当前位置: 首页>>代码示例>>PHP>>正文


PHP auth::acl_get方法代码示例

本文整理汇总了PHP中auth::acl_get方法的典型用法代码示例。如果您正苦于以下问题:PHP auth::acl_get方法的具体用法?PHP auth::acl_get怎么用?PHP auth::acl_get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在auth的用法示例。


在下文中一共展示了auth::acl_get方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: main

    function main($id, $mode)
    {
        global $config, $phpbb_root_path, $phpEx;
        global $db, $user, $auth, $template;
        $username = request_var('username', '', true);
        $email = strtolower(request_var('email', ''));
        $submit = isset($_POST['submit']) ? true : false;
        if ($submit) {
            $sql = 'SELECT user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason
				FROM ' . USERS_TABLE . "\n\t\t\t\tWHERE user_email = '" . $db->sql_escape($email) . "'\n\t\t\t\t\tAND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
            $result = $db->sql_query($sql);
            $user_row = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
            if (!$user_row) {
                trigger_error('NO_EMAIL_USER');
            }
            if ($user_row['user_type'] == USER_IGNORE) {
                trigger_error('NO_USER');
            }
            if ($user_row['user_type'] == USER_INACTIVE) {
                if ($user_row['user_inactive_reason'] == INACTIVE_MANUAL) {
                    trigger_error('ACCOUNT_DEACTIVATED');
                } else {
                    trigger_error('ACCOUNT_NOT_ACTIVATED');
                }
            }
            // Check users permissions
            $auth2 = new auth();
            $auth2->acl($user_row);
            if (!$auth2->acl_get('u_chgpasswd')) {
                trigger_error('NO_AUTH_PASSWORD_REMINDER');
            }
            $server_url = generate_board_url();
            $key_len = 54 - strlen($server_url);
            $key_len = max(6, $key_len);
            // we want at least 6
            $key_len = $config['max_pass_chars'] ? min($key_len, $config['max_pass_chars']) : $key_len;
            // we want at most $config['max_pass_chars']
            $user_actkey = substr(gen_rand_string(10), 0, $key_len);
            $user_password = gen_rand_string(8);
            $sql = 'UPDATE ' . USERS_TABLE . "\n\t\t\t\tSET user_newpasswd = '" . $db->sql_escape(phpbb_hash($user_password)) . "', user_actkey = '" . $db->sql_escape($user_actkey) . "'\n\t\t\t\tWHERE user_id = " . $user_row['user_id'];
            $db->sql_query($sql);
            include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
            $messenger = new messenger(false);
            $messenger->template('user_activate_passwd', $user_row['user_lang']);
            $messenger->to($user_row['user_email'], $user_row['username']);
            $messenger->im($user_row['user_jabber'], $user_row['username']);
            $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($user_row['username']), 'PASSWORD' => htmlspecialchars_decode($user_password), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user_row['user_id']}&k={$user_actkey}"));
            $messenger->send($user_row['user_notify_type']);
            meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}"));
            $message = $user->lang['PASSWORD_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.{$phpEx}") . '">', '</a>');
            trigger_error($message);
        }
        $template->assign_vars(array('USERNAME' => $username, 'EMAIL' => $email, 'S_PROFILE_ACTION' => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=sendpassword')));
        $this->tpl_name = 'ucp_remind';
        $this->page_title = 'UCP_REMIND';
    }
开发者ID:jvinhit,项目名称:php,代码行数:57,代码来源:ucp_remind.php

示例2: main

    public function main()
    {
        global $config, $phpbb_root_path, $phpEx;
        global $db, $user, $auth, $template;
        $username = request_var('username', '', true);
        $sql = 'SELECT user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason
			FROM ' . USERS_TABLE . "\r\r\n\t\t\tWHERE  username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
        $result = $db->sql_query($sql);
        $user_row = $db->sql_fetchrow($result);
        $db->sql_freeresult($result);
        if (!$user_row) {
            trigger_error('NO_EMAIL_USER');
        }
        if ($user_row['user_type'] == USER_IGNORE) {
            trigger_error('NO_USER');
        }
        if ($user_row['user_type'] == USER_INACTIVE) {
            if ($user_row['user_inactive_reason'] == INACTIVE_MANUAL) {
                trigger_error('ACCOUNT_DEACTIVATED');
            } else {
                trigger_error('ACCOUNT_NOT_ACTIVATED');
            }
        }
        // Check users permissions
        $auth2 = new auth();
        $auth2->acl($user_row);
        if (!$auth2->acl_get('u_chgpasswd')) {
            trigger_error('NO_AUTH_PASSWORD_REMINDER');
        }
        $result = tt_register_verify($_POST['tt_token'], $_POST['tt_code']);
        if ($result->result && $user_row['user_email'] == $result->email) {
            $this->result = true;
            $this->verify = true;
            return;
        }
        $this->result = false;
        $this->result_text = 'Sorry, you can only retrieve your password from browser.';
        return;
    }
开发者ID:danielgospodinow,项目名称:GamingZone,代码行数:39,代码来源:mobi_ucp_remind.php

示例3: check_rule

/**
* Check Rule against Message Information
*/
function check_rule(&$rules, &$rule_row, &$message_row, $user_id)
{
    global $user, $config;
    if (!isset($rules[$rule_row['rule_check']][$rule_row['rule_connection']])) {
        return false;
    }
    $check_ary = $rules[$rule_row['rule_check']][$rule_row['rule_connection']];
    // Replace Check Literals
    $evaluate = $check_ary['function'];
    $evaluate = preg_replace('/{(CHECK[0-9])}/', '$message_row[$check_ary[strtolower("\\1")]]', $evaluate);
    // Replace Rule Literals
    $evaluate = preg_replace('/{(STRING|USER_ID|GROUP_ID)}/', '$rule_row["rule_" . strtolower("\\1")]', $evaluate);
    // Evil Statement
    $result = false;
    eval('$result = (' . $evaluate . ') ? true : false;');
    if (!$result) {
        return false;
    }
    switch ($rule_row['rule_action']) {
        case ACTION_PLACE_INTO_FOLDER:
            return array('action' => $rule_row['rule_action'], 'folder_id' => $rule_row['rule_folder_id']);
            break;
        case ACTION_MARK_AS_READ:
        case ACTION_MARK_AS_IMPORTANT:
            return array('action' => $rule_row['rule_action'], 'pm_unread' => $message_row['pm_unread'], 'pm_marked' => $message_row['pm_marked']);
            break;
        case ACTION_DELETE_MESSAGE:
            global $db, $auth;
            // Check for admins/mods - users are not allowed to remove those messages...
            // We do the check here to make sure the data we use is consistent
            $sql = 'SELECT user_id, user_type, user_permissions
				FROM ' . USERS_TABLE . '
				WHERE user_id = ' . (int) $message_row['author_id'];
            $result = $db->sql_query($sql);
            $userdata = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
            $auth2 = new auth();
            $auth2->acl($userdata);
            if (!$auth2->acl_get('a_') && !$auth2->acl_get('m_') && !$auth2->acl_getf_global('m_')) {
                return array('action' => $rule_row['rule_action'], 'pm_unread' => $message_row['pm_unread'], 'pm_marked' => $message_row['pm_marked']);
            }
            return false;
            break;
        default:
            return false;
    }
    return false;
}
开发者ID:jvinhit,项目名称:php,代码行数:51,代码来源:functions_privmsgs.php

示例4: isset

    /**
     * Handles warning the user
     */
    function mcp_warn_user_view($action)
    {
        global $phpEx, $phpbb_root_path, $config, $module;
        global $template, $db, $user, $auth;
        $user_id = request_var('u', 0);
        $username = request_var('username', '', true);
        $notify = isset($_REQUEST['notify_user']) ? true : false;
        $warning = utf8_normalize_nfc(request_var('warning', '', true));
        $sql_where = $user_id ? "user_id = {$user_id}" : "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
        $sql = 'SELECT *
			FROM ' . USERS_TABLE . '
			WHERE ' . $sql_where;
        $result = $db->sql_query($sql);
        $user_row = $db->sql_fetchrow($result);
        $db->sql_freeresult($result);
        if (!$user_row) {
            trigger_error('NO_USER');
        }
        // Prevent someone from warning themselves
        if ($user_row['user_id'] == $user->data['user_id']) {
            trigger_error('CANNOT_WARN_SELF');
        }
        $user_id = $user_row['user_id'];
        if (strpos($this->u_action, "&amp;u={$user_id}") === false) {
            $this->p_master->adjust_url('&amp;u=' . $user_id);
            $this->u_action .= "&amp;u={$user_id}";
        }
        // Check if can send a notification
        if ($config['allow_privmsg']) {
            $auth2 = new auth();
            $auth2->acl($user_row);
            $s_can_notify = $auth2->acl_get('u_readpm') ? true : false;
            unset($auth2);
        } else {
            $s_can_notify = false;
        }
        // Prevent against clever people
        if ($notify && !$s_can_notify) {
            $notify = false;
        }
        if ($warning && $action == 'add_warning') {
            if (check_form_key('mcp_warn')) {
                add_warning($user_row, $warning, $notify);
                $msg = $user->lang['USER_WARNING_ADDED'];
            } else {
                $msg = $user->lang['FORM_INVALID'];
            }
            $redirect = append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i=notes&amp;mode=user_notes&amp;u={$user_id}");
            meta_refresh(2, $redirect);
            trigger_error($msg . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
        }
        // Generate the appropriate user information for the user we are looking at
        if (!function_exists('get_user_avatar')) {
            include $phpbb_root_path . 'includes/functions_display.' . $phpEx;
        }
        $rank_title = $rank_img = '';
        $avatar_img = get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']);
        // OK, they didn't submit a warning so lets build the page for them to do so
        $template->assign_vars(array('U_POST_ACTION' => $this->u_action, 'RANK_TITLE' => $rank_title, 'JOINED' => $user->format_date($user_row['user_regdate']), 'POSTS' => $user_row['user_posts'] ? $user_row['user_posts'] : 0, 'WARNINGS' => $user_row['user_warnings'] ? $user_row['user_warnings'] : 0, 'USERNAME_FULL' => get_username_string('full', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), 'USERNAME_COLOUR' => get_username_string('colour', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), 'USERNAME' => get_username_string('username', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), 'U_PROFILE' => get_username_string('profile', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), 'AVATAR_IMG' => $avatar_img, 'RANK_IMG' => $rank_img, 'S_CAN_NOTIFY' => $s_can_notify));
        return $user_id;
    }
开发者ID:danielheyman,项目名称:EazySubs,代码行数:64,代码来源:mcp_warn.php

示例5: array

    /**
     * Display a complete trace tree for the selected permission to determine where settings are set/unset
     */
    function permission_trace($user_id, $forum_id, $permission)
    {
        global $db, $template, $user, $auth;
        if ($user_id != $user->data['user_id']) {
            $sql = 'SELECT user_id, username, user_permissions, user_type
				FROM ' . USERS_TABLE . '
				WHERE user_id = ' . $user_id;
            $result = $db->sql_query($sql);
            $userdata = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
        } else {
            $userdata = $user->data;
        }
        if (!$userdata) {
            trigger_error('NO_USERS', E_USER_ERROR);
        }
        $forum_name = false;
        if ($forum_id) {
            $sql = 'SELECT forum_name
				FROM ' . FORUMS_TABLE . "\n\t\t\t\tWHERE forum_id = {$forum_id}";
            $result = $db->sql_query($sql, 3600);
            $forum_name = $db->sql_fetchfield('forum_name');
            $db->sql_freeresult($result);
        }
        $back = request_var('back', 0);
        $template->assign_vars(array('PERMISSION' => $user->lang['acl_' . $permission]['lang'], 'PERMISSION_USERNAME' => $userdata['username'], 'FORUM_NAME' => $forum_name, 'S_GLOBAL_TRACE' => $forum_id ? false : true, 'U_BACK' => $back ? build_url(array('f', 'back')) . "&amp;f={$back}" : ''));
        $template->assign_block_vars('trace', array('WHO' => $user->lang['DEFAULT'], 'INFORMATION' => $user->lang['TRACE_DEFAULT'], 'S_SETTING_NO' => true, 'S_TOTAL_NO' => true));
        $sql = 'SELECT DISTINCT g.group_name, g.group_id, g.group_type
			FROM ' . GROUPS_TABLE . ' g
				LEFT JOIN ' . USER_GROUP_TABLE . ' ug ON (ug.group_id = g.group_id)
			WHERE ug.user_id = ' . $user_id . '
				AND ug.user_pending = 0
			ORDER BY g.group_type DESC, g.group_id DESC';
        $result = $db->sql_query($sql);
        $groups = array();
        while ($row = $db->sql_fetchrow($result)) {
            $groups[$row['group_id']] = array('auth_setting' => ACL_NO, 'group_name' => $row['group_type'] == GROUP_SPECIAL ? $user->lang['G_' . $row['group_name']] : $row['group_name']);
        }
        $db->sql_freeresult($result);
        $total = ACL_NO;
        $add_key = $forum_id ? '_LOCAL' : '';
        if (sizeof($groups)) {
            // Get group auth settings
            $hold_ary = $auth->acl_group_raw_data(array_keys($groups), $permission, $forum_id);
            foreach ($hold_ary as $group_id => $forum_ary) {
                $groups[$group_id]['auth_setting'] = $hold_ary[$group_id][$forum_id][$permission];
            }
            unset($hold_ary);
            foreach ($groups as $id => $row) {
                switch ($row['auth_setting']) {
                    case ACL_NO:
                        $information = $user->lang['TRACE_GROUP_NO' . $add_key];
                        break;
                    case ACL_YES:
                        $information = $total == ACL_YES ? $user->lang['TRACE_GROUP_YES_TOTAL_YES' . $add_key] : ($total == ACL_NEVER ? $user->lang['TRACE_GROUP_YES_TOTAL_NEVER' . $add_key] : $user->lang['TRACE_GROUP_YES_TOTAL_NO' . $add_key]);
                        $total = $total == ACL_NO ? ACL_YES : $total;
                        break;
                    case ACL_NEVER:
                        $information = $total == ACL_YES ? $user->lang['TRACE_GROUP_NEVER_TOTAL_YES' . $add_key] : ($total == ACL_NEVER ? $user->lang['TRACE_GROUP_NEVER_TOTAL_NEVER' . $add_key] : $user->lang['TRACE_GROUP_NEVER_TOTAL_NO' . $add_key]);
                        $total = ACL_NEVER;
                        break;
                }
                $template->assign_block_vars('trace', array('WHO' => $row['group_name'], 'INFORMATION' => $information, 'S_SETTING_NO' => $row['auth_setting'] == ACL_NO ? true : false, 'S_SETTING_YES' => $row['auth_setting'] == ACL_YES ? true : false, 'S_SETTING_NEVER' => $row['auth_setting'] == ACL_NEVER ? true : false, 'S_TOTAL_NO' => $total == ACL_NO ? true : false, 'S_TOTAL_YES' => $total == ACL_YES ? true : false, 'S_TOTAL_NEVER' => $total == ACL_NEVER ? true : false));
            }
        }
        // Get user specific permission... globally or for this forum
        $hold_ary = $auth->acl_user_raw_data($user_id, $permission, $forum_id);
        $auth_setting = !sizeof($hold_ary) ? ACL_NO : $hold_ary[$user_id][$forum_id][$permission];
        switch ($auth_setting) {
            case ACL_NO:
                $information = $total == ACL_NO ? $user->lang['TRACE_USER_NO_TOTAL_NO' . $add_key] : $user->lang['TRACE_USER_KEPT' . $add_key];
                $total = $total == ACL_NO ? ACL_NEVER : $total;
                break;
            case ACL_YES:
                $information = $total == ACL_YES ? $user->lang['TRACE_USER_YES_TOTAL_YES' . $add_key] : ($total == ACL_NEVER ? $user->lang['TRACE_USER_YES_TOTAL_NEVER' . $add_key] : $user->lang['TRACE_USER_YES_TOTAL_NO' . $add_key]);
                $total = $total == ACL_NO ? ACL_YES : $total;
                break;
            case ACL_NEVER:
                $information = $total == ACL_YES ? $user->lang['TRACE_USER_NEVER_TOTAL_YES' . $add_key] : ($total == ACL_NEVER ? $user->lang['TRACE_USER_NEVER_TOTAL_NEVER' . $add_key] : $user->lang['TRACE_USER_NEVER_TOTAL_NO' . $add_key]);
                $total = ACL_NEVER;
                break;
        }
        $template->assign_block_vars('trace', array('WHO' => $userdata['username'], 'INFORMATION' => $information, 'S_SETTING_NO' => $auth_setting == ACL_NO ? true : false, 'S_SETTING_YES' => $auth_setting == ACL_YES ? true : false, 'S_SETTING_NEVER' => $auth_setting == ACL_NEVER ? true : false, 'S_TOTAL_NO' => false, 'S_TOTAL_YES' => $total == ACL_YES ? true : false, 'S_TOTAL_NEVER' => $total == ACL_NEVER ? true : false));
        if ($forum_id != 0 && isset($auth->acl_options['global'][$permission])) {
            if ($user_id != $user->data['user_id']) {
                $auth2 = new auth();
                $auth2->acl($userdata);
                $auth_setting = $auth2->acl_get($permission);
            } else {
                $auth_setting = $auth->acl_get($permission);
            }
            if ($auth_setting) {
                $information = $total == ACL_YES ? $user->lang['TRACE_USER_GLOBAL_YES_TOTAL_YES'] : $user->lang['TRACE_USER_GLOBAL_YES_TOTAL_NEVER'];
                $total = ACL_YES;
            } else {
                $information = $user->lang['TRACE_USER_GLOBAL_NEVER_TOTAL_KEPT'];
            }
//.........这里部分代码省略.........
开发者ID:html,项目名称:PI,代码行数:101,代码来源:acp_permissions.php

示例6: main

    function main($id, $mode)
    {
        global $config, $db, $user, $auth, $template, $cache;
        global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads;
        $user->add_lang(array('posting', 'ucp', 'acp/users'));
        $this->tpl_name = 'acp_users';
        $this->page_title = 'ACP_USER_' . strtoupper($mode);
        $error = array();
        $username = utf8_normalize_nfc(request_var('username', '', true));
        $user_id = request_var('u', 0);
        $action = request_var('action', '');
        $submit = isset($_POST['update']) && !isset($_POST['cancel']) ? true : false;
        $form_name = 'acp_users';
        add_form_key($form_name);
        // Whois (special case)
        if ($action == 'whois') {
            include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
            $this->page_title = 'WHOIS';
            $this->tpl_name = 'simple_body';
            $user_ip = request_var('user_ip', '');
            $domain = gethostbyaddr($user_ip);
            $ipwhois = user_ipwhois($user_ip);
            $template->assign_vars(array('MESSAGE_TITLE' => sprintf($user->lang['IP_WHOIS_FOR'], $domain), 'MESSAGE_TEXT' => nl2br($ipwhois)));
            return;
        }
        // Show user selection mask
        if (!$username && !$user_id) {
            $this->page_title = 'SELECT_USER';
            $template->assign_vars(array('U_ACTION' => $this->u_action, 'ANONYMOUS_USER_ID' => ANONYMOUS, 'S_SELECT_USER' => true, 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=searchuser&amp;form=select_user&amp;field=username&amp;select_single=true')));
            return;
        }
        if (!$user_id) {
            $sql = 'SELECT user_id
				FROM ' . USERS_TABLE . "\n\t\t\t\tWHERE username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
            $result = $db->sql_query($sql);
            $user_id = (int) $db->sql_fetchfield('user_id');
            $db->sql_freeresult($result);
            if (!$user_id) {
                trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING);
            }
        }
        // Generate content for all modes
        $sql = 'SELECT u.*, s.*
			FROM ' . USERS_TABLE . ' u
				LEFT JOIN ' . SESSIONS_TABLE . ' s ON (s.session_user_id = u.user_id)
			WHERE u.user_id = ' . $user_id . '
			ORDER BY s.session_time DESC';
        $result = $db->sql_query_limit($sql, 1);
        $user_row = $db->sql_fetchrow($result);
        $db->sql_freeresult($result);
        if (!$user_row) {
            trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING);
        }
        // Generate overall "header" for user admin
        $s_form_options = '';
        // Build modes dropdown list
        $sql = 'SELECT module_mode, module_auth
			FROM ' . MODULES_TABLE . "\n\t\t\tWHERE module_basename = 'users'\n\t\t\t\tAND module_enabled = 1\n\t\t\t\tAND module_class = 'acp'\n\t\t\tORDER BY left_id, module_mode";
        $result = $db->sql_query($sql);
        $dropdown_modes = array();
        while ($row = $db->sql_fetchrow($result)) {
            if (!$this->p_master->module_auth($row['module_auth'])) {
                continue;
            }
            $dropdown_modes[$row['module_mode']] = true;
        }
        $db->sql_freeresult($result);
        foreach ($dropdown_modes as $module_mode => $null) {
            $selected = $mode == $module_mode ? ' selected="selected"' : '';
            $s_form_options .= '<option value="' . $module_mode . '"' . $selected . '>' . $user->lang['ACP_USER_' . strtoupper($module_mode)] . '</option>';
        }
        $template->assign_vars(array('U_BACK' => $this->u_action, 'U_MODE_SELECT' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i={$id}&amp;u={$user_id}"), 'U_ACTION' => $this->u_action . '&amp;u=' . $user_id, 'S_FORM_OPTIONS' => $s_form_options, 'MANAGED_USERNAME' => $user_row['username']));
        // Prevent normal users/admins change/view founders if they are not a founder by themselves
        if ($user->data['user_type'] != USER_FOUNDER && $user_row['user_type'] == USER_FOUNDER) {
            trigger_error($user->lang['NOT_MANAGE_FOUNDER'] . adm_back_link($this->u_action), E_USER_WARNING);
        }
        switch ($mode) {
            case 'overview':
                include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
                $user->add_lang('acp/ban');
                $delete = request_var('delete', 0);
                $delete_type = request_var('delete_type', '');
                $ip = request_var('ip', 'ip');
                if ($submit) {
                    // You can't delete the founder
                    if ($delete && $user_row['user_type'] != USER_FOUNDER) {
                        if (!$auth->acl_get('a_userdel')) {
                            trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action . '&amp;u=' . $user_id), E_USER_WARNING);
                        }
                        // Check if the user wants to remove himself or the guest user account
                        if ($user_id == ANONYMOUS) {
                            trigger_error($user->lang['CANNOT_REMOVE_ANONYMOUS'] . adm_back_link($this->u_action . '&amp;u=' . $user_id), E_USER_WARNING);
                        }
                        if ($user_id == $user->data['user_id']) {
                            trigger_error($user->lang['CANNOT_REMOVE_YOURSELF'] . adm_back_link($this->u_action . '&amp;u=' . $user_id), E_USER_WARNING);
                        }
                        if ($delete_type) {
                            if (confirm_box(true)) {
                                user_delete($delete_type, $user_id, $user_row['username']);
                                add_log('admin', 'LOG_USER_DELETED', $user_row['username']);
//.........这里部分代码省略.........
开发者ID:ubick,项目名称:lorekeepers.org,代码行数:101,代码来源:acp_users.php

示例7: array

	/**
	* Get permission mask
	* This function only supports getting permissions of one type (for example a_)
	*
	* @param set|view $mode defines the permissions we get, view gets effective permissions (checking user AND group permissions), set only gets the user or group permission set alone
	* @param mixed $user_id user ids to search for (a user_id or a group_id has to be specified at least)
	* @param mixed $group_id group ids to search for, return group related settings (a user_id or a group_id has to be specified at least)
	* @param mixed $forum_id forum_ids to search for. Defining a forum id also means getting local settings
	* @param string $auth_option the auth_option defines the permission setting to look for (a_ for example)
	* @param local|global $scope the scope defines the permission scope. If local, a forum_id is additionally required
	* @param ACL_NEVER|ACL_NO|ACL_YES $acl_fill defines the mode those permissions not set are getting filled with
	*/
	function get_mask($mode, $user_id = false, $group_id = false, $forum_id = false, $auth_option = false, $scope = false, $acl_fill = ACL_NEVER)
	{
		global $db, $user;

		$hold_ary = array();
		$view_user_mask = ($mode == 'view' && $group_id === false) ? true : false;

		if ($auth_option === false || $scope === false)
		{
			return array();
		}

		$acl_user_function = ($mode == 'set') ? 'acl_user_raw_data' : 'acl_raw_data';

		if (!$view_user_mask)
		{
			if ($forum_id !== false)
			{
				$hold_ary = ($group_id !== false) ? $this->acl_group_raw_data($group_id, $auth_option . '%', $forum_id) : $this->$acl_user_function($user_id, $auth_option . '%', $forum_id);
			}
			else
			{
				$hold_ary = ($group_id !== false) ? $this->acl_group_raw_data($group_id, $auth_option . '%', ($scope == 'global') ? 0 : false) : $this->$acl_user_function($user_id, $auth_option . '%', ($scope == 'global') ? 0 : false);
			}
		}

		// Make sure hold_ary is filled with every setting (prevents missing forums/users/groups)
		$ug_id = ($group_id !== false) ? ((!is_array($group_id)) ? array($group_id) : $group_id) : ((!is_array($user_id)) ? array($user_id) : $user_id);
		$forum_ids = ($forum_id !== false) ? ((!is_array($forum_id)) ? array($forum_id) : $forum_id) : (($scope == 'global') ? array(0) : array());

		// Only those options we need
		$compare_options = array_diff(preg_replace('/^((?!' . $auth_option . ').+)|(' . $auth_option . ')$/', '', array_keys($this->acl_options[$scope])), array(''));

		// If forum_ids is false and the scope is local we actually want to have all forums within the array
		if ($scope == 'local' && !sizeof($forum_ids))
		{
			$sql = 'SELECT forum_id
				FROM ' . FORUMS_TABLE;
			$result = $db->sql_query($sql, 120);

			while ($row = $db->sql_fetchrow($result))
			{
				$forum_ids[] = $row['forum_id'];
			}
			$db->sql_freeresult($result);
		}

		if ($view_user_mask)
		{
			$auth2 = null;

			$sql = 'SELECT user_id, user_permissions, user_type
				FROM ' . USERS_TABLE . '
				WHERE ' . $db->sql_in_set('user_id', $ug_id);
			$result = $db->sql_query($sql);

			while ($userdata = $db->sql_fetchrow($result))
			{
				if ($user->data['user_id'] != $userdata['user_id'])
				{
					$auth2 = new auth();
					$auth2->acl($userdata);
				}
				else
				{
					global $auth;
					$auth2 = &$auth;
				}

				
				$hold_ary[$userdata['user_id']] = array();
				foreach ($forum_ids as $f_id)
				{
					$hold_ary[$userdata['user_id']][$f_id] = array();
					foreach ($compare_options as $option)
					{
						$hold_ary[$userdata['user_id']][$f_id][$option] = $auth2->acl_get($option, $f_id);
					}
				}
			}
			$db->sql_freeresult($result);

			unset($userdata);
			unset($auth2);
		}

		foreach ($ug_id as $_id)
		{
//.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:101,代码来源:auth.php

示例8: viewtopic_php_data

 public function viewtopic_php_data()
 {
     global $user, $db;
     $sql = 'SELECT  pb.id AS pb_id, pb.holding AS pb_holding,
   FROM ' . POINTS_BANK_TABLE . '
   WHERE poster_id = ' . (int) $poster_id;
     $has_account = true;
     $holding = empty($holding) ? array() : $holding;
     $pointslock = $banklock = '';
     if ($config['points_enable']) {
         // Get the points status
         $check_auth = new auth();
         $check_auth->acl($row);
         $pointslock = !$check_auth->acl_get('u_use_points');
         // Get the bank status
         if ($points_config['bank_enable']) {
             $check_auth = new auth();
             $check_auth->acl($row);
             $banklock = !$check_auth->acl_get('u_use_bank');
         }
         if (!isset($row['pb_holding']) && $poster_id > 0) {
             $has_account = false;
         }
         $holding[$poster_id] = $row['pb_holding'] ? $row['pb_holding'] : '0';
     } else {
         $holding[$poster_id] = '0';
     }
 }
开发者ID:FifoF,项目名称:phpbb3.1_ultimate_points,代码行数:28,代码来源:main_listener.php

示例9: change_poster

/**
* Change a post's poster
*/
function change_poster(&$post_info, $userdata)
{
    global $auth, $db, $config;
    if (empty($userdata) || $userdata['user_id'] == $post_info['user_id']) {
        return;
    }
    $post_id = $post_info['post_id'];
    $sql = 'UPDATE ' . POSTS_TABLE . "\n\t\tSET poster_id = {$userdata['user_id']}\n\t\tWHERE post_id = {$post_id}";
    $db->sql_query($sql);
    // Resync topic/forum if needed
    if ($post_info['topic_last_post_id'] == $post_id || $post_info['forum_last_post_id'] == $post_id) {
        sync('topic', 'topic_id', $post_info['topic_id'], false, false);
        sync('forum', 'forum_id', $post_info['forum_id'], false, false);
    }
    // Adjust post counts
    $auth_user_from = new auth();
    $auth_user_from->acl($post_info);
    $auth_user_to = new auth();
    $auth_user_to->acl($userdata);
    // Decrease post count by one for the old user
    if ($auth_user_from->acl_get('f_postcount', $post_info['forum_id'])) {
        $sql = 'UPDATE ' . USERS_TABLE . '
			SET user_posts = user_posts - 1
			WHERE user_id = ' . $post_info['user_id'];
        $db->sql_query($sql);
    }
    // Increase post count by one for the new user
    if ($auth_user_to->acl_get('f_postcount', $post_info['forum_id'])) {
        $sql = 'UPDATE ' . USERS_TABLE . '
			SET user_posts = user_posts + 1
			WHERE user_id = ' . $userdata['user_id'];
        $db->sql_query($sql);
    }
    // Add posted to information for this topic for the new user
    markread('post', $post_info['forum_id'], $post_info['topic_id'], time(), $userdata['user_id']);
    // Remove the dotted topic option if the old user has no more posts within this topic
    if ($config['load_db_track'] && $post_info['user_id'] != ANONYMOUS) {
        $sql = 'SELECT topic_id
			FROM ' . POSTS_TABLE . '
			WHERE topic_id = ' . $post_info['topic_id'] . '
				AND poster_id = ' . $post_info['user_id'];
        $result = $db->sql_query_limit($sql, 1);
        $topic_id = (int) $db->sql_fetchfield('topic_id');
        $db->sql_freeresult($result);
        if (!$topic_id) {
            $sql = 'DELETE FROM ' . TOPICS_POSTED_TABLE . '
				WHERE user_id = ' . $post_info['user_id'] . '
					AND topic_id = ' . $post_info['topic_id'];
            $db->sql_query($sql);
        }
    }
    // Do not change the poster_id within the attachments table, since they were still posted by the original user
    $from_username = $post_info['username'];
    $to_username = $userdata['username'];
    // Renew post info
    $post_info = get_post_data(array($post_id));
    if (!sizeof($post_info)) {
        trigger_error($user->lang['POST_NOT_EXIST']);
    }
    $post_info = $post_info[$post_id];
    // Now add log entry
    add_log('mod', $post_info['forum_id'], $post_info['topic_id'], 'LOG_MCP_CHANGE_POSTER', $post_info['topic_title'], $from_username, $to_username);
}
开发者ID:yunsite,项目名称:gloryroad,代码行数:66,代码来源:mcp_post.php

示例10: array

    /**
     * Get permission mask
     * This function only supports getting permissions of one type (for example a_)
     *
     * @param set|view $mode defines the permissions we get, view gets effective permissions (checking user AND group permissions), set only gets the user or group permission set alone
     * @param mixed $user_id user ids to search for (a user_id or a group_id has to be specified at least)
     * @param mixed $group_id group ids to search for, return group related settings (a user_id or a group_id has to be specified at least)
     * @param mixed $forum_id forum_ids to search for. Defining a forum id also means getting local settings
     * @param string $auth_option the auth_option defines the permission setting to look for (a_ for example)
     * @param local|global $scope the scope defines the permission scope. If local, a forum_id is additionally required
     * @param ACL_NEVER|ACL_NO|ACL_YES $acl_fill defines the mode those permissions not set are getting filled with
     */
    function get_mask($mode, $user_id = false, $group_id = false, $forum_id = false, $auth_option = false, $scope = false, $acl_fill = ACL_NEVER)
    {
        global $db, $user;
        // Mighty Gorgon: we need to define this here to be allowed to use the class later...
        global $cms_permissions;
        $hold_ary = array();
        $view_user_mask = $mode == 'view' && $group_id === false ? true : false;
        if ($auth_option === false || $scope === false) {
            return array();
        }
        $acl_user_function = $mode == 'set' ? 'acl_user_raw_data' : 'acl_raw_data';
        if (!$view_user_mask) {
            if ($forum_id !== false) {
                $hold_ary = $group_id !== false ? $this->acl_group_raw_data($group_id, $auth_option . '%', $forum_id) : $this->{$acl_user_function}($user_id, $auth_option . '%', $forum_id);
            } else {
                $hold_ary = $group_id !== false ? $this->acl_group_raw_data($group_id, $auth_option . '%', $scope == 'global' ? 0 : false) : $this->{$acl_user_function}($user_id, $auth_option . '%', $scope == 'global' ? 0 : false);
            }
        }
        // Make sure hold_ary is filled with every setting (prevents missing forums/users/groups)
        $ug_id = $group_id !== false ? !is_array($group_id) ? array($group_id) : $group_id : (!is_array($user_id) ? array($user_id) : $user_id);
        $forum_ids = $forum_id !== false ? !is_array($forum_id) ? array($forum_id) : $forum_id : ($scope == 'global' ? array(0) : array());
        // Only those options we need
        $compare_options = array_diff(preg_replace('/^((?!' . $auth_option . ').+)|(' . $auth_option . ')$/', '', array_keys($this->acl_options[$scope])), array(''));
        // If forum_ids is false and the scope is local we actually want to have all forums within the array
        if ($scope == 'local' && !sizeof($forum_ids)) {
            // Mighty Gorgon: phpBB only uses local for forums, while we want to use this magic feature also for CMS!!!
            if (!empty($cms_permissions->id_type) && method_exists($cms_permissions, 'check_existence')) {
                $ids = array();
                $ids_data = $cms_permissions->check_existence($cms_permissions->id_type, $ids, true);
                foreach ($ids_data as $id_data) {
                    $forum_ids[] = (int) $id_data['id'];
                }
            } else {
                $sql = 'SELECT forum_id
					FROM ' . FORUMS_TABLE;
                $result = $db->sql_query($sql, 120);
                while ($row = $db->sql_fetchrow($result)) {
                    $forum_ids[] = (int) $row['forum_id'];
                }
                $db->sql_freeresult($result);
            }
        }
        if ($view_user_mask) {
            $auth2 = null;
            $sql = 'SELECT user_id, user_permissions, user_type
				FROM ' . USERS_TABLE . '
				WHERE ' . $db->sql_in_set('user_id', $ug_id);
            $result = $db->sql_query($sql);
            while ($userdata = $db->sql_fetchrow($result)) {
                if ($user->data['user_id'] != $userdata['user_id']) {
                    $auth2 = new auth();
                    $auth2->acl($userdata);
                } else {
                    global $auth;
                    $auth2 =& $auth;
                }
                $hold_ary[$userdata['user_id']] = array();
                foreach ($forum_ids as $f_id) {
                    $hold_ary[$userdata['user_id']][$f_id] = array();
                    foreach ($compare_options as $option) {
                        $hold_ary[$userdata['user_id']][$f_id][$option] = $auth2->acl_get($option, $f_id);
                    }
                }
            }
            $db->sql_freeresult($result);
            unset($userdata);
            unset($auth2);
        }
        foreach ($ug_id as $_id) {
            if (!isset($hold_ary[$_id])) {
                $hold_ary[$_id] = array();
            }
            foreach ($forum_ids as $f_id) {
                if (!isset($hold_ary[$_id][$f_id])) {
                    $hold_ary[$_id][$f_id] = array();
                }
            }
        }
        // Now, we need to fill the gaps with $acl_fill. ;)
        // Now switch back to keys
        if (sizeof($compare_options)) {
            $compare_options = array_combine($compare_options, array_fill(1, sizeof($compare_options), $acl_fill));
        }
        // Defining the user-function here to save some memory
        $return_acl_fill = create_function('$value', 'return ' . $acl_fill . ';');
        // Actually fill the gaps
        if (sizeof($hold_ary)) {
            foreach ($hold_ary as $ug_id => $row) {
//.........这里部分代码省略.........
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:101,代码来源:class_auth_admin.php


注:本文中的auth::acl_get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。