本文整理汇总了PHP中phpbb\controller\helper::get_current_url方法的典型用法代码示例。如果您正苦于以下问题:PHP helper::get_current_url方法的具体用法?PHP helper::get_current_url怎么用?PHP helper::get_current_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpbb\controller\helper
的用法示例。
在下文中一共展示了helper::get_current_url方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepare_user_reputation_data
/**
* Display user reputation on user profile page
*
* @param object $event The event object
* @return null
* @access public
*/
public function prepare_user_reputation_data($event)
{
$data = $event['data'];
$template_data = $event['template_data'];
$template_data = array_merge($template_data, array('USER_REPUTATION' => $data['user_reputation'], 'U_VIEW_USER_REPUTATION' => $this->helper->route('reputation_details_controller', array('uid' => $data['user_id'])), 'U_RATE_USER' => $this->helper->route('reputation_user_rating_controller', array('uid' => $data['user_id'])), 'U_REPUTATION_REFERER' => $this->helper->get_current_url(), 'S_RATE_USER' => $this->config['rs_user_rating'] && $this->auth->acl_get('u_rs_rate') ? true : false, 'S_VIEW_REPUTATION' => $this->auth->acl_get('u_rs_view') ? true : false));
$event['template_data'] = $template_data;
}
示例2: assign_reputation
/**
* Add global template var for reputation in forums
*
* @param object $event The event object
* @return null
* @access public
*/
public function assign_reputation($event)
{
if ($this->config['rs_enable']) {
$topic_data = $event['topic_data'];
// Author note
// Post rating is not allowed in the global announcements
// because there is no option to set proper permissions for such topics
$this->template->assign_vars(array('S_FORUM_REPUTATION' => $topic_data['reputation_enabled'] && $this->config['rs_post_rating'] && $topic_data['topic_type'] != POST_GLOBAL ? true : false, 'U_REPUTATION_REFERER' => $this->helper->get_current_url()));
}
}
示例3: view
/**
* Display popup comment
*
* @param int $link_id The category ID
* @param int $page Page number taken from the URL
* @param string $mode add|edit
* @return \Symfony\Component\HttpFoundation\Response A Symfony Response object
* @throws \phpbb\exception\http_exception
*/
public function view($link_id, $page, $mode = 'new')
{
$this->_check_comments_enable($link_id);
$comment_id = $this->request->variable('c', 0);
$view = $this->request->variable('view', '');
$start = ($page - 1) * $this->config['dir_comments_per_page'];
$this->s_hidden_fields = array_merge($this->s_hidden_fields, array('page' => $page));
$this->_populate_form($link_id, $mode);
$sql = 'SELECT COUNT(comment_id) AS nb_comments
FROM ' . DIR_COMMENT_TABLE . '
WHERE comment_link_id = ' . (int) $link_id;
$result = $this->db->sql_query($sql);
$nb_comments = (int) $this->db->sql_fetchfield('nb_comments');
$this->db->sql_freeresult($result);
// Make sure $start is set to the last page if it exceeds the amount
$start = $this->pagination->validate_start($start, $this->config['dir_comments_per_page'], $nb_comments);
$sql_array = array('SELECT' => 'a.comment_id, a.comment_user_id, a. comment_user_ip, a.comment_date, a.comment_text, a.comment_uid, a.comment_bitfield, a.comment_flags, u.username, u.user_id, u.user_colour, z.foe', 'FROM' => array(DIR_COMMENT_TABLE => 'a'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 'a.comment_user_id = u.user_id'), array('FROM' => array(ZEBRA_TABLE => 'z'), 'ON' => 'z.user_id = ' . $this->user->data['user_id'] . ' AND z.zebra_id = a.comment_user_id')), 'WHERE' => 'a.comment_link_id = ' . (int) $link_id, 'ORDER_BY' => 'a.comment_date DESC');
$sql = $this->db->sql_build_query('SELECT', $sql_array);
$result = $this->db->sql_query_limit($sql, $this->config['dir_comments_per_page'], $start);
$have_result = false;
while ($comments = $this->db->sql_fetchrow($result)) {
$have_result = true;
$edit_allowed = $this->user->data['is_registered'] && ($this->auth->acl_get('m_edit_comment_dir') || $this->user->data['user_id'] == $comments['comment_user_id'] && $this->auth->acl_get('u_edit_comment_dir'));
$delete_allowed = $this->user->data['is_registered'] && ($this->auth->acl_get('m_delete_comment_dir') || $this->user->data['user_id'] == $comments['comment_user_id'] && $this->auth->acl_get('u_delete_comment_dir'));
$this->template->assign_block_vars('comment', array('MINI_POST_IMG' => $this->user->img('icon_post_target', 'POST'), 'S_USER' => get_username_string('full', $comments['comment_user_id'], $comments['username'], $comments['user_colour']), 'S_USER_IP' => $comments['comment_user_ip'], 'S_DATE' => $this->user->format_date($comments['comment_date']), 'S_COMMENT' => generate_text_for_display($comments['comment_text'], $comments['comment_uid'], $comments['comment_bitfield'], $comments['comment_flags']), 'S_ID' => $comments['comment_id'], 'U_EDIT' => $edit_allowed ? $this->helper->route('ernadoo_phpbbdirectory_comment_edit_controller', array('link_id' => (int) $link_id, 'comment_id' => (int) $comments['comment_id'])) : '', 'U_DELETE' => $delete_allowed ? $this->helper->route('ernadoo_phpbbdirectory_comment_delete_controller', array('link_id' => (int) $link_id, 'comment_id' => (int) $comments['comment_id'], '_referer' => $this->helper->get_current_url())) : '', 'S_IGNORE_POST' => $comments['foe'] && ($view != 'show' || $comment_id != $comments['comment_id']) ? true : false, 'L_IGNORE_POST' => $comments['foe'] ? $this->user->lang('POST_BY_FOE', get_username_string('full', $comments['comment_user_id'], $comments['username'], $comments['user_colour']), '<a href="' . $this->helper->url('directory/link/' . $link_id . '/comment' . ($page > 1 ? '/' . $page : '') . '?view=show#c' . (int) $comments['comment_id']) . '">', '</a>') : '', 'L_POST_DISPLAY' => $comments['foe'] ? $this->user->lang('POST_DISPLAY', '<a class="display_post" data-post-id="' . $comments['comment_id'] . '" href="' . $this->helper->url('directory/link/' . $link_id . '/comment' . ($page > 1 ? '/' . $page : '') . '?c=' . (int) $comments['comment_id'] . '&view=show#c' . (int) $comments['comment_id']) . '">', '</a>') : '', 'S_INFO' => $this->auth->acl_get('m_info')));
}
$base_url = array('routes' => 'ernadoo_phpbbdirectory_comment_view_controller', 'params' => array('link_id' => (int) $link_id));
$this->pagination->generate_template_pagination($base_url, 'pagination', 'page', $nb_comments, $this->config['dir_comments_per_page'], $start);
$this->template->assign_vars(array('TOTAL_COMMENTS' => $this->user->lang('DIR_NB_COMMS', (int) $nb_comments), 'S_HAVE_RESULT' => $have_result ? true : false));
return $this->helper->render('comments.html', $this->user->lang['DIR_COMMENT_TITLE']);
}
示例4: suggest_tags
/**
* Gets suggestions for tags based on a ajax request, route: /tags/suggest
*
* @param php://input raw post data must contain a json-encoded object of this structure: {"query":"...", "exclude":["...", "...", ...]}
*/
public function suggest_tags()
{
if (false && $this->request->is_ajax()) {
$data = json_decode(file_get_contents('php://input'), true);
$query = $data['query'];
$exclude = $data['exclude'];
$tags = $this->tags_manager->get_tag_suggestions($query, $exclude, 5);
$json_response = new json_response();
$json_response->send($tags);
}
// fake a 404
return $this->helper->error($this->user->lang('RH_TOPICTAGS_TAG_SUGGEST_TAG_ROUTE_ERROR', $this->helper->get_current_url()), 404);
}
示例5: add_portal_link
/**
* Add portal link if user is authed to see it
*
* @return null
*/
public function add_portal_link()
{
if (!$this->has_portal_access()) {
return;
}
if (strpos($this->controller_helper->get_current_url(), '/portal') === false) {
$portal_link = $this->controller_helper->route('board3_portal_controller');
$this->check_portal_all();
} else {
$portal_link = $this->path_helper->remove_web_root_path($this->controller_helper->route('board3_portal_controller'));
}
$this->template->assign_vars(array('U_PORTAL' => $portal_link));
}
示例6: parse_uploader
/**
* Parse the uploader
*
* @param string $tpl_file The name of the template file to use to create the uploader
* @param bool $custom_sort Function used to sort the attachments
* @return string The parsed HTML code ready for output
*/
public function parse_uploader($tpl_file = 'posting/attachments/default.html', $custom_sort = false)
{
// If the upload max filesize is less than 0, do not show the uploader (0 = unlimited)
if (!$this->access->is_team()) {
if (isset($this->ext_config->upload_max_filesize[$this->object_type]) && $this->ext_config->upload_max_filesize[$this->object_type] < 0) {
return '';
}
}
$this->template->assign_vars(array('FORM_NAME' => $this->form_name, 'MAX_LENGTH' => $this->access->is_team() ? $this->config['max_filesize'] : false, 'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"', 'S_INLINE_ATTACHMENT_OPTIONS' => true, 'S_PLUPLOAD_ENABLED' => $this->use_plupload, 'S_SET_CUSTOM_ORDER' => $this->set_custom_order, 'S_UPLOADER_KEY' => generate_link_hash('uploader_key'), 'SELECT_PREVIEW' => $this->object_type == TITANIA_SCREENSHOT, 'SELECT_REVIEW_VAR' => 'set_preview_file' . $this->object_type));
$index_dir = '-';
$index = $this->operator->get_count() - 1;
if ($custom_sort == false && !$this->config['display_order']) {
$index_dir = '+';
$index = 0;
}
$this->operator->sort($custom_sort);
// Delete previous attachments list
$this->template->destroy_block_vars('attach_row');
$base_url = $this->controller_helper->get_current_url();
$hash = generate_link_hash('attach_manage');
$comments = $this->get_request_comments();
$hidden_data = $this->get_basic_attachment_data();
$index_prefix = $this->use_plupload ? '' : $this->form_name . '_';
foreach ($this->operator->get_all() as $attachment_id => $attach) {
$params = array('a' => $attachment_id, 'hash' => $hash);
$_hidden_data = array();
foreach ($hidden_data[$attachment_id] as $property => $value) {
$_hidden_data["attachment_data[{$index_prefix}{$index}][{$property}]"] = $value;
}
$output = array_merge($attach->get_display_vars(''), array('FILENAME' => $attach->get_filename(), 'FILE_COMMENT' => isset($comments[$attachment_id]) ? $comments[$attachment_id] : $attach->get('attachment_comment'), 'ATTACH_ID' => $attachment_id, 'INDEX' => $index_prefix . $index, 'FILESIZE' => get_formatted_filesize($attach->get('filesize')), 'S_HIDDEN' => build_hidden_fields($_hidden_data), 'S_PREVIEW' => $attach->is_preview(), 'U_VIEW_ATTACHMENT' => $attach->get_url(), 'U_DELETE' => $this->path_helper->append_url_params($base_url, array_merge($params, array('action' => 'delete_attach')))));
if ($attach->is_type(TITANIA_SCREENSHOT)) {
$output = array_merge($output, array('U_MOVE_UP' => $this->path_helper->append_url_params($base_url, array_merge($params, array('action' => 'attach_up'))), 'U_MOVE_DOWN' => $this->path_helper->append_url_params($base_url, array_merge($params, array('action' => 'attach_down')))));
}
$index += $index_dir == '+' ? 1 : -1;
$this->template->assign_block_vars('attach_row', $output);
}
$this->template->assign_var('S_ATTACH_DATA', json_encode(array_values($hidden_data)));
$this->template->set_filenames(array($tpl_file => $tpl_file));
return $this->template->assign_display($tpl_file);
}
示例7: view
//.........这里部分代码省略.........
$sort_by_text['p'] = $this->user->lang['DIR_PR_ORDER'];
$sort_by_sql['p'] = 'l.link_pagerank';
}
$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param, $default_sort_days, $default_sort_key, $default_sort_dir);
$u_sort_param = $sort_days === $default_sort_days && $sort_key == $default_sort_key && $sort_dir == $default_sort_dir ? array() : array('sort_days' => $sort_days, 'sort_key' => $sort_key, 'sort_dir' => $sort_dir);
// Are we watching this categorie?
$s_watching_categorie = array('link' => '', 'link_toggle' => '', 'title' => '', 'title_toggle' => '', 'is_watching' => false);
if ($this->config['email_enable'] && $this->user->data['is_registered']) {
$notify_status = isset($this->categorie->data['notify_status']) ? $this->categorie->data['notify_status'] : null;
if ($message = $this->categorie->watch_categorie($mode, $s_watching_categorie, $this->user->data['user_id'], $cat_id, $notify_status)) {
return $this->helper->message($message);
}
}
// A deadline has been selected
if ($sort_days) {
$min_post_time = time() - $sort_days * 86400;
$sql = 'SELECT COUNT(link_id) AS nb_links
FROM ' . DIR_LINK_TABLE . '
WHERE link_cat = ' . (int) $cat_id . '
AND link_time >= ' . $min_post_time;
$result = $this->db->sql_query($sql);
$nb_links = (int) $this->db->sql_fetchfield('nb_links');
$this->db->sql_freeresult($result);
if ($this->request->is_set_post('sort')) {
$start = 0;
}
$sql_limit_time = " AND l.link_time >= {$min_post_time}";
} else {
$sql_limit_time = '';
$nb_links = (int) $this->categorie->data['cat_links'];
}
// Make sure $start is set to the last page if it exceeds the amount
$start = $this->pagination->validate_start($start, $this->config['dir_show'], $nb_links);
// Build navigation links
$this->categorie->generate_dir_nav($this->categorie->data);
// Jumpbox
$this->categorie->make_cat_jumpbox();
$base_url = array('routes' => 'ernadoo_phpbbdirectory_page_controller', 'params' => array_merge(array('cat_id' => $cat_id), $u_sort_param));
$this->pagination->generate_template_pagination($base_url, 'pagination', 'page', $nb_links, $this->config['dir_show'], $start);
$this->template->assign_vars(array('S_SELECT_SORT_DIR' => $s_sort_dir, 'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_DAYS' => $s_limit_days, 'S_CATLIST' => $this->categorie->make_cat_select($cat_id), 'S_PAGE_ACTION' => $this->helper->route('ernadoo_phpbbdirectory_page_controller', array('cat_id' => $cat_id, 'page' => $page)), 'S_CAT_ID' => $cat_id, 'TOTAL_LINKS' => $this->user->lang('DIR_NB_LINKS', (int) $nb_links), 'U_NEW_SITE' => $this->helper->route('ernadoo_phpbbdirectory_new_controller', array('cat_id' => $cat_id)), 'U_WATCH_CAT' => $s_watching_categorie['link'], 'U_WATCH_CAT_TOGGLE' => $s_watching_categorie['link_toggle'], 'S_WATCH_CAT_TITLE' => $s_watching_categorie['title'], 'S_WATCH_CAT_TOGGLE' => $s_watching_categorie['title_toggle'], 'S_WATCHING_CAT' => $s_watching_categorie['is_watching']));
// If the user is trying to reach late pages, start searching from the end
$store_reverse = false;
$sql_limit = $this->config['dir_show'];
if ($start > $nb_links / 2) {
$store_reverse = true;
// Select the sort order
$direction = $sort_dir == 'd' ? 'ASC' : 'DESC';
$sql_limit = $this->pagination->reverse_limit($start, $sql_limit, $nb_links);
$sql_start = $this->pagination->reverse_start($start, $sql_limit, $nb_links);
} else {
// Select the sort order
$direction = $sort_dir == 'd' ? 'DESC' : 'ASC';
$sql_start = $start;
}
if (is_array($sort_by_sql[$sort_key])) {
$sql_sort_order = implode(' ' . $direction . ', ', $sort_by_sql[$sort_key]) . ' ' . $direction;
} else {
$sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction;
}
// Grab just the sorted link ids
$sql_array = array('SELECT' => 'l.link_id', 'FROM' => array(DIR_LINK_TABLE => 'l'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 'l.link_user_id = u.user_id')), 'WHERE' => "l.link_cat = {$cat_id}\n\t\t\t\tAND l.link_active = 1\n\t\t\t\t\t{$sql_limit_time}", 'ORDER_BY' => $sql_sort_order);
$sql = $this->db->sql_build_query('SELECT', $sql_array);
$result = $this->db->sql_query_limit($sql, $sql_limit, $sql_start);
while ($row = $this->db->sql_fetchrow($result)) {
$link_list[] = (int) $row['link_id'];
}
$this->db->sql_freeresult($result);
if (sizeof($link_list)) {
// We get links, informations about poster, votes and number of comments
$sql_array = array('SELECT' => 'l.link_id, l.link_cat, l.link_url, l.link_user_id, l.link_comment, l. link_description, l.link_banner, l.link_rss, l. link_uid, l.link_bitfield, l.link_flags, l.link_vote, l.link_note, l.link_view, l.link_time, l.link_name, l.link_flag, l.link_pagerank, l.link_thumb, u.user_id, u.username, u.user_colour, v.vote_user_id', 'FROM' => array(DIR_LINK_TABLE => 'l'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 'l.link_user_id = u.user_id'), array('FROM' => array(DIR_VOTE_TABLE => 'v'), 'ON' => 'l.link_id = v.vote_link_id AND v.vote_user_id = ' . $this->user->data['user_id'])), 'WHERE' => $this->db->sql_in_set('l.link_id', $link_list));
$sql = $this->db->sql_build_query('SELECT', $sql_array);
$result = $this->db->sql_query($sql);
while ($site = $this->db->sql_fetchrow($result)) {
$rowset[$site['link_id']] = $site;
}
$this->db->sql_freeresult($result);
$link_list = $store_reverse ? array_reverse($link_list) : $link_list;
$votes_status = $this->categorie->data['cat_allow_votes'] ? true : false;
$comments_status = $this->categorie->data['cat_allow_comments'] ? true : false;
foreach ($link_list as $link_id) {
$site =& $rowset[$link_id];
$s_flag = $this->link->display_flag($site);
$s_note = $this->link->display_note($site['link_note'], $site['link_vote'], $votes_status);
$s_thumb = $this->link->display_thumb($site);
$s_vote = $this->link->display_vote($site);
$s_banner = $this->link->display_bann($site);
$s_pr = $this->link->display_pagerank($site);
$s_rss = $this->link->display_rss($site);
$edit_allowed = $this->user->data['is_registered'] && ($this->auth->acl_get('m_edit_dir') || $this->user->data['user_id'] == $site['link_user_id'] && $this->auth->acl_get('u_edit_dir'));
$delete_allowed = $this->user->data['is_registered'] && ($this->auth->acl_get('m_delete_dir') || $this->user->data['user_id'] == $site['link_user_id'] && $this->auth->acl_get('u_delete_dir'));
$this->template->assign_block_vars('site', array('BANNER' => $s_banner, 'COUNT' => $this->user->lang('DIR_NB_CLICKS', (int) $site['link_view']), 'DESCRIPTION' => generate_text_for_display($site['link_description'], $site['link_uid'], $site['link_bitfield'], $site['link_flags']), 'LINK_ID' => $site['link_id'], 'NAME' => $site['link_name'], 'NB_COMMENT' => $comments_status ? $this->user->lang('DIR_NB_COMMS', (int) $site['link_comment']) : '', 'NB_VOTE' => $this->user->lang('DIR_NB_VOTES', (int) $site['link_vote']), 'NOTE' => $s_note, 'PAGERANK' => $s_pr, 'RSS' => $s_rss, 'TIME' => $site['link_time'] ? $this->user->format_date($site['link_time']) : '', 'USER' => get_username_string('full', $site['link_user_id'], $site['username'], $site['user_colour']), 'VOTE_LIST' => $votes_status ? $s_vote : '', 'IMG_FLAG' => $s_flag, 'ON_CLICK' => "onclick=\"window.open('" . $this->helper->route('ernadoo_phpbbdirectory_view_controller', array('link_id' => (int) $site['link_id'])) . "'); return false;\"", 'S_NEW_LINK' => (time() - $site['link_time']) / 86400 <= $this->config['dir_new_time'] ? true : false, 'U_COMMENT' => $comments_status ? $this->helper->route('ernadoo_phpbbdirectory_comment_view_controller', array('link_id' => (int) $site['link_id'])) : '', 'U_DELETE' => $delete_allowed ? $this->helper->route('ernadoo_phpbbdirectory_delete_controller', array('cat_id' => (int) $cat_id, 'link_id' => (int) $site['link_id'], '_referer' => $this->helper->get_current_url())) : '', 'U_EDIT' => $edit_allowed ? $this->helper->route('ernadoo_phpbbdirectory_edit_controller', array('cat_id' => (int) $cat_id, 'link_id' => (int) $site['link_id'])) : '', 'U_FORM_VOTE' => $votes_status ? $this->helper->route('ernadoo_phpbbdirectory_vote_controller', array('cat_id' => (int) $site['link_cat'], 'link_id' => (int) $site['link_id'])) : '', 'U_LINK' => $site['link_url'], 'U_THUMB' => $s_thumb));
}
} else {
$this->template->assign_block_vars('no_draw_link', array());
}
$page_title = $this->user->lang['DIRECTORY'] . ' - ' . $this->categorie->data['cat_name'];
$this->categorie->display();
return $this->helper->render('view_cat.html', $page_title);
}