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 = '