summaryrefslogtreecommitdiff
path: root/forum/utils/threads.php
diff options
context:
space:
mode:
Diffstat (limited to 'forum/utils/threads.php')
-rw-r--r--forum/utils/threads.php28
1 files changed, 22 insertions, 6 deletions
diff --git a/forum/utils/threads.php b/forum/utils/threads.php
index 0c4ef32..11c54ee 100644
--- a/forum/utils/threads.php
+++ b/forum/utils/threads.php
@@ -1,4 +1,4 @@
-<?php
+<?php /* -*- Mode: php; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
include_once($UTIL_DIR . "/convert.php");
@@ -20,14 +20,16 @@ class Thread {
public function show()
{
global $fid, $current_user;
+
$jumptonew = "";
- echo " <div class=\"thread\">\n";
+ $newcls = "";
if($this->lastseen[$current_user->uid] < $this->lastpost) {
- echo " <div class=\"new\"></div>";
+ $newcls = " thread_new";
$jumptonew = "#firstunread";
- } else {
- echo " <div class=\"nonew\"></div>\n";
- }
+ }
+
+ echo " <div class=\"thread\">\n";
+ echo " <span class=\"thread_icon".$newcls."\"></span>";
echo " <a href=\"?fid=" . $fid . "&amp;tid=" . $this->tid . $jumptonew."\">" . $this->name . "</a>\n";
echo " </div>\n";
}
@@ -117,6 +119,20 @@ class Threads {
return $thread;
}
+ public function getLatestThread()
+ {
+ $tid = -1;
+ $last = -1;
+ foreach($this->threads as $thread) {
+ if($thread->lastpost > $last) {
+ $last = $thread->lastpost;
+ $tid = $thread->tid;
+ }
+ }
+ if($tid != -1) return $this->getThread($tid);
+ return NULL;
+ }
+
public function show()
{
foreach($this->threads as $thread) {