function KUNENA_timeformat($logTime, $show_today = true) { // formatts a time in Display space! Don't pass internal times! // ToDo: Pass format! $usertime_format = _KUNENA_DT_DATETIME_FMT; $app =& JFactory::getApplication(); $time = $logTime; $todayMod = 2; // We can't have a negative date (on Windows, at least.) if ($time < 0) { $time = 0; } // Today and Yesterday? if ($show_today === true) { // Get the current time. $nowtime = CKunenaTools::fbGetShowTime(); $then = @getdate($time); $now = @getdate($nowtime); // Try to make something of a time format string... $s = strpos($usertime_format, '%S') === false ? '' : ':%S'; if (strpos($usertime_format, '%H') === false && strpos($usertime_format, '%T') === false) { $today_fmt = '%I:%M' . $s . ' %p'; } else { $today_fmt = '%H:%M' . $s; } // Same day of the year, same year.... Today! if ($then['yday'] == $now['yday'] && $then['year'] == $now['year']) { return '' . _TIME_TODAY . '' . KUNENA_timeformat($logTime, $today_fmt); } // Day-of-year is one less and same year, or it's the first of the year and that's the last of the year... if ($todayMod == '2' && ($then['yday'] == $now['yday'] - 1 && $then['year'] == $now['year'] || $now['yday'] == 0 && $then['year'] == $now['year'] - 1 && $then['mon'] == 12 && $then['mday'] == 31)) { return '' . _TIME_YESTERDAY . '' . KUNENA_timeformat($logTime, $today_fmt); } } $str = !is_bool($show_today) ? $show_today : $usertime_format; // Do-it-yourself time localization. Fun. foreach (array('%a' => 'days_short', '%A' => 'days', '%b' => 'months_short', '%B' => 'months') as $token => $text_label) { if (strpos($str, $token) !== false) { $str = str_replace($token, $GLOBALS['KUNENA_DT_txt'][$text_label][(int) strftime($token === '%a' || $token === '%A' ? '%w' : '%m', $time)], $str); } } if (strpos($str, '%p')) { $str = str_replace('%p', strftime('%H', $time) < 12 ? 'am' : 'pm', $str); } // Format any other characters.. return strftime($str, $time); }
$k = 1 - $k; ?> <tr class = "<?php echo $boardclass . '' . $tabclass[$k]; ?> "> <td class = "td-1" align="center"> #<?php echo $row->id; ?> </td> <td class = "td-2" align="left"> <?php echo KUNENA_timeformat(strtotime($row->created)); ?> </td> <td class = "td-3" align="left"> <a href = "<?php echo CKunenaLink::GetAnnouncementURL($fbConfig, 'read', $row->id); ?> "><?php echo stripslashes($row->title); ?> </a> </td> <td class = "td-4" align="center"> <?php
check_dberror("Unable to load categories."); $tabclass = array("sectiontableentry1", "sectiontableentry2"); $k = 0; if (sizeof($rows) == 0) { echo '' . _GEN_NOFORUMS . ''; } else { foreach ($rows as $singlerow) { $obj_fb_cat = new jbCategory($kunena_db, $singlerow->id); $is_Mod = fb_has_moderator_permission($kunena_db, $obj_fb_cat, $kunena_my->id, $is_admin); if (in_array($singlerow->id, $allow_forum)) { // $k=for alternating row colors: $k = 1 - $k; $numtopics = $singlerow->numTopics; $numreplies = $singlerow->numPosts; $lastPosttime = $singlerow->time_last_msg; $lastptime = KUNENA_timeformat(CKunenaTools::fbGetShowTime($singlerow->time_last_msg)); $forumDesc = stripslashes(smile::smileReplace($singlerow->description, 0, $fbConfig->disemoticons, $smileyList)); $forumDesc = nl2br($forumDesc); $forumDesc = smile::htmlwrap($forumDesc, $fbConfig->wrap); // Get the forumsubparent categories :: get the subcategories here $kunena_db->setQuery("SELECT id, name, numTopics, numPosts FROM #__fb_categories WHERE parent='{$singlerow->id}' AND published='1' ORDER BY ordering"); $forumparents = $kunena_db->loadObjectList(); check_dberror("Unable to load categories."); foreach ($forumparents as $childnum => $childforum) { if (!in_array($childforum->id, $allow_forum)) { unset($forumparents[$childnum]); } } $forumparents = array_values($forumparents); if ($kunena_my->id) { // get all threads with posts after the users last visit; don't bother for guests
//count the number of topics posted in each forum $kunena_db->setQuery("SELECT id FROM #__fb_messages WHERE catid='{$singlerow->id}' AND parent='0' AND hold='0'"); $num = $kunena_db->loadObjectList(); check_dberror("Unable to load messages."); $numtopics = count($num); //count the number of replies posted in each forum $kunena_db->setQuery("SELECT id FROM #__fb_messages WHERE catid='{$singlerow->id}' AND parent!='0' AND hold='0'"); $num = $kunena_db->loadObjectList(); check_dberror("Unable to load messages."); $numreplies = count($num); //Get the last post from each forum $kunena_db->setQuery("SELECT MAX(time) FROM #__fb_messages WHERE catid='{$singlerow->id}' AND hold='0' AND moved!='1'"); $lastPosttime = $kunena_db->loadResult(); check_dberror("Unable to get max time."); //changed lastPosttime to lastptime $lastptime = KUNENA_timeformat(CKunenaTools::fbGetShowTime($lastPosttime)); $lastPosttime = (int) $lastPosttime; if ($kunena_my->id != 0) { // get all threads with posts after the users last visit; don't bother for guests $kunena_db->setQuery("SELECT thread FROM #__fb_messages WHERE catid='{$singlerow->id}' AND hold='0' AND time>'{$prevCheck}' GROUP BY thread"); $newThreadsAll = $kunena_db->loadObjectList(); check_dberror("Unable to load messages."); if (count($newThreadsAll) == 0) { $newThreadsAll = array(); } //Get the topics this user has already read this session from #__fb_sessions $readTopics = ""; $kunena_db->setQuery("SELECT readtopics FROM #__fb_sessions WHERE userid='{$kunena_my->id}'"); $readTopics = $kunena_db->loadResult(); check_dberror("Unable to load read topics."); //make it into an array
$anns = $kunena_db->loadObjectList(); check_dberror("Unable to load announcements."); if (count($anns) == 0) { return; } $ann = $anns[0]; $annID = $ann->id; $anntitle = stripslashes($ann->title); $smileyList = smile::getEmoticons(0); $annsdescription = stripslashes(smile::smileReplace($ann->sdescription, 0, $fbConfig->disemoticons, $smileyList)); $annsdescription = nl2br($annsdescription); $annsdescription = smile::htmlwrap($annsdescription, $fbConfig->wrap); $anndescription = stripslashes(smile::smileReplace($ann->description, 0, $fbConfig->disemoticons, $smileyList)); $anndescription = nl2br($anndescription); $anndescription = smile::htmlwrap($anndescription, $fbConfig->wrap); $anncreated = KUNENA_timeformat(strtotime($ann->created)); $annpublished = $ann->published; $annshowdate = $ann->showdate; if ($annID > 0) { ?> <!-- ANNOUNCEMENTS BOX --> <div class="<?php echo $boardclass; ?> _bt_cvr1"> <div class="<?php echo $boardclass; ?> _bt_cvr2"> <div class="<?php echo $boardclass;