X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fglobals.inc.php.in;h=2ddbcc1e72b3aa814b2fe15806208fc83d8a4df1;hb=4a28e567307ee8061d96f631547fe24c68f0f5eb;hp=7672412bffa2065b441f50073b99b39f23031640;hpb=c4c8da69a5718740241d4f11c2f6cc3bba447396;p=platal.git diff --git a/include/globals.inc.php.in b/include/globals.inc.php.in index 7672412..2ddbcc1 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'; - /** paths */ - var $baseurl; - var $spoolroot; + /** default skin */ + public $skin; + public $register_skin; - 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->spoolroot = dirname(dirname(dirname(__FILE__))); - - $this->read_config(); - - $this->dbconnect(); - $this->setlocale(); + $this->session = $sess; /* XXX Remove references to session from $globals */ + parent::__construct(array('platal.ini', 'platal.conf')); } - function read_config() - { - $array = parse_ini_file($this->spoolroot.'/configs/platal.ini', true); - foreach ($array as $cat => $conf) { - $c = strtolower($cat); - foreach ($conf as $k => $v) { - $this->$c->$k = $v; - } - } - - $array = parse_ini_file($this->spoolroot.'/configs/platal.conf', true); - if (!is_array($array)) { - return; - } - - foreach ($array as $cat=>$conf) { - $c = strtolower($cat); - foreach ($conf as $key=>$val) { - if ($c == 'core' && isset($this->$key)) { - $this->$key=$val; - } else { - $this->$c->$key = $val; - } - } - } - } - - function dbconnect() - { - @mysql_connect($this->dbhost, $this->dbuser, $this->dbpwd); - @mysql_select_db($this->dbdb); - } - - function setlocale() - { - global $globals; - setlocale(LC_MESSAGES, $globals->core->locale); - setlocale(LC_TIME, $globals->core->locale); - setlocale(LC_CTYPE, $globals->core->locale); - } - - function asso($key=null) + public function asso($key=null) { static $aid = null; if (is_null($aid)) { $gp = Get::v('n'); - $gp = substr($gp, 0, strpos($gp, '/')); + if ($p = strpos($gp, '/')) { + $gp = substr($gp, 0, $p); + } 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, + FIND_IN_SET(\'notif_unsub\', a.flags) AS notif_unsub FROM groupex.asso AS a LEFT JOIN groupex.dom AS d ON d.id = a.dom WHERE diminutif = {?}', $gp); @@ -122,5 +81,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: ?>