本文整理汇总了PHP中generate_link_hash函数的典型用法代码示例。如果您正苦于以下问题:PHP generate_link_hash函数的具体用法?PHP generate_link_hash怎么用?PHP generate_link_hash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了generate_link_hash函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_idea_link
/**
* Shortcut method to get the link to a specified idea.
* Optionally add mode and hash URL arguments.
*
* @param int $idea_id int The ID of the idea.
* @param string $mode The mode argument (vote, delete, etc.)
* @param bool $hash Add a link hash
* @return string The route
*/
public function get_idea_link($idea_id, $mode = '', $hash = false)
{
$params = array('idea_id' => $idea_id);
$params = $mode ? array_merge($params, array('mode' => $mode)) : $params;
$params = $hash ? array_merge($params, array('hash' => generate_link_hash("{$mode}_{$idea_id}"))) : $params;
return $this->helper->route('phpbb_ideas_idea_controller', $params);
}
示例2: 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);
}
示例3: configure_ext
/**
* Configure Plupload for use under Titania.
*
* @param \phpbb\titania\config\config $ext_config
* @param \phpbb\template\template $template
* @param $s_action
* @param $object_type
* @param $max_files
* @param $max_filesize
*/
public function configure_ext(\phpbb\titania\config\config $ext_config, \phpbb\template\template $template, $s_action, $object_type, $max_files, $max_filesize)
{
$filters = $this->generate_filter_string_ext($ext_config, $object_type);
$chunk_size = $this->get_chunk_size();
$resize = $this->generate_resize_string();
$template->assign_vars(array('S_RESIZE' => $resize, 'S_PLUPLOAD_EXT' => true, 'FILTERS' => $filters, 'CHUNK_SIZE' => $chunk_size, 'S_PLUPLOAD_URL' => htmlspecialchars_decode($s_action), 'MAX_ATTACHMENTS' => $max_files, 'ATTACH_ORDER' => $this->config['display_order'] ? 'asc' : 'desc', 'L_TOO_MANY_ATTACHMENTS' => $this->user->lang('TOO_MANY_ATTACHMENTS', $max_files), 'FILESIZE' => $max_filesize, 'S_PLUPLOAD_KEY' => generate_link_hash('plupload_key')));
$this->user->add_lang('plupload');
}
示例4: acp_bbcodes_custom_sorting_buttons
/**
* Add some additional elements to the BBCodes template
*
* @param object $event The event object
* @return null
* @access public
*/
public function acp_bbcodes_custom_sorting_buttons($event)
{
$row = $event['row'];
$bbcodes_array = $event['bbcodes_array'];
$bbcodes_array['U_MOVE_UP'] = $event['u_action'] . '&action=move_up&id=' . $row['bbcode_id'] . '&hash=' . generate_link_hash('move_up' . $row['bbcode_id']);
$bbcodes_array['U_MOVE_DOWN'] = $event['u_action'] . '&action=move_down&id=' . $row['bbcode_id'] . '&hash=' . generate_link_hash('move_down' . $row['bbcode_id']);
$event['bbcodes_array'] = $bbcodes_array;
}
示例5: get_template_center
/**
* {@inheritdoc}
*/
public function get_template_center($module_id)
{
if (!function_exists('display_forums')) {
include $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext;
}
\display_forums('', $this->config['load_moderators'], false);
$this->template->assign_vars(array('FORUM_IMG' => $this->user->img('forum_read', 'NO_NEW_POSTS'), 'FORUM_NEW_IMG' => $this->user->img('forum_unread', 'NEW_POSTS'), 'FORUM_LOCKED_IMG' => $this->user->img('forum_read_locked', 'NO_NEW_POSTS_LOCKED'), 'FORUM_NEW_LOCKED_IMG' => $this->user->img('forum_unread_locked', 'NO_NEW_POSTS_LOCKED'), 'U_MARK_FORUMS' => $this->user->data['is_registered'] || $this->config['load_anon_lastread'] ? append_sid("{$this->phpbb_root_path}index.{$this->php_ext}", 'hash=' . generate_link_hash('global') . '&mark=forums') : '', 'U_MCP' => $this->auth->acl_get('m_') || $this->auth->acl_getf_global('m_') ? append_sid("{$this->phpbb_root_path}mcp.{$this->php_ext}", 'i=main&mode=front', true, $this->user->session_id) : ''));
return 'forumlist.html';
}
示例6: show_collapsible_categories
/**
* Set category display states
*
* @param object $event The event object
*
* @return null
* @access public
*/
public function show_collapsible_categories($event)
{
if (!isset($this->categories)) {
$this->categories = $this->operator->get_user_categories();
}
$fid = 'fid_' . $event['row']['forum_id'];
$row = isset($event['cat_row']) ? 'cat_row' : 'forum_row';
$event_row = $event[$row];
$event_row += array('S_FORUM_HIDDEN' => in_array($fid, $this->categories), 'U_COLLAPSE_URL' => $this->helper->route('phpbb_collapsiblecategories_main_controller', array('forum_id' => $fid, 'hash' => generate_link_hash("collapsible_{$fid}"))));
$event[$row] = $event_row;
}
示例7: display_autogroups
/**
* {@inheritdoc}
*/
public function display_autogroups()
{
// Get all auto groups data from the database
$autogroup_rows = $this->get_all_autogroups();
// Process all auto groups data for display in the template
foreach ($autogroup_rows as $row) {
$this->template->assign_block_vars('autogroups', array('GROUP_NAME' => $row['group_name'], 'CONDITION_NAME' => $this->manager->get_condition_lang($row['autogroups_type_name']), 'MIN_VALUE' => $row['autogroups_min_value'], 'MAX_VALUE' => $row['autogroups_max_value'], 'S_DEFAULT' => $row['autogroups_default'], 'S_NOTIFY' => $row['autogroups_notify'], 'U_EDIT' => "{$this->u_action}&action=edit&autogroups_id=" . $row['autogroups_id'], 'U_DELETE' => "{$this->u_action}&action=delete&autogroups_id=" . $row['autogroups_id'], 'U_SYNC' => "{$this->u_action}&action=sync&autogroups_id=" . $row['autogroups_id'] . '&hash=' . generate_link_hash('sync' . $row['autogroups_id'])));
}
$this->template->assign_vars(array('U_ACTION' => $this->u_action, 'U_ADD_AUTOGROUP_RULE' => "{$this->u_action}&action=add"));
// Display the group exemption select box
$this->display_group_exempt_options();
}
示例8: run_tool
function run_tool()
{
$section = phpbb::$request->variable('section', 0);
$start = phpbb::$request->variable('start', 0);
$limit = titania::$config->search_backend == 'solr' ? 250 : 100;
$total = 0;
$search_manager = phpbb::$container->get('phpbb.titania.search.manager');
$sync = phpbb::$container->get('phpbb.titania.sync');
switch ($section) {
case 0:
$search_manager->truncate();
$display_message = 'TRUNCATING_SEARCH';
break;
case 1:
$sql = 'SELECT COUNT(contrib_id) AS cnt FROM ' . TITANIA_CONTRIBS_TABLE;
phpbb::$db->sql_query($sql);
$total = phpbb::$db->sql_fetchfield('cnt');
phpbb::$db->sql_freeresult();
$sync->contribs('index', false, $start, $limit);
$display_message = 'INDEXING_CONTRIBS';
break;
case 2:
$sql = 'SELECT COUNT(post_id) AS cnt FROM ' . TITANIA_POSTS_TABLE;
phpbb::$db->sql_query($sql);
$total = phpbb::$db->sql_fetchfield('cnt');
phpbb::$db->sql_freeresult();
$sync->posts('index', $start, $limit);
$display_message = 'INDEXING_POSTS';
break;
case 3:
$sql = 'SELECT COUNT(faq_id) AS cnt FROM ' . TITANIA_CONTRIB_FAQ_TABLE;
phpbb::$db->sql_query($sql);
$total = phpbb::$db->sql_fetchfield('cnt');
phpbb::$db->sql_freeresult();
$sync->faqs('index', $start, $limit);
$display_message = 'INDEXING_FAQ';
break;
case 4:
trigger_error('DONE');
break;
}
$params = array('tool' => 'reindex', 'section' => $section, 'submit' => 1, 'hash' => generate_link_hash('manage'));
if ($start + $limit >= $total) {
$params['section']++;
} else {
$params['start'] = $start + $limit;
}
// Move to the next step
meta_refresh(0, phpbb::$container->get('controller.helper')->route('phpbb.titania.administration.tool', $params));
$display_message = phpbb::$user->lang[$display_message];
$section_status = $start + $limit < $total ? sprintf(phpbb::$user->lang['SECTION_STATUS'], $start + $limit, $total) : phpbb::$user->lang['DONE'];
trigger_error(sprintf(phpbb::$user->lang['REINDEX_STATUS'], $display_message, $section, $section_status));
}
示例9: run_tool
function run_tool()
{
$section = request_var('section', 0);
$start = request_var('start', 0);
$limit = titania::$config->search_backend == 'solr' ? 1000 : 100;
$total = 0;
$sync = new titania_sync();
switch ($section) {
case 0:
titania_search::truncate();
$display_message = 'Truncating Search';
break;
case 1:
$sql = 'SELECT COUNT(contrib_id) AS cnt FROM ' . TITANIA_CONTRIBS_TABLE;
phpbb::$db->sql_query($sql);
$total = phpbb::$db->sql_fetchfield('cnt');
phpbb::$db->sql_freeresult();
$sync->contribs('index', false, $start, $limit);
$display_message = 'Indexing Contributions';
break;
case 2:
$sql = 'SELECT COUNT(post_id) AS cnt FROM ' . TITANIA_POSTS_TABLE;
phpbb::$db->sql_query($sql);
$total = phpbb::$db->sql_fetchfield('cnt');
phpbb::$db->sql_freeresult();
$sync->posts('index', $start, $limit);
$display_message = 'Indexing Posts';
break;
case 3:
$sql = 'SELECT COUNT(faq_id) AS cnt FROM ' . TITANIA_CONTRIB_FAQ_TABLE;
phpbb::$db->sql_query($sql);
$total = phpbb::$db->sql_fetchfield('cnt');
phpbb::$db->sql_freeresult();
$sync->faqs('index', $start, $limit);
$display_message = 'Indexing FAQ';
break;
case 4:
trigger_back('Done!');
break;
}
if ($start + $limit >= $total) {
// Move to the next step
meta_refresh(0, titania_url::build_url('manage/administration', array('t' => 'reindex', 'section' => $section + 1, 'submit' => 1, 'hash' => generate_link_hash('manage'))));
} else {
// Move to the next step
meta_refresh(0, titania_url::build_url('manage/administration', array('t' => 'reindex', 'section' => $section, 'start' => $start + $limit, 'submit' => 1, 'hash' => generate_link_hash('manage'))));
}
trigger_error($display_message . ' - section ' . $section . ' of 3 - ' . ($start + $limit < $total ? 'part ' . ($start + $limit) . ' of ' . $total : 'Done'));
}
示例10: get_template_center
public function get_template_center($module_id)
{
global $config, $template, $user, $auth, $phpbb_root_path, $phpEx;
display_forums('', $config['load_moderators'], false);
$template->assign_vars(array(
'FORUM_IMG' => $user->img('forum_read', 'NO_NEW_POSTS'),
'FORUM_NEW_IMG' => $user->img('forum_unread', 'NEW_POSTS'),
'FORUM_LOCKED_IMG' => $user->img('forum_read_locked', 'NO_NEW_POSTS_LOCKED'),
'FORUM_NEW_LOCKED_IMG' => $user->img('forum_unread_locked', 'NO_NEW_POSTS_LOCKED'),
'U_MARK_FORUMS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}index.$phpEx", 'hash=' . generate_link_hash('global') . '&mark=forums') : '',
'U_MCP' => ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=front', true, $user->session_id) : '',
));
return 'forumlist.html';
}
示例11: handle_subscriptions
/**
* Shorten the amount of code required for some places
*
* @param mixed $object_type
* @param mixed $object_id
* @param mixed $url
*/
public static function handle_subscriptions($object_type, $object_id, $url)
{
if (!phpbb::$user->data['is_registered']) {
// Cannot currently handle non-registered users
return;
}
$subscribe = request_var('subscribe', '');
if ($subscribe == 'subscribe' && check_link_hash(request_var('hash', ''), 'subscribe')) {
titania_subscriptions::subscribe($object_type, $object_id);
} else {
if ($subscribe == 'unsubscribe' && check_link_hash(request_var('hash', ''), 'unsubscribe')) {
titania_subscriptions::unsubscribe($object_type, $object_id);
}
}
if (titania_subscriptions::is_subscribed($object_type, $object_id)) {
phpbb::$template->assign_vars(array('IS_SUBSCRIBED' => true, 'U_SUBSCRIBE' => titania_url::append_url($url, array('subscribe' => 'unsubscribe', 'hash' => generate_link_hash('unsubscribe')))));
} else {
phpbb::$template->assign_vars(array('U_SUBSCRIBE' => titania_url::append_url($url, array('subscribe' => 'subscribe', 'hash' => generate_link_hash('subscribe')))));
}
}
示例12: main
public function main($id, $mode)
{
global $config, $template, $user, $request, $phpbb_container;
global $phpbb_root_path, $phpEx;
add_form_key('ucp_notification');
$start = $request->variable('start', 0);
$form_time = $request->variable('form_time', 0);
$form_time = $form_time <= 0 || $form_time > time() ? time() : $form_time;
/* @var $phpbb_notifications \phpbb\notification\manager */
$phpbb_notifications = $phpbb_container->get('notification_manager');
/* @var $pagination \phpbb\pagination */
$pagination = $phpbb_container->get('pagination');
switch ($mode) {
case 'notification_options':
$subscriptions = $phpbb_notifications->get_global_subscriptions(false);
// Add/remove subscriptions
if ($request->is_set_post('submit')) {
if (!check_form_key('ucp_notification')) {
trigger_error('FORM_INVALID');
}
$notification_methods = $phpbb_notifications->get_subscription_methods();
foreach ($phpbb_notifications->get_subscription_types() as $group => $subscription_types) {
foreach ($subscription_types as $type => $data) {
foreach ($notification_methods as $method => $method_data) {
if ($request->is_set_post(str_replace('.', '_', $type . '_' . $method_data['id'])) && (!isset($subscriptions[$type]) || !in_array($method_data['id'], $subscriptions[$type]))) {
$phpbb_notifications->add_subscription($type, 0, $method_data['id']);
} else {
if (!$request->is_set_post(str_replace('.', '_', $type . '_' . $method_data['id'])) && isset($subscriptions[$type]) && in_array($method_data['id'], $subscriptions[$type])) {
$phpbb_notifications->delete_subscription($type, 0, $method_data['id']);
}
}
}
if ($request->is_set_post(str_replace('.', '_', $type) . '_notification') && !isset($subscriptions[$type])) {
$phpbb_notifications->add_subscription($type);
} else {
if (!$request->is_set_post(str_replace('.', '_', $type) . '_notification') && isset($subscriptions[$type])) {
$phpbb_notifications->delete_subscription($type);
}
}
}
}
meta_refresh(3, $this->u_action);
$message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
trigger_error($message);
}
$this->output_notification_methods($phpbb_notifications, $template, $user, 'notification_methods');
$this->output_notification_types($subscriptions, $phpbb_notifications, $template, $user, 'notification_types');
$this->tpl_name = 'ucp_notifications';
$this->page_title = 'UCP_NOTIFICATION_OPTIONS';
break;
case 'notification_list':
default:
// Mark all items read
if ($request->variable('mark', '') == 'all' && check_link_hash($request->variable('token', ''), 'mark_all_notifications_read')) {
$phpbb_notifications->mark_notifications_read(false, false, $user->data['user_id'], $form_time);
meta_refresh(3, $this->u_action);
$message = $user->lang['NOTIFICATIONS_MARK_ALL_READ_SUCCESS'];
if ($request->is_ajax()) {
$json_response = new \phpbb\json_response();
$json_response->send(array('MESSAGE_TITLE' => $user->lang['INFORMATION'], 'MESSAGE_TEXT' => $message, 'success' => true));
}
$message .= '<br /><br />' . $user->lang('RETURN_UCP', '<a href="' . $this->u_action . '">', '</a>');
trigger_error($message);
}
// Mark specific notifications read
if ($request->is_set_post('submit')) {
if (!check_form_key('ucp_notification')) {
trigger_error('FORM_INVALID');
}
$mark_read = $request->variable('mark', array(0));
if (!empty($mark_read)) {
$phpbb_notifications->mark_notifications_read_by_id($mark_read, $form_time);
}
}
$notifications = $phpbb_notifications->load_notifications(array('start' => $start, 'limit' => $config['topics_per_page'], 'count_total' => true));
foreach ($notifications['notifications'] as $notification) {
$template->assign_block_vars('notification_list', $notification->prepare_for_display());
}
$base_url = append_sid("{$phpbb_root_path}ucp.{$phpEx}", "i=ucp_notifications&mode=notification_list");
$start = $pagination->validate_start($start, $config['topics_per_page'], $notifications['total_count']);
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $notifications['total_count'], $config['topics_per_page'], $start);
$template->assign_vars(array('TOTAL_COUNT' => $notifications['total_count'], 'U_MARK_ALL' => $base_url . '&mark=all&token=' . generate_link_hash('mark_all_notifications_read')));
$this->tpl_name = 'ucp_notifications';
$this->page_title = 'UCP_NOTIFICATION_LIST';
break;
}
$template->assign_vars(array('TITLE' => $user->lang($this->page_title), 'TITLE_EXPLAIN' => $user->lang($this->page_title . '_EXPLAIN'), 'MODE' => $mode, 'FORM_TIME' => time()));
}
示例13: generate_pagination
$topic_mod .= $auth->acl_get('m_', $forum_id) ? '<option value="topic_logs">' . $user->lang['VIEW_TOPIC_LOGS'] . '</option>' : '';
// If we've got a hightlight set pass it on to pagination.
$pagination = generate_pagination(append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "f={$forum_id}&t={$topic_id}" . (strlen($u_sort_param) ? "&{$u_sort_param}" : '') . ($highlight_match ? "&hilit={$highlight}" : '')), $total_posts, $config['posts_per_page'], $start);
// Navigation links
generate_forum_nav($topic_data);
// Forum Rules
generate_forum_rules($topic_data);
// Moderators
$forum_moderators = array();
get_moderators($forum_moderators, $forum_id);
// This is only used for print view so ...
$server_path = !$view ? $phpbb_root_path : generate_board_url() . '/';
// Replace naughty words in title
$topic_data['topic_title'] = censor_text($topic_data['topic_title']);
// Send vars to template
$template->assign_vars(array('FORUM_ID' => $forum_id, 'FORUM_NAME' => $topic_data['forum_name'], 'FORUM_DESC' => generate_text_for_display($topic_data['forum_desc'], $topic_data['forum_desc_uid'], $topic_data['forum_desc_bitfield'], $topic_data['forum_desc_options']), 'TOPIC_ID' => $topic_id, 'TOPIC_TITLE' => $topic_data['topic_title'], 'TOPIC_POSTER' => $topic_data['topic_poster'], 'TOPIC_AUTHOR_FULL' => get_username_string('full', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), 'TOPIC_AUTHOR' => get_username_string('username', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), 'PAGINATION' => $pagination, 'PAGE_NUMBER' => on_page($total_posts, $config['posts_per_page'], $start), 'TOTAL_POSTS' => $total_posts == 1 ? $user->lang['VIEW_TOPIC_POST'] : sprintf($user->lang['VIEW_TOPIC_POSTS'], $total_posts), 'U_MCP' => $auth->acl_get('m_', $forum_id) ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i=main&mode=topic_view&f={$forum_id}&t={$topic_id}&start={$start}" . (strlen($u_sort_param) ? "&{$u_sort_param}" : ''), true, $user->session_id) : '', 'MODERATORS' => isset($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id]) ? implode(', ', $forum_moderators[$forum_id]) : '', 'POST_IMG' => $topic_data['forum_status'] == ITEM_LOCKED ? $user->img('button_topic_locked', 'FORUM_LOCKED') : $user->img('button_topic_new', 'POST_NEW_TOPIC'), 'QUOTE_IMG' => $user->img('icon_post_quote', 'REPLY_WITH_QUOTE'), 'REPLY_IMG' => $topic_data['forum_status'] == ITEM_LOCKED || $topic_data['topic_status'] == ITEM_LOCKED ? $user->img('button_topic_locked', 'TOPIC_LOCKED') : $user->img('button_topic_reply', 'REPLY_TO_TOPIC'), 'EDIT_IMG' => $user->img('icon_post_edit', 'EDIT_POST'), 'DELETE_IMG' => $user->img('icon_post_delete', 'DELETE_POST'), 'INFO_IMG' => $user->img('icon_post_info', 'VIEW_INFO'), 'PROFILE_IMG' => $user->img('icon_user_profile', 'READ_PROFILE'), 'SEARCH_IMG' => $user->img('icon_user_search', 'SEARCH_USER_POSTS'), 'PM_IMG' => $user->img('icon_contact_pm', 'SEND_PRIVATE_MESSAGE'), 'EMAIL_IMG' => $user->img('icon_contact_email', 'SEND_EMAIL'), 'WWW_IMG' => $user->img('icon_contact_www', 'VISIT_WEBSITE'), 'ICQ_IMG' => $user->img('icon_contact_icq', 'ICQ'), 'AIM_IMG' => $user->img('icon_contact_aim', 'AIM'), 'MSN_IMG' => $user->img('icon_contact_msnm', 'MSNM'), 'YIM_IMG' => $user->img('icon_contact_yahoo', 'YIM'), 'JABBER_IMG' => $user->img('icon_contact_jabber', 'JABBER'), 'REPORT_IMG' => $user->img('icon_post_report', 'REPORT_POST'), 'REPORTED_IMG' => $user->img('icon_topic_reported', 'POST_REPORTED'), 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'POST_UNAPPROVED'), 'WARN_IMG' => $user->img('icon_user_warn', 'WARN_USER'), 'S_IS_LOCKED' => $topic_data['topic_status'] == ITEM_UNLOCKED ? false : true, 'S_SELECT_SORT_DIR' => $s_sort_dir, 'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_DAYS' => $s_limit_days, 'S_SINGLE_MODERATOR' => !empty($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id]) > 1 ? false : true, 'S_TOPIC_ACTION' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "f={$forum_id}&t={$topic_id}&start={$start}"), 'S_TOPIC_MOD' => $topic_mod != '' ? '<select name="action" id="quick-mod-select">' . $topic_mod . '</select>' : '', 'S_MOD_ACTION' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", "f={$forum_id}&t={$topic_id}&quickmod=1&redirect=" . urlencode(str_replace('&', '&', $viewtopic_url)), true, $user->session_id), 'S_VIEWTOPIC' => true, 'S_DISPLAY_SEARCHBOX' => $auth->acl_get('u_search') && $auth->acl_get('f_search', $forum_id) && $config['load_search'] ? true : false, 'S_SEARCHBOX_ACTION' => append_sid("{$phpbb_root_path}search.{$phpEx}", 't=' . $topic_id), 'S_DISPLAY_POST_INFO' => $topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? true : false, 'S_DISPLAY_REPLY_INFO' => $topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_reply', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? true : false, 'U_TOPIC' => "{$server_path}viewtopic.{$phpEx}?f={$forum_id}&t={$topic_id}", 'U_FORUM' => $server_path, 'U_VIEW_TOPIC' => $viewtopic_url, 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $forum_id), 'U_VIEW_OLDER_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "f={$forum_id}&t={$topic_id}&view=previous"), 'U_VIEW_NEWER_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "f={$forum_id}&t={$topic_id}&view=next"), 'U_PRINT_TOPIC' => $auth->acl_get('f_print', $forum_id) ? $viewtopic_url . '&view=print' : '', 'U_EMAIL_TOPIC' => $auth->acl_get('f_email', $forum_id) && $config['email_enable'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=email&t={$topic_id}") : '', 'U_WATCH_TOPIC' => $s_watching_topic['link'], 'L_WATCH_TOPIC' => $s_watching_topic['title'], 'S_WATCHING_TOPIC' => $s_watching_topic['is_watching'], 'U_BOOKMARK_TOPIC' => $user->data['is_registered'] && $config['allow_bookmarks'] ? $viewtopic_url . '&bookmark=1&hash=' . generate_link_hash("topic_{$topic_id}") : '', 'L_BOOKMARK_TOPIC' => $user->data['is_registered'] && $config['allow_bookmarks'] && $topic_data['bookmarked'] ? $user->lang['BOOKMARK_TOPIC_REMOVE'] : $user->lang['BOOKMARK_TOPIC'], 'U_POST_NEW_TOPIC' => $auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS ? append_sid("{$phpbb_root_path}posting.{$phpEx}", "mode=post&f={$forum_id}") : '', 'U_POST_REPLY_TOPIC' => $auth->acl_get('f_reply', $forum_id) || $user->data['user_id'] == ANONYMOUS ? append_sid("{$phpbb_root_path}posting.{$phpEx}", "mode=reply&f={$forum_id}&t={$topic_id}") : '', 'U_BUMP_TOPIC' => bump_topic_allowed($forum_id, $topic_data['topic_bumped'], $topic_data['topic_last_post_time'], $topic_data['topic_poster'], $topic_data['topic_last_poster_id']) ? append_sid("{$phpbb_root_path}posting.{$phpEx}", "mode=bump&f={$forum_id}&t={$topic_id}&hash=" . generate_link_hash("topic_{$topic_id}")) : ''));
// Does this topic contain a poll?
if (!empty($topic_data['poll_start'])) {
$sql = 'SELECT o.*, p.bbcode_bitfield, p.bbcode_uid
FROM ' . POLL_OPTIONS_TABLE . ' o, ' . POSTS_TABLE . " p\n\t\tWHERE o.topic_id = {$topic_id}\n\t\t\tAND p.post_id = {$topic_data['topic_first_post_id']}\n\t\t\tAND p.topic_id = o.topic_id\n\t\tORDER BY o.poll_option_id";
$result = $db->sql_query($sql);
$poll_info = array();
while ($row = $db->sql_fetchrow($result)) {
$poll_info[] = $row;
}
$db->sql_freeresult($result);
$cur_voted_id = array();
if ($user->data['is_registered']) {
$sql = 'SELECT poll_option_id
FROM ' . POLL_VOTES_TABLE . '
WHERE topic_id = ' . $topic_id . '
示例14: page_header
//.........这里部分代码省略.........
$s_privmsg_new = false;
// Check for new private messages if user is logged in
if (!empty($user->data['is_registered'])) {
if ($user->data['user_new_privmsg']) {
if (!$user->data['user_last_privmsg'] || $user->data['user_last_privmsg'] > $user->data['session_last_visit']) {
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_last_privmsg = ' . $user->data['session_last_visit'] . '
WHERE user_id = ' . $user->data['user_id'];
$db->sql_query($sql);
$s_privmsg_new = true;
} else {
$s_privmsg_new = false;
}
} else {
$s_privmsg_new = false;
}
}
$forum_id = request_var('f', 0);
$topic_id = request_var('t', 0);
$s_feed_news = false;
// Get option for news
if ($config['feed_enable']) {
$sql = 'SELECT forum_id
FROM ' . FORUMS_TABLE . '
WHERE ' . $db->sql_bit_and('forum_options', FORUM_OPTION_FEED_NEWS, '<> 0');
$result = $db->sql_query_limit($sql, 1, 0, 600);
$s_feed_news = (int) $db->sql_fetchfield('forum_id');
$db->sql_freeresult($result);
}
// Determine board url - we may need it later
$board_url = generate_board_url() . '/';
// This path is sent with the base template paths in the assign_vars()
// call below. We need to correct it in case we are accessing from a
// controller because the web paths will be incorrect otherwise.
$phpbb_path_helper = $phpbb_container->get('path_helper');
$corrected_path = $phpbb_path_helper->get_web_root_path();
$web_path = defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH ? $board_url : $corrected_path;
// Send a proper content-language to the output
$user_lang = $user->lang['USER_LANG'];
if (strpos($user_lang, '-x-') !== false) {
$user_lang = substr($user_lang, 0, strpos($user_lang, '-x-'));
}
$s_search_hidden_fields = array();
if ($_SID) {
$s_search_hidden_fields['sid'] = $_SID;
}
if (!empty($_EXTRA_URL)) {
foreach ($_EXTRA_URL as $url_param) {
$url_param = explode('=', $url_param, 2);
$s_search_hidden_fields[$url_param[0]] = $url_param[1];
}
}
$dt = $user->create_datetime();
$timezone_offset = $user->lang(array('timezones', 'UTC_OFFSET'), phpbb_format_timezone_offset($dt->getOffset()));
$timezone_name = $user->timezone->getName();
if (isset($user->lang['timezones'][$timezone_name])) {
$timezone_name = $user->lang['timezones'][$timezone_name];
}
// Output the notifications
$notifications = false;
if ($config['load_notifications'] && $user->data['user_id'] != ANONYMOUS && $user->data['user_type'] != USER_IGNORE) {
$phpbb_notifications = $phpbb_container->get('notification_manager');
$notifications = $phpbb_notifications->load_notifications(array('all_unread' => true, 'limit' => 5));
foreach ($notifications['notifications'] as $notification) {
$template->assign_block_vars('notifications', $notification->prepare_for_display());
}
}
$notification_mark_hash = generate_link_hash('mark_all_notifications_read');
// The following assigns all _common_ variables that may be used at any point in a template.
$template->assign_vars(array('SITENAME' => $config['sitename'], 'SITE_DESCRIPTION' => $config['site_desc'], 'PAGE_TITLE' => $page_title, 'SCRIPT_NAME' => str_replace('.' . $phpEx, '', $user->page['page_name']), 'LAST_VISIT_DATE' => sprintf($user->lang['YOU_LAST_VISIT'], $s_last_visit), 'LAST_VISIT_YOU' => $s_last_visit, 'CURRENT_TIME' => sprintf($user->lang['CURRENT_TIME'], $user->format_date(time(), false, true)), 'TOTAL_USERS_ONLINE' => $l_online_users, 'LOGGED_IN_USER_LIST' => $online_userlist, 'RECORD_USERS' => $l_online_record, 'PRIVATE_MESSAGE_COUNT' => !empty($user->data['user_unread_privmsg']) ? $user->data['user_unread_privmsg'] : 0, 'CURRENT_USER_AVATAR' => phpbb_get_user_avatar($user->data), 'CURRENT_USERNAME_SIMPLE' => get_username_string('no_profile', $user->data['user_id'], $user->data['username'], $user->data['user_colour']), 'CURRENT_USERNAME_FULL' => get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour']), 'UNREAD_NOTIFICATIONS_COUNT' => $notifications !== false ? $notifications['unread_count'] : '', 'NOTIFICATIONS_COUNT' => $notifications !== false ? $notifications['unread_count'] : '', 'U_VIEW_ALL_NOTIFICATIONS' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=ucp_notifications'), 'U_MARK_ALL_NOTIFICATIONS' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=ucp_notifications&mode=notification_list&mark=all&token=' . $notification_mark_hash), 'U_NOTIFICATION_SETTINGS' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=ucp_notifications&mode=notification_options'), 'S_NOTIFICATIONS_DISPLAY' => $config['load_notifications'], 'S_USER_NEW_PRIVMSG' => $user->data['user_new_privmsg'], 'S_USER_UNREAD_PRIVMSG' => $user->data['user_unread_privmsg'], 'S_USER_NEW' => $user->data['user_new'], 'SID' => $SID, '_SID' => $_SID, 'SESSION_ID' => $user->session_id, 'ROOT_PATH' => $web_path, 'BOARD_URL' => $board_url, 'L_LOGIN_LOGOUT' => $l_login_logout, 'L_INDEX' => $config['board_index_text'] !== '' ? $config['board_index_text'] : $user->lang['FORUM_INDEX'], 'L_SITE_HOME' => $config['site_home_text'] !== '' ? $config['site_home_text'] : $user->lang['HOME'], 'L_ONLINE_EXPLAIN' => $l_online_time, 'U_PRIVATEMSGS' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm&folder=inbox'), 'U_RETURN_INBOX' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm&folder=inbox'), 'U_MEMBERLIST' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}"), 'U_VIEWONLINE' => $auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel') ? append_sid("{$phpbb_root_path}viewonline.{$phpEx}") : '', 'U_LOGIN_LOGOUT' => $u_login_logout, 'U_INDEX' => append_sid("{$phpbb_root_path}index.{$phpEx}"), 'U_SEARCH' => append_sid("{$phpbb_root_path}search.{$phpEx}"), 'U_SITE_HOME' => $config['site_home_url'], 'U_REGISTER' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'mode=register'), 'U_PROFILE' => append_sid("{$phpbb_root_path}ucp.{$phpEx}"), 'U_USER_PROFILE' => get_username_string('profile', $user->data['user_id'], $user->data['username'], $user->data['user_colour']), 'U_MODCP' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", false, true, $user->session_id), 'U_FAQ' => append_sid("{$phpbb_root_path}faq.{$phpEx}"), 'U_SEARCH_SELF' => append_sid("{$phpbb_root_path}search.{$phpEx}", 'search_id=egosearch'), 'U_SEARCH_NEW' => append_sid("{$phpbb_root_path}search.{$phpEx}", 'search_id=newposts'), 'U_SEARCH_UNANSWERED' => append_sid("{$phpbb_root_path}search.{$phpEx}", 'search_id=unanswered'), 'U_SEARCH_UNREAD' => append_sid("{$phpbb_root_path}search.{$phpEx}", 'search_id=unreadposts'), 'U_SEARCH_ACTIVE_TOPICS' => append_sid("{$phpbb_root_path}search.{$phpEx}", 'search_id=active_topics'), 'U_DELETE_COOKIES' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'mode=delete_cookies'), 'U_CONTACT_US' => $config['contact_admin_form_enable'] && $config['email_enable'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=contactadmin') : '', 'U_TEAM' => $user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile') ? '' : append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=team'), 'U_TERMS_USE' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'mode=terms'), 'U_PRIVACY' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'mode=privacy'), 'U_RESTORE_PERMISSIONS' => $user->data['user_perm_from'] && $auth->acl_get('a_switchperm') ? append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'mode=restore_perm') : '', 'U_FEED' => generate_board_url() . "/feed.{$phpEx}", 'S_USER_LOGGED_IN' => $user->data['user_id'] != ANONYMOUS ? true : false, 'S_AUTOLOGIN_ENABLED' => $config['allow_autologin'] ? true : false, 'S_BOARD_DISABLED' => $config['board_disable'] ? true : false, 'S_REGISTERED_USER' => !empty($user->data['is_registered']) ? true : false, 'S_IS_BOT' => !empty($user->data['is_bot']) ? true : false, 'S_USER_LANG' => $user_lang, 'S_USER_BROWSER' => isset($user->data['session_browser']) ? $user->data['session_browser'] : $user->lang['UNKNOWN_BROWSER'], 'S_USERNAME' => $user->data['username'], 'S_CONTENT_DIRECTION' => $user->lang['DIRECTION'], 'S_CONTENT_FLOW_BEGIN' => $user->lang['DIRECTION'] == 'ltr' ? 'left' : 'right', 'S_CONTENT_FLOW_END' => $user->lang['DIRECTION'] == 'ltr' ? 'right' : 'left', 'S_CONTENT_ENCODING' => 'UTF-8', 'S_TIMEZONE' => sprintf($user->lang['ALL_TIMES'], $timezone_offset, $timezone_name), 'S_DISPLAY_ONLINE_LIST' => $l_online_time ? 1 : 0, 'S_DISPLAY_SEARCH' => !$config['load_search'] ? 0 : (isset($auth) ? $auth->acl_get('u_search') && $auth->acl_getf_global('f_search') : 1), 'S_DISPLAY_PM' => $config['allow_privmsg'] && !empty($user->data['is_registered']) && ($auth->acl_get('u_readpm') || $auth->acl_get('u_sendpm')) ? true : false, 'S_DISPLAY_MEMBERLIST' => isset($auth) ? $auth->acl_get('u_viewprofile') : 0, 'S_NEW_PM' => $s_privmsg_new ? 1 : 0, 'S_REGISTER_ENABLED' => $config['require_activation'] != USER_ACTIVATION_DISABLE ? true : false, 'S_FORUM_ID' => $forum_id, 'S_TOPIC_ID' => $topic_id, 'S_LOGIN_ACTION' => !defined('ADMIN_START') ? append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'mode=login') : append_sid("{$phpbb_admin_path}index.{$phpEx}", false, true, $user->session_id), 'S_LOGIN_REDIRECT' => build_hidden_fields(array('redirect' => $phpbb_path_helper->remove_web_root_path(build_url()))), 'S_ENABLE_FEEDS' => $config['feed_enable'] ? true : false, 'S_ENABLE_FEEDS_OVERALL' => $config['feed_overall'] ? true : false, 'S_ENABLE_FEEDS_FORUMS' => $config['feed_overall_forums'] ? true : false, 'S_ENABLE_FEEDS_TOPICS' => $config['feed_topics_new'] ? true : false, 'S_ENABLE_FEEDS_TOPICS_ACTIVE' => $config['feed_topics_active'] ? true : false, 'S_ENABLE_FEEDS_NEWS' => $s_feed_news ? true : false, 'S_LOAD_UNREADS' => $config['load_unreads_search'] && ($config['load_anon_lastread'] || $user->data['is_registered']) ? true : false, 'S_SEARCH_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields), 'T_ASSETS_VERSION' => $config['assets_version'], 'T_ASSETS_PATH' => "{$web_path}assets", 'T_THEME_PATH' => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme', 'T_TEMPLATE_PATH' => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/template', 'T_SUPER_TEMPLATE_PATH' => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/template', 'T_IMAGES_PATH' => "{$web_path}images/", 'T_SMILIES_PATH' => "{$web_path}{$config['smilies_path']}/", 'T_AVATAR_PATH' => "{$web_path}{$config['avatar_path']}/", 'T_AVATAR_GALLERY_PATH' => "{$web_path}{$config['avatar_gallery_path']}/", 'T_ICONS_PATH' => "{$web_path}{$config['icons_path']}/", 'T_RANKS_PATH' => "{$web_path}{$config['ranks_path']}/", 'T_UPLOAD_PATH' => "{$web_path}{$config['upload_path']}/", 'T_STYLESHEET_LINK' => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme/stylesheet.css?assets_version=' . $config['assets_version'], 'T_STYLESHEET_LANG_LINK' => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme/' . $user->lang_name . '/stylesheet.css?assets_version=' . $config['assets_version'], 'T_JQUERY_LINK' => !empty($config['allow_cdn']) && !empty($config['load_jquery_url']) ? $config['load_jquery_url'] : "{$web_path}assets/javascript/jquery.min.js?assets_version=" . $config['assets_version'], 'S_ALLOW_CDN' => !empty($config['allow_cdn']), 'T_THEME_NAME' => rawurlencode($user->style['style_path']), 'T_THEME_LANG_NAME' => $user->data['user_lang'], 'T_TEMPLATE_NAME' => $user->style['style_path'], 'T_SUPER_TEMPLATE_NAME' => rawurlencode(isset($user->style['style_parent_tree']) && $user->style['style_parent_tree'] ? $user->style['style_parent_tree'] : $user->style['style_path']), 'T_IMAGES' => 'images', 'T_SMILIES' => $config['smilies_path'], 'T_AVATAR' => $config['avatar_path'], 'T_AVATAR_GALLERY' => $config['avatar_gallery_path'], 'T_ICONS' => $config['icons_path'], 'T_RANKS' => $config['ranks_path'], 'T_UPLOAD' => $config['upload_path'], 'SITE_LOGO_IMG' => $user->img('site_logo')));
$http_headers = array();
if ($send_headers) {
// An array of http headers that phpbb will set. The following event may override these.
$http_headers += array('Content-type' => 'text/html; charset=UTF-8', 'Cache-Control' => 'private, no-cache="set-cookie"', 'Expires' => gmdate('D, d M Y H:i:s', time()) . ' GMT');
if (!empty($user->data['is_bot'])) {
// Let reverse proxies know we detected a bot.
$http_headers['X-PHPBB-IS-BOT'] = 'yes';
}
}
/**
* Execute code and/or overwrite _common_ template variables after they have been assigned.
*
* @event core.page_header_after
* @var string page_title Page title
* @var bool display_online_list Do we display online users list
* @var string item Restrict online users to a certain
* session item, e.g. forum for
* session_forum_id
* @var int item_id Restrict online users to item id
* @var array http_headers HTTP headers that should be set by phpbb
*
* @since 3.1.0-b3
*/
$vars = array('page_title', 'display_online_list', 'item_id', 'item', 'http_headers');
extract($phpbb_dispatcher->trigger_event('core.page_header_after', compact($vars)));
foreach ($http_headers as $hname => $hval) {
header((string) $hname . ': ' . (string) $hval);
}
return;
}
示例15: append_sid
'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id),
'U_VIEW_OLDER_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&view=previous"),
'U_VIEW_NEWER_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&view=next"),
'U_PRINT_TOPIC' => ($auth->acl_get('f_print', $forum_id)) ? $viewtopic_url . '&view=print' : '',
'U_EMAIL_TOPIC' => ($auth->acl_get('f_email', $forum_id) && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=email&t=$topic_id") : '',
'U_WATCH_TOPIC' => $s_watching_topic['link'],
'L_WATCH_TOPIC' => $s_watching_topic['title'],
'S_WATCHING_TOPIC' => $s_watching_topic['is_watching'],
'U_BOOKMARK_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks']) ? $viewtopic_url . '&bookmark=1&hash=' . generate_link_hash("topic_$topic_id") : '',
'L_BOOKMARK_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks'] && $topic_data['bookmarked']) ? $user->lang['BOOKMARK_TOPIC_REMOVE'] : $user->lang['BOOKMARK_TOPIC'],
'U_POST_NEW_TOPIC' => ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=post&f=$forum_id") : '',
'U_POST_REPLY_TOPIC' => ($auth->acl_get('f_reply', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=reply&f=$forum_id&t=$topic_id") : '',
'U_BUMP_TOPIC' => (bump_topic_allowed($forum_id, $topic_data['topic_bumped'], $topic_data['topic_last_post_time'], $topic_data['topic_poster'], $topic_data['topic_last_poster_id'])) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=bump&f=$forum_id&t=$topic_id&hash=" . generate_link_hash("topic_$topic_id")) : '')
);
// Does this topic contain a poll?
if (!empty($topic_data['poll_start']))
{
$sql = 'SELECT o.*, p.bbcode_bitfield, p.bbcode_uid
FROM ' . POLL_OPTIONS_TABLE . ' o, ' . POSTS_TABLE . " p
WHERE o.topic_id = $topic_id
AND p.post_id = {$topic_data['topic_first_post_id']}
AND p.topic_id = o.topic_id
ORDER BY o.poll_option_id";
$result = $db->sql_query($sql);
$poll_info = array();
while ($row = $db->sql_fetchrow($result))