X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fregister.php;h=7c145fbeb8adc31416a6122258cc4ee5877395a3;hb=6d1747b3dbcf944c995dc2d87e8561c7a66f3aa6;hp=6d1273bbd49456959ae14be79f24194b765e7acf;hpb=adb07f6fa54e996442e9ae1a0fe4158facdb6343;p=platal.git diff --git a/modules/register.php b/modules/register.php index 6d1273b..7c145fb 100644 --- a/modules/register.php +++ b/modules/register.php @@ -1,6 +1,6 @@ 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 forum_subs (fid,uid) + SELECT fid, {?} + FROM forum + WHERE name = {?}', $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(); - if (!start_connexion($uid, false)) { + if (!Platal::session()->startWeakSession($uid)) { return PL_FORBIDDEN; } - $_SESSION['auth'] = AUTH_MDP; /***********************************************************/ /************* envoi d'un mail au démarcheur ***************/ @@ -374,14 +397,14 @@ class RegisterModule extends PLModule . " - forlife : $forlife\n" . " - email : $email\n" . " - sexe : $femme\n" - . " - ip : {$logger->ip} ({$logger->host})\n" - . ($logger->proxy_ip ? " - proxy : {$logger->proxy_ip} ({$logger->proxy_host})\n" : "") + . " - ip : " . S::logger()->ip . " (" . S::logger()->host . ")\n" + . (S::logger()->proxy_ip ? " - proxy : " . S::logger()->proxy_ip . " (" . S::logger()->proxy_host . ")\n" : "") . "\n\n"; if (count($market) > 0) { $msg .= "Les marketings suivants avaient été effectués :\n" . implode("\n", $market); } else { - $msg .= "$prenom $nom n'a jamais reçu d\'email de marketing."; + $msg .= "$prenom $nom n'a jamais reçu d'email de marketing."; } $mymail->setTxtBody($msg); $mymail->send(); @@ -397,6 +420,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,23 +431,18 @@ 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); } } - $log = S::v('log'); - S::logger()->log('passwd', ''); - - if (Cookie::v('ORGaccess')) { - require_once('secure_hash.inc.php'); - setcookie('ORGaccess', hash_encrypt($password), (time()+25920000), '/', '' ,0); - } + S::logger()->log('passwd'); + Platal::session()->setAccessCookie(true); $page->assign('mdpok', true); } @@ -491,7 +510,8 @@ class RegisterModule extends PLModule } if (Post::v('imap')) { require_once 'emails.inc.php'; - $storage = new EmailStorage(S::v('uid'), 'imap'); + $user = S::user(); + $storage = new EmailStorage($user, 'imap'); $storage->activate(); }