本文整理汇总了PHP中phpbb\request\request_interface类的典型用法代码示例。如果您正苦于以下问题:PHP request_interface类的具体用法?PHP request_interface怎么用?PHP request_interface使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了request_interface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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';
}
示例2: like_post
/**
* Likes controller for route /like_post/{like}
*
* @param int @post_id The post to be edited.
*/
public function like_post($post_id)
{
// If unknown user or bot, cannot like.
if ($this->user->data['user_id'] == ANONYMOUS || $this->user->data['is_bot']) {
return;
}
// Add language variables for response.
$this->user->add_lang_ext('nuleaf/likes', 'likes');
// Grab forum id for permission.
$sql = 'SELECT forum_id
FROM ' . POSTS_TABLE . '
WHERE post_id = ' . $post_id;
$result = $this->db->sql_query_limit($sql, 1);
$forum_id = $this->db->sql_fetchrow($result)['forum_id'];
$this->db->sql_freeresult($result);
// Does the user have permission to like posts in this forum?
if ($this->auth->acl_get('!f_like', $forum_id)) {
$json_response = new json_response();
$json_response->send(array('error' => $this->user->lang('LIKE_NOT_AUTHORIZED')));
return;
}
if ($this->request->is_ajax()) {
$liked = $this->likes_manager->is_liked($post_id);
if ($liked) {
// If post is already liked, unlike it.
$likes_count = $this->likes_manager->unlike($post_id);
} else {
// Else like the post.
$likes_count = $this->likes_manager->like($post_id);
}
// Since the post has now been liked/unliked, $liked is reversed.
$json_response = new json_response();
$json_response->send(array('likes_count' => $likes_count, 'liked' => !$liked, 'LIKE_POST' => $this->user->lang('LIKE_POST'), 'UNLIKE_POST' => $this->user->lang('UNLIKE_POST'), 'LIKE_BUTTON' => $this->user->lang('LIKE_BUTTON'), 'UNLIKE_BUTTON' => $this->user->lang('UNLIKE_BUTTON')));
}
}
示例3: 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);
}
示例4: 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;
}
示例5: 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');
}
示例6: 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;
}
}
示例7: avatar_explain
public function avatar_explain($event)
{
$mode = $this->request->variable('mode', '');
if ($mode == 'avatar') {
$this->resize->avatar_explain();
}
}
示例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: submit_post_end
/**
* Initialized the survey data if necessary.
*
* @param unknown $event
*/
public function submit_post_end($event)
{
if (!$this->survey->can_create_survey($event['data']['forum_id'])) {
return;
}
if ($this->request->is_set_post('survey_enabled') && ($event['mode'] == 'post' || $event['mode'] == 'edit' && $event['data']['topic_first_post_id'] == $event['data']['post_id'] && $this->survey->is_enabled($event['data']['topic_id']))) {
$this->survey->initialize($event['data']['topic_id']);
}
}
示例10: posting_modify_submit_post_after
/**
* Event: core.posting_modify_submit_post_after
*
* @param Event $event
*/
public function posting_modify_submit_post_after($event)
{
$post_data = $event['post_data'];
if ($post_data['topic_status'] == ITEM_UNLOCKED && $this->request->is_set_post('lock_topic')) {
if ($this->auth->acl_get('m_lock', $event['forum_id']) || $this->auth->acl_get('f_user_lock', $event['forum_id']) && $this->user->data['is_registered'] && !empty($post_data['topic_poster']) && $this->user->data['user_id'] == $post_data['topic_poster'] && $post_data['topic_status'] == ITEM_UNLOCKED ? true : false) {
$topic_data = array($event['post_data']['topic_id'] => $event['post_data']);
$this->topic_mover->move_topics($topic_data, 'move_topics_when_locked');
}
}
}
示例11: 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');
}
示例12: _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;
}
示例13: 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();
}
示例14: 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'];
}
示例15: 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'];
}