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


PHP user::check_ban方法代码示例

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


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

示例1: user

    /**
     * Display the user rating page
     *
     * @param int $uid	User ID taken from the URL
     * @return Symfony\Component\HttpFoundation\Response A Symfony Response object
     * @access public
     */
    public function user($uid)
    {
        $this->user->add_lang_ext('pico/reputation', 'reputation_rating');
        // Define some variables
        $error = '';
        $is_ajax = $this->request->is_ajax();
        $referer = $this->symfony_request->get('_referer');
        if (empty($this->config['rs_enable'])) {
            if ($is_ajax) {
                $json_response = new \phpbb\json_response();
                $json_data = array('error_msg' => $this->user->lang('RS_DISABLED'));
                $json_response->send($json_data);
            }
            redirect(append_sid("{$this->root_path}index.{$this->php_ext}"));
        }
        if (!$this->config['rs_user_rating'] || !$this->auth->acl_get('u_rs_rate')) {
            $message = $this->user->lang('RS_DISABLED');
            $json_data = array('error_msg' => $message);
            $redirect = append_sid("{$this->root_path}index.{$this->php_ext}");
            $redirect_text = 'RETURN_INDEX';
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
        }
        $sql = 'SELECT user_id, user_type
			FROM ' . USERS_TABLE . "\n\t\t\tWHERE user_id = {$uid}";
        $result = $this->db->sql_query($sql);
        $row = $this->db->sql_fetchrow($result);
        $this->db->sql_freeresult($result);
        if (!$row) {
            $message = $this->user->lang('RS_NO_USER_ID');
            $json_data = array('error_msg' => $message);
            $redirect = append_sid("{$this->root_path}index.{$this->php_ext}");
            $redirect_text = 'RETURN_INDEX';
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
        }
        // Cancel action
        if ($this->request->is_set_post('cancel')) {
            redirect(append_sid("memberlist.{$this->php_ext}", 'mode=viewprofile&u=' . $uid));
        }
        if ($row['user_type'] == USER_IGNORE) {
            $message = $this->user->lang('RS_USER_ANONYMOUS');
            $json_data = array('error_msg' => $message);
            $redirect = append_sid("{$this->root_path}index.{$this->php_ext}");
            $redirect_text = 'RETURN_INDEX';
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
        }
        if ($row['user_id'] == $this->user->data['user_id']) {
            $message = $this->user->lang('RS_SELF');
            $json_data = array('error_msg' => $message);
            $redirect = append_sid("memberlist.{$this->php_ext}", 'mode=viewprofile&u=' . $uid);
            $redirect_text = 'RETURN_PAGE';
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
        }
        // Disallow rating banned users
        if ($this->user->check_ban($uid, false, false, true)) {
            $message = $this->user->lang('RS_USER_BANNED');
            $json_data = array('error_msg' => $message);
            $redirect = append_sid("memberlist.{$this->php_ext}", 'mode=viewprofile&u=' . $uid);
            $redirect_text = 'RETURN_PAGE';
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
        }
        $reputation_type_id = (int) $this->reputation_manager->get_reputation_type_id('user');
        $sql = 'SELECT reputation_id, reputation_time
			FROM ' . $this->reputations_table . "\n\t\t\tWHERE user_id_to = {$uid}\n\t\t\t\tAND user_id_from = {$this->user->data['user_id']}\n\t\t\t\tAND reputation_type_id = {$reputation_type_id}\n\t\t\tORDER by reputation_id DESC";
        $result = $this->db->sql_query($sql);
        $check_user = $this->db->sql_fetchrow($result);
        $this->db->sql_freeresult($result);
        if ($check_user && !$this->config['rs_user_rating_gap']) {
            $message = $this->user->lang('RS_SAME_USER');
            $json_data = array('error_msg' => $message);
            $redirect = append_sid("memberlist.{$this->php_ext}", 'mode=viewprofile&u=' . $uid);
            $redirect_text = 'RETURN_PAGE';
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
        }
        if ($this->config['rs_user_rating_gap'] && time() < $check_user['reputation_time'] + $this->config['rs_user_rating_gap'] * 86400) {
            //Inform user how long he has to wait to rate the user
            $next_vote_time = $check_user['reputation_time'] + $this->config['rs_user_rating_gap'] * 86400 - time();
            $next_vote_in = '';
            $next_vote_in .= intval($next_vote_time / 86400) ? intval($next_vote_time / 86400) . ' ' . $this->user->lang('DAYS') . ' ' : '';
            $next_vote_in .= intval($next_vote_time / 3600 % 24) ? intval($next_vote_time / 3600 % 24) . ' ' . $this->user->lang('HOURS') . ' ' : '';
            $next_vote_in .= intval($next_vote_time / 60 % 60) ? intval($next_vote_time / 60 % 60) . ' ' . $this->user->lang('MINUTES') : '';
            $next_vote_in .= intval($next_vote_time) < 60 ? intval($next_vote_time) . ' ' . $this->user->lang('SECONDS') : '';
            $message = $this->user->lang('RS_USER_GAP', $next_vote_in);
            $json_data = array('error_msg' => $message);
            $redirect = append_sid("memberlist.{$this->php_ext}", 'mode=viewprofile&amp;u=' . $uid);
            $redirect_text = 'RETURN_PAGE';
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
        }
        if ($this->reputation_manager->prevent_rating($uid)) {
            $message = $this->user->lang('RS_SAME_USER');
            $json_data = array('error_msg' => $message);
            $redirect = append_sid("memberlist.{$this->php_ext}", 'mode=viewprofile&amp;u=' . $uid);
            $redirect_text = 'RETURN_TOPIC';
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
//.........这里部分代码省略.........
开发者ID:rampmaster,项目名称:phpBB-Reputation-System,代码行数:101,代码来源:rating_controller.php


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