- Timestamp:
- 08/27/10 23:01:58 (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/thememanager/controller/thememanager.admin.php
r4506 r4599 24 24 * 25 25 * @license GNU/GPL v2 or (at your option) any later version, see "/doc/LICENSE". 26 *27 26 * @author Jens-André Koch <vain@clansuite.com> 28 27 * @copyright Jens-André Koch (2005 - onwards) 29 *30 28 * @link http://www.clansuite.com 31 * @link http://gna.org/projects/32 29 * 33 30 * @version SVN: $Id: users.module.php 2634 2008-12-12 22:07:48Z vain $ … … 35 32 36 33 # Security Handler 37 if (defined('IN_CS') == false)34 if (defined('IN_CS') === false) 38 35 { 39 36 die('Clansuite not loaded. Direct Access forbidden.'); … … 47 44 * @subpackage Thememanager 48 45 */ 49 class Clansuite_Module_Thememanager_Admin extends Clansuite_Module_Controller implements Clansuite_Module_Interface46 class Clansuite_Module_Thememanager_Admin extends Clansuite_Module_Controller 50 47 { 51 public function initializeModule( Clansuite_HttpRequest $request, Clansuite_HttpResponse $response)48 public function initializeModule() 52 49 { 50 $this->getModuleConfig(); 53 51 } 54 52 … … 75 73 # loop through ROOT_THEMES dir 76 74 $dirs = new DirectoryIterator(ROOT_THEMES); 77 foreach ($dirs as $dir)75 foreach($dirs as $dir) 78 76 { 79 77 $i++; 80 78 81 79 # exclude .svn and core dir, take only dirs with theme_info.xml in it 82 if( (!$dir->isDot()) and ($dir != '.svn') and ($dir != 'core') and (is_file($dir->getPathName().DS.'theme_info.xml')))80 if((!$dir->isDot()) and ($dir != '.svn') and ($dir != 'core') and (is_file($dir->getPathName() . DS . 'theme_info.xml'))) 83 81 { 84 82 # add xml infos from file 85 $theme_info[$i] = self::parseThemeInformations($dir);83 $theme_info[$i] = self::parseThemeInformations($dir); 86 84 87 85 # add fullpath 88 $theme_info[$i]['fullpath' ]= $dir->getPathName();86 $theme_info[$i]['fullpath'] = $dir->getPathName(); 89 87 90 88 # add templatefilename … … 92 90 { 93 91 $theme_info[$i]['layouttpl'] = $theme_info[$i]['layoutfiles']['layoutfile']['@attributes']['tpl']; 94 $theme_info[$i]['layoutpath'] = $theme_info[$i]['fullpath'] .DS.$theme_info[$i]['layouttpl'];92 $theme_info[$i]['layoutpath'] = $theme_info[$i]['fullpath'] . DS . $theme_info[$i]['layouttpl']; 95 93 } 96 94 97 95 # add dirname 98 $theme_info[$i]['dirname'] = (string) $dir;96 $theme_info[$i]['dirname'] = (string) $dir; 99 97 100 98 # is this theme activated? 101 if( $this->config['template']['theme'] == $dir)99 if($this->moduleconfig['template']['theme'] == $dir) 102 100 { 103 $theme_info[$i]['activated'] = true;101 $theme_info[$i]['activated'] = true; 104 102 } 105 103 else 106 104 { 107 $theme_info[$i]['activated'] = false;105 $theme_info[$i]['activated'] = false; 108 106 } 109 107 110 108 # add preview image (preview_image should contain 2 files: [0]preview.img and [1]preview_thumb.img) 111 $preview_image = glob( ROOT_THEMES. $dir . DS . 'preview*.{jpg,png,gif,jpeg,JPG,PNG,GIF,JPEG}', GLOB_BRACE);109 $preview_image = glob(ROOT_THEMES . $dir . DS . 'preview*.{jpg,png,gif,jpeg,JPG,PNG,GIF,JPEG}', GLOB_BRACE); 112 110 113 111 # turn ROOT_THEMES path into WWW_ROOT 114 $preview_image = str_replace(ROOT_THEMES, WWW_ROOT_THEMES .'/', $preview_image);112 $preview_image = str_replace(ROOT_THEMES, WWW_ROOT_THEMES . '/', $preview_image); 115 113 116 114 # fix slashes 117 $preview_image = str_replace('\\', '/', $preview_image);115 $preview_image = str_replace('\\', '/', $preview_image); 118 116 119 if (is_array($preview_image) and (empty($preview_image) == false))117 if(is_array($preview_image) and (empty($preview_image) == false)) 120 118 { 121 $theme_info[$i]['preview_image'] = $preview_image[0]; # path to [0]preview119 $theme_info[$i]['preview_image'] = $preview_image[0]; # path to [0]preview 122 120 $theme_info[$i]['preview_thumbnail'] = $preview_image[1]; # path to [1]preview_thumb 123 121 } 124 122 else # show only nopreview.gif as thumbnail 125 126 123 { 127 $theme_info[$i]['preview_thumbnail'] = WWW_ROOT_THEMES .'/core/images/nopreview.jpg';124 $theme_info[$i]['preview_thumbnail'] = WWW_ROOT_THEMES . '/core/images/nopreview.jpg'; 128 125 } 129 126 } … … 131 128 132 129 # sort and return 133 asort ($theme_info);130 asort($theme_info); 134 131 return $theme_info; 135 132 } … … 146 143 147 144 # ensure we have simplexml available 148 if (false == function_exists('simplexml_load_file'))145 if(false == function_exists('simplexml_load_file')) 149 146 { 150 147 throw new Clansuite_Exception('Missing simplexml_load_file() function'); … … 156 153 157 154 # die in case we fetched no object 158 if (false === $themeinfos_XML_obj)155 if(false === $themeinfos_XML_obj) 159 156 { 160 throw new Clansuite_Exception('The Description File (' .$theme_info_file.') of the "'.$themedir.'" Theme is corrupted! Check it\'s XML Syntax and Structure.');157 throw new Clansuite_Exception('The Description File (' . $theme_info_file . ') of the "' . $themedir . '" Theme is corrupted! Check it\'s XML Syntax and Structure.'); 161 158 } 162 159
Note: See TracChangeset
for help on using the changeset viewer.
