<?php
/*
* 项目: iOrange(橘子)
* 作者: 离家出走(yzxh24)
* Email: yzxh24@gmail.com
* 主页: www.iorange.cc
*/
/* vim: set ts=4 sw=4: */
define('IN_IORANGE', true);
include('include/init.php');

$action = empty($_GET['action']) ? 'index' : trim(S::gp('action','G'));

if ('index' == $action)
{
    $grades = $db->select()->from(UserGroups::table())->where("gptype='member'")->asc('creditslower')->find();

    include_once tpl('level');
}
else if ('permission' == $action)
{
    $map = array(
        '基础权限' => array(
            'isvisit' => '允许访问(全局控制)',
            'ispost' => '允许发言(全局控制)',
            'ishide' => '允许隐身登录',
            'daycredits' => '用户每日最大评分数',
            'booklimit' => '最大藏书数',
            'propdiscount' => '用户购买道具折扣',
            'isfaceimg' => '允许上传头像',
            'issign' => '允许使用签名',
            'issignubb' => '签名中是否允许使用UBB',
            'issignimg' => '签名中是否允许使用[img]',
            'issignurl' => '签名中是否允许使用[url]',
            'signlenght' => '签名长度',
            'signimgwidth' => '签名中图片宽度',
            'signimgheight' => '签名中图片长度',
        ),
        '社区权限' => array(
            'isbbsvisit' => '允许访问社区',
            'isread' => '允许浏览帖子',
            'isbbspost' => '允许社区发表主题',
            'isrp' => '允许社区回复主题',
            'isvotepost' => '允许社区发起投票',
            'ismodifyvote' => '允许修改社区投票',
            'isvote' => '允许投票',
            'isattpost' => '允许发附件贴',
            'issellpost' => '允许发出售贴',
            'sellprice' => '出售贴最高售价',
            'isrewardpost' => '允许发出悬赏贴',
            'rewardprice' => '悬赏贴最高悬赏额度',
            'isdelatc' => '允许删除自己的主题',
            'iseditatc' => '允许修改自己的主题',
            'isappendatc' => '允许续写自己的主题',
            'isleaveword' => '允许给自己的主题留言',
            'israting' => '允许给帖子评分',
            'maxrating' => '单次最大评分数',
            'ratingmax' => '单贴最大评分次数(0表示不限)',
            'ispostimg' => '允许帖子里使用[img]',
            'isposturl' => '允许帖子里使用[url]',
            'isviewsign' => '允许帖子里显示签名',
            'bbspostpertime' => '社区发帖时间间隔',
        ),
        '书会权限' => array(
            'isforumvisit' => '允许访问书会',
            'isforumpost' => '允许书会发言',
            'forumpostlimit' => '书会每日发帖数(0表示不限制)',
            'isapplybm' => '允许申请书管',
            'isforumcredit' => '允许书会发分',
            'forumcreditlimit' => '书会每日可发获得积分',
            'forumpostpertime' => '书会发帖时间间隔',
            'isadvancepost' => '允许发高级贴',
            'isselladvancepost' => '允许出售高级贴',
            'advancepricelimit' => '高级贴最高售价',
            'isapplydigest' => '允许申请精评',
            'isjoinforum' => '允许加入书会',
            'forumpostlen' => '书评长度(0表示不限制)',
            'isdedicate' => '是否允许捐赠',
            'isbmvote' => '允许书管投票',
        ),
        '附件权限' => array(
            'isuploadatt' => '允许上传附件',
            'isdownloadatt' => '允许下载附件',
            'uploadattlimit' => '每日上传附件数量',
            'downloadattlimit' => '每日下载附件数量',
            'attextensions' => '允许上传的附件后缀',
            'attsize' => '最大附件尺寸(字节)',
        ),
        '短信权限' => array(
            'ispm' => '允许发送站内短信',
            'ispmimg' => '允许使用[img]代码',
            'ispmurl' => '允许使用[url]代码',
            'maxpmsend' => '每日最大发送消息数目(0不限制)',
            'maxpmsize' => '每条消息内容最多字节数',
        ),
    );
    $groupid = intval(S::gp('gid','G'));
    $group = $db->select()->from(UserGroups::table())->where('groupid='.$groupid)->find(true);
    if (empty($group))
    {
        iexit('不存在的用户组');
    }
    if (in_array($groupid,getAdminGroup()))
    {
        $map['管理权限'] = array(
            'isleaveadmin' => '前台主题贴留言',
            'isrplock' => '前台回复锁定的主题',
            'isdigestadmin' => '前台帖子加精',
            'isundigestadmin' => '前台帖子取消精华',
            'islockadmin' => '前台帖子锁定',
            'isunlockadmin' => '前台帖子取消锁定',
            'issinkadmin' => '前台帖子下沉',
            'ispushadmin' => '前台帖子提前',
            'pushtime' => '前台帖子提前时间上线(按小时)',
            'istopadmin' => '前台帖子置顶',
            'istop1admin' => '前台帖子置顶1(版块内)',
            'istop3admin' => '前台帖子置顶3',
            'isdelpost' => '前台删除主题贴',
            'iseditpost' => '前台修改主题贴',
            'isappendpost' => '前台续写主题贴',
            'isdelreply' => '前台删除回复',
            'isdelatt' => '前台删除附件',
            'ismovepost' => '前台移动帖子',
            'isbanvisit' => '禁止访问',
        );
    }
    $g = getUserGroup($groupid);
    
    include_once tpl('permission');
}