X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fxnetevents%2Fxnetevents.inc.php;h=214e1a7fc57bb0c9e1cb8fa8e586a704f8822bd2;hb=f981776842674edfa2c654e4248a7b290df98501;hp=a9ca09ccd5c83091d00a023bc2b865ba796ddca4;hpb=5f30b30e8b2657ade5c727e98de286386ee002d8;p=platal.git diff --git a/modules/xnetevents/xnetevents.inc.php b/modules/xnetevents/xnetevents.inc.php index a9ca09c..214e1a7 100644 --- a/modules/xnetevents/xnetevents.inc.php +++ b/modules/xnetevents/xnetevents.inc.php @@ -202,7 +202,8 @@ function get_event_participants(&$evt, $item_id, $tri, $limit = '') { function subscribe_lists_event($participate, $uid, $evt) { require_once('user.func.inc.php'); - global $globals,$page; + global $globals; + $page =& Platal::page(); $participant_list = $evt['participant_list']; $absent_list = $evt['absent_list']; @@ -215,7 +216,7 @@ function subscribe_lists_event($participate, $uid, $evt) $res = XDB::query("SELECT email FROM groupex.membres WHERE uid = {?} AND asso_id = {?}", - S::v('uid'), $globals->asso('id')); + $uid, $globals->asso('id')); $email = $res->fetchOneCell(); } @@ -250,7 +251,7 @@ function subscribe_lists_event($participate, $uid, $evt) } // }}} -function event_change_shortname(&$page, $old, $new) +function event_change_shortname(&$page, $eid, $old, $new) { global $globals; @@ -259,7 +260,7 @@ function event_change_shortname(&$page, $old, $new) } // Quelques vérifications sur l'alias (caractères spéciaux) if ($new && !preg_match( "/^[a-zA-Z0-9\-.]{3,20}$/", $new)) { - $page->trig("Le raccourci demandé n'est pas valide. + $page->trigError("Le raccourci demandé n'est pas valide. Vérifie qu'il comporte entre 3 et 20 caractères et qu'il ne contient que des lettres non accentuées, des chiffres ou les caractères - et ."); @@ -273,7 +274,7 @@ function event_change_shortname(&$page, $old, $new) WHERE short_name = {?}', $new); if ($res->fetchOneCell() > 0) { - $page->trig("Le raccourci demandé est déjà utilisé. Choisis en un autre."); + $page->trigError("Le raccourci demandé est déjà utilisé. Choisis en un autre."); return $old; } } @@ -301,13 +302,13 @@ function event_change_shortname(&$page, $old, $new) $lastid = XDB::insertId(); XDB::execute( - "INSERT INTO virtual_redirect ( + "INSERT IGNORE INTO virtual_redirect ( SELECT {?} AS vid, IF(u.nom IS NULL, m.email, CONCAT(a.alias, {?})) AS redirect FROM groupex.evenements_participants AS ep LEFT JOIN groupex.membres AS m ON (ep.uid = m.uid) LEFT JOIN auth_user_md5 AS u ON (u.user_id = ep.uid) LEFT JOIN aliases AS a ON (a.id = ep.uid AND a.type = 'a_vie') - WHERE ep.eid = {?} + WHERE ep.eid = {?} AND ep.nb > 0 GROUP BY ep.uid)", $lastid, '@'.$globals->mail->domain, $eid); @@ -318,12 +319,12 @@ function event_change_shortname(&$page, $old, $new) XDB::execute("INSERT INTO virtual_redirect ( SELECT {?} AS vid, IF(u.nom IS NULL, m.email, CONCAT(a.alias, {?})) AS redirect FROM groupex.membres AS m - LEFT JOIN groupex.evenements_participants AS ep ON (ep.uid = m.uid) + LEFT JOIN groupex.evenements_participants AS ep ON (ep.uid = m.uid AND ep.eid = {?}) LEFT JOIN auth_user_md5 AS u ON (u.user_id = m.uid) LEFT JOIN aliases AS a ON (a.id = m.uid AND a.type = 'a_vie') WHERE m.asso_id = {?} AND ep.uid IS NULL GROUP BY m.uid)", - $lastid, "@".$globals->mail->domain, $globals->asso('id')); + $lastid, "@".$globals->mail->domain, $eid, $globals->asso('id')); return $new; }