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


PHP request::variable方法代码示例

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


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

示例1: main

 public function main($id, $mode)
 {
     global $config, $request, $template, $user;
     $this->config = $config;
     $this->request = $request;
     $this->template = $template;
     $this->user = $user;
     // Add the common lang file
     $this->user->add_lang(array('acp/common'));
     // Add the board snowstormlights ACP lang file
     $this->user->add_lang_ext('prosk8er/snowstormlights', 'info_acp_snowstorm_lights');
     // Load a template from adm/style for our ACP page
     $this->tpl_name = 'snowstorm_lights';
     // Set the page title for our ACP page
     $this->page_title = $user->lang['ACP_SNOWSTORM_LIGHTS'];
     // Define the name of the form for use as a form key
     $form_key = 'acp_snowstorm_lights';
     add_form_key($form_key);
     // If form is submitted or previewed
     if ($this->request->is_set_post('submit')) {
         // Test if form key is valid
         if (!check_form_key($form_key)) {
             trigger_error('FORM_INVALID');
         }
         // Store the config enable/disable state
         $scl_enabled = $this->request->variable('scl_enabled', 0);
         $this->config->set('scl_enabled', $scl_enabled);
         $snow_enabled = $request->variable('snow_enabled', 0);
         $this->config->set('snow_enabled', $snow_enabled);
         // Output message to user for the update
         trigger_error($this->user->lang('SNOWSTORM_LIGHTS_SAVED') . adm_back_link($this->u_action));
     }
     // Output data to the template
     $this->template->assign_vars(array('SCL_ENABLED' => isset($this->config['scl_enabled']) ? $this->config['scl_enabled'] : '', 'SNOW_ENABLED' => isset($this->config['snow_enabled']) ? $this->config['snow_enabled'] : '', 'U_ACTION' => $this->u_action));
 }
开发者ID:Mauron,项目名称:Snowstorm-Lights,代码行数:35,代码来源:snowstorm_lights_module.php

示例2: main

 public function main($id, $mode)
 {
     global $config, $request, $template, $user;
     $this->config = $config;
     $this->request = $request;
     $this->template = $template;
     $this->user = $user;
     $this->user->add_lang('acp/common');
     $this->user->add_lang_ext('phpbbmodders/holidayflare', 'holidayflare_acp');
     $this->tpl_name = 'acp_holidayflare';
     $this->page_title = $this->user->lang('ACP_HOLIDAYFLARE');
     $form_key = 'acp_holidayflare';
     add_form_key($form_key);
     if ($this->request->is_set_post('submit')) {
         if (!check_form_key($form_key)) {
             trigger_error($user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING);
         }
         /* XMAS Start */
         $enable_xmas = $this->request->variable('enable_xmas', 0);
         $this->config->set('enable_xmas', $enable_xmas);
         /* XMAS Stop */
         /* Valentine Start */
         $enable_valentine = $this->request->variable('enable_valentine', 0);
         $this->config->set('enable_valentine', $enable_valentine);
         /* Valentine Stop */
         trigger_error($this->user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action));
     }
     $this->template->assign_vars(array('S_ENABLE_XMAS' => isset($this->config['enable_xmas']) ? $this->config['enable_xmas'] : '', 'S_ENABLE_VALENTINE' => isset($this->config['enable_valentine']) ? $this->config['enable_valentine'] : '', 'U_ACTION' => $this->u_action));
 }
开发者ID:TWEagle,项目名称:holiday_flare,代码行数:29,代码来源:holidayflare_module.php

示例3: acp_manage_forums_request_data

 public function acp_manage_forums_request_data($event)
 {
     $sfpo_array = $event['forum_data'];
     $sfpo_array['sfpo_guest_enable'] = $this->request->variable('sfpo_guest_enable', 0);
     $sfpo_array['sfpo_characters'] = $this->request->variable('sfpo_characters', 0);
     $event['forum_data'] = $sfpo_array;
 }
开发者ID:3D-I,项目名称:phpBB-3.1-sfpo,代码行数:7,代码来源:listener.php

