mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-01-31 04:13:49 +01:00
Time limit before you are able to delete your post
This commit is contained in:
parent
f1acf68cde
commit
2852f0adf3
@ -113,6 +113,7 @@
|
|||||||
$config['error']['maxsize'] = 'The file was too big.';
|
$config['error']['maxsize'] = 'The file was too big.';
|
||||||
$config['error']['invalidzip'] = 'Invalid archive!';
|
$config['error']['invalidzip'] = 'Invalid archive!';
|
||||||
$config['error']['fileexists'] = 'That file <a href="%s">already exists</a>!';
|
$config['error']['fileexists'] = 'That file <a href="%s">already exists</a>!';
|
||||||
|
$config['error']['delete_too_soon'] = 'You\'ll have to wait another %s before deleting that.';
|
||||||
|
|
||||||
// Moderator errors
|
// Moderator errors
|
||||||
$config['error']['invalid'] = 'Invalid username and/or password.';
|
$config['error']['invalid'] = 'Invalid username and/or password.';
|
||||||
@ -131,7 +132,10 @@
|
|||||||
// How many reports you can create in the same request.
|
// How many reports you can create in the same request.
|
||||||
$config['report_limit'] = 2;
|
$config['report_limit'] = 2;
|
||||||
|
|
||||||
// Reply limit (deletes thread when this is reached)
|
// How long before you can delete a post after posting, in seconds.
|
||||||
|
$config['delete_time'] = 60;
|
||||||
|
|
||||||
|
// Reply limit (stops bumping thread when this is reached)
|
||||||
$config['reply_limit'] = 250;
|
$config['reply_limit'] = 250;
|
||||||
|
|
||||||
// Strip superfluous new lines at the end of a post
|
// Strip superfluous new lines at the end of a post
|
||||||
|
8
post.php
8
post.php
@ -52,14 +52,18 @@
|
|||||||
error($config['error']['nodelete']);
|
error($config['error']['nodelete']);
|
||||||
|
|
||||||
foreach($delete as &$id) {
|
foreach($delete as &$id) {
|
||||||
$query = prepare(sprintf("SELECT `password` FROM `posts_%s` WHERE `id` = :id", $board['uri']));
|
$query = prepare(sprintf("SELECT `time`,`password` FROM `posts_%s` WHERE `id` = :id", $board['uri']));
|
||||||
$query->bindValue(':id', $id, PDO::PARAM_INT);
|
$query->bindValue(':id', $id, PDO::PARAM_INT);
|
||||||
$query->execute() or error(db_error($query));
|
$query->execute() or error(db_error($query));
|
||||||
|
|
||||||
if($post = $query->fetch()) {
|
if($post = $query->fetch()) {
|
||||||
if(!empty($password) && $post['password'] != $password)
|
if(!empty($password) && $post['password'] != $password)
|
||||||
error($config['error']['invalidpassword']);
|
error($config['error']['invalidpassword']);
|
||||||
|
|
||||||
|
if($post['time'] >= time() - $config['delete_time']) {
|
||||||
|
error(sprintf($config['error']['delete_too_soon'], until($post['time'] + $config['delete_time'])));
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($_POST['file'])) {
|
if(isset($_POST['file'])) {
|
||||||
// Delete just the file
|
// Delete just the file
|
||||||
deleteFile($id);
|
deleteFile($id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user