本文整理汇总了PHP中phpbb\request\request_interface::variable方法的典型用法代码示例。如果您正苦于以下问题:PHP request_interface::variable方法的具体用法?PHP request_interface::variable怎么用?PHP request_interface::variable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpbb\request\request_interface
的用法示例。
在下文中一共展示了request_interface::variable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display_topics
/**
* Display support topics from all contributions or of a specific type.
*
* @param string $type Contribution type's string identifier
* @return \Symfony\Component\HttpFoundation\Response
*/
public function display_topics($type)
{
$type_id = $this->get_type_id($type);
if ($type_id === false) {
return $this->helper->error('NO_PAGE', 404);
}
if ($type == 'all') {
// Mark all topics read
if ($this->request->variable('mark', '') == 'topics') {
$this->tracking->track(TITANIA_ALL_SUPPORT, self::ALL_SUPPORT);
}
// Mark all topics read
$this->template->assign_var('U_MARK_TOPICS', $this->helper->route('phpbb.titania.support', array('type' => 'all', 'mark' => 'topics')));
}
$this->display->assign_global_vars();
$u_all_support = $this->helper->route('phpbb.titania.support', array('type' => 'all'));
$this->template->assign_var('U_ALL_SUPPORT', $u_all_support);
// Generate the main breadcrumbs
$this->display->generate_breadcrumbs(array('ALL_SUPPORT' => $u_all_support));
// Links to the support topic lists
foreach ($this->types->get_all() as $id => $class) {
$this->template->assign_block_vars('support_types', array('U_SUPPORT' => $this->helper->route('phpbb.titania.support', array('type' => $class->url)), 'TYPE_SUPPORT' => $class->langs));
}
$data = \topics_overlord::display_forums_complete('all_support', false, array('contrib_type' => $type_id));
// Canonical URL
$data['sort']->set_url($this->helper->route('phpbb.titania.support', array('type' => $type)));
$this->template->assign_var('U_CANONICAL', $data['sort']->build_canonical());
return $this->helper->render('all_support.html', 'CUSTOMISATION_DATABASE');
}
示例2: avatar_explain
public function avatar_explain($event)
{
$mode = $this->request->variable('mode', '');
if ($mode == 'avatar') {
$this->resize->avatar_explain();
}
}
示例3: get_bookmarks
public function get_bookmarks($ext_mode = '', $forums = array())
{
define('POSTS_BOOKMARKS_TABLE', $this->table_prefix . 'posts_bookmarks');
$start = $this->request->variable('start', 0);
$sql = 'SELECT COUNT(post_id) as posts_count
FROM ' . POSTS_BOOKMARKS_TABLE . '
WHERE user_id = ' . $this->user->data['user_id'];
$result = $this->db->sql_query($sql);
$posts_count = (int) $this->db->sql_fetchfield('posts_count');
$this->db->sql_freeresult($result);
$sql_where = $sql_fields = '';
if ($ext_mode != 'find') {
$sql_where = 'LEFT JOIN ' . USERS_TABLE . ' u ON (p.poster_id = u.user_id)';
$sql_fields = ', p.post_time, u.user_id, u.username, u.user_colour';
}
$pagination_url = append_sid("{$this->phpbb_root_path}postbookmark", "mode=find");
$this->pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $posts_count, $this->config['topics_per_page'], $start);
$sql = 'SELECT b.post_id AS b_post_id, b.user_id, b.bookmark_time, b.bookmark_desc, p.post_id, p.forum_id, p.topic_id, p.poster_id, p.post_subject, t.topic_title ' . $sql_fields . '
FROM ' . POSTS_BOOKMARKS_TABLE . ' b
LEFT JOIN ' . POSTS_TABLE . ' p ON( b.post_id = p.post_id)
LEFT JOIN ' . TOPICS_TABLE . ' t ON( t.topic_id = p.topic_id)
' . $sql_where . '
WHERE b.user_id = ' . $this->user->data['user_id'] . '
ORDER BY b.bookmark_time ASC';
$result = $this->db->sql_query_limit($sql, $this->config['topics_per_page'], $start);
while ($row = $this->db->sql_fetchrow($result)) {
$topic_author = $sql_where ? get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']) : '';
$post_time = $sql_where ? $this->user->format_date($row['post_time']) : '';
// Send vars to template
$this->template->assign_block_vars('postrow', array('POST_ID' => $row['b_post_id'], 'POST_TIME' => $post_time, 'BOOKMARK_TIME' => $this->user->format_date($row['bookmark_time']), 'BOOKMARK_DESC' => $row['bookmark_desc'], 'TOPIC_AUTHOR' => $topic_author, 'POST_TITLE' => $row['post_subject'] ? $row['post_subject'] : $row['topic_title'], 'U_VIEW_POST' => append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", "p=" . $row['post_id'] . "#p" . $row['post_id'] . ""), 'S_DELETED_TOPIC' => !$row['topic_id'] ? true : false, 'S_DELETED_POST' => !$row['post_id'] ? true : false, 'U_POST_BOOKMARK' => '[url=' . generate_board_url() . '/viewtopic.' . $this->php_ext . '?p=' . $row['post_id'] . '#p' . $row['post_id'] . ']' . ($row['post_subject'] ? $row['post_subject'] : $row['topic_title']) . '[/url]'));
}
$this->db->sql_freeresult($result);
$this->template->assign_vars(array('TOTAL_BOOKMARKS' => $this->user->lang('TOTAL_BOOKMARKS', (int) $posts_count), 'PAGE_NUMBER' => $this->pagination->on_page($posts_count, $this->config['topics_per_page'], $start)));
}
示例4: get_template_side
/**
* {@inheritdoc}
*/
public function get_template_side($module_id)
{
$style_count = 0;
$style_select = '';
$sql = 'SELECT style_id, style_name
FROM ' . STYLES_TABLE . '
WHERE style_active = 1
ORDER BY LOWER(style_name) ASC';
$result = $this->db->sql_query($sql, 3600);
while ($row = $this->db->sql_fetchrow($result)) {
$style = $this->request->variable('style', 0);
if (!empty($style)) {
$url = str_replace('style=' . $style, 'style=' . $row['style_id'], $this->modules_helper->route('board3_portal_controller'));
} else {
$url = $this->modules_helper->route('board3_portal_controller') . '?style=' . $row['style_id'];
}
++$style_count;
$style_select .= '<option value="' . $url . '"' . ($row['style_id'] == $this->user->style['style_id'] ? ' selected="selected"' : '') . '>' . utf8_htmlspecialchars($row['style_name']) . '</option>';
}
$this->db->sql_freeresult($result);
if (strlen($style_select)) {
$this->template->assign_var('STYLE_SELECT', $style_select);
}
// Assign specific vars
$this->template->assign_vars(array('S_STYLE_OPTIONS' => $this->config['override_user_style'] || $style_count < 2 ? '' : $style_select));
return 'stylechanger_side.html';
}
示例5: memberlist_modify_query
public function memberlist_modify_query($event)
{
$sql_from = $event['sql_from'];
$sql_where = $event['sql_where'];
$user_from = $this->request->variable('user_from', '', true);
$user_id = $this->request->variable('user_id', '');
$this->template->assign_vars(array('USER_FROM' => $user_from, 'USER_ID' => (int) $user_id));
if ($user_from) {
$sql_from .= ', ' . PROFILE_FIELDS_DATA_TABLE . ' pf ';
$pieces = explode(' ', $user_from);
$sql_where .= ' AND (pf.pf_phpbb_location COLLATE utf8_general_ci ';
$sql_where .= $this->db->sql_like_expression(str_replace('*', $this->db->get_any_char(), $pieces[0]));
for ($i = 1; $i < sizeof($pieces); $i++) {
$sql_where .= ' OR pf.pf_phpbb_location COLLATE utf8_general_ci ';
$sql_where .= $this->db->sql_like_expression(str_replace('*', $this->db->get_any_char(), $pieces[$i]));
}
$sql_where .= ') AND u.user_id = pf.user_id';
$event['sql_where'] = $sql_where;
$event['sql_from'] = $sql_from;
}
if ((int) $user_id) {
$sql_where .= ' AND u.user_id = ' . $user_id . '';
$event['sql_where'] = $sql_where;
}
}
示例6: run_tool
/**
* Run tool.
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function run_tool()
{
$type = $this->request->variable('type', 'queue');
$start = $this->request->variable('start', 0);
$continue_start = null;
switch ($type) {
case 'queue':
$continue_start = $this->sync_queue_topics($start);
if ($continue_start === null) {
$type = 'contrib';
$continue_start = 0;
}
break;
case 'contrib':
$continue_start = $this->sync_contrib_topics($start);
break;
}
if ($continue_start !== null) {
$params = array('tool' => 'rebuild_topic_urls', 'type' => $type, 'submit' => 1, 'hash' => generate_link_hash('manage'), 'start' => $continue_start);
meta_refresh(2, $this->controller_helper->route('phpbb.titania.administration.tool', $params));
}
$msg = $continue_start !== null ? 'PLEASE_WAIT_FOR_TOOL' : 'DONE';
$this->template->assign_vars(array('MESSAGE_TEXT' => $this->user->lang($msg), 'MESSAGE_TITLE' => $this->user->lang('INFORMATION')));
return $this->controller_helper->render('message_body.html', $msg);
}
示例7: viewforum_get_topic_ids_data
/**
* Event: core.viewforum_get_topic_ids_data
*/
public function viewforum_get_topic_ids_data($event)
{
$custom_sorting = array('by' => $this->user->data['user_topic_sortby_type'], 'order' => $this->user->data['user_topic_sortby_dir']);
// Forum-specific sorting
if ($event['forum_data']['sort_topics_by'] != $this->default_sort_by) {
$custom_sorting = array('by' => $event['forum_data']['sort_topics_by'], 'order' => $event['forum_data']['sort_topics_order']);
} else {
if ($this->user->data['is_registered'] && !$this->user->data['is_bot'] && $this->config['kasimi.sorttopics.ucp_enabled'] && $this->user->data['sort_topics_by_created_time']) {
$custom_sorting['by'] = 'c';
}
}
// Temporary sorting if the user used the options at the bottom of viewforum
if ($this->request->is_set('sk')) {
$custom_sorting['by'] = $this->request->variable('sk', '');
}
if ($this->request->is_set('sd')) {
$custom_sorting['order'] = $this->request->variable('sd', '');
}
$this->inject_created_time_select_option('S_SELECT_SORT_KEY', $custom_sorting['by'], 'S_SELECT_SORT_DIR', $custom_sorting['order']);
// Bail out if we don't need to adjust sorting
if ($custom_sorting['by'] == $this->sort_key && $custom_sorting['order'] == $this->sort_dir) {
return;
}
// This forum requires custom topic sorting, let's get our hands dirty
$sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => array('t.topic_last_post_time', 't.topic_last_post_id'), 'c' => array('t.topic_time', 't.topic_id'), 'r' => $this->auth->acl_get('m_approve', $event['forum_data']['forum_id']) ? 't.topic_posts_approved + t.topic_posts_unapproved + t.topic_posts_softdeleted' : 't.topic_posts_approved', 's' => 't.topic_title', 'v' => 't.topic_views');
$sort_sql = $sort_by_sql[$custom_sorting['by']];
$direction = $custom_sorting['order'] == 'd' ? 'DESC' : 'ASC';
$sql_sort_order = (is_array($sort_sql) ? implode(' ' . $direction . ', ', $sort_sql) : $sort_sql) . ' ' . $direction;
$sql_ary = $event['sql_ary'];
$store_reverse = $event['store_reverse'];
$sql_ary['ORDER_BY'] = 't.topic_type ' . (!$store_reverse ? 'DESC' : 'ASC') . ', ' . $sql_sort_order;
$event['sql_sort_order'] = $sql_sort_order;
$event['sql_ary'] = $sql_ary;
}
示例8: perform_auth_login
/**
* {@inheritdoc}
*/
public function perform_auth_login()
{
if (!$this->service_provider instanceof \OAuth\OAuth2\Service\Evesso) {
throw new \phpbb\auth\provider\oauth\service\exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE');
}
$this->service_provider->requestAccessToken($this->request->variable('code', ''));
$result = json_decode($this->service_provider->request('verify'), true);
return $result['CharacterID'];
}
示例9: _force_get_route
protected function _force_get_route($route_data, $has_blocks = false)
{
$route_mapper = $this->mapper_factory->create('blocks', 'routes');
if (($route = $route_mapper->load($route_data)) === null) {
$route_data['ext_name'] = $this->request->variable('ext', '');
$route_data['has_blocks'] = $has_blocks;
$entity = $route_mapper->create_entity($route_data);
$route = $route_mapper->save($entity);
}
return $route;
}
示例10: save
/**
* @param int $block_id
* @return array
*/
public function save($block_id)
{
$content = $this->request->variable('content', '', true);
$cblocks = $this->_get_custom_blocks();
$sql_data = array('block_id' => $block_id, 'block_content' => $content, 'bbcode_bitfield' => '', 'bbcode_options' => 7, 'bbcode_uid' => '');
generate_text_for_storage($sql_data['block_content'], $sql_data['bbcode_uid'], $sql_data['bbcode_bitfield'], $sql_data['bbcode_options'], true, true, true);
$sql = !isset($cblocks[$block_id]) ? 'INSERT INTO ' . $this->cblocks_table . ' ' . $this->db->sql_build_array('INSERT', $sql_data) : 'UPDATE ' . $this->cblocks_table . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_data) . ' WHERE block_id = ' . (int) $block_id;
$this->db->sql_query($sql);
$this->cache->destroy('pt_cblocks');
return array('id' => $block_id, 'content' => $this->_get_content($sql_data), 'callback' => 'previewCustomBlock');
}
示例11: perform_auth_login
/**
* {@inheritdoc}
*/
public function perform_auth_login()
{
if (!$this->service_provider instanceof \OAuth\OAuth2\Service\Facebook) {
throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE');
}
// This was a callback request, get the token
$this->service_provider->requestAccessToken($this->request->variable('code', ''));
// Send a request with it
$result = json_decode($this->service_provider->request('/me'), true);
// Return the unique identifier
return $result['id'];
}
示例12: acp_manage_forums_update_data_after
public function acp_manage_forums_update_data_after($event)
{
$status = $this->request->variable('rh_topictags_enabled', 0);
$prune = $this->request->variable('rh_topictags_prune', 0);
if (!$status && $prune) {
$data = $event->get_data();
$forum_id = (int) $data['forum_data']['forum_id'];
$this->tags_manager->delete_tags_from_tagdisabled_forums(array($forum_id));
$this->tags_manager->delete_unused_tags();
}
$this->tags_manager->calc_count_tags();
}
示例13: perform_auth_login
/**
* {@inheritdoc}
*/
public function perform_auth_login()
{
if (!$this->service_provider instanceof \OAuth\OAuth2\Service\BattleNetUS) {
throw new \phpbb\auth\provider\oauth\service\exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE');
}
// This was a callback request from battlenet, get the token
$this->service_provider->requestAccessToken($this->request->variable('code', ''));
// Send a request with it
$result = json_decode($this->service_provider->request('account/user'), true);
// Return the unique identifier returned from battlenet
return $result['battletag'];
}
示例14: pm_warning
public function pm_warning($event)
{
// There is no suitable event - read the data from the submit:
$address_list = $this->request->variable('address_list', array('' => array(0 => '')));
// This has the drawback of not knowing about new users currently being added
// We therefore will have to check the added recipients list for known usernames as well :/
// This also has the drawback of still showing the warning even if the user is currently deleted.
// So let's remove the deleted user from the list as well:
$delete = $this->request->variable('remove_u', array(0 => ''));
foreach ($delete as $key => $value) {
if (isset($address_list['u'][$key])) {
unset($address_list['u'][$key]);
}
}
//Wenn PN an Teammitglied gesendet werden soll, Hinweismeldung anzeigen
//TODO: Etwas besseres als Referenz nehmen als "phpBB.de-Team" im Gruppennamen.
if (!empty($address_list['u'])) {
$sql = "SELECT u.user_id, ut.username\n\t\t\t\tFROM " . USER_GROUP_TABLE . " u\n\t\t\t\tLEFT JOIN " . GROUPS_TABLE . " g ON g.group_id = u.group_id\n\t\t\t\tLEFT JOIN " . USERS_TABLE . " ut ON u.user_id = ut.user_id\n\t\t\t\tWHERE g.group_name = 'phpBB.de-Team' OR g.group_name = 'phpBB Deutschland e. V.' ";
$result = $this->db->sql_query($sql, 3600);
$team_user_ids = array();
$team_user_names = array();
while ($row = $this->db->sql_fetchrow($result)) {
$team_user_ids[] = $row['user_id'];
$team_user_names[$row['user_id']] = $row['username'];
}
if (count(array_intersect(array_keys($address_list['u']), $team_user_ids)) > 0) {
$this->template->assign_var('S_PN_TO_TEAM_MEMBER', true);
return;
}
// This is only necessary, if we didn't find a member yet.
$new_recipients = explode("\n", $this->request->variable('username_list', '', true));
if (sizeof($team_user_names) < sizeof($new_recipients)) {
$new_recipients = array_map('trim', $new_recipients);
foreach ($team_user_names as $username) {
if (in_array($username, $new_recipients)) {
$this->template->assign_var('S_PN_TO_TEAM_MEMBER', true);
return;
}
}
} else {
foreach ($new_recipients as $username) {
if (in_array(trim($username), $team_user_names)) {
$this->template->assign_var('S_PN_TO_TEAM_MEMBER', true);
return;
}
}
}
}
}
示例15: acp_board_config
public function acp_board_config($event)
{
$mode = $event['mode'];
if ($mode == 'post') {
$new_config = array('legend_newtopic' => 'ACP_NEWTOPIC', 'newtopic_forum' => array('lang' => 'ACP_NEWTOPIC_FORUM', 'validate' => 'string', 'type' => 'custom', 'function' => array($this, 'select_forums'), 'explain' => true), 'newtopic_button' => array('lang' => 'ACP_NEWTOPIC_BUTTON', 'validate' => 'string', 'type' => 'text:25:40', 'explain' => false));
$search_slice = 'max_post_img_height';
$display_vars = $event['display_vars'];
$display_vars['vars'] = phpbb_insert_config_array($display_vars['vars'], $new_config, array('after' => $search_slice));
$event['display_vars'] = array('title' => $display_vars['title'], 'vars' => $display_vars['vars']);
if ($event['submit']) {
$values = $this->request->variable('newtopic_forum', array(0 => ''));
$this->config->set('newtopic_forum', implode(',', $values));
}
}
}