/***************************************************************************** * phorum * * www.phorum.org * * Created 04/16/98 Last Modified 2/24/98 * ****************************************************************************** * Copyright (C) 1998 Phorum Dev Team * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2, or (at your option) * * any later version. * * * * You should have received a copy of the GNU General Public License * * if not, write to: * * Free Software Foundation Inc. * * 675 Mass Ave * * Cambridge, MA 02139, USA. * * * *****************************************************************************/ include "header.inc"; include "vars.phtml"; /* Begin PHP Code */ /**************************************************** * Determine if there are params and build page SQL * ****************************************************/ if($back!=""){ $sSQL = "Select thread from $sTable where thread <>0 and thread > $back order by thread limit $nDisplay"; } elseif($more!=""){ $sSQL = "Select thread from $sTable where thread <>0 and thread < $more order by thread desc limit $nDisplay"; } else{ $sSQL = "Select thread from $sTable where thread <>0 order by thread desc limit $nDisplay"; } $nThreads = mysql_db_query($sDB, $sSQL, $nConnection); $nRows = mysql_num_rows ( $nThreads ); if($nRows<$nDisplay){ if($back!=""){ $sSQL = "Select thread from $sTable where thread <>0 order by thread desc limit $nDisplay"; $nThreads = mysql_db_query($sDB, $sSQL,$nConnection); $nRows = mysql_num_rows ( $nThreads ); } } $topics = ""; if ( $nRows > 0 ){ $a=1; $thread = mysql_result($nThreads, 0, "thread"); $topics = "$thread"; While($a<$nRows){ $thread = mysql_result($nThreads, $a, "thread"); $topics = $topics.",$thread"; $a++; } } if($topics!=""){ $sSQL = "Select id,topic,name,datestamp,thread from $sTable where thread in ($topics) order by thread desc, id"; } else{ $sSQL = "Select id,topic,name,datestamp,thread from $sTable"; } echo ""; ?> echo "\n"; if($nTopics>0){ $nRows = mysql_num_rows($nTopics); $nav = "
\n\n\n
\n \n
\n\n"; if($RestrictedPosting==0){ $nav = $nav." $lStartTopic "; } if($nRows>0){ //Initialize navigation $sSQL = "Select max(thread) as max, min(thread) as min from $sTable where thread in ($topics)"; $nMaxMin = mysql_db_query ( $sDB, $sSQL, $nConnection ); $obj = mysql_fetch_object($nMaxMin); $HiOnPage = $obj->max; $LowOnPage = $obj->min; $sSQL = "Select max(thread) as max, min(thread) as min from $sTable"; $nMaxMin = mysql_db_query ( $sDB, $sSQL, $nConnection ); $obj = mysql_fetch_object($nMaxMin); $HiThread = $obj->max; $LowThread = $obj->min; if($HiThread>$HiOnPage){ if(strstr($nav,$lStartTopic)!=""){ $nav = $nav."|"; } $nav = $nav." $lGoToTop | $lNewer "; } if($LowThread<$LowOnPage){ if(strstr($nav,$lStartTopic)!="" || strstr($nav,$lGoToTop)!=""){ $nav = $nav."|"; } $nav = $nav." $lOlder "; } } $nav = $nav."\n
\n"; echo $nav; echo "\n"; if($nRows>0){ include "threads.inc"; echo $nav; echo "\n"; } else{ echo "
\n"; } } else{ ?>