📄 index.php
字号:
<?/* $Source: /repository/php-src/ext/mnogosearch/Attic/index.php,v $ $Id: index.php,v 1.15 2002/08/03 11:34:52 gluke Exp $ *//* mnoGoSearch-php-lite v.1.4 * for mnoGoSearch ( formely known as UdmSearch ) free web search engine * (C) 2001-2002 by Sergey Kartashoff <gluke@mail.ru>, * mnoGoSearch Developers Team <devel@mnogosearch.org> */if (!extension_loaded('mnogosearch')) { print "<b>This script requires PHP4.0.5+ with mnoGoSearch extension</b>"; exit;}// maximal page number to view$MAX_NP=1000;// maximum results per page$MAX_PS=100;// (optional) Enable autowild feature for url limits// 'yes' - default value, can be 'yes' or 'no'// $auto_wild='yes';/* variables section */if (Udm_Api_Version() >= 30204) { $dbaddr='mysql://mnogo:mnogo@/mnogo/?dbmode=single';} else { $dbaddr='mysql://mnogo:mnogo@/mnogo/'; $dbmode='single';}$localcharset='koi8-r';$browsercharset='utf-8';$phrase=$cache=$crosswords='no';$ispelluseprefixes=$trackquery='no';$spell_host=$vardir=$datadir='';$ispellmode='text';$affix_file=array();$spell_file=array();$stopwordtable_arr=array();$stopwordfile_arr=array();$synonym_arr=array();$searchd_arr=array();// $affix_file['en']='/opt/udm/ispell/en.aff';// $affix_file['ru']='/opt/udm/ispell/ru.aff';// $spell_file['en']='/opt/udm/ispell/en.dict';// $spell_file['ru']='/opt/udm/ispell/ru.dict'; $stopwordtable_arr[]='stopword';// $stopwordfile_arr[]='stopwords.txt';// $synonym_arr[]='/opt/udm/synonym/english.syn';$searchd_arr[]='localhost';$minwordlength=1;$maxwordlength=32;$storedocurl="/cgi-bin/storedoc.cgi";/* initialisation section */if(isset($HTTP_GET_VARS)){ while(list($var, $val)=each($HTTP_GET_VARS)){ $$var=$val; }}if(isset($HTTP_POST_VARS)){ while(list($var, $val)=each($HTTP_POST_VARS)){ $$var=$val; }}if(isset($HTTP_COOKIE_VARS)){ while(list($var, $val)=each($HTTP_COOKIE_VARS)){ $$var=$val; }}if(isset($HTTP_SERVER_VARS)){ while(list($var, $val)=each($HTTP_SERVER_VARS)){ $$var=$val; }}$self=$PHP_SELF;if ($ps=="") $ps=20;if ($np=="") $np=0;if ($o=="") $o=0;if (($dt!='back') && ($dt!='er') && ($dt!='range')) $dt='back';if ($dp=="") $dp=0;if (($dx!=0) && ($dx!=-1) && ($dx!=1)) $dx=0;if ($dy<1970) $dy=1970;if (($dm<0) || ($dm>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';// define this to enable stored support// $storedaddr="localhost";$storedocurl='/cgi-bin/storedoc.cgi';if (isset($q)) { $q=urldecode($q); $have_query_flag=1;} else { $have_query_flag=0;}$ul=urldecode($ul);$tag=urldecode($t); $lang=urldecode($lang); $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);$t_local=urlencode($tag);$db_local=urlencode($db);$de_local=urlencode($de);$lang_local=urlencode($lang);if (($MAX_NP > 0) && ($np>$MAX_NP)) $np=$MAX_NP;if (($MAX_PS > 0) && ($ps>$MAX_PS)) $ps=$MAX_PS;// -----------------------------------------------// print_bottom()// -----------------------------------------------function print_bottom(){ print ("<HR><center><img src=\"http://mnogosearch.org/img/mnogo.gif\">\n"); print ("<font size=\"-1\">Powered by <a href=\"http://mnogosearch.org/\">mnoGoSearch</a></font><br>\n"); print ("<p></BODY></HTML>\n");}// -----------------------------------------------// print_error_local($str)// -----------------------------------------------function print_error_local($str){ print ("<CENTER><FONT COLOR=\"#FF0000\">An error occured!</FONT>\n"); print ("<P><B>$str</B></CENTER>\n"); print_bottom(); exit;}// -----------------------------------------------// exit_local()// -----------------------------------------------function exit_local($print_err = 1) { drop_temp_table($print_err); exit;}// -----------------------------------------------// format_lastmod($lastmod)// -----------------------------------------------function format_lastmod($lastmod) { $temp=$lastmod; if (!$temp) $temp = 'undefined'; else $temp = strftime('%a, %d %b %Y %H:%M:%S %Z',$temp); return $temp;}// -----------------------------------------------// format_dp($dp)// -----------------------------------------------function format_dp($dp) { $result=0; while ($dp != '') { if (preg_match('/^([\-\+]?\d+)([sMhdmy]?)/',$dp,$param)) { switch ($param[2]) { case 's': $multiplier=1; break; case 'M': $multiplier=60; break; case 'h': $multiplier=3600; break; case 'd': $multiplier=3600*24; break; case 'm': $multiplier=3600*24*31; break; case 'y': $multiplier=3600*24*365; break; default: $multiplier=1; } $result += $param[1]*$multiplier; $dp=preg_replace("/^[\-\+]?\d+$param[2]/",'',$dp); } else { return 0; } } return $result;}// -----------------------------------------------// format_userdate($date)// -----------------------------------------------function format_userdate($date) { $result=0; if (preg_match('/^(\d+)\/(\d+)\/(\d+)$/',$date,$param)) { $day=$param[1]; $mon=$param[2]; $year=$param[3]; $result=mktime(0,0,0,$mon,$day,$year); } return $result;}// -----------------------------------------------// ParseDocText($text)// -----------------------------------------------function ParseDocText($text){ global $all_words; global $hlbeg, $hlend; $str=$text; if (Udm_Api_Version() < 30200) { for ($i=0; $i<count($all_words); $i++) { $word=$all_words[$i]; $str = preg_replace("/([\s\t\r\n\~\!\@\#\$\%\^\&\*\(\)\-\_\=\+\\\|\{\}\[\]\;\:\'\"\<\>\?\/\,\.]+)($word)/i","\\1$hlbeg\\2$hlend",$str); $str = preg_replace("/^($word)/i","$hlbeg\\1$hlend",$str); } } else { $str = str_replace("\2",$hlbeg,$str); $str = str_replace("\3",$hlend,$str); } return $str;}// -----------------------------------------------// print_template($t,$echo=1)// -----------------------------------------------function print_template($t,$echo=1){ global $templates, $udm_agent; global $first_doc, $last_doc, $found, $query_orig, $error, $self; global $nav, $wordinfo; global $url, $ue, $o, $cat; global $clones, $searchtime; global $title, $rating, $desc, $contype, $lastmod, $docsize, $ndoc; global $keyw, $text, $category; global $crc, $Randoms, $rec_id, $DEBUG; global $lang_url_translation, $phpver; $str=$templates["$t"][$o]; if ($str == '') $str=$templates["$t"][0]; $str=ereg_replace('\$f', "$first_doc", $str); $str=ereg_replace('\$l', "$last_doc", $str); $str=ereg_replace('\$t', "$found", $str); $str=ereg_replace('\$A', $self, $str); $str=ereg_replace('\$Q', HtmlSpecialChars(StripSlashes($query_orig)), $str); $str=ereg_replace('\$q', urlencode($query_orig), $str); $str=eregi_replace('\$UE', $ue, $str); $str=ereg_replace('\$E', $error, $str); $str=ereg_replace('\$W', $wordinfo, $str); $str=ereg_replace('\$V', $nav, $str); if ($lang_url_translation == 'yes') { $nolangurl = ereg_replace("\.[a-z]{2}\.[a-z]{2,4}$", "", $url); $str=ereg_replace('\$DU', $nolangurl, $str); } else { $str=ereg_replace('\$DU', $url, $str); } $str=ereg_replace('\$DT', $title, $str); $str=ereg_replace('\$DR', "$rating", $str); $str=ereg_replace('\$DX', $text, $str); $str=ereg_replace('\$DE', ($desc != '')?$desc:$text, $str); $str=ereg_replace('\$DC', $contype, $str); $str=ereg_replace('\$DM', $lastmod, $str); $str=ereg_replace('\$DS', "$docsize", $str); $str=ereg_replace('\$DN', "$ndoc", $str); $str=ereg_replace('\$DD', $desc, $str); $str=ereg_replace('\$DK', $keyw, $str); $str=ereg_replace('\$SearchTime', "$searchtime", $str); if ($phpver >= 40006) { if (ereg('\$CP',$str)) { if ($temp_cp_arr=Udm_Cat_Path($udm_agent,$cat)) { reset($temp_cp_arr); $temp_cp=''; for ($i=0; $i<count($temp_cp_arr); $i+=2) { $cp_path=$temp_cp_arr[$i]; $cp_name=$temp_cp_arr[$i+1]; $temp_cp .= " > <a href=\"$PHP_SELF?cat=$cp_path\">$cp_name</a> "; } $str=ereg_replace('\$CP', $temp_cp, $str); } else $str=ereg_replace('\$CP', '', $str); } if (ereg('\$CS',$str)) { if ($temp_cp_arr=Udm_Cat_List($udm_agent,$cat)) { reset($temp_cp_arr); $temp_cp=''; for ($i=0; $i<count($temp_cp_arr); $i+=2) { $cp_path=$temp_cp_arr[$i]; $cp_name=$temp_cp_arr[$i+1]; $temp_cp .= "<a href=\"$PHP_SELF?cat=$cp_path\">$cp_name</a><br>"; } $str=ereg_replace('\$CS', $temp_cp, $str); } else $str=ereg_replace('\$CS', '', $str); } if (ereg('\$DY',$str)) { if ($temp_cp_arr=Udm_Cat_Path($udm_agent,$category)) { reset($temp_cp_arr); $temp_cp=''; for ($i=0; $i<count($temp_cp_arr); $i+=2) { $cp_path=$temp_cp_arr[$i]; $cp_name=$temp_cp_arr[$i+1]; $temp_cp .= " > <a href=\"$PHP_SELF?cat=$cp_path\">$cp_name</a> "; } $str=ereg_replace('\$DY', $temp_cp, $str); } else $str=ereg_replace('\$DY', '', $str); } } else { $str=ereg_replace('\$CP', '', $str); $str=ereg_replace('\$CS', '', $str); $str=ereg_replace('\$DY', '', $str); } $sub=$str; while($sub=strstr($sub,'$r')){ $sub=substr($sub,2);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -