<?php define('TICKET', 'preview'); $bckdir = getcwd(); $curdir = chdir(dirname(__FILE__)); include "includes/init.php"; $post = new tkPost(0); echo $post->handleField("text", $_POST["previewText"]);
$where["cat"] = "( parent=0 )";*/ // -------------------------- Search function begin -------------------------- // // Search Function. Map: // Search for the keywords in the Post table // Save each match in an array. array( "thradid" => 0/1/2 ) // Limit the search to the found threads if ($envSearchActive) { $searchWords = explode(" ", $_GET["tkSearch"]); #var_dump( $searchWords ); $words = array(); foreach ($searchWords as $searchWord) { $words[] = "`text` LIKE '%" . mysql_real_escape_string($searchWord) . "%'"; } $search["words_simple"] = tkWhereArrayToStr($words, "OR"); $searchWhere = tkWhereArrayToStr($search); $searchPost = new tkPost(0); $searchPost->requestList($searchWhere); // Go through matches and put them in the Array $matches = array(); while ($dataRaw = $searchPost->getListRow()) { #echo "post ".$dataRaw["id"]."<br>"; $matches[$dataRaw["threadid"]] = "`id` = '" . $dataRaw["threadid"] . "'"; } if (count($matches) <= 0) { $matches[] = "1=2"; } // We are also looking for the thread subjects, // so we join the post results with the threads by an "OR" $searchAll = array("posts" => tkWhereArrayToStr($matches, "OR"), "subject" => "`subject` LIKE '%" . mysql_real_escape_string($searchWord) . "%'"); // Add our results to the Overview Request $where["search"] = tkWhereArrayToStr($searchAll, "OR");