- pl_redirect('register/success');
- $page->assign('uid', $uid);
- }
-
- function handler_success(&$page)
- {
- global $globals;
- $page->changeTpl('register/success.tpl');
-
- $_SESSION['sub_state'] = array('step' => 5);
- if (Env::has('response2')) {
- $_SESSION['password'] = $password = Post::v('response2');
-
- XDB::execute('UPDATE auth_user_md5 SET password={?}
- WHERE user_id={?}', $password,
- 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,
- // 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'));
- 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);
- }
-
- $page->assign('mdpok', true);
- }
-
- $res = XDB::iterRow("SELECT sub, domain
- FROM register_subs
- WHERE uid = {?} AND type = 'list'
- ORDER BY domain",
- S::i('uid'));
- $current_domain = null;
- $lists = array();
- while (list($sub, $domain) = $res->next()) {
- if ($current_domain != $domain) {
- $current_domain = $domain;
- $client = new MMList(S::v('uid'), S::v('password'), $domain);
- }
- list($details, ) = $client->get_members($sub);
- $lists["$sub@$domain"] = $details;
- }
- $page->assign_by_ref('lists', $lists);
-
- $page->addJsLink('motdepasse.js');
- }
-
- function handler_save(&$page)
- {
- global $globals;
-
- // Finish registration procedure
- if (Post::v('register_from_ax_question')) {
- XDB::execute('UPDATE auth_user_quick
- SET profile_from_ax = 1
- WHERE user_id = {?}',
- S::v('uid'));
- }
- if (Post::v('add_to_nl')) {
- require_once 'newsletter.inc.php';
- NewsLetter::subscribe();
- }
- if (Post::v('add_to_ax')) {
- require_once dirname(__FILE__) . '/axletter/axletter.inc.php';
- AXLetter::subscribe();
- }
- if (Post::v('add_to_promo')) {
- $r = XDB::query('SELECT id FROM groupex.asso WHERE diminutif = {?}',
- S::v('promo'));
- $asso_id = $r->fetchOneCell();
- XDB::execute('REPLACE INTO groupex.membres (uid,asso_id)
- VALUES ({?}, {?})',
- S::v('uid'), $asso_id);
- $mmlist = new MMList(S::v('uid'), S::v('password'));
- $mmlist->subscribe("promo".S::v('promo'));
- }
- if (Post::v('sub_ml')) {
- $subs = array_keys(Post::v('sub_ml'));
- $current_domain = null;
- foreach ($subs as $list) {
- list($sub, $domain) = explode('@', $list);
- if ($domain != $current_domain) {
- $current_domain = $domain;
- $client = new MMList(S::v('uid'), S::v('password'), $domain);
- }
- $client->subscribe($sub);
- }
- }
- if (Post::v('imap')) {
- require_once 'emails.inc.php';
- $storage = new EmailStorage(S::v('uid'), 'imap');
- $storage->activate();
- }
-