process()) { exit(); } $handler->setNavi("FAQ"); $handler->setTitle("Message Board"); //////////////////////////////////////////////////////////////////////////////// // // // Copyright (C) 2000 Phorum Development Team // // http://www.phorum.org // // // // This program is free software. You can redistribute it and/or modify // // it under the terms of either the current Phorum License (viewable at // // phorum.org) or the Phorum License that was distributed with this file // // // // This program is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY, without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // // // // You should have received a copy of the Phorum License // // along with this program. // //////////////////////////////////////////////////////////////////////////////// $read=true; require './common.php'; require "$include_path/read_functions.php"; settype($t, 'integer'); settype($a, 'integer'); settype($i, 'integer'); settype($admview, 'integer'); $thread=$t; $action=$a; $id=$i; // default $max_id=0; if(isset($v)) $v=='f' ? $flat=1 : $flat=0; $flat = 1; if($num==0 || $ForumName==''){ Header("Location: $forum_page.$ext?$GetVars"); exit; } if(empty($id) && empty($action)){ Header("Location: $list_page.$ext?f=$num$GetVars"); exit; } $phcollapse="phorum-collapse-$ForumTableName"; $phflat="phorum-flat-$ForumTableName"; $new_cookie="phorum-new-$ForumTableName"; $haveread_cookie="phorum-haveread-$ForumTableName"; if($UseCookies){ if(IsSet($flat)){ $$phflat=$flat; } elseif(!isset($$phflat)){ $$phflat=$ForumFlat; } if(!IsSet($$new_cookie)){ $$new_cookie='0'; } $use_haveread=false; // if(IsSet($$haveread_cookie)) { // $haveread=array_flip(explode('.', $$haveread_cookie)); // $old_message=key($haveread); // $use_haveread=true; // } // else{ // $old_message=$$new_cookie; // } } else{ if(IsSet($flat)){ $$phflat=$flat; } else{ $$phflat=$ForumFlat; } if(IsSet($collapse)){ $$phcollapse=$collapse; } else{ $$phcollapse=$ForumCollapse; } } $$phcollapse = 1; if($admview!=1 || !$phorum_user['moderator']) { $limitApproved=' and approved=\'Y\''; } else { $limitApproved=''; } if($action!=0 && ($action==1 || $action==2)){ if($DB->type=='sybase') { $limit=""; $q->query($DB, 'set rowcount $ForumDisplay'); } elseif($DB->type=='postgresql'){ $limit=""; $q->query($DB, 'set QUERY_LIMIT TO 1'); } else{ $limit=' limit 1'; } if ($ForumMultiLevel==2){ $SQL = "Select modifystamp from $ForumTableName where thread=$thread $limitApproved $limit"; $q->query($DB,$SQL); $thms=$q->field('modifystamp', 0); } switch($action){ case 2: $cutoff_thread=$thread-$cutoff; if ($ForumMultiLevel==2){ $sSQL="Select thread, id from $ForumTableName where modifystamp < $thms $limitApproved order by modifystamp desc $limit"; } else { $sSQL="Select thread, id from $ForumTableName where thread<$thread and thread>$cutoff_thread and id=thread $limitApproved order by thread desc $limit"; } break; case 1: $cutoff_thread=$thread+$cutoff; if ($ForumMultiLevel==2){ $sSQL="select thread, id from $ForumTableName where modifystamp>$thms $limitApproved order by modifystamp $limit"; } else { $sSQL="Select thread, id from $ForumTableName where thread<$cutoff_thread and thread>$thread and id=thread $limitApproved 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?f=$num$GetVars"); exit; } $tres=$msg->getrow(); Header("Location: $read_page.$ext?f=$num&i=$tres[id]&t=$tres[thread]$GetVars"); exit(); } $sSQL = "Select * from $ForumTableName where thread=$thread $limitApproved order by id"; $msg_list = new query($DB, $sSQL); $rec=$msg_list->getrow(); $x=0; $closed=0; While(is_array($rec)){ $headers[]=$rec; if($rec['id']==$id) $loc=$x; if($rec['thread']==$rec['id']) { $closed=$rec['closed']; $closevar=$rec['closed']==1 ? 0 : 1; $closetxt=$rec['closed']==1 ? $lModOpenThread : $lModCloseThread; } if($ForumSecurity!=SEC_NONE && $rec['userid']>0) $ids[]=$rec['userid']; $rec=$msg_list->getrow(); $x++; } // Get the user info. I curse PG for not having Left Joins. if(@is_array($ids)){ $users=phorum_get_users($ids); $moderators=phorum_get_modstatus($ids); } if ($$phflat) { $sSQL = "SELECT $ForumTableName.id AS id, $ForumTableName.thread AS thread, body from $ForumTableName, ".$ForumTableName."_bodies WHERE $ForumTableName.approved = 'Y' AND $ForumTableName.thread = ".$thread." AND $ForumTableName.id = ".$ForumTableName."_bodies.id ORDER BY id"; } else { $sSQL = "Select * from $ForumTableName"."_bodies where id=$id"; } $msg_body = new query($DB, $sSQL); $rec=$msg_body->getrow(); While(is_array($rec)){ $bodies[]=$rec; $rec=$msg_body->getrow(); } $msg_body->free(); $header_rows=count($headers); $body_rows=count($bodies); $next_thread = "f=$num&t=$thread&a=2$GetVars"; $prev_thread = "f=$num&t=$thread&a=1$GetVars"; if(!$$phflat && $header_rows > 0){ if($loc+1==$header_rows){ $next_link = $next_thread; } else{ $next_loc = $loc+1; $next_id = $headers[$next_loc]['id']; $next_link = "f=$num&i=$next_id&t=$thread$GetVars"; } if($loc==0){ $prev_link = $prev_thread; } else{ $prev_loc = $loc-1; $prev_id = $headers[$prev_loc]['id']; $prev_link = "f=$num&i=$prev_id&t=$thread$GetVars"; } if(!isset($haveread[$id]) && $UseCookies && $id > $old_message){ if(empty($$haveread_cookie)){ $haveread[$$new_cookie] = 1; $$haveread_cookie=$$new_cookie; } if (!isset($haveread[$id])) { // don't append id to cookie if it is already there $$haveread_cookie.=".$id"; $haveread[$id] = 1; // SetCookie("phorum-haveread-$ForumTableName",$$haveread_cookie,0); } } $max_id=$id; } elseif($header_rows > 0) { $prev_link=$prev_thread; $next_link=$next_thread; $lNextMessage=$lNextTopic; $lPreviousMessage=$lPreviousTopic; if($UseCookies){ $madechange=false; @reset($headers); $row=@current($headers); while(!empty($row['id'])){ if(!isset($haveread[$row['id']]) && $row['id'] > $old_message){ $madechange=true; if(empty($$haveread_cookie)){ $haveread[$$new_cookie] = 1; $$haveread_cookie=$$new_cookie; } $$haveread_cookie.='.'; $$haveread_cookie.=$row['id']; } $haveread[$row['id']] = 1; $max_id=$row['id']; $row=next($headers); } if ($madechange) { // SetCookie($haveread_cookie,$$haveread_cookie,0); } } } if($UseCookies){ if($$new_cookie<$max_id){ $$new_cookie=$max_id; // SetCookie($new_cookie,$$new_cookie,time()+ 31536000); } } if($header_rows > 0) { $subject = chop($headers[$loc]['subject']); $rawsub=preg_replace("/<\/*b>/", '', $subject); $title = " - ".$rawsub; } else { $title = ''; } // include phorum_get_file_name('header'); $toThread = $thread + 1; ////////////////////////// // START NAVIGATION // ////////////////////////// $menu=array(); if(!$$phflat){ if(!$closed){ if($ReplyLocation==1){ addnav($menu2, $lReplyMessage, "$post_page.$ext?f=$f&i=$rec_id&t=$t&r=$id$GetVars"); } else { addnav($menu2, $lReplyMessage, "$read_page.$ext?f=$f&i=$id&t=$t$GetVars#REPLY"); } } } if($ActiveForums>1){ // Forum List // addnav($menu2, "List of Discussions", "$forum_page.$ext?f=$ForumParent$GetVars"); } // New Topic if(isset($phorum_user['id'])){ // addnav($menu1, $lStartTopic, "$post_page.$ext?f=$num$GetVars"); } // Go To Top // addnav($menu1, $lGoToTop, "$list_page.$ext?f=$num$GetVars"); // Go To Topic if ($ForumMultiLevel==2) { // Float to Top // addnav($menu1, $lGoToTopic, "$list_page.$ext?f=$num&t=".$headers[0]['modifystamp']."&a=3$GetVars"); } else { // addnav($menu1, $lGoToTopic, "$list_page.$ext?f=$num&t=$toThread&a=3$GetVars"); } // Search // addnav($menu1, $lSearch, "$search_page.$ext?f=$num$GetVars"); $TopLeftNav=getnav($menu1); $LowLeftNav=getnav($menu2); $menu=array(); // Prev Thread addnav($menu, "Older Posts", "$read_page.$ext?$prev_thread$GetVars"); // Next Thread addnav($menu, "Newer Posts", "$read_page.$ext?$next_thread$GetVars"); $ThreadNav=getnav($menu); $menu=array(); // Previous Message addnav($menu, "Older Posts", "$read_page.$ext?$prev_link$GetVars"); // Next Message addnav($menu, "Newer Posts", "$read_page.$ext?$next_link$GetVars"); $MessageNav=getnav($menu); ////////////////////////// // END NAVIGATION // ////////////////////////// Require_once "include/hp_top.php"; ?>

Message Board