fix bug: special tag

pull/17/head
qkqpttgf 2020-02-24 22:53:10 +08:00 committed by GitHub
parent ff2e852f87
commit d7dcc180a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 13 deletions

View File

@ -39,9 +39,9 @@ function getGET()
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);
@ -49,7 +49,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);
@ -57,7 +57,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') {
@ -90,6 +90,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'];
@ -147,6 +149,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 . '<br><button onclick="location.href = location.href;">'.getconstStr('Reflesh').'</button><script>document.cookie=\'disktag=; path=/\';</script>', 'Error', 201);
}
$_SERVER['disktag'] = $_COOKIE['disktag'];
$tmp['disktag_add'] = $_POST['disktag_add'];
$tmp['diskname'] = $_POST['diskname'];
@ -199,6 +204,11 @@ function_name:' . $_SERVER['function_name'] . '<br>
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').'\');
@ -345,11 +355,10 @@ function updateHerokuapp($function_name, $apikey)
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 = '<title>OneManager '.getconstStr('Setup').'</title>';
if ($_POST['updateProgram']==getconstStr('updateProgram')) {
$response = json_decode(updateHerokuapp(getConfig('function_name'), getConfig('APIKey'))['body'], true);
@ -374,10 +383,10 @@ function_name:' . $_SERVER['function_name'] . '<br>
}
$_SERVER['disk_oprating'] = '';
foreach ($_POST as $k => $v) {
if (in_array($k, $commonEnv)) {
if (in_array($k, $ShowedCommonEnv)) {
if (!(getConfig($k)==''&&$v=='')) $tmp[$k] = $v;
}
if (in_array($k, $innerEnv)||$k=='disktag_del' || $k=='disktag_add') {
if (in_array($k, $ShowedInnerEnv)||$k=='disktag_del' || $k=='disktag_add') {
$tmp[$k] = $v;
}
if ($k == 'disk') $_SERVER['disk_oprating'] = $v;
@ -425,7 +434,7 @@ function_name:' . $_SERVER['function_name'] . '<br>
<tr>
<td colspan="2">'.getconstStr('PlatformConfig').'</td>
</tr>';
foreach ($commonEnv as $key) {
foreach ($ShowedCommonEnv as $key) {
if ($key=='language') {
$html .= '
<tr>
@ -494,7 +503,7 @@ function_name:' . $_SERVER['function_name'] . '<br>
$html .= '
<form name="'.$disktag.'" action="" method="post">
<input type="hidden" name="disk" value="'.$disktag.'">';
foreach ($ShowedinnerEnv as $key) {
foreach ($ShowedInnerEnv as $key) {
$html .= '
<tr>
<td><label>' . $key . '</label></td>