示例4: modify_profile_info

 /**
  * Allow to change their colour
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function modify_profile_info($event)
 {
     $this->user->add_lang_ext('dmzx/usernamecolourchanger', 'common');
     // Request the user option vars and add them to the data array
     $event['data'] = array_merge($event['data'], array('user_colour' => $this->request->variable('user_colour', $this->user->data['user_colour'], true)));
     $this->template->assign_vars(array('COLOUR' => $event['data']['user_colour'], 'USE_USERNAMECOLOURCHANGER' => $this->auth->acl_get('u_usernamecolourchanger_use')));
 }
开发者ID:rmcgirr83,项目名称:Username-Colour-Changer,代码行数:14,代码来源:listener.php

示例5: get_cookie_categories

 /**
  * {@inheritdoc}
  */
 public function get_cookie_categories()
 {
     // Get categories from the cookie and htmlspecialchars decode it
     $cookie_data = htmlspecialchars_decode($this->request->variable($this->config['cookie_name'] . '_ccat', '', true, \phpbb\request\request_interface::COOKIE));
     // json decode the cookie data and return an array
     return (array) json_decode($cookie_data, true);
 }
开发者ID:phpbb-addons,项目名称:collapsible-categories,代码行数:10,代码来源:operator.php

示例6: ucp_prefs_get_data

 public function ucp_prefs_get_data($event)
 {
     // Request the user option vars and add them to the data array
     $event['data'] = array_merge($event['data'], array('rt_enable' => $this->request->variable('rt_enable', (int) $this->user->data['user_rt_enable']), 'rt_alt_location' => $this->request->variable('rt_alt_location', (int) $this->user->data['user_rt_alt_location']), 'rt_sort_start_time' => $this->request->variable('rt_sort_start_time', (int) $this->user->data['user_rt_sort_start_time']), 'rt_unread_only' => $this->request->variable('rt_unread_only', (int) $this->user->data['user_rt_unread_only'])));
     // Output the data vars to the template (except on form submit)
     if (!$event['submit'] && $this->auth->acl_get('u_rt_view')) {
         $this->user->add_lang_ext('paybas/recenttopics', 'recenttopics_ucp');
         $template_vars = array();
         if ($this->auth->acl_get('u_rt_enable') || $this->auth->acl_get('u_rt_alt_location') || $this->auth->acl_get('u_rt_sort_start_time') || $this->auth->acl_get('u_rt_unread_only')) {
             $template_vars += array('S_RT_SHOW' => true);
         }
         if ($this->auth->acl_get('u_rt_enable')) {
             $template_vars += array('A_RT_ENABLE' => true, 'S_RT_ENABLE' => $event['data']['rt_enable']);
         }
         if ($this->auth->acl_get('u_rt_alt_location')) {
             $template_vars += array('A_RT_ALT_LOCATION' => true, 'S_RT_ALT_LOCATION' => $event['data']['rt_alt_location']);
         }
         if ($this->auth->acl_get('u_rt_sort_start_time')) {
             $template_vars += array('A_RT_SORT_START_TIME' => true, 'S_RT_SORT_START_TIME' => $event['data']['rt_sort_start_time']);
         }
         if ($this->auth->acl_get('u_rt_unread_only')) {
             $template_vars += array('A_RT_UNREAD_ONLY' => true, 'S_RT_UNREAD_ONLY' => $event['data']['rt_unread_only']);
         }
         $this->template->assign_vars($template_vars);
     }
 }
开发者ID:nachtelb,项目名称:RecentTopics,代码行数:26,代码来源:ucp_listener.php

示例7: base

    public function base()
    {
        $note = utf8_normalize_nfc($this->request->variable('note', '', true));
        $submit = isset($_POST['submit']) ? true : false;
        $error = array();
        // check if user s logged in, since this page can be used only after registration...
        if (!$this->user->data['is_registered']) {
            login_box($this->helper->route('vinny_usersnotes_controller'));
        }
        // ... and also this is not for bots (especially for bad ones :)
        if ($this->user->data['is_bot']) {
            redirect(append_sid("{$this->phpbb_root_path}index.{$this->phpEx}"));
        }
        $s_action = $this->helper->route('vinny_usersnotes_controller');
        $s_hidden_fields = '';
        add_form_key('postform');
        // create a template variables
        $this->template->assign_vars(array('S_POST_ACTION' => $s_action, 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'ERROR' => sizeof($error) ? implode('<br />', $error) : ''));
        if ($submit) {
            /*if(!check_form_key('postform'))
            		{
            			trigger_error('FORM_INVALID');
            		}*/
            $sql = 'UPDATE ' . USERS_TABLE . '
				SET user_note = "' . $note . '"
				WHERE user_id = ' . $this->user->data['user_id'];
            $this->db->sql_query($sql);
            meta_refresh(3, $this->helper->route('vinny_usersnotes_controller'));
            trigger_error(sprintf($this->user->lang['NOTES_SAVED'], $this->helper->route('vinny_usersnotes_controller')));
        }
        // create a template variables
        $this->template->assign_vars(array('NOTE' => $this->user->data['user_note']));
        $this->template->assign_block_vars('navlinks', array('FORUM_NAME' => $this->user->lang['NOTES']));
        return $this->helper->render('notes.html', $this->user->lang['NOTES']);
    }
