From 1920d57d3afc446b2548bb58e2b26dacf9c9e1d3 Mon Sep 17 00:00:00 2001 From: pengjiangxiu Date: Thu, 22 Jun 2017 13:35:16 +0800 Subject: [PATCH] * Adjust filter and framework --- config/filter.php | 3 +++ framework/base/helper.class.php | 5 ++--- framework/base/router.class.php | 4 ++-- www/install.php.tmp | 1 - 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/config/filter.php b/config/filter.php index 1f779e1fb8..f146ba2068 100644 --- a/config/filter.php +++ b/config/filter.php @@ -22,6 +22,9 @@ $filter->default->paramValue = 'reg::paramValue'; $filter->default->get['onlybody'] = 'equal::yes'; $filter->default->get['HTTP_X_REQUESTED_WITH'] = 'equal::XMLHttpRequest'; +$filter->default->cookie['lang'] = 'reg::lang'; +$filter->default->cookie['theme'] = 'reg::word'; + $filter->bug = new stdclass(); $filter->doc = new stdclass(); $filter->product = new stdclass(); diff --git a/framework/base/helper.class.php b/framework/base/helper.class.php index 26769396ac..9066ccc455 100644 --- a/framework/base/helper.class.php +++ b/framework/base/helper.class.php @@ -713,10 +713,9 @@ function getWebRoot($full = false) return $http . $_SERVER['HTTP_HOST'] . substr($path, 0, (strrpos($path, '/') + 1)); } - $path = dirname(dirname($path)); + $path = substr($path, 0, (strrpos($path, '/') + 1)); $path = str_replace('\\', '/', $path); - if($path == '/') return '/'; - return $path . '/'; + return $path; } /** diff --git a/framework/base/router.class.php b/framework/base/router.class.php index 5f30e83aba..494b62ed4c 100644 --- a/framework/base/router.class.php +++ b/framework/base/router.class.php @@ -1061,9 +1061,9 @@ class baseRouter { $value = $_SERVER['ORIG_PATH_INFO']; } - elseif(isset($_SERVER['REQUEST_URI'])) + elseif(isset($this->URI)) { - $value = htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES); + $value = $this->URI; $subpath = str_replace($_SERVER['DOCUMENT_ROOT'], '', dirname($_SERVER['SCRIPT_FILENAME'])); if($subpath != '/') $subpath = '/' . $subpath; if($subpath != '' and $subpath != '/' and strpos($value, $subpath) === 0) $value = substr($value, strlen($subpath)); diff --git a/www/install.php.tmp b/www/install.php.tmp index 04596f2d31..6d7e9fdfd1 100644 --- a/www/install.php.tmp +++ b/www/install.php.tmp @@ -10,7 +10,6 @@ * @link http://www.zentao.net */ error_reporting(0); -session_start(); define('IN_INSTALL', true); /* Load the framework. */