From ff2e852f873bec2ce25bbfbbb8a3b6556c62561d Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Mon, 24 Feb 2020 22:52:11 +0800 Subject: [PATCH] fix bug: special tag --- function/normal.php | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/function/normal.php b/function/normal.php index 7d0bc0b..4e0f3de 100644 --- a/function/normal.php +++ b/function/normal.php @@ -38,14 +38,14 @@ function getGET() function getConfig($str, $disktag = '') { - global $innerEnv; + global $InnerEnv; //include 'config.php'; if ($disktag=='') $disktag = $_SERVER['disktag']; $s = file_get_contents('config.php'); $configs = substr($s, 18, -2); if ($configs!='') { $envs = json_decode($configs, true); - if (in_array($str, $innerEnv)) { + if (in_array($str, $InnerEnv)) { if (isset($envs[$disktag][$str])) return $envs[$disktag][$str]; } else if (isset($envs[$str])) return $envs[$str]; } @@ -54,7 +54,7 @@ function getConfig($str, $disktag = '') function setConfig($arr, $disktag = '') { - global $innerEnv; + global $InnerEnv; if ($disktag=='') $disktag = $_SERVER['disktag']; //include 'config.php'; $s = file_get_contents('config.php'); @@ -64,7 +64,7 @@ function setConfig($arr, $disktag = '') //$indisk = 0; $operatedisk = 0; foreach ($arr as $k => $v) { - if (in_array($k, $innerEnv)) { + if (in_array($k, $InnerEnv)) { $envs[$disktag][$k] = $v; /*$diskconfig[$k] = $v; $indisk = 1;*/ @@ -103,6 +103,8 @@ function setConfig($arr, $disktag = '') function get_refresh_token() { global $constStr; + global $CommonEnv; + foreach ($CommonEnv as $env) $envs .= '\'' . $env . '\', '; $url = path_format($_SERVER['PHP_SELF'] . '/'); if ($_GET['authorization_code'] && isset($_GET['code'])) { $_SERVER['disktag'] = $_COOKIE['disktag']; @@ -160,6 +162,9 @@ function get_refresh_token() } if ($_GET['install0']) { if ($_POST['disktag_add']!='' && ($_POST['Onedrive_ver']=='MS' || $_POST['Onedrive_ver']=='CN' || $_POST['Onedrive_ver']=='MSC')) { + if (in_array($_COOKIE['disktag'], $CommonEnv)) { + return message('Do not input ' . $envs . '
', 'Error', 201); + } $_SERVER['disktag'] = $_COOKIE['disktag']; $tmp['disktag_add'] = $_POST['disktag_add']; $tmp['diskname'] = $_POST['diskname']; @@ -211,6 +216,11 @@ Can not write config to file.
alert(\'Input Disk Tag\'); return false; } + envs = [' . $envs . ']; + if (envs.indexOf(t.disktag_add.value)>-1) { + alert(\'' . $envs . '\'); + return false; + } var reg = /^[a-zA-Z]([-_a-zA-Z0-9]{1,20})$/; if (!reg.test(t.disktag_add.value)) { alert(\''.getconstStr('TagFormatAlert').'\'); @@ -313,11 +323,10 @@ function RewriteEngineOn() function EnvOpt($function_name, $needUpdate = 0) { global $constStr; - global $commonEnv; - global $innerEnv; - global $ShowedinnerEnv; - asort($commonEnv); - asort($ShowedinnerEnv); + global $ShowedCommonEnv; + global $ShowedInnerEnv; + asort($ShowedCommonEnv); + asort($ShowedInnerEnv); $html = 'OneManager '.getconstStr('Setup').''; /*if ($_POST['updateProgram']==getconstStr('updateProgram')) { $response = json_decode(updataProgram($function_name, $Region, $namespace), true)['Response']; @@ -339,7 +348,7 @@ namespace:' . $namespace . '
if ($_POST['submit1']) { $_SERVER['disk_oprating'] = ''; foreach ($_POST as $k => $v) { - if (in_array($k, $commonEnv)||in_array($k, $innerEnv)||$k=='disktag_del' || $k=='disktag_add') { + if (in_array($k, $ShowedCommonEnv)||in_array($k, $ShowedInnerEnv)||$k=='disktag_del' || $k=='disktag_add') { $tmp[$k] = $v; } if ($k == 'disk') $_SERVER['disk_oprating'] = $v; @@ -384,7 +393,7 @@ namespace:' . $namespace . '
'.getconstStr('PlatformConfig').' '; - foreach ($commonEnv as $key) { + foreach ($ShowedCommonEnv as $key) { if ($key=='language') { $html .= ' @@ -453,7 +462,7 @@ namespace:' . $namespace . '
$html .= '
'; - foreach ($ShowedinnerEnv as $key) { + foreach ($ShowedInnerEnv as $key) { $html .= '