From fe765192e14add7187417fb7e294c60305a096d9 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Fri, 21 Aug 2020 14:35:07 +0800 Subject: [PATCH] fix: some system can not edit config manually --- platform/Normal.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/platform/Normal.php b/platform/Normal.php index 124bc3c..3b28d53 100644 --- a/platform/Normal.php +++ b/platform/Normal.php @@ -9,7 +9,8 @@ function getpath() if ($p>0) $path = substr($_SERVER['REQUEST_URI'], 0, $p); else $path = $_SERVER['REQUEST_URI']; $path = path_format( substr($path, strlen($_SERVER['base_path'])) ); - return substr($path, 1); + return $path; + //return substr($path, 1); //return spurlencode($path, '/'); } @@ -44,7 +45,8 @@ function getConfig($str, $disktag = '') global $Base64Env; //include 'config.php'; $s = file_get_contents('config.php'); - $configs = substr($s, 18, -2); + //$configs = substr($s, 18, -2); + $configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}'; if ($configs!='') { $envs = json_decode($configs, true); if (in_array($str, $InnerEnv)) { @@ -70,7 +72,8 @@ function setConfig($arr, $disktag = '') if ($disktag=='') $disktag = $_SERVER['disktag']; //include 'config.php'; $s = file_get_contents('config.php'); - $configs = substr($s, 18, -2); + //$configs = substr($s, 18, -2); + $configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}'; if ($configs!='') $envs = json_decode($configs, true); $disktags = explode("|",getConfig('disktag')); $indisk = 0; @@ -107,10 +110,8 @@ function setConfig($arr, $disktag = '') $envs = array_filter($envs, 'array_value_isnot_null'); ksort($envs); //echo '
'. json_encode($envs, JSON_PRETTY_PRINT).'
'; - $prestr = '