Пример #1
0
function getInfoHtml($uid)
{
    $avatar_width = 100;
    $avatar_height = 100;
    $avatar_class = "avatar";
    $config = new avatarupload_config();
    $avatar_img = "";
    if ($a = avatarupload_get_avatar($uid, 1, 1)) {
        $avatar_img = '<img src="' . $a[0] . '" width="' . $avatar_width . '" height="' . $avatar_height . '" alt="' . $a[4] . '" class="' . $class . '" />';
    }
    $user_name = get_user_name($uid);
    $profile_link = get_user_profile_link($uid);
    $html = $avatar_img . '<div class="nombre_usuario"><b><a href="' . $profile_link . '">' . $user_name . '</a></b></div>';
    return $html;
}
Пример #2
0
/**
 * Links the users & tags in posts
 *
 * @see bp_activity_at_name_filter() BuddyPress Function
 * 
 * @param $content The content to be parsed
 */
function em_do_linking($content)
{
    global $em_plugopts;
    if ($em_plugopts['link-tags'] == 1) {
        preg_match_all('/[#]+([A-Za-z0-9-_]+)/', $content, $tags);
        $tags = $tags[1];
        foreach ((array) $tags as $tag) {
            if (!($t = bb_get_tag($tag))) {
                continue;
            }
            if ($link = bb_get_tag_link($t)) {
                $content = str_replace("#{$tag}", "#<a href='" . $link . "'>{$tag}</a>", $content);
            }
            //should we add rel='nofollow'?
        }
    }
    if ($em_plugopts['link-users'] == 1) {
        preg_match_all('/[@]+([A-Za-z0-9-_]+)/', $content, $usernames);
        $usernames = $usernames[1];
        foreach ((array) $usernames as $username) {
            if (!($user = bb_get_user($username, array('by' => 'login')))) {
                //check #1, by username
                if (!($user = bb_get_user($username, array('by' => 'nicename')))) {
                    //check #2, by nicename
                    continue;
                }
            }
            /* Increase the number of new @ mentions for the user - maybe later */
            /*$new_mention_count = (int)bb_get_usermeta( $user_id, 'em_mention_count' );
            		bb_update_usermeta( $user_id, 'em_mention_count', $new_mention_count + 1 );*/
            if ('website' == $em_plugopts['link-user-to']) {
                if (!($link = $user->user_url)) {
                    $link = get_user_profile_link($user->ID);
                }
            } else {
                $link = get_user_profile_link($user->ID);
            }
            if ($link) {
                $content = str_replace("@{$username}", "@<a href='" . $link . "'>{$username}</a>", $content);
            }
            //should we add rel='nofollow'?
        }
    }
    return $content;
}
Пример #3
0
function nm_rewrite_user_group_name($post_id = 0)
{
    $title = get_post_author_title($post_id);
    if (false === $title) {
        $r = __('Unregistered');
    } else {
        $r = '<a href="' . attribute_escape(get_user_profile_link(get_post_author_id($post_id))) . '">' . $title . '</a>';
    }
    $ug_name = apply_filters('post_author_title', $r);
    if ($ug_name == "Member") {
        $ug_name = bloginfo() . " Member";
    } elseif ($ug_name == "Key Master") {
        $ug_name = bloginfo() . " Administrator";
    } elseif ($ug_name == "Moderator") {
        $ug_name = bloginfo() . " Moderator";
    } elseif ($ug_name == "Administrator") {
        $ug_name = bloginfo() . "  Administrator";
    } else {
        $ug_name = bloginfo() . " Member";
    }
    return $ug_name;
}
Пример #4
0
function thanks_output_details($post_id, $uid, $logged_in = true)
{
    $out = "";
    $meta = bb_get_post_meta("thanks", $post_id);
    $report_length = 0;
    if (isset($meta)) {
        $vote_count = count($meta);
        $msg_type = $vote_count == 0 ? "none" : ($vote_count == 1 ? "one" : "many");
        $msg = thanks_get_voting_phrase("thanks_output_" . $msg_type);
        $report_length = strlen($msg);
        $out .= str_replace("#", "" . $vote_count, $msg);
        $should_show_voters = thanks_get_voting_phrase("thanks_voters");
        if ($should_show_voters == "yes") {
            $out .= ' ' . thanks_get_voting_phrase("thanks_voters_prefix");
            for ($i = 0; $i < count($meta); $i++) {
                $link = get_user_profile_link($meta[$i]);
                $voter = bb_get_user($meta[$i]);
                if ($i > 0) {
                    $out .= ", ";
                }
                $out .= '<a href="' . $link . '">' . $voter->display_name . '</a>';
            }
            $out .= thanks_get_voting_phrase("thanks_voters_suffix");
        }
    }
    if ($logged_in) {
        if (!in_array($uid, $meta)) {
            if (isset($meta) && $report_length > 0) {
                $out .= "&nbsp;&nbsp;|&nbsp;&nbsp;";
            }
            $msg = thanks_get_voting_phrase("thanks_voting");
            $out .= "<a class=\"thanks-vote\" user=\"" . $uid . "\" id=\"" . $post_id . "\">" . $msg . "</a>";
        }
    }
    return $out;
}
Пример #5
0
function bb_ksd_submit($submit, $type = false)
{
    global $bb_ksd_api_host;
    global $bb_ksd_api_port;
    switch ($type) {
        case 'ham':
        case 'spam':
            $path = '/1.1/submit-' . $type;
            $bb_post = bb_get_post($submit);
            if (!$bb_post) {
                return;
            }
            $user = bb_get_user($bb_post->poster_id);
            if (bb_is_trusted_user($user->ID)) {
                return;
            }
            $_submit = array('blog' => bb_get_uri(null, null, BB_URI_CONTEXT_TEXT + BB_URI_CONTEXT_AKISMET), 'user_ip' => $bb_post->poster_ip, 'permalink' => get_topic_link($bb_post->topic_id), 'comment_type' => 'forum', 'comment_author' => get_user_name($user->ID), 'comment_author_email' => bb_get_user_email($user->ID), 'comment_author_url' => get_user_link($user->ID), 'comment_content' => $bb_post->post_text, 'comment_date_gmt' => $bb_post->post_time);
            break;
        case 'hammer':
        case 'spammer':
            $path = '/1.1/submit-' . substr($type, 0, -3);
            $user = bb_get_user($submit);
            if (!$user) {
                return;
            }
            if (bb_is_trusted_user($user->ID)) {
                return;
            }
            $_submit = array('blog' => bb_get_uri(null, null, BB_URI_CONTEXT_TEXT + BB_URI_CONTEXT_AKISMET), 'permalink' => get_user_profile_link($user->ID), 'comment_type' => 'profile', 'comment_author' => get_user_name($user->ID), 'comment_author_email' => bb_get_user_email($user->ID), 'comment_author_url' => get_user_link($user->ID), 'comment_content' => $user->occ . ' ' . $user->interests, 'comment_date_gmt' => $user->user_registered);
            break;
        default:
            if (bb_is_trusted_user(bb_get_current_user())) {
                return;
            }
            $path = '/1.1/comment-check';
            $_submit = array('blog' => bb_get_uri(null, null, BB_URI_CONTEXT_TEXT + BB_URI_CONTEXT_AKISMET), 'user_ip' => preg_replace('/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR']), 'user_agent' => $_SERVER['HTTP_USER_AGENT'], 'referrer' => $_SERVER['HTTP_REFERER'], 'comment_type' => isset($_POST['topic_id']) ? 'forum' : 'profile', 'comment_author' => bb_get_current_user_info('name'), 'comment_author_email' => bb_get_current_user_info('email'), 'comment_author_url' => bb_get_current_user_info('url'), 'comment_content' => $submit);
            if (isset($_POST['topic_id'])) {
                $_submit['permalink'] = get_topic_link($_POST['topic_id']);
                // First page
            }
            break;
    }
    $query_string = '';
    foreach ($_submit as $key => $data) {
        $query_string .= $key . '=' . urlencode(stripslashes($data)) . '&';
    }
    return bb_ksd_http_post($query_string, $bb_ksd_api_host, $path, $bb_ksd_api_port);
}
function bb_get_profile_link($args = '')
{
    if ($args && is_string($args) && false === strpos($args, '=')) {
        $args = array('text' => $args);
    } elseif (is_numeric($args)) {
        $args = array('id' => $args);
    }
    $defaults = array('text' => __('View your profile'), 'before' => '', 'after' => '', 'id' => false);
    $args = wp_parse_args($args, $defaults);
    extract($args, EXTR_SKIP);
    $id = (int) $id;
    if (!$id) {
        $id = bb_get_current_user_info('id');
    }
    return apply_filters('bb_get_profile_link', "{$before}<a href='" . esc_attr(get_user_profile_link($id)) . "'>{$text}</a>{$after}", $args);
}
Пример #7
0
            if ($bb_post->poster_id) {
                printf(__('<a href="%1$s">Post</a> on <a href="%2$s">%3$s</a> by <a href="%4$s">%5$s</a>'), esc_attr(add_query_arg('view', 'all', get_post_link())), get_topic_link($bb_post->topic_id), get_topic_title($bb_post->topic_id), get_user_profile_link($bb_post->poster_id), get_post_author());
            } else {
                printf(__('<a href="%1$s">Post</a> on <a href="%2$s">%3$s</a> by %4$s'), esc_attr(add_query_arg('view', 'all', get_post_link())), get_topic_link($bb_post->topic_id), get_topic_title($bb_post->topic_id), get_post_author());
            }
            ?>
			</li>
			<?php 
        } elseif ('topic' == $object['type']) {
            global $topic;
            $topic = $object['data'];
            ?>
			<li>
			<?php 
            if ($topic->topic_poster) {
                printf(__('Topic titled <a href="%1$s">%2$s</a> started by <a href="%3$s">%4$s</a>'), esc_attr(add_query_arg('view', 'all', get_topic_link())), get_topic_title($topic->topic_id), get_user_profile_link($topic->topic_poster), get_topic_author($topic->topic_id));
            } else {
                printf(__('Topic titled <a href="%1$s">%2$s</a> started by %3$s'), esc_attr(add_query_arg('view', 'all', get_topic_link())), get_topic_title($topic->topic_id), get_topic_author($topic->topic_id));
            }
            ?>
			</li>
			<?php 
        }
    }
    remove_filter('get_topic_where', 'bb_no_where');
    ?>
		</ul>
		<?php 
} else {
    ?>
		<p>
Пример #8
0
     }
     $comment_content = $params['default_text'];
 }
 echo $params['form_title_start'];
 echo T_('Leave a comment');
 echo $params['form_title_end'];
 $Form =& new Form($htsrv_url . 'comment_post.php', 'bComment_form_id_' . $Item->ID, 'post');
 $Form->begin_form('bComment', '', array('target' => '_self'));
 // TODO: dh> a plugin hook would be useful here to add something to the top of the Form.
 //           Actually, the best would be, if the $Form object could be changed by a plugin
 //           before display!
 $Form->hidden('comment_post_ID', $Item->ID);
 $Form->hidden('redirect_to', url_rel_to_same_host(regenerate_url('', '', $Blog->get('blogurl'), '&'), $htsrv_url));
 if (is_logged_in()) {
     // User is logged in:
     $Form->info_field(T_('User'), '<strong>' . $current_User->get_preferred_name() . '</strong>' . ' ' . get_user_profile_link(' [', ']', T_('Edit profile')));
 } else {
     // User is not logged in:
     // Note: we use funky field names to defeat the most basic guestbook spam bots
     $Form->text('u', $comment_author, 40, T_('Name'), '', 100, 'bComment');
     $Form->text('i', $comment_author_email, 40, T_('Email'), '<br />' . T_('Your email address will <strong>not</strong> be revealed on this site.'), 100, 'bComment');
     $Form->text('o', $comment_author_url, 40, T_('Website'), '<br />' . T_('Your URL will be displayed.'), 100, 'bComment');
 }
 if ($Item->can_rate()) {
     // Comment rating:
     echo $Form->begin_field(NULL, T_('Your vote'), true);
     $Comment->rating_input();
     echo $Form->end_field();
 }
 if (!empty($params['policy_text'])) {
     // We have a policy text to display
Пример #9
0
 /**
  * Display the widget!
  *
  * @param array MUST contain at least the basic display params
  */
 function display($params)
 {
     if (!is_logged_in()) {
         // Only logged in users can see this tools panel
         return false;
     }
     $this->init_display($params);
     // just in case it hasn't been done before
     $this->disp_params['item_start'] .= '<strong>';
     $this->disp_params['item_end'] = '</strong>' . $this->disp_params['item_end'];
     $tools_links = '';
     if ($this->get_param('user_postnew_link_show')) {
         // Write new post - disp=edit
         $tools_links .= get_item_new_link($this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params['user_postnew_link']);
     }
     if ($this->get_param('user_messaging_link_show')) {
         // Messaging - disp=threads
         $tools_links .= get_user_messaging_link($this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params['user_messaging_link'], $this->disp_params['user_messaging_link'], $this->disp_params['show_badge']);
     }
     if ($this->get_param('user_contacts_link_show')) {
         // Contacts - disp=contacts
         $tools_links .= get_user_contacts_link($this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params['user_contacts_link'], $this->disp_params['user_contacts_link']);
     }
     if ($this->get_param('user_view_link_show')) {
         // See profile - disp=user
         $tools_links .= get_user_tab_link('user', $this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params['user_view_link'], $this->disp_params['user_view_link']);
     }
     if ($this->get_param('user_profile_link_show')) {
         // Edit profile - disp=profile
         $tools_links .= get_user_profile_link($this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params['user_profile_link'], $this->disp_params['user_profile_link']);
     }
     if ($this->get_param('user_picture_link_show')) {
         // Edit picture - disp=avatar
         $tools_links .= get_user_tab_link('avatar', $this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params['user_picture_link'], $this->disp_params['user_picture_link']);
     }
     if ($this->get_param('user_password_link_show')) {
         // Edit password - disp=pwdchange
         $tools_links .= get_user_tab_link('pwdchange', $this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params['user_password_link'], $this->disp_params['user_password_link']);
     }
     if ($this->get_param('user_preferences_link_show')) {
         // Edit preferences - disp=userprefs
         $tools_links .= get_user_tab_link('userprefs', $this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params['user_preferences_link'], $this->disp_params['user_preferences_link']);
     }
     if ($this->get_param('user_subs_link_show')) {
         // Edit notifications - disp=subs
         $tools_links .= get_user_subs_link($this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params['user_subs_link'], $this->disp_params['user_subs_link']);
     }
     if ($this->get_param('user_admin_link_show')) {
         // Admin
         $tools_links .= get_user_admin_link($this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params['user_admin_link']);
     }
     if ($this->get_param('user_logout_link_show')) {
         // Logout
         $tools_links .= get_user_logout_link($this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params['user_logout_link']);
     }
     if (empty($tools_links)) {
         // No available links to display
         return false;
     }
     // User tools:
     echo $this->disp_params['block_start'];
     if (!empty($this->disp_params['title'])) {
         // Display title
         echo $this->disp_params['block_title_start'];
         echo $this->disp_params['title'];
         echo $this->disp_params['block_title_end'];
     }
     echo $this->disp_params['list_start'];
     echo $tools_links;
     if (isset($this->BlockCache)) {
         // Do NOT cache because some of these links are using a redirect_to param, which makes it page dependent.
         // Note: also beware of the source param.
         // so this will be cached by the PageCache; there is no added benefit to cache it in the BlockCache
         // (which could have been shared between several pages):
         $this->BlockCache->abort_collect();
     }
     echo $this->disp_params['list_end'];
     echo $this->disp_params['block_end'];
 }
Пример #10
0
                } elseif ('blocked' != $role && array_key_exists('blocked', $user->capabilities)) {
                    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'));
Пример #11
0
/**
 * Template tag: Display a link to user profile
 */
function user_profile_link($before = '', $after = '', $link_text = '', $link_title = '#')
{
    echo get_user_profile_link($before, $after, $link_text, $link_title);
}
        function display($show_search = true, $show_email = false)
        {
            global $wp_roles;
            $r = '';
            $now = date('Y-m-d H:i:s');
            if (isset($this->title)) {
                $title = $this->title;
            } elseif ($this->is_search()) {
                $title = sprintf(__('Users Matching "%s" by Role'), esc_html($this->search_term));
            }
            $h2_role = $this->roles[0];
            $roles = $wp_roles->get_names();
            if (in_array($h2_role, array_keys($roles))) {
                $h2_role = $roles[$h2_role];
            }
            $h2_span = apply_filters('bb_user_search_description', sprintf(__('%1$s%2$s'), $h2_search, $h2_role), $h2_search, $h2_role, $this);
            echo "<h2 class=\"first left\">" . apply_filters('bb_user_search_title', __('Users Waiting for Approval')) . $h2_span . "</h2>\n";
            do_action('bb_admin_notices');
            if ($this->get_results()) {
                if ($this->results_are_paged()) {
                    $r .= "<div class='tablenav'>\n" . $this->paging_text . "</div><div class=\"clear\"></div>\n\n";
                }
                $r .= "<table class='widefat'>\n";
                $r .= "<thead>\n";
                $r .= "\t<tr>\n";
                $r .= "\t\t<th style='width:10;'>&nbsp;</th>\n";
                $r .= "\t\t<th>" . __('Username') . "</th>\n";
                $r .= "\t\t<th>" . __('Email') . "</th>\n";
                $r .= "\t\t<th>" . __('Registered') . "</th>\n";
                $r .= "\t\t<th>" . __('Elapsed') . "</th>\n";
                $r .= "\t</tr>\n";
                $r .= "</thead>\n\n";
                $r .= "<tbody id='role-{$role}'>\n";
                foreach ((array) $this->get_results() as $user_object) {
                    //$r .= bb_user_row($user_object->ID, $role, $show_email);
                    $user = bb_get_user($user_object->ID);
                    $registered = date('Y/m/d H:i:s', bb_offset_time(bb_gmtstrtotime($user->user_registered)));
                    $date_eng = date('H:i:s - d/m/Y', bb_offset_time(bb_gmtstrtotime($user->user_registered)));
                    $difference = strtotime($now) - strtotime($registered);
                    $hours_ago = number_format($difference / 60 / 60, 0);
                    if ($hours_ago < '15') {
                        $reg_compare = '"color: red"';
                        $checked = '';
                    }
                    if ($hours_ago >= '15' && $hours_ago < '24') {
                        $reg_compare = '"color: blue"';
                        $checked = 'checked';
                    }
                    if ($hours_ago >= '24') {
                        $reg_compare = '"color: purple"';
                        $checked = 'checked';
                    }
                    $r .= "\t<tr id='user-{$user->ID}'" . get_alt_class("user-{$role}") . ">\n";
                    $r .= "\t\t<td><input type='checkbox' value='{$user->ID}' name='userids[]' {$checked}/></td>\n";
                    $r .= "\t\t<td><a href='" . get_user_profile_link($user->ID) . "' style=" . $reg_compare . ">" . get_user_name($user->ID) . "</a></td>\n";
                    $email = bb_get_user_email($user->ID);
                    $r .= "\t\t<td><a href='mailto:{$email}'>{$email}</a></td>\n";
                    $r .= "\t\t<td>" . $date_eng . "</td>\n";
                    $r .= "\t\t<td>" . $hours_ago . " hours</td>\n";
                    $r .= "\n\t</tr>";
                }
                $r .= "</tbody>\n";
                $r .= "<tfoot>\n";
                $r .= "\t<tr>\n";
                $r .= "\t\t<th>&nbsp;</th>\n";
                $r .= "\t\t<th>" . __('Username') . "</th>\n";
                $r .= "\t\t<th>" . __('Email') . "</th>\n";
                $r .= "\t\t<th>" . __('Registered') . "</th>\n";
                $r .= "\t\t<th>" . __('Elapsed') . "</th>\n";
                $r .= "\t</tr>\n";
                $r .= "</tfoot>\n\n";
                $r .= "</table>\n";
                $r .= "<p style=\"text-align: right; color: #9f9f9f; font-size: small; font-style: normal;\">Registered: Red: < 15 hours ago. Blue: > 15 hours ago. Purple: > 24 hours ago.</p>";
                if ($this->results_are_paged()) {
                    $r .= "<div class='tablenav bottom'>\n" . $this->paging_text_bottom . "</div><div class=\"clear\"></div>\n\n";
                }
            }
            ?>
			<form class="settings" method="post" name="approve_user_registration_form">
			<?php 
            echo $r;
            ?>
	       	<fieldset class="submit">
	          <input type="submit" class="submit left" name="approve_user_registration_button_approve" value="Approve" />
	          <input type="submit" class="submit left" name="approve_user_registration_button_reject" value="Reject" />
	        </fieldset>
	        </form>
			<?php 
            //			}
        }
Пример #13
0
    foreach ($relevant as $topic) {
        $bb_post = bb_get_first_post($topic);
        ?>
		<li<?php 
        alt_class('relevant');
        ?>
>
			<a class="result" href="<?php 
        post_link();
        ?>
"><?php 
        echo bb_show_topic_context($q, get_topic_title());
        ?>
</a>
			<span class="freshness"><?php 
        printf(__('By <a href="%1$s">%2$s</a> on %3$s'), get_user_profile_link($topic->topic_poster), get_topic_author(), bb_datetime_format_i18n(get_topic_start_time(array('format' => 'timestamp'))));
        ?>
</span>
			<p><?php 
        echo bb_show_context($q, $bb_post->post_text);
        ?>
</p>
		</li>
<?php 
    }
    ?>
	</ol>
</div>
<?php 
}
?>
Пример #14
0
			<h4><?php 
            echo $comment_type == 'meta' ? T_('Leave a meta comment') : T_('Leave a comment');
            ?>
