From: Pierre Habouzit (MadCoder Date: Thu, 23 Dec 2004 17:55:04 +0000 (+0000) Subject: work on hooks X-Git-Tag: xorg/old~623 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=e81683e67cbebc465e2108871651618ae8c3f9c4;p=platal.git work on hooks * make globals->hook be an instance of XOrgHook * make the menu be constructed by hooks: - banan is a proof of concept git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-125 --- diff --git a/hooks/README b/hooks/README index 2d872d7..10f933b 100644 --- a/hooks/README +++ b/hooks/README @@ -1 +1,2 @@ +function menu() function subscribe($forlife, $uid, $promo, $pass) diff --git a/hooks/banana.inc.php b/hooks/banana.inc.php index 64b62eb..e17c55a 100644 --- a/hooks/banana.inc.php +++ b/hooks/banana.inc.php @@ -19,7 +19,16 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -// {{{ function banana_subscirbe() +// {{{ menu HOOK + +function &banana_menu(&$result) +{ + global $globals; + $globals->menu->addPrivateEntry(XOM_SERVICES, 10, 'Forums & PA', 'banana/'); +} + +// }}} +// {{{ subscribe HOOK function &banana_subscribe($forlife, $uid, $promo, $password, &$result) { diff --git a/htdocs/inscription/step4.php b/htdocs/inscription/step4.php index 8ad904a..33ff384 100644 --- a/htdocs/inscription/step4.php +++ b/htdocs/inscription/step4.php @@ -149,10 +149,7 @@ $mymail->send(); // s'il est dans la table envoidirect, on le marque comme inscrit $globals->db->query("update envoidirect set date_succes=NOW() where matricule = $matricule"); - -require_once("xorg.hook.inc.php"); -$hook = new XOrgHook(); -$hook->subscribe($forlife, $uid, $promo, $password, true); +$globals->hook->subscribe($forlife, $uid, $promo, $password, true); start_connexion($uid,false); $page->run(); diff --git a/include/conf.d/banana.menu.inc.php b/include/conf.d/banana.menu.inc.php deleted file mode 100644 index 58615ab..0000000 --- a/include/conf.d/banana.menu.inc.php +++ /dev/null @@ -1,3 +0,0 @@ -addPrivateEntry(XOM_SERVICES, 10, 'Forums & PA', 'banana/'); -?> diff --git a/include/xorg.globals.inc.php.in b/include/xorg.globals.inc.php.in index d7d643a..31f2857 100644 --- a/include/xorg.globals.inc.php.in +++ b/include/xorg.globals.inc.php.in @@ -29,6 +29,7 @@ class XorgGlobals extends DiogenesCoreGlobals var $page = 'XorgPage'; var $session = 'XorgSession'; var $menu; + var $hook; /** The x.org version */ var $version = "@VERSION@"; @@ -57,6 +58,7 @@ class XorgGlobals extends DiogenesCoreGlobals function init() { global $globals; + require_once("xorg/hook.inc.php"); require_once("xorg/menu.inc.php"); $globals = new XorgGlobals; @@ -83,7 +85,9 @@ class XorgGlobals extends DiogenesCoreGlobals } } + $globals->hook = new XOrgHook(); $globals->menu = new XOrgMenu($globals->root.'/include/conf.d/'); + $globals->hook->menu(null); $globals->dbconnect(); if ($globals->debug) { diff --git a/include/xorg.hook.inc.php b/include/xorg/hook.inc.php similarity index 100% rename from include/xorg.hook.inc.php rename to include/xorg/hook.inc.php