예제 #1
0
    update_user_level($user_id);
    $l_auth_return = $mode == 'user' ? $lang['CLICK_RETURN_USERAUTH'] : $lang['CLICK_RETURN_GROUPAUTH'];
    $message = $lang['AUTH_UPDATED'] . '<br /><br />';
    $message .= sprintf($l_auth_return, '<a href="admin_ug_auth.php?mode=' . $mode . '">', '</a>') . '<br /><br />';
    $message .= sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
    bb_die($message);
} else {
    if ($submit && $mode == 'group' && is_array(@$_POST['auth'])) {
        if (!($group_data = get_group_data($group_id))) {
            bb_die($lang['GROUP_NOT_EXIST']);
        }
        $auth = array();
        array_deep($_POST['auth'], 'intval');
        foreach ($_POST['auth'] as $f_id => $bf_ary) {
            if (array_sum($bf_ary)) {
                $auth[$f_id] = bit2dec(array_keys($bf_ary, 1));
            }
        }
        delete_permissions($group_id, null, $cat_id);
        store_permissions($group_id, $auth);
        update_user_level('all');
        $l_auth_return = $lang['CLICK_RETURN_GROUPAUTH'];
        $message = $lang['AUTH_UPDATED'] . '<br /><br />';
        $message .= sprintf($l_auth_return, '<a href="admin_ug_auth.php?mode=' . $mode . '">', '</a>') . '<br /><br />';
        $message .= sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
        bb_die($message);
    }
}
//
// Front end (changing permissions)
//
예제 #2
0
// forum_perm bitfields - backward compatible with auth($type)
define('AUTH_ALL', 0);
define('AUTH_VIEW', 1);
define('AUTH_READ', 2);
define('AUTH_MOD', 3);
define('AUTH_POST', 4);
define('AUTH_REPLY', 5);
define('AUTH_EDIT', 6);
define('AUTH_DELETE', 7);
define('AUTH_STICKY', 8);
define('AUTH_ANNOUNCE', 9);
define('AUTH_VOTE', 10);
define('AUTH_POLLCREATE', 11);
define('AUTH_ATTACH', 12);
define('AUTH_DOWNLOAD', 13);
define('BF_AUTH_MOD', bit2dec(AUTH_MOD));
// When defining user permissions, take into account:
define('UG_PERM_BOTH', 1);
// both user and group
define('UG_PERM_USER_ONLY', 2);
// only personal user permissions
define('UG_PERM_GROUP_ONLY', 3);
// only group permissions
$bf['forum_perm'] = array('auth_view' => AUTH_VIEW, 'auth_read' => AUTH_READ, 'auth_mod' => AUTH_MOD, 'auth_post' => AUTH_POST, 'auth_reply' => AUTH_REPLY, 'auth_edit' => AUTH_EDIT, 'auth_delete' => AUTH_DELETE, 'auth_sticky' => AUTH_STICKY, 'auth_announce' => AUTH_ANNOUNCE, 'auth_vote' => AUTH_VOTE, 'auth_pollcreate' => AUTH_POLLCREATE, 'auth_attachments' => AUTH_ATTACH, 'auth_download' => AUTH_DOWNLOAD);
$bf['user_opt'] = array('user_viewemail' => 0, 'dis_sig' => 1, 'dis_avatar' => 2, 'dis_pm' => 3, 'user_viewonline' => 4, 'user_notify' => 5, 'user_notify_pm' => 6, 'dis_passkey' => 7, 'user_porn_forums' => 8, 'user_callseed' => 9, 'user_hide_ads' => 10, 'dis_topic' => 11, 'dis_post' => 12, 'dis_post_edit' => 13, 'user_dls' => 14, 'user_retracker' => 15);
function bit2dec($bit_num)
{
    if (is_array($bit_num)) {
        $dec = 0;
        foreach ($bit_num as $bit) {
            $dec |= 1 << $bit;