Source for file Index.class.php

Documentation is available at Index.class.php

  1. <?php
  2. /**
  3.  * Class Index, login page creator
  4.  *
  5.  * LICENSE: CREATIVE COMMONS PUBLIC LICENSE  "Namensnennung — Nicht-kommerziell 2.0"
  6.  *
  7.  * @copyright  2009 <SEDesign />
  8.  * @license    http://creativecommons.org/licenses/by-nc/2.0/de/
  9.  * @version    $3.0.6$
  10.  * @link       http://www.sedesign.de/de_produkte_chat-v3.html
  11.  * @since      File available since Alpha 1.0
  12.  */
  13.  
  14. class Index extends DbConectionMaker
  15. {
  16.     /**
  17.     * LangXml Obj for login page
  18.     * @var LangXml 
  19.     */
  20.     public $lang;
  21.     
  22.     /**
  23.     * Unix timestamp for login form. This serve as a test for bot blocking.
  24.     * @var int 
  25.     */
  26.     public $aktuell_date_u;
  27.     
  28.     /**
  29.     * Constructor
  30.     *
  31.     * @uses ConnectDB::sqlSet()
  32.     * @uses ConnectDB::close()
  33.     * @return void 
  34.     */
  35.     public function __construct (){
  36.     
  37.         // call parent Constructor from class DbConectionMaker
  38.         parent::__construct();
  39.             
  40.         // starts session in index.php
  41.         session_start();
  42.         
  43.         // Sets  cookie with Unix timestamp. This serve as a test for bot blocking.
  44.         setcookie($this->_prefix."cookie_test"date('U'));
  45.         
  46.         // Sets charset and content-type for index.php
  47.         header('content-type: text/html; charset=utf-8');
  48.         
  49.         // Set all Data from [prefix]_etchat_config Table to Session-Vars. So needs only to be run once on login page.
  50.         $this->configTabData2Session();
  51.         
  52.         // something like cron-job to delete wasteful/old data from db
  53.         $this->dbObj->sqlSet("delete FROM {$this->_prefix}etchat_messages where etchat_timestamp < ".(date('U')-($_SESSION['etchat_'.$this->_prefix.'loeschen_nach']*3600*24)));
  54.         $this->dbObj->sqlSet("delete FROM {$this->_prefix}etchat_blacklist where etchat_blacklist_time < ".date('U'));
  55.         $this->dbObj->sqlSet("delete FROM {$this->_prefix}etchat_kick_user where etchat_kicked_user_time < ".date('U'));
  56.  
  57.         // close db connection
  58.         $this->dbObj->close();
  59.         
  60.         // create new LangXml Object
  61.         $langObj = new LangXml;
  62.         $this->lang=$langObj->getLang()->index_php[0];
  63.         
  64.         $this->aktuell_date_u=date('U');
  65.         $_SESSION[$this->_prefix.'set_check']=md5($this->aktuell_date_u);
  66.         
  67.         // initialize index template
  68.         $this->initTemplate();
  69.     }
  70.     
  71.     /**
  72.     * Initializer for template
  73.     *
  74.     * @return void
  75.     */
  76.     private function initTemplate(){
  77.         // Include Template
  78.         include_once("styles/".$_SESSION['etchat_'.$this->_prefix.'style']."/index.tpl.html");
  79.     }
  80.     

Documentation generated on Thu, 05 May 2011 14:05:56 +0000 by phpDocumentor 1.4.3