未验证 提交 fe765192 编写于 作者: Q qkqpttgf 提交者: GitHub

fix: some system can not edit config manually

上级 36df71a7
......@@ -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 '<pre>'. json_encode($envs, JSON_PRETTY_PRINT).'</pre>';
$prestr = '<?php $configs = \'
';
$aftstr = '
\';';
$prestr = '<?php $configs = \'' . PHP_EOL;
$aftstr = PHP_EOL . '\';';
return file_put_contents('config.php', $prestr . json_encode($envs, JSON_PRETTY_PRINT) . $aftstr);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册