function mod_notification_profile()
{
    global $user_id, $mods;
    if (bb_is_user_logged_in() && is_moderator($user_id)) {
        $checked = "";
        $no_check = ' checked="checked"';
        if (mod_notification_is_activated($user_id)) {
            $checked = ' checked="checked"';
            $no_check = "";
        }
        echo '
			<fieldset>
				<legend>All Posts Notification</legend>
				<p>Select to receive an email when a new post is added by a member to any topic.</p>
				<table width="100%">
					<tr>
						<th width="21%" scope="row">Activate:</th>
						<td width="79%">
							Yes <input name="mod_notification" id="mod_notification" type="radio" value="1"' . $checked . ' />
							No <input name="mod_notification" id="mod_notification_no" type="radio" value="0"' . $no_check . ' />
						</td>
					</tr>
				</table>
			</fieldset>';
    }
}
Esempio n. 2
0
function thanks_output()
{
    global $bb_post, $DEFAULTS;
    $logged_in = bb_is_user_logged_in();
    $post_id = $bb_post->post_id;
    $user = bb_get_current_user();
    $uid = $logged_in ? (int) $user->ID : false;
    echo "<div class=\"thanks-output\" id=\"thanks-" . $post_id . "\">";
    echo thanks_output_details($post_id, $uid, $logged_in);
    echo "</div>";
}
Esempio n. 3
0
/**
 * Add reply link below each post
 *
 * @param $post_links Array of the links
 * @param $args Array of args
 */
function em_reply_link($post_links = array(), $args = array())
{
    global $em_plugopts;
    if ($em_plugopts['reply-link'] == 1 && $em_plugopts['reply-text'] && bb_is_topic() && topic_is_open() && (bb_is_user_logged_in() || function_exists('bb_is_login_required') && !bb_is_login_required())) {
        /* Check if link is needed */
        $text = str_replace("%%POSTLINK%%", get_post_link(), str_replace("%%USERNAME%%", get_post_author(), $em_plugopts['reply-text']));
        $js = "var ema=document.getElementById('post_content');var emb=ema.value;if(emb!='')emb+='\\n\\n';ema.value=emb+'" . $text . "\\n\\n';ema.focus();void(0);";
        $post_links[] = $args['before_each'] . '<a class="reply_link" style="cursor:pointer" onclick="' . $js . '">' . __('Reply', 'easy-mentions') . '</a>' . $args['after_each'];
    }
    return $post_links;
}
Esempio n. 4
0
function bb_quote_link($link_text = 'Quote')
{
    global $bb, $page, $topic, $forum, $bb_post;
    $add = topic_pages_add();
    if (!topic_is_open($bb_post->topic_id) || !bb_is_user_logged_in()) {
        return;
    }
    $post_id = get_post_id();
    $last_page = get_page_number($topic->topic_posts + $add);
    echo '<a href="' . get_topic_link(0, $last_page) . '&quote=' . $post_id . '#postform" id="quote_' . $post_id . '">' . __($link_text) . '</a>';
}
Esempio n. 5
0
function notification_profile()
{
    global $user_id, $bb_current_user;
    if (bb_is_user_logged_in()) {
        $checked = "";
        $no_check = "checked='checked'";
        if (notification_is_activated($user_id)) {
            $checked = "checked='checked'";
            $no_check = "";
        }
        echo "<fieldset>\n<legend>Favorite Notification</legend>\n<p> " . __('Select to receive an email when a new post is added to a topic in your favorites list.') . "</p>\n<table>\n<tr>\n<th scope=\"row\">" . __('Activate') . "</th>\n<td>\nYes <input name=\"favorite_notification\" id=\"favorite_notification\" type=\"radio\" value=\"1\"" . $checked . " />\nNo <input name=\"favorite_notification\" id=\"favorite_notification_no\" type=\"radio\" value=\"0\"" . $no_check . " /></td>\n</tr>\n</table>\n</fieldset>\n\n";
    }
}
Esempio n. 6
0
function add_twitter_to_profile_edit()
{
    global $user_id, $bb_current_user, $bb_twitter;
    if (bb_current_user_can('edit_profile', $user->ID) && bb_is_user_logged_in()) {
        $twitter = fetch_user_twitter($user_id);
        $user = bb_get_user($user_id);
        $tweets_on = $user->twitter_on;
        $tweets_on_post = $user->twitter_on_post;
        ?>
<fieldset>
<legend><?php 
        _e('Twitter');
        ?>
</legend>
<table border=0>
<tr>
<th>Twitter username : </th><td><input type="text" name="twitter" value="<?php 
        echo $twitter;
        ?>
 " size="25"/></td>
</tr>
<?php 
        if (false) {
            ?>
	<tr>
	<td>Show your latest <em>tweet</em> in your profile?</td><td>
	<input name="show_tweets" value="tweets_on" type="checkbox" checked="checked"/></td>
	<input name="show_tweets" value="tweets_on" type="checkbox"/></td>
	</tr>
	<tr>
	<td>Show your latest <em>tweet</em> under each post?</td><td>
	<input name="show_tweets_post" value="tweets_on_post" type="checkbox" checked="checked"/></td>
	<input name="show_tweets_post" value="tweets_on_post" type="checkbox"/></td>
<?php 
        }
        ?>
</tr>
</table>
</fieldset>
<?php 
    }
}
Esempio n. 7
0
function auto_add_favorit_profile()
{
    global $user_id;
    if (bb_is_user_logged_in()) {
        $checked = "";
        $user = bb_get_user($user_id);
        if (!empty($user->auto_add_favorit)) {
            $checked = ' checked="checked"';
        }
        echo '
			<fieldset>
				<legend>Add my threads automatically to my favorites</legend>
				<p>Check this option to add all your threads or threads where you have posted something to your favorite list.</p>
				<table width="100%">
					<tr>
						<th width="21%" scope="row">Activate:</th>
						<td width="79%">
							<input name="edit_auto_add_favorit" id="edit_auto_add_favorit" type="checkbox" value="1"' . $checked . ' />
						</td>
					</tr>
				</table>
			</fieldset>';
    }
}
Esempio n. 8
0
<ul class="topicmeta">
	<li><?php 
