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


PHP user::optionget方法代码示例

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


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

示例1: viewtopic_modify_data

 /**
  * Show bbcodes and smilies in the quickreply
  * Template data for Ajax submit
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function viewtopic_modify_data($event)
 {
     $forum_id = $event['forum_id'];
     $topic_data = $event['topic_data'];
     $post_list = $event['post_list'];
     $topic_id = $topic_data['topic_id'];
     $s_quick_reply = false;
     if (($this->user->data['is_registered'] || $this->config['qr_allow_for_guests']) && $this->config['allow_quick_reply'] && $topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY && $this->auth->acl_get('f_reply', $forum_id)) {
         // Quick reply enabled forum
         $s_quick_reply = $topic_data['forum_status'] == ITEM_UNLOCKED && $topic_data['topic_status'] == ITEM_UNLOCKED || $this->auth->acl_get('m_edit', $forum_id) ? true : false;
     }
     if (!$this->user->data['is_registered'] && $s_quick_reply) {
         add_form_key('posting');
         $s_attach_sig = $this->config['allow_sig'] && $this->user->optionget('attachsig') && $this->auth->acl_get('f_sigs', $forum_id) && $this->auth->acl_get('u_sig');
         $s_smilies = $this->config['allow_smilies'] && $this->user->optionget('smilies') && $this->auth->acl_get('f_smilies', $forum_id);
         $s_bbcode = $this->config['allow_bbcode'] && $this->user->optionget('bbcode') && $this->auth->acl_get('f_bbcode', $forum_id);
         $s_notify = false;
         $qr_hidden_fields = array('topic_cur_post_id' => (int) $topic_data['topic_last_post_id'], 'lastclick' => (int) time(), 'topic_id' => (int) $topic_data['topic_id'], 'forum_id' => (int) $forum_id);
         // Originally we use checkboxes and check with isset(), so we only provide them if they would be checked
         !$s_bbcode ? $qr_hidden_fields['disable_bbcode'] = 1 : true;
         !$s_smilies ? $qr_hidden_fields['disable_smilies'] = 1 : true;
         !$this->config['allow_post_links'] ? $qr_hidden_fields['disable_magic_url'] = 1 : true;
         $s_attach_sig ? $qr_hidden_fields['attach_sig'] = 1 : true;
         $s_notify ? $qr_hidden_fields['notify'] = 1 : true;
         $topic_data['topic_status'] == ITEM_LOCKED ? $qr_hidden_fields['lock_topic'] = 1 : true;
         $this->template->assign_vars(array('S_QUICK_REPLY' => true, 'U_QR_ACTION' => append_sid("{$this->phpbb_root_path}posting.{$this->php_ext}", "mode=reply&f={$forum_id}&t={$topic_id}"), 'QR_HIDDEN_FIELDS' => build_hidden_fields($qr_hidden_fields), 'USERNAME' => $this->request->variable('username', '', true)));
         if ($this->config['enable_post_confirm']) {
             $captcha = $this->captcha->get_instance($this->config['captcha_plugin']);
             $captcha->init(CONFIRM_POST);
         }
         if ($this->config['enable_post_confirm'] && (isset($captcha) && $captcha->is_solved() === false)) {
             $this->template->assign_vars(array('S_CONFIRM_CODE' => true, 'CAPTCHA_TEMPLATE' => $captcha->get_template()));
         }
         // Add the confirm id/code pair to the hidden fields, else an error is displayed on next submit/preview
         if (isset($captcha) && $captcha->is_solved() !== false) {
             $this->template->append_var('QR_HIDDEN_FIELDS', build_hidden_fields($captcha->get_hidden_fields()));
         }
     }
     // Ajaxify viewtopic data
     if ($this->request->is_ajax() && $this->request->is_set('qr_request')) {
         if (!$this->user->data['is_registered'] && $this->config['enable_post_confirm']) {
             $captcha = $this->captcha->get_instance($this->config['captcha_plugin']);
             $captcha->init(CONFIRM_POST);
             // Add the confirm id/code pair to the hidden fields, else an error is displayed on next submit/preview
             if (isset($captcha) && $captcha->is_solved() !== false) {
                 $this->template->append_var('QR_HIDDEN_FIELDS', build_hidden_fields($captcha->get_hidden_fields()));
             }
         }
         // Fix issues if the inserted post is not the first.
         if ($this->qr_insert && !$this->qr_first) {
             $this->template->alter_block_array('postrow', array('S_FIRST_ROW' => false), false, 'change');
         }
         $page_title = $event['page_title'];
         $this->template->assign_vars(array('S_QUICKREPLY_REQUEST' => true, 'S_QR_NO_FIRST_POST' => $this->qr_insert, 'S_QR_FULL_QUOTE' => $this->config['qr_full_quote']));
         $this->template->append_var('QR_HIDDEN_FIELDS', build_hidden_fields(array('qr' => 1, 'qr_cur_post_id' => (int) max($post_list))));
         // Output the page
         page_header($page_title, false, $forum_id);
         page_footer(false, false, false);
         $json_response = new \phpbb\json_response();
         $json_response->send(array('success' => true, 'result' => $this->template->assign_display('@tatiana5_quickreply/quickreply_template.html', '', true), 'insert' => $this->qr_insert));
     }
     if ($s_quick_reply) {
         include_once $this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext;
         // HTML, BBCode, Smilies, Images and Flash status
         $bbcode_status = $this->config['allow_bbcode'] && $this->config['qr_bbcode'] && $this->auth->acl_get('f_bbcode', $forum_id) ? true : false;
         $smilies_status = $this->config['allow_smilies'] && $this->config['qr_smilies'] && $this->auth->acl_get('f_smilies', $forum_id) ? true : false;
         $img_status = $bbcode_status && $this->auth->acl_get('f_img', $forum_id) ? true : false;
         $url_status = $this->config['allow_post_links'] ? true : false;
         $flash_status = $bbcode_status && $this->auth->acl_get('f_flash', $forum_id) && $this->config['allow_post_flash'] ? true : false;
         $quote_status = true;
         // Build custom bbcodes array
         if ($bbcode_status) {
             display_custom_bbcodes();
         }
         // Generate smiley listing
         if ($smilies_status) {
             generate_smilies('inline', $forum_id);
         }
         // Show attachment box for adding attachments if true
         $form_enctype = @ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$this->config['allow_attachments'] || !$this->auth->acl_get('u_attach') || !$this->auth->acl_get('f_attach', $forum_id) ? '' : '" enctype="multipart/form-data';
         $allowed = $this->auth->acl_get('f_attach', $forum_id) && $this->auth->acl_get('u_attach') && $this->config['allow_attachments'] && $form_enctype;
         $attachment_data = false;
         if ($bbcode_status || $smilies_status || $this->config['qr_attach'] && $allowed) {
             $this->user->add_lang('posting');
         }
         if ($this->config['qr_attach'] && $allowed) {
             $this->template->assign_vars(array('U_QR_ACTION' => append_sid("{$this->phpbb_root_path}posting.{$this->php_ext}", "mode=reply&f={$forum_id}&t={$topic_id}") . $form_enctype));
             include_once $this->phpbb_root_path . 'includes/message_parser.' . $this->php_ext;
             $message_parser = new \parse_message();
             $message_parser->set_plupload($this->plupload);
             $message_parser->set_mimetype_guesser($this->mimetype_guesser);
             $message_parser->get_submitted_attachment_data($this->user->data['user_id']);
//.........这里部分代码省略.........
开发者ID:edipdincer,项目名称:QuickReply,代码行数:101,代码来源:listener.php

示例2: get_display_category

 /**
  * Get the attachment's display category.
  *
  * @return int	Returns ATTACHMENT_CATEGORY_NONE|ATTACHMENT_CATEGORY_IMAGE|ATTACHMENT_CATEGORY_THUMB
  */
 protected function get_display_category()
 {
     $image = ATTACHMENT_CATEGORY_IMAGE;
     $none = ATTACHMENT_CATEGORY_NONE;
     $thumb = ATTACHMENT_CATEGORY_THUMB;
     $display_cat = strpos($this->get('mimetype'), 'image') === 0 ? $image : $none;
     if ($display_cat == $image) {
         if ($this->get('thumbnail')) {
             $display_cat = $thumb;
         } else {
             if ($this->config['img_display_inlined']) {
                 if ($this->config['img_link_width'] || $this->config['img_link_height']) {
                     $dimension = @getimagesize($this->get_filepath());
                     // If the dimensions could not be determined or the image being 0x0 we display it as a link for safety purposes
                     if ($dimension === false || empty($dimension[0]) || empty($dimension[1])) {
                         $display_cat = $none;
                     } else {
                         $display_cat = $dimension[0] <= $this->config['img_link_width'] && $dimension[1] <= $this->config['img_link_height'] ? $image : $none;
                     }
                 }
             } else {
                 $display_cat = $none;
             }
         }
     }
     // Make some decisions based on user options being set.
     if (($display_cat == $image || $display_cat == $thumb) && !$this->user->optionget('viewimg')) {
         $display_cat = $none;
     }
     return $display_cat;
 }
