From: x2000habouzit Date: Mon, 31 Jul 2006 19:30:39 +0000 (+0000) Subject: remove include/{xnet,xorg}/globals.inc.php. X-Git-Tag: xorg/0.9.11~159 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=ea6398d17ff92793b0a76d6fffc88147bb40a203;p=platal.git remove include/{xnet,xorg}/globals.inc.php. merge all in platal/globals.inc.php \o/ git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@756 839d8a87-29fc-0310-9880-83ba4fa771e5 --- diff --git a/configs/platal.ini b/configs/platal.ini index 2c9e019..3125e03 100644 --- a/configs/platal.ini +++ b/configs/platal.ini @@ -1,3 +1,6 @@ +[Core] +locale = 'fr_FR' + [Banana] server = "localhost" port = 119 diff --git a/include/platal/globals.inc.php.in b/include/platal/globals.inc.php.in index adf834d..7672412 100644 --- a/include/platal/globals.inc.php.in +++ b/include/platal/globals.inc.php.in @@ -19,17 +19,9 @@ * 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: diff --git a/include/xnet.inc.php b/include/xnet.inc.php index 98275a3..6b58906 100644 --- a/include/xnet.inc.php +++ b/include/xnet.inc.php @@ -20,10 +20,9 @@ ***************************************************************************/ 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 index c36f80d..0000000 --- a/include/xnet/globals.inc.php +++ /dev/null @@ -1,74 +0,0 @@ -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: -?> diff --git a/include/xorg.inc.php b/include/xorg.inc.php index 6bf7752..b473e1f 100644 --- a/include/xorg.inc.php +++ b/include/xorg.inc.php @@ -20,10 +20,9 @@ ***************************************************************************/ 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 index 1a9fe1f..0000000 --- a/include/xorg/globals.inc.php +++ /dev/null @@ -1,45 +0,0 @@ -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: -?>