diff --git a/common.php b/common.php index 994e00f..8f21c8f 100644 --- a/common.php +++ b/common.php @@ -2310,7 +2310,8 @@ function render_list($path = '', $files = []) $html = str_replace('', '', $html); $html = str_replace('', '', $html); } - $html = str_replace('', encode_str_replace(path_format($_SERVER['base_disk_path'] . '/' . $path)), $html); + //$html = str_replace('', encode_str_replace(path_format($_SERVER['base_disk_path'] . '/' . $path)), $html); + $html = str_replace('', encode_str_replace(splitlast($path, '/')[1]), $html); $html = str_replace('', (path_format($_SERVER['base_disk_path'] . '/' . $path)), $html); $ext = strtolower(substr($path, strrpos($path, '.') + 1)); @@ -2338,17 +2339,22 @@ function render_list($path = '', $files = []) $html = str_replace('', '', $html); } //while (strpos($html, '')) $html = str_replace('', $files['url'], $html); - while (strpos($html, '')) $html = str_replace('', (path_format($_SERVER['base_disk_path'] . '/' . $path)), $html); + //while (strpos($html, '')) $html = str_replace('', (path_format($_SERVER['base_disk_path'] . '/' . $path)), $html); + while (strpos($html, '')) $html = str_replace('', encode_str_replace(splitlast($path, '/')[1]), $html); //echo $path . "
\n"; - while (strpos($html, '')) $html = str_replace('', (path_format($_SERVER['base_disk_path'] . '/' . str_replace('&', '&', $path))), $html); + //while (strpos($html, '')) $html = str_replace('', (path_format($_SERVER['base_disk_path'] . '/' . str_replace('&', '&', $path))), $html); + while (strpos($html, '')) $html = str_replace('', encode_str_replace(splitlast($path, '/')[1]), $html); while (strpos($html, '')) $html = str_replace('', $files['name'], $html); while (strpos($html, '')) $html = str_replace('', urlencode($files['url']), $html); //while (strpos($html, '')) $html = str_replace('', urlencode($_SERVER['host'] . path_format($_SERVER['base_disk_path'] . '/' . $path)), $html); $html = str_replace('', getconstStr('ClicktoEdit'), $html); $html = str_replace('', getconstStr('CancelEdit'), $html); $html = str_replace('', getconstStr('Save'), $html); - //while (strpos($html, '')) $html = str_replace('', htmlspecialchars(curl('GET', $files['url'], '', [], 0, 1)['body']), $html); - while (strpos($html, '')) $html = str_replace('', htmlspecialchars(get_content(spurlencode(path_format(urldecode($path)), '/'))['content']['body']), $html); + if (strpos($html, '')) { + $tmp_content = get_content(spurlencode(path_format(urldecode($path)), '/'))['content']['body']; + if (strlen($tmp_content)==$files['size']) $html = str_replace('', htmlspecialchars($tmp_content), $html); + else $html = str_replace('', $files['size']<1024*1024?htmlspecialchars(curl('GET', $files['url'], '', [], 0, 1)['body']):"File too large: " . $files['size'] . " B.", $html); + } $html = str_replace('', getconstStr('FileNotSupport'), $html); //$html = str_replace('', getconstStr('File'), $html); @@ -2390,7 +2396,8 @@ function render_list($path = '', $files = []) if ($file['type']=='folder') { if ($_SERVER['admin'] or !isHideFile($file['name'])) { $filenum++; - $FolderListStr = str_replace('', encode_str_replace(path_format($_SERVER['base_disk_path'] . '/' . str_replace('&', '&', $path) . '/' . $file['name'])), $FolderList); + //$FolderListStr = str_replace('', encode_str_replace(path_format($_SERVER['base_disk_path'] . '/' . str_replace('&', '&', $path) . '/' . $file['name'])), $FolderList); + $FolderListStr = str_replace('', encode_str_replace($file['name']), $FolderList); $FolderListStr = str_replace('', $file['id'], $FolderListStr); $FolderListStr = str_replace('', str_replace('&','&', $file['showname']?$file['showname']:$file['name']), $FolderListStr); $FolderListStr = str_replace('', time_format($file['time']), $FolderListStr); @@ -2412,7 +2419,8 @@ function render_list($path = '', $files = []) $filenum++; $ext = strtolower(substr($file['name'], strrpos($file['name'], '.') + 1)); $FolderListStr = $FolderList; - while (strpos($FolderListStr, '')) $FolderListStr = str_replace('', encode_str_replace(path_format($_SERVER['base_disk_path'] . '/' . str_replace('&', '&', $path) . '/' . $file['name'])), $FolderListStr); + //while (strpos($FolderListStr, '')) $FolderListStr = str_replace('', encode_str_replace(path_format($_SERVER['base_disk_path'] . '/' . str_replace('&', '&', $path) . '/' . $file['name'])), $FolderListStr); + while (strpos($FolderListStr, '')) $FolderListStr = str_replace('', encode_str_replace($file['name']), $FolderListStr); $FolderListStr = str_replace('', $ext, $FolderListStr); if (in_array($ext, $exts['music'])) $FolderListStr = str_replace('', 'audio', $FolderListStr); elseif (in_array($ext, $exts['video'])) $FolderListStr = str_replace('', 'iframe', $FolderListStr); @@ -2599,7 +2607,7 @@ function render_list($path = '', $files = []) if ($folder1!='') { $tmp_url .= $folder1 . '/'; $PathArrayStr1 = str_replace('', encode_str_replace($folder1==$files['name']?'':$tmp_url), $PathArrayStr); - $PathArrayStr1 = str_replace('', $folder1, $PathArrayStr1); + $PathArrayStr1 = str_replace('', str_replace('&', '&', $folder1), $PathArrayStr1); $html .= $PathArrayStr1; } $tmp_path = $tmp1[1]; @@ -2620,7 +2628,7 @@ function render_list($path = '', $files = []) if ($folder1!='') { $tmp_url .= $folder1 . '/'; $PathArrayStr1 = str_replace('', encode_str_replace($folder1==$files['name']?'':$tmp_url), $PathArrayStr); - $PathArrayStr1 = str_replace('', ($folder1==$_SERVER['disktag']?(getConfig('diskname')==''?$_SERVER['disktag']:getConfig('diskname')):$folder1), $PathArrayStr1); + $PathArrayStr1 = str_replace('', str_replace('&', '&', $folder1==$_SERVER['disktag']?(getConfig('diskname')==''?$_SERVER['disktag']:getConfig('diskname')):$folder1), $PathArrayStr1); $html .= $PathArrayStr1; } $tmp_path = $tmp1[1];