diff options
| author | Fredrick Brennan <admin@8chan.co> | 2014-04-29 19:14:26 -0400 |
|---|---|---|
| committer | Fredrick Brennan <admin@8chan.co> | 2014-04-29 19:14:26 -0400 |
| commit | 0c9a27e1657c49687af6482242e14d4f0e12cae1 (patch) | |
| tree | d254d403762cfb1b18b4cda243c70d4e889daec8 /templates/themes/catalog/theme.php | |
| parent | 53e33d414fcf85fb2bf4219279378c4a4d131a70 (diff) | |
| parent | 2adf7d99db1ef22ef37e517e64f511495e6c83c4 (diff) | |
Merge branch 'staging' of https://github.com/vichan-devel/vichan into staging
Diffstat (limited to 'templates/themes/catalog/theme.php')
| -rw-r--r-- | templates/themes/catalog/theme.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/templates/themes/catalog/theme.php b/templates/themes/catalog/theme.php index 1f42b8d1..e3a45d64 100644 --- a/templates/themes/catalog/theme.php +++ b/templates/themes/catalog/theme.php @@ -35,7 +35,7 @@ $recent_posts = array(); $stats = array(); - $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()); + $query = query(sprintf("SELECT *, `id` AS `thread_id`, (SELECT COUNT(*) FROM ``posts_%s`` WHERE `thread` = `thread_id`) AS `reply_count`, (SELECT COUNT(*) FROM ``posts_%s`` WHERE `thread` = `thread_id` AND `filehash` IS NOT NULL) AS `image_count`, (SELECT `time` FROM ``posts_%s`` WHERE `thread` = `thread_id` ORDER BY `time` DESC LIMIT 1) AS `last_reply`, (SELECT `name` FROM ``posts_%s`` WHERE `thread` = `thread_id` ORDER BY `time` DESC LIMIT 1) AS `last_reply_name`, (SELECT `subject` FROM ``posts_%s`` WHERE `thread` = `thread_id` ORDER BY `time` DESC LIMIT 1) AS `last_reply_subject`, '%s' AS `board` FROM ``posts_%s`` WHERE `thread` IS NULL ORDER BY `bump` DESC", $board_name, $board_name, $board_name, $board_name, $board_name, $board_name, $board_name)) or error(db_error()); 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'])); @@ -44,6 +44,15 @@ $files = json_decode($post['files']); if ($files[0]->file == 'deleted') continue; $post['file'] = $config['uri_thumb'] . $files[0]->thumb; + + if ($settings['use_tooltipster']) { + $post['muhdifference'] = ago(time() - $post['time']); + + if ($post['last_reply']) + $post['last_reply_difference'] = ago(time() - $post['last_reply']); + } + + $recent_posts[] = $post; } |
