fbsessiontimeout); //move 30 minutes back to compensate for expired sessions } else { if ("" == $sel) { $sel = 720; } //take 720 hours ~ 1 month as default //Time translation $back_time = $sel * 3600; //hours*(mins*secs) $querytime = time() - $back_time; } // get all the threads with posts in the specified timeframe $kunena_db->setQuery( "SELECT a.id, a.thread, a.subject, b.lastpost FROM #__fb_messages AS a JOIN ( SELECT thread, MAX(time) AS lastpost FROM #__fb_messages WHERE time >'{$querytime}' AND hold='0' AND moved='0' AND catid IN ($fbSession->allowed) GROUP BY 1) AS b ON b.thread = a.thread WHERE a.parent='0' AND a.moved='0' AND a.hold='0' GROUP BY a.thread ORDER BY b.lastpost DESC LIMIT 100"); $resultSet = $kunena_db->loadObjectList(); check_dberror("Unable to load messages."); $countRS = count($resultSet); //check if $sel has a reasonable value and not a Unix timestamp: $since = false; $lastvisit = ''; if ($sel == "0") { $lastvisit = date(_DATETIME, $querytime); $since = true; } ?>
setQuery("SELECT MAX(time) AS maxtime, COUNT(*) AS totalmessages FROM #__fb_messages WHERE thread='{$rs->thread}'"); $thisThread = $kunena_db->loadObject(); $latestPostTime = $thisThread->maxtime; //get the latest post itself unset($result); $kunena_db->setQuery("SELECT a.id, a.name, a.userid, a.catid, c.id AS catid, c.name as catname FROM #__fb_messages AS a LEFT JOIN #__fb_categories AS c ON a.catid=c.id WHERE a.time='{$latestPostTime}'"); $result = $kunena_db->loadObject(); $latestPostId = $result->id; $latestPostName = html_entity_decode_utf8(stripslashes($result->name)); $latestPostUserid = $result->userid; $latestPostCatid = $result->catid; $catname = kunena_htmlspecialchars(stripslashes($result->catname)); $kunena_db->setQuery("SELECT COUNT(*) FROM #__fb_messages WHERE time>'{$querytime}' AND thread={$rs->thread}"); $numberOfPosts = $kunena_db->loadResult(); $k = 1 - $k; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } } else { echo ""; } echo "
()
'; echo CKunenaLink::GetThreadLink('view', $latestPostCatid, $rs->thread, kunena_htmlspecialchars(stripslashes($rs->subject)), kunena_htmlspecialchars(stripslashes($rs->subject))).' '; $threadPages = 1; if ($thisThread->totalmessages > $fbConfig->messages_per_page) { $threadPages = ceil($thisThread->totalmessages / $fbConfig->messages_per_page); echo ("["); echo _PAGE.' '.CKunenaLink::GetThreadPageLink($fbConfig, 'view', $latestPostCatid, $rs->thread, 1, $fbConfig->messages_per_page, 1); if ($threadPages > 3) { echo ("..."); $startPage = $threadPages - 2; } else { echo (","); $startPage = 2; } $noComma = true; for ($hopPage = $startPage; $hopPage <= $threadPages; $hopPage++) { if ($noComma) { $noComma = false; } else { echo (","); } echo CKunenaLink::GetThreadPageLink($fbConfig, 'view', $latestPostCatid, $rs->thread, $hopPage, $fbConfig->messages_per_page, $hopPage); } echo '] '; } $tmpicon = isset($fbIcons['latestpost']) ? ''._SHOW_LAST.'':' '._SHOW_LAST.''; echo CKunenaLink::GetThreadPageLink($fbConfig, 'view', $latestPostCatid, $rs->thread, $threadPages, $fbConfig->messages_per_page, $tmpicon, $latestPostId); echo '
' . _GEN_FORUM . ' : ' . $catname . '
' . $numberOfPosts . ''; echo CKunenaLink::GetProfileLink($fbConfig, $latestPostUserid, kunena_htmlspecialchars($latestPostName)); echo '' . date(_DATETIME, $latestPostTime) . '
" . _NO_TIMEFRAME_POSTS . "
"; ?>
enableforumjump) require_once (KUNENA_PATH_LIB .DS. 'kunena.forumjump.php'); ?>