<?php defined('ACCESS') OR die('No direct script access...');
/**
* Author - koder_alex
* ISQ - 669906617
* VK - https://vk.com/koder_alex
* It is forbidden to give, sell, modify.
*/
thead('Выбор собеседника');
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
if(!empty($_POST['q']))
{
$_POST['q'] = implode('+', explode(' ', system::check($_POST['q'])));
redirect('/mail/?act=write&q='.$_POST['q']);
}
else
redirect('/mail/?act=write');
}
//$sql = '';
if(is_numeric($config['q']['text']) === true)
$sql ="WHERE `id` = :search AND";
else
$sql ="WHERE `info_first_name` like :search AND";
?>
<div class="app-block">
<div class="app-search">
<form method="post" action="/mail/?act=write">
<table class="_row-table">
<tbody>
<tr>
<td class="_row-table-main"><input type="text" value="<?=$config['q']['text'] ?>"autocomplete="off" id="ma_search_field" name="q" class="app-search-input" placeholder="Введите ID или НИК пользователя.."></td>
<td class="_row-table-last"><input type="submit" class="_w-100 _dbl main-btn" value="Поиск"></td>
</tr>
</tbody>
</table>
</form>
</div>
<?
$k_post=DB::$pdo -> querySingle("SELECT COUNT(id) FROM `users` $sql `id` != :id", array(':search' => (is_numeric($config['q']['text']) === true ? $config['q']['text'] : '%' . $config['q']['text'] . '%'), ':id' => $user['id']));
$k_page = 0;
if (isset($_GET['p']) && $_GET['p'] != NULL && is_numeric($_GET['p']) && $_GET['p'] > 1)
{
$p = abs(intval($_GET['p']));
} else {
$p = 1;
}
if ($k_post > 10)
{
$pagination = new pagination(10, $k_post, $p);
$total_lin = $pagination -> limit;
$k_page= $pagination -> pages;
} else {
$total_lin = '';
}
if ($k_post)
{
$q = DB::$pdo -> query("SELECT id FROM `users` $sql `id` != :id ORDER BY `id` DESC $total_lin", array(':search' => (is_numeric($config['q']['text']) === true ? $config['q']['text'] : '%' . $config['q']['text'] . '%'), ':id' => $user['id']));
while($post = $q -> fetch())
{
$d = d_user($post['id'], true, 'ii_img');
if($config['q']['text'] !== false) {
$d['login'] = preg_replace('/' . $config['q']['text'] . '/i', '<em class="found">$0</em>', $d['login']);
}
?>
<div class="touch"><a href="/mail/?act=show&peer=<?= $d['id'] ?>" class="touch-cont"><div class="ii_body"><?= $d['avatar'] ?><span class="ii_owner"><?= $d['online']. $d['group'] . $d['login'] . $d['Medals'] ?></span></div></a></div>
<?
}
if ($k_page > 1)
str_vk('/mail/?act=write&' . ($config['q']['text'] ? 'q='.$config['q']['text'].'&' : ''), $k_page, $p);
}
else
show($config['q']['type'], 'null');