make config be built from a hook
authorPierre Habouzit (MadCoder <pierre.habouzit@m4x.org>
Thu, 23 Dec 2004 19:23:09 +0000 (19:23 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 26 Jun 2008 21:26:48 +0000 (23:26 +0200)
no more dirty glob-include in include/conf.d !!!

git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-127

16 files changed:
hooks/banana.inc.php
hooks/emails.inc.php
hooks/lists.inc.php
hooks/money.inc.php
hooks/newsletter.inc.php
hooks/search.inc.php
hooks/skin.inc.php [moved from include/conf.d/skin.globals.inc.php with 93% similarity]
hooks/webredirect.inc.php [moved from include/conf.d/webredirect.globals.inc.php with 92% similarity]
include/conf.d/README [deleted file]
include/conf.d/banana.globals.inc.php [deleted file]
include/conf.d/emails.globals.inc.php [deleted file]
include/conf.d/lists.globals.inc.php [deleted file]
include/conf.d/money.globals.inc.php [deleted file]
include/conf.d/newsletter.globals.inc.php [deleted file]
include/conf.d/search.globals.inc.php [deleted file]
include/xorg.globals.inc.php.in

index e17c55a..5a58492 100644 (file)
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
+// {{{ config HOOK
+
+// {{{ class SkinConfig
+
+class BananaConfig
+{
+    var $server       = 'localhost';
+    var $port         = 119;
+    var $password     = '***';
+    var $web_user     = '***';
+    var $web_pass     = '***';
+
+    var $table_prefix = 'banana_';
+}
+
+// }}}
+
+function banana_config(&$return)
+{
+    global $globals;
+    $globals->banana = new BananaConfig;
+}
+
+// }}}
 // {{{ menu HOOK
 
 function &banana_menu(&$result)
index 13a3a8a..88f3ef4 100644 (file)
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
+// {{{ config HOOK
+
+// {{{ class SkinConfig
+
+class MailConfig
+{
+    var $domain     = '';
+    var $domain2    = '';
+
+    var $alias_dom  = '';
+    var $alias_dom2 = '';
+
+    var $send_form  = true;
+
+    function shorter_domain()
+    {
+        if (empty($this->domain2) || strlen($this->domain2)>strlen($this->domain)) {
+            return $this->domain;
+        } else {
+            return $this->domain2;
+        }
+    }
+}
+
+// }}}
+
+function emails_config(&$return)
+{
+    global $globals;
+    $globals->mail = new MailConfig;
+}
+// }}}
 // {{{ menu HOOK
 
 function emails_menu(&$return)
index f61ed0b..29b34c7 100644 (file)
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
+// {{{ config HOOK
+// {{{ class ListsConfig
+
+class ListsConfig
+{
+    var $rpchost     = 'localhost';
+    var $rpcport     = 4949;
+    
+    var $spool       = '/var/spool/platal/archives/';
+
+    var $admin_owner = '';
+    var $vhost_sep   = '-';
+}
+
+// }}}
+
+function lists_config(&$result)
+{
+    global $globals;
+    $globals->lists = new ListsConfig;
+}
+
+// }}}
 // {{{ menu HOOK
 
 function &lists_menu(&$result)
index 4a0b864..68f616b 100644 (file)
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
+// {{{ config HOOK
+
+// {{{ class MoneyConfig
+
+class MoneyConfig
+{
+    var $mpay_enable   = true;
+    var $mpay_def_id   = 0;
+    var $mpay_def_meth = 0;
+    var $mpay_tprefix  = 'paiement.';
+}
+
+// }}}
+
+function money_config(&$result)
+{
+    global $globals;
+    $globals->money = new MoneyConfig;
+}
+
+// }}}
 // {{{ menu HOOK
 
+
 function money_menu(&$result)
 {
     global $globals;
index 4cfd094..74ff5d1 100644 (file)
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
+// {{{ config HOOK
+
+// {{{ class SkinConfig
+
+class NLConfig
+{
+    var $from    = "Lettre Mensuelle <null@example.org>";
+    var $replyto = "";
+}
+
+// }}}
+
+function newsletter_config(&$return) {
+    global $globals;
+    $globals->newsletter = new NLConfig;
+}
+
+// }}}
 // {{{ menu HOOK
 
 function &newsletter_menu(&$result)
index 8726256..3afd501 100644 (file)
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
+// {{{ config HOOK
+
+// {{{ class SearchConfig
+
+class SearchConfig
+{
+    var $public_max  =  25;
+    var $private_max = 800;
+
+    var $per_page    =  20;
+}
+
+// }}}
+
+function search_search(&$result)
+{
+    global $glabals;
+    $globals->search = new SearchConfig;
+}
+
+// }}}
 // {{{ menu HOOK
 
 function search_menu(&$result)
similarity index 93%
rename from include/conf.d/skin.globals.inc.php
rename to hooks/skin.inc.php
index 26df496..ad77b7b 100644 (file)
@@ -19,6 +19,8 @@
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
+// {{{ config HOOK
+
 // {{{ class SkinConfig
 
 class SkinConfig
@@ -30,7 +32,13 @@ class SkinConfig
 
 // }}}
 
-$globals->skin = new SkinConfig;
+function skin_config(&$result)
+{
+    global $globals;
+    $globals->skin = new SkinConfig;
+}
+
+// }}}
 
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
 ?>
similarity index 92%
rename from include/conf.d/webredirect.globals.inc.php
rename to hooks/webredirect.inc.php
index 9ac01f6..9943dd3 100644 (file)
@@ -19,6 +19,8 @@
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
+// {{{ config HOOK
+
 // {{{ class WebRedirConfig
 
 class WebRedirConfig
@@ -28,7 +30,13 @@ class WebRedirConfig
 
 // }}}
 
-$globals->webredirect = new WebRedirConfig;
+function webredirect_config(&$result)
+{
+    global $globals;
+    $globals->webredirect = new WebRedirConfig;
+}
+
+// }}}
 
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
 ?>
diff --git a/include/conf.d/README b/include/conf.d/README
deleted file mode 100644 (file)
index 96427af..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-WHAT IS PUT HERE ?
-------------------
-
-*.globals.inc.php :
-    in there you can extend $globals with new params.
-    each module can have as many files it wants here.
-    in thoses scripts, $this is the current $globals beeing created.
-
-*.menu.inc.php :
-    quite the same as previous one, but for menus.
-    you can add $this->addPrivateEntry/addPublicEntry to extend the menu.
diff --git a/include/conf.d/banana.globals.inc.php b/include/conf.d/banana.globals.inc.php
deleted file mode 100644 (file)
index 419b8f0..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2004 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                *
- ***************************************************************************/
-
-// {{{ class SkinConfig
-
-class BananaConfig
-{
-    var $server       = 'localhost';
-    var $port         = 119;
-    var $password     = '***';
-    var $web_user     = '***';
-    var $web_pass     = '***';
-
-    var $table_prefix = 'banana_';
-}
-
-// }}}
-
-$globals->banana = new BananaConfig;
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
-?>
diff --git a/include/conf.d/emails.globals.inc.php b/include/conf.d/emails.globals.inc.php
deleted file mode 100644 (file)
index 5362562..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2004 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                *
- ***************************************************************************/
-
-// {{{ class SkinConfig
-
-class MailConfig
-{
-    var $domain     = '';
-    var $domain2    = '';
-
-    var $alias_dom  = '';
-    var $alias_dom2 = '';
-
-    var $send_form  = true;
-
-    function shorter_domain()
-    {
-        if (empty($this->domain2) || strlen($this->domain2)>strlen($this->domain)) {
-            return $this->domain;
-        } else {
-            return $this->domain2;
-        }
-    }
-}
-
-// }}}
-
-$globals->mail = new MailConfig;
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
-?>
diff --git a/include/conf.d/lists.globals.inc.php b/include/conf.d/lists.globals.inc.php
deleted file mode 100644 (file)
index b5be7ea..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2004 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                *
- ***************************************************************************/
-
-// {{{ class ListsConfig
-
-class ListsConfig
-{
-    var $rpchost     = 'localhost';
-    var $rpcport     = 4949;
-    
-    var $spool       = '/var/spool/platal/archives/';
-
-    var $admin_owner = '';
-    var $vhost_sep   = '-';
-}
-
-// }}}
-
-$globals->lists = new ListsConfig;
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
-?>
diff --git a/include/conf.d/money.globals.inc.php b/include/conf.d/money.globals.inc.php
deleted file mode 100644 (file)
index b15f0da..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2004 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                *
- ***************************************************************************/
-
-// {{{ class MoneyConfig
-
-class MoneyConfig
-{
-    var $mpay_enable   = true;
-    var $mpay_def_id   = 0;
-    var $mpay_def_meth = 0;
-    var $mpay_tprefix  = 'paiement.';
-}
-
-// }}}
-
-$globals->money = new MoneyConfig;
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
-?>
diff --git a/include/conf.d/newsletter.globals.inc.php b/include/conf.d/newsletter.globals.inc.php
deleted file mode 100644 (file)
index e9606e6..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2004 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                *
- ***************************************************************************/
-
-// {{{ class SkinConfig
-
-class NLConfig
-{
-    var $from    = "Lettre Mensuelle <null@example.org>";
-    var $replyto = "";
-}
-
-// }}}
-
-$globals->newsletter = new NLConfig;
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
-?>
diff --git a/include/conf.d/search.globals.inc.php b/include/conf.d/search.globals.inc.php
deleted file mode 100644 (file)
index 802a057..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2004 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                *
- ***************************************************************************/
-
-// {{{ class SearchConfig
-
-class SearchConfig
-{
-    var $public_max  =  25;
-    var $private_max = 800;
-
-    var $per_page    =  20;
-}
-
-// }}}
-
-$globals->search = new SearchConfig;
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
-?>
index a1f3f0c..4bc0f9d 100644 (file)
@@ -61,14 +61,13 @@ class XorgGlobals extends DiogenesCoreGlobals
         require_once("xorg/hook.inc.php");
         require_once("xorg/menu.inc.php");
 
-        $globals = new XorgGlobals;
-
+        $globals       = new XorgGlobals;
         $globals->root = dirname(dirname(__FILE__));
+        $globals->hook = new XOrgHook();
+        $globals->menu = new XOrgMenu();
+
+        $globals->hook->config(null);
 
-        foreach(glob($globals->root.'/include/conf.d/*.globals.inc.php') as $inc) {
-            require_once($inc);
-        }
-        
         $array = parse_ini_file($globals->root.'/configs/platal.conf', true);
         if (!is_array($array)) {
             return;
@@ -85,8 +84,6 @@ class XorgGlobals extends DiogenesCoreGlobals
             }
         }
         
-        $globals->hook = new XOrgHook();
-        $globals->menu = new XOrgMenu();
         $globals->hook->menu(null);
 
         $globals->dbconnect();