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

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