11)) $dm=0; if (($dd<=0) || ($dd>31)) $dd="01"; $db=urldecode($db); $de=urldecode($de); if ($db=="") $db='01/01/1970'; if ($de=="") $de='31/12/2020'; if ($hlbeg=="") $hlbeg=''; if ($hlend=="") $hlend=''; if (isset($q)) $q=urldecode($q); $ul=urldecode($ul); $ue=urldecode($ue); $tag=urldecode($t); $lang=urldecode($lang); if (isset($q)) $have_query_flag=1; else $have_query_flag=0; $query_orig=$q; if (isset($CHARSET_SAVED_QUERY_STRING)) { $q_local=urldecode($CHARSET_SAVED_QUERY_STRING); if (preg_match('/q=([^&]*)\&/',$q_local,$param)) { $q_local=urlencode($param[1]); } elseif (preg_match('/q=(.*)$/',$q_local,$param)) { $q_local=urlencode($param[1]); } else { $q_local=urlencode($q); } } else { $q_local=urlencode($q); } $ul_local=urlencode($ul); $ue_local=urlencode($ue); $t_local=urlencode($tag); $db_local=urlencode($db); $de_local=urlencode($de); $lang_local=urlencode($lang); $timestr=''; $uestr=($ue=="")?"":" AND url.url NOT LIKE '%$ue%' "; $ulstr=($ul=="")?"":" AND url.url LIKE '%$ul%' "; $langstr=($lang=="")?"":" AND url.lang = '$lang' "; if ($m == 'and') $DEFAULT_QUERY_TYPE='and'; if ($m == 'or') $DEFAULT_QUERY_TYPE='or'; if (($MAX_NP > 0) && ($np>$MAX_NP)) $np=$MAX_NP; if (($MAX_PS > 0) && ($ps>$MAX_PS)) $ps=$MAX_PS; $clones='yes'; if ($LC_CTYPE != '') { setlocale("LC_ALL",$LC_CTYPE); } elseif ($LC_ALL != '') { setlocale("LC_ALL",$LC_ALL); } elseif ($LANG != '') { setlocale("LC_ALL",$LANG); } // ----------------------------------------------- // init() // ----------------------------------------------- function init(){ global $q; global $tag, $tagstr; global $cat, $catstr, $cs, $cp; global $trackquery; global $rus_bool_lang; global $have_query_flag; global $lang_content_negotiation, $lang_url_translation; global $soundex, $soundex_words; global $highlight_stopwords; global $stopword_arr; global $cp_arr; global $dict_table; global $dict_table1; global $dict_table2; global $dbaddr; global $dbodbc,$dbodbc_cursor_type; global $dbhost,$dbuser,$dbpass,$dbname,$dbport,$dbtype,$dbmode; global $db_format; global $last_mod_field, $crc_field; global $timestr, $dt, $dp, $dx, $dm, $dd, $dy, $db, $de; global $micro_start, $start_time; $micro_start=get_micro_time(); $start_time=time(); srand((double)microtime()*1000000); $stopword_arr=array(); $cp_arr=array(); $soundex_words=array(); read_template(); $trackquery=strtolower($trackquery); if (($trackquery != 'no') && ($trackquery != 'yes')) $trackquery = 'no'; $rus_bool_lang=strtolower($rus_bool_lang); if (($rus_bool_lang != 'no') && ($rus_bool_lang != 'yes')) $rus_bool_lang = 'no'; $lang_content_negotiation=strtolower($lang_content_negotiation); if (($lang_content_negotiation != 'no') && ($lang_content_negotiation != 'yes')) $lang_content_negotiation = 'no'; $soundex=strtolower($soundex); if (($soundex != 'no') && ($soundex != 'yes')) $soundex = 'no'; $highlight_stopwords=strtolower($highlight_stopwords); if (($highlight_stopwords != 'no') && ($highlight_stopwords != 'yes')) $highlight_stopwords = 'no'; $lang_url_translation=strtolower($lang_url_translation); if (($lang_url_translation != 'no') && ($lang_url_translation != 'yes')) $lang_url_translation = 'no'; if (($db_format != '3.0') && ($db_format != '3.1')) $db_format = '3.0'; $last_mod_field='url.last_modified'; if ($db_format == '3.1') $last_mod_field='url.last_mod_time'; $crc_field='url.crc'; if ($db_format == '3.1') $crc_field='url.crc32'; if ($db_format == '3.1') { $tagstr=($tag=="")?"":"AND url.tag LIKE '$tag'"; $catstr=($cat=="")?"":"AND url.category LIKE '$cat%'"; } else { $tagstr=($tag=="")?"":"AND url.tag=$tag"; } if (preg_match("/^([^:]+):(.*)\/([^\/]+)\/?$/",$dbaddr,$param)) { $dbtype=$param[1]; $dbname=$param[3]; $temp=$param[2]; if (preg_match("/^\/\/([^:]+):?(.*)\@([^:]*):?(.*)$/",$temp,$param)) { $dbuser=$param[1]; if ($param[2]) $dbpass=$param[2]; $dbhost=$param[3]; if ($param[4]) $dbport=$param[4]; } } if (preg_match("/^(.*)-odbc$/i",$dbtype,$param)) { $dbodbc=1; $dbtype=$param[1]; } else { $dbodbc=0; } if ($dbmode == 'multi') $dict_table=$dict_table1; if ($dbmode == 'crc-multi') $dict_table=$dict_table2; if ($have_query_flag) $q=ParseQ($q); if ($db_format == '3.1') { if (($dt == 'back') && ($dp != '0')) { $recent_time=format_dp($dp); if ($recent_time != 0) { $timestr = "AND $last_mod_field >= ".(time()-$recent_time); } } elseif ($dt=='er') { $recent_time=mktime(0,0,0,($dm+1),$dd,$dy); if ($dx == -1) { $timestr = "AND $last_mod_field <= $recent_time "; } elseif ($dx == 1) { $timestr = "AND $last_mod_field >= $recent_time "; } } elseif ($dt=='range') { $begin_time=format_userdate($db); if ($begin_time) $timestr .= "AND $last_mod_field >= $begin_time "; $end_time=format_userdate($de); if ($end_time) $timestr .= "AND $last_mod_field <= $end_time "; } } db_init($dbtype,$dbname,$dbhost,$dbuser,$dbpass,$dbport,$dbodbc,$dbodbc_cursor_type); if ($db_format == '3.1') { $cs=load_cs($cat); $cp=load_cp($cat); } print_template('top'); flush(); } ?>