?> </a></p> <?php topic_pages(array('before' => '<div class="nav">', 'after' => '</div>')); } if (topic_is_open($bb_post->topic_id)) { post_form(); } else { ?> <h2><?php _e('Question Closed'); ?> </h2> <p><?php _e('This topic has been closed to new replies.'); ?> </p> <?php } if (bb_current_user_can('delete_topic', get_topic_id()) || bb_current_user_can('close_topic', get_topic_id()) || bb_current_user_can('stick_topic', get_topic_id()) || bb_current_user_can('move_topic', get_topic_id())) { ?> <div class="admin"> <?php bb_topic_admin(); ?> </div> <?php } bb_get_footer();
function topic_is_sticky($topic_id = 0) { $topic = get_topic(get_topic_id($topic_id)); return '0' !== $topic->topic_sticky; }
/** * bb_get_topic_tags() - Returns all of the bb_topic_tags associated with the specified topic. * * @param int $topic_id * @param mixed $args * @return array|false Term objects (back-compat), false on failure */ function bb_get_topic_tags($topic_id = 0, $args = null) { global $wp_taxonomy_object; if (!($topic = get_topic(get_topic_id($topic_id)))) { return false; } $topic_id = (int) $topic->topic_id; $cache_id = $topic_id . serialize($args); $terms = wp_cache_get($cache_id, 'bb_topic_tag_terms'); if (false === $terms) { $terms = $wp_taxonomy_object->get_object_terms((int) $topic->topic_id, 'bb_topic_tag', $args); wp_cache_set($cache_id, $terms, 'bb_topic_tag_terms'); } if (is_wp_error($terms)) { return false; } for ($i = 0; isset($terms[$i]); $i++) { _bb_make_tag_compat($terms[$i]); } return $terms; }
function socialit_insert_in_post($post_content) { global $socialit_plugopts, $bbdb; // decide whether or not to generate the bookmarks. $istopic = bb_is_topic(); if ($istopic && $socialit_plugopts['topic'] == 1 || bb_is_feed() && $socialit_plugopts['feed'] == 1 && bb_get_topicmeta(get_topic_id(), 'hide_socialit') != "true") { //socials should be generated and added $post_id_fc = get_post_id(); //post id for check if (bb_is_first($post_id_fc)) { $post_content .= get_socialit(); } } return $post_content; }
function bb_get_tag_remove_link($args = null) { if (is_scalar($args) || is_object($args)) { $args = array('tag' => $args); } $defaults = array('tag' => 0, 'topic' => 0, 'list_id' => 'tags-list'); $args = wp_parse_args($args, $defaults); extract($args, EXTR_SKIP); if (is_object($tag) && isset($tag->tag_id)) { } elseif (!($tag = bb_get_tag(bb_get_tag_id($tag)))) { return false; } if (!($topic = get_topic(get_topic_id($topic)))) { return false; } if (!bb_current_user_can('edit_tag_by_on', $tag->user_id, $topic->topic_id)) { return false; } $url = bb_get_uri('tag-remove.php', array('tag' => $tag->tag_id, 'user' => $tag->user_id, 'topic' => $topic->topic_id)); $url = esc_url(bb_nonce_url($url, 'remove-tag_' . $tag->tag_id . '|' . $topic->topic_id)); $title = esc_attr__('Remove this tag'); $list_id = esc_attr($list_id); return "[<a href='{$url}' class='delete:{$list_id}:tag-{$tag->tag_id}_{$tag->user_id}' title='{$title}'>×</a>]"; }
/** * Load localized script just in time for MCE. * * These localizations require information that may not be loaded even by init. */ function bb_just_in_time_script_localization() { wp_localize_script('topic', 'bbTopicJS', array('currentUserId' => bb_get_current_user_info('id'), 'topicId' => get_topic_id(), 'favoritesLink' => get_favorites_link(), 'isFav' => (int) is_user_favorite(bb_get_current_user_info('id')), 'confirmPostDelete' => __("Are you sure you want to delete this post?"), 'confirmPostUnDelete' => __("Are you sure you want to undelete this post?"), 'favLinkYes' => __('favorites'), 'favLinkNo' => __('?'), 'favYes' => __('This topic is one of your %favLinkYes% [%favDel%]'), 'favNo' => __('%favAdd% (%favLinkNo%)'), 'favDel' => __('×'), 'favAdd' => __('Add this topic to your favorites'))); }
// // End session management // // check if user is a moderator or an admin if ($userdata['user_level'] != MOD && $userdata['user_level'] != ADMIN) { message_die(GENERAL_MESSAGE, $lang['Not_Authorised']); } // from topic $from_topic = isset($HTTP_POST_VARS['from_topic']) ? strtolower(trim(htmlspecialchars($HTTP_POST_VARS['from_topic']))) : ''; if (empty($from_topic) && (isset($HTTP_GET_VARS[POST_TOPIC_URL]) || isset($HTTP_GET_VARS[POST_POST_URL]))) { $from_topic = isset($HTTP_GET_VARS[POST_TOPIC_URL]) ? intval($HTTP_GET_VARS[POST_TOPIC_URL]) : POST_POST_URL . '=' . intval($HTTP_GET_VARS[POST_POST_URL]); } $from_topic_id = get_topic_id($from_topic); // to topic $to_topic = isset($HTTP_POST_VARS['to_topic']) ? strtolower(trim(htmlspecialchars($HTTP_POST_VARS['to_topic']))) : ''; $to_topic_id = get_topic_id($to_topic); // topic title $topic_title = ''; if (isset($HTTP_POST_VARS['topic_title'])) { $topic_title = htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['topic_title']))); } // start if (isset($HTTP_POST_VARS['start'])) { $start = intval($start); } // buttons $submit = isset($HTTP_POST_VARS['submit']); $confirm = isset($HTTP_POST_VARS['confirm']); $cancel = isset($HTTP_POST_VARS['cancel']); $shadow = isset($HTTP_POST_VARS['shadow']); if ($cancel) {
/** * Outputs the subscribe/unsubscibe link. * * Checks if user is subscribed and outputs link based on status. * * @since 1.1 */ function bb_user_subscribe_link() { $topic_id = get_topic_id(); if (!bb_is_user_logged_in()) { return false; } if (bb_is_user_subscribed()) { echo '<li id="subscription-toggle"><a href="' . bb_nonce_url(bb_get_uri(null, array('doit' => 'bb-subscribe', 'topic_id' => $topic_id, 'and' => 'remove')), 'toggle-subscribe_' . $topic_id) . '">' . apply_filters('bb_user_subscribe_link_unsubscribe', __('Unsubscribe from Topic')) . '</a></li>'; } else { echo '<li id="subscription-toggle"><a href="' . bb_nonce_url(bb_get_uri(null, array('doit' => 'bb-subscribe', 'topic_id' => $topic_id, 'and' => 'add')), 'toggle-subscribe_' . $topic_id) . '">' . apply_filters('bb_user_subscribe_link_subscribe', __('Subscribe to Topic')) . '</a></li>'; } }
function topic_move_dropdown($id = 0) { $topic = get_topic(get_topic_id($id)); if (!bb_current_user_can('move_topic', $topic->topic_id)) { return; } $dropdown = bb_get_forum_dropdown(array('callback' => 'bb_current_user_can', 'callback_args' => array('move_topic', $topic->topic_id), 'selected' => $topic->forum_id)); if (!$dropdown) { return; } echo '<form id="topic-move" method="post" action="' . bb_get_uri('bb-admin/topic-move.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN) . '">' . "\n\t"; echo "<input type='hidden' name='topic_id' value='{$topic->topic_id}' />\n\t"; echo $dropdown; bb_nonce_field('move-topic_' . $topic->topic_id); echo "<input class='button-secondary' type='submit' name='Submit' value='" . __('Move') . "' />\n</form>"; }