X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fglobals.inc.php.in;h=9bb1b54f139a2fc14a7550c0b858ead74f4b1ef4;hb=794feea76e0979eba4e125bb91b7ea43680f26e0;hp=a99a6b4ed73a3038bc037496be51370a8fda4919;hpb=27ae65e38edd32fd2154c3c9c852eb5b8ffc0b3b;p=platal.git diff --git a/include/globals.inc.php.in b/include/globals.inc.php.in index a99a6b4..9bb1b54 100644 --- a/include/globals.inc.php.in +++ b/include/globals.inc.php.in @@ -1,6 +1,6 @@ read/write, + // 'r' => read/only + // '' => site down /** db params */ - var $dbdb = 'x4dat'; - var $dbhost = 'localhost'; - var $dbuser = 'x4dat'; - var $dbpwd = 'x4dat'; + public $dbdb = 'x4dat'; + public $dbhost = 'localhost'; + public $dbuser = 'x4dat'; + public $dbpwd = 'x4dat'; + public $dbcharset = 'utf8'; + + /** default skin */ + public $skin; + public $register_skin; /** paths */ - var $baseurl; - var $spoolroot; + public $baseurl; + public $spoolroot; - var $locale; - var $timezone; + public $locale; + public $timezone; - function PlatalGlobals($sess) + public function __construct($sess) { $this->session = $sess; $base = empty($_SERVER['HTTPS']) ? 'http://' : 'https://'; - $this->baseurl = trim($base.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']), '/'); + $this->baseurl = @trim($base.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']), '/'); $this->spoolroot = dirname(dirname(__FILE__)); $this->read_config(); - - $this->dbconnect(); $this->setlocale(); } - function read_ini_file($filename) + private function read_ini_file($filename) { $array = parse_ini_file($filename, true); if (!is_array($array)) { @@ -75,28 +81,22 @@ class PlatalGlobals } } - function read_config() + private function read_config() { $this->read_ini_file($this->spoolroot.'/configs/platal.ini'); - $this->read_ini_file($this->spoolroot.'/configs/platal.conf'); } - function dbconnect() - { - @mysql_connect($this->dbhost, $this->dbuser, $this->dbpwd); - @mysql_select_db($this->dbdb); - } - - function setlocale() + private function setlocale() { setlocale(LC_MESSAGES, $this->locale); setlocale(LC_TIME, $this->locale); setlocale(LC_CTYPE, $this->locale); date_default_timezone_set($this->timezone); + mb_internal_encoding("UTF-8"); } - function asso($key=null) + public function asso($key=null) { static $aid = null; @@ -107,7 +107,7 @@ class PlatalGlobals } if ($gp) { - $res = XDB::query('SELECT a.*, d.nom AS domnom + $res = XDB::query('SELECT a.*, d.nom AS domnom, FIND_IN_SET(\'wiki_desc\', a.flags) AS wiki_desc FROM groupex.asso AS a LEFT JOIN groupex.dom AS d ON d.id = a.dom WHERE diminutif = {?}', $gp); @@ -128,5 +128,5 @@ class PlatalGlobals } } -// vim:set et sw=4 sts=4 sws=4 foldmethod=marker: +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?>