merge
						commit
						0ea79568bd
					
				| 
						 | 
					@ -0,0 +1,3 @@
 | 
				
			||||||
 | 
					language = "php74"
 | 
				
			||||||
 | 
					run = "php -S 0.0.0.0:8000 index.php"
 | 
				
			||||||
 | 
					entrypoint = "index.php"
 | 
				
			||||||
							
								
								
									
										418
									
								
								common.php
								
								
								
								
							
							
						
						
									
										418
									
								
								common.php
								
								
								
								
							| 
						 | 
					@ -21,7 +21,7 @@ $EnvConfigs = [
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    'admin'             => 0b000,
 | 
					    'admin'             => 0b000,
 | 
				
			||||||
    'adminloginpage'    => 0b010,
 | 
					    'adminloginpage'    => 0b010,
 | 
				
			||||||
    'autoJumpFirstDisk' => 0b010,
 | 
					    //'autoJumpFirstDisk' => 0b010,
 | 
				
			||||||
    'background'        => 0b011,
 | 
					    'background'        => 0b011,
 | 
				
			||||||
    'backgroundm'       => 0b011,
 | 
					    'backgroundm'       => 0b011,
 | 
				
			||||||
    'disableShowThumb'  => 0b010,
 | 
					    'disableShowThumb'  => 0b010,
 | 
				
			||||||
| 
						 | 
					@ -38,6 +38,10 @@ $EnvConfigs = [
 | 
				
			||||||
    'useBasicAuth'      => 0b010,
 | 
					    'useBasicAuth'      => 0b010,
 | 
				
			||||||
    'referrer'          => 0b011,
 | 
					    'referrer'          => 0b011,
 | 
				
			||||||
    'forceHttps'        => 0b010,
 | 
					    'forceHttps'        => 0b010,
 | 
				
			||||||
 | 
					    'globalHeadOmfUrl'  => 0b011,
 | 
				
			||||||
 | 
					    'globalHeadMdUrl'   => 0b011,
 | 
				
			||||||
 | 
					    'globalReadmeMdUrl' => 0b011,
 | 
				
			||||||
 | 
					    'globalFootOmfUrl'  => 0b011,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    'Driver'            => 0b100,
 | 
					    'Driver'            => 0b100,
 | 
				
			||||||
    'client_id'         => 0b100,
 | 
					    'client_id'         => 0b100,
 | 
				
			||||||
| 
						 | 
					@ -137,6 +141,7 @@ function main($path)
 | 
				
			||||||
    $_SERVER['php_starttime'] = microtime(true);
 | 
					    $_SERVER['php_starttime'] = microtime(true);
 | 
				
			||||||
    $path = path_format($path);
 | 
					    $path = path_format($path);
 | 
				
			||||||
    $_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
 | 
					    $_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
 | 
				
			||||||
 | 
					    $_SERVER['base_disk_path'] = $_SERVER['base_path'];
 | 
				
			||||||
    if (getConfig('forceHttps')&&$_SERVER['REQUEST_SCHEME']=='http') {
 | 
					    if (getConfig('forceHttps')&&$_SERVER['REQUEST_SCHEME']=='http') {
 | 
				
			||||||
        if ($_GET) {
 | 
					        if ($_GET) {
 | 
				
			||||||
            $tmp = '';
 | 
					            $tmp = '';
 | 
				
			||||||
| 
						 | 
					@ -166,14 +171,23 @@ function main($path)
 | 
				
			||||||
    $_SERVER['timezone'] = getConfig('timezone');
 | 
					    $_SERVER['timezone'] = getConfig('timezone');
 | 
				
			||||||
    if (isset($_COOKIE['timezone'])&&$_COOKIE['timezone']!='') $_SERVER['timezone'] = $_COOKIE['timezone'];
 | 
					    if (isset($_COOKIE['timezone'])&&$_COOKIE['timezone']!='') $_SERVER['timezone'] = $_COOKIE['timezone'];
 | 
				
			||||||
    if ($_SERVER['timezone']=='') $_SERVER['timezone'] = 0;
 | 
					    if ($_SERVER['timezone']=='') $_SERVER['timezone'] = 0;
 | 
				
			||||||
 | 
					    $_SERVER['sitename'] = getConfig('sitename');
 | 
				
			||||||
 | 
					    if (empty($_SERVER['sitename'])) $_SERVER['sitename'] = getconstStr('defaultSitename');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (isset($_GET['WaitFunction'])) {
 | 
				
			||||||
 | 
					        $response = WaitFunction($_GET['WaitFunction']);
 | 
				
			||||||
 | 
					        //var_dump($response);
 | 
				
			||||||
 | 
					        if ($response===true) return output("ok", 200);
 | 
				
			||||||
 | 
					        elseif ($response===false) return output("", 206);
 | 
				
			||||||
 | 
					        else return $response;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    if (getConfig('admin')=='') return install();
 | 
					    if (getConfig('admin')=='') return install();
 | 
				
			||||||
    if (getConfig('adminloginpage')=='') {
 | 
					    if (getConfig('adminloginpage')=='') {
 | 
				
			||||||
        $adminloginpage = 'admin';
 | 
					        $adminloginpage = 'admin';
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        $adminloginpage = getConfig('adminloginpage');
 | 
					        $adminloginpage = getConfig('adminloginpage');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (isset($_GET[$adminloginpage])) {
 | 
					    if (isset($_GET['login'])&&$_GET['login']==$adminloginpage) {
 | 
				
			||||||
        /*if (isset($_GET['preview'])) {
 | 
					        /*if (isset($_GET['preview'])) {
 | 
				
			||||||
            $url = $_SERVER['PHP_SELF'] . '?preview';
 | 
					            $url = $_SERVER['PHP_SELF'] . '?preview';
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
| 
						 | 
					@ -204,63 +218,6 @@ function main($path)
 | 
				
			||||||
            $url = path_format($_SERVER['PHP_SELF'] . '/');
 | 
					            $url = path_format($_SERVER['PHP_SELF'] . '/');
 | 
				
			||||||
            return output('<script>alert(\''.getconstStr('SetSecretsFirst').'\');</script>', 302, [ 'Location' => $url ]);
 | 
					            return output('<script>alert(\''.getconstStr('SetSecretsFirst').'\');</script>', 302, [ 'Location' => $url ]);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    if (isset($_GET['WaitFunction'])) {
 | 
					 | 
				
			||||||
        $response = WaitFunction($_GET['WaitFunction']);
 | 
					 | 
				
			||||||
        //var_dump($response);
 | 
					 | 
				
			||||||
        if ($response===true) return output("ok", 200);
 | 
					 | 
				
			||||||
        elseif ($response===false) return output("", 206);
 | 
					 | 
				
			||||||
        else return $response;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    $_SERVER['sitename'] = getConfig('sitename');
 | 
					 | 
				
			||||||
    if (empty($_SERVER['sitename'])) $_SERVER['sitename'] = getconstStr('defaultSitename');
 | 
					 | 
				
			||||||
    $_SERVER['base_disk_path'] = $_SERVER['base_path'];
 | 
					 | 
				
			||||||
    $disktags = explode("|", getConfig('disktag'));
 | 
					 | 
				
			||||||
    //    echo 'count$disk:'.count($disktags);
 | 
					 | 
				
			||||||
    if (count($disktags)>1) {
 | 
					 | 
				
			||||||
        if ($path=='/'||$path=='') {
 | 
					 | 
				
			||||||
            $files['type'] = 'folder';
 | 
					 | 
				
			||||||
            $files['childcount'] = count($disktags);
 | 
					 | 
				
			||||||
            $files['showname'] = 'root';
 | 
					 | 
				
			||||||
            foreach ($disktags as $disktag) {
 | 
					 | 
				
			||||||
                $files['list'][$disktag]['type'] = 'folder';
 | 
					 | 
				
			||||||
                $files['list'][$disktag]['name'] = $disktag;
 | 
					 | 
				
			||||||
                $files['list'][$disktag]['showname'] = getConfig('diskname', $disktag);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            if ($_GET['json']) {
 | 
					 | 
				
			||||||
                // return a json
 | 
					 | 
				
			||||||
                return output(json_encode($files), 200, ['Content-Type' => 'application/json']);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            if (getConfig('autoJumpFirstDisk')) return output('', 302, [ 'Location' => path_format($_SERVER['base_path'].'/'.$disktags[0].'/') ]);
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            $_SERVER['disktag'] = splitfirst( substr(path_format($path), 1), '/' )[0];
 | 
					 | 
				
			||||||
            //$pos = strpos($path, '/');
 | 
					 | 
				
			||||||
            //if ($pos>1) $_SERVER['disktag'] = substr($path, 0, $pos);
 | 
					 | 
				
			||||||
            if (!in_array($_SERVER['disktag'], $disktags)) {
 | 
					 | 
				
			||||||
                $tmp = path_format($_SERVER['base_path'] . '/' . $disktags[0] . '/' . $path);
 | 
					 | 
				
			||||||
                if (!!$_GET) {
 | 
					 | 
				
			||||||
                    $tmp .= '?';
 | 
					 | 
				
			||||||
                    foreach ($_GET as $k => $v) {
 | 
					 | 
				
			||||||
                        if ($v === true) $tmp .= $k . '&';
 | 
					 | 
				
			||||||
                        else $tmp .= $k . '=' . $v . '&';
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                    $tmp = substr($tmp, 0, -1);
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                return output('Please visit <a href="' . $tmp . '">' . $tmp . '</a>.', 302, [ 'Location' => $tmp ]);
 | 
					 | 
				
			||||||
                //return message('<meta http-equiv="refresh" content="2;URL='.$_SERVER['base_path'].'">Please visit from <a href="'.$_SERVER['base_path'].'">Home Page</a>.', 'Error', 404);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            $path = substr($path, strlen('/' . $_SERVER['disktag']));
 | 
					 | 
				
			||||||
            if ($_SERVER['disktag']!='') $_SERVER['base_disk_path'] = path_format($_SERVER['base_disk_path'] . '/' . $_SERVER['disktag'] . '/');
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    } else $_SERVER['disktag'] = $disktags[0];
 | 
					 | 
				
			||||||
    //    echo 'main.disktag:'.$_SERVER['disktag'].',path:'.$path.'';
 | 
					 | 
				
			||||||
    $_SERVER['list_path'] = getListpath($_SERVER['HTTP_HOST']);
 | 
					 | 
				
			||||||
    if ($_SERVER['list_path']=='') $_SERVER['list_path'] = '/';
 | 
					 | 
				
			||||||
    $path1 = path_format($_SERVER['list_path'] . path_format($path));
 | 
					 | 
				
			||||||
    if ($path1!='/' && substr($path1,-1)=='/') $path1 = substr($path1, 0, -1);
 | 
					 | 
				
			||||||
    $_SERVER['is_guestup_path'] = is_guestup_path($path);
 | 
					 | 
				
			||||||
    $_SERVER['ajax']=0;
 | 
					 | 
				
			||||||
    if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) if ($_SERVER['HTTP_X_REQUESTED_WITH']=='XMLHttpRequest') $_SERVER['ajax']=1;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Add disk
 | 
					    // Add disk
 | 
				
			||||||
    if (isset($_GET['AddDisk'])) {
 | 
					    if (isset($_GET['AddDisk'])) {
 | 
				
			||||||
| 
						 | 
					@ -269,6 +226,7 @@ function main($path)
 | 
				
			||||||
            return output('Please visit <a href="' . $tmp . '">' . $tmp . '</a>.', 301, [ 'Location' => $tmp ]);
 | 
					            return output('Please visit <a href="' . $tmp . '">' . $tmp . '</a>.', 301, [ 'Location' => $tmp ]);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if ($_SERVER['admin']) {
 | 
					        if ($_SERVER['admin']) {
 | 
				
			||||||
 | 
					            if (!$_SERVER['disktag']) $_SERVER['disktag'] = '';
 | 
				
			||||||
            if (!class_exists($_GET['AddDisk'])) require 'disk' . $slash . $_GET['AddDisk'] . '.php';
 | 
					            if (!class_exists($_GET['AddDisk'])) require 'disk' . $slash . $_GET['AddDisk'] . '.php';
 | 
				
			||||||
            $drive = new $_GET['AddDisk']($_GET['disktag']);
 | 
					            $drive = new $_GET['AddDisk']($_GET['disktag']);
 | 
				
			||||||
            return $drive->AddDisk();
 | 
					            return $drive->AddDisk();
 | 
				
			||||||
| 
						 | 
					@ -291,20 +249,67 @@ function main($path)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    $disktags = explode("|", getConfig('disktag'));
 | 
				
			||||||
 | 
					    //    echo 'count$disk:'.count($disktags);
 | 
				
			||||||
 | 
					    if (count($disktags)>1) {
 | 
				
			||||||
 | 
					        if ($path=='/'||$path=='') {
 | 
				
			||||||
 | 
					            $files['type'] = 'folder';
 | 
				
			||||||
 | 
					            $files['childcount'] = count($disktags);
 | 
				
			||||||
 | 
					            $files['showname'] = 'root';
 | 
				
			||||||
 | 
					            foreach ($disktags as $disktag) {
 | 
				
			||||||
 | 
					                $files['list'][$disktag]['type'] = 'folder';
 | 
				
			||||||
 | 
					                $files['list'][$disktag]['name'] = $disktag;
 | 
				
			||||||
 | 
					                $files['list'][$disktag]['showname'] = getConfig('diskname', $disktag);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if ($_GET['json']) {
 | 
				
			||||||
 | 
					                // return a json
 | 
				
			||||||
 | 
					                return output(json_encode($files), 200, ['Content-Type' => 'application/json']);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            //if (getConfig('autoJumpFirstDisk')) return output('', 302, [ 'Location' => path_format($_SERVER['base_path'].'/'.$disktags[0].'/') ]);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $_SERVER['disktag'] = splitfirst( substr(path_format($path), 1), '/' )[0];
 | 
				
			||||||
 | 
					            //$pos = strpos($path, '/');
 | 
				
			||||||
 | 
					            //if ($pos>1) $_SERVER['disktag'] = substr($path, 0, $pos);
 | 
				
			||||||
 | 
					            if (!in_array($_SERVER['disktag'], $disktags)) {
 | 
				
			||||||
 | 
					                $tmp = path_format($_SERVER['base_path'] . '/' . $disktags[0] . '/' . $path);
 | 
				
			||||||
 | 
					                if (!!$_GET) {
 | 
				
			||||||
 | 
					                    $tmp .= '?';
 | 
				
			||||||
 | 
					                    foreach ($_GET as $k => $v) {
 | 
				
			||||||
 | 
					                        if ($v === true) $tmp .= $k . '&';
 | 
				
			||||||
 | 
					                        else $tmp .= $k . '=' . $v . '&';
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    $tmp = substr($tmp, 0, -1);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                return output('Please visit <a href="' . $tmp . '">' . $tmp . '</a>.', 302, [ 'Location' => $tmp ]);
 | 
				
			||||||
 | 
					                //return message('<meta http-equiv="refresh" content="2;URL='.$_SERVER['base_path'].'">Please visit from <a href="'.$_SERVER['base_path'].'">Home Page</a>.', 'Error', 404);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            //$path = substr($path, strlen('/' . $_SERVER['disktag']));
 | 
				
			||||||
 | 
					            $path = splitfirst($path, $_SERVER['disktag'])[1];
 | 
				
			||||||
 | 
					            if ($_SERVER['disktag']!='') $_SERVER['base_disk_path'] = path_format($_SERVER['base_disk_path'] . '/' . $_SERVER['disktag'] . '/');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    } else $_SERVER['disktag'] = $disktags[0];
 | 
				
			||||||
 | 
					    //    echo 'main.disktag:'.$_SERVER['disktag'].',path:'.$path.'';
 | 
				
			||||||
 | 
					    $_SERVER['list_path'] = getListpath($_SERVER['HTTP_HOST']);
 | 
				
			||||||
 | 
					    if ($_SERVER['list_path']=='') $_SERVER['list_path'] = '/';
 | 
				
			||||||
 | 
					    $path1 = path_format($_SERVER['list_path'] . path_format($path));
 | 
				
			||||||
 | 
					    if ($path1!='/' && substr($path1,-1)=='/') $path1 = substr($path1, 0, -1);
 | 
				
			||||||
 | 
					    $_SERVER['is_guestup_path'] = is_guestup_path($path);
 | 
				
			||||||
 | 
					    $_SERVER['ajax']=0;
 | 
				
			||||||
 | 
					    if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) if ($_SERVER['HTTP_X_REQUESTED_WITH']=='XMLHttpRequest') $_SERVER['ajax']=1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!isreferhost()) return message('Must visit from designated host', 'NOT_ALLOWED', 403);
 | 
					    if (!isreferhost()) return message('Must visit from designated host', 'NOT_ALLOWED', 403);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Show disks in root
 | 
					 | 
				
			||||||
    if ($files['showname'] == 'root') return render_list($path, $files);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (!driveisfine($_SERVER['disktag'], $drive)) return render_list();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Operate
 | 
					    // Operate
 | 
				
			||||||
    if ($_SERVER['ajax']) {
 | 
					    if ($_SERVER['ajax']) {
 | 
				
			||||||
 | 
					        //error_log1($_SERVER['REQUEST_METHOD']);
 | 
				
			||||||
        if ($_GET['action']=='del_upload_cache') {
 | 
					        if ($_GET['action']=='del_upload_cache') {
 | 
				
			||||||
            // del '.tmp' without login. 无需登录即可删除.tmp后缀文件
 | 
					            // del '.tmp' without login. 无需登录即可删除.tmp后缀文件
 | 
				
			||||||
 | 
					            if (!driveisfine($_SERVER['disktag'], $drive)) return output('Not in drive, or disk [' . $_SERVER['disktag'] . '] error.', 403);
 | 
				
			||||||
 | 
					            savecache('path_' . $path1, '', $_SERVER['disktag'], 1); // clear cache.
 | 
				
			||||||
            return $drive->del_upload_cache($path);
 | 
					            return $drive->del_upload_cache($path);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if ($_GET['action']=='upbigfile') {
 | 
					        if ($_GET['action']=='upbigfile') {
 | 
				
			||||||
 | 
					            if (!driveisfine($_SERVER['disktag'], $drive)) return output('Not in drive, or disk [' . $_SERVER['disktag'] . '] error.', 403);
 | 
				
			||||||
            if (!$_SERVER['admin']) {
 | 
					            if (!$_SERVER['admin']) {
 | 
				
			||||||
                if (!$_SERVER['is_guestup_path']) return output('Not_Guest_Upload_Folder', 400);
 | 
					                if (!$_SERVER['is_guestup_path']) return output('Not_Guest_Upload_Folder', 400);
 | 
				
			||||||
                if (strpos($_GET['upbigfilename'], '../')!==false) return output('Not_Allow_Cross_Path', 400);
 | 
					                if (strpos($_GET['upbigfilename'], '../')!==false) return output('Not_Allow_Cross_Path', 400);
 | 
				
			||||||
| 
						 | 
					@ -323,6 +328,12 @@ function main($path)
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        if ($_SERVER['ajax']) return output(getconstStr('RefreshtoLogin'),401);
 | 
					        if ($_SERVER['ajax']) return output(getconstStr('RefreshtoLogin'),401);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Show disks in root
 | 
				
			||||||
 | 
					    if ($files['showname'] == 'root') return render_list($path, $files);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (!driveisfine($_SERVER['disktag'], $drive)) return render_list();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $_SERVER['ishidden'] = passhidden($path);
 | 
					    $_SERVER['ishidden'] = passhidden($path);
 | 
				
			||||||
    if (isset($_GET['thumbnails'])) {
 | 
					    if (isset($_GET['thumbnails'])) {
 | 
				
			||||||
        if ($_SERVER['ishidden']<4) {
 | 
					        if ($_SERVER['ishidden']<4) {
 | 
				
			||||||
| 
						 | 
					@ -350,7 +361,7 @@ function main($path)
 | 
				
			||||||
        $files = json_decode('{"type":"folder"}', true);
 | 
					        $files = json_decode('{"type":"folder"}', true);
 | 
				
			||||||
    } elseif ($_SERVER['ishidden']==4) {
 | 
					    } elseif ($_SERVER['ishidden']==4) {
 | 
				
			||||||
        if (!getConfig('downloadencrypt', $_SERVER['disktag'])) {
 | 
					        if (!getConfig('downloadencrypt', $_SERVER['disktag'])) {
 | 
				
			||||||
            $files = json_decode('{"type":"folder"}', true);
 | 
					            $files = json_decode('{"type":"file"}', true);
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            $files = $drive->list_files($path1);
 | 
					            $files = $drive->list_files($path1);
 | 
				
			||||||
            if ($files['type']=='folder') $files = json_decode('{"type":"folder"}', true);
 | 
					            if ($files['type']=='folder') $files = json_decode('{"type":"folder"}', true);
 | 
				
			||||||
| 
						 | 
					@ -358,7 +369,8 @@ function main($path)
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        $files = $drive->list_files($path1);
 | 
					        $files = $drive->list_files($path1);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if ($path!=='') if ( $files['type']=='folder' && substr($path, -1)!=='/' ) {
 | 
					    //if ($path!=='') 
 | 
				
			||||||
 | 
					    if ( $files['type']=='folder' && substr($path, -1)!=='/' ) {
 | 
				
			||||||
        $tmp = path_format($_SERVER['base_disk_path'] . $path . '/');
 | 
					        $tmp = path_format($_SERVER['base_disk_path'] . $path . '/');
 | 
				
			||||||
        return output('<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 | 
					        return output('<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 | 
				
			||||||
<html><head>
 | 
					<html><head>
 | 
				
			||||||
| 
						 | 
					@ -552,7 +564,7 @@ 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');
 | 
				
			||||||
        return 'The timestamp in server is ' . time() . ' (' . date("Y-m-d H:i:s") . ' UTC),<br>and your posted timestamp is ' . $timestamp . ' (' . date("Y-m-d H:i:s", $timestamp) . ' UTC)';
 | 
					        return 'The time in server is ' . time() . ' (' . date("Y-m-d H:i:s") . ' UTC),<br>and your time is ' . $timestamp . ' (' . date("Y-m-d H:i:s", $timestamp) . ' UTC)';
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if ($adminsha1 == sha1($timestamp . $pass)) return '';
 | 
					    if ($adminsha1 == sha1($timestamp . $pass)) return '';
 | 
				
			||||||
    else return 'Error password';
 | 
					    else return 'Error password';
 | 
				
			||||||
| 
						 | 
					@ -618,7 +630,7 @@ function filecache($disktag)
 | 
				
			||||||
            if ( is_writable($tmp) ) $dir = $tmp;
 | 
					            if ( is_writable($tmp) ) $dir = $tmp;
 | 
				
			||||||
        } elseif ( mkdir($tmp) ) $dir = $tmp;
 | 
					        } elseif ( mkdir($tmp) ) $dir = $tmp;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    $tag = __DIR__ . '/OneManager/' . $disktag;
 | 
					    $tag = $_SERVER['HTTP_HOST'] . '/OneManager/' . $disktag;
 | 
				
			||||||
    while (strpos($tag, '/')>-1) $tag = str_replace('/', '_', $tag);
 | 
					    while (strpos($tag, '/')>-1) $tag = str_replace('/', '_', $tag);
 | 
				
			||||||
    if (strpos($tag, ':')>-1) {
 | 
					    if (strpos($tag, ':')>-1) {
 | 
				
			||||||
        $tag = str_replace(':', '_', $tag);
 | 
					        $tag = str_replace(':', '_', $tag);
 | 
				
			||||||
| 
						 | 
					@ -629,14 +641,52 @@ function filecache($disktag)
 | 
				
			||||||
    return $cache;
 | 
					    return $cache;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function calcDownKey($filename, $key = '') {
 | 
				
			||||||
 | 
					    if ($key) {
 | 
				
			||||||
 | 
					        // check key
 | 
				
			||||||
 | 
					        $tmp = splitfirst($key, '.');
 | 
				
			||||||
 | 
					        if ($tmp[1]!='') {
 | 
				
			||||||
 | 
					            $timestamp = $tmp[0];
 | 
				
			||||||
 | 
					            if (time() > $timestamp) return false;
 | 
				
			||||||
 | 
					            if (md5($timestamp . sha1($filename . getConfig('admin'))) == $tmp[1]) return true;
 | 
				
			||||||
 | 
					            else return false;
 | 
				
			||||||
 | 
					        } else return false;
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        // calc key
 | 
				
			||||||
 | 
					        $timestamp = time() + 1*24*60*60;
 | 
				
			||||||
 | 
					        return $timestamp . '.' . md5($timestamp . sha1($filename . getConfig('admin')));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function findIndexPath($rootpath, $path = '')
 | 
				
			||||||
 | 
					{// find the path of the first 'index.php' that not in rootpath.
 | 
				
			||||||
 | 
					    global $slash;
 | 
				
			||||||
 | 
					    if (substr($rootpath,-1)==$slash) $rootpath = substr($rootpath, 0, -1);
 | 
				
			||||||
 | 
					    if (substr($path,0,1)==$slash) $path = substr($path, 1);
 | 
				
			||||||
 | 
					    $handler=opendir(path_format($rootpath.$slash.$path)); //打开当前文件夹
 | 
				
			||||||
 | 
					    while($filename=readdir($handler)){
 | 
				
			||||||
 | 
					        if($filename != "." && $filename != ".."){//文件夹文件名字为'.'和‘..’,不要对他们进行操作
 | 
				
			||||||
 | 
					            $nowname = path_format($rootpath.$slash.$path.$slash.$filename);
 | 
				
			||||||
 | 
					            if(is_dir($nowname)){// 如果读取的某个对象是文件夹,则递归
 | 
				
			||||||
 | 
					                $res = findIndexPath($rootpath, $path.$slash.$filename);
 | 
				
			||||||
 | 
					                if ($res!=='') return $res;
 | 
				
			||||||
 | 
					            }else{
 | 
				
			||||||
 | 
					                if ($filename==='index.php') if ($path!='') return $rootpath.$slash.$path;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    @closedir($handler);
 | 
				
			||||||
 | 
					    return '';
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function sortConfig(&$arr)
 | 
					function sortConfig(&$arr)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ksort($arr);
 | 
					    ksort($arr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (isset($arr['disktag'])) {
 | 
				
			||||||
        $tags = explode('|', $arr['disktag']);
 | 
					        $tags = explode('|', $arr['disktag']);
 | 
				
			||||||
        unset($arr['disktag']);
 | 
					        unset($arr['disktag']);
 | 
				
			||||||
    if ($tags[0]!='') {
 | 
					        foreach($tags as $tag) if (isset($arr[$tag])) {
 | 
				
			||||||
        foreach($tags as $tag) {
 | 
					 | 
				
			||||||
            $disks[$tag] = $arr[$tag];
 | 
					            $disks[$tag] = $arr[$tag];
 | 
				
			||||||
            unset($arr[$tag]);
 | 
					            unset($arr[$tag]);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -917,7 +967,7 @@ function message($message, $title = 'Message', $statusCode = 200, $wainstat = 0)
 | 
				
			||||||
                            //setTimeout(function() { getStatus() }, 1000);
 | 
					                            //setTimeout(function() { getStatus() }, 1000);
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    } else if (xhr.status==206) {
 | 
					                    } else if (xhr.status==206) {
 | 
				
			||||||
                        errordiv.innerHTML = min + "<br>' . getconstStr('Wait') . '" + x;
 | 
					                        errordiv.innerHTML = "' . getconstStr('Wait') . '" + x + "<br>" + min;
 | 
				
			||||||
                        setTimeout(function() { getStatus() }, 1000);
 | 
					                        setTimeout(function() { getStatus() }, 1000);
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        errordiv.innerHTML = "ERROR<br>" + xhr.status + "<br>" + xhr.responseText;
 | 
					                        errordiv.innerHTML = "ERROR<br>" + xhr.status + "<br>" + xhr.responseText;
 | 
				
			||||||
| 
						 | 
					@ -949,7 +999,8 @@ function needUpdate()
 | 
				
			||||||
    $current_ver = explode(urldecode('%0D'),$current_ver)[0];
 | 
					    $current_ver = explode(urldecode('%0D'),$current_ver)[0];
 | 
				
			||||||
    $split = splitfirst($current_version, '.' . $current_ver)[0] . '.' . $current_ver;
 | 
					    $split = splitfirst($current_version, '.' . $current_ver)[0] . '.' . $current_ver;
 | 
				
			||||||
    if (!($github_version = getcache('github_version'))) {
 | 
					    if (!($github_version = getcache('github_version'))) {
 | 
				
			||||||
        $tmp = curl('GET', 'https://raw.githubusercontent.com/qkqpttgf/OneManager-php/master/version');
 | 
					        //$tmp = curl('GET', 'https://raw.githubusercontent.com/qkqpttgf/OneManager-php/master/version');
 | 
				
			||||||
 | 
					        $tmp = curl('GET', 'https://git.hit.edu.cn/ysun/OneManager-php/-/raw/master/version');
 | 
				
			||||||
        if ($tmp['stat']==0) return 0;
 | 
					        if ($tmp['stat']==0) return 0;
 | 
				
			||||||
        $github_version = $tmp['body'];
 | 
					        $github_version = $tmp['body'];
 | 
				
			||||||
        savecache('github_version', $github_version);
 | 
					        savecache('github_version', $github_version);
 | 
				
			||||||
| 
						 | 
					@ -1082,7 +1133,7 @@ function adminform($name = '', $pass = '', $storage = '', $path = '')
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
<script src="https://cdn.bootcss.com/js-sha1/0.6.0/sha1.min.js"></script>';
 | 
					<script src="https://cdn.jsdelivr.net/npm/js-sha1@0.6.0/src/sha1.min.js"></script>';
 | 
				
			||||||
    $html .= '</html>';
 | 
					    $html .= '</html>';
 | 
				
			||||||
    return output($html, $statusCode);
 | 
					    return output($html, $statusCode);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1090,6 +1141,7 @@ function adminform($name = '', $pass = '', $storage = '', $path = '')
 | 
				
			||||||
function adminoperate($path)
 | 
					function adminoperate($path)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    global $drive;
 | 
					    global $drive;
 | 
				
			||||||
 | 
					    if ($_SERVER['REQUEST_METHOD']=='POST') if (!driveisfine($_SERVER['disktag'], $drive)) return output('Not in drive, or disk [' . $_SERVER['disktag'] . '] error.', 403);
 | 
				
			||||||
    $path1 = path_format($_SERVER['list_path'] . '/' . $path);
 | 
					    $path1 = path_format($_SERVER['list_path'] . '/' . $path);
 | 
				
			||||||
    if (substr($path1, -1)=='/') $path1=substr($path1, 0, -1);
 | 
					    if (substr($path1, -1)=='/') $path1=substr($path1, 0, -1);
 | 
				
			||||||
    $tmpget = $_GET;
 | 
					    $tmpget = $_GET;
 | 
				
			||||||
| 
						 | 
					@ -1207,6 +1259,7 @@ function splitfirst($str, $split)
 | 
				
			||||||
        $tmp[0] = '';
 | 
					        $tmp[0] = '';
 | 
				
			||||||
        $tmp[1] = substr($str, $len);
 | 
					        $tmp[1] = substr($str, $len);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    if ($tmp[1]===false) $tmp[1] = '';
 | 
				
			||||||
    return $tmp;
 | 
					    return $tmp;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1224,6 +1277,7 @@ function splitlast($str, $split)
 | 
				
			||||||
        $tmp[0] = '';
 | 
					        $tmp[0] = '';
 | 
				
			||||||
        $tmp[1] = substr($str, $len);
 | 
					        $tmp[1] = substr($str, $len);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    if ($tmp[1]===false) $tmp[1] = '';
 | 
				
			||||||
    return $tmp;
 | 
					    return $tmp;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1251,7 +1305,7 @@ function EnvOpt($needUpdate = 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $html = '<title>OneManager '.getconstStr('Setup').'</title>';
 | 
					    $html = '<title>OneManager '.getconstStr('Setup').'</title>';
 | 
				
			||||||
    if (isset($_POST['updateProgram'])&&$_POST['updateProgram']==getconstStr('updateProgram')) if (compareadminmd5('admin', getConfig('admin'), $_COOKIE['admin'], $_POST['_admin'])) {
 | 
					    if (isset($_POST['updateProgram'])&&$_POST['updateProgram']==getconstStr('updateProgram')) if (compareadminmd5('admin', getConfig('admin'), $_COOKIE['admin'], $_POST['_admin'])) {
 | 
				
			||||||
        $response = setConfigResponse(OnekeyUpate($_POST['auth'], $_POST['project'], $_POST['branch']));
 | 
					        $response = setConfigResponse(OnekeyUpate($_POST['GitSource'], $_POST['auth'], $_POST['project'], $_POST['branch']));
 | 
				
			||||||
        if (api_error($response)) {
 | 
					        if (api_error($response)) {
 | 
				
			||||||
            $html = api_error_msg($response);
 | 
					            $html = api_error_msg($response);
 | 
				
			||||||
            $title = 'Error';
 | 
					            $title = 'Error';
 | 
				
			||||||
| 
						 | 
					@ -1391,19 +1445,18 @@ function EnvOpt($needUpdate = 0)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    } else return message('please login again', 'Need login', 403);
 | 
					    } else return message('please login again', 'Need login', 403);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (isset($_GET['preview'])) {
 | 
					 | 
				
			||||||
        $preurl = $_SERVER['PHP_SELF'] . '?preview';
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
        $preurl = path_format($_SERVER['PHP_SELF'] . '/');
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    $html .= '
 | 
					    $html .= '
 | 
				
			||||||
<a href="' . $preurl . '">' . getconstStr('Back') . '</a><br>
 | 
					<a id="back" href="./">' . getconstStr('Back') . '</a><br>
 | 
				
			||||||
 | 
					    <script>
 | 
				
			||||||
 | 
					        if (location.search.indexOf("preview")>0) document.getElementById("back").href = "?preview";
 | 
				
			||||||
 | 
					    </script>
 | 
				
			||||||
';
 | 
					';
 | 
				
			||||||
    if ($_GET['setup']==='cmd') {
 | 
					    if ($_GET['setup']==='cmd') {
 | 
				
			||||||
        $statusCode = 200;
 | 
					        $statusCode = 200;
 | 
				
			||||||
        $html .= '
 | 
					        $html .= '
 | 
				
			||||||
 | 
					OneManager DIR: ' . __DIR__ . '
 | 
				
			||||||
<form name="form1" method="POST" action="">
 | 
					<form name="form1" method="POST" action="">
 | 
				
			||||||
    <input id="inputarea" name="cmd" style="width:100%" value="' . $_POST['cmd'] . '"><br>
 | 
					    <input id="inputarea" name="cmd" style="width:100%" value="' . $_POST['cmd'] . '" placeholder="ls, pwd, cat"><br>
 | 
				
			||||||
    <input type="submit" value="post">
 | 
					    <input type="submit" value="post">
 | 
				
			||||||
</form>';
 | 
					</form>';
 | 
				
			||||||
        if ($_POST['cmd']!='') {
 | 
					        if ($_POST['cmd']!='') {
 | 
				
			||||||
| 
						 | 
					@ -1433,6 +1486,9 @@ output:
 | 
				
			||||||
</script>';
 | 
					</script>';
 | 
				
			||||||
        return message($html, 'Run cmd', $statusCode);
 | 
					        return message($html, 'Run cmd', $statusCode);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    if ($_GET['setup']==='auth') {
 | 
				
			||||||
 | 
					        return changeAuthKey();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    if ($_GET['setup']==='platform') {
 | 
					    if ($_GET['setup']==='platform') {
 | 
				
			||||||
        $frame .= '
 | 
					        $frame .= '
 | 
				
			||||||
<table border=1 width=100%>
 | 
					<table border=1 width=100%>
 | 
				
			||||||
| 
						 | 
					@ -1599,11 +1655,9 @@ output:
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
</script>';
 | 
					</script>';
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        //$_GET['disktag'] = '';
 | 
					 | 
				
			||||||
        $Driver_arr = scandir(__DIR__ . $slash . 'disk');
 | 
					 | 
				
			||||||
        if (count($disktags)>1) {
 | 
					        if (count($disktags)>1) {
 | 
				
			||||||
            $frame .= '
 | 
					            $frame .= '
 | 
				
			||||||
<script src="//cdn.bootcss.com/Sortable/1.8.3/Sortable.js"></script>
 | 
					<script src="http://sortablejs.github.io/Sortable/Sortable.js"></script>
 | 
				
			||||||
<style>
 | 
					<style>
 | 
				
			||||||
    .sortable-ghost {
 | 
					    .sortable-ghost {
 | 
				
			||||||
        opacity: 0.4;
 | 
					        opacity: 0.4;
 | 
				
			||||||
| 
						 | 
					@ -1614,24 +1668,26 @@ output:
 | 
				
			||||||
        cursor: move;
 | 
					        cursor: move;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
</style>
 | 
					</style>
 | 
				
			||||||
 | 
					' . getconstStr('DragSort') . ':
 | 
				
			||||||
 | 
					<form id="sortdisks_form" action="" method="post" style="margin: 0" onsubmit="return dragsort(this);">
 | 
				
			||||||
<table border=1>
 | 
					<table border=1>
 | 
				
			||||||
    <form id="sortdisks_form" action="" method="post" style="margin: 0" onsubmit="return dragsort(this);">
 | 
					    <tbody id="sortdisks">
 | 
				
			||||||
    <tr id="sortdisks">
 | 
					 | 
				
			||||||
    <input type="hidden" name="disktag_sort" value="">';
 | 
					    <input type="hidden" name="disktag_sort" value="">';
 | 
				
			||||||
            $num = 0;
 | 
					            $num = 0;
 | 
				
			||||||
            foreach ($disktags as $disktag) {
 | 
					            foreach ($disktags as $disktag) {
 | 
				
			||||||
                if ($disktag!='') {
 | 
					                if ($disktag!='') {
 | 
				
			||||||
                    $num++;
 | 
					                    $num++;
 | 
				
			||||||
                    $frame .= '
 | 
					                    $frame .= '
 | 
				
			||||||
        <td>' . $disktag . '</td>';
 | 
					        <tr class="sorthandle"><td>' . $num . '</td><td> ' . $disktag . '</td></tr>';
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            $frame .= '
 | 
					            $frame .= '
 | 
				
			||||||
 | 
					    </tbody>
 | 
				
			||||||
    <input name="_admin" type="hidden" value="">
 | 
					    <input name="_admin" type="hidden" value="">
 | 
				
			||||||
    </tr>
 | 
					 | 
				
			||||||
    <tr><td colspan="' . $num . '">' . getconstStr('DragSort') . '<input type="submit" name="submit1" value="' . getconstStr('SubmitSortdisks') . '"></td></tr>
 | 
					 | 
				
			||||||
    </form>
 | 
					 | 
				
			||||||
</table>
 | 
					</table>
 | 
				
			||||||
 | 
					    <input type="submit" name="submit1" value="' . getconstStr('SubmitSortdisks') . '">
 | 
				
			||||||
 | 
					</form>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
    var disks=' . json_encode($disktags) . ';
 | 
					    var disks=' . json_encode($disktags) . ';
 | 
				
			||||||
    function change(arr, oldindex, newindex) {
 | 
					    function change(arr, oldindex, newindex) {
 | 
				
			||||||
| 
						 | 
					@ -1664,7 +1720,8 @@ output:
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    Sortable.create(document.getElementById(\'sortdisks\'), {
 | 
					    new Sortable(document.getElementById(\'sortdisks\'), {
 | 
				
			||||||
 | 
					        handle: \'.sorthandle\',
 | 
				
			||||||
        animation: 150,
 | 
					        animation: 150,
 | 
				
			||||||
        onEnd: function (evt) { //拖拽完毕之后发生该事件
 | 
					        onEnd: function (evt) { //拖拽完毕之后发生该事件
 | 
				
			||||||
            //console.log(evt.oldIndex);
 | 
					            //console.log(evt.oldIndex);
 | 
				
			||||||
| 
						 | 
					@ -1677,6 +1734,7 @@ output:
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
</script><br>';
 | 
					</script><br>';
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        $Driver_arr = scandir(__DIR__ . $slash . 'disk');
 | 
				
			||||||
        $frame .= '
 | 
					        $frame .= '
 | 
				
			||||||
<select name="DriveType" onchange="changedrivetype(this.options[this.options.selectedIndex].value)">';
 | 
					<select name="DriveType" onchange="changedrivetype(this.options[this.options.selectedIndex].value)">';
 | 
				
			||||||
        foreach ($Driver_arr as $v1) {
 | 
					        foreach ($Driver_arr as $v1) {
 | 
				
			||||||
| 
						 | 
					@ -1701,7 +1759,7 @@ output:
 | 
				
			||||||
            $canOneKeyUpate = 1;
 | 
					            $canOneKeyUpate = 1;
 | 
				
			||||||
        } elseif (isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app') {
 | 
					        } elseif (isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app') {
 | 
				
			||||||
            $canOneKeyUpate = 1;
 | 
					            $canOneKeyUpate = 1;
 | 
				
			||||||
        } elseif (isset($_SERVER['FC_SERVER_PATH'])&&$_SERVER['FC_SERVER_PATH']==='/var/fc/runtime/php7.2') {
 | 
					        } elseif (isset($_SERVER['FC_FUNC_CODE_PATH'])) {
 | 
				
			||||||
            $canOneKeyUpate = 1;
 | 
					            $canOneKeyUpate = 1;
 | 
				
			||||||
        } elseif (isset($_SERVER['BCE_CFC_RUNTIME_NAME'])&&$_SERVER['BCE_CFC_RUNTIME_NAME']=='php7') {
 | 
					        } elseif (isset($_SERVER['BCE_CFC_RUNTIME_NAME'])&&$_SERVER['BCE_CFC_RUNTIME_NAME']=='php7') {
 | 
				
			||||||
            $canOneKeyUpate = 1;
 | 
					            $canOneKeyUpate = 1;
 | 
				
			||||||
| 
						 | 
					@ -1716,7 +1774,10 @@ output:
 | 
				
			||||||
                $canOneKeyUpate = 1;
 | 
					                $canOneKeyUpate = 1;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        $frame .= '<a href="https://github.com/qkqpttgf/OneManager-php" target="_blank">Github</a>';
 | 
					        $frame .= '
 | 
				
			||||||
 | 
					        <a href="https://github.com/qkqpttgf/OneManager-php" target="_blank">Github</a>
 | 
				
			||||||
 | 
					<a href="https://git.hit.edu.cn/ysun/OneManager-php" target="_blank">HIT Gitlab</a><br><br>
 | 
				
			||||||
 | 
					';
 | 
				
			||||||
        if (!$canOneKeyUpate) {
 | 
					        if (!$canOneKeyUpate) {
 | 
				
			||||||
            $frame .= '
 | 
					            $frame .= '
 | 
				
			||||||
' . getconstStr('CannotOneKeyUpate') . '<br>';
 | 
					' . getconstStr('CannotOneKeyUpate') . '<br>';
 | 
				
			||||||
| 
						 | 
					@ -1724,17 +1785,33 @@ output:
 | 
				
			||||||
            $frame .= '
 | 
					            $frame .= '
 | 
				
			||||||
<form name="updateform" action="" method="post">
 | 
					<form name="updateform" action="" method="post">
 | 
				
			||||||
    <input name="_admin" type="hidden" value="">
 | 
					    <input name="_admin" type="hidden" value="">
 | 
				
			||||||
 | 
					    Update from
 | 
				
			||||||
 | 
					    <select name="GitSource" onchange="changeGitSource(this)">
 | 
				
			||||||
 | 
					        <option value="Github" selected>Github</option>
 | 
				
			||||||
 | 
					        <option value="HITGitlab">HIT Gitlab</option>
 | 
				
			||||||
 | 
					    </select>
 | 
				
			||||||
    <input type="text" name="auth" size="6" placeholder="auth" value="qkqpttgf">
 | 
					    <input type="text" name="auth" size="6" placeholder="auth" value="qkqpttgf">
 | 
				
			||||||
    <input type="text" name="project" size="12" placeholder="project" value="OneManager-php">
 | 
					    <input type="text" name="project" size="12" placeholder="project" value="OneManager-php">
 | 
				
			||||||
    <button name="QueryBranchs" onclick="querybranchs();return false;">' . getconstStr('QueryBranchs') . '</button>
 | 
					    <button name="QueryBranchs" onclick="querybranchs(this);return false;">' . getconstStr('QueryBranchs') . '</button>
 | 
				
			||||||
    <select name="branch">
 | 
					    <select name="branch">
 | 
				
			||||||
        <option value="master">master</option>
 | 
					        <option value="master">master</option>
 | 
				
			||||||
    </select>
 | 
					    </select>
 | 
				
			||||||
    <input type="submit" name="updateProgram" value="' . getconstStr('updateProgram') . '">
 | 
					    <input type="submit" name="updateProgram" value="' . getconstStr('updateProgram') . '">
 | 
				
			||||||
</form>
 | 
					</form>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
    function querybranchs()
 | 
					    function changeGitSource(d) {
 | 
				
			||||||
    {
 | 
					        if (d.options[d.options.selectedIndex].value=="Github") document.updateform.auth.value = "qkqpttgf";
 | 
				
			||||||
 | 
					        if (d.options[d.options.selectedIndex].value=="HITGitlab") document.updateform.auth.value = "ysun";
 | 
				
			||||||
 | 
					        document.updateform.QueryBranchs.style.display = null;
 | 
				
			||||||
 | 
					        document.updateform.branch.options.length = 0;
 | 
				
			||||||
 | 
					        document.updateform.branch.options.add(new Option("master", "master"));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    function querybranchs(b) {
 | 
				
			||||||
 | 
					        if (document.updateform.GitSource.options[document.updateform.GitSource.options.selectedIndex].value=="Github") return Githubquerybranchs(b);
 | 
				
			||||||
 | 
					        if (document.updateform.GitSource.options[document.updateform.GitSource.options.selectedIndex].value=="HITGitlab") return HITquerybranchs(b);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    function Githubquerybranchs(b) {
 | 
				
			||||||
        var xhr = new XMLHttpRequest();
 | 
					        var xhr = new XMLHttpRequest();
 | 
				
			||||||
        xhr.open("GET", "https://api.github.com/repos/"+document.updateform.auth.value+"/"+document.updateform.project.value+"/branches");
 | 
					        xhr.open("GET", "https://api.github.com/repos/"+document.updateform.auth.value+"/"+document.updateform.project.value+"/branches");
 | 
				
			||||||
        //xhr.setRequestHeader("User-Agent","qkqpttgf/OneManager");
 | 
					        //xhr.setRequestHeader("User-Agent","qkqpttgf/OneManager");
 | 
				
			||||||
| 
						 | 
					@ -1746,7 +1823,50 @@ output:
 | 
				
			||||||
                    document.updateform.branch.options.add(new Option(e.name,e.name));
 | 
					                    document.updateform.branch.options.add(new Option(e.name,e.name));
 | 
				
			||||||
                    if ("master"==e.name) document.updateform.branch.options[document.updateform.branch.options.length-1].selected = true; 
 | 
					                    if ("master"==e.name) document.updateform.branch.options[document.updateform.branch.options.length-1].selected = true; 
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
                document.updateform.QueryBranchs.style.display="none";
 | 
					                //document.updateform.QueryBranchs.style.display="none";
 | 
				
			||||||
 | 
					                b.style.display="none";
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                alert(xhr.responseText+"\n"+xhr.status);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        xhr.onerror = function(e){
 | 
				
			||||||
 | 
					            alert("Network Error "+xhr.status);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        xhr.send(null);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    function HITquerybranchs(b) {
 | 
				
			||||||
 | 
					        // https://git.hit.edu.cn/api/v4/projects/383/repository/branches/
 | 
				
			||||||
 | 
					        var pro_id;
 | 
				
			||||||
 | 
					        var xhr = new XMLHttpRequest();
 | 
				
			||||||
 | 
					        xhr.open("GET", "https://git.hit.edu.cn/api/v4/projects");
 | 
				
			||||||
 | 
					        //xhr.setRequestHeader("User-Agent","qkqpttgf/OneManager");
 | 
				
			||||||
 | 
					        xhr.onload = function(e){
 | 
				
			||||||
 | 
					            //console.log(xhr.responseText+","+xhr.status);
 | 
				
			||||||
 | 
					            if (xhr.status==200) {
 | 
				
			||||||
 | 
					                //document.updateform.branch.options.length=0;
 | 
				
			||||||
 | 
					                JSON.parse(xhr.responseText).forEach( function (e) {
 | 
				
			||||||
 | 
					                    if (e.name===document.updateform.project.value && e.namespace.path===document.updateform.auth.value) {
 | 
				
			||||||
 | 
					                        //console.log(e.id);
 | 
				
			||||||
 | 
					                        pro_id = e.id;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					                //console.log(pro_id);
 | 
				
			||||||
 | 
					                var xhr1 = new XMLHttpRequest();
 | 
				
			||||||
 | 
					                xhr1.open("GET", "https://git.hit.edu.cn/api/v4/projects/"+pro_id+"/repository/branches");
 | 
				
			||||||
 | 
					                xhr1.onload = function(e){
 | 
				
			||||||
 | 
					                    if (xhr1.status==200) {
 | 
				
			||||||
 | 
					                        document.updateform.branch.options.length=0;
 | 
				
			||||||
 | 
					                        JSON.parse(xhr1.responseText).forEach( function (e) {
 | 
				
			||||||
 | 
					                            document.updateform.branch.options.add(new Option(e.name,e.name));
 | 
				
			||||||
 | 
					                            if ("master"==e.name) document.updateform.branch.options[document.updateform.branch.options.length-1].selected = true; 
 | 
				
			||||||
 | 
					                        });
 | 
				
			||||||
 | 
					                    } else {
 | 
				
			||||||
 | 
					                        alert(xhr1.responseText+"\n"+xhr1.status);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                xhr1.send(null);
 | 
				
			||||||
 | 
					                //document.updateform.QueryBranchs.style.display="none";
 | 
				
			||||||
 | 
					                b.style.display="none";
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                alert(xhr.responseText+"\n"+xhr.status);
 | 
					                alert(xhr.responseText+"\n"+xhr.status);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					@ -1761,17 +1881,17 @@ output:
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if ($needUpdate) {
 | 
					        if ($needUpdate) {
 | 
				
			||||||
            $frame .= '<div style="position: relative; word-wrap: break-word;">
 | 
					            $frame .= '<div style="position: relative; word-wrap: break-word;">
 | 
				
			||||||
        ' . str_replace("\r", '<br>', $_SERVER['github_ver_new']) . '
 | 
					        ' . str_replace("\n", '<br>', $_SERVER['github_ver_new']) . '
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
<button onclick="document.getElementById(\'github_ver_old\').style.display=(document.getElementById(\'github_ver_old\').style.display==\'none\'?\'\':\'none\');">More...</button>
 | 
					<button onclick="document.getElementById(\'github_ver_old\').style.display=(document.getElementById(\'github_ver_old\').style.display==\'none\'?\'\':\'none\');">More...</button>
 | 
				
			||||||
<div id="github_ver_old" style="position: relative; word-wrap: break-word; display: none">
 | 
					<div id="github_ver_old" style="position: relative; word-wrap: break-word; display: none">
 | 
				
			||||||
        ' . str_replace("\r", '<br>', $_SERVER['github_ver_old']) . '
 | 
					        ' . str_replace("\n", '<br>', $_SERVER['github_ver_old']) . '
 | 
				
			||||||
</div>';
 | 
					</div>';
 | 
				
			||||||
        }/* else {
 | 
					        }/* else {
 | 
				
			||||||
            $frame .= getconstStr('NotNeedUpdate');
 | 
					            $frame .= getconstStr('NotNeedUpdate');
 | 
				
			||||||
        }*/
 | 
					        }*/
 | 
				
			||||||
        $frame .= '<br><br>
 | 
					        $frame .= '<br><br>
 | 
				
			||||||
<script src="https://cdn.bootcss.com/js-sha1/0.6.0/sha1.min.js"></script>
 | 
					<script src="https://cdn.jsdelivr.net/npm/js-sha1@0.6.0/src/sha1.min.js"></script>
 | 
				
			||||||
<table>
 | 
					<table>
 | 
				
			||||||
    <form id="change_pass" name="change_pass" action="" method="POST" onsubmit="return changePassword(this);">
 | 
					    <form id="change_pass" name="change_pass" action="" method="POST" onsubmit="return changePassword(this);">
 | 
				
			||||||
        <input name="_admin" type="hidden" value="">
 | 
					        <input name="_admin" type="hidden" value="">
 | 
				
			||||||
| 
						 | 
					@ -1904,31 +2024,30 @@ output:
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    $html .= '
 | 
					    $html .= '
 | 
				
			||||||
<style type="text/css">
 | 
					<style type="text/css">
 | 
				
			||||||
    .tabs td { padding: 5px; }
 | 
					    .tabs { padding: 10px; white-space: nowrap; overflow-x: auto;}
 | 
				
			||||||
 | 
					    .tabs a { margin:0 10px; }
 | 
				
			||||||
</style>
 | 
					</style>
 | 
				
			||||||
<table border=0>
 | 
					<div class="tabs">';
 | 
				
			||||||
    <tr class="tabs">';
 | 
					 | 
				
			||||||
    if ($_GET['disktag']==''||$_GET['disktag']===true||!in_array($_GET['disktag'], $disktags)) {
 | 
					    if ($_GET['disktag']==''||$_GET['disktag']===true||!in_array($_GET['disktag'], $disktags)) {
 | 
				
			||||||
        if ($_GET['setup']==='platform') $html .= '
 | 
					        if ($_GET['setup']==='platform') $html .= '
 | 
				
			||||||
        <td><a href="?setup">' . getconstStr('Home') . '</a></td>
 | 
					    <a href="?setup">' . getconstStr('Home') . '</a>
 | 
				
			||||||
        <td>' . getconstStr('PlatformConfig') . '</td>';
 | 
					    ' . getconstStr('PlatformConfig') . '';
 | 
				
			||||||
        else $html .= '
 | 
					        else $html .= '
 | 
				
			||||||
        <td>' . getconstStr('Home') . '</td>
 | 
					    ' . getconstStr('Home') . '
 | 
				
			||||||
        <td><a href="?setup=platform">' . getconstStr('PlatformConfig') . '</a></td>';
 | 
					    <a href="?setup=platform">' . getconstStr('PlatformConfig') . '</a>';
 | 
				
			||||||
    } else $html .= '
 | 
					    } else $html .= '
 | 
				
			||||||
        <td><a href="?setup">' . getconstStr('Home') . '</a></td>
 | 
					    <a href="?setup">' . getconstStr('Home') . '</a>
 | 
				
			||||||
        <td><a href="?setup=platform">' . getconstStr('PlatformConfig') . '</a></td>';
 | 
					    <a href="?setup=platform">' . getconstStr('PlatformConfig') . '</a>';
 | 
				
			||||||
    foreach ($disktags as $disktag) {
 | 
					    foreach ($disktags as $disktag) {
 | 
				
			||||||
        if ($disktag!='') {
 | 
					        if ($disktag!='') {
 | 
				
			||||||
            if ($_GET['disktag']===$disktag) $html .= '
 | 
					            if ($_GET['disktag']===$disktag) $html .= '
 | 
				
			||||||
        <td>' . $disktag . '</td>';
 | 
					    ' . $disktag . '';
 | 
				
			||||||
            else $html .= '
 | 
					            else $html .= '
 | 
				
			||||||
        <td><a href="?setup&disktag=' . $disktag . '">' . $disktag . '</a></td>';
 | 
					    <a href="?setup&disktag=' . $disktag . '">' . $disktag . '</a>';
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    $html .= '
 | 
					    $html .= '
 | 
				
			||||||
    </tr>
 | 
					</div><br>';
 | 
				
			||||||
</table><br>';
 | 
					 | 
				
			||||||
    $html .= $frame;
 | 
					    $html .= $frame;
 | 
				
			||||||
    $html .= '<script>
 | 
					    $html .= '<script>
 | 
				
			||||||
    var inputAdminStorage = document.getElementsByName("_admin");
 | 
					    var inputAdminStorage = document.getElementsByName("_admin");
 | 
				
			||||||
| 
						 | 
					@ -1995,6 +2114,7 @@ function render_list($path = '', $files = [])
 | 
				
			||||||
    $authinfo = '
 | 
					    $authinfo = '
 | 
				
			||||||
<!--
 | 
					<!--
 | 
				
			||||||
    OneManager: An index & manager of Onedrive auth by ysun.
 | 
					    OneManager: An index & manager of Onedrive auth by ysun.
 | 
				
			||||||
 | 
					    HIT Gitlab: https://git.hit.edu.cn/ysun/OneManager-php
 | 
				
			||||||
    Github: https://github.com/qkqpttgf/OneManager-php
 | 
					    Github: https://github.com/qkqpttgf/OneManager-php
 | 
				
			||||||
-->';
 | 
					-->';
 | 
				
			||||||
    //$authinfo = $path . '<br><pre>' . json_encode($files, JSON_PRETTY_PRINT) . '</pre>';
 | 
					    //$authinfo = $path . '<br><pre>' . json_encode($files, JSON_PRETTY_PRINT) . '</pre>';
 | 
				
			||||||
| 
						 | 
					@ -2133,7 +2253,18 @@ function render_list($path = '', $files = [])
 | 
				
			||||||
            while (strpos($html, '<!--GuestEnd-->')) $html = str_replace('<!--GuestEnd-->', '', $html);
 | 
					            while (strpos($html, '<!--GuestEnd-->')) $html = str_replace('<!--GuestEnd-->', '', $html);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($_SERVER['ishidden']==4) {
 | 
					        if ($_SERVER['ishidden']<4 || ($files['type']=='file'&&getConfig('downloadencrypt', $_SERVER['disktag']))) {
 | 
				
			||||||
 | 
					            while (strpos($html, '<!--EncryptedStart-->')) {
 | 
				
			||||||
 | 
					                $tmp = splitfirst($html, '<!--EncryptedStart-->');
 | 
				
			||||||
 | 
					                $html = $tmp[0];
 | 
				
			||||||
 | 
					                $tmp = splitfirst($tmp[1], '<!--EncryptedEnd-->');
 | 
				
			||||||
 | 
					                $html .= $tmp[1];
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            while (strpos($html, '<!--IsNotHiddenStart-->')) {
 | 
				
			||||||
 | 
					                $html = str_replace('<!--IsNotHiddenStart-->', '', $html);
 | 
				
			||||||
 | 
					                $html = str_replace('<!--IsNotHiddenEnd-->', '', $html);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
            // 加密状态
 | 
					            // 加密状态
 | 
				
			||||||
            if (getConfig('useBasicAuth')) {
 | 
					            if (getConfig('useBasicAuth')) {
 | 
				
			||||||
                // use Basic Auth
 | 
					                // use Basic Auth
 | 
				
			||||||
| 
						 | 
					@ -2208,17 +2339,6 @@ function render_list($path = '', $files = [])
 | 
				
			||||||
                $tmp = splitfirst($tmp[1], '<!--FootomfEnd-->');
 | 
					                $tmp = splitfirst($tmp[1], '<!--FootomfEnd-->');
 | 
				
			||||||
                $html .= $tmp[1];
 | 
					                $html .= $tmp[1];
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            while (strpos($html, '<!--EncryptedStart-->')) {
 | 
					 | 
				
			||||||
                $tmp = splitfirst($html, '<!--EncryptedStart-->');
 | 
					 | 
				
			||||||
                $html = $tmp[0];
 | 
					 | 
				
			||||||
                $tmp = splitfirst($tmp[1], '<!--EncryptedEnd-->');
 | 
					 | 
				
			||||||
                $html .= $tmp[1];
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            while (strpos($html, '<!--IsNotHiddenStart-->')) {
 | 
					 | 
				
			||||||
                $html = str_replace('<!--IsNotHiddenStart-->', '', $html);
 | 
					 | 
				
			||||||
                $html = str_replace('<!--IsNotHiddenEnd-->', '', $html);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        while (strpos($html, '<!--constStr@Download-->')) $html = str_replace('<!--constStr@Download-->', getconstStr('Download'), $html);
 | 
					        while (strpos($html, '<!--constStr@Download-->')) $html = str_replace('<!--constStr@Download-->', getconstStr('Download'), $html);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2738,6 +2858,15 @@ function render_list($path = '', $files = [])
 | 
				
			||||||
        $tmp = splitfirst($tmp[1], '<!--HeadomfEnd-->');
 | 
					        $tmp = splitfirst($tmp[1], '<!--HeadomfEnd-->');
 | 
				
			||||||
        if (isset($files['list']['head.omf'])) {
 | 
					        if (isset($files['list']['head.omf'])) {
 | 
				
			||||||
            $headomf = str_replace('<!--HeadomfContent-->', get_content(path_format($path . '/' . $files['list']['head.omf']['name']))['content']['body'], $tmp[0]);
 | 
					            $headomf = str_replace('<!--HeadomfContent-->', get_content(path_format($path . '/' . $files['list']['head.omf']['name']))['content']['body'], $tmp[0]);
 | 
				
			||||||
 | 
					        } elseif (getConfig('globalHeadOmfUrl')) {
 | 
				
			||||||
 | 
					            if (!$headomfcontent = getcache('HeadomfContent')) {
 | 
				
			||||||
 | 
					                $headomfres = curl('GET', getConfig('globalHeadOmfUrl'), '', [], 0, 1);
 | 
				
			||||||
 | 
					                if ($headomfres['stat']==200) {
 | 
				
			||||||
 | 
					                    $headomfcontent = $headomfres['body'];
 | 
				
			||||||
 | 
					                    savecache('HeadomfContent', $headomfcontent);
 | 
				
			||||||
 | 
					                } else $headomfcontent = $headomfres['stat'];
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            $headomf = str_replace('<!--HeadomfContent-->', $headomfcontent, $tmp[0]);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        $html .= $headomf . $tmp[1];
 | 
					        $html .= $headomf . $tmp[1];
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
| 
						 | 
					@ -2751,6 +2880,20 @@ function render_list($path = '', $files = [])
 | 
				
			||||||
                $html = str_replace('<!--HeadmdStart-->', '', $html);
 | 
					                $html = str_replace('<!--HeadmdStart-->', '', $html);
 | 
				
			||||||
                $html = str_replace('<!--HeadmdEnd-->', '', $html);
 | 
					                $html = str_replace('<!--HeadmdEnd-->', '', $html);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					        } elseif (getConfig('globalHeadMdUrl')) {
 | 
				
			||||||
 | 
					            if (!$headmdcontent = getcache('HeadmdContent')) {
 | 
				
			||||||
 | 
					                $headmdres = curl('GET', getConfig('globalHeadMdUrl'), '', [], 0, 1);
 | 
				
			||||||
 | 
					                if ($headmdres['stat']==200) {
 | 
				
			||||||
 | 
					                    $headmdcontent = $headmdres['body'];
 | 
				
			||||||
 | 
					                    savecache('HeadmdContent', $headmdcontent);
 | 
				
			||||||
 | 
					                } else $headmdcontent = $headmdres['stat'];
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            $headmd = str_replace('<!--HeadmdContent-->', $headmdcontent, $tmp[0]);
 | 
				
			||||||
 | 
					            $html .= $headmd . $tmp[1];
 | 
				
			||||||
 | 
					            while (strpos($html, '<!--HeadmdStart-->')) {
 | 
				
			||||||
 | 
					                $html = str_replace('<!--HeadmdStart-->', '', $html);
 | 
				
			||||||
 | 
					                $html = str_replace('<!--HeadmdEnd-->', '', $html);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            $html .= $tmp[1];
 | 
					            $html .= $tmp[1];
 | 
				
			||||||
            $tmp[1] = 'a';
 | 
					            $tmp[1] = 'a';
 | 
				
			||||||
| 
						 | 
					@ -2785,6 +2928,20 @@ function render_list($path = '', $files = [])
 | 
				
			||||||
                $html = str_replace('<!--ReadmemdStart-->', '', $html);
 | 
					                $html = str_replace('<!--ReadmemdStart-->', '', $html);
 | 
				
			||||||
                $html = str_replace('<!--ReadmemdEnd-->', '', $html);
 | 
					                $html = str_replace('<!--ReadmemdEnd-->', '', $html);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					        } elseif (getConfig('globalReadmeMdUrl')) {
 | 
				
			||||||
 | 
					            if (!$readmemdcontent = getcache('ReadmemdContent')) {
 | 
				
			||||||
 | 
					                $readmemdres = curl('GET', getConfig('globalReadmeMdUrl'), '', [], 0, 1);
 | 
				
			||||||
 | 
					                if ($readmemdres['stat']==200) {
 | 
				
			||||||
 | 
					                    $readmemdcontent = $readmemdres['body'];
 | 
				
			||||||
 | 
					                    savecache('ReadmemdContent', $readmemdcontent);
 | 
				
			||||||
 | 
					                } else $readmemdcontent = $readmemdres['stat'];
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            $Readmemd = str_replace('<!--ReadmemdContent-->', $readmemdcontent, $tmp[0]);
 | 
				
			||||||
 | 
					            $html .= $Readmemd . $tmp[1];
 | 
				
			||||||
 | 
					            while (strpos($html, '<!--ReadmemdStart-->')) {
 | 
				
			||||||
 | 
					                $html = str_replace('<!--ReadmemdStart-->', '', $html);
 | 
				
			||||||
 | 
					                $html = str_replace('<!--ReadmemdEnd-->', '', $html);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            $html .= $tmp[1];
 | 
					            $html .= $tmp[1];
 | 
				
			||||||
            $tmp[1] = 'a';
 | 
					            $tmp[1] = 'a';
 | 
				
			||||||
| 
						 | 
					@ -2802,6 +2959,15 @@ function render_list($path = '', $files = [])
 | 
				
			||||||
        $tmp = splitfirst($tmp[1], '<!--FootomfEnd-->');
 | 
					        $tmp = splitfirst($tmp[1], '<!--FootomfEnd-->');
 | 
				
			||||||
        if (isset($files['list']['foot.omf'])) {
 | 
					        if (isset($files['list']['foot.omf'])) {
 | 
				
			||||||
            $Footomf = str_replace('<!--FootomfContent-->', get_content(path_format($path . '/' . $files['list']['foot.omf']['name']))['content']['body'], $tmp[0]);
 | 
					            $Footomf = str_replace('<!--FootomfContent-->', get_content(path_format($path . '/' . $files['list']['foot.omf']['name']))['content']['body'], $tmp[0]);
 | 
				
			||||||
 | 
					        } elseif (getConfig('globalFootOmfUrl')) {
 | 
				
			||||||
 | 
					            if (!$footomfcontent = getcache('FootomfContent')) {
 | 
				
			||||||
 | 
					                $footres = curl('GET', getConfig('globalFootOmfUrl'), '', [], 0, 1);
 | 
				
			||||||
 | 
					                if ($footres['stat']==200) {
 | 
				
			||||||
 | 
					                    $footomfcontent = $footres['body'];
 | 
				
			||||||
 | 
					                    savecache('FootomfContent', $footomfcontent);
 | 
				
			||||||
 | 
					                } else $footomfcontent = $footres['stat'];
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            $Footomf = str_replace('<!--FootomfContent-->', $footomfcontent, $tmp[0]);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        $html .= $Footomf . $tmp[1];
 | 
					        $html .= $Footomf . $tmp[1];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2809,7 +2975,7 @@ function render_list($path = '', $files = [])
 | 
				
			||||||
        $tmp = splitfirst($html, '<!--MdRequireStart-->');
 | 
					        $tmp = splitfirst($html, '<!--MdRequireStart-->');
 | 
				
			||||||
        $html = $tmp[0];
 | 
					        $html = $tmp[0];
 | 
				
			||||||
        $tmp = splitfirst($tmp[1], '<!--MdRequireEnd-->');
 | 
					        $tmp = splitfirst($tmp[1], '<!--MdRequireEnd-->');
 | 
				
			||||||
        if (isset($files['list']['head.md'])||isset($files['list']['readme.md'])) {
 | 
					        if (isset($files['list']['head.md'])||isset($files['list']['readme.md'])||getConfig('globalHeadMdUrl')||getConfig('globalReadmeMdUrl')) {
 | 
				
			||||||
            $html .= $tmp[0] . $tmp[1];
 | 
					            $html .= $tmp[0] . $tmp[1];
 | 
				
			||||||
        } else $html .= $tmp[1];
 | 
					        } else $html .= $tmp[1];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										56
									
								
								conststr.php
								
								
								
								
							
							
						
						
									
										56
									
								
								conststr.php
								
								
								
								
							| 
						 | 
					@ -7,7 +7,7 @@ $exts['img'] = ['ico', 'bmp', 'gif', 'jpg', 'jpeg', 'jpe', 'jfif', 'tif', 'tiff'
 | 
				
			||||||
$exts['music'] = ['mp3', 'wma', 'flac', 'ape', 'wav', 'ogg', 'm4a'];
 | 
					$exts['music'] = ['mp3', 'wma', 'flac', 'ape', 'wav', 'ogg', 'm4a'];
 | 
				
			||||||
$exts['office'] = ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'];
 | 
					$exts['office'] = ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'];
 | 
				
			||||||
$exts['txt'] = ['txt', 'bat', 'sh', 'php', 'asp', 'js', 'css', 'json', 'html', 'c', 'cpp', 'md', 'py', 'omf'];
 | 
					$exts['txt'] = ['txt', 'bat', 'sh', 'php', 'asp', 'js', 'css', 'json', 'html', 'c', 'cpp', 'md', 'py', 'omf'];
 | 
				
			||||||
$exts['video'] = ['mp4', 'webm', 'mkv', 'mov', 'flv', 'blv', 'avi', 'wmv', 'm3u8', 'rm', 'ts', 'rmvb'];
 | 
					$exts['video'] = ['mp4', 'webm', 'mkv', 'mov', 'flv', 'blv', 'avi', 'wmv', 'm3u8', 'rm', '3gp', 'rmvb'];
 | 
				
			||||||
$exts['zip'] = ['zip', 'rar', '7z', 'gz', 'tar'];
 | 
					$exts['zip'] = ['zip', 'rar', '7z', 'gz', 'tar'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$constStr = [
 | 
					$constStr = [
 | 
				
			||||||
| 
						 | 
					@ -88,8 +88,8 @@ $constStr = [
 | 
				
			||||||
    'EnvironmentsDescription' => [
 | 
					    'EnvironmentsDescription' => [
 | 
				
			||||||
        'en-us' => [
 | 
					        'en-us' => [
 | 
				
			||||||
            'admin' => 'The admin password, Login button will not show when empty',
 | 
					            'admin' => 'The admin password, Login button will not show when empty',
 | 
				
			||||||
            'adminloginpage' => 'if set, the Login button will not display, and the login page no longer \'?admin\', it is \'?{this value}\'.',
 | 
					            'adminloginpage' => 'if set, the Login button will not display, and the login page no longer \'?login=admin\', it is \'?login={this value}\'.',
 | 
				
			||||||
            'autoJumpFirstDisk' => 'used in multy disks, if 1, auto jump to first disk',
 | 
					            'autoJumpFirstDisk' => 'a switch used in multy disks, if 1, auto jump to first disk',
 | 
				
			||||||
            'customScript' => '<script> in all pages, e.g. http turn to https',
 | 
					            'customScript' => '<script> in all pages, e.g. http turn to https',
 | 
				
			||||||
            'customCss' => '<style> in <head>',
 | 
					            'customCss' => '<style> in <head>',
 | 
				
			||||||
            'customTheme' => 'an url of html',
 | 
					            'customTheme' => 'an url of html',
 | 
				
			||||||
| 
						 | 
					@ -98,19 +98,23 @@ $constStr = [
 | 
				
			||||||
            'diskname' => 'The disk name you want show.',
 | 
					            'diskname' => 'The disk name you want show.',
 | 
				
			||||||
            'diskDescription' => ' Some tips of this disk, not used in code.',
 | 
					            'diskDescription' => ' Some tips of this disk, not used in code.',
 | 
				
			||||||
            'disktag' => 'A tag used in store config and url.',
 | 
					            'disktag' => 'A tag used in store config and url.',
 | 
				
			||||||
            'disableShowThumb' => 'if 1, the ShowThumbnail button will not display',
 | 
					            'disableShowThumb' => 'a switch, if 1, the ShowThumbnail button will not display',
 | 
				
			||||||
            'disableChangeTheme' => 'if 1, the Theme selection button will not display',
 | 
					            'disableChangeTheme' => 'a switch, if 1, the Theme selection button will not display',
 | 
				
			||||||
            'downloadencrypt' => '0 or 1. if 1, the files in encrypt folder can be downloaded without password',
 | 
					            'downloadencrypt' => 'a switch, 0 or 1. if 1, the files in encrypt folder can be downloaded without password',
 | 
				
			||||||
            'useBasicAuth' => 'if 1, will popup user/pass windows in encrypted folder.',
 | 
					            'globalHeadOmfUrl' => 'get txt from url, show it as head.omf in every page.',
 | 
				
			||||||
 | 
					            'globalHeadMdUrl' => 'get txt from url, show it as head.md in every page.',
 | 
				
			||||||
 | 
					            'globalReadmeMdUrl' => 'get txt from url, show it as readme.md in every page.',
 | 
				
			||||||
 | 
					            'globalFootOmfUrl' => 'get txt from url, show it as foot.omf in every page.',
 | 
				
			||||||
 | 
					            'useBasicAuth' => 'a switch, if 1, will popup user/pass windows in encrypted folder.',
 | 
				
			||||||
            'background' => 'Set an url as background photo.',
 | 
					            'background' => 'Set an url as background photo.',
 | 
				
			||||||
            'backgroundm' => 'Set an url as background in mobile phone.',
 | 
					            'backgroundm' => 'Set an url as background in mobile phone.',
 | 
				
			||||||
            'forceHttps' => 'if 1, force to redirect to https when visit via http.',
 | 
					            'forceHttps' => 'a switch, if 1, force to redirect to https when visit via http.',
 | 
				
			||||||
            'fileConduitCacheTime' => 'Input number, unit is hour, if set this, little file<1M(or fileConduitSize) will through program and cache in explorer, otherwise, default 302 to Microsoft',
 | 
					            'fileConduitCacheTime' => 'Input number, unit is hour, if set this, little file<1M(or fileConduitSize) will through program and cache in explorer, otherwise, default 302 to Microsoft',
 | 
				
			||||||
            'fileConduitSize' => 'Input number, unit is M(suggest less than 4M), if set this, little file<this value will through program and cache in explorer, otherwise, default 302 to Microsoft',
 | 
					            'fileConduitSize' => 'Input number, unit is M(suggest less than 4M), if set this, little file<this value will through program and cache in explorer, otherwise, default 302 to Microsoft',
 | 
				
			||||||
            'theme' => 'Select theme for guest.',
 | 
					            'theme' => 'Select theme for guest.',
 | 
				
			||||||
            'timezone' => 'Set default timezone.',
 | 
					            'timezone' => 'Set default timezone.',
 | 
				
			||||||
            'guestup_path' => 'Set guest upload dir, before set this, the files in this dir will show as normal.',
 | 
					            'guestup_path' => 'Set guest upload dir, before set this, the files in this dir will show as normal.',
 | 
				
			||||||
            'hideFunctionalityFile' => '0 or 1. if 1, some file will not show in list to guest, like readme.md',
 | 
					            'hideFunctionalityFile' => 'a switch, 0 or 1. if 1, some file will not show in list to guest, like readme.md',
 | 
				
			||||||
            'passfile' => 'The password of folder(& its childrens) will save in this file.',
 | 
					            'passfile' => 'The password of folder(& its childrens) will save in this file.',
 | 
				
			||||||
            'domainforproxy' => 'Will replace the https://xxxxx-my.sharepoint.com with this value.Add &Origindomain=xxxxx-my.sharepoint.com at last',
 | 
					            'domainforproxy' => 'Will replace the https://xxxxx-my.sharepoint.com with this value.Add &Origindomain=xxxxx-my.sharepoint.com at last',
 | 
				
			||||||
            'public_path' => 'Show this Onedrive dir when through the long url of API Gateway.',
 | 
					            'public_path' => 'Show this Onedrive dir when through the long url of API Gateway.',
 | 
				
			||||||
| 
						 | 
					@ -118,8 +122,8 @@ $constStr = [
 | 
				
			||||||
        ],
 | 
					        ],
 | 
				
			||||||
        'zh-cn' => [
 | 
					        'zh-cn' => [
 | 
				
			||||||
            'admin' => '管理密码,不添加时不显示登录页面且无法登录。',
 | 
					            'admin' => '管理密码,不添加时不显示登录页面且无法登录。',
 | 
				
			||||||
            'adminloginpage' => '如果设置,登录按钮及页面隐藏。管理登录的页面不再是\'?admin\',而是\'?此设置的值\'。',
 | 
					            'adminloginpage' => '如果设置,登录按钮及页面隐藏。管理登录的页面不再是\'?login=admin\',而是\'?login=此设置的值\'。',
 | 
				
			||||||
            'autoJumpFirstDisk' => '用于多个磁盘,如果为1,则自动跳转到第一个磁盘',
 | 
					            'autoJumpFirstDisk' => '一个开关,用于多个磁盘,如果为1,则自动跳转到第一个磁盘',
 | 
				
			||||||
            'customScript' => '<script>,在所有页都会存在,例如放一个http跳转https',
 | 
					            'customScript' => '<script>,在所有页都会存在,例如放一个http跳转https',
 | 
				
			||||||
            'customCss' => '<style>,在<head>最后面',
 | 
					            'customCss' => '<style>,在<head>最后面',
 | 
				
			||||||
            'customTheme' => 'html格式的主题的url',
 | 
					            'customTheme' => 'html格式的主题的url',
 | 
				
			||||||
| 
						 | 
					@ -128,19 +132,23 @@ $constStr = [
 | 
				
			||||||
            'diskname' => '这个盘你想显示什么名称。',
 | 
					            'diskname' => '这个盘你想显示什么名称。',
 | 
				
			||||||
            'diskDescription' => '对这个盘的一些描述,随便写,代码不引用这个。',
 | 
					            'diskDescription' => '对这个盘的一些描述,随便写,代码不引用这个。',
 | 
				
			||||||
            'disktag' => '一个标签,用于保存配置,多盘时会显示在url中。',
 | 
					            'disktag' => '一个标签,用于保存配置,多盘时会显示在url中。',
 | 
				
			||||||
            'disableShowThumb' => '如果填 1, ‘显示缩略’按钮将被隐藏。',
 | 
					            'disableShowThumb' => '一个开关,如果填 1, ‘显示缩略’按钮将被隐藏。',
 | 
				
			||||||
            'disableChangeTheme' => '如果为 1,则不会显示主题选择按钮',
 | 
					            'disableChangeTheme' => '一个开关,如果为 1,则不会显示主题选择按钮',
 | 
				
			||||||
            'downloadencrypt' => '0 或 1。如果 1, 那加密目录内的文件可以不需要密码就能下载。',
 | 
					            'downloadencrypt' => '一个开关,0 或 1。如果 1, 那加密目录内的文件可以不需要密码就能下载。',
 | 
				
			||||||
            'useBasicAuth' => '如果为 1,加密目录将弹出用户名密码窗口,不会显示主题自带的输入密码页面。',
 | 
					            'globalHeadOmfUrl' => '从url获取文本,当成head.omf显示在每一页。',
 | 
				
			||||||
 | 
					            'globalHeadMdUrl' => '从url获取文本,当成head.md显示在每一页。',
 | 
				
			||||||
 | 
					            'globalReadmeMdUrl' => '从url获取文本,当成readme.md显示在每一页。',
 | 
				
			||||||
 | 
					            'globalFootOmfUrl' => '从url获取文本,当成foot.omf显示在每一页。',
 | 
				
			||||||
 | 
					            'useBasicAuth' => '一个开关,如果为 1,加密目录将弹出用户名密码窗口,不会显示主题自带的输入密码页面。',
 | 
				
			||||||
            'background' => '设置一个url作为背景。',
 | 
					            'background' => '设置一个url作为背景。',
 | 
				
			||||||
            'backgroundm' => '设置一个url作为手机端用的背景。',
 | 
					            'backgroundm' => '设置一个url作为手机端用的背景。',
 | 
				
			||||||
            'forceHttps' => '0或1。如果设置为1,会强制跳https',
 | 
					            'forceHttps' => '一个开关,0或1。如果设置为1,会强制跳https',
 | 
				
			||||||
            'fileConduitCacheTime' => '填数字,单位是小时,如果设置,小于1M(或fileConduitSize)的小文件会从程序通过然后缓存在浏览器,不然,默认302跳微软',
 | 
					            'fileConduitCacheTime' => '填数字,单位是小时,如果设置,小于1M(或fileConduitSize)的小文件会从程序通过然后缓存在浏览器,不然,默认302跳微软',
 | 
				
			||||||
            'fileConduitSize' => '填数字,单位是M(建议4M以下),如果设置,小于这个值的小文件会从程序通过然后缓存在浏览器,不然,默认302跳微软',
 | 
					            'fileConduitSize' => '填数字,单位是M(建议4M以下),如果设置,小于这个值的小文件会从程序通过然后缓存在浏览器,不然,默认302跳微软',
 | 
				
			||||||
            'theme' => '为游客选择一个主题。',
 | 
					            'theme' => '为游客选择一个主题。',
 | 
				
			||||||
            'timezone' => '设置默认时区。',
 | 
					            'timezone' => '设置默认时区。',
 | 
				
			||||||
            'guestup_path' => '设置游客上传路径(图床路径),不设置这个值时该目录内容会正常列文件出来,设置后只有上传界面,不显示其中文件(登录后显示)。',
 | 
					            'guestup_path' => '设置游客上传路径(图床路径),不设置这个值时该目录内容会正常列文件出来,设置后只有上传界面,不显示其中文件(登录后显示)。',
 | 
				
			||||||
            'hideFunctionalityFile' => '0 或 1。如果 1, 某些文件不列表给游客看,但它的功能正常,比如readme.md',
 | 
					            'hideFunctionalityFile' => '一个开关,0 或 1。如果 1, 功能文件不列表给游客看,但它的功能正常,比如readme.md',
 | 
				
			||||||
            'passfile' => '自定义密码文件的名字,可以是\'pppppp\',也可以是\'aaaa.txt\'等等;列目录时不会显示,只有知道密码才能查看或下载此文件。密码是这个文件的内容,可以空格、可以中文;',
 | 
					            'passfile' => '自定义密码文件的名字,可以是\'pppppp\',也可以是\'aaaa.txt\'等等;列目录时不会显示,只有知道密码才能查看或下载此文件。密码是这个文件的内容,可以空格、可以中文;',
 | 
				
			||||||
            'domainforproxy' => '会将https://xxxxx-my.sharepoint.com替换成这个值,在目标需要自己设置反代。会加上&Origindomain=原域名',
 | 
					            'domainforproxy' => '会将https://xxxxx-my.sharepoint.com替换成这个值,在目标需要自己设置反代。会加上&Origindomain=原域名',
 | 
				
			||||||
            'public_path' => '使用API长链接访问时,显示网盘文件的路径,不设置时默认为根目录。',
 | 
					            'public_path' => '使用API长链接访问时,显示网盘文件的路径,不设置时默认为根目录。',
 | 
				
			||||||
| 
						 | 
					@ -148,7 +156,7 @@ $constStr = [
 | 
				
			||||||
        ],
 | 
					        ],
 | 
				
			||||||
        'zh-tw' => [
 | 
					        'zh-tw' => [
 | 
				
			||||||
            'admin' => '管理密碼,不設定密碼將不顯示登入頁面且無法登入。',
 | 
					            'admin' => '管理密碼,不設定密碼將不顯示登入頁面且無法登入。',
 | 
				
			||||||
            'adminloginpage' => '如果設定,登入按鈕及頁面隱藏。管理登入的頁面不再是\'?admin\',而是\'?此設置的值\'。',
 | 
					            'adminloginpage' => '如果設定,登入按鈕及頁面隱藏。管理登入的頁面不再是\'?login=admin\',而是\'?login=此設置的值\'。',
 | 
				
			||||||
            'autoJumpFirstDisk' => '用於多盤,如果設1,將會自動跳到第一個盤。',
 | 
					            'autoJumpFirstDisk' => '用於多盤,如果設1,將會自動跳到第一個盤。',
 | 
				
			||||||
            'customScript' => '<script>,在所有頁都會存在,例如放一個http跳轉https',
 | 
					            'customScript' => '<script>,在所有頁都會存在,例如放一個http跳轉https',
 | 
				
			||||||
            'customCss' => '<style>,在<head>最後面',
 | 
					            'customCss' => '<style>,在<head>最後面',
 | 
				
			||||||
| 
						 | 
					@ -173,7 +181,7 @@ $constStr = [
 | 
				
			||||||
        ],
 | 
					        ],
 | 
				
			||||||
        'ja' => [
 | 
					        'ja' => [
 | 
				
			||||||
            'admin' => 'パスワードを管理する、追加しない場合、ログインページは表示されず、ログインできません。',
 | 
					            'admin' => 'パスワードを管理する、追加しない場合、ログインページは表示されず、ログインできません。',
 | 
				
			||||||
            'adminloginpage' => '設定すると、ログインボタンとページが非表示になります。ログインを管理するためのページは\'?admin \'ではなく、\'?この設定の値\'。',
 | 
					            'adminloginpage' => '設定すると、ログインボタンとページが非表示になります。ログインを管理するためのページは\'?login=admin \'ではなく、\'?login=この設定の値\'。',
 | 
				
			||||||
            'autoJumpFirstDisk' => '複数のディスクを使って、1を設定すると、自動的に最初のディスクにジャンプします。',
 | 
					            'autoJumpFirstDisk' => '複数のディスクを使って、1を設定すると、自動的に最初のディスクにジャンプします。',
 | 
				
			||||||
            'customScript' => '<script>は、すべてのページに存在します。例えば、httpを置いてhttpsをジャンプします。',
 | 
					            'customScript' => '<script>は、すべてのページに存在します。例えば、httpを置いてhttpsをジャンプします。',
 | 
				
			||||||
            'customCss' => '<style>は、<head>の一番後ろにあります。',
 | 
					            'customCss' => '<style>は、<head>の一番後ろにあります。',
 | 
				
			||||||
| 
						 | 
					@ -198,7 +206,7 @@ $constStr = [
 | 
				
			||||||
        ],
 | 
					        ],
 | 
				
			||||||
        'ko-kr' => [
 | 
					        'ko-kr' => [
 | 
				
			||||||
            'admin' => '비밀번호를 관리하고 로그인 페이지를 표시하지 않으며 추가하지 않으면 로그인 할 수 없습니다.',
 | 
					            'admin' => '비밀번호를 관리하고 로그인 페이지를 표시하지 않으며 추가하지 않으면 로그인 할 수 없습니다.',
 | 
				
			||||||
            'adminloginpage' => '설정하면 로그인 버튼과 페이지가 숨겨집니다. 로그인 관리 페이지는 더 이상 \ ?Admin\'이 아니라 \ ?이 설정의 값 \'입니다.',
 | 
					            'adminloginpage' => '설정하면 로그인 버튼과 페이지가 숨겨집니다. 로그인 관리 페이지는 더 이상 \ ?login=admin\'이 아니라 \ ?login=이 설정의 값 \'입니다.',
 | 
				
			||||||
            'autoJumpFirstDisk' => '여러 개의 디스크 에 사용 되 며, 1 이 되면 첫 번 째 디스크 로 자동 으로 이동 합 니 다.',
 | 
					            'autoJumpFirstDisk' => '여러 개의 디스크 에 사용 되 며, 1 이 되면 첫 번 째 디스크 로 자동 으로 이동 합 니 다.',
 | 
				
			||||||
            'customScript' => '< script > 은 모든 페이지 에 존재 합 니 다. 예 를 들 어 http 을 하나 넣 고 https 로 이동 합 니 다.',
 | 
					            'customScript' => '< script > 은 모든 페이지 에 존재 합 니 다. 예 를 들 어 http 을 하나 넣 고 https 로 이동 합 니 다.',
 | 
				
			||||||
            'customCss' => '< 스타일 >, < 헤드 > 맨 뒤에',
 | 
					            'customCss' => '< 스타일 >, < 헤드 > 맨 뒤에',
 | 
				
			||||||
| 
						 | 
					@ -223,7 +231,7 @@ $constStr = [
 | 
				
			||||||
        ],
 | 
					        ],
 | 
				
			||||||
        'fa' => [
 | 
					        'fa' => [
 | 
				
			||||||
            'admin' => 'رمز عبور ادمین، در صورت خالی بودن دکمه لاگین به نمایش در نمیآید',
 | 
					            'admin' => 'رمز عبور ادمین، در صورت خالی بودن دکمه لاگین به نمایش در نمیآید',
 | 
				
			||||||
            'adminloginpage' => 'در صورت تنظیم ، دکمه ورود نمایش داده نمی شود و صفحه ورود دیگر \?admin\ نیست بلکه \?{مقدار ورودی شما}\ است.',
 | 
					            'adminloginpage' => 'در صورت تنظیم ، دکمه ورود نمایش داده نمی شود و صفحه ورود دیگر \?login=admin\ نیست بلکه \?login={مقدار ورودی شما}\ است.',
 | 
				
			||||||
            'referrer' => '',
 | 
					            'referrer' => '',
 | 
				
			||||||
            'domain_path' => 'تنظیم دامنه سفارشی، به صورت a1.com:/dirto/path1|b2.com:/path2',
 | 
					            'domain_path' => 'تنظیم دامنه سفارشی، به صورت a1.com:/dirto/path1|b2.com:/path2',
 | 
				
			||||||
            'diskname' => 'نام دیسک که میخواهید نشان دهید.',
 | 
					            'diskname' => 'نام دیسک که میخواهید نشان دهید.',
 | 
				
			||||||
| 
						 | 
					@ -1126,9 +1134,9 @@ $constStr = [
 | 
				
			||||||
        'ar-sa' => 'اختيار اللغة',
 | 
					        'ar-sa' => 'اختيار اللغة',
 | 
				
			||||||
    ],
 | 
					    ],
 | 
				
			||||||
    'RefreshCache' => [
 | 
					    'RefreshCache' => [
 | 
				
			||||||
        'en-us' => 'RefreshCache',
 | 
					        'en-us' => 'Refresh Cache of Current Folder',
 | 
				
			||||||
        'zh-cn' => '刷新缓存',
 | 
					        'zh-cn' => '刷新当前目录的缓存',
 | 
				
			||||||
        'zh-tw' => '重新整理快取',
 | 
					        'zh-tw' => '重新整理当前資料夾快取',
 | 
				
			||||||
        'ja' => 'キャッシュを再構築',
 | 
					        'ja' => 'キャッシュを再構築',
 | 
				
			||||||
        'ko-kr' => '캐시 플러시',
 | 
					        'ko-kr' => '캐시 플러시',
 | 
				
			||||||
        'fa' => 'رفرش cache',
 | 
					        'fa' => 'رفرش cache',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -320,6 +320,7 @@ class Aliyundrive {
 | 
				
			||||||
        return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
 | 
					        return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    public function Copy($file) {
 | 
					    public function Copy($file) {
 | 
				
			||||||
 | 
					        return output('NO copy', 415);
 | 
				
			||||||
        if (!$file['id']) {
 | 
					        if (!$file['id']) {
 | 
				
			||||||
            $oldfile = $this->list_path($file['path'] . '/' . $file['name']);
 | 
					            $oldfile = $this->list_path($file['path'] . '/' . $file['name']);
 | 
				
			||||||
            //error_log1('res:' . json_encode($res));
 | 
					            //error_log1('res:' . json_encode($res));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -446,7 +446,7 @@ class Onedrive {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $envs = '';
 | 
					        $envs = '';
 | 
				
			||||||
        foreach ($EnvConfigs as $env => $v) if (isCommonEnv($env)) $envs .= '\'' . $env . '\', ';
 | 
					        foreach ($EnvConfigs as $env => $v) if (isCommonEnv($env)) $envs .= '\'' . $env . '\', ';
 | 
				
			||||||
        $url = path_format($_SERVER['PHP_SELF'] . '/');
 | 
					        $url = $_SERVER['PHP_SELF'];
 | 
				
			||||||
        //$this->api_url = splitfirst($_SERVER['api_url'], '/v1.0')[0] . '/v1.0';
 | 
					        //$this->api_url = splitfirst($_SERVER['api_url'], '/v1.0')[0] . '/v1.0';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (isset($_GET['Finish'])) {
 | 
					        if (isset($_GET['Finish'])) {
 | 
				
			||||||
| 
						 | 
					@ -478,8 +478,8 @@ class Onedrive {
 | 
				
			||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
                    return message($arr['stat'] . $arr['body'], 'Get User ID', $arr['stat']);
 | 
					                    return message($arr['stat'] . $arr['body'], 'Get User ID', $arr['stat']);
 | 
				
			||||||
                }*/
 | 
					                }*/
 | 
				
			||||||
                if (get_class($this)=='Sharepoint') $tmp['Driver'] = 'Onedrive';
 | 
					                if ($tmp['Driver']=='Sharepoint') $tmp['Driver'] = 'Onedrive';
 | 
				
			||||||
                elseif (get_class($this)=='SharepointCN') $tmp['Driver'] = 'OnedriveCN';
 | 
					                elseif ($tmp['Driver']=='SharepointCN') $tmp['Driver'] = 'OnedriveCN';
 | 
				
			||||||
                $tmp['sharepointSite'] = '';
 | 
					                $tmp['sharepointSite'] = '';
 | 
				
			||||||
                $tmp['siteid'] = '';
 | 
					                $tmp['siteid'] = '';
 | 
				
			||||||
            } elseif ($_POST['DriveType']=='Custom') {
 | 
					            } elseif ($_POST['DriveType']=='Custom') {
 | 
				
			||||||
| 
						 | 
					@ -492,14 +492,14 @@ class Onedrive {
 | 
				
			||||||
                //if ($arr['stat']!=200) return message($arr['stat'] . $arr['body'], 'Get Sharepoint Drive ID ' . $_POST['DriveType'], $arr['stat']);
 | 
					                //if ($arr['stat']!=200) return message($arr['stat'] . $arr['body'], 'Get Sharepoint Drive ID ' . $_POST['DriveType'], $arr['stat']);
 | 
				
			||||||
                $tmp['siteid'] = $siteid;
 | 
					                $tmp['siteid'] = $siteid;
 | 
				
			||||||
                $tmp['sharepointSite'] = $_POST['sharepointSite'];
 | 
					                $tmp['sharepointSite'] = $_POST['sharepointSite'];
 | 
				
			||||||
                if (get_class($this)=='Onedrive') $tmp['Driver'] = 'Sharepoint';
 | 
					                if ($tmp['Driver']=='Onedrive') $tmp['Driver'] = 'Sharepoint';
 | 
				
			||||||
                elseif (get_class($this)=='OnedriveCN') $tmp['Driver'] = 'SharepointCN';
 | 
					                elseif ($tmp['Driver']=='OnedriveCN') $tmp['Driver'] = 'SharepointCN';
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                // 直接是siteid
 | 
					                // 直接是siteid
 | 
				
			||||||
                $tmp['siteid'] = $_POST['DriveType'];
 | 
					                $tmp['siteid'] = $_POST['DriveType'];
 | 
				
			||||||
                $tmp['sharepointSite'] = $_POST['sharepointSiteUrl'];
 | 
					                $tmp['sharepointSite'] = $_POST['sharepointSiteUrl'];
 | 
				
			||||||
                if (get_class($this)=='Onedrive') $tmp['Driver'] = 'Sharepoint';
 | 
					                if ($tmp['Driver']=='Onedrive') $tmp['Driver'] = 'Sharepoint';
 | 
				
			||||||
                elseif (get_class($this)=='OnedriveCN') $tmp['Driver'] = 'SharepointCN';
 | 
					                elseif ($tmp['Driver']=='OnedriveCN') $tmp['Driver'] = 'SharepointCN';
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $response = setConfigResponse( setConfig($tmp, $this->disktag) );
 | 
					            $response = setConfigResponse( setConfig($tmp, $this->disktag) );
 | 
				
			||||||
| 
						 | 
					@ -520,11 +520,11 @@ class Onedrive {
 | 
				
			||||||
                        console.log(i++);
 | 
					                        console.log(i++);
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        clearInterval(uploadList);
 | 
					                        clearInterval(uploadList);
 | 
				
			||||||
                        location.href = "' . $url . '";
 | 
					                        location.href = "' . $url . '?setup&disktag=' . $_GET['disktag'] . '";
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }, 1000);
 | 
					                }, 1000);
 | 
				
			||||||
                </script>';
 | 
					                </script>';
 | 
				
			||||||
                return message($html, getconstStr('WaitJumpIndex'), 201, 1);
 | 
					                return message($html, getconstStr('Wait'), 201, 1);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -554,12 +554,13 @@ class Onedrive {
 | 
				
			||||||
            $title = 'Select Driver';
 | 
					            $title = 'Select Driver';
 | 
				
			||||||
            $html = '
 | 
					            $html = '
 | 
				
			||||||
<div>
 | 
					<div>
 | 
				
			||||||
    <form action="?Finish&disktag=' . $_GET['disktag'] . '&AddDisk=' . get_class($this) . '" method="post" onsubmit="return notnull(this);">
 | 
					    <form name="form1" action="?Finish&disktag=' . $_GET['disktag'] . '&AddDisk=' . get_class($this) . '" method="post" onsubmit="return notnull(this);">
 | 
				
			||||||
        <label><input type="radio" name="DriveType" value="Onedrive" checked>' . 'Use Onedrive ' . getconstStr(' ') . '</label><br>';
 | 
					        <label><input type="radio" name="DriveType" value="Onedrive">' . 'Use Onedrive ' . getconstStr(' ') . '</label><br>';
 | 
				
			||||||
            if ($sites[0]!='') foreach ($sites as $k => $v) {
 | 
					            if ($sites[0]!='') foreach ($sites as $k => $v) {
 | 
				
			||||||
                $html .= '
 | 
					                $html .= '
 | 
				
			||||||
        <label>
 | 
					        <label>
 | 
				
			||||||
            <input type="radio" name="DriveType" value="' . $v['id'] . '" onclick="document.getElementById(\'sharepointSiteUrl\').value=\'' . $v['webUrl'] . '\';">' . 'Use Sharepoint: <br><div style="width:100%;margin:0px 35px">webUrl: ' . $v['webUrl'] . '<br>siteid: ' . $v['id'] . '</div>
 | 
					            <input type="radio" name="DriveType" value="' . $v['id'] . '" onclick="document.getElementById(\'sharepointSiteUrl\').value=\'' . $v['webUrl'] . '\';">' . 'Use Sharepoint: <br><div style="width:100%;margin:0px 35px">webUrl: ' . $v['webUrl'] . '<br>siteid: ' . $v['id'] . '</div>
 | 
				
			||||||
 | 
					            <input type="hidden" id="' . $v['id'] . '" name="' . $v['id'] . '" value="' . $v['webUrl'] . '">
 | 
				
			||||||
        </label>';
 | 
					        </label>';
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            $html .= '
 | 
					            $html .= '
 | 
				
			||||||
| 
						 | 
					@ -576,6 +577,26 @@ class Onedrive {
 | 
				
			||||||
    </form>
 | 
					    </form>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
 | 
					    var driver = "' . $_GET['AddDisk'] . '";
 | 
				
			||||||
 | 
					    if (driver=="Onedrive"||driver=="OnedriveCN") {
 | 
				
			||||||
 | 
					        document.form1.DriveType[0].checked = true;
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        var siteid = "' . getConfig('siteid', $this->disktag) . '";
 | 
				
			||||||
 | 
					        if (siteid==="") {
 | 
				
			||||||
 | 
					            document.form1.DriveType[document.form1.DriveType.length-1].checked = true;
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            for (i=0; i<document.form1.DriveType.length; i++) {
 | 
				
			||||||
 | 
					                if (document.form1.DriveType[i].value==siteid) {
 | 
				
			||||||
 | 
					                    document.form1.DriveType[i].checked = true;
 | 
				
			||||||
 | 
					                    document.getElementById(\'sharepointSiteUrl\').value = document.getElementById(siteid).value;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if (document.getElementById(\'sharepointSiteUrl\').value=="") {
 | 
				
			||||||
 | 
					                document.form1.DriveType[document.form1.DriveType.length-1].checked = true;
 | 
				
			||||||
 | 
					                document.getElementById(\'sharepointSite\').value = "' . getConfig('sharepointSite', $this->disktag) . '";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    function notnull(t)
 | 
					    function notnull(t)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if (t.DriveType.value==\'\') {
 | 
					        if (t.DriveType.value==\'\') {
 | 
				
			||||||
| 
						 | 
					@ -590,8 +611,8 @@ class Onedrive {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    </script>
 | 
					</script>
 | 
				
			||||||
    ';
 | 
					';
 | 
				
			||||||
            return message($html, $title, 201);
 | 
					            return message($html, $title, 201);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -611,6 +632,7 @@ class Onedrive {
 | 
				
			||||||
                texta[i].style.height = texta[i].scrollHeight + \'px\';
 | 
					                texta[i].style.height = texta[i].scrollHeight + \'px\';
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        </script>';
 | 
					        </script>';
 | 
				
			||||||
 | 
					                $tmptoken['Driver'] = $_GET['AddDisk'];
 | 
				
			||||||
                $tmptoken['refresh_token'] = $refresh_token;
 | 
					                $tmptoken['refresh_token'] = $refresh_token;
 | 
				
			||||||
                $tmptoken['token_expires'] = time()+7*24*60*60;
 | 
					                $tmptoken['token_expires'] = time()+7*24*60*60;
 | 
				
			||||||
                $response = setConfigResponse( setConfig($tmptoken, $this->disktag) );
 | 
					                $response = setConfigResponse( setConfig($tmptoken, $this->disktag) );
 | 
				
			||||||
| 
						 | 
					@ -628,7 +650,7 @@ class Onedrive {
 | 
				
			||||||
                        console.log(i++);
 | 
					                        console.log(i++);
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        clearInterval(uploadList);
 | 
					                        clearInterval(uploadList);
 | 
				
			||||||
                        location.href = "' . $url . '?AddDisk=' . get_class($this) . '&disktag=' . $_GET['disktag'] . '&SelectDrive";
 | 
					                        location.href = "' . $url . '?AddDisk=' . $_GET['AddDisk'] . '&disktag=' . $_GET['disktag'] . '&SelectDrive";
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }, 1000);
 | 
					                }, 1000);
 | 
				
			||||||
                </script>';
 | 
					                </script>';
 | 
				
			||||||
| 
						 | 
					@ -640,7 +662,7 @@ class Onedrive {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (isset($_GET['install1'])) {
 | 
					        if (isset($_GET['install1'])) {
 | 
				
			||||||
            if (get_class($this)=='Onedrive' || get_class($this)=='OnedriveCN') {
 | 
					            //if (get_class($this)=='Onedrive' || get_class($this)=='OnedriveCN') {
 | 
				
			||||||
                return message('
 | 
					                return message('
 | 
				
			||||||
    <a href="" id="a1">' . getconstStr('JumptoOffice') . '</a>
 | 
					    <a href="" id="a1">' . getconstStr('JumptoOffice') . '</a>
 | 
				
			||||||
    <script>
 | 
					    <script>
 | 
				
			||||||
| 
						 | 
					@ -651,9 +673,9 @@ class Onedrive {
 | 
				
			||||||
        location.href = url;
 | 
					        location.href = url;
 | 
				
			||||||
    </script>
 | 
					    </script>
 | 
				
			||||||
    ', getconstStr('Wait') . ' 1s', 201);
 | 
					    ', getconstStr('Wait') . ' 1s', 201);
 | 
				
			||||||
            } else {
 | 
					            //} else {
 | 
				
			||||||
                return message('Something error, retry after a few seconds.', 'Retry', 201);
 | 
					            //    return message('Something error, retry after a few seconds.', 'Retry', 201);
 | 
				
			||||||
            }
 | 
					            //}
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (isset($_GET['install0'])) {
 | 
					        if (isset($_GET['install0'])) {
 | 
				
			||||||
| 
						 | 
					@ -680,7 +702,8 @@ class Onedrive {
 | 
				
			||||||
                //$this->disktag = $_POST['disktag_add'];
 | 
					                //$this->disktag = $_POST['disktag_add'];
 | 
				
			||||||
                $tmp['disktag_add'] = $_POST['disktag_add'];
 | 
					                $tmp['disktag_add'] = $_POST['disktag_add'];
 | 
				
			||||||
                $tmp['diskname'] = $_POST['diskname'];
 | 
					                $tmp['diskname'] = $_POST['diskname'];
 | 
				
			||||||
                $tmp['Driver'] = $_POST['Drive_ver'];
 | 
					                //$tmp['Driver'] = $_POST['Drive_ver'];
 | 
				
			||||||
 | 
					                $tmp['Driver'] = $_GET['AddDisk'];
 | 
				
			||||||
                if ($_POST['Drive_ver']=='Sharelink') {
 | 
					                if ($_POST['Drive_ver']=='Sharelink') {
 | 
				
			||||||
                    $tmp['shareurl'] = $_POST['shareurl'];
 | 
					                    $tmp['shareurl'] = $_POST['shareurl'];
 | 
				
			||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
| 
						 | 
					@ -700,7 +723,7 @@ class Onedrive {
 | 
				
			||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
                    $title = getconstStr('MayinEnv');
 | 
					                    $title = getconstStr('MayinEnv');
 | 
				
			||||||
                    $html = getconstStr('Wait');
 | 
					                    $html = getconstStr('Wait');
 | 
				
			||||||
                    if ($_POST['Drive_ver']!='Sharelink') $url .= '?install1&disktag=' . $_GET['disktag'] . '&AddDisk=' . $_POST['Drive_ver'];
 | 
					                    if ($_POST['Drive_ver']!='Sharelink') $url .= '?install1&disktag=' . $_GET['disktag'] . '&AddDisk=' . $_GET['AddDisk'];
 | 
				
			||||||
                    $html .= '<script>
 | 
					                    $html .= '<script>
 | 
				
			||||||
                    var i = 0;
 | 
					                    var i = 0;
 | 
				
			||||||
                    var status = "' . $response['DplStatus'] . '";
 | 
					                    var status = "' . $response['DplStatus'] . '";
 | 
				
			||||||
| 
						 | 
					@ -721,7 +744,7 @@ class Onedrive {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $html = '
 | 
					        $html = '
 | 
				
			||||||
<div>
 | 
					<div>
 | 
				
			||||||
    <form id="form1" action="" method="post" onsubmit="return notnull(this);">
 | 
					    <form id="form1" name="form1" action="" method="post" onsubmit="return notnull(this);">
 | 
				
			||||||
        ' . getconstStr('DiskTag') . ': (' . getConfig('disktag') . ')
 | 
					        ' . getconstStr('DiskTag') . ': (' . getConfig('disktag') . ')
 | 
				
			||||||
        <input type="text" name="disktag_add" placeholder="' . getconstStr('EnvironmentsDescription')['disktag'] . '" style="width:100%"><br>
 | 
					        <input type="text" name="disktag_add" placeholder="' . getconstStr('EnvironmentsDescription')['disktag'] . '" style="width:100%"><br>
 | 
				
			||||||
        ' . getconstStr('DiskName') . ':
 | 
					        ' . getconstStr('DiskName') . ':
 | 
				
			||||||
| 
						 | 
					@ -733,7 +756,7 @@ class Onedrive {
 | 
				
			||||||
                <label><input type="checkbox" name="NT_Drive_custom" onclick="document.getElementById(\'NT_secret\').style.display=(this.checked?\'\':\'none\');">' . getconstStr('CustomIdSecret') . '</label><br>
 | 
					                <label><input type="checkbox" name="NT_Drive_custom" onclick="document.getElementById(\'NT_secret\').style.display=(this.checked?\'\':\'none\');">' . getconstStr('CustomIdSecret') . '</label><br>
 | 
				
			||||||
                <div id="NT_secret" style="display:none;margin:10px 35px">
 | 
					                <div id="NT_secret" style="display:none;margin:10px 35px">
 | 
				
			||||||
                    <a href="https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps" target="_blank">' . getconstStr('GetSecretIDandKEY') . '</a><br>
 | 
					                    <a href="https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps" target="_blank">' . getconstStr('GetSecretIDandKEY') . '</a><br>
 | 
				
			||||||
                    return_uri(Reply URL):<br>https://scfonedrive.github.io/<br>
 | 
					                    return_uri(Reply URL):<br>' . $this->redirect_uri . '<br>
 | 
				
			||||||
                    client_id:<input type="text" name="NT_client_id" style="width:100%" placeholder="a1b2c345-90ab-cdef-ghij-klmnopqrstuv"><br>
 | 
					                    client_id:<input type="text" name="NT_client_id" style="width:100%" placeholder="a1b2c345-90ab-cdef-ghij-klmnopqrstuv"><br>
 | 
				
			||||||
                    client_secret:<input type="text" name="NT_client_secret" style="width:100%"><br>
 | 
					                    client_secret:<input type="text" name="NT_client_secret" style="width:100%"><br>
 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
| 
						 | 
					@ -743,7 +766,7 @@ class Onedrive {
 | 
				
			||||||
                <label><input type="checkbox" name="CN_Drive_custom" onclick="document.getElementById(\'CN_secret\').style.display=(this.checked?\'\':\'none\');">' . getconstStr('CustomIdSecret') . '</label><br>
 | 
					                <label><input type="checkbox" name="CN_Drive_custom" onclick="document.getElementById(\'CN_secret\').style.display=(this.checked?\'\':\'none\');">' . getconstStr('CustomIdSecret') . '</label><br>
 | 
				
			||||||
                <div id="CN_secret" style="display:none;margin:10px 35px">
 | 
					                <div id="CN_secret" style="display:none;margin:10px 35px">
 | 
				
			||||||
                    <a href="https://portal.azure.cn/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps" target="_blank">' . getconstStr('GetSecretIDandKEY') . '</a><br>
 | 
					                    <a href="https://portal.azure.cn/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps" target="_blank">' . getconstStr('GetSecretIDandKEY') . '</a><br>
 | 
				
			||||||
                    return_uri(Reply URL):<br>https://scfonedrive.github.io/<br>
 | 
					                    return_uri(Reply URL):<br>' . $this->redirect_uri . '<br>
 | 
				
			||||||
                    client_id:<input type="text" name="CN_client_id" style="width:100%" placeholder="a1b2c345-90ab-cdef-ghij-klmnopqrstuv"><br>
 | 
					                    client_id:<input type="text" name="CN_client_id" style="width:100%" placeholder="a1b2c345-90ab-cdef-ghij-klmnopqrstuv"><br>
 | 
				
			||||||
                    client_secret:<input type="text" name="CN_client_secret" style="width:100%"><br>
 | 
					                    client_secret:<input type="text" name="CN_client_secret" style="width:100%"><br>
 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
| 
						 | 
					@ -761,6 +784,21 @@ class Onedrive {
 | 
				
			||||||
    </form>
 | 
					    </form>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
    <script>
 | 
					    <script>
 | 
				
			||||||
 | 
					        var driver = "' . get_class($this) . '";
 | 
				
			||||||
 | 
					        if (driver=="Onedrive" || driver=="Sharepoint") {
 | 
				
			||||||
 | 
					            document.form1.Drive_ver[0].checked = true;
 | 
				
			||||||
 | 
					            document.getElementById(\'NT_custom\').style.display=\'\';
 | 
				
			||||||
 | 
					            //document.getElementById(\'CN_custom\').style.display=\'\';
 | 
				
			||||||
 | 
					            //document.getElementById(\'inputshareurl\').style.display=\'none\';
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (driver=="OnedriveCN" || driver=="SharepointCN") {
 | 
				
			||||||
 | 
					            document.form1.Drive_ver[1].checked = true;
 | 
				
			||||||
 | 
					            document.getElementById(\'CN_custom\').style.display=\'\';
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (driver=="Sharelink") {
 | 
				
			||||||
 | 
					            document.form1.Drive_ver[2].checked = true;
 | 
				
			||||||
 | 
					            document.getElementById(\'inputshareurl\').style.display=\'\';
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        function notnull(t)
 | 
					        function notnull(t)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (t.disktag_add.value==\'\') {
 | 
					            if (t.disktag_add.value==\'\') {
 | 
				
			||||||
| 
						 | 
					@ -769,7 +807,7 @@ class Onedrive {
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            envs = [' . $envs . '];
 | 
					            envs = [' . $envs . '];
 | 
				
			||||||
            if (envs.indexOf(t.disktag_add.value)>-1) {
 | 
					            if (envs.indexOf(t.disktag_add.value)>-1) {
 | 
				
			||||||
                alert("Do not input ' . $envs . '");
 | 
					                alert("Do not input \"" + t.disktag_add.value + "\" in ' . getconstStr('DiskTag') . '");
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            var reg = /^[a-zA-Z]([_a-zA-Z0-9]{1,20})$/;
 | 
					            var reg = /^[a-zA-Z]([_a-zA-Z0-9]{1,20})$/;
 | 
				
			||||||
| 
						 | 
					@ -786,25 +824,28 @@ class Onedrive {
 | 
				
			||||||
                    alert(\'shareurl\');
 | 
					                    alert(\'shareurl\');
 | 
				
			||||||
                    return false;
 | 
					                    return false;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					                driver = \'Sharelink\';
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                if ((t.Drive_ver.value==\'Onedrive\') && t.NT_Drive_custom.checked==true) {
 | 
					                if (t.Drive_ver.value==\'Onedrive\') {
 | 
				
			||||||
 | 
					                    if (t.NT_Drive_custom.checked==true) {
 | 
				
			||||||
                        if (t.NT_client_secret.value==\'\'||t.NT_client_id.value==\'\') {
 | 
					                        if (t.NT_client_secret.value==\'\'||t.NT_client_id.value==\'\') {
 | 
				
			||||||
                            alert(\'client_id & client_secret\');
 | 
					                            alert(\'client_id & client_secret\');
 | 
				
			||||||
                            return false;
 | 
					                            return false;
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                if ((t.Drive_ver.value==\'OnedriveCN\') && t.CN_Drive_custom.checked==true) {
 | 
					                    if (driver!="Onedrive" && driver!="Sharepoint") driver = "Onedrive";
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                if (t.Drive_ver.value==\'OnedriveCN\') {
 | 
				
			||||||
 | 
					                    if (t.CN_Drive_custom.checked==true) {
 | 
				
			||||||
                        if (t.CN_client_secret.value==\'\'||t.CN_client_id.value==\'\') {
 | 
					                        if (t.CN_client_secret.value==\'\'||t.CN_client_id.value==\'\') {
 | 
				
			||||||
                            alert(\'client_id & client_secret\');
 | 
					                            alert(\'client_id & client_secret\');
 | 
				
			||||||
                            return false;
 | 
					                            return false;
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					                    if (driver!="OnedriveCN" && driver!="SharepointCN") driver = "OnedriveCN";
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            document.getElementById("form1").action="?install0&disktag=" + t.disktag_add.value + "&AddDisk=" + t.Drive_ver.value;
 | 
					            }
 | 
				
			||||||
            //var expd = new Date();
 | 
					            document.getElementById("form1").action="?install0&disktag=" + t.disktag_add.value + "&AddDisk=" + driver;
 | 
				
			||||||
            //expd.setTime(expd.getTime()+(2*60*60*1000));
 | 
					 | 
				
			||||||
            //var expires = "expires="+expd.toGMTString();
 | 
					 | 
				
			||||||
            //document.cookie=\'disktag=\'+t.disktag_add.value+\'; path=/; \'+expires;
 | 
					 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    </script>';
 | 
					    </script>';
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										31
									
								
								index.php
								
								
								
								
							
							
						
						
									
										31
									
								
								index.php
								
								
								
								
							| 
						 | 
					@ -5,18 +5,19 @@ include 'vendor/autoload.php';
 | 
				
			||||||
include 'conststr.php';
 | 
					include 'conststr.php';
 | 
				
			||||||
include 'common.php';
 | 
					include 'common.php';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					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>';
 | 
				
			||||||
if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
 | 
					if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
 | 
				
			||||||
    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 (isset($_SERVER['FC_SERVER_PATH'])&&$_SERVER['FC_SERVER_PATH']==='/var/fc/runtime/php7.2') {
 | 
					} elseif (isset($_SERVER['FC_FUNC_CODE_PATH'])) {
 | 
				
			||||||
    include 'platform/AliyunFC.php';
 | 
					    include 'platform/AliyunFC.php';
 | 
				
			||||||
} elseif ($_SERVER['_APP_SHARE_DIR']=='/var/share/CFF/processrouter') {
 | 
					} 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 ($_SERVER['BCE_CFC_RUNTIME_NAME']=='php7') {
 | 
					} elseif (isset($_SERVER['BCE_CFC_RUNTIME_NAME']) && $_SERVER['BCE_CFC_RUNTIME_NAME']=='php7') {
 | 
				
			||||||
    include 'platform/BaiduCFC.php';
 | 
					    include 'platform/BaiduCFC.php';
 | 
				
			||||||
} elseif (isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app') {
 | 
					} elseif (isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app') {
 | 
				
			||||||
    include 'platform/Heroku.php';
 | 
					    include 'platform/Heroku.php';
 | 
				
			||||||
| 
						 | 
					@ -39,6 +40,22 @@ if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
 | 
				
			||||||
    //echo 'path:'. $path;
 | 
					    //echo 'path:'. $path;
 | 
				
			||||||
    $_GET = getGET();
 | 
					    $_GET = getGET();
 | 
				
			||||||
    //echo '<pre>'. json_encode($_GET, JSON_PRETTY_PRINT).'</pre>';
 | 
					    //echo '<pre>'. json_encode($_GET, JSON_PRETTY_PRINT).'</pre>';
 | 
				
			||||||
 | 
					    $re = main($path);
 | 
				
			||||||
 | 
					    $sendHeaders = array();
 | 
				
			||||||
 | 
					    foreach ($re['headers'] as $headerName => $headerVal) {
 | 
				
			||||||
 | 
					        header($headerName . ': ' . $headerVal, true);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    http_response_code($re['statusCode']);
 | 
				
			||||||
 | 
					    if ($re['isBase64Encoded']) echo base64_decode($re['body']);
 | 
				
			||||||
 | 
					    else echo $re['body'];
 | 
				
			||||||
 | 
					} elseif (isset($_SERVER['DOCUMENT_ROOT'])&&substr($_SERVER['DOCUMENT_ROOT'], 0, 13)==='/home/runner/') {
 | 
				
			||||||
 | 
					    include 'platform/Replit.php';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    $path = getpath();
 | 
				
			||||||
 | 
					    //echo 'path:'. $path;
 | 
				
			||||||
 | 
					    $_GET = getGET();
 | 
				
			||||||
 | 
					    //echo '<pre>'. json_encode($_GET, JSON_PRETTY_PRINT).'</pre>';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $re = main($path);
 | 
					    $re = main($path);
 | 
				
			||||||
    $sendHeaders = array();
 | 
					    $sendHeaders = array();
 | 
				
			||||||
    foreach ($re['headers'] as $headerName => $headerVal) {
 | 
					    foreach ($re['headers'] as $headerName => $headerVal) {
 | 
				
			||||||
| 
						 | 
					@ -56,7 +73,6 @@ if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
 | 
				
			||||||
    //echo 'path:'. $path;
 | 
					    //echo 'path:'. $path;
 | 
				
			||||||
    $_GET = getGET();
 | 
					    $_GET = getGET();
 | 
				
			||||||
    //echo '<pre>'. json_encode($_GET, JSON_PRETTY_PRINT).'</pre>';
 | 
					    //echo '<pre>'. json_encode($_GET, JSON_PRETTY_PRINT).'</pre>';
 | 
				
			||||||
 | 
					 | 
				
			||||||
    $re = main($path);
 | 
					    $re = main($path);
 | 
				
			||||||
    $sendHeaders = array();
 | 
					    $sendHeaders = array();
 | 
				
			||||||
    foreach ($re['headers'] as $headerName => $headerVal) {
 | 
					    foreach ($re['headers'] as $headerName => $headerVal) {
 | 
				
			||||||
| 
						 | 
					@ -73,6 +89,9 @@ function main_handler($event, $context)
 | 
				
			||||||
    $event = json_decode(json_encode($event), true);
 | 
					    $event = json_decode(json_encode($event), true);
 | 
				
			||||||
    $context = json_decode(json_encode($context), true);
 | 
					    $context = json_decode(json_encode($context), true);
 | 
				
			||||||
    printInput($event, $context);
 | 
					    printInput($event, $context);
 | 
				
			||||||
 | 
					    if ( $event['requestContext']['serviceId'] === substr($event['headers']['host'], 0, strlen($event['requestContext']['serviceId'])) ) {
 | 
				
			||||||
 | 
					        if ($event['path']==='/' . $context['function_name']) return output('add / at last.', 308, ['Location'=>'/'.$event['requestContext']['stage'].'/'.$context['function_name'].'/']);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    unset($_POST);
 | 
					    unset($_POST);
 | 
				
			||||||
    unset($_GET);
 | 
					    unset($_GET);
 | 
				
			||||||
    unset($_COOKIE);
 | 
					    unset($_COOKIE);
 | 
				
			||||||
| 
						 | 
					@ -87,7 +106,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)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (isset($_SERVER['FC_SERVER_PATH'])&&$_SERVER['FC_SERVER_PATH']==='/var/fc/runtime/php7.2') {
 | 
					    if (isset($_SERVER['FC_FUNC_CODE_PATH'])) {
 | 
				
			||||||
        // Aliyun FC
 | 
					        // Aliyun FC
 | 
				
			||||||
        set_error_handler("myErrorHandler");
 | 
					        set_error_handler("myErrorHandler");
 | 
				
			||||||
        $tmp = array(
 | 
					        $tmp = array(
 | 
				
			||||||
| 
						 | 
					@ -111,7 +130,7 @@ function handler($event, $context)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $re = main($path);
 | 
					        $re = main($path);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        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 ($_SERVER['_APP_SHARE_DIR']=='/var/share/CFF/processrouter') {
 | 
					    } elseif ($_SERVER['_APP_SHARE_DIR']=='/var/share/CFF/processrouter') {
 | 
				
			||||||
        // Huawei FG
 | 
					        // Huawei FG
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -67,7 +67,8 @@ 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_SERVER_PATH'] = '/var/fc/runtime/php7.2';
 | 
					    $_SERVER['FC_FUNC_CODE_PATH'] = getenv('FC_FUNC_CODE_PATH');
 | 
				
			||||||
 | 
					    $_SERVER['REQUEST_METHOD'] = $event['method'];
 | 
				
			||||||
    return $path;
 | 
					    return $path;
 | 
				
			||||||
    //return spurlencode($path, '/');
 | 
					    //return spurlencode($path, '/');
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -185,16 +186,16 @@ function install()
 | 
				
			||||||
    if ($_GET['install1']) {
 | 
					    if ($_GET['install1']) {
 | 
				
			||||||
        //if ($_POST['admin']!='') {
 | 
					        //if ($_POST['admin']!='') {
 | 
				
			||||||
            $tmp['timezone'] = $_COOKIE['timezone'];
 | 
					            $tmp['timezone'] = $_COOKIE['timezone'];
 | 
				
			||||||
            $AccessKeyID = getConfig('AccessKeyID');
 | 
					            //$AccessKeyID = getConfig('AccessKeyID');
 | 
				
			||||||
            if ($AccessKeyID=='') {
 | 
					            //if ($AccessKeyID=='') {
 | 
				
			||||||
                $AccessKeyID = $_POST['AccessKeyID'];
 | 
					                $AccessKeyID = $_POST['AccessKeyID'];
 | 
				
			||||||
                $tmp['AccessKeyID'] = $AccessKeyID;
 | 
					                $tmp['AccessKeyID'] = $AccessKeyID;
 | 
				
			||||||
            }
 | 
					            //}
 | 
				
			||||||
            $AccessKeySecret = getConfig('AccessKeySecret');
 | 
					            //$AccessKeySecret = getConfig('AccessKeySecret');
 | 
				
			||||||
            if ($AccessKeySecret=='') {
 | 
					            //if ($AccessKeySecret=='') {
 | 
				
			||||||
                $AccessKeySecret = $_POST['AccessKeySecret'];
 | 
					                $AccessKeySecret = $_POST['AccessKeySecret'];
 | 
				
			||||||
                $tmp['AccessKeySecret'] = $AccessKeySecret;
 | 
					                $tmp['AccessKeySecret'] = $AccessKeySecret;
 | 
				
			||||||
            }
 | 
					            //}
 | 
				
			||||||
            $response = setConfigResponse( SetbaseConfig($tmp, $_SERVER['accountId'], $_SERVER['region'], $_SERVER['service_name'], $_SERVER['function_name'], $AccessKeyID, $AccessKeySecret) );
 | 
					            $response = setConfigResponse( SetbaseConfig($tmp, $_SERVER['accountId'], $_SERVER['region'], $_SERVER['service_name'], $_SERVER['function_name'], $AccessKeyID, $AccessKeySecret) );
 | 
				
			||||||
            if (api_error($response)) {
 | 
					            if (api_error($response)) {
 | 
				
			||||||
                $html = api_error_msg($response);
 | 
					                $html = api_error_msg($response);
 | 
				
			||||||
| 
						 | 
					@ -229,12 +230,13 @@ language:<br>';
 | 
				
			||||||
            $html .= '
 | 
					            $html .= '
 | 
				
			||||||
        <label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
 | 
					        <label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (getConfig('AccessKeyID')==''||getConfig('AccessKeySecret')=='') $html .= '
 | 
					        //if (getConfig('AccessKeyID')==''||getConfig('AccessKeySecret')=='') 
 | 
				
			||||||
        <a href="https://usercenter.console.aliyun.com/?#/manage/ak" target="_blank">'.getconstStr('Create').' AccessKeyID & AccessKeySecret</a><br>
 | 
					 | 
				
			||||||
        <label>AccessKeyID:<input name="AccessKeyID" type="text" placeholder="" size=""></label><br>
 | 
					 | 
				
			||||||
        <label>AccessKeySecret:<input name="AccessKeySecret" type="text" placeholder="" size=""></label><br>';
 | 
					 | 
				
			||||||
        $html .= '
 | 
					        $html .= '
 | 
				
			||||||
        <input type="submit" value="'.getconstStr('Submit').'">
 | 
					        <a href="https://usercenter.console.aliyun.com/?#/manage/ak" target="_blank">' . getconstStr('Create') . ' AccessKeyID & AccessKeySecret</a><br>
 | 
				
			||||||
 | 
					        <label>AccessKeyID:<input name="AccessKeyID" type="text" placeholder="" size=""></label><br>
 | 
				
			||||||
 | 
					        <label>AccessKeySecret:<input name="AccessKeySecret" type="password" placeholder="" size=""></label><br>';
 | 
				
			||||||
 | 
					        $html .= '
 | 
				
			||||||
 | 
					        <input type="submit" value="' . getconstStr('Submit') . '">
 | 
				
			||||||
    </form>
 | 
					    </form>
 | 
				
			||||||
    <script>
 | 
					    <script>
 | 
				
			||||||
        var nowtime= new Date();
 | 
					        var nowtime= new Date();
 | 
				
			||||||
| 
						 | 
					@ -253,7 +255,8 @@ language:<br>';
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        function notnull(t)
 | 
					        function notnull(t)
 | 
				
			||||||
        {';
 | 
					        {';
 | 
				
			||||||
        if (getConfig('AccessKeyID')==''||getConfig('AccessKeySecret')=='') $html .= '
 | 
					        //if (getConfig('AccessKeyID')==''||getConfig('AccessKeySecret')=='') 
 | 
				
			||||||
 | 
					        $html .= '
 | 
				
			||||||
            if (t.AccessKeyID.value==\'\') {
 | 
					            if (t.AccessKeyID.value==\'\') {
 | 
				
			||||||
                alert(\'input AccessKeyID\');
 | 
					                alert(\'input AccessKeyID\');
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
| 
						 | 
					@ -269,7 +272,7 @@ language:<br>';
 | 
				
			||||||
        $title = getconstStr('SelectLanguage');
 | 
					        $title = getconstStr('SelectLanguage');
 | 
				
			||||||
        return message($html, $title, 201);
 | 
					        return message($html, $title, 201);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    $html .= '<a href="?install0">'.getconstStr('ClickInstall').'</a>, '.getconstStr('LogintoBind');
 | 
					    $html .= '<a href="?install0">' . getconstStr('ClickInstall').'</a>, ' . getconstStr('LogintoBind');
 | 
				
			||||||
    $title = 'Install';
 | 
					    $title = 'Install';
 | 
				
			||||||
    return message($html, $title, 201);
 | 
					    return message($html, $title, 201);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -419,42 +422,27 @@ function setConfigResponse($response)
 | 
				
			||||||
    return json_decode($response, true);
 | 
					    return json_decode($response, true);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
 | 
					function OnekeyUpate($GitSource = 'Github', $auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    $source = '/tmp/code.zip';
 | 
					    $source = '/tmp/code.zip';
 | 
				
			||||||
    $outPath = '/tmp/';
 | 
					    $outPath = '/tmp/';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if ($GitSource=='Github') {
 | 
				
			||||||
        // 从github下载对应tar.gz,并解压
 | 
					        // 从github下载对应tar.gz,并解压
 | 
				
			||||||
        $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
 | 
					        $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
 | 
				
			||||||
 | 
					    } elseif ($GitSource=='HITGitlab') {
 | 
				
			||||||
 | 
					        $url = 'https://git.hit.edu.cn/' . $auth . '/' . $project . '/-/archive/' . urlencode($branch) . '/' . $project . '-' . urlencode($branch) . '.tar.gz';
 | 
				
			||||||
 | 
					    } else return json_encode(['ErrorMessage'=>'Git Source input Error!']);
 | 
				
			||||||
    $tarfile = '/tmp/github.tar.gz';
 | 
					    $tarfile = '/tmp/github.tar.gz';
 | 
				
			||||||
    file_put_contents($tarfile, file_get_contents($url));
 | 
					    file_put_contents($tarfile, file_get_contents($url));
 | 
				
			||||||
    $phar = new PharData($tarfile);
 | 
					    $phar = new PharData($tarfile);
 | 
				
			||||||
    $html = $phar->extractTo($outPath, null, true);//路径 要解压的文件 是否覆盖
 | 
					    $html = $phar->extractTo($outPath, null, true);//路径 要解压的文件 是否覆盖
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // 获取解压出的目录名
 | 
					    // 获取解压出的目录名
 | 
				
			||||||
/*
 | 
					    $outPath = findIndexPath($outPath);
 | 
				
			||||||
    @ob_start();
 | 
					 | 
				
			||||||
    passthru('ls /tmp | grep '.$auth.'-'.$project.'',$stat);
 | 
					 | 
				
			||||||
            $html.='状态:' . $stat . '
 | 
					 | 
				
			||||||
    结果:
 | 
					 | 
				
			||||||
    ';
 | 
					 | 
				
			||||||
    $archivefolder = ob_get_clean();
 | 
					 | 
				
			||||||
    if (substr($archivefolder,-1)==PHP_EOL) $archivefolder = substr($archivefolder, 0, -1);
 | 
					 | 
				
			||||||
    $outPath .= $archivefolder;
 | 
					 | 
				
			||||||
    $html.=htmlspecialchars($archivefolder);
 | 
					 | 
				
			||||||
    //return $html;
 | 
					 | 
				
			||||||
*/
 | 
					 | 
				
			||||||
    $tmp = scandir($outPath);
 | 
					 | 
				
			||||||
    $name = $auth.'-'.$project;
 | 
					 | 
				
			||||||
    foreach ($tmp as $f) {
 | 
					 | 
				
			||||||
        if ( substr($f, 0, strlen($name)) == $name) {
 | 
					 | 
				
			||||||
            $outPath .= $f;
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // 将目录中文件打包成zip
 | 
					    // 将目录中文件打包成zip
 | 
				
			||||||
    $zip=new ZipArchive();
 | 
					    $zip = new ZipArchive();
 | 
				
			||||||
    if($zip->open($source, ZipArchive::CREATE)){
 | 
					    if($zip->open($source, ZipArchive::CREATE)){
 | 
				
			||||||
        addFileToZip($zip, $outPath); //调用方法,对要打包的根目录进行操作,并将ZipArchive的对象传递给方法
 | 
					        addFileToZip($zip, $outPath); //调用方法,对要打包的根目录进行操作,并将ZipArchive的对象传递给方法
 | 
				
			||||||
        $zip->close(); //关闭处理的zip文件
 | 
					        $zip->close(); //关闭处理的zip文件
 | 
				
			||||||
| 
						 | 
					@ -481,7 +469,7 @@ function addFileToZip($zip, $rootpath, $path = '')
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    @closedir($path);
 | 
					    @closedir($handler);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function myErrorHandler($errno, $errstr, $errfile, $errline) {
 | 
					function myErrorHandler($errno, $errstr, $errfile, $errline) {
 | 
				
			||||||
| 
						 | 
					@ -509,3 +497,52 @@ function myErrorHandler($errno, $errstr, $errfile, $errline) {
 | 
				
			||||||
function WaitFunction() {
 | 
					function WaitFunction() {
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function changeAuthKey() {
 | 
				
			||||||
 | 
					    if ($_POST['AccessKeyID']!=''&&$_POST['AccessKeySecret']!='') {
 | 
				
			||||||
 | 
					        $tmp['AccessKeyID'] = $_POST['AccessKeyID'];
 | 
				
			||||||
 | 
					        $tmp['AccessKeySecret'] = $_POST['AccessKeySecret'];
 | 
				
			||||||
 | 
					        $response = setConfigResponse( SetbaseConfig($tmp, $_SERVER['accountId'], $_SERVER['region'], $_SERVER['service_name'], $_SERVER['function_name'], $tmp['AccessKeyID'], $tmp['AccessKeySecret']) );
 | 
				
			||||||
 | 
					        if (api_error($response)) {
 | 
				
			||||||
 | 
					            $html = api_error_msg($response);
 | 
				
			||||||
 | 
					            $title = 'Error';
 | 
				
			||||||
 | 
					            return message($html, $title, 400);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $html = getconstStr('Success') . '
 | 
				
			||||||
 | 
					    <script>
 | 
				
			||||||
 | 
					        var i = 0;
 | 
				
			||||||
 | 
					        var uploadList = setInterval(function(){
 | 
				
			||||||
 | 
					            if (document.getElementById("dis").style.display=="none") {
 | 
				
			||||||
 | 
					                console.log(i++);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                clearInterval(uploadList);
 | 
				
			||||||
 | 
					                location.href = "' . path_format($_SERVER['base_path'] . '/') . '";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }, 1000);
 | 
				
			||||||
 | 
					    </script>';
 | 
				
			||||||
 | 
					            return message($html, $title, 201, 1);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    $html = '
 | 
				
			||||||
 | 
					    <form action="" method="post" onsubmit="return notnull(this);">
 | 
				
			||||||
 | 
					    <a href="https://usercenter.console.aliyun.com/?#/manage/ak" target="_blank">' . getconstStr('Create') . ' AccessKeyID & AccessKeySecret</a><br>
 | 
				
			||||||
 | 
					    <label>AccessKeyID:<input name="AccessKeyID" type="text" placeholder="" size=""></label><br>
 | 
				
			||||||
 | 
					    <label>AccessKeySecret:<input name="AccessKeySecret" type="password" placeholder="" size=""></label><br>
 | 
				
			||||||
 | 
					        <input type="submit" value="' . getconstStr('Submit') . '">
 | 
				
			||||||
 | 
					    </form>
 | 
				
			||||||
 | 
					    <script>
 | 
				
			||||||
 | 
					        function notnull(t)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (t.AccessKeyID.value==\'\') {
 | 
				
			||||||
 | 
					                alert(\'input AccessKeyID\');
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if (t.AccessKeySecret.value==\'\') {
 | 
				
			||||||
 | 
					                alert(\'input SecretKey\');
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    </script>';
 | 
				
			||||||
 | 
					    return message($html, 'Change platform Auth token or key', 200);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,6 @@
 | 
				
			||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					        // https://cloud.baidu.com/doc/CFC/s/jjwvz45ex
 | 
				
			||||||
 | 
					        // https://cloud.baidu.com/doc/CFC/s/2jwvz44ns
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function printInput($event, $context)
 | 
					function printInput($event, $context)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -49,6 +51,7 @@ function GetPathSetting($event, $context)
 | 
				
			||||||
    $_SERVER['referhost'] = explode('/', $event['headers']['Referer'])[2];
 | 
					    $_SERVER['referhost'] = explode('/', $event['headers']['Referer'])[2];
 | 
				
			||||||
    $_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['BCE_CFC_RUNTIME_NAME'] = 'php7';
 | 
					    $_SERVER['BCE_CFC_RUNTIME_NAME'] = 'php7';
 | 
				
			||||||
    return $path;
 | 
					    return $path;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -164,16 +167,16 @@ function install()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if ($_GET['install1']) {
 | 
					    if ($_GET['install1']) {
 | 
				
			||||||
        $tmp['timezone'] = $_COOKIE['timezone'];
 | 
					        $tmp['timezone'] = $_COOKIE['timezone'];
 | 
				
			||||||
        $SecretId = getConfig('SecretId');
 | 
					        //$SecretId = getConfig('SecretId');
 | 
				
			||||||
        if ($SecretId=='') {
 | 
					        //if ($SecretId=='') {
 | 
				
			||||||
            $SecretId = $_POST['SecretId'];
 | 
					            $SecretId = $_POST['SecretId'];
 | 
				
			||||||
            $tmp['SecretId'] = $SecretId;
 | 
					            $tmp['SecretId'] = $SecretId;
 | 
				
			||||||
        }
 | 
					        //}
 | 
				
			||||||
        $SecretKey = getConfig('SecretKey');
 | 
					        //$SecretKey = getConfig('SecretKey');
 | 
				
			||||||
        if ($SecretKey=='') {
 | 
					        //if ($SecretKey=='') {
 | 
				
			||||||
            $SecretKey = $_POST['SecretKey'];
 | 
					            $SecretKey = $_POST['SecretKey'];
 | 
				
			||||||
            $tmp['SecretKey'] = $SecretKey;
 | 
					            $tmp['SecretKey'] = $SecretKey;
 | 
				
			||||||
        }
 | 
					        //}
 | 
				
			||||||
        $response = setConfigResponse(SetbaseConfig($tmp, $SecretId, $SecretKey));
 | 
					        $response = setConfigResponse(SetbaseConfig($tmp, $SecretId, $SecretKey));
 | 
				
			||||||
        if (api_error($response)) {
 | 
					        if (api_error($response)) {
 | 
				
			||||||
            $html = api_error_msg($response);
 | 
					            $html = api_error_msg($response);
 | 
				
			||||||
| 
						 | 
					@ -207,12 +210,13 @@ language:<br>';
 | 
				
			||||||
            $html .= '
 | 
					            $html .= '
 | 
				
			||||||
        <label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
 | 
					        <label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (getConfig('SecretId')==''||getConfig('SecretKey')=='') $html .= '
 | 
					        //if (getConfig('SecretId')==''||getConfig('SecretKey')=='') 
 | 
				
			||||||
        <a href="https://console.bce.baidu.com/iam/#/iam/accesslist" target="_blank">'.getconstStr('Create').' Access Key & Secret Key</a><br>
 | 
					 | 
				
			||||||
        <label>Access Key:<input name="SecretId" type="text" placeholder="" size=""></label><br>
 | 
					 | 
				
			||||||
        <label>Secret Key:<input name="SecretKey" type="text" placeholder="" size=""></label><br>';
 | 
					 | 
				
			||||||
        $html .= '
 | 
					        $html .= '
 | 
				
			||||||
        <input type="submit" value="'.getconstStr('Submit').'">
 | 
					        <a href="https://console.bce.baidu.com/iam/#/iam/accesslist" target="_blank">' . getconstStr('Create') . ' Access Key & Secret Key</a><br>
 | 
				
			||||||
 | 
					        <label>Access Key:<input name="SecretId" type="text" placeholder="" size=""></label><br>
 | 
				
			||||||
 | 
					        <label>Secret Key:<input name="SecretKey" type="password" placeholder="" size=""></label><br>';
 | 
				
			||||||
 | 
					        $html .= '
 | 
				
			||||||
 | 
					        <input type="submit" value="' . getconstStr('Submit') . '">
 | 
				
			||||||
    </form>
 | 
					    </form>
 | 
				
			||||||
    <script>
 | 
					    <script>
 | 
				
			||||||
        var nowtime= new Date();
 | 
					        var nowtime= new Date();
 | 
				
			||||||
| 
						 | 
					@ -231,7 +235,8 @@ language:<br>';
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        function notnull(t)
 | 
					        function notnull(t)
 | 
				
			||||||
        {';
 | 
					        {';
 | 
				
			||||||
        if (getConfig('SecretId')==''||getConfig('SecretKey')=='') $html .= '
 | 
					        //if (getConfig('SecretId')==''||getConfig('SecretKey')=='') 
 | 
				
			||||||
 | 
					        $html .= '
 | 
				
			||||||
            if (t.SecretId.value==\'\') {
 | 
					            if (t.SecretId.value==\'\') {
 | 
				
			||||||
                alert(\'input Access Key\');
 | 
					                alert(\'input Access Key\');
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
| 
						 | 
					@ -374,29 +379,24 @@ function setConfigResponse($response)
 | 
				
			||||||
    return json_decode( $response, true );
 | 
					    return json_decode( $response, true );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
 | 
					function OnekeyUpate($GitSource = 'Github', $auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    $source = '/tmp/code.zip';
 | 
					    $source = '/tmp/code.zip';
 | 
				
			||||||
    $outPath = '/tmp/';
 | 
					    $outPath = '/tmp/';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if ($GitSource=='Github') {
 | 
				
			||||||
        // 从github下载对应tar.gz,并解压
 | 
					        // 从github下载对应tar.gz,并解压
 | 
				
			||||||
        $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
 | 
					        $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
 | 
				
			||||||
 | 
					    } elseif ($GitSource=='HITGitlab') {
 | 
				
			||||||
 | 
					        $url = 'https://git.hit.edu.cn/' . $auth . '/' . $project . '/-/archive/' . urlencode($branch) . '/' . $project . '-' . urlencode($branch) . '.tar.gz';
 | 
				
			||||||
 | 
					    } else return json_encode(['FunctionBrn'=>$_SERVER['functionBrn'], 'code'=>'Git Source input Error!']);
 | 
				
			||||||
    $tarfile = '/tmp/github.tar.gz';
 | 
					    $tarfile = '/tmp/github.tar.gz';
 | 
				
			||||||
    file_put_contents($tarfile, file_get_contents($url));
 | 
					    file_put_contents($tarfile, file_get_contents($url));
 | 
				
			||||||
    $phar = new PharData($tarfile);
 | 
					    $phar = new PharData($tarfile);
 | 
				
			||||||
    $html = $phar->extractTo($outPath, null, true);//路径 要解压的文件 是否覆盖
 | 
					    $html = $phar->extractTo($outPath, null, true);//路径 要解压的文件 是否覆盖
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // 获取包中目录名
 | 
					    // 获取解压出的目录名
 | 
				
			||||||
    $tmp = scandir('phar://'.$tarfile);
 | 
					    $outPath = findIndexPath($outPath);
 | 
				
			||||||
    $name = $auth.'-'.$project;
 | 
					 | 
				
			||||||
    foreach ($tmp as $f) {
 | 
					 | 
				
			||||||
        if ( substr($f, 0, strlen($name)) == $name) {
 | 
					 | 
				
			||||||
            $outPath .= $f;
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    // 放入配置文件
 | 
					 | 
				
			||||||
    //file_put_contents($outPath . '/config.php', file_get_contents(__DIR__.'/../config.php'));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // 将目录中文件打包成zip
 | 
					    // 将目录中文件打包成zip
 | 
				
			||||||
    //$zip=new ZipArchive();
 | 
					    //$zip=new ZipArchive();
 | 
				
			||||||
| 
						 | 
					@ -428,9 +428,60 @@ function addFileToZip($zip, $rootpath, $path = '')
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    @closedir($path);
 | 
					    @closedir($handler);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function WaitFunction() {
 | 
					function WaitFunction() {
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function changeAuthKey() {
 | 
				
			||||||
 | 
					    if ($_POST['SecretId']!=''&&$_POST['SecretKey']!='') {
 | 
				
			||||||
 | 
					        $SecretId = $_POST['SecretId'];
 | 
				
			||||||
 | 
					        $tmp['SecretId'] = $SecretId;
 | 
				
			||||||
 | 
					        $SecretKey = $_POST['SecretKey'];
 | 
				
			||||||
 | 
					        $tmp['SecretKey'] = $SecretKey;
 | 
				
			||||||
 | 
					        $response = setConfigResponse(SetbaseConfig($tmp, $SecretId, $SecretKey));
 | 
				
			||||||
 | 
					        if (api_error($response)) {
 | 
				
			||||||
 | 
					            $html = api_error_msg($response);
 | 
				
			||||||
 | 
					            $title = 'Error';
 | 
				
			||||||
 | 
					            return message($html, $title, 400);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $html = getconstStr('Success') . '
 | 
				
			||||||
 | 
					    <script>
 | 
				
			||||||
 | 
					        var i = 0;
 | 
				
			||||||
 | 
					        var uploadList = setInterval(function(){
 | 
				
			||||||
 | 
					            if (document.getElementById("dis").style.display=="none") {
 | 
				
			||||||
 | 
					                console.log(i++);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                clearInterval(uploadList);
 | 
				
			||||||
 | 
					                location.href = "' . path_format($_SERVER['base_path'] . '/') . '";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }, 1000);
 | 
				
			||||||
 | 
					    </script>';
 | 
				
			||||||
 | 
					            return message($html, $title, 201, 1);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    $html = '
 | 
				
			||||||
 | 
					    <form action="" method="post" onsubmit="return notnull(this);">
 | 
				
			||||||
 | 
					        <a href="https://console.bce.baidu.com/iam/#/iam/accesslist" target="_blank">' . getconstStr('Create') . ' Access Key & Secret Key</a><br>
 | 
				
			||||||
 | 
					        <label>Access Key:<input name="SecretId" type="text" placeholder="" size=""></label><br>
 | 
				
			||||||
 | 
					        <label>Secret Key:<input name="SecretKey" type="password" placeholder="" size=""></label><br>
 | 
				
			||||||
 | 
					        <input type="submit" value="' . getconstStr('Submit') . '">
 | 
				
			||||||
 | 
					    </form>
 | 
				
			||||||
 | 
					    <script>
 | 
				
			||||||
 | 
					        function notnull(t)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (t.SecretId.value==\'\') {
 | 
				
			||||||
 | 
					                alert(\'input Access Key\');
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if (t.SecretKey.value==\'\') {
 | 
				
			||||||
 | 
					                alert(\'input Secret Key\');
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    </script>';
 | 
				
			||||||
 | 
					    return message($html, 'Change platform Auth token or key', 200);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -170,11 +170,8 @@ function install()
 | 
				
			||||||
            $tmp['admin'] = $_POST['admin'];
 | 
					            $tmp['admin'] = $_POST['admin'];
 | 
				
			||||||
            //$tmp['language'] = $_POST['language'];
 | 
					            //$tmp['language'] = $_POST['language'];
 | 
				
			||||||
            $tmp['timezone'] = $_COOKIE['timezone'];
 | 
					            $tmp['timezone'] = $_COOKIE['timezone'];
 | 
				
			||||||
            $APIKey = getConfig('APIKey');
 | 
					 | 
				
			||||||
            if ($APIKey=='') {
 | 
					 | 
				
			||||||
            $APIKey = $_POST['APIKey'];
 | 
					            $APIKey = $_POST['APIKey'];
 | 
				
			||||||
            $tmp['APIKey'] = $APIKey;
 | 
					            $tmp['APIKey'] = $APIKey;
 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            $HerokuappId = getConfig('HerokuappId');
 | 
					            $HerokuappId = getConfig('HerokuappId');
 | 
				
			||||||
            if ($HerokuappId=='') {
 | 
					            if ($HerokuappId=='') {
 | 
				
			||||||
                $function_name = getConfig('function_name');
 | 
					                $function_name = getConfig('function_name');
 | 
				
			||||||
| 
						 | 
					@ -197,17 +194,27 @@ function install()
 | 
				
			||||||
            if (api_error($response)) {
 | 
					            if (api_error($response)) {
 | 
				
			||||||
                $html = api_error_msg($response);
 | 
					                $html = api_error_msg($response);
 | 
				
			||||||
                $title = 'Error';
 | 
					                $title = 'Error';
 | 
				
			||||||
 | 
					                return message($html, $title, 400);
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                return output('Jump
 | 
					                $html = getconstStr('Success') . '
 | 
				
			||||||
    <script>
 | 
					    <script>
 | 
				
			||||||
        var expd = new Date();
 | 
					        var expd = new Date();
 | 
				
			||||||
        expd.setTime(expd.getTime()+1000);
 | 
					        expd.setTime(expd.getTime()+1000);
 | 
				
			||||||
        var expires = "expires="+expd.toGMTString();
 | 
					        var expires = "expires="+expd.toGMTString();
 | 
				
			||||||
        document.cookie=\'language=; path=/; \'+expires;
 | 
					        document.cookie=\'language=; path=/; \'+expires;
 | 
				
			||||||
    </script>
 | 
					        var status = "' . $response['DplStatus'] . '";
 | 
				
			||||||
    <meta http-equiv="refresh" content="3;URL=' . path_format($_SERVER['base_path'] . '/') . '">', 302);
 | 
					        var i = 0;
 | 
				
			||||||
 | 
					        var uploadList = setInterval(function(){
 | 
				
			||||||
 | 
					            if (document.getElementById("dis").style.display=="none") {
 | 
				
			||||||
 | 
					                console.log(i++);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                clearInterval(uploadList);
 | 
				
			||||||
 | 
					                location.href = "' . path_format($_SERVER['base_path'] . '/') . '";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }, 1000);
 | 
				
			||||||
 | 
					    </script>';
 | 
				
			||||||
 | 
					                return message($html, $title, 201, 1);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            return message($html, $title, 201);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if ($_GET['install0']) {
 | 
					    if ($_GET['install0']) {
 | 
				
			||||||
| 
						 | 
					@ -218,9 +225,9 @@ language:<br>';
 | 
				
			||||||
            $html .= '
 | 
					            $html .= '
 | 
				
			||||||
        <label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
 | 
					        <label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (getConfig('APIKey')=='') $html .= '
 | 
					        $html .= '
 | 
				
			||||||
        <a href="https://dashboard.heroku.com/account" target="_blank">'.getconstStr('Create').' API Key</a><br>
 | 
					        <a href="https://dashboard.heroku.com/account" target="_blank">' . getconstStr('Create') . ' API Key</a><br>
 | 
				
			||||||
        <label>API Key:<input name="APIKey" type="text" placeholder="" size=""></label><br>';
 | 
					        <label>API Key:<input name="APIKey" type="password" placeholder="" size=""></label><br>';
 | 
				
			||||||
        $html .= '
 | 
					        $html .= '
 | 
				
			||||||
        <label>Set admin password:<input name="admin" type="password" placeholder="' . getconstStr('EnvironmentsDescription')['admin'] . '" size="' . strlen(getconstStr('EnvironmentsDescription')['admin']) . '"></label><br>';
 | 
					        <label>Set admin password:<input name="admin" type="password" placeholder="' . getconstStr('EnvironmentsDescription')['admin'] . '" size="' . strlen(getconstStr('EnvironmentsDescription')['admin']) . '"></label><br>';
 | 
				
			||||||
        $html .= '
 | 
					        $html .= '
 | 
				
			||||||
| 
						 | 
					@ -247,7 +254,7 @@ language:<br>';
 | 
				
			||||||
                alert(\'input admin\');
 | 
					                alert(\'input admin\');
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
            }';
 | 
					            }';
 | 
				
			||||||
        if (getConfig('APIKey')=='') $html .= '
 | 
					        $html .= '
 | 
				
			||||||
            if (t.APIKey.value==\'\') {
 | 
					            if (t.APIKey.value==\'\') {
 | 
				
			||||||
                alert(\'input API Key\');
 | 
					                alert(\'input API Key\');
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
| 
						 | 
					@ -333,10 +340,15 @@ function_name:' . $_SERVER['function_name'] . '<br>
 | 
				
			||||||
<button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>';
 | 
					<button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>';
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
 | 
					function OnekeyUpate($GitSource = 'Github', $auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    if ($GitSource=='Github') {
 | 
				
			||||||
        //'https://github.com/qkqpttgf/OneManager-php/tarball/master/';
 | 
					        //'https://github.com/qkqpttgf/OneManager-php/tarball/master/';
 | 
				
			||||||
        $source = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
 | 
					        $source = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
 | 
				
			||||||
 | 
					    } elseif ($GitSource=='HITGitlab') {
 | 
				
			||||||
 | 
					        $source = 'https://git.hit.edu.cn/' . $auth . '/' . $project . '/-/archive/' . urlencode($branch) . '/' . $project . '-' . urlencode($branch) . '.tar.gz';
 | 
				
			||||||
 | 
					    } else return ['stat'=>403, 'body'=>json_encode(['id'=>'Error', 'message'=>'Git Source input Error!'])];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return updateHerokuapp(getConfig('HerokuappId'), getConfig('APIKey'), $source);
 | 
					    return updateHerokuapp(getConfig('HerokuappId'), getConfig('APIKey'), $source);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -358,3 +370,48 @@ function WaitFunction($buildId = '') {
 | 
				
			||||||
        return $response;
 | 
					        return $response;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function changeAuthKey() {
 | 
				
			||||||
 | 
					    if ($_POST['APIKey']!='') {
 | 
				
			||||||
 | 
					        $APIKey = $_POST['APIKey'];
 | 
				
			||||||
 | 
					        $tmp['APIKey'] = $APIKey;
 | 
				
			||||||
 | 
					        $response = setConfigResponse( setHerokuConfig($tmp, getConfig('HerokuappId'), $APIKey) );
 | 
				
			||||||
 | 
					        if (api_error($response)) {
 | 
				
			||||||
 | 
					            $html = api_error_msg($response);
 | 
				
			||||||
 | 
					            $title = 'Error';
 | 
				
			||||||
 | 
					            return message($html, $title, 400);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $html = getconstStr('Success') . '
 | 
				
			||||||
 | 
					    <script>
 | 
				
			||||||
 | 
					        var status = "' . $response['DplStatus'] . '";
 | 
				
			||||||
 | 
					        var i = 0;
 | 
				
			||||||
 | 
					        var uploadList = setInterval(function(){
 | 
				
			||||||
 | 
					            if (document.getElementById("dis").style.display=="none") {
 | 
				
			||||||
 | 
					                console.log(i++);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                clearInterval(uploadList);
 | 
				
			||||||
 | 
					                location.href = "' . path_format($_SERVER['base_path'] . '/') . '";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }, 1000);
 | 
				
			||||||
 | 
					    </script>';
 | 
				
			||||||
 | 
					            return message($html, $title, 201, 1);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    $html = '
 | 
				
			||||||
 | 
					    <form action="" method="post" onsubmit="return notnull(this);">
 | 
				
			||||||
 | 
					        <a href="https://dashboard.heroku.com/account" target="_blank">'.getconstStr('Create').' API Key</a><br>
 | 
				
			||||||
 | 
					        <label>API Key:<input name="APIKey" type="password" placeholder="" size=""></label><br>
 | 
				
			||||||
 | 
					        <input type="submit" value="' . getconstStr('Submit') . '">
 | 
				
			||||||
 | 
					    </form>
 | 
				
			||||||
 | 
					    <script>
 | 
				
			||||||
 | 
					        function notnull(t)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (t.APIKey.value==\'\') {
 | 
				
			||||||
 | 
					                alert(\'input API Key\');
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    </script>';
 | 
				
			||||||
 | 
					    return message($html, 'Change platform Auth token or key', 200);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,7 @@
 | 
				
			||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					// https://support.huaweicloud.com/api-functiongraph/functiongraph_06_0110.html
 | 
				
			||||||
 | 
					// https://support.huaweicloud.com/api-functiongraph/functiongraph_06_0111.html
 | 
				
			||||||
 | 
					
 | 
				
			||||||
global $contextUserData;
 | 
					global $contextUserData;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function printInput($event, $context)
 | 
					function printInput($event, $context)
 | 
				
			||||||
| 
						 | 
					@ -71,6 +74,7 @@ function GetPathSetting($event, $context)
 | 
				
			||||||
    $_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
 | 
					    $_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
 | 
				
			||||||
    $_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['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter';
 | 
					    $_SERVER['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter';
 | 
				
			||||||
    return $path;
 | 
					    return $path;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -190,18 +194,9 @@ function install()
 | 
				
			||||||
    if ($_GET['install1']) {
 | 
					    if ($_GET['install1']) {
 | 
				
			||||||
        //if ($_POST['admin']!='') {
 | 
					        //if ($_POST['admin']!='') {
 | 
				
			||||||
            $tmp['timezone'] = $_COOKIE['timezone'];
 | 
					            $tmp['timezone'] = $_COOKIE['timezone'];
 | 
				
			||||||
            $tmp['HW_urn'] = getConfig('HW_urn');
 | 
					 | 
				
			||||||
            if ($tmp['HW_urn']=='') {
 | 
					 | 
				
			||||||
            $tmp['HW_urn'] = $_POST['HW_urn'];
 | 
					            $tmp['HW_urn'] = $_POST['HW_urn'];
 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            $tmp['HW_key'] = getConfig('HW_key');
 | 
					 | 
				
			||||||
            if ($tmp['HW_key']=='') {
 | 
					 | 
				
			||||||
            $tmp['HW_key'] = $_POST['HW_key'];
 | 
					            $tmp['HW_key'] = $_POST['HW_key'];
 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            $tmp['HW_secret'] = getConfig('HW_secret');
 | 
					 | 
				
			||||||
            if ($tmp['HW_secret']=='') {
 | 
					 | 
				
			||||||
            $tmp['HW_secret'] = $_POST['HW_secret'];
 | 
					            $tmp['HW_secret'] = $_POST['HW_secret'];
 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            $tmp['ONEMANAGER_CONFIG_SAVE'] = $_POST['ONEMANAGER_CONFIG_SAVE'];
 | 
					            $tmp['ONEMANAGER_CONFIG_SAVE'] = $_POST['ONEMANAGER_CONFIG_SAVE'];
 | 
				
			||||||
            //$response = json_decode(SetbaseConfig($tmp, $HW_urn, $HW_name, $HW_pwd), true)['Response'];
 | 
					            //$response = json_decode(SetbaseConfig($tmp, $HW_urn, $HW_name, $HW_pwd), true)['Response'];
 | 
				
			||||||
            $response = setConfigResponse( SetbaseConfig($tmp, $tmp['HW_urn'], $tmp['HW_key'], $tmp['HW_secret']) );
 | 
					            $response = setConfigResponse( SetbaseConfig($tmp, $tmp['HW_urn'], $tmp['HW_key'], $tmp['HW_secret']) );
 | 
				
			||||||
| 
						 | 
					@ -243,13 +238,14 @@ language:<br>';
 | 
				
			||||||
            $html .= '
 | 
					            $html .= '
 | 
				
			||||||
        <label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
 | 
					        <label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (getConfig('HW_urn')==''||getConfig('HW_key')==''||getConfig('HW_secret')=='') $html .= '
 | 
					        //if (getConfig('HW_urn')==''||getConfig('HW_key')==''||getConfig('HW_secret')=='') 
 | 
				
			||||||
 | 
					        $html .= '
 | 
				
			||||||
        在函数代码操作页上方找到URN,鼠标放上去后显示URN,复制填入:<br>
 | 
					        在函数代码操作页上方找到URN,鼠标放上去后显示URN,复制填入:<br>
 | 
				
			||||||
        <label>URN:<input name="HW_urn" type="text" placeholder="" size=""></label><br>
 | 
					        <label>URN:<input name="HW_urn" type="text" placeholder="" size=""></label><br>
 | 
				
			||||||
        <a href="https://console.huaweicloud.com/iam/#/mine/accessKey" target="_blank">点击链接</a>,新增访问密钥,
 | 
					        <a href="https://console.huaweicloud.com/iam/#/mine/accessKey" target="_blank">点击链接</a>,新增访问密钥,
 | 
				
			||||||
        在下载的credentials.csv文件中找到对应信息,填入:<br>
 | 
					        在下载的credentials.csv文件中找到对应信息,填入:<br>
 | 
				
			||||||
        <label>Access Key Id:<input name="HW_key" type="text" placeholder="" size=""></label><br>
 | 
					        <label>Access Key Id:<input name="HW_key" type="text" placeholder="" size=""></label><br>
 | 
				
			||||||
        <label>Secret Access Key:<input name="HW_secret" type="text" placeholder="" size=""></label><br>';
 | 
					        <label>Secret Access Key:<input name="HW_secret" type="password" placeholder="" size=""></label><br>';
 | 
				
			||||||
        $html .= '
 | 
					        $html .= '
 | 
				
			||||||
        <label><input type="radio" name="ONEMANAGER_CONFIG_SAVE" value="" ' . ('file'==$contextUserData->getUserData('ONEMANAGER_CONFIG_SAVE')?'':'checked') . '>' . getconstStr('ONEMANAGER_CONFIG_SAVE_ENV') . '</label><br>
 | 
					        <label><input type="radio" name="ONEMANAGER_CONFIG_SAVE" value="" ' . ('file'==$contextUserData->getUserData('ONEMANAGER_CONFIG_SAVE')?'':'checked') . '>' . getconstStr('ONEMANAGER_CONFIG_SAVE_ENV') . '</label><br>
 | 
				
			||||||
        <label><input type="radio" name="ONEMANAGER_CONFIG_SAVE" value="file" ' . ('file'==$contextUserData->getUserData('ONEMANAGER_CONFIG_SAVE')?'checked':'') . '>' . getconstStr('ONEMANAGER_CONFIG_SAVE_FILE') . '</label><br>';
 | 
					        <label><input type="radio" name="ONEMANAGER_CONFIG_SAVE" value="file" ' . ('file'==$contextUserData->getUserData('ONEMANAGER_CONFIG_SAVE')?'checked':'') . '>' . getconstStr('ONEMANAGER_CONFIG_SAVE_FILE') . '</label><br>';
 | 
				
			||||||
| 
						 | 
					@ -273,7 +269,8 @@ language:<br>';
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        function notnull(t)
 | 
					        function notnull(t)
 | 
				
			||||||
        {';
 | 
					        {';
 | 
				
			||||||
        if (getConfig('HW_urn')==''||getConfig('HW_key')==''||getConfig('HW_secret')=='') $html .= '
 | 
					        //if (getConfig('HW_urn')==''||getConfig('HW_key')==''||getConfig('HW_secret')=='') 
 | 
				
			||||||
 | 
					        $html .= '
 | 
				
			||||||
            if (t.HW_urn.value==\'\') {
 | 
					            if (t.HW_urn.value==\'\') {
 | 
				
			||||||
                alert(\'input URN\');
 | 
					                alert(\'input URN\');
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
| 
						 | 
					@ -433,27 +430,24 @@ function setConfigResponse($response)
 | 
				
			||||||
    return json_decode( $response, true );
 | 
					    return json_decode( $response, true );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
 | 
					function OnekeyUpate($GitSource = 'Github', $auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    $source = '/tmp/code.zip';
 | 
					    $source = '/tmp/code.zip';
 | 
				
			||||||
    $outPath = '/tmp/';
 | 
					    $outPath = '/tmp/';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if ($GitSource=='Github') {
 | 
				
			||||||
        // 从github下载对应tar.gz,并解压
 | 
					        // 从github下载对应tar.gz,并解压
 | 
				
			||||||
        $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
 | 
					        $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
 | 
				
			||||||
 | 
					    } elseif ($GitSource=='HITGitlab') {
 | 
				
			||||||
 | 
					        $url = 'https://git.hit.edu.cn/' . $auth . '/' . $project . '/-/archive/' . urlencode($branch) . '/' . $project . '-' . urlencode($branch) . '.tar.gz';
 | 
				
			||||||
 | 
					    } else return json_encode(['error_code'=>'Error', 'error_msg'=>'Git Source input Error!']);
 | 
				
			||||||
    $tarfile = '/tmp/github.tar.gz';
 | 
					    $tarfile = '/tmp/github.tar.gz';
 | 
				
			||||||
    file_put_contents($tarfile, file_get_contents($url));
 | 
					    file_put_contents($tarfile, file_get_contents($url));
 | 
				
			||||||
    $phar = new PharData($tarfile);
 | 
					    $phar = new PharData($tarfile);
 | 
				
			||||||
    $html = $phar->extractTo($outPath, null, true);//路径 要解压的文件 是否覆盖
 | 
					    $html = $phar->extractTo($outPath, null, true);//路径 要解压的文件 是否覆盖
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // 获取解压出的目录名
 | 
					    // 获取解压出的目录名
 | 
				
			||||||
    $tmp = scandir($outPath);
 | 
					    $outPath = findIndexPath($outPath);
 | 
				
			||||||
    $name = $auth.'-'.$project;
 | 
					 | 
				
			||||||
    foreach ($tmp as $f) {
 | 
					 | 
				
			||||||
        if ( substr($f, 0, strlen($name)) == $name) {
 | 
					 | 
				
			||||||
            $outPath .= $f;
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // 将目录中文件打包成zip
 | 
					    // 将目录中文件打包成zip
 | 
				
			||||||
    //$zip=new ZipArchive();
 | 
					    //$zip=new ZipArchive();
 | 
				
			||||||
| 
						 | 
					@ -485,9 +479,60 @@ function addFileToZip($zip, $rootpath, $path = '')
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    @closedir($path);
 | 
					    @closedir($handler);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function WaitFunction() {
 | 
					function WaitFunction() {
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function changeAuthKey() {
 | 
				
			||||||
 | 
					    if ($_POST['HW_key']!=''&&$_POST['HW_secret']!='') {
 | 
				
			||||||
 | 
					        $tmp['HW_key'] = $_POST['HW_key'];
 | 
				
			||||||
 | 
					        $tmp['HW_secret'] = $_POST['HW_secret'];
 | 
				
			||||||
 | 
					        $response = setConfigResponse( SetbaseConfig($tmp, getConfig('HW_urn'), $tmp['HW_key'], $tmp['HW_secret']) );
 | 
				
			||||||
 | 
					        if (api_error($response)) {
 | 
				
			||||||
 | 
					            $html = api_error_msg($response);
 | 
				
			||||||
 | 
					            $title = 'Error';
 | 
				
			||||||
 | 
					            return message($html, $title, 400);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $html = getconstStr('Success') . '
 | 
				
			||||||
 | 
					    <script>
 | 
				
			||||||
 | 
					        var status = "' . $response['DplStatus'] . '";
 | 
				
			||||||
 | 
					        var i = 0;
 | 
				
			||||||
 | 
					        var uploadList = setInterval(function(){
 | 
				
			||||||
 | 
					            if (document.getElementById("dis").style.display=="none") {
 | 
				
			||||||
 | 
					                console.log(i++);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                clearInterval(uploadList);
 | 
				
			||||||
 | 
					                location.href = "' . path_format($_SERVER['base_path'] . '/') . '";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }, 1000);
 | 
				
			||||||
 | 
					    </script>';
 | 
				
			||||||
 | 
					            return message($html, $title, 201, 1);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    $html = '
 | 
				
			||||||
 | 
					    <form action="" method="post" onsubmit="return notnull(this);">
 | 
				
			||||||
 | 
					        <a href="https://console.huaweicloud.com/iam/#/mine/accessKey" target="_blank">点击链接</a>,新增访问密钥,
 | 
				
			||||||
 | 
					        在下载的credentials.csv文件中找到对应信息,填入:<br>
 | 
				
			||||||
 | 
					        <label>Access Key Id:<input name="HW_key" type="text" placeholder="" size=""></label><br>
 | 
				
			||||||
 | 
					        <label>Secret Access Key:<input name="HW_secret" type="password" placeholder="" size=""></label><br>
 | 
				
			||||||
 | 
					        <input type="submit" value="' . getconstStr('Submit') . '">
 | 
				
			||||||
 | 
					    </form>
 | 
				
			||||||
 | 
					    <script>
 | 
				
			||||||
 | 
					        function notnull(t)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (t.HW_key.value==\'\') {
 | 
				
			||||||
 | 
					                alert(\'input Access Key Id\');
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if (t.HW_secret.value==\'\') {
 | 
				
			||||||
 | 
					                alert(\'input Secret Access Key\');
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    </script>';
 | 
				
			||||||
 | 
					    return message($html, 'Change platform Auth token or key', 200);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,7 @@
 | 
				
			||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					// https://support.huaweicloud.com/api-functiongraph/functiongraph_06_0110.html
 | 
				
			||||||
 | 
					// https://support.huaweicloud.com/api-functiongraph/functiongraph_06_0111.html
 | 
				
			||||||
 | 
					
 | 
				
			||||||
global $contextUserData;
 | 
					global $contextUserData;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function printInput($event, $context)
 | 
					function printInput($event, $context)
 | 
				
			||||||
| 
						 | 
					@ -71,16 +74,15 @@ function GetPathSetting($event, $context)
 | 
				
			||||||
    $_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
 | 
					    $_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
 | 
				
			||||||
    $_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['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter';
 | 
					    $_SERVER['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter';
 | 
				
			||||||
    return $path;
 | 
					    return $path;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function getConfig($str, $disktag = '')
 | 
					function getConfig($str, $disktag = '')
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    $projectPath = splitlast(__DIR__, '/')[0];
 | 
				
			||||||
    global $slash;
 | 
					    $configPath = $projectPath . '/.data/config.php';
 | 
				
			||||||
    $projectPath = splitlast(__DIR__, $slash)[0];
 | 
					 | 
				
			||||||
    $configPath = $projectPath . $slash . '.data' . $slash . 'config.php';
 | 
					 | 
				
			||||||
    $s = file_get_contents($configPath);
 | 
					    $s = file_get_contents($configPath);
 | 
				
			||||||
    $configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}';
 | 
					    $configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}';
 | 
				
			||||||
    if ($configs!='') {
 | 
					    if ($configs!='') {
 | 
				
			||||||
| 
						 | 
					@ -105,9 +107,8 @@ function setConfig($arr, $disktag = '')
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ($disktag=='') $disktag = $_SERVER['disktag'];
 | 
					    if ($disktag=='') $disktag = $_SERVER['disktag'];
 | 
				
			||||||
    global $slash;
 | 
					    $projectPath = splitlast(__DIR__, '/')[0];
 | 
				
			||||||
    $projectPath = splitlast(__DIR__, $slash)[0];
 | 
					    $configPath = $projectPath . '/.data/config.php';
 | 
				
			||||||
    $configPath = $projectPath . $slash . '.data' . $slash . 'config.php';
 | 
					 | 
				
			||||||
    $s = file_get_contents($configPath);
 | 
					    $s = file_get_contents($configPath);
 | 
				
			||||||
    $configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}';
 | 
					    $configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}';
 | 
				
			||||||
    if ($configs!='') $envs = json_decode($configs, true);
 | 
					    if ($configs!='') $envs = json_decode($configs, true);
 | 
				
			||||||
| 
						 | 
					@ -204,18 +205,9 @@ function install()
 | 
				
			||||||
    if ($_GET['install1']) {
 | 
					    if ($_GET['install1']) {
 | 
				
			||||||
        //if ($_POST['admin']!='') {
 | 
					        //if ($_POST['admin']!='') {
 | 
				
			||||||
            $tmp['timezone'] = $_COOKIE['timezone'];
 | 
					            $tmp['timezone'] = $_COOKIE['timezone'];
 | 
				
			||||||
            $tmp['HW_urn'] = getConfig('HW_urn');
 | 
					 | 
				
			||||||
            if ($tmp['HW_urn']=='') {
 | 
					 | 
				
			||||||
            $tmp['HW_urn'] = $_POST['HW_urn'];
 | 
					            $tmp['HW_urn'] = $_POST['HW_urn'];
 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            $tmp['HW_key'] = getConfig('HW_key');
 | 
					 | 
				
			||||||
            if ($tmp['HW_key']=='') {
 | 
					 | 
				
			||||||
            $tmp['HW_key'] = $_POST['HW_key'];
 | 
					            $tmp['HW_key'] = $_POST['HW_key'];
 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            $tmp['HW_secret'] = getConfig('HW_secret');
 | 
					 | 
				
			||||||
            if ($tmp['HW_secret']=='') {
 | 
					 | 
				
			||||||
            $tmp['HW_secret'] = $_POST['HW_secret'];
 | 
					            $tmp['HW_secret'] = $_POST['HW_secret'];
 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            $tmp['ONEMANAGER_CONFIG_SAVE'] = $_POST['ONEMANAGER_CONFIG_SAVE'];
 | 
					            $tmp['ONEMANAGER_CONFIG_SAVE'] = $_POST['ONEMANAGER_CONFIG_SAVE'];
 | 
				
			||||||
            //return message($html, $title, 201);
 | 
					            //return message($html, $title, 201);
 | 
				
			||||||
            $response = setConfigResponse( SetbaseConfig($tmp, $tmp['HW_urn'], $tmp['HW_key'], $tmp['HW_secret']) );
 | 
					            $response = setConfigResponse( SetbaseConfig($tmp, $tmp['HW_urn'], $tmp['HW_key'], $tmp['HW_secret']) );
 | 
				
			||||||
| 
						 | 
					@ -257,13 +249,14 @@ language:<br>';
 | 
				
			||||||
            $html .= '
 | 
					            $html .= '
 | 
				
			||||||
        <label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
 | 
					        <label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (getConfig('HW_urn')==''||getConfig('HW_key')==''||getConfig('HW_secret')=='') $html .= '
 | 
					        //if (getConfig('HW_urn')==''||getConfig('HW_key')==''||getConfig('HW_secret')=='') 
 | 
				
			||||||
 | 
					        $html .= '
 | 
				
			||||||
        在函数代码操作页上方找到URN,鼠标放上去后显示URN,复制填入:<br>
 | 
					        在函数代码操作页上方找到URN,鼠标放上去后显示URN,复制填入:<br>
 | 
				
			||||||
        <label>URN:<input name="HW_urn" type="text" placeholder="urn:fss:ap-XXXXXXXX:XXXXXXXXXXXXXXXXXXXXc01a1e9caXXX:function:default:XXXXX:latest" size=""></label><br>
 | 
					        <label>URN:<input name="HW_urn" type="text" placeholder="urn:fss:ap-XXXXXXXX:XXXXXXXXXXXXXXXXXXXXc01a1e9caXXX:function:default:XXXXX:latest" size=""></label><br>
 | 
				
			||||||
        <a href="https://console.huaweicloud.com/iam/#/mine/accessKey" target="_blank">点击链接</a>,新增访问密钥,
 | 
					        <a href="https://console.huaweicloud.com/iam/#/mine/accessKey" target="_blank">点击链接</a>,新增访问密钥,
 | 
				
			||||||
        在下载的credentials.csv文件中找到对应信息,填入:<br>
 | 
					        在下载的credentials.csv文件中找到对应信息,填入:<br>
 | 
				
			||||||
        <label>Access Key Id:<input name="HW_key" type="text" placeholder="" size=""></label><br>
 | 
					        <label>Access Key Id:<input name="HW_key" type="text" placeholder="" size=""></label><br>
 | 
				
			||||||
        <label>Secret Access Key:<input name="HW_secret" type="text" placeholder="" size=""></label><br>';
 | 
					        <label>Secret Access Key:<input name="HW_secret" type="password" placeholder="" size=""></label><br>';
 | 
				
			||||||
        $html .= '
 | 
					        $html .= '
 | 
				
			||||||
        <label><input type="radio" name="ONEMANAGER_CONFIG_SAVE" value="" ' . ('file'==$contextUserData->getUserData('ONEMANAGER_CONFIG_SAVE')?'':'checked') . '>' . getconstStr('ONEMANAGER_CONFIG_SAVE_ENV') . '</label><br>
 | 
					        <label><input type="radio" name="ONEMANAGER_CONFIG_SAVE" value="" ' . ('file'==$contextUserData->getUserData('ONEMANAGER_CONFIG_SAVE')?'':'checked') . '>' . getconstStr('ONEMANAGER_CONFIG_SAVE_ENV') . '</label><br>
 | 
				
			||||||
        <label><input type="radio" name="ONEMANAGER_CONFIG_SAVE" value="file" ' . ('file'==$contextUserData->getUserData('ONEMANAGER_CONFIG_SAVE')?'checked':'') . '>' . getconstStr('ONEMANAGER_CONFIG_SAVE_FILE') . '</label><br>';
 | 
					        <label><input type="radio" name="ONEMANAGER_CONFIG_SAVE" value="file" ' . ('file'==$contextUserData->getUserData('ONEMANAGER_CONFIG_SAVE')?'checked':'') . '>' . getconstStr('ONEMANAGER_CONFIG_SAVE_FILE') . '</label><br>';
 | 
				
			||||||
| 
						 | 
					@ -287,17 +280,18 @@ language:<br>';
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        function notnull(t)
 | 
					        function notnull(t)
 | 
				
			||||||
        {';
 | 
					        {';
 | 
				
			||||||
        if (getConfig('HW_urn')==''||getConfig('HW_key')==''||getConfig('HW_secret')=='') $html .= '
 | 
					        //if (getConfig('HW_urn')==''||getConfig('HW_key')==''||getConfig('HW_secret')=='') 
 | 
				
			||||||
 | 
					        $html .= '
 | 
				
			||||||
            if (t.HW_urn.value==\'\') {
 | 
					            if (t.HW_urn.value==\'\') {
 | 
				
			||||||
                alert(\'input URN\');
 | 
					                alert(\'input URN\');
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (t.HW_key.value==\'\') {
 | 
					            if (t.HW_key.value==\'\') {
 | 
				
			||||||
                alert(\'input name\');
 | 
					                alert(\'input Access Key Id\');
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (t.HW_secret.value==\'\') {
 | 
					            if (t.HW_secret.value==\'\') {
 | 
				
			||||||
                alert(\'input pwd\');
 | 
					                alert(\'input Secret Access Key\');
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
            }';
 | 
					            }';
 | 
				
			||||||
        $html .= '
 | 
					        $html .= '
 | 
				
			||||||
| 
						 | 
					@ -426,7 +420,6 @@ function updateEnvironment($Envs, $HW_urn, $HW_key, $HW_secret)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function SetbaseConfig($Envs, $HW_urn, $HW_key, $HW_secret)
 | 
					function SetbaseConfig($Envs, $HW_urn, $HW_key, $HW_secret)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    global $slash;
 | 
					 | 
				
			||||||
    //echo json_encode($Envs,JSON_PRETTY_PRINT);
 | 
					    //echo json_encode($Envs,JSON_PRETTY_PRINT);
 | 
				
			||||||
    if ($Envs['ONEMANAGER_CONFIG_SAVE'] == 'file') $envs = Array( 'ONEMANAGER_CONFIG_SAVE' => 'file' );
 | 
					    if ($Envs['ONEMANAGER_CONFIG_SAVE'] == 'file') $envs = Array( 'ONEMANAGER_CONFIG_SAVE' => 'file' );
 | 
				
			||||||
    else {
 | 
					    else {
 | 
				
			||||||
| 
						 | 
					@ -469,8 +462,8 @@ function SetbaseConfig($Envs, $HW_urn, $HW_key, $HW_secret)
 | 
				
			||||||
        return $response;
 | 
					        return $response;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $projectPath = splitlast(__DIR__, $slash)[0];
 | 
					    $projectPath = splitlast(__DIR__, '/')[0];
 | 
				
			||||||
    $configPath = $projectPath . $slash . '.data' . $slash . 'config.php';
 | 
					    $configPath = $projectPath . '/.data/config.php';
 | 
				
			||||||
    $s = file_get_contents($configPath);
 | 
					    $s = file_get_contents($configPath);
 | 
				
			||||||
    $configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}';
 | 
					    $configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}';
 | 
				
			||||||
    if ($configs!='') $tmp_env = json_decode($configs, true);
 | 
					    if ($configs!='') $tmp_env = json_decode($configs, true);
 | 
				
			||||||
| 
						 | 
					@ -525,39 +518,24 @@ function setConfigResponse($response)
 | 
				
			||||||
    return json_decode( $response, true );
 | 
					    return json_decode( $response, true );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
 | 
					function OnekeyUpate($GitSource = 'Github', $auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    $source = '/tmp/code.zip';
 | 
					    $source = '/tmp/code.zip';
 | 
				
			||||||
    $outPath = '/tmp/';
 | 
					    $outPath = '/tmp/';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if ($GitSource=='Github') {
 | 
				
			||||||
        // 从github下载对应tar.gz,并解压
 | 
					        // 从github下载对应tar.gz,并解压
 | 
				
			||||||
        $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
 | 
					        $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
 | 
				
			||||||
 | 
					    } elseif ($GitSource=='HITGitlab') {
 | 
				
			||||||
 | 
					        $url = 'https://git.hit.edu.cn/' . $auth . '/' . $project . '/-/archive/' . urlencode($branch) . '/' . $project . '-' . urlencode($branch) . '.tar.gz';
 | 
				
			||||||
 | 
					    } else return json_encode(['error_code'=>'Error', 'error_msg'=>'Git Source input Error!']);
 | 
				
			||||||
    $tarfile = '/tmp/github.tar.gz';
 | 
					    $tarfile = '/tmp/github.tar.gz';
 | 
				
			||||||
    file_put_contents($tarfile, file_get_contents($url));
 | 
					    file_put_contents($tarfile, file_get_contents($url));
 | 
				
			||||||
    $phar = new PharData($tarfile);
 | 
					    $phar = new PharData($tarfile);
 | 
				
			||||||
    $html = $phar->extractTo($outPath, null, true);//路径 要解压的文件 是否覆盖
 | 
					    $html = $phar->extractTo($outPath, null, true);//路径 要解压的文件 是否覆盖
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // 获取解压出的目录名
 | 
					    // 获取解压出的目录名
 | 
				
			||||||
/*
 | 
					    $outPath = findIndexPath($outPath);
 | 
				
			||||||
    @ob_start();
 | 
					 | 
				
			||||||
    passthru('ls /tmp | grep '.$auth.'-'.$project.'',$stat);
 | 
					 | 
				
			||||||
            $html.='状态:' . $stat . '
 | 
					 | 
				
			||||||
    结果:
 | 
					 | 
				
			||||||
    ';
 | 
					 | 
				
			||||||
    $archivefolder = ob_get_clean();
 | 
					 | 
				
			||||||
    if (substr($archivefolder,-1)==PHP_EOL) $archivefolder = substr($archivefolder, 0, -1);
 | 
					 | 
				
			||||||
    $outPath .= $archivefolder;
 | 
					 | 
				
			||||||
    $html.=htmlspecialchars($archivefolder);
 | 
					 | 
				
			||||||
    //return $html;
 | 
					 | 
				
			||||||
*/
 | 
					 | 
				
			||||||
    $tmp = scandir($outPath);
 | 
					 | 
				
			||||||
    $name = $auth.'-'.$project;
 | 
					 | 
				
			||||||
    foreach ($tmp as $f) {
 | 
					 | 
				
			||||||
        if ( substr($f, 0, strlen($name)) == $name) {
 | 
					 | 
				
			||||||
            $outPath .= $f;
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // 放入配置文件
 | 
					    // 放入配置文件
 | 
				
			||||||
    file_put_contents($outPath . '/.data/config.php', file_get_contents(__DIR__ . '/../.data/config.php'));
 | 
					    file_put_contents($outPath . '/.data/config.php', file_get_contents(__DIR__ . '/../.data/config.php'));
 | 
				
			||||||
| 
						 | 
					@ -592,7 +570,7 @@ function addFileToZip($zip, $rootpath, $path = '')
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    @closedir($path);
 | 
					    @closedir($handler);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -602,6 +580,7 @@ function addFileToZip($zip, $rootpath, $path = '')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
define("BasicDateFormat", "Ymd\THis\Z");
 | 
					define("BasicDateFormat", "Ymd\THis\Z");
 | 
				
			||||||
define("Algorithm", "SDK-HMAC-SHA256");
 | 
					define("Algorithm", "SDK-HMAC-SHA256");
 | 
				
			||||||
define("HeaderXDate", "X-Sdk-Date");
 | 
					define("HeaderXDate", "X-Sdk-Date");
 | 
				
			||||||
| 
						 | 
					@ -872,3 +851,54 @@ class Signer
 | 
				
			||||||
function WaitFunction() {
 | 
					function WaitFunction() {
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function changeAuthKey() {
 | 
				
			||||||
 | 
					    if ($_POST['HW_key']!=''&&$_POST['HW_secret']!='') {
 | 
				
			||||||
 | 
					        $tmp['HW_key'] = $_POST['HW_key'];
 | 
				
			||||||
 | 
					        $tmp['HW_secret'] = $_POST['HW_secret'];
 | 
				
			||||||
 | 
					        $response = setConfigResponse( SetbaseConfig($tmp, getConfig('HW_urn'), $tmp['HW_key'], $tmp['HW_secret']) );
 | 
				
			||||||
 | 
					        if (api_error($response)) {
 | 
				
			||||||
 | 
					            $html = api_error_msg($response);
 | 
				
			||||||
 | 
					            $title = 'Error';
 | 
				
			||||||
 | 
					            return message($html, $title, 400);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $html = getconstStr('Success') . '
 | 
				
			||||||
 | 
					    <script>
 | 
				
			||||||
 | 
					        var status = "' . $response['DplStatus'] . '";
 | 
				
			||||||
 | 
					        var i = 0;
 | 
				
			||||||
 | 
					        var uploadList = setInterval(function(){
 | 
				
			||||||
 | 
					            if (document.getElementById("dis").style.display=="none") {
 | 
				
			||||||
 | 
					                console.log(i++);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                clearInterval(uploadList);
 | 
				
			||||||
 | 
					                location.href = "' . path_format($_SERVER['base_path'] . '/') . '";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }, 1000);
 | 
				
			||||||
 | 
					    </script>';
 | 
				
			||||||
 | 
					            return message($html, $title, 201, 1);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    $html = '
 | 
				
			||||||
 | 
					    <form action="" method="post" onsubmit="return notnull(this);">
 | 
				
			||||||
 | 
					        <a href="https://console.huaweicloud.com/iam/#/mine/accessKey" target="_blank">点击链接</a>,新增访问密钥,
 | 
				
			||||||
 | 
					        在下载的credentials.csv文件中找到对应信息,填入:<br>
 | 
				
			||||||
 | 
					        <label>Access Key Id:<input name="HW_key" type="text" placeholder="" size=""></label><br>
 | 
				
			||||||
 | 
					        <label>Secret Access Key:<input name="HW_secret" type="password" placeholder="" size=""></label><br>
 | 
				
			||||||
 | 
					        <input type="submit" value="' . getconstStr('Submit') . '">
 | 
				
			||||||
 | 
					    </form>
 | 
				
			||||||
 | 
					    <script>
 | 
				
			||||||
 | 
					        function notnull(t)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (t.HW_key.value==\'\') {
 | 
				
			||||||
 | 
					                alert(\'input Access Key Id\');
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if (t.HW_secret.value==\'\') {
 | 
				
			||||||
 | 
					                alert(\'input Secret Access Key\');
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    </script>';
 | 
				
			||||||
 | 
					    return message($html, 'Change platform Auth token or key', 200);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -312,19 +312,23 @@ function setConfigResponse($response)
 | 
				
			||||||
    return json_decode($response, true);
 | 
					    return json_decode($response, true);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
 | 
					function OnekeyUpate($GitSource = 'Github', $auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    $slash = '/';
 | 
					    global $slash;
 | 
				
			||||||
    if (strpos(__DIR__, ':')) $slash = '\\';
 | 
					 | 
				
			||||||
    // __DIR__ is xxx/platform
 | 
					    // __DIR__ is xxx/platform
 | 
				
			||||||
    $projectPath = splitlast(__DIR__, $slash)[0];
 | 
					    $projectPath = splitlast(__DIR__, $slash)[0];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if ($GitSource=='Github') {
 | 
				
			||||||
        // 从github下载对应tar.gz,并解压
 | 
					        // 从github下载对应tar.gz,并解压
 | 
				
			||||||
        $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
 | 
					        $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
 | 
				
			||||||
 | 
					    } elseif ($GitSource=='HITGitlab') {
 | 
				
			||||||
 | 
					        $url = 'https://git.hit.edu.cn/' . $auth . '/' . $project . '/-/archive/' . urlencode($branch) . '/' . $project . '-' . urlencode($branch) . '.tar.gz';
 | 
				
			||||||
 | 
					    } else return 0;
 | 
				
			||||||
    $tarfile = $projectPath . $slash .'github.tar.gz';
 | 
					    $tarfile = $projectPath . $slash .'github.tar.gz';
 | 
				
			||||||
    $githubfile = file_get_contents($url);
 | 
					    $githubfile = file_get_contents($url);
 | 
				
			||||||
    if (!$githubfile) return 0;
 | 
					    if (!$githubfile) return 0;
 | 
				
			||||||
    file_put_contents($tarfile, $githubfile);
 | 
					    file_put_contents($tarfile, $githubfile);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (splitfirst(PHP_VERSION, '.')[0] > '5') {
 | 
					    if (splitfirst(PHP_VERSION, '.')[0] > '5') {
 | 
				
			||||||
        $phar = new PharData($tarfile); // need php5.3, 7, 8
 | 
					        $phar = new PharData($tarfile); // need php5.3, 7, 8
 | 
				
			||||||
        $phar->extractTo($projectPath, null, true);//路径 要解压的文件 是否覆盖
 | 
					        $phar->extractTo($projectPath, null, true);//路径 要解压的文件 是否覆盖
 | 
				
			||||||
| 
						 | 
					@ -336,14 +340,7 @@ function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch =
 | 
				
			||||||
    unlink($tarfile);
 | 
					    unlink($tarfile);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $outPath = '';
 | 
					    $outPath = '';
 | 
				
			||||||
    $tmp = scandir($projectPath);
 | 
					    $outPath = findIndexPath($projectPath);
 | 
				
			||||||
    $name = $auth . '-' . $project;
 | 
					 | 
				
			||||||
    foreach ($tmp as $f) {
 | 
					 | 
				
			||||||
        if ( substr($f, 0, strlen($name)) == $name) {
 | 
					 | 
				
			||||||
            $outPath = $projectPath . $slash . $f;
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    //error_log1($outPath);
 | 
					    //error_log1($outPath);
 | 
				
			||||||
    if ($outPath=='') return 0;
 | 
					    if ($outPath=='') return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -354,11 +351,12 @@ function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch =
 | 
				
			||||||
        $tmp1['message'] = "Can not move " . $projectPath . $slash . '.data' . $slash . 'config.php' . " to " . $outPath . $slash . '.data' . $slash . 'config.php';
 | 
					        $tmp1['message'] = "Can not move " . $projectPath . $slash . '.data' . $slash . 'config.php' . " to " . $outPath . $slash . '.data' . $slash . 'config.php';
 | 
				
			||||||
        return json_encode($tmp1);
 | 
					        return json_encode($tmp1);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return moveFolder($outPath, $projectPath, $slash);
 | 
					    return moveFolder($outPath, $projectPath);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function moveFolder($from, $to, $slash)
 | 
					function moveFolder($from, $to)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    global $slash;
 | 
				
			||||||
    if (substr($from, -1)==$slash) $from = substr($from, 0, -1);
 | 
					    if (substr($from, -1)==$slash) $from = substr($from, 0, -1);
 | 
				
			||||||
    if (substr($to, -1)==$slash) $to = substr($to, 0, -1);
 | 
					    if (substr($to, -1)==$slash) $to = substr($to, 0, -1);
 | 
				
			||||||
    if (!file_exists($to)) mkdir($to, 0777);
 | 
					    if (!file_exists($to)) mkdir($to, 0777);
 | 
				
			||||||
| 
						 | 
					@ -368,7 +366,7 @@ function moveFolder($from, $to, $slash)
 | 
				
			||||||
            $fromfile = $from . $slash . $filename;
 | 
					            $fromfile = $from . $slash . $filename;
 | 
				
			||||||
            $tofile = $to . $slash . $filename;
 | 
					            $tofile = $to . $slash . $filename;
 | 
				
			||||||
            if(is_dir($fromfile)){// 如果读取的某个对象是文件夹,则递归
 | 
					            if(is_dir($fromfile)){// 如果读取的某个对象是文件夹,则递归
 | 
				
			||||||
                $response = moveFolder($fromfile, $tofile, $slash);
 | 
					                $response = moveFolder($fromfile, $tofile);
 | 
				
			||||||
                if (api_error(setConfigResponse($response))) return $response;
 | 
					                if (api_error(setConfigResponse($response))) return $response;
 | 
				
			||||||
            }else{
 | 
					            }else{
 | 
				
			||||||
                //if (file_exists($tofile)) unlink($tofile);
 | 
					                //if (file_exists($tofile)) unlink($tofile);
 | 
				
			||||||
| 
						 | 
					@ -390,3 +388,7 @@ function moveFolder($from, $to, $slash)
 | 
				
			||||||
function WaitFunction() {
 | 
					function WaitFunction() {
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function changeAuthKey() {
 | 
				
			||||||
 | 
					    return message("Not need.", 'Change platform Auth token or key', 404);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,357 @@
 | 
				
			||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function getpath()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    $_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 ($_SERVER['REQUEST_SCHEME']!='http'&&$_SERVER['REQUEST_SCHEME']!='https') {
 | 
				
			||||||
 | 
					        if ($_SERVER['HTTP_X_FORWARDED_PROTO']!='') {
 | 
				
			||||||
 | 
					            $tmp = explode(',', $_SERVER['HTTP_X_FORWARDED_PROTO'])[0];
 | 
				
			||||||
 | 
					            if ($tmp=='http'||$tmp=='https') $_SERVER['REQUEST_SCHEME'] = $tmp;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if ($_SERVER['HTTP_FLY_FORWARDED_PROTO']!='') $_SERVER['REQUEST_SCHEME'] = $_SERVER['HTTP_FLY_FORWARDED_PROTO'];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    $_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
 | 
				
			||||||
 | 
					    $_SERVER['referhost'] = explode('/', $_SERVER['HTTP_REFERER'])[2];
 | 
				
			||||||
 | 
					    $_SERVER['base_path'] = '/';
 | 
				
			||||||
 | 
					    if (isset($_SERVER['UNENCODED_URL'])) $_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL'];
 | 
				
			||||||
 | 
					    $p = strpos($_SERVER['REQUEST_URI'],'?');
 | 
				
			||||||
 | 
					    if ($p>0) $path = substr($_SERVER['REQUEST_URI'], 0, $p);
 | 
				
			||||||
 | 
					    else $path = $_SERVER['REQUEST_URI'];
 | 
				
			||||||
 | 
					    $path = path_format( substr($path, strlen($_SERVER['base_path'])) );
 | 
				
			||||||
 | 
					    return $path;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function getGET()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    if (!$_POST) {
 | 
				
			||||||
 | 
					        if (!!$HTTP_RAW_POST_DATA) {
 | 
				
			||||||
 | 
					            $tmpdata = $HTTP_RAW_POST_DATA;
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $tmpdata = file_get_contents('php://input');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (!!$tmpdata) {
 | 
				
			||||||
 | 
					            $postbody = explode("&", $tmpdata);
 | 
				
			||||||
 | 
					            foreach ($postbody as $postvalues) {
 | 
				
			||||||
 | 
					                $pos = strpos($postvalues,"=");
 | 
				
			||||||
 | 
					                $_POST[urldecode(substr($postvalues,0,$pos))]=urldecode(substr($postvalues,$pos+1));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (isset($_SERVER['UNENCODED_URL'])) $_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL'];
 | 
				
			||||||
 | 
					    $p = strpos($_SERVER['REQUEST_URI'],'?');
 | 
				
			||||||
 | 
					    if ($p>0) {
 | 
				
			||||||
 | 
					        $getstr = substr($_SERVER['REQUEST_URI'], $p+1);
 | 
				
			||||||
 | 
					        $getstrarr = explode("&",$getstr);
 | 
				
			||||||
 | 
					        foreach ($getstrarr as $getvalues) {
 | 
				
			||||||
 | 
					            if ($getvalues != '') {
 | 
				
			||||||
 | 
					                $pos = strpos($getvalues, "=");
 | 
				
			||||||
 | 
					            //echo $pos;
 | 
				
			||||||
 | 
					                if ($pos > 0) {
 | 
				
			||||||
 | 
					                    $getarry[urldecode(substr($getvalues, 0, $pos))] = urldecode(substr($getvalues, $pos + 1));
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    $getarry[urldecode($getvalues)] = true;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (isset($getarry)) {
 | 
				
			||||||
 | 
					        return $getarry;
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        return [];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function ReplitAPI($op, $key, $value = '') {
 | 
				
			||||||
 | 
					    //error_log1($op . '_' . $key . '_' . $value);
 | 
				
			||||||
 | 
					    $apiurl = getenv('REPLIT_DB_URL');
 | 
				
			||||||
 | 
					    //foreach (explode("\n", curl('GET', $apiurl . '?prefix')['body']) as $a) curl('DELETE', $apiurl . '/' . $a);
 | 
				
			||||||
 | 
					    if ($op === 'r') {
 | 
				
			||||||
 | 
					        if (!($config = getcache('REPLIT_CONFIG'))) {
 | 
				
			||||||
 | 
					            $config = json_decode(curl('GET', $apiurl . '/REPLIT_CONFIG')['body'], true);
 | 
				
			||||||
 | 
					            savecache('REPLIT_CONFIG', $config);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return ['stat'=>200, 'body'=>(is_array($config[$key])?json_encode($config[$key]):$config[$key])];
 | 
				
			||||||
 | 
					    } elseif ($op === 'w') {
 | 
				
			||||||
 | 
					        return curl('POST', $apiurl, 'REPLIT_CONFIG=' . $value, ["Content-Type"=>"application/x-www-form-urlencoded"]);
 | 
				
			||||||
 | 
					    } elseif ($op === 'd') {
 | 
				
			||||||
 | 
					        // not use
 | 
				
			||||||
 | 
					        return curl('DELETE', $apiurl . '/' . $key);
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        return ['stat'=>500, 'body'=>'error option input to function ReplitAPI().'];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function getConfig($str, $disktag = '')
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    if (isInnerEnv($str)) {
 | 
				
			||||||
 | 
					        if ($disktag=='') $disktag = $_SERVER['disktag'];
 | 
				
			||||||
 | 
					        $env = json_decode(ReplitAPI('r', $disktag)['body'], true);
 | 
				
			||||||
 | 
					        if (isset($env[$str])) {
 | 
				
			||||||
 | 
					            if (isBase64Env($str)) return base64y_decode($env[$str]);
 | 
				
			||||||
 | 
					            else return $env[$str];
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        if (isBase64Env($str)) return base64y_decode(ReplitAPI('r', $str)['body']);
 | 
				
			||||||
 | 
					        else return ReplitAPI('r', $str)['body'];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return '';
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function setConfig($arr, $disktag = '')
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    if (!($envs = getcache('REPLIT_CONFIG'))) {
 | 
				
			||||||
 | 
					        $envs = json_decode(curl('GET', getenv('REPLIT_DB_URL') . '/REPLIT_CONFIG')['body'], true);
 | 
				
			||||||
 | 
					        savecache('REPLIT_CONFIG', $envs);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if ($disktag=='') $disktag = $_SERVER['disktag'];
 | 
				
			||||||
 | 
					    $disktags = explode("|", getConfig('disktag'));
 | 
				
			||||||
 | 
					    $indisk = 0;
 | 
				
			||||||
 | 
					    $operatedisk = 0;
 | 
				
			||||||
 | 
					    foreach ($arr as $k => $v) {
 | 
				
			||||||
 | 
					        if (isCommonEnv($k)) {
 | 
				
			||||||
 | 
					            if (isBase64Env($k)) $envs[$k] = base64y_encode($v);
 | 
				
			||||||
 | 
					            else $envs[$k] = $v;
 | 
				
			||||||
 | 
					        } elseif (isInnerEnv($k)) {
 | 
				
			||||||
 | 
					            if (isBase64Env($k)) $envs[$disktag][$k] = base64y_encode($v);
 | 
				
			||||||
 | 
					            else $envs[$disktag][$k] = $v;
 | 
				
			||||||
 | 
					            $indisk = 1;
 | 
				
			||||||
 | 
					        } elseif ($k=='disktag_add') {
 | 
				
			||||||
 | 
					            array_push($disktags, $v);
 | 
				
			||||||
 | 
					            $operatedisk = 1;
 | 
				
			||||||
 | 
					        } elseif ($k=='disktag_del') {
 | 
				
			||||||
 | 
					            $disktags = array_diff($disktags, [ $v ]);
 | 
				
			||||||
 | 
					            $envs[$v] = '';
 | 
				
			||||||
 | 
					            $operatedisk = 1;
 | 
				
			||||||
 | 
					        } elseif ($k=='disktag_copy') {
 | 
				
			||||||
 | 
					            $newtag = $v . '_' . date("Ymd_His");
 | 
				
			||||||
 | 
					            $envs[$newtag] = $envs[$v];
 | 
				
			||||||
 | 
					            array_push($disktags, $newtag);
 | 
				
			||||||
 | 
					            $operatedisk = 1;
 | 
				
			||||||
 | 
					        } elseif ($k=='disktag_rename' || $k=='disktag_newname') {
 | 
				
			||||||
 | 
					            if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $envs[$k] = $v;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if ($indisk) {
 | 
				
			||||||
 | 
					        $diskconfig = $envs[$disktag];
 | 
				
			||||||
 | 
					        $diskconfig = array_filter($diskconfig, 'array_value_isnot_null');
 | 
				
			||||||
 | 
					        ksort($diskconfig);
 | 
				
			||||||
 | 
					        $envs[$disktag] = $diskconfig;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if ($operatedisk) {
 | 
				
			||||||
 | 
					        if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') {
 | 
				
			||||||
 | 
					            $tags = [];
 | 
				
			||||||
 | 
					            foreach ($disktags as $tag) {
 | 
				
			||||||
 | 
					                if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']);
 | 
				
			||||||
 | 
					                else array_push($tags, $tag);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            $envs['disktag'] = implode('|', $tags);
 | 
				
			||||||
 | 
					            $envs[$arr['disktag_newname']] = $envs[$arr['disktag_rename']];
 | 
				
			||||||
 | 
					            unset($envs[$arr['disktag_rename']]);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $disktags = array_unique($disktags);
 | 
				
			||||||
 | 
					            foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
 | 
				
			||||||
 | 
					            if ($disktag_s!='') $envs['disktag'] = substr($disktag_s, 0, -1);
 | 
				
			||||||
 | 
					            else $envs['disktag'] = '';
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    $envs = array_filter($envs, 'array_value_isnot_null');
 | 
				
			||||||
 | 
					    sortConfig($envs);
 | 
				
			||||||
 | 
					    $response = ReplitAPI('w', 'REPLIT_CONFIG', json_encode($envs));
 | 
				
			||||||
 | 
					    //error_log1(json_encode($arr, JSON_PRETTY_PRINT) . ' => tmp:' . json_encode($envs, JSON_PRETTY_PRINT));
 | 
				
			||||||
 | 
					    savecache('REPLIT_CONFIG', null, '', 0);
 | 
				
			||||||
 | 
					    if (api_error($response)) return ['stat'=>$response['stat'], 'body'=>$response['body'] . "<br>\nError in writting " . $key . "=" . $val];
 | 
				
			||||||
 | 
					    return $response;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function install()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    global $constStr;
 | 
				
			||||||
 | 
					    if ($_GET['install2']) {
 | 
				
			||||||
 | 
					        if ($_POST['admin']!='') {
 | 
				
			||||||
 | 
					            $tmp['admin'] = $_POST['admin'];
 | 
				
			||||||
 | 
					            //$tmp['language'] = $_COOKIE['language'];
 | 
				
			||||||
 | 
					            $tmp['timezone'] = $_COOKIE['timezone'];
 | 
				
			||||||
 | 
					            $response = setConfigResponse( setConfig($tmp) );
 | 
				
			||||||
 | 
					            if (api_error($response)) {
 | 
				
			||||||
 | 
					                $html = api_error_msg($response);
 | 
				
			||||||
 | 
					                $title = 'Error';
 | 
				
			||||||
 | 
					                return message($html, $title, 201);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                return output('Jump
 | 
				
			||||||
 | 
					            <script>
 | 
				
			||||||
 | 
					                var expd = new Date();
 | 
				
			||||||
 | 
					                expd.setTime(expd.getTime()+(2*60*60*1000));
 | 
				
			||||||
 | 
					                var expires = "expires="+expd.toGMTString();
 | 
				
			||||||
 | 
					                document.cookie=\'language=; path=/; \'+expires;
 | 
				
			||||||
 | 
					            </script>
 | 
				
			||||||
 | 
					            <meta http-equiv="refresh" content="3;URL=' . path_format($_SERVER['base_path'] . '/') . '">', 302);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if ($_GET['install1']) {
 | 
				
			||||||
 | 
					        /*if (!ConfigWriteable()) {
 | 
				
			||||||
 | 
					            $html .= getconstStr('MakesuerWriteable');
 | 
				
			||||||
 | 
					            $title = 'Error';
 | 
				
			||||||
 | 
					            return message($html, $title, 201);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (!RewriteEngineOn()) {
 | 
				
			||||||
 | 
					            $html .= getconstStr('MakesuerRewriteOn');
 | 
				
			||||||
 | 
					            $title = 'Error';
 | 
				
			||||||
 | 
					            return message($html, $title, 201);
 | 
				
			||||||
 | 
					        }*/
 | 
				
			||||||
 | 
					        $html .= '
 | 
				
			||||||
 | 
					    <form action="?install2" method="post" onsubmit="return notnull(this);">
 | 
				
			||||||
 | 
					        <input name="admin" type="password" placeholder="' . getconstStr('EnvironmentsDescription')['admin'] . '" size="' . strlen(getconstStr('EnvironmentsDescription')['admin']) . '"><br>
 | 
				
			||||||
 | 
					        <input id="submitbtn" type="submit" value="'.getconstStr('Submit').'">
 | 
				
			||||||
 | 
					    </form>
 | 
				
			||||||
 | 
					    <script>
 | 
				
			||||||
 | 
					        var nowtime= new Date();
 | 
				
			||||||
 | 
					        var timezone = 0-nowtime.getTimezoneOffset()/60;
 | 
				
			||||||
 | 
					        var expd = new Date();
 | 
				
			||||||
 | 
					        expd.setTime(expd.getTime()+(2*60*60*1000));
 | 
				
			||||||
 | 
					        var expires = "expires="+expd.toGMTString();
 | 
				
			||||||
 | 
					        document.cookie="timezone="+timezone+"; path=/; "+expires;
 | 
				
			||||||
 | 
					        function notnull(t)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (t.admin.value==\'\') {
 | 
				
			||||||
 | 
					                alert(\''.getconstStr('SetAdminPassword').'\');
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    </script>';
 | 
				
			||||||
 | 
					        $title = getconstStr('SetAdminPassword');
 | 
				
			||||||
 | 
					        return message($html, $title, 201);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if ($_GET['install0']) {
 | 
				
			||||||
 | 
					        $html .= '
 | 
				
			||||||
 | 
					    <form action="?install1" method="post">
 | 
				
			||||||
 | 
					language:<br>';
 | 
				
			||||||
 | 
					        foreach ($constStr['languages'] as $key1 => $value1) {
 | 
				
			||||||
 | 
					            $html .= '
 | 
				
			||||||
 | 
					        <label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        $html .= '
 | 
				
			||||||
 | 
					        <input type="submit" value="'.getconstStr('Submit').'">
 | 
				
			||||||
 | 
					    </form>
 | 
				
			||||||
 | 
					    <script>
 | 
				
			||||||
 | 
					        function changelanguage(str)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            var expd = new Date();
 | 
				
			||||||
 | 
					            expd.setTime(expd.getTime()+(2*60*60*1000));
 | 
				
			||||||
 | 
					            var expires = "expires="+expd.toGMTString();
 | 
				
			||||||
 | 
					            document.cookie=\'language=\'+str+\'; path=/; \'+expires;
 | 
				
			||||||
 | 
					            location.href = location.href;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    </script>';
 | 
				
			||||||
 | 
					        $title = getconstStr('SelectLanguage');
 | 
				
			||||||
 | 
					        return message($html, $title, 201);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    $title = 'Install';
 | 
				
			||||||
 | 
					    $html = '<a href="?install0">' . getconstStr('ClickInstall') . '</a>, ' . getconstStr('LogintoBind');
 | 
				
			||||||
 | 
					    return message($html, $title, 201);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function ConfigWriteable()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    $t = md5( md5(time()).rand(1000,9999) );
 | 
				
			||||||
 | 
					    $r = setConfig([ 'tmp' => $t ]);
 | 
				
			||||||
 | 
					    $tmp = getConfig('tmp');
 | 
				
			||||||
 | 
					    setConfig([ 'tmp' => '' ]);
 | 
				
			||||||
 | 
					    if ($tmp == $t) return true;
 | 
				
			||||||
 | 
					    if ($r) return true;
 | 
				
			||||||
 | 
					    return false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function api_error($response)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return !($response['stat']==200||$response['stat']==204||$response['stat']==404);
 | 
				
			||||||
 | 
					    //return isset($response['message']);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function api_error_msg($response)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return '<pre>'. json_encode($response, JSON_PRETTY_PRINT).'</pre>' . '<br>
 | 
				
			||||||
 | 
					<button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>';
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function setConfigResponse($response)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return $response;
 | 
				
			||||||
 | 
					    //return json_decode($response, true);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function OnekeyUpate($GitSource = 'Github', $auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    // __DIR__ is xxx/platform
 | 
				
			||||||
 | 
					    $projectPath = splitlast(__DIR__, '/')[0];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if ($GitSource=='Github') {
 | 
				
			||||||
 | 
					        // 从github下载对应tar.gz,并解压
 | 
				
			||||||
 | 
					        $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
 | 
				
			||||||
 | 
					    } elseif ($GitSource=='HITGitlab') {
 | 
				
			||||||
 | 
					        $url = 'https://git.hit.edu.cn/' . $auth . '/' . $project . '/-/archive/' . urlencode($branch) . '/' . $project . '-' . urlencode($branch) . '.tar.gz';
 | 
				
			||||||
 | 
					    } else return ['stat'=>500, 'body'=>'Git Source input Error!'];
 | 
				
			||||||
 | 
					    $tarfile = $projectPath . '/github.tar.gz';
 | 
				
			||||||
 | 
					    $githubfile = file_get_contents($url);
 | 
				
			||||||
 | 
					    if (!$githubfile) return ['stat'=>500, 'body'=>'download error from github.'];
 | 
				
			||||||
 | 
					    file_put_contents($tarfile, $githubfile);
 | 
				
			||||||
 | 
					    if (splitfirst(PHP_VERSION, '.')[0] > '5') {
 | 
				
			||||||
 | 
					        $phar = new PharData($tarfile); // need php5.3, 7, 8
 | 
				
			||||||
 | 
					        $phar->extractTo($projectPath, null, true);//路径 要解压的文件 是否覆盖
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        ob_start();
 | 
				
			||||||
 | 
					        passthru('tar -xzvf ' . $tarfile, $stat);
 | 
				
			||||||
 | 
					        ob_get_clean();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    unlink($tarfile);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    $outPath = '';
 | 
				
			||||||
 | 
					    $outPath = findIndexPath($projectPath);
 | 
				
			||||||
 | 
					    //error_log1($outPath);
 | 
				
			||||||
 | 
					    if ($outPath=='') return ['stat'=>500, 'body'=>'can\'t find folder after download from github.'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return moveFolder($outPath, $projectPath);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function moveFolder($from, $to)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    if (substr($from, -1)=='/') $from = substr($from, 0, -1);
 | 
				
			||||||
 | 
					    if (substr($to, -1)=='/') $to = substr($to, 0, -1);
 | 
				
			||||||
 | 
					    if (!file_exists($to)) mkdir($to, 0777);
 | 
				
			||||||
 | 
					    $handler=opendir($from);
 | 
				
			||||||
 | 
					    while($filename=readdir($handler)) {
 | 
				
			||||||
 | 
					        if($filename != '.' && $filename != '..'){
 | 
				
			||||||
 | 
					            $fromfile = $from . '/' . $filename;
 | 
				
			||||||
 | 
					            $tofile = $to . '/' . $filename;
 | 
				
			||||||
 | 
					            if(is_dir($fromfile)){// 如果读取的某个对象是文件夹,则递归
 | 
				
			||||||
 | 
					                $response = moveFolder($fromfile, $tofile);
 | 
				
			||||||
 | 
					                if (api_error(setConfigResponse($response))) return $response;
 | 
				
			||||||
 | 
					            }else{
 | 
				
			||||||
 | 
					                if (file_exists($tofile)) unlink($tofile);
 | 
				
			||||||
 | 
					                $response = rename($fromfile, $tofile);
 | 
				
			||||||
 | 
					                if (!$response) {
 | 
				
			||||||
 | 
					                    $tmp['code'] = "Move Failed";
 | 
				
			||||||
 | 
					                    $tmp['message'] = "Can not move " . $fromfile . " to " . $tofile;
 | 
				
			||||||
 | 
					                    return ['stat'=>500, 'body'=>json_encode($tmp)];
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                if (file_exists($fromfile)) unlink($fromfile);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    closedir($handler);
 | 
				
			||||||
 | 
					    rmdir($from);
 | 
				
			||||||
 | 
					    return ['stat'=>200, 'body'=>'success.'];
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function WaitFunction() {
 | 
				
			||||||
 | 
					    return true;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function changeAuthKey() {
 | 
				
			||||||
 | 
					    return message("Not need.", 'Change platform Auth token or key', 404);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,379 @@
 | 
				
			||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function getpath()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    $_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 ($_SERVER['REQUEST_SCHEME']!='http'&&$_SERVER['REQUEST_SCHEME']!='https') {
 | 
				
			||||||
 | 
					        if ($_SERVER['HTTP_X_FORWARDED_PROTO']!='') {
 | 
				
			||||||
 | 
					            $tmp = explode(',', $_SERVER['HTTP_X_FORWARDED_PROTO'])[0];
 | 
				
			||||||
 | 
					            if ($tmp=='http'||$tmp=='https') $_SERVER['REQUEST_SCHEME'] = $tmp;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if ($_SERVER['HTTP_FLY_FORWARDED_PROTO']!='') $_SERVER['REQUEST_SCHEME'] = $_SERVER['HTTP_FLY_FORWARDED_PROTO'];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    $_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
 | 
				
			||||||
 | 
					    $_SERVER['referhost'] = explode('/', $_SERVER['HTTP_REFERER'])[2];
 | 
				
			||||||
 | 
					    $_SERVER['base_path'] = '/';
 | 
				
			||||||
 | 
					    if (isset($_SERVER['UNENCODED_URL'])) $_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL'];
 | 
				
			||||||
 | 
					    $p = strpos($_SERVER['REQUEST_URI'],'?');
 | 
				
			||||||
 | 
					    if ($p>0) $path = substr($_SERVER['REQUEST_URI'], 0, $p);
 | 
				
			||||||
 | 
					    else $path = $_SERVER['REQUEST_URI'];
 | 
				
			||||||
 | 
					    $path = path_format( substr($path, strlen($_SERVER['base_path'])) );
 | 
				
			||||||
 | 
					    return $path;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function getGET()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    if (!$_POST) {
 | 
				
			||||||
 | 
					        if (!!$HTTP_RAW_POST_DATA) {
 | 
				
			||||||
 | 
					            $tmpdata = $HTTP_RAW_POST_DATA;
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $tmpdata = file_get_contents('php://input');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (!!$tmpdata) {
 | 
				
			||||||
 | 
					            $postbody = explode("&", $tmpdata);
 | 
				
			||||||
 | 
					            foreach ($postbody as $postvalues) {
 | 
				
			||||||
 | 
					                $pos = strpos($postvalues,"=");
 | 
				
			||||||
 | 
					                $_POST[urldecode(substr($postvalues,0,$pos))]=urldecode(substr($postvalues,$pos+1));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (isset($_SERVER['UNENCODED_URL'])) $_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL'];
 | 
				
			||||||
 | 
					    $p = strpos($_SERVER['REQUEST_URI'],'?');
 | 
				
			||||||
 | 
					    if ($p>0) {
 | 
				
			||||||
 | 
					        $getstr = substr($_SERVER['REQUEST_URI'], $p+1);
 | 
				
			||||||
 | 
					        $getstrarr = explode("&",$getstr);
 | 
				
			||||||
 | 
					        foreach ($getstrarr as $getvalues) {
 | 
				
			||||||
 | 
					            if ($getvalues != '') {
 | 
				
			||||||
 | 
					                $pos = strpos($getvalues, "=");
 | 
				
			||||||
 | 
					            //echo $pos;
 | 
				
			||||||
 | 
					                if ($pos > 0) {
 | 
				
			||||||
 | 
					                    $getarry[urldecode(substr($getvalues, 0, $pos))] = urldecode(substr($getvalues, $pos + 1));
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    $getarry[urldecode($getvalues)] = true;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (isset($getarry)) {
 | 
				
			||||||
 | 
					        return $getarry;
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        return [];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function ReplitAPI($op, $key, $value = '') {
 | 
				
			||||||
 | 
					  //error_log1($op . '_' . $key . '_' . $value);
 | 
				
			||||||
 | 
					  $apiurl = getenv('REPLIT_DB_URL');
 | 
				
			||||||
 | 
					  if ($op === 'r') {
 | 
				
			||||||
 | 
					    return curl('GET', $apiurl . '/' . $key);
 | 
				
			||||||
 | 
					  } elseif ($op === 'w') {
 | 
				
			||||||
 | 
					    return curl('POST', $apiurl, $key . '=' . $value, ["Content-Type"=>"application/x-www-form-urlencoded"]);
 | 
				
			||||||
 | 
					  } elseif ($op === 'd') {
 | 
				
			||||||
 | 
					    return curl('DELETE', $apiurl . '/' . $key);
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					    return ['stat'=>500, 'body'=>'error option input to function ReplitAPI().'];
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function getConfig($str, $disktag = '')
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    if (isInnerEnv($str)) {
 | 
				
			||||||
 | 
					        if ($disktag=='') $disktag = $_SERVER['disktag'];
 | 
				
			||||||
 | 
					        $env = json_decode(ReplitAPI('r', $disktag)['body'], true);
 | 
				
			||||||
 | 
					        if (isset($env[$str])) {
 | 
				
			||||||
 | 
					            if (isBase64Env($str)) return base64y_decode($env[$str]);
 | 
				
			||||||
 | 
					            else return $env[$str];
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        if (isBase64Env($str)) return base64y_decode(ReplitAPI('r', $str)['body']);
 | 
				
			||||||
 | 
					        else return ReplitAPI('r', $str)['body'];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return '';
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function setConfig($arr, $disktag = '')
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    if ($disktag=='') $disktag = $_SERVER['disktag'];
 | 
				
			||||||
 | 
					    $disktags = explode("|", getConfig('disktag'));
 | 
				
			||||||
 | 
					    if ($disktag!='') $diskconfig = json_decode(ReplitAPI('r', $disktag)['body'], true);
 | 
				
			||||||
 | 
					    $tmp = [];
 | 
				
			||||||
 | 
					    $indisk = 0;
 | 
				
			||||||
 | 
					    $operatedisk = 0;
 | 
				
			||||||
 | 
					    foreach ($arr as $k => $v) {
 | 
				
			||||||
 | 
					        if (isCommonEnv($k)) {
 | 
				
			||||||
 | 
					            if (isBase64Env($k)) $tmp[$k] = base64y_encode($v);
 | 
				
			||||||
 | 
					            else $tmp[$k] = $v;
 | 
				
			||||||
 | 
					        } elseif (isInnerEnv($k)) {
 | 
				
			||||||
 | 
					            if (isBase64Env($k)) $diskconfig[$k] = base64y_encode($v);
 | 
				
			||||||
 | 
					            else $diskconfig[$k] = $v;
 | 
				
			||||||
 | 
					            $indisk = 1;
 | 
				
			||||||
 | 
					        } elseif ($k=='disktag_add') {
 | 
				
			||||||
 | 
					            array_push($disktags, $v);
 | 
				
			||||||
 | 
					            $operatedisk = 1;
 | 
				
			||||||
 | 
					        } elseif ($k=='disktag_del') {
 | 
				
			||||||
 | 
					            $disktags = array_diff($disktags, [ $v ]);
 | 
				
			||||||
 | 
					            $tmp[$v] = '';
 | 
				
			||||||
 | 
					            $operatedisk = 1;
 | 
				
			||||||
 | 
					        } elseif ($k=='disktag_copy') {
 | 
				
			||||||
 | 
					            $newtag = $v . '_' . date("Ymd_His");
 | 
				
			||||||
 | 
					            $tmp[$newtag] = getConfig($v);
 | 
				
			||||||
 | 
					            array_push($disktags, $newtag);
 | 
				
			||||||
 | 
					            $operatedisk = 1;
 | 
				
			||||||
 | 
					        } elseif ($k=='disktag_rename' || $k=='disktag_newname') {
 | 
				
			||||||
 | 
					            if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $tmp[$k] = json_encode($v);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if ($indisk) {
 | 
				
			||||||
 | 
					        $diskconfig = array_filter($diskconfig, 'array_value_isnot_null');
 | 
				
			||||||
 | 
					        ksort($diskconfig);
 | 
				
			||||||
 | 
					        $tmp[$disktag] = json_encode($diskconfig);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if ($operatedisk) {
 | 
				
			||||||
 | 
					        if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') {
 | 
				
			||||||
 | 
					            $tags = [];
 | 
				
			||||||
 | 
					            foreach ($disktags as $tag) {
 | 
				
			||||||
 | 
					                if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']);
 | 
				
			||||||
 | 
					                else array_push($tags, $tag);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            $tmp['disktag'] = implode('|', $tags);
 | 
				
			||||||
 | 
					            $tmp[$arr['disktag_newname']] = getConfig($arr['disktag_rename']);
 | 
				
			||||||
 | 
					            $tmp[$arr['disktag_rename']] = null;
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $disktags = array_unique($disktags);
 | 
				
			||||||
 | 
					            foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
 | 
				
			||||||
 | 
					            if ($disktag_s!='') $tmp['disktag'] = substr($disktag_s, 0, -1);
 | 
				
			||||||
 | 
					            else $tmp['disktag'] = null;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    $response = null;
 | 
				
			||||||
 | 
					    foreach ($tmp as $key => $val) {
 | 
				
			||||||
 | 
					      if (!!$val) $response = ReplitAPI('w', $key, $val);
 | 
				
			||||||
 | 
					      else $response = ReplitAPI('d', $key);
 | 
				
			||||||
 | 
					      if (api_error($response)) return ['stat'=>$response['stat'], 'body'=>$response['body'] . "<br>\nError in writting " . $key . "=" . $val];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    //error_log1(json_encode($arr, JSON_PRETTY_PRINT) . ' => tmp:' . json_encode($tmp, JSON_PRETTY_PRINT));
 | 
				
			||||||
 | 
					    return $response;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function install()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    global $constStr;
 | 
				
			||||||
 | 
					    if ($_GET['install2']) {
 | 
				
			||||||
 | 
					        if ($_POST['admin']!='') {
 | 
				
			||||||
 | 
					            $tmp['admin'] = $_POST['admin'];
 | 
				
			||||||
 | 
					            //$tmp['language'] = $_COOKIE['language'];
 | 
				
			||||||
 | 
					            $tmp['timezone'] = $_COOKIE['timezone'];
 | 
				
			||||||
 | 
					            $response = setConfigResponse( setConfig($tmp) );
 | 
				
			||||||
 | 
					            if (api_error($response)) {
 | 
				
			||||||
 | 
					                $html = api_error_msg($response);
 | 
				
			||||||
 | 
					                $title = 'Error';
 | 
				
			||||||
 | 
					                return message($html, $title, 201);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                return output('Jump
 | 
				
			||||||
 | 
					            <script>
 | 
				
			||||||
 | 
					                var expd = new Date();
 | 
				
			||||||
 | 
					                expd.setTime(expd.getTime()+(2*60*60*1000));
 | 
				
			||||||
 | 
					                var expires = "expires="+expd.toGMTString();
 | 
				
			||||||
 | 
					                document.cookie=\'language=; path=/; \'+expires;
 | 
				
			||||||
 | 
					            </script>
 | 
				
			||||||
 | 
					            <meta http-equiv="refresh" content="3;URL=' . path_format($_SERVER['base_path'] . '/') . '">', 302);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if ($_GET['install1']) {
 | 
				
			||||||
 | 
					        if (!ConfigWriteable()) {
 | 
				
			||||||
 | 
					            $html .= getconstStr('MakesuerWriteable');
 | 
				
			||||||
 | 
					            $title = 'Error';
 | 
				
			||||||
 | 
					            return message($html, $title, 201);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        /*if (!RewriteEngineOn()) {
 | 
				
			||||||
 | 
					            $html .= getconstStr('MakesuerRewriteOn');
 | 
				
			||||||
 | 
					            $title = 'Error';
 | 
				
			||||||
 | 
					            return message($html, $title, 201);
 | 
				
			||||||
 | 
					        }*/
 | 
				
			||||||
 | 
					        $html .= '<button id="checkrewritebtn" onclick="checkrewrite();">'.getconstStr('MakesuerRewriteOn').'</button>
 | 
				
			||||||
 | 
					<div id="formdiv" style="display: none">
 | 
				
			||||||
 | 
					    <form action="?install2" method="post" onsubmit="return notnull(this);">
 | 
				
			||||||
 | 
					        <input name="admin" type="password" placeholder="' . getconstStr('EnvironmentsDescription')['admin'] . '" size="' . strlen(getconstStr('EnvironmentsDescription')['admin']) . '"><br>
 | 
				
			||||||
 | 
					        <input id="submitbtn" type="submit" value="'.getconstStr('Submit').'" disabled>
 | 
				
			||||||
 | 
					    </form>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					    <script>
 | 
				
			||||||
 | 
					        var nowtime= new Date();
 | 
				
			||||||
 | 
					        var timezone = 0-nowtime.getTimezoneOffset()/60;
 | 
				
			||||||
 | 
					        var expd = new Date();
 | 
				
			||||||
 | 
					        expd.setTime(expd.getTime()+(2*60*60*1000));
 | 
				
			||||||
 | 
					        var expires = "expires="+expd.toGMTString();
 | 
				
			||||||
 | 
					        document.cookie="timezone="+timezone+"; path=/; "+expires;
 | 
				
			||||||
 | 
					        function notnull(t)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (t.admin.value==\'\') {
 | 
				
			||||||
 | 
					                alert(\''.getconstStr('SetAdminPassword').'\');
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        function checkrewrite()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            url=location.protocol + "//" + location.host;
 | 
				
			||||||
 | 
					            //if (location.port!="") url += ":" + location.port;
 | 
				
			||||||
 | 
					            url += location.pathname;
 | 
				
			||||||
 | 
					            if (url.substr(-1)!="/") url += "/";
 | 
				
			||||||
 | 
					            url += "app.json";
 | 
				
			||||||
 | 
					            url += "?" + Date.now();
 | 
				
			||||||
 | 
					            var xhr4 = new XMLHttpRequest();
 | 
				
			||||||
 | 
					            xhr4.open("GET", url);
 | 
				
			||||||
 | 
					            xhr4.setRequestHeader("x-requested-with","XMLHttpRequest");
 | 
				
			||||||
 | 
					            xhr4.send(null);
 | 
				
			||||||
 | 
					            xhr4.onload = function(e){
 | 
				
			||||||
 | 
					                console.log(xhr4.responseText+","+xhr4.status);
 | 
				
			||||||
 | 
					                if (xhr4.status==201) {
 | 
				
			||||||
 | 
					                    document.getElementById("checkrewritebtn").style.display = "none";
 | 
				
			||||||
 | 
					                    document.getElementById("submitbtn").disabled = false;
 | 
				
			||||||
 | 
					                    document.getElementById("formdiv").style.display = "";
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    alert("' . getconstStr('MakesuerRewriteOn') . '?\nfalse\n\nUrl: " + url + "\nExpect http code 201, but received " + xhr4.status);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    </script>';
 | 
				
			||||||
 | 
					        $title = getconstStr('SetAdminPassword');
 | 
				
			||||||
 | 
					        return message($html, $title, 201);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if ($_GET['install0']) {
 | 
				
			||||||
 | 
					        $html .= '
 | 
				
			||||||
 | 
					    <form action="?install1" method="post">
 | 
				
			||||||
 | 
					language:<br>';
 | 
				
			||||||
 | 
					        foreach ($constStr['languages'] as $key1 => $value1) {
 | 
				
			||||||
 | 
					            $html .= '
 | 
				
			||||||
 | 
					        <label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        $html .= '
 | 
				
			||||||
 | 
					        <input type="submit" value="'.getconstStr('Submit').'">
 | 
				
			||||||
 | 
					    </form>
 | 
				
			||||||
 | 
					    <script>
 | 
				
			||||||
 | 
					        function changelanguage(str)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            var expd = new Date();
 | 
				
			||||||
 | 
					            expd.setTime(expd.getTime()+(2*60*60*1000));
 | 
				
			||||||
 | 
					            var expires = "expires="+expd.toGMTString();
 | 
				
			||||||
 | 
					            document.cookie=\'language=\'+str+\'; path=/; \'+expires;
 | 
				
			||||||
 | 
					            location.href = location.href;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    </script>';
 | 
				
			||||||
 | 
					        $title = getconstStr('SelectLanguage');
 | 
				
			||||||
 | 
					        return message($html, $title, 201);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    $title = 'Install';
 | 
				
			||||||
 | 
					    $html = '<a href="?install0">' . getconstStr('ClickInstall') . '</a>, ' . getconstStr('LogintoBind');
 | 
				
			||||||
 | 
					    return message($html, $title, 201);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function ConfigWriteable()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    $t = md5( md5(time()).rand(1000,9999) );
 | 
				
			||||||
 | 
					    $r = setConfig([ 'tmp' => $t ]);
 | 
				
			||||||
 | 
					    $tmp = getConfig('tmp');
 | 
				
			||||||
 | 
					    setConfig([ 'tmp' => '' ]);
 | 
				
			||||||
 | 
					    if ($tmp == $t) return true;
 | 
				
			||||||
 | 
					    if ($r) return true;
 | 
				
			||||||
 | 
					    return false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function api_error($response)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  return !($response['stat']==200||$response['stat']==204||$response['stat']==404);
 | 
				
			||||||
 | 
					    //return isset($response['message']);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function api_error_msg($response)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return '<pre>'. json_encode($response, JSON_PRETTY_PRINT).'</pre>' . '<br>
 | 
				
			||||||
 | 
					<button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>';
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function setConfigResponse($response)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  return $response;
 | 
				
			||||||
 | 
					    //return json_decode($response, true);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    $slash = '/';
 | 
				
			||||||
 | 
					    if (strpos(__DIR__, ':')) $slash = '\\';
 | 
				
			||||||
 | 
					    // __DIR__ is xxx/platform
 | 
				
			||||||
 | 
					    $projectPath = splitlast(__DIR__, $slash)[0];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // 从github下载对应tar.gz,并解压
 | 
				
			||||||
 | 
					    $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
 | 
				
			||||||
 | 
					    $tarfile = $projectPath . $slash .'github.tar.gz';
 | 
				
			||||||
 | 
					    $githubfile = file_get_contents($url);
 | 
				
			||||||
 | 
					    if (!$githubfile) return ['stat'=>500, 'body'=>'download error from github.'];
 | 
				
			||||||
 | 
					    file_put_contents($tarfile, $githubfile);
 | 
				
			||||||
 | 
					    if (splitfirst(PHP_VERSION, '.')[0] > '5') {
 | 
				
			||||||
 | 
					        $phar = new PharData($tarfile); // need php5.3, 7, 8
 | 
				
			||||||
 | 
					        $phar->extractTo($projectPath, null, true);//路径 要解压的文件 是否覆盖
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        ob_start();
 | 
				
			||||||
 | 
					        passthru('tar -xzvf ' . $tarfile, $stat);
 | 
				
			||||||
 | 
					        ob_get_clean();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    unlink($tarfile);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    $outPath = '';
 | 
				
			||||||
 | 
					    $tmp = scandir($projectPath);
 | 
				
			||||||
 | 
					    $name = $auth . '-' . $project;
 | 
				
			||||||
 | 
					    foreach ($tmp as $f) {
 | 
				
			||||||
 | 
					        if ( substr($f, 0, strlen($name)) == $name) {
 | 
				
			||||||
 | 
					            $outPath = $projectPath . $slash . $f;
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    //error_log1($outPath);
 | 
				
			||||||
 | 
					    if ($outPath=='') return ['stat'=>500, 'body'=>'can\'t find folder after download from github.'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return moveFolder($outPath, $projectPath, $slash);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function moveFolder($from, $to, $slash)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    if (substr($from, -1)==$slash) $from = substr($from, 0, -1);
 | 
				
			||||||
 | 
					    if (substr($to, -1)==$slash) $to = substr($to, 0, -1);
 | 
				
			||||||
 | 
					    if (!file_exists($to)) mkdir($to, 0777);
 | 
				
			||||||
 | 
					    $handler=opendir($from);
 | 
				
			||||||
 | 
					    while($filename=readdir($handler)) {
 | 
				
			||||||
 | 
					        if($filename != '.' && $filename != '..'){
 | 
				
			||||||
 | 
					            $fromfile = $from . $slash . $filename;
 | 
				
			||||||
 | 
					            $tofile = $to . $slash . $filename;
 | 
				
			||||||
 | 
					            if(is_dir($fromfile)){// 如果读取的某个对象是文件夹,则递归
 | 
				
			||||||
 | 
					                $response = moveFolder($fromfile, $tofile, $slash);
 | 
				
			||||||
 | 
					                if (api_error(setConfigResponse($response))) return $response;
 | 
				
			||||||
 | 
					            }else{
 | 
				
			||||||
 | 
					                if (file_exists($tofile)) unlink($tofile);
 | 
				
			||||||
 | 
					                $response = rename($fromfile, $tofile);
 | 
				
			||||||
 | 
					                if (!$response) {
 | 
				
			||||||
 | 
					                    $tmp['code'] = "Move Failed";
 | 
				
			||||||
 | 
					                    $tmp['message'] = "Can not move " . $fromfile . " to " . $tofile;
 | 
				
			||||||
 | 
					                    return ['stat'=>500, 'body'=>json_encode($tmp)];
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                if (file_exists($fromfile)) unlink($fromfile);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    closedir($handler);
 | 
				
			||||||
 | 
					    rmdir($from);
 | 
				
			||||||
 | 
					    return ['stat'=>200, 'body'=>'success.'];
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function WaitFunction() {
 | 
				
			||||||
 | 
					    return true;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function changeAuthKey() {
 | 
				
			||||||
 | 
					    return message("Not need.", 'Change platform Auth token or key', 404);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,7 @@
 | 
				
			||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					// https://cloud.tencent.com/document/product/583/33846
 | 
				
			||||||
 | 
					// https://cloud.tencent.com/document/product/583/18581
 | 
				
			||||||
 | 
					// https://cloud.tencent.com/document/product/583/18580
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function printInput($event, $context)
 | 
					function printInput($event, $context)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -56,6 +59,7 @@ function GetPathSetting($event, $context)
 | 
				
			||||||
    $_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
 | 
					    $_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
 | 
				
			||||||
    $_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['USER'] = 'qcloud';
 | 
					    $_SERVER['USER'] = 'qcloud';
 | 
				
			||||||
    return $path;
 | 
					    return $path;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -166,16 +170,24 @@ function install()
 | 
				
			||||||
            var expires = "expires="+expd.toGMTString();
 | 
					            var expires = "expires="+expd.toGMTString();
 | 
				
			||||||
            document.cookie=\'language=; path=/; \'+expires;
 | 
					            document.cookie=\'language=; path=/; \'+expires;
 | 
				
			||||||
        </script>
 | 
					        </script>
 | 
				
			||||||
        <meta http-equiv="refresh" content="3;URL=' . $url . '">', 'Program updating', 201);
 | 
					        <meta http-equiv="refresh" content="3;URL=' . $url . '">', 'Program updating', 201, 1);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return output('Jump
 | 
					        return message(getconstStr('Success') . '
 | 
				
			||||||
    <script>
 | 
					    <script>
 | 
				
			||||||
        var expd = new Date();
 | 
					        var expd = new Date();
 | 
				
			||||||
        expd.setTime(expd.getTime()+(2*60*60*1000));
 | 
					        expd.setTime(expd.getTime()+(2*60*60*1000));
 | 
				
			||||||
        var expires = "expires="+expd.toGMTString();
 | 
					        var expires = "expires="+expd.toGMTString();
 | 
				
			||||||
        document.cookie=\'language=; path=/; \'+expires;
 | 
					        document.cookie=\'language=; path=/; \'+expires;
 | 
				
			||||||
    </script>
 | 
					        var i = 0;
 | 
				
			||||||
    <meta http-equiv="refresh" content="3;URL=' . path_format($_SERVER['base_path'] . '/') . '">', 302);
 | 
					        var uploadList = setInterval(function(){
 | 
				
			||||||
 | 
					            if (document.getElementById("dis").style.display=="none") {
 | 
				
			||||||
 | 
					                console.log(i++);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                clearInterval(uploadList);
 | 
				
			||||||
 | 
					                location.href = "' . path_format($_SERVER['base_path'] . '/') . '";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }, 1000);
 | 
				
			||||||
 | 
					    </script>', 201, 1);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if ($_GET['install1']) {
 | 
					    if ($_GET['install1']) {
 | 
				
			||||||
        $tmp['timezone'] = $_COOKIE['timezone'];
 | 
					        $tmp['timezone'] = $_COOKIE['timezone'];
 | 
				
			||||||
| 
						 | 
					@ -199,7 +211,7 @@ function install()
 | 
				
			||||||
            if ($tmp['ONEMANAGER_CONFIG_SAVE'] == 'file') {
 | 
					            if ($tmp['ONEMANAGER_CONFIG_SAVE'] == 'file') {
 | 
				
			||||||
                $html = getconstStr('ONEMANAGER_CONFIG_SAVE_FILE') . '<br><a href="' . $_SERVER['base_path'] . '">' . getconstStr('Home') . '</a>';
 | 
					                $html = getconstStr('ONEMANAGER_CONFIG_SAVE_FILE') . '<br><a href="' . $_SERVER['base_path'] . '">' . getconstStr('Home') . '</a>';
 | 
				
			||||||
                $title = 'Reinstall';
 | 
					                $title = 'Reinstall';
 | 
				
			||||||
                return message($html, $title, 201);
 | 
					                return message($html, $title, 201, 1);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            $html .= '
 | 
					            $html .= '
 | 
				
			||||||
    <form action="?install2" method="post" onsubmit="return notnull(this);">
 | 
					    <form action="?install2" method="post" onsubmit="return notnull(this);">
 | 
				
			||||||
| 
						 | 
					@ -217,7 +229,7 @@ function install()
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    </script>';
 | 
					    </script>';
 | 
				
			||||||
            $title = getconstStr('SetAdminPassword');
 | 
					            $title = getconstStr('SetAdminPassword');
 | 
				
			||||||
            return message($html, $title, 201);
 | 
					            return message($html, $title, 201, 1);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if ($_GET['install0']) {
 | 
					    if ($_GET['install0']) {
 | 
				
			||||||
| 
						 | 
					@ -228,10 +240,11 @@ language:<br>';
 | 
				
			||||||
            $html .= '
 | 
					            $html .= '
 | 
				
			||||||
        <label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
 | 
					        <label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (getConfig('SecretId')==''||getConfig('SecretKey')=='') $html .= '
 | 
					        //if (getConfig('SecretId')==''||getConfig('SecretKey')=='') 
 | 
				
			||||||
 | 
					        $html .= '
 | 
				
			||||||
        <a href="https://console.cloud.tencent.com/cam/capi" target="_blank">' . getconstStr('Create') . ' SecretId & SecretKey</a><br>
 | 
					        <a href="https://console.cloud.tencent.com/cam/capi" target="_blank">' . getconstStr('Create') . ' SecretId & SecretKey</a><br>
 | 
				
			||||||
        <label>SecretId:<input name="SecretId" type="text" placeholder="" size=""></label><br>
 | 
					        <label>SecretId:<input name="SecretId" type="text" placeholder="" size=""></label><br>
 | 
				
			||||||
        <label>SecretKey:<input name="SecretKey" type="text" placeholder="" size=""></label><br>';
 | 
					        <label>SecretKey:<input name="SecretKey" type="password" placeholder="" size=""></label><br>';
 | 
				
			||||||
        $html .= '
 | 
					        $html .= '
 | 
				
			||||||
        <label><input type="radio" name="ONEMANAGER_CONFIG_SAVE" value="" ' . ('file'==getenv('ONEMANAGER_CONFIG_SAVE')?'':'checked') . '>' . getconstStr('ONEMANAGER_CONFIG_SAVE_ENV') . '</label><br>
 | 
					        <label><input type="radio" name="ONEMANAGER_CONFIG_SAVE" value="" ' . ('file'==getenv('ONEMANAGER_CONFIG_SAVE')?'':'checked') . '>' . getconstStr('ONEMANAGER_CONFIG_SAVE_ENV') . '</label><br>
 | 
				
			||||||
        <label><input type="radio" name="ONEMANAGER_CONFIG_SAVE" value="file" ' . ('file'==getenv('ONEMANAGER_CONFIG_SAVE')?'checked':'') . '>' . getconstStr('ONEMANAGER_CONFIG_SAVE_FILE') . '</label><br>';
 | 
					        <label><input type="radio" name="ONEMANAGER_CONFIG_SAVE" value="file" ' . ('file'==getenv('ONEMANAGER_CONFIG_SAVE')?'checked':'') . '>' . getconstStr('ONEMANAGER_CONFIG_SAVE_FILE') . '</label><br>';
 | 
				
			||||||
| 
						 | 
					@ -255,7 +268,8 @@ language:<br>';
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        function notnull(t)
 | 
					        function notnull(t)
 | 
				
			||||||
        {';
 | 
					        {';
 | 
				
			||||||
        if (getConfig('SecretId')==''||getConfig('SecretKey')=='') $html .= '
 | 
					        //if (getConfig('SecretId')==''||getConfig('SecretKey')=='') 
 | 
				
			||||||
 | 
					        $html .= '
 | 
				
			||||||
            if (t.SecretId.value==\'\') {
 | 
					            if (t.SecretId.value==\'\') {
 | 
				
			||||||
                alert(\'input SecretId\');
 | 
					                alert(\'input SecretId\');
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
| 
						 | 
					@ -547,29 +561,24 @@ function updateProgram($function_name, $Region, $Namespace, $SecretId, $SecretKe
 | 
				
			||||||
    return curl('POST', 'https://'.$host, $payload, $headers)['body'];
 | 
					    return curl('POST', 'https://'.$host, $payload, $headers)['body'];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
 | 
					function OnekeyUpate($GitSource = 'Github', $auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    $source = '/tmp/code.zip';
 | 
					    $source = '/tmp/code.zip';
 | 
				
			||||||
    $outPath = '/tmp/';
 | 
					    $outPath = '/tmp/';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if ($GitSource=='Github') {
 | 
				
			||||||
        // 从github下载对应tar.gz,并解压
 | 
					        // 从github下载对应tar.gz,并解压
 | 
				
			||||||
        $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
 | 
					        $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
 | 
				
			||||||
 | 
					    } elseif ($GitSource=='HITGitlab') {
 | 
				
			||||||
 | 
					        $url = 'https://git.hit.edu.cn/' . $auth . '/' . $project . '/-/archive/' . urlencode($branch) . '/' . $project . '-' . urlencode($branch) . '.tar.gz';
 | 
				
			||||||
 | 
					    } else return json_encode(['Response'=>['Error'=>['code'=>'Git Source input Error!']]]);
 | 
				
			||||||
    $tarfile = '/tmp/github.tar.gz';
 | 
					    $tarfile = '/tmp/github.tar.gz';
 | 
				
			||||||
    file_put_contents($tarfile, file_get_contents($url));
 | 
					    file_put_contents($tarfile, file_get_contents($url));
 | 
				
			||||||
    $phar = new PharData($tarfile);
 | 
					    $phar = new PharData($tarfile);
 | 
				
			||||||
    $html = $phar->extractTo($outPath, null, true);//路径 要解压的文件 是否覆盖
 | 
					    $html = $phar->extractTo($outPath, null, true);//路径 要解压的文件 是否覆盖
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // 获取包中目录名
 | 
					    // 获取解压出的目录名
 | 
				
			||||||
    $tmp = scandir('phar://'.$tarfile);
 | 
					    $outPath = findIndexPath($outPath);
 | 
				
			||||||
    $name = $auth.'-'.$project;
 | 
					 | 
				
			||||||
    foreach ($tmp as $f) {
 | 
					 | 
				
			||||||
        if ( substr($f, 0, strlen($name)) == $name) {
 | 
					 | 
				
			||||||
            $outPath .= $f;
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    // 放入配置文件
 | 
					 | 
				
			||||||
    file_put_contents($outPath . '/.data/config.php', file_get_contents(__DIR__ . '/../.data/config.php'));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // 将目录中文件打包成zip
 | 
					    // 将目录中文件打包成zip
 | 
				
			||||||
    //$zip=new ZipArchive();
 | 
					    //$zip=new ZipArchive();
 | 
				
			||||||
| 
						 | 
					@ -601,5 +610,55 @@ function addFileToZip($zip, $rootpath, $path = '')
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    @closedir($path);
 | 
					    @closedir($handler);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function changeAuthKey() {
 | 
				
			||||||
 | 
					    if ($_POST['SecretId']!=''&&$_POST['SecretId']!='') {
 | 
				
			||||||
 | 
					        $tmp['SecretId'] = $_POST['SecretId'];
 | 
				
			||||||
 | 
					        $tmp['SecretKey'] = $_POST['SecretKey'];
 | 
				
			||||||
 | 
					        $response = setConfigResponse( SetbaseConfig($tmp, $_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $tmp['SecretId'], $tmp['SecretKey']) );
 | 
				
			||||||
 | 
					        if (api_error($response)) {
 | 
				
			||||||
 | 
					            $html = api_error_msg($response);
 | 
				
			||||||
 | 
					            $title = 'Error';
 | 
				
			||||||
 | 
					            return message($html, $title, 400);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $html = getconstStr('Success') . '
 | 
				
			||||||
 | 
					    <script>
 | 
				
			||||||
 | 
					        var status = "' . $response['DplStatus'] . '";
 | 
				
			||||||
 | 
					        var i = 0;
 | 
				
			||||||
 | 
					        var uploadList = setInterval(function(){
 | 
				
			||||||
 | 
					            if (document.getElementById("dis").style.display=="none") {
 | 
				
			||||||
 | 
					                console.log(i++);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                clearInterval(uploadList);
 | 
				
			||||||
 | 
					                location.href = "' . path_format($_SERVER['base_path'] . '/') . '";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }, 1000);
 | 
				
			||||||
 | 
					    </script>';
 | 
				
			||||||
 | 
					            return message($html, $title, 201, 1);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    $html = '
 | 
				
			||||||
 | 
					    <form action="" method="post" onsubmit="return notnull(this);">
 | 
				
			||||||
 | 
					        <a href="https://console.cloud.tencent.com/cam/capi" target="_blank">' . getconstStr('Create') . ' SecretId & SecretKey</a><br>
 | 
				
			||||||
 | 
					        <label>SecretId:<input name="SecretId" type="text" placeholder="" size=""></label><br>
 | 
				
			||||||
 | 
					        <label>SecretKey:<input name="SecretKey" type="password" placeholder="" size=""></label><br>
 | 
				
			||||||
 | 
					        <input type="submit" value="' . getconstStr('Submit') . '">
 | 
				
			||||||
 | 
					    </form>
 | 
				
			||||||
 | 
					    <script>
 | 
				
			||||||
 | 
					        function notnull(t)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (t.SecretId.value==\'\') {
 | 
				
			||||||
 | 
					                alert(\'input SecretId\');
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if (t.SecretKey.value==\'\') {
 | 
				
			||||||
 | 
					                alert(\'input SecretKey\');
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    </script>';
 | 
				
			||||||
 | 
					    return message($html, 'Change platform Auth token or key', 200);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,7 @@
 | 
				
			||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					// https://cloud.tencent.com/document/product/583/33846
 | 
				
			||||||
 | 
					// https://cloud.tencent.com/document/product/583/18581
 | 
				
			||||||
 | 
					// https://cloud.tencent.com/document/product/583/18580
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function printInput($event, $context)
 | 
					function printInput($event, $context)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -56,6 +59,7 @@ function GetPathSetting($event, $context)
 | 
				
			||||||
    $_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
 | 
					    $_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
 | 
				
			||||||
    $_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['USER'] = 'qcloud';
 | 
					    $_SERVER['USER'] = 'qcloud';
 | 
				
			||||||
    return $path;
 | 
					    return $path;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -178,29 +182,31 @@ function install()
 | 
				
			||||||
            var expires = "expires="+expd.toGMTString();
 | 
					            var expires = "expires="+expd.toGMTString();
 | 
				
			||||||
            document.cookie=\'language=; path=/; \'+expires;
 | 
					            document.cookie=\'language=; path=/; \'+expires;
 | 
				
			||||||
        </script>
 | 
					        </script>
 | 
				
			||||||
        <meta http-equiv="refresh" content="3;URL=' . $url . '">', 'Program updating', 201);
 | 
					        <meta http-equiv="refresh" content="3;URL=' . $url . '">', 'Program updating', 201, 1);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return output('Jump
 | 
					        return message(getconstStr('Success') . '
 | 
				
			||||||
    <script>
 | 
					    <script>
 | 
				
			||||||
        var expd = new Date();
 | 
					        var expd = new Date();
 | 
				
			||||||
        expd.setTime(expd.getTime()+(2*60*60*1000));
 | 
					        expd.setTime(expd.getTime()+(2*60*60*1000));
 | 
				
			||||||
        var expires = "expires="+expd.toGMTString();
 | 
					        var expires = "expires="+expd.toGMTString();
 | 
				
			||||||
        document.cookie=\'language=; path=/; \'+expires;
 | 
					        document.cookie=\'language=; path=/; \'+expires;
 | 
				
			||||||
    </script>
 | 
					        var i = 0;
 | 
				
			||||||
    <meta http-equiv="refresh" content="3;URL=' . path_format($_SERVER['base_path'] . '/') . '">', 302);
 | 
					        var uploadList = setInterval(function(){
 | 
				
			||||||
 | 
					            if (document.getElementById("dis").style.display=="none") {
 | 
				
			||||||
 | 
					                console.log(i++);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                clearInterval(uploadList);
 | 
				
			||||||
 | 
					                location.href = "' . path_format($_SERVER['base_path'] . '/') . '";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }, 1000);
 | 
				
			||||||
 | 
					    </script>', 201, 1);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if ($_GET['install1']) {
 | 
					    if ($_GET['install1']) {
 | 
				
			||||||
        $tmp['timezone'] = $_COOKIE['timezone'];
 | 
					        $tmp['timezone'] = $_COOKIE['timezone'];
 | 
				
			||||||
        $SecretId = getConfig('SecretId');
 | 
					 | 
				
			||||||
        if ($SecretId=='') {
 | 
					 | 
				
			||||||
        $SecretId = $_POST['SecretId'];
 | 
					        $SecretId = $_POST['SecretId'];
 | 
				
			||||||
        $tmp['SecretId'] = $SecretId;
 | 
					        $tmp['SecretId'] = $SecretId;
 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        $SecretKey = getConfig('SecretKey');
 | 
					 | 
				
			||||||
        if ($SecretKey=='') {
 | 
					 | 
				
			||||||
        $SecretKey = $_POST['SecretKey'];
 | 
					        $SecretKey = $_POST['SecretKey'];
 | 
				
			||||||
        $tmp['SecretKey'] = $SecretKey;
 | 
					        $tmp['SecretKey'] = $SecretKey;
 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        $tmp['ONEMANAGER_CONFIG_SAVE'] = $_POST['ONEMANAGER_CONFIG_SAVE'];
 | 
					        $tmp['ONEMANAGER_CONFIG_SAVE'] = $_POST['ONEMANAGER_CONFIG_SAVE'];
 | 
				
			||||||
        $response = json_decode(SetbaseConfig($tmp, $_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey), true)['Response'];
 | 
					        $response = json_decode(SetbaseConfig($tmp, $_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey), true)['Response'];
 | 
				
			||||||
        if (api_error($response)) {
 | 
					        if (api_error($response)) {
 | 
				
			||||||
| 
						 | 
					@ -211,7 +217,7 @@ function install()
 | 
				
			||||||
            if ($tmp['ONEMANAGER_CONFIG_SAVE'] != 'file') {
 | 
					            if ($tmp['ONEMANAGER_CONFIG_SAVE'] != 'file') {
 | 
				
			||||||
                $html = getconstStr('ONEMANAGER_CONFIG_SAVE_ENV') . '<br><a href="' . $_SERVER['base_path'] . '">' . getconstStr('Home') . '</a>';
 | 
					                $html = getconstStr('ONEMANAGER_CONFIG_SAVE_ENV') . '<br><a href="' . $_SERVER['base_path'] . '">' . getconstStr('Home') . '</a>';
 | 
				
			||||||
                $title = 'Reinstall';
 | 
					                $title = 'Reinstall';
 | 
				
			||||||
                return message($html, $title, 201);
 | 
					                return message($html, $title, 201, 1);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            $html .= '
 | 
					            $html .= '
 | 
				
			||||||
    <form action="?install2" method="post" onsubmit="return notnull(this);">
 | 
					    <form action="?install2" method="post" onsubmit="return notnull(this);">
 | 
				
			||||||
| 
						 | 
					@ -229,7 +235,7 @@ function install()
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    </script>';
 | 
					    </script>';
 | 
				
			||||||
            $title = getconstStr('SetAdminPassword');
 | 
					            $title = getconstStr('SetAdminPassword');
 | 
				
			||||||
            return message($html, $title, 201);
 | 
					            return message($html, $title, 201, 1);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if ($_GET['install0']) {
 | 
					    if ($_GET['install0']) {
 | 
				
			||||||
| 
						 | 
					@ -240,10 +246,11 @@ language:<br>';
 | 
				
			||||||
            $html .= '
 | 
					            $html .= '
 | 
				
			||||||
        <label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
 | 
					        <label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (getConfig('SecretId')==''||getConfig('SecretKey')=='') $html .= '
 | 
					        //if (getConfig('SecretId')==''||getConfig('SecretKey')=='') 
 | 
				
			||||||
 | 
					        $html .= '
 | 
				
			||||||
        <a href="https://console.cloud.tencent.com/cam/capi" target="_blank">'.getconstStr('Create').' SecretId & SecretKey</a><br>
 | 
					        <a href="https://console.cloud.tencent.com/cam/capi" target="_blank">'.getconstStr('Create').' SecretId & SecretKey</a><br>
 | 
				
			||||||
        <label>SecretId:<input name="SecretId" type="text" placeholder="" size=""></label><br>
 | 
					        <label>SecretId:<input name="SecretId" type="text" placeholder="" size=""></label><br>
 | 
				
			||||||
        <label>SecretKey:<input name="SecretKey" type="text" placeholder="" size=""></label><br>';
 | 
					        <label>SecretKey:<input name="SecretKey" type="password" placeholder="" size=""></label><br>';
 | 
				
			||||||
        $html .= '
 | 
					        $html .= '
 | 
				
			||||||
        <label><input type="radio" name="ONEMANAGER_CONFIG_SAVE" value="" ' . ('file'==getenv('ONEMANAGER_CONFIG_SAVE')?'':'checked') . '>' . getconstStr('ONEMANAGER_CONFIG_SAVE_ENV') . '</label><br>
 | 
					        <label><input type="radio" name="ONEMANAGER_CONFIG_SAVE" value="" ' . ('file'==getenv('ONEMANAGER_CONFIG_SAVE')?'':'checked') . '>' . getconstStr('ONEMANAGER_CONFIG_SAVE_ENV') . '</label><br>
 | 
				
			||||||
        <label><input type="radio" name="ONEMANAGER_CONFIG_SAVE" value="file" ' . ('file'==getenv('ONEMANAGER_CONFIG_SAVE')?'checked':'') . '>' . getconstStr('ONEMANAGER_CONFIG_SAVE_FILE') . '</label><br>';
 | 
					        <label><input type="radio" name="ONEMANAGER_CONFIG_SAVE" value="file" ' . ('file'==getenv('ONEMANAGER_CONFIG_SAVE')?'checked':'') . '>' . getconstStr('ONEMANAGER_CONFIG_SAVE_FILE') . '</label><br>';
 | 
				
			||||||
| 
						 | 
					@ -267,7 +274,8 @@ language:<br>';
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        function notnull(t)
 | 
					        function notnull(t)
 | 
				
			||||||
        {';
 | 
					        {';
 | 
				
			||||||
        if (getConfig('SecretId')==''||getConfig('SecretKey')=='') $html .= '
 | 
					        //if (getConfig('SecretId')==''||getConfig('SecretKey')=='') 
 | 
				
			||||||
 | 
					        $html .= '
 | 
				
			||||||
            if (t.SecretId.value==\'\') {
 | 
					            if (t.SecretId.value==\'\') {
 | 
				
			||||||
                alert(\'input SecretId\');
 | 
					                alert(\'input SecretId\');
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
| 
						 | 
					@ -588,27 +596,25 @@ function setConfigResponse($response)
 | 
				
			||||||
    return json_decode( $response, true )['Response'];
 | 
					    return json_decode( $response, true )['Response'];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
 | 
					function OnekeyUpate($GitSource = 'Github', $auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    $source = '/tmp/code.zip';
 | 
					    $source = '/tmp/code.zip';
 | 
				
			||||||
    $outPath = '/tmp/';
 | 
					    $outPath = '/tmp/';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if ($GitSource=='Github') {
 | 
				
			||||||
        // 从github下载对应tar.gz,并解压
 | 
					        // 从github下载对应tar.gz,并解压
 | 
				
			||||||
        $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
 | 
					        $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
 | 
				
			||||||
 | 
					    } elseif ($GitSource=='HITGitlab') {
 | 
				
			||||||
 | 
					        $url = 'https://git.hit.edu.cn/' . $auth . '/' . $project . '/-/archive/' . urlencode($branch) . '/' . $project . '-' . urlencode($branch) . '.tar.gz';
 | 
				
			||||||
 | 
					    } else return json_encode(['Response'=>['Error'=>['code'=>'Git Source input Error!']]]);
 | 
				
			||||||
    $tarfile = '/tmp/github.tar.gz';
 | 
					    $tarfile = '/tmp/github.tar.gz';
 | 
				
			||||||
    file_put_contents($tarfile, file_get_contents($url));
 | 
					    file_put_contents($tarfile, file_get_contents($url));
 | 
				
			||||||
    $phar = new PharData($tarfile);
 | 
					    $phar = new PharData($tarfile);
 | 
				
			||||||
    $html = $phar->extractTo($outPath, null, true);//路径 要解压的文件 是否覆盖
 | 
					    $html = $phar->extractTo($outPath, null, true);//路径 要解压的文件 是否覆盖
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // 获取包中目录名
 | 
					    // 获取解压出的目录名
 | 
				
			||||||
    $tmp = scandir('phar://'.$tarfile);
 | 
					    $outPath = findIndexPath($outPath);
 | 
				
			||||||
    $name = $auth.'-'.$project;
 | 
					
 | 
				
			||||||
    foreach ($tmp as $f) {
 | 
					 | 
				
			||||||
        if ( substr($f, 0, strlen($name)) == $name) {
 | 
					 | 
				
			||||||
            $outPath .= $f;
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    // 放入配置文件
 | 
					    // 放入配置文件
 | 
				
			||||||
    file_put_contents($outPath . '/.data/config.php', file_get_contents(__DIR__ . '/../.data/config.php'));
 | 
					    file_put_contents($outPath . '/.data/config.php', file_get_contents(__DIR__ . '/../.data/config.php'));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -642,10 +648,60 @@ function addFileToZip($zip, $rootpath, $path = '')
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    @closedir($path);
 | 
					    @closedir($handler);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function WaitFunction() {
 | 
					function WaitFunction() {
 | 
				
			||||||
    if ( json_decode(getfunctioninfo($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey')),true)['Response']['Status']=='Active' ) return true;
 | 
					    if ( json_decode(getfunctioninfo($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey')),true)['Response']['Status']=='Active' ) return true;
 | 
				
			||||||
    else return false;
 | 
					    else return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function changeAuthKey() {
 | 
				
			||||||
 | 
					    if ($_POST['SecretId']!=''&&$_POST['SecretId']!='') {
 | 
				
			||||||
 | 
					        $tmp['SecretId'] = $_POST['SecretId'];
 | 
				
			||||||
 | 
					        $tmp['SecretKey'] = $_POST['SecretKey'];
 | 
				
			||||||
 | 
					        $response = setConfigResponse( SetbaseConfig($tmp, $_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $tmp['SecretId'], $tmp['SecretKey']) );
 | 
				
			||||||
 | 
					        if (api_error($response)) {
 | 
				
			||||||
 | 
					            $html = api_error_msg($response);
 | 
				
			||||||
 | 
					            $title = 'Error';
 | 
				
			||||||
 | 
					            return message($html, $title, 400);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $html = getconstStr('Success') . '
 | 
				
			||||||
 | 
					    <script>
 | 
				
			||||||
 | 
					        var status = "' . $response['DplStatus'] . '";
 | 
				
			||||||
 | 
					        var i = 0;
 | 
				
			||||||
 | 
					        var uploadList = setInterval(function(){
 | 
				
			||||||
 | 
					            if (document.getElementById("dis").style.display=="none") {
 | 
				
			||||||
 | 
					                console.log(i++);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                clearInterval(uploadList);
 | 
				
			||||||
 | 
					                location.href = "' . path_format($_SERVER['base_path'] . '/') . '";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }, 1000);
 | 
				
			||||||
 | 
					    </script>';
 | 
				
			||||||
 | 
					            return message($html, $title, 201, 1);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    $html = '
 | 
				
			||||||
 | 
					    <form action="" method="post" onsubmit="return notnull(this);">
 | 
				
			||||||
 | 
					        <a href="https://console.cloud.tencent.com/cam/capi" target="_blank">' . getconstStr('Create') . ' SecretId & SecretKey</a><br>
 | 
				
			||||||
 | 
					        <label>SecretId:<input name="SecretId" type="text" placeholder="" size=""></label><br>
 | 
				
			||||||
 | 
					        <label>SecretKey:<input name="SecretKey" type="password" placeholder="" size=""></label><br>
 | 
				
			||||||
 | 
					        <input type="submit" value="' . getconstStr('Submit') . '">
 | 
				
			||||||
 | 
					    </form>
 | 
				
			||||||
 | 
					    <script>
 | 
				
			||||||
 | 
					        function notnull(t)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (t.SecretId.value==\'\') {
 | 
				
			||||||
 | 
					                alert(\'input SecretId\');
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if (t.SecretKey.value==\'\') {
 | 
				
			||||||
 | 
					                alert(\'input SecretKey\');
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    </script>';
 | 
				
			||||||
 | 
					    return message($html, 'Change platform Auth token or key', 200);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -151,7 +151,7 @@ function setConfig($arr, $disktag = '')
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    $envs = array_filter($envs, 'array_value_isnot_null');
 | 
					    $envs = array_filter($envs, 'array_value_isnot_null');
 | 
				
			||||||
    //ksort($envs);
 | 
					    //ksort($envs);
 | 
				
			||||||
    sortConfig($envs);
 | 
					    //sortConfig($envs);
 | 
				
			||||||
    //error_log1(json_encode($arr, JSON_PRETTY_PRINT) . ' => tmp:' . json_encode($envs, JSON_PRETTY_PRINT));
 | 
					    //error_log1(json_encode($arr, JSON_PRETTY_PRINT) . ' => tmp:' . json_encode($envs, JSON_PRETTY_PRINT));
 | 
				
			||||||
    //echo json_encode($arr, JSON_PRETTY_PRINT) . ' => tmp:' . json_encode($envs, JSON_PRETTY_PRINT);
 | 
					    //echo json_encode($arr, JSON_PRETTY_PRINT) . ' => tmp:' . json_encode($envs, JSON_PRETTY_PRINT);
 | 
				
			||||||
    return setVercelConfig($envs, getConfig('HerokuappId'), getConfig('APIKey'));
 | 
					    return setVercelConfig($envs, getConfig('HerokuappId'), getConfig('APIKey'));
 | 
				
			||||||
| 
						 | 
					@ -187,16 +187,24 @@ function install()
 | 
				
			||||||
                $title = 'Error';
 | 
					                $title = 'Error';
 | 
				
			||||||
                return message($html, $title, 400);
 | 
					                return message($html, $title, 400);
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                /*$html = '<script>
 | 
					                $html = getconstStr('Success') . '
 | 
				
			||||||
 | 
					    <script>
 | 
				
			||||||
        var status = "' . $response['DplStatus'] . '";
 | 
					        var status = "' . $response['DplStatus'] . '";
 | 
				
			||||||
 | 
					        var i = 0;
 | 
				
			||||||
        var expd = new Date();
 | 
					        var expd = new Date();
 | 
				
			||||||
        expd.setTime(expd.getTime()+1000);
 | 
					        expd.setTime(expd.getTime()+1000);
 | 
				
			||||||
        var expires = "expires="+expd.toGMTString();
 | 
					        var expires = "expires="+expd.toGMTString();
 | 
				
			||||||
        document.cookie=\'language=; path=/; \'+expires;
 | 
					        document.cookie=\'language=; path=/; \'+expires;
 | 
				
			||||||
 | 
					        var uploadList = setInterval(function(){
 | 
				
			||||||
 | 
					            if (document.getElementById("dis").style.display=="none") {
 | 
				
			||||||
 | 
					                console.log(i++);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                clearInterval(uploadList);
 | 
				
			||||||
 | 
					                location.href = "' . path_format($_SERVER['base_path'] . '/') . '";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }, 1000);
 | 
				
			||||||
    </script>';
 | 
					    </script>';
 | 
				
			||||||
                return message($html, $title, 201, 1);*/
 | 
					                return message($html, $title, 201, 1);
 | 
				
			||||||
                $data["dplId"] = $response['DplStatus'];
 | 
					 | 
				
			||||||
                return output(json_encode($data), 201);
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -208,10 +216,9 @@ language:<br>';
 | 
				
			||||||
            $html .= '
 | 
					            $html .= '
 | 
				
			||||||
        <label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
 | 
					        <label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        //if (getConfig('APIKey')=='') 
 | 
					 | 
				
			||||||
        $html .= '<br>
 | 
					        $html .= '<br>
 | 
				
			||||||
        <a href="https://vercel.com/account/tokens" target="_blank">' . getconstStr('Create') . ' token</a><br>
 | 
					        <a href="https://vercel.com/account/tokens" target="_blank">' . getconstStr('Create') . ' token</a><br>
 | 
				
			||||||
        <label>Token:<input name="APIKey" type="password" placeholder="" value="' . getConfig('APIKey') . '"></label><br>';
 | 
					        <label>Token:<input name="APIKey" type="password" placeholder="" value=""></label><br>';
 | 
				
			||||||
        $html .= '<br>
 | 
					        $html .= '<br>
 | 
				
			||||||
        <label>Set admin password:<input name="admin" type="password" placeholder="' . getconstStr('EnvironmentsDescription')['admin'] . '" size="' . strlen(getconstStr('EnvironmentsDescription')['admin']) . '"></label><br>';
 | 
					        <label>Set admin password:<input name="admin" type="password" placeholder="' . getconstStr('EnvironmentsDescription')['admin'] . '" size="' . strlen(getconstStr('EnvironmentsDescription')['admin']) . '"></label><br>';
 | 
				
			||||||
        $html .= '
 | 
					        $html .= '
 | 
				
			||||||
| 
						 | 
					@ -244,52 +251,7 @@ language:<br>';
 | 
				
			||||||
                alert(\'input Token\');
 | 
					                alert(\'input Token\');
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            t.style.display = "none";
 | 
					            return true;
 | 
				
			||||||
            errordiv.innerHTML = "' . getconstStr('Wait') . '";
 | 
					 | 
				
			||||||
            var xhr = new XMLHttpRequest();
 | 
					 | 
				
			||||||
            xhr.open("POST", t.action);
 | 
					 | 
				
			||||||
            xhr.onload = function(e) {
 | 
					 | 
				
			||||||
                if (xhr.status==201) {
 | 
					 | 
				
			||||||
                    var res = JSON.parse(xhr.responseText);
 | 
					 | 
				
			||||||
                    getStatus(res.dplId, t.APIKey.value);
 | 
					 | 
				
			||||||
                } else {
 | 
					 | 
				
			||||||
                    t.style.display = "";
 | 
					 | 
				
			||||||
                    errordiv.innerHTML = xhr.status + "<br>" + xhr.responseText;
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            xhr.send("admin=" + t.admin.value + "&APIKey=" + t.APIKey.value);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            var x = "";
 | 
					 | 
				
			||||||
            var min = 0;
 | 
					 | 
				
			||||||
            function getStatus(id, VercelToken) {
 | 
					 | 
				
			||||||
                x += ".";
 | 
					 | 
				
			||||||
                min++;
 | 
					 | 
				
			||||||
                var xhr = new XMLHttpRequest();
 | 
					 | 
				
			||||||
                var url = "https://api.vercel.com/v11/now/deployments/" + id;
 | 
					 | 
				
			||||||
                xhr.open("GET", url);
 | 
					 | 
				
			||||||
                xhr.setRequestHeader("Authorization", "Bearer " + VercelToken);
 | 
					 | 
				
			||||||
                xhr.onload = function(e) {
 | 
					 | 
				
			||||||
                    if (xhr.status==200) {
 | 
					 | 
				
			||||||
                        var deployStat = JSON.parse(xhr.responseText).readyState;
 | 
					 | 
				
			||||||
                        if (deployStat=="READY") {
 | 
					 | 
				
			||||||
                            x = "";
 | 
					 | 
				
			||||||
                            min = 0;
 | 
					 | 
				
			||||||
                            errordiv.innerHTML = "Deploy done.";
 | 
					 | 
				
			||||||
                            location.href = "/";
 | 
					 | 
				
			||||||
                        } else {
 | 
					 | 
				
			||||||
                            errordiv.innerHTML = deployStat + ", " + min + ".<br>' . getconstStr('Wait') . ' " + x;
 | 
					 | 
				
			||||||
                            if (deployStat!=="ERROR") setTimeout(function() { getStatus(id, VercelToken) }, 1000);
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                    } else {
 | 
					 | 
				
			||||||
                        t.style.display = "";
 | 
					 | 
				
			||||||
                        console.log(xhr.status);
 | 
					 | 
				
			||||||
                        console.log(xhr.responseText);
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                xhr.send(null);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            return false;
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    </script>';
 | 
					    </script>';
 | 
				
			||||||
        $title = getconstStr('SelectLanguage');
 | 
					        $title = getconstStr('SelectLanguage');
 | 
				
			||||||
| 
						 | 
					@ -329,7 +291,7 @@ function copyFolder($from, $to)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function setVercelConfig($envs, $appId, $token)
 | 
					function setVercelConfig($envs, $appId, $token)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    //sortConfig($envs); cant view in vercel, not need sort.
 | 
					    sortConfig($envs);
 | 
				
			||||||
    $outPath = '/tmp/code/';
 | 
					    $outPath = '/tmp/code/';
 | 
				
			||||||
    $outPath_Api = $outPath . 'api/';
 | 
					    $outPath_Api = $outPath . 'api/';
 | 
				
			||||||
    $coderoot = __DIR__;
 | 
					    $coderoot = __DIR__;
 | 
				
			||||||
| 
						 | 
					@ -345,7 +307,8 @@ function setVercelConfig($envs, $appId, $token)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function VercelUpdate($appId, $token, $sourcePath = "")
 | 
					function VercelUpdate($appId, $token, $sourcePath = "")
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    $url = "https://api.vercel.com/v12/now/deployments";
 | 
					    if (checkBuilding($appId, $token)) return '{"error":{"message":"Another building is in progress."}}';
 | 
				
			||||||
 | 
					    $url = "https://api.vercel.com/v13/deployments";
 | 
				
			||||||
    $header["Authorization"] = "Bearer " . $token;
 | 
					    $header["Authorization"] = "Bearer " . $token;
 | 
				
			||||||
    $header["Content-Type"] = "application/json";
 | 
					    $header["Content-Type"] = "application/json";
 | 
				
			||||||
    $data["name"] = "OneManager";
 | 
					    $data["name"] = "OneManager";
 | 
				
			||||||
| 
						 | 
					@ -367,6 +330,23 @@ function VercelUpdate($appId, $token, $sourcePath = "")
 | 
				
			||||||
    return json_encode($result);
 | 
					    return json_encode($result);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function checkBuilding($projectId, $token)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    $r = 0;
 | 
				
			||||||
 | 
					    $url = "https://api.vercel.com/v6/deployments/?projectId=" . $projectId;
 | 
				
			||||||
 | 
					    $header["Authorization"] = "Bearer " . $token;
 | 
				
			||||||
 | 
					    $header["Content-Type"] = "application/json";
 | 
				
			||||||
 | 
					    $response = curl("GET", $url, '', $header);
 | 
				
			||||||
 | 
					    //echo json_encode($response, JSON_PRETTY_PRINT) . " ,res<br>";
 | 
				
			||||||
 | 
					    $result = json_decode($response["body"], true);
 | 
				
			||||||
 | 
					    foreach ( $result['deployments'] as $deployment ) {
 | 
				
			||||||
 | 
					        if ($deployment['state']!=="READY") $r++;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return $r;
 | 
				
			||||||
 | 
					    //if ($r===0) return true;
 | 
				
			||||||
 | 
					    //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);
 | 
				
			||||||
| 
						 | 
					@ -408,34 +388,33 @@ function setConfigResponse($response)
 | 
				
			||||||
    return json_decode($response, true);
 | 
					    return json_decode($response, true);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function OnekeyUpate($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') {
 | 
				
			||||||
        // 从github下载对应tar.gz,并解压
 | 
					        // 从github下载对应tar.gz,并解压
 | 
				
			||||||
        $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
 | 
					        $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
 | 
				
			||||||
 | 
					    } elseif ($GitSource=='HITGitlab') {
 | 
				
			||||||
 | 
					        $url = 'https://git.hit.edu.cn/' . $auth . '/' . $project . '/-/archive/' . urlencode($branch) . '/' . $project . '-' . urlencode($branch) . '.tar.gz';
 | 
				
			||||||
 | 
					    } else return json_encode(['error'=>['code'=>'Git Source input Error!']]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $tarfile = $tmppath . '/github.tar.gz';
 | 
					    $tarfile = $tmppath . '/github.tar.gz';
 | 
				
			||||||
    $githubfile = file_get_contents($url);
 | 
					    file_put_contents($tarfile, file_get_contents($url));
 | 
				
			||||||
    if (!$githubfile) return '{"error":{"message":"fail to download from github"}}';
 | 
					    $phar = new PharData($tarfile);
 | 
				
			||||||
    file_put_contents($tarfile, $githubfile);
 | 
					    $html = $phar->extractTo($tmppath, null, true);//路径 要解压的文件 是否覆盖
 | 
				
			||||||
        $phar = new PharData($tarfile); // need php5.3, 7, 8
 | 
					 | 
				
			||||||
        $phar->extractTo($tmppath, null, true);//路径 要解压的文件 是否覆盖
 | 
					 | 
				
			||||||
    unlink($tarfile);
 | 
					    unlink($tarfile);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $outPath = '';
 | 
					    // 获取解压出的目录名
 | 
				
			||||||
    $tmp = scandir($tmppath);
 | 
					    $outPath = findIndexPath($tmppath);
 | 
				
			||||||
    $name = $auth . '-' . $project;
 | 
					
 | 
				
			||||||
 | 
					    if ($outPath=='') return '{"error":{"message":"no outpath"}}';
 | 
				
			||||||
 | 
					    $name = $project . 'CODE';
 | 
				
			||||||
    mkdir($tmppath . "/" . $name, 0777, 1);
 | 
					    mkdir($tmppath . "/" . $name, 0777, 1);
 | 
				
			||||||
    foreach ($tmp as $f) {
 | 
					    rename($outPath, $tmppath . "/" . $name . '/api');
 | 
				
			||||||
        if ( substr($f, 0, strlen($name)) == $name) {
 | 
					 | 
				
			||||||
            rename($tmppath . '/' . $f, $tmppath . "/" . $name . '/api');
 | 
					 | 
				
			||||||
    $outPath = $tmppath . "/" . $name;
 | 
					    $outPath = $tmppath . "/" . $name;
 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    //echo $outPath . "<br>";
 | 
					    //echo $outPath . "<br>";
 | 
				
			||||||
    //error_log1($outPath);
 | 
					    //error_log1($outPath);
 | 
				
			||||||
    if ($outPath=='') return '{"error":{"message":"no outpath"}}';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // put in config
 | 
					    // put in config
 | 
				
			||||||
    $coderoot = __DIR__;
 | 
					    $coderoot = __DIR__;
 | 
				
			||||||
| 
						 | 
					@ -453,7 +432,7 @@ function WaitFunction($deployid = '') {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    $header["Authorization"] = "Bearer " . getConfig('APIKey');
 | 
					    $header["Authorization"] = "Bearer " . getConfig('APIKey');
 | 
				
			||||||
    $header["Content-Type"] = "application/json";
 | 
					    $header["Content-Type"] = "application/json";
 | 
				
			||||||
    $url = "https://api.vercel.com/v11/now/deployments/" . $deployid;
 | 
					    $url = "https://api.vercel.com/v11/deployments/" . $deployid;
 | 
				
			||||||
    $response = curl("GET", $url, "", $header);
 | 
					    $response = curl("GET", $url, "", $header);
 | 
				
			||||||
    if ($response['stat']==200) {
 | 
					    if ($response['stat']==200) {
 | 
				
			||||||
        $result = json_decode($response['body'], true);
 | 
					        $result = json_decode($response['body'], true);
 | 
				
			||||||
| 
						 | 
					@ -465,3 +444,48 @@ function WaitFunction($deployid = '') {
 | 
				
			||||||
        return $response;
 | 
					        return $response;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function changeAuthKey() {
 | 
				
			||||||
 | 
					    if ($_POST['APIKey']!='') {
 | 
				
			||||||
 | 
					        $APIKey = $_POST['APIKey'];
 | 
				
			||||||
 | 
					        $tmp['APIKey'] = $APIKey;
 | 
				
			||||||
 | 
					        $response = setConfigResponse( setVercelConfig($tmp, getConfig('HerokuappId'), $APIKey) );
 | 
				
			||||||
 | 
					        if (api_error($response)) {
 | 
				
			||||||
 | 
					            $html = api_error_msg($response);
 | 
				
			||||||
 | 
					            $title = 'Error';
 | 
				
			||||||
 | 
					            return message($html, $title, 400);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $html = getconstStr('Success') . '
 | 
				
			||||||
 | 
					    <script>
 | 
				
			||||||
 | 
					        var status = "' . $response['DplStatus'] . '";
 | 
				
			||||||
 | 
					        var i = 0;
 | 
				
			||||||
 | 
					        var uploadList = setInterval(function(){
 | 
				
			||||||
 | 
					            if (document.getElementById("dis").style.display=="none") {
 | 
				
			||||||
 | 
					                console.log(i++);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                clearInterval(uploadList);
 | 
				
			||||||
 | 
					                location.href = "' . path_format($_SERVER['base_path'] . '/') . '";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }, 1000);
 | 
				
			||||||
 | 
					    </script>';
 | 
				
			||||||
 | 
					            return message($html, $title, 201, 1);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    $html = '
 | 
				
			||||||
 | 
					    <form action="" method="post" onsubmit="return notnull(this);">
 | 
				
			||||||
 | 
					        <a href="https://vercel.com/account/tokens" target="_blank">' . getconstStr('Create') . ' token</a><br>
 | 
				
			||||||
 | 
					        <label>Token:<input name="APIKey" type="password" placeholder="" value=""></label><br>
 | 
				
			||||||
 | 
					        <input type="submit" value="' . getconstStr('Submit') . '">
 | 
				
			||||||
 | 
					    </form>
 | 
				
			||||||
 | 
					    <script>
 | 
				
			||||||
 | 
					        function notnull(t)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (t.APIKey.value==\'\') {
 | 
				
			||||||
 | 
					                alert(\'Input Token\');
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    </script>';
 | 
				
			||||||
 | 
					    return message($html, 'Change platform Auth token or key', 200);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -163,9 +163,6 @@ function install()
 | 
				
			||||||
            //$tmp['language'] = $_POST['language'];
 | 
					            //$tmp['language'] = $_POST['language'];
 | 
				
			||||||
            $tmp['timezone'] = $_COOKIE['timezone'];
 | 
					            $tmp['timezone'] = $_COOKIE['timezone'];
 | 
				
			||||||
            $APIKey = $_POST['APIKey'];
 | 
					            $APIKey = $_POST['APIKey'];
 | 
				
			||||||
            //if ($APIKey=='') {
 | 
					 | 
				
			||||||
            //    $APIKey = getConfig('APIKey');
 | 
					 | 
				
			||||||
            //}
 | 
					 | 
				
			||||||
            $tmp['APIKey'] = $APIKey;
 | 
					            $tmp['APIKey'] = $APIKey;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $token = $APIKey;
 | 
					            $token = $APIKey;
 | 
				
			||||||
| 
						 | 
					@ -184,16 +181,24 @@ function install()
 | 
				
			||||||
                $title = 'Error';
 | 
					                $title = 'Error';
 | 
				
			||||||
                return message($html, $title, 400);
 | 
					                return message($html, $title, 400);
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                /*$html = '<script>
 | 
					                $html = getconstStr('Success') . '
 | 
				
			||||||
 | 
					    <script>
 | 
				
			||||||
        var status = "' . $response['DplStatus'] . '";
 | 
					        var status = "' . $response['DplStatus'] . '";
 | 
				
			||||||
 | 
					        var i = 0;
 | 
				
			||||||
        var expd = new Date();
 | 
					        var expd = new Date();
 | 
				
			||||||
        expd.setTime(expd.getTime()+1000);
 | 
					        expd.setTime(expd.getTime()+1000);
 | 
				
			||||||
        var expires = "expires="+expd.toGMTString();
 | 
					        var expires = "expires="+expd.toGMTString();
 | 
				
			||||||
        document.cookie=\'language=; path=/; \'+expires;
 | 
					        document.cookie=\'language=; path=/; \'+expires;
 | 
				
			||||||
 | 
					        var uploadList = setInterval(function(){
 | 
				
			||||||
 | 
					            if (document.getElementById("dis").style.display=="none") {
 | 
				
			||||||
 | 
					                console.log(i++);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                clearInterval(uploadList);
 | 
				
			||||||
 | 
					                location.href = "' . path_format($_SERVER['base_path'] . '/') . '";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }, 1000);
 | 
				
			||||||
    </script>';
 | 
					    </script>';
 | 
				
			||||||
                return message($html, $title, 201, 1);*/
 | 
					                return message($html, $title, 201, 1);
 | 
				
			||||||
                $data["dplId"] = $response['DplStatus'];
 | 
					 | 
				
			||||||
                return output(json_encode($data), 201);
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -205,10 +210,9 @@ language:<br>';
 | 
				
			||||||
            $html .= '
 | 
					            $html .= '
 | 
				
			||||||
        <label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
 | 
					        <label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        //if (getConfig('APIKey')=='') 
 | 
					 | 
				
			||||||
        $html .= '<br>
 | 
					        $html .= '<br>
 | 
				
			||||||
        <a href="https://vercel.com/account/tokens" target="_blank">' . getconstStr('Create') . ' token</a><br>
 | 
					        <a href="https://vercel.com/account/tokens" target="_blank">' . getconstStr('Create') . ' token</a><br>
 | 
				
			||||||
        <label>Token:<input name="APIKey" type="password" placeholder="" value="' . getConfig('APIKey') . '"></label><br>';
 | 
					        <label>Token:<input name="APIKey" type="password" placeholder="" value=""></label><br>';
 | 
				
			||||||
        $html .= '<br>
 | 
					        $html .= '<br>
 | 
				
			||||||
        <label>Set admin password:<input name="admin" type="password" placeholder="' . getconstStr('EnvironmentsDescription')['admin'] . '" size="' . strlen(getconstStr('EnvironmentsDescription')['admin']) . '"></label><br>';
 | 
					        <label>Set admin password:<input name="admin" type="password" placeholder="' . getconstStr('EnvironmentsDescription')['admin'] . '" size="' . strlen(getconstStr('EnvironmentsDescription')['admin']) . '"></label><br>';
 | 
				
			||||||
        $html .= '
 | 
					        $html .= '
 | 
				
			||||||
| 
						 | 
					@ -241,52 +245,7 @@ language:<br>';
 | 
				
			||||||
                alert(\'input Token\');
 | 
					                alert(\'input Token\');
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            t.style.display = "none";
 | 
					            return true;
 | 
				
			||||||
            errordiv.innerHTML = "' . getconstStr('Wait') . '";
 | 
					 | 
				
			||||||
            var xhr = new XMLHttpRequest();
 | 
					 | 
				
			||||||
            xhr.open("POST", t.action);
 | 
					 | 
				
			||||||
            xhr.onload = function(e) {
 | 
					 | 
				
			||||||
                if (xhr.status==201) {
 | 
					 | 
				
			||||||
                    var res = JSON.parse(xhr.responseText);
 | 
					 | 
				
			||||||
                    getStatus(res.dplId, t.APIKey.value);
 | 
					 | 
				
			||||||
                } else {
 | 
					 | 
				
			||||||
                    t.style.display = "";
 | 
					 | 
				
			||||||
                    errordiv.innerHTML = xhr.status + "<br>" + xhr.responseText;
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            xhr.send("admin=" + t.admin.value + "&APIKey=" + t.APIKey.value);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            var x = "";
 | 
					 | 
				
			||||||
            var min = 0;
 | 
					 | 
				
			||||||
            function getStatus(id, VercelToken) {
 | 
					 | 
				
			||||||
                x += ".";
 | 
					 | 
				
			||||||
                min++;
 | 
					 | 
				
			||||||
                var xhr = new XMLHttpRequest();
 | 
					 | 
				
			||||||
                var url = "https://api.vercel.com/v11/now/deployments/" + id;
 | 
					 | 
				
			||||||
                xhr.open("GET", url);
 | 
					 | 
				
			||||||
                xhr.setRequestHeader("Authorization", "Bearer " + VercelToken);
 | 
					 | 
				
			||||||
                xhr.onload = function(e) {
 | 
					 | 
				
			||||||
                    if (xhr.status==200) {
 | 
					 | 
				
			||||||
                        var deployStat = JSON.parse(xhr.responseText).readyState;
 | 
					 | 
				
			||||||
                        if (deployStat=="READY") {
 | 
					 | 
				
			||||||
                            x = "";
 | 
					 | 
				
			||||||
                            min = 0;
 | 
					 | 
				
			||||||
                            errordiv.innerHTML = "Deploy done.";
 | 
					 | 
				
			||||||
                            location.href = "/";
 | 
					 | 
				
			||||||
                        } else {
 | 
					 | 
				
			||||||
                            errordiv.innerHTML = deployStat + ", " + min + ".<br>' . getconstStr('Wait') . ' " + x;
 | 
					 | 
				
			||||||
                            if (deployStat!=="ERROR") setTimeout(function() { getStatus(id, VercelToken) }, 1000);
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                    } else {
 | 
					 | 
				
			||||||
                        t.style.display = "";
 | 
					 | 
				
			||||||
                        console.log(xhr.status);
 | 
					 | 
				
			||||||
                        console.log(xhr.responseText);
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                xhr.send(null);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            return false;
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    </script>';
 | 
					    </script>';
 | 
				
			||||||
        $title = getconstStr('SelectLanguage');
 | 
					        $title = getconstStr('SelectLanguage');
 | 
				
			||||||
| 
						 | 
					@ -335,7 +294,8 @@ function setVercelConfig($envs, $appId, $token)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function VercelUpdate($appId, $token, $sourcePath = "")
 | 
					function VercelUpdate($appId, $token, $sourcePath = "")
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    $url = "https://api.vercel.com/v12/now/deployments";
 | 
					    if (checkBuilding($appId, $token)) return '{"error":{"message":"Another building is in progress."}}';
 | 
				
			||||||
 | 
					    $url = "https://api.vercel.com/v13/deployments";
 | 
				
			||||||
    $header["Authorization"] = "Bearer " . $token;
 | 
					    $header["Authorization"] = "Bearer " . $token;
 | 
				
			||||||
    $header["Content-Type"] = "application/json";
 | 
					    $header["Content-Type"] = "application/json";
 | 
				
			||||||
    $data["name"] = "OneManager";
 | 
					    $data["name"] = "OneManager";
 | 
				
			||||||
| 
						 | 
					@ -357,6 +317,23 @@ function VercelUpdate($appId, $token, $sourcePath = "")
 | 
				
			||||||
    return json_encode($result);
 | 
					    return json_encode($result);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function checkBuilding($projectId, $token)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    $r = 0;
 | 
				
			||||||
 | 
					    $url = "https://api.vercel.com/v6/deployments/?projectId=" . $projectId;
 | 
				
			||||||
 | 
					    $header["Authorization"] = "Bearer " . $token;
 | 
				
			||||||
 | 
					    $header["Content-Type"] = "application/json";
 | 
				
			||||||
 | 
					    $response = curl("GET", $url, '', $header);
 | 
				
			||||||
 | 
					    //echo json_encode($response, JSON_PRETTY_PRINT) . " ,res<br>";
 | 
				
			||||||
 | 
					    $result = json_decode($response["body"], true);
 | 
				
			||||||
 | 
					    foreach ( $result['deployments'] as $deployment ) {
 | 
				
			||||||
 | 
					        if ($deployment['state']!=="READY") $r++;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return $r;
 | 
				
			||||||
 | 
					    //if ($r===0) return true;
 | 
				
			||||||
 | 
					    //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);
 | 
				
			||||||
| 
						 | 
					@ -398,34 +375,33 @@ function setConfigResponse($response)
 | 
				
			||||||
    return json_decode($response, true);
 | 
					    return json_decode($response, true);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function OnekeyUpate($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') {
 | 
				
			||||||
        // 从github下载对应tar.gz,并解压
 | 
					        // 从github下载对应tar.gz,并解压
 | 
				
			||||||
        $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
 | 
					        $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
 | 
				
			||||||
 | 
					    } elseif ($GitSource=='HITGitlab') {
 | 
				
			||||||
 | 
					        $url = 'https://git.hit.edu.cn/' . $auth . '/' . $project . '/-/archive/' . urlencode($branch) . '/' . $project . '-' . urlencode($branch) . '.tar.gz';
 | 
				
			||||||
 | 
					    } else return json_encode(['error'=>['code'=>'Git Source input Error!']]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $tarfile = $tmppath . '/github.tar.gz';
 | 
					    $tarfile = $tmppath . '/github.tar.gz';
 | 
				
			||||||
    $githubfile = file_get_contents($url);
 | 
					    file_put_contents($tarfile, file_get_contents($url));
 | 
				
			||||||
    if (!$githubfile) return '{"error":{"message":"fail to download from github"}}';
 | 
					    $phar = new PharData($tarfile);
 | 
				
			||||||
    file_put_contents($tarfile, $githubfile);
 | 
					    $html = $phar->extractTo($tmppath, null, true);//路径 要解压的文件 是否覆盖
 | 
				
			||||||
        $phar = new PharData($tarfile); // need php5.3, 7, 8
 | 
					 | 
				
			||||||
        $phar->extractTo($tmppath, null, true);//路径 要解压的文件 是否覆盖
 | 
					 | 
				
			||||||
    unlink($tarfile);
 | 
					    unlink($tarfile);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $outPath = '';
 | 
					    // 获取解压出的目录名
 | 
				
			||||||
    $tmp = scandir($tmppath);
 | 
					    $outPath = findIndexPath($tmppath);
 | 
				
			||||||
    $name = $auth . '-' . $project;
 | 
					
 | 
				
			||||||
    mkdir($tmppath . "/" . $name, 0777);
 | 
					    if ($outPath=='') return '{"error":{"message":"no outpath"}}';
 | 
				
			||||||
    foreach ($tmp as $f) {
 | 
					    $name = $project . 'CODE';
 | 
				
			||||||
        if ( substr($f, 0, strlen($name)) == $name) {
 | 
					    mkdir($tmppath . "/" . $name, 0777, 1);
 | 
				
			||||||
            rename($tmppath . '/' . $f, $tmppath . "/" . $name . '/api');
 | 
					    rename($outPath, $tmppath . "/" . $name . '/api');
 | 
				
			||||||
    $outPath = $tmppath . "/" . $name;
 | 
					    $outPath = $tmppath . "/" . $name;
 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    //echo $outPath . "<br>";
 | 
					    //echo $outPath . "<br>";
 | 
				
			||||||
    //error_log1($outPath);
 | 
					    //error_log1($outPath);
 | 
				
			||||||
    if ($outPath=='') return '{"error":{"message":"no outpath"}}';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return VercelUpdate(getConfig('HerokuappId'), getConfig('APIKey'), $outPath);
 | 
					    return VercelUpdate(getConfig('HerokuappId'), getConfig('APIKey'), $outPath);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -438,7 +414,7 @@ function WaitFunction($deployid) {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    $header["Authorization"] = "Bearer " . getConfig('APIKey');
 | 
					    $header["Authorization"] = "Bearer " . getConfig('APIKey');
 | 
				
			||||||
    $header["Content-Type"] = "application/json";
 | 
					    $header["Content-Type"] = "application/json";
 | 
				
			||||||
    $url = "https://api.vercel.com/v11/now/deployments/" . $deployid;
 | 
					    $url = "https://api.vercel.com/v11/deployments/" . $deployid;
 | 
				
			||||||
    $response = curl("GET", $url, "", $header);
 | 
					    $response = curl("GET", $url, "", $header);
 | 
				
			||||||
    if ($response['stat']==200) {
 | 
					    if ($response['stat']==200) {
 | 
				
			||||||
        $result = json_decode($response['body'], true);
 | 
					        $result = json_decode($response['body'], true);
 | 
				
			||||||
| 
						 | 
					@ -450,3 +426,48 @@ function WaitFunction($deployid) {
 | 
				
			||||||
        return $response;
 | 
					        return $response;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function changeAuthKey() {
 | 
				
			||||||
 | 
					    if ($_POST['APIKey']!='') {
 | 
				
			||||||
 | 
					        $APIKey = $_POST['APIKey'];
 | 
				
			||||||
 | 
					        $tmp['APIKey'] = $APIKey;
 | 
				
			||||||
 | 
					        $response = json_decode(setVercelConfig($tmp, getConfig('HerokuappId'), $APIKey), true);
 | 
				
			||||||
 | 
					        if (api_error($response)) {
 | 
				
			||||||
 | 
					            $html = api_error_msg($response);
 | 
				
			||||||
 | 
					            $title = 'Error';
 | 
				
			||||||
 | 
					            return message($html, $title, 400);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $html = getconstStr('Success') . '
 | 
				
			||||||
 | 
					    <script>
 | 
				
			||||||
 | 
					        var status = "' . $response['DplStatus'] . '";
 | 
				
			||||||
 | 
					        var i = 0;
 | 
				
			||||||
 | 
					        var uploadList = setInterval(function(){
 | 
				
			||||||
 | 
					            if (document.getElementById("dis").style.display=="none") {
 | 
				
			||||||
 | 
					                console.log(i++);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                clearInterval(uploadList);
 | 
				
			||||||
 | 
					                location.href = "' . path_format($_SERVER['base_path'] . '/') . '";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }, 1000);
 | 
				
			||||||
 | 
					    </script>';
 | 
				
			||||||
 | 
					            return message($html, $title, 201, 1);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    $html = '
 | 
				
			||||||
 | 
					    <form action="" method="post" onsubmit="return notnull(this);">
 | 
				
			||||||
 | 
					        <a href="https://vercel.com/account/tokens" target="_blank">' . getconstStr('Create') . ' token</a><br>
 | 
				
			||||||
 | 
					        <label>Token:<input name="APIKey" type="password" placeholder="" value=""></label><br>
 | 
				
			||||||
 | 
					        <input type="submit" value="' . getconstStr('Submit') . '">
 | 
				
			||||||
 | 
					    </form>
 | 
				
			||||||
 | 
					    <script>
 | 
				
			||||||
 | 
					        function notnull(t)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (t.APIKey.value==\'\') {
 | 
				
			||||||
 | 
					                alert(\'Input Token\');
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    </script>';
 | 
				
			||||||
 | 
					    return message($html, 'Change platform Auth token or key', 200);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										93
									
								
								readme.md
								
								
								
								
							
							
						
						
									
										93
									
								
								readme.md
								
								
								
								
							| 
						 | 
					@ -8,40 +8,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Deploy to Heroku  
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Official
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  https://heroku.com  
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Demo
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  https://herooneindex.herokuapp.com/  
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### How to Install
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
> ~~Click the button [](https://heroku.com/deploy) to Deploy a new app~~(`"We couldn't deploy your app because the source code violates the Salesforce Acceptable Use and External-Facing Services Policy."`)  
 | 
					 | 
				
			||||||
>
 | 
					 | 
				
			||||||
> Star this project, then Fork, create a app in Heroku, then turn to the Deploy tab, "Deployment method" via "Connect GitHub", select your github fork.   
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
---
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Deploy to Glitch  
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Official
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  https://glitch.com/  
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Demo
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  https://onemanager.glitch.me/  
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### How to Install
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  [New Project] -> [Import form Github] -> paste "https://github.com/qkqpttgf/OneManager-php" , after done, [Show] -> [In a New Window].  
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
---
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Deploy to Vercel  
 | 
					# Deploy to Vercel  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Official
 | 
					### Official
 | 
				
			||||||
| 
						 | 
					@ -60,7 +26,64 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### How to Install
 | 
					### How to Install
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  https://scfonedrive.github.io/Vercel/Deploy.html .  
 | 
					> https://scfonedrive.github.io/Vercel/Deploy.html .  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Deploy to Replit  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Official
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  https://repl.it/  
 | 
				
			||||||
 | 
					  https://replit.com/  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Demo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  https://onemanager.qkqpttgf.repl.co/  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Notice
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> `Import from Github` useing the `.replit` file in code files will cause an empty web page, may someone help me?  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### How to Install
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> 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.  
 | 
				
			||||||
 | 
					> 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  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Official
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  https://heroku.com  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Demo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  https://herooneindex.herokuapp.com/  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### How to Install
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> ~~Click the button [](https://heroku.com/deploy) to Deploy a new app~~(`"We couldn't deploy your app because the source code violates the Salesforce Acceptable Use and External-Facing Services Policy."`)  
 | 
				
			||||||
 | 
					>
 | 
				
			||||||
 | 
					> Star this project, then Fork, create an app in Heroku, then turn to the Deploy tab, "Deployment method" via "Connect GitHub", select your github fork.   
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Deploy to Glitch  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Official
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  https://glitch.com/  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Demo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  https://onemanager.glitch.me/  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### How to Install
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  [New Project] -> [Import form Github] -> paste "https://github.com/qkqpttgf/OneManager-php" , after done, [Show] -> [In a New Window].  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										67
									
								
								readme_cn.md
								
								
								
								
							
							
						
						
									
										67
									
								
								readme_cn.md
								
								
								
								
							| 
						 | 
					@ -12,6 +12,51 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# 部署到 Vercel  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### 官网
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  https://vercel.com/  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Demo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  https://onemanager-php.vercel.app/  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### 注意
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> 1. 每次更改配置后都要等 30-50s 来确保部署成功;  
 | 
				
			||||||
 | 
					>
 | 
				
			||||||
 | 
					> 2. Vercel 每天限制 100 次部署。  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### 安装(英文)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  https://scfonedrive.github.io/Vercel/Deploy.html   
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# 部署到 Replit  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### 官网
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  https://repl.it/  
 | 
				
			||||||
 | 
					  https://replit.com/  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Demo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  https://onemanager.qkqpttgf.repl.co/  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### 注意
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> 直接`Import from Github`通过`.replit`文件指定php时,网页会空白,有人帮忙解决吗?  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### 安装
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> 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` 敲回车运行。  
 | 
				
			||||||
 | 
					> 3. 点上方的绿色 "Run" 按钮,右边会显示一个网页,你要在新窗口打开它来安装,不然不能登录。  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# 部署到 Heroku  
 | 
					# 部署到 Heroku  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### 官网
 | 
					### 官网
 | 
				
			||||||
| 
						 | 
					@ -44,28 +89,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# 部署到 Vercel  
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### 官网
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  https://vercel.com/  
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Demo
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  https://onemanager-php.vercel.app/  
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### 注意
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
> 1. 每次更改配置后都要等 30-50s 来确保部署成功;  
 | 
					 | 
				
			||||||
>
 | 
					 | 
				
			||||||
> 2. Vercel 每天限制 100 次部署。  
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### 安装(英文)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  https://scfonedrive.github.io/Vercel/Deploy.html   
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
---
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# 部署到腾讯无服务器云函数 Serverless Cloud Function (SCF)  
 | 
					# 部署到腾讯无服务器云函数 Serverless Cloud Function (SCF)  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### 官网
 | 
					### 官网
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -305,7 +305,7 @@
 | 
				
			||||||
                            <div>
 | 
					                            <div>
 | 
				
			||||||
                            <div style="margin: 24px">
 | 
					                            <div style="margin: 24px">
 | 
				
			||||||
                                <textarea id="url" title="url" rows="1" style="width: 100%; margin-top: 2px;" readonly><!--FileEncodeUrl--></textarea>
 | 
					                                <textarea id="url" title="url" rows="1" style="width: 100%; margin-top: 2px;" readonly><!--FileEncodeUrl--></textarea>
 | 
				
			||||||
                                <a href="<!--FileUrl-->"><ion-icon name="download" style="line-height: 16px;vertical-align: middle;"></ion-icon> <!--constStr@Download--></a>
 | 
					                                <a href="<!--FileEncodeUrl-->"><ion-icon name="download" style="line-height: 16px;vertical-align: middle;"></ion-icon> <!--constStr@Download--></a>
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                            <div>
 | 
					                            <div>
 | 
				
			||||||
| 
						 | 
					@ -396,6 +396,7 @@
 | 
				
			||||||
<!--LoginEnd-->
 | 
					<!--LoginEnd-->
 | 
				
			||||||
    <script src="https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>
 | 
					    <script src="https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>
 | 
				
			||||||
    <script>
 | 
					    <script>
 | 
				
			||||||
 | 
					<!--AdminStart-->
 | 
				
			||||||
        window.onload = function () 
 | 
					        window.onload = function () 
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            // 获取所有radios元素
 | 
					            // 获取所有radios元素
 | 
				
			||||||
| 
						 | 
					@ -448,6 +449,7 @@
 | 
				
			||||||
                radios[i].setAttribute("currStatus", false);
 | 
					                radios[i].setAttribute("currStatus", false);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					<!--AdminEnd-->
 | 
				
			||||||
        function changelanguage(str)
 | 
					        function changelanguage(str)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if (str=='Language') str = '';
 | 
					        if (str=='Language') str = '';
 | 
				
			||||||
| 
						 | 
					@ -479,7 +481,10 @@
 | 
				
			||||||
<!--IsFileStart-->
 | 
					<!--IsFileStart-->
 | 
				
			||||||
    var $url = document.getElementById('url');
 | 
					    var $url = document.getElementById('url');
 | 
				
			||||||
    if ($url) {
 | 
					    if ($url) {
 | 
				
			||||||
        $url.innerHTML = location.protocol + '//' + location.host + $url.innerHTML;
 | 
					        //$url.innerHTML = location.protocol + '//' + location.host + $url.innerHTML;
 | 
				
			||||||
 | 
					        let url = location.href;
 | 
				
			||||||
 | 
					        url = url.substr(0, url.length-8);
 | 
				
			||||||
 | 
					        $url.innerHTML = url.replace(/&/g, '&amp;');
 | 
				
			||||||
        $url.style.height = $url.scrollHeight + 'px';
 | 
					        $url.style.height = $url.scrollHeight + 'px';
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
<!--IsvideoFileStart-->
 | 
					<!--IsvideoFileStart-->
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -64,7 +64,7 @@
 | 
				
			||||||
        .more-disk a:hover, .more-disk a[now]{ background-color: rgba(85,85,85,0.7); color: white; }
 | 
					        .more-disk a:hover, .more-disk a[now]{ background-color: rgba(85,85,85,0.7); color: white; }
 | 
				
			||||||
        .list-table{width:100%;padding:0 20px 20px 20px;border-spacing:0}
 | 
					        .list-table{width:100%;padding:0 20px 20px 20px;border-spacing:0}
 | 
				
			||||||
        .list-table tr{height:40px}
 | 
					        .list-table tr{height:40px}
 | 
				
			||||||
        .list-table tr[data-to]:hover{background:rgba(85,85,85,0.7);color:white;}
 | 
					        .list-table tr[data-to]:hover{background:rgba(85,85,85,0.7) !important;color:white;}
 | 
				
			||||||
        .list-table tr[data-to]:hover a{color:white}
 | 
					        .list-table tr[data-to]:hover a{color:white}
 | 
				
			||||||
        .list-table tr:first-child{background:rgba(245,245,245,0)}
 | 
					        .list-table tr:first-child{background:rgba(245,245,245,0)}
 | 
				
			||||||
        .list-table td,.list-table th{padding:0 10px;text-align:left}
 | 
					        .list-table td,.list-table th{padding:0 10px;text-align:left}
 | 
				
			||||||
| 
						 | 
					@ -129,6 +129,7 @@
 | 
				
			||||||
    <h1 class="title" id="title">
 | 
					    <h1 class="title" id="title">
 | 
				
			||||||
        <a href="<!--base_path-->"><!--Sitename--></a>
 | 
					        <a href="<!--base_path-->"><!--Sitename--></a>
 | 
				
			||||||
    </h1>
 | 
					    </h1>
 | 
				
			||||||
 | 
					<!--
 | 
				
			||||||
<!--MultiDiskAreaStart-->
 | 
					<!--MultiDiskAreaStart-->
 | 
				
			||||||
    <div class="list-wrapper" id="more-disk-div">
 | 
					    <div class="list-wrapper" id="more-disk-div">
 | 
				
			||||||
        <div class="list-container">
 | 
					        <div class="list-container">
 | 
				
			||||||
| 
						 | 
					@ -142,6 +143,7 @@
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
<!--MultiDiskAreaEnd-->
 | 
					<!--MultiDiskAreaEnd-->
 | 
				
			||||||
 | 
					-->
 | 
				
			||||||
<!--HeadomfStart-->
 | 
					<!--HeadomfStart-->
 | 
				
			||||||
    <div class="list-wrapper" id="head-om-div">
 | 
					    <div class="list-wrapper" id="head-om-div">
 | 
				
			||||||
        <div class="list-container">
 | 
					        <div class="list-container">
 | 
				
			||||||
| 
						 | 
					@ -495,7 +497,7 @@
 | 
				
			||||||
        <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?-->admin" method="post" onsubmit="return sha1loginpass(this);">
 | 
					                <form action="<!--IsPreview?-->login=admin" method="post" onsubmit="return sha1loginpass(this);">
 | 
				
			||||||
                    <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 name="timestamp" type="hidden" value="">
 | 
				
			||||||
                    <input type="submit" value="<!--constStr@Login-->">
 | 
					                    <input type="submit" value="<!--constStr@Login-->">
 | 
				
			||||||
| 
						 | 
					@ -512,7 +514,7 @@
 | 
				
			||||||
<!--MdRequireStart--><link rel="stylesheet" href="//unpkg.zhimg.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="//unpkg.zhimg.com/marked@0.6.2/marked.min.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="//cdn.bootcss.com/spark-md5/3.0.0/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://cdn.bootcss.com/js-sha1/0.6.0/sha1.min.js"></script><!--AliyundriveUploadJsEnd-->
 | 
					<!--AliyundriveUploadJsStart--><script src="https://cdn.jsdelivr.net/npm/js-sha1@0.6.0/src/sha1.min.js"></script><!--AliyundriveUploadJsEnd-->
 | 
				
			||||||
<!--IsFileStart--><!--IspdfFileStart--><script src="//cdn.bootcss.com/pdf.js/2.3.200/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">
 | 
				
			||||||
| 
						 | 
					@ -993,7 +995,6 @@
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    function size_reformat(str) {
 | 
					    function size_reformat(str) {
 | 
				
			||||||
        if (str.substr(-1)==' ') str=str.substr(0,str.length-1);
 | 
					        if (str.substr(-1)==' ') str=str.substr(0,str.length-1);
 | 
				
			||||||
        if (str.substr(-2)=='PB') num=str.substr(0,str.length-3)*1024*1024*1024*1024*1024;
 | 
					 | 
				
			||||||
        if (str.substr(-2)=='TB') num=str.substr(0,str.length-3)*1024*1024*1024*1024;
 | 
					        if (str.substr(-2)=='TB') num=str.substr(0,str.length-3)*1024*1024*1024*1024;
 | 
				
			||||||
        if (str.substr(-2)=='GB') num=str.substr(0,str.length-3)*1024*1024*1024;
 | 
					        if (str.substr(-2)=='GB') num=str.substr(0,str.length-3)*1024*1024*1024;
 | 
				
			||||||
        if (str.substr(-2)=='MB') num=str.substr(0,str.length-3)*1024*1024;
 | 
					        if (str.substr(-2)=='MB') num=str.substr(0,str.length-3)*1024*1024;
 | 
				
			||||||
| 
						 | 
					@ -1271,7 +1272,9 @@
 | 
				
			||||||
                                let tmpspeed = e.loaded*1000/(tmptime.getTime()-C_starttime.getTime());
 | 
					                                let tmpspeed = e.loaded*1000/(tmptime.getTime()-C_starttime.getTime());
 | 
				
			||||||
                                lastCurrentSpeed = tmpspeed;
 | 
					                                lastCurrentSpeed = tmpspeed;
 | 
				
			||||||
                                let remaintime = (totalsize-asize-e.loaded)/tmpspeed;
 | 
					                                let remaintime = (totalsize-asize-e.loaded)/tmpspeed;
 | 
				
			||||||
                                label.innerHTML=StartStr+'<!--constStr@Upload--> ' +size_format(asize+e.loaded)+ ' / '+size_format(totalsize) + ' = ' + ((asize+e.loaded)*100/totalsize).toFixed(2) + '% <!--constStr@AverageSpeed-->:'+size_format((asize+e.loaded-newstartsize)*1000/(tmptime.getTime()-StartTime.getTime()))+'/s<br><!--constStr@CurrentSpeed--> '+size_format(tmpspeed)+'/s <!--constStr@Expect--> '+seconds2hour(remaintime.toFixed(1));
 | 
					                                let percent = ((asize+e.loaded)*100/totalsize).toFixed(2);
 | 
				
			||||||
 | 
					                                label.parentNode.style.background = "linear-gradient(to right, rgba(0,0,0,25%) " + percent + "%, rgba(0,0,0,0%) 0%)";
 | 
				
			||||||
 | 
					                                label.innerHTML = StartStr+'<!--constStr@Upload--> ' +size_format(asize+e.loaded)+ ' / '+size_format(totalsize) + ' = ' + percent + '% <!--constStr@AverageSpeed-->:'+size_format((asize+e.loaded-newstartsize)*1000/(tmptime.getTime()-StartTime.getTime()))+'/s<br><!--constStr@CurrentSpeed--> '+size_format(tmpspeed)+'/s <!--constStr@Expect--> '+seconds2hour(remaintime.toFixed(1));
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        var C_starttime = new Date();
 | 
					                        var C_starttime = new Date();
 | 
				
			||||||
| 
						 | 
					@ -1300,7 +1303,7 @@
 | 
				
			||||||
                                while (filename.indexOf('%2F')>0) filename = filename.replace('%2F', '/');
 | 
					                                while (filename.indexOf('%2F')>0) filename = filename.replace('%2F', '/');
 | 
				
			||||||
                                document.getElementById('upfile_td1_'+tdnum).innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+filename+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+filename+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'" <!--AdminStart--> style="display:none"<!--AdminEnd--> ><!--constStr@CopyUrl--></button></div>';
 | 
					                                document.getElementById('upfile_td1_'+tdnum).innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+filename+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+filename+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'" <!--AdminStart--> style="display:none"<!--AdminEnd--> ><!--constStr@CopyUrl--></button></div>';
 | 
				
			||||||
                                label.innerHTML=StartStr+MiddleStr;
 | 
					                                label.innerHTML=StartStr+MiddleStr;
 | 
				
			||||||
                                label.style.color='green';
 | 
					                                label.parentNode.style.background = 'rgba(0,80,0,25%)';
 | 
				
			||||||
                                
 | 
					                                
 | 
				
			||||||
                                // uploadbuttonshow();
 | 
					                                // uploadbuttonshow();
 | 
				
			||||||
<!--AdminStart-->
 | 
					<!--AdminStart-->
 | 
				
			||||||
| 
						 | 
					@ -1543,7 +1546,7 @@
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                            document.getElementById('upfile_td1_'+tdnum).innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+filename+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+filename+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'" <!--AdminStart--> style="display:none"<!--AdminEnd--> ><!--constStr@CopyUrl--></button></div>';
 | 
					                            document.getElementById('upfile_td1_'+tdnum).innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+filename+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+filename+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'" <!--AdminStart--> style="display:none"<!--AdminEnd--> ><!--constStr@CopyUrl--></button></div>';
 | 
				
			||||||
                            label.innerHTML=StartStr+MiddleStr;
 | 
					                            label.innerHTML=StartStr+MiddleStr;
 | 
				
			||||||
                            label.style.color='green';
 | 
					                            label.parentNode.style.background = 'rgba(0,80,0,25%)';
 | 
				
			||||||
                        } else {
 | 
					                        } else {
 | 
				
			||||||
                            label.innerHTML= '<font color="red">' + xhr1.status + ',' + xhr1.responseText + '</font>';
 | 
					                            label.innerHTML= '<font color="red">' + xhr1.status + ',' + xhr1.responseText + '</font>';
 | 
				
			||||||
                            localStorage.removeItem(filesha1);
 | 
					                            localStorage.removeItem(filesha1);
 | 
				
			||||||
| 
						 | 
					@ -1563,7 +1566,9 @@
 | 
				
			||||||
                            var tmptime = new Date();
 | 
					                            var tmptime = new Date();
 | 
				
			||||||
                            var tmpspeed = e.loaded*1000/(tmptime.getTime()-C_starttime.getTime());
 | 
					                            var tmpspeed = e.loaded*1000/(tmptime.getTime()-C_starttime.getTime());
 | 
				
			||||||
                            var remaintime = (totalsize-asize-e.loaded)/tmpspeed;
 | 
					                            var remaintime = (totalsize-asize-e.loaded)/tmpspeed;
 | 
				
			||||||
                            label.innerHTML=StartStr+'<!--constStr@Upload--> ' +size_format(asize+e.loaded)+ ' / '+size_format(totalsize) + ' = ' + ((asize+e.loaded)*100/totalsize).toFixed(2) + '% <!--constStr@AverageSpeed-->:'+size_format((asize+e.loaded-newstartsize)*1000/(tmptime.getTime()-StartTime.getTime()))+'/s<br><!--constStr@CurrentSpeed--> '+size_format(tmpspeed)+'/s <!--constStr@Expect--> '+seconds2hour(remaintime.toFixed(1));
 | 
					                            let percent = ((asize+e.loaded)*100/totalsize).toFixed(2);
 | 
				
			||||||
 | 
					                            label.parentNode.style.background = "linear-gradient(to right, rgba(0,0,0,25%) " + percent + "%, rgba(0,0,0,0%) 0%)";
 | 
				
			||||||
 | 
					                            label.innerHTML=StartStr+'<!--constStr@Upload--> ' +size_format(asize+e.loaded)+ ' / '+size_format(totalsize) + ' = ' + percent + '% <!--constStr@AverageSpeed-->:'+size_format((asize+e.loaded-newstartsize)*1000/(tmptime.getTime()-StartTime.getTime()))+'/s<br><!--constStr@CurrentSpeed--> '+size_format(tmpspeed)+'/s <!--constStr@Expect--> '+seconds2hour(remaintime.toFixed(1));
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    var C_starttime = new Date();
 | 
					                    var C_starttime = new Date();
 | 
				
			||||||
| 
						 | 
					@ -1614,7 +1619,7 @@
 | 
				
			||||||
                                        }
 | 
					                                        }
 | 
				
			||||||
                                        document.getElementById('upfile_td1_'+tdnum).innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+filename+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+filename+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'" <!--AdminStart--> style="display:none"<!--AdminEnd--> ><!--constStr@CopyUrl--></button></div>';
 | 
					                                        document.getElementById('upfile_td1_'+tdnum).innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+filename+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+filename+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'" <!--AdminStart--> style="display:none"<!--AdminEnd--> ><!--constStr@CopyUrl--></button></div>';
 | 
				
			||||||
                                        label.innerHTML=StartStr+MiddleStr;
 | 
					                                        label.innerHTML=StartStr+MiddleStr;
 | 
				
			||||||
                                        label.style.color='green';
 | 
					                                        label.parentNode.style.background = 'rgba(0,80,0,25%)';
 | 
				
			||||||
                                    } else {
 | 
					                                    } else {
 | 
				
			||||||
                                        label.innerHTML= '<font color="red">' + xhr1.status + ',' + xhr1.responseText + '</font>';
 | 
					                                        label.innerHTML= '<font color="red">' + xhr1.status + ',' + xhr1.responseText + '</font>';
 | 
				
			||||||
                                        localStorage.removeItem(filesha1);
 | 
					                                        localStorage.removeItem(filesha1);
 | 
				
			||||||
| 
						 | 
					@ -1861,7 +1866,7 @@
 | 
				
			||||||
<!--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="https://cdn.bootcss.com/js-sha1/0.6.0/sha1.min.js"></script><!--LoginEnd-->
 | 
					<!--LoginStart--><script src="https://cdn.jsdelivr.net/npm/js-sha1@0.6.0/src/sha1.min.js"></script><!--LoginEnd-->
 | 
				
			||||||
<!--customScript-->
 | 
					<!--customScript-->
 | 
				
			||||||
<a href="https://icp.gov.moe/?keyword=20220244" target="_blank">萌ICP备20220244号</a>
 | 
					<a href="https://icp.gov.moe/?keyword=20220244" target="_blank">萌ICP备20220244号</a>
 | 
				
			||||||
</html>
 | 
					</html>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -558,7 +558,9 @@
 | 
				
			||||||
<!--IsFileStart-->
 | 
					<!--IsFileStart-->
 | 
				
			||||||
    var $url = document.getElementById('url');
 | 
					    var $url = document.getElementById('url');
 | 
				
			||||||
    if ($url) {
 | 
					    if ($url) {
 | 
				
			||||||
        $url.innerHTML = location.protocol + '//' + location.host + $url.innerHTML;
 | 
					        let url = location.href;
 | 
				
			||||||
 | 
					        url = url.substr(0, url.length-8);
 | 
				
			||||||
 | 
					        $url.innerHTML = url.replace(/&/g, '&amp;');
 | 
				
			||||||
        $url.style.height = $url.scrollHeight + 'px';
 | 
					        $url.style.height = $url.scrollHeight + 'px';
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
<!--IsofficeFileStart-->
 | 
					<!--IsofficeFileStart-->
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -222,7 +222,7 @@
 | 
				
			||||||
                <div style="margin: 12px 4px 4px; text-align: center">
 | 
					                <div style="margin: 12px 4px 4px; text-align: center">
 | 
				
			||||||
                    <div style="margin: 24px">
 | 
					                    <div style="margin: 24px">
 | 
				
			||||||
                        <textarea id="url" title="url" rows="1" style="width: 100%; margin-top: 2px;" readonly><!--FileEncodeUrl--></textarea>
 | 
					                        <textarea id="url" title="url" rows="1" style="width: 100%; margin-top: 2px;" readonly><!--FileEncodeUrl--></textarea>
 | 
				
			||||||
                        <a href="<!--FileUrl-->"><ion-icon name="download" style="line-height: 16px;vertical-align: middle;"></ion-icon> <!--constStr@Download--></a>
 | 
					                        <a href="<!--FileEncodeUrl-->"><ion-icon name="download" style="line-height: 16px;vertical-align: middle;"></ion-icon> <!--constStr@Download--></a>
 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
                    <div style="margin: 24px">
 | 
					                    <div style="margin: 24px">
 | 
				
			||||||
<!--IsimgFileStart-->
 | 
					<!--IsimgFileStart-->
 | 
				
			||||||
| 
						 | 
					@ -717,7 +717,10 @@ return false;
 | 
				
			||||||
<!--IsFileStart-->
 | 
					<!--IsFileStart-->
 | 
				
			||||||
    var $url = document.getElementById('url');
 | 
					    var $url = document.getElementById('url');
 | 
				
			||||||
    if ($url) {
 | 
					    if ($url) {
 | 
				
			||||||
        $url.innerHTML = location.protocol + '//' + location.host + $url.innerHTML;
 | 
					        //$url.innerHTML = location.protocol + '//' + location.host + $url.innerHTML;
 | 
				
			||||||
 | 
					        let url = location.href;
 | 
				
			||||||
 | 
					        url = url.substr(0, url.length-8);
 | 
				
			||||||
 | 
					        $url.innerHTML = url.replace(/&/g, '&amp;');
 | 
				
			||||||
        $url.style.height = $url.scrollHeight + 'px';
 | 
					        $url.style.height = $url.scrollHeight + 'px';
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
<!--IsofficeFileStart-->
 | 
					<!--IsofficeFileStart-->
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -479,7 +479,10 @@
 | 
				
			||||||
<!--IsFileStart-->
 | 
					<!--IsFileStart-->
 | 
				
			||||||
    var $url = document.getElementById('url');
 | 
					    var $url = document.getElementById('url');
 | 
				
			||||||
    if ($url) {
 | 
					    if ($url) {
 | 
				
			||||||
        $url.innerHTML = location.protocol + '//' + location.host + $url.innerHTML;
 | 
					        //$url.innerHTML = location.protocol + '//' + location.host + $url.innerHTML;
 | 
				
			||||||
 | 
					        let url = location.href;
 | 
				
			||||||
 | 
					        url = url.substr(0, url.length-8);
 | 
				
			||||||
 | 
					        $url.innerHTML = url.replace(/&/g, '&amp;');
 | 
				
			||||||
        $url.style.height = $url.scrollHeight + 'px';
 | 
					        $url.style.height = $url.scrollHeight + 'px';
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
<!--IsofficeFileStart-->
 | 
					<!--IsofficeFileStart-->
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -179,7 +179,7 @@
 | 
				
			||||||
                <div style="margin: 12px 4px 4px; text-align: center">
 | 
					                <div style="margin: 12px 4px 4px; text-align: center">
 | 
				
			||||||
                    <div style="margin: 24px">
 | 
					                    <div style="margin: 24px">
 | 
				
			||||||
                        <textarea id="url" title="url" rows="1" style="width: 100%; margin-top: 2px;" readonly><!--FileEncodeUrl--></textarea>
 | 
					                        <textarea id="url" title="url" rows="1" style="width: 100%; margin-top: 2px;" readonly><!--FileEncodeUrl--></textarea>
 | 
				
			||||||
                        <a href="<!--FileUrl-->"><ion-icon name="download" style="line-height: 16px;vertical-align: middle;"></ion-icon> <!--constStr@Download--></a>
 | 
					                        <a href="<!--FileEncodeUrl-->"><ion-icon name="download" style="line-height: 16px;vertical-align: middle;"></ion-icon> <!--constStr@Download--></a>
 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
                    <div style="margin: 24px">
 | 
					                    <div style="margin: 24px">
 | 
				
			||||||
<!--IsimgFileStart-->
 | 
					<!--IsimgFileStart-->
 | 
				
			||||||
| 
						 | 
					@ -509,7 +509,10 @@
 | 
				
			||||||
<!--IsFileStart-->
 | 
					<!--IsFileStart-->
 | 
				
			||||||
    var $url = document.getElementById('url');
 | 
					    var $url = document.getElementById('url');
 | 
				
			||||||
    if ($url) {
 | 
					    if ($url) {
 | 
				
			||||||
        $url.innerHTML = location.protocol + '//' + location.host + $url.innerHTML;
 | 
					        //$url.innerHTML = location.protocol + '//' + location.host + $url.innerHTML;
 | 
				
			||||||
 | 
					        let url = location.href;
 | 
				
			||||||
 | 
					        url = url.substr(0, url.length-8);
 | 
				
			||||||
 | 
					        $url.innerHTML = url.replace(/&/g, '&amp;');
 | 
				
			||||||
        $url.style.height = $url.scrollHeight + 'px';
 | 
					        $url.style.height = $url.scrollHeight + 'px';
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
<!--IsofficeFileStart-->
 | 
					<!--IsofficeFileStart-->
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -98,13 +98,9 @@
 | 
				
			||||||
    <div class="mdui-drawer mdui-drawer-close" id="main-drawer">
 | 
					    <div class="mdui-drawer mdui-drawer-close" id="main-drawer">
 | 
				
			||||||
  <div class="mdui-list" mdui-collapse="{accordion: true}">
 | 
					  <div class="mdui-list" mdui-collapse="{accordion: true}">
 | 
				
			||||||
    <!--LoginStart-->
 | 
					    <!--LoginStart-->
 | 
				
			||||||
<li
 | 
					<li class="mdui-list-item mdui-ripple" href="?admin" >
 | 
				
			||||||
  class="mdui-list-item mdui-ripple"
 | 
					  <a class="mdui-list-item-icon mdui-icon material-icons">account_circle</a>
 | 
				
			||||||
  href="javascript:void(0);"
 | 
					  <a class="mdui-list-item-content" href="?admin">登录</a>
 | 
				
			||||||
  mdui-dialog="{target: '#login_input'}"
 | 
					 | 
				
			||||||
>
 | 
					 | 
				
			||||||
  <a class="mdui-list-item-icon mdui-icon material-icons">account_circle</a
 | 
					 | 
				
			||||||
  ><a class="mdui-list-item-content">登录</a>
 | 
					 | 
				
			||||||
</li>
 | 
					</li>
 | 
				
			||||||
<!--LoginEnd-->
 | 
					<!--LoginEnd-->
 | 
				
			||||||
<!--AdminStart-->
 | 
					<!--AdminStart-->
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -187,10 +187,10 @@
 | 
				
			||||||
</path></svg></div>
 | 
					</path></svg></div>
 | 
				
			||||||
    <div style="padding:1px" id="top-div">
 | 
					    <div style="padding:1px" id="top-div">
 | 
				
			||||||
<!--LoginStart-->
 | 
					<!--LoginStart-->
 | 
				
			||||||
        <a class="login" href="?admin"><ion-icon name="ban-outline"></ion-icon></a><!--onclick="login();"-->
 | 
					        <a class="login" href="?admin"><ion-icon name="add-circle-outline"></ion-icon></a><!--onclick="login();"-->
 | 
				
			||||||
<!--LoginEnd-->
 | 
					<!--LoginEnd-->
 | 
				
			||||||
<!--AdminStart-->
 | 
					<!--AdminStart-->
 | 
				
			||||||
        <li class="operate" id="opflow"><ion-icon name="ban-outline"></ion-icon><ul>
 | 
					        <li class="operate" id="opflow"><ion-icon name="add-circle-outline"></ion-icon><ul>
 | 
				
			||||||
<!--IsFolderStart-->
 | 
					<!--IsFolderStart-->
 | 
				
			||||||
            <li><a onclick="showdiv(event,'create','');"><ion-icon name="add-circle-outline"></ion-icon><!--constStr@Create--></a></li>
 | 
					            <li><a onclick="showdiv(event,'create','');"><ion-icon name="add-circle-outline"></ion-icon><!--constStr@Create--></a></li>
 | 
				
			||||||
            <li><a onclick="showdiv(event,'encrypt','');"><ion-icon name="lock-closed-outline"></ion-icon><!--constStr@Encrypt--></a></li>
 | 
					            <li><a onclick="showdiv(event,'encrypt','');"><ion-icon name="lock-closed-outline"></ion-icon><!--constStr@Encrypt--></a></li>
 | 
				
			||||||
| 
						 | 
					@ -300,7 +300,9 @@
 | 
				
			||||||
                            var prePath = strFullPath.substring(0, pos);
 | 
					                            var prePath = strFullPath.substring(0, pos);
 | 
				
			||||||
                            var width = window.innerWidth;
 | 
					                            var width = window.innerWidth;
 | 
				
			||||||
                            // var postPath = strPath.substring(0, strPath.substr(1).indexOf('/') + 1);
 | 
					                            // var postPath = strPath.substring(0, strPath.substr(1).indexOf('/') + 1);
 | 
				
			||||||
                            document.getElementById("url").value= prePath + "<!--FileEncodeUrl-->";
 | 
					                            let url = location.href;
 | 
				
			||||||
 | 
					                            url = url.substr(0, url.length-8);
 | 
				
			||||||
 | 
					                            document.getElementById("url").value= url;
 | 
				
			||||||
                            // document.getElementById("url").value= prePath + postPath + "<!--FileEncodeUrl-->";
 | 
					                            // document.getElementById("url").value= prePath + postPath + "<!--FileEncodeUrl-->";
 | 
				
			||||||
                            if(width < 495) { 
 | 
					                            if(width < 495) { 
 | 
				
			||||||
                                if(document.getElementById("office-a")) { 
 | 
					                                if(document.getElementById("office-a")) { 
 | 
				
			||||||
| 
						 | 
					@ -603,7 +605,7 @@
 | 
				
			||||||
<!--MdRequireStart--><link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/github-markdown-css@4.0.0/github-markdown.min.css">
 | 
					<!--MdRequireStart--><link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/github-markdown-css@4.0.0/github-markdown.min.css">
 | 
				
			||||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/marked@2.0.0/lib/marked.min.js"></script><!--MdRequireEnd-->
 | 
					<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/marked@2.0.0/lib/marked.min.js"></script><!--MdRequireEnd-->
 | 
				
			||||||
<!--GuestUploadStart--><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/spark-md5@3.0.1/spark-md5.min.js"></script><!--GuestUploadEnd-->
 | 
					<!--GuestUploadStart--><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/spark-md5@3.0.1/spark-md5.min.js"></script><!--GuestUploadEnd-->
 | 
				
			||||||
<!--AliyundriveUploadJsStart--><script src="https://cdn.jsdelivr.net/npm/sha1@1.1.1/sha1.min.js"></script><!--AliyundriveUploadJsEnd-->
 | 
					<!--AliyundriveUploadJsStart--><script src="https://cdn.jsdelivr.net/npm/js-sha1@0.6.0/src/sha1.min.js"></script><!--AliyundriveUploadJsEnd-->
 | 
				
			||||||
<!--IsFileStart--><!--IspdfFileStart--><script src="https://cdn.jsdelivr.net/npm/pdfjs-dist@2.8.335/build/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd-->
 | 
					<!--IsFileStart--><!--IspdfFileStart--><script src="https://cdn.jsdelivr.net/npm/pdfjs-dist@2.8.335/build/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd-->
 | 
				
			||||||
<!--ListEnd-->
 | 
					<!--ListEnd-->
 | 
				
			||||||
<script type="text/javascript">
 | 
					<script type="text/javascript">
 | 
				
			||||||
| 
						 | 
					@ -642,11 +644,6 @@
 | 
				
			||||||
<!--LoginEnd-->
 | 
					<!--LoginEnd-->
 | 
				
			||||||
<!--ListStart-->
 | 
					<!--ListStart-->
 | 
				
			||||||
<!--IsFileStart-->
 | 
					<!--IsFileStart-->
 | 
				
			||||||
    var $url = document.getElementById('url').value;
 | 
					 | 
				
			||||||
    if ($url) {
 | 
					 | 
				
			||||||
        $url.innerHTML = location.protocol + '//' + location.host + $url.innerHTML;
 | 
					 | 
				
			||||||
        $url.style.height = $url.scrollHeight + 'px';
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
<!--IsofficeFileStart-->
 | 
					<!--IsofficeFileStart-->
 | 
				
			||||||
    var $officearea=document.getElementById('office-a');
 | 
					    var $officearea=document.getElementById('office-a');
 | 
				
			||||||
    if ($officearea) {
 | 
					    if ($officearea) {
 | 
				
			||||||
| 
						 | 
					@ -1807,6 +1804,6 @@ function size_format(num) {
 | 
				
			||||||
    document.getElementById('password1').focus();
 | 
					    document.getElementById('password1').focus();
 | 
				
			||||||
<!--EncryptedEnd-->
 | 
					<!--EncryptedEnd-->
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
<!--LoginStart--><script src="https://cdn.jsdelivr.net/npm/sha1@1.1.1/sha1.min.js"></script><!--LoginEnd-->
 | 
					<!--LoginStart--><script src="https://cdn.jsdelivr.net/npm/js-sha1@0.6.0/src/sha1.min.js"></script><!--LoginEnd-->
 | 
				
			||||||
<!--customScript-->
 | 
					<!--customScript-->
 | 
				
			||||||
</html>
 | 
					</html>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										29
									
								
								version
								
								
								
								
							
							
						
						
									
										29
									
								
								version
								
								
								
								
							| 
						 | 
					@ -1,7 +1,34 @@
 | 
				
			||||||
 | 
					20220127-1234.43
 | 
				
			||||||
 | 
					<font color="red">change login page, default not '?admin' but '?login=admin' now! and if set adminloginpage, it will be '?login=[value]'.</font> rm JumpFirstDisk, 403 in operating root, change sorting disk, remake disktags tab, add global md config. Allow Preview when enable downloadencrypt. some change in adding Onedrive disk. show upload progress in table background. fix some bugs.
 | 
				
			||||||
 | 
					<font color="red">更改登录地址,默认不再是'?admin'而是'?login=admin',如果设置了adminloginpage,那登录地址会是'?login=值'。</font>移除 JumpFirstDisk,在root操作时返回403,更改盘排序,重做盘符排列,添加全局md配置。在开启downloadencrypt后可以网页预览了。添加onedrive盘时稍做修改。上传时以背景做进度条。修复其它bug。
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					20211220-1100.42
 | 
				
			||||||
 | 
					Add new platform Replit. Add a git source for update. sha1.js use jsdelivr cdn. fix some bugs.
 | 
				
			||||||
 | 
					新增Replit平台。新增国内git源,以后国内可以选择从HIT源更新。sha1.js换成jsdelivr CDN。修复bug。
 | 
				
			||||||
 | 
					20211201-1602.41
 | 
				
			||||||
 | 
					add a latent function, you can edit platform token(or API key) via '?setup=auth' when the token invalid, not need edit it in Environment(or Config Var) manually, (even in Vercel, config saved in file, and can't modiy it manually).
 | 
				
			||||||
 | 
					新增隐藏功能,在平台操作代码的token或API key失效时,可以在 '?setup=auth' 修改它,不用去环境变量修改了(特别地,Vercel保存在代码中时都改不到)。
 | 
				
			||||||
 | 
					20211129
 | 
				
			||||||
 | 
					check if there is another deployment building when start deploy.
 | 
				
			||||||
 | 
					Vercel部署时检测是否有另一个部署。
 | 
				
			||||||
 | 
					20211104
 | 
				
			||||||
 | 
					check if exist php-curl or not in php host and VPS.
 | 
				
			||||||
 | 
					在VPS中检测是否有php-curl。
 | 
				
			||||||
 | 
					20211021
 | 
				
			||||||
 | 
					specialchars, fix: list folder, encrypt folder, preview files, rename, show in title, error on back link after login at specialchars folder, etc.
 | 
				
			||||||
 | 
					针对特殊字符,解决目录的列表,目录的加密,文件的预览,目录与文件重命名,在网页标题的显示,在特殊字符处登录后跳转出错等问题。
 | 
				
			||||||
 | 
					20211006
 | 
				
			||||||
 | 
					oprate files by fileID, write a localStorage when login to anti CSRF.
 | 
				
			||||||
 | 
					管理时对文件id操作,管理登录时写入一个localStorage预防CSRF。
 | 
				
			||||||
 | 
					20210908
 | 
				
			||||||
 | 
					add fileConduitSize&fileConduitCacheTime, little files can stream from program, better to show html/js as local file.
 | 
				
			||||||
 | 
					增加fileConduitSize,fileConduitCacheTime,小文件可以从服务器中转,以对html/js本地化更好的支持。
 | 
				
			||||||
 | 
					20210903
 | 
				
			||||||
 | 
					add a latent function, you can run some command by '?setup=cmd', be care, please dont try "top", and set times by "ping -c 4".
 | 
				
			||||||
 | 
					新增隐藏功能,你可以通过'?setup=cmd'来跑一些命令,注意不要试图跑top,另外ping请-c设置次数。
 | 
				
			||||||
20210820-1810.40
 | 
					20210820-1810.40
 | 
				
			||||||
because Vercel must redeploy after change Environment Variables, and it must <4k, so decide that, save config in code file. <font color=red>in Vercel, after update, please install again. if you want continue use Environment, please add a ( name: "ONEMANAGER_CONFIG_SAVE", value: "env" ) in Environment Variables in Project Settings before update.</font>
 | 
					because Vercel must redeploy after change Environment Variables, and it must <4k, so decide that, save config in code file. <font color=red>in Vercel, after update, please install again. if you want continue use Environment, please add a ( name: "ONEMANAGER_CONFIG_SAVE", value: "env" ) in Environment Variables in Project Settings before update.</font>
 | 
				
			||||||
因为Vercel修改环境变量也必须重新部署才生效,而且环境变量只能小于4k,所以决定将配置保存在代码文件中。<font color=red>升级更新后,用Vercel的请重新安装。如果还想继续使用环境变量,请在更新前,在Project Settings的Environment Variables中,新增一个( name: "ONEMANAGER_CONFIG_SAVE", value: "env" )的环境变量。</font>
 | 
					因为Vercel修改环境变量也必须重新部署才生效,而且环境变量只能小于4k,所以决定将配置保存在代码文件中。<font color=red>升级更新后,用Vercel的请重新安装。如果还想继续使用环境变量,请在更新前,在Project Settings的Environment Variables中,新增一个( name: "ONEMANAGER_CONFIG_SAVE", value: "env" )的环境变量。</font>
 | 
				
			||||||
 | 
					 | 
				
			||||||
20210817-2030.39
 | 
					20210817-2030.39
 | 
				
			||||||
fix bugs in Vercel. add wait function in operating. change update method in SCF. add payme in readme.
 | 
					fix bugs in Vercel. add wait function in operating. change update method in SCF. add payme in readme.
 | 
				
			||||||
修复一些Vercel上的bug。在操作完后添加等待功能,确认平台已经准备好。SCF的更新方式改变。在readme中添加讨饭链接。
 | 
					修复一些Vercel上的bug。在操作完后添加等待功能,确认平台已经准备好。SCF的更新方式改变。在readme中添加讨饭链接。
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue