X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fuser.func.inc.php;h=d9232a3457f9ee30ea3dbde66dd2d7800ac91b56;hb=5d42c993d85a2f1fa3595eb1591a921c0f89d8cd;hp=b515c0ce75e627ce5dcb84401e05db4aa9f34e4b;hpb=eaf30d86cc99df2414cf4f171a9b0f11b0561e3b;p=platal.git diff --git a/include/user.func.inc.php b/include/user.func.inc.php index b515c0c..d9232a3 100644 --- a/include/user.func.inc.php +++ b/include/user.func.inc.php @@ -1,6 +1,6 @@ mail->domain); @@ -71,6 +70,15 @@ function user_clear_all_subs($user_id, $really_del=true) $mmlist = new MMList(S::v('uid'), S::v('password')); $mmlist->kill($alias, $really_del); + + // Deactivates, when available, the Google Apps account of the user. + if ($globals->mailstorage->googleapps_domain) { + require_once 'googleapps.inc.php'; + if (GoogleAppsAccount::account_status($uid)) { + $account = new GoogleAppsAccount($uid, $alias); + $account->suspend(); + } + } } // }}} @@ -79,8 +87,7 @@ function user_clear_all_subs($user_id, $really_del=true) // Defaut callback to call when a login is not found function _default_user_callback($login) { - global $page; - $page->trig("Il n'y a pas d'utilisateur avec l'identifiant : $login"); + Platal::page()->trigError("Il n'y a pas d'utilisateur avec l'identifiant : $login"); return; } @@ -91,7 +98,7 @@ function _silent_user_callback($login) function get_user_login($data, $get_forlife = false, $callback = '_default_user_callback') { - global $globals, $page; + global $globals; if (is_numeric($data)) { $res = XDB::query("SELECT alias FROM aliases WHERE type='a_vie' AND id={?}", $data); @@ -163,7 +170,7 @@ function get_user_login($data, $get_forlife = false, $callback = '_default_user_ default: if (S::has_perms()) { $aliases = $res->fetchColumn(); - $page->trig("Il y a $i utilisateurs avec cette adresse mail : ".join(', ', $aliases)); + Platal::page()->trigError("Il y a $i utilisateurs avec cette adresse mail : ".join(', ', $aliases)); } else { $res->free(); } @@ -190,15 +197,27 @@ function get_users_forlife_list($members, $strict = false, $callback = '_default if (strlen(trim($members)) == 0) { return null; } - $members = explode(' ', $members); + $members = split("[; ,\r\n\|]+", $members); } if ($members) { $list = array(); foreach ($members as $i => $alias) { + $alias = trim($alias); + if (empty($alias)) { + continue; + } if (($login = get_user_forlife($alias, $callback)) !== false) { $list[$i] = $login; - } else if(!$strict) { + } else if (!$strict) { $list[$i] = $alias; + } else { + global $globals; + if (strpos($alias, '@') !== false) { + list($user, $dom) = explode('@', $alias); + if ($dom != $globals->mail->domain && $dom != $globals->mail->domain2) { + $list[$i] = $alias; + } + } } } return $list; @@ -239,7 +258,7 @@ function get_not_registered_user($login, $iterator = false) } $sql = "SELECT user_id, nom, prenom, promo FROM auth_user_md5 - WHERE $where + WHERE $where AND perms = 'pending' ORDER BY promo, nom, prenom"; if ($iterator) { return XDB::iterator($sql, $nom, $prenom, $promo); @@ -339,6 +358,7 @@ function get_user_details_adr($uid, $view = 'private') { gp.pays AS countrytxt,a.region, a.regiontxt, FIND_IN_SET('active', a.statut) AS active, a.adrid, FIND_IN_SET('res-secondaire', a.statut) AS secondaire, + FIND_IN_SET('courrier', a.statut) AS courier, a.pub, gp.display FROM adresses AS a LEFT JOIN geoloc_pays AS gp ON (gp.a2=a.country) @@ -391,7 +411,7 @@ function &get_user_details($login, $from_uid = '', $view = 'private') s.text AS section, p.x, p.y, p.pub AS photo_pub, u.matricule_ax, m.expertise != '' AS is_referent, - COUNT(e.email) > 0 AS actif + (COUNT(e.email) > 0 OR FIND_IN_SET('googleapps', u.mail_storage) > 0) AS actif FROM auth_user_md5 AS u INNER JOIN auth_user_quick AS q USING(user_id) INNER JOIN aliases AS a ON (u.user_id=a.id AND a.type='a_vie') @@ -448,14 +468,18 @@ function &get_user_details($login, $from_uid = '', $view = 'private') $user['binets'] = $res->fetchColumn(); $user['binets_join'] = join(', ', $user['binets']); - $res = XDB::iterRow("SELECT text, url - FROM groupesx_ins - LEFT JOIN groupesx_def ON groupesx_ins.gid = groupesx_def.id - WHERE guid = {?}", $uid); + $res = XDB::iterRow("SELECT a.diminutif, a.nom, a.site + FROM groupex.asso AS a + LEFT JOIN groupex.membres AS m ON (m.asso_id = a.id) + WHERE m.uid = {?} AND (a.cat = 'GroupesX' OR a.cat = 'Institutions') + AND pub = 'public'", $uid); $user['gpxs'] = Array(); $user['gpxs_name'] = Array(); - while (list($gxt, $gxu) = $res->next()) { - $user['gpxs'][] = $gxu ? "$gxt" : $gxt; + while (list($gxd, $gxt, $gxu) = $res->next()) { + if (!$gxu) { + $gxu = 'http://www.polytechnique.net/' . $gxd; + } + $user['gpxs'][] = '$gxd"; $user['gpxs_name'][] = $gxt; } $user['gpxs_join'] = join(', ', $user['gpxs']); @@ -477,7 +501,7 @@ function &get_user_details($login, $from_uid = '', $view = 'private') $user['applis_join'] = join(', ', $user['applis_fmt']); if (has_user_right($user['medals_pub'], $view)) { - $res = XDB::iterator("SELECT m.id, m.text AS medal, m.type, m.img, s.gid, g.text AS grade + $res = XDB::iterator("SELECT m.id, m.text AS medal, m.type, s.gid, g.text AS grade FROM profile_medals_sub AS s INNER JOIN profile_medals AS m ON ( s.mid = m.id ) LEFT JOIN profile_medals_grades AS g ON ( s.mid = g.mid AND s.gid = g.gid )