Index: trunk/core/kernel/application.php =================================================================== diff -u -N -r4490 -r4524 --- trunk/core/kernel/application.php (.../application.php) (revision 4490) +++ trunk/core/kernel/application.php (.../application.php) (revision 4524) @@ -829,6 +829,34 @@ } /** + * Returns index file, that could be passed as parameter to method, as parameter to tag and as constant or not passed at all + * + * @param string $prefix + * @param string $index_file + * @param Array $params + * @return string + */ + function getIndexFile($prefix, $index_file, &$params) + { + if (isset($params['index_file'])) { + $index_file = $params['index_file']; + unset($params['index_file']); + return $index_file; + } + + if (isset($index_file)) { + return $index_file; + } + + if (defined('INDEX_FILE')) { + return INDEX_FILE; + } + + $cut_prefix = trim(BASE_PATH, '/').'/'.trim($prefix, '/'); + return trim(preg_replace('/'.preg_quote($cut_prefix, '/').'(.*)/', '\\1', $_SERVER['PHP_SELF']), '/'); + } + + /** * Return href for template * * @access public @@ -853,14 +881,9 @@ if ( $this->IsAdmin() && $prefix == '') $prefix = '/admin'; if ( $this->IsAdmin() && $prefix == '_FRONT_END_') $prefix = ''; - $index_file = isset($index_file) ? $index_file : (defined('INDEX_FILE') ? INDEX_FILE : basename($_SERVER['PHP_SELF'])); - - if( isset($params['index_file']) ) - { - $index_file = $params['index_file']; - unset($params['index_file']); - } - + + $index_file = $this->getIndexFile($prefix, $index_file, $params); + $ssl = isset($params['__SSL__']) ? $params['__SSL__'] : null; if ($ssl !== null) { $session =& $this->recallObject('Session');