<?php
/***************************************************************************
- * Copyright (C) 2003-2013 Polytechnique.org *
+ * Copyright (C) 2003-2014 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
'admin/emails/duplicated' => $this->make_hook('duplicated', AUTH_PASSWD, 'admin'),
'admin/emails/watch' => $this->make_hook('duplicated', AUTH_PASSWD, 'admin'),
'admin/emails/lost' => $this->make_hook('lost', AUTH_PASSWD, 'admin'),
- 'admin/emails/broken' => $this->make_hook('broken_addr', AUTH_PASSWD, 'admin'),
+ 'admin/emails/broken' => $this->make_hook('broken_addr', AUTH_PASSWD, 'admin,edit_directory'),
);
}
INNER JOIN email_virtual_domains AS m ON (s.domain = m.id)
INNER JOIN email_virtual_domains AS d ON (d.aliasing = m.id)
WHERE s.uid = {?}
- ORDER BY !alias, s.email",
+ ORDER BY !alias, s.email, d.name",
$user->id());
- $page->assign('aliases', $aliases);
+ $aliases_forlife = array();
+ $aliases_hundred = array();
+ $aliases_other = array();
+ while ($a = $aliases->next()) {
+ if ($a['forlife']) {
+ $aliases_forlife[] = $a;
+ } elseif ($a['hundred_year']) {
+ $aliases_hundred[] = $a;
+ } else {
+ $aliases_other[] = $a;
+ }
+ }
+ $page->assign('aliases_forlife', $aliases_forlife);
+ $page->assign('aliases_hundred', $aliases_hundred);
+ $page->assign('aliases_other', $aliases_other);
$alias = XDB::fetchOneCell('SELECT COUNT(email)
FROM email_source_account
AND er.type != \'imap\' AND er.type != \'homonym\')
LEFT JOIN account_profiles AS ap ON (ap.uid = a.uid AND FIND_IN_SET(\'owner\', ap.perms))
LEFT JOIN profile_display AS pd ON (ap.pid = pd.pid)
- WHERE a.state = \'active\' AND er.redirect IS NULL AND FIND_IN_SET(\'mail\', at.perms)
+ LEFT JOIN profiles AS p ON (ap.pid = p.pid)
+ WHERE a.state = \'active\' AND er.redirect IS NULL AND FIND_IN_SET(\'mail\', at.perms) AND p.deathdate IS NULL
GROUP BY a.uid
ORDER BY pd.promo, a.hruid'));
}
WHERE flags = \'active\' AND broken_level = 1
AND DATE_ADD(last, INTERVAL 1 YEAR) < CURDATE()');
+ // Sort $broken_user_list with (promo, sortname, pid)
+ $sortable_array = array();
+ foreach ($broken_user_list as $pid => $mails) {
+ $profile = $broken_user_profiles[$pid];
+ $sortable_array[$pid] = array($profile->promo(), $profile->sortName(), $pid);
+ }
+ asort($sortable_array);
+
// Output the list of users with recently broken addresses,
// along with the count of valid redirections.
pl_cached_content_headers('text/x-csv', 1);
$csv = fopen('php://output', 'w');
fputcsv($csv, array('nom', 'promo', 'bounces', 'nbmails', 'url', 'corps', 'job', 'networking'), ';');
$corpsList = DirEnum::getOptions(DirEnum::CURRENTCORPS);
- foreach ($broken_user_list as $pid => $mails) {
+ foreach (array_keys($sortable_array) as $pid) {
+ $mails = $broken_user_list[$pid];
$profile = $broken_user_profiles[$pid];
$current_corps = $profile->getCorpsName();
$jobs = $profile->getJobs();
}
}
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8:
?>