Finalized report syste,

This commit is contained in:
Savetheinternet 2011-02-20 18:28:39 +11:00
parent ad3af856b3
commit dd845f4c7e
5 changed files with 29 additions and 4 deletions

View File

@ -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.

13
mod.php
View File

@ -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',

View File

@ -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));
}
}

View File

@ -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;
}

View File

@ -46,7 +46,7 @@ div.pages a.selected {
color: #800;
}
hr {
border-color: 1px solid #D9BFB7;
border-color: #D9BFB7;
}
div.boardlist {
color: #B86;