Вход Регистрация
Файл: public_html/modules/library/search.php
Строк: 79
<?php
/**********************************
*    @package: PerfCMS              *
*    @year: 2012                      *
*    @author: Artas                  *
*    @link: http://perfcms.net     *
* ------------------------------- *
*    @package: PerfCMS Ultra          *
*    @year: 2013                      *
*   @author: wanya26ua & Tesla    *
*   @link: http://perfclub.ru     *
**********************************/

$title $lang->word('search');
require_once(
SYS .'/view/header.php');
if(isset(
$_GET['q']) && mb_strlen($_GET['q']) >= && $_GET['act'] == 'title') {
    
$search_r $db->query("SELECT * FROM `library` WHERE `title` LIKE '%".input($_GET['q'])."%'")->rowCount();
    
$tpl->div('title'$lang->word('search'));
    
$tpl->div('menu'''.$lang->word('search').': <b>'.$search_r.'</b>');
    
$pages = new Paginator($search_r$ames);
    if(
$search_r == 0) { 
        
$tpl->div('menu'$lang->word('search_none'));
    } else {
        
$search_q $db->query("SELECT * FROM `library` WHERE `title` LIKE '%".input($_GET['q'])."%' LIMIT $start$ames");
        while(
$search $search_q->fetch()) {
            
$search['name'] = str_replace(input($_GET['q']), '<b>'.input($_GET['q']).'</b>'$search['title']);
            echo 
'<div class="post">
            <a href="/library/article/'
.$search['id'].'/"><b>'.$search['title'].'</b></a><br/>
                        '
.mb_substr($search['text'], 0200).'...<br/>
                        <a href="/library/'
.$search['id'].'/comments/">'$lang->word('comments').' ['.$db->query("SELECT * FROM `library_comms` WHERE `id_note` = '".$search['id']."' ")->rowCount().']</a>
                </div>'
;
        }
    
$pages->view('/library/search/?q='.input($_GET['q']).'&act=title&');
    }
$tpl->div('block',  NAV .' <a href="/library/search">'.$lang->word('search').'</a><br/>'.NAV .' <a href="/library/">'.$lang->word('library').'</a><br/>'HICO .'<a href="/">'$lang->word('home') .'</a>');

require_once(
SYS .'/view/footer.php');
exit;

} elseif(isset(
$_GET['q']) && mb_strlen($_GET['q']) >= && $_GET['act'] == 'text') {
    
$search_r $db->query("SELECT * FROM `library` WHERE `text` LIKE '%".input($_GET['q'])."%'")->rowCount();
    
$tpl->div('title'$lang->word('search'));
    
$tpl->div('menu'''.$lang->word('search').': <b>'.$search_r.'</b>');
    
$pages = new Paginator($search_r$ames);
    if(
$search_r == 0) { 
        
$tpl->div('menu'$lang->word('search_none'));
    } else {
        
$search_q $db->query("SELECT * FROM `library` WHERE `text` LIKE '%".input($_GET['q'])."%' LIMIT $start$ames");
        while(
$search $search_q->fetch()) {
            
$search['text'] = str_replace(input($_GET['q']), '<b>'.input($_GET['q']).'</b>'$search['text']);
            echo 
'<div class="post">
            <a href="/library/article/'
.$search['id'].'/"><b>'.$search['title'].'</b></a><br/>
                        '
.mb_substr($search['text'], 0200).'...<br/>
                        <a href="/library/'
.$search['id'].'/comments/">'$lang->word('comments').' ['.$db->query("SELECT * FROM `library_comms` WHERE `id_note` = '".$search['id']."' ")->rowCount().']</a>
                </div>'
;
        }
    
$pages->view('/blogs/search.php?q='.input($_GET['q']).'&amp;act=text&');
    }
$tpl->div('block',  NAV .' <a href="/library/search">'.$lang->word('search').'</a><br/>'.NAV .' <a href="/library/">'.$lang->word('library').'</a><br/>'HICO .'<a href="/">'$lang->word('home') .'</a>');
require_once(
SYS .'/view/footer.php');
exit;

$tpl->div('title'$lang->word('search'));
echo 
'<div class="menu">'.$lang->word('search_z').':<br/>
        <form action="/library/search.php?" method="get">
        <input type="text" name="q" /><br/>
        '
.$lang->word('search_where').':<br/>
        <select name="act">
        <option value="title">'
$lang->word('search_title') .'</option>
        <option value="text">'
$lang->word('search_note') .'</option>
        </select><br/>
        <input type="submit" value="'
$lang->word('search') .'" />
        </form>
        </div>'
;
$tpl->div('block',  NAV .' <a href="/library/search">'.$lang->word('search').'</a><br/>'.NAV .' <a href="/library/">'.$lang->word('library').'</a><br/>'HICO .'<a href="/">'$lang->word('home') .'</a>');
require_once(
SYS .'/view/footer.php');
?>
Онлайн: 0
Реклама