예제 #1
0
파일: search.php 프로젝트: philum/cms
function plug_search($d, $n, $opt = '', $res = '')
{
    list($b, $o, $t, $ph) = split('-', $opt);
    chrono();
    $rech = good_rech($d);
    $_GET['search'] = $rech;
    list($cat, $tag) = ajxr($res);
    $rech = str_replace(array("’", '«', '»', " "), array("'", '"', '"', ' '), trim($rech));
    if (!$n) {
        $n = $_SESSION['nbj'];
    }
    $_GET['dig'] = $n;
    $_GET['cat'] = $cat;
    $_GET['tag'] = $tag;
    $_GET['bool'] = $b;
    $_GET['titles'] = $t;
    //$_GET['pho']=$ph;
    $vrf = normalize($rech . $n . $b . $o . $t . $ph . $res);
    if ($rech == 'last') {
        $id = lastid('qda');
        $load[$id] = 1;
    } elseif (isset($_SESSION['recache'][$vrf])) {
        $load = $_SESSION['recache'][$vrf];
        $cac = $vrf;
    } elseif ($d && is_numeric($d) && $d < lastid('qda')) {
        $load[$d] = 1;
    } elseif (strpos($rech, ';') && strpos($rech, ':')) {
        list($rch, $cat, $tag, $utg) = rech_script($rech);
    } elseif (strpos($rech, '=')) {
        $load = make_list_arts($rech);
    } else {
        $load = rech($rech, $n);
    }
    if ($load && !is_array($load)) {
        $load = '';
    }
    if (!$load && ($cat or $tag or $utg)) {
        $load = rech_catag($cat, $tag, $utg, $n);
    }
    $_SESSION['load'] = $load;
    $_SESSION['recache'][$vrf] = $load;
    $ret = rech_titles($rech, $n, $opt, $cac, $cat, $tag, $tag2);
    $_SESSION['page'] = 1;
    $_SESSION['popm'] = chrono('search');
    if ($load[0]) {
        unset($load[0]);
    }
    if ($load[1]) {
        unset($load[1]);
    }
    if ($load) {
        $ret .= scroll($load, divd($vrf, output_pages($load, '', '')), 2, '', 400);
    }
    return $ret;
}
예제 #2
0
파일: spe.php 프로젝트: philum/cms
function define_load()
{
    $rech = good_rech();
    //active console
    $days = getorpost('dig', ses('nbj'));
    $dayb = calc_date($days);
    $pday = time_prev($days);
    if ($pday == 1) {
        $pday = 0;
    }
    $daya = calc_date($pday);
    if (get('tag')) {
        $load = tag_arts(get('tag', ses('nbj')), '', $days, $pday);
    } elseif ($rech) {
        $_SESSION['frm'] = '';
        if (!get('search')) {
            $load = $_SESSION["recache"][$vrf];
        }
        if (!$load) {
            require 'plug/search.php';
            $load = rech($rech, $days);
        }
        if (is_array($load)) {
            if (get('bydate')) {
                krsort($load);
            }
        }
        $_SESSION["recache"][$vrf] = $load;
    } elseif (get('source')) {
        $_SESSION['frm'] = '';
        if (get('dig')) {
            $load = tri_rqt_d(get('source'), 'mail', $daya, $dayb);
        } elseif ($_SESSION['rqt']) {
            foreach ($_SESSION['rqt'] as $k => $v) {
                if (strpos($v[9], get('source')) !== false) {
                    $load[$k] = 1;
                }
            }
        }
    } elseif (get('parent')) {
        $load = sql('id', 'qda', 'k', 'ib=' . get('parent'));
    } elseif (get('rub_tag')) {
        $rub_t = get('rub_tag');
        $rbtags = tri_rqt_rubtags(ses('frm'), 5, $daya, $dayb);
        $load = tri_rub_tags($rbtags, $rub_t);
    } elseif (get('author')) {
        $load = tri_rqt_d(get('author'), 'name', $daya, $dayb);
    } elseif ($gets = detect_uget()) {
        $load = tag_arts($gets[1], $gets[2], $days, $pday);
    }
    if ($load) {
        save_get();
    }
    return $load;
}