<?php
/***************************************************************************
- * Copyright (C) 2003-2008 Polytechnique.org *
+ * Copyright (C) 2003-2009 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
switch ($sub_state['step']) {
case 0:
- require_once('wiki.inc.php');
- wiki_require_page('Reference.Charte');
+ $wp = new PlWikiPage('Reference.Charte');
+ $wp->buildCache();
if (Post::has('step1')) {
$sub_state['step'] = 1;
if (isset($sub_state['hash'])) {
$sub_state['step'] = 3;
- require_once(dirname(__FILE__) . '/register/register.inc.php');
+ $this->load('register.inc.php');
create_aliases($sub_state);
}
}
case 2:
if (count($_POST)) {
- require_once(dirname(__FILE__) . '/register/register.inc.php');
+ $this->load('register.inc.php');
$sub_state['prenom'] = Post::v('prenom');
$sub_state['nom'] = Post::v('nom');
$sub_state['mat'] = Post::v('mat');
case 3:
if (count($_POST)) {
- require_once(dirname(__FILE__) . '/register/register.inc.php');
+ $this->load('register.inc.php');
+ require_once 'emails.inc.php';
if (!isvalid_email(Post::v('email'))) {
$err[] = "Le champ 'E-mail' n'est pas valide.";
} elseif (!isvalid_email_redirection(Post::v('email'))) {
}
}
if ($sub_state['watch']) {
- $alter .= "Inscription d'un utilisateur surveillé - ";
+ $alert .= "Inscription d'un utilisateur surveillé - ";
}
if (check_ip('unsafe')) {
$alert .= "Tentative d'inscription depuis une IP surveillee";
}
if ($email_banned || $ip_banned) {
+ global $globals;
$err = "Une erreur s'est produite lors de l'inscription."
. " Merci de contacter <a href='mailto:register@{$globals->mail->domain}>"
. " register@{$globals->mail->domain}</a>"
}
$_SESSION['sub_state'] = $sub_state;
- if ($alert) {
+ if (!empty($alert)) {
send_warning_mail($alert);
}
$page->changeTpl('register/step'.intval($sub_state['step']).'.tpl');
if (isset($err)) {
- $page->trig($err);
+ $page->trigError($err);
}
}
}
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 CoreLogger($uid);
- $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)
- update_NbIns();
+ $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 ***************/
INNER JOIN aliases AS sa ON ( sa.id = m.sender
AND FIND_IN_SET('bestalias', sa.flags) )
WHERE m.uid = {?}
- GROUP BY m.sender", $uid);
+ GROUP BY m.sender
+ ORDER BY dateDernier DESC", $uid);
XDB::execute("UPDATE register_mstats SET success=NOW() WHERE uid={?}", $uid);
$market = array();
. " - 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 de mail de marketing.";
+ $msg .= "$prenom $nom n'a jamais reçu d'email de marketing.";
}
$mymail->setTxtBody($msg);
$mymail->send();
{
global $globals;
$page->changeTpl('register/success.tpl');
+ $page->assign('user', S::user());
$_SESSION['sub_state'] = array('step' => 5);
if (Env::has('response2')) {
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');
- $log->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);
}
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')) {
}
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();
}