本文整理汇总了PHP中build_forum_breadcrumb函数的典型用法代码示例。如果您正苦于以下问题:PHP build_forum_breadcrumb函数的具体用法?PHP build_forum_breadcrumb怎么用?PHP build_forum_breadcrumb使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了build_forum_breadcrumb函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switch
$stickybit = " AND sticky=1";
}
// Figure out what page the thread is actually on
switch ($db->type) {
case "pgsql":
$query = $db->query("\r\n\t\t\t\tSELECT COUNT(tid) as threads\r\n\t\t\t\tFROM " . TABLE_PREFIX . "threads\r\n\t\t\t\tWHERE fid = '{$fid}' AND (lastpost >= '" . intval($thread['lastpost']) . "'{$stickybit}) {$visibleonly} {$uid_only}\r\n\t\t\t\tGROUP BY lastpost\r\n\t\t\t\tORDER BY lastpost DESC\r\n\t\t\t");
break;
default:
$query = $db->simple_select("threads", "COUNT(tid) as threads", "fid = '{$fid}' AND (lastpost >= '" . intval($thread['lastpost']) . "'{$stickybit}) {$visibleonly} {$uid_only}", array('order_by' => 'lastpost', 'order_dir' => 'desc'));
}
$thread_position = $db->fetch_field($query, "threads");
$thread_page = ceil($thread_position / $mybb->settings['threadsperpage']);
$breadcrumb_multipage = array("num_threads" => $threadcount, "current_page" => $thread_page);
}
// Build the navigation.
build_forum_breadcrumb($fid, $breadcrumb_multipage);
add_breadcrumb($thread['displayprefix'] . $thread['subject'], get_thread_link($thread['tid']));
$plugins->run_hooks("showthread_start");
// Show the entire thread (taking into account pagination).
if ($mybb->input['action'] == "thread") {
if ($thread['firstpost'] == 0) {
update_first_post($tid);
}
// Does this thread have a poll?
if ($thread['poll']) {
$options = array("limit" => 1);
$query = $db->simple_select("polls", "*", "pid='" . $thread['poll'] . "'", $options);
$poll = $db->fetch_array($query);
$poll['timeout'] = $poll['timeout'] * 60 * 60 * 24;
$expiretime = $poll['dateline'] + $poll['timeout'];
$now = TIME_NOW;
示例2: get_thread
$tid = $post['tid'];
$editdraftpid = "<input type=\"hidden\" name=\"pid\" value=\"{$pid}\" />";
}
// Set up $thread and $forum for later use.
$thread = get_thread($tid);
if (!$thread) {
error($lang->error_invalidthread);
}
$fid = $thread['fid'];
// Get forum info
$forum = get_forum($fid);
if (!$forum) {
error($lang->error_invalidforum);
}
// Make navigation
build_forum_breadcrumb($fid);
$thread['subject'] = htmlspecialchars_uni($thread['subject']);
add_breadcrumb($thread['subject'], get_thread_link($thread['tid']));
add_breadcrumb($lang->nav_newreply);
$forumpermissions = forum_permissions($fid);
// See if everything is valid up to here.
if (isset($post) && ($post['visible'] == 0 && !is_moderator($fid, "canviewunapprove") || $post['visible'] < 0 && $post['uid'] != $mybb->user['uid'])) {
error($lang->error_invalidpost);
}
if ($thread['visible'] == 0 && !is_moderator($fid, "canviewunapprove") || $thread['visible'] < 0) {
error($lang->error_invalidthread);
}
if ($forum['open'] == 0 || $forum['type'] != "f") {
error($lang->error_closedinvalidforum);
}
if ($forumpermissions['canview'] == 0 || $forumpermissions['canpostreplys'] == 0) {
示例3: htmlspecialchars_uni
if (isset($threadprefix['displaystyle'])) {
$breadcrumbprefix = $threadprefix['displaystyle'] . ' ';
}
}
$thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));
// Invalid thread
if (!$thread['tid']) {
error($lang->error_invalidthread);
}
// Guests cannot use this feature
if (!$mybb->user['uid']) {
error_no_permission();
}
$fid = $thread['fid'];
// Make navigation
build_forum_breadcrumb($thread['fid']);
add_breadcrumb($breadcrumbprefix . $thread['subject'], get_thread_link($thread['tid']));
add_breadcrumb($lang->nav_sendthread);
// Get forum info
$forum = get_forum($thread['fid']);
$forumpermissions = forum_permissions($forum['fid']);
// Invalid forum?
if (!$forum['fid'] || $forum['type'] != "f") {
error($lang->error_invalidforum);
}
// This user can't view this forum or this thread
if ($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0 || $forumpermissions['canonlyviewownthreads'] != 0 && $thread['uid'] != $mybb->user['uid']) {
error_no_permission();
}
// Check if this forum is password protected and we have a valid password
check_forum_password($forum['fid']);
示例4: forum_permissions
case "forum":
// Check if we have permission to view this forum
$forumpermissions = forum_permissions($forum['fid']);
if ($forumpermissions['canview'] != 1) {
archive_error_no_permission();
}
check_forum_password_archive($forum['fid']);
$useronly = "";
if ($forumpermissions['canonlyviewownthreads'] == 1) {
$useronly = "AND uid={$mybb->user['uid']}";
}
// Paginate this forum
$query = $db->simple_select("threads", "COUNT(tid) AS threads", "fid='{$id}' AND visible='1' {$useronly}");
$threadcount = $db->fetch_field($query, "threads");
// Build the navigation
build_forum_breadcrumb($forum['fid'], 1);
// No threads and not a category? Error!
if (($threadcount < 1 || $forumpermissions['canviewthreads'] != 1) && $forum['type'] != 'c') {
archive_header(strip_tags($forum['name']), $forum['name'], $mybb->settings['bburl'] . "/" . get_forum_link($id, $page) . "");
archive_error($lang->error_nothreads);
}
// Build the archive header.
archive_header(strip_tags($forum['name']), $forum['name'], $mybb->settings['bburl'] . "/" . get_forum_link($id, $page), 1);
$plugins->run_hooks("archive_forum_start");
if (!$mybb->settings['threadsperpage'] || (int) $mybb->settings['threadsperpage'] < 1) {
$mybb->settings['threadsperpage'] = 20;
}
$perpage = $mybb->settings['threadsperpage'];
$pages = ceil($threadcount / $perpage);
if ($page > $pages) {
$page = 1;
示例5: error
if (!$forum || $forum['type'] != "f" || $forum['rules'] == '') {
error($lang->error_invalidforum);
}
$forumpermissions = forum_permissions($forum['fid']);
if ($forumpermissions['canview'] != 1) {
error_no_permission();
}
if (!$forum['rulestitle']) {
$forum['rulestitle'] = $lang->sprintf($lang->forum_rules, $forum['name']);
}
require_once MYBB_ROOT . "inc/class_parser.php";
$parser = new postParser();
$parser_options = array("allow_html" => 1, "allow_mycode" => 1, "allow_smilies" => 1, "allow_imgcode" => 1, "filter_badwords" => 1);
$forum['rules'] = $parser->parse_message($forum['rules'], $parser_options);
// Make navigation
build_forum_breadcrumb($mybb->input['fid']);
add_breadcrumb($forum['rulestitle']);
$plugins->run_hooks("misc_rules_end");
eval("\$rules = \"" . $templates->get("misc_rules_forum") . "\";");
output_page($rules);
}
} elseif ($mybb->input['action'] == "do_helpsearch" && $mybb->request_method == "post") {
$plugins->run_hooks("misc_do_helpsearch_start");
if ($mybb->settings['helpsearch'] != 1) {
error($lang->error_helpsearchdisabled);
}
// Check if search flood checking is enabled and user is not admin
if ($mybb->settings['searchfloodtime'] > 0 && $mybb->usergroup['cancp'] != 1) {
// Fetch the time this user last searched
$timecut = TIME_NOW - $mybb->settings['searchfloodtime'];
$query = $db->simple_select("searchlog", "*", "uid='{$mybb->user['uid']}' AND dateline > '{$timecut}'", array('order_by' => "dateline", 'order_dir' => "DESC"));
示例6: get_announcement_func
function get_announcement_func($xmlrpc_params)
{
global $db, $lang, $mybb, $position, $plugins, $pids, $groupscache;
$input = Tapatalk_Input::filterXmlInput(array('topic_id' => Tapatalk_Input::STRING, 'start_num' => Tapatalk_Input::INT, 'last_num' => Tapatalk_Input::INT, 'return_html' => Tapatalk_Input::INT), $xmlrpc_params);
$parser = new Tapatalk_Parser();
// Load global language phrases
$lang->load("announcements");
$aid = intval($_GET['aid']);
// Get announcement fid
$query = $db->simple_select("announcements", "fid", "aid='{$aid}'");
$announcement = $db->fetch_array($query);
$plugins->run_hooks("announcements_start");
if (!$announcement) {
error($lang->error_invalidannouncement);
}
// Get forum info
$fid = $announcement['fid'];
if ($fid > 0) {
$forum = get_forum($fid);
if (!$forum) {
error($lang->error_invalidforum);
}
// Make navigation
build_forum_breadcrumb($forum['fid']);
// Permissions
$forumpermissions = forum_permissions($forum['fid']);
if ($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0) {
error_no_permission();
}
// Check if this forum is password protected and we have a valid password
check_forum_password($forum['fid']);
}
add_breadcrumb($lang->nav_announcements);
$archive_url = build_archive_link("announcement", $aid);
// Get announcement info
$time = TIME_NOW;
$query = $db->query("\n\t\tSELECT u.*, u.username AS userusername, a.*, f.*\n\t\tFROM " . TABLE_PREFIX . "announcements a\n\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=a.uid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "userfields f ON (f.ufid=u.uid)\n\t\tWHERE a.startdate<='{$time}' AND (a.enddate>='{$time}' OR a.enddate='0') AND a.aid='{$aid}'\n\t");
$announcementarray = $db->fetch_array($query);
if (!$announcementarray) {
error($lang->error_invalidannouncement);
}
// Gather usergroup data from the cache
// Field => Array Key
$data_key = array('title' => 'grouptitle', 'usertitle' => 'groupusertitle', 'stars' => 'groupstars', 'starimage' => 'groupstarimage', 'image' => 'groupimage', 'namestyle' => 'namestyle', 'usereputationsystem' => 'usereputationsystem');
foreach ($data_key as $field => $key) {
$announcementarray[$key] = $groupscache[$announcementarray['usergroup']][$field];
}
$announcementarray['dateline'] = $announcementarray['startdate'];
$announcementarray['userusername'] = $announcementarray['username'];
$announcement = build_postbit($announcementarray, 3);
$announcementarray['subject'] = $parser->parse_badwords($announcementarray['subject']);
$lang->forum_announcement = $lang->sprintf($lang->forum_announcement, htmlspecialchars_uni($announcementarray['subject']));
if ($announcementarray['startdate'] > $mybb->user['lastvisit']) {
$setcookie = true;
if (isset($mybb->cookies['mybb']['announcements']) && is_scalar($mybb->cookies['mybb']['announcements'])) {
$cookie = my_unserialize(stripslashes($mybb->cookies['mybb']['announcements']));
if (isset($cookie[$announcementarray['aid']])) {
$setcookie = false;
}
}
if ($setcookie) {
my_set_array_cookie('announcements', $announcementarray['aid'], $announcementarray['startdate'], -1);
}
}
$user_info = get_user($announcementarray['aid']);
$icon_url = absolute_url($user_info['avatar']);
// prepare xmlrpc return
$xmlrpc_post = new xmlrpcval(array('topic_id' => new xmlrpcval('ann_' . $announcementarray['aid']), 'post_title' => new xmlrpcval(basic_clean($announcementarray['subject']), 'base64'), 'post_content' => new xmlrpcval(process_post($announcementarray['message'], $input['return_html']), 'base64'), 'post_author_id' => new xmlrpcval($announcementarray['uid']), 'post_author_name' => new xmlrpcval(basic_clean($announcementarray['username']), 'base64'), 'user_type' => new xmlrpcval(check_return_user_type($announcementarray['username']), 'base64'), 'icon_url' => new xmlrpcval(absolute_url($icon_url)), 'post_time' => new xmlrpcval(mobiquo_iso8601_encode($announcementarray['dateline']), 'dateTime.iso8601'), 'timestamp' => new xmlrpcval($announcementarray['dateline'], 'string')), 'struct');
$result = array('total_post_num' => new xmlrpcval(1, 'int'), 'can_reply' => new xmlrpcval(false, 'boolean'), 'can_subscribe' => new xmlrpcval(false, 'boolean'), 'posts' => new xmlrpcval(array($xmlrpc_post), 'array'));
return new xmlrpcresp(new xmlrpcval($result, 'struct'));
}
示例7: replyban_run
function replyban_run()
{
global $db, $mybb, $lang, $templates, $theme, $headerinclude, $header, $footer, $replyban, $moderation;
$lang->load("replyban");
if ($mybb->input['action'] != "replyban" && $mybb->input['action'] != "do_replyban" && $mybb->input['action'] != "liftreplyban") {
return;
}
if ($mybb->input['action'] == "replyban") {
$tid = $mybb->get_input('tid', MyBB::INPUT_INT);
$thread = get_thread($tid);
if (!is_moderator($thread['fid'], "canmanagethreads")) {
error_no_permission();
}
if (!$thread['tid']) {
error($lang->error_invalidthread);
}
$thread['subject'] = htmlspecialchars_uni($thread['subject']);
$lang->reply_bans_for = $lang->sprintf($lang->reply_bans_for, $thread['subject']);
check_forum_password($thread['fid']);
build_forum_breadcrumb($thread['fid']);
add_breadcrumb($thread['subject'], get_thread_link($thread['tid']));
add_breadcrumb($lang->reply_bans);
$query = $db->query("\r\n\t\t\tSELECT r.*, u.username\r\n\t\t\tFROM " . TABLE_PREFIX . "replybans r\r\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (r.uid=u.uid)\r\n\t\t\tWHERE r.tid='{$thread['tid']}'\r\n\t\t\tORDER BY r.dateline DESC\r\n\t\t");
while ($ban = $db->fetch_array($query)) {
$ban['reason'] = htmlspecialchars_uni($ban['reason']);
$ban['username'] = build_profile_link($ban['username'], $ban['uid']);
if ($ban['lifted'] == 0) {
$ban['lifted'] = $lang->permanent;
} else {
$ban['lifted'] = my_date('relative', $ban['lifted'], '', 2);
}
$alt_bg = alt_trow();
eval("\$ban_bit .= \"" . $templates->get("moderation_replyban_bit") . "\";");
}
if (!$ban_bit) {
eval("\$ban_bit = \"" . $templates->get("moderation_replyban_no_bans") . "\";");
}
// Generate the banned times dropdown
$liftlist = '';
$bantimes = fetch_ban_times();
foreach ($bantimes as $time => $title) {
$selected = '';
if (isset($banned['bantime']) && $banned['bantime'] == $time) {
$selected = " selected=\"selected\"";
}
$thattime = '';
if ($time != '---') {
$dateline = TIME_NOW;
if (isset($banned['dateline'])) {
$dateline = $banned['dateline'];
}
$thatime = my_date("D, jS M Y @ g:ia", ban_date2timestamp($time, $dateline));
$thattime = " ({$thatime})";
}
eval("\$liftlist .= \"" . $templates->get("moderation_replyban_liftlist") . "\";");
}
eval("\$replyban = \"" . $templates->get("moderation_replyban") . "\";");
output_page($replyban);
}
if ($mybb->input['action'] == "do_replyban" && $mybb->request_method == "post") {
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));
$tid = $mybb->get_input('tid', MyBB::INPUT_INT);
$thread = get_thread($tid);
if (!is_moderator($thread['fid'], "canmanagethreads")) {
error_no_permission();
}
if (!$thread['tid']) {
error($lang->error_invalidthread);
}
$user = get_user_by_username($mybb->input['username'], array('fields' => array('username')));
if (!$user['uid']) {
error($lang->error_invaliduser);
}
$mybb->input['reason'] = $mybb->get_input('reason');
if (!trim($mybb->input['reason'])) {
error($lang->error_missing_reason);
}
$query = $db->simple_select('replybans', 'rid', "uid='{$user['uid']}' AND tid='{$thread['tid']}'");
$existingban = $db->fetch_field($query, 'rid');
if ($existingban > 0) {
error($lang->error_alreadybanned);
}
if ($mybb->get_input('liftban') == '---') {
$lifted = 0;
} else {
$lifted = ban_date2timestamp($mybb->get_input('liftban'), 0);
}
$reason = my_substr($mybb->input['reason'], 0, 240);
$insert_array = array('uid' => $user['uid'], 'tid' => $thread['tid'], 'dateline' => TIME_NOW, 'reason' => $db->escape_string($reason), 'lifted' => $db->escape_string($lifted));
$db->insert_query('replybans', $insert_array);
log_moderator_action(array("tid" => $thread['tid'], "fid" => $thread['fid'], "uid" => $user['uid'], "username" => $user['username']), $lang->user_reply_banned);
moderation_redirect("moderation.php?action=replyban&tid={$thread['tid']}", $lang->redirect_user_banned_replying);
}
if ($mybb->input['action'] == "liftreplyban") {
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));
$rid = $mybb->get_input('rid', MyBB::INPUT_INT);
$query = $db->simple_select("replybans", "*", "rid='{$rid}'");
$ban = $db->fetch_array($query);
//.........这里部分代码省略.........
示例8: build_forum_breadcrumb
/**
* Build the forum breadcrumb nagiation (the navigation to a specific forum including all parent forums)
*
* @param int The forum ID to build the navigation for
* @param array The multipage drop down array of information
*/
function build_forum_breadcrumb($fid, $multipage = array())
{
global $pforumcache, $currentitem, $forum_cache, $navbits, $lang, $base_url, $archiveurl;
if (!$pforumcache) {
if (!is_array($forum_cache)) {
cache_forums();
}
foreach ($forum_cache as $key => $val) {
$pforumcache[$val['fid']][$val['pid']] = $val;
}
}
if (is_array($pforumcache[$fid])) {
foreach ($pforumcache[$fid] as $key => $forumnav) {
if ($fid == $forumnav['fid']) {
if (!empty($pforumcache[$forumnav['pid']])) {
build_forum_breadcrumb($forumnav['pid']);
}
$navsize = count($navbits);
// Convert & to &
$navbits[$navsize]['name'] = preg_replace("#&(?!\\#[0-9]+;)#si", "&", $forumnav['name']);
if (defined("IN_ARCHIVE")) {
// Set up link to forum in breadcrumb.
if ($pforumcache[$fid][$forumnav['pid']]['type'] == 'f' || $pforumcache[$fid][$forumnav['pid']]['type'] == 'c') {
$navbits[$navsize]['url'] = "{$base_url}forum-" . $forumnav['fid'] . ".html";
} else {
$navbits[$navsize]['url'] = $archiveurl . "/index.php";
}
} elseif (!empty($multipage)) {
$navbits[$navsize]['url'] = get_forum_link($forumnav['fid'], $multipage['current_page']);
$navbits[$navsize]['multipage'] = $multipage;
$navbits[$navsize]['multipage']['url'] = str_replace('{fid}', $forumnav['fid'], FORUM_URL_PAGED);
} else {
$navbits[$navsize]['url'] = get_forum_link($forumnav['fid']);
}
}
}
}
return 1;
}