<?php

/* 

 * 获取客户端首页新闻分类排序

 * ==============================================================

 * @param                  | 登录令牌

 * @author                 | zhangxin 

 * ==============================================================

 */

if(!defined('IN_DISCUZ')) {

	exit('Access Denied');

}



global $_G;



$data = DB::fetch_first('SELECT svalue FROM '.DB::table('common_setting')." WHERE skey = 'indexnews'");



if(empty($data)){

        odz_error('data empty');

}



$catgory = unserialize($data['svalue']);



$list = array();

$catgorylist = array();

//隐藏 未开启模块

foreach($catgory as $k=>$v){

        if($v['isshow']=='1'){

                $catgorylist[] =$v;

        }

}

//按照order排序 从小到大 order 越小越靠前

if(!empty($catgorylist)){

        foreach($catgorylist as $k=>$v){

                $recommend[] = $v['order'];

        }

        array_multisort($recommend, SORT_ASC, $catgorylist);

}



//取出排序最靠前的新闻列表页  type = 1 调用特定版块最新帖子(新鲜事) type = 2 调用推送模块(本地头条)

$type = $catgorylist[0]['type'];



if($type == 1){

        $fid = $catgorylist[0]['fid'];

        //新鲜事

        include 'includes/news/news_forum.php';

}else if($type ==2){

        //本地头条

        include 'includes/news/news_block.php';

}





$result['catgory'] = $catgorylist;



odz_result($result);



?>