Файл: forum/search.php
Строк: 115
<?
include_once '../sys/includes/start.php';
include_once '../sys/includes/compress.php';
include_once '../sys/includes/sess.php';
include_once '../sys/includes/home.php';
include_once '../sys/includes/settings.php';
include_once '../sys/includes/db_connect.php';
include_once '../sys/includes/ipua.php';
include_once '../sys/includes/fnc.php';
include_once '../sys/includes/user.php';
$searched=&$_SESSION['searched'];
if (!isset($searched) || isset($_GET['newsearch']) || isset($_GET['null']))
{
$searched['in']=array('m'=>null);
$searched['text']=null;
$searched['query']=null;
$searched['sql_query']=null;
$searched['result']=array();
$searched['mark']=array();
}
if (isset($_GET['newsearch']))
{
include 'inc/search_act.php';
}
$set['title']='Форум - поиск';
include_once '../sys/includes/header.php';
title();
auter();
if (isset($_GET['newsearch']))
{
if (count($searched['result'])!=0)
msg('По запросу "'.htmlentities($searched['text'], ENT_QUOTES, 'UTF-8').'" найдено совпадений:'.count($searched['result']));
elseif(!isset($err))
msg('По запросу "'.htmlentities($searched['text'], ENT_QUOTES, 'UTF-8').'" ничего не найдено');
}
$res=$searched['result'];
if (count($res)!=0)
{
$k_post=count($res);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$end=min($set['p_str']*$page,$k_post);
for($i=$start;$i<$end;$i++)
{
$them=$res[$i];
echo "<table style='width:100%' cellspacing='1' cellpadding='1'><tr>";
if ($set['set_show_icon']==2)
{
echo "<td class='icon48' rowspan='2'>";
echo "<img src='/s-klub/img/big/them_$them[up]$them[close].png' />";
echo "</td>";
}
else if ($set['set_show_icon']==1)
{
echo "<td class='icon14'>";
echo "<img src='/s-klub/img/them_$them[up]$them[close].png' alt='' />";
echo "</td>";
}
echo "<td class='p_t'>";
echo "<a href='/forum/$them[id_forum]/$them[id_razdel]/$them[id]/'>$them[name]</a> <a href='/forum/$them[id_forum]/$them[id_razdel]/$them[id]/?page=end'>(".mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_p` WHERE `id_them` = '$them[id]'"),0).")</a>n";
echo "</td>";
echo "</tr>";
echo "<tr>";
if ($set['set_show_icon']==1)
{
echo "<td class='p_m' colspan='2'>";
}else{
echo "<td class='p_m'>";
}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_p` WHERE `id_them` = '$them[id]'"),0)==$them['k_post'])
{
$post1=mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_p` WHERE `id_them` = '$them[id]' ORDER BY `time` ASC LIMIT 1"));
$ank=get_user($post1['id_user']);
echo "<img src='/s-klub/img/who.png'> Автор: <a href='/info.php?id=$ank[id]' title='Анкета "$ank[nick]"'>";
echo GradientText("$ank[nick]", "$ank[ncolor]", "$ank[ncolor2]");
echo "</a> ".online($ank['id'])." (".vremja($them['time_create']).")<br />";
$post2=mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_p` WHERE `id_them` = '$them[id]' ORDER BY `time` DESC LIMIT 1"));
$ank2=get_user($post2['id_user']);
echo "<img src='/s-klub/img/time.png'> Посл.: <a href='/info.php?id=$ank2[id]' title='Анкета "$ank2[nick]"'>";
echo GradientText("$ank2[nick]", "$ank2[ncolor]", "$ank2[ncolor2]");
echo "</a> ".online($ank2['id'])." (".vremja($post2['time']).")<br />";
}else{
echo esc(br(bbcode(preg_replace($searched['mark'], "<span class='search_cit'>\1</span>",htmlentities($them['msg'], ENT_QUOTES, 'UTF-8')))))."<br />";
echo "Всего совпадений: $them[k_post]<br />";
}
echo "</td>";
echo "</tr></table>";
}
if ($k_page>1)
{
str('?',$k_page,$page);
}
}else{
include 'inc/search_form.php';
}
if (count($searched['result'])!=0)
{
echo "<a href='?null=$passgen'><div class='foot'>";
echo "<img src='/s-klub/img/search.png'> Новый поиск<br />";
echo "</div></a>";
}
echo "<a href='index.php'><div class='foot'>";
echo "<img src='/s-klub/img/left.png'> Форум<br />";
echo "</div></a>";
include_once '../sys/includes/footer.php';
?>