<?php
/***************************************************************************
- * Copyright (C) 2003-2006 Polytechnique.org *
+ * Copyright (C) 2003-2007 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
class PlatalGlobals
{
- var $session;
+ public $session;
/** The x.org version */
- var $version = '@VERSION@';
- var $debug = 0;
+ public $version = '@VERSION@';
+ public $debug = 0;
+ public $mode = 'rw'; // 'rw' => 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;
+ 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)) {
foreach ($array as $cat => $conf) {
$c = strtolower($cat);
foreach ($conf as $k => $v) {
- if ($c == 'core' && isset($this->$k)) {
+ if ($c == 'core' && property_exists($this, $k)) {
$this->$k=$v;
} else {
if (!isset($this->$c)) {
}
}
- 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;
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
FROM groupex.asso AS a
LEFT JOIN groupex.dom AS d ON d.id = a.dom
WHERE diminutif = {?}', $gp);
}
}
-// 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:
?>