diff --git a/application/controllers/admin/templates.php b/application/controllers/admin/templates.php index c266f50aad0..768cb6c93c7 100644 --- a/application/controllers/admin/templates.php +++ b/application/controllers/admin/templates.php @@ -1131,26 +1131,7 @@ protected function _initialise($templatename, $screenname, $editfile, $showsumma $files = array(0=>$files); } - - // Get list of 'otherfiles' - // We can't use $oTemplate->otherFiles, because of retrocompatibility with 2.06 template and the big mess of it mixing files - $filesdir = ($oEditedTemplate->filesPath!='')?$oEditedTemplate->filesPath:$templatedir . '../files'; - - $otherfiles = array(); - if ( file_exists($filesdir) && $handle = opendir($filesdir)) - { - while (false !== ($file = readdir($handle))) - { - if (!array_search($file, $normalfiles)) { - if (!is_dir($templatedir . DIRECTORY_SEPARATOR . $file)) { - $otherfiles[] = $file; - } - } - } - - closedir($handle); - } - + $otherfiles = $oEditedTemplate->getOtherFiles(); $editfile = (empty($editfile))?$sLayoutFile:$editfile; $sEditfile = $oEditedTemplate->getFilePathForEdition($editfile, array_merge($files, $aCssAndJsfiles)); diff --git a/application/models/TemplateManifest.php b/application/models/TemplateManifest.php index 31854764345..51870a570a2 100644 --- a/application/models/TemplateManifest.php +++ b/application/models/TemplateManifest.php @@ -228,6 +228,24 @@ public function getTemplateForFile($sFile, $oRTemplate) return $oRTemplate; } + public function getOtherFiles() + { + $otherfiles = array(); + if ( file_exists($this->filesPath) && $handle = opendir($this->filesPath)) + { + while (false !== ($file = readdir($handle))) + { + if (!array_search($file, array("DUMMYENTRY", ".", "..", "preview.png"))) { + if (!is_dir($this->viewPath . DIRECTORY_SEPARATOR . $file)) { + $otherfiles[] = $file; + } + } + } + + closedir($handle); + } + return $otherfiles; + } /** * Update the config file of a given template so that it extends another one