printf(__('Asked %1$s ago by %2$s'), get_topic_start_time(), get_topic_author());
?>
</li>
<?php 
if (1 < get_topic_posts()) {
    ?>
	<li><?php 
    printf(__('<a href="%1$s">Latest answer</a> from %2$s'), esc_attr(get_topic_last_post_link()), get_topic_last_poster());
    ?>
</li>
<?php 
}
if (bb_is_user_logged_in()) {
    ?>
	<li<?php 
    echo $class;
    ?>
 id="favorite-toggle"><?php 
    user_favorites_link();
    ?>
</li>
<?php 
}
do_action('topicmeta');
?>
</ul>
</div>
 function bb_is_user_authorized()
 {
     return bb_is_user_logged_in();
 }
Esempio n. 10
0
function bb_send_headers()
{
    if (bb_is_user_logged_in()) {
        nocache_headers();
    }
    @header('Content-Type: ' . bb_get_option('html_type') . '; charset=' . bb_get_option('charset'));
    do_action('bb_send_headers');
}
function bb_template_scripts()
{
    if (bb_is_topic() && bb_is_user_logged_in()) {
        wp_enqueue_script('topic');
    } elseif (bb_is_profile() && bb_is_user_logged_in()) {
        global $self;
        if ($self == 'profile-edit.php') {
            wp_enqueue_script('profile-edit');
        }
    }
}
Esempio n. 12
0
function nospamuser_maybe_set_user_ip_field()
{
    if (bb_is_user_logged_in() && !bb_get_usermeta(bb_get_current_user_info('ID'), 'nospamuser_ip')) {
        nospamuser_set_user_ip_field(bb_get_current_user_info('ID'));
    }
}
Esempio n. 13
0
/**
 * Get details of the current user
 */
