return array(
'register' => $this->make_hook('register', AUTH_PUBLIC),
'register/end' => $this->make_hook('end', AUTH_PUBLIC),
+ 'register/end.php' => $this->make_hook('end_old', AUTH_PUBLIC),
'register/success' => $this->make_hook('success', AUTH_MDP),
);
}
function handler_register(&$page, $hash = null)
{
- global $globals;
-
- $sub_state = Session::getMixed('sub_state', Array());
+ $sub_state = S::v('sub_state', Array());
if (!isset($sub_state['step'])) {
$sub_state['step'] = 0;
}
- if (Get::has('back') && Get::getInt('back') < $sub_state['step']) {
- $sub_state['step'] = max(0,Get::getInt('back'));
+ if (Get::has('back') && Get::i('back') < $sub_state['step']) {
+ $sub_state['step'] = max(0,Get::i('back'));
+ }
+
+ // Compatibility with old sources, keep it atm
+ if (!$hash && Env::has('hash')) {
+ $hash = Env::v('hash');
}
if ($hash) {
- $res = $globals->xdb->query(
+ $res = XDB::query(
"SELECT m.uid, u.promo, u.nom, u.prenom, u.matricule
FROM register_marketing AS m
INNER JOIN auth_user_md5 AS u ON u.user_id = m.uid
$sub_state['prenom'] = $prenom;
$sub_state['ourmat'] = $ourmat;
- $globals->xdb->execute(
+ XDB::execute(
"REPLACE INTO register_mstats (uid,sender,success)
SELECT m.uid, m.sender, 0
FROM register_marketing AS m
case 1:
if (Post::has('promo')) {
- $promo = Post::getInt('promo');
+ $promo = Post::i('promo');
if ($promo < 1900 || $promo > date('Y')) {
$err = "La promotion saisie est incorrecte !";
} else {
case 2:
if (count($_POST)) {
require_once('register.inc.php');
- $sub_state['prenom'] = Post::get('prenom');
- $sub_state['nom'] = Post::get('nom');
- $sub_state['mat'] = Post::get('mat');
+ $sub_state['prenom'] = Post::v('prenom');
+ $sub_state['nom'] = Post::v('nom');
+ $sub_state['mat'] = Post::v('mat');
$err = check_new_user($sub_state);
if ($err !== true) { break; }
case 3:
if (count($_POST)) {
require_once('register.inc.php');
- if (!isvalid_email(Post::get('email'))) {
+ if (!isvalid_email(Post::v('email'))) {
$err[] = "Le champ 'E-mail' n'est pas valide.";
- } elseif (!isvalid_email_redirection(Post::get('email'))) {
+ } elseif (!isvalid_email_redirection(Post::v('email'))) {
$err[] = $sub_state['forlife']." doit renvoyer vers un email existant ".
"valide, en particulier, il ne peut pas être renvoyé vers lui-même.";
}
if (!preg_match('/^[0-3][0-9][01][0-9][12][90][0-9][0-9]$/',
- Post::get('naissance')))
+ Post::v('naissance')))
{
$err[] = "La 'Date de naissance' n'est pas correcte.";
}
if (isset($err)) {
$err = join('<br />', $err);
} else {
- $birth = Env::get('naissance');
+ $birth = Env::v('naissance');
$sub_state['naissance'] = sprintf("%s-%s-%s",
substr($birth,4,4),
substr($birth,2,2),
substr($birth,0,2));
- $sub_state['email'] = Post::get('email');
+ $sub_state['email'] = Post::v('email');
$sub_state['step'] = 4;
finish_ins($sub_state);
}
}
$_SESSION['sub_state'] = $sub_state;
- $page->changeTpl('register/step'.intval($sub_state['step']).'.tpl');
- $page->assign('simple', true);
+ $page->changeTpl('register/step'.intval($sub_state['step']).'.tpl', SIMPLE);
if (isset($err)) {
$page->trig($err);
}
+ }
- return PL_OK;
+ function handler_end_old(&$page)
+ {
+ return $this->handler_end($page, Env::v('hash'));
}
function handler_end(&$page, $hash = null)
require_once('user.func.inc.php');
if ($hash) {
- $res = $globals->xdb->query(
+ $res = XDB::query(
"SELECT r.uid, r.forlife, r.bestalias, r.mailorg2,
r.password, r.email, r.naissance, u.nom, u.prenom,
u.promo, u.flags
/****************** REALLY CREATE ACCOUNT ******************/
/***********************************************************/
- $globals->xdb->execute('UPDATE auth_user_md5
+ XDB::execute('UPDATE auth_user_md5
SET password={?}, perms="user",
date=NOW(), naissance={?}, date_ins = NOW()
WHERE user_id={?}', $password, $naissance, $uid);
- $globals->xdb->execute('REPLACE INTO auth_user_quick (user_id) VALUES ({?})', $uid);
- $globals->xdb->execute('INSERT INTO aliases (id,alias,type)
+ XDB::execute('REPLACE INTO auth_user_quick (user_id) VALUES ({?})', $uid);
+ XDB::execute('INSERT INTO aliases (id,alias,type)
VALUES ({?}, {?}, "a_vie")', $uid,
$forlife);
- $globals->xdb->execute('INSERT INTO aliases (id,alias,type,flags)
+ XDB::execute('INSERT INTO aliases (id,alias,type,flags)
VALUES ({?}, {?}, "alias", "bestalias")',
$uid, $bestalias);
if ($mailorg2) {
- $globals->xdb->execute('INSERT INTO aliases (id,alias,type)
+ XDB::execute('INSERT INTO aliases (id,alias,type)
VALUES ({?}, {?}, "alias")', $uid,
$mailorg2);
}
$logger = new DiogenesCoreLogger($uid);
$logger->log('inscription', $email);
- $globals->xdb->execute('UPDATE register_pending SET hash="INSCRIT" WHERE uid={?}', $uid);
+ XDB::execute('UPDATE register_pending SET hash="INSCRIT" WHERE uid={?}', $uid);
$globals->hook->subscribe($forlife, $uid, $promo, $password);
/***********************************************************/
/************* envoi d'un mail au démarcheur ***************/
/***********************************************************/
- $res = $globals->xdb->iterRow(
+ $res = XDB::iterRow(
"SELECT DISTINCT sa.alias, IF(s.nom_usage,s.nom_usage,s.nom) AS nom,
s.prenom, s.flags AS femme
FROM register_marketing AS m
INNER JOIN aliases AS sa ON ( sa.id = m.sender
AND FIND_IN_SET('bestalias', sa.flags) )
WHERE m.uid = {?}", $uid);
- $globals->xdb->execute("UPDATE register_mstats SET success=NOW() WHERE uid={?}", $uid);
+ XDB::execute("UPDATE register_mstats SET success=NOW() WHERE uid={?}", $uid);
while (list($salias, $snom, $sprenom, $sfemme) = $res->next()) {
require_once('diogenes/diogenes.hermes.inc.php');
$mymail->send();
}
- $globals->xdb->execute("DELETE FROM register_marketing WHERE uid = {?}", $uid);
+ XDB::execute("DELETE FROM register_marketing WHERE uid = {?}", $uid);
- redirect($globals->baseurl.'/register/success');
+ pl_redirect('register/success');
$page->assign('uid', $uid);
-
- return PL_OK;
}
function handler_success(&$page)
{
- global $globals;
-
$page->changeTpl('register/success.tpl');
if (Env::has('response2')) {
- $_SESSION['password'] = $password = Post::get('response2');
+ $_SESSION['password'] = $password = Post::v('response2');
- $globals->xdb->execute('UPDATE auth_user_md5 SET password={?}
+ XDB::execute('UPDATE auth_user_md5 SET password={?}
WHERE user_id={?}', $password,
- Session::getInt('uid'));
+ S::v('uid'));
- $log =& Session::getMixed('log');
+ $log =& S::v('log');
$log->log('passwd', '');
- if (Cookie::get('ORGaccess')) {
+ if (Cookie::v('ORGaccess')) {
require_once('secure_hash.inc.php');
setcookie('ORGaccess', hash_encrypt($password), (time()+25920000), '/', '' ,0);
}
}
$page->addJsLink('javascript/motdepasse.js');
-
- return PL_OK;
}
}