mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-23 23:20:57 +01:00
post.php: fix broken JS cookie setting
This commit is contained in:
parent
827373819f
commit
96bebe8c79
16
post.php
16
post.php
@ -1321,14 +1321,22 @@ if (isset($_POST['delete'])) {
|
||||
|
||||
if (isset($_SERVER['HTTP_REFERER'])) {
|
||||
// Tell Javascript that we posted successfully
|
||||
if (isset($_COOKIE[$config['cookies']['js']]))
|
||||
if (isset($_COOKIE[$config['cookies']['js']])) {
|
||||
$js = json_decode($_COOKIE[$config['cookies']['js']]);
|
||||
else
|
||||
} else {
|
||||
$js = (object)array();
|
||||
}
|
||||
// Tell it to delete the cached post for referer
|
||||
$js->{$_SERVER['HTTP_REFERER']} = true;
|
||||
// Encode and set cookie
|
||||
setcookie($config['cookies']['js'], json_encode($js), 0, $config['cookies']['jail'] ? $config['cookies']['path'] : '/', null, false, false);
|
||||
|
||||
// Encode and set cookie.
|
||||
$options = [
|
||||
'expires' => 0,
|
||||
'path' => $config['cookies']['jail'] ? $config['cookies']['path'] : '/',
|
||||
'httponly' => false,
|
||||
'samesite' => 'Strict'
|
||||
];
|
||||
setcookie($config['cookies']['js'], json_encode($js), $options);
|
||||
}
|
||||
|
||||
$root = $post['mod'] ? $config['root'] . $config['file_mod'] . '?/' : $config['root'];
|
||||
|
Loading…
Reference in New Issue
Block a user