<?php
include("_confirm.php");
global $id, $locked, $userInfo, $p, $maxPerPage, $offset, $oldcount;
//echo $oldcount;
if ($locked && @$userInfo['title'] != "Administrator") {
 echo "<b>This forum is locked.</b>";
}
else {
 echo "<br><br><div class='viewforumend_btt_outer'><a href=\"newthread.php?id={$id}\"><img src=\"templates/{$pageInfo['theme']}/images/newthread.gif\" border=\"0\"></a></div>";
}
?>

<div class="clearfix"></div>
<div class="pagenation">
<div class="pagenation_inner">
<?php

$pagecount = ceil($oldcount / $maxPerPage);

echo "<span class='page'>Page:</span>";
if ($p > 1) {
 $prev = $p - 1;
 echo "<span class='previous'><a href=\"?id={$id}&p={$prev}\">Previous</a></span>&nbsp;\n";
}
for ($i=0; $i<$pagecount; $i++) {
 if (($i+1) == $p) {
  echo "<b>{$p}</b>&nbsp;\n";
 }
 else {
  echo "<a href=\"?id={$id}&p=" . ($i+1) . "\">" . ($i+1) . "</a>&nbsp;\n";
 }
}
if ($p < $pagecount) {
 $prev = $p + 1;
 echo "<span class='next'><a href=\"?id={$id}&p={$prev}\">Next</a></span>\n";
}
?>
</div>
</div>
<div class="clearfix"></div>

 
<table cellspacing="0" cellpadding="0" class="forums forums_new" align="center">
 <tr>
  <th width="6%" class="alt5">&nbsp;</th>
  <th width="37%" class="alt5">Thread</th>
  <th width="37%" class="alt5" align="center">Last Reply</th>
  <th width="10%" class="alt5" align="center">Replys</th>
  <th width="10%" class="alt5" align="center">Views</th>
<?php
if ($userInfo['loggedin'] && ($userInfo['title'] == "Moderator" || $userInfo['title'] == "Administrator")) {
?>
  <th align="center" class="alt5">Sticky</thth>
  <th align="center" class="alt5">Delete</th>
<?php } ?>
 </tr>