From e7872767ffc0ba33883508c54dcdff2412ce7a56 Mon Sep 17 00:00:00 2001 From: nlstart Date: Tue, 20 Jul 2010 16:49:06 +0000 Subject: [PATCH] Bugtracker #4766 - Correct 'new' icon of new forum threads; thanks MikeNL --- .../newforumposts_main/languages/English.php | 9 ++- .../newforumposts_main/newforumposts_main.php | 72 +++++++++++++++++-- 2 files changed, 75 insertions(+), 6 deletions(-) diff --git a/e107_plugins/newforumposts_main/languages/English.php b/e107_plugins/newforumposts_main/languages/English.php index e70df8a5c..43ff13e5a 100644 --- a/e107_plugins/newforumposts_main/languages/English.php +++ b/e107_plugins/newforumposts_main/languages/English.php @@ -24,6 +24,13 @@ define("NFPM_L13", "Update New Forum Posts Settings"); define("NFPM_L14", "New Forum Posts settings updated."); define("NFPM_L15", "Check to display latest forum posts.
Default is latest topics."); define('NFPM_L16', '[user deleted]'); - +define('NFPM_L17', 'New Posts on Popular Thread'); +define('NFPM_L18', 'New Posts'); +define('NFPM_L19', 'No New Posts on Popular Thread'); +define('NFPM_L20', 'No New Posts'); +define('NFPM_L21', 'Sticky Thread'); +define('NFPM_L22', 'Closed Sticky Thread'); +define('NFPM_L23', 'Announcement'); +define('NFPM_L24', 'Closed Thread'); ?> \ No newline at end of file diff --git a/e107_plugins/newforumposts_main/newforumposts_main.php b/e107_plugins/newforumposts_main/newforumposts_main.php index ac87869e9..b3ea147a8 100644 --- a/e107_plugins/newforumposts_main/newforumposts_main.php +++ b/e107_plugins/newforumposts_main/newforumposts_main.php @@ -66,7 +66,7 @@ elseif(!isset($NEWFORUMPOSTSTYLE_HEADER)) } $results = $sql->db_Select_gen(" -SELECT t.thread_id, t.thread_name, t.thread_datestamp, t.thread_user, t.thread_views, t.thread_lastpost, t.thread_lastuser, t.thread_total_replies, f.forum_id, f.forum_name, f.forum_class, u.user_name, fp.forum_class, lp.user_name AS lp_name +SELECT t.thread_id, t.thread_name, t.thread_datestamp, t.thread_user, t.thread_views, t.thread_lastpost, t.thread_lastuser, t.thread_total_replies, t.thread_active, t.thread_s, f.forum_id, f.forum_name, f.forum_class, u.user_name, fp.forum_class, lp.user_name AS lp_name FROM #forum_t AS t LEFT JOIN #user AS u ON SUBSTRING_INDEX(t.thread_user,'.',1) = u.user_id LEFT JOIN #user AS lp ON SUBSTRING_INDEX(t.thread_lastuser,'.',1) = lp.user_id @@ -83,6 +83,7 @@ if(!isset($gen) || !is_object($gen)) $gen = new convert; } +/* // Deprecated method to indicate new forum posts if(is_readable(THEME."forum/new_small.png")) { $ICON = ""; @@ -91,6 +92,7 @@ else { $ICON = ""; } +*/ $TOTAL_TOPICS = $sql->db_Count("forum_t", "(*)", " WHERE thread_parent='0' "); $TOTAL_REPLIES = $sql->db_Count("forum_t", "(*)", " WHERE thread_parent!='0' "); $sql->db_Select_gen("SELECT sum(thread_views) FROM ".MPREFIX."forum_t"); @@ -125,10 +127,71 @@ foreach ($forumArray as $forumInfo) } else { - $LASTPOST = " - "; - $LASTPOSTDATE = ""; + $LASTPOST = ' - '; + $LASTPOSTDATE = ''; + } + + $newflag = FALSE; + if (USER) + { + if ($forumInfo['thread_lastpost'] > USERLV && !preg_match("#\b".$forumInfo['thread_id']."\b#", USERVIEWED)) + { + $newflag = TRUE; + } } + if ($newflag) + { + if ($forumInfo['thread_total_replies'] >= $pref['forum_popular']) + { + $iconfile = 'new_popular.png'; + $iconalt = NFPM_L17; + } + else + { + $iconfile = 'new.png'; + $iconalt = NFPM_L18; + } + } + else + { + if ($forumInfo['thread_total_replies'] >= $pref['forum_popular']) + { + $iconfile = 'nonew_popular.png'; + $iconalt = NFPM_L19; + } + else + { + $iconfile = 'nonew.png'; + $iconalt = NFPM_L20; + } + + if ($forumInfo['thread_s'] == 1) + { + if ($forumInfo['thread_active']) + { + $iconfile = 'sticky.png'; + $iconalt = NFPM_L21; + } + else + { + $iconfile = 'sticky_closed.png'; + $iconalt = NFPM_L22; + } + } + elseif($forumInfo['thread_s'] == 2) + { + $iconfile = 'announce.png'; + $iconalt = NFPM_L23; + } + elseif(!$forumInfo['thread_active']) + { + $iconfile = 'closed.png'; + $iconalt = NFPM_L24; + } + } + + $ICON = "".$iconalt.""; $x = explode(chr(1), $thread_user); $tmp = explode(".", $x[0], 2); if($user_name) @@ -161,6 +224,5 @@ $text = ($pref['nfp_layer'] ? "