Example #1
0
<?php

set_time_limit(0);
define('RPP', 50);
require_once dirname(__FILE__) . '/inc/config.inc';
$page = isset($_GET['p']) ? (int) $_GET['p'] : 1;
$query = isset($_GET['q']) ? (string) $_GET['q'] : '';
$category = isset($_GET['cat']) ? (string) $_GET['cat'] : '';
$days = isset($_GET['d']) ? (int) $_GET['d'] : 0;
$days = max($days, 0);
$minsize = isset($_GET['minsize']) ? (string) $_GET['minsize'] : '0.1 GB';
if (!Searcher::correctHumanSize($minsize)) {
    $minsize = '0';
}
$extsearch = isset($_GET['extsearch']) ? (bool) $_GET['extsearch'] : false;
$nodirs = isset($_GET['nodirs']) ? (bool) $_GET['nodirs'] : false;
$T = new Blitz();
$T->load(file_get_contents('tpl/index.tpl'));
$tpl_values = array();
$tpl_values['page'] = $page;
if ($query || $extsearch) {
    $tpl_values['query'] = htmlspecialchars($query);
    $tpl_values['extsearch'] = $extsearch;
    $tpl_values['nodirs'] = $nodirs;
    $categories = Searcher::getCategories($category, true);
    $tpl_values['categories'] = $categories;
    $tpl_values['days'] = $days;
    $tpl_values['minsize'] = $minsize;
    if ($query) {
        $searcher = new SphinxClient();
        $searcher->setServer("localhost", 3312);