Файл: forum/search.php
Строк: 91
<?php
require_once '../sys/inc/start.php';
require_once '../sys/inc/compress.php';
require_once '../sys/inc/sess.php';
require_once '../sys/inc/settings.php';
require_once '../sys/inc/db_connect.php';
require_once '../sys/inc/ipua.php';
require_once '../sys/inc/fnc.php';
require_once '../sys/inc/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'] = "Форум - поиск";
require_once '../sys/inc/thead.php';
err();
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') . '" ничего не найдено');
}
}
aut();
$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 class = 'foot'><tr><td class = 'null'>";
echo "<img src = '/style/icons/them_$them[up]$them[close].png' /> <a href = '/forum/$them[id_forum]/$them[id_razdel]/$them[id]/'>$them[name]</a> ";
echo "<span class = 'count1'>";
echo "<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>";
echo "</span><br />";
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']);
$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 = '/style/icons/xfn.png' /> Автор: ";
echo "<a href = '/info.php?id=$ank[id]'>n";
echo text::gradient("$ank[nick] ", "$ank[ncolor]", "$ank[ncolor2]");
echo "</a> | ";
echo "<a href = '/info.php?id=$ank2[id]'>n";
echo text::gradient("$ank2[nick] ", "$ank2[ncolor]", "$ank2[ncolor2]");
echo "</a><br />";
echo "<img src = '/style/icons/time.png' /> " . vremja($them['time_create']) . " ";
echo " | ";
echo vremja($post2['time']) . "<br />";
} else {
echo text::esc(text::br(text::bbcode(preg_replace($searched['mark'], "<span class = ''>\1</span>", htmlentities($them['msg'], ENT_QUOTES, 'UTF-8'))))) . "" . BR;
css::open_teg('div', 'foots');
echo "Всего совпадений: $them[k_post]";
css::close_teg('div');
}
echo "</td></tr></table>";
}
#Вывод страниц
if ($k_page > 1) {
str('?', $k_page, $page);
}
} else {
include 'inc/search_form.php';
}
if (count($searched['result']) != 0) {
echo "<div class = 'foot'>";
echo "<img src = '/style/icons/zoom.png' /> <a href = '?null=$passgen'>Новый поиск</a>";
echo "</div>";
}
require_once '../sys/inc/tfoot.php';