Index: branches/5.1.x/core/kernel/utility/http_query.php =================================================================== diff -u -N -r12127 -r12657 --- branches/5.1.x/core/kernel/utility/http_query.php (.../http_query.php) (revision 12127) +++ branches/5.1.x/core/kernel/utility/http_query.php (.../http_query.php) (revision 12657) @@ -1,6 +1,6 @@ Get = $this->AddVars($_GET); + if (array_key_exists('sid', $_GET)) { + $this->_sidInQueryString = true; + } + $vars = $this->processQueryString( $this->Get(ENV_VAR_NAME) ); + + if (array_key_exists('sid', $vars)) { + // used by Session::GetPassedSIDValue + $this->Get['sid'] = $vars['sid']; + } + $this->AddParams($vars); break; @@ -221,15 +240,13 @@ // $this->convertPostEvents(); // if ($this->Application->RewriteURLs()) { if ($this->Application->RewriteURLs() || $this->Get('_mod_rw_url_')) { - if( $this->Application->isDebugMode() ) - { + if (defined('DEBUG_MODE') && $this->Application->isDebugMode()) { $this->Application->Debugger->profileStart('url_parsing'); $this->processRewriteURL(); $description = 'Parsing MOD_REWRITE url (template: '.$this->Get('t').')'; $this->Application->Debugger->profileFinish('url_parsing', $description); } - else - { + else { $this->processRewriteURL(); } } @@ -375,26 +392,19 @@ function extractSIDAndTemplate(&$parts) { $vars = Array (); - if (defined('INPORTAL_ENV') && INPORTAL_ENV) { // SID-TEMPLATE - $sub_parts = array_shift($parts); - list($sid, $t) = explode('-', $sub_parts, 2); + $sub_parts = array_shift($parts); + list ($sid, $t) = explode('-', $sub_parts, 2); + + if ($sid) { // Save Session ID - if ($sid) { - $this->Set('sid', $sid); - $vars['sid'] = $sid; - } + $this->Set('sid', $sid); + $vars['sid'] = $sid; } - else { // SID:TEMPLATE - // Save Session ID - $sid = array_shift($parts); - if ($sid) $vars['sid'] = $sid; - $t = array_shift($parts); - } - // Save Template Name $vars['t'] = $this->getDefaultTemplate($t); + return $vars; } @@ -493,7 +503,7 @@ */ function getTemplateName($t) { - if (isset($this->Get['t']) && $this->Get['t']) { + if (array_key_exists('t', $this->Get) && $this->Get['t']) { // template name is passed directly in url (GET method) $t = $this->Get['t']; } @@ -503,13 +513,6 @@ $t = $this->Get('t'); } - if (is_numeric($t)) { - $sql = 'SELECT CONCAT(FilePath, \'/\', FileName) - FROM '.TABLE_PREFIX.'ThemeFiles - WHERE FileId = '.$t; - $t = $this->Conn->GetOne($sql); - } - return preg_replace('/\.tpl$/', '', $t); } @@ -571,27 +574,33 @@ */ function getRedirectParams($access_error = false) { + $vars = $this->Get; $unset_vars = Array (ENV_VAR_NAME, 'rewrite', '_mod_rw_url_', 'Action'); - $ret = $this->Get; + if (!$this->_sidInQueryString) { + $unset_vars[] = 'sid'; + } + + // remove system variables foreach ($unset_vars as $var_name) { - if( isset($ret[$var_name]) ) { - unset( $ret[$var_name] ); + if (array_key_exists($var_name, $vars)) { + unset($vars[$var_name]); } } if ($access_error) { - $ret = $this->_removePassThroughVariables($ret); + $vars = $this->_removePassThroughVariables($vars); if ($this->Application->IsAdmin()) { // place 1 of 2 (also in UsersEventHandler::OnSessionExpire) - $ret['m_cat_id'] = 0; // category means nothing on admin login screen - $ret['m_wid'] = ''; // remove wid, otherwise parent window may add wid to its name breaking all the frameset (for targets) - $ret['pass'] = 'm'; // don't pass any other (except "m") prefixes to admin login template + $vars['m_cat_id'] = 0; // category means nothing on admin login screen + $vars['m_wid'] = ''; // remove wid, otherwise parent window may add wid to its name breaking all the frameset (for targets) + $vars['pass'] = 'm'; // don't pass any other (except "m") prefixes to admin login template } } - return $ret; + // transform arrays + return $this->_transformArrays($vars); } /** @@ -617,6 +626,23 @@ return $url_params; } + function _transformArrays($array, $level_prefix = '') + { + $ret = Array (); + foreach ($array as $var_name => $var_value) { + $new_var_name = $level_prefix ? $level_prefix . '[' . $var_name . ']' : $var_name; + + if (is_array($var_value)) { + $ret = array_merge($ret, $this->_transformArrays($var_value, $new_var_name)); + } + else { + $ret[$new_var_name] = $var_value; + } + } + + return $ret; + } + function writeRequestLog($filename) { $folder_path = dirname(FULL_PATH.'/'.$filename); @@ -653,6 +679,4 @@ } } -} - -?> \ No newline at end of file +} \ No newline at end of file