bb_current_user();
/**
 * Initialise CRON
 */
if (!function_exists('nxt_schedule_single_event')) {
    require_once BACKPRESS_PATH . 'functions.nxt-cron.php';
}
if (!defined('DOING_CRON') || !DOING_CRON) {
    nxt_cron();
}
/**
 * The currently viewed page number
 */
$page = bb_get_uri_page();
/**
 * Initialisation complete API hook
 */
do_action('bb_init');
/**
 * Block user if they deserve it
 */
if (bb_is_user_logged_in() && bb_has_broken_pass()) {
    bb_block_current_user();
}
/**
 * Send HTTP headers
 */
bb_send_headers();
Esempio n. 14
0
    ?>
<p id="post-form-forum-container">
	<label for="forum-id"><?php 
    _e('Forum');
    ?>
		<?php 
    bb_new_topic_forum_dropdown('tab=37');
    ?>
	</label>
</p>
<?php 
}
?>

<?php 
if (bb_is_user_logged_in() && bb_is_subscriptions_active()) {
    ?>
<p id="post-form-subscription-container" class="left">
	<?php 
    bb_user_subscribe_checkbox('tab=38');
    ?>
</p>
<?php 
}
?>

<p id="post-form-submit-container" class="submit">
	<input type="submit" id="postformsub" name="Submit" value="<?php 
esc_attr_e('Send Post &raquo;');
?>
" tabindex="39" />
Esempio n. 15
0
function oid_register()
{
    global $bbdb, $user_id, $openid_options;
    if (!bb_get_location() == "register-page") {
        return;
    }
    if (bb_is_user_logged_in()) {
        return;
    }
    /*
    echo "<p>Session:<br />";
    print_r($_SESSION);
    echo "</p>";
    */
    echo '<fieldset><legend>' . $openid_options['profile_text'] . '</legend>';
    if (!empty($_SESSION['OPENID']) && 0) {
        openid_session();
        $url = $_SESSION['OPENID'];
        $instructions = $openid_options['approved_text'];
        echo '<p>' . $instructions . '</p><table><tr class="form-field"><th scope="row" style="padding-left:20px;background: url(' . $openid_options['icon'] . ') no-repeat  50% 50%;">
		<label>[<a title="' . $openid_options['remove_text'] . '" href="' . add_query_arg('remove_openid', urlencode($url)) . '"><strong>x</strong></a>]</label></th><td> ' . $url . ' </td></tr>';
    } else {
        $value = "";
        $instructions = $openid_options['register_text'];
        if (isset($_GET['openid_error'])) {
            echo "<div  style='color:#000;width:75%;overflow:hidden;padding:3px 10px;background:#FFF6BF;border:1px solid #FFD324;'>" . substr(addslashes(strip_tags($_GET['openid_error'], "<br>")), 0, 200) . "</div>";
        }
        echo '<p>' . $instructions . '</p><table><tr class="form-field"><th scope="row"><label for="openid_url">OpenID</label></th>';
        echo '<td><input value="' . $value . '"  name="openid_identity" id="openid_identity"  style="padding-left:20px;  background: #fff url(' . $openid_options['icon'] . ') no-repeat center left;" type="text" />';
        if ($session_id = session_id()) {
            $session_name = session_name();
            echo '<input tabindex="0" type="hidden" name = "' . $session_name . '" value = "' . $session_id . '" />';
        }
        echo '</td></tr>';
    }
    // session else
    echo '</table></fieldset>';
}
Esempio n. 16
0
/**
 * Process subscription checkbox submission.
 *
 * Get ID of and new subscription status and pass values to
 * bb_user_subscribe_checkbox_update function
 *
 * @since 1.1
 *
 * @param int $post_id ID of new/edited post
 */