开发者ID:Sajaki,项目名称:customisation-db,代码行数:36,代码来源:attachment.php

示例3: modify_case_img

 /**
  * Changes the regex replacement for second pass
  *
  * @param object $event
  * @return null
  * @access public
  */
 public function modify_case_img($event)
 {
     $bbcode_id = 4;
     // [img] has bbcode_id 4 hardcoded
     $bbcode_cache = $event['bbcode_cache'];
     if (!isset($bbcode_cache[$bbcode_id]) || !$this->user->optionget('viewimg')) {
         return;
     }
     $this->template->set_filenames(array('bbcode.html' => 'bbcode.html'));
     $bbcode = new \bbcode();
     // We need these otherwise we cannot use $bbcode->bbcode_tpl()
     $bbcode->template_bitfield = new \bitfield($this->user->style['bbcode_bitfield']);
     $bbcode->template_filename = $this->template->get_source_file_for_handle('bbcode.html');
     $extimgaslink_boardurl = generate_board_url() . '/';
     $bbcode_cache[$bbcode_id] = array('preg' => array('#\\[img:$uid\\](' . preg_quote($extimgaslink_boardurl, '#') . '.*?)\\[/img:$uid\\]#s' => $bbcode->bbcode_tpl('img', $bbcode_id), '#\\[img:$uid\\](.*?)\\[/img:$uid\\]#s' => str_replace('$2', $this->user->lang('EXTIMGLINK'), $bbcode->bbcode_tpl('url', $bbcode_id, true))));
     $event['bbcode_cache'] = $bbcode_cache;
 }
