function handlers()
{
return array(
- 'emails' => $this->make_hook('emails', AUTH_COOKIE),
- 'emails/alias' => $this->make_hook('alias', AUTH_MDP),
- 'emails/antispam' => $this->make_hook('antispam', AUTH_MDP),
+ 'emails' => $this->make_hook('emails', AUTH_COOKIE, 'mail'),
+ 'emails/alias' => $this->make_hook('alias', AUTH_MDP, 'mail'),
+ 'emails/antispam' => $this->make_hook('antispam', AUTH_MDP, 'mail'),
'emails/broken' => $this->make_hook('broken', AUTH_COOKIE),
- 'emails/redirect' => $this->make_hook('redirect', AUTH_MDP),
- 'emails/send' => $this->make_hook('send', AUTH_MDP),
+ 'emails/redirect' => $this->make_hook('redirect', AUTH_MDP, 'mail'),
+ 'emails/send' => $this->make_hook('send', AUTH_MDP, 'mail'),
'emails/antispam/submit' => $this->make_hook('submit', AUTH_COOKIE),
- 'emails/test' => $this->make_hook('test', AUTH_COOKIE, 'user', NO_AUTH),
+ 'emails/test' => $this->make_hook('test', AUTH_COOKIE, 'mail', NO_AUTH),
'emails/rewrite/in' => $this->make_hook('rewrite_in', AUTH_PUBLIC),
'emails/rewrite/out' => $this->make_hook('rewrite_out', AUTH_PUBLIC),
function handler_alias(&$page, $action = null, $value = null)
{
- require_once 'validations.inc.php';
-
global $globals;
$page->changeTpl('emails/alias.tpl');
}
//vérifier que l'alias n'est pas déja en demande
- $it = new ValidateIterator();
+ $it = Validate::iterate('alias');
while($req = $it->next()) {
- if ($req->type == 'alias' and $req->alias == $alias_mail) {
+ if ($req->alias == $alias_mail) {
$page->trigError("L'alias $alias_mail a déja été demandé.
Tu ne peux donc pas l'obtenir pour l'instant.");
return ;
if ($user->hasProfile()) {
XDB::execute("UPDATE profiles
SET alias_pub = {?}
- WHERE pid = {?}",
+ WHERE pid = {?}",
$value, $user->profile()->id());
}
$visibility = ($value == 'public');
function handler_send(&$page)
{
$page->changeTpl('emails/send.tpl');
- $page->addJsLink('ajax.js');
$page->setTitle('Envoyer un email');
$storage = new EmailStorage(S::user(), 'imap');
$storage->activate();
$page->assign('ok', true);
- $page->assign('prenom', S::v('prenom'));
- $page->assign('sexe', S::v('femme'));
+ $page->assign('yourself', S::user()->displayName());
+ $page->assign('sexe', S::user()->isFemale());
} else if (!S::logged() && $user) {
$storage = new EmailStorage($user, 'imap');
$storage->activate();
$page->assign('ok', true);
- $page->assign('prenom', $user->displayName());
+ $page->assign('yourself', $user->displayName());
$page->assign('sexe', $user->isFemale());
}
}
{
$page->changeTpl('emails/lost.tpl');
- // TODO: Order by promo.
$page->assign('lost_emails',
- XDB::iterator("SELECT a.uid, a.hruid
- FROM accounts AS a
- INNER JOIN email_options AS eo ON (eo.uid = a.uid)
- LEFT JOIN emails AS e ON (a.uid = e.uid AND FIND_IN_SET('active', e.flags))
- WHERE e.uid IS NULL AND FIND_IN_SET('googleapps', eo.storage) = 0 AND
- a.state = 'active'
- ORDER BY a.hruid"));
+ XDB::iterator('SELECT a.uid, a.hruid, pd.promo
+ FROM accounts AS a
+ INNER JOIN email_options AS eo ON (eo.uid = a.uid)
+ LEFT JOIN emails AS e ON (a.uid = e.uid AND FIND_IN_SET(\'active\', e.flags))
+ LEFT JOIN account_profiles AS ap ON (ap.uid = a.uid AND FIND_IN_SET(\'owner\', perms))
+ LEFT JOIN profile_display AS pd ON (ap.pid = pd.pid)
+ WHERE e.uid IS NULL AND FIND_IN_SET(\'googleapps\', eo.storage) = 0
+ AND a.state = \'active\'
+ ORDER BY pd.promo, a.hruid'));
}
function handler_broken_addr(&$page)