<?php
//#--hack--huaishui--post--replace--#
if(!defined('IN_DISCUZ')) {
    exit('Access Denied');
}
require_once libfile('function/forumlist');

odz_loadforum();
//$tmp = array_keys($_G['forum']['threadsorts']['types']);
//print_R($_G['forum']['threadsorts']);exit;
//$sortid = isset($tmp[0])?$tmp[0]:'';

$thread = array('readperm' => '', 'pricedisplay' => '', 'hiddenreplies' => '');
$threadtypes = array();
    if($_G['forum']['ismoderator'] || empty($_G['forum']['threadtypes']['moderators'][$thread['typeid']])) {
        $arr = $_G['forum']['threadsorts'];
        $threadtypes['required'] = $arr['required'];
        if($threadtypes['required'] == 0){
                $threadtypes['required'] = 'false';
        }
        if($threadtypes['required'] == 1){
                $threadtypes['required'] = 'true';
        }
        foreach($arr['types'] as $key => $value) {
            if( $arr['moderators'][$key] == 1 && !$_G['forum']['ismoderator']){
                continue;
            }
            $threadtypes['types'][] = array('sortid'=>$key, 'name'=>strip_tags($value));
        }
    }
odz_result(array('threadtypes'=>$threadtypes));