Changeset 5


Ignore:
Timestamp:
Mar 31, 2007, 5:53:43 PM (11 years ago)
Author:
julian
Message:
  • began to correct variable names
  • new core module (removed dependencies)
  • new template module (now based on module template)
Location:
trunk
Files:
1 added
2 deleted
18 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/config/Core.config.class.php

    r2 r5  
    22
    33class CoreConfig extends ConfigTemplate {
    4     protected $Config = array(
    5         'IndexFile'=>'index.php',
    6         'DefaultAction'=>'ForumIndex',
    7         'AllowedActions'=>array(
     4    protected $config = array(
     5        'indexFile'=>'index.php',
     6        'defaultAction'=>'ForumIndex',
     7        'enableOutputCompression'=>TRUE,
     8        'allowedActions'=>array(
    89            'Ajax',
    910            'EditProfile',
  • trunk/config/DB.config.class.php

    r2 r5  
    22
    33class DBConfig extends ConfigTemplate {
    4     protected $Config = array(
    5         'DBType'=>'Mysql',
    6         'DBServer'=>'localhost',
    7         'DBUser'=>'root',
    8         'DBPassword'=>'',
    9         'DBName'=>'tbb2test',
    10         'TablePrefix'=>'tbb2_'
     4    protected $config = array(
     5        'dbType'=>'Mysql',
     6        'dbServer'=>'localhost',
     7        'dbUser'=>'root',
     8        'dbPassword'=>'',
     9        'dbName'=>'tbb2test',
     10        'tablePrefix'=>'tbb2_'
    1111    );
    1212}
  • trunk/config/Language.config.class.php

    r2 r5  
    22
    33class LanguageConfig extends ConfigTemplate {
    4     protected $Config = array(
    5         'DefaultLanguageCode'=>'de',
    6         'AutoloadFiles'=>array('Main')
     4    protected $config = array(
     5        'defaultLanguageCode'=>'de',
     6        'autoloadFiles'=>array('Main')
    77    );
    88}
  • trunk/core/ConfigTemplate.class.php

    r2 r5  
    22
    33class ConfigTemplate {
    4     protected $Config = array();
     4    protected $config = array();
    55
    6     public function getValue($ConfigName) {
    7         return $this->Config[$ConfigName];
     6    public function getValue($configName) {
     7        return $this->config[$configName];
    88    }
    99}
  • trunk/core/Core.class.php

    r2 r5  
    22
    33class Core extends ModuleTemplate {
    4     protected $RequiredModules = array(
    5         'Auth',
    6         'Config',
    7         'DB',
    8         'Language',
    9         'Navbar',
    10         'Template'
    11     );
     4    public function executeMe() {
     5        /**
     6         * Some basic settings:
     7         * - Show all PHP-messages
     8         * - Set GET argument seperator to & (for XHTML compatibility)
     9         * - Disable slashing of database query results
     10         */
     11        error_reporting(E_ALL);
     12        set_magic_quotes_runtime(0);
     13        ini_set('arg_separator.output','&');
     14        //if(file_exists('install.php')) die('Please delete install.php first!'); // Ueberprueft, ob die Installationsdatei geloescht wurde
    1215
    13     protected $Modules = array();
    1416
    15     public function executeMe() {
    16         // Ein paar wichtige Dinge
    17         error_reporting(E_ALL); // Zeigt alle Fehler an
    18         set_magic_quotes_runtime(0); // Beim Laden von Daten aus der Datenbank sollen keine Backslashes hinzugefuegt werden
    19         ini_set('arg_separator.output','&'); // Falls session.use_trans_sid ueber .htaccess nicht geaendert werden kann, wird die SID so wenigstens richtig angezeigt
    20         if(file_exists('install.php')) die('Please delete install.php first!'); // Ueberprueft, ob die Installationsdatei geloescht wurde
     17        /**
     18         * Make indexFile everywhere available
     19         */
     20        define('INDEXFILE',$this->getC('indexFile'));
    2121
    22         // Konstanten setzen
    23         $this->setConstants();
    2422
    25         // GZIP-Komprimierung
    26         if($this->Modules['Config']->getValue('enable_gzip') == 1) { // Falls von der Boardkonfiguration her GZIP verwendet werden soll...
    27             if(ini_get('zlib.output_compression') != 1 && ini_get('output_handler') != 'ob_gzhandler') // ...und die Seite nicht schon von der PHP-Konfiguration her automatisch komprimiert wird...
    28                 @ob_start('ob_gzhandler'); // ...die Seite komprimieren
     23        /**
     24         * Enable output compression
     25         */
     26        if($this->getC('enableOutputCompression')) {
     27            if(ini_get('zlib.output_compression') != 1 && ini_get('output_handler') != 'ob_gzhandler')
     28                @ob_start('ob_gzhandler');
    2929        }
    3030
    31         // Veraltete Suchergebnisse loeschen
    32         if($this->Modules['Config']->getValue('srgc_probability') >= rand(1,100)) // Falls die Wahrscheinlichkeit groesser oder gleich der Zufallszahl ist...
    33             $this->Modules['DB']->query("DELETE FROM ".TBLPFX."search_results WHERE search_last_access<'".$this->Modules['DB']->fromUnixTimestamp(time()-$this->Modules['Config']->getValue('sr_timeout')*60)."'"); // ...veraltete Suchergebnisse loeschen
    3431
    35         // Smarty Zeugs
    36         $Modules = &Factory::getInstances();
    37         $this->Modules['Template']->setDirs('std');
    38         $this->Modules['Template']->assign('IndexFile',$this->getConfigValue('IndexFile'));
    39         $this->Modules['Template']->assign_by_ref('Modules',$Modules);
    40 
    41         // Navigationsleiste
    42         $this->Modules['Navbar']->addElement($this->Modules['Config']->getValue('board_name'),INDEXFILE.'?'.MYSID);
    43 
    44         // Etwas GPC Zeugs
    45         if(get_magic_quotes_gpc() == 0) { // Falls Werte von "aussen" nicht automatisch mit \ escaped werden (ist sehr wichtig fuer die Sicherheit der Datenbankabfragen)...
    46             $_POST = Functions::addSlashes($_POST); // ...dies mit den $_POST-Werten tun...
    47             $_GET = Functions::addSlashes($_GET); // ...und dies mit den $_GET-Werten tun...
    48             $_REQUEST = Functions::addSlashes($_REQUEST); // ...und den $_REQUEST-Werten tun
     32        /**
     33         * Some GPC-Stuff
     34         * - Add slashes
     35         * - Sets available checkbox variables to 1 if a form was submitted
     36         */
     37        if(get_magic_quotes_gpc() == 0) {
     38            $_POST = Functions::addSlashes($_POST);
     39            $_GET = Functions::addSlashes($_GET);
     40            $_REQUEST = Functions::addSlashes($_REQUEST);
    4941        }
    5042        if(isset($_POST['p']) == FALSE || is_array($_POST['p']) == FALSE) $_POST['p'] = array();
    5143        if(isset($_POST['c']) == FALSE || is_array($_POST['c']) == FALSE) $_POST['c'] = array();
    52         if(isset($_GET['Doit'])) {
     44        if(isset($_GET['doIt'])) {
    5345            while(list($curKey) = each($_POST['c'])) {
    5446                $_POST['c'][$curKey] = 1;
     
    5648        }
    5749
    58         // Die Aktion bestimmen und ausfuehren
    59         $Action = (isset($_GET['Action']) == TRUE && in_array($_GET['Action'],$this->getConfigValue('AllowedActions')) == TRUE) ? $_GET['Action'] : (($this->Modules['Config']->getValue('DefaultAction') != '') ? $this->Modules['Config']->getValue('DefaultAction') : $this->getConfigValue('DefaultAction'));
    60         $this->Modules[$Action] = Factory::singleton($Action);
    61         $this->Modules[$Action]->executeMe();
    62     }
    6350
    64     protected function setConstants() {
    65         define('INDEXFILE',$this->getConfigValue('IndexFile'));
    66 
    67         define('SMILEY_TYPE_SMILEY',0);
    68         define('SMILEY_TYPE_TPIC',1);
    69         define('SMILEY_TYPE_ADMINSMILEY',2);
    70 
    71         define('SUBSCRIPTION_TYPE_FORUM',0);
    72         define('SUBSCRIPTION_TYPE_TOPIC',1);
    73 
    74         define('AUTH_TYPE_USER',0);
    75         define('AUTH_TYPE_GROUP',1);
    76 
    77         define('USER_STATUS_INACTIVE',0);
    78 
    79         define('TOPIC_STATUS_OPEN',0);
    80         define('TOPIC_STATUS_CLOSED',1);
    81 
    82         define('PROFILE_FIELD_TYPE_TEXT',0);
    83         define('PROFILE_FIELD_TYPE_TEXTAREA',1);
    84         define('PROFILE_FIELD_TYPE_SELECTSINGLE',2);
    85         define('PROFILE_FIELD_TYPE_SELECTMULTI',3);
     51        /**
     52         * Check what to do and execute specified module, if allowed and if existing.
     53         * Otherwise execute default module
     54         */
     55        $action = (isset($_GET['action']) && in_array($_GET['action'],$this->getC('allowedActions'))) ? $_GET['action'] : $this->getC('defaultAction');
     56        $this->modules[$action] = Factory::singleton($action);
     57        $this->modules[$action]->executeMe();
    8658    }
    8759}
  • trunk/core/Factory.class.php

    r2 r5  
    22
    33class Factory {
    4     protected static $Instances = array();
     4    protected static $instances = array();
    55
    6     public static function &singleton($ClassName) {
    7         if(!isset(self::$Instances[$ClassName])) {
    8             include('modules/'.$ClassName.'.class.php');
    9             self::$Instances[$ClassName] = new $ClassName;
    10             self::$Instances[$ClassName]->initializeMe();
     6    public static function &singleton($className) {
     7        if(!isset(self::$instances[$className])) {
     8            include('modules/'.$className.'.class.php');
     9            self::$instances[$className] = new $className;
     10            self::$instances[$className]->initializeMe();
    1111        }
    1212
    13         return self::$Instances[$ClassName];
     13        return self::$instances[$className];
    1414    }
    1515
    1616    public static function &getInstances() {
    17         return self::$Instances;
     17        return self::$instances;
    1818    }
    1919}
  • trunk/core/ModuleTemplate.class.php

    r2 r5  
    22
    33class ModuleTemplate {
    4     protected $RequiredModules = array();
    5     protected $Modules = array();
    6     protected $ModuleConfig = NULL;
     4    protected $requiredModules = array();
     5    protected $modules = array();
     6    protected $moduleConfig = NULL;
    77
    88    public function __construct() {
    9         $ClassName = get_class($this);
     9        $className = get_class($this);
    1010
    11         if(file_exists('config/'.$ClassName.'.config.class.php')) {
    12             include('config/'.$ClassName.'.config.class.php');
    13             $Temp = $ClassName.'Config';
    14             $this->ModuleConfig = new $Temp;
     11        if(file_exists('config/'.$className.'.config.class.php')) {
     12            include('config/'.$className.'.config.class.php');
     13            $temp = $className.'Config';
     14            $this->moduleConfig = new $temp;
    1515        }
    1616
    17         foreach($this->RequiredModules AS $curModule)
    18             $this->Modules[$curModule] = &Factory::singleton($curModule);
     17        foreach($this->requiredModules AS $curModule)
     18            $this->modules[$curModule] = &Factory::singleton($curModule);
    1919    }
    2020
     
    2525    }
    2626
    27     public function getConfigValue($ConfigName) {
    28         return $this->ModuleConfig->getValue($ConfigName);
     27    public function getConfigValue($configName) {
     28        return $this->moduleConfig->getValue($configName);
     29    }
     30
     31    public function getC($configName) {
     32        return $this->moduleConfig->getValue($configName);
    2933    }
    3034}
  • trunk/modules/Auth.class.php

    r2 r5  
    22
    33class Auth extends ModuleTemplate {
    4     protected $RequiredModules = array(
     4    protected $requiredModules = array(
    55        'Session',
    66        'DB'
    77    );
    8     protected $UserLoggedIn = 0;
    9     protected $UserID = 0;
    10     protected $UserData = array();
     8    protected $userLoggedIn = 0;
     9    protected $userID = 0;
     10    protected $userData = array();
    1111
    1212    public function initializeMe() {
    1313        if(isset($_SESSION['UserID']) == TRUE) {
    14             $this->Modules['DB']->query("SELECT * FROM ".TBLPFX."users WHERE UserID='".$_SESSION['UserID']."'");
    15             if($this->Modules['DB']->getAffectedRows() == 1) {
    16                 $TempUserData = $this->Modules['DB']->fetchArray();
    17                 if($TempUserData['UserPassword'] == $_SESSION['UserPassword']) {
    18                     $this->UserID = $TempUserData['UserID'];
    19                     $this->UserLoggedIn = 1;
    20                     $this->UserData = $TempUserData;
     14            $this->modules['DB']->query("SELECT * FROM ".TBLPFX."users WHERE UserID='".$_SESSION['UserID']."'");
     15            if($this->modules['DB']->getAffectedRows() == 1) {
     16                $tempUserData = $this->Modules['DB']->fetchArray();
     17                if($tempUserData['UserPassword'] == $_SESSION['UserPassword']) {
     18                    $this->userID = $tempUserData['UserID'];
     19                    $this->userLoggedIn = 1;
     20                    $this->userData = $tempUserData;
    2121                }
    2222            }
    2323        }
    24         define('USERID',$this->UserID);
     24        define('USERID',$this->userID);
    2525    }
    2626
    2727    public function getUserID() {
    28         return $this->UserID;
     28        return $this->userID;
    2929    }
    3030
    3131    public function isLoggedIn() {
    32         return $this->UserLoggedIn;
     32        return $this->userLoggedIn;
    3333    }
    3434
    3535    public function getUserData() {
    36         return $this->UserData;
     36        return $this->userData;
    3737    }
    3838
     
    4545    }
    4646
    47     public function getUserDataValue($Key) {
    48         return (isset($this->UserData[$Key]) == TRUE) ? $this->UserData[$Key] : FALSE;
     47    public function getUserDataValue($key) {
     48        return isset($this->userData[$key]) ? $this->userData[$key] : FALSE;
    4949    }
    5050
    51     public function getValue($Key) {
    52         return $this->getUserDataValue($Key);
     51    public function getValue($key) {
     52        return $this->getUserDataValue($key);
    5353    }
    5454
    55     public function setValue($Key,$Value) {
    56         $this->UserData[$Key] = $Value;
     55    public function setValue($key,$value) {
     56        $this->userData[$key] = $value;
    5757    }
    5858
  • trunk/modules/Cache.class.php

    r2 r5  
    22
    33class Cache extends ModuleTemplate {
    4     protected $RequiredModules = array(
     4    protected $requiredModules = array(
    55        'DB'
    66    );
     
    1212
    1313    public function setSmiliesData() {
    14         $ToWrite1 = $ToWrite2 = array();
    15         $this->Modules['DB']->query("SELECT SmileyID,SmileyType,SmileyFileName,SmileySynonym,SmileyStatus FROM ".TBLPFX."smilies WHERE SmileyType='".SMILEY_TYPE_SMILEY."' OR SmileyType='".SMILEY_TYPE_ADMINSMILEY."'");
    16         while($curSmiley = $this->Modules['DB']->fetchArray()) {
     14        $toWrite1 = $toWrite2 = array();
     15        $this->modules['DB']->query("SELECT SmileyID,SmileyType,SmileyFileName,SmileySynonym,SmileyStatus FROM ".TBLPFX."smilies WHERE SmileyType='".SMILEY_TYPE_SMILEY."' OR SmileyType='".SMILEY_TYPE_ADMINSMILEY."'");
     16        while($curSmiley = $this->modules['DB']->fetchArray()) {
    1717            if($curSmiley['SmileyType'] != SMILEY_TYPE_ADMINSMILEY)
    18                 $ToWrite1[] = 'array(\'SmileyID\'=>\''.$curSmiley['SmileyID'].'\',\'SmileyFileName\'=>\''.$curSmiley['SmileyFileName'].'\',\'SmileySynonym\'=>\''.$curSmiley['SmileySynonym'].'\',\'SmileyStatus\'=>\''.$curSmiley['SmileyStatus'].'\')';
    19             $ToWrite2[] = '\''.$curSmiley['SmileySynonym'].'\'=>\'<img src="'.$curSmiley['SmileyFileName'].'" border="0" alt="'.$curSmiley['SmileySynonym'].'"/>\'';
    20         }
    21 
    22         $ToWrite1 = '<?php $SmiliesDataRead = array('.implode(',',$ToWrite1).'); ?>';
    23         $ToWrite2 = '<?php $SmiliesDataWrite = array('.implode(',',$ToWrite2).'); ?>';
    24 
    25         Functions::FileWrite('cache/cache_smilies_read.php',$ToWrite1,'w');
    26         Functions::FileWrite('cache/cache_smilies_write.php',$ToWrite2,'w');
     18                $toWrite1[] = 'array(\'SmileyID\'=>\''.$curSmiley['SmileyID'].'\',\'SmileyFileName\'=>\''.$curSmiley['SmileyFileName'].'\',\'SmileySynonym\'=>\''.$curSmiley['SmileySynonym'].'\',\'SmileyStatus\'=>\''.$curSmiley['SmileyStatus'].'\')';
     19            $toWrite2[] = '\''.$curSmiley['SmileySynonym'].'\'=>\'<img src="'.$curSmiley['SmileyFileName'].'" border="0" alt="'.$curSmiley['SmileySynonym'].'"/>\'';
     20        }
     21
     22        $toWrite1 = '<?php $SmiliesDataRead = array('.implode(',',$toWrite1).'); ?>';
     23        $toWrite2 = '<?php $SmiliesDataWrite = array('.implode(',',$toWrite2).'); ?>';
     24
     25        Functions::FileWrite('cache/cache_smilies_read.php',$toWrite1,'w');
     26        Functions::FileWrite('cache/cache_smilies_write.php',$toWrite2,'w');
    2727    }
    2828
     
    3434                include('cache/SmiliesRead.cache.php');
    3535            else {
    36                 $this->Modules['DB']->query("SELECT SmileyID,SmileyFileName,SmileySynonym,SmileyStatus FROM ".TBLPFX."smilies WHERE SmileyType='".SMILEY_TYPE_SMILEY."'");
    37                 $SmiliesDataRead = $this->Modules['DB']->Raw2Array();
     36                $this->modules['DB']->query("SELECT SmileyID,SmileyFileName,SmileySynonym,SmileyStatus FROM ".TBLPFX."smilies WHERE SmileyType='".SMILEY_TYPE_SMILEY."'");
     37                $SmiliesDataRead = $this->modules['DB']->Raw2Array();
    3838            }
    3939
     
    4646                include('cache/SmiliesWrite.cache.php');
    4747            else {
    48                 $this->Modules['DB']->query("SELECT SmileyFileName,SmileySynonym FROM ".TBLPFX."smilies WHERE SmileyType='".SMILEY_TYPE_SMILEY."' OR SmileyType='".SMILEY_TYPE_ADMINSMILEY."'");
    49                 while($curSmiley = $this->Modules['DB']->fetchArray())
     48                $this->modules['DB']->query("SELECT SmileyFileName,SmileySynonym FROM ".TBLPFX."smilies WHERE SmileyType='".SMILEY_TYPE_SMILEY."' OR SmileyType='".SMILEY_TYPE_ADMINSMILEY."'");
     49                while($curSmiley = $this->modules['DB']->fetchArray())
    5050                    $SmiliesDataWrite[$curSmiley['SmileySynonym']] = '<img src="'.$curSmiley['SmileyFileName'].'" border="0" alt="'.$curSmiley['SmileySynonym'].'"/>';
    5151            }
     
    6565
    6666    public function setAdminSmiliesData() {
    67         $AdminSmiliesData = $ToWrite = array();
    68 
    69         $this->Modules['DB']->query("SELECT SmileyID,SmileyType,SmileyFileName,SmileySynonym,SmileyStatus FROM ".TBLPFX."smilies WHERE SmileyType='".SMILEY_TYPE_ADMINSMILEY."'");
    70         while($curSmiley = $this->Modules['DB']->fetchArray()) {
     67        $AdminSmiliesData = $toWrite = array();
     68
     69        $this->modules['DB']->query("SELECT SmileyID,SmileyType,SmileyFileName,SmileySynonym,SmileyStatus FROM ".TBLPFX."smilies WHERE SmileyType='".SMILEY_TYPE_ADMINSMILEY."'");
     70        while($curSmiley = $this->modules['DB']->fetchArray()) {
    7171            $AdminSmiliesData[] = array(
    7272                'SmileyID'=>$curSmiley['SmileyID'],
     
    7575                'SmileyStatus'=>$curSmiley['SmileyStatus']
    7676            );
    77             $ToWrite[] = 'array(\'SmileyID\'=>\''.$curSmiley['SmileyID'].'\',\'SmileyFileName\'=>\''.$curSmiley['SmileyFileName'].'\',\'SmileySynonym\'=>\''.$curSmiley['SmileySynonym'].'\',\'SmileyStatus\'=>\''.$curSmiley['SmileyStatus'].'\')';
    78         }
    79 
    80         Functions::FileWrite('cache/AdminSmilies.cache.php','<?php $AdminSmiliesData = array('.implode(',',$ToWrite).'); ?>','w');
     77            $toWrite[] = 'array(\'SmileyID\'=>\''.$curSmiley['SmileyID'].'\',\'SmileyFileName\'=>\''.$curSmiley['SmileyFileName'].'\',\'SmileySynonym\'=>\''.$curSmiley['SmileySynonym'].'\',\'SmileyStatus\'=>\''.$curSmiley['SmileyStatus'].'\')';
     78        }
     79
     80        Functions::FileWrite('cache/AdminSmilies.cache.php','<?php $AdminSmiliesData = array('.implode(',',$toWrite).'); ?>','w');
    8181
    8282        return $AdminSmiliesData;
     
    8484
    8585    public function setPPicsData() {
    86         $ToWrite = $PPicsData = array();
    87 
    88         $this->Modules['DB']->query("SELECT SmileyID,SmileyFileName FROM ".TBLPFX."smilies WHERE SmileyType='1'");
    89         while($curSmiley = $this->Modules['DB']->fetchArray()) {
    90             $ToWrite[] = 'array(\'SmileyID\'=>\''.$curSmiley['SmileyID'].'\',\'SmileyFileName\'=>\''.$curSmiley['SmileyFileName'].'\')';
     86        $toWrite = $PPicsData = array();
     87
     88        $this->modules['DB']->query("SELECT SmileyID,SmileyFileName FROM ".TBLPFX."smilies WHERE SmileyType='1'");
     89        while($curSmiley = $this->modules['DB']->fetchArray()) {
     90            $toWrite[] = 'array(\'SmileyID\'=>\''.$curSmiley['SmileyID'].'\',\'SmileyFileName\'=>\''.$curSmiley['SmileyFileName'].'\')';
    9191            $PPicsData[] = $curSmiley;
    9292        }
    9393
    94         $ToWrite = '<?php $PPicsData = array('.implode(',',$ToWrite).'); ?>';
    95 
    96         Functions::FileWrite('cache/PPics.cache.php',$ToWrite,'w');
     94        $toWrite = '<?php $PPicsData = array('.implode(',',$toWrite).'); ?>';
     95
     96        Functions::FileWrite('cache/PPics.cache.php',$toWrite,'w');
    9797
    9898        return $PPicsData;
     
    112112        $RanksData1 = $RanksData2 = array();
    113113
    114         $this->Modules['DB']->query("SELECT * FROM ".TBLPFX."ranks ORDER BY RankPosts");
    115         while($curRank = $this->Modules['DB']->fetchArray()) {
     114        $this->modules['DB']->query("SELECT * FROM ".TBLPFX."ranks ORDER BY RankPosts");
     115        while($curRank = $this->modules['DB']->fetchArray()) {
    116116            $curRankGfx = '';
    117117
     
    129129        }
    130130
    131         $ToWrite = '<?php $RanksData = array(array('.implode(",",$RanksData1).'),array('.implode(",",$RanksData2).')); ?>';
    132 
    133         Functions::FileWrite('cache/Ranks.cache.php',$ToWrite,'w');
     131        $toWrite = '<?php $RanksData = array(array('.implode(",",$RanksData1).'),array('.implode(",",$RanksData2).')); ?>';
     132
     133        Functions::FileWrite('cache/Ranks.cache.php',$toWrite,'w');
    134134
    135135        return array($RanksData1,$RanksData2);
     
    149149        $Languages = $LanguageIDs = array();
    150150
    151         $ToWrite1 = array();
    152         $ToWrite2 = array();
     151        $toWrite1 = array();
     152        $toWrite2 = array();
    153153
    154154        $DP = opendir('languages');
     
    160160
    161161            foreach($curSupportedLanguages AS $curLanguage) {
    162                 $ToWrite1[] = "'$curLanguage'=>'$curObj'";
     162                $toWrite1[] = "'$curLanguage'=>'$curObj'";
    163163                $LanguageIDs[$curLanguage] = $curObj;
    164164            }
     
    171171            );
    172172
    173             $ToWrite2[] = "array('Name'=>'".$curLanguageConfig['language_name']."','NativeName'=>'".$curLanguageConfig['language_name_native']."','Dir'=>'".$curObj."','SupportedLanguages'=>'".$curLanguageConfig['supported_languages']."')";
     173            $toWrite2[] = "array('Name'=>'".$curLanguageConfig['language_name']."','NativeName'=>'".$curLanguageConfig['language_name_native']."','Dir'=>'".$curObj."','SupportedLanguages'=>'".$curLanguageConfig['supported_languages']."')";
    174174        }
    175175        closedir($DP);
    176176
    177         $ToWrite = '<?php $LanguageIDs = array('.implode(',',$ToWrite1).'); $Languages = array('.implode(',',$ToWrite2).'); ?>';
    178 
    179         Functions::FileWrite('cache/Languages.cache.php',$ToWrite,'w');
     177        $toWrite = '<?php $LanguageIDs = array('.implode(',',$toWrite1).'); $Languages = array('.implode(',',$toWrite2).'); ?>';
     178
     179        Functions::FileWrite('cache/Languages.cache.php',$toWrite,'w');
    180180
    181181        return array($LanguageIDs,$Languages);
     
    194194
    195195    public function setConfig() {
    196         $Config = $ToWrite = array();
    197         $this->Modules['DB']->query("SELECT * FROM ".TBLPFX."config");
    198         while($curRow = $this->Modules['DB']->fetchArray()) {
     196        $Config = $toWrite = array();
     197        $this->modules['DB']->query("SELECT * FROM ".TBLPFX."config");
     198        while($curRow = $this->modules['DB']->fetchArray()) {
    199199            $Config[$curRow['ConfigName']] = $curRow['ConfigValue'];
    200             $ToWrite[] = '\''.$curRow['ConfigName'].'\'=>\''.addslashes($curRow['ConfigValue']).'\'';
    201         }
    202 
    203         $ToWrite = '<?php $Config = array('.implode(',',$ToWrite).'); ?>';
    204 
    205         Functions::FileWrite('cache/Config.cache.php',$ToWrite,'w');
     200            $toWrite[] = '\''.$curRow['ConfigName'].'\'=>\''.addslashes($curRow['ConfigValue']).'\'';
     201        }
     202
     203        $toWrite = '<?php $Config = array('.implode(',',$toWrite).'); ?>';
     204
     205        Functions::FileWrite('cache/Config.cache.php',$toWrite,'w');
    206206
    207207        return $Config;
  • trunk/modules/Config.class.php

    r2 r5  
    22
    33class Config extends ModuleTemplate {
    4     protected $RequiredModules = array(
     4    protected $requiredModules = array(
    55        'Cache',
    66        'DB'
    77    );
    8     protected $MyConfig = array();
     8    protected $myConfig = array();
    99
    1010    public function initializeMe() {
    11         $this->MyConfig = $this->Modules['Cache']->getConfig();
    12         $this->Modules['Cache']->setPPicsData();
     11        $this->myConfig = $this->modules['Cache']->getConfig();
     12        $this->modules['Cache']->setPPicsData();
    1313    }
    1414
    15     public function getValue($ConfigName) {
    16         return (isset($this->MyConfig[$ConfigName]) == FALSE) ? FALSE : $this->MyConfig[$ConfigName];
     15    public function getValue($configName) {
     16        return (isset($this->myConfig[$configName]) == FALSE) ? FALSE : $this->myConfig[$configName];
    1717    }
    1818}
  • trunk/modules/DB.class.php

    r2 r5  
    99    public function initializeMe() {
    1010        $this->DBObject = new mysqli;
    11         @$this->DBObject->connect($this->ModuleConfig->getValue('DBServer'),$this->ModuleConfig->getValue('DBUser'),$this->ModuleConfig->getValue('DBPassword'),$this->ModuleConfig->getValue('DBName'));
     11
     12        @$this->DBObject->connect($this->getC('dbServer'),$this->getC('dbUser'),$this->getC('dbPassword'),$this->getC('dbName'));
    1213        if(mysqli_connect_error() != '') die('Database error: <b>'.mysqli_connect_error().'</b>');
     14
    1315        define('TBLPFX',$this->getTablePrefix());
    1416        $this->query("SET NAMES utf8");
    15         ////$this->query("update tbb2_posts set PostText = REPLACE(PostText,'ö','ö')");
    16         ////$this->query("update tbb2_posts set PostText = REPLACE(PostText,'À','À')");
    17         ////$this->query("update tbb2_posts set PostText = REPLACE(PostText,'Ì','ÃŒ')");
    18         ////$this->query("update tbb2_posts set PostText = REPLACE(PostText,'ÃŞ','ß')");
    19         //$this->query("update tbb2_posts set PostText = REPLACE(PostText,'ö','ö')");
    20         //$this->query("update tbb2_posts set PostText = REPLACE(PostText,'ö','ö')");
    21         //$this->query("update tbb2_posts set PostText = REPLACE(PostText,'ö','ö')");
     17        /*/$this->query("update tbb2_posts set PostText = REPLACE(PostText,'ö','ö')");
     18        $this->query("update tbb2_posts set PostText = REPLACE(PostText,'À','À')");
     19        $this->query("update tbb2_posts set PostText = REPLACE(PostText,'Ì','ÃŒ')");
     20        $this->query("update tbb2_posts set PostText = REPLACE(PostText,'ÃŞ','ß')");
     21        $this->query("update tbb2_posts set PostText = REPLACE(PostText,'ö','ö')");
     22        $this->query("update tbb2_posts set PostText = REPLACE(PostText,'ö','ö')");
     23        $this->query("update tbb2_posts set PostText = REPLACE(PostText,'ö','ö')");
    2224
    2325
    24         ////$this->query("update tbb2_posts set PostTitle = REPLACE(PostTitle,'ö','ö')");
    25         ////$this->query("update tbb2_posts set PostTitle = REPLACE(PostTitle,'À','À')");
    26         ////$this->query("update tbb2_posts set PostTitle = REPLACE(PostTitle,'Ì','ÃŒ')");
    27         ////$this->query("update tbb2_posts set PostTitle = REPLACE(PostTitle,'ÃŞ','ß')");
     26        $this->query("update tbb2_posts set PostTitle = REPLACE(PostTitle,'ö','ö')");
     27        $this->query("update tbb2_posts set PostTitle = REPLACE(PostTitle,'À','À')");
     28        $this->query("update tbb2_posts set PostTitle = REPLACE(PostTitle,'Ì','ÃŒ')");
     29        $this->query("update tbb2_posts set PostTitle = REPLACE(PostTitle,'ÃŞ','ß')");
    2830
    29         //$this->query("update tbb2_forums set ForumName = REPLACE(ForumName,'ö','ö')");
    30         //$this->query("update tbb2_forums set ForumName = REPLACE(ForumName,'À','À')");
    31         //$this->query("update tbb2_forums set ForumName = REPLACE(ForumName,'Ì','ÃŒ')");
    32         //$this->query("update tbb2_forums set ForumName = REPLACE(ForumName,'ÃŞ','ß')");
    33         //$this->query("update tbb2_forums set ForumDescription = REPLACE(ForumDescription,'ö','ö')");
    34         //$this->query("update tbb2_forums set ForumDescription = REPLACE(ForumDescription,'À','À')");
    35         //$this->query("update tbb2_forums set ForumDescription = REPLACE(ForumDescription,'Ì','ÃŒ')");
    36         //$this->query("update tbb2_forums set ForumDescription = REPLACE(ForumDescription,'ÃŞ','ß')");
     31        $this->query("update tbb2_forums set ForumName = REPLACE(ForumName,'ö','ö')");
     32        $this->query("update tbb2_forums set ForumName = REPLACE(ForumName,'À','À')");
     33        $this->query("update tbb2_forums set ForumName = REPLACE(ForumName,'Ì','ÃŒ')");
     34        $this->query("update tbb2_forums set ForumName = REPLACE(ForumName,'ÃŞ','ß')");
     35        $this->query("update tbb2_forums set ForumDescription = REPLACE(ForumDescription,'ö','ö')");
     36        $this->query("update tbb2_forums set ForumDescription = REPLACE(ForumDescription,'À','À')");
     37        $this->query("update tbb2_forums set ForumDescription = REPLACE(ForumDescription,'Ì','ÃŒ')");
     38        $this->query("update tbb2_forums set ForumDescription = REPLACE(ForumDescription,'ÃŞ','ß')");/**/
    3739    }
    3840
     
    7880
    7981    public function getTablePrefix() {
    80         return $this->ModuleConfig->getValue('TablePrefix');
     82        return $this->getC('tablePrefix');
    8183    }
    8284
  • trunk/modules/ForumIndex.class.php

    r2 r5  
    22
    33class ForumIndex extends ModuleTemplate {
    4     protected $RequiredModules = array(
     4    protected $requiredModules = array(
    55        'Auth',
    66        'Cache',
     
    1414
    1515    public function executeMe() {
    16         $BaseCatID = isset($_GET['BaseCatID']) ? intval($_GET['BaseCatID']) : 1;
    17         $CatID = isset($_GET['CatID']) ? intval($_GET['CatID']) : $BaseCatID;
     16        $baseCatID = isset($_GET['baseCatID']) ? intval($_GET['baseCatID']) : 1;
     17        $catID = isset($_GET['CatID']) ? intval($_GET['CatID']) : $baseCatID;
    1818
    1919        // Kategoriedaten laden
    20         if(($CatsData = Functions::getCatsData($CatID)) === FALSE) die('Wrong base cat id');
    21         $CatsCounter = count($CatsData);
     20        if(($catsData = Functions::getCatsData($catID)) === FALSE) die('Wrong base cat id');
     21        $catsCounter = count($catsData);
    2222
    2323        // Sprachstrings laden
    24         $this->Modules['Language']->addFile('ForumIndex');
     24        $this->modules['Language']->addFile('ForumIndex');
    2525
    2626        // Forendaten laden
    27         $ForumsData = $this->_loadForumsData();
    28         $ForumsCounter = count($ForumsData);
     27        $forumsData = $this->_loadForumsData();
     28        $forumsCounter = count($forumsData);
    2929
    3030        // Moderatorendaten laden
    31         $ModsUsersData = $this->_loadModsUsersData();
    32         $ModsGroupsData = $this->_loadModsGroupsData();
     31        $modsUsersData = $this->_loadModsUsersData();
     32        $modsGroupsData = $this->_loadModsGroupsData();
    3333
    3434        // Zugriffsrechte auf die Foren laden
     
    4242        $ClosedCatIDs = array();
    4343        if(!isset($_COOKIE['ClosedCatIDs'])) {
    44             for($i = 0; $i < $CatsCounter; $i++) {
    45                 if($CatsData[$i]['CatStandardStatus'] != 1) $ClosedCatIDs[] = $CatsData[$i]['CatID'];
     44            for($i = 0; $i < $catsCounter; $i++) {
     45                if($catsData[$i]['CatStandardStatus'] != 1) $ClosedCatIDs[] = $catsData[$i]['CatID'];
    4646            }
    4747            setcookie('ClosedCatIDs',implode('.',$ClosedCatIDs),time()+31536000);
     
    5050            $ClosedCatIDs = explode('.',$_COOKIE['ClosedCatIDs']);
    5151
    52         for($i = 0; $i < $CatsCounter; $i++) {
    53             $curCat = &$CatsData[$i];
     52        for($i = 0; $i < $catsCounter; $i++) {
     53            $curCat = &$catsData[$i];
    5454
    5555            if(in_array($curCat['CatID'],$ClosedCatIDs) == TRUE) $curCat['CatIsOpen'] = 0;
     
    5959        }
    6060
    61         for($i = 0; $i < $ForumsCounter; $i++) {
    62             $curForum = &$ForumsData[$i];
     61        for($i = 0; $i < $forumsCounter; $i++) {
     62            $curForum = &$forumsData[$i];
    6363
    6464            //
     
    6666            //
    6767            $curAuthViewForum = 1;
    68             if($this->Modules['Auth']->isLoggedIn() == 0) {
    69                 if($ForumsData[$i]['GuestsAuthViewForum'] == 0) $curAuthViewForum = 0;
    70             }
    71             elseif($this->Modules['Auth']->getValue('UserIsAdmin')!= 1 && $this->Modules['Auth']->getValue('UserIsSupermod') != 1) {
    72                 if($ForumsData[$i]['MembersAuthViewForum'] == 1) {
     68            if($this->modules['Auth']->isLoggedIn() == 0) {
     69                if($forumsData[$i]['GuestsAuthViewForum'] == 0) $curAuthViewForum = 0;
     70            }
     71            elseif($this->modules['Auth']->getValue('UserIsAdmin')!= 1 && $this->modules['Auth']->getValue('UserIsSupermod') != 1) {
     72                if($forumsData[$i]['MembersAuthViewForum'] == 1) {
    7373                    while(list($curKey,$curData) = each($ForumsAuthData)) {
    74                         if($curData['ForumID'] != $ForumsData[$i]['ForumID']) continue;
     74                        if($curData['ForumID'] != $forumsData[$i]['ForumID']) continue;
    7575
    7676                        unset($ForumsAuthData[$curKey]);
     
    8585                    $curAuthViewForum = 0;
    8686                    while(list($akt_key,$akt_data) = each($ForumsAuthData)) {
    87                         if($curData['ForumID'] != $ForumsData[$i]['ForumID']) continue;
     87                        if($curData['ForumID'] != $forumsData[$i]['ForumID']) continue;
    8888
    8989                        unset($ForumsAuthData[$akt_key]);
     
    9797                reset($ForumsAuthData);
    9898            }
    99             $ForumsData[$i]['ForumIsAccessible'] = $curAuthViewForum;
    100 
    101 
    102             if($curAuthViewForum == 1 || $this->Modules['Config']->getValue('HideNotAccessibleForums') == 0) {
     99            $forumsData[$i]['ForumIsAccessible'] = $curAuthViewForum;
     100
     101
     102            if($curAuthViewForum == 1 || $this->modules['Config']->getValue('HideNotAccessibleForums') == 0) {
    103103                //
    104104                // Die Moderatoren (Mitglieder und Gruppen) des aktuellen Forums
    105105                //
    106106                $curForumMods = array(); // Array fuer die Moderatoren
    107                 while(list($curKey) = each($ModsUsersData)) { // Erst werden alle Mitglieder-Moderatoren ueberprueft
    108                     if($ModsUsersData[$curKey]['ForumID'] != $ForumsData[$i]['ForumID']) continue;
    109 
    110                     $curForumMods[] = '<a href="'.INDEXFILE.'?Action=ViewProfile&amp;ProfileID='.$ModsUsersData[$curKey]['UserID'].'&amp;'.MYSID.'">'.$ModsUsersData[$curKey]['UserNick'].'</a>'; // Aktuelles Mitglied zu Array mit Moderatoren des aktuellen Forums hinzufuegen
    111                     unset($ModsUsersData[$curKey]); // Mitglied kann aus Array geloescht werden
    112                 }
    113                 reset($ModsUsersData);
    114 
    115                 while(list($curKey) = each($ModsGroupsData)) { // Erst werden alle Gruppen-Moderatoren ueberprueft
    116                     if($ModsGroupsData[$curKey]['ForumID'] != $ForumsData[$i]['ForumID']) continue;
    117 
    118                     $curForumMods[] = '<a href="'.INDEXFILE.'?Action=ViewGroup&amp;GroupID='.$ModsGroupsData[$curKey]['GroupID'].'&amp;'.MYSID.'">'.$ModsGroupsData[$curKey]['GroupName'].'</a>'; // Aktuelle Gruppe zu Array mit Moderatoren des aktuellen Forums hinzufuegen
    119                     unset($ModsGroupsData[$curKey]); // Mitglied kann aus Array geloescht werden
    120                 }
    121                 reset($ModsGroupsData); // Array resetten (Pointer auf Position 1 setzen)
    122 
    123                 $ForumsData[$i]['ForumMods'] = implode(', ',$curForumMods);
     107                while(list($curKey) = each($modsUsersData)) { // Erst werden alle Mitglieder-Moderatoren ueberprueft
     108                    if($modsUsersData[$curKey]['ForumID'] != $forumsData[$i]['ForumID']) continue;
     109
     110                    $curForumMods[] = '<a href="'.INDEXFILE.'?Action=ViewProfile&amp;ProfileID='.$modsUsersData[$curKey]['UserID'].'&amp;'.MYSID.'">'.$modsUsersData[$curKey]['UserNick'].'</a>'; // Aktuelles Mitglied zu Array mit Moderatoren des aktuellen Forums hinzufuegen
     111                    unset($modsUsersData[$curKey]); // Mitglied kann aus Array geloescht werden
     112                }
     113                reset($modsUsersData);
     114
     115                while(list($curKey) = each($modsGroupsData)) { // Erst werden alle Gruppen-Moderatoren ueberprueft
     116                    if($modsGroupsData[$curKey]['ForumID'] != $forumsData[$i]['ForumID']) continue;
     117
     118                    $curForumMods[] = '<a href="'.INDEXFILE.'?Action=ViewGroup&amp;GroupID='.$modsGroupsData[$curKey]['GroupID'].'&amp;'.MYSID.'">'.$modsGroupsData[$curKey]['GroupName'].'</a>'; // Aktuelle Gruppe zu Array mit Moderatoren des aktuellen Forums hinzufuegen
     119                    unset($modsGroupsData[$curKey]); // Mitglied kann aus Array geloescht werden
     120                }
     121                reset($modsGroupsData); // Array resetten (Pointer auf Position 1 setzen)
     122
     123                $forumsData[$i]['ForumMods'] = implode(', ',$curForumMods);
    124124
    125125
     
    134134                //
    135135                $curLastPostPic = $curLastPostText = '';
    136                 if($ForumsData[$i]['ForumLastPostID'] != 0) {
     136                if($forumsData[$i]['ForumLastPostID'] != 0) {
    137137                    if($curAuthViewForum == 1) {
    138                         $curLastPostPic = ($ForumsData[$i]['ForumLastPostSmileyFileName'] == '') ? '' : '<img src="'.$ForumsData[$i]['ForumLastPostSmileyFileName'].'" alt="" border="" />';
    139                         if(strlen($ForumsData[$i]['ForumLastPostTitle']) > 22) $curLastPostLink = '<a href="'.INDEXFILE.'?Action=ViewTopic&amp;PostID='.$ForumsData[$i]['ForumLastPostID'].'&amp;'.MYSID.'#Post'.$ForumsData[$i]['ForumLastPostID'].'" title="'.Functions::HTMLSpecialChars(($ForumsData[$i]['ForumLastPostTitle'])).'">'.Functions::HTMLSpecialChars(substr($ForumsData[$i]['ForumLastPostTitle'],0,22)).'...</a>';
    140                         else $curLastPostLink = '<a href="'.INDEXFILE.'?Action=ViewTopic&amp;PostID='.$ForumsData[$i]['ForumLastPostID'].'&amp;'.MYSID.'#Post'.$ForumsData[$i]['ForumLastPostID'].'">'.Functions::HTMLSpecialChars($ForumsData[$i]['ForumLastPostTitle']).'</a>';
    141 
    142                         if($ForumsData[$i]['ForumLastPostPosterID'] == 0) $curLastPostPosterNick = $ForumsData[$i]['ForumLastPostGuestNick'];
    143                         else $curLastPostPosterNick = '<a href="index.php?action=viewprofile&amp;profile_id='.$ForumsData[$i]['ForumLastPostPosterID'].'&amp;'.MYSID.'">'.$ForumsData[$i]['ForumLastPostPosterNick'].'</a>';
    144 
    145                         $curLastPostText = $curLastPostLink.' ('.$this->Modules['Language']->getString('by').' '.$curLastPostPosterNick.')<br/>'.Functions::toDateTime($ForumsData[$i]['ForumLastPostTimestamp']);
     138                        $curLastPostPic = ($forumsData[$i]['ForumLastPostSmileyFileName'] == '') ? '' : '<img src="'.$forumsData[$i]['ForumLastPostSmileyFileName'].'" alt="" border="" />';
     139                        if(strlen($forumsData[$i]['ForumLastPostTitle']) > 22) $curLastPostLink = '<a href="'.INDEXFILE.'?Action=ViewTopic&amp;PostID='.$forumsData[$i]['ForumLastPostID'].'&amp;'.MYSID.'#Post'.$forumsData[$i]['ForumLastPostID'].'" title="'.Functions::HTMLSpecialChars(($forumsData[$i]['ForumLastPostTitle'])).'">'.Functions::HTMLSpecialChars(substr($forumsData[$i]['ForumLastPostTitle'],0,22)).'...</a>';
     140                        else $curLastPostLink = '<a href="'.INDEXFILE.'?Action=ViewTopic&amp;PostID='.$forumsData[$i]['ForumLastPostID'].'&amp;'.MYSID.'#Post'.$forumsData[$i]['ForumLastPostID'].'">'.Functions::HTMLSpecialChars($forumsData[$i]['ForumLastPostTitle']).'</a>';
     141
     142                        if($forumsData[$i]['ForumLastPostPosterID'] == 0) $curLastPostPosterNick = $forumsData[$i]['ForumLastPostGuestNick'];
     143                        else $curLastPostPosterNick = '<a href="index.php?action=viewprofile&amp;profile_id='.$forumsData[$i]['ForumLastPostPosterID'].'&amp;'.MYSID.'">'.$forumsData[$i]['ForumLastPostPosterNick'].'</a>';
     144
     145                        $curLastPostText = $curLastPostLink.' ('.$this->modules['Language']->getString('by').' '.$curLastPostPosterNick.')<br/>'.Functions::toDateTime($forumsData[$i]['ForumLastPostTimestamp']);
    146146                    }
    147147                }
    148                 else $curLastPostText = $this->Modules['Language']->getString('No_last_post');
    149 
    150                 $ForumsData[$i]['ForumLastPostPic'] = $curLastPostPic;
    151                 $ForumsData[$i]['ForumLastPostText'] = $curLastPostText;
     148                else $curLastPostText = $this->modules['Language']->getString('No_last_post');
     149
     150                $forumsData[$i]['ForumLastPostPic'] = $curLastPostPic;
     151                $forumsData[$i]['ForumLastPostText'] = $curLastPostText;
    152152
    153153
     
    160160        }
    161161
    162         $CatsData = array_merge(array(array('CatID'=>$CatID,'CatIsOpen'=>1)),$CatsData);
    163 
    164         $this->Modules['Navbar']->addCategories($CatID);
    165 
    166         $this->Modules['Template']->assign(array(
    167             'CatID'=>$CatID,
    168             'CatsData'=>$CatsData,
    169             'ForumsData'=>$ForumsData,
     162        $catsData = array_merge(array(array('CatID'=>$catID,'CatIsOpen'=>1)),$catsData);
     163
     164        $this->modules['Navbar']->addCategories($catID);
     165
     166        $this->modules['Template']->assign(array(
     167            'CatID'=>$catID,
     168            'CatsData'=>$catsData,
     169            'ForumsData'=>$forumsData,
    170170            'NewsData'=>$NewsData,
    171171            'WIOData'=>$WIOData,
    172172            'BoardStatsData'=>$BoardStatsData
    173173        ));
    174         $this->Modules['PageParts']->printPage('ForumIndex.tpl');
     174        $this->modules['PageParts']->printPage('ForumIndex.tpl');
    175175    }
    176176
    177177    protected function _loadForumsData() {
    178         $this->Modules['DB']->query("SELECT
     178        $this->modules['DB']->query("SELECT
    179179            t1.*,
    180180            t2.PosterID AS ForumLastPostPosterID,
     
    191191        ORDER BY t1.OrderID
    192192        ");
    193         return $this->Modules['DB']->Raw2Array();
     193        return $this->modules['DB']->Raw2Array();
    194194    }
    195195
     
    201201     */
    202202    protected function _loadModsUsersData() {
    203         $this->Modules['DB']->query("SELECT
     203        $this->modules['DB']->query("SELECT
    204204            t1.AuthID AS UserID,
    205205            t1.ForumID,
     
    213213            AND t2.UserID=t1.AuthID
    214214        ");
    215         return $this->Modules['DB']->Raw2Array();
     215        return $this->modules['DB']->Raw2Array();
    216216    }
    217217
     
    223223     */
    224224    protected function _loadModsGroupsData() {
    225         $this->Modules['DB']->query("SELECT
     225        $this->modules['DB']->query("SELECT
    226226            t1.AuthID AS GroupID,
    227227            t1.ForumID,
     
    235235            AND t2.GroupID=t1.AuthID
    236236        ");
    237         return $this->Modules['DB']->Raw2Array();
     237        return $this->modules['DB']->Raw2Array();
    238238    }
    239239
     
    247247        $ForumsAuthData = array();
    248248
    249         if($this->Modules['Auth']->isLoggedIn() == 1 && $this->Modules['Auth']->getValue('UserIsAdmin') != 1 && $this->Modules['Auth']->getValue('UserIsSupermod') != 1) {
    250             $this->Modules['DB']->query("SELECT
     249        if($this->modules['Auth']->isLoggedIn() == 1 && $this->modules['Auth']->getValue('UserIsAdmin') != 1 && $this->modules['Auth']->getValue('UserIsSupermod') != 1) {
     250            $this->modules['DB']->query("SELECT
    251251                t1.ForumID,
    252252                t1.AuthViewForum
     
    257257                AND t1.AuthID='".USERID."'
    258258            ");
    259             $ForumsAuthData = $this->Modules['DB']->Raw2Array();
    260 
    261             $this->Modules['DB']->query("SELECT
     259            $ForumsAuthData = $this->modules['DB']->Raw2Array();
     260
     261            $this->modules['DB']->query("SELECT
    262262                t1.ForumID,
    263263                t1.AuthViewForum
     
    269269                AND t1.AuthID=t2.GroupID
    270270                AND t2.MemberID='".USERID."'");
    271             while($curData = $this->Modules['DB']->fetchArray())
     271            while($curData = $this->modules['DB']->fetchArray())
    272272                $ForumsAuthData[] = $curData;
    273273        }
     
    285285        $NewsData = FALSE;
    286286
    287         if($this->Modules['Config']->getValue('news_forum') != 0 && $this->Modules['Config']->getValue('show_news_forumindex') == 1) {
    288             $this->Modules['DB']->query("
     287        if($this->modules['Config']->getValue('news_forum') != 0 && $this->modules['Config']->getValue('show_news_forumindex') == 1) {
     288            $this->modules['DB']->query("
    289289                SELECT
    290290                    t2.PostText AS NewsText,
     
    300300                )
    301301                WHERE
    302                     t1.ForumID='".$this->Modules['Config']->getValue('news_forum')."'
     302                    t1.ForumID='".$this->modules['Config']->getValue('news_forum')."'
    303303                    AND t2.PostID=t1.TopicFirstPosID
    304304                ORDER BY t1.TopicTimestamp
     
    306306            ");
    307307
    308             if($this->Modules['DB']->getAffectedRows() == 1) {
    309                 $NewsData = $this->Modules['DB']->fetchArray();
     308            if($this->modules['DB']->getAffectedRows() == 1) {
     309                $NewsData = $this->modules['DB']->fetchArray();
    310310                //$news_comments_link = "<a href=\"index.php?action=viewtopic&amp;post_id=".$news_data['post_id']."&amp;$MYSID\">".sprintf($LNG['x_comments'],$news_data['news_comments_counter']).'</a>';
    311311
     
    330330        $WIOData = FALSE;
    331331
    332         if($this->Modules['Config']->getValue('enable_wio') == 1 && $this->Modules['Config']->getValue('show_wio_forumindex') == 1) {
     332        if($this->modules['Config']->getValue('enable_wio') == 1 && $this->modules['Config']->getValue('show_wio_forumindex') == 1) {
    333333            $OnlineGuestsCounter = $OnlineMembersCounter = $OnlineGhostsCounter = $OnlineUsersCounter = 0;
    334334            $Members = array();
     
    336336            $Guests = '';
    337337
    338             $this->Modules['DB']->query("
     338            $this->modules['DB']->query("
    339339                SELECT
    340340                    t1.*,
     
    342342                FROM ".TBLPFX."sessions AS t1
    343343                LEFT JOIN ".TBLPFX."users AS t2 ON t1.SessionUserID=t2.UserID
    344                 WHERE SessionLastUpdate>'".($this->Modules['DB']->fromUnixTimestamp(time()-$this->Modules['Config']->getValue('wio_timeout')*60))."'
     344                WHERE SessionLastUpdate>'".($this->modules['DB']->fromUnixTimestamp(time()-$this->modules['Config']->getValue('wio_timeout')*60))."'
    345345            ");
    346             while($curData = $this->Modules['DB']->fetchArray()) {
     346            while($curData = $this->modules['DB']->fetchArray()) {
    347347                if($curData['SessionUserID'] == 0) $OnlineGuestsCounter++;
    348348                elseif($curData['SessionIsGhost'] == 1) $OnlineGhostsCounter++;
     
    357357
    358358            $OnlineUsersCounter = $OnlineGuestsCounter+$OnlineGhostsCounter+$OnlineMembersCounter;
    359             if($this->Modules['Config']->getValue('online_users_record') == '')
     359            if($this->modules['Config']->getValue('online_users_record') == '')
    360360                $OnlineUsersRecord = array(0,0);
    361361            else
    362                 $OnlineUsersRecord = explode(',',$this->Modules['Config']->getValue('online_users_record'));
     362                $OnlineUsersRecord = explode(',',$this->modules['Config']->getValue('online_users_record'));
    363363
    364364            if($OnlineUsersCounter > $OnlineUsersRecord[0]) {
    365365                $OnlineUsersRecord = array($OnlineUsersCounter,time());
    366                 $this->Modules['Config']->updateValue('online_users_record',implode(',',$OnlineUsersRecord));
    367             }
    368 
    369             if($OnlineMembersCounter == 0) $OnlineMembersCounter = $this->Modules['Language']->getString('no_members');
    370             elseif($OnlineMembersCounter == 1) $OnlineMembersCounter = $this->Modules['Language']->getString('one_member');
    371             else $OnlineMembersCounter = sprintf($this->Modules['Language']->getString('x_members'),$OnlineMembersCounter);
    372 
    373             if($OnlineGhostsCounter == 0) $OnlineGhostsCounter = $this->Modules['Language']->getString('no_ghosts');
    374             elseif($OnlineGhostsCounter == 1) $OnlineGhostsCounter = $this->Modules['Language']->getString('one_ghost');
    375             else $OnlineGhostsCounter = sprintf($this->Modules['Language']->getString('x_ghosts'),$OnlineGhostsCounter);
    376 
    377             if($OnlineGuestsCounter == 0) $OnlineGuestsCounter = $this->Modules['Language']->getString('no_guests');
    378             elseif($OnlineGuestsCounter == 1) $OnlineGuestsCounter = $this->Modules['Language']->getString('one_guest');
    379             else $OnlineGuestsCounter = sprintf($this->Modules['Language']->getString('x_guests'),$OnlineGuestsCounter);
    380 
    381             $WIOData['Text'] = sprintf($this->Modules['Language']->getString('wio_text'),$OnlineGuestsCounter,$OnlineGhostsCounter,$OnlineMembersCounter,$OnlineUsersCounter,Functions::toDateTime($OnlineUsersRecord[1],TRUE),$OnlineUsersRecord[0]);
     366                $this->modules['Config']->updateValue('online_users_record',implode(',',$OnlineUsersRecord));
     367            }
     368
     369            if($OnlineMembersCounter == 0) $OnlineMembersCounter = $this->modules['Language']->getString('no_members');
     370            elseif($OnlineMembersCounter == 1) $OnlineMembersCounter = $this->modules['Language']->getString('one_member');
     371            else $OnlineMembersCounter = sprintf($this->modules['Language']->getString('x_members'),$OnlineMembersCounter);
     372
     373            if($OnlineGhostsCounter == 0) $OnlineGhostsCounter = $this->modules['Language']->getString('no_ghosts');
     374            elseif($OnlineGhostsCounter == 1) $OnlineGhostsCounter = $this->modules['Language']->getString('one_ghost');
     375            else $OnlineGhostsCounter = sprintf($this->modules['Language']->getString('x_ghosts'),$OnlineGhostsCounter);
     376
     377            if($OnlineGuestsCounter == 0) $OnlineGuestsCounter = $this->modules['Language']->getString('no_guests');
     378            elseif($OnlineGuestsCounter == 1) $OnlineGuestsCounter = $this->modules['Language']->getString('one_guest');
     379            else $OnlineGuestsCounter = sprintf($this->modules['Language']->getString('x_guests'),$OnlineGuestsCounter);
     380
     381            $WIOData['Text'] = sprintf($this->modules['Language']->getString('wio_text'),$OnlineGuestsCounter,$OnlineGhostsCounter,$OnlineMembersCounter,$OnlineUsersCounter,Functions::toDateTime($OnlineUsersRecord[1],TRUE),$OnlineUsersRecord[0]);
    382382            $WIOData['Members'] = implode(', ',$Members);
    383383        }
     
    388388    protected function _loadBoardStatsData() {
    389389        $BoardStatsData = FALSE;
    390         if($this->Modules['Config']->getValue('show_boardstats_forumindex') == 1) {
     390        if($this->modules['Config']->getValue('show_boardstats_forumindex') == 1) {
    391391            $MembersCounter = Functions::getUsersCounter();
    392392            $TopicsCounter = Functions::getTopicsCounter();
    393393            $PostsCounter = Functions::getPostsCounter();
    394394
    395             $BoardStatsData['Text'] = sprintf($this->Modules['Language']->getString('board_stats_text'),$MembersCounter,$PostsCounter,$TopicsCounter,'<a href="index.php?action=viewprofile&amp;profile_id='.$this->Modules['Config']->getValue('newest_user_id').'&amp;'.MYSID.'">'.$this->Modules['Config']->getValue('newest_user_nick').'</a>');
     395            $BoardStatsData['Text'] = sprintf($this->modules['Language']->getString('board_stats_text'),$MembersCounter,$PostsCounter,$TopicsCounter,'<a href="index.php?action=viewprofile&amp;profile_id='.$this->modules['Config']->getValue('newest_user_id').'&amp;'.MYSID.'">'.$this->modules['Config']->getValue('newest_user_nick').'</a>');
    396396        }
    397397        return $BoardStatsData;
  • trunk/modules/Language.class.php

    r2 r5  
    22
    33class Language extends ModuleTemplate {
    4     protected $Strings = array();
    5     protected $LanguageDir = '';
    6     protected $LoadedFiles = array();
    7     protected $LanguageCode = '';
     4    protected $strings = array();
     5    protected $languageDir = '';
     6    protected $loadedFiles = array();
     7    protected $languageCode = '';
    88
    99    public function initializeMe() {
    10         $this->LanguageCode = $this->getConfigValue('DefaultLanguageCode');
    11         $this->LanguageDir = 'languages/'.$this->getConfigValue('DefaultLanguageCode').'/';
    12         foreach($this->getConfigValue('AutoloadFiles') AS $curFile)
     10        $this->languageCode = $this->getConfigValue('defaultLanguageCode');
     11        $this->languageDir = 'languages/'.$this->getConfigValue('defaultLanguageCode').'/';
     12        foreach($this->getConfigValue('autoloadFiles') AS $curFile)
    1313            $this->addFile($curFile);
    14 
    15 
    1614    }
    1715
    1816    public function setLanguageCode($newLanguageCode) {
    19         $this->LanguageCode = $newLanguageCode;
     17        $this->languageCode = $newLanguageCode;
    2018    }
    2119
    2220    public function getLanguageCode() {
    23         return $this->LanguageCode;
     21        return $this->languageCode;
    2422    }
    2523
    2624    public function getLC() {
    27         return $this->LanguageCode;
     25        return $this->languageCode;
    2826    }
    2927
    3028    public function getLD() {
    31         return $this->LanguageDir;
     29        return $this->languageDir;
    3230    }
    3331
    3432    public function addFile($FileName) {
    35         if(!isset($this->LoadedFiles[$FileName])) {
    36             if(file_exists($this->LanguageDir.$FileName.'.language') == FALSE) die('Language file "'.$this->LanguageDir.$FileName.'.language" does not exist');
     33        if(!isset($this->loadedFiles[$FileName])) {
     34            if(file_exists($this->languageDir.$FileName.'.language') == FALSE) die('Language file "'.$this->languageDir.$FileName.'.language" does not exist');
    3735
    38             foreach(explode("\n",file_get_contents($this->LanguageDir.$FileName.'.language')) AS $curLine) {
     36            foreach(explode("\n",file_get_contents($this->languageDir.$FileName.'.language')) AS $curLine) {
    3937                preg_match('/^([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[ ]*=[ ]*"(.*)"$/',rtrim($curLine),$Matches);
    4038
    4139                if(count($Matches) == 3)
    42                     $this->Strings[$Matches[1]] = $Matches[2];
     40                    $this->strings[$Matches[1]] = $Matches[2];
    4341            }
    4442
    45             $this->LoadedFiles[$FileName] = TRUE;
     43            $this->loadedFiles[$FileName] = TRUE;
    4644        }
    4745    }
    4846
    4947    public function resetStrings() {
    50         $this->Strings = array();
     48        $this->strings = array();
    5149    }
    5250
    5351    public function getString($Index) {
    54         if(isset($this->Strings[$Index]) == FALSE) {
     52        if(isset($this->strings[$Index]) == FALSE) {
    5553            trigger_error('Language string "'.$Index.'" does not exist');
    5654            return FALSE;
    5755        }
    58         return $this->Strings[$Index];
     56        return $this->strings[$Index];
    5957    }
    6058
    6159    public function setLanguageDir($newLanguageDir) {
    62         $this->LanguageDir = $newLanguageDir;
     60        $this->languageDir = $newLanguageDir;
    6361    }
    6462}
  • trunk/modules/PageParts.class.php

    r2 r5  
    22
    33class PageParts extends ModuleTemplate {
    4     protected $RequiredModules = array(
     4    protected $requiredModules = array(
    55        'Auth',
    66        'Config',
     
    1010    );
    1111
    12     protected $Flags = array(
    13         'InEditProfile'=>FALSE,
    14         'InAdministration'=>FALSE,
    15         'InPrivateMessages'=>FALSE
     12    protected $flags = array(
     13        'inEditProfile'=>FALSE,
     14        'inAdministration'=>FALSE,
     15        'inPrivateMessages'=>FALSE
    1616    );
    1717
    1818    public function initializeMe() {
    19         $this->Modules['Language']->addFile('PageParts');
     19        $this->modules['Language']->addFile('PageParts');
    2020    }
    2121
    2222    public function setInEditProfile($Value) {
    23         $this->Flags['InEditProfile'] = $Value;
     23        $this->flags['inEditProfile'] = $Value;
    2424    }
    2525
    2626    public function setInAdministration($Value) {
    27         $this->Flags['InAdministration'] = $Value;
     27        $this->flags['inAdministration'] = $Value;
    2828    }
    2929
    3030    public function setInPrivateMessages($Value) {
    31         $this->Flags['InPrivateMessages'] = $Value;
     31        $this->flags['inPrivateMessages'] = $Value;
    3232    }
    3333
    34     public function setFlag($FlagName,$Value) {
    35         $this->Flags[$FlagName] = $Value;
     34    public function setFlag($flagName,$value) {
     35        $this->flags[$flagName] = $value;
    3636    }
    3737
    3838    public function printHeader() {
    39         if($this->Modules['Config']->getValue('board_logo') != '') $BoardBanner = '<img src="'.$this->Modules['Config']->getValue('board_logo').'" alt="'.$this->Modules['Config']->getValue('board_name').'" />';
    40         else $BoardBanner = $this->Modules['Config']->getValue('board_name');
     39        if($this->modules['Config']->getValue('board_logo') != '') $BoardBanner = '<img src="'.$this->modules['Config']->getValue('board_logo').'" alt="'.$this->modules['Config']->getValue('board_name').'" />';
     40        else $BoardBanner = $this->modules['Config']->getValue('board_name');
    4141
    42         if($this->Modules['Auth']->isLoggedIn() == 1) $WelcomeText = sprintf($this->Modules['Language']->getString('welcome_logged_in'),$this->Modules['Auth']->getValue('UserNick'),Functions::toTime(time()),INDEXFILE,MYSID);
    43         else $WelcomeText = sprintf($this->Modules['Language']->getString('welcome_not_logged_in'),$this->Modules['Config']->getValue('board_name'),INDEXFILE,MYSID);
     42        if($this->modules['Auth']->isLoggedIn() == 1) $WelcomeText = sprintf($this->modules['Language']->getString('welcome_logged_in'),$this->modules['Auth']->getValue('UserNick'),Functions::toTime(time()),INDEXFILE,MYSID);
     43        else $WelcomeText = sprintf($this->modules['Language']->getString('welcome_not_logged_in'),$this->modules['Config']->getValue('board_name'),INDEXFILE,MYSID);
    4444
    45         $this->Modules['Template']->assign(array(
     45        $this->modules['Template']->assign(array(
    4646            'BoardBanner'=>$BoardBanner,
    4747            'WelcomeText'=>$WelcomeText
    4848        ));
    4949
    50         $this->Modules['Template']->display('PageHeader.tpl');
     50        $this->modules['Template']->display('PageHeader.tpl');
    5151
    52         if($this->Flags['InEditProfile'])
    53             $this->Modules['Template']->display('EditProfileHeader.tpl');
    54         elseif($this->Flags['InPrivateMessages']) {
    55             $this->Modules['DB']->query("SELECT FolderName,FolderID FROM ".TBLPFX."pms_folders WHERE UserID='".USERID."' ORDER BY FolderName");
    56             $HeaderFoldersData = $this->Modules['DB']->Raw2Array();
     52        if($this->flags['inEditProfile'])
     53            $this->modules['Template']->display('EditProfileHeader.tpl');
     54        elseif($this->flags['inPrivateMessages']) {
     55            $this->modules['DB']->query("SELECT FolderName,FolderID FROM ".TBLPFX."pms_folders WHERE UserID='".USERID."' ORDER BY FolderName");
     56            $HeaderFoldersData = $this->modules['DB']->Raw2Array();
    5757
    5858            array_unshift($HeaderFoldersData, // Fuegt an den Anfang die Standardordner hinzu...
    59                 array('FolderID'=>0,'FolderName'=>$this->Modules['Language']->getString('Inbox')),
    60                 array('FolderID'=>1,'FolderName'=>$this->Modules['Language']->getString('Outbox'))
     59                array('FolderID'=>0,'FolderName'=>$this->modules['Language']->getString('Inbox')),
     60                array('FolderID'=>1,'FolderName'=>$this->modules['Language']->getString('Outbox'))
    6161            );
    6262            reset($HeaderFoldersData);
    6363
    64             $this->Modules['Template']->assign('HeaderFoldersData',$HeaderFoldersData);
     64            $this->modules['Template']->assign('HeaderFoldersData',$HeaderFoldersData);
    6565
    66             $this->Modules['Template']->display('PrivateMessagesHeader.tpl');
     66            $this->modules['Template']->display('PrivateMessagesHeader.tpl');
    6767        }
    6868    }
     
    7070    public function printPage($TemplateName) {
    7171        $this->printHeader();
    72         $this->Modules['Template']->display($TemplateName);
     72        $this->modules['Template']->display($TemplateName);
    7373        $this->printTail();
    7474    }
    7575
    7676    public function printMessage($MessageCode,$AdditionalLinks = array()) {
    77         $this->Modules['Language']->addFile('Messages');
     77        $this->modules['Language']->addFile('Messages');
    7878
    7979        $this->printHeader();
    80         $this->Modules['Template']->assign(array(
    81             'Flags'=>$this->Flags,
    82             'MessageTitle'=>$this->Modules['Language']->getString('message_title_'.$MessageCode),
    83             'MessageText'=>$this->Modules['Language']->getString('message_text_'.$MessageCode),
     80        $this->modules['Template']->assign(array(
     81            'Flags'=>$this->flags,
     82            'MessageTitle'=>$this->modules['Language']->getString('message_title_'.$MessageCode),
     83            'MessageText'=>$this->modules['Language']->getString('message_text_'.$MessageCode),
    8484            'AdditionalLinks'=>$AdditionalLinks
    8585        ));
    86         $this->Modules['Template']->display('Message.tpl');
     86        $this->modules['Template']->display('Message.tpl');
    8787        $this->printTail();
    8888    }
    8989
    9090    public function printTail() {
    91         if($this->Flags['InEditProfile'] == TRUE)
    92             $this->Modules['Template']->display('EditProfileTail.tpl');
    93         elseif($this->Flags['InPrivateMessages'] == TRUE)
    94             $this->Modules['Template']->display('PrivateMessagesTail.tpl');
     91        if($this->flags['inEditProfile'] == TRUE)
     92            $this->modules['Template']->display('EditProfileTail.tpl');
     93        elseif($this->flags['inPrivateMessages'] == TRUE)
     94            $this->modules['Template']->display('PrivateMessagesTail.tpl');
    9595
    96         $this->Modules['Template']->display('PageTail.tpl');
     96        $this->modules['Template']->display('PageTail.tpl');
    9797    }
    9898
    9999    public function printPopupHeader() {
    100         $this->Modules['Template']->display('PopupHeader.tpl');
     100        $this->modules['Template']->display('PopupHeader.tpl');
    101101    }
    102102
    103103    public function printPopupTail() {
    104         $this->Modules['Template']->display('PopupTail.tpl');
     104        $this->modules['Template']->display('PopupTail.tpl');
    105105    }
    106106
    107107    public function printPopupPage($TemplateName) {
    108108        $this->printPopupHeader();
    109         $this->Modules['Template']->display($TemplateName);
     109        $this->modules['Template']->display($TemplateName);
    110110        $this->printPopupTail();
    111111    }
  • trunk/modules/Session.class.php

    r2 r5  
    22
    33class Session extends ModuleTemplate {
    4     protected $RequiredModules = array(
     4    protected $requiredModules = array(
    55        'Template',
    66        'DB'
     
    2727
    2828        define('MYSID',$MySID);
    29         $this->Modules['Template']->assign('MySID',$MySID);
     29        $this->modules['Template']->assign('MySID',$MySID);
    3030    }
    3131
     
    3939
    4040    public function DataHandlerRead($SessionID) {
    41         $this->Modules['DB']->query("SELECT SessionData FROM ".TBLPFX."sessions WHERE SessionID='$SessionID'");
    42         if($this->Modules['DB']->getAffectedRows() == 0) {
    43             $this->Modules['DB']->query("INSERT INTO ".TBLPFX."sessions (SessionID) VALUES ('$SessionID')");
     41        $this->modules['DB']->query("SELECT SessionData FROM ".TBLPFX."sessions WHERE SessionID='$SessionID'");
     42        if($this->modules['DB']->getAffectedRows() == 0) {
     43            $this->modules['DB']->query("INSERT INTO ".TBLPFX."sessions (SessionID) VALUES ('$SessionID')");
    4444            return "";
    4545        }
    4646
    47         list($SessionData) = $this->Modules['DB']->fetchArray();
     47        list($SessionData) = $this->modules['DB']->fetchArray();
    4848        return $SessionData;
    4949    }
    5050
    5151    public function DataHandlerWrite($SessionID,$SessionData) {
    52         $SessionData = $this->Modules['DB']->escapeString($SessionData);
     52        $SessionData = $this->modules['DB']->escapeString($SessionData);
    5353
    54         $this->Modules['DB']->query("UPDATE ".TBLPFX."sessions SET SessionData='$SessionData', SessionLastUpdate=NOW() WHERE SessionID='$SessionID'");
    55         if($this->Modules['DB']->getAffectedRows() == 0)
     54        $this->modules['DB']->query("UPDATE ".TBLPFX."sessions SET SessionData='$SessionData', SessionLastUpdate=NOW() WHERE SessionID='$SessionID'");
     55        if($this->modules['DB']->getAffectedRows() == 0)
    5656            return FALSE;
    5757
     
    6060
    6161    function DataHandlerDestroy($SessionID) {
    62         $this->Modules['DB']->query("DELETE FROM ".TBLPFX."sessions WHERE SessionID='$SessionID'");
    63         return ($this->Modules['DB']->getAffectedRows() == 0) ? FALSE : TRUE;
     62        $this->modules['DB']->query("DELETE FROM ".TBLPFX."sessions WHERE SessionID='$SessionID'");
     63        return ($this->modules['DB']->getAffectedRows() == 0) ? FALSE : TRUE;
    6464    }
    6565
    6666    function DataHandlerGc($SessionMaxLifeTime) {
    67         $this->Modules['DB']->query("DELETE FROM ".TBLPFX."sessions WHERE SessionLastUpdate<'".$this->Modules['DB']->fromUnixTimestamp(time()-$SessionMaxLifeTime)."'");
     67        $this->modules['DB']->query("DELETE FROM ".TBLPFX."sessions WHERE SessionLastUpdate<'".$this->modules['DB']->fromUnixTimestamp(time()-$SessionMaxLifeTime)."'");
    6868
    6969        return TRUE;
  • trunk/modules/Template.class.php

    r3 r5  
    11<?php
    22
    3 include('smarty/Smarty.class.php');
     3include('Template/Smarty.class.php');
    44
    5 class Template extends Smarty {
    6     public function setDirs($DirName) {
    7         $this->template_dir = 'templates/'.$DirName.'/templates';
    8         $this->compile_dir = 'templates/'.$DirName.'/templates_c';
    9         $this->cache_dir = 'templates/'.$DirName.'/cache';
    10         $this->config_dir = 'templates/'.$DirName.'/configs';
     5class Template extends ModuleTemplate {
     6    protected $smarty = NULL;
     7
     8    public function setDirs($dirName) {
     9        $this->smarty->template_dir = 'templates/'.$dirName.'/templates';
     10        $this->smarty->compile_dir = 'templates/'.$dirName.'/templates_c';
     11        $this->smarty->cache_dir = 'templates/'.$dirName.'/cache';
     12        $this->smarty->config_dir = 'templates/'.$dirName.'/configs';
    1113    }
    1214
    1315    public function getTemplateDir() {
    14         return $this->template_dir;
     16        return $this->smarty->template_dir;
    1517    }
    1618
    1719    public function getTD() {
    18         return $this->template_dir;
     20        return $this->smarty->template_dir;
    1921    }
    2022
    2123    public function initializeMe() {
    22         $this->error_reporting = E_ALL;
     24        $this->smarty = new Smarty;
     25
     26        $this->setDirs($this->getC('defaultTemplateDir'));
     27        $this->smarty->assign('IndexFile',INDEXFILE);
     28
     29        $modules = &Factory::getInstances();
     30        $this->smarty->assign_by_ref('modules',$modules);
     31    }
     32
     33    public function assign($value1, $value2 = NULL) {
     34        $this->smarty->assign($value1, $value2);
     35    }
     36
     37    public function display($value1) {
     38        $this->smarty->display($value1);
    2339    }
    2440}
  • trunk/templates/std/templates/ForumIndex.tpl

    r3 r5  
    11<script>
    22
    3 TemplateDir = "{$Modules.Template->getTemplateDir()}";
     3TemplateDir = "{$modules.Template->getTemplateDir()}";
    44ClosedCatIDs = new Array();
    55
     
    4242{if $NewsData != FALSE}
    4343 <table class="TableStd" width="100%">
    44  <tr><td class="CellTitle"><span class="FontTitle">{$Modules.Language->getString('Latest_news')}</span></td></tr>
     44 <tr><td class="CellTitle"><span class="FontTitle">{$modules.Language->getString('Latest_news')}</span></td></tr>
    4545 <tr><td class="CellStd"><span class="FontNorm"><b>{$news_data.news_title}</b><br/><br/>{$news_data.news_text}</span><br/><br/><span class="FontSmall">{$news_comments_link}</span></td></tr>
    4646 </table>
     
    5151<tr>
    5252 <td class="CellTitle">&nbsp;</td>
    53  <td class="CellTitle" align="center"><span class="FontTitleSmall">{$Modules.Language->getString('Forum')}</span></td>
    54  <td class="CellTitle" align="center"><span class="FontTitleSmall">{$Modules.Language->getString('Topics')}</span></td>
    55  <td class="CellTitle" align="center"><span class="FontTitleSmall">{$Modules.Language->getString('Posts')}</span></td>
    56  <td class="CellTitle" align="center"><span class="FontTitleSmall">{$Modules.Language->getString('Last_post')}</span></td>
    57  <td class="CellTitle" align="center"><span class="FontTitleSmall">{$Modules.Language->getString('Moderators')}</span></td>
     53 <td class="CellTitle" align="center"><span class="FontTitleSmall">{$modules.Language->getString('Forum')}</span></td>
     54 <td class="CellTitle" align="center"><span class="FontTitleSmall">{$modules.Language->getString('Topics')}</span></td>
     55 <td class="CellTitle" align="center"><span class="FontTitleSmall">{$modules.Language->getString('Posts')}</span></td>
     56 <td class="CellTitle" align="center"><span class="FontTitleSmall">{$modules.Language->getString('Last_post')}</span></td>
     57 <td class="CellTitle" align="center"><span class="FontTitleSmall">{$modules.Language->getString('Moderators')}</span></td>
    5858</tr>
    5959</thead>
     
    6161 {if $curCat.CatID != $CatID}
    6262  <tbody>
    63   <tr><td class="CellCat" colspan="6"><a href="javascript:switchCatStatus({$curCat.CatID});"><img border="0" src="{$Modules.Template->getTemplateDir()}/images/{if $curCat.CatIsOpen == 1}minus{else}plus{/if}.gif" id="CatPic{$curCat.CatID}"/></a>&nbsp;<span class="FontCat"><a class="FontCat" href="{$IndexFile}?CatID={$curCat.CatID}&amp;{$MySID}">{$curCat.CatName}</a></span></td></tr>
     63  <tr><td class="CellCat" colspan="6"><a href="javascript:switchCatStatus({$curCat.CatID});"><img border="0" src="{$modules.Template->getTemplateDir()}/images/{if $curCat.CatIsOpen == 1}minus{else}plus{/if}.gif" id="CatPic{$curCat.CatID}"/></a>&nbsp;<span class="FontCat"><a class="FontCat" href="{$IndexFile}?CatID={$curCat.CatID}&amp;{$MySID}">{$curCat.CatName}</a></span></td></tr>
    6464  </tbody>
    6565 {/if}
     
    8181    <tr>
    8282     <td align="center">{$curForum.ForumLastPostPic}</td>
    83      <td align="left"><span class="FontSmall">{$curForum.ForumLastPostText}</span></td>
     83     <td align="left" style="padding-left:4px;"><span class="FontSmall">{$curForum.ForumLastPostText}</span></td>
    8484    </tr>
    8585    </table>
     
    9595{if $BoardStatsData != FALSE}
    9696 <table class="TableStd" width="100%">
    97  <tr><td class="CellTitle"><span class="FontTitle">{$Modules.Language->getString('Board_statistics')}</span></td></tr>
     97 <tr><td class="CellTitle"><span class="FontTitle">{$modules.Language->getString('Board_statistics')}</span></td></tr>
    9898 <tr><td class="CellStd"><span class="FontSmall">{$BoardStatsData.Text}</span></td></tr>
    9999 </table>
     
    102102{if $WIOData != FALSE}
    103103 <table class="TableStd" width="100%">
    104  <tr><td class="CellTitle"><span class="FontTitle">{$Modules.Language->getString('Who_is_online')}</span></td></tr>
     104 <tr><td class="CellTitle"><span class="FontTitle">{$modules.Language->getString('Who_is_online')}</span></td></tr>
    105105 <tr><td class="CellStd"><span class="FontSmall">{$WIOData.Text}</span><hr /><span class="FontSmall">{$WIOData.Members}</span></td></tr>
    106106 </table>
     
    109109<!--<template:latestpostsbox>
    110110 <table class="TableStd" width="100%">
    111  <tr><td class="CellTitle"><span class="FontTitle">{$Modules.Language->getString('Latest_posts')}</span></td></tr>
     111 <tr><td class="CellTitle"><span class="FontTitle">{$modules.Language->getString('Latest_posts')}</span></td></tr>
    112112 <template:postrow>
    113113  <tr><td class="CellStd"><span class="FontSmall">{$akt_latest_post_text}</span></td></tr>
  • trunk/templates/std/templates/PageHeader.tpl

    r3 r5  
    11<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    2 <html xmlns="http://www.w3.org/1999/xhtml" dir="{$Modules.Language->getString('html_direction')}" lang="{$Modules.Language->getString('html_language')}" xml:lang="{$Modules.Language->getString('html_language')}">
     2<html xmlns="http://www.w3.org/1999/xhtml" dir="{$modules.Language->getString('html_direction')}" lang="{$modules.Language->getString('html_language')}" xml:lang="{$modules.Language->getString('html_language')}">
    33<head>
    4  <title>{$Modules.Navbar->parseElements(0)}</title>
     4 <title>{$modules.Navbar->parseElements(0)}</title>
    55 <link rel="stylesheet" href="templates/std/templates/styles/ts_tbb2_standard.css" type="text/css"></link>
    6  <meta http-equiv="Content-Type" content="text/html; charset={$Modules.Language->getString('html_encoding')}"/>
     6 <meta http-equiv="Content-Type" content="text/html; charset={$modules.Language->getString('html_encoding')}"/>
    77 <meta http-equiv="Content-Style-Type" content="text/css"/>
    88 <script src="templates/std/templates/jscripts.js" type="text/javascript"></script>
     
    2222 <tr><td style="background-color:#c5e8f9; background-image:url(images/bck.jpg);"><!--<span class="big">{$BoardBanner}</span>--><img src="images/test.jpg"/></td></tr>
    2323  <tr><td align="center" style="background-color:#aec9d7; padding-bottom:4px;"><span class="FontSmall">
    24   {if $Modules.Auth->isLoggedIn() == 1}
    25    <a href="{$IndexFile}?Action=EditProfile&amp;{$MySID}"><img src="templates/std/templates/images/buttons/de/myprofile.png" class="ImageButton" alt="{$Modules.Language->getString('My_profile')}" border="0"/></a>
    26    <a href="{$IndexFile}?Action=ViewHelp&amp;{$MySID}"><img src="templates/std/templates/images/buttons/de/help.png" class="ImageButton" alt="{$Modules.Language->getString('Help')}" border="0"/></a>
    27    <a href="{$IndexFile}?Action=PrivateMessages&amp;{$MySID}"><img src="templates/std/templates/images/buttons/de/pms.png" class="ImageButton" alt="{$Modules.Language->getString('Private_messages')}" border="0"/></a>
    28    <a href="{$IndexFile}?Action=Search&amp;{$MySID}"><img src="templates/std/templates/images/buttons/de/search.png" class="ImageButton" alt="{$Modules.Language->getString('Search')}" border="0"/></a>
    29    <a href="{$IndexFile}?Action=MemberList&amp;{$MySID}"><img src="templates/std/templates/images/buttons/de/memberlist.png" class="ImageButton" alt="{$Modules.Language->getString('Memberlist')}" border="0"/></a>
    30    <a href="{$IndexFile}?Action=WhoIsOnline&amp;{$MySID}"><img src="templates/std/templates/images/buttons/de/whoisonline.png" class="ImageButton" alt="{$Modules.Language->getString('Who_is_online')}" border="0"/></a>
    31    <a href="{$IndexFile}?Action=Logout&amp;{$MySID}"><img src="templates/std/templates/images/buttons/de/logout.png" class="ImageButton" alt="{$Modules.Language->getString('Logout')}" border="0"/></a>
     24  {if $modules.Auth->isLoggedIn() == 1}
     25   <a href="{$IndexFile}?Action=EditProfile&amp;{$MySID}"><img src="templates/std/templates/images/buttons/de/myprofile.png" class="ImageButton" alt="{$modules.Language->getString('My_profile')}" border="0"/></a>
     26   <a href="{$IndexFile}?Action=ViewHelp&amp;{$MySID}"><img src="templates/std/templates/images/buttons/de/help.png" class="ImageButton" alt="{$modules.Language->getString('Help')}" border="0"/></a>
     27   <a href="{$IndexFile}?Action=PrivateMessages&amp;{$MySID}"><img src="templates/std/templates/images/buttons/de/pms.png" class="ImageButton" alt="{$modules.Language->getString('Private_messages')}" border="0"/></a>
     28   <a href="{$IndexFile}?Action=Search&amp;{$MySID}"><img src="templates/std/templates/images/buttons/de/search.png" class="ImageButton" alt="{$modules.Language->getString('Search')}" border="0"/></a>
     29   <a href="{$IndexFile}?Action=MemberList&amp;{$MySID}"><img src="templates/std/templates/images/buttons/de/memberlist.png" class="ImageButton" alt="{$modules.Language->getString('Memberlist')}" border="0"/></a>
     30   <a href="{$IndexFile}?Action=WhoIsOnline&amp;{$MySID}"><img src="templates/std/templates/images/buttons/de/whoisonline.png" class="ImageButton" alt="{$modules.Language->getString('Who_is_online')}" border="0"/></a>
     31   <a href="{$IndexFile}?Action=Logout&amp;{$MySID}"><img src="templates/std/templates/images/buttons/de/logout.png" class="ImageButton" alt="{$modules.Language->getString('Logout')}" border="0"/></a>
    3232  {else}
    33    <a href="{$IndexFile}?Action=Register&amp;{$MySID}"><img src="templates/std/templates/images/buttons/de/register.png" class="ImageButton" alt="{$Modules.Language->getString('Register')}" border="0"/></a>
    34    <a href="{$IndexFile}?Action=ViewHelp&amp;{$MySID}"><img src="templates/std/templates/images/buttons/de/help.png" class="ImageButton" alt="{$Modules.Language->getString('Help')}" border="0"/></a>
    35    <a href="{$IndexFile}?Action=Search&amp;{$MySID}"><img src="templates/std/templates/images/buttons/de/search.png" class="ImageButton" alt="{$Modules.Language->getString('Search')}" border="0"/></a>
    36    <a href="{$IndexFile}?Action=MemberList&amp;{$MySID}"><img src="templates/std/templates/images/buttons/de/memberlist.png" class="ImageButton" alt="{$Modules.Language->getString('Memberlist')}" border="0"/></a>
    37    <a href="{$IndexFile}?Action=WhoIsOnline&amp;{$MySID}"><img src="templates/std/templates/images/buttons/de/whoisonline.png" class="ImageButton" alt="{$Modules.Language->getString('Who_is_online')}" border="0"/></a>
    38    <a href="{$IndexFile}?Action=Login&amp;{$MySID}"><img src="templates/std/templates/images/buttons/de/login.png" class="ImageButton" alt="{$Modules.Language->getString('Login')}" border="0"/></a>
     33   <a href="{$IndexFile}?Action=Register&amp;{$MySID}"><img src="templates/std/templates/images/buttons/de/register.png" class="ImageButton" alt="{$modules.Language->getString('Register')}" border="0"/></a>
     34   <a href="{$IndexFile}?Action=ViewHelp&amp;{$MySID}"><img src="templates/std/templates/images/buttons/de/help.png" class="ImageButton" alt="{$modules.Language->getString('Help')}" border="0"/></a>
     35   <a href="{$IndexFile}?Action=Search&amp;{$MySID}"><img src="templates/std/templates/images/buttons/de/search.png" class="ImageButton" alt="{$modules.Language->getString('Search')}" border="0"/></a>
     36   <a href="{$IndexFile}?Action=MemberList&amp;{$MySID}"><img src="templates/std/templates/images/buttons/de/memberlist.png" class="ImageButton" alt="{$modules.Language->getString('Memberlist')}" border="0"/></a>
     37   <a href="{$IndexFile}?Action=WhoIsOnline&amp;{$MySID}"><img src="templates/std/templates/images/buttons/de/whoisonline.png" class="ImageButton" alt="{$modules.Language->getString('Who_is_online')}" border="0"/></a>
     38   <a href="{$IndexFile}?Action=Login&amp;{$MySID}"><img src="templates/std/templates/images/buttons/de/login.png" class="ImageButton" alt="{$modules.Language->getString('Login')}" border="0"/></a>
    3939  {/if}
    4040  </span></td></tr>
     
    4444</form>
    4545<!--<br/>
    46 <div class="DivInfoBox"><span class="FontInfoBox"><img src="{$Modules.Template->getTemplateDir()}/images/icons/Info.gif" class="ImageIcon" alt="" border="0"/>{$WelcomeText}</span></div>
     46<div class="DivInfoBox"><span class="FontInfoBox"><img src="{$modules.Template->getTemplateDir()}/images/icons/Info.gif" class="ImageIcon" alt="" border="0"/>{$WelcomeText}</span></div>
    4747-->
    4848<br/>
     
    5252  <table border="0" cellpadding="0" cellspacing="0" width="100%">
    5353   <tr>
    54     <td><span class="FontNavbar">{$Modules.Navbar->parseElements()}</span></td>
    55     <td align="right"><span class="FontNavbar">{$Modules.Navbar->getRightArea()}</span></td>
     54    <td><span class="FontNavbar">{$modules.Navbar->parseElements()}</span></td>
     55    <td align="right"><span class="FontNavbar">{$modules.Navbar->getRightArea()}</span></td>
    5656   </tr>
    5757  </table>
Note: See TracChangeset for help on using the changeset viewer.