remove include/{xnet,xorg}/globals.inc.php.
authorx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Mon, 31 Jul 2006 19:30:39 +0000 (19:30 +0000)
committerx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Mon, 31 Jul 2006 19:30:39 +0000 (19:30 +0000)
merge all in platal/globals.inc.php \o/

git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@756 839d8a87-29fc-0310-9880-83ba4fa771e5

configs/platal.ini
include/platal/globals.inc.php.in
include/xnet.inc.php
include/xnet/globals.inc.php [deleted file]
include/xorg.inc.php
include/xorg/globals.inc.php [deleted file]

index 2c9e019..3125e03 100644 (file)
@@ -1,3 +1,6 @@
+[Core]
+locale = 'fr_FR'
+
 [Banana]
 server = "localhost"
 port   = 119
index adf834d..7672412 100644 (file)
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
-class CoreConfig
-{
-    var $locale = 'fr_FR';
-}
-
 class PlatalGlobals
 {
-    var $page    = 'XorgPage';
     var $session;
-    var $menu;
-    var $hook;
 
     /** The x.org version */
     var $version = '@VERSION@';
@@ -41,9 +33,6 @@ class PlatalGlobals
     var $dbuser             = 'x4dat';
     var $dbpwd              = 'x4dat';
 
-    /** The class to use for session handling. */
-    var $session = 'DiogenesCoreSession';
-
     /** paths */
     var $baseurl;
     var $spoolroot;
@@ -55,12 +44,11 @@ class PlatalGlobals
         $base = empty($_SERVER['HTTPS']) ? 'http://' : 'https://';
         $this->baseurl   = trim($base.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']), '/');
         $this->spoolroot = dirname(dirname(dirname(__FILE__)));
-    }
 
-    function dbconnect()
-    {
-        @mysql_connect($this->dbhost, $this->dbuser, $this->dbpwd);
-        @mysql_select_db($this->dbdb);
+        $this->read_config();
+
+        $this->dbconnect();
+        $this->setlocale();
     }
 
     function read_config()
@@ -90,6 +78,12 @@ class PlatalGlobals
         }
     }
 
+    function dbconnect()
+    {
+        @mysql_connect($this->dbhost, $this->dbuser, $this->dbpwd);
+        @mysql_select_db($this->dbdb);
+    }
+
     function setlocale()
     {
         global $globals;
@@ -97,6 +91,35 @@ class PlatalGlobals
         setlocale(LC_TIME,     $globals->core->locale);
         setlocale(LC_CTYPE,    $globals->core->locale);
     }
+
+    function asso($key=null)
+    {
+        static $aid = null;
+
+        if (is_null($aid)) {
+            $gp = Get::v('n');
+            $gp = substr($gp, 0, strpos($gp, '/'));
+
+            if ($gp) {
+                $res = XDB::query('SELECT  a.*, d.nom AS domnom
+                                     FROM  groupex.asso AS a
+                                LEFT JOIN  groupex.dom  AS d ON d.id = a.dom
+                                    WHERE  diminutif = {?}', $gp);
+                if (!($aid = $res->fetchOneAssoc())) {
+                    $aid = array();
+                }
+            } else {
+                $aid = array();
+            }
+        }
+        if (empty($key)) {
+            return $aid;
+        } elseif ( isset($aid[$key]) ) {
+            return $aid[$key];
+        } else {
+            return null;
+        }
+    }
 }
 
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
index 98275a3..6b58906 100644 (file)
  ***************************************************************************/
 
 require_once('platal.inc.php');
-require_once('xnet/globals.inc.php');
+require_once('platal/globals.inc.php');
 require_once('xnet/session.inc.php');
-XnetGlobals::init();
-XnetGlobals::setlocale();
+$globals = new PlatalGlobals('XnetSession');
 XnetSession::init();
 
 // {{{ function new_skinned_page()
diff --git a/include/xnet/globals.inc.php b/include/xnet/globals.inc.php
deleted file mode 100644 (file)
index c36f80d..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2006 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-require_once('platal/globals.inc.php');
-
-class XnetGlobals extends PlatalGlobals
-{
-    function XnetGlobals()
-    {
-        $this->PlatalGlobals('XnetSession');
-    }
-
-    function init()
-    {
-        global $globals;
-
-        $globals       = new XnetGlobals;
-        $globals->core = new CoreConfig;
-
-        $globals->read_config();
-
-        $globals->dbconnect();
-    }
-
-    function asso($key=null)
-    {
-        static $aid = null;
-
-        if (is_null($aid)) {
-            $gp = Get::v('n');
-            $gp = substr($gp, 0, strpos($gp, '/'));
-
-            if ($gp) {
-                $res = XDB::query('SELECT  a.*, d.nom AS domnom
-                                     FROM  groupex.asso AS a
-                                LEFT JOIN  groupex.dom  AS d ON d.id = a.dom
-                                    WHERE  diminutif = {?}', $gp);
-                if (!($aid = $res->fetchOneAssoc())) {
-                    $aid = array();
-                }
-            } else {
-                $aid = array();
-            }
-        }
-        if (empty($key)) {
-            return $aid;
-        } elseif ( isset($aid[$key]) ) {
-            return $aid[$key];
-        } else {
-            return null;
-        }
-    }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
-?>
index 6bf7752..b473e1f 100644 (file)
  ***************************************************************************/
 
 require_once('platal.inc.php');
-require_once('xorg/globals.inc.php');
+require_once('platal/globals.inc.php');
 require_once('xorg/session.inc.php');
-XorgGlobals::init();
-XorgGlobals::setlocale();
+$globals = new PlatalGlobals('XorgSession');
 XorgSession::init();
 
 require_once dirname(__FILE__).'/../classes/Page.php';
diff --git a/include/xorg/globals.inc.php b/include/xorg/globals.inc.php
deleted file mode 100644 (file)
index 1a9fe1f..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2006 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-require_once('platal/globals.inc.php');
-
-class XorgGlobals extends PlatalGlobals
-{
-    function XorgGlobals()
-    {
-        $this->PlatalGlobals('XorgSession');
-    }
-
-    function init()
-    {
-        global $globals;
-
-        $globals       = new XorgGlobals;
-        $globals->core = new CoreConfig;
-
-        $globals->read_config();
-
-        $globals->dbconnect();
-    }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
-?>