From a093470f31552b3a1374b49cc81b73f224dd3e41 Mon Sep 17 00:00:00 2001 From: "Pierre Habouzit (MadCoder" Date: Thu, 23 Dec 2004 19:23:09 +0000 Subject: [PATCH] make config be built from a hook no more dirty glob-include in include/conf.d !!! git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-127 --- hooks/banana.inc.php | 24 +++++++++++ hooks/emails.inc.php | 32 ++++++++++++++ hooks/lists.inc.php | 23 ++++++++++ hooks/money.inc.php | 22 ++++++++++ hooks/newsletter.inc.php | 18 ++++++++ hooks/search.inc.php | 21 ++++++++++ .../skin.globals.inc.php => hooks/skin.inc.php | 10 ++++- .../webredirect.inc.php | 10 ++++- include/conf.d/README | 11 ----- include/conf.d/banana.globals.inc.php | 40 ------------------ include/conf.d/emails.globals.inc.php | 49 ---------------------- include/conf.d/lists.globals.inc.php | 40 ------------------ include/conf.d/money.globals.inc.php | 37 ---------------- include/conf.d/newsletter.globals.inc.php | 35 ---------------- include/conf.d/search.globals.inc.php | 37 ---------------- include/xorg.globals.inc.php.in | 13 +++--- 16 files changed, 163 insertions(+), 259 deletions(-) rename include/conf.d/skin.globals.inc.php => hooks/skin.inc.php (93%) rename include/conf.d/webredirect.globals.inc.php => hooks/webredirect.inc.php (92%) delete mode 100644 include/conf.d/README delete mode 100644 include/conf.d/banana.globals.inc.php delete mode 100644 include/conf.d/emails.globals.inc.php delete mode 100644 include/conf.d/lists.globals.inc.php delete mode 100644 include/conf.d/money.globals.inc.php delete mode 100644 include/conf.d/newsletter.globals.inc.php delete mode 100644 include/conf.d/search.globals.inc.php diff --git a/hooks/banana.inc.php b/hooks/banana.inc.php index e17c55a..5a58492 100644 --- a/hooks/banana.inc.php +++ b/hooks/banana.inc.php @@ -19,6 +19,30 @@ * 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) diff --git a/hooks/emails.inc.php b/hooks/emails.inc.php index 13a3a8a..88f3ef4 100644 --- a/hooks/emails.inc.php +++ b/hooks/emails.inc.php @@ -19,6 +19,38 @@ * 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) diff --git a/hooks/lists.inc.php b/hooks/lists.inc.php index f61ed0b..29b34c7 100644 --- a/hooks/lists.inc.php +++ b/hooks/lists.inc.php @@ -19,6 +19,29 @@ * 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) diff --git a/hooks/money.inc.php b/hooks/money.inc.php index 4a0b864..68f616b 100644 --- a/hooks/money.inc.php +++ b/hooks/money.inc.php @@ -19,8 +19,30 @@ * 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; diff --git a/hooks/newsletter.inc.php b/hooks/newsletter.inc.php index 4cfd094..74ff5d1 100644 --- a/hooks/newsletter.inc.php +++ b/hooks/newsletter.inc.php @@ -19,6 +19,24 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ +// {{{ config HOOK + +// {{{ class SkinConfig + +class NLConfig +{ + var $from = "Lettre Mensuelle "; + var $replyto = ""; +} + +// }}} + +function newsletter_config(&$return) { + global $globals; + $globals->newsletter = new NLConfig; +} + +// }}} // {{{ menu HOOK function &newsletter_menu(&$result) diff --git a/hooks/search.inc.php b/hooks/search.inc.php index 8726256..3afd501 100644 --- a/hooks/search.inc.php +++ b/hooks/search.inc.php @@ -19,6 +19,27 @@ * 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) diff --git a/include/conf.d/skin.globals.inc.php b/hooks/skin.inc.php similarity index 93% rename from include/conf.d/skin.globals.inc.php rename to hooks/skin.inc.php index 26df496..ad77b7b 100644 --- a/include/conf.d/skin.globals.inc.php +++ b/hooks/skin.inc.php @@ -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: ?> diff --git a/include/conf.d/webredirect.globals.inc.php b/hooks/webredirect.inc.php similarity index 92% rename from include/conf.d/webredirect.globals.inc.php rename to hooks/webredirect.inc.php index 9ac01f6..9943dd3 100644 --- a/include/conf.d/webredirect.globals.inc.php +++ b/hooks/webredirect.inc.php @@ -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 index 96427af..0000000 --- a/include/conf.d/README +++ /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 index 419b8f0..0000000 --- a/include/conf.d/banana.globals.inc.php +++ /dev/null @@ -1,40 +0,0 @@ -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 index 5362562..0000000 --- a/include/conf.d/emails.globals.inc.php +++ /dev/null @@ -1,49 +0,0 @@ -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 index b5be7ea..0000000 --- a/include/conf.d/lists.globals.inc.php +++ /dev/null @@ -1,40 +0,0 @@ -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 index b15f0da..0000000 --- a/include/conf.d/money.globals.inc.php +++ /dev/null @@ -1,37 +0,0 @@ -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 index e9606e6..0000000 --- a/include/conf.d/newsletter.globals.inc.php +++ /dev/null @@ -1,35 +0,0 @@ -"; - 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 index 802a057..0000000 --- a/include/conf.d/search.globals.inc.php +++ /dev/null @@ -1,37 +0,0 @@ -search = new SearchConfig; - -// vim:set et sw=4 sts=4 sws=4 foldmethod=marker: -?> diff --git a/include/xorg.globals.inc.php.in b/include/xorg.globals.inc.php.in index a1f3f0c..4bc0f9d 100644 --- a/include/xorg.globals.inc.php.in +++ b/include/xorg.globals.inc.php.in @@ -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(); -- 2.1.4