本文整理汇总了PHP中bb_load_template函数的典型用法代码示例。如果您正苦于以下问题:PHP bb_load_template函数的具体用法?PHP bb_load_template怎么用?PHP bb_load_template使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bb_load_template函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bb_fix_password
bb_fix_password($user->ID);
}
}
foreach ($profile_admin_keys as $key => $label) {
if (${$key} != '' || isset($user->{$key})) {
bb_update_usermeta($user->ID, $key, ${$key});
}
}
foreach ($assignable_caps as $cap => $label) {
if (!($already = array_key_exists($cap, $user->capabilities)) && ${$cap}) {
$user_obj->add_cap($cap);
} elseif (!${$cap} && $already) {
$user_obj->remove_cap($cap);
}
}
}
if (bb_current_user_can('change_user_password', $user->ID) && !empty($_POST['pass1'])) {
$_POST['pass1'] = addslashes($_POST['pass1']);
bb_update_user_password($user->ID, $_POST['pass1']);
if (bb_get_current_user_info('ID') == $user->ID) {
bb_clear_auth_cookie();
bb_set_auth_cookie($user->ID);
}
}
do_action('profile_edited', $user->ID);
nxt_redirect(add_query_arg('updated', 'true', get_user_profile_link($user->ID)));
exit;
}
}
bb_load_template('profile-edit.php', array('profile_info_keys', 'profile_admin_keys', 'assignable_caps', 'user_email', 'bb_roles', 'errors', 'self'));
示例2: topic_tags
function topic_tags()
{
global $tags, $tag, $topic_tag_cache, $user_tags, $other_tags, $topic;
if (is_array($tags) || bb_current_user_can('edit_tag_by_on', bb_get_current_user_info('id'), $topic->topic_id)) {
bb_load_template('topic-tags.php', array('user_tags', 'other_tags', 'public_tags'));
}
}
示例3: bb_repermalink
//.........这里部分代码省略.........
if (bb_get_option('mod_rewrite') === 'slugs') {
if (!($user = bb_get_user_by_nicename($id))) {
$user = bb_get_user($id);
}
} else {
if (!($user = bb_get_user($id))) {
$user = bb_get_user_by_nicename($id);
}
}
}
if (!$user || 1 == $user->user_status && !bb_current_user_can('moderate')) {
bb_die(__('User not found.'), '', 404);
}
$user_id = $user->ID;
bb_global_profile_menu_structure();
$valid = false;
if ($tab = isset($_GET['tab']) ? $_GET['tab'] : bb_get_path(2)) {
foreach ($profile_hooks as $valid_tab => $valid_file) {
if ($tab == $valid_tab) {
$valid = true;
$self = $valid_file;
}
}
}
if ($valid) {
$permalink = get_profile_tab_link($user->ID, $tab, $page);
} else {
$permalink = get_user_profile_link($user->ID, $page);
unset($self, $tab);
}
break;
case 'favorites-page':
$permalink = get_favorites_link();
break;
case 'tag-page':
// It's not an integer and tags.php pulls double duty.
$id = isset($_GET['tag']) ? $_GET['tag'] : false;
if (!$id || !bb_get_tag((string) $id)) {
$permalink = bb_get_tag_page_link();
} else {
global $tag, $tag_name;
$tag_name = $id;
$tag = bb_get_tag((string) $id);
$permalink = bb_get_tag_link(0, $page);
// 0 => grabs $tag from global.
}
break;
case 'view-page':
// Not an integer
if (isset($_GET['view'])) {
$id = $_GET['view'];
} else {
$id = bb_get_path();
}
$_original_id = $id;
global $view;
$view = $id;
$permalink = get_view_link($view, $page);
break;
default:
return;
break;
}
nxt_parse_str($_SERVER['QUERY_STRING'], $args);
$args = urlencode_deep($args);
if ($args) {
$permalink = add_query_arg($args, $permalink);
if (bb_get_option('mod_rewrite')) {
$pretty_args = array('id', 'page', 'tag', 'tab', 'username');
// these are already specified in the path
if ($location == 'view-page') {
$pretty_args[] = 'view';
}
foreach ($pretty_args as $pretty_arg) {
$permalink = remove_query_arg($pretty_arg, $permalink);
}
}
}
$permalink = apply_filters('bb_repermalink_result', $permalink, $location);
$domain = bb_get_option('domain');
$domain = preg_replace('/^https?/', '', $domain);
$check = preg_replace('|^.*' . trim($domain, ' /') . '|', '', $permalink, 1);
$uri = rtrim($uri, " \t\n\r\v?");
$uri = str_replace('/index.php', '/', $uri);
global $bb_log;
$bb_log->debug($uri, 'bb_repermalink() ' . __('REQUEST_URI'));
$bb_log->debug($check, 'bb_repermalink() ' . __('should be'));
$bb_log->debug($permalink, 'bb_repermalink() ' . __('full permalink'));
$bb_log->debug(isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : null, 'bb_repermalink() ' . __('PATH_INFO'));
if ($check != $uri && $check != str_replace(urlencode($_original_id), $_original_id, $uri)) {
if ($issue_404 && rtrim($check, " \t\n\r\v/") !== rtrim($uri, " \t\n\r\v/")) {
status_header(404);
bb_load_template('404.php');
} else {
nxt_redirect($permalink);
}
exit;
}
do_action('post_permalink', $permalink);
}
示例4: array
$posts = array();
foreach ($topics as $topic) {
$posts[] = bb_get_first_post($topic->topic_id);
}
$title = esc_html(sprintf(__('%1$s » Recent Topics'), bb_get_option('name')));
$link = bb_get_uri();
$link_self = bb_get_topics_rss_link();
break;
// Get latest posts by default
// Get latest posts by default
case 'all-posts':
default:
if (!($posts = bb_get_latest_posts(35))) {
die;
}
$title = esc_html(sprintf(__('%1$s » Recent Posts'), bb_get_option('name')));
$link = bb_get_uri();
$link_self = bb_get_posts_rss_link();
break;
}
}
bb_send_304($posts[0]->post_time);
if (!($description = esc_html(bb_get_option('description')))) {
$description = $title;
}
$title = apply_filters('bb_title_rss', $title, $feed);
$description = apply_filters('bb_description_rss', $description, $feed);
$posts = apply_filters('bb_posts_rss', $posts, $feed);
$link_self = apply_filters('bb_link_self_rss', $link_self, $feed);
bb_load_template('rss2.php', array('bb_db_override', 'title', 'description', 'link', 'link_self'), $feed);
示例5: bb_auth
<?php
require './bb-load.php';
bb_auth('logged_in');
$post_id = (int) $_GET['id'];
$bb_post = bb_get_post($post_id);
if (!$bb_post || !bb_current_user_can('edit_post', $post_id)) {
wp_redirect(bb_get_uri(null, null, BB_URI_CONTEXT_HEADER));
die;
}
if (0 != $bb_post->post_status && 'all' == $_GET['view']) {
// We're trying to edit a deleted post
add_filter('bb_is_first_where', 'bb_no_where');
}
$topic = get_topic($bb_post->topic_id);
if (bb_is_first($bb_post->post_id) && bb_current_user_can('edit_topic', $topic->topic_id)) {
$topic_title = $topic->topic_title;
} else {
$topic_title = false;
}
bb_load_template('edit-post.php', array('topic_title'));
示例6: bb_repermalink
<?php
require './bb-load.php';
bb_repermalink();
$bb_db_override = false;
do_action('bb_index.php_pre_db');
if (isset($_GET['new']) && '1' == $_GET['new']) {
$forums = false;
} elseif (!$bb_db_override) {
$forums = bb_get_forums();
// Comment to hide forums
if ($topics = get_latest_topics(false, $page)) {
bb_cache_last_posts($topics);
}
if ($super_stickies = get_sticky_topics()) {
bb_cache_last_posts($super_stickies);
}
}
bb_load_template('front-page.php', array('bb_db_override', 'super_stickies'));
示例7: get_popular_topics
<?php
require './bb-load.php';
require_once BB_PATH . BB_INC . 'functions.bb-statistics.php';
$popular = get_popular_topics();
$bb->static_title = __('Statistics');
bb_load_template('stats.php', array('popular'));
示例8: bb_get_current_user_info
<?php
require_once './bb-load.php';
$user_id = bb_get_current_user_info('id');
if (!bb_is_profile()) {
$sendto = get_profile_tab_link($user_id, 'edit');
nxt_redirect($sendto);
exit;
}
do_action($self . '_pre_head');
if (is_callable($self)) {
bb_load_template('profile-base.php', array('self'), $user_id);
}
exit;
示例9: bb_repermalink
<?php
require_once './bb-load.php';
$forum_id = 0;
bb_repermalink();
if (!$forum) {
bb_die(__('Forum not found.'));
}
$bb_db_override = false;
do_action('bb_forum.php_pre_db', $forum_id);
if (!$bb_db_override) {
if ($topics = get_latest_topics($forum_id, $page)) {
bb_cache_last_posts($topics);
}
if ($stickies = get_sticky_topics($forum_id, $page)) {
bb_cache_last_posts($stickies);
}
}
bb_load_template('forum.php', array('bb_db_override', 'stickies'), $forum_id);
示例10: bb_new_user
if (!$bad_input) {
$user_id = bb_new_user($user_login, $_POST['user_email'], $_POST['user_url']);
if (is_wp_error($user_id)) {
// error
foreach ($user_id->get_error_codes() as $code) {
$bb_register_error->add($code, $user_id->get_error_message($code));
}
if ($bb_register_error->get_error_message('user_login')) {
$user_safe = false;
}
} elseif ($user_id) {
// success
foreach ($profile_info_keys as $key => $label) {
if (strpos($key, 'user_') !== 0 && ${$key} !== '') {
bb_update_usermeta($user_id, $key, ${$key});
}
}
do_action('register_user', $user_id);
bb_load_template('register-success.php', $_globals);
exit;
}
// else failure
}
}
if (isset($_GET['user'])) {
$user_login = sanitize_user($_GET['user'], true);
} elseif (isset($_POST['user_login']) && !is_string($user_login)) {
$user_login = '';
}
bb_load_template('register.php', $_globals);
示例11: __
}
// Check for errors on post method
if ('post' == strtolower($_SERVER['REQUEST_METHOD'])) {
// If the user doesn't exist then add that error
if (empty($user_exists)) {
if (!empty($_POST['log'])) {
$bb_login_error->add('user_login', __('User does not exist.'));
} else {
$bb_login_error->add('user_login', $email_login ? __('Enter a username or email address.') : __('Enter a username.'));
}
}
// If the password was wrong then add that error
if (!$bb_login_error->get_error_code()) {
$bb_login_error->add('password', __('Incorrect password.'));
}
}
/**
* If trying to log in with email address, don't leak whether or not email
* address exists in the db. is_email() is not perfect. Usernames can be
* valid email addresses potentially.
*/
if (!empty($email_login) && $bb_login_error->get_error_codes() && false !== is_email(@$_POST['log'])) {
$bb_login_error = new WP_Error('user_login', __('Username and Password do not match.'));
}
/** Prepare for display *******************************************************/
// Sanitze variables for display
$remember_checked = @$_POST['rememberme'] ? ' checked="checked"' : '';
$user_login = esc_attr(sanitize_user(@$_POST['log'], true));
// Load the template
bb_load_template('login.php', array('user_exists', 'user_login', 'remember_checked', 'redirect_to', 're', 'bb_login_error'));
exit;
示例12: bb_repermalink
<?php
require_once './bb-load.php';
bb_repermalink();
$view = bb_slug_sanitize($view);
$sticky_count = $topic_count = 0;
$stickies = $topics = $view_count = false;
if (isset($bb_views[$view])) {
if ($bb_views[$view]['sticky']) {
$sticky_query = bb_view_query($view, array('sticky' => '-no'));
// -no = yes
$stickies = $sticky_query->results;
$sticky_count = $sticky_query->found_rows;
}
$topic_query = bb_view_query($view, array('count' => true));
$topics = $topic_query->results;
$topic_count = $topic_query->found_rows;
$view_count = max($sticky_count, $topic_count);
}
do_action('bb_custom_view', $view, $page);
bb_load_template('view.php', array('view_count', 'stickies'), $view);
示例13: trim
<?php
require_once './bb-load.php';
if (!($q = trim(@$_GET['search']))) {
$q = trim(@$_GET['q']);
}
$bb_query_form = new BB_Query_Form();
if ($q = stripslashes($q)) {
add_filter('bb_recent_search_fields', create_function('$f', 'return $f . ", MAX(post_time) AS post_time";'));
add_filter('bb_recent_search_group_by', create_function('', 'return "t.topic_id";'));
$bb_query_form->BB_Query_Form('post', array(), array('per_page' => 5, 'post_status' => 0, 'topic_status' => 0, 'post_text' => $q, 'forum_id', 'tag', 'topic_author', 'post_author'), 'bb_recent_search');
$recent = $bb_query_form->results;
$bb_query_form->BB_Query_Form('topic', array('search' => $q), array('post_status' => 0, 'topic_status' => 0, 'search', 'forum_id', 'tag', 'topic_author', 'post_author'), 'bb_relevant_search');
$relevant = $bb_query_form->results;
$q = $bb_query_form->get('search');
}
do_action('do_search', $q);
// Cache topics
// NOT bbdb::prepared
if ($recent) {
$topic_ids = array();
foreach ($recent as $bb_post) {
$topic_ids[] = (int) $bb_post->topic_id;
}
$topic_ids = join($topic_ids);
if ($topics = $bbdb->get_results("SELECT * FROM {$bbdb->topics} WHERE topic_id IN ({$topic_ids})")) {
$topics = bb_append_meta($topics, 'topic');
}
}
bb_load_template('search.php', array('q', 'recent', 'relevant'), $q);
示例14: bb_repermalink
bb_repermalink();
if (!$topic) {
bb_die(__('Topic not found.'));
}
if ($view_deleted) {
add_filter('get_thread_where', create_function('', 'return "p.topic_id = ' . $topic_id . '";'));
add_filter('get_thread_post_ids', create_function('', 'return "p.topic_id = ' . $topic_id . '";'));
add_filter('post_edit_uri', 'bb_make_link_view_all');
}
$bb_db_override = false;
do_action('bb_topic.php_pre_db', $topic_id);
if (!$bb_db_override) {
$posts = get_thread($topic_id, $page);
$forum = bb_get_forum($topic->forum_id);
$tags = bb_get_topic_tags($topic_id);
if ($tags && ($bb_current_id = bb_get_current_user_info('id'))) {
$user_tags = bb_get_user_tags($topic_id, $bb_current_id);
$other_tags = bb_get_other_tags($topic_id, $bb_current_id);
$public_tags = bb_get_public_tags($topic_id);
} elseif (is_array($tags)) {
$user_tags = false;
$other_tags = bb_get_public_tags($topic_id);
$public_tags =& $other_tags;
} else {
$user_tags = $other_tags = $public_tags = false;
}
$list_start = ($page - 1) * bb_get_option('page_topics') + 1;
bb_post_author_cache($posts);
}
bb_load_template('topic.php', array('bb_db_override', 'user_tags', 'other_tags', 'list_start'), $topic_id);
示例15: bb_repermalink
<?php
require_once './bb-load.php';
bb_repermalink();
// Temporary, refactor this!
if (!$tag && $tag_name) {
bb_die(__('Tag not found'));
}
if ($tag_name && $tag) {
if ($topics = get_tagged_topics($tag->tag_id, $page)) {
bb_cache_last_posts($topics);
}
bb_load_template('tag-single.php', array('tag', 'tag_name', 'topics'), $tag->tag_id);
} else {
bb_load_template('tags.php');
}