* (C) 1998-1999 by Vladas Lapinskas * Kir Kolyshkin * UdmSearch Developers Team * oracle7 support by Roman V. Petrov (poma@mail.ru) * * features: ispell support (db & text mode), * mysql , oracle (both v7 and v8) and postgresql SQL-backends * both in native and odbc modes support * crc-multi, crc, multi-dict and single-dict storage modes support */ require('config.inc'); require('init.inc'); require('common.inc'); require('crc32.inc'); require('template.inc'); require('db_func.inc'); require('ispell.inc'); require('parse.inc'); // ----------------------------------------------- // M A I N // ----------------------------------------------- init(); if ($q=='') { print_template('noquery'); print_template('bottom'); drop_temp_table(0); return; } initdb(); if (eregi('db',$ispellmode) || eregi('text',$ispellmode)) load_affix(); list($query_url_id,$query_url,$query_count_url_id)=last_parse($q); if (count($all_words) == 0) { print_template('notfound'); print_template('bottom'); drop_temp_table(0); return; } if (($dbtype == 'oracle')|| ($dbtype == 'oracle7') || ($dbtype == 'oracle8')) { if($DEBUG) echo $query_count_url_id,"

"; if (!($res2=query($query_count_url_id))) print_error_local('Query error: '.$query_count_url_id."\n
".db_error()); $row=fetch_row($res2); $found=$row[0]; free_result($res2); } if($DEBUG) echo $query_url_id,"

"; if (!($res=query($query_url_id))) print_error_local('Query error: '.$query_url_id."\n
".db_error()); $from=IntVal($np)*IntVal($ps); $to=IntVal($np+1)*IntVal($ps); if (($dbtype == 'mysql') || ($dbtype == 'pgsql') || ($dbtype == '')) { $found=db_numrows($res); } if($to>$found) $to=$found; if (($from+$ps)<$found) $isnext=1; $nav=make_nav($query_orig); if ($found>0) { print_template('restop'); } else { print_template('notfound'); print_template('bottom'); drop_temp_table(0); return; } $data_seek=db_data_seek($res,$from); if (! $data_seek) { print_template('notfound'); print_template('bottom'); drop_temp_table(0); return; } $url_id_array=array(); $rating_array=array(); for ($i=0; $i<$ps; $i++) { $row=fetch_row($res); if (!$row) break; $url_id_array[] = $row[0]; $rating_array[] = $row[1]; } free_result($res); drop_temp_table(1); $ndoc=$from+1; for ($i=0; $i
"; if (!($res=query($query))) print_error_local('Query error: '.$query."\n
".db_error()); $data=fetch_row($res); free_result($res); $url=$data[0]; $title=$data[1]; $title=($title) ? htmlspecialChars($title):'No title'; $text=ParseDocText(htmlspecialChars($data[2])); $contype=$data[3]; $docsize=$data[4]; $lastmod=$data[5]; $keyw=htmlspecialChars($data[6]); $desc=htmlspecialChars($data[7]); $crc=$data[8]; $rec_id=0+$data[9]; if ((ereg("^ftp://", $url)) && ($templates['ftpres'][0] != '')) { print_template('ftpres'); } elseif ((ereg("^https?://", $url)) && ($templates['httpres'][0] != '')) { print_template('httpres'); } else { print_template('res'); } $ndoc++; } print_template('resbot'); print_template('bottom'); if ($dbtype == 'oracle7') { Ora_Close($dbconn); // closing oracle7 cursor } ?>