some config can input Special symbols now

pull/31/head
qkqpttgf 2020-02-29 12:54:20 +08:00 committed by GitHub
parent 4a16b62812
commit 9bf3969242
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 6 deletions

View File

@ -39,6 +39,7 @@ function getGET()
function getConfig($str, $disktag = '') function getConfig($str, $disktag = '')
{ {
global $InnerEnv; global $InnerEnv;
global $Base64Env;
//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');
@ -46,8 +47,12 @@ function getConfig($str, $disktag = '')
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 (in_array($str, $Base64Env)) return base64_decode(equal_replace($envs[$disktag][$str],1));
} else if (isset($envs[$str])) return $envs[$str]; else return $envs[$disktag][$str];
} else {
if (in_array($str, $Base64Env)) return base64_decode(equal_replace($envs[$str],1));
else return $envs[$str];
}
} }
return ''; return '';
} }
@ -55,6 +60,7 @@ function getConfig($str, $disktag = '')
function setConfig($arr, $disktag = '') function setConfig($arr, $disktag = '')
{ {
global $InnerEnv; global $InnerEnv;
global $Base64Env;
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');
@ -65,7 +71,8 @@ function setConfig($arr, $disktag = '')
$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; if (in_array($k, $Base64Env)) $envs[$disktag][$k] = equal_replace(base64_encode($v));
else $envs[$disktag][$k] = $v;
/*$diskconfig[$k] = $v; /*$diskconfig[$k] = $v;
$indisk = 1;*/ $indisk = 1;*/
} elseif ($k=='disktag_add') { } elseif ($k=='disktag_add') {
@ -76,7 +83,8 @@ function setConfig($arr, $disktag = '')
$envs[$v] = ''; $envs[$v] = '';
$operatedisk = 1; $operatedisk = 1;
} else { } else {
$envs[$k] = $v; if (in_array($k, $Base64Env)) $tmp[$k] = equal_replace(base64_encode($v));
else $tmp[$k] = $v;
} }
} }
/*if ($indisk) { /*if ($indisk) {
@ -171,8 +179,7 @@ function get_refresh_token()
$tmp['Onedrive_ver'] = $_POST['Onedrive_ver']; $tmp['Onedrive_ver'] = $_POST['Onedrive_ver'];
if ($_POST['Onedrive_ver']=='MSC') { if ($_POST['Onedrive_ver']=='MSC') {
$tmp['client_id'] = $_POST['client_id']; $tmp['client_id'] = $_POST['client_id'];
$tmp['client_secret'] = equal_replace(base64_encode($_POST['client_secret'])); $tmp['client_secret'] = $_POST['client_secret'];
//$_POST['client_secret'];
} }
$response = setConfig($tmp, $_COOKIE['disktag']); $response = setConfig($tmp, $_COOKIE['disktag']);
$title = getconstStr('MayinEnv'); $title = getconstStr('MayinEnv');