$value) { $_POST[$key] = addslashes($value); } } if($get->searchwords==""){ $get->searchwords="Enter Your Search Terms"; } print<<$config[siteName] Help Forums

Search Forums

eof; switch($action){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // dosearch //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// case"dosearch": if(($get->searchwords=="")||($get->searchwords=="Enter Your Search Terms")){ print<<Error

You must enter some search terms in order to do a search.

eof; include("inc/foot.php"); exit; } // build the string... $searchArray = explode(" ",$get->searchwords); $sql = "SELECT DISTINCT(forumThreads.thread_id),forumThreads.* FROM forumThreads LEFT JOIN forumPosts USING(thread_id) WHERE forumThreads.thread_id is not null AND"; if(is_array($searchArray)){ foreach($searchArray AS $key=>$value){ $sql.=" (forumThreads.threadBody LIKE('%$value%') OR forumPosts.postBody LIKE('%$value%'))"; } } $sql.=" AND forumThreads.thread_id>0 ORDER BY forumThreads.created DESC"; // debug //print"

$sql

"; $res = $db->query($sql); $resultCount = $res->numRows(); print<< Title Author Posts Last Posted eof; $out = new printForum($db,$config); $printed=0; while($res->fetchInto($row)){ if($printed%2!=0){$out->class="subrow1";}else{$out->class="subrow2";} $out->setThread($row->thread_id); $out->printThread(""); $printed++; } break; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // savepost // decides if this is a new post or an existing post and inserts or updates a post record //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// case"savepost": // do some form error checking - make sure required fields are not null // if we've got an error...reprint the form with the data from the $post object and exit $errors =0; $msg=""; if($post->postTitle==""){ $errors++; $msg.="You must enter a post title.
"; } if($post->postBody==""){ $errors++; $msg.="You must provide some body text.
"; } if($errors!=0){ print<<Error

The following errors occured while trying to process your request. Please review your error(s) and click "Save Post" to continue.

$msg

eof; $newaction=$post->action; $row = $post; include("forms/forumPostForm.php"); include("inc/foot.php"); exit; } $post_id = $forum->savePost($_POST,$session->sUser_id); print<<Success

Your post has been saved.

eof; $out = new printForum($db,$config); $out->setThread($post->thread_id); $out->printBreadCrumbs(); $out->printForumOutput(); break; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // savethread // decides if this is a new thread or an existing thread and inserts or updates a thread record //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// case"savethread": // do some form error checking - make sure required fields are not null // if we've got an error...reprint the form with the data from the $post object and exit $errors =0; $msg=""; if($post->threadTitle==""){ $errors++; $msg.="You must enter a thread title.
"; } if($post->threadBody==""){ $errors++; $msg.="You must provide some body text.
"; } if($errors!=0){ print<<Error

The following errors occured while trying to process your request. Please review your error(s) and click "Save Thread" to continue.

$msg

eof; $newaction=$post->action; $row = $post; include("forms/forumThreadForm.php"); include("inc/foot.php"); exit; } $thread_id = $forum->saveThread($_POST,$session->sUser_id); print<<Success

Your thread has been saved.

eof; $out = new printForum($db,$config); $out->setCategory($post->category_id); $out->printBreadCrumbs(); $out->printForumOutput(); break; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // printforumsingle - prints single forum and related categories /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// case "printforumsingle": $out = new printForum($db,$config); $out->setForum($get->forum_id); $out->printBreadCrumbs(); $out->printForumOutput(); break; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // printcategory - prints single category and related threads /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// case "printcategory": $out = new printForum($db,$config); $out->setCategory($get->category_id); $out->printBreadCrumbs(); $out->printForumOutput(); break; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // printthread - prints single thread and related posts /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// case "printthread": $out = new printForum($db,$config); $out->setThread($get->thread_id); $out->printBreadCrumbs(); $out->printForumOutput(); break; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // default - prints all forums and categories /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// default: $out = new printForum($db,$config); $out->printBreadCrumbs(); $out->printForumOutput(); break; } print""; include("inc/foot.php"); ?>