diff options
| author | Michael Foster <savetheinternet@tinyboard.org> | 2013-09-16 04:42:13 +1000 |
|---|---|---|
| committer | Michael Foster <savetheinternet@tinyboard.org> | 2013-09-16 04:42:13 +1000 |
| commit | 4b45ccc4ee3780f1393cfa9b1944d8f2b809afa6 (patch) | |
| tree | c3d496abf391836cb787f62dde7e748cb83f56a5 /post.php | |
| parent | 5d108319eb527ad91d362d8eecc3f24303e31dfa (diff) | |
ajax-post-controls.js
Diffstat (limited to 'post.php')
| -rw-r--r-- | post.php | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -58,7 +58,7 @@ if (isset($_POST['delete'])) { if ($password != '' && $post['password'] != $password) error($config['error']['invalidpassword']); - if ($post['time'] >= time() - $config['delete_time']) { + if ($post['time'] > time() - $config['delete_time']) { error(sprintf($config['error']['delete_too_soon'], until($post['time'] + $config['delete_time']))); } @@ -84,8 +84,12 @@ if (isset($_POST['delete'])) { $is_mod = isset($_POST['mod']) && $_POST['mod']; $root = $is_mod ? $config['root'] . $config['file_mod'] . '?/' : $config['root']; - header('Location: ' . $root . $board['dir'] . $config['file_index'], true, $config['redirect_http']); - + if (!isset($_POST['json_response'])) { + header('Location: ' . $root . $board['dir'] . $config['file_index'], true, $config['redirect_http']); + } else { + header('Content-Type: text/json'); + echo json_encode(array('success' => true)); + } } elseif (isset($_POST['report'])) { if (!isset($_POST['board'], $_POST['password'], $_POST['reason'])) error($config['error']['bot']); @@ -139,7 +143,12 @@ if (isset($_POST['delete'])) { $is_mod = isset($_POST['mod']) && $_POST['mod']; $root = $is_mod ? $config['root'] . $config['file_mod'] . '?/' : $config['root']; - header('Location: ' . $root . $board['dir'] . $config['file_index'], true, $config['redirect_http']); + if (!isset($_POST['json_response'])) { + header('Location: ' . $root . $board['dir'] . $config['file_index'], true, $config['redirect_http']); + } else { + header('Content-Type: text/json'); + echo json_encode(array('success' => true)); + } } elseif (isset($_POST['post'])) { if (!isset($_POST['body'], $_POST['board'])) error($config['error']['bot']); |
