X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fregister.php;h=f77841c4c022aa6f2e57d655e37f4e03a1187d2a;hb=7912097e011456e2ab4e5d1c1608b68472f0ef8c;hp=9a32e609de50568218e05acbdcd9645d090706e7;hpb=460d8f5533ac4dff9d0df95efe11c399228b8637;p=platal.git diff --git a/modules/register.php b/modules/register.php index 9a32e60..f77841c 100644 --- a/modules/register.php +++ b/modules/register.php @@ -297,26 +297,48 @@ class RegisterModule extends PLModule } require_once('emails.inc.php'); - $redirect = new Redirect($uid); + $user = User::getSilent($uid); + $redirect = new Redirect($user); $redirect->add_email($email); // on cree un objet logger et on log l'inscription - $logger = new PlLogger($uid); - S::logger()->log('inscription', $email); - + S::logger($uid)->log('inscription', $email); XDB::execute('UPDATE register_pending SET hash="INSCRIT" WHERE uid={?}', $uid); - global $platal; - $platal->on_subscribe($forlife, $uid, $promo, $password); $mymail = new PlMailer('register/inscription.reussie.tpl'); $mymail->assign('forlife', $forlife); $mymail->assign('prenom', $prenom); $mymail->send(); + // Enable search on the user require_once('user.func.inc.php'); user_reindex($uid); + // Add notification for people looking for this registration + require_once 'notifs.inc.php'; + register_watch_op($uid, WATCH_INSCR); + inscription_notifs_base($uid); + + // Default registration on forums + $p_for = 'xorg.promo.x' . $promo; + $cible = array('xorg.general', 'xorg.pa.divers', 'xorg.pa.logements', $p_for); + foreach ($cible as $val) { + XDB::execute("INSERT INTO forums.abos (fid,uid) + SELECT fid, {?} FROM forums.list WHERE nom={?}", $uid, $val); + if (XDB::affectedRows() == 0 && $val == $p_for) { + $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) { // + + $mymail = new PlMailer('admin/forums-promo.mail.tpl'); + $mymail->assign('promo', $promo); + $mymail->send(); + } + } + } + // update number of subscribers (perms has changed) $globals->updateNbIns(); @@ -397,6 +419,7 @@ class RegisterModule extends PLModule { global $globals; $page->changeTpl('register/success.tpl'); + $page->assign('user', S::user()); $_SESSION['sub_state'] = array('step' => 5); if (Env::has('response2')) { @@ -407,11 +430,11 @@ class RegisterModule extends PLModule S::v('uid')); // If GoogleApps is enabled, and the user did choose to use synchronized passwords, - // and if the (stupid) user has decided to user /register/success another time, + // and if the (stupid) user has decided to use /register/success another time, // updates the Google Apps password as well. if ($globals->mailstorage->googleapps_domain) { require_once 'googleapps.inc.php'; - $account = new GoogleAppsAccount(S::v('uid'), S::v('forlife')); + $account = new GoogleAppsAccount(S::user()); if ($account->active() && $account->sync_password) { $account->set_password($password); } @@ -464,7 +487,7 @@ class RegisterModule extends PLModule NewsLetter::subscribe(); } if (Post::v('add_to_ax')) { - require_once dirname(__FILE__) . '/axletter/axletter.inc.php'; + Platal::load('axletter', 'axletter.inc.php'); AXLetter::subscribe(); } if (Post::v('add_to_promo')) {