diff --git a/application/models/AdminTheme.php b/application/models/AdminTheme.php index 48dd836c9d5..9df931b6c35 100644 --- a/application/models/AdminTheme.php +++ b/application/models/AdminTheme.php @@ -307,6 +307,7 @@ static private function getThemeList($sDir) { $bOldEntityLoaderState = libxml_disable_entity_loader(true); // @see: http://phpsecurity.readthedocs.io/en/latest/Injection-Attacks.html#xml-external-entity-injection $aListOfFiles = array(); + $oAdminTheme = new AdminTheme; if ($sDir && $pHandle = opendir($sDir)) { while (false !== ($file = readdir($pHandle))) { if (is_dir($sDir.DIRECTORY_SEPARATOR.$file) && is_file($sDir.DIRECTORY_SEPARATOR.$file.DIRECTORY_SEPARATOR.'config.xml')) { @@ -315,7 +316,11 @@ static private function getThemeList($sDir) // Simple Xml is buggy on PHP < 5.4. The [ array -> json_encode -> json_decode ] workaround seems to be the most used one. // @see: http://php.net/manual/de/book.simplexml.php#105330 (top comment on PHP doc for simplexml) $oTemplateConfig = json_decode(json_encode((array) simplexml_load_string($sXMLConfigFile), 1)); - $previewUrl = Yii::app()->getConfig('styleurl').$file; // NOTE: will not work with uploaded themes for now + if ($oAdminTheme->isStandardAdminTheme($file)) { + $previewUrl = Yii::app()->getConfig('styleurl').$file; + } else { + $previewUrl = Yii::app()->getConfig('uploadurl').DIRECTORY_SEPARATOR.'admintheme'.DIRECTORY_SEPARATOR.$file; + } $oTemplateConfig->path = $file; $oTemplateConfig->preview = 'admin theme preview'; $aListOfFiles[$file] = $oTemplateConfig;