summaryrefslogtreecommitdiff
path: root/mod.php
diff options
context:
space:
mode:
authorSavetheinternet <savetheinternet@n0v4.com>2011-02-11 23:02:30 +1100
committerSavetheinternet <savetheinternet@n0v4.com>2011-02-11 23:02:30 +1100
commitc34ea2e3af01d9a688fb14b3da550aa96615f312 (patch)
tree8560552c1f92ce13452cca79172799491ff9b69a /mod.php
parent0346862645aa0b9a8ba0f0d929b336b08ff8fcf4 (diff)
a Fixed delete by IP, plus a bunch of small stuff
Diffstat (limited to 'mod.php')
-rw-r--r--mod.php39
1 files changed, 38 insertions, 1 deletions
diff --git a/mod.php b/mod.php
index 43dd8d26..12b730a0 100644
--- a/mod.php
+++ b/mod.php
@@ -43,6 +43,8 @@
if(!login($_POST['username'], $_POST['password']))
loginForm(ERROR_INVALID, $_POST['username']);
+ modLog("Logged in.");
+
// Login successful
// Set cookies
setCookies();
@@ -295,6 +297,9 @@
}
$query->execute() or error(db_error($query));
+ // Record the action
+ modLog("Created a new board: {$b['title']}");
+
// Open the board
openBoard($b['uri']) or error("Couldn't open board after creation.");
@@ -356,6 +361,10 @@
// Delete post
deleteFile($post);
+
+ // Record the action
+ modLog("Removed file from post #{$post}");
+
// Rebuild board
buildIndex();
@@ -377,6 +386,10 @@
// Delete post
deletePost($post);
+
+ // Record the action
+ modLog("Deleted post #{$post}");
+
// Rebuild board
buildIndex();
@@ -399,8 +412,12 @@
$query->bindValue(':id', $post, PDO::PARAM_INT);
if($matches[2] == 'un') {
+ // Record the action
+ modLog("Unstickied post #{$post}");
$query->bindValue(':sticky', 0, PDO::PARAM_INT);
} else {
+ // Record the action
+ modLog("Stickied post #{$post}");
$query->bindValue(':sticky', 1, PDO::PARAM_INT);
}
@@ -429,8 +446,12 @@
$query->bindValue(':id', $post, PDO::PARAM_INT);
if($matches[2] == 'un') {
+ // Record the action
+ modLog("Unlocked post #{$post}");
$query->bindValue(':locked', 0, PDO::PARAM_INT);
} else {
+ // Record the action
+ modLog("Locked post #{$post}");
$query->bindValue(':locked', 1, PDO::PARAM_INT);
}
@@ -454,10 +475,22 @@
if(!openBoard($boardName))
error(ERROR_NOBOARD);
- $query = prepare(sprintf("SELECT `id` FROM `posts_%s` WHERE `ip` = (SELECT `ip` FROM `posts_%s` WHERE `id` = :id)", $board['uri'], $board['uri']));
+ $query = prepare(sprintf("SELECT `ip` FROM `posts_%s` WHERE `id` = :id", $board['uri']));
$query->bindValue(':id', $post);
$query->execute() or error(db_error($query));
+ if(!$post = $query->fetch())
+ error(ERROR_INVALIDPOST);
+
+ $ip = $post['ip'];
+
+ // Record the action
+ modLog("Deleted all posts by IP address: #{$ip}");
+
+ $query = prepare(sprintf("SELECT `id` FROM `posts_%s` WHERE `ip` = :ip", $board['uri']));
+ $query->bindValue(':ip', $ip);
+ $query->execute() or error(db_error($query));
+
if($query->rowCount() < 1)
error(ERROR_INVALIDPOST);
@@ -529,6 +562,10 @@
} else {
$query->bindValue(':reason', null, PDO::PARAM_NULL);
}
+
+ // Record the action
+ modLog("Created a ban for {$_POST['ip']} with reason {$_POST['reason']}");
+
$query->execute() or error(db_error($query));
// Delete too