summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorczaks <marcin@6irc.net>2013-07-31 21:03:13 -0400
committerczaks <marcin@6irc.net>2013-07-31 21:03:13 -0400
commit83844b5e3e5e29c71f1820901928eb5030eda6cb (patch)
tree33126ec603d83aebc5575f45e7388766de506ce9 /templates
parent03d91df1d8af49aa1fd9e87fa8e9643b52fd52d9 (diff)
parent0f9df0ac6608d3398cd480465dcab1b0227ec9c0 (diff)
Merge branch 'master' of https://github.com/savetheinternet/Tinyboard
Conflicts: inc/functions.php
Diffstat (limited to 'templates')
-rw-r--r--templates/themes/catalog/theme.php2
-rw-r--r--templates/themes/recent/theme.php19
-rw-r--r--templates/themes/rrdtool/theme.php5
3 files changed, 11 insertions, 15 deletions
diff --git a/templates/themes/catalog/theme.php b/templates/themes/catalog/theme.php
index e585cf17..5c9f6769 100644
--- a/templates/themes/catalog/theme.php
+++ b/templates/themes/catalog/theme.php
@@ -39,7 +39,7 @@
$query = query(sprintf("SELECT *, `id` AS `thread_id`, (SELECT COUNT(*) FROM `posts_%s` WHERE `thread` = `thread_id`) AS `reply_count`, '%s' AS `board` FROM `posts_%s` WHERE `thread` IS NULL ORDER BY `bump` DESC", $board_name, $board_name, $board_name)) or error(db_error());
- while ($post = $query->fetch()) {
+ while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
$post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], ($post['thread'] ? $post['thread'] : $post['id']));
$post['board_name'] = $board['name'];
$post['file'] = $config['uri_thumb'] . $post['thumb'];
diff --git a/templates/themes/recent/theme.php b/templates/themes/recent/theme.php
index 75907e77..98fabfa1 100644
--- a/templates/themes/recent/theme.php
+++ b/templates/themes/recent/theme.php
@@ -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,
diff --git a/templates/themes/rrdtool/theme.php b/templates/themes/rrdtool/theme.php
index 68fc1850..0e0a2f15 100644
--- a/templates/themes/rrdtool/theme.php
+++ b/templates/themes/rrdtool/theme.php
@@ -61,9 +61,8 @@
// debug just the graphing (not updating) with the --debug switch
if (!isset($argv[1]) || $argv[1] != '--debug') {
// Update graph
- $query = query(sprintf("SELECT MAX(`id`) AS `count` FROM `posts_%s`", $board));
- $count = $query->fetch();
- $count = $count['count'];
+ $query = query(sprintf("SELECT MAX(`id`) FROM `posts_%s`", $board));
+ $count = $query->fetchColumn();
if (!rrd_update($file, Array(
'-t',