================================================================================
VERSION 1.1.1 XX XX XXXX
+Bug/Wish:
+
+ * Emails:
+ - #1459: Lists and administrates aliases on main domain -JAC
+
From 1.1.0 branch:
* Search:
'lists/soptions' => $this->make_hook('soptions', AUTH_MDP),
'lists/check' => $this->make_hook('check', AUTH_MDP),
'admin/lists' => $this->make_hook('admin_all', AUTH_MDP, 'admin'),
+ 'admin/aliases' => $this->make_hook('aaliases', AUTH_MDP, 'admin')
);
}
$listes = $this->client->get_all_lists();
$page->assign_by_ref('listes', $listes);
}
+
+ function handler_aaliases($page, $alias = null)
+ {
+ global $globals;
+ require_once 'emails.inc.php';
+ $page->setTitle('Administration - Aliases');
+
+ if (Post::has('new_alias')) {
+ pl_redirect('admin/aliases/' . Post::t('new_alias') . '@' . $globals->mail->domain);
+ }
+
+ // If no alias, list them all.
+ if (is_null($alias)) {
+ $page->changeTpl('lists/admin_aliases.tpl');
+ $page->assign('aliases', array_merge(iterate_list_alias($globals->mail->domain), iterate_list_alias($globals->mail->domain2)));
+ return;
+ }
+
+ list($local_part, $domain) = explode('@', $alias);
+ if (!($globals->mail->domain == $domain || $globals->mail->domain2 == $domain)
+ || !preg_match("/^[a-zA-Z0-9\-\.]*$/", $local_part)) {
+ $page->trigErrorRedirect('Le nom de l\'alias est erroné.', $globals->asso('diminutif') . 'admin/aliases');
+ }
+
+ // Now we can perform the action.
+ if (Post::has('del_alias')) {
+ S::assert_xsrf_token();
+
+ delete_list_alias($local_part, $domain);
+ $page->trigSuccessRedirect($alias . ' supprimé.', 'admin/aliases');
+ }
+
+ if (Post::has('add_member')) {
+ S::assert_xsrf_token();
+
+ if (add_to_list_alias(Post::t('add_member'), $local_part, $domain)) {
+ $page->trigSuccess('Ajout réussit.');
+ } else {
+ $page->trigError('Ajout infructueux.');
+ }
+ }
+
+ if (Get::has('del_member')) {
+ S::assert_xsrf_token();
+
+ if (delete_from_list_alias(Get::t('del_member'), $local_part, $domain)) {
+ $page->trigSuccess('Suppression réussie.');
+ } else {
+ $page->trigError('Suppression infructueuse.');
+ }
+ }
+
+ $page->changeTpl('lists/admin_edit_alias.tpl');
+ $page->assign('members', list_alias_members($local_part, $domain));
+ $page->assign('alias', $alias);
+ }
}
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
<td>
<a href="admin/lists">MLs</a>
|
+ <a href="admin/aliases">aliases</a>
+ |
<a href="admin/mx/broken">MX défaillants</a>
|
<a href="admin/emails/lost">Perdus de vue</a>
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2011 Polytechnique.org *}
+{* http://opensource.polytechnique.org/ *}
+{* *}
+{* This program is free software; you can redistribute it and/or modify *}
+{* it under the terms of the GNU General Public License as published by *}
+{* the Free Software Foundation; either version 2 of the License, or *}
+{* (at your option) any later version. *}
+{* *}
+{* This program is distributed in the hope that it will be useful, *}
+{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
+{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
+{* GNU General Public License for more details. *}
+{* *}
+{* You should have received a copy of the GNU General Public License *}
+{* along with this program; if not, write to the Free Software *}
+{* Foundation, Inc., *}
+{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
+{* *}
+{**************************************************************************}
+
+<h1>Aliases</h1>
+
+<table cellspacing="0" cellpadding="0" class="tinybicol">
+ <tr>
+ <th>Aliases</th>
+ </tr>
+ {if $aliases|@count}
+ {foreach from=$aliases item=alias}
+ <tr>
+ <td><a href="admin/aliases/{$alias}">{$alias}</a></td>
+ </tr>
+ {/foreach}
+ {else}
+ <tr>
+ <td>Aucun alias</td>
+ </tr>
+ {/if}
+</table>
+
+<form method="post" action="admin/aliases">
+ {xsrf_token_field}
+ <p class="center">
+ <input type="text" name="new_alias" />
+ <input type="submit" value="Créer l'alias" />
+ </p>
+</form>
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2011 Polytechnique.org *}
+{* http://opensource.polytechnique.org/ *}
+{* *}
+{* This program is free software; you can redistribute it and/or modify *}
+{* it under the terms of the GNU General Public License as published by *}
+{* the Free Software Foundation; either version 2 of the License, or *}
+{* (at your option) any later version. *}
+{* *}
+{* This program is distributed in the hope that it will be useful, *}
+{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
+{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
+{* GNU General Public License for more details. *}
+{* *}
+{* You should have received a copy of the GNU General Public License *}
+{* along with this program; if not, write to the Free Software *}
+{* Foundation, Inc., *}
+{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
+{* *}
+{**************************************************************************}
+
+<p>[<a href="admin/aliases">Retour à la liste des aliases</a>]</p>
+
+<h1>Membres de {$alias}</h1>
+
+<table class="tinybicol">
+ {if $members.users|@count}
+ {foreach from=$members.users item=member}
+ <tr>
+ <td>
+ {if $member->hasProfile()}
+ <a href="https://www.polytechnique.org/profile/{$member->hruid}" class="popup2">{$member->fullName()}</a>
+ {else}
+ {$member->fullName()}
+ {/if}
+ </td>
+ <td class="right">{$member->promo()}</td>
+ <td class="center">
+ <a href="admin/aliases/{$alias}?del_member={$member->id()}&token={xsrf_token}">
+ {icon name=delete title="retirer membre"}
+ </a>
+ </td>
+ </tr>
+ {/foreach}
+ {/if}
+ {if $members.nonusers|@count}
+ {foreach from=$members.nonusers item=member}
+ <tr>
+ <td>{$member}</td>
+ <td></td>
+ <td class="center">
+ <a href="admin/aliases/{$alias}?del_member={$member}&token={xsrf_token}">
+ {icon name=delete title="retirer membre"}
+ </a>
+ </td>
+ </tr>
+ {/foreach}
+ {/if}
+ {if $members.users|@count eq 0 && $members.nonusers|@count eq 0}
+ <tr>
+ <td colspan="3">
+ <em>aucun membre…</em>
+ </td>
+ </tr>
+ {/if}
+ <tr>
+ <th colspan="3">Ajouter</th>
+ </tr>
+ <tr>
+ <td colspan="3" class="center">
+ <form method="post" action="admin/aliases/{$alias}">
+ {xsrf_token_field}
+ <div>
+ <input type="text" name="add_member" />
+
+ <input type="submit" value="ajouter" />
+ </div>
+ </form>
+ </td>
+ </tr>
+</table>
+
+
+<form method="post" action="admin/aliases/{$alias}">
+ {xsrf_token_field}
+ <p class="center">
+ <input type="submit" name="del_alias" value="Supprimer l'alias" onclick="return confirm('ES tu sûr de vouloir supprimer cet alias.')" />
+ </p>
+</form>
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}