From afabfbf0debf761c39d6261476903b2e3fdc3580 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Mon, 24 Feb 2020 22:51:20 +0800 Subject: [PATCH] fix bug:special tag --- function/scf.php | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/function/scf.php b/function/scf.php index bce634b..8a09b47 100644 --- a/function/scf.php +++ b/function/scf.php @@ -53,9 +53,9 @@ function GetPathSetting($event, $context) function getConfig($str, $disktag = '') { - global $innerEnv; + global $InnerEnv; if ($disktag=='') $disktag = $_SERVER['disktag']; - if (in_array($str, $innerEnv)) { + if (in_array($str, $InnerEnv)) { return json_decode(getenv($disktag), true)[$str]; } return getenv($str); @@ -63,7 +63,7 @@ function getConfig($str, $disktag = '') function setConfig($arr, $disktag = '') { - global $innerEnv; + global $InnerEnv; if ($disktag=='') $disktag = $_SERVER['disktag']; $disktags = explode("|",getConfig('disktag')); $diskconfig = json_decode(getenv($disktag), true); @@ -71,7 +71,7 @@ function setConfig($arr, $disktag = '') $indisk = 0; $oparetdisk = 0; foreach ($arr as $k => $v) { - if (in_array($k, $innerEnv)) { + if (in_array($k, $InnerEnv)) { $diskconfig[$k] = $v; $indisk = 1; } elseif ($k=='disktag_add') { @@ -111,6 +111,8 @@ function WaitSCFStat() 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']; @@ -169,6 +171,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']; @@ -223,6 +228,11 @@ namespace:' . $_SERVER['namespace'] . '
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').'\'); @@ -487,11 +497,10 @@ function updateProgram($function_name, $Region, $Namespace, $SecretId, $SecretKe 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(updateProgram($function_name, $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey')), true)['Response']; @@ -514,7 +523,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; @@ -568,7 +577,7 @@ namespace:' . $_SERVER['namespace'] . '
'.getconstStr('PlatformConfig').' '; - foreach ($commonEnv as $key) { + foreach ($ShowedCommonEnv as $key) { if ($key=='language') { $html .= ' @@ -637,7 +646,7 @@ namespace:' . $_SERVER['namespace'] . '
$html .= '
'; - foreach ($ShowedinnerEnv as $key) { + foreach ($ShowedInnerEnv as $key) { $html .= '