X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=htdocs.net%2Fgroupe%2Fmembres-edit.php;h=c5c86f57731d648d84751c8745f058497916e0f3;hb=31c3c378b14ffa752e22b62dbdc0e3b2c13df566;hp=8209b1a248e56a89271e876e34f99aa40503013d;hpb=253c95d9e2634920cd015c268c99077a2925a9e3;p=platal.git diff --git a/htdocs.net/groupe/membres-edit.php b/htdocs.net/groupe/membres-edit.php index 8209b1a..c5c86f5 100644 --- a/htdocs.net/groupe/membres-edit.php +++ b/htdocs.net/groupe/membres-edit.php @@ -5,17 +5,22 @@ function get_infos($email) { global $globals; + // look for uid instead of email if numeric + $field = is_numeric($email)?'uid':'email'; - $email = strtolower($email); - if (strpos($email, '@') === false) { - $email .= '@m4x.org'; + if ($field == 'email') { + $email = strtolower($email); + if (strpos($email, '@') === false) { + $email .= '@m4x.org'; + } + list($mbox,$dom) = explode('@', $email); } - list($mbox,$dom) = explode('@', $email); $res = $globals->xdb->query( "SELECT uid, nom, prenom, email, email AS email2, perms='admin', origine FROM groupex.membres - WHERE email = {?} AND asso_id = {?}", $email, $globals->asso('id')); + WHERE $field = {?} AND asso_id = {?}", $email, $globals->asso('id')); + if ($res->numRows()) { return $res->fetchOneAssoc(); } elseif ($dom == 'polytechnique.org' || $dom == 'm4x.org') { @@ -158,7 +163,15 @@ $page->assign('user', $user); if (Post::has('confirm')) { - if ($domain = $globals->asso('mail_domain')) { + + $globals->xdb->execute( + "DELETE FROM groupex.membres WHERE uid={?} AND asso_id={?}", + $user['uid'], $globals->asso('id')); + + // don't unsubscribe email from list if other user use same email + $user_same_email = get_infos($user['email']); + + if (($domain = $globals->asso('mail_domain')) && empty($user_same_email)) { require 'lists.inc.php'; $client =& lists_xmlrpc(Session::getInt('uid'), Session::get('password'), $domain); @@ -183,9 +196,6 @@ } } - $globals->xdb->execute( - "DELETE FROM groupex.membres WHERE uid={?} AND asso_id={?}", - $user['uid'], $globals->asso('id')); $page->trig("{$user['prenom']} {$user['nom']} a été retiré du groupe !"); } }