Index: main_processor.php =================================================================== --- main_processor.php (revision 15158) +++ main_processor.php (working copy) @@ -508,24 +508,47 @@ // for tabs function is_active($params) { - $test_templ = $this->SelectParam($params, 'templ,template,t'); - if ( !getArrayValue($params,'allow_empty') ) - { - $if_true=getArrayValue($params,'true') ? $params['true'] : 1; - $if_false=getArrayValue($params,'false') ? $params['false'] : 0; + $test_templ = $this->SelectParam($params, 'templ,template,t'); + + if ( !getArrayValue($params, 'allow_empty') ) { + $if_true = getArrayValue($params, 'true') ? $params['true'] : 1; + $if_false = getArrayValue($params, 'false') ? $params['false'] : 0; } - else - { - $if_true=$params['true']; - $if_false=$params['false']; + else { + $if_true = $params['true']; + $if_false = $params['false']; } - if ( preg_match("/^".str_replace('/', '\/', $test_templ)."/i", $this->Application->GetVar('t'))) { - return $if_true; + $physical_template = $this->_getPhysicalTemplate($this->Application->GetVar('t')); + + return preg_match('/^' . str_replace('/', '\/', $test_templ) . '/i', $physical_template) ? $if_true : $if_false; + } + + /** + * Returns theme template filename and it's corresponding page_id based on given seo template + * + * Copy from kUrlManager::getPhysicalTemplate in 5.2.0 version + * + * @param string $seo_template + * @return string + * @access public + */ + public function _getPhysicalTemplate($seo_template) + { + $physical_template = array_search($seo_template, $this->Application->structureTemplateMapping); + + if ( $physical_template === false ) { + return false; } - else { - return $if_false; + + if ( substr($physical_template, 0, 3) == 'id:' ) { + // virtual templates have same path + return $seo_template; } + + list ($physical_template,) = explode(':', $physical_template, 2); // template_path:theme_id => seo_template + + return $physical_template; } function IsNotActive($params)