Index: trunk/core/kernel/parser/template.php =================================================================== diff -u -r2839 -r3031 --- trunk/core/kernel/parser/template.php (.../template.php) (revision 2839) +++ trunk/core/kernel/parser/template.php (.../template.php) (revision 3031) @@ -82,14 +82,21 @@ function SetThemePath() { - if ( defined('SPECIAL_TEMPLATES_FOLDER') ) { - safeDefine( 'THEMES_PATH', preg_replace('/'.preg_quote(rtrim(FULL_PATH, '/'), '/').'/i','',str_replace('\\', '/', FULL_PATH)). SPECIAL_TEMPLATES_FOLDER ); + if ( defined('SPECIAL_TEMPLATES_FOLDER') ) + { + $sub_folder = SPECIAL_TEMPLATES_FOLDER; } - else { + elseif( $this->Application->IsAdmin() ) + { + $sub_folder = '/admin/templates'; + } + else + { $current_theme = $this->Application->GetVar('m_theme'); - $folder = $this->Application->DB->GetOne('SELECT Name FROM '.TABLE_PREFIX.'Theme WHERE ThemeId = '.$current_theme); - safeDefine( 'THEMES_PATH', preg_replace('/'.preg_quote(rtrim(FULL_PATH, '/'), '/').'/i','',str_replace('\\', '/', FULL_PATH)). ( defined('ADMIN') ? '/admin/templates' : '/themes/'.$folder)); + $theme_folder = $this->Application->DB->GetOne('SELECT Name FROM '.TABLE_PREFIX.'Theme WHERE ThemeId = '.$current_theme); + $sub_folder = '/themes/'.$theme_folder; } + safeDefine('THEMES_PATH', $sub_folder); } function LoadTemplate($filename, $title=NULL, $silent=0) @@ -103,7 +110,7 @@ $module_filename = $filename; } - if ( defined('ADMIN') && ADMIN && in_array(strtolower($first_dir), $this->ModulesCache)) { + if ( $this->Application->IsAdmin() && in_array(strtolower($first_dir), $this->ModulesCache)) { $path = MODULES_PATH.'/'.strtolower($first_dir).'/admin_templates'; } else { @@ -126,7 +133,7 @@ $module_filename = $filename; } - if ( defined('ADMIN') && ADMIN && in_array(strtolower($first_dir), $this->ModulesCache)) { + if ( $this->Application->IsAdmin() && in_array(strtolower($first_dir), $this->ModulesCache)) { $path = MODULES_PATH.'/'.strtolower($first_dir).'/admin_templates'; } else {