$saved = false;
$new = true;
}
- } elseif (Post::has('valid')) {
+ } elseif (Post::has('valid') && S::has_xsrf_token()) {
if (!$subject && $title) {
$subject = $title;
}
pl_redirect('ax');
break;
}
+ } elseif (Post::has('valid')) {
+ $page->trig("L'opération a échouée, merci de réessayer.");
}
$page->assign('id', $id);
$page->assign('short_name', $short_name);
function handler_cancel(&$page, $force = null)
{
require_once dirname(__FILE__) . '/axletter/axletter.inc.php';
- if (!AXLetter::hasPerms()) {
- return PL_FORBIDDEN;
- }
-
- $url = parse_url($_SERVER['HTTP_REFERER']);
- if ($force != 'force' && trim($url['path'], '/') != 'ax/edit') {
+ if (!AXLetter::hasPerms() || !S::has_xsrf_token()) {
return PL_FORBIDDEN;
}
$al = AXLetter::awaiting();
- if (!$alg) {
+ if (!$al) {
$page->kill("Aucune lettre en attente");
return;
}
function handler_valid(&$page, $force = null)
{
require_once dirname(__FILE__) . '/axletter/axletter.inc.php';
- if (!AXLetter::hasPerms()) {
- return PL_FORBIDDEN;
- }
-
- $url = parse_url($_SERVER['HTTP_REFERER']);
- if ($force != 'force' && trim($url['path'], '/') != 'ax/edit') {
+ if (!AXLetter::hasPerms() || !S::has_xsrf_token()) {
return PL_FORBIDDEN;
}
$action = Post::v('action');
$uid = Post::v('uid');
}
- if ($uid) {
+ if ($uid && S::has_xsrf_token()) {
$uids = preg_split('/ *[,;\: ] */', $uid);
foreach ($uids as $uid) {
switch ($action) {
break;
}
if (!$res) {
- $page->trig("Personne ne oorrespond à l'identifiant '$uid'");
+ $page->trig("Personne ne correspond à l'identifiant '$uid'");
}
}
+ } elseif ($uid) {
+ $page->trig("L'opération sur la liste des administrateurs AX a échouée, merci de réessayer.");
}
$page->changeTpl('axletter/admin.tpl');
<h1>Droits d'administration des lettres de l'AX</h1>
<form action="admin/axletter" method="post">
+ {xsrf_token_field}
<table class="tinybicol">
<tr>
<th>Nom</th>
{iterate item=a from=$admins}
<tr class="{cycle values="impair, pair"}">
<td><a href="profile/{$a.forlife}" class="popup2">{$a.prenom} {$a.nom} (X{$a.promo}){icon name=user_suit}</a></td>
- <td class="right"><a href="admin/axletter/del/{$a.forlife}">{icon name=cross title="Retirer"}</a></td>
+ <td class="right"><a href="admin/axletter/del/{$a.forlife}?token={xsrf_token}">{icon name=cross title="Retirer"}</a></td>
</tr>
{/iterate}
</table>
<h1>Edition de message</h1>
<form action="{$platal->pl_self()}" method="post">
+ {xsrf_token_field}
{if $am}
{include file="axletter/letter.tpl"}
<td colspan="2" class="center">
Envoi au plus tard le {$echeance|date_format:"%x vers %Hh"}<br />
{if $is_xorg}
- [<a href="ax/edit/valid" onclick="return confirm('Es-tu sûr de voiloir valider l\'envoi de ce message ?');">{*
+ [<a href="ax/edit/valid?token={xsrf_token}" onclick="return confirm('Es-tu sûr de vouloir valider l\'envoi de ce message ?');">{*
*}{icon name=thumb_up} Valider l'envoi</a>]
{else}
- [<a href="ax/edit/cancel" onclick="return confirm('Es-tu sûr de vouloir annuler l\'envoi de ce message ?');">{*
+ [<a href="ax/edit/cancel?token={xsrf_token}" onclick="return confirm('Es-tu sûr de vouloir annuler l\'envoi de ce message ?');">{*
*}{icon name=thumb_down} Annuler l'envoi</a>]
{/if}
</td>