Пример #1
0
function checkperm($permtype)
{
    global $_SGLOBAL, $space;
    if ($permtype == 'admin') {
        $permtype = 'manageconfig';
    }
    $var = 'checkperm_' . $permtype;
    if (!isset($_SGLOBAL[$var])) {
        if (empty($_SGLOBAL['supe_uid'])) {
            $_SGLOBAL[$var] = '';
        } else {
            if (empty($_SGLOBAL['member'])) {
                getmember();
            }
            $gid = getgroupid($_SGLOBAL['member']['experience'], $_SGLOBAL['member']['groupid']);
            if (!@(include_once S_ROOT . './data/data_usergroup_' . $gid . '.php')) {
                usergroup_cache();
                @(include_once S_ROOT . './data/data_usergroup_' . $gid . '.php');
            }
            if ($gid != $_SGLOBAL['member']['groupid']) {
                updatetable('space', array('groupid' => $gid), array('uid' => $_SGLOBAL['supe_uid']));
                //赠送道具
                if ($_SGLOBAL['usergroup'][$gid]['magicaward']) {
                    include_once S_ROOT . './source/inc_magicaward.php';
                }
            }
            $_SGLOBAL[$var] = empty($_SGLOBAL['usergroup'][$gid][$permtype]) ? '' : $_SGLOBAL['usergroup'][$gid][$permtype];
            if (substr($permtype, 0, 6) == 'manage' && empty($_SGLOBAL[$var])) {
                $_SGLOBAL[$var] = $_SGLOBAL['usergroup'][$gid]['manageconfig'];
                //权限覆盖
                if (empty($_SGLOBAL[$var])) {
                    $_SGLOBAL[$var] = ckfounder($_SGLOBAL['supe_uid']) ? 1 : 0;
                    //创始人
                }
            }
        }
    }
    return $_SGLOBAL[$var];
}
Пример #2
0
if (!defined('IN_UCHOME') || !defined('IN_ADMINCP')) {
    exit('Access Denied');
}
//Ȩ��
if (!checkperm('managecache')) {
    cpmessage('no_authority_management_operation');
}
$turl = 'admincp.php?ac=cache';
//���»���
if (submitcheck('cachesubmit')) {
    include_once S_ROOT . './source/function_cp.php';
    include_once S_ROOT . './source/function_cache.php';
    //ϵͳ����
    if (empty($_POST['cachetype']) || in_array('database', $_POST['cachetype'])) {
        config_cache();
        usergroup_cache();
        profilefield_cache();
        profield_cache();
        censor_cache();
        block_cache();
        eventclass_cache();
        magic_cache();
        click_cache();
        task_cache();
        ad_cache();
        creditrule_cache();
        userapp_cache();
        app_cache();
        network_cache();
    }
    //ģ����뻺��
Пример #3
0
function getgroupid($credit, $gid = 0)
{
    global $_SGLOBAL;
    if (!@(include_once S_ROOT . './data/data_usergroup.php')) {
        include_once S_ROOT . './source/function_cache.php';
        usergroup_cache();
    }
    $needfind = false;
    if ($gid && !empty($_SGLOBAL['usergroup'][$gid])) {
        $group = $_SGLOBAL['usergroup'][$gid];
        if (empty($group['system'])) {
            if ($group['credithigher'] < $credit || $group['creditlower'] > $credit) {
                $needfind = true;
            }
        }
    } else {
        $needfind = true;
    }
    if ($needfind) {
        $query = $_SGLOBAL['db']->query("SELECT gid FROM " . tname('usergroup') . " WHERE creditlower<='{$credit}' AND system='0' ORDER BY creditlower DESC LIMIT 1");
        $gid = $_SGLOBAL['db']->result($query, 0);
    }
    return $gid;
}