/[corp_html]/mnogo/init.inc
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /mnogo/init.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Wed Mar 27 16:00:18 2002 UTC (17 years, 1 month ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
*** empty log message ***

1 <?
2
3 $dict_table1 = array ('dict2', 'dict2', 'dict2', 'dict3',
4 'dict4', 'dict5', 'dict6', 'dict7',
5 'dict8', 'dict9', 'dict10','dict11',
6 'dict12','dict16','dict16','dict16',
7 'dict16','dict32');
8
9 $dict_table2 = array ('ndict2', 'ndict2', 'ndict2', 'ndict3',
10 'ndict4', 'ndict5', 'ndict6', 'ndict7',
11 'ndict8', 'ndict9', 'ndict10','ndict11',
12 'ndict12','ndict16','ndict16','ndict16',
13 'ndict16','ndict32');
14
15 $self=$PHP_SELF;
16
17 if ($ps=="") $ps=20;
18 if ($np=="") $np=0;
19 if ($o=="") $o=0;
20
21 if (($dt!='back') && ($dt!='er') && ($dt!='range')) $dt='back';
22 if ($dp=="") $dp=0;
23 if (($dx!=0) && ($dx!=-1) && ($dx!=1)) $dx=0;
24 if ($dy<1970) $dy=1970;
25 if (($dm<0) || ($dm>11)) $dm=0;
26 if (($dd<=0) || ($dd>31)) $dd="01";
27
28 $db=urldecode($db);
29 $de=urldecode($de);
30
31 if ($db=="") $db='01/01/1970';
32 if ($de=="") $de='31/12/2020';
33
34 if ($hlbeg=="") $hlbeg='<b>';
35 if ($hlend=="") $hlend='</b>';
36
37 if (isset($q)) $q=urldecode($q);
38 $ul=urldecode($ul);
39 $ue=urldecode($ue);
40 $tag=urldecode($t);
41 $lang=urldecode($lang);
42
43 if (isset($q)) $have_query_flag=1;
44 else $have_query_flag=0;
45
46 $query_orig=$q;
47
48 if (isset($CHARSET_SAVED_QUERY_STRING)) {
49 $q_local=urldecode($CHARSET_SAVED_QUERY_STRING);
50 if (preg_match('/q=([^&]*)\&/',$q_local,$param)) {
51 $q_local=urlencode($param[1]);
52 } elseif (preg_match('/q=(.*)$/',$q_local,$param)) {
53 $q_local=urlencode($param[1]);
54 } else {
55 $q_local=urlencode($q);
56 }
57 } else {
58 $q_local=urlencode($q);
59 }
60
61 $ul_local=urlencode($ul);
62 $ue_local=urlencode($ue);
63 $t_local=urlencode($tag);
64 $db_local=urlencode($db);
65 $de_local=urlencode($de);
66 $lang_local=urlencode($lang);
67
68 $timestr='';
69 $uestr=($ue=="")?"":" AND url.url NOT LIKE '%$ue%' ";
70 $ulstr=($ul=="")?"":" AND url.url LIKE '%$ul%' ";
71 $langstr=($lang=="")?"":" AND url.lang = '$lang' ";
72
73 if ($m == 'and') $DEFAULT_QUERY_TYPE='and';
74 if ($m == 'or') $DEFAULT_QUERY_TYPE='or';
75
76 if (($MAX_NP > 0) && ($np>$MAX_NP)) $np=$MAX_NP;
77 if (($MAX_PS > 0) && ($ps>$MAX_PS)) $ps=$MAX_PS;
78
79 $clones='yes';
80
81 if ($LC_CTYPE != '') {
82 setlocale("LC_ALL",$LC_CTYPE);
83 } elseif ($LC_ALL != '') {
84 setlocale("LC_ALL",$LC_ALL);
85 } elseif ($LANG != '') {
86 setlocale("LC_ALL",$LANG);
87 }
88
89 // -----------------------------------------------
90 // init()
91 // -----------------------------------------------
92 function init(){
93 global $q;
94 global $tag, $tagstr;
95 global $cat, $catstr, $cs, $cp;
96 global $trackquery;
97 global $rus_bool_lang;
98 global $have_query_flag;
99 global $lang_content_negotiation, $lang_url_translation;
100 global $soundex, $soundex_words;
101 global $highlight_stopwords;
102
103 global $stopword_arr;
104 global $cp_arr;
105
106 global $dict_table;
107 global $dict_table1;
108 global $dict_table2;
109
110 global $dbaddr;
111 global $dbodbc,$dbodbc_cursor_type;
112 global $dbhost,$dbuser,$dbpass,$dbname,$dbport,$dbtype,$dbmode;
113
114 global $db_format;
115 global $last_mod_field, $crc_field;
116
117 global $timestr, $dt, $dp, $dx, $dm, $dd, $dy, $db, $de;
118 global $micro_start, $start_time;
119
120 $micro_start=get_micro_time();
121 $start_time=time();
122
123 srand((double)microtime()*1000000);
124
125 $stopword_arr=array();
126 $cp_arr=array();
127 $soundex_words=array();
128
129 read_template();
130
131 $trackquery=strtolower($trackquery);
132 if (($trackquery != 'no') && ($trackquery != 'yes')) $trackquery = 'no';
133
134 $rus_bool_lang=strtolower($rus_bool_lang);
135 if (($rus_bool_lang != 'no') && ($rus_bool_lang != 'yes')) $rus_bool_lang = 'no';
136
137 $lang_content_negotiation=strtolower($lang_content_negotiation);
138 if (($lang_content_negotiation != 'no') && ($lang_content_negotiation != 'yes')) $lang_content_negotiation = 'no';
139
140 $soundex=strtolower($soundex);
141 if (($soundex != 'no') && ($soundex != 'yes')) $soundex = 'no';
142
143 $highlight_stopwords=strtolower($highlight_stopwords);
144 if (($highlight_stopwords != 'no') && ($highlight_stopwords != 'yes')) $highlight_stopwords = 'no';
145
146 $lang_url_translation=strtolower($lang_url_translation);
147 if (($lang_url_translation != 'no') && ($lang_url_translation != 'yes')) $lang_url_translation = 'no';
148
149 if (($db_format != '3.0') &&
150 ($db_format != '3.1')) $db_format = '3.0';
151
152 $last_mod_field='url.last_modified';
153 if ($db_format == '3.1') $last_mod_field='url.last_mod_time';
154
155 $crc_field='url.crc';
156 if ($db_format == '3.1') $crc_field='url.crc32';
157
158 if ($db_format == '3.1') {
159 $tagstr=($tag=="")?"":"AND url.tag LIKE '$tag'";
160 $catstr=($cat=="")?"":"AND url.category LIKE '$cat%'";
161 } else {
162 $tagstr=($tag=="")?"":"AND url.tag=$tag";
163 }
164
165 if (preg_match("/^([^:]+):(.*)\/([^\/]+)\/?$/",$dbaddr,$param)) {
166 $dbtype=$param[1];
167 $dbname=$param[3];
168 $temp=$param[2];
169
170 if (preg_match("/^\/\/([^:]+):?(.*)\@([^:]*):?(.*)$/",$temp,$param)) {
171 $dbuser=$param[1];
172 if ($param[2]) $dbpass=$param[2];
173 $dbhost=$param[3];
174 if ($param[4]) $dbport=$param[4];
175 }
176 }
177
178 if (preg_match("/^(.*)-odbc$/i",$dbtype,$param)) {
179 $dbodbc=1;
180 $dbtype=$param[1];
181 } else {
182 $dbodbc=0;
183 }
184
185 if ($dbmode == 'multi') $dict_table=$dict_table1;
186 if ($dbmode == 'crc-multi') $dict_table=$dict_table2;
187
188 if ($have_query_flag) $q=ParseQ($q);
189
190 if ($db_format == '3.1') {
191 if (($dt == 'back') && ($dp != '0')) {
192 $recent_time=format_dp($dp);
193 if ($recent_time != 0) {
194 $timestr = "AND $last_mod_field >= ".(time()-$recent_time);
195 }
196 } elseif ($dt=='er') {
197 $recent_time=mktime(0,0,0,($dm+1),$dd,$dy);
198 if ($dx == -1) {
199 $timestr = "AND $last_mod_field <= $recent_time ";
200 } elseif ($dx == 1) {
201 $timestr = "AND $last_mod_field >= $recent_time ";
202 }
203 } elseif ($dt=='range') {
204 $begin_time=format_userdate($db);
205 if ($begin_time) $timestr .= "AND $last_mod_field >= $begin_time ";
206
207 $end_time=format_userdate($de);
208 if ($end_time) $timestr .= "AND $last_mod_field <= $end_time ";
209 }
210 }
211
212 db_init($dbtype,$dbname,$dbhost,$dbuser,$dbpass,$dbport,$dbodbc,$dbodbc_cursor_type);
213
214 if ($db_format == '3.1') {
215 $cs=load_cs($cat);
216 $cp=load_cp($cat);
217 }
218
219 print_template('top');
220 flush();
221 }
222
223 ?>

  ViewVC Help
Powered by ViewVC 1.1.26