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 4276 2008-11-23 03:01:33Z Tikitiki $
| * $Id: forumdisplay.php 5379 2011-02-21 11:06:42Z Tomm $
|
*/
define("IN_MYBB", 1);
| */
define("IN_MYBB", 1);
|
Zeile 69 | 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) { error_no_permission(); }
if($mybb->user['uid'] == 0)
|
if($fpermissions['canview'] != 1) { error_no_permission(); }
if($mybb->user['uid'] == 0)
|
{
| {
|
// Build a forum cache. $query = $db->query(" SELECT *
| // Build a forum cache. $query = $db->query(" SELECT *
|
Zeile 89 | Zeile 92 |
---|
"); $forumsread = unserialize($mybb->cookies['mybb']['forumread']);
|
"); $forumsread = unserialize($mybb->cookies['mybb']['forumread']);
|
| if(!is_array($forumsread)) { $forumsread = array(); }
|
} else {
| } else {
|
Zeile 115 | Zeile 123 |
---|
// 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)
|
{
| {
|
$moderatorcache = $cache->read("moderators"); }
| $moderatorcache = $cache->read("moderators"); }
|
Zeile 142 | Zeile 150 |
---|
check_forum_password($foruminfo['fid']);
if($foruminfo['linkto'])
|
check_forum_password($foruminfo['fid']);
if($foruminfo['linkto'])
|
{
| {
|
header("Location: {$foruminfo['linkto']}"); exit; }
| header("Location: {$foruminfo['linkto']}"); exit; }
|
Zeile 359 | Zeile 367 |
---|
$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')";
|
} else {
| } else {
|
$datecutsql = ''; $datecutsql2 = ''; }
| $datecutsql = ''; $datecutsql2 = ''; }
|
Zeile 370 | 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']);
switch(my_strtolower($mybb->input['order']))
| $mybb->input['order'] = htmlspecialchars($mybb->input['order']);
switch(my_strtolower($mybb->input['order']))
|
Zeile 387 | Zeile 395 |
---|
$ordersel['desc'] = "selected=\"selected\""; $oppsort = $lang->asc; $oppsortnext = "asc";
|
$ordersel['desc'] = "selected=\"selected\""; $oppsort = $lang->asc; $oppsortnext = "asc";
|
break; }
| break; }
|
// Sort by which field? if(!isset($mybb->input['sortby']) && !empty($foruminfo['defaultsortby'])) {
| // Sort by which field? if(!isset($mybb->input['sortby']) && !empty($foruminfo['defaultsortby'])) {
|
Zeile 437 | Zeile 445 |
---|
} else {
|
} else {
|
$sorturl = "forumdisplay.php?fid=$fid&datecut=$datecut"; } eval("\$orderarrow['$sortby'] = \"".$templates->get("forumdisplay_orderarrow")."\";");
// 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"); } 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'];
| $sorturl = "forumdisplay.php?fid=$fid&datecut=$datecut"; } eval("\$orderarrow['$sortby'] = \"".$templates->get("forumdisplay_orderarrow")."\";");
$threadcount = 0;
if($fpermissions['canviewthreads'] != 0) { // 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 474 | Zeile 487 |
---|
$perpage = $mybb->settings['threadsperpage'];
if(intval($mybb->input['page']) > 0)
|
$perpage = $mybb->settings['threadsperpage'];
if(intval($mybb->input['page']) > 0)
|
{
| {
|
$page = intval($mybb->input['page']); $start = ($page-1) * $perpage; $pages = $threadcount / $perpage;
| $page = intval($mybb->input['page']); $start = ($page-1) * $perpage; $pages = $threadcount / $perpage;
|
Zeile 483 | Zeile 496 |
---|
{ $start = 0; $page = 1;
|
{ $start = 0; $page = 1;
|
}
| }
|
} else {
| } else {
|
Zeile 519 | Zeile 532 |
---|
if($sortby != "lastpost") { $page_url .= "{$q}{$and}sortby={$sortby}";
|
if($sortby != "lastpost") { $page_url .= "{$q}{$and}sortby={$sortby}";
|
$q = ''; $and = "&"; }
| $q = ''; $and = "&"; }
|
if($sortordernow != "desc") { $page_url .= "{$q}{$and}order={$sortordernow}";
| if($sortordernow != "desc") { $page_url .= "{$q}{$and}order={$sortordernow}";
|
Zeile 541 | 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; } $t = "t."; $sortfield = "lastpost";
| $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 615 | 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'])
| while($announcement = $db->fetch_array($query)) { if($announcement['startdate'] > $mybb->user['lastvisit'])
|
Zeile 635 | 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 668 | Zeile 660 |
---|
$icon_cache = $cache->read("posticons");
|
$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($fpermissions['canviewthreads'] != 0)
|
{
|
{
|
if($db->type == "pgsql")
| // 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))
|
{
|
{
|
$thread['averagerating'] = $averagerating[$thread['tid']]; }
| $threadcache[$thread['tid']] = $thread;
|
|
|
$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])
| // 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")
|
{
|
{
|
$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]);
| $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 837 | Zeile 831 |
---|
else { $thread['averagerating'] = floatval(round($thread['averagerating'], 2));
|
else { $thread['averagerating'] = floatval(round($thread['averagerating'], 2));
|
$thread['width'] = intval($thread['averagerating'])*20;
| $thread['width'] = intval(round($thread['averagerating']))*20;
|
$thread['numratings'] = intval($thread['numratings']);
$not_rated = '';
| $thread['numratings'] = intval($thread['numratings']);
$not_rated = '';
|