:</h4>

			<?php 
            $Form = new Form($htsrv_url . 'comment_post.php', 'comment_checkchanges');
            $Form->begin_form('bComment evo_form evo_form__comment ' . ($comment_type == 'meta' ? ' evo_form__comment_meta' : ''));
            if ($comment_type == 'meta') {
                echo '<b class="form_info">' . T_('Please remember: this comment will be included in a private discussion view and <u>only will be visible to other admins</u>') . '</b>';
            }
            $Form->add_crumb('comment');
            $Form->hidden('comment_item_ID', $Item->ID);
            $Form->hidden('comment_type', $comment_type);
            $Form->hidden('redirect_to', $ReqURI);
            $Form->info(T_('User'), $current_User->get_identity_link(array('link_text' => 'name')) . ' ' . get_user_profile_link(' [', ']', T_('Edit profile')));
            $Form->textarea($dummy_fields['content'], '', 12, T_('Comment text'), '', 40, 'bComment autocomplete_usernames');
            global $Plugins;
            $Form->info(T_('Text Renderers'), $Plugins->get_renderer_checkboxes(array('default'), array('Blog' => &$Blog, 'setting_name' => 'coll_apply_comment_rendering')));
            $Form->buttons_input(array(array('name' => 'submit', 'value' => T_('Send comment'), 'class' => 'SaveButton')));
            ?>

				<div class="clear"></div>
			<?php 
            $Form->end_form();
            ?>
			<!-- ========== END of FORM to add a comment ========== -->
			<?php 
        }
        // / can comment
        ?>
