// Defaut callback to call when a login is not found
function _default_user_callback($login)
{
- global $page;
- $page->trigError("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;
}
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);
default:
if (S::has_perms()) {
$aliases = $res->fetchColumn();
- $page->trigError("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();
}
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;
}
$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);
{
$sql = "SELECT e.entreprise, s.label as secteur , ss.label as sous_secteur , f.fonction_fr as fonction,
e.poste, e.adr1, e.adr2, e.adr3, e.postcode, e.city, e.entrid,
- gp.pays AS countrytxt, gr.name AS region, tt.display_tel AS tel,
- tf.display_tel AS fax, tm.display_tel AS mobile, e.entrid,
- e.pub, e.adr_pub, tt.pub AS tel_pub, e.email, e.email_pub, e.web
+ gp.pays AS countrytxt, gr.name AS region, e.entrid,
+ e.pub, e.adr_pub, e.email, e.email_pub, e.web
FROM entreprises AS e
LEFT JOIN emploi_secteur AS s ON(e.secteur = s.id)
LEFT JOIN emploi_ss_secteur AS ss ON(e.ss_secteur = ss.id AND e.secteur = ss.secteur)
LEFT JOIN fonctions_def AS f ON(e.fonction = f.id)
LEFT JOIN geoloc_pays AS gp ON (gp.a2 = e.country)
LEFT JOIN geoloc_region AS gr ON (gr.a2 = e.country and gr.region = e.region)
- LEFT JOIN profile_phones AS tt ON(tt.uid = e.uid AND tt.link_type = 'pro' AND tt.link_id = entrid AND tt.tel_id = 0)
- LEFT JOIN profile_phones AS tf ON(tf.uid = e.uid AND tf.link_type = 'pro' AND tf.link_id = entrid AND tf.tel_id = 1)
- LEFT JOIN profile_phones AS tm ON(tm.uid = e.uid AND tm.link_type = 'pro' AND tm.link_id = entrid AND tm.tel_id = 2)
WHERE e.uid = {?}
ORDER BY e.entrid";
$res = XDB::query($sql, $uid);
$all_pro[$i]['region'] = '';
}
}
- if (!has_user_right($pro['tel_pub'], $view)) {
- // if no tel was defined, then the viewer will be able to write it
- if ($pro['tel'] == '' &&
- $pro['fax'] == '' &&
- $pro['mobile'] == '') {
- $all_pro[$i]['tel_pub'] = $view;
- } else {
- $all_pro[$i]['tel'] = '';
- $all_pro[$i]['fax'] = '';
- $all_pro[$i]['mobile'] = '';
+ $sql = "SELECT pub AS tel_pub, tel_type, display_tel AS tel, comment
+ FROM profile_phones AS t
+ WHERE uid = {?} AND link_type = 'pro' AND link_id = {?}
+ ORDER BY link_id, tel_type DESC, tel_id";
+ $restel = XDB::iterator($sql, $uid, $pro['entrid']);
+ while ($nexttel = $restel->next()) {
+ if (has_user_right($nexttel['tel_pub'], $view)) {
+ if (!isset($all_pro[$i]['tels'])) {
+ $all_pro[$i]['tels'] = array($nexttel);
+ } else {
+ $all_pro[$i]['tels'][] = $nexttel;
+ }
}
}
if (!has_user_right($pro['email_pub'], $view)) {
$all_pro[$i]['fonction'] == '' &&
$all_pro[$i]['secteur'] == '' &&
$all_pro[$i]['poste'] == '' &&
- $all_pro[$i]['tel'] == '' &&
- $all_pro[$i]['fax'] == '' &&
- $all_pro[$i]['mobile'] == '' &&
+ (!isset($all_pro[$i]['tels'])) &&
$all_pro[$i]['email'] == '')
unset($all_pro[$i]);
}
$adrid_index[$adr['adrid']] = $i;
}
- $sql = "SELECT link_id AS adrid, pub AS tel_pub, tel_type, display_tel AS tel, tel_id AS telid
+ $sql = "SELECT link_id AS adrid, pub AS tel_pub, tel_type, display_tel AS tel, tel_id AS telid, comment
FROM profile_phones AS t
WHERE uid = {?} AND link_type = 'address'
ORDER BY link_id, tel_type DESC, tel_id";
{
$reqsql = "SELECT u.user_id, u.promo, u.promo_sortie, u.prenom, u.nom, u.nom_usage, u.date, u.cv,
u.perms IN ('admin','user','disabled') AS inscrit, FIND_IN_SET('femme', u.flags) AS sexe, u.deces != 0 AS dcd, u.deces,
- q.profile_nick AS nickname, q.profile_from_ax, t.display_tel AS mobile, q.profile_freetext AS freetext,
- t.pub AS mobile_pub, q.profile_freetext_pub AS freetext_pub,
+ q.profile_nick AS nickname, q.profile_from_ax, q.profile_freetext AS freetext,
+ q.profile_freetext_pub AS freetext_pub,
q.profile_medals_pub AS medals_pub,
IF(gp.nat='',gp.pays,gp.nat) AS nationalite, gp.a2 AS iso3166,
a.alias AS forlife, a2.alias AS bestalias,
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 OR FIND_IN_SET('googleapps', u.mail_storage) > 0) AS actif
+ (COUNT(e.email) > 0 OR FIND_IN_SET('googleapps', u.mail_storage) > 0) AS actif,
+ nd.display AS name_display, nd.tooltip AS name_tooltip
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')
LEFT JOIN photo AS p ON (p.uid = u.user_id)
LEFT JOIN mentor AS m ON (m.uid = u.user_id)
LEFT JOIN emails AS e ON (e.uid = u.user_id AND e.flags='active')
- LEFT JOIN profile_phones AS t ON (t.uid = u.user_id AND link_type = 'user' AND link_id = 0 AND tel_id = 0)
+ INNER JOIN profile_names_display AS nd ON (nd.user_id = u.user_id)
WHERE a.alias = {?}
GROUP BY u.user_id";
$res = XDB::query($reqsql, $from_uid, $login);
$user['nickname'] = '';
$user['section'] = '';
}
- // hide mobile
- if (!has_user_right($user['mobile_pub'], $view)) {
- if ($user['mobile'] == '')
- $user['mobile_pub'] = $view;
- else
- $user['mobile'] = '';
- }
// hide freetext
if (!has_user_right($user['freetext_pub'], $view)) {
$user['freetext'] = '';
}
+ $sql = "SELECT pub AS tel_pub, tel_type, display_tel AS tel, comment
+ FROM profile_phones AS t
+ WHERE uid = {?} AND link_type = 'user'
+ ORDER BY tel_type DESC, tel_id";
+ $restel = XDB::iterator($sql, $uid);
+ while ($nexttel = $restel->next()) {
+ if (has_user_right($nexttel['tel_pub'], $view)) {
+ if (!isset($user['tels'])) {
+ $user['tels'] = array($nexttel);
+ } else {
+ $user['tels'][] = $nexttel;
+ }
+ }
+ }
+
$user['adr_pro'] = get_user_details_pro($uid, $view);
$user['adr'] = get_user_details_adr($uid, $view);