From 4f57d758d0052c7417d31d3e855f6352e5d5ceb0 Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Mon, 22 Nov 2004 21:40:47 +0000 Subject: [PATCH] switch to plain ini override. thanks to Vincent for the __FILE__ tip ! --- configs/.cvsignore | 1 + include/xorg.globals.inc.php.in | 31 ++++++++++++++++++++++- include/xorg.inc.php | 15 +---------- install.d/platal.conf | 28 +++++++++++++++++++++ install.d/xorg.config.inc.php | 55 ----------------------------------------- 5 files changed, 60 insertions(+), 70 deletions(-) create mode 100644 configs/.cvsignore create mode 100644 install.d/platal.conf delete mode 100644 install.d/xorg.config.inc.php diff --git a/configs/.cvsignore b/configs/.cvsignore new file mode 100644 index 0000000..55d50bd --- /dev/null +++ b/configs/.cvsignore @@ -0,0 +1 @@ +platal.conf diff --git a/include/xorg.globals.inc.php.in b/include/xorg.globals.inc.php.in index d8d9560..432f4d6 100644 --- a/include/xorg.globals.inc.php.in +++ b/include/xorg.globals.inc.php.in @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: xorg.globals.inc.php.in,v 1.3 2004-11-22 10:42:52 x2000habouzit Exp $ + $Id: xorg.globals.inc.php.in,v 1.4 2004-11-22 21:40:47 x2000habouzit Exp $ ***************************************************************************/ require_once("diogenes.core.globals.inc.php"); @@ -59,6 +59,35 @@ class XorgGlobals extends DiogenesCoreGlobals /** recherche */ var $public_max_search_results = 25; var $search_results_per_page = 20; + + function XorgGlobals() { + $ini = dirname(dirname(__FILE__)).'/configs/platal.conf'; + $array = parse_ini_file($ini, true); + if (!is_array($array)) { + return; + } + + foreach ($array as $cat=>$conf) { + $c = strtolower($cat); + foreach ($conf as $key=>$val) { + if ($c == 'global') { + global $$key; + $$key = $val; + } elseif ($c == 'core') { + $this->$key=$val; + } else { + $this->$c->$key = $val; + } + } + } + + session_start(); + + $this->dbconnect(); + if ($this->debug) { + $this->db->trace_on(); + } + } } // }}} diff --git a/include/xorg.inc.php b/include/xorg.inc.php index 18b9322..800a9c9 100644 --- a/include/xorg.inc.php +++ b/include/xorg.inc.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: xorg.inc.php,v 1.2 2004-11-22 20:05:10 x2000habouzit Exp $ + $Id: xorg.inc.php,v 1.3 2004-11-22 21:40:47 x2000habouzit Exp $ ***************************************************************************/ function microtime_float() @@ -53,7 +53,6 @@ require_once("xorg/menu.inc.php"); require_once("xorg/session.inc.php"); $globals = new XorgGlobals; -require_once("xorg.config.inc.php"); // }}} // {{{ Build Menu, TODO: move that into appropriates hooks @@ -103,18 +102,6 @@ $globals->menu->addPublicEntry(XOM_INFOS, 10, 'Nous contacter', 'docs/co $globals->menu->addPublicEntry(XOM_INFOS, 20, 'FAQ', 'docs/faq.php'); // }}} -// {{{ start session + database connection - -session_start(); - -// connect to database -$globals->dbconnect(); -if ($globals->debug) { - $globals->db->trace_on(); -} - -//}}} - // {{{ function _new_page() function _new_page($type, $tpl_name, $tpl_head, $min_auth, $admin=false) diff --git a/install.d/platal.conf b/install.d/platal.conf new file mode 100644 index 0000000..5e8f067 --- /dev/null +++ b/install.d/platal.conf @@ -0,0 +1,28 @@ +; {{{ [Core] + +[Core] + +debug = true +dbuser = "***" +dbpwd = "***" + +; base url of the site, WITHOUT LEADING / +baseurl = "http://dev.m4x.org/~x2000habouzit"; +root = "/home/x2000habouzit/dev/public/"; +spoolroot = "/home/x2000habouzit/dev/public/"; + +econfiance = "***"; + +; }}} +; {{{ [Global] + +[Global] + +news_server = "localhost" +news_port = 119 +news_auth_pass = "***" +news_web_user = "***" +news_web_pass = "***" + +; }}} +; vim:set syntax=dosini: diff --git a/install.d/xorg.config.inc.php b/install.d/xorg.config.inc.php deleted file mode 100644 index 106b490..0000000 --- a/install.d/xorg.config.inc.php +++ /dev/null @@ -1,55 +0,0 @@ -dbhost='djali.polytechnique.org'; -$globals->debug = true; -$globals->dbuser = '***'; -$globals->dbpwd = '***'; -// }}} -// {{{ Paths - -/* URL de la racine pour les mails contenant des URL (pas de slash final!) */ -$globals->baseurl = "http://dev.m4x.org/~x2000habouzit"; -$globals->root = "/home/x2000habouzit/dev/public/"; -$globals->spoolroot = "/home/x2000habouzit/dev/public/"; - -// }}} -// {{{ Extra - -# JPF -$globals->econfiance = '***'; - -/* les parametres pour se connecter au serveur NNTP */ -if (!isset($news_server)) $news_server="localhost"; -if (!isset($news_port)) $news_port=119; -if (!isset($news_auth_pass)) $news_auth_pass="***"; -$news_web_user = '***'; -$news_web_pass = '***'; - -// }}} - -// vim:set et sw=4 sts=4 sws=4 foldmethod=marker: -?> -- 2.1.4