本文整理汇总了PHP中generate_forum_nav函数的典型用法代码示例。如果您正苦于以下问题:PHP generate_forum_nav函数的具体用法?PHP generate_forum_nav怎么用?PHP generate_forum_nav使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了generate_forum_nav函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: redirect
// Is this forum a link? ... User got here either because the
// number of clicks is being tracked or they guessed the id
if ($forum_data['forum_type'] == FORUM_LINK && $forum_data['forum_link']) {
// Does it have click tracking enabled?
if ($forum_data['forum_flags'] & FORUM_FLAG_LINK_TRACK) {
$sql = 'UPDATE ' . FORUMS_TABLE . '
SET forum_posts_approved = forum_posts_approved + 1
WHERE forum_id = ' . $forum_id;
$db->sql_query($sql);
}
// We redirect to the url. The third parameter indicates that external redirects are allowed.
redirect($forum_data['forum_link'], false, true);
return;
}
// Build navigation links
generate_forum_nav($forum_data);
// Forum Rules
if ($auth->acl_get('f_read', $forum_id)) {
generate_forum_rules($forum_data);
}
// Do we have subforums?
$active_forum_ary = $moderators = array();
if ($forum_data['left_id'] != $forum_data['right_id'] - 1) {
list($active_forum_ary, $moderators) = display_forums($forum_data, $config['load_moderators'], $config['load_moderators']);
} else {
$template->assign_var('S_HAS_SUBFORUM', false);
if ($config['load_moderators']) {
get_moderators($moderators, $forum_id);
}
}
/* @var $phpbb_content_visibility \phpbb\content_visibility */
示例2: switch
$s_action .= $post_id ? "&p={$post_id}" : '';
switch ($mode) {
case 'post':
$page_title = $user->lang['POST_TOPIC'];
break;
case 'quote':
case 'reply':
$page_title = $user->lang['POST_REPLY'];
break;
case 'delete':
case 'edit':
$page_title = $user->lang['EDIT_POST'];
break;
}
// Build Navigation Links
generate_forum_nav($post_data);
// Build Forum Rules
generate_forum_rules($post_data);
// Posting uses is_solved for legacy reasons. Plugins have to use is_solved to force themselves to be displayed.
if ($config['enable_post_confirm'] && !$user->data['is_registered'] && (isset($captcha) && $captcha->is_solved() === false) && ($mode == 'post' || $mode == 'reply' || $mode == 'quote')) {
$template->assign_vars(array('S_CONFIRM_CODE' => true, 'CAPTCHA_TEMPLATE' => $captcha->get_template()));
}
$s_hidden_fields = $mode == 'reply' || $mode == 'quote' ? '<input type="hidden" name="topic_cur_post_id" value="' . $post_data['topic_last_post_id'] . '" />' : '';
$s_hidden_fields .= '<input type="hidden" name="lastclick" value="' . $current_time . '" />';
$s_hidden_fields .= $draft_id || isset($_REQUEST['draft_loaded']) ? '<input type="hidden" name="draft_loaded" value="' . request_var('draft_loaded', $draft_id) . '" />' : '';
if ($mode == 'edit') {
$s_hidden_fields .= build_hidden_fields(array('edit_post_message_checksum' => $post_data['post_checksum'], 'edit_post_subject_checksum' => $post_data['post_subject_md5']));
}
// Add the confirm id/code pair to the hidden fields, else an error is displayed on next submit/preview
if (isset($captcha) && $captcha->is_solved() !== false) {
$s_hidden_fields .= build_hidden_fields($captcha->get_hidden_fields());
示例3: gen_forum_auth_level
$extensions = $cache->obtain_attach_extensions($forum_id);
}
// Forum rules listing
$s_forum_rules = '';
gen_forum_auth_level('topic', $forum_id, $topic_data['forum_status']);
// Quick mod tools
$allow_change_type = $auth->acl_get('m_', $forum_id) || $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'] ? true : false;
$s_quickmod_action = append_sid("{$phpbb_root_path}mcp.{$phpEx}", array('f' => $forum_id, 't' => $topic_id, 'start' => $start, 'quickmod' => 1, 'redirect' => urlencode(str_replace('&', '&', $viewtopic_url))), true, $user->session_id);
$quickmod_array = array('lock' => array('LOCK_TOPIC', $topic_data['topic_status'] == ITEM_UNLOCKED && ($auth->acl_get('m_lock', $forum_id) || $auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'])), 'unlock' => array('UNLOCK_TOPIC', $topic_data['topic_status'] != ITEM_UNLOCKED && $auth->acl_get('m_lock', $forum_id)), 'delete_topic' => array('DELETE_TOPIC', $auth->acl_get('m_delete', $forum_id) || $topic_data['topic_visibility'] != ITEM_DELETED && $auth->acl_get('m_softdelete', $forum_id)), 'restore_topic' => array('RESTORE_TOPIC', $topic_data['topic_visibility'] == ITEM_DELETED && $auth->acl_get('m_approve', $forum_id)), 'move' => array('MOVE_TOPIC', $auth->acl_get('m_move', $forum_id) && $topic_data['topic_status'] != ITEM_MOVED), 'split' => array('SPLIT_TOPIC', $auth->acl_get('m_split', $forum_id)), 'merge' => array('MERGE_POSTS', $auth->acl_get('m_merge', $forum_id)), 'merge_topic' => array('MERGE_TOPIC', $auth->acl_get('m_merge', $forum_id)), 'fork' => array('FORK_TOPIC', $auth->acl_get('m_move', $forum_id)), 'make_normal' => array('MAKE_NORMAL', $allow_change_type && $auth->acl_gets('f_sticky', 'f_announce', 'f_announce_global', $forum_id) && $topic_data['topic_type'] != POST_NORMAL), 'make_sticky' => array('MAKE_STICKY', $allow_change_type && $auth->acl_get('f_sticky', $forum_id) && $topic_data['topic_type'] != POST_STICKY), 'make_announce' => array('MAKE_ANNOUNCE', $allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_ANNOUNCE), 'make_global' => array('MAKE_GLOBAL', $allow_change_type && $auth->acl_get('f_announce_global', $forum_id) && $topic_data['topic_type'] != POST_GLOBAL), 'topic_logs' => array('VIEW_TOPIC_LOGS', $auth->acl_get('m_', $forum_id)));
foreach ($quickmod_array as $option => $qm_ary) {
if (!empty($qm_ary[1])) {
phpbb_add_quickmod_option($s_quickmod_action, $option, $qm_ary[0]);
}
}
// Navigation links
generate_forum_nav($topic_data);
// Forum Rules
generate_forum_rules($topic_data);
// Moderators
$forum_moderators = array();
if ($config['load_moderators']) {
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']);
$s_search_hidden_fields = array('t' => $topic_id, 'sf' => 'msgonly');
if ($_SID) {
$s_search_hidden_fields['sid'] = $_SID;
}
示例4: ON
LEFT JOIN ' . FORUMS_TABLE . " f ON (f.forum_id = t.forum_id)\n\t\t\tWHERE t.topic_id = {$topic_id}";
$result = $db->sql_query($sql);
$topicrow = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// Setup look and feel
$user->setup('viewtopic', $topicrow['forum_style']);
$uid = $bitfield = $options = '';
// will be modified by generate_text_for_storage
$allow_bbcode = $allow_urls = $allow_smilies = true;
generate_text_for_storage($message, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies);
// Grab ranks
$ranks = $cache->obtain_ranks();
// Grab icons
$icons = $cache->obtain_icons();
// Navigation links
generate_forum_nav($topicrow);
$data = array('topic_title' => $topicrow['topic_title'], 'topic_first_post_id' => isset($topicrow['topic_first_post_id']) ? (int) $topicrow['topic_first_post_id'] : 0, 'topic_last_post_id' => isset($topicrow['topic_last_post_id']) ? (int) $topicrow['topic_last_post_id'] : 0, 'topic_time_limit' => (int) $topicrow['topic_time_limit'], 'topic_attachment' => 0, 'post_id' => 0, 'topic_id' => (int) $topic_id, 'forum_id' => (int) $forum_id, 'icon_id' => 0, 'poster_id' => $user->data['user_id'], 'enable_sig' => true, 'enable_bbcode' => true, 'enable_smilies' => true, 'enable_urls' => true, 'enable_indexing' => true, 'message_md5' => (string) md5($message), 'post_time' => $current_time, 'post_checksum' => '', 'post_edit_reason' => '', 'post_edit_user' => 0, 'forum_parents' => $topicrow['forum_parents'], 'forum_name' => $topicrow['forum_name'], 'notify' => false, 'notify_set' => '', 'poster_ip' => $user->ip, 'post_edit_locked' => 0, 'bbcode_bitfield' => $bitfield, 'bbcode_uid' => $uid, 'message' => $message, 'attachment_data' => '', 'filename_data' => '');
$subject = utf8_normalize_nfc(request_var('subject', '', true));
$subject = !$subject ? "Re: {$topicrow['topic_title']}" : $subject;
$submitmode = 'reply';
submit_post($submitmode, $subject, $user->data['username'], $topicrow['topic_type'], $poll, $data, $update_message = true);
$rank_title = $rank_image = $rank_image_src = $user_age = '';
$post_id = $data['post_id'];
}
$_RESULT['success'] = true;
echo $post_id;
} else {
if ($mode == 'topic_preview') {
/**
Preview topic
*/
示例5: while
// Generate the form
$sql = 'SELECT *
FROM ' . REASONS_TABLE . '
ORDER BY reason_priority ASC';
$result = $_CLASS['core_db']->sql_query($sql);
while ($row = $_CLASS['core_db']->sql_fetchrow($result)) {
$row['reason_name'] = strtoupper($row['reason_name']);
$reason_title = !empty($_CLASS['core_user']->lang['report_reasons']['TITLE'][$row['reason_name']]) ? $_CLASS['core_user']->lang['report_reasons']['TITLE'][$row['reason_name']] : ucwords(str_replace('_', ' ', $row['reason_name']));
$reason_desc = !empty($_CLASS['core_user']->lang['report_reasons']['DESCRIPTION'][$row['reason_name']]) ? $_CLASS['core_user']->lang['report_reasons']['DESCRIPTION'][$row['reason_name']] : $row['reason_desc'];
$_CLASS['core_template']->assign_vars_array('reason', array('ID' => $row['reason_id'], 'NAME' => htmlspecialchars($reason_title), 'DESCRIPTION' => htmlspecialchars($reason_desc), 'S_SELECTED' => $row['reason_id'] == $reason_id ? true : false));
}
$_CLASS['core_db']->sql_freeresult($result);
$u_report = $report_post ? "p={$id}" : "pm={$id}";
$_CLASS['core_template']->assign(array('REPORT_TEXT' => $report_text, 'S_REPORT_ACTION' => generate_link("Forums&file=report&{$u_report}" . ($report_id ? "&report_id={$report_id}" : '')), 'S_NOTIFY' => !empty($user_notify) ? true : false, 'S_CAN_NOTIFY' => $_CLASS['core_user']->data['user_id'] == ANONYMOUS ? false : true, 'S_REPORT_POST' => $report_post));
if ($report_post) {
generate_forum_nav($report_data);
}
page_header();
$_CLASS['core_template']->display('modules/Forums/report_body.html');
function report_notification($notify_user, $report_post, $report_data)
{
global $config, $site_file_root;
require_once $site_file_root . 'includes/forums/functions_messenger.php';
require_once $site_file_root . 'includes/forums/functions_privmsgs.php';
$messenger = new messenger();
$email_sig = str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']);
$email_template = $report_post ? 'new_report_post' : 'new_report_pm';
$view_report_url = $report_post ? generate_link('Forums&file=mcp&i=queue&r=' . $report_data['report_id'], array('full' => true, 'sid' => false)) : generate_link('Forums&file=mcp&i=pm&p=' . $report_data['id'] . '&r=' . $report_data['report_id'], array('full' => true, 'sid' => false));
foreach ($notify_user as $user_id => $notify_row) {
// Send notification by email
if (!$notify_row['pm']) {
示例6: get_thread_func
function get_thread_func()
{
global $template, $user, $auth, $phpbb_home, $config, $attachment_by_id, $forum_id, $topic_id, $support_post_thanks, $topic_data, $total_posts, $can_subscribe;
generate_forum_nav($topic_data);
$navgation_arr = $template->_tpldata['navlinks'];
if (is_array($navgation_arr) && count($navgation_arr) > 0) {
global $app_version;
foreach ($navgation_arr as $navigation) {
$nav_forum_id = $navigation['FORUM_ID'];
$sub_only = false;
if ($navigation['S_IS_POST'] != FORUM_POST) {
$sub_only = true;
}
if (empty($nav_forum_id)) {
continue;
}
$breadcrumb[] = new xmlrpcval(array('forum_id' => new xmlrpcval($nav_forum_id, 'string'), 'forum_name' => new xmlrpcval($navigation['FORUM_NAME'], 'base64'), 'sub_only' => new xmlrpcval($sub_only, 'boolean')), 'struct');
}
}
$post_list = array();
foreach ($template->_tpldata['postrow'] as $key => $row) {
$attachments = array();
if ($row['S_HAS_ATTACHMENTS']) {
foreach ($row['attachment'] as $attachment) {
if (preg_match('/<img src=\\".*?\\/(download\\/file\\.php\\?id=(\\d+).*?)\\"/is', $attachment['DISPLAY_ATTACHMENT'], $matches)) {
$attach_id = $matches[2];
$file_url = basic_clean($phpbb_home . $matches[1]);
$thumbnail_url = '';
if ($config['img_create_thumbnail'] && $attachment_by_id[$attach_id]['thumbnail_orig']) {
$thumbnail_url = preg_replace('/file\\.php\\?/is', 'file.php?t=1&', $file_url);
}
unset($matches);
if (strpos($attachment_by_id[$attach_id]['mimetype'], 'image') === 0) {
$content_type = 'image';
} else {
$content_type = $attachment_by_id[$attach_id]['extension'];
}
$xmlrpc_attachment = new xmlrpcval(array('filename' => new xmlrpcval($attachment_by_id[$attach_id]['real_filename'], 'base64'), 'filesize' => new xmlrpcval($attachment_by_id[$attach_id]['filesize'], 'int'), 'content_type' => new xmlrpcval($content_type), 'thumbnail_url' => new xmlrpcval($thumbnail_url), 'url' => new xmlrpcval($file_url)), 'struct');
$attachments[] = $xmlrpc_attachment;
}
}
}
if ($row['S_IGNORE_POST']) {
$row['MESSAGE'] = '[color=Gray]' . $row['L_IGNORE_POST'] . '[/color]' . "[spoiler]{$row[MESSAGE]}[/spoiler]";
}
$can_ban_user = $auth->acl_get('m_ban') && $row['POSTER_ID'] != $user->data['user_id'];
$xmlrpc_post = array('topic_id' => new xmlrpcval($topic_id), 'post_id' => new xmlrpcval($row['POST_ID']), 'post_title' => new xmlrpcval(basic_clean($row['POST_SUBJECT']), 'base64'), 'post_content' => new xmlrpcval(post_html_clean($row['MESSAGE']), 'base64'), 'post_author_id' => new xmlrpcval($row['POSTER_ID']), 'post_author_name' => new xmlrpcval(basic_clean($row['POST_AUTHOR']), 'base64'), 'icon_url' => new xmlrpcval($row['POSTER_AVATAR']), 'post_time' => new xmlrpcval($row['POST_DATE'], 'dateTime.iso8601'), 'timestamp' => new xmlrpcval($row['POST_TIMESTAMP'], 'string'), 'attachments' => new xmlrpcval($attachments, 'array'), 'is_online' => new xmlrpcval($row['S_ONLINE'], 'boolean'), 'can_edit' => new xmlrpcval($row['U_EDIT'], 'boolean'), 'can_delete' => new xmlrpcval($row['U_DELETE'], 'boolean'), 'can_approve' => new xmlrpcval($auth->acl_get('m_approve', $forum_id) && !$row['post_approved'], 'boolean'), 'is_approved' => new xmlrpcval($row['post_approved'] ? true : false, 'boolean'), 'can_move' => new xmlrpcval($auth->acl_get('m_split', $forum_id), 'boolean'), 'can_ban' => new xmlrpcval($can_ban_user, 'boolean'), 'allow_smilies' => new xmlrpcval($row['enable_smilies'] ? true : false, 'boolean'));
if ($support_post_thanks) {
if (!$row['S_GLOBAL_POST_THANKS'] && !$row['S_POST_ANONYMOUS'] && $auth->acl_get('f_thanks', $forum_id) && $user->data['user_id'] != ANONYMOUS && $user->data['user_id'] != $row['POSTER_ID'] && !$row['S_ALREADY_THANKED']) {
if (!empty($config['thanks_only_first_post']) && $key == 0) {
$xmlrpc_post['can_thank'] = new xmlrpcval(true, 'boolean');
} else {
if (!empty($config['thanks_only_first_post'])) {
$xmlrpc_post['can_thank'] = new xmlrpcval(false, 'boolean');
} else {
$xmlrpc_post['can_thank'] = new xmlrpcval(true, 'boolean');
}
}
}
if ($row['THANKS'] && $row['THANKS_POSTLIST_VIEW'] && !$row['S_POST_ANONYMOUS'] && empty($user->data['is_bot'])) {
global $thankers;
$count = 0;
$thank_list = array();
$maxcount = isset($config['thanks_number_post']) ? $config['thanks_number_post'] : (isset($config['thanks_number']) ? $config['thanks_number'] : 10);
foreach ($thankers as $thanker) {
if ($count >= $maxcount) {
break;
}
if ($thanker['post_id'] == $row['POST_ID']) {
$thank_list[] = new xmlrpcval(array('userid' => new xmlrpcval($thanker['user_id'], 'string'), 'username' => new xmlrpcval(basic_clean($thanker['username']), 'base64'), 'user_type' => check_return_user_type($thanker['username'])), 'struct');
$count++;
}
}
if (!empty($thank_list)) {
$xmlrpc_post['thanks_info'] = new xmlrpcval($thank_list, 'array');
}
}
}
$post_list[] = new xmlrpcval($xmlrpc_post, 'struct');
}
//add show first post only to guest support
if (!empty($topic_data['sfpo_guest_enable']) && $user->data['user_id'] == ANONYMOUS && $total_posts > 1) {
$post_list_temp[] = $post_list[0];
unset($post_list);
$post_list = $post_list_temp;
$total_posts = 1;
}
$allow_change_type = $auth->acl_get('m_', $forum_id) || $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'] ? true : false;
$allowed = $config['max_attachments'] && $auth->acl_get('f_attach', $forum_id) && $auth->acl_get('u_attach') && $config['allow_attachments'] && @ini_get('file_uploads') != '0' && strtolower(@ini_get('file_uploads')) != 'off';
$max_attachment = $auth->acl_get('a_') || $auth->acl_get('m_', $forum_id) ? 99 : ($allowed ? $config['max_attachments'] : 0);
$max_png_size = $auth->acl_get('a_') || $auth->acl_get('m_', $forum_id) ? 10485760 : ($allowed ? $config['max_filesize'] === '0' ? 10485760 : $config['max_filesize'] : 0);
$max_jpg_size = $auth->acl_get('a_') || $auth->acl_get('m_', $forum_id) ? 10485760 : ($allowed ? $config['max_filesize'] === '0' ? 10485760 : $config['max_filesize'] : 0);
$can_rename = $user->data['is_registered'] && ($auth->acl_get('m_edit', $forum_id) || $user->data['user_id'] == $row['topic_poster'] && $auth->acl_get('f_edit', $forum_id) && ($topic_data['topic_time'] > time() - $config['edit_time'] * 60 || !$config['edit_time']));
$is_poll = !empty($topic_data['poll_title']) ? true : false;
$result = array('total_post_num' => new xmlrpcval($total_posts, 'int'), 'forum_id' => new xmlrpcval($forum_id), 'forum_name' => new xmlrpcval(basic_clean($topic_data['forum_name']), 'base64'), 'topic_id' => new xmlrpcval($topic_id), 'topic_title' => new xmlrpcval(basic_clean(censor_text($topic_data['topic_title'])), 'base64'), 'position' => new xmlrpcval($topic_data['prev_posts'] + 1, 'int'), 'can_reply' => new xmlrpcval($auth->acl_get('f_reply', $forum_id) && $topic_data['forum_status'] != ITEM_LOCKED && $topic_data['topic_status'] != ITEM_LOCKED, 'boolean'), 'can_report' => new xmlrpcval(true, 'boolean'), 'can_upload' => new xmlrpcval($allowed, 'boolean'), 'can_delete' => new xmlrpcval($auth->acl_get('m_delete', $forum_id), 'boolean'), 'can_move' => new xmlrpcval($auth->acl_get('m_move', $forum_id), 'boolean'), 'can_subscribe' => new xmlrpcval($can_subscribe, 'boolean'), 'can_rename' => new xmlrpcval($can_rename, 'boolean'), 'is_subscribed' => new xmlrpcval(isset($topic_data['notify_status']) && !is_null($topic_data['notify_status']) && $topic_data['notify_status'] !== '' ? true : false, 'boolean'), 'can_stick' => new xmlrpcval($allow_change_type && $auth->acl_get('f_sticky', $forum_id), 'boolean'), 'is_sticky' => new xmlrpcval($topic_data['topic_type'] == POST_STICKY, 'boolean'), 'can_close' => new xmlrpcval($auth->acl_get('m_lock', $forum_id) || $auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'], 'boolean'), 'is_closed' => new xmlrpcval($topic_data['topic_status'] == ITEM_LOCKED, 'boolean'), 'can_approve' => new xmlrpcval($auth->acl_get('m_approve', $forum_id) && !$topic_data['topic_approved'], 'boolean'), 'is_approved' => new xmlrpcval($topic_data['topic_approved'] ? true : false, 'boolean'), 'is_poll' => new xmlrpcval($is_poll, 'boolean'), 'max_attachment' => new xmlrpcval($max_attachment, 'int'), 'max_png_size' => new xmlrpcval($max_png_size, 'int'), 'max_jpg_size' => new xmlrpcval($max_jpg_size, 'int'), 'posts' => new xmlrpcval($post_list, 'array'));
if (!empty($breadcrumb)) {
$result['breadcrumb'] = new xmlrpcval($breadcrumb, 'array');
}
return new xmlrpcresp(new xmlrpcval($result, 'struct'));
}