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(' + +308 Permanent Redirect + +

Permanent Redirect

+

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:
'; $title = getconstStr('SelectLanguage'); return message($html, $title, 201); } - $html .= ''.getconstStr('ClickInstall').', '.getconstStr('LogintoBind'); + $title = 'Install'; + $html = '' . getconstStr('ClickInstall') . ', ' . getconstStr('LogintoBind'); return message($html, $title, 201); } diff --git a/platform/TencentSCF_env.php b/platform/TencentSCF_env.php index 6210d6b..c8084ae 100644 --- a/platform/TencentSCF_env.php +++ b/platform/TencentSCF_env.php @@ -41,8 +41,6 @@ function GetPathSetting($event, $context) $_SERVER['base_path'] = $event['requestContext']['path']; $path = substr($event['path'], strlen($event['requestContext']['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/TencentSCF_file.php b/platform/TencentSCF_file.php index 27acaa1..78e8600 100644 --- a/platform/TencentSCF_file.php +++ b/platform/TencentSCF_file.php @@ -41,8 +41,6 @@ function GetPathSetting($event, $context) $_SERVER['base_path'] = $event['requestContext']['path']; $path = substr($event['path'], strlen($event['requestContext']['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/readme.md b/readme.md index 193d7d1..3f12e7d 100644 --- a/readme.md +++ b/readme.md @@ -2,7 +2,7 @@ # NOTICE: - The release is used as archive. + The Releases is used as archive, not newest code. Please read the descriptions of settings before raising an issue. diff --git a/readme_cn.md b/readme_cn.md index 5363588..5d45aaf 100644 --- a/readme_cn.md +++ b/readme_cn.md @@ -2,7 +2,7 @@ # 注意: - release只是当存档用的。 + Releases只是当存档在用的,并不是最新代码。 请将设置中所有的设置项的说明都读一遍,有些问题就不用问了。 @@ -132,7 +132,7 @@ 1. 新建函数 -- HTTP函数 2. 运行环境选择php7.2 3. 触发器认证方式选择anonymous,请求方式里面,点一下GET,再点一下POST,最终框框里面有这2个 -4. 上传代码 +4. 上传代码(这里的ZIP文件不能直接用从Github上下载的ZIP文件,要将它解压后,去掉外层文件夹后,再压缩为ZIP。) 5. 触发器中点进去,找到配置自定义域名,点击前往,创建,路径中填 /* ,其它下拉选择。 6. 访问你的域名,开始安装 diff --git a/theme/classic.html b/theme/classic.html index c3919a1..17b04a9 100644 --- a/theme/classic.html +++ b/theme/classic.html @@ -229,7 +229,7 @@
- +     @@ -1477,17 +1477,18 @@ document.getElementById('mask').style.display=''; //document.getElementById('mask').style.width=document.documentElement.scrollWidth+'px'; document.getElementById('mask').style.height=document.documentElement.scrollHeight-1) str=str.substr(str.lastIndexOf('/')+1); - var fileid=document.getElementById('file_a'+num).attributes['fileid'].nodeValue; } + var fileid = document.getElementById('file_a'+num).attributes['fileid'].nodeValue; document.getElementById(action + '_div').style.display=''; document.getElementById(action + '_label').innerText=str;//.replace(/&/,'&'); document.getElementById(action + '_sid').value=num;