开发者ID:Galixte,项目名称:phpbb-ext-external-images-as-link,代码行数:24,代码来源:listener.php

示例4: bbcode_cache_init_end

 /**
  * Changes the regex replacement for second pass
  *
  * Based on phpBB.de - External Image as Link from Christian Schnegelberger<blackhawk87@phpbb.de> and Oliver Schramm <elsensee@phpbb.de>
  *
  * @param object $event
  * @return null
  * @access public
  */
 public function bbcode_cache_init_end($event)
 {
     $bbcode_id = 4;
     // [img] has bbcode_id 4 hardcoded
     $bbcode_cache = $event['bbcode_cache'];
     if (!isset($bbcode_cache[$bbcode_id]) || !$this->user->optionget('viewimg')) {
         return;
     }
     $this->template->set_filenames(array('bbcode.html' => 'bbcode.html'));
     $bbcode = new \bbcode();
     // We need these otherwise we cannot use $bbcode->bbcode_tpl()
     $bbcode->template_bitfield = new \bitfield($this->user->style['bbcode_bitfield']);
     $bbcode->template_filename = $this->template->get_source_file_for_handle('bbcode.html');
     $extimgaslink_boardurl = generate_board_url() . '/';
     $url = $this->helper->route('tas2580_imageproxy_main', array());
     $bbcode_cache[$bbcode_id] = array('preg' => array('#\\[img:$uid\\](' . preg_quote($extimgaslink_boardurl, '#') . '.*?)\\[/img:$uid\\]#s' => $bbcode->bbcode_tpl('img', $bbcode_id), '#\\[img:$uid\\](.*?)\\[/img:$uid\\]#s' => str_replace('$1', $url . '?img=$1', $bbcode->bbcode_tpl('img', $bbcode_id, true))));
     $event['bbcode_cache'] = $bbcode_cache;
 }
开发者ID:tas2580,项目名称:imageproxy,代码行数:27,代码来源:listener.php

