$view = new UserSet(new UFC_Group($globals->asso('id'), $admins));
$view->addMod('groupmember', 'Annuaire');
$view->addMod('trombi', 'Trombinoscope');
+ $view->addMod('map', 'Planisphère');
$view->apply('annuaire', $page, $action);
$page->assign('only_admin', $admins);
$page->changeTpl('xnetgrp/annuaire.tpl');
// + (the data) => %2B (in the url) => + (first decoding) => ' ' (second decoding)
// Since there can be no spaces in emails, we can fix this with :
$email = str_replace(' ', '+', $email);
+ $is_valid_email = isvalid_email($email);
- // Finds or creates account: first cases are for users with an account.
- if (!User::isForeignEmailAddress($email)) {
- // Standard account
- $user = User::getSilent($email);
- } else if (!isvalid_email($email)) {
- // email might not be a regular email but an alias or a hruid
- $user = User::getSilent($email);
- if (!$user) {
- // need a valid email address
- $page->trigError('« <strong>' . $email . '</strong> » n\'est pas une adresse email valide.');
- return;
- }
- } else if (Env::v('x') && Env::i('userid')) {
+ // X not registered to main site.
+ if (Env::v('x') && Env::i('userid') && $is_valid_email) {
$user = User::getSilentWithUID(Env::i('userid'));
if (!$user) {
$page->trigError('Utilisateur invalide.');
}
}
} else {
- // Check if the email is a redirection.
$user = User::getSilent($email);
+ // Wrong email and no user: failure.
+ if (is_null($user) && !$is_valid_email) {
+ $page->trigError('« <strong>' . $email . '</strong> » n\'est pas une adresse email valide.');
+ return;
+ }
+
+ // Deals with xnet accounts.
if (is_null($user) || $user->type == 'xnet') {
// User is of type xnet. There are 3 possible cases:
// * the email is not known yet: we create a new account and
if (Post::has('suggest')) {
if (Post::t('suggest') == 'yes') {
$user = S::user();
- $group = Platal::globals()->asso('nom');
- $request = new AccountReq($user, $hruid, $email, $group);
+ $request = new AccountReq($user, $hruid, $email, Platal::globals()->asso('nom'));
$request->submit();
$page->trigSuccessRedirect('Un email va bien être envoyé à ' . $email . ' pour l\'activation de son compte.',
- $group . '/member/' . $hruid);
+ Platal::globals()->asso('diminutif') . '/member/' . $hruid);
} else {
pl_redirect('member/' . $hruid);
}
}
XDB::query('UPDATE accounts
SET full_name = {?}, directory_name = {?}, display_name = {?},
- firstname = {?}, lastname = {?}, sex = {?}, email = {?}, type = {?}
+ firstname = {?}, lastname = {?}, sex = {?}, type = {?}
WHERE uid = {?}',
$full_name, $directory_name, Post::t('display_name'), $firstname, $lastname,
- (Post::t('sex') == 'male') ? 'male' : 'female', Post::t('email'),
+ (Post::t('sex') == 'male') ? 'male' : 'female',
(Post::t('type') == 'xnet') ? 'xnet' : 'virtual', $user->id());
- } else if (!$user->perms && Post::has('email') && require_email_update($user, Post::t('email'))) {
+ }
+
+ // Updates email.
+ $new_email = strtolower(Post::t('email'));
+ if (!$user->perms && require_email_update($user, $new_email)) {
XDB::query('UPDATE accounts
SET email = {?}
WHERE uid = {?}',
- Post::t('email'), $user->id());
+ $new_email, $user->id());
$listClient = new MMList(S::user());
- $listClient->change_user_email($user->forlifeEmail(), Post::t('email'));
- update_alias_user($user->forlifeEmail(), Post::t('email'));
+ $listClient->change_user_email($user->forlifeEmail(), $new_email);
+ update_alias_user($user->forlifeEmail(), $new_email);
}
if (XDB::affectedRows()) {
$page->trigSuccess('Données de l\'utilisateur mises à jour.');