<?php

##############################################################
### vB Easy Archive Final - Released on January 16th, 2003 ###
## Scripts created by Xenon and modified/released by SkuZZy ##
### Copyright info MUST stay on the bottom of all scripts ####
#### Visit http://www.vbulletin.org for updated versions! ####
##############################################################

error_reporting(7);

require('config.php');
$temp=strrpos($scriptpath,"/");
$forumid=intval(substr($scriptpath,$temp+1));
$pagenumber=intval(substr($scriptpath,strrpos($scriptpath,"-")+1));
if ($pagenumber==0) $pagenumber=1;

$foruminfo = verifyid('forum',$forumid,1,1);

$getperms=getpermissions($forumid,-1,-1,$foruminfo['parentlist']);
if (!$getperms[canview]) {
  show_nopermission();
}

updateuserforum($forumid);

$forumdisplay['threadslist'] = "";
/////////////////////////////////
if ($foruminfo['cancontainthreads']==1) {
/////////////////////////////////
$threadcount=$DB_site->query_first("SELECT COUNT(*) as threads FROM thread WHERE forumid='$forumid' AND visible=1");
echo "<html><body><head><title>$title</title></head><base href=\"$archiveurl/\">";

include "$archiveurl/header.php";


echo "Pages:";
$pagelink = "";
for($i = 1; $i <= intval($threadcount[threads] / 200) + 1; $i++) {
  $pagelink .= "<a href=$archiveurl/forum/" . $forumid . "-" . $i . ".html>$i</a> ";
}
echo $pagelink;


$getthreadids=$DB_site->query("
	SELECT
		thread.threadid,thread.title
	FROM thread
	WHERE thread.forumid = $forumid
		AND thread.visible=1
  	ORDER BY sticky DESC, lastpost DESC
    LIMIT ".(($pagenumber-1)*200).",200    ");


echo "<ul>";
while ($thread=$DB_site->fetch_array($getthreadids)) {
  echo "<li><a href=$archiveurl/topic/$thread[threadid]-1.html>$thread[title]</a>";
}
echo "</ul>";
if ($stickyids != '') {
	$threadids .= $stickyids;
}
/////////////////////////////////
}
/////////////////////////////////

echo '<b>vB Easy Archive Final</b> - Created by <a href="http://www.strategy-forum.de/">Xenon</a> and modified/released by SkuZZy from the <a href="http://www.scriptz.com/">Web Scripts Directory</a><br></font></center></body></html>';

?>