示例5: addAction

    /**
     * Add & read action
     *
     * @return bool
     */
    private function addAction()
    {
        $this->get = true;
        $message = utf8_normalize_nfc($this->request->variable('message', '', true));
        if (!$message) {
            return;
        }
        $this->clean_message($message);
        $uid = $bitfield = $options = '';
        $allow_bbcode = $this->auth->acl_get('u_ajaxchat_bbcode');
        $allow_urls = $allow_smilies = true;
        generate_text_for_storage($message, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies);
        $sql_ary = ['chat_id' => 1, 'user_id' => $this->user->data['user_id'], 'username' => $this->user->data['username'], 'user_colour' => $this->user->data['user_colour'], 'message' => $message, 'bbcode_bitfield' => $bitfield, 'bbcode_uid' => $uid, 'bbcode_options' => $options, 'time' => time()];
        $sql = 'INSERT INTO ' . CHAT_TABLE . ' ' . $this->db->sql_build_array('INSERT', $sql_ary);
        $this->db->sql_query($sql);
        $sql_ary2 = ['username' => $this->user->data['username'], 'user_colour' => $this->user->data['user_colour'], 'user_lastpost' => time(), 'user_lastupdate' => time()];
        $sql = 'UPDATE ' . CHAT_SESSIONS_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary2) . " WHERE user_id = {$this->user->data['user_id']}";
        $result = $this->db->sql_query($sql);
        $sql = 'SELECT c.*, p.post_visibility, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height
				FROM ' . CHAT_TABLE . ' as c
				LEFT JOIN ' . USERS_TABLE . ' as u ON c.user_id = u.user_id
				LEFT JOIN ' . POSTS_TABLE . ' as p ON c.post_id = p.post_id
				WHERE c.message_id > ' . $this->last_id . '
				ORDER BY c.message_id DESC';
        $result = $this->db->sql_query_limit($sql, (int) $this->config['ajax_chat_chat_amount']);
        $rows = $this->db->sql_fetchrowset($result);
        if (!sizeof($rows) && time() - 60 < $this->last_time) {
            exit;
        }
        foreach ($rows as $row) {
            if ($row['forum_id'] && !$row['post_visibility'] == ITEM_APPROVED && !$this->auth->acl_get('m_approve', $row['forum_id'])) {
                continue;
            }
            if ($row['forum_id'] && !$this->auth->acl_get('f_read', $row['forum_id'])) {
                continue;
            }
            $avatar = ['avatar' => $row['user_avatar'], 'avatar_type' => $row['user_avatar_type'], 'avatar_height' => $row['user_avatar_height'], 'avatar_width' => $row['user_avatar_width']];
            $avatar_thumb = ['avatar' => $row['user_avatar'], 'avatar_type' => $row['user_avatar_type'], 'avatar_height' => '', 'avatar_width' => 35];
            $row['avatar'] = $this->user->optionget('viewavatars') ? phpbb_get_avatar($avatar, '') : '';
            $row['avatar_thumb'] = $this->user->optionget('viewavatars') ? phpbb_get_avatar($avatar_thumb, '') : '';
            if ($this->count++ == 0) {
                $this->last_id = $row['message_id'];
                $this->template->assign_vars(['SOUND_ENABLED' => true, 'SOUND_FILE' => 'soundout']);
            }
            if ($this->config['ajax_chat_time_setting']) {
                $time = $this->config['ajax_chat_time_setting'];
            } else {
                $time = $this->user->data['user_dateformat'];
            }
            $this->template->assign_block_vars('chatrow', ['MESSAGE_ID' => $row['message_id'], 'USERNAME_FULL' => $this->clean_username(get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST'])), 'USERNAME_A' => $row['username'], 'USER_COLOR' => $row['user_colour'], 'MESSAGE' => generate_text_for_display($row['message'], $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options']), 'TIME' => $this->user->format_date($row['time'], $time), 'CLASS' => $row['message_id'] % 2 ? 1 : 2, 'USER_AVATAR' => $row['avatar'], 'USER_AVATAR_THUMB' => $row['avatar_thumb']]);
        }
        $this->db->sql_freeresult($result);
        return;
    }
开发者ID:MrGoldy,项目名称:ajaxchat,代码行数:59,代码来源:popup.php

示例6: readAction

 /**
  * Refresher Read action
  *
  * @return bool
  */
 private function readAction()
 {
     $sql = 'SELECT c.*, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height
             FROM ' . CHAT_TABLE . ' as c
             LEFT JOIN ' . USERS_TABLE . ' as u
             ON c.user_id = u.user_id
             WHERE c.message_id > ' . $this->last_id . '
             ORDER BY message_id DESC';
     $result = $this->db->sql_query_limit($sql, (int) $this->config['ajax_chat_archive_amount']);
     $rows = $this->db->sql_fetchrowset($result);
     if (!sizeof($rows) && time() - 60 < $this->last_time) {
         return;
     }
     foreach ($rows as $row) {
         if ($row['forum_id'] && !$this->auth->acl_get('f_read', $row['forum_id'])) {
             continue;
         }
         $avatar = ['avatar' => $row['user_avatar'], 'avatar_type' => $row['user_avatar_type'], 'avatar_height' => $row['user_avatar_height'], 'avatar_width' => $row['user_avatar_width']];
         $avatar_thumb = ['avatar' => $row['user_avatar'], 'avatar_type' => $row['user_avatar_type'], 'avatar_height' => '', 'avatar_width' => 35];
         $row['avatar'] = $this->user->optionget('viewavatars') ? phpbb_get_avatar($avatar, '') : '';
         $row['avatar_thumb'] = $this->user->optionget('viewavatars') ? phpbb_get_avatar($avatar_thumb, '') : '';
         if ($this->count++ === 0) {
             if ($row['message_id'] !== null) {
                 $this->last_id = $row['message_id'];
             } else {
                 $this->last_id = 0;
             }
             $this->template->assign_vars(['SOUND_ENABLED' => true, 'SOUND_FILE' => 'sound']);
         }
         if ($this->config['ajax_chat_time_setting']) {
             $time = $this->config['ajax_chat_time_setting'];
         } else {
             $time = $this->user->data['user_dateformat'];
         }
         $this->template->assign_block_vars('chatrow', ['MESSAGE_ID' => $row['message_id'], 'USERNAME_FULL' => $this->clean_username(get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST'])), 'USERNAME_A' => $row['username'], 'USER_COLOR' => $row['user_colour'], 'MESSAGE' => make_clickable(generate_text_for_display($row['message'], $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options'])), 'TIME' => $this->user->format_date($row['time'], $time), 'CLASS' => $row['message_id'] % 2 ? 1 : 2, 'USER_AVATAR' => $row['avatar'], 'USER_AVATAR_THUMB' => $row['avatar_thumb']]);
     }
     $this->db->sql_freeresult($result);
     if (time() - 60 > $this->last_time) {
         $sql_ary = ['username' => $this->user->data['username'], 'user_colour' => $this->user->data['user_colour'], 'user_lastupdate' => time()];
         $sql = 'UPDATE ' . CHAT_SESSIONS_TABLE . '
         SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . "\n            WHERE user_id = {$this->user->data['user_id']}";
         $result = $this->db->sql_query($sql);
     }
     $this->get = true;
     return;
 }
