portal-classes-core.search.php
<?PHP class Search { var found_ids; function Search(&this->core = &this->core->Db->connectDb(); } function checkVariables() { if(isset(_GET['s'] != "") { return true; } return false; } function getSearchWords(searchwords = explode(' ',searchwords as word != "") { word); } } return // bla } searchstring = found_ids; //echo '<h1>Searching for "', searchstring, '"...</h1>'; this->getSearchWords(searchstring = implode(" ", //echo 'Executing queries...<br />'; results[] = searchstring,results[] = searchstring,results[] = searchwords); //echo '<pre>',var_dump(</pre>'; return results; } function titleSearch(searchwords) { global query = 'select content_id,content_title,content_binary FROM content WHERE MATCH (content_title) AGAINST (\''; searchstring.'"'; foreach(word) { word; } //echo '<pre>',query,'</pre>'; this->core->Db->getPlainQueryResult(result) { //echo('invalid query, ignoring...<br />'); } else { while(result, MYSQL_NUM)) { if(in_array(found_ids)) { //echo 'found duplicate search result with ID ',<br />'; } else { results[] = found_ids[] = //echo '<pre>'; //var_dump(results[0]); //echo '</pre>'; mysql_free_result(results; } function textSearch(searchwords) { global query = 'select content_id,content_title,content_binary FROM content WHERE MATCH (content_binary) AGAINST (\''; searchstring.'"'; foreach(word) { word; } //echo '<pre>',query,'</pre>'; this->core->Db->getPlainQueryResult(result) { //echo('invalid query, ignoring...<br />'); } else { while(result, MYSQL_NUM)) { if(in_array(found_ids)) { //echo 'found duplicate search result with ID ',<br />'; } else { results[] = found_ids[] = //echo '<pre>'; //var_dump(results); //echo '</pre>'; mysql_free_result(results; } function keywordSearch(found_ids; searchwords[0].'\''; if(count(searchwords); foreach(word) { word.'\''; } } //echo '<pre>',query,'</pre>'; this->core->Db->getPlainQueryResult(result) { //echo('invalid query, ignoring...<br />'); } else { while(result, MYSQL_NUM)) { if(in_array(found_ids)) { //echo 'found duplicate search result with ID ',<br />'; } else { results[] = found_ids[] = //echo '<pre>'; //var_dump(results['fullstring_keywords']); //echo '</pre>'; mysql_free_result(results; } function doAdvancedSearch() { sortby_options = array("relevance" => "Relevance", "datedes" => "Date (newest first)", "dateasc" => "Date (oldest first)"); foreach(search_field) { if(isset(search_field]) && !empty(search_field])) { //echo "found ", $$search_field = _GET[search_fields_used[] = beforedd) && isset(beforeyyyy)) { if(!beforedd,beforeyyyy)) { //echo "Invalid 'before' date; ignored...<br />"; } else beforeyyyy."-".beforedd; } if(isset(aftermm) && isset(this->checkValidDate(aftermm,//echo "Invalid 'after' date; ignored...<br />"; } else afterdate = aftermm."-".// bouw query op query = title,keywords,beforedate,sortby); //echo '<pre>',</pre>'; // maak verbinding en voer query uit result = query); if(!//echo('invalid query, ignoring...<br />'); } else { while(row = mysql_fetch_array(results[] = //echo '<pre>'; //var_dump(results); //echo '</pre>'; mysql_free_result(results; } function checkValidDate(m,d) && strlen(m) && strlen(y) && strlen(m,y) >= mktime(0,0,0,1,1,1970) && mktime(0,0,0,d,title,keywords,beforedate,sortby) { title)) { this->getSearchWords(searchstring = implode(" ", query .= 'MATCH content_title AGAINST (\''; searchstring.'"'; foreach(word) { word; } title) && isset(query .= ' '; if(query .= 'AND '; } else { description)) { this->getSearchWords(searchstring = implode(" ", query .= 'MATCH content_binary AGAINST (\''; searchstring.'"'; foreach(word) { word; } description) && isset(query .= ' '; if(query .= 'AND '; } else { keywords)) { keywords); searchwords[0].'\''; if(count(searchwords); foreach(word) { word.'\''; } } beforedate)) { beforedate.' 00:00:00\' '; } if(isset(query .= 'AND content_date_added > \''.sortby)) { if(query .= 'ORDER BY content_date_added DESC'; } elseif(query .= 'ORDER BY content_date_added'; } } //echo '<pre>',</pre>'; return query; } } ?>
(C) A. Eliƫns 2/9/2007
You may not copy or print any of this material without explicit permission of the author or the publisher.