From e5364fb428e4b68f8297bea4e9a5c5b56458ac8a Mon Sep 17 00:00:00 2001 From: Nao Date: Fri, 12 Sep 2014 01:24:36 +0200 Subject: [PATCH] * Rewrote Recent Items to use the time tag instead of these convoluted timestamp manipulations... (recent_items/*) Signed-off-by: Nao --- recent_items/Recent-Admin.english.php | 1 - recent_items/Recent-Admin.german.php | 1 - recent_items/Recent-Main.english.php | 2 -- recent_items/Recent-Main.german.php | 2 -- recent_items/Recent-Main.php | 23 +++++------------------ recent_items/Recent.template.php | 4 +--- recent_items/plugin-info.xml | 4 ++-- 7 files changed, 8 insertions(+), 29 deletions(-) diff --git a/recent_items/Recent-Admin.english.php b/recent_items/Recent-Admin.english.php index 678ff06..dceca2b 100644 --- a/recent_items/Recent-Admin.english.php +++ b/recent_items/Recent-Admin.english.php @@ -6,4 +6,3 @@ $txt['recentitems_as_post'] = 'The most recently updated posts'; $txt['recentitems_as_topic'] = 'The most recently updated topics'; $txt['recentitems_sidebar_infocenter'] = 'Show recent items in the info-center?'; -?> \ No newline at end of file diff --git a/recent_items/Recent-Admin.german.php b/recent_items/Recent-Admin.german.php index 4468fc2..e77fd69 100644 --- a/recent_items/Recent-Admin.german.php +++ b/recent_items/Recent-Admin.german.php @@ -6,4 +6,3 @@ $txt['recentitems_as_post'] = 'Die neuesten Beiträge'; $txt['recentitems_as_topic'] = 'Die neuesten Themen'; $txt['recentitems_sidebar_infocenter'] = 'Neue Beiträge im Info-Center zeigen?'; -?> \ No newline at end of file diff --git a/recent_items/Recent-Main.english.php b/recent_items/Recent-Main.english.php index 38a3145..6da7100 100644 --- a/recent_items/Recent-Main.english.php +++ b/recent_items/Recent-Main.english.php @@ -2,5 +2,3 @@ $txt['recent_items_post'] = 'Recent Posts'; $txt['recent_items_topic'] = 'Recent Topics'; - -?> \ No newline at end of file diff --git a/recent_items/Recent-Main.german.php b/recent_items/Recent-Main.german.php index 07c96fb..be7235e 100644 --- a/recent_items/Recent-Main.german.php +++ b/recent_items/Recent-Main.german.php @@ -2,5 +2,3 @@ $txt['recent_items_post'] = 'Neue Beiträge'; $txt['recent_items_topic'] = 'Neue Themen'; - -?> \ No newline at end of file diff --git a/recent_items/Recent-Main.php b/recent_items/Recent-Main.php index 9427b1c..6472f11 100644 --- a/recent_items/Recent-Main.php +++ b/recent_items/Recent-Main.php @@ -25,24 +25,15 @@ function recentitems_common() if (isset($context['latest_posts'])) return; - loadPluginTemplate('Arantor:RecentItems', 'Recent'); - loadPluginLanguage('Arantor:RecentItems', 'Recent-Main'); + loadPluginTemplate('Wedge:RecentItems', 'Recent'); + loadPluginLanguage('Wedge:RecentItems', 'Recent-Main'); if (empty($settings['recentitems_posttopic']) || ($settings['recentitems_posttopic'] != 'post' && $settings['recentitems_posttopic'] != 'topic')) $settings['recentitems_posttopic'] = 'post'; - $temp = cache_get_data('boards-latest_' . $settings['recentitems_posttopic'] . ':' . md5(we::$user['query_wanna_see_board'] . we::$user['language']), 90); - if ($temp !== null) - { - // Before we just throw it at the user, reformat the time. It will have been cached with whatever format the user had at the time. - $context['latest_posts'] = $temp; - foreach ($context['latest_posts'] as $k => $post) - { - $context['latest_posts'][$k]['time'] = timeformat($post['raw_timestamp']); - $context['latest_posts'][$k]['timestamp'] = forum_time(true, $post['raw_timestamp']); - } + $context['latest_posts'] = cache_get_data('boards-latest_' . $settings['recentitems_posttopic'] . ':' . md5(we::$user['query_wanna_see_board'] . we::$user['language']), 90); + if ($context['latest_posts'] !== null) return; - } // First, get the message ids. $context['latest_posts'] = array(); @@ -131,9 +122,7 @@ function recentitems_common() ), 'subject' => $row['subject'], 'short_subject' => shorten_subject($row['subject'], 24), - 'time' => timeformat($row['poster_time']), - 'timestamp' => forum_time(true, $row['poster_time']), - 'raw_timestamp' => $row['poster_time'], + 'timestamp' => $row['poster_time'], 'href' => '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'], 'link' => '' . $row['subject'] . '' ); @@ -143,5 +132,3 @@ function recentitems_common() cache_put_data('boards-latest_' . $settings['recentitems_posttopic'] . ':' . md5(we::$user['query_wanna_see_board'] . we::$user['language']), $context['latest_posts'], 90); } - -?> \ No newline at end of file diff --git a/recent_items/Recent.template.php b/recent_items/Recent.template.php index 71fc67b..0f02635 100644 --- a/recent_items/Recent.template.php +++ b/recent_items/Recent.template.php @@ -21,11 +21,9 @@ function template_recentitems_infocenter() foreach ($context['latest_posts'] as $post) echo '
', $post['link'], ' ', $txt['by'], ' ', $post['poster']['link'], ' (', $post['board']['link'], ')
-
', $post['time'], '
'; +
', time_tag($post['timestamp']), '
'; echo ' '; } - -?> \ No newline at end of file diff --git a/recent_items/plugin-info.xml b/recent_items/plugin-info.xml index b66457b..1bfe799 100644 --- a/recent_items/plugin-info.xml +++ b/recent_items/plugin-info.xml @@ -1,7 +1,7 @@ - + Recent Items - Arantor + Wedge Team Displays recent items (posts or topics) from your forum. 1.0