<?php
/**
 * 
 * @file index.php
 * @copyright (c) 2005 - 2007 eifr.com
 * @license http://www.gnu.org/copyleft/gpl.html gnu/gpl
 * eifr is free software
 */
require_once(dirname(__FILE__) . '/includes/inc_general.php');

function getHotArticle($limit_num = 10) {
    $sql = "select * from " . TB_ARTICLE . " where flag<3  and status=0 order by viewnum desc,issuetime desc limit $limit_num";

    return dbGetRecordn($sql);
} 

function getHotComment($limit_num = 10) {
    $sql = "select * from " . TB_ARTICLE . " where flag<3  and status=0 order by commentnum desc,issuetime desc limit $limit_num";

    return dbGetRecordn($sql);
} 

function getTabViewTime($days = 1, $limit_num = 10) {
    global $id;
    $pretime = time() - $days * 24 * 60 * 60;
    $sql = "select id,title,issuetime from " . TB_ARTICLE . " where flag<3  and status=0 and issuetime>'$pretime'  order by issuetime desc limit $limit_num"; 
    // echo $sql;
    return dbGetRecordn($sql);
} 

function getPoll($article_id = '') {
    global $db;
    $rtn = array();
    if ($article_id == '') return $rtn;
    $sql = "select id,title,type from " . TB_POLL . " where article_id='" . $article_id . "' order by ordernum ";
    $rs = $db -> Execute($sql); 
    // echo $sql;
    while (!$rs -> EOF) {
        if ($rs -> fields['type'] == 2) {
            $type = 'checkbox';
            $name = 'poll_id[]';
        } else {
            $type = 'radio';
            $name = 'poll_id';
        } 
        $rs -> fields['eifr_type'] = $type;
        $rs -> fields['eifr_name'] = $name;
        $rtn[] = $rs -> fields;
        $rs -> MoveNext();
    } 
    $rs -> Close();
    return $rtn;
} 
// ---start---

$search_select = createChannelsSelect();

require_once(EIFR_ROOT . 'includes/inc_loadtpl.php');

?>