Index: branches/5.2.x/core/kernel/utility/http_query.php =================================================================== diff -u -N -r14714 -r14904 --- branches/5.2.x/core/kernel/utility/http_query.php (.../http_query.php) (revision 14714) +++ branches/5.2.x/core/kernel/utility/http_query.php (.../http_query.php) (revision 14904) @@ -1,6 +1,6 @@ AddAllVars(); - $this->specialsToRemove = $this->Get('remove_specials'); - - if ( $this->specialsToRemove ) { - foreach ($this->specialsToRemove as $prefix_special => $flag) { - if ( $flag && strpos($prefix_special, '.') === false ) { - unset($this->specialsToRemove[$prefix_special]); - trigger_error('Incorrect usage of "remove_specials[' . $prefix_special . ']" field (no special found)', E_USER_NOTICE); - } - } - - $this->_Params = $this->removeSpecials($this->_Params); - } - - ini_set('magic_quotes_gpc', 0); - } - - /** * Discovers unit form request and returns it's QueryString option on success * * @param string $prefix_special @@ -219,7 +191,7 @@ * @return Array * @access protected */ - protected function removeSpecials($array) + protected function _removeSpecials($array) { $ret = Array (); $removed = false; @@ -231,33 +203,43 @@ foreach ($array as $key => $val) { $new_key = preg_match("/^" . $prefix . "[._]{1}" . $special . "(.*)/", $key, $regs) ? $prefix . $regs[1] : $key; - $ret[$new_key] = is_array($val) ? $this->removeSpecials($val) : $val; + $ret[$new_key] = is_array($val) ? $this->_removeSpecials($val) : $val; } } } return $removed ? $ret : $array; } + public function process() + { + $this->AddAllVars(); + $this->removeSpecials(); + ini_set('magic_quotes_gpc', 0); + + $this->AfterInit(); + } + /** * All all requested vars to * common storage place * - * @access private + * @return void + * @access protected */ - function AddAllVars() + protected function AddAllVars() { for ($i = 0; $i < strlen($this->Order); $i++) { - switch ( $this->Order[$i] ) { + switch ($this->Order[$i]) { case 'G': $this->Get = $this->AddVars($_GET); - if (array_key_exists('sid', $_GET)) { + if ( array_key_exists('sid', $_GET) ) { $this->_sidInQueryString = true; } - $vars = $this->Application->processQueryString( $this->Get(ENV_VAR_NAME) ); + $vars = $this->Application->processQueryString($this->Get(ENV_VAR_NAME)); - if (array_key_exists('sid', $vars)) { + if ( array_key_exists('sid', $vars) ) { // used by Session::GetPassedSIDValue $this->Get['sid'] = $vars['sid']; } @@ -321,16 +303,45 @@ } } - function AfterInit() + /** + * Removes requested specials from all request variables + * + * @return void + * @access protected + */ + protected function removeSpecials() { + $this->specialsToRemove = $this->Get('remove_specials'); + + if ( $this->specialsToRemove ) { + foreach ($this->specialsToRemove as $prefix_special => $flag) { + if ( $flag && strpos($prefix_special, '.') === false ) { + unset($this->specialsToRemove[$prefix_special]); + trigger_error('Incorrect usage of "remove_specials[' . $prefix_special . ']" field (no special found)', E_USER_NOTICE); + } + } + + $this->_Params = $this->_removeSpecials($this->_Params); + } + } + + /** + * Finishes initialization of kHTTPQuery class + * + * @return void + * @access protected + * TODO: only uses build-in rewrite listeners, when cache is build for the first time + */ + protected function AfterInit() + { $rewrite_url = $this->Get('_mod_rw_url_'); - if ($this->Application->RewriteURLs() || $rewrite_url) { + if ( $this->Application->RewriteURLs() || $rewrite_url ) { // maybe call onafterconfigread here $this->Application->UrlManager->initRewrite(); - if (defined('DEBUG_MODE') && $this->Application->isDebugMode()) { + if ( defined('DEBUG_MODE') && $this->Application->isDebugMode() ) { $this->Application->Debugger->profileStart('url_parsing', 'Parsing MOD_REWRITE url'); $this->Application->UrlManager->rewrite->parseRewriteURL(); $description = 'Parsing MOD_REWRITE url (template: ' . $this->Get('t') . ')'; Index: branches/5.2.x/core/kernel/application.php =================================================================== diff -u -N -r14880 -r14904 --- branches/5.2.x/core/kernel/application.php (.../application.php) (revision 14880) +++ branches/5.2.x/core/kernel/application.php (.../application.php) (revision 14904) @@ -1,6 +1,6 @@ HttpQuery =& $this->recallObject('HTTPQuery'); - $this->HttpQuery->AfterInit(); // TODO: only uses build-in rewrite listeners, when cache is build for the first time + $this->HttpQuery->process(); if ( defined('DEBUG_MODE') && $this->isDebugMode() ) { $this->Debugger->appendTimestamp('Processed HTTPQuery initial'); @@ -1222,8 +1222,9 @@ public function GetVarDirect($name, $type, $default = false) { // $type = ucfirst($type); + $array = $this->HttpQuery->$type; - return isset($this->HttpQuery->$type[$name]) ? $this->HttpQuery->$type[$name] : $default; + return isset($array[$name]) ? $array[$name] : $default; } /**