some config can input Special symbols now

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

View File

@ -40,16 +40,20 @@ function getGET()
function getConfig($str, $disktag = '') function getConfig($str, $disktag = '')
{ {
global $InnerEnv; global $InnerEnv;
global $Base64Env;
if ($disktag=='') $disktag = $_SERVER['disktag']; if ($disktag=='') $disktag = $_SERVER['disktag'];
if (in_array($str, $InnerEnv)) { if (in_array($str, $InnerEnv)) {
return json_decode(getenv($disktag), true)[$str]; if (in_array($str, $Base64Env)) return base64_decode(equal_replace(json_decode(getenv($disktag), true)[$str],1));
else return json_decode(getenv($disktag), true)[$str];
} }
return getenv($str); if (in_array($str, $Base64Env)) return base64_decode(equal_replace(getenv($str),1));
else return getenv($str);
} }
function setConfig($arr, $disktag = '') function setConfig($arr, $disktag = '')
{ {
global $InnerEnv; global $InnerEnv;
global $Base64Env;
if ($disktag=='') $disktag = $_SERVER['disktag']; if ($disktag=='') $disktag = $_SERVER['disktag'];
$disktags = explode("|",getConfig('disktag')); $disktags = explode("|",getConfig('disktag'));
$diskconfig = json_decode(getenv($disktag), true); $diskconfig = json_decode(getenv($disktag), true);
@ -58,7 +62,8 @@ function setConfig($arr, $disktag = '')
$oparetdisk = 0; $oparetdisk = 0;
foreach ($arr as $k => $v) { foreach ($arr as $k => $v) {
if (in_array($k, $InnerEnv)) { if (in_array($k, $InnerEnv)) {
$diskconfig[$k] = $v; if (in_array($k, $Base64Env)) $diskconfig[$k] = equal_replace(base64_encode($v));
else $diskconfig[$k] = $v;
$indisk = 1; $indisk = 1;
} elseif ($k=='disktag_add') { } elseif ($k=='disktag_add') {
array_push($disktags, $v); array_push($disktags, $v);
@ -68,7 +73,8 @@ function setConfig($arr, $disktag = '')
$tmp[$v] = ''; $tmp[$v] = '';
$oparetdisk = 1; $oparetdisk = 1;
} else { } else {
$tmp[$k] = $v; if (in_array($k, $Base64Env)) $tmp[$k] = equal_replace(base64_encode($v));
else $tmp[$k] = $v;
} }
} }
if ($indisk) { if ($indisk) {
@ -158,7 +164,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']; //$_POST['client_secret'];
} }
$response = json_decode( setConfig($tmp, $_COOKIE['disktag']), true )['Response']; $response = json_decode( setConfig($tmp, $_COOKIE['disktag']), true )['Response'];