开发者ID:sq6jny,项目名称:ajaxchat,代码行数:51,代码来源:archive.php

示例7: __construct

 public function __construct(\phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\db\driver\driver_interface $db, \phpbb\db\tools $db_tools, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\extension\manager $extension_manager, \phpbb\profilefields\manager $profilefields_manager, \phpbb\template\template $template, \phpbb\user $user, \phpbb\path_helper $path_helper, $root_path, $phpEx, $pbwow_config_table, $pbwow_chars_table)
 {
     $this->config = $config;
     $this->cache = $cache;
     $this->db = $db;
     $this->db_tools = $db_tools;
     $this->dispatcher = $dispatcher;
     $this->extension_manager = $extension_manager;
     $this->profilefields_manager = $profilefields_manager;
     $this->template = $template;
     $this->user = $user;
     $this->path_helper = $path_helper;
     $this->root_path = $root_path;
     $this->phpEx = $phpEx;
     $this->pbwow_config_table = $pbwow_config_table;
     $this->pbwow_chars_table = $pbwow_chars_table;
     $this->get_pbwow_config();
     $this->avatars_enabled = $config['allow_avatar'] && $user->optionget('viewavatars') ? true : false;
     $this->avatars_enabled_full = $this->avatars_enabled && $this->pbwow_config['avatars_enable'] ? true : false;
     $this->tp_ext_enabled = $extension_manager->is_enabled('vse/topicpreview');
 }
开发者ID:TurinTurambar,项目名称:PBWoW3ext,代码行数:21,代码来源:pbwow.php

示例8: enable_qr_for_guests

 /**
  * Assign template variables for guests if quick reply is available for them
  *
  * @param int   $forum_id   Forum ID
  * @param array $topic_data Array with topic data
  */
 public function enable_qr_for_guests($forum_id, $topic_data)
 {
     $topic_id = $topic_data['topic_id'];
     add_form_key('posting');
     $s_attach_sig = $this->config['allow_sig'] && $this->user->optionget('attachsig') && $this->auth->acl_get('f_sigs', $forum_id) && $this->auth->acl_get('u_sig');
     $s_smilies = $this->config['allow_smilies'] && $this->user->optionget('smilies') && $this->auth->acl_get('f_smilies', $forum_id);
     $s_bbcode = $this->config['allow_bbcode'] && $this->user->optionget('bbcode') && $this->auth->acl_get('f_bbcode', $forum_id);
     $s_notify = false;
     $qr_hidden_fields = array('topic_cur_post_id' => (int) $topic_data['topic_last_post_id'], 'lastclick' => (int) time(), 'topic_id' => (int) $topic_data['topic_id'], 'forum_id' => (int) $forum_id);
     // Originally we use checkboxes and check with isset(), so we only provide them if they would be checked
     !$s_bbcode ? $qr_hidden_fields['disable_bbcode'] = 1 : true;
     !$s_smilies ? $qr_hidden_fields['disable_smilies'] = 1 : true;
     !$this->config['allow_post_links'] ? $qr_hidden_fields['disable_magic_url'] = 1 : true;
     $s_attach_sig ? $qr_hidden_fields['attach_sig'] = 1 : true;
     $s_notify ? $qr_hidden_fields['notify'] = 1 : true;
     $topic_data['topic_status'] == ITEM_LOCKED ? $qr_hidden_fields['lock_topic'] = 1 : true;
     $this->template->assign_vars(array('S_QUICK_REPLY' => true, 'U_QR_ACTION' => append_sid("{$this->phpbb_root_path}posting.{$this->php_ext}", "mode=reply&amp;f={$forum_id}&amp;t={$topic_id}"), 'QR_HIDDEN_FIELDS' => build_hidden_fields($qr_hidden_fields), 'USERNAME' => $this->request->variable('username', '', true)));
     if ($this->config['enable_post_confirm']) {
         $this->set_captcha();
     }
 }
开发者ID:DataMedics,项目名称:QuickReply,代码行数:27,代码来源:listener_helper.php

示例9: avatars_enabled

 /**
  * Show avatars, given current board and user configurations
  *
  * @return bool
  */
 public function avatars_enabled()
 {
     return (bool) $this->config['topic_preview_avatars'] && $this->config['allow_avatar'] && $this->user->optionget('viewavatars');
 }
