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 5655 2011-11-27 00:10:00Z Tomm $
| * $Id: forumdisplay.php 5765 2012-03-27 09:52:45Z Tomm $
|
*/
define("IN_MYBB", 1);
| */
define("IN_MYBB", 1);
|
Zeile 84 | Zeile 84 |
---|
if($mybb->user['uid'] == 0) { // Cookie'd forum read time
|
if($mybb->user['uid'] == 0) { // Cookie'd forum read time
|
$forumsread = unserialize($mybb->cookies['mybb']['forumread']); if(!is_array($forumsread))
| $forumsread = my_unserialize($mybb->cookies['mybb']['forumread']);
if(is_array($forumsread) && empty($forumsread))
|
{ if($mybb->cookies['mybb']['readallforums']) {
| { if($mybb->cookies['mybb']['readallforums']) {
|
Zeile 117 | Zeile 117 |
---|
if($mybb->user['uid'] == 0 && $forumsread[$forum['fid']]) { $forum['lastread'] = $forumsread[$forum['fid']];
|
if($mybb->user['uid'] == 0 && $forumsread[$forum['fid']]) { $forum['lastread'] = $forumsread[$forum['fid']];
|
}
| }
|
$fcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;
|
$fcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;
|
}
| }
|
// Get the forum moderators if the setting is enabled. if($mybb->settings['modlist'] != 0) {
| // Get the forum moderators if the setting is enabled. if($mybb->settings['modlist'] != 0) {
|
Zeile 132 | Zeile 132 |
---|
if($mybb->settings['subforumsindex'] != 0) { $showdepth = 3;
|
if($mybb->settings['subforumsindex'] != 0) { $showdepth = 3;
|
}
| }
|
else { $showdepth = 2;
| else { $showdepth = 2;
|
Zeile 163 | Zeile 163 |
---|
}
if($foruminfo['type'] == "f" && $foruminfo['open'] != 0)
|
}
if($foruminfo['type'] == "f" && $foruminfo['open'] != 0)
|
{
| {
|
eval("\$newthread = \"".$templates->get("forumdisplay_newthread")."\";");
|
eval("\$newthread = \"".$templates->get("forumdisplay_newthread")."\";");
|
}
| }
|
if($fpermissions['cansearch'] != 0 && $foruminfo['type'] == "f") { eval("\$searchforum = \"".$templates->get("forumdisplay_searchforum")."\";");
|
if($fpermissions['cansearch'] != 0 && $foruminfo['type'] == "f") { eval("\$searchforum = \"".$templates->get("forumdisplay_searchforum")."\";");
|
| }
// Gather forum stats $has_announcements = $has_modtools = false; $forum_stats = $cache->read("forumsdisplay");
if(is_array($forum_stats)) { if($forum_stats[-1]['modtools'] || $forum_stats[$fid]['modtools']) { // Mod tools are specific to forums, not parents $has_modtools = true; }
if($forum_stats[-1]['announcements'] || $forum_stats[$fid]['announcements']) { // Global or forum-specific announcements $has_announcements = true; }
|
}
$done_moderators = array( "users" => array(), "groups" => array() );
|
}
$done_moderators = array( "users" => array(), "groups" => array() );
|
|
|
$moderators = ''; $parentlistexploded = explode(",", $parentlist);
|
$moderators = ''; $parentlistexploded = explode(",", $parentlist);
|
|
|
foreach($parentlistexploded as $mfid) { // This forum has moderators
| foreach($parentlistexploded as $mfid) { // This forum has moderators
|
Zeile 191 | Zeile 212 |
---|
if($moderator['isgroup']) { if(in_array($moderator['id'], $done_moderators['groups']))
|
if($moderator['isgroup']) { if(in_array($moderator['id'], $done_moderators['groups']))
|
{ continue; }
| { continue; }
|
$moderators .= $comma.htmlspecialchars_uni($moderator['title']); $done_moderators['groups'][] = $moderator['id']; }
| $moderators .= $comma.htmlspecialchars_uni($moderator['title']); $done_moderators['groups'][] = $moderator['id']; }
|
Zeile 209 | Zeile 230 |
---|
$comma = $lang->comma; } }
|
$comma = $lang->comma; } }
|
| }
if($forum_stats[$mfid]['announcements']) { $has_announcements = true;
|
} } $comma = '';
| } } $comma = '';
|
Zeile 313 | Zeile 339 |
---|
);
$foruminfo['rules'] = $parser->parse_message($foruminfo['rules'], $rules_parser);
|
);
$foruminfo['rules'] = $parser->parse_message($foruminfo['rules'], $rules_parser);
|
if($foruminfo['rulestype'] == 1)
| if($foruminfo['rulestype'] == 1 || $foruminfo['rulestype'] == 3)
|
{ eval("\$rules = \"".$templates->get("forumdisplay_rules")."\";"); }
| { eval("\$rules = \"".$templates->get("forumdisplay_rules")."\";"); }
|
Zeile 365 | Zeile 391 |
---|
if($mybb->user['daysprune']) { $datecut = $mybb->user['daysprune'];
|
if($mybb->user['daysprune']) { $datecut = $mybb->user['daysprune'];
|
} else
| } else
|
{ // If the forum has a non-default date cut, use it. if(!empty($foruminfo['defaultdatecut']))
| { // If the forum has a non-default date cut, use it. if(!empty($foruminfo['defaultdatecut']))
|
Zeile 384 | Zeile 410 |
---|
$datecut = intval($datecut); $datecutsel[$datecut] = "selected=\"selected\""; if($datecut > 0 && $datecut != 9999)
|
$datecut = intval($datecut); $datecutsel[$datecut] = "selected=\"selected\""; if($datecut > 0 && $datecut != 9999)
|
{
| {
|
$checkdate = TIME_NOW - ($datecut * 86400); $datecutsql = "AND (lastpost >= '$checkdate' OR sticky = '1')"; $datecutsql2 = "AND (t.lastpost >= '$checkdate' OR t.sticky = '1')";
| $checkdate = TIME_NOW - ($datecut * 86400); $datecutsql = "AND (lastpost >= '$checkdate' OR sticky = '1')"; $datecutsql2 = "AND (t.lastpost >= '$checkdate' OR t.sticky = '1')";
|
Zeile 393 | Zeile 419 |
---|
{ $datecutsql = ''; $datecutsql2 = '';
|
{ $datecutsql = ''; $datecutsql2 = '';
|
}
| }
|
// Pick the sort order. if(!isset($mybb->input['order']) && !empty($foruminfo['defaultsortorder'])) { $mybb->input['order'] = $foruminfo['defaultsortorder'];
|
// Pick the sort order. if(!isset($mybb->input['order']) && !empty($foruminfo['defaultsortorder'])) { $mybb->input['order'] = $foruminfo['defaultsortorder'];
|
}
$mybb->input['order'] = htmlspecialchars($mybb->input['order']);
| }
$mybb->input['order'] = htmlspecialchars($mybb->input['order']);
|
switch(my_strtolower($mybb->input['order'])) {
| switch(my_strtolower($mybb->input['order'])) {
|
Zeile 471 | Zeile 497 |
---|
// Are we viewing a specific page? if(isset($mybb->input['page']) && is_numeric($mybb->input['page']))
|
// Are we viewing a specific page? if(isset($mybb->input['page']) && is_numeric($mybb->input['page']))
|
{
| {
|
$sorturl = get_forum_link($fid, $mybb->input['page']).$string."datecut=$datecut"; } else
| $sorturl = get_forum_link($fid, $mybb->input['page']).$string."datecut=$datecut"; } else
|
Zeile 505 | Zeile 531 |
---|
if($ismod == true) { $threadcount += $forum_threads['unapprovedthreads'];
|
if($ismod == true) { $threadcount += $forum_threads['unapprovedthreads'];
|
}
| }
|
// If we have 0 threads double check there aren't any "moved" threads if($threadcount == 0) {
| // If we have 0 threads double check there aren't any "moved" threads if($threadcount == 0) {
|
Zeile 520 | Zeile 546 |
---|
if(!$mybb->settings['threadsperpage']) { $mybb->settings['threadsperpage'] = 20;
|
if(!$mybb->settings['threadsperpage']) { $mybb->settings['threadsperpage'] = 20;
|
}
| }
|
$perpage = $mybb->settings['threadsperpage'];
if(intval($mybb->input['page']) > 0)
| $perpage = $mybb->settings['threadsperpage'];
if(intval($mybb->input['page']) > 0)
|
Zeile 534 | Zeile 560 |
---|
{ $start = 0; $page = 1;
|
{ $start = 0; $page = 1;
|
} }
| } }
|
else
|
else
|
{
| {
|
$start = 0; $page = 1;
|
$start = 0; $page = 1;
|
}
| }
|
$end = $start + $perpage; $lower = $start + 1; $upper = $end;
|
$end = $start + $perpage; $lower = $start + 1; $upper = $end;
|
|
|
if($upper > $threadcount) { $upper = $threadcount;
|
if($upper > $threadcount) { $upper = $threadcount;
|
}
| }
|
// Assemble page URL if($mybb->input['sortby'] || $mybb->input['order'] || $mybb->input['datecut']) // Ugly URL { $page_url = str_replace("{fid}", $fid, FORUM_URL_PAGED); if($mybb->settings['seourls'] == "yes" || ($mybb->settings['seourls'] == "auto" && $_SERVER['SEO_SUPPORT'] == 1))
|
// Assemble page URL if($mybb->input['sortby'] || $mybb->input['order'] || $mybb->input['datecut']) // Ugly URL { $page_url = str_replace("{fid}", $fid, FORUM_URL_PAGED); if($mybb->settings['seourls'] == "yes" || ($mybb->settings['seourls'] == "auto" && $_SERVER['SEO_SUPPORT'] == 1))
|
{
| {
|
$q = "?"; $and = '';
|
$q = "?"; $and = '';
|
}
| }
|
else
|
else
|
{ $q = ''; $and = "&"; }
| { $q = ''; $and = "&"; }
|
if($sortby != "lastpost") {
| if($sortby != "lastpost") {
|
Zeile 592 | Zeile 618 |
---|
} $multipage = multipage($threadcount, $perpage, $page, $page_url);
|
} $multipage = multipage($threadcount, $perpage, $page, $page_url);
|
if($foruminfo['allowtratings'] != 0 && $fpermissions['canviewthreads'] != 0)
| if($mybb->settings['allowthreadratings'] != 0 && $foruminfo['allowtratings'] != 0 && $fpermissions['canviewthreads'] != 0)
|
{ $lang->load("ratethread");
switch($db->type)
|
{ $lang->load("ratethread");
switch($db->type)
|
{
| {
|
case "pgsql": $ratingadd = "CASE WHEN t.numratings=0 THEN 0 ELSE t.totalratings/t.numratings::numeric END AS averagerating, "; break;
| case "pgsql": $ratingadd = "CASE WHEN t.numratings=0 THEN 0 ELSE t.totalratings/t.numratings::numeric END AS averagerating, "; break;
|
Zeile 628 | Zeile 654 |
---|
}
// Get Announcements
|
}
// Get Announcements
|
$forum_stats = $cache->read("forumsdisplay");
if(!is_array($forum_stats)) { $forum_stats = $cache->read("forumdisplay", true); }
$parentlist_exp = explode(',', $parentlist); if(is_array($forum_stats) && ($forum_stats[-1]['announcements'] || array_intersect_key(array_flip($parentlist_exp), $forum_stats)))
| if($has_announcements == true)
|
{ $limit = ''; $announcements = '';
| { $limit = ''; $announcements = '';
|
Zeile 659 | Zeile 677 |
---|
$cookie = array(); if(isset($mybb->cookies['mybb']['announcements'])) {
|
$cookie = array(); if(isset($mybb->cookies['mybb']['announcements'])) {
|
$cookie = unserialize(stripslashes($mybb->cookies['mybb']['announcements']));
| $cookie = my_unserialize(stripslashes($mybb->cookies['mybb']['announcements']));
|
}
$bgcolor = alt_trow(true); // Reset the trow colors
| }
$bgcolor = alt_trow(true); // Reset the trow colors
|
Zeile 689 | Zeile 707 |
---|
$posttime = my_date($mybb->settings['timeformat'], $announcement['startdate']); $announcement['profilelink'] = build_profile_link($announcement['username'], $announcement['uid']);
|
$posttime = my_date($mybb->settings['timeformat'], $announcement['startdate']); $announcement['profilelink'] = build_profile_link($announcement['username'], $announcement['uid']);
|
if($foruminfo['allowtratings'] != 0 && $fpermissions['canviewthreads'] != 0)
| if($mybb->settings['allowthreadratings'] != 0 && $foruminfo['allowtratings'] != 0 && $fpermissions['canviewthreads'] != 0)
|
{ eval("\$rating = \"".$templates->get("forumdisplay_announcement_rating")."\";"); $lpbackground = "trow2";
| { eval("\$rating = \"".$templates->get("forumdisplay_announcement_rating")."\";"); $lpbackground = "trow2";
|
Zeile 776 | Zeile 794 |
---|
} }
|
} }
|
if($foruminfo['allowtratings'] != 0 && $mybb->user['uid'] && $tids && $ratings == true)
| if($mybb->settings['allowthreadratings'] != 0 && $foruminfo['allowtratings'] != 0 && $mybb->user['uid'] && $tids && $ratings == true)
|
{ // Check if we've rated threads on this page // Guests get the pleasure of not being ID'd, but will be checked when they try and rate
| { // Check if we've rated threads on this page // Guests get the pleasure of not being ID'd, but will be checked when they try and rate
|
Zeile 792 | Zeile 810 |
---|
else { $threadcache = $tids = null;
|
else { $threadcache = $tids = null;
|
}
| }
|
// If user has moderation tools available, prepare the Select All feature $num_results = $db->num_rows($query);
| // If user has moderation tools available, prepare the Select All feature $num_results = $db->num_rows($query);
|
Zeile 878 | Zeile 896 |
---|
if($thread['visible'] == 0) { $bgcolor = "trow_shaded";
|
if($thread['visible'] == 0) { $bgcolor = "trow_shaded";
|
} else {
| } else {
|
$bgcolor = alt_trow(); }
| $bgcolor = alt_trow(); }
|
Zeile 932 | Zeile 950 |
---|
if($thread['poll']) { $prefix = $lang->poll_prefix;
|
if($thread['poll']) { $prefix = $lang->poll_prefix;
|
}
| }
|
if($thread['sticky'] == "1" && !$donestickysep) {
| if($thread['sticky'] == "1" && !$donestickysep) {
|
Zeile 947 | Zeile 965 |
---|
}
$rating = '';
|
}
$rating = '';
|
if($foruminfo['allowtratings'] != 0)
| if($mybb->settings['allowthreadratings'] != 0 && $foruminfo['allowtratings'] != 0)
|
{ if($moved[0] == "moved")
|
{ if($moved[0] == "moved")
|
{
| {
|
$rating = "<td class=\"{$bgcolor}\" style=\"text-align: center;\">-</td>";
|
$rating = "<td class=\"{$bgcolor}\" style=\"text-align: center;\">-</td>";
|
}
| }
|
else { $thread['averagerating'] = floatval(round($thread['averagerating'], 2)); $thread['width'] = intval(round($thread['averagerating']))*20; $thread['numratings'] = intval($thread['numratings']);
|
else { $thread['averagerating'] = floatval(round($thread['averagerating'], 2)); $thread['width'] = intval(round($thread['averagerating']))*20; $thread['numratings'] = intval($thread['numratings']);
|
|
|
$not_rated = ''; if(!$thread['rated']) {
| $not_rated = ''; if(!$thread['rated']) {
|
Zeile 967 | Zeile 985 |
---|
$ratingvotesav = $lang->sprintf($lang->rating_votes_average, $thread['numratings'], $thread['averagerating']); eval("\$rating = \"".$templates->get("forumdisplay_thread_rating")."\";");
|
$ratingvotesav = $lang->sprintf($lang->rating_votes_average, $thread['numratings'], $thread['averagerating']); eval("\$rating = \"".$templates->get("forumdisplay_thread_rating")."\";");
|
} }
| } }
|
$thread['pages'] = 0; $thread['multipage'] = ''; $threadpages = ''; $morelink = ''; $thread['posts'] = $thread['replies'] + 1;
|
$thread['pages'] = 0; $thread['multipage'] = ''; $threadpages = ''; $morelink = ''; $thread['posts'] = $thread['replies'] + 1;
|
|
|
if(!$mybb->settings['postsperpage'])
|
if(!$mybb->settings['postsperpage'])
|
{
| {
|
$mybb->settings['postperpage'] = 20;
|
$mybb->settings['postperpage'] = 20;
|
}
| }
|
if($thread['unapprovedposts'] > 0 && $ismod) { $thread['posts'] += $thread['unapprovedposts'];
|
if($thread['unapprovedposts'] > 0 && $ismod) { $thread['posts'] += $thread['unapprovedposts'];
|
}
| }
|
if($thread['posts'] > $mybb->settings['postsperpage']) { $thread['pages'] = $thread['posts'] / $mybb->settings['postsperpage'];
| if($thread['posts'] > $mybb->settings['postsperpage']) { $thread['pages'] = $thread['posts'] / $mybb->settings['postsperpage'];
|
Zeile 1000 | Zeile 1018 |
---|
else { $pagesstop = $thread['pages'];
|
else { $pagesstop = $thread['pages'];
|
}
| }
|
for($i = 1; $i <= $pagesstop; ++$i) { $page_link = get_thread_link($thread['tid'], $i);
| for($i = 1; $i <= $pagesstop; ++$i) { $page_link = get_thread_link($thread['tid'], $i);
|
Zeile 1035 | Zeile 1053 |
---|
else { $modbit = '';
|
else { $modbit = '';
|
}
| }
|
if($moved[0] == "moved") { $prefix = $lang->moved_prefix;
| if($moved[0] == "moved") { $prefix = $lang->moved_prefix;
|
Zeile 1047 | Zeile 1065 |
---|
$thread['threadlink'] = get_thread_link($thread['tid']); $thread['lastpostlink'] = get_thread_link($thread['tid'], 0, "lastpost");
|
$thread['threadlink'] = get_thread_link($thread['tid']); $thread['lastpostlink'] = get_thread_link($thread['tid'], 0, "lastpost");
|
|
|
// Determine the folder $folder = ''; $folder_label = '';
if($thread['doticon'])
|
// Determine the folder $folder = ''; $folder_label = '';
if($thread['doticon'])
|
{
| {
|
$folder = "dot_"; $folder_label .= $lang->icon_dot;
|
$folder = "dot_"; $folder_label .= $lang->icon_dot;
|
}
| }
|
$gotounread = ''; $isnew = 0;
| $gotounread = ''; $isnew = 0;
|
Zeile 1071 | Zeile 1089 |
---|
else { $last_read = $read_cutoff;
|
else { $last_read = $read_cutoff;
|
} }
| } }
|
else { $last_read = my_get_array_cookie("threadread", $thread['tid']);
| else { $last_read = my_get_array_cookie("threadread", $thread['tid']);
|
Zeile 1124 | Zeile 1142 |
---|
if(($thread['uid'] == $mybb->user['uid'] && $thread['closed'] != 1 && $mybb->user['uid'] != 0 && $can_edit_titles == 1) || $ismod == true) { $inline_edit_class = "subject_editable";
|
if(($thread['uid'] == $mybb->user['uid'] && $thread['closed'] != 1 && $mybb->user['uid'] != 0 && $can_edit_titles == 1) || $ismod == true) { $inline_edit_class = "subject_editable";
|
} else
| } else
|
{ $inline_edit_class = ""; }
| { $inline_edit_class = ""; }
|
Zeile 1140 | Zeile 1158 |
---|
if($lastposteruid == 0) { $lastposterlink = $lastposter;
|
if($lastposteruid == 0) { $lastposterlink = $lastposter;
|
} else {
| } else {
|
$lastposterlink = build_profile_link($lastposter, $lastposteruid); }
|
$lastposterlink = build_profile_link($lastposter, $lastposteruid); }
|
|
|
$thread['replies'] = my_number_format($thread['replies']); $thread['views'] = my_number_format($thread['views']);
| $thread['replies'] = my_number_format($thread['replies']); $thread['views'] = my_number_format($thread['views']);
|
Zeile 1153 | Zeile 1171 |
---|
if($thread['unapprovedposts'] > 0 && $ismod) { if($thread['unapprovedposts'] > 1)
|
if($thread['unapprovedposts'] > 0 && $ismod) { if($thread['unapprovedposts'] > 1)
|
{
| {
|
$unapproved_posts_count = $lang->sprintf($lang->thread_unapproved_posts_count, $thread['unapprovedposts']); } else { $unapproved_posts_count = $lang->sprintf($lang->thread_unapproved_post_count, 1);
|
$unapproved_posts_count = $lang->sprintf($lang->thread_unapproved_posts_count, $thread['unapprovedposts']); } else { $unapproved_posts_count = $lang->sprintf($lang->thread_unapproved_post_count, 1);
|
}
| }
|
$unapproved_posts = " <span title=\"{$unapproved_posts_count}\">(".my_number_format($thread['unapprovedposts']).")</span>"; }
| $unapproved_posts = " <span title=\"{$unapproved_posts_count}\">(".my_number_format($thread['unapprovedposts']).")</span>"; }
|
Zeile 1193 | Zeile 1211 |
---|
$customthreadtools = ''; if($ismod) {
|
$customthreadtools = ''; if($ismod) {
|
if($forum_stats[-1]['modtools'] || $forum_stats[$fid]['modtools'])
| if(is_moderator($fid, "canusecustomtools") && $has_modtools == true)
|
{ switch($db->type) {
| { switch($db->type) {
|
Zeile 1208 | Zeile 1226 |
---|
while($tool = $db->fetch_array($query)) { eval("\$customthreadtools .= \"".$templates->get("forumdisplay_inlinemoderation_custom_tool")."\";");
|
while($tool = $db->fetch_array($query)) { eval("\$customthreadtools .= \"".$templates->get("forumdisplay_inlinemoderation_custom_tool")."\";");
|
| } if($customthreadtools) { eval("\$customthreadtools = \"".$templates->get("forumdisplay_inlinemoderation_custom")."\";");
|
} }
|
} }
|
else { eval("\$customthreadtools = \"".$templates->get("forumdisplay_inlinemoderation_custom")."\";"); }
|
|
eval("\$inlinemod = \"".$templates->get("forumdisplay_inlinemoderation")."\";"); } }
| eval("\$inlinemod = \"".$templates->get("forumdisplay_inlinemoderation")."\";"); } }
|