示例#1
0
function view()
{
    // parse the search params
    $kind = get_http_var('type', "");
    $q = get_http_var('q');
    if (!$kind) {
        $j = get_http_var('j', "");
        $a = get_http_var('a', "");
        if ($j) {
            $q = $j;
            $kind = 'journo';
        }
        if ($a) {
            $q = $a;
            $kind = 'article';
        }
    }
    $art_page = get_http_var('p', 0);
    $journo_page = get_http_var('jp', 0);
    // special 'by' param for article searches
    $by = get_http_var('by', "");
    if ($by && $kind != 'journo') {
        $q .= " author:" . $by;
    }
    $sort_order = get_http_var('o');
    $article_results = null;
    if ($q != "" && $kind != 'journo') {
        $as = new ArticleSearch($q, $sort_order, $art_page, 'p');
        $article_results = $as->perform();
    }
    $journo_results = null;
    if ($q != "" && $kind != 'article') {
        $js = new JournoSearch($q, $journo_page, 'jp');
        $journo_results = $js->perform();
    }
    // hackhackhack
    /*
          if( $s['fmt'] == 'csv' ) {
            search_articles_output_csv($article_results->data);
            return;
          }
    */
    tmpl($q, $kind, $sort_order, $journo_results, $article_results);
}