Файл: feed/search.php
Строк: 122
<?php
require_once '../incfiles/core.php';
require_once '../incfiles/func.php';
require_once '../incfiles/auth.php';
require_once '../incfiles/user.php';
if (empty($user_id)) {go(URL.'/');}
$title = lang('Мои Новости','Мої Новини');
require_once '../incfiles/head.php';
if (!empty($_REQUEST['search']) && mb_strlen(check($_REQUEST['search']))>2) $search = substr(check($_REQUEST['search']),0,100);
?>
<script type="text/javascript">
$(function(){
$('#form').on('submit', function(e){
Page.Loading('start');
e.preventDefault();
var $that = $(this),
formData = new FormData($that.get(0));
$.ajax({
url: $that.attr('action'),
type: $that.attr('method'),
contentType: false,
processData: false,
data: formData,
success: function(response){
if(response){
$('.content').html(response);
}
Page.Loading('stop');
}
});
});
});
</script>
<?
echo '<div class="title for_pc">
<a href="'.URL.'/feed/" onclick="Page.Go(this.href); return false;">Записи</a>
<a href="'.URL.'/feed/photos.php" onclick="Page.Go(this.href); return false;">Фото</a>
<a href="'.URL.'/feed/update.php" onclick="Page.Go(this.href); return false;">'.lang('Обновления','Оновлення').'</a>
<a href="'.URL.'/feed/groups.php" onclick="Page.Go(this.href); return false;">'.lang('Сообщества','Спільноти').'</a>
<a class="title_a_hover" href="'.URL.'/feed/search.php" onclick="Page.Go(this.href); return false;">'.lang('Поиск','Пошук').'</a>
</div>
';
?>
<html>
<head>
<script type="text/javascript">
function Menu(id)
{
var menu = document.getElementById('menu_' + id).style;
if (menu.display == 'none')
{
menu.display = 'block';
}
else
{
menu.display = 'none';
}
}
</script>
</head>
</body>
</html>
<div class="block for_mobile"><a class=" " li onclick="javascript:Menu('1')"><? echo'<img src="'.URL.'/design/img/filter.jpg" width="25" height="25" alt="filter news"/> '.lang('Фильтр новостей','Фільтр новин').''; ?></li/></div>
</a>
<ul id="menu_1" style="display:none;" >
<div class="content_block for_mobile">
<?echo'
<a href="'.URL.'/feed/" onclick="Page.Go(this.href); return false"><li><img src="'.URL.'/design/img/menu/feed.png"/>'.lang('Записи','Записи').'</li></a>
<a href="'.URL.'/feed/photos.php" onclick="Page.Go(this.href); return false"><li><img src="'.URL.'/design/img/menu/photo.png"/>'.lang('Фото','Фото').'</li></a>
<a href="'.URL.'/feed/update.php" onclick="Page.Go(this.href); return false"><li><img src="'.URL.'/design/img/menu/users.png"/>'.lang('Обновления','Оновлення').'</li></a>
<a href="'.URL.'/feed/groups.php" onclick="Page.Go(this.href); return false"><li><img src="'.URL.'/design/img/menu/groups.png"/>'.lang('Сообщества','Спільноти').'</li></a>
<a href="'.URL.'/feed/search.php" onclick="Page.Go(this.href); return false"><li><img src="'.URL.'/design/img/menu/journal.png"/>'.lang('Поиск','Пошук').' ✔</li></a>
';
?>
</div>
</ul></div>
<?php
echo'
<div class="block2">
<form id="form" action="'.URL.'/feed/search.php" method="post">
<input class="input2" style="width:70%" type="text" name="search" value="'.$search.'"/>
<input class="button2" type="submit" value="'.lang('Поиск','Пошук').'"/>
</form>
</div>';
if(!empty($search))
{
$all = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `wall` WHERE `text` LIKE '%".$search."%'"),0);
if ($all > 0)
{
$cp = ceil($all/10);
$p = (isset($_GET['p']) and is_numeric($_GET['p']) and $_GET['p']>1 and $_GET['p']<=$cp) ? $_GET['p'] : 1;
$start = $p*10-10;
$res = mysql_query("SELECT * FROM `wall` WHERE `text` LIKE '%".$search."%' ORDER by `time` DESC LIMIT $start,10");
while ($arr = mysql_fetch_array($res))
{
echo wall_post($arr,0,$search);
}
navi($p,$cp,'/feed/search.php?');
}
else echo '<div class="block">'.lang('По Вашему запросу ничего не найдено','За Вашим запитом нічого не знайдено').'</div>';
}
else
{
$all = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `wall` WHERE `type` = 'post'"),0);
if ($all > 0)
{
$cp = ceil($all/10);
$p = (isset($_GET['p']) and is_numeric($_GET['p']) and $_GET['p']>1 and $_GET['p']<=$cp) ? $_GET['p'] : 1;
$start = $p*10-10;
$res = mysql_query("SELECT * FROM `wall` WHERE `type` = 'post' ORDER by `time` DESC LIMIT $start,10");
while ($arr = mysql_fetch_array($res))
{
echo wall_post($arr);
}
navi($p,$cp,'/feed/search.php?'.(!empty($search)?$search.'&':''));
}
else echo '<div class="block">'.lang('По Вашему запросу ничего не найдено','За Вашим запитом нічого не знайдено').'</div>';
}
require_once '../incfiles/foot.php';
?>