function bb_user_subscribe_checkbox_update($post_id)
{
    if (!bb_is_user_logged_in()) {
        return false;
    }
    $post = bb_get_post($post_id);
    $topic_id = (int) $post->topic_id;
    $subscribed = bb_is_user_subscribed(array('topic_id' => $topic_id, 'user_id' => $post->poster_id)) ? true : false;
    $check = $_REQUEST['subscription_checkbox'];
    do_action('bb_user_subscribe_checkbox_update', $post_id, $topic_id, $subscribe, $check);
    if ('subscribe' == $check && !$subscribed) {
        bb_subscription_management($topic_id, 'add');
    } elseif (!$check && $subscribed) {
        bb_subscription_management($topic_id, 'remove');
    }
}
/**
 * Custom insert post function so that we could do what we need
 *
 * All counting functions have been removed from here, recount should be done
 * after running this script.
 *
 * @param mixed $args
 * @return int|bool New post ID if post was created, otherwise false
 */
function w2bc_insert_post($args = null)
{
    global $bbdb, $bb_current_user, $bb;
    if (!($args = wp_parse_args($args))) {
        return false;
    }
    $fields = array_keys($args);
    $defaults = array('topic_id' => 0, 'post_text' => '', 'post_time' => bb_current_time('mysql'), 'poster_id' => bb_get_current_user_info('id'), 'poster_ip' => $_SERVER['REMOTE_ADDR'], 'post_status' => 0, 'post_position' => false);
    // Insert all args
    $fields = array_keys($defaults);
    $fields[] = 'forum_id';
    extract(wp_parse_args($args, $defaults));
    if (!($topic = get_topic($topic_id))) {
        return false;
    }
    $topic_id = (int) $topic->topic_id;
    $forum_id = (int) $topic->forum_id;
    if (false === $post_position) {
        $post_position = $topic_posts = intval(0 == $post_status ? $topic->topic_posts + 1 : $topic->topic_posts);
    }
    $bbdb->insert($bbdb->posts, compact($fields));
    $post_id = $topic_last_post_id = (int) $bbdb->insert_id;
    // if anonymous posting, save user data as meta data
    if (!$user) {
        if ($post_author) {
            bb_update_meta($post_id, 'post_author', $post_author, 'post');
        }
        // Atleast this should be there
        if ($post_email) {
            bb_update_meta($post_id, 'post_email', $post_email, 'post');
        }
        if ($post_url) {
            bb_update_meta($post_id, 'post_url', $post_url, 'post');
        }
    }
    $topic_time = $post_time;
    $topic_last_poster = !bb_is_user_logged_in() && !bb_is_login_required() ? -1 : $poster_id;
    $topic_last_poster_name = !bb_is_user_logged_in() && !bb_is_login_required() ? $post_author : $user->user_login;
    $bbdb->update($bbdb->topics, compact('topic_time', 'topic_last_poster', 'topic_last_poster_name', 'topic_last_post_id', 'topic_posts'), compact('topic_id'));
    wp_cache_delete($topic_id, 'bb_topic');
    wp_cache_delete($topic_id, 'bb_thread');
    wp_cache_delete($forum_id, 'bb_forum');
    wp_cache_flush('bb_forums');
    wp_cache_flush('bb_query');
    wp_cache_flush('bb_cache_posts_post_ids');
    if (bb_get_option('enable_pingback')) {
        bb_update_postmeta($post_id, 'pingback_queued', '');
        wp_schedule_single_event(time(), 'do_pingbacks');
    }
    return $post_id;
}
Esempio n. 18
0
function li_post_hide_post_login()
{
    if (!bb_is_user_logged_in()) {
        echo "</div>\n";
    }
}
Esempio n. 19
0
?>
>
<head profile="http://gmpg.org/xfn/11">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title><?php 
bb_title();
?>
</title>
	
	<?php 
bb_feed_head();
?>
 
	
<?php 
if (is_topic() && bb_is_user_logged_in()) {
    ?>
	<script type="text/javascript">
		var lastMod = <?php 
    topic_time('timestamp');
    ?>
;
		var page = <?php 
    global $page;
    echo $page;
    ?>
;
		var currentUserId = <?php 
    bb_current_user_info('id');
    ?>
;