getTraceAsString(),Log::ERR); // } } } static public function clear_server() { $fields = self::SRV_PARAMS(); foreach ($fields as $field) { unset($_SERVER[$field]); } } static public function fill_param() { $method = strtolower(request_helper::method()); if(!array_key_exists('act',$_GET)) { $_GET['act'] = 'index'; } if(!array_key_exists('op',$_GET)) { $_GET['op'] = 'index'; } if(!array_key_exists('act',$_POST)) { $_POST['act'] = 'index'; } if(!array_key_exists('op',$_POST)) { $_POST['op'] = 'index'; } if ($method == 'get') { $squery = request_helper::query_string(); } else { $squery = request_helper::content(); } if ($squery == '') { return; } else { $_SERVER['original_querystring'] = $squery; } $params = preg_split('/&|=/', $squery); if ($method == 'get' || $method == 'post') { for ($i = 0; $i < count($params); ++$i) { $key = $params[$i]; $val = $params[++$i]; $_GET[$key] = $val; $_POST[$key] = $val; } } } } function init_request() { request_helper::fill_server(); request_helper::fill_param(); } class local_request { private $script_file; private $query_string; private $method; public function __construct($uri) { $param = parse_url($uri); $this->script_file = BASE_ROOT_PATH . $param['path']; $this->query_string = $param['query']; $this->method = 'GET'; } public function script_file() { return $this->script_file; } public function query_string() { return $this->query_string; } public function method() { return $this->method; } } function init_localreq(local_request $req) { $squery = $req->query_string(); $params = preg_split('/&|=/', $squery); $method = strtolower($req->method()); if ($method == 'get' || $method == 'post') { for ($i = 0; $i < count($params); ++$i) { $key = $params[$i]; $val = $params[++$i]; $_GET[$key] = $val; $_POST[$key] = $val; } } }