query($DB, $sSQL); $aryRow=$q->getrow(); if(isset($aryRow['max_id'])){ $max_id=$aryRow['max_id']; $$new_cookie=$max_id; SetCookie($new_cookie,$$new_cookie,time()+ 31536000); SetCookie($haveread_cookie,$$new_cookie); //destroy session cookie unset($$haveread_cookie); } } if(!IsSet($$new_cookie)){ $$new_cookie='0'; } $use_haveread=false; if(IsSet($$haveread_cookie)) { $arr=explode(".", $$haveread_cookie); $old_message=reset($arr); array_walk($arr, "explode_haveread"); $use_haveread=true; } else{ $old_message=$$new_cookie; } if(IsSet($collapse)){ $$phcollapse=$collapse; SetCookie("phorum-collapse-$ForumTableName",$collapse,time()+ 31536000); } elseif(!isset($$phcollapse)){ $$phcollapse=$ForumCollapse; } } else{ if(IsSet($collapse)){ $$phcollapse=$collapse; } else{ $$phcollapse=$ForumCollapse; } } if($DB->type=="sybase") { $limit=""; $q->query($DB, "set rowcount $ForumDisplay"); } elseif($DB->type=="postgresql"){ $limit=""; $q->query($DB, "set QUERY_LIMIT TO '$ForumDisplay'"); } else{ $limit=" limit $ForumDisplay"; } if($thread==0 || $action==0){ $sSQL = "Select max(thread) as thread from $ForumTableName where approved='Y'"; $q->query($DB, $sSQL); if($q->numrows()>0){ $rec=$q->getrow(); $maxthread = isset($rec["thread"]) ? $rec["thread"] : 0; } else{ $maxthread=0; } if ($maxthread > $cutoff) { $cutoff_thread=$maxthread-$cutoff; } else { $cutoff_thread = 0; } if($$phcollapse==0){ $sSQL = "Select thread from $ForumTableName where thread > $cutoff_thread and approved='Y' order by thread desc".$limit; } else{ $sSQL = "Select thread, count(id) as tcount, max(datestamp) as latest, max(id) as maxid from $ForumTableName where approved='Y' AND thread > $cutoff_thread group by thread order by thread desc".$limit; } } else{ if($action==1){ $cutoff_thread=$thread+$cutoff; $sSQL = "Select thread from $ForumTableName where approved='Y' AND thread < $cutoff_thread AND thread > $thread order by thread".$limit; $q=new query($DB, $sSQL); $rec=$q->getrow(); if(!empty($rec["thread"])){ $keepgoing=true; $x=0; while (is_array($rec) && $keepgoing){ $thread = $rec["thread"]; $rec=$q->getrow(); $x++; } } $thread=$thread+1; } if ($thread > $cutoff) { $cutoff_thread=$thread-$cutoff; } else { $cutoff_thread = 0; } if($$phcollapse==0){ $sSQL = "Select thread from $ForumTableName where approved='Y' and thread < $thread and thread > $cutoff_thread order by thread desc".$limit; } else{ $sSQL = "Select thread, COUNT(id) AS tcount, MAX(datestamp) AS latest, MAX(id) AS maxid FROM $ForumTableName WHERE approved='Y' AND thread < $thread AND thread > $cutoff_thread GROUP BY thread ORDER BY thread DESC".$limit; } } $thread_list = new query($DB, $sSQL); if($DB->type=="sybase") { $q->query($DB, "set rowcount 0"); } elseif($DB->type=="postgresql"){ $q->query($DB, "set QUERY_LIMIT TO '0'"); } $rec=$thread_list->getrow(); if(empty($rec["thread"]) && $action!=0){ Header("Location: $forum_url/$list_page.$ext?f=$num$GetVars"); exit(); } if(isset($rec['thread'])){ $max=$rec["thread"]; $keepgoing=true; $x=0; while (is_array($rec)){ $threads[]=$rec; $min=$rec["thread"]; $rec=$thread_list->getrow(); } } else{ $threads=""; $max=0; $min=0; } if($$phcollapse==0){ $sSQL = "Select id,parent,thread,subject,author,datestamp from $ForumTableName where approved='Y' AND thread<=$max and thread>=$min order by thread desc, id asc"; } else{ $sSQL = "Select id,thread,subject,author,datestamp from $ForumTableName where approved='Y' AND thread = id AND thread<=$max AND thread>=$min order by thread desc"; } $msg_list = new query($DB, $sSQL); $rec=$msg_list->getrow(); while(is_array($rec)){ $headers[]=$rec; $rec=$msg_list->getrow(); } $rows=@count($headers); if(file_exists("$include_path/header_$ForumConfigSuffix.php")){ include "$include_path/header_$ForumConfigSuffix.php"; } else{ include "$include_path/header.php"; } if($$phcollapse==0){ $collapse_link = "".$lCollapseThreads.""; } else{ $collapse_link = "".$lViewThreads.""; } if($ActiveForums>1){ $nav = ""; } else{ $nav = ""; } $pagenav=""; if($action!=0) $pagenav=" $lNewerMessages"; if($rows>=$ForumDisplay){ if(!empty($pagenav)) $pagenav.="  |  "; $pagenav.="$lOlderMessages "; } if(empty($pagenav)) { $pagenav=" "; } ?>
> >
> >