$page->assign_by_ref('platal', $this);
$page->run();
}
+
+ function on_subscribe($forlife, $uid, $promo, $pass)
+ {
+ $args = func_get_args();
+ foreach ($this->__mods as $mod) {
+ if (!is_callable($mod, 'on_subscribe'))
+ continue;
+ call_user_func_array(array($mod, 'on_subscribe'), $args);
+ }
+ }
}
?>
+++ /dev/null
-config()
- function used to create new config entries in $globals.
- usually, a module need to create a ....Config class to store the defaults.
-
-subscribe($forlife, $uid, $promo, $pass)
- triggered when a user subscription is sucessfull
-
-prefs()
- function used to add boxes in htdocs/preferences.php
- must return a dictionnary : url, title, text, weight.
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2006 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 *
- ***************************************************************************/
-
-// {{{ subscribe HOOK
-
-function banana_subscribe($forlife, $uid, $promo, $password)
-{
- $cible = array('xorg.general','xorg.pa.emploi','xorg.pa.divers','xorg.pa.logements');
- $p_for = "xorg.promo.x$promo";
-
- // récupération de l'id du forum promo
- $res = XDB::query("SELECT fid FROM forums.list WHERE nom={?}", $p_for);
- if ($res->numRows()) {
- $cible[] = $p_for;
- } else { // pas de forum promo, il faut le créer
- $res = XDB::query("SELECT SUM(perms IN ('admin','user') AND deces=0),COUNT(*)
- FROM auth_user_md5 WHERE promo={?}", $promo);
- list($effau, $effid) = $res->fetchOneRow();
- if (5*$effau>$effid) { // + de 20% d'inscrits
- require_once("xorg.mailer.inc.php");
- $mymail = new XOrgMailer('mails/forums.promo.tpl');
- $mymail->assign('promo', $promo);
- $mymail->send();
- }
- }
-
- while (list ($key, $val) = each ($cible)) {
- XDB::execute("INSERT INTO forums.abos (fid,uid)
- SELECT fid,{?} FROM forums.list WHERE nom={?}", $uid, $val);
- }
-}
-
-// }}}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2006 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 *
- ***************************************************************************/
-
-// {{{ subscribe HOOK
-
-function lists_subscribe($forlife, $uid, $promo, $password)
-{
- require_once('lists.inc.php');
- $client =& lists_xmlrpc($uid, $password);
- $client->subscribe("promo$promo");
-}
-
-// }}}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2006 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 *
- ***************************************************************************/
-
-// {{{ subscribe HOOK
-
-function newsletter_subscribe($forlife, $uid, $promo, $password)
-{
- require_once('newsletter.inc.php');
- subscribe_nl($uid);
-}
-
-// }}}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2006 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 *
- ***************************************************************************/
-
-// {{{ subscribe HOOK
-function search_subscribe($forlife, $uid, $promo, $pass)
-{
- require_once('user.func.inc.php');
- user_reindex($uid);
-}
-// }}}
-
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2006 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 *
- ***************************************************************************/
-
-// {{{ subscribe HOOK
-
-function tmp_subscribe($forlife, $uid, $promo, $password)
-{
- require_once('notifs.inc.php');
- register_watch_op($uid, WATCH_INSCR);
- inscription_notifs_base($uid);
-}
-
-// }}}
-?>
function init()
{
global $globals;
- require_once('xorg/hook.inc.php');
$globals = new XnetGlobals;
$globals->core = new CoreConfig;
- $globals->hook = new XOrgHook();
$globals->read_config();
function init()
{
global $globals;
- require_once('xorg/hook.inc.php');
$globals = new XorgGlobals;
$globals->core = new CoreConfig;
- $globals->hook = new XOrgHook();
$globals->read_config();
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2006 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 *
- **************************************************************************/
-
-/**
- * XOrg's Hooks API
- *
- * Hooks are used in modules to allow modules that depends upon us to hook
- * themselves in our core functionnalities.
- *
- * Every module will use some hools, and define their names.
- * Pretend « myhook » is one of those names, then :
- * - hooks/myhook/API has to exists, and will explain the API of the hook
- * - every module "mod" may have a file hooks/myhook/mod.inc.php that implements
- * fully or partially the API of the hook.
- *
- * If the hook's API has to change, the functions that change MUST change their
- * name to avoid any compatibility problem.
- *
- * @category XOrgCore
- * @package XOrgCore
- * @author Pierre Habouzit <pierre.habouzit@polytechnique.org>
- * @access public
- * @link http://doc.polytechnique.org/XOrgModule/#hook
- * @since Classe available since 0.9.3
- */
-class XOrgHook
-{
- // {{{ properties
-
- /**
- * list of all the modules names that have implemented some reactions to our triggers
- *
- * @var array
- * @access private
- */
- var $_mods = Array();
-
- // }}}
- // {{{ constructor XOrgHook()
-
- /**
- * Instanciates our Hook.
- *
- * @param string $name the name of the hook
- */
- function XOrgHook()
- {
- global $globals;
-
- foreach (glob($globals->spoolroot."/hooks/*.inc.php") as $file) {
- require_once("$file");
- $this->_mods[] = basename($file, '.inc.php');
- }
- }
-
- // }}}
- // {{{ function subscribe
-
- function subscribe($forlife, $uid, $promo, $pass)
- {
- foreach ($this->_mods as $mod) {
- if (!function_exists($mod.'_subscribe')) continue;
- call_user_func($mod.'_subscribe', $forlife, $uid, $promo, $pass);
- }
- }
-
- // }}}
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
-?>
);
}
+ function on_subscribe($forlife, $uid, $promo, $password)
+ {
+ $cible = array('xorg.general', 'xorg.pa.divers', 'xorg.pa.logements');
+ $p_for = "xorg.promo.x$promo";
+
+ // récupération de l'id du forum promo
+ $res = XDB::query("SELECT fid FROM forums.list WHERE nom={?}", $p_for);
+ if ($res->numRows()) {
+ $cible[] = $p_for;
+ } else { // pas de forum promo, il faut le créer
+ $res = XDB::query("SELECT SUM(perms IN ('admin','user') AND deces=0),COUNT(*)
+ FROM auth_user_md5 WHERE promo={?}", $promo);
+ list($effau, $effid) = $res->fetchOneRow();
+ if (5*$effau>$effid) { // + de 20% d'inscrits
+ require_once("xorg.mailer.inc.php");
+ $mymail = new XOrgMailer('mails/forums.promo.tpl');
+ $mymail->assign('promo', $promo);
+ $mymail->send();
+ }
+ }
+
+ while (list ($key, $val) = each ($cible)) {
+ XDB::execute("INSERT INTO forums.abos (fid,uid)
+ SELECT fid,{?} FROM forums.list WHERE nom={?}", $uid, $val);
+ }
+ }
+
function handler_banana(&$page, $group = null, $action = null, $artid = null)
{
$get = Array();
);
}
+ function on_subscribe($forlife, $uid, $promo, $password)
+ {
+ require_once 'notifs.inc.php';
+ register_watch_op($uid, WATCH_INSCR);
+ inscription_notifs_base($uid);
+ }
+
function _add_rss_link(&$page)
{
if (!S::has('core_rss_hash')) {
);
}
+ function on_subscribe($forlife, $uid, $promo, $password)
+ {
+ require_once 'newsletter.inc.php';
+ subscribe_nl($uid);
+ }
+
function handler_ev(&$page)
{
$page->changeTpl('login.tpl');
);
}
+ function on_subscribe($forlife, $uid, $promo, $password)
+ {
+ $this->prepare_client(null);
+ $this->client->subscribe("promo$promo");
+ }
+
function prepare_client(&$page)
{
require_once 'lists.inc.php';
XDB::execute('UPDATE register_pending SET hash="INSCRIT" WHERE uid={?}', $uid);
- $globals->hook->subscribe($forlife, $uid, $promo, $password);
+ global $platal;
+ $platal->on_subscribe($forlife, $uid, $promo, $password);
require_once('xorg.mailer.inc.php');
$mymail = new XOrgMailer('register/inscription.reussie.tpl');
);
}
+ function on_subscribe($forlife, $uid, $promo, $pass)
+ {
+ require_once 'user.func.inc.php';
+ user_reindex($uid);
+ }
+
function get_quick($offset, $limit, $order)
{
global $globals;