开发者ID:VSEphpbb,项目名称:topicpreview,代码行数:9,代码来源:base.php

示例10: configure_user

 /**
  * Configure this renderer as per the user's settings
  *
  * Should set the locale as well as the viewcensor/viewflash/viewimg/viewsmilies options.
  *
  * @param  \phpbb\user          $user
  * @param  \phpbb\config\config $config
  * @param  \phpbb\auth\auth     $auth
  * @return null
  */
 public function configure_user(\phpbb\user $user, \phpbb\config\config $config, \phpbb\auth\auth $auth)
 {
     $censor = $user->optionget('viewcensors') || !$config['allow_nocensors'] || !$auth->acl_get('u_chgcensors');
     $this->set_viewcensors($censor);
     $this->set_viewflash($user->optionget('viewflash'));
     $this->set_viewimg($user->optionget('viewimg'));
     $this->set_viewsmilies($user->optionget('viewsmilies'));
     // Set the stylesheet parameters
     foreach (array_keys($this->renderer->getParameters()) as $param_name) {
         if (strpos($param_name, 'L_') === 0) {
             // L_FOO is set to $user->lang('FOO')
             $this->renderer->setParameter($param_name, $user->lang(substr($param_name, 2)));
         }
     }
     // Set this user's style id and other parameters
     $this->renderer->setParameters(array('S_IS_BOT' => $user->data['is_bot'], 'S_REGISTERED_USER' => $user->data['is_registered'], 'S_USER_LOGGED_IN' => $user->data['user_id'] != ANONYMOUS, 'STYLE_ID' => $user->style['style_id']));
 }
开发者ID:bruninoit,项目名称:phpbb,代码行数:27,代码来源:renderer.php

