Пример #1
0
 /**
  * Deletes an existing post
  *
  * @since 1.0
  * @return integer|object 1 when successfully deleted, 0 when already deleted or an IXR_Error object on failure
  * @param array $args Arguments passed by the XML-RPC call
  * @param string $args[0] The username for authentication
  * @param string $args[1] The password for authentication
  * @param array $args[2] The unique id of the post
  * @param array $args[3] 1 deletes the post, 0 undeletes the post (optional)
  *
  * XML-RPC request to delete the post with an id of 4301
  * <methodCall>
  *     <methodName>bb.editPost</methodName>
  *     <params>
  *         <param><value><string>joeblow</string></value></param>
  *         <param><value><string>123password</string></value></param>
  *         <param><value><int>4301</int></value></param>
  *     </params>
  * </methodCall>
  */
 function bb_deletePost($args)
 {
     do_action('bb_xmlrpc_call', 'bb.deletePost');
     // Escape args
     $this->escape($args);
     // Get the login credentials
     $username = $args[0];
     $password = (string) $args[1];
     // Check the user is valid
     $user = $this->authenticate($username, $password, 'delete_posts', __('You do not have permission to delete posts.'));
     do_action('bb_xmlrpc_call_authenticated', 'bb.deletePost');
     // If an error was raised by authentication or by an action then return it
     if ($this->error) {
         return $this->error;
     }
     // Can be numeric id or slug
     $post_id = isset($args[2]) ? (int) $args[2] : false;
     // Check for bad data
     if (!$post_id) {
         $this->error = new IXR_Error(400, __('The post id is invalid.'));
         return $this->error;
     }
     // Check the requested topic exists
     if (!($post = bb_get_post($post_id))) {
         $this->error = new IXR_Error(400, __('No post found.'));
         return $this->error;
     }
     // Re-assign the post id
     $post_id = (int) $post->post_id;
     // Make sure they are allowed to delete this post
     if (!bb_current_user_can('delete_post', $post_id)) {
         $this->error = new IXR_Error(403, __('You do not have permission to delete this post.'));
         return $this->error;
     }
     $status = isset($args[3]) ? (int) $args[3] : 1;
     if ($status === (int) $post->post_status) {
         return 0;
     }
     // Delete the post
     if (!($post_id = bb_delete_post($post_id, $status))) {
         $this->error = new IXR_Error(500, __('The post could not be edited.'));
         return $this->error;
     }
     $result = 1;
     do_action('bb_xmlrpc_call_return', 'bb.deletePost');
     return $result;
 }
Пример #2
0
function bb_akismet_delete_old()
{
    // Delete old every 20
    $n = mt_rand(1, 20);
    if ($n % 20) {
        return;
    }
    global $bbdb;
    $now = bb_current_time('mysql');
    $posts = (array) $bbdb->get_col($bbdb->prepare("SELECT post_id FROM {$bbdb->posts} WHERE DATE_SUB(%s, INTERVAL 15 DAY) > post_time AND post_status = '2'", $now));
    foreach ($posts as $post) {
        bb_delete_post($post, 1);
    }
}
Пример #3
0
function bp_forums_delete_post($args = '')
{
    global $bp;
    do_action('bbpress_init');
    $defaults = array('post_id' => false);
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    return bb_delete_post($post_id, 1);
}
Пример #4
0
/**
 * Delete a post.
 *
 * Wrapper for {@link bb_delete_post()}.
 *
 * @param array $args {
 *     @type int $post_id ID of the post being deleted.
 * }
 * @return bool True on success, false on failure.
 */
