Вход Регистрация
Файл: modules/domens/search.php
Строк: 107
<?php
/**********************************
*    @package: PerfCMS              *
*    @year: 2012                      *
*    @author: Artas                  *
*    @link: http://perfcms.ru      *
**********************************/

$locate 'share';
$title $lang->word('search').' | '$lang->word('share');
require_once(
SYS .'/view/header.php');
if(isset(
$_GET['q']) && mb_strlen($_GET['q']) >= && $_GET['where'] == 'names') {
    
$search_r $db->query("SELECT * FROM `share_files` WHERE `name` LIKE '%".input($_GET['q'])."%'")->rowCount();
    
$tpl->div('title'$lang->word('search_topics'));
    
$tpl->div('menu'$lang->word('found').': <b>'.$search_r.'</b>');
    
$pages = new Paginator($search_r$ames);
    if(
$search_r == 0) { 
        
$tpl->div('menu'$lang->word('not_found'));
    } else {
        
$search_q $db->query("SELECT * FROM `share_files` WHERE `name` 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['name']);
            echo 
'<div class="post">
                '
.(preg_match('/jpeg|jpg|gif|png|bmp/i'$search['ext']) ? img('image.png') : NULL).'
                '
.(preg_match('/jar|sis|sisx|jad|apk/i'$search['ext']) ? img('application.png') : NULL).'
                '
.(preg_match('/mp4|3gp|avi|flv/i'$search['ext']) ? img('video.png') : NULL).'
                '
.(preg_match('/mp3|aac|amr|wav|midi|mid/i'$search['ext']) ? img('music.png') : NULL).'
                '
.(preg_match('/zip|rar|tar.gz|7z/i'$search['ext']) ? img('box.png') : NULL).'
                 <a href="/domens/file/'
$search['id'] .'/">'$search['name'] .'</a> ('.strtoupper($search['ext']).')
                </div>'
;
        }
    
$pages->view('/domens/search?q='.input($_GET['q']).'&amp;where=names&');
    }
$tpl->div('block',  NAV .' <a href="/domens/search">'$lang->word('search') .'</a><br/>'.
                    
img('share.png') .' <a href="/domens/">'$lang->word('share') .'</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['where'] == 'desc') {
    
$search_r $db->query("SELECT * FROM `share_files` WHERE `text` LIKE '%".input($_GET['q'])."%'")->rowCount();
    
$tpl->div('title'$lang->word('search_messages'));
    
$tpl->div('menu'$lang->word('found').': <b>'.$search_r.'</b>');
    
$pages = new Paginator($search_r$ames);
    if(
$search_r == 0) { 
        
$tpl->div('menu'$lang->word('not_found'));
    } else {
        
$search_q $db->query("SELECT * FROM `share_files` 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">
            '
.(preg_match('/jpeg|jpg|gif|png|bmp/i'$search['ext']) ? img('image.png') : NULL).'
                '
.(preg_match('/jar|sis|sisx|jad|apk/i'$search['ext']) ? img('application.png') : NULL).'
                '
.(preg_match('/mp4|3gp|avi|flv/i'$search['ext']) ? img('video.png') : NULL).'
                '
.(preg_match('/mp3|aac|amr|wav|midi|mid/i'$search['ext']) ? img('music.png') : NULL).'
                '
.(preg_match('/zip|rar|tar.gz|7z/i'$search['ext']) ? img('box.png') : NULL).'
                 <a href="/domens/file/'
$search['id'] .'/">'$search['name'] .'</a> ('.strtoupper($search['ext']).')<br/>
                 '
$search['text'].'
                </div>'
;
        }
    
$pages->view('/domens/search?q='.input($_GET['q']).'&amp;where=desc&');
    }
$tpl->div('block',  NAV .' <a href="/domens/search">'$lang->word('search') .'</a><br/>'.
                    
img('share.png') .' <a href="/domens/">'$lang->word('share') .'</a><br/>'
                    
HICO .'<a href="/">'$lang->word('home') .'</a>');
require_once(
SYS .'/view/footer.php');
exit;
}
$tpl->div('title'$lang->word('search').' | '$lang->word('share'));
echo 
'<div class="menu">'.$lang->word('enter_search_key').':<br/>
        <form action="/domens/search?" method="get">
        <input type="text" name="q" /><br/>
        '
$lang->word('where') .':<br/>
        <select name="where">
        <option value="names">'
.$lang->word('in_files_names').'</option>
        <option value="desc">'
.$lang->word('in_files_desc').'</option>
        </select><br/>
        <input type="submit" value="'
$lang->word('search') .'" />
        </form>
        </div>'
;
$tpl->div('block'img('share.png') .' <a href="/domens/">'$lang->word('share') .'</a><br/>'
                    
HICO .'<a href="/">'$lang->word('home') .'</a>');
require_once(
SYS .'/view/footer.php');
?>
Онлайн: 1
Реклама