diff --git a/common.php b/common.php index 2abb476..a2723a1 100644 --- a/common.php +++ b/common.php @@ -256,6 +256,8 @@ function main($path) // echo 'main.disktag:'.$_SERVER['disktag'].',path:'.$path.''; $_SERVER['list_path'] = getListpath($_SERVER['HTTP_HOST']); if ($_SERVER['list_path']=='') $_SERVER['list_path'] = '/'; + $path1 = path_format($_SERVER['list_path'] . path_format($path)); + if ($path1!='/' && substr($path1,-1)=='/') $path1 = substr($path1, 0, -1); $_SERVER['is_guestup_path'] = is_guestup_path($path); $_SERVER['ajax']=0; if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) if ($_SERVER['HTTP_X_REQUESTED_WITH']=='XMLHttpRequest') $_SERVER['ajax']=1; @@ -308,8 +310,6 @@ function main($path) if (strpos($_GET['upbigfilename'], '../')!==false) return output('Not_Allow_Cross_Path', 400); if (strpos($_POST['upbigfilename'], '../')!==false) return output('Not_Allow_Cross_Path', 400); } - $path1 = path_format($_SERVER['list_path'] . path_format($path)); - if (substr($path1, -1)=='/') $path1=substr($path1, 0, -1); return $drive->bigfileupload($path1); } } @@ -317,8 +317,6 @@ function main($path) if ($_SERVER['admin']) { $tmp = adminoperate($path); if ($tmp['statusCode'] > 0) { - $path1 = path_format($_SERVER['list_path'] . path_format($path)); - if ($path1!='/'&&substr($path1,-1)=='/') $path1 = substr($path1, 0, -1); savecache('path_' . $path1, '', $_SERVER['disktag'], 1); return $tmp; } @@ -329,8 +327,6 @@ function main($path) if (isset($_GET['thumbnails'])) { if ($_SERVER['ishidden']<4) { if (in_array(strtolower(substr($path, strrpos($path, '.') + 1)), $exts['img'])) { - $path1 = path_format($_SERVER['list_path'] . path_format($path)); - if ($path1!='/'&&substr($path1, -1)=='/') $path1=substr($path1, 0, -1); $thumb_url = $drive->get_thumbnails_url($path1); if ($thumb_url!='') { if ($_GET['location']) { @@ -356,16 +352,22 @@ function main($path) if (!getConfig('downloadencrypt', $_SERVER['disktag'])) { $files = json_decode('{"type":"folder"}', true); } else { - $path1 = path_format($_SERVER['list_path'] . path_format($path)); - if ($path1!='/'&&substr($path1,-1)=='/') $path1=substr($path1, 0, -1); $files = $drive->list_files($path1); if ($files['type']=='folder') $files = json_decode('{"type":"folder"}', true); } } else { - $path1 = path_format($_SERVER['list_path'] . path_format($path)); - if ($path1!='/'&&substr($path1,-1)=='/') $path1=substr($path1, 0, -1); $files = $drive->list_files($path1); } + if ($path!=='') if ( $files['type']=='folder' && substr($path, -1)!=='/' ) { + $tmp = path_format($_SERVER['base_disk_path'] . $path . '/'); + return output(' +
+The document has moved here.
+', 308, [ 'Location' => $tmp ]); + } if ($_GET['json']) { // return a json @@ -2394,6 +2396,7 @@ function render_list($path = '', $files = []) $html = str_replace('', '', $html); } $html = str_replace('', getconstStr('File'), $html); + while (strpos($html, '')) $html = str_replace('', $files['id'], $html); $html = str_replace('', getconstStr('ShowThumbnails'), $html); $html = str_replace('', getconstStr('CopyAllDownloadUrl'), $html); $html = str_replace('', getconstStr('EditTime'), $html); diff --git a/disk/Aliyundrive.php b/disk/Aliyundrive.php index 795fd59..6dd2875 100644 --- a/disk/Aliyundrive.php +++ b/disk/Aliyundrive.php @@ -194,8 +194,8 @@ class Aliyundrive { $data['image_url_process'] = 'image/resize,w_1920/format,jpeg'; $data['video_thumbnail_process'] = 'video/snapshot,t_0,f_jpg,w_300'; $data['fields'] = '*'; - $data['order_by'] = 'updated_at'; - $data['order_direction'] = 'DESC'; + $data['order_by'] = 'name'; //updated_at + $data['order_direction'] = 'ASC'; //DESC $res = curl('POST', $url, json_encode($data), $header); //error_log1($res['stat'] . $res['body']); diff --git a/index.php b/index.php index 56fecf2..a06dc76 100644 --- a/index.php +++ b/index.php @@ -49,6 +49,9 @@ if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') { else echo $re['body']; } else { include 'platform/Normal.php'; + if (!function_exists('curl_init')) { + return message('Need curl, please install php-curl.', 'Error', 500); + } $path = getpath(); //echo 'path:'. $path; $_GET = getGET(); diff --git a/platform/AliyunFC.php b/platform/AliyunFC.php index 09c5f49..2618d89 100644 --- a/platform/AliyunFC.php +++ b/platform/AliyunFC.php @@ -54,9 +54,6 @@ function GetPathSetting($event, $context) //$_SERVER['base_path'] = substr($tmp, 0, strlen(urldecode($event['path']))); } $_SERVER['base_path'] = spurlencode($_SERVER['base_path'], '/'); - - if (substr($path,-1)=='/') $path=substr($path,0,-1); - $_SERVER['is_guestup_path'] = is_guestup_path($path); //$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path); $_SERVER['REMOTE_ADDR'] = $event['clientIP']; $_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['X-Requested-With'][0]; diff --git a/platform/BaiduCFC.php b/platform/BaiduCFC.php index c8ba09e..f2b21e6 100644 --- a/platform/BaiduCFC.php +++ b/platform/BaiduCFC.php @@ -34,8 +34,6 @@ function GetPathSetting($event, $context) $_SERVER['functionBrn'] = $context['functionBrn']; $_SERVER['base_path'] = '/'; $path = $event['path']; - if (substr($path,-1)=='/') $path=substr($path,0,-1); - $_SERVER['is_guestup_path'] = is_guestup_path($path); //$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path); $_SERVER['REMOTE_ADDR'] = $event['requestContext']['sourceIp']; $_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['X-Requested-With']; diff --git a/platform/HuaweiFG_env.php b/platform/HuaweiFG_env.php index d65ae59..d3cebd9 100644 --- a/platform/HuaweiFG_env.php +++ b/platform/HuaweiFG_env.php @@ -57,8 +57,6 @@ function GetPathSetting($event, $context) $_SERVER['base_path'] = substr($_SERVER['base_path'], 0, -strlen($path)); if ($_SERVER['base_path']=='') $_SERVER['base_path'] = '/'; } - if (substr($path,-1)=='/') $path=substr($path,0,-1); - $_SERVER['is_guestup_path'] = is_guestup_path($path); //$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path); $_SERVER['REMOTE_ADDR'] = $event['headers']['x-real-ip']; $_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['x-requested-with']; diff --git a/platform/HuaweiFG_file.php b/platform/HuaweiFG_file.php index 38422fa..64e6199 100644 --- a/platform/HuaweiFG_file.php +++ b/platform/HuaweiFG_file.php @@ -57,8 +57,6 @@ function GetPathSetting($event, $context) $_SERVER['base_path'] = substr($_SERVER['base_path'], 0, -strlen($path)); if ($_SERVER['base_path']=='') $_SERVER['base_path'] = '/'; } - if (substr($path,-1)=='/') $path=substr($path,0,-1); - $_SERVER['is_guestup_path'] = is_guestup_path($path); //$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path); $_SERVER['REMOTE_ADDR'] = $event['headers']['x-real-ip']; $_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['x-requested-with']; diff --git a/platform/Normal.php b/platform/Normal.php index 2e7782b..5002b19 100644 --- a/platform/Normal.php +++ b/platform/Normal.php @@ -278,8 +278,9 @@ language: