Index: branches/5.1.x/core/kernel/nparser/template_cache.php =================================================================== diff -u -N -r13086 -r13113 --- branches/5.1.x/core/kernel/nparser/template_cache.php (.../template_cache.php) (revision 13086) +++ branches/5.1.x/core/kernel/nparser/template_cache.php (.../template_cache.php) (revision 13113) @@ -1,6 +1,6 @@ Application->ModuleInfo as $module_name => $module_info) { - $module_paths[$module_name] = rtrim($module_info['Path'], '/'); + $module_paths[ mb_strtolower($module_name) ] = rtrim($module_info['Path'], '/'); } $this->_modulePaths = $module_paths; @@ -84,15 +84,16 @@ function GetTemplatePaths($filename) { if ($this->Application->isAdmin && array_key_exists($filename, $this->Application->ReplacementTemplates)) { + // process admin template replacement $filename = $this->Application->ReplacementTemplates[$filename]; } // allows to use non-replaced version of replaced template $filename = preg_replace('/^original:(.*)/', '\\1', $filename); if (preg_match('#^[\/]{0,1}([^\/]*)\/(.*)#', $filename, $regs)) { - $module_filename = $regs[2]; $first_dir = $regs[1]; + $module_filename = $regs[2]; } else { $first_dir = ''; @@ -104,31 +105,18 @@ $first_dir = 'theme:' . $this->forceThemeName . ($first_dir ? '/' . $first_dir : ''); } - // !preg_match for backward compatability with full-path plugins - if ($this->Application->isAdmin && ($first_dir == 'plugins') && !preg_match('/admin_templates/', $module_filename)) { - if (preg_match('#^[\/]{0,1}([^\/]*)\/(.*)#', $module_filename, $regs)) {; - $path = MODULES_PATH.'/'.mb_strtolower($first_dir).'/'.$regs[1].'/admin_templates'; - $module_filename = $regs[2]; - } - else { - $first_dir = ''; - $module_filename = $filename; - } + if ($this->Application->isAdmin && array_key_exists($first_dir, $this->_modulePaths)) { + // template belongs to one of the modules + $path = FULL_PATH . '/' . $this->_modulePaths[$first_dir] . '/admin_templates'; } - elseif ($this->Application->isAdmin && in_array($first_dir, $this->_modulePaths)) { - // $this->Application->findModule('Name', $first_dir) - /*if ($first_dir == 'in-portal') { - $first_dir = 'kernel'; - }*/ - $path = MODULES_PATH.'/'.mb_strtolower($first_dir).'/admin_templates'; - } elseif ($this->forceThemeName && preg_match('/^theme:(.*)/', $first_dir, $regs)) { // ability to use Front-End templates in admin (only during mass compilation) $path = FULL_PATH . '/themes/' . $regs[1]; } else { + // template from "core" module $path = $this->BasePath; - $module_filename = $first_dir.'/'.$module_filename; + $module_filename = $first_dir . '/' . $module_filename; } return Array ($path, $module_filename);