summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSavetheinternet <savetheinternet@n0v4.com>2011-02-20 18:28:39 +1100
committerSavetheinternet <savetheinternet@n0v4.com>2011-02-20 18:28:39 +1100
commitdd845f4c7eaece33367b15bf60419ca92616a1a0 (patch)
tree06f1b520519c5353cee0f4f893f8d1f1b379ba9d
parentad3af856b3e8a70b71f80a3086104f36d149184a (diff)
Finalized report syste,
-rw-r--r--inc/config.php7
-rw-r--r--mod.php13
-rw-r--r--post.php5
-rw-r--r--style.css6
-rw-r--r--yotsuba.css2
5 files changed, 29 insertions, 4 deletions
diff --git a/inc/config.php b/inc/config.php
index 27352b5a..abfc38e3 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -227,6 +227,8 @@
$config['mod']['ip_banform'] = true;
// How many recent posts, per board, to show in the IP summary page
$config['mod']['ip_recentposts'] = 5;
+ // How many posts to display on the reports page
+ $config['mod']['recent_reports'] = 5;
// Probably best not to change these:
if(!defined('JANITOR')) {
@@ -328,7 +330,10 @@
'subject',
'post',
'body',
- 'password'
+ 'password',
+ 'sticky',
+ 'lock',
+ 'raw'
);
// A small file in the main directory indicating that the script has been ran and the board(s) have been generated.
diff --git a/mod.php b/mod.php
index 2e8a993e..04c17ac9 100644
--- a/mod.php
+++ b/mod.php
@@ -107,8 +107,12 @@
);
} elseif(preg_match('/^\/reports$/', $query)) {
$body = '';
+ $reports = 0;
+
+ $query = prepare("SELECT `reports`.*, `boards`.`uri` FROM `reports` INNER JOIN `boards` ON `board` = `boards`.`id` ORDER BY `time` DESC LIMIT :limit");
+ $query->bindValue(':limit', $config['mod']['recent_reports'], PDO::PARAM_INT);
+ $query->execute() or error(db_error($query));
- $query = query("SELECT `reports`.*, `boards`.`uri` FROM `reports` INNER JOIN `boards` ON `board` = `boards`.`id` ORDER BY `time` DESC") or error(db_error());
if($query->rowCount() < 1)
$body = '(Empty.)';
else {
@@ -124,6 +128,7 @@
$p_query->execute() or error(db_error($query));
}
+ $reports++;
openBoard($report['uri']);
if(!$post['thread']) {
@@ -148,6 +153,12 @@
}
}
+ $query = query("SELECT COUNT(`id`) AS `count` FROM `reports`") or error(db_error());
+ $count = $query->fetch();
+
+ $body .= '<p class="unimportant" style="text-align:center">Showing ' .
+ ($reports == $count['count'] ? 'all ' . $reports . ' reports' : $reports . ' of ' . $count['count'] . ' reports') . '.</p>';
+
echo Element('page.html', Array(
'index'=>$config['root'],
'title'=>'Report queue',
diff --git a/post.php b/post.php
index 5b1268da..23196c06 100644
--- a/post.php
+++ b/post.php
@@ -111,6 +111,9 @@
if(count($report) > $config['report_limit'])
error($config['error']['toomanyreports']);
+ $reason = $_POST['reason'];
+ markup($reason);
+
foreach($report as &$id) {
$query = prepare(sprintf("SELECT 1 FROM `posts_%s` WHERE `id` = :id", $board['uri']));
$query->bindValue(':id', $id, PDO::PARAM_INT);
@@ -122,7 +125,7 @@
$query->bindValue(':ip', $_SERVER['REMOTE_ADDR'], PDO::PARAM_STR);
$query->bindValue(':board', $board['id'], PDO::PARAM_INT);
$query->bindValue(':post', $id, PDO::PARAM_INT);
- $query->bindValue(':reason', htmlentities($_POST['reason']), PDO::PARAM_STR);
+ $query->bindValue(':reason', $reason, PDO::PARAM_STR);
$query->execute() or error(db_error($query));
}
}
diff --git a/style.css b/style.css
index 0b00f14e..c04cba83 100644
--- a/style.css
+++ b/style.css
@@ -140,6 +140,9 @@ div.post.op {
margin-right: 20px;
margin-bottom: 5px;
}
+div.post.op hr {
+ border-color: #D9BFB7;
+}
p.intro {
margin: 0.5em 0;
padding: 0;
@@ -316,4 +319,7 @@ div.boardlist.bottom {
}
div.boardlist a {
text-decoration: none;
+}
+div.report {
+ color: #333;
} \ No newline at end of file
diff --git a/yotsuba.css b/yotsuba.css
index a3809209..8a150157 100644
--- a/yotsuba.css
+++ b/yotsuba.css
@@ -46,7 +46,7 @@ div.pages a.selected {
color: #800;
}
hr {
- border-color: 1px solid #D9BFB7;
+ border-color: #D9BFB7;
}
div.boardlist {
color: #B86;