X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Femail.php;h=197ae8ec42f94701de1cb3ddc910b61747feddf1;hb=1285cf5413df654ccac839b9d9a32c4df2cee95a;hp=cca8797548c8cf2df746b67dbb9ee6194822ed65;hpb=5b6768e61333046987cdcc2a108051cfed5583cf;p=platal.git diff --git a/modules/email.php b/modules/email.php index cca8797..197ae8e 100644 --- a/modules/email.php +++ b/modules/email.php @@ -198,6 +198,7 @@ class EmailModule extends PLModule $value, $user->profile()->id()); } $visibility = ($value == 'public'); + exit; } $page->assign('actuel', $alias); @@ -249,15 +250,18 @@ class EmailModule extends PLModule $actifs = Env::v('emails_actifs', Array()); print_r(Env::v('emails_rewrite')); if (Env::v('emailop') == "ajouter" && Env::has('email')) { + $error_email = false; $new_email = Env::v('email'); if ($new_email == "new@example.org") { $new_email = Env::v('email_new'); } $result = $redirect->add_email($new_email); if ($result == ERROR_INVALID_EMAIL) { + $error_email = true; $page->assign('email', $new_email); } $page->assign('retour', $result); + $page->assign('error_email', $error_email); } elseif (empty($actifs)) { $result = ERROR_INACTIVE_REDIRECTION; } elseif (is_array($actifs)) { @@ -271,7 +275,7 @@ class EmailModule extends PLModule . $user->forlifeEmail() . ' ne fonctionnerait plus.'); break; case ERROR_INVALID_EMAIL: - $page->trigError('Erreur: l\'email n\'est pas valide.'); + $page->trigError('Erreur : l\'email n\'est pas valide.'); break; case ERROR_LOOP_EMAIL: $page->trigError('Erreur : ' . $user->forlifeEmail() @@ -664,13 +668,14 @@ class EmailModule extends PLModule $page->assign('neuneu', true); } else { $page->assign('email',$email); - $x = XDB::fetchOneAssoc("SELECT e1.uid, e1.panne != 0 AS panne, - (count(e2.uid) + IF(FIND_IN_SET('googleapps', eo.storage), 1, 0)) AS nb_mails - FROM emails as e1 + $x = XDB::fetchOneAssoc("SELECT e1.uid, e1.panne != 0 AS panne, a.hruid, + (COUNT(e2.uid) + IF(FIND_IN_SET('googleapps', eo.storage), 1, 0)) AS nb_mails + FROM emails AS e1 INNER JOIN email_options AS eo ON (eo.uid = e1.uid) - LEFT JOIN emails as e2 ON(e1.uid = e2.uid - AND FIND_IN_SET('active', e2.flags) - AND e1.email != e2.email) + INNER JOIN accounts AS a ON (e1.uid = a.uid) + LEFT JOIN emails AS e2 ON (e1.uid = e2.uid + AND FIND_IN_SET('active', e2.flags) + AND e1.email != e2.email) WHERE e1.email = {?} GROUP BY e1.uid", $email); if ($x) { @@ -920,19 +925,21 @@ class EmailModule extends PLModule $sel = Xdb::query( "SELECT acc.uid, count(e.email) AS nb_mails, IFNULL(pd.public_name, acc.full_name) AS fullname, - IFNULL(pd.promo, 0) AS promo, - FROM aliases AS a - INNER JOIN accounts AS acc ON a.id = acc.uid - LEFT JOIN emails AS e ON (e.uid = acc.uid - AND FIND_IN_SET('active', e.flags) AND e.panne = 0) - LEFT JOIN account_profiles AS ap ON (acc.uid = ap.uid AND FIND_IN_SET('owner', ap.perms)) - LEFT JOIN profile_display AS pd ON (pd.pid = ap.pid) + IFNULL(pd.promo, 0) AS promo + FROM aliases AS a + INNER JOIN accounts AS acc ON (a.uid = acc.uid) + LEFT JOIN emails AS e ON (e.uid = acc.uid + AND FIND_IN_SET('active', e.flags) AND e.panne = 0) + LEFT JOIN account_profiles AS ap ON (acc.uid = ap.uid AND FIND_IN_SET('owner', ap.perms)) + LEFT JOIN profile_display AS pd ON (pd.pid = ap.pid) WHERE a.alias = {?} GROUP BY acc.uid", $alias); if ($x = $sel->fetchOneAssoc()) { if ($x['nb_mails'] == 0) { - register_profile_update($x['uid'], 'broken'); + $user = User::getSilentWithUID($x['uid']); + $profile = $user->profile(); + WatchProfileUpdate::register($profile, 'broken'); } fputcsv($csv, array($x['fullname'], $x['promo'], $alias, join(',', $mails), $x['nb_mails'],