Ignore:
Timestamp:
08/27/10 23:01:58 (21 months ago)
Author:
vain
Message:
  • minor change to all security constant checks
  • fixed the non rewrite routing
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/thememanager/controller/thememanager.admin.php

    r4506 r4599  
    2424    * 
    2525    * @license    GNU/GPL v2 or (at your option) any later version, see "/doc/LICENSE". 
    26     * 
    2726    * @author     Jens-André Koch <vain@clansuite.com> 
    2827    * @copyright  Jens-André Koch (2005 - onwards) 
    29     * 
    3028    * @link       http://www.clansuite.com 
    31     * @link       http://gna.org/projects/ 
    3229    * 
    3330    * @version    SVN: $Id: users.module.php 2634 2008-12-12 22:07:48Z vain $ 
     
    3532 
    3633# Security Handler 
    37 if (defined('IN_CS') == false) 
     34if (defined('IN_CS') === false) 
    3835{ 
    3936    die('Clansuite not loaded. Direct Access forbidden.'); 
     
    4744 * @subpackage  Thememanager 
    4845 */ 
    49 class Clansuite_Module_Thememanager_Admin extends Clansuite_Module_Controller implements Clansuite_Module_Interface 
     46class Clansuite_Module_Thememanager_Admin extends Clansuite_Module_Controller 
    5047{ 
    51     public function initializeModule(Clansuite_HttpRequest $request, Clansuite_HttpResponse $response) 
     48    public function initializeModule() 
    5249    { 
     50        $this->getModuleConfig(); 
    5351    } 
    5452 
     
    7573        # loop through ROOT_THEMES dir 
    7674        $dirs = new DirectoryIterator(ROOT_THEMES); 
    77         foreach ($dirs as $dir) 
     75        foreach($dirs as $dir) 
    7876        { 
    7977            $i++; 
    8078 
    8179            # 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'))) 
    8381            { 
    8482                # add xml infos from file 
    85                 $theme_info[$i]               = self::parseThemeInformations($dir); 
     83                $theme_info[$i] = self::parseThemeInformations($dir); 
    8684 
    8785                # add fullpath 
    88                 $theme_info[$i]['fullpath' ] = $dir->getPathName(); 
     86                $theme_info[$i]['fullpath'] = $dir->getPathName(); 
    8987 
    9088                # add templatefilename 
     
    9290                { 
    9391                    $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']; 
    9593                } 
    9694 
    9795                # add dirname 
    98                 $theme_info[$i]['dirname']    = (string) $dir; 
     96                $theme_info[$i]['dirname'] = (string) $dir; 
    9997 
    10098                # is this theme activated? 
    101                 if( $this->config['template']['theme'] == $dir ) 
     99                if($this->moduleconfig['template']['theme'] == $dir) 
    102100                { 
    103                     $theme_info[$i]['activated']  = true; 
     101                    $theme_info[$i]['activated'] = true; 
    104102                } 
    105103                else 
    106104                { 
    107                     $theme_info[$i]['activated']  = false; 
     105                    $theme_info[$i]['activated'] = false; 
    108106                } 
    109107 
    110108                # 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); 
    112110 
    113111                # 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); 
    115113 
    116114                # fix slashes 
    117                 $preview_image = str_replace('\\','/', $preview_image); 
     115                $preview_image = str_replace('\\', '/', $preview_image); 
    118116 
    119                 if ( is_array($preview_image) and (empty($preview_image) == false)) 
     117                if(is_array($preview_image) and (empty($preview_image) == false)) 
    120118                { 
    121                     $theme_info[$i]['preview_image']     = $preview_image[0];  # path to [0]preview 
     119                    $theme_info[$i]['preview_image'] = $preview_image[0];  # path to [0]preview 
    122120                    $theme_info[$i]['preview_thumbnail'] = $preview_image[1];  # path to [1]preview_thumb 
    123121                } 
    124122                else # show only nopreview.gif as thumbnail 
    125  
    126123                { 
    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'; 
    128125                } 
    129126            } 
     
    131128 
    132129        # sort and return 
    133         asort ($theme_info); 
     130        asort($theme_info); 
    134131        return $theme_info; 
    135132    } 
     
    146143 
    147144        # ensure we have simplexml available 
    148         if (false == function_exists('simplexml_load_file') ) 
     145        if(false == function_exists('simplexml_load_file')) 
    149146        { 
    150147            throw new Clansuite_Exception('Missing simplexml_load_file() function'); 
     
    156153 
    157154        # die in case we fetched no object 
    158         if (false === $themeinfos_XML_obj) 
     155        if(false === $themeinfos_XML_obj) 
    159156        { 
    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.'); 
    161158        } 
    162159 
Note: See TracChangeset for help on using the changeset viewer.