diff options
| author | Savetheinternet <savetheinternet@n0v4.com> | 2011-02-20 18:28:39 +1100 |
|---|---|---|
| committer | Savetheinternet <savetheinternet@n0v4.com> | 2011-02-20 18:28:39 +1100 |
| commit | dd845f4c7eaece33367b15bf60419ca92616a1a0 (patch) | |
| tree | 06f1b520519c5353cee0f4f893f8d1f1b379ba9d /mod.php | |
| parent | ad3af856b3e8a70b71f80a3086104f36d149184a (diff) | |
Finalized report syste,
Diffstat (limited to 'mod.php')
| -rw-r--r-- | mod.php | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -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', |