function bp_forums_delete_post($args = '')
{
    /** This action is documented in bp-forums/bp-forums-screens */
    do_action('bbpress_init');
    $r = wp_parse_args($args, array('post_id' => false));
    extract($r, EXTR_SKIP);
    return bb_delete_post($post_id, 1);
}
Пример #5
0
require_once 'admin.php';
if ('post' == strtolower($_SERVER['REQUEST_METHOD'])) {
    bb_check_admin_referer('post-bulk');
    $post_ids = array_map('absint', $_POST['post']);
    $count = 0;
    $action = trim($_POST['action']);
    switch ($action) {
        case 'delete':
            foreach ($post_ids as $post_id) {
                $count += (int) (bool) bb_delete_post($post_id, 1);
            }
            $query_vars = array('message' => 'deleted', 'count' => $count);
            break;
        case 'undelete':
            foreach ($post_ids as $post_id) {
                $count += (int) (bool) bb_delete_post($post_id, 0);
            }
            $query_vars = array('message' => 'undeleted', 'count' => $count);
            break;
        default:
            if ($action) {
                $query_vars = apply_filters("bulk_post__{$action}", array(), $post_ids, $action);
            }
            break;
    }
    bb_safe_redirect(add_query_arg($query_vars));
    exit;
}
if (!empty($_GET['message'])) {
    $message_count = isset($_GET['count']) ? (int) $_GET['count'] : 1;
    switch ((string) $_GET['message']) {
Пример #6
0
function bb_ksd_bulk_post__action($query_vars, $post_ids, $action)
{
    $count = 0;
    switch ($action) {
        case 'spam':
            foreach ($post_ids as $post_id) {
                $count += (int) (bool) bb_delete_post($post_id, 2);
            }
            return array('message' => 'spammed', 'count' => $count);
        case 'unspam':
            foreach ($post_ids as $post_id) {
                $count += (int) (bool) bb_delete_post($post_id, 0);
            }
            return array('message' => 'unspammed-normal', 'count' => $count);
    }
}
Пример #7
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);
        }
    }
}
Пример #8
0
     break;
 case 'delete-post':
     // $id is post_id
     if (!bb_current_user_can('delete_post', $id)) {
         die('-1');
     }
     bb_check_ajax_referer("delete-post_{$id}");
     $status = (int) $_POST['status'];
     if (!($bb_post = bb_get_post($id))) {
         die('0');
     }
     if ($status == $bb_post->post_status) {
         die('1');
     }
     // We're already there
     if (bb_delete_post($id, $status)) {
         die('1');
     }
     break;
     /*
     case 'add-post' : // Can put last_modified stuff back in later
     	bb_check_ajax_referer( $action );
     	$error = false;
     	$post_id = 0;
     	$topic_id = (int) $_POST['topic_id'];
     	$last_mod = (int) $_POST['last_mod'];
     	if ( !$post_content = trim($_POST['post_content']) )
     		$error = new WP_Error( 'no-content', __('You need to actually submit some content!') );
     	if ( !bb_current_user_can( 'write_post', $topic_id ) )
     		die('-1');
     	if ( !$topic = get_topic( $topic_id ) )
function bp_forums_delete_post($args = '')
{
    do_action('bbpress_init');
    $r = wp_parse_args($args, array('post_id' => false));
    extract($r, EXTR_SKIP);
    return bb_delete_post($post_id, 1);
}
Пример #10
0
if (!bb_current_user_can('delete_post', $post_id)) {
    wp_redirect(bb_get_uri(null, null, BB_URI_CONTEXT_HEADER));
    exit;
}
bb_check_admin_referer('delete-post_' . $post_id);
$status = (int) $_GET['status'];
$bb_post = bb_get_post($post_id);
$old_status = (int) $bb_post->post_status;
if (!$bb_post) {
    bb_die(__('There is a problem with that post, pardner.'));
}
if (0 == $status && 0 != $bb_post->post_status) {
    // We're undeleting
    add_filter('bb_delete_post', 'bb_topics_replied_on_undelete_post');
}
bb_delete_post($post_id, $status);
$message = '';
switch ($old_status) {
    case 0:
        switch ($status) {
            case 0:
                break;
            case 1:
                $message = 'deleted';
                break;
            default:
                $message = 'spammed';
                break;
        }
        break;
    case 1:
Пример #11
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 
}