Index: kernel/utility/http_query.php =================================================================== --- kernel/utility/http_query.php (revision 15158) +++ kernel/utility/http_query.php (working copy) @@ -466,13 +466,6 @@ $mod_rw_helper->processRewriteURL(); } - function getDefaultTemplate($t) - { - $t = $this->getTemplateName( trim($t, '/') ); - if (!$t) $t = 'index'; - return trim($t, '/'); - } - function extractSIDAndTemplate(&$parts) { $vars = Array (); @@ -487,7 +480,7 @@ } // Save Template Name - $vars['t'] = $this->getDefaultTemplate($t); + $vars['t'] = $this->getTemplateName($t); return $vars; } @@ -532,7 +525,7 @@ } } else { - $t = $this->getTemplateName('index'); + $t = $this->getTemplateName(); $vars['t'] = $t; } @@ -581,23 +574,25 @@ /** * Removes tpl part from template name + resolved template ID to name * - * @param string $t + * @param string $default_template * @return string - * @access private + * @access public */ - function getTemplateName($t) + function getTemplateName($default_template = '') { - if (array_key_exists('t', $this->Get) && $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']; } - - // if t was set through env, even in mod_rewrite mode! - if ($this->Get('env') && $this->Application->RewriteURLs() && $this->Get('t')) { + elseif ( $this->Get('env') && $this->Application->RewriteURLs() && $this->Get('t') ) { + // if t was set through env, even in mod_rewrite mode! $t = $this->Get('t'); } + else { + $t = trim($default_template ? $default_template : 'index', '/'); + } - return preg_replace('/\.tpl$/', '', $t); + return trim(preg_replace('/\.tpl$/', '', $t), '/'); } /** Index: units/helpers/mod_rewrite_helper.php =================================================================== --- units/helpers/mod_rewrite_helper.php (revision 15158) +++ units/helpers/mod_rewrite_helper.php (working copy) @@ -237,13 +237,10 @@ if ( !$url_parts ) { $this->InitAll(); - $vars['t'] = $this->HTTPQuery->getDefaultTemplate(''); + $vars['t'] = $this->HTTPQuery->getTemplateName(); return $vars; } - else { - $vars['t'] = ''; - } $this->_parseLanguage($url_parts, $vars); $this->_parseTheme($url_parts, $vars);