[ Index ] |
PHP Cross Reference of BuddyPress |
[Summary view] [Print] [Text view]
1 <?php 2 require_once ('admin.php'); 3 4 if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) ) { 5 bb_check_admin_referer( 'post-bulk' ); 6 7 $post_ids = array_map( 'absint', $_POST['post'] ); 8 9 $count = 0; 10 11 $action = trim( $_POST['action'] ); 12 13 switch ( $action ) { 14 case 'delete' : 15 foreach ( $post_ids as $post_id ) { 16 $count += (int) (bool) bb_delete_post( $post_id, 1 ); 17 } 18 $query_vars = array( 'message' => 'deleted', 'count' => $count ); 19 break; 20 case 'undelete' : 21 foreach ( $post_ids as $post_id ) { 22 $count += (int) (bool) bb_delete_post( $post_id, 0 ); 23 } 24 $query_vars = array( 'message' => 'undeleted', 'count' => $count ); 25 break; 26 default : 27 if ( $action ) 28 $query_vars = apply_filters( "bulk_post__$action", array(), $post_ids, $action ); 29 break; 30 } 31 32 bb_safe_redirect( add_query_arg( $query_vars ) ); 33 exit; 34 } 35 36 if ( !empty( $_GET['message'] ) ) { 37 $message_count = isset( $_GET['count'] ) ? (int) $_GET['count'] : 1; 38 39 switch ( (string) $_GET['message'] ) { 40 case 'undeleted': 41 bb_admin_notice( sprintf( _n( '<strong>Post undeleted.</strong>', '<strong>%s posts undeleted.</strong>', $message_count ), bb_number_format_i18n( $message_count ) ) ); 42 break; 43 case 'deleted': 44 bb_admin_notice( sprintf( _n( '<strong>Post deleted.</strong>', '<strong>%s posts deleted.</strong>', $message_count ), bb_number_format_i18n( $message_count ) ) ); 45 break; 46 case 'spammed': 47 bb_admin_notice( sprintf( _n( '<strong>Post spammed.</strong>', '<strong>%s posts spammed.</strong>', $message_count ), bb_number_format_i18n( $message_count ) ) ); 48 break; 49 case 'unspammed-normal': 50 bb_admin_notice( sprintf( _n( '<strong>Post removed from spam.</strong> It is now a normal post.', '<strong>%s posts removed from spam.</strong> They are now normal posts.', $message_count ), bb_number_format_i18n( $message_count ) ) ); 51 break; 52 case 'unspammed-deleted': 53 bb_admin_notice( sprintf( _n( '<strong>Post removed from spam.</strong> It is now a deleted post.', '<strong>%s posts removed from spam.</strong> They are nowdeleted posts.', $message_count ), bb_number_format_i18n( $message_count ) ) ); 54 break; 55 } 56 } 57 58 $ip_available = false; 59 if ( bb_current_user_can( 'view_by_ip' ) ) { 60 $ip_available = true; 61 } elseif (isset($_GET['poster_ip'])) { 62 unset( $_GET['poster_ip'] ); 63 } 64 65 $bb_admin_body_class = ' bb-admin-posts'; 66 67 bb_get_admin_header(); 68 69 if ( !bb_current_user_can('browse_deleted') ) 70 die(__("Now how'd you get here? And what did you think you'd being doing?")); //This should never happen. 71 add_filter( 'get_topic_where', 'bb_no_where' ); 72 add_filter( 'get_topic_link', 'bb_make_link_view_all' ); 73 add_filter( 'post_edit_uri', 'bb_make_link_view_all' ); 74 $post_query = new BB_Query_Form( 'post', array( 'post_status' => 'normal', 'count' => true, 'per_page' => 20 ) ); 75 $bb_posts =& $post_query->results; 76 $total = $post_query->found_rows; 77 ?> 78 79 <div class="wrap"> 80 81 <h2><?php _e( 'Posts' ); ?> 82 <?php 83 $h2_search = $post_query->get( 'post_text' ); 84 $h2_forum = $post_query->get( 'forum_id' ); 85 $h2_tag = $post_query->get( 'tag_id' ); 86 $h2_author = $post_query->get( 'post_author_id' ); 87 88 $h2_search = $h2_search ? ' ' . sprintf( __('containing “%s”'), esc_html( $h2_search ) ) : ''; 89 $h2_forum = $h2_forum ? ' ' . sprintf( __('in “%s”') , get_forum_name( $h2_forum ) ) : ''; 90 $h2_tag = $h2_tag ? ' ' . sprintf( __('with tag “%s”'), esc_html( bb_get_tag_name( $h2_tag ) ) ) : ''; 91 $h2_author = $h2_author ? ' ' . sprintf( __('by %s') , esc_html( get_user_name( $h2_author ) ) ) : ''; 92 93 if ($ip_available) { 94 $h2_ip = $post_query->get( 'poster_ip' ); 95 $h2_ip = $h2_ip ? ' ' . sprintf( __('from IP address %s'), esc_html( $h2_ip ) ) : ''; 96 } else { 97 $h2_ip = ''; 98 } 99 100 if ( $h2_search || $h2_forum || $h2_tag || $h2_author || $h2_ip ) { 101 echo '<span class="subtitle">'; 102 103 printf( __( '%1$s%2$s%3$s%4$s%5$s' ), $h2_search, $h2_forum, $h2_tag, $h2_author, $h2_ip ); 104 105 echo '</span>'; 106 } 107 ?> 108 </h2> 109 <?php 110 111 do_action( 'bb_admin_notices' ); 112 113 $post_query->form( array( 'poster_ip' => $ip_available, 'tag' => true, 'post_author' => true, 'post_status' => true, 'submit' => __( 'Filter' ) ) ); 114 115 $bulk_actions = array( 116 'delete' => __( 'Delete' ), 117 'undelete' => __( 'Undelete' ), 118 ); 119 120 if ( is_numeric( $bulk_action = $post_query->get( 'post_status' ) ) ) { 121 switch ( $bulk_action ) { 122 case 0 : 123 unset( $bulk_actions['undelete'] ); 124 break; 125 case 1 : 126 unset( $bulk_actions['delete'] ); 127 } 128 } 129 130 unset( $bulk_action ); 131 132 do_action_ref_array( 'bulk_post_actions', array( &$bulk_actions, &$post_query ) ); 133 134 ?> 135 136 <div class="clear"></div> 137 138 <form class="table-form bulk-form" method="post" action=""> 139 140 <fieldset> 141 <select name="action"> 142 <option><?php _e( 'Bulk Actions' ); ?></option> 143 <?php foreach ( $bulk_actions as $value => $label ) : ?> 144 145 <option value="<?php echo esc_attr( $value ); ?>"><?php echo esc_html( $label ); ?></option> 146 <?php endforeach; ?> 147 </select> 148 <input type="submit" value="<?php esc_attr_e( 'Apply' ); ?>" class="button submit-input" /> 149 <?php bb_nonce_field( 'post-bulk' ); ?> 150 </fieldset> 151 152 <div class="tablenav"> 153 <?php if ( $total ) : ?> 154 <div class="tablenav-pages"> 155 <span class="displaying-num"><?php echo $displaying_num = sprintf( 156 __( '%1$s to %2$s of %3$s' ), 157 bb_number_format_i18n( ( $page - 1 ) * $post_query->get( 'per_page' ) + 1 ), 158 $page * $post_query->get( 'per_page' ) < $total ? bb_number_format_i18n( $page * $post_query->get( 'per_page' ) ) : '<span class="total-type-count">' . bb_number_format_i18n( $total ) . '</span>', 159 '<span class="total-type-count">' . bb_number_format_i18n( $total ) . '</span>' 160 ); ?></span><span class="displaying-pages"> 161 <?php 162 $_page_link_args = array( 163 'page' => $page, 164 'total' => $total, 165 'per_page' => $post_query->get( 'per_page' ), 166 'mod_rewrite' => false, 167 'prev_text' => __( '«' ), 168 'next_text' => __( '»' ) 169 ); 170 echo $page_number_links = get_page_number_links( $_page_link_args ); 171 ?></span> 172 <div class="clear"></div> 173 </div> 174 <?php endif; ?> 175 </div> 176 177 <div class="clear"></div> 178 179 <?php bb_admin_list_posts(); ?> 180 181 </form> 182 183 <div class="tablenav bottom"> 184 <?php if ( $total ) : ?> 185 <div class="tablenav-pages"> 186 <span class="displaying-pages"><?php echo $page_number_links; ?></span> 187 <div class="clear"></div> 188 </div> 189 <?php endif; ?> 190 </div> 191 <div class="clear"></div> 192 193 </div> 194 195 <?php bb_get_admin_footer(); ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Dec 7 01:01:35 2017 | Cross-referenced by PHPXref 0.7.1 |