Index: trunk/core/kernel/utility/http_query.php =================================================================== diff -u -r7635 -r8002 --- trunk/core/kernel/utility/http_query.php (.../http_query.php) (revision 7635) +++ trunk/core/kernel/utility/http_query.php (.../http_query.php) (revision 8002) @@ -131,7 +131,8 @@ switch ($current) { case 'G': $this->Get = $this->AddVars($_GET); - $this->processQueryString(); + $vars = $this->processQueryString( $this->Get(ENV_VAR_NAME) ); + $this->AddParams($vars); break; case 'P': @@ -162,7 +163,8 @@ } function AfterInit() { -// $this->processQueryString(); +// $vars = $this->processQueryString($this->Get(ENV_VAR_NAME)); +// $this->AddParams($vars); // $this->convertPostEvents(); // if ($this->Application->RewriteURLs()) { if ($this->Application->RewriteURLs() || $this->Get('_mod_rw_url_')) { @@ -278,11 +280,11 @@ function convertPostEvents() { $events = $this->Get('events'); - if( is_array($events) ) - { - foreach ($events as $prefix_special => $event_name) - { - if($event_name) $this->Set($prefix_special.'_event', $event_name); + if (is_array($events)) { + foreach ($events as $prefix_special => $event_name) { + if ($event_name) { + $this->Set($prefix_special.'_event', $event_name); + } } } } @@ -319,31 +321,28 @@ function extractSIDAndTemplate(&$parts) { - if ( defined('INPORTAL_ENV') && INPORTAL_ENV ) // SID-TEMPLATE - { + $vars = Array (); + if (defined('INPORTAL_ENV') && INPORTAL_ENV) { // SID-TEMPLATE $sub_parts = array_shift($parts); list($sid, $t) = explode('-', $sub_parts, 2); // Save Session ID - if($sid) - { + if ($sid) { $this->Set('sid', $sid); - $this->Get['sid'] = $sid; + $vars['sid'] = $sid; } - - // Save Template Name - $this->Set('t', $this->getDefaultTemplate($t) ); } - else // SID:TEMPLATE - { + else { // SID:TEMPLATE // Save Session ID $sid = array_shift($parts); - if ($sid) $this->Set('sid', $sid); + if ($sid) $vars['sid'] = $sid; - // Save Template Name $t = array_shift($parts); - $this->Set('t', $this->getDefaultTemplate($t) ); } + + // Save Template Name + $vars['t'] = $this->getDefaultTemplate($t); + return $vars; } /** @@ -354,31 +353,31 @@ * * @access private */ - function processQueryString() + function processQueryString($env_var) { // env=SID:TEMPLATE:m-1-1-1-1:l0-0-0:n-0-0-0:bb-0-0-1-1-1-0 - - $env_var = $this->Get(ENV_VAR_NAME); + $vars = Array (); if ($env_var) { // replace escaped ":" symbol not to explode by it $env_var = str_replace('\:','_&+$$+&_', $env_var); // replace escaped "=" with spec-chars :) $parts = explode(':', $env_var); if (!$this->Application->RewriteURLs() || ($this->Application->RewriteURLs() && $this->Get('rewrite') != 'on')) { - $this->extractSIDAndTemplate($parts); + $vars = $this->extractSIDAndTemplate($parts); } if ($parts) { foreach ($parts as $mixed_part) { - $this->parseEnvPart($mixed_part); + $vars = array_merge_recursive2($vars, $this->parseEnvPart($mixed_part)); } } } - else - { - $t=$this->getTemplateName('index'); - $this->Set('t', $t); + else { + $t = $this->getTemplateName('index'); + $vars['t'] = $t; } + + return $vars; } function parseEnvPart($mixed_part) @@ -398,42 +397,40 @@ $prefix_special = array_shift($mixed_part); // l.pick, l $query_map = $this->Application->EventManager->setQueryMap($prefix_special); - $this->Set('passed', implode(',', array_keys($this->Application->EventManager->queryMaps))); + + $vars = Array (); + $vars['passed'] = implode(',', array_keys($this->Application->EventManager->queryMaps)); // if config is not defined for prefix in QueryString, then don't process it if ($query_map) { - foreach($query_map as $index => $var_name) - { + foreach ($query_map as $index => $var_name) { // l_id, l_page, l_bla-bla-bla $val = $mixed_part[$index - 1]; if ($val == '') $val = false; - $this->Set($prefix_special.'_'.$var_name, $val); + $vars[$prefix_special.'_'.$var_name] = $val; } } + + return $vars; } /** - * Decides what template name to - * use from $_GET or from $_POST + * Removes tpl part from template name + resolved template ID to name * - * @param string $querystring_template + * @param string $t * @return string * @access private */ - function getTemplateName($querystring_template) + function getTemplateName($t) { - $t_from_post = $this->Get('t'); - $t = $t_from_post ? $t_from_post : $querystring_template; - - if ( is_numeric($t) ) - { - $t = $this->Conn->GetOne(' SELECT CONCAT(FilePath, \'/\', FileName) - FROM '.TABLE_PREFIX.'ThemeFiles - WHERE FileId = '.$t); + if (is_numeric($t)) { + $sql = 'SELECT CONCAT(FilePath, \'/\', FileName) + FROM '.TABLE_PREFIX.'ThemeFiles + WHERE FileId = '.$t; + $t = $this->Conn->GetOne($sql); } - $t = preg_replace('/\.tpl$/', '', $t); - return $t; + return preg_replace('/\.tpl$/', '', $t); } /**