• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP user_ban函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中user_ban函数的典型用法代码示例。如果您正苦于以下问题:PHP user_ban函数的具体用法?PHP user_ban怎么用?PHP user_ban使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: main

 function main($id, $mode)
 {
     global $config, $db, $user, $auth, $template, $cache;
     global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
     include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
     $bansubmit = isset($_POST['bansubmit']) ? true : false;
     $unbansubmit = isset($_POST['unbansubmit']) ? true : false;
     $current_time = time();
     $user->add_lang(array('acp/ban', 'acp/users'));
     $this->tpl_name = 'acp_ban';
     $form_key = 'acp_ban';
     add_form_key($form_key);
     if (($bansubmit || $unbansubmit) && !check_form_key($form_key)) {
         trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
     }
     // Ban submitted?
     if ($bansubmit) {
         // Grab the list of entries
         $ban = utf8_normalize_nfc(request_var('ban', '', true));
         $ban_len = request_var('banlength', 0);
         $ban_len_other = request_var('banlengthother', '');
         $ban_exclude = request_var('banexclude', 0);
         $ban_reason = utf8_normalize_nfc(request_var('banreason', '', true));
         $ban_give_reason = utf8_normalize_nfc(request_var('bangivereason', '', true));
         if ($ban) {
             user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reason, $ban_give_reason);
             trigger_error($user->lang['BAN_UPDATE_SUCCESSFUL'] . adm_back_link($this->u_action));
         }
     } else {
         if ($unbansubmit) {
             $ban = request_var('unban', array(''));
             if ($ban) {
                 user_unban($mode, $ban);
                 trigger_error($user->lang['BAN_UPDATE_SUCCESSFUL'] . adm_back_link($this->u_action));
             }
         }
     }
     // Define language vars
     $this->page_title = $user->lang[strtoupper($mode) . '_BAN'];
     $l_ban_explain = $user->lang[strtoupper($mode) . '_BAN_EXPLAIN'];
     $l_ban_exclude_explain = $user->lang[strtoupper($mode) . '_BAN_EXCLUDE_EXPLAIN'];
     $l_unban_title = $user->lang[strtoupper($mode) . '_UNBAN'];
     $l_unban_explain = $user->lang[strtoupper($mode) . '_UNBAN_EXPLAIN'];
     $l_no_ban_cell = $user->lang[strtoupper($mode) . '_NO_BANNED'];
     switch ($mode) {
         case 'user':
             $l_ban_cell = $user->lang['USERNAME'];
             break;
         case 'ip':
             $l_ban_cell = $user->lang['IP_HOSTNAME'];
             break;
         case 'email':
             $l_ban_cell = $user->lang['EMAIL_ADDRESS'];
             break;
     }
     $this->display_ban_options($mode);
     $template->assign_vars(array('L_TITLE' => $this->page_title, 'L_EXPLAIN' => $l_ban_explain, 'L_UNBAN_TITLE' => $l_unban_title, 'L_UNBAN_EXPLAIN' => $l_unban_explain, 'L_BAN_CELL' => $l_ban_cell, 'L_BAN_EXCLUDE_EXPLAIN' => $l_ban_exclude_explain, 'L_NO_BAN_CELL' => $l_no_ban_cell, 'S_USERNAME_BAN' => $mode == 'user' ? true : false, 'U_ACTION' => $this->u_action, 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=searchuser&form=acp_ban&field=ban')));
 }
开发者ID:ahmatjan,项目名称:Crimson,代码行数:58,代码来源:acp_ban.php


示例2: main

 function main($id, $mode)
 {
     global $config, $db, $user, $auth, $template, $cache;
     global $phpbb_root_path, $phpEx;
     include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
     // Include the admin banning interface...
     include $phpbb_root_path . 'includes/acp/acp_ban.' . $phpEx;
     $bansubmit = isset($_POST['bansubmit']) ? true : false;
     $unbansubmit = isset($_POST['unbansubmit']) ? true : false;
     $current_time = time();
     $user->add_lang('acp/ban');
     $this->tpl_name = 'mcp_ban';
     // Ban submitted?
     if ($bansubmit) {
         // Grab the list of entries
         $ban = request_var('ban', '');
         $ban_len = request_var('banlength', 0);
         $ban_len_other = request_var('banlengthother', '');
         $ban_exclude = request_var('banexclude', 0);
         $ban_reason = request_var('banreason', '', true);
         $ban_give_reason = request_var('bangivereason', '', true);
         user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reason, $ban_give_reason);
         trigger_error($user->lang['BAN_UPDATE_SUCCESSFUL'] . '<br /><br /><a href="' . $this->u_action . '">&laquo; ' . $user->lang['BACK_TO_PREV'] . '</a>');
     } else {
         if ($unbansubmit) {
             $ban = request_var('unban', array(''));
             user_unban($mode, $ban);
             trigger_error($user->lang['BAN_UPDATE_SUCCESSFUL'] . '<br /><br /><a href="' . $this->u_action . '">&laquo; ' . $user->lang['BACK_TO_PREV'] . '</a>');
         }
     }
     // Ban length options
     $ban_end_text = array(0 => $user->lang['PERMANENT'], 30 => $user->lang['30_MINS'], 60 => $user->lang['1_HOUR'], 360 => $user->lang['6_HOURS'], 1440 => $user->lang['1_DAY'], 10080 => $user->lang['7_DAYS'], 20160 => $user->lang['2_WEEKS'], 40320 => $user->lang['1_MONTH'], -1 => $user->lang['UNTIL'] . ' -&gt; ');
     $ban_end_options = '';
     foreach ($ban_end_text as $length => $text) {
         $ban_end_options .= '<option value="' . $length . '">' . $text . '</option>';
     }
     // Define language vars
     $this->page_title = $user->lang[strtoupper($mode) . '_BAN'];
     $l_ban_explain = $user->lang[strtoupper($mode) . '_BAN_EXPLAIN'];
     $l_ban_exclude_explain = $user->lang[strtoupper($mode) . '_BAN_EXCLUDE_EXPLAIN'];
     $l_unban_title = $user->lang[strtoupper($mode) . '_UNBAN'];
     $l_unban_explain = $user->lang[strtoupper($mode) . '_UNBAN_EXPLAIN'];
     $l_no_ban_cell = $user->lang[strtoupper($mode) . '_NO_BANNED'];
     switch ($mode) {
         case 'user':
             $l_ban_cell = $user->lang['USERNAME'];
             break;
         case 'ip':
             $l_ban_cell = $user->lang['IP_HOSTNAME'];
             break;
         case 'email':
             $l_ban_cell = $user->lang['EMAIL_ADDRESS'];
             break;
     }
     acp_ban::display_ban_options($mode);
     $template->assign_vars(array('L_TITLE' => $this->page_title, 'L_EXPLAIN' => $l_ban_explain, 'L_UNBAN_TITLE' => $l_unban_title, 'L_UNBAN_EXPLAIN' => $l_unban_explain, 'L_BAN_CELL' => $l_ban_cell, 'L_BAN_EXCLUDE_EXPLAIN' => $l_ban_exclude_explain, 'L_NO_BAN_CELL' => $l_no_ban_cell, 'S_USERNAME_BAN' => $mode == 'user' ? true : false, 'U_ACTION' => $this->u_action, 'U_FIND_USER' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=searchuser&amp;form=mcp_ban&amp;field=ban')));
 }
开发者ID:yunsite,项目名称:gloryroad,代码行数:57,代码来源:mcp_ban.php


示例3: post_funct

 public function post_funct($event)
 {
     if ($this->config['autoban_active'] && $event['user_row']['user_warnings'] + 1 >= $this->config['autoban_count']) {
         if (!function_exists('user_ban')) {
             include $this->root_path . 'includes/functions_user.' . $this->php_ext;
         }
         user_ban('user', utf8_normalize_nfc($event['user_row']['username']), $this->config['autoban_duration'] * 60 * 24, '', '', $this->config['autoban_reason'], $this->config['autoban_reason']);
     }
 }
开发者ID:cracknel,项目名称:ubuntudanmark.dk,代码行数:9,代码来源:mainlistener.php


示例4: main

    function main($id, $mode)
    {
        global $config, $db, $user, $auth, $template, $cache;
        global $phpbb_root_path, $phpEx;
        include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
        // Include the admin banning interface...
        include $phpbb_root_path . 'includes/acp/acp_ban.' . $phpEx;
        $bansubmit = isset($_POST['bansubmit']) ? true : false;
        $unbansubmit = isset($_POST['unbansubmit']) ? true : false;
        $current_time = time();
        $user->add_lang(array('acp/ban', 'acp/users'));
        $this->tpl_name = 'mcp_ban';
        // Ban submitted?
        if ($bansubmit) {
            // Grab the list of entries
            $ban = request_var('ban', '', $mode === 'user' ? true : false);
            if ($mode === 'user') {
                $ban = utf8_normalize_nfc($ban);
            }
            $ban_len = request_var('banlength', 0);
            $ban_len_other = request_var('banlengthother', '');
            $ban_exclude = request_var('banexclude', 0);
            $ban_reason = utf8_normalize_nfc(request_var('banreason', '', true));
            $ban_give_reason = utf8_normalize_nfc(request_var('bangivereason', '', true));
            if ($ban) {
                if (confirm_box(true)) {
                    user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reason, $ban_give_reason);
                    trigger_error($user->lang['BAN_UPDATE_SUCCESSFUL'] . '<br /><br /><a href="' . $this->u_action . '">&laquo; ' . $user->lang['BACK_TO_PREV'] . '</a>');
                } else {
                    confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array('mode' => $mode, 'ban' => $ban, 'bansubmit' => true, 'banlength' => $ban_len, 'banlengthother' => $ban_len_other, 'banexclude' => $ban_exclude, 'banreason' => $ban_reason, 'bangivereason' => $ban_give_reason)));
                }
            }
        } else {
            if ($unbansubmit) {
                $ban = request_var('unban', array(''));
                if ($ban) {
                    if (confirm_box(true)) {
                        user_unban($mode, $ban);
                        trigger_error($user->lang['BAN_UPDATE_SUCCESSFUL'] . '<br /><br /><a href="' . $this->u_action . '">&laquo; ' . $user->lang['BACK_TO_PREV'] . '</a>');
                    } else {
                        confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array('mode' => $mode, 'unbansubmit' => true, 'unban' => $ban)));
                    }
                }
            }
        }
        // Ban length options
        $ban_end_text = array(0 => $user->lang['PERMANENT'], 30 => $user->lang['30_MINS'], 60 => $user->lang['1_HOUR'], 360 => $user->lang['6_HOURS'], 1440 => $user->lang['1_DAY'], 10080 => $user->lang['7_DAYS'], 20160 => $user->lang['2_WEEKS'], 40320 => $user->lang['1_MONTH'], -1 => $user->lang['UNTIL'] . ' -&gt; ');
        $ban_end_options = '';
        foreach ($ban_end_text as $length => $text) {
            $ban_end_options .= '<option value="' . $length . '">' . $text . '</option>';
        }
        // Define language vars
        $this->page_title = $user->lang[strtoupper($mode) . '_BAN'];
        $l_ban_explain = $user->lang[strtoupper($mode) . '_BAN_EXPLAIN'];
        $l_ban_exclude_explain = $user->lang[strtoupper($mode) . '_BAN_EXCLUDE_EXPLAIN'];
        $l_unban_title = $user->lang[strtoupper($mode) . '_UNBAN'];
        $l_unban_explain = $user->lang[strtoupper($mode) . '_UNBAN_EXPLAIN'];
        $l_no_ban_cell = $user->lang[strtoupper($mode) . '_NO_BANNED'];
        switch ($mode) {
            case 'user':
                $l_ban_cell = $user->lang['USERNAME'];
                break;
            case 'ip':
                $l_ban_cell = $user->lang['IP_HOSTNAME'];
                break;
            case 'email':
                $l_ban_cell = $user->lang['EMAIL_ADDRESS'];
                break;
        }
        acp_ban::display_ban_options($mode);
        $template->assign_vars(array('L_TITLE' => $this->page_title, 'L_EXPLAIN' => $l_ban_explain, 'L_UNBAN_TITLE' => $l_unban_title, 'L_UNBAN_EXPLAIN' => $l_unban_explain, 'L_BAN_CELL' => $l_ban_cell, 'L_BAN_EXCLUDE_EXPLAIN' => $l_ban_exclude_explain, 'L_NO_BAN_CELL' => $l_no_ban_cell, 'S_USERNAME_BAN' => $mode == 'user' ? true : false, 'U_ACTION' => $this->u_action, 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=searchuser&amp;form=mcp_ban&amp;field=ban')));
        if ($mode === 'email' && !$auth->acl_get('a_user')) {
            return;
        }
        // As a "service" we will check if any post id is specified and populate the username of the poster id if given
        $post_id = request_var('p', 0);
        $user_id = request_var('u', 0);
        $username = $pre_fill = false;
        if ($user_id && $user_id != ANONYMOUS) {
            $sql = 'SELECT username, user_email, user_ip
				FROM ' . USERS_TABLE . '
				WHERE user_id = ' . $user_id;
            $result = $db->sql_query($sql);
            switch ($mode) {
                case 'user':
                    $pre_fill = (string) $db->sql_fetchfield('username');
                    break;
                case 'ip':
                    $pre_fill = (string) $db->sql_fetchfield('user_ip');
                    break;
                case 'email':
                    $pre_fill = (string) $db->sql_fetchfield('user_email');
                    break;
            }
            $db->sql_freeresult($result);
        } else {
            if ($post_id) {
                $post_info = get_post_data($post_id, 'm_ban');
                if (sizeof($post_info) && !empty($post_info[$post_id])) {
                    switch ($mode) {
//.........这里部分代码省略.........
开发者ID:puring0815,项目名称:OpenKore,代码行数:101,代码来源:mcp_ban.php


示例5: main


//.........这里部分代码省略.........
                            confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array('u' => $user_id, 'i' => $id, 'mode' => $mode, 'action' => $action, 'update' => true, 'delete' => 1, 'delete_type' => $delete_type)));
                        }
                    }
                    // Handle quicktool actions
                    switch ($action) {
                        case 'banuser':
                        case 'banemail':
                        case 'banip':
                            $ban = array();
                            switch ($action) {
                                case 'banuser':
                                    $ban[] = $user_row['username'];
                                    $reason = 'USER_ADMIN_BAN_NAME_REASON';
                                    $log = 'LOG_USER_BAN_USER';
                                    break;
                                case 'banemail':
                                    $ban[] = $user_row['user_email'];
                                    $reason = 'USER_ADMIN_BAN_EMAIL_REASON';
                                    $log = 'LOG_USER_BAN_EMAIL';
                                    break;
                                case 'banip':
                                    $ban[] = $user_row['user_ip'];
                                    $sql = 'SELECT DISTINCT poster_ip
										FROM ' . POSTS_TABLE . "\n\t\t\t\t\t\t\t\t\t\tWHERE poster_id = {$user_id}";
                                    $result = $db->sql_query($sql);
                                    while ($row = $db->sql_fetchrow($result)) {
                                        $ban[] = $row['poster_ip'];
                                    }
                                    $db->sql_freeresult($result);
                                    $reason = 'USER_ADMIN_BAN_IP_REASON';
                                    $log = 'LOG_USER_BAN_IP';
                                    break;
                            }
                            user_ban(substr($action, 3), $ban, 0, 0, 0, $user->lang[$reason]);
                            add_log('admin', $log, $user->lang[$reason]);
                            add_log('user', $user_id, $log, $user->lang[$reason]);
                            trigger_error($user->lang['BAN_SUCCESSFUL'] . adm_back_link($this->u_action . '&amp;u=' . $user_id));
                            break;
                        case 'reactivate':
                            if ($config['email_enable']) {
                                include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
                                $server_url = generate_board_url();
                                $user_actkey = gen_rand_string(10);
                                $key_len = 54 - strlen($server_url);
                                $key_len = $key_len > 6 ? $key_len : 6;
                                $user_actkey = substr($user_actkey, 0, $key_len);
                                if ($user_row['user_type'] != USER_INACTIVE) {
                                    user_active_flip($user_id, $user_row['user_type'], $user_actkey, $user_row['username']);
                                }
                                $messenger = new messenger(false);
                                $messenger->template('user_resend_inactive', $user_row['user_lang']);
                                $messenger->replyto($config['board_contact']);
                                $messenger->to($user_row['user_email'], $user_row['username']);
                                $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
                                $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
                                $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
                                $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
                                $messenger->assign_vars(array('SITENAME' => $config['sitename'], 'WELCOME_MSG' => sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename']), 'USERNAME' => html_entity_decode($user_row['username']), 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user_row['user_id']}&k={$user_actkey}"));
                                $messenger->send(NOTIFY_EMAIL);
                                add_log('admin', 'LOG_USER_REACTIVATE', $user_row['username']);
                                add_log('user', $user_id, 'LOG_USER_REACTIVATE_USER');
                                trigger_error($user->lang['FORCE_REACTIVATION_SUCCESS'] . adm_back_link($this->u_action . '&amp;u=' . $user_id));
                            }
                            break;
                        case 'active':
                            user_active_flip($user_id, $user_row['user_type'], false, $user_row['username']);
开发者ID:yunsite,项目名称:gloryroad,代码行数:67,代码来源:acp_users.php


示例6: main

    function main($id, $mode)
    {
        global $db, $user, $auth, $template, $request, $phpbb_dispatcher;
        global $phpbb_root_path, $phpEx;
        include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
        // Include the admin banning interface...
        include $phpbb_root_path . 'includes/acp/acp_ban.' . $phpEx;
        $bansubmit = $request->is_set_post('bansubmit');
        $unbansubmit = $request->is_set_post('unbansubmit');
        $user->add_lang(array('acp/ban', 'acp/users'));
        $this->tpl_name = 'mcp_ban';
        /**
         * Use this event to pass perform actions when a ban is issued or revoked
         *
         * @event core.mcp_ban_main
         * @var	bool	bansubmit	True if a ban is issued
         * @var	bool	unbansubmit	True if a ban is removed
         * @var	string	mode		Mode of the ban that is being worked on
         * @since 3.1.0-RC5
         */
        $vars = array('bansubmit', 'unbansubmit', 'mode');
        extract($phpbb_dispatcher->trigger_event('core.mcp_ban_main', compact($vars)));
        // Ban submitted?
        if ($bansubmit) {
            // Grab the list of entries
            $ban = $request->variable('ban', '', $mode === 'user');
            $ban_length = $request->variable('banlength', 0);
            $ban_length_other = $request->variable('banlengthother', '');
            $ban_exclude = $request->variable('banexclude', 0);
            $ban_reason = $request->variable('banreason', '', true);
            $ban_give_reason = $request->variable('bangivereason', '', true);
            if ($ban) {
                if (confirm_box(true)) {
                    $abort_ban = false;
                    /**
                     * Use this event to modify the ban details before the ban is performed
                     *
                     * @event core.mcp_ban_before
                     * @var	string	mode				One of the following: user, ip, email
                     * @var	string	ban					Either string or array with usernames, ips or email addresses
                     * @var	int		ban_length			Ban length in minutes
                     * @var	string	ban_length_other	Ban length as a date (YYYY-MM-DD)
                     * @var	bool	ban_exclude			Are we banning or excluding from another ban
                     * @var	string	ban_reason			Ban reason displayed to moderators
                     * @var	string	ban_give_reason		Ban reason displayed to the banned user
                     * @var	mixed	abort_ban			Either false, or an error message that is displayed to the user.
                     *									If a string is given the bans are not issued.
                     * @since 3.1.0-RC5
                     */
                    $vars = array('mode', 'ban', 'ban_length', 'ban_length_other', 'ban_exclude', 'ban_reason', 'ban_give_reason', 'abort_ban');
                    extract($phpbb_dispatcher->trigger_event('core.mcp_ban_before', compact($vars)));
                    if ($abort_ban) {
                        trigger_error($abort_ban);
                    }
                    user_ban($mode, $ban, $ban_length, $ban_length_other, $ban_exclude, $ban_reason, $ban_give_reason);
                    /**
                     * Use this event to perform actions after the ban has been performed
                     *
                     * @event core.mcp_ban_after
                     * @var	string	mode				One of the following: user, ip, email
                     * @var	string	ban					Either string or array with usernames, ips or email addresses
                     * @var	int		ban_length			Ban length in minutes
                     * @var	string	ban_length_other	Ban length as a date (YYYY-MM-DD)
                     * @var	bool	ban_exclude			Are we banning or excluding from another ban
                     * @var	string	ban_reason			Ban reason displayed to moderators
                     * @var	string	ban_give_reason		Ban reason displayed to the banned user
                     * @since 3.1.0-RC5
                     */
                    $vars = array('mode', 'ban', 'ban_length', 'ban_length_other', 'ban_exclude', 'ban_reason', 'ban_give_reason');
                    extract($phpbb_dispatcher->trigger_event('core.mcp_ban_after', compact($vars)));
                    trigger_error($user->lang['BAN_UPDATE_SUCCESSFUL'] . '<br /><br /><a href="' . $this->u_action . '">&laquo; ' . $user->lang['BACK_TO_PREV'] . '</a>');
                } else {
                    $hidden_fields = array('mode' => $mode, 'ban' => $ban, 'bansubmit' => true, 'banlength' => $ban_length, 'banlengthother' => $ban_length_other, 'banexclude' => $ban_exclude, 'banreason' => $ban_reason, 'bangivereason' => $ban_give_reason);
                    /**
                     * Use this event to pass data from the ban form to the confirmation screen
                     *
                     * @event core.mcp_ban_confirm
                     * @var	array	hidden_fields	Hidden fields that are passed through the confirm screen
                     * @since 3.1.0-RC5
                     */
                    $vars = array('hidden_fields');
                    extract($phpbb_dispatcher->trigger_event('core.mcp_ban_confirm', compact($vars)));
                    confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($hidden_fields));
                }
            }
        } else {
            if ($unbansubmit) {
                $ban = $request->variable('unban', array(''));
                if ($ban) {
                    if (confirm_box(true)) {
                        user_unban($mode, $ban);
                        trigger_error($user->lang['BAN_UPDATE_SUCCESSFUL'] . '<br /><br /><a href="' . $this->u_action . '">&laquo; ' . $user->lang['BACK_TO_PREV'] . '</a>');
                    } else {
                        confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array('mode' => $mode, 'unbansubmit' => true, 'unban' => $ban)));
                    }
                }
            }
        }
        // Ban length options
        $ban_end_text = array(0 => $user->lang['PERMANENT'], 30 => $user->lang['30_MINS'], 60 => $user->lang['1_HOUR'], 360 => $user->lang['6_HOURS'], 1440 => $user->lang['1_DAY'], 10080 => $user->lang['7_DAYS'], 20160 => $user->lang['2_WEEKS'], 40320 => $user->lang['1_MONTH'], -1 => $user->lang['UNTIL'] . ' -&gt; ');
//.........这里部分代码省略.........
开发者ID:Tarendai,项目名称:spring-website,代码行数:101,代码来源:mcp_ban.php


示例7: main


//.........这里部分代码省略.........
									$reason = 'USER_ADMIN_BAN_NAME_REASON';
									$log = 'LOG_USER_BAN_USER';
								break;

								case 'banemail':
									$ban[] = $user_row['user_email'];
									$reason = 'USER_ADMIN_BAN_EMAIL_REASON';
									$log = 'LOG_USER_BAN_EMAIL';
								break;

								case 'banip':
									$ban[] = $user_row['user_ip'];

									$sql = 'SELECT DISTINCT poster_ip
										FROM ' . POSTS_TABLE . "
										WHERE poster_id = $user_id";
									$result = $db->sql_query($sql);

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

									$reason = 'USER_ADMIN_BAN_IP_REASON';
									$log = 'LOG_USER_BAN_IP';
								break;
							}

							$ban_reason = utf8_normalize_nfc(request_var('ban_reason', $user->lang[$reason], true));
							$ban_give_reason = utf8_normalize_nfc(request_var('ban_give_reason', '', true));

							// Log not used at the moment, we simply utilize the ban function.
							$result = user_ban(substr($action, 3), $ban, 0, 0, 0, $ban_reason, $ban_give_reason);

							trigger_error((($result === false) ? $user->lang['BAN_ALREADY_ENTERED'] : $user->lang['BAN_SUCCESSFUL']) . adm_back_link($this->u_action . '&amp;u=' . $user_id));

						break;

						case 'reactivate':

							if ($user_id == $user->data['user_id'])
							{
								trigger_error($user->lang['CANNOT_FORCE_REACT_YOURSELF'] . adm_back_link($this->u_action . '&amp;u=' . $user_id), E_USER_WARNING);
							}

							if (!check_form_key($form_name))
							{
								trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&amp;u=' . $user_id), E_USER_WARNING);
							}

							if ($user_row['user_type'] == USER_FOUNDER)
							{
								trigger_error($user->lang['CANNOT_FORCE_REACT_FOUNDER'] . adm_back_link($this->u_action . '&amp;u=' . $user_id), E_USER_WARNING);
							}

							if ($user_row['user_type'] == USER_IGNORE)
							{
								trigger_error($user->lang['CANNOT_FORCE_REACT_BOT'] . adm_back_link($this->u_action . '&amp;u=' . $user_id), E_USER_WARNING);
							}

							if ($config['email_enable'])
							{
								include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);

								$server_url = generate_board_url();
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:67,代码来源:acp_users.php


示例8: main

 function main($id, $mode)
 {
     global $user, $template, $request, $phpbb_dispatcher;
     global $phpbb_root_path, $phpEx;
     include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
     $bansubmit = $request->is_set_post('bansubmit');
     $unbansubmit = $request->is_set_post('unbansubmit');
     $user->add_lang(array('acp/ban', 'acp/users'));
     $this->tpl_name = 'acp_ban';
     $form_key = 'acp_ban';
     add_form_key($form_key);
     if (($bansubmit || $unbansubmit) && !check_form_key($form_key)) {
         trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
     }
     // Ban submitted?
     if ($bansubmit) {
         // Grab the list of entries
         $ban = $request->variable('ban', '', true);
         $ban_length = $request->variable('banlength', 0);
         $ban_length_other = $request->variable('banlengthother', '');
         $ban_exclude = $request->variable('banexclude', 0);
         $ban_reason = $request->variable('banreason', '', true);
         $ban_give_reason = $request->variable('bangivereason', '', true);
         if ($ban) {
             $abort_ban = false;
             /**
              * Use this event to modify the ban details before the ban is performed
              *
              * @event core.acp_ban_before
              * @var	string	mode				One of the following: user, ip, email
              * @var	string	ban					Either string or array with usernames, ips or email addresses
              * @var	int		ban_length			Ban length in minutes
              * @var	string	ban_length_other	Ban length as a date (YYYY-MM-DD)
              * @var	bool	ban_exclude			Are we banning or excluding from another ban
              * @var	string	ban_reason			Ban reason displayed to moderators
              * @var	string	ban_give_reason		Ban reason displayed to the banned user
              * @var	mixed	abort_ban			Either false, or an error message that is displayed to the user.
              *									If a string is given the bans are not issued.
              * @since 3.1.0-RC5
              */
             $vars = array('mode', 'ban', 'ban_length', 'ban_length_other', 'ban_exclude', 'ban_reason', 'ban_give_reason', 'abort_ban');
             extract($phpbb_dispatcher->trigger_event('core.acp_ban_before', compact($vars)));
             if ($abort_ban) {
                 trigger_error($abort_ban . adm_back_link($this->u_action));
             }
             user_ban($mode, $ban, $ban_length, $ban_length_other, $ban_exclude, $ban_reason, $ban_give_reason);
             /**
              * Use this event to perform actions after the ban has been performed
              *
              * @event core.acp_ban_after
              * @var	string	mode				One of the following: user, ip, email
              * @var	string	ban					Either string or array with usernames, ips or email addresses
              * @var	int		ban_length			Ban length in minutes
              * @var	string	ban_length_other	Ban length as a date (YYYY-MM-DD)
              * @var	bool	ban_exclude			Are we banning or excluding from another ban
              * @var	string	ban_reason			Ban reason displayed to moderators
              * @var	string	ban_give_reason		Ban reason displayed to the banned user
              * @since 3.1.0-RC5
              */
             $vars = array('mode', 'ban', 'ban_length', 'ban_length_other', 'ban_exclude', 'ban_reason', 'ban_give_reason');
             extract($phpbb_dispatcher->trigger_event('core.acp_ban_after', compact($vars)));
             trigger_error($user->lang['BAN_UPDATE_SUCCESSFUL'] . adm_back_link($this->u_action));
         }
     } else {
         if ($unbansubmit) {
             $ban = $request->variable('unban', array(''));
             if ($ban) {
                 user_unban($mode, $ban);
                 trigger_error($user->lang['BAN_UPDATE_SUCCESSFUL'] . adm_back_link($this->u_action));
             }
         }
     }
     // Define language vars
     $this->page_title = $user->lang[strtoupper($mode) . '_BAN'];
     $l_ban_explain = $user->lang[strtoupper($mode) . '_BAN_EXPLAIN'];
     $l_ban_exclude_explain = $user->lang[strtoupper($mode) . '_BAN_EXCLUDE_EXPLAIN'];
     $l_unban_title = $user->lang[strtoupper($mode) . '_UNBAN'];
     $l_unban_explain = $user->lang[strtoupper($mode) . '_UNBAN_EXPLAIN'];
     $l_no_ban_cell = $user->lang[strtoupper($mode) . '_NO_BANNED'];
     switch ($mode) {
         case 'user':
             $l_ban_cell = $user->lang['USERNAME'];
             break;
         case 'ip':
             $l_ban_cell = $user->lang['IP_HOSTNAME'];
             break;
         case 'email':
             $l_ban_cell = $user->lang['EMAIL_ADDRESS'];
             break;
     }
     self::display_ban_options($mode);
     $template->assign_vars(array('L_TITLE' => $this->page_title, 'L_EXPLAIN' => $l_ban_explain, 'L_UNBAN_TITLE' => $l_unban_title, 'L_UNBAN_EXPLAIN' => $l_unban_explain, 'L_BAN_CELL' => $l_ban_cell, 'L_BAN_EXCLUDE_EXPLAIN' => $l_ban_exclude_explain, 'L_NO_BAN_CELL' => $l_no_ban_cell, 'S_USERNAME_BAN' => $mode == 'user' ? true : false, 'U_ACTION' => $this->u_action, 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=searchuser&amp;form=acp_ban&amp;field=ban')));
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:93,代码来源:acp_ban.php


示例9: edit_warning

    /**
     * Insert the edited warning into the database
     */
    function edit_warning($warning_row, $user_row, $warning, $warn_len, $warn_len_other, $warn_type)
    {
        global $db, $cache;
        if (!isset($warning_row) || empty($warning_row)) {
            return false;
        }
        $warn_end = $this->get_warning_end($warn_len, $warn_len_other);
        $warning_type_change = false;
        if ($warning_row['warning_type'] != $warn_type && in_array($warn_type, array(WARNING, BAN))) {
            $warning_type_change = true;
        }
        $sql_warn_ary = array('warning_end' => (int) $warn_end, 'warning_type' => $warn_type);
        $sql_log_ary = array('log_data' => serialize(array($warning)));
        if ($warning_row['warning_type'] == BAN) {
            $sql = 'SELECT ban_id FROM ' . BANLIST_TABLE . ' 
						WHERE ban_userid = ' . $warning_row['user_id'] . ' 
							AND ban_end = ' . $warning_row['warning_end'];
            $result = $db->sql_query($sql);
            $ban_id = $db->sql_fetchfield('ban_id');
            $db->sql_freeresult($result);
            if (!$warning_type_change && $ban_id) {
                $sql_ban_ary = array('ban_end' => (int) $warn_end, 'ban_reason' => (string) $warning, 'ban_give_reason' => (string) $warning);
                $sql = 'UPDATE ' . BANLIST_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ban_ary) . ' WHERE ban_id = ' . $ban_id;
                $db->sql_query($sql);
            }
        }
        if ($warning_type_change) {
            if ($warn_type == WARNING && $ban_id) {
                user_unban('user', $ban_id);
            } else {
                if ($warn_type == BAN) {
                    $ban = utf8_normalize_nfc($user_row['username']);
                    user_ban('user', $ban, $warn_len, $warn_len_other, 0, $warning, $warning);
                }
            }
        }
        // Update warning information - submit new warning and log data to database
        $sql = 'UPDATE ' . WARNINGS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_warn_ary) . ' WHERE warning_id = ' . $warning_row['warning_id'];
        $db->sql_query($sql);
        $sql = 'UPDATE ' . LOG_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_log_ary) . ' WHERE log_id = ' . $warning_row['log_id'];
        $db->sql_query($sql);
        $cache->destroy('sql', WARNINGS_TABLE);
    }
开发者ID:Galixte,项目名称:advanced_warnings,代码行数:46,代码来源:warnings_module.php


示例10: do_ban_hammer_stuff

    public function do_ban_hammer_stuff($event)
    {
        $this->data = $event['member'];
        $this->user_id = (int) $this->data['user_id'];
        $curl_exists = function_exists('curl_init') ? true : false;
        $admin_mod_array = $this->admin_mod_array();
        /**
         * Split these up and give error messages? Later maybe.
         */
        if (!$this->auth->acl_get('m_ban') || $this->data['user_type'] == USER_FOUNDER && $this->user->data['user_type'] != USER_FOUNDER || $this->user_id == $this->user->data['user_id'] || in_array($this->data['user_id'], $admin_mod_array)) {
            // Nothing to see here, move on.
            // Only let founders be banned by other founders.
            // And don't allow them to ban them selves
            return;
        }
        $this->user->add_lang_ext('phpbbmodders/banhammer', 'banhammer_lang');
        // Check if this user already is banned.
        if (!function_exists('phpbb_get_banned_user_ids')) {
            include $this->root_path . 'includes/functions_user.' . $this->php_ext;
        }
        $banned = phpbb_get_banned_user_ids(array($this->user_id));
        if (!empty($banned)) {
            $bh_result = $this->request->variable('bh_res', '');
            if (!empty($bh_result)) {
                if ($bh_result == 'success') {
                    $bh_message = $this->user->lang['BANNED_SUCCESS'];
                } else {
                    // One or more actions failed.
                    $message_ary = explode('+', urldecode($bh_result));
                    $bh_message = $this->user->lang['BANNED_ERROR'];
                    foreach ($message_ary as $error) {
                        $bh_message .= '<br />' . $this->user->lang[$error];
                    }
                }
                $this->template->assign_vars(array('BH_STYLE' => ($bh_result == 'success' ? 'green' : '#a92c2c') . '; color: white;"', 'BH_MESSAGE' => $bh_message));
            } else {
                // It's enough to ban them once.
                $this->template->assign_var('BH_MESSAGE', $this->user->lang['BH_BANNED']);
            }
            return;
        }
        // Get Ban Hammer settings
        $sql = 'SELECT * FROM ' . CONFIG_TEXT_TABLE . "\n\t\t\t\tWHERE config_name = 'banhammer_settings'";
        $result = $this->db->sql_query($sql);
        $settings = $this->db->sql_fetchfield('config_value');
        $this->db->sql_freeresult($result);
        $settings = unserialize($settings);
        if ($settings['group_id']) {
            // Get group name for banned users, if any.
            $sql = 'SELECT group_id, group_name FROM ' . GROUPS_TABLE . '
					WHERE group_id = ' . (int) $settings['group_id'];
            $result = $this->db->sql_query($sql);
            $group_name = $this->db->sql_fetchfield('group_name');
            $this->db->sql_freeresult($result);
            if (empty($group_name)) {
                $settings['group_id'] = 0;
            }
        }
        if (!$this->request->is_set('bh') || $this->request->is_set('bh') && $this->request->is_set('confirm_key') && !confirm_box(true)) {
            $params = array('mode' => 'viewprofile', 'u' => $this->user_id, 'bh' => 1);
            $this->template->assign_vars(array('BH_BAN_EMAIL' => $settings['ban_email'], 'BH_BAN_IP' => $settings['ban_ip'], 'BH_DEL_AVATAR' => $settings['del_avatar'], 'BH_DEL_PRIVMSGS' => $settings['del_privmsgs'], 'BH_DEL_POSTS' => $settings['del_posts'], 'BH_DEL_PROFILE' => $settings['del_profile'], 'BH_DEL_SIGNATURE' => $settings['del_signature'], 'L_BH_MOVE_GROUP' => !empty($group_name) ? sprintf($this->user->lang['BH_MOVE_GROUP'], $group_name) : '', 'S_BH_SFS' => !empty($settings['sfs_api_key']) && $curl_exists ? true : false, 'S_SHOW_BH' => true, 'U_HAMMERBAN' => append_sid($this->root_path . 'memberlist.' . $this->php_ext, $params)));
            return;
        }
        // Time to ban a user. But are you sure?
        if (!confirm_box(true)) {
            $hidden_fields = array('ban_email' => $this->request->variable('ban_email', 0), 'ban_ip' => $this->request->variable('ban_ip', 0), 'bh_reason' => $this->request->variable('bh_reason', '', true), 'bh_reason_user' => $this->request->variable('bh_reason_user', '', true), 'del_avatar' => $this->request->variable('del_avatar', 0), 'del_privmsgs' => $this->request->variable('del_privmsgs', 0), 'del_posts' => $this->request->variable('del_posts', 0), 'del_profile' => $this->request->variable('del_profile', 0), 'del_signature' => $this->request->variable('del_signature', 0), 'mode' => 'viewprofile', 'move_group' => $this->request->variable('move_group', 0), 'sfs_report' => $this->request->variable('sfs_report', 0));
            $message = sprintf($this->user->lang['SURE_BAN'], $this->data['username']) . '<br /><br />';
            $message .= $this->user->lang['THIS_WILL'] . '' . $this->user->lang['COLON'] . '<br />' . $this->user->lang['BH_BAN_USER'] . '<br />';
            $message .= $hidden_fields['ban_email'] ? $this->user->lang['BH_BAN_EMAIL'] . '<br />' : '';
            $message .= $hidden_fields['ban_ip'] ? $this->user->lang['BH_BAN_IP'] . '<br />' : '';
            $message .= $hidden_fields['bh_reason'] ? sprintf($this->user->lang['BH_REASON'], $hidden_fields['bh_reason']) . '<br />' : '';
            $message .= $hidden_fields['bh_reason_user'] ? sprintf($this->user->lang['BH_REASON_USER'], $hidden_fields['bh_reason_user']) . '<br />' : '';
            $message .= $hidden_fields['del_avatar'] ? $this->user->lang['BH_DEL_AVATAR'] . '<br />' : '';
            $message .= $hidden_fields['del_privmsgs'] ? $this->user->lang['BH_DEL_PRIVMSGS'] . '<br />' : '';
            $message .= $hidden_fields['del_posts'] ? $this->user->lang['BH_DEL_POSTS'] . '<br />' : '';
            $message .= $hidden_fields['del_profile'] ? $this->user->lang['BH_DEL_PROFILE'] . '<br />' : '';
            $message .= $hidden_fields['del_signature'] ? $this->user->lang['BH_DEL_SIGNATURE'] . '<br />' : '';
            $message .= !empty($group_name) && $hidden_fields['move_group'] ? sprintf($this->user->lang['BH_MOVE_GROUP'], $group_name) . '<br />' : '';
            $message .= $hidden_fields['sfs_report'] && $curl_exists ? $this->user->lang['BH_SUBMIT_SFS'] . '<br />' : '';
            confirm_box(false, $message, build_hidden_fields($hidden_fields));
        }
        // We have a user to ban.
        $error = array();
        // Any reason for this ban?
        $bh_reason = $this->request->variable('bh_reason', '', true);
        $bh_reason_user = $this->request->variable('bh_reason_user', '', true);
        // The username is the user so it's always banned.
        $success = user_ban('user', $this->data['username'], 0, '', false, $bh_reason, $bh_reason_user);
        if (!$success) {
            $error[] = 'ERROR_BAN_USER';
        }
        if ($this->request->variable('ban_email', 0)) {
            $success = user_ban('email', $this->data['user_email'], 0, '', false, $bh_reason, $bh_reason_user);
            if (!$success) {
                $error[] = 'ERROR_BAN_EMAIL';
            }
        }
        if ($this->request->variable('ban_ip', 0) && !empty($this->data['user_ip'])) {
            $success = user_ban('ip', $this->data['user_ip'], 0, '', false, $bh_reason, $bh_reason_user);
            if (!$success) {
//.........这里部分代码省略.........
开发者ID:alhitary,项目名称:ban-hammer,代码行数:101,代码来源:banhammer_listener.php


示例11: ban_by_ip

 private function ban_by_ip($ip)
 {
     if (!function_exists('user_ban')) {
         include $this->root_path . 'includes/functions_user.' . $this->php_ext;
     }
     // ban the nub for one hour
     user_ban('ip', $ip, 60, 0, false, $this->user->lang['SFS_BANNED'], $this->user->lang['SFS_BANNED']);
     return;
 }
开发者ID:TimoMF,项目名称:phpBB-3.1-stopforumspam,代码行数:9,代码来源:main_listener.php


示例12: ban_user

    /**
     * Ban user by minimum karma;
     */
    function ban_user($user_id = ANONYMOUS)
    {
        // Ban by minimum karma is disabled
        if (!$this->config['ban']) {
            return;
        }
        // We don't have user id
        if ($user_id == ANONYMOUS) {
            return;
        }
        global $db, $user;
        // Catch username
        $sql = 'SELECT username_clean, user_karma, user_karma_powered
			FROM ' . USERS_TABLE . '
			WHERE user_id = ' . $user_id;
        $result = $db->sql_query($sql);
        $row = $db->sql_fetchrow($result);
        $clean_name = $row['username_clean'];
        $karma = $this->config['power'] ? $row['user_karma'] : $row['user_karma_powered'];
        $db->sql_freeresult($result);
        // User doesn't have enought karma, so don't ban
        if ($karma > $this->config['ban_karma']) {
            return;
        }
        // You can't ban yourself
        if ($clean_name == $user->data['username_clean']) {
            return;
        }
        // Create a list of founder...
        $sql = 'SELECT user_id, user_email, username_clean
			FROM ' . USERS_TABLE . '
			WHERE user_type = ' . USER_FOUNDER;
        $result = $db->sql_query($sql);
        while ($row = $db->sql_fetchrow($result)) {
            $founder[$row['user_id']] = $row['user_email'];
            $founder_names[$row['user_id']] = $row['username_clean'];
        }
        $db->sql_freeresult($result);
        // You can't ban founder
        if (in_array($clean_name, $founder_names)) {
            return;
        }
        // Okay, all tests passed and we'll ban user
        $mode = 'ban_userid';
        // Ban by user id
        $ban = $clean_name;
        // Banned user
        $ban_len = 0;
        // Permanent ban
        $ben_len_other = '';
        // This field user, if baning not permanent
        $ban_exclude = '';
        // We don't have excludes from banning
        $ban_reason = $this->config['ban_reason'];
        // Ban reason showed at ACP/MCP
        $ban_give_reason = $this->config['ban_give_reason'];
        // Ban reason showed to user
        // Ban!
        user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reason, $ban_give_reason);
    }
开发者ID:esacinc,项目名称:forum-sitplatform-org-website,代码行数:63,代码来源:functions_karma.php


示例13: insert_ip

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP user_bonus函数代码示例发布时间:2022-05-23
下一篇:
PHP user_avatar_delete函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap