type=="postgresql"){
$limit="";
$q->query($DB, "set QUERY_LIMIT TO 1");
}
else{
$limit=" limit 1";
}
switch($action){
case 2:
$cutoff_thread=$thread-$cutoff;
$sSQL="Select thread, id from $TableName where thread<$thread and thread>$cutoff_thread and id=thread order by thread desc".$limit;
break;
case 1:
$cutoff_thread=$thread+$cutoff;
$sSQL="Select thread, id from $TableName where thread<$cutoff_thread and thread>$thread and id=thread order by thread asc".$limit;
break;
}
$msg = new query($DB, $sSQL);
if($DB->type=="postgresql"){
$q->query($DB, "set QUERY_LIMIT TO '0'");
}
if($msg->numrows()==0){
Header("Location: $list_page.$ext?num=$num$GetVars");
exit;
}
$id = $msg->field("id", 0);
$thread = $msg->field("thread", 0);
}
$sSQL = "Select * from $TableName where thread=$thread order by id";
$msg_list = new query($DB, $sSQL);
$sSQL = "Select * from $BodiesTable where id=$id";
$msg_body = new query($DB, $sSQL);
$rows=$msg_list->numrows();
if($loc<0){
$loc=$rows-1;
}
elseif($loc==0 && $id!=$thread){
$x=0;
While($x!=$id){
$loc++;
$x=$msg_list->field("id", $loc);
};
}
$next_thread = "num=$num&thread=$thread&action=2$GetVars";
$prev_thread = "num=$num&thread=$thread&action=1$GetVars";
if($loc+1==$rows){
$next_link = $next_thread."&loc=0"; // was =-1
}
else{
$next_loc = $loc+1;
$next_id = $msg_list->field("id", $next_loc);
$next_link = "num=$num&id=$next_id&loc=$next_loc&thread=$thread$GetVars";
}
if($loc==0){
$prev_link = $prev_thread."&loc=0"; // was =-1
}
else{
$prev_loc = $loc-1;
$prev_id = $msg_list->field("id", $prev_loc);
$prev_link = "num=$num&id=$prev_id&loc=$prev_loc&thread=$thread$GetVars";
}
$author = chop($msg_list->field("author", $loc));
$subject = chop($msg_list->field("subject", $loc));
$datestamp = date_format($msg_list->field("datestamp", $loc));
$email = $msg_list->field("email", $loc);
$host = chop($msg_list->field("host", $loc));
$body = $msg_body->field("body", 0);
$qauthor=ereg_replace("|", "", $author);
$qsubject=ereg_replace("|", "", $subject);
if($email!=""){
$author = "$author";
}
$title = " - ".ereg_replace("|", "", $subject);
if(file_exists("header_$TableName.inc")){
include "./header_$TableName.inc";
}
else{
include "./header.inc";
}
$toThread = $thread + 1;
if(count($forums)>1){
$nav = "
";
}
else{
$nav = "";
}
?>
> |
valign="TOP">
width="100%" valign="top"> |
|
> : |
valign="TOP">
width="100%" valign="top">
: ()
:
\n\t]+)>", "{phopen}a href=\"\\1\\2\"{phclose}\\2{phopen}/a{phclose}", $body);
$body=eregi_replace("<([http|news|ftp]+://[^ >\n\t]+)>", "{phopen}a href=\"\\1\"{phclose}\\1{phopen}/a{phclose}", $body);
if(!$AllowHtml && !strstr($body, "")){
$body=eregi_replace("<(/*font *[^>]*)>", "{phopen}\\1{phclose}", $body);
$body=eregi_replace("<(/*ul *[^>]*)>", "{phopen}\\1{phclose}", $body);
$body=eregi_replace("<(/*ol *[^>]*)>", "{phopen}\\1{phclose}", $body);
$body=eregi_replace("<(/*li *[^>]*)>", "{phopen}\\1{phclose}", $body);
$body=eregi_replace("<(/*[b|i|u] *)>", "{phopen}\\1{phclose}", $body);
//$body=eregi_replace("<(/*a *[^>]*)>", "{phopen}\\1{phclose}", $body);
//$body=eregi_replace("<(img *[^>]*)>", "{phopen}\\1{phclose}", $body);
$body=str_replace("<", "<", $body);
$body=str_replace(">", ">", $body);
}
$body=str_replace("{phopen}", "<", $body);
$body=str_replace("{phclose}", ">", $body);
?>
|
|