систем open slaed 1.2
Весь код модуля...
<?php
# Copyright © 2005 - 2008 SLAED
# Website:
http://www.slaed.net
if (!defined(&
quot;MODULE_FILE&
quot;)) {
Header(&
quot;Location: ../../index.php&
quot;);
exit;
}
get_lang($conf['name']);
function search_result() {
global $prefix, $db, $pagetitle, $admin_file, $conf, $confu;
$word = ($_POST['word']) ? text_filter($_POST['word']) : text_filter($_GET['word']);
$mod = ($_POST['mod']) ? text_filter($_POST['mod']) : text_filter($_GET['mod']);
$mod = ($mod) ? $mod : 0;
$num = isset($_GET['num']) ? intval($_GET['num']) : &
quot;1&
quot;;
$display = ($conf['display']) ? &
quot;&
quot; : &
quot;style=\&
quot;display:none;\&
quot;&
quot;;
$navi = &
quot;<img src=\&
quot;&
quot;.img_find(&
quot;misc/navi&
quot;).&
quot;\&
quot; border=\&
quot;0\&
quot;>&
quot;;
$search = explode(&
quot;,&
quot;, $conf['search']);
$pagetitle = ($word) ? &
quot;&
quot;.$conf['defis'].&
quot; &
quot;._SEARCH.&
quot; &
quot;.$conf['defis'].&
quot; $word&
quot; : &
quot;&
quot;.$conf['defis'].&
quot; &
quot;._SEARCH.&
quot;&
quot;;
$lang = array(_FILES, _NEWS);
$m = 0;
$sel = &
quot;&
quot;;
foreach ($search as $val) {
if (is_active($val) && $val != &
quot;&
quot;) {
$sel = ($val == $mod && $mod != &
quot;&
quot;) ? &
quot;selected&
quot; : &
quot;&
quot;;
$modcont .= &
quot;<option value=\&
quot;$val\&
quot; $sel>&
quot;.$lang[$m].&
quot;</option>&
quot;;
}
$m++;
}
$stop = ($word && strlen($word) < $conf['searchlet']) ? &
quot;&
quot;._SEARCHLETMIN.&
quot;: &
quot;.$conf['searchlet'].&
quot;&
quot; : &
quot;&
quot;;
head();
title(&
quot;&
quot;._SEARCH.&
quot;&
quot;);
open();
echo &
quot;<table align=\&
quot;center\&
quot;><form action=\&
quot;index.php?name=&
quot;.$conf['name'].&
quot;\&
quot; method=\&
quot;post\&
quot;><tr>&
quot;
.&
quot;<td align=\&
quot;center\&
quot;><img src=\&
quot;&
quot;.img_find(&
quot;all/search&
quot;).&
quot;\&
quot; alt=\&
quot;&
quot;._SEARCH.&
quot;\&
quot; title=\&
quot;&
quot;._SEARCH.&
quot;\&
quot;></td>&
quot;
.&
quot;<td align=\&
quot;center\&
quot;><select name=\&
quot;mod\&
quot; class=\&
quot;&
quot;.$conf['style'].&
quot;\&
quot;><option value=\&
quot;\&
quot;>&
quot;._SEARCHALL.&
quot;</option>&
quot;.$modcont.&
quot;</select></td>&
quot;
.&
quot;<td align=\&
quot;center\&
quot;><input type=\&
quot;text\&
quot; name=\&
quot;word\&
quot; value=\&
quot;$word\&
quot; size=\&
quot;25\&
quot; maxlength=\&
quot;100\&
quot; class=\&
quot;&
quot;.$conf['style'].&
quot;\&
quot;></td>&
quot;
.&
quot;<td align=\&
quot;center\&
quot;><input type=\&
quot;submit\&
quot; title=\&
quot;&
quot;._SEARCH.&
quot;\&
quot; value=\&
quot;&
quot;._SEARCH.&
quot;\&
quot; class=\&
quot;fbutton\&
quot;></td>&
quot;
.&
quot;</tr></form></table>&
quot;;
close();
if (!$stop && $word) {
foreach ($search as $val) {
if ((!$mod || $mod == $val) && is_active($val) && $val != &
quot;&
quot;) {
if ($val == &
quot;files&
quot;) {
$result = $db->sql_query(&
quot;SELECT f.lid, f.name, f.title, f.description, f. bodytext, f.date, f.homepage, c.id, c.title, u.user_name FROM &
quot;.$prefix.&
quot;_files AS f LEFT JOIN &
quot;.$prefix.&
quot;_categories AS c ON (f.cid=c.id) LEFT JOIN &
quot;.$prefix.&
quot;_users AS u ON (f.uid=u.user_id) WHERE date <= now() AND status!='0' AND (f.title LIKE '%&
quot;.$word.&
quot;%' OR f.description LIKE '%&
quot;.$word.&
quot;%') ORDER BY date DESC&
quot;);
while (list($id, $uname, $title, $hometext, $bodytext, $date, $link, $cid, $ctitle, $user_name) = $db->sql_fetchrow($result)) {
$atitle = &
quot;<a href=\&
quot;index.php?name=$val&op=view&id=$id&word=&
quot;.urlencode($word).&
quot;\&
quot; title=\&
quot;$title\&
quot;>&
quot;.search_color($title, $word).&
quot;</a>&
quot;;
$description = ($bodytext) ? &
quot;&
quot;.$hometext.&
quot;<br /><br />&
quot;.$bodytext.&
quot;&
quot; : $hometext;
$aimg = &
quot;<span id=\&
quot;cont\&
quot;><img src=\&
quot;&
quot;.img_find(&
quot;all/plus&
quot;).&
quot;\&
quot; border=\&
quot;0\&
quot; align=\&
quot;center\&
quot; alt=\&
quot;&
quot;._READMORE.&
quot;\&
quot; title=\&
quot;&
quot;._READMORE.&
quot;\&
quot; id=\&
quot;menu&
quot;.$a.&
quot;\&
quot; OnClick=\&
quot;SwitchMenu('sub&
quot;.$a.&
quot;')\&
quot; style=\&
quot;cursor:pointer;\&
quot;></span>&
quot;;
$ahref = &
quot;<a href=\&
quot;index.php?name=$val&op=view&id=$id&word=&
quot;.urlencode($word).&
quot;\&
quot; target=\&
quot;_blank\&
quot; title=\&
quot;&
quot;._WINDOWNEW.&
quot;\&
quot;><img src=\&
quot;&
quot;.img_find(&
quot;all/content&
quot;).&
quot;\&
quot; border=\&
quot;0\&
quot; align=\&
quot;center\&
quot; alt=\&
quot;&
quot;._WINDOWNEW.&
quot;\&
quot;></a>&
quot;;
$text = &
quot;<div id=\&
quot;sub&
quot;.$a.&
quot;\&
quot; $display>&
quot;.search_color(bb_decode($description, $val), $word).&
quot;</div>&
quot;;
$tdate = &
quot;&
quot;._DATE.&
quot;: &
quot;.format_time($date).&
quot;&
quot;;
$tmodul = &
quot;&
quot;._MODUL.&
quot;: <a href=\&
quot;index.php?name=$val\&
quot; title=\&
quot;&
quot;.$lang[2].&
quot;\&
quot;>&
quot;.$lang[2].&
quot;</a>&
quot;;
$ctitle = (!$ctitle) ? &
quot;&
quot;._CATEGORY.&
quot;: &
quot;._NO.&
quot;&
quot; : &
quot;&
quot;._CATEGORY.&
quot;: <a href=\&
quot;index.php?name=$val&cat=$cid\&
quot; title=\&
quot;&
quot;.$ctitle.&
quot;\&
quot;>&
quot;.cutstr($ctitle, 15).&
quot;</a>&
quot;;
$author = ($user_name) ? &
quot;&
quot;._POSTEDBY.&
quot;: &
quot;.user_info($user_name, 1).&
quot;&
quot; : (($uname) ? &
quot;&
quot;._POSTEDBY.&
quot;: &
quot;.$uname.&
quot;&
quot; : &
quot;&
quot;._POSTEDBY.&
quot;: &
quot;.$confu['anonym'].&
quot;&
quot;);
$link = ($link) ? &
quot;&
quot;._SITEURL.&
quot;: <a href=\&
quot;index.php?name=$val&op=view&id=$id\&
quot; target=\&
quot;_blank\&
quot; title=\&
quot;&
quot;.$title.&
quot;\&
quot;>&
quot;.search_color(str_replace(array(&
quot;http://&
quot;, &
quot;www.&
quot;), &
quot;&
quot;, $link), $word).&
quot;</a>&
quot; : &
quot;&
quot;;
$edit = (is_moder($val)) ? &
quot;&
quot;.ad_edit(&
quot;&
quot;.$admin_file.&
quot;.php?op=files_add&id=&
quot;.$id.&
quot;&
quot;).&
quot;&
quot; : &
quot;&
quot;;
$conts[] = array($id, $atitle, $aimg, $ahref, $edit, $text, $tdate, $tmodul, $ctitle, $author, $link);
$a++;
}
} elseif ($val == &
quot;news&
quot;) {
$result = $db->sql_query(&
quot;SELECT s.sid, s.name, s.title, s.time, s.hometext, s.bodytext, c.id, c.title, u.user_name FROM &
quot;.$prefix.&
quot;_stories AS s LEFT JOIN &
quot;.$prefix.&
quot;_categories AS c ON (s.catid=c.id) LEFT JOIN &
quot;.$prefix.&
quot;_users AS u ON (s.uid=u.user_id) WHERE time <= now() AND status!='0' AND (s.title LIKE '%&
quot;.$word.&
quot;%' OR s.hometext LIKE '%&
quot;.$word.&
quot;%' OR s.bodytext LIKE '%&
quot;.$word.&
quot;%') ORDER BY time DESC&
quot;);
while (list($id, $uname, $title, $date, $hometext, $bodytext, $cid, $ctitle, $user_name) = $db->sql_fetchrow($result)) {
$atitle = &
quot;<a href=\&
quot;index.php?name=$val&op=view&id=$id&word=&
quot;.urlencode($word).&
quot;\&
quot; title=\&
quot;$title\&
quot;>&
quot;.search_color($title, $word).&
quot;</a>&
quot;;
$description = ($bodytext) ? &
quot;&
quot;.$hometext.&
quot;<br /><br />&
quot;.$bodytext.&
quot;&
quot; : $hometext;
$aimg = &
quot;<span id=\&
quot;cont\&
quot;><img src=\&
quot;&
quot;.img_find(&
quot;all/plus&
quot;).&
quot;\&
quot; border=\&
quot;0\&
quot; align=\&
quot;center\&
quot; alt=\&
quot;&
quot;._READMORE.&
quot;\&
quot; title=\&
quot;&
quot;._READMORE.&
quot;\&
quot; id=\&
quot;menu&
quot;.$a.&
quot;\&
quot; OnClick=\&
quot;SwitchMenu('sub&
quot;.$a.&
quot;')\&
quot; style=\&
quot;cursor:pointer;\&
quot;></span>&
quot;;
$ahref = &
quot;<a href=\&
quot;index.php?name=$val&op=view&id=$id&word=&
quot;.urlencode($word).&
quot;\&
quot; target=\&
quot;_blank\&
quot; title=\&
quot;&
quot;._WINDOWNEW.&
quot;\&
quot;><img src=\&
quot;&
quot;.img_find(&
quot;all/content&
quot;).&
quot;\&
quot; border=\&
quot;0\&
quot; align=\&
quot;center\&
quot; alt=\&
quot;&
quot;._WINDOWNEW.&
quot;\&
quot;></a>&
quot;;
$text = &
quot;<div id=\&
quot;sub&
quot;.$a.&
quot;\&
quot; $display>&
quot;.search_color(bb_decode($description, $val), $word).&
quot;</div>&
quot;;
$tdate = &
quot;&
quot;._DATE.&
quot;: &
quot;.format_time($date).&
quot;&
quot;;
$tmodul = &
quot;&
quot;._MODUL.&
quot;: <a href=\&
quot;index.php?name=$val\&
quot; title=\&
quot;&
quot;.$lang[6].&
quot;\&
quot;>&
quot;.$lang[6].&
quot;</a>&
quot;;
$ctitle = (!$ctitle) ? &
quot;&
quot;._CATEGORY.&
quot;: &
quot;._NO.&
quot;&
quot; : &
quot;&
quot;._CATEGORY.&
quot;: <a href=\&
quot;index.php?name=$val&cat=$cid\&
quot; title=\&
quot;&
quot;.$ctitle.&
quot;\&
quot;>&
quot;.cutstr($ctitle, 15).&
quot;</a>&
quot;;
$author = ($user_name) ? &
quot;&
quot;._POSTEDBY.&
quot;: &
quot;.user_info($user_name, 1).&
quot;&
quot; : (($uname) ? &
quot;&
quot;._POSTEDBY.&
quot;: &
quot;.$uname.&
quot;&
quot; : &
quot;&
quot;._POSTEDBY.&
quot;: &
quot;.$confu['anonym'].&
quot;&
quot;);
$edit = (is_moder($val)) ? &
quot;&
quot;.ad_edit(&
quot;&
quot;.$admin_file.&
quot;.php?op=news_add&id=&
quot;.$id.&
quot;&
quot;).&
quot;&
quot; : &
quot;&
quot;;
$conts[] = array($id, $atitle, $aimg, $ahref, $edit, $text, $tdate, $tmodul, $ctitle, $author, &
quot;&
quot;);
$a++;
}
}
}
}
$offset = ($num - 1) * $conf['searchnum'];
$tnum = ($offset) ? $conf['searchnum'] + $offset : $conf['searchnum'];
for ($i = $offset; $i < $tnum; $i++) {
if ($conts[$i] != &
quot;&
quot;) basic($conts[$i][0], $conts[$i][1], $conts[$i][2], $conts[$i][3], $conts[$i][4], $conts[$i][5], $conts[$i][6], $conts[$i][7], $conts[$i][8], $conts[$i][9], $conts[$i][10]);
}
if (!$a) warning(&
quot;&
quot;._NOMATCHES.&
quot;&
quot;, &
quot;&
quot;, &
quot;&
quot;, 1);
$numpages = ceil($a / $conf['searchnum']);
num_page($conf['name'], $a, $numpages, $conf['searchnum'], &
quot;mod=$mod&word=&
quot;.urlencode($word).&
quot;&&
quot;);
} else {
if ($stop) {
$winfo = $stop;
$typ = &
quot;1&
quot;;
} else {
$winfo = &
quot;&
quot;._SEARCHINFO.&
quot;&
quot;;
$typ = &
quot;2&
quot;;
}
warning($winfo, &
quot;&
quot;, &
quot;&
quot;, $typ);
}
if ($a >= 10) get_page($conf['name']);
foot();
}
switch($op) {
default:
search_result();
break;
}
?>