示例11: render_data_for_page

    /**
     * Method to render the page data
     *
     * @var bool		Bool if the rendering is only for index
     * @return array	Data for page rendering
     */
    public function render_data_for_page($only_for_index = false)
    {
        $include_on_index = $only_for_index === true;
        // Add lang file
        $this->user->add_lang('posting');
        //chat enabled
        if (!$this->config['mchat_enable']) {
            trigger_error($this->user->lang['MCHAT_ENABLE'], E_USER_NOTICE);
        }
        //	avatars
        if (!function_exists('get_user_avatar')) {
            include $this->phpbb_root_path . 'includes/functions_display.' . $this->phpEx;
        }
        if (($this->config_mchat = $this->cache->get('_mchat_config')) === false) {
            $this->functions_mchat->mchat_cache();
        }
        $this->config_mchat = $this->cache->get('_mchat_config');
        // Access rights
        $mchat_allow_bbcode = $this->config['allow_bbcode'] && $this->auth->acl_get('u_mchat_bbcode') ? true : false;
        $mchat_smilies = $this->config['allow_smilies'] && $this->auth->acl_get('u_mchat_smilies') ? true : false;
        $mchat_urls = $this->config['allow_post_links'] && $this->auth->acl_get('u_mchat_urls') ? true : false;
        $mchat_ip = $this->auth->acl_get('u_mchat_ip') ? true : false;
        $mchat_pm = $this->auth->acl_get('u_mchat_pm') ? true : false;
        $mchat_like = $this->auth->acl_get('u_mchat_like') ? true : false;
        $mchat_quote = $this->auth->acl_get('u_mchat_quote') ? true : false;
        $mchat_add_mess = $this->auth->acl_get('u_mchat_use') ? true : false;
        $mchat_view = $this->auth->acl_get('u_mchat_view') ? true : false;
        $mchat_no_flood = $this->auth->acl_get('u_mchat_flood_ignore') ? true : false;
        $mchat_read_archive = $this->auth->acl_get('u_mchat_archive') ? true : false;
        $mchat_founder = $this->user->data['user_type'] == USER_FOUNDER ? true : false;
        $mchat_session_time = !empty($this->config_mchat['timeout']) ? $this->config_mchat['timeout'] : (!empty($this->config['load_online_time']) ? $this->config['load_online_time'] * 60 : $this->config['session_length']);
        $mchat_rules = !empty($this->config_mchat['rules']) || isset($this->user->lang[strtoupper('mchat_rules')]) ? true : false;
        $mchat_avatars = !empty($this->config_mchat['avatars']) && $this->user->optionget('viewavatars') && $this->user->data['user_mchat_avatars'] ? true : false;
        // needed variables
        // Request options.
        $mchat_mode = $this->request->variable('mode', '');
        $mchat_read_mode = $mchat_archive_mode = $mchat_custom_page = $mchat_no_message = false;
        // set redirect if on index or custom page
        $on_page = $include_on_index ? 'index' : 'mchat';
        // grab fools..uhmmm, foes the user has
        $foes_array = array();
        $sql = 'SELECT * FROM ' . ZEBRA_TABLE . '
			WHERE user_id = ' . $this->user->data['user_id'] . '	AND foe = 1';
        $result = $this->db->sql_query($sql);
        while ($row = $this->db->sql_fetchrow($result)) {
            $foes_array[] = $row['zebra_id'];
        }
        $this->db->sql_freeresult($result);
        // Request mode...
        switch ($mchat_mode) {
            // rules popup..
            case 'rules':
                // If the rules are defined in the language file use them, else just use the entry in the database
                if ($mchat_rules || isset($this->user->lang[strtoupper('mchat_rules')])) {
                    if (isset($this->user->lang[strtoupper('mchat_rules')])) {
                        $this->template->assign_var('MCHAT_RULES', $this->user->lang[strtoupper('mchat_rules')]);
                    } else {
                        $mchat_rules = $this->config_mchat['rules'];
                        $mchat_rules = explode("\n", $mchat_rules);
                        foreach ($mchat_rules as $mchat_rule) {
                            $mchat_rule = utf8_htmlspecialchars($mchat_rule);
                            $this->template->assign_block_vars('rule', array('MCHAT_RULE' => $mchat_rule));
                        }
                    }
                    // Output the page
                    // Return for: \$this->helper->render(filename, lang_title);
                    return array('filename' => 'mchat_rules.html', 'lang_title' => $this->user->lang['MCHAT_HELP']);
                } else {
                    // Show no rules
                    trigger_error('MCHAT_NO_RULES', E_USER_NOTICE);
                }
                break;
                // whois function..
            // whois function..
            case 'whois':
                // Must have auths
                if ($mchat_mode == 'whois' && $mchat_ip) {
                    // function already exists..
                    if (!function_exists('user_ipwhois')) {
                        include $this->phpbb_root_path . 'includes/functions_user.' . $this->phpEx;
                    }
                    $this->user_ip = $this->request->variable('ip', '');
                    $this->template->assign_var('WHOIS', user_ipwhois($this->user_ip));
                    // Output the page
                    // Return for: \$this->helper->render(filename, lang_title);
                    return array('filename' => 'viewonline_whois.html', 'lang_title' => $this->user->lang['WHO_IS_ONLINE']);
                } else {
                    // Show not authorized
                    trigger_error('NO_AUTH_OPERATION', E_USER_NOTICE);
                }
                break;
                // Clean function...
            // Clean function...
            case 'clean':
//.........这里部分代码省略.........
开发者ID:ezpz-cz,项目名称:web-plugins,代码行数:101,代码来源:render_helper.php

示例12: display_avatars

 /**
  * Returns true if we need do display avatars in the messages, otherwise false
  *
  * @return bool
  */
 protected function display_avatars()
 {
     return $this->config['mchat_avatars'] && $this->user->optionget('viewavatars') && $this->user->data['user_mchat_avatars'];
 }
开发者ID:EntropyRy,项目名称:mChat-Extension,代码行数:9,代码来源:mchat.php

示例13: index

 /**
  * Modifies the forum index to add the chat
  */
 public function index()
 {
     if ($this->config['prune_ajax_chat'] === true) {
         $this->prune();
     }
     if (!defined('PHPBB_USE_BOARD_URL_PATH')) {
         define('PHPBB_USE_BOARD_URL_PATH', true);
     }
     $this->user->add_lang('posting');
     $this->user->add_lang_ext('spaceace/ajaxchat', 'ajax_chat');
     if (!defined('CHAT_TABLE')) {
         $chat_table = $this->table_prefix . 'ajax_chat';
         define('CHAT_TABLE', $chat_table);
     }
     if (!defined('CHAT_SESSIONS_TABLE')) {
         $chat_session_table = $this->table_prefix . 'ajax_chat_sessions';
         define('CHAT_SESSIONS_TABLE', $chat_session_table);
     }
     include_once $this->root_path . 'includes/functions_posting.' . $this->php_ext;
     include_once $this->root_path . 'includes/functions_display.' . $this->php_ext;
     $this->mode = $this->request->variable('mode', 'default');
     $this->last_id = $this->request->variable('last_id', 0);
     $this->last_time = $this->request->variable('last_time', 0);
     $this->post_time = $this->request->variable('last_post', 0);
     $this->times = ['online' => $this->config['status_online_chat'], 'idle' => $this->config['status_idle_chat'], 'offline' => $this->config['status_offline_chat']];
     $sql = 'SELECT c.*, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height
             FROM ' . CHAT_TABLE . ' as c
             LEFT JOIN ' . USERS_TABLE . ' as u
             ON c.user_id = u.user_id
             ORDER BY message_id DESC';
     $result = $this->db->sql_query_limit($sql, (int) $this->config['ajax_chat_index_amount']);
     $rows = $this->db->sql_fetchrowset($result);
     if (!sizeof($rows) && time() - 60 < $this->last_time) {
         return;
     }
     foreach ($rows as $row) {
         if ($row['forum_id'] && !$this->auth->acl_get('f_read', $row['forum_id'])) {
             continue;
         }
         $avatar = ['avatar' => $row['user_avatar'], 'avatar_type' => $row['user_avatar_type'], 'avatar_height' => $row['user_avatar_height'], 'avatar_width' => $row['user_avatar_width']];
         $avatar_thumb = ['avatar' => $row['user_avatar'], 'avatar_type' => $row['user_avatar_type'], 'avatar_height' => '', 'avatar_width' => 35];
         $row['avatar'] = $this->user->optionget('viewavatars') ? phpbb_get_avatar($avatar, '') : '';
         $row['avatar_thumb'] = $this->user->optionget('viewavatars') ? phpbb_get_avatar($avatar_thumb, '') : '';
         if ($this->count++ == 0) {
             $this->last_id = $row['message_id'];
         }
         if ($this->config['ajax_chat_time_setting']) {
             $time = $this->config['ajax_chat_time_setting'];
         } else {
             $time = $this->user->data['user_dateformat'];
         }
         $this->template->assign_block_vars('chatrow', ['MESSAGE_ID' => $row['message_id'], 'USERNAME_FULL' => $this->clean_username(get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST'])), 'USERNAME_A' => $row['username'], 'USER_COLOR' => $row['user_colour'], 'MESSAGE' => make_clickable(generate_text_for_display($row['message'], $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options'])), 'TIME' => $this->user->format_date($row['time'], $time), 'CLASS' => $row['message_id'] % 2 ? 1 : 2, 'USER_AVATAR' => $row['avatar'], 'USER_AVATAR_THUMB' => $row['avatar_thumb']]);
     }
     $this->db->sql_freeresult($result);
     if ($this->user->data['user_type'] == USER_FOUNDER || $this->user->data['user_type'] == USER_NORMAL) {
         $sql = 'SELECT * FROM ' . CHAT_SESSIONS_TABLE . " WHERE user_id = {$this->user->data['user_id']}";
         $result1 = $this->db->sql_query($sql);
         $row = $this->db->sql_fetchrow($result1);
         $this->db->sql_freeresult($result1);
         if ($row['user_id'] != $this->user->data['user_id']) {
             $sql_ary = ['user_id' => $this->user->data['user_id'], 'username' => $this->user->data['username'], 'user_colour' => $this->user->data['user_colour'], 'user_login' => time(), 'user_lastupdate' => time()];
             $sql = 'INSERT INTO ' . CHAT_SESSIONS_TABLE . ' ' . $this->db->sql_build_array('INSERT', $sql_ary);
             $this->db->sql_query($sql);
         } else {
             $sql_ary = ['username' => $this->user->data['username'], 'user_colour' => $this->user->data['user_colour'], 'user_login' => time(), 'user_lastupdate' => time()];
             $sql = 'UPDATE ' . CHAT_SESSIONS_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . " WHERE user_id = {$this->user->data['user_id']}";
             $this->db->sql_query($sql);
         }
     }
     $bbcode_status = $this->config['allow_bbcode'] && $this->config['auth_bbcode_pm'] && $this->auth->acl_get('u_ajaxchat_bbcode') ? true : false;
     $smilies_status = $this->config['allow_smilies'] && $this->config['auth_smilies_pm'] && $this->auth->acl_get('u_pm_smilies') ? true : false;
     $img_status = $this->config['auth_img_pm'] && $this->auth->acl_get('u_pm_img') ? true : false;
     $flash_status = $this->config['auth_flash_pm'] && $this->auth->acl_get('u_pm_flash') ? true : false;
     $url_status = $this->config['allow_post_links'] ? true : false;
     $this->mode = strtoupper($this->mode);
     $sql = 'SELECT `user_lastpost` FROM ' . CHAT_SESSIONS_TABLE . " WHERE user_id = {$this->user->data['user_id']}";
     $result1 = $this->db->sql_query($sql);
     $row = $this->db->sql_fetchrow($result1);
     $this->db->sql_freeresult($result1);
     if ($this->get_status($row['user_lastpost']) === 'online') {
         $refresh = $this->config['refresh_online_chat'];
     } else {
         if ($this->get_status($row['user_lastpost']) === 'idle') {
             $refresh = $this->config['refresh_idle_chat'];
         } else {
             if ($this->user->data['user_id'] === ANONYMOUS || $this->get_status($row['user_lastpost']) === 'offline') {
                 $refresh = $this->config['refresh_offline_chat'];
             } else {
                 $refresh = $this->config['refresh_offline_chat'];
             }
         }
     }
     if ($this->user->data['user_id'] === ANONYMOUS || $row['user_lastpost'] === null) {
         $last_post = 0;
     } else {
         $last_post = $row['user_lastpost'];
     }
//.........这里部分代码省略.........
开发者ID:sq6jny,项目名称:ajaxchat,代码行数:101,代码来源:listener.php


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