开发者ID:OfficeForum,项目名称:users-notes-ext,代码行数:35,代码来源:main.php

示例8: handle_downloadlog

    public function handle_downloadlog()
    {
        if (!$this->auth->acl_get('a_')) {
            trigger_error('Access Denied');
        } else {
            $this->user->add_lang_ext('dmzx/downloadlog', 'common');
            $fileid = $this->request->variable('file', 0);
            $start = $this->request->variable('start', 0);
            // Pagination number from ACP
            $dll = $this->config['downloadlog_value'];
            // Generate pagination
            $sql = 'SELECT COUNT(downloadslog_id) AS total_downloadlogs
				FROM ' . $this->userdownloadslog_table . '
				WHERE user_id = user_id
				AND file_id = ' . $fileid;
            $result = $this->db->sql_query($sql);
            $total_downloadlogs = (int) $this->db->sql_fetchfield('total_downloadlogs');
            $sql = 'SELECT d.user_id, d.down_date, u.user_id, u.username, u.user_colour
				FROM ' . $this->userdownloadslog_table . ' d, ' . USERS_TABLE . ' u
				WHERE u.user_id = d.user_id
				AND file_id = ' . $fileid . '
				ORDER BY d.down_date DESC';
            $top_result = $this->db->sql_query_limit($sql, $dll, $start);
            while ($row = $this->db->sql_fetchrow($top_result)) {
                $this->template->assign_block_vars('downloaders', array('D_USERNAME' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'D_TIME' => $this->user->format_date($row['down_date'])));
            }
        }
        $pagination_url = $this->helper->route('dmzx_downloadlog_controller', array('file' => $fileid));
        //Start pagination
        $this->pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $total_downloadlogs, $dll, $start);
        $this->template->assign_vars(array('DOWNLOADERS_USERS' => $total_downloadlogs == 1 ? $this->user->lang['DOWNLOADERS_COUNT'] : sprintf($this->user->lang['DOWNLOADERS_COUNTS'], $total_downloadlogs), 'DOWNLOADERS_VERSION' => $this->config['downloadlog_version']));
        page_header('Downloaders Log', false);
        $this->template->set_filenames(array('body' => 'DownloadLog.html'));
        page_footer();
    }
开发者ID:phpbb-es,项目名称:Downloadlog,代码行数:35,代码来源:downloadlog.php

示例9: ucp_profile_modify_profile_info

 /**
  * Add a new data field to the UCP
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function ucp_profile_modify_profile_info($event)
 {
     // Only if the user can add to map
     if ($this->auth->acl_get('u_usermap_add')) {
         $hide = $this->auth->acl_get('u_usermap_hide') ? $this->request->variable('usermap_hide', $this->user->data['user_usermap_hide']) : 0;
         if ($this->config['tas2580_usermap_input_method'] == 'zip') {
             $this->user->data['user_usermap_default_country'] = empty($this->user->data['user_usermap_default_country']) ? $this->config['tas2580_usermap_default_country'] : $this->user->data['user_usermap_default_country'];
             $usermap_zip = $this->request->variable('usermap_zip', $this->user->data['user_usermap_zip']);
             $default_country = $this->request->variable('default_country', $this->user->data['user_usermap_default_country']);
             // Query only if zip code has changed
             if ($usermap_zip != $this->user->data['user_usermap_zip'] && $usermap_zip != 0) {
                 $data = $this->get_cords_form_zip($usermap_zip, $default_country, $error);
                 $lon = $data['lon'];
                 $lat = $data['lat'];
             } else {
                 if (empty($usermap_zip) || $usermap_zip == 0) {
                     $lon = 0;
                     $lat = 0;
                 } else {
                     $lon = $this->user->data['user_usermap_lon'];
                     $lat = $this->user->data['user_usermap_lat'];
                 }
             }
         } else {
             $usermap_zip = $default_country = '';
             $lon = substr($this->request->variable('usermap_lon', $this->user->data['user_usermap_lon']), 0, 10);
             $lat = substr($this->request->variable('usermap_lat', $this->user->data['user_usermap_lat']), 0, 10);
         }
         $event['data'] = array_merge($event['data'], array('user_usermap_lon' => empty($lon) ? '' : $lon, 'user_usermap_lat' => empty($lat) ? '' : $lat, 'user_usermap_hide' => (int) $hide, 'user_usermap_zip' => $usermap_zip, 'user_usermap_default_country' => $default_country));
         $this->add_field($event['data']['user_usermap_lon'], $event['data']['user_usermap_lat'], $event['data']['user_usermap_hide'], $event['data']['user_usermap_zip'], $event['data']['user_usermap_default_country']);
     }
 }
开发者ID:tas2580,项目名称:usermap,代码行数:39,代码来源:listener_ucp.php

示例10: delete_post

 /**
  * Delete a shoutbox post
  *
  * @param int $id
  *
  * @throws \paul999\ajaxshoutbox\exceptions\shoutbox_exception
  */
 public function delete_post($id)
 {
     if (!$id) {
         $id = $this->request->variable('id', 0);
     }
     $sql = 'SELECT user_id FROM ' . $this->table . ' WHERE shout_id = ' . (int) $id;
     $result = $this->db->sql_query($sql);
     $row = $this->db->sql_fetchrow();
     $this->db->sql_freeresult($result);
     if (!$row) {
         throw new shoutbox_exception('AJAX_SHOUTBOX_NO_SUCH_POST');
     }
     if (!$this->auth->acl_get('m_shoutbox_delete')) {
         // User has no m_ permission.
         if ($row['user_id'] != $this->user->data['user_id']) {
             throw new shoutbox_exception('AJAX_SHOUTBOX_NO_SUCH_POST');
         }
         if (!$this->auth->acl_get('u_shoutbox_delete')) {
             throw new shoutbox_exception('AJAX_SHOUTBOX_NO_PERMISSION');
         }
     }
     if ($this->push->canPush()) {
         if ($this->push->delete($id) === false) {
             throw new shoutbox_exception('AJAX_SHOUTBOX_PUSH_NOT_AVAIL');
         }
     }
     $sql = 'DELETE FROM ' . $this->table . ' WHERE shout_id =  ' . (int) $id;
     $this->db->sql_query($sql);
 }