Пример #15
0
function bb_repermalink()
{
    global $page;
    $location = bb_get_location();
    $uri = $_SERVER['REQUEST_URI'];
    if (isset($_GET['id'])) {
        $id = $_GET['id'];
    } else {
        $id = bb_get_path();
    }
    $_original_id = $id;
    do_action('pre_permalink', $id);
    $id = apply_filters('bb_repermalink', $id);
    switch ($location) {
        case 'front-page':
            $path = null;
            $querystring = null;
            if ($page > 1) {
                if (bb_get_option('mod_rewrite')) {
                    $path = 'page/' . $page;
                } else {
                    $querystring = array('page' => $page);
                }
            }
            $permalink = bb_get_uri($path, $querystring, BB_URI_CONTEXT_HEADER);
            $issue_404 = true;
            break;
        case 'forum-page':
            if (empty($id)) {
                $permalink = bb_get_uri(null, null, BB_URI_CONTEXT_HEADER);
                break;
            }
            global $forum_id, $forum;
            $forum = bb_get_forum($id);
            $forum_id = $forum->forum_id;
            $permalink = get_forum_link($forum->forum_id, $page);
            break;
        case 'topic-edit-page':
        case 'topic-page':
            if (empty($id)) {
                $permalink = bb_get_uri(null, null, BB_URI_CONTEXT_HEADER);
                break;
            }
            global $topic_id, $topic;
            $topic = get_topic($id);
            $topic_id = $topic->topic_id;
            $permalink = get_topic_link($topic->topic_id, $page);
            break;
        case 'profile-page':
            // This handles the admin side of the profile as well.
            global $user_id, $user, $profile_hooks, $self;
            if (isset($_GET['id'])) {
                $id = $_GET['id'];
            } elseif (isset($_GET['username'])) {
                $id = $_GET['username'];
            } else {
                $id = bb_get_path();
            }
            $_original_id = $id;
            if (!$id) {
                $user = bb_get_current_user();
                // Attempt to go to the current users profile
            } else {
                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);
}
Пример #16
0
function blocklist_check($post_id = 0, $wall = false)
{
    if (bb_current_user_can('moderate') || bb_current_user_can('throttle')) {
        return;
    }
    if ($wall) {
        $bb_post = user_wall_get_post($post_id);
    } else {
        $bb_post = bb_get_post($post_id);
    }
    if (empty($post_id) || empty($bb_post) || !empty($bb_post->post_status)) {
        return;
    }
    global $blocklist, $bbdb;
    blocklist_initialize();
    if (empty($blocklist['data'])) {
        return;
    }
    (array) ($data = explode("\r\n", $blocklist['data']));
    $user = bb_get_user($bb_post->poster_id);
    foreach ($data as $item) {
        if (empty($item) || strlen($item) < 4 || ord($item) == 35) {
            continue;
        }
        if (preg_match('/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}/', $item)) {
            // is IP
            if (strpos($bb_post->poster_ip, $item) === 0) {
                $found = "IP address";
                $bad = $item;
                break;
            }
        } else {
            // is word
            $qitem = preg_quote($item);
            if (preg_match('/\\b' . $qitem . '/simU', $user->user_email)) {
                $found = "email";
                $bad = $item;
                break;
            }
            if (preg_match('/\\b' . $qitem . '/simU', $user->user_login)) {
                $found = "username";
                $bad = $item;
                break;
            }
            if (preg_match('/\\b' . $qitem . '/simU', $bb_post->post_text)) {
                $found = "post text";
                $bad = $item;
                break;
            } elseif (!$wall && $bb_post->post_position == 1) {
                if (empty($topic)) {
                    $topic = get_topic($bb_post->topic_id);
                }
                if (!empty($topic->topic_title) && preg_match('/\\b' . $qitem . '/simU', $topic->topic_title)) {
                    $found = "topic title";
                    $bad = $item;
                    break;
                }
            }
        }
        if (!empty($bad)) {
            break;
        }
    }
    if (!empty($bad)) {
        if ($wall) {
            user_wall_delete_post($post_id, 2);
            $uri = bb_get_option('uri') . "bb-admin/admin-base.php?post_status=2&plugin=user_wall_admin&user-wall-recent=1";
        } else {
            bb_delete_post($post_id, 2);
            if (empty($topic)) {
                $topic = get_topic($bb_post->topic_id);
            }
            if (empty($topic->topic_posts)) {
                bb_delete_topic($topic->topic_id, 2);
            }
            // if no posts in topic, also set topic to spam
            $uri = bb_get_option('uri') . 'bb-admin/' . (defined('BACKPRESS_PATH') ? '' : 'content-') . 'posts.php?post_status=2';
        }
        if (empty($blocklist['email'])) {
            return;
        }
        (array) ($email = explode("\r\n", $blocklist['email']));
        $message = "The blocklist has been triggered... \r\n\r\n";
        $message .= "Matching entry " . '"' . $bad . '"' . " found in {$found}.\r\n";
        $message .= "{$uri}\r\n\r\n";
        $message .= sprintf(__('Username: %s'), stripslashes($user->user_login)) . "\r\n";
        $message .= sprintf(__('Profile: %s'), get_user_profile_link($user->ID)) . "\r\n";
        $message .= sprintf(__('Email: %s'), stripslashes($user->user_email)) . "\r\n";
        $message .= sprintf(__('IP address: %s'), $_SERVER['REMOTE_ADDR']) . "\r\n";
        $message .= sprintf(__('Agent: %s'), substr(stripslashes($_SERVER["HTTP_USER_AGENT"]), 0, 255)) . "\r\n\r\n";
        foreach ($email as $to) {
            if (empty($to) || strlen($to) < 8) {
                continue;
            }
            @bb_mail($to, "[" . bb_get_option('name') . "] blocklist triggered", $message);
        }
    }
}
Пример #17
0
 $Form->switch_template_parts($params['form_params']);
 $Form->begin_form('bComment', '', array('target' => '_self'));
 // TODO: dh> a plugin hook would be useful here to add something to the top of the Form.
 //           Actually, the best would be, if the $Form object could be changed by a plugin
 //           before display!
 $Form->add_crumb('comment');
 $Form->hidden('comment_post_ID', $Item->ID);
 if (!empty($comment_reply_ID)) {
     $Form->hidden('reply_ID', $comment_reply_ID);
     // Link to scroll back up to replying comment
     echo '<a href="' . url_add_param($Item->get_permanent_url(), 'reply_ID=' . $comment_reply_ID . '&amp;redir=no') . '#c' . $comment_reply_ID . '" class="comment_reply_current" rel="' . $comment_reply_ID . '">' . T_('You are currently replying to a specific comment') . '</a>';
 }
 $Form->hidden('redirect_to', $Item->get_feedback_url($disp == 'feedback-popup', '&'));
 if (check_user_status('is_validated')) {
     // User is logged in and activated:
     $Form->info_field(T_('User'), '<strong>' . $current_User->get_identity_link(array('link_text' => $params['author_link_text'])) . '</strong> ' . get_user_profile_link(' [', ']', T_('Edit profile')));
 } else {
     // User is not logged in or not activated:
     if (is_logged_in() && empty($comment_author) && empty($comment_author_email)) {
         $comment_author = $current_User->login;
         $comment_author_email = $current_User->email;
     }
     // Note: we use funky field names to defeat the most basic guestbook spam bots
     $Form->text($dummy_fields['name'], $comment_author, 40, T_('Name'), '', 100, 'bComment');
     $Form->text($dummy_fields['email'], $comment_author_email, 40, T_('Email'), '<br />' . T_('Your email address will <strong>not</strong> be revealed on this site.'), 100, 'bComment');
     $Item->load_Blog();
     if ($Item->Blog->get_setting('allow_anon_url')) {
         $Form->text($dummy_fields['url'], $comment_author_url, 40, T_('Website'), '<br />' . T_('Your URL will be displayed.'), 100, 'bComment');
     }
 }
 if ($Item->can_rate()) {
Пример #18
0
 case 'profile':
     if (bb_get_option('mod_rewrite') === 'slugs') {
         if (!($user = bb_get_user_by_nicename($feed_id))) {
             $user = bb_get_user($feed_id);
         }
     } else {
         if (!($user = bb_get_user($feed_id))) {
             $user = bb_get_user_by_nicename($feed_id);
         }
     }
     if (!$user) {
         die;
     }
     $posts = get_user_favorites($user->ID);
     $title = sprintf(__('%1$s &raquo; User Favorites: %2$s'), bb_get_option('name'), $user->user_nicename);
     $link = get_user_profile_link($feed_id);
     $link_self = get_favorites_rss_link($feed_id);
     break;
 case 'tag-topics':
     if (!($tag = bb_get_tag($feed_id))) {
         die;
     }
     $topics = get_tagged_topics(array('tag_id' => $tag->tag_id, 'page' => 0));
     $posts = array();
     foreach ((array) $topics as $topic) {
         $posts[] = bb_get_first_post($topic->topic_id);
     }
     $title = sprintf(__('%1$s &raquo; Tag: %2$s - Recent Topics'), bb_get_option('name'), bb_get_tag_name());
     $link = bb_get_tag_link($feed_id);
     $link_self = bb_get_tag_topics_rss_link($feed_id);
     break;
function bb_user_row($user, $role = '', $email = false)
{
    $actions = "<a href='" . esc_attr(get_user_profile_link($user->ID)) . "'>" . __('View') . "</a>";
    $title = '';
    if (bb_current_user_can('edit_user', $user_id)) {
        $actions .= " | <a href='" . esc_attr(bb_get_user_admin_link($user->ID)) . "'>" . __('Edit') . "</a>";
        $title = " title='" . esc_attr(sprintf(__('User ID: %d'), $user->ID)) . "'";
    }
    $r = "\t<tr id='user-{$user->ID}'" . get_alt_class("user-{$role}") . ">\n";
    $r .= "\t\t<td class=\"user\">" . bb_get_avatar($user->ID, 32) . "<span class=\"row-title\"><a href='" . get_user_profile_link($user->ID) . "'" . $title . ">" . get_user_name($user->ID) . "</a></span><div><span class=\"row-actions\">{$actions}</span>&nbsp;</div></td>\n";
    $r .= "\t\t<td><a href='" . get_user_profile_link($user->ID) . "'>" . get_user_display_name($user->ID) . "</a></td>\n";
    if ($email) {
        $email = bb_get_user_email($user->ID);
        $r .= "\t\t<td><a href='mailto:{$email}'>{$email}</a></td>\n";
    }
    $registered_time = bb_gmtstrtotime($user->user_registered);
    if ($registered_time < time() - 86400) {
        $time = date('Y/m/d\\<\\b\\r \\/\\>H:i:s', bb_offset_time($registered_time));
    } else {
        $time = sprintf(__('%s ago'), bb_since($registered_time));
    }
    $r .= "\t\t<td>" . $time . "</td>\n";
    if (!isset($user->capabilities) || !is_array($user->capabilities) || empty($user->capabilities)) {
        $role = array(__('Inactive (no role)'));
    } else {
        global $nxt_roles;
        $_roles = $nxt_roles->get_names();
        $role = array();
        foreach ($user->capabilities as $cap => $cap_set) {
            if (!$cap_set) {
                continue;
            }
            $role[] = $_roles[$cap];
        }
        if (!count($role)) {
            $role[] = __('None');
        }
    }
    $r .= "\t\t<td>" . join(', ', $role) . "</td>\n\t</tr>";
    return $r;
}
Пример #20
0
function mass_edit()
{
    if (!bb_current_user_can('browse_deleted')) {
        die(__("Now how'd you get here?  And what did you think you'd be doing?"));
    }
    add_action('bb_get_option_page_topics', 'mass_edit_topic_limit', 250);
    global $bbdb, $bb_post_cache, $bb_user_cache, $bb_posts, $bb_post, $page, $mass_edit_options;
    if (isset($_GET['mass_edit_reset'])) {
        bb_delete_option('mass_edit_options');
        wp_redirect(remove_query_arg(array('mass_edit_options', 'mass_edit_reset')));
    }
    if (!empty($_POST['mass_edit_save_options'])) {
        $mass_edit_options['mass_edit_columns'] = implode(",", array_unique(array_map('trim', explode(",", strtolower(stripslashes($_POST['mass_edit_columns'] . ", checkbox , excerpt , name , meta , actions"))))));
        $mass_edit_options['mass_edit_css'] = stripslashes($_POST['mass_edit_css']);
        bb_update_option('mass_edit_options', $mass_edit_options);
        wp_redirect(remove_query_arg(array('mass_edit_options', 'mass_edit_reset')));
        // may not work since headers are already sent
    }
    echo '<div style="text-align:right;margin-bottom:-1.5em;">';
    if (isset($_GET['mass_edit_options'])) {
        echo '[ <a href="' . bb_get_admin_tab_link("mass_edit") . '&mass_edit_reset=1">Reset To Defaults</a> ]';
    } else {
        echo '[ <a href="' . bb_get_admin_tab_link("mass_edit") . '&mass_edit_options=1">Settings</a> ]';
    }
    echo '</div>';
    echo "<h2><a style='color:black;border:0;text-decoration:none;' href='" . bb_get_admin_tab_link("mass_edit") . "'>" . __('Mass Edit') . "</a></h2>";
    if (!isset($mass_edit_options)) {
        $mass_edit_options = bb_get_option('mass_edit_options');
    }
    if (!isset($mass_edit_options['mass_edit_columns']) || is_array($mass_edit_options['mass_edit_columns'])) {
        $mass_edit_options['mass_edit_columns'] = "checkbox , excerpt , name , meta , actions";
        bb_update_option('mass_edit_options', $mass_edit_options);
    }
    $mass_edit_columns = explode(",", strtolower($mass_edit_options['mass_edit_columns']));
    array_walk($mass_edit_columns, create_function('&$arr', '$arr=trim($arr);'));
    if (isset($_GET['mass_edit_options'])) {
        ?>
	<form action="<?php 
        echo bb_get_admin_tab_link("mass_edit");
        ?>
" method="post" id="mass-edit-options">
	
	<fieldset><legend><strong>Mass Edit Column Order</strong> - default: checkbox , excerpt , name , meta , actions</legend>
	<input name="mass_edit_columns" id="mass_edit_columns" type="text" size="50" value="<?php 
        echo $mass_edit_options['mass_edit_columns'];
        ?>
" />
	<span style="padding-left:2em;" class=submit><input class=submit type="submit" name="mass_edit_save_options" value="<?php 
        _e('Save Options');
        ?>
 &raquo;"  /></span>
	</fieldset>
		
	<fieldset><legend><b>Mass Edit CSS</b></legend>
	<textarea name="mass_edit_css" id="mass_edit_css" cols="100" rows="10"><?php 
        echo $mass_edit_options['mass_edit_css'];
        ?>
</textarea>
	</fieldset>
	</form>
	<br clear=both />
	<hr />
	<?php 
    }
    /*	
    	add_filter( 'get_topic_where', 'no_where' ); add_filter( 'get_topic_link', 'bb_make_link_view_all' );	
    	$bb_post_query = new BB_Query_Form( 'post',array( 'post_status' => 0, 'count' => true ));
    	$bb_posts =& $bb_post_query->results; 	$total = $bb_post_query->found_rows;
    */
    if (!empty($_POST['mass_edit_delete_posts'])) {
        bb_check_admin_referer('mass-edit-bulk-posts');
        $i = 0;
        $bbdb->hide_errors();
        // bbPress still has some db function issues with topic delete/undelete
        foreach ($_POST['mass_edit_delete_posts'] as $bb_post_id) {
            // Check the permissions on each
            $bb_post_id = (int) $bb_post_id;
            // $bb_post_id = $bbdb->get_var("SELECT post_id FROM $bbdb->posts WHERE post_id = $bb_post");
            // $authordata = bb_get_usermeta( $bbdb->get_var("SELECT poster_id FROM $bbdb->posts WHERE ID = $bb_post_id") );
            if (bb_current_user_can('delete_posts', $bb_post_id)) {
                if (!empty($_POST['mass_edit_spam_button'])) {
                    bb_delete_post($bb_post_id, 2);
                }
                if (!empty($_POST['mass_edit_delete_button'])) {
                    bb_delete_post($bb_post_id, 1);
                }
                if (!empty($_POST['mass_edit_undelete_button'])) {
                    bb_delete_post($bb_post_id, 0);
                }
                ++$i;
            }
        }
        $bbdb->show_errors();
        // bbPress still has some db function issues with topic delete/undelete
        // $bbdb->flush();
        // global $bb_cache,$bb_post_cache, $bb_topic_cache;  unset($bb_cache); unset($bb_post_cache); unset($bb_topic_cache);
        echo '<div  id="message" class="updated fade" style="clear:both;"><p>';
        if (!empty($_POST['mass_edit_spam_button'])) {
            printf(__('%s posts marked as spam.'), $i);
        }
        if (!empty($_POST['mass_edit_delete_button'])) {
            printf(__('%s posts deleted.'), $i);
        }
        if (!empty($_POST['mass_edit_undelete_button'])) {
            printf(__('%s posts undeleted.'), $i);
        }
        echo '</p></div>';
    }
    if (isset($_GET['post_text'])) {
        $post_text = substr($bbdb->escape($_GET['post_text']), 0, 100);
    } else {
        $post_text = "";
    }
    if (isset($_GET['post_author'])) {
        $post_author = substr($bbdb->escape($_GET['post_author']), 0, 30);
    } else {
        $post_author = "";
    }
    if (isset($_GET['post_status'])) {
        $post_status = substr($bbdb->escape($_GET['post_status']), 0, 3);
    } else {
        $post_status = "0";
    }
    if (isset($_GET['post_order'])) {
        $post_order = $_GET['post_order'] == "ASC" ? "ASC" : "DESC";
    } else {
        $post_order = "DESC";
    }
    if (isset($_GET['exact_match'])) {
        $exact_match = intval($_GET['exact_match']);
    } else {
        $exact_match = 0;
    }
    if (isset($_GET['per_page'])) {
        $per_page = intval(substr($bbdb->escape($_GET['per_page']), 0, 3));
    } else {
        $per_page = "20";
    }
    $offset = (intval($page) - 1) * $per_page;
    // if (isset($_GET['page']))  {} else {$offset = 0;}
    $query = " FROM {$bbdb->posts} ";
    if ($post_text || $post_author || $post_status != "all") {
        $query .= " WHERE ";
    }
    if ($post_text) {
        if ($exact_match) {
            $query .= " (post_text REGEXP '[[:<:]]" . $post_text . "[[:>:]]'\tOR poster_ip = '" . $post_text . "') ";
        } else {
            $query .= " (post_text LIKE '%{$post_text}%' OR poster_ip LIKE '%{$post_text}%' ) ";
        }
    }
    if ($post_author) {
        $authors = "SELECT ID FROM {$bbdb->users} WHERE ";
        $authors .= $exact_match ? " (user_login REGEXP '[[:<:]]" . $post_author . "[[:>:]]') " : " (user_login LIKE '%{$post_author}%') ";
        $authors .= " LIMIT 99";
        if ($authors = $bbdb->get_results($authors)) {
            if (is_array($authors)) {
                foreach ($authors as $key => $value) {
                    $trans[] = $value->ID;
                }
                $authors = join(',', $trans);
            }
        } else {
            $authors = "-1";
        }
        $query .= ($post_text ? " AND " : "") . " poster_id IN ({$authors}) ";
    }
    if ($post_status != "all") {
        $query .= ($post_text || $authors ? " AND " : "") . " post_status = '{$post_status}' ";
    }
    $restrict = " ORDER BY post_time {$post_order} LIMIT {$offset},{$per_page}";
    // echo $query;	// diagnostic
    $total = $bbdb->get_var("SELECT COUNT(*) " . $query);
    // intval(bb_count_last_query($query));
    if ($total) {
        $bb_posts = $bbdb->get_results("SELECT * " . $query . $restrict);
    } else {
        unset($bb_posts);
    }
    ?>

<form action="<?php 
    echo bb_get_admin_tab_link("mass_edit");
    ?>
" method="get" id="post-search-form" class="search-form">
	<fieldset><legend><?php 
    _e('Show Posts or IPs That Contain &hellip;');
    ?>
</legend> 
	<input name="post_text" id="post-text" class="text-input" type="text" value="<?php 
    echo wp_specialchars($post_text);
    ?>
" size="30" /> 	
	</fieldset>

<?php 
    /*  selection by forum and tag not included in initial versions
    <fieldset><legend>Forum &hellip;</legend>
    <select name="forum_id" id="forum-id" tabindex="5">
    <option value="0">Any</option>
    <option value="1"> bbPress chat</option>
    </select>
    </fieldset>
    <fieldset><legend>Tag&hellip;</legend>
    <input name="tag" id="topic-tag" class="text-input" value="" type="text" />	</fieldset>
    */
    ?>

	<fieldset><legend>Post Author&hellip;</legend>
	<input name="post_author" id="post-author" class="text-input" type="text" value="<?php 
    if (isset($_GET['post_author'])) {
        echo wp_specialchars($_GET['post_author'], 1);
    }
    ?>
" />	
	</fieldset>

	<fieldset><legend>Post Status &hellip;</legend>
		<select name="post_status" id="post-status">			
			<option value="0" <?php 
    echo $post_status == 0 ? 'selected="selected"' : '';
    ?>
>Visible</option>
			<option value="1" <?php 
    echo $post_status == 1 ? 'selected="selected"' : '';
    ?>
>Deleted</option>
			<option value="2" <?php 
    echo $post_status == 2 ? 'selected="selected"' : '';
    ?>
>Spam</option>
			<option value="all" <?php 
    echo $post_status == "all" ? 'selected="selected"' : '';
    ?>
>All</option>
		</select>
	</fieldset>
	
	<fieldset><legend>Sort Order &hellip;</legend>
		<select name="post_order" id="post-order">
			<option value="DESC" <?php 
    echo $post_order == "DESC" ? 'selected="selected"' : '';
    ?>
>Newest</option>
			<option value="ASC" <?php 
    echo $post_order == "ASC" ? 'selected="selected"' : '';
    ?>
>Oldest</option>			
		</select>
	</fieldset>
	
	<fieldset><legend>Per Page</legend>
		<select name="per_page" id="per-page">
			<option value="20" <?php 
    echo $per_page == 20 ? 'selected="selected"' : '';
    ?>
>20</option>
			<option value="50" <?php 
    echo $per_page == 50 ? 'selected="selected"' : '';
    ?>
>50</option>			
			<option value="100" <?php 
    echo $per_page == 100 ? 'selected="selected"' : '';
    ?>
>100</option>
		</select>
	</fieldset>

	<fieldset><legend>Exact Match</legend>
	<input type="hidden" name="plugin" value="mass_edit"  />
	<span style="padding-left:1em;"><input style="height:1.4em;width:1.4em;" name="exact_match" id="exact-match" class="checkbox" type="checkbox" value="1" <?php 
    echo $exact_match ? 'checked="checked"' : '';
    ?>
 /></span>
    	<span style="padding-left:1em;" class=submit><input class=submit type="submit" name="submit" value="<?php 
    _e('Search');
    ?>
 &raquo;"  /></span>
    	</fieldset>
    
 </form>

<?php 
    if ($total) {
        echo $pagelinks = "<p style='clear:left'>[ " . ($total > $per_page ? "showing " . (($page - 1) * $per_page + 1) . " - " . ($total < $page * $per_page ? $total : $page * $per_page) . " of " : "") . "{$total} posts found ] " . '<span style="padding-left:1em">' . get_page_number_links($page, $total) . "</span></p>";
    }
    if ($bb_posts) {
        // lazy cache loading to radically reduce query count
        foreach ($bb_posts as $bb_post) {
            $users[$bb_post->poster_id] = $bb_post->poster_id;
            $topics[$bb_post->topic_id] = $bb_post->topic_id;
        }
        bb_cache_users($users);
        unset($users);
        $topics = join(',', $topics);
        $topics = $bbdb->get_results("SELECT topic_id,topic_title,topic_slug FROM {$bbdb->topics} WHERE topic_id IN ({$topics})");
        $topics = bb_append_meta($topics, 'topic');
        unset($topics);
        echo '<form name="deleteposts" id="deleteposts" action="" method="post"> ';
        bb_nonce_field('mass-edit-bulk-posts');
        echo '<table class="widefat">
<thead>
<tr>';
        foreach ($mass_edit_columns as $position) {
            switch ($position) {
                case "checkbox":
                    echo '<th scope="col"><input type="checkbox" onclick="checkAll(this,document.getElementById(\'deleteposts\'));" /></th>';
                    break;
                case "excerpt":
                    echo '<th scope="col" width="90%">' . __('Post Excerpt') . '</th>';
                    break;
                case "name":
                    echo '<th scope="col">' . __('Name') . '</th>';
                    break;
                case "meta":
                    echo '<th scope="col">' . __('Meta') . '</th>';
                    break;
                case 'actions':
                    echo '<th scope="col" colspan="2">' . __('Actions') . '</th>';
                    break;
            }
        }
        echo '</tr></thead>';
        foreach ($bb_posts as $bb_post) {
            $bb_post_cache[$bb_post->post_id] = $bb_post;
            // yes this is naughty but lazy workaround for using internal functions without extra mysql queries
            switch ($bb_post->post_status) {
                case 0:
                    $del_class = '';
                    break;
                case 1:
                    $del_class = 'deleted';
                    break;
                case 2:
                    $del_class = 'spam';
                    break;
                default:
                    $del_class = apply_filters('post_del_class', $bb_post->post_status, $bb_post->post_id);
            }
            ?>
  <tr id="post-<?php 
            echo $bb_post->post_id;
            ?>
" <?php 
            alt_class('post', $del_class);
            ?>
>   
<?php 
            foreach ($mass_edit_columns as $position) {
                switch ($position) {
                    case "checkbox":
                        ?>
    <td><?php 
                        if (bb_current_user_can('edit_post', $bb_post->post_id)) {
                            ?>
<input type="checkbox" name="mass_edit_delete_posts[]" value="<?php 
                            echo $bb_post->post_id;
                            ?>
" /><?php 
                        }
                        ?>
</td>
  <?php 
                        break;
                    case "excerpt":
                        ?>
    <td><?php 
                        echo "<a class=metext href='" . mass_edit_get_post_link() . "'>[<strong>" . get_topic_title($bb_post->topic_id) . "</strong>] " . mass_edit_scrub_text($bb_post->post_text, $post_text, 45, $exact_match) . '</a>';
                        ?>
</td>
<?php 
                        break;
                    case "name":
                        ?>
    <td><a href="<?php 
                        echo attribute_escape(get_user_profile_link($bb_post->poster_id));
                        ?>
"><?php 
                        echo get_user_name($bb_post->poster_id);
                        ?>
</a></td>    
<?php 
                        break;
                    case "meta":
                        ?>
    <td><span class=timetitle title="<?php 
                        echo date("r", strtotime(bb_get_post_time()));
                        ?>
"><?php 
                        printf(__('%s ago'), bb_get_post_time());
                        ?>
</span> 
    	<?php 
                        post_ip_link();
                        ?>
</td>    
<?php 
                        break;
                    case "actions":
                        ?>
	
    <td><a href="<?php 
                        post_link();
                        ?>
"><?php 
                        _e('View');
                        ?>
</a>
    	<?php 
                        if (bb_current_user_can('edit_post', $bb_post->post_id)) {
                            post_edit_link();
                        }
                        ?>
</td>
    <td><?php 
                        if (bb_current_user_can('edit_post', $bb_post->post_id)) {
                            post_delete_link();
                        }
                        ?>
</td>    
<?php 
                }
            }
            echo '</tr>';
        }
        // end foreach
        unset($bb_posts);
        ?>
</table>

<?php 
        if ($total) {
            echo $pagelinks;
        }
        ?>

<p class="submit">
<input type="submit" class="deleted" name="mass_edit_delete_button" value="<?php 
        _e('Delete Checked posts &raquo;');
        ?>
" onclick="var numchecked = getNumChecked(document.getElementById('deleteposts')); if(numchecked < 1) { alert('<?php 
        _e("Please select some posts to delete");
        ?>
'); return false } return confirm('<?php 
        printf(__("You are about to delete %s posts  \\n  \\'Cancel\\' to stop, \\'OK\\' to delete."), "' + numchecked + '");
        ?>
')" />
<input type="submit" class="spam" name="mass_edit_spam_button" value="<?php 
        _e('Mark Checked posts as Spam &raquo;');
        ?>
" onclick="var numchecked = getNumChecked(document.getElementById('deleteposts')); if(numchecked < 1) { alert('<?php 
        _e("Please select some posts to mark as spam");
        ?>
'); return false } return confirm('<?php 
        printf(__("You are about to mark %s posts as spam \\n  \\'Cancel\\' to stop, \\'OK\\' to spam."), "' + numchecked + '");
        ?>
')" />
<input type="submit" class="normal" name="mass_edit_undelete_button" value="<?php 
        _e('Undelete Checked posts &raquo;');
        ?>
" onclick="var numchecked = getNumChecked(document.getElementById('deleteposts')); if(numchecked < 1) { alert('<?php 
        _e("Please select some posts to delete");
        ?>
'); return false } return confirm('<?php 
        printf(__("You are about to undelete %s posts  \\n  \\'Cancel\\' to stop, \\'OK\\' to undelete."), "' + numchecked + '");
        ?>
')" />
</form>

<div id="ajax-response"></div>
<?php 
    } else {
        ?>
<p style="clear:both;">
<?php 
        if ($exact_match) {
            echo " <strong>" . __('No results found for exact match.') . " ";
            echo ' <a href="' . attribute_escape(remove_query_arg('exact_match')) . '">' . __("Try non-exact?") . '</a></strong> ';
        } else {
            echo "<strong>" . __('No results found.') . "</strong>";
        }
        ?>
</p>
<?php 
    }
    // end if ($bb_posts)
    ?>

</div>

<?php 
}