Closes #677: Wiki syntax for announces even after validation, and wiki
[platal.git] / include / globals.inc.php.in
index 31a5760..9bb1b54 100644 (file)
 
 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';
-    var $dbcharset          = 'utf8';
+    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->setlocale();
     }
 
-    function read_ini_file($filename)
+    private function read_ini_file($filename)
     {
         $array = parse_ini_file($filename, true);
         if (!is_array($array)) {
@@ -74,22 +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 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;
 
@@ -100,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);