开发者ID:alhitary,项目名称:ajax-shoutbox-ext,代码行数:36,代码来源:delete.php

示例11: set_personal_settings

 protected function set_personal_settings()
 {
     if ($this->request->is_set_post('submit')) {
         $gallery_settings = array('watch_own' => $this->request->variable('watch_own', false), 'watch_com' => $this->request->variable('watch_com', false), 'user_allow_comments' => $this->request->variable('allow_comments', false));
         $additional_settings = array();
         /**
          * Event set personal settings
          *
          * @event phpbbgallery.core.ucp.set_settings_submit
          * @var	array	additional_settings		array of additional settings
          * @since 1.2.0
          */
         $vars = array('additional_settings');
         extract($this->dispatcher->trigger_event('phpbbgallery.core.ucp.set_settings_submit', compact($vars)));
         $gallery_settings = array_merge($gallery_settings, $additional_settings);
         if (!$this->config['phpbb_gallery_allow_comments'] || !$this->config['phpbb_gallery_comment_user_control']) {
             unset($gallery_settings['user_allow_comments']);
         }
         $this->gallery_user->set_user_id($this->user->data['user_id']);
         $this->gallery_user->update_data($gallery_settings);
         meta_refresh(3, $this->u_action);
         trigger_error($this->user->lang['WATCH_CHANGED'] . '<br /><br />' . sprintf($this->user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'));
     }
     /**
      * Event no submit personal settings
      *
      * @event phpbbgallery.core.ucp.set_settings_nosubmit
      * @since 1.2.0
      */
     $this->dispatcher->dispatch('phpbbgallery.core.ucp.set_settings_nosubmit');
     $this->template->assign_vars(array('S_PERSONAL_SETTINGS' => true, 'S_UCP_ACTION' => $this->u_action, 'L_TITLE' => $this->user->lang['UCP_GALLERY_SETTINGS'], 'L_TITLE_EXPLAIN' => $this->user->lang['WATCH_NOTE'], 'S_WATCH_OWN' => $this->gallery_user->get_data('watch_own'), 'S_WATCH_COM' => $this->gallery_user->get_data('watch_com'), 'S_ALLOW_COMMENTS' => $this->gallery_user->get_data('user_allow_comments'), 'S_COMMENTS_ENABLED' => $this->config['phpbb_gallery_allow_comments'] && $this->config['phpbb_gallery_comment_user_control']));
 }
开发者ID:here-we-go,项目名称:phpbbgallery,代码行数:32,代码来源:settings_module.php

示例12: manage_list

 /**
  * @param string $list_name whitelist or blacklist
  * @param string $u_action phpbb acp-u_action
  */
 private function manage_list($u_action, $list_name)
 {
     $list_name_upper = strtoupper($list_name);
     // Define the name of the form for use as a form key
     $form_name = 'topictags';
     add_form_key($form_name);
     $errors = array();
     if ($this->request->is_set_post('submit')) {
         if (!check_form_key($form_name)) {
             trigger_error('FORM_INVALID');
         }
         $this->config->set(prefixes::CONFIG . '_' . $list_name . '_enabled', $this->request->variable(prefixes::CONFIG . '_' . $list_name . '_enabled', 0));
         $list = rawurldecode(base64_decode($this->request->variable(prefixes::CONFIG . '_' . $list_name, '')));
         if (!empty($list)) {
             $list = json_decode($list, true);
             $tags = array();
             for ($i = 0, $size = sizeof($list); $i < $size; $i++) {
                 $tags[] = $list[$i]['text'];
             }
             $list = json_encode($tags);
         }
         // store the list
         $this->config_text->set(prefixes::CONFIG . '_' . $list_name, $list);
         trigger_error($this->user->lang('TOPICTAGS_' . $list_name_upper . '_SAVED') . adm_back_link($u_action));
     }
     // display
     $list = $this->config_text->get(prefixes::CONFIG . '_' . $list_name);
     $list = base64_encode(rawurlencode($list));
     $this->template->assign_vars(array('TOPICTAGS_VERSION' => $this->user->lang('TOPICTAGS_INSTALLED', $this->config[prefixes::CONFIG . '_version']), 'TOPICTAGS_' . $list_name_upper . '_ENABLED' => $this->config[prefixes::CONFIG . '_' . $list_name . '_enabled'], 'TOPICTAGS_' . $list_name_upper => $list, 'S_RH_TOPICTAGS_INCLUDE_NG_TAGS_INPUT' => true, 'S_RH_TOPICTAGS_INCLUDE_CSS' => true, 'TOPICTAGS_CONVERT_SPACE_TO_MINUS' => $this->config[prefixes::CONFIG . '_convert_space_to_minus'] ? 'true' : 'false', 'S_ERROR' => sizeof($errors) ? true : false, 'ERROR_MSG' => implode('<br />', $errors), 'U_ACTION' => $u_action));
 }
开发者ID:NuLeaf,项目名称:phpbb-ext-tags,代码行数:34,代码来源:white_and_blacklist_controller.php

示例13: ucp_prefs_add

 /**
  * Add configuration to UCP
  *
  * @param object	$event The event object
  * @return null
  * @access public
  */
 public function ucp_prefs_add($event)
 {
     $this->user->add_lang_ext('crizzo/maxwidthswitch', 'ucp');
     // I'm so happy that this is just a radiobox! Just a boolean! <3
     $maxwidth = $this->request->variable('maxwidth', (bool) $this->user->data['user_maxwidth']);
     $event['data'] = array_merge($event['data'], array('maxwidth' => $maxwidth));
     $this->template->assign_vars(array('S_MAXWIDTH' => $maxwidth));
 }
开发者ID:coreice,项目名称:phpbb-ext-maxwidth-switch,代码行数:15,代码来源:listener.php

示例14: ucp_prefs_get_data

 /**
  * Get user's option and display it in UCP Prefs View page
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function ucp_prefs_get_data($event)
 {
     // Request the user option vars and add them to the data array
     $event['data'] = array_merge($event['data'], array('elonw' => $this->request->variable('elonw', (int) $this->user->data['user_elonw'])));
     // Output the data vars to the template (except on form submit)
     if (!$event['submit']) {
         $this->user->add_lang_ext('rmcgirr83/elonw', 'elonw_ucp');
         $this->template->assign_vars(array('S_UCP_ELONW' => $event['data']['elonw']));
     }
 }
开发者ID:cracknel,项目名称:ubuntudanmark.dk,代码行数:17,代码来源:listener.php

示例15: ucp_prefs_get_data

 /**
  * Get user's Topic Preview option and display it in UCP Prefs View page
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function ucp_prefs_get_data($event)
 {
     // Request the user option vars and add them to the data array
     $event['data'] = array_merge($event['data'], array('topic_preview' => $this->request->variable('topic_preview', (int) $this->user->data['user_topic_preview'])));
     // Output the data vars to the template (except on form submit)
     if (!$event['submit']) {
         $this->user->add_lang_ext('vse/topicpreview', 'topic_preview_ucp');
         $this->template->assign_vars(array('S_TOPIC_PREVIEW' => $this->config['topic_preview_limit'], 'S_DISPLAY_TOPIC_PREVIEW' => $event['data']['topic_preview']));
     }
 }
开发者ID:CageStooge,项目名称:dsForums,代码行数:17,代码来源:ucp_listener.php


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