Zeile 1 | Zeile 1 |
---|
<?php /** * MyBB 1.6
|
<?php /** * MyBB 1.6
|
* Copyright � 2010 MyBB Group, All Rights Reserved
| * Copyright 2010 MyBB Group, All Rights Reserved
|
* * Website: http://mybb.com * License: http://mybb.com/about/license *
|
* * Website: http://mybb.com * License: http://mybb.com/about/license *
|
* $Id: functions_forumlist.php 4941 2010-05-15 18:17:38Z RyanGordon $
| * $Id: functions_forumlist.php 5711 2011-12-08 15:22:29Z Tomm $
|
*/
/**
| */
/**
|
Zeile 18 | Zeile 18 |
---|
*/ function build_forumbits($pid=0, $depth=1) {
|
*/ function build_forumbits($pid=0, $depth=1) {
|
global $fcache, $moderatorcache, $forumpermissions, $theme, $mybb, $templates, $bgcolor, $collapsed, $lang, $showdepth, $plugins, $parser, $forum_viewers;
| global $db, $fcache, $moderatorcache, $forumpermissions, $theme, $mybb, $templates, $bgcolor, $collapsed, $lang, $showdepth, $plugins, $parser, $forum_viewers; static $private_forums;
|
$forum_listing = '';
| $forum_listing = '';
|
Zeile 48 | Zeile 49 |
---|
continue; }
|
continue; }
|
$plugins->run_hooks_by_ref("build_forumbits_forum", $forum);
| $forum = $plugins->run_hooks("build_forumbits_forum", $forum);
|
// Build the link to this forum $forum_url = get_forum_link($forum['fid']);
| // Build the link to this forum $forum_url = get_forum_link($forum['fid']);
|
Zeile 64 | Zeile 65 |
---|
if($permissions['canonlyviewownthreads'] == 1) {
|
if($permissions['canonlyviewownthreads'] == 1) {
|
$hidelastpostinfo = true;
| $hideinfo = true;
// If we only see our own threads, find out if there's a new post in one of them so the lightbulb shows if(!is_array($private_forums)) { $private_forums = $fids = array(); foreach($fcache[$pid] as $parent_p) { foreach($parent_p as $forum_p) { if($forumpermissions[$forum_p['fid']]['canonlyviewownthreads']) { $fids[] = $forum_p['fid']; } } }
if(!empty($fids)) { $fids = implode(',', $fids); $query = $db->simple_select("threads", "tid, fid, lastpost", "uid = '{$mybb->user['uid']}' AND fid IN ({$fids})", array("order_by" => "lastpost", "order_dir" => "desc"));
while($thread = $db->fetch_array($query)) { if(!$private_forums[$thread['fid']]) { $private_forums[$thread['fid']] = $thread; } } } }
if($private_forums[$forum['fid']]['lastpost']) { $forum['lastpost'] = $private_forums[$forum['fid']]['lastpost']; $lastpost_data = array( "lastpost" => $private_forums[$forum['fid']]['lastpost'] ); } } else { $lastpost_data = array( "lastpost" => $forum['lastpost'], "lastpostsubject" => $forum['lastpostsubject'], "lastposter" => $forum['lastposter'], "lastposttid" => $forum['lastposttid'], "lastposteruid" => $forum['lastposteruid'] );
|
}
if($forum['password'] != '' && $mybb->cookies['forumpass'][$forum['fid']] != md5($mybb->user['uid'].$forum['password']))
| }
if($forum['password'] != '' && $mybb->cookies['forumpass'][$forum['fid']] != md5($mybb->user['uid'].$forum['password']))
|
Zeile 72 | Zeile 122 |
---|
$hideinfo = true; $showlockicon = 1; }
|
$hideinfo = true; $showlockicon = 1; }
|
$lastpost_data = array( "lastpost" => $forum['lastpost'], "lastpostsubject" => $forum['lastpostsubject'], "lastposter" => $forum['lastposter'], "lastposttid" => $forum['lastposttid'], "lastposteruid" => $forum['lastposteruid'] );
|
|
// Fetch subforums of this forum if(isset($fcache[$forum['fid']])) {
| // Fetch subforums of this forum if(isset($fcache[$forum['fid']])) {
|
Zeile 92 | Zeile 134 |
---|
$forum['unapprovedthreads'] += $forum_info['counters']['unapprovedthreads']; $forum['unapprovedposts'] += $forum_info['counters']['unapprovedposts']; $forum['viewers'] += $forum_info['counters']['viewing'];
|
$forum['unapprovedthreads'] += $forum_info['counters']['unapprovedthreads']; $forum['unapprovedposts'] += $forum_info['counters']['unapprovedposts']; $forum['viewers'] += $forum_info['counters']['viewing'];
|
|
|
// If the child forums' lastpost is greater than the one for this forum, set it as the child forums greatest. if($forum_info['lastpost']['lastpost'] > $lastpost_data['lastpost']) {
| // If the child forums' lastpost is greater than the one for this forum, set it as the child forums greatest. if($forum_info['lastpost']['lastpost'] > $lastpost_data['lastpost']) {
|
Zeile 112 | Zeile 154 |
---|
}
$sub_forums = $forum_info['forum_list'];
|
}
$sub_forums = $forum_info['forum_list'];
|
}
| }
|
// If we are hiding information (lastpost) because we aren't authenticated against the password for this forum, remove them
|
// If we are hiding information (lastpost) because we aren't authenticated against the password for this forum, remove them
|
if($hideinfo == true || $hidelastpostinfo == true)
| if($hidelastpostinfo == true)
|
{ unset($lastpost_data); }
| { unset($lastpost_data); }
|
Zeile 275 | Zeile 317 |
---|
$posts = my_number_format($forum['posts']); $threads = my_number_format($forum['threads']);
|
$posts = my_number_format($forum['posts']); $threads = my_number_format($forum['threads']);
|
}
| }
|
// Moderator column is not off if($mybb->settings['modlist'] != 0)
| // Moderator column is not off if($mybb->settings['modlist'] != 0)
|
Zeile 356 | Zeile 398 |
---|
// Swap over the alternate backgrounds $bgcolor = alt_trow();
|
// Swap over the alternate backgrounds $bgcolor = alt_trow();
|
|
|
// Add the forum to the list eval("\$forum_list .= \"".$templates->get("forumbit_depth$depth$forumcat")."\";");
|
// Add the forum to the list eval("\$forum_list .= \"".$templates->get("forumbit_depth$depth$forumcat")."\";");
|
} }
| } }
|
// Return an array of information to the parent forum including child forums list, counters and lastpost information return array( "forum_list" => $forum_list,
| // Return an array of information to the parent forum including child forums list, counters and lastpost information return array( "forum_list" => $forum_list,
|
Zeile 381 | Zeile 423 |
---|
function get_forum_lightbulb($forum, $lastpost, $locked=0) { global $mybb, $lang, $db, $unread_forums;
|
function get_forum_lightbulb($forum, $lastpost, $locked=0) { global $mybb, $lang, $db, $unread_forums;
|
|
|
// This forum is closed, so override the folder icon with the "offlock" icon. if($forum['open'] == 0 || $locked) {
| // This forum is closed, so override the folder icon with the "offlock" icon. if($forum['open'] == 0 || $locked) {
|
Zeile 395 | Zeile 437 |
---|
{ $forum_read = $forum['lastread']; }
|
{ $forum_read = $forum['lastread']; }
|
else // Is there not a read record for this forum? It must be unread
| elseif($mybb->cookies['mybb']['readallforums']) { // We've hit the read all forums as a guest, so use the lastvisit of the user $forum_read = $mybb->cookies['mybb']['lastvisit']; } else
|
{ $forum_read = 0;
|
{ $forum_read = 0;
|
//$forum_read = my_get_array_cookie("forumread", $forum['fid']);
| $threadcut = TIME_NOW - 60*60*24*$mybb->settings['threadreadcut'];
// If the user is a guest, do they have a forumsread cookie? if(!$mybb->user['uid'] && $mybb->cookies['mybb']['forumread']) { // If they've visited us before, then they'll have this cookie - otherwise everything is unread... $forum_read = my_get_array_cookie("forumread", $forum['fid']); } else if($mybb->user['uid'] && $mybb->settings['threadreadcut'] > 0 && $threadcut > $lastpost['lastpost']) { // We have a user, the forum's unread and we're over our threadreadcut limit for the lastpost - we mark these as read $forum_read = $lastpost['lastpost'] + 1; }
|
}
//if(!$forum_read)
| }
//if(!$forum_read)
|