Zeile 6 | Zeile 6 |
---|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* $Id: forumdisplay.php 5480 2011-07-04 21:29:44Z huji $
| * $Id: forumdisplay.php 5627 2011-10-06 07:52:01Z Tomm $
|
*/
define("IN_MYBB", 1);
| */
define("IN_MYBB", 1);
|
Zeile 629 | Zeile 629 |
---|
// Get Announcements $forum_stats = $cache->read("forumsdisplay");
|
// Get Announcements $forum_stats = $cache->read("forumsdisplay");
|
if($forum_stats[-1]['announcements'] || $forum_stats[$fid]['announcements'])
| if(!is_array($forum_stats))
|
{
|
{
|
$limit = ''; $announcements = ''; if($mybb->settings['announcementlimit']) { $limit = "LIMIT 0, ".$mybb->settings['announcementlimit']; }
| $forum_stats = $cache->read("forumdisplay", true);
|
|
|
$sql = build_parent_list($fid, "fid", "OR", $parentlist); $time = TIME_NOW; $query = $db->query(" SELECT a.*, u.username FROM ".TABLE_PREFIX."announcements a LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=a.uid) WHERE a.startdate<='$time' AND (a.enddate>='$time' OR a.enddate='0') AND ($sql OR fid='-1') ORDER BY a.startdate DESC $limit ");
| if(is_array($forum_stats) && ($forum_stats[-1]['announcements'] || $forum_stats[$fid]['announcements'])) { $limit = ''; $announcements = ''; if($mybb->settings['announcementlimit']) { $limit = "LIMIT 0, ".$mybb->settings['announcementlimit']; }
$sql = build_parent_list($fid, "fid", "OR", $parentlist); $time = TIME_NOW; $query = $db->query(" SELECT a.*, u.username FROM ".TABLE_PREFIX."announcements a LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=a.uid) WHERE a.startdate<='$time' AND (a.enddate>='$time' OR a.enddate='0') AND ($sql OR fid='-1') ORDER BY a.startdate DESC $limit ");
// See if this announcement has been read in our announcement array $cookie = array(); if(isset($mybb->cookies['mybb']['announcements'])) { $cookie = unserialize(stripslashes($mybb->cookies['mybb']['announcements'])); }
$bgcolor = alt_trow(true); // Reset the trow colors while($announcement = $db->fetch_array($query)) { if($announcement['startdate'] > $mybb->user['lastvisit'] && !$cookie[$announcement['aid']]) { $new_class = ' class="subject_new"'; $folder = "newfolder"; } else { $new_class = ' class="subject_old"'; $folder = "folder"; }
// Mmm, eat those announcement cookies if they're older than our last visit if($cookie[$announcement['aid']] < $mybb->user['lastvisit']) { unset($cookie[$announcement['aid']]); }
$announcement['announcementlink'] = get_announcement_link($announcement['aid']); $announcement['subject'] = $parser->parse_badwords($announcement['subject']); $announcement['subject'] = htmlspecialchars_uni($announcement['subject']); $postdate = my_date($mybb->settings['dateformat'], $announcement['startdate']); $posttime = my_date($mybb->settings['timeformat'], $announcement['startdate']); $announcement['profilelink'] = build_profile_link($announcement['username'], $announcement['uid']); if($foruminfo['allowtratings'] != 0 && $fpermissions['canviewthreads'] != 0) { eval("\$rating = \"".$templates->get("forumdisplay_announcement_rating")."\";"); $lpbackground = "trow2"; } else { $rating = ''; $lpbackground = "trow1"; } if($ismod) { eval("\$modann = \"".$templates->get("forumdisplay_announcements_announcement_modbit")."\";"); } else { $modann = ''; } $plugins->run_hooks("forumdisplay_announcement"); eval("\$announcements .= \"".$templates->get("forumdisplay_announcements_announcement")."\";"); $bgcolor = alt_trow(); }
|
|
|
$bgcolor = alt_trow(true); // Reset the trow colors while($announcement = $db->fetch_array($query)) { if($announcement['startdate'] > $mybb->user['lastvisit']) { $new_class = ' class="subject_new"'; $folder = "newfolder"; } else { $new_class = ' class="subject_old"'; $folder = "folder";
| if($announcements) { eval("\$announcementlist = \"".$templates->get("forumdisplay_announcements")."\";"); $shownormalsep = true;
|
}
|
}
|
$announcement['announcementlink'] = get_announcement_link($announcement['aid']); $announcement['subject'] = $parser->parse_badwords($announcement['subject']); $announcement['subject'] = htmlspecialchars_uni($announcement['subject']); $postdate = my_date($mybb->settings['dateformat'], $announcement['startdate']); $posttime = my_date($mybb->settings['timeformat'], $announcement['startdate']); $announcement['profilelink'] = build_profile_link($announcement['username'], $announcement['uid']); if($foruminfo['allowtratings'] != 0 && $fpermissions['canviewthreads'] != 0) { eval("\$rating = \"".$templates->get("forumdisplay_announcement_rating")."\";"); $lpbackground = "trow2"; } else { $rating = ''; $lpbackground = "trow1";
| if(empty($cookie)) { // Clean up cookie crumbs my_setcookie('mybb[announcements]', 0, (TIME_NOW - (60*60*24*365)));
|
}
|
}
|
if($ismod)
| else if(!empty($cookie))
|
{
|
{
|
eval("\$modann = \"".$templates->get("forumdisplay_announcements_announcement_modbit")."\";");
| my_setcookie("mybb[announcements]", addslashes(serialize($cookie)), -1);
|
}
|
}
|
else { $modann = ''; } $plugins->run_hooks("forumdisplay_announcement"); eval("\$announcements .= \"".$templates->get("forumdisplay_announcements_announcement")."\";"); $bgcolor = alt_trow(); }
if($announcements) { eval("\$announcementlist = \"".$templates->get("forumdisplay_announcements")."\";"); $shownormalsep = true;
| |
} }
| } }
|