Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* $Id: forumdisplay.php 4020 2008-07-15 22:03:34Z Tikitiki $
| * $Id: forumdisplay.php 5379 2011-02-21 11:06:42Z Tomm $
|
*/
define("IN_MYBB", 1);
|
*/
define("IN_MYBB", 1);
|
| define('THIS_SCRIPT', 'forumdisplay.php');
|
$templatelist = "forumdisplay,forumdisplay_thread,breadcrumb_bit,forumbit_depth1_cat,forumbit_depth1_forum,forumbit_depth2_cat,forumbit_depth2_forum,forumdisplay_subforums,forumdisplay_threadlist,forumdisplay_moderatedby_moderator,forumdisplay_moderatedby,forumdisplay_newthread,forumdisplay_searchforum,forumdisplay_orderarrow,forumdisplay_thread_rating,forumdisplay_announcement,forumdisplay_threadlist_rating,forumdisplay_threadlist_sortrating,forumdisplay_subforums_modcolumn,forumbit_moderators,forumbit_subforums,forumbit_depth2_forum_lastpost"; $templatelist .= ",forumbit_depth1_forum_lastpost,forumdisplay_thread_multipage_page,forumdisplay_thread_multipage,forumdisplay_thread_multipage_more";
| $templatelist = "forumdisplay,forumdisplay_thread,breadcrumb_bit,forumbit_depth1_cat,forumbit_depth1_forum,forumbit_depth2_cat,forumbit_depth2_forum,forumdisplay_subforums,forumdisplay_threadlist,forumdisplay_moderatedby_moderator,forumdisplay_moderatedby,forumdisplay_newthread,forumdisplay_searchforum,forumdisplay_orderarrow,forumdisplay_thread_rating,forumdisplay_announcement,forumdisplay_threadlist_rating,forumdisplay_threadlist_sortrating,forumdisplay_subforums_modcolumn,forumbit_moderators,forumbit_subforums,forumbit_depth2_forum_lastpost"; $templatelist .= ",forumbit_depth1_forum_lastpost,forumdisplay_thread_multipage_page,forumdisplay_thread_multipage,forumdisplay_thread_multipage_more";
|
Zeile 68 | Zeile 69 |
---|
$currentitem = $fid; build_forum_breadcrumb($fid); $parentlist = $foruminfo['parentlist'];
|
$currentitem = $fid; build_forum_breadcrumb($fid); $parentlist = $foruminfo['parentlist'];
|
| // To validate, turn & to & but keep unicode support $foruminfo['name'] = preg_replace("#&(?!\#[0-9]+;)#si", "&", $foruminfo['name']);
|
$forumpermissions = forum_permissions(); $fpermissions = $forumpermissions[$fid];
|
$forumpermissions = forum_permissions(); $fpermissions = $forumpermissions[$fid];
|
|
|
if($fpermissions['canview'] != 1)
|
if($fpermissions['canview'] != 1)
|
{
| {
|
error_no_permission(); }
|
error_no_permission(); }
|
// Build a forum cache. $query = $db->query(" SELECT f.*, fr.dateline AS lastread FROM ".TABLE_PREFIX."forums f LEFT JOIN ".TABLE_PREFIX."forumsread fr ON (fr.fid=f.fid AND fr.uid='{$mybb->user['uid']}') WHERE f.active != 0 ORDER BY pid, disporder ");
| if($mybb->user['uid'] == 0) { // Build a forum cache. $query = $db->query(" SELECT * FROM ".TABLE_PREFIX."forums WHERE active != 0 ORDER BY pid, disporder "); $forumsread = unserialize($mybb->cookies['mybb']['forumread']);
if(!is_array($forumsread)) { $forumsread = array(); } } else { // Build a forum cache. $query = $db->query(" SELECT f.*, fr.dateline AS lastread FROM ".TABLE_PREFIX."forums f LEFT JOIN ".TABLE_PREFIX."forumsread fr ON (fr.fid=f.fid AND fr.uid='{$mybb->user['uid']}') WHERE f.active != 0 ORDER BY pid, disporder "); }
|
while($forum = $db->fetch_array($query)) {
|
while($forum = $db->fetch_array($query)) {
|
| if($mybb->user['uid'] == 0) { if($forumsread[$forum['fid']]) { $forum['lastread'] = $forumsread[$forum['fid']]; } }
|
$fcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum; }
| $fcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum; }
|
Zeile 136 | Zeile 167 |
---|
}
if($fpermissions['cansearch'] != 0 && $foruminfo['type'] == "f")
|
}
if($fpermissions['cansearch'] != 0 && $foruminfo['type'] == "f")
|
{
| {
|
eval("\$searchforum = \"".$templates->get("forumdisplay_searchforum")."\";"); }
| eval("\$searchforum = \"".$templates->get("forumdisplay_searchforum")."\";"); }
|
Zeile 167 | Zeile 198 |
---|
}
if($modlist)
|
}
if($modlist)
|
{
| {
|
eval("\$moderatedby = \"".$templates->get("forumdisplay_moderatedby")."\";"); }
| eval("\$moderatedby = \"".$templates->get("forumdisplay_moderatedby")."\";"); }
|
Zeile 197 | Zeile 228 |
---|
else { if($doneusers[$user['uid']] < $user['time'] || !$doneusers[$user['uid']])
|
else { if($doneusers[$user['uid']] < $user['time'] || !$doneusers[$user['uid']])
|
{
| {
|
$doneusers[$user['uid']] = $user['time']; ++$membercount; if($user['invisible'] == 1)
| $doneusers[$user['uid']] = $user['time']; ++$membercount; if($user['invisible'] == 1)
|
Zeile 237 | Zeile 268 |
---|
$invisonline = $lang->sprintf($lang->users_browsing_forum_invis, $inviscount); }
|
$invisonline = $lang->sprintf($lang->users_browsing_forum_invis, $inviscount); }
|
if($invisonline != '' && $guestcount)
| if($invisonline != '' && ($guestcount || $onlinemembers))
|
{ $onlinesep2 = ", "; }
| { $onlinesep2 = ", "; }
|
Zeile 259 | Zeile 290 |
---|
"allow_smilies" => 1, "allow_imgcode" => 1 );
|
"allow_smilies" => 1, "allow_imgcode" => 1 );
|
|
|
$foruminfo['rules'] = $parser->parse_message($foruminfo['rules'], $rules_parser); if($foruminfo['rulestype'] == 1) {
| $foruminfo['rules'] = $parser->parse_message($foruminfo['rules'], $rules_parser); if($foruminfo['rulestype'] == 1) {
|
Zeile 320 | Zeile 351 |
---|
if(!empty($foruminfo['defaultdatecut'])) { $datecut = $foruminfo['defaultdatecut'];
|
if(!empty($foruminfo['defaultdatecut'])) { $datecut = $foruminfo['defaultdatecut'];
|
}
| }
|
} } // If there was a manual date cut override, use it.
| } } // If there was a manual date cut override, use it.
|
Zeile 347 | Zeile 378 |
---|
if(!isset($mybb->input['order']) && !empty($foruminfo['defaultsortorder'])) { $mybb->input['order'] = $foruminfo['defaultsortorder'];
|
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']);
|
Zeile 371 | Zeile 402 |
---|
if(!isset($mybb->input['sortby']) && !empty($foruminfo['defaultsortby'])) { $mybb->input['sortby'] = $foruminfo['defaultsortby'];
|
if(!isset($mybb->input['sortby']) && !empty($foruminfo['defaultsortby'])) { $mybb->input['sortby'] = $foruminfo['defaultsortby'];
|
}
$t = "t.";
| }
$t = "t.";
|
$sortby = htmlspecialchars($mybb->input['sortby']); switch($mybb->input['sortby'])
| $sortby = htmlspecialchars($mybb->input['sortby']); switch($mybb->input['sortby'])
|
Zeile 413 | Zeile 444 |
---|
$sorturl = "forumdisplay.php?fid=$fid&datecut=$datecut&page=".$mybb->input['page']; } else
|
$sorturl = "forumdisplay.php?fid=$fid&datecut=$datecut&page=".$mybb->input['page']; } else
|
{
| {
|
$sorturl = "forumdisplay.php?fid=$fid&datecut=$datecut"; } eval("\$orderarrow['$sortby'] = \"".$templates->get("forumdisplay_orderarrow")."\";");
|
$sorturl = "forumdisplay.php?fid=$fid&datecut=$datecut"; } eval("\$orderarrow['$sortby'] = \"".$templates->get("forumdisplay_orderarrow")."\";");
|
// How many posts are there? if($datecut > 0)
| $threadcount = 0;
if($fpermissions['canviewthreads'] != 0)
|
{
|
{
|
$query = $db->simple_select("threads", "COUNT(tid) AS threads", "fid = '$fid' $visibleonly $datecutsql"); $threadcount = $db->fetch_field($query, "threads"); } else { $query = $db->simple_select("forums", "threads, unapprovedthreads", "fid = '{$fid}'", array('limit' => 1)); $forum_threads = $db->fetch_array($query); $threadcount = $forum_threads['threads']; if($ismod == true) { $threadcount += $forum_threads['unapprovedthreads'];
| // How many posts are there? if($datecut > 0) { $query = $db->simple_select("threads", "COUNT(tid) AS threads", "fid = '$fid' $visibleonly $datecutsql"); $threadcount = $db->fetch_field($query, "threads");
|
}
|
}
|
// If we have 0 threads double check there aren't any "moved" threads if($threadcount == 0)
| else
|
{
|
{
|
$query = $db->simple_select("threads", "COUNT(tid) AS threads", "fid = '$fid' $visibleonly", array('limit' => 1)); $threadcount = $db->fetch_field($query, "threads");
| $query = $db->simple_select("forums", "threads, unapprovedthreads", "fid = '{$fid}'", array('limit' => 1)); $forum_threads = $db->fetch_array($query); $threadcount = $forum_threads['threads']; if($ismod == true) { $threadcount += $forum_threads['unapprovedthreads']; } // If we have 0 threads double check there aren't any "moved" threads if($threadcount == 0) { $query = $db->simple_select("threads", "COUNT(tid) AS threads", "fid = '$fid' $visibleonly", array('limit' => 1)); $threadcount = $db->fetch_field($query, "threads"); }
|
} }
| } }
|
Zeile 518 | Zeile 554 |
---|
} $multipage = multipage($threadcount, $perpage, $page, $page_url);
|
} $multipage = multipage($threadcount, $perpage, $page, $page_url);
|
if($foruminfo['allowtratings'] != 0)
| if($foruminfo['allowtratings'] != 0 && $fpermissions['canviewthreads'] != 0)
|
{ $lang->load("ratethread"); switch($db->type) { case "pgsql":
|
{ $lang->load("ratethread"); switch($db->type) { case "pgsql":
|
$ratingadd = ''; $query = $db->query(" SELECT t.numratings, t.totalratings, t.tid FROM ".TABLE_PREFIX."threads t WHERE t.fid='$fid' $tvisibleonly $datecutsql2 ORDER BY t.sticky DESC, t.$sortfield $sortordernow $sortfield2 LIMIT $start, $perpage "); while($thread = $db->fetch_array($query)) { if($thread['totalratings'] == 0) { $rating = 0; } else { $rating = $thread['totalratings'] / $thread['numratings']; }
$avaragerating[$thread['tid']] = $rating; }
| $ratingadd = "CASE WHEN t.numratings=0 THEN 0 ELSE t.totalratings/t.numratings::numeric END AS averagerating, ";
|
break; default: $ratingadd = "(t.totalratings/t.numratings) AS averagerating, ";
| break; default: $ratingadd = "(t.totalratings/t.numratings) AS averagerating, ";
|
Zeile 557 | Zeile 573 |
---|
$select_rating_user = "r.uid AS rated, "; } else
|
$select_rating_user = "r.uid AS rated, "; } else
|
{
| { if($sortfield == "averagerating") { $t = "t."; $sortfield = "lastpost"; }
|
$ratingadd = ''; $lpbackground = "trow1"; $colspan = "6";
| $ratingadd = ''; $lpbackground = "trow1"; $colspan = "6";
|
Zeile 566 | Zeile 587 |
---|
if($ismod) { ++$colspan;
|
if($ismod) { ++$colspan;
|
}
| }
|
// Get Announcements $limit = ''; $announcements = ''; if($mybb->settings['announcementlimit'])
|
// Get Announcements $limit = ''; $announcements = ''; if($mybb->settings['announcementlimit'])
|
{
| {
|
$limit = "LIMIT 0, ".$mybb->settings['announcementlimit']; }
| $limit = "LIMIT 0, ".$mybb->settings['announcementlimit']; }
|
Zeile 585 | Zeile 606 |
---|
WHERE a.startdate<='$time' AND (a.enddate>='$time' OR a.enddate='0') AND ($sql OR fid='-1') ORDER BY a.startdate DESC $limit ");
|
WHERE a.startdate<='$time' AND (a.enddate>='$time' OR a.enddate='0') AND ($sql OR fid='-1') ORDER BY a.startdate DESC $limit ");
|
| $bgcolor = alt_trow(true); // Reset the trow colours
|
while($announcement = $db->fetch_array($query)) { if($announcement['startdate'] > $mybb->user['lastvisit']) { $new_class = ' class="subject_new"'; $folder = "newfolder";
|
while($announcement = $db->fetch_array($query)) { if($announcement['startdate'] > $mybb->user['lastvisit']) { $new_class = ' class="subject_new"'; $folder = "newfolder";
|
}
| }
|
else { $new_class = '';
| else { $new_class = '';
|
Zeile 605 | Zeile 627 |
---|
$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)
| if($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 623 | Zeile 645 |
---|
else { $modann = '';
|
else { $modann = '';
|
}
| }
|
$plugins->run_hooks("forumdisplay_announcement"); eval("\$announcements .= \"".$templates->get("forumdisplay_announcements_announcement")."\";"); $bgcolor = alt_trow();
|
$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;
|
if($announcements) { eval("\$announcementlist = \"".$templates->get("forumdisplay_announcements")."\";"); $shownormalsep = true;
|
}
$icon_cache = $cache->read("posticons");
// Start Getting Threads $query = $db->query(" SELECT t.*, {$ratingadd}{$select_rating_user}t.username AS threadusername, u.username FROM ".TABLE_PREFIX."threads t LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid){$select_voting} WHERE t.fid='$fid' $tvisibleonly $datecutsql2 ORDER BY t.sticky DESC, {$t}{$sortfield} $sortordernow $sortfield2 LIMIT $start, $perpage "); while($thread = $db->fetch_array($query)) { if($db->type == "pgsql") { $thread['averagerating'] = $averagerating[$thread['tid']]; }
$threadcache[$thread['tid']] = $thread;
// If this is a moved thread - set the tid for participation marking and thread read marking to that of the moved thread if(substr($thread['closed'], 0, 5) == "moved") { $tid = substr($thread['closed'], 6); if(!$tids[$tid]) { $moved_threads[$tid] = $thread['tid']; $tids[$thread['tid']] = $tid; } } // Otherwise - set it to the plain thread ID else { $tids[$thread['tid']] = $thread['tid']; if($moved_threads[$tid]) { unset($moved_threads[$tid]); } } }
| }
$icon_cache = $cache->read("posticons");
if($fpermissions['canviewthreads'] != 0) { // Start Getting Threads $query = $db->query(" SELECT t.*, {$ratingadd}{$select_rating_user}t.username AS threadusername, u.username FROM ".TABLE_PREFIX."threads t LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid){$select_voting} WHERE t.fid='$fid' $tvisibleonly $datecutsql2 ORDER BY t.sticky DESC, {$t}{$sortfield} $sortordernow $sortfield2 LIMIT $start, $perpage "); while($thread = $db->fetch_array($query)) { $threadcache[$thread['tid']] = $thread;
// If this is a moved thread - set the tid for participation marking and thread read marking to that of the moved thread if(substr($thread['closed'], 0, 5) == "moved") { $tid = substr($thread['closed'], 6); if(!$tids[$tid]) { $moved_threads[$tid] = $thread['tid']; $tids[$thread['tid']] = $tid; } } // Otherwise - set it to the plain thread ID else { $tids[$thread['tid']] = $thread['tid']; if($moved_threads[$tid]) { unset($moved_threads[$tid]); } } } } else { $tids = $threadcache = null; }
|
if($tids) {
| if($tids) {
|
Zeile 736 | Zeile 760 |
---|
$threads = ''; $load_inline_edit_js = 0; if(is_array($threadcache))
|
$threads = ''; $load_inline_edit_js = 0; if(is_array($threadcache))
|
{
| {
|
foreach($threadcache as $thread) { $plugins->run_hooks("forumdisplay_thread");
| foreach($threadcache as $thread) { $plugins->run_hooks("forumdisplay_thread");
|
Zeile 806 | Zeile 830 |
---|
} else {
|
} else {
|
$thread['averagerating'] = intval(round($thread['averagerating'], 2)); $thread['width'] = $thread['averagerating']*20;
| $thread['averagerating'] = floatval(round($thread['averagerating'], 2)); $thread['width'] = intval(round($thread['averagerating']))*20;
|
$thread['numratings'] = intval($thread['numratings']);
$not_rated = '';
| $thread['numratings'] = intval($thread['numratings']);
$not_rated = '';
|
Zeile 815 | Zeile 839 |
---|
{ $not_rated = ' star_rating_notrated'; }
|
{ $not_rated = ' star_rating_notrated'; }
|
|
|
$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")."\";"); }
|
Zeile 830 | Zeile 854 |
---|
if(!$mybb->settings['postsperpage']) { $mybb->settings['postperpage'] = 20;
|
if(!$mybb->settings['postsperpage']) { $mybb->settings['postperpage'] = 20;
|
}
| }
|
if($thread['unapprovedposts'] > 0 && $ismod) {
| if($thread['unapprovedposts'] > 0 && $ismod) {
|
Zeile 860 | Zeile 884 |
---|
}
eval("\$thread['multipage'] = \"".$templates->get("forumdisplay_thread_multipage")."\";");
|
}
eval("\$thread['multipage'] = \"".$templates->get("forumdisplay_thread_multipage")."\";");
|
}
| }
|
else { $threadpages = '';
| else { $threadpages = '';
|
Zeile 1105 | Zeile 1129 |
---|
if($load_inline_edit_js == 1) { eval("\$inline_edit_js = \"".$templates->get("forumdisplay_threadlist_inlineedit_js")."\";");
|
if($load_inline_edit_js == 1) { eval("\$inline_edit_js = \"".$templates->get("forumdisplay_threadlist_inlineedit_js")."\";");
|
| }
$post_code_string = ''; if($mybb->user['uid']) { $post_code_string = "&my_post_key=".$mybb->post_code;
|
}
$lang->rss_discovery_forum = $lang->sprintf($lang->rss_discovery_forum, htmlspecialchars_uni(strip_tags($foruminfo['name'])));
| }
$lang->rss_discovery_forum = $lang->sprintf($lang->rss_discovery_forum, htmlspecialchars_uni(strip_tags($foruminfo['name'])));
|