<?php
if(!defined('IN_DISCUZ')) {
    exit('Access Denied');
}
require_once libfile('function/forumlist');
odz_loadforum();
$tmp = array_keys($_G['forum']['threadsorts']['types']);
$sortid = isset($tmp[0])?$tmp[0]:'';

$thread = array('readperm' => '', 'pricedisplay' => '', 'hiddenreplies' => '');
$threadtypes = array();
    if($_GET['fid']==55){//娣按瀹夋緶
//        echo $_G['groupid'];exit;
        if($_G['groupid']==87){
          $query1 = DB::query("SELECT * FROM ".DB::table('forum_threadclass_addon')." WHERE fid='{$_GET['fid']}' and removed = 0 and isadmin = 1 ORDER BY displayorder DESC ");  
        }else{
          $query1 = DB::query("SELECT * FROM ".DB::table('forum_threadclass_addon')." WHERE fid='{$_GET['fid']}' and removed = 0 and isadmin = 0 ORDER BY displayorder DESC");  
        }
        $threadtypes['required'] = 1;
        while($class = DB::fetch($query1)){//涓婚鍒嗙被
            $th[]=$class;
        }
        foreach($th as $key => $value){
            $threadtypes['typelists']['type'.$value[groupid]][] = array('id'=>$value['typeid'], 'name'=>strip_tags($value['name']));
        }
    }
    $threadtypes['sortid'] = $sortid;
    if($_G['forum']['ismoderator'] || empty($_G['forum']['threadtypes']['moderators'][$thread['typeid']])) {
        $arr = $_G['forum']['threadtypes'];
        //$threadtypes['required'] = $arr['required'];
        foreach($arr['types'] as $key => $value) {
            $threadtypes['types'][] = array('id'=>$key, 'name'=>strip_tags($value));
        }
    }
odz_result(array('threadtypes'=>$threadtypes));

?>