$promo_sortie = $res->fetchOneCell();
$page->assign('promo_sortie', $promo_sortie);
- if ($action && !S::has_xsrf_token()) {
- $page->trig("La mise à jour des notifications a échouée, merci de réessayer.");
- $action = false;
+ if ($action) {
+ S::assert_xsrf_token();
}
switch ($action) {
case 'add_promo':
break;
}
- if (Env::has('subs') && S::has_xsrf_token()) {
+ if (Env::has('subs')) {
+ S::assert_xsrf_token();
$watch->_subs->update('sub');
- } elseif (Env::has('subs')) {
- $page->trig("La mise à jour des notifications a échouée, merci de réessayer.");
}
- if (Env::has('flags_contacts') && S::has_xsrf_token()) {
+ if (Env::has('flags_contacts')) {
+ S::assert_xsrf_token();
$watch->watch_contacts = Env::b('contacts');
$watch->saveFlags();
- } elseif (Env::has('flags_contacts')) {
- $page->trig("La mise à jour des notifications a échouée, merci de réessayer.");
}
- if (Env::has('flags_mail') && S::has_xsrf_token()) {
+ if (Env::has('flags_mail')) {
+ S::assert_xsrf_token();
$watch->watch_mail = Env::b('mail');
$watch->saveFlags();
- } elseif (Env::has('flags_mail')) {
- $page->trig("La mise à jour des notifications a échouée, merci de réessayer.");
}
$page->assign_by_ref('watch', $watch);
// For XSRF protection, checks both the normal xsrf token, and the special RSS token.
// It allows direct linking to contact adding in the RSS feed.
- if (Env::v('action') && (S::has_xsrf_token() || Env::v('token') === S::v('core_rss_hash'))) {
- switch (Env::v('action')) {
- case 'retirer':
+ if (Env::v('action') && Env::v('token') !== S::v('core_rss_hash')) {
+ S::assert_xsrf_token();
+ }
+ switch (Env::v('action')) {
+ case 'retirer':
if (is_numeric($user)) {
if (XDB::execute('DELETE FROM contacts
WHERE uid = {?} AND contact = {?}',
}
break;
- case 'ajouter':
+ case 'ajouter':
require_once('user.func.inc.php');
if (($login = get_user_login($user)) !== false) {
if (XDB::execute(
$page->trig('Contact déjà dans la liste !');
}
}
- }
- } elseif (Env::v('action')) {
- $page->trig("La modification du contact a échouée, merci de réessayer.");
}
$search = false;