SQL cleanup
This commit is contained in:
@@ -47,7 +47,7 @@
|
||||
$query = preg_replace('/UNION ALL $/', 'ORDER BY `time` DESC LIMIT ' . (int)$settings['limit_images'], $query);
|
||||
$query = query($query) or error(db_error());
|
||||
|
||||
while ($post = $query->fetch()) {
|
||||
while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
openBoard($post['board']);
|
||||
|
||||
// board settings won't be available in the template file, so generate links now
|
||||
@@ -67,7 +67,7 @@
|
||||
$query = preg_replace('/UNION ALL $/', 'ORDER BY `time` DESC LIMIT ' . (int)$settings['limit_posts'], $query);
|
||||
$query = query($query) or error(db_error());
|
||||
|
||||
while ($post = $query->fetch()) {
|
||||
while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
openBoard($post['board']);
|
||||
|
||||
$post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], ($post['thread'] ? $post['thread'] : $post['id'])) . '#' . $post['id'];
|
||||
@@ -78,7 +78,7 @@
|
||||
}
|
||||
|
||||
// Total posts
|
||||
$query = 'SELECT SUM(`top`) AS `count` FROM (';
|
||||
$query = 'SELECT SUM(`top`) FROM (';
|
||||
foreach ($boards as &$_board) {
|
||||
if (in_array($_board['uri'], $this->excluded))
|
||||
continue;
|
||||
@@ -86,11 +86,10 @@
|
||||
}
|
||||
$query = preg_replace('/UNION ALL $/', ') AS `posts_all`', $query);
|
||||
$query = query($query) or error(db_error());
|
||||
$res = $query->fetch();
|
||||
$stats['total_posts'] = number_format($res['count']);
|
||||
$stats['total_posts'] = number_format($query->fetchColumn());
|
||||
|
||||
// Unique IPs
|
||||
$query = 'SELECT COUNT(DISTINCT(`ip`)) AS `count` FROM (';
|
||||
$query = 'SELECT COUNT(DISTINCT(`ip`)) FROM (';
|
||||
foreach ($boards as &$_board) {
|
||||
if (in_array($_board['uri'], $this->excluded))
|
||||
continue;
|
||||
@@ -98,11 +97,10 @@
|
||||
}
|
||||
$query = preg_replace('/UNION ALL $/', ') AS `posts_all`', $query);
|
||||
$query = query($query) or error(db_error());
|
||||
$res = $query->fetch();
|
||||
$stats['unique_posters'] = number_format($res['count']);
|
||||
$stats['unique_posters'] = number_format($query->fetchColumn());
|
||||
|
||||
// Active content
|
||||
$query = 'SELECT SUM(`filesize`) AS `count` FROM (';
|
||||
$query = 'SELECT SUM(`filesize`) FROM (';
|
||||
foreach ($boards as &$_board) {
|
||||
if (in_array($_board['uri'], $this->excluded))
|
||||
continue;
|
||||
@@ -110,8 +108,7 @@
|
||||
}
|
||||
$query = preg_replace('/UNION ALL $/', ') AS `posts_all`', $query);
|
||||
$query = query($query) or error(db_error());
|
||||
$res = $query->fetch();
|
||||
$stats['active_content'] = $res['count'];
|
||||
$stats['active_content'] = $query->fetchColumn();
|
||||
|
||||
return Element('themes/recent/recent.html', Array(
|
||||
'settings' => $settings,
|
||||
|
Reference in New Issue
Block a user