'; if (isset($_GET['mass_edit_options'])) { echo '[ Reset To Defaults ]'; } else { echo '[ Settings ]';} echo ''; echo "

".__('Mass Edit')."

"; 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'])) { ?>
" method="post" id="mass-edit-options">
Mass Edit Column Order - default: checkbox , excerpt , name , meta , actions
Mass Edit CSS


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; } endforeach; $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 '

'; 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 '

'; endif; 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."[[:>:]]' OR 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);} ?>
" method="get" id="post-search-form" class="search-form">
Forum …
Tag…
*/ ?>
Post Author…
Post Status …
Sort Order …
Per Page
Exact Match />
[ ".(($total>$per_page) ? "showing ".(($page-1)*$per_page+1)." - ".(($total<$page*$per_page) ? $total : $page*$per_page)." of " : "")."$total posts found ] ".''.get_page_number_links( $page, $total )."

";} 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 '
'; bb_nonce_field('mass-edit-bulk-posts'); echo ''; foreach ($mass_edit_columns as $position) : switch ($position) : case "checkbox" : echo ''; break; case "excerpt" : echo ''; break; case "name" : echo ''; break; case "meta" : echo ''; break; case 'actions' : echo ''; break; endswitch; endforeach; echo ''; 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 ); endswitch; ?> > '; } // end foreach unset($bb_posts); ?>
' . __('Post Excerpt') . '' . __('Name') . '' . __('Meta') . '' . __('Actions') . '
post_id) ) { ?> [".get_topic_title($bb_post->topic_id) ."] ".mass_edit_scrub_text($bb_post->post_text,$post_text,45,$exact_match).''; ?> poster_id ); ?> "> post_id) ) {post_edit_link();} ?> post_id) ) {post_delete_link();} ?>

'); return false } return confirm('')" /> '); return false } return confirm('')" /> '); return false } return confirm('')" />

".__('No results found for exact match.')." "; echo ' '.__("Try non-exact?").' '; } else {echo "".__('No results found.')."";} ?>

post_position ); $link=get_topic_link( $bb_post->topic_id, $page ) . "#post-$bb_post->post_id"; if ($bb_post->post_status) {$link=add_query_arg('view','all',$link);} return $link; // apply_filters( 'get_post_link', $link, $bb_post->post_id ); } function mass_edit_list_posts() { global $bb_posts, $bb_post; if ( $bb_posts ) : foreach ( $bb_posts as $bb_post ) : ?> >


%3$s'), bb_get_post_time(), get_topic_link( $bb_post->topic_id ), get_topic_title( $bb_post->topic_id ));?> IP:
@', '@]*?>.*?@siU', // Strip out javascript '@]*?>.*?@siU', // Strip style tags properly '@]*?>.*?@siU', // embed '@]*?>.*?@siU', // object '@]*?>.*?@siU', // iframe '@@', // Strip multi-line comments including CDATA '@]*>*@' // html tags ); while($text != strip_tags($text)) { $text = preg_replace($search, '', $text); } if ($term) { $search = preg_quote($term); if ($exact) {$search="\b$search\b";} $text = preg_replace("|.*?(.{0,200})$search(.{0,200}).*|is", "... $1$term$2 ...", $text, 1); } if ($limit) { $blah = explode(' ', $text); if (count($blah) > $limit) { $k = $limit; $use_dotdotdot = 1; } else { $k = count($blah); $use_dotdotdot = 0; } for ($i=0; $i<$k; $i++) {$excerpt .= $blah[$i].' ';} $excerpt .= ($use_dotdotdot) ? '...' : ''; $text = $excerpt; } $htmlEntities = array_values (get_html_translation_table (HTML_ENTITIES, ENT_QUOTES)); $entitiesDecoded = array_keys (get_html_translation_table (HTML_ENTITIES, ENT_QUOTES)); $num = count ($entitiesDecoded); for ($u = 0; $u < $num; $u++) { $utf8Entities[$u] = '&#'.ord($entitiesDecoded[$u]).';'; } return str_replace ($htmlEntities, $utf8Entities, $text); } function mass_edit_add_css() { if (!(isset($_GET['plugin']) && $_GET['plugin']=="mass_edit")) {return;} $mass_edit_options = bb_get_option('mass_edit_options'); if (!isset($mass_edit_options['mass_edit_css'])) { $mass_edit_options['mass_edit_css']= 'fieldset {display:inline;} .submit input {cursor:pointer;cursor:hand;} table td a {line-height:160%;border:0;text-decoration:none;} table.widefat tbody tr:hover { background: #ccddcc; } .timetitle {border-bottom: 1px dashed #aaa; cursor: help;} .metext,.metext:hover,.metext:visited {line-height:120%;text-decoration:none;border:0;color:black;overflow:hidden;display:block;} .bozo { background: #eeee88; } .alt.bozo { background: #ffff99; } .deleted,INPUT.deleted { background: #ee8888; } .alt.deleted { background: #ff9999; } .spam,INPUT.spam {background:#FFF380;} .alt.spam {background:#FAF8CC;} .normal,INPUT.normal {background:#D4E8D4;}'; bb_update_option('mass_edit_options',$mass_edit_options); } echo ''; ?>