,=,?,!,#,^,(,),[,\],:,;,\\\,%]/","",$text); /* * * for jp * * * * * * * * * * */ $text = str_replace ("\xE3\x80\x80",' ',$text); $text = preg_replace ("/[<>=?!#^()[\]:;\\%]/","",$text); $this->ascii = '[\x00-\x7F]'; $this->two = '[\xC0-\xDF][\x80-\xBF]'; $this->three = '[\xE0-\xEF][\x80-\xBF][\x80-\xBF]'; $this->jpmarked = $this->boolean_mark_atoms_jp($text); /* * * * * * * * * * * * * * * * */ $this->querystring = $text; // $this->marked = $this->boolean_mark_atoms($text); $this->inclusive = $this->boolean_inclusive_atoms($text); $this->blogs = array(); // get all public searchable blogs, no matter what, include the current blog allways. $res = sql_query('SELECT bnumber FROM '.sql_table('blog').' WHERE bincludesearch=1 '); while ($obj = mysql_fetch_object($res)) $this->blogs[] = intval($obj->bnumber); } function boolean_sql_select($match){ // $string = $this->inclusive; // if (strlen($string) > 0) { /* build sql for determining score for each record */ /* preg_match_all( "([A-Za-z0-9]{1,}[A-Za-z0-9\-\.\_]{0,})", $string, $result); $result = $result[0]; for($cth=0;$cth=4){ $stringsum_long .= " $result[$cth] "; }else{ $stringsum_a[] = ' '.$this->boolean_sql_select_short($result[$cth],$match).' '; } } if(strlen($stringsum_long)>0){ $stringsum_long = addslashes($stringsum_long); $stringsum_a[] = " match ($match) against ('$stringsum_long') "; } $stringsum .= implode("+",$stringsum_a); return $stringsum; } */ } function boolean_inclusive_atoms($string){ $result=trim($string); $result=preg_replace("/([[:space:]]{2,})/",' ',$result); /* convert normal boolean operators to shortened syntax */ $result=eregi_replace(' not ',' -',$result); $result=eregi_replace(' and ',' ',$result); $result=eregi_replace(' or ',',',$result); /* drop unnecessary spaces */ $result=str_replace(' ,',',',$result); $result=str_replace(', ',',',$result); $result=str_replace('- ','-',$result); $result=str_replace('+','',$result); /* strip exlusive atoms */ $result=preg_replace( // "(\-\([A-Za-z0-9]{1,}[A-Za-z0-9\-\.\_\,]{0,}\))", "(\-\(([A-Za-z0-9]|$this->two|$this->three){1,}([A-Za-z0-9\-\.\_\,]|$this->two|$this->three){0,}\))", '', $result); $result=preg_replace( // "(\-[A-Za-z0-9]{1,}[A-Za-z0-9\-\.\_]{0,})", "(\-([A-Za-z0-9]|$this->two|$this->three){1,}([A-Za-z0-9\-\.\_\,]|$this->two|$this->three){0,})", '', $result); $result=str_replace('(',' ',$result); $result=str_replace(')',' ',$result); $result=str_replace(',',' ',$result); return $result; } function boolean_sql_where($match){ /* $result = $this->marked; $result = preg_replace( "/foo\[\(\'([^\)]{4,})\'\)\]bar/e", " 'match ('.\$match.') against (\''.\$this->copyvalue(\"$1\").'\') > 0 ' ", $result); $result = preg_replace( "/foo\[\(\'([^\)]{1,3})\'\)\]bar/e", " '('.\$this->boolean_sql_where_short(\"$1\",\"$match\").')' ", $result); */ $result = $this->jpmarked; /* for jp */ $result = $this->boolean_sql_where_jp_short($result,$match);/* for jp */ return $result; } // there must be a simple way to simply copy a value with backslashes in it through // the preg_replace, but I cannot currently find it (karma 2003-12-30) function copyvalue($foo) { return $foo; } /*********************************************** Make "WHERE" (jp) ***********************************************/ function boolean_mark_atoms_jp($string){ $result=trim($string); $result=preg_replace("/([[:space:]]{2,})/",' ',$result); /* convert normal boolean operators to shortened syntax */ $result=eregi_replace(' not ',' -',$result); $result=eregi_replace(' and ',' ',$result); $result=eregi_replace(' or ',',',$result); /* strip excessive whitespace */ $result=str_replace(', ',',',$result); $result=str_replace(' ,',',',$result); $result=str_replace('- ','-',$result); $result=str_replace('+','',$result); $result=str_replace(',',' ,',$result); return $result; } function boolean_sql_where_jp_short($string,$match){ $match_a = explode(',',$match); $key_a = explode(' ',$string); for($ith=0;$ith