fix bug: special tag

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

View File

@ -38,14 +38,14 @@ function getGET()
function getConfig($str, $disktag = '') function getConfig($str, $disktag = '')
{ {
global $innerEnv; global $InnerEnv;
//include 'config.php'; //include 'config.php';
if ($disktag=='') $disktag = $_SERVER['disktag']; if ($disktag=='') $disktag = $_SERVER['disktag'];
$s = file_get_contents('config.php'); $s = file_get_contents('config.php');
$configs = substr($s, 18, -2); $configs = substr($s, 18, -2);
if ($configs!='') { if ($configs!='') {
$envs = json_decode($configs, true); $envs = json_decode($configs, true);
if (in_array($str, $innerEnv)) { if (in_array($str, $InnerEnv)) {
if (isset($envs[$disktag][$str])) return $envs[$disktag][$str]; if (isset($envs[$disktag][$str])) return $envs[$disktag][$str];
} else if (isset($envs[$str])) return $envs[$str]; } else if (isset($envs[$str])) return $envs[$str];
} }
@ -54,7 +54,7 @@ function getConfig($str, $disktag = '')
function setConfig($arr, $disktag = '') function setConfig($arr, $disktag = '')
{ {
global $innerEnv; global $InnerEnv;
if ($disktag=='') $disktag = $_SERVER['disktag']; if ($disktag=='') $disktag = $_SERVER['disktag'];
//include 'config.php'; //include 'config.php';
$s = file_get_contents('config.php'); $s = file_get_contents('config.php');
@ -64,7 +64,7 @@ function setConfig($arr, $disktag = '')
//$indisk = 0; //$indisk = 0;
$operatedisk = 0; $operatedisk = 0;
foreach ($arr as $k => $v) { foreach ($arr as $k => $v) {
if (in_array($k, $innerEnv)) { if (in_array($k, $InnerEnv)) {
$envs[$disktag][$k] = $v; $envs[$disktag][$k] = $v;
/*$diskconfig[$k] = $v; /*$diskconfig[$k] = $v;
$indisk = 1;*/ $indisk = 1;*/
@ -103,6 +103,8 @@ function setConfig($arr, $disktag = '')
function get_refresh_token() function get_refresh_token()
{ {
global $constStr; global $constStr;
global $CommonEnv;
foreach ($CommonEnv as $env) $envs .= '\'' . $env . '\', ';
$url = path_format($_SERVER['PHP_SELF'] . '/'); $url = path_format($_SERVER['PHP_SELF'] . '/');
if ($_GET['authorization_code'] && isset($_GET['code'])) { if ($_GET['authorization_code'] && isset($_GET['code'])) {
$_SERVER['disktag'] = $_COOKIE['disktag']; $_SERVER['disktag'] = $_COOKIE['disktag'];
@ -160,6 +162,9 @@ function get_refresh_token()
} }
if ($_GET['install0']) { if ($_GET['install0']) {
if ($_POST['disktag_add']!='' && ($_POST['Onedrive_ver']=='MS' || $_POST['Onedrive_ver']=='CN' || $_POST['Onedrive_ver']=='MSC')) { 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']; $_SERVER['disktag'] = $_COOKIE['disktag'];
$tmp['disktag_add'] = $_POST['disktag_add']; $tmp['disktag_add'] = $_POST['disktag_add'];
$tmp['diskname'] = $_POST['diskname']; $tmp['diskname'] = $_POST['diskname'];
@ -211,6 +216,11 @@ Can not write config to file.<br>
alert(\'Input Disk Tag\'); alert(\'Input Disk Tag\');
return false; 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})$/; var reg = /^[a-zA-Z]([-_a-zA-Z0-9]{1,20})$/;
if (!reg.test(t.disktag_add.value)) { if (!reg.test(t.disktag_add.value)) {
alert(\''.getconstStr('TagFormatAlert').'\'); alert(\''.getconstStr('TagFormatAlert').'\');
@ -313,11 +323,10 @@ function RewriteEngineOn()
function EnvOpt($function_name, $needUpdate = 0) function EnvOpt($function_name, $needUpdate = 0)
{ {
global $constStr; global $constStr;
global $commonEnv; global $ShowedCommonEnv;
global $innerEnv; global $ShowedInnerEnv;
global $ShowedinnerEnv; asort($ShowedCommonEnv);
asort($commonEnv); asort($ShowedInnerEnv);
asort($ShowedinnerEnv);
$html = '<title>OneManager '.getconstStr('Setup').'</title>'; $html = '<title>OneManager '.getconstStr('Setup').'</title>';
/*if ($_POST['updateProgram']==getconstStr('updateProgram')) { /*if ($_POST['updateProgram']==getconstStr('updateProgram')) {
$response = json_decode(updataProgram($function_name, $Region, $namespace), true)['Response']; $response = json_decode(updataProgram($function_name, $Region, $namespace), true)['Response'];
@ -339,7 +348,7 @@ namespace:' . $namespace . '<br>
if ($_POST['submit1']) { if ($_POST['submit1']) {
$_SERVER['disk_oprating'] = ''; $_SERVER['disk_oprating'] = '';
foreach ($_POST as $k => $v) { 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; $tmp[$k] = $v;
} }
if ($k == 'disk') $_SERVER['disk_oprating'] = $v; if ($k == 'disk') $_SERVER['disk_oprating'] = $v;
@ -384,7 +393,7 @@ namespace:' . $namespace . '<br>
<tr> <tr>
<td colspan="2">'.getconstStr('PlatformConfig').'</td> <td colspan="2">'.getconstStr('PlatformConfig').'</td>
</tr>'; </tr>';
foreach ($commonEnv as $key) { foreach ($ShowedCommonEnv as $key) {
if ($key=='language') { if ($key=='language') {
$html .= ' $html .= '
<tr> <tr>
@ -453,7 +462,7 @@ namespace:' . $namespace . '<br>
$html .= ' $html .= '
<form name="'.$disktag.'" action="" method="post"> <form name="'.$disktag.'" action="" method="post">
<input type="hidden" name="disk" value="'.$disktag.'">'; <input type="hidden" name="disk" value="'.$disktag.'">';
foreach ($ShowedinnerEnv as $key) { foreach ($ShowedInnerEnv as $key) {
$html .= ' $html .= '
<tr> <tr>
<td><label>' . $key . '</label></td> <td><label>' . $key . '</label></td>