Changes in trunk/wp-admin/admin-ajax.php [4760:5118]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r4760 r5118 152 152 $x->send(); 153 153 break; 154 case 'add-comment' : 155 if ( !current_user_can( 'edit_post', $id ) ) 156 die('-1'); 157 $search = isset($_POST['s']) ? $_POST['s'] : false; 158 $start = isset($_POST['page']) ? intval($_POST['page']) * 25 : 25; 159 160 list($comments, $total) = _wp_get_comment_list( $search, $start, 1 ); 161 162 if ( !$comments ) 163 die('1'); 164 $x = new WP_Ajax_Response(); 165 foreach ( (array) $comments as $comment ) { 166 get_comment( $comment ); 167 ob_start(); 168 _wp_comment_list_item( $comment->comment_ID ); 169 $comment_list_item = ob_get_contents(); 170 ob_end_clean(); 171 $x->add( array( 172 'what' => 'comment', 173 'id' => $comment->comment_ID, 174 'data' => $comment_list_item 175 ) ); 176 } 177 $x->send(); 178 break; 154 179 case 'add-meta' : 155 180 if ( !current_user_can( 'edit_post', $id ) ) 156 181 die('-1'); 157 182 if ( $id < 0 ) { 158 $now = current_time('timestamp' );183 $now = current_time('timestamp', 1); 159 184 if ( $pid = wp_insert_post( array( 160 185 'post_title' => sprintf('Draft created on %s at %s', date(get_option('date_format'), $now), date(get_option('time_format'), $now)) … … 227 252 $_POST['post_category'] = explode(",", $_POST['catslist']); 228 253 if($_POST['post_type'] == 'page' || empty($_POST['post_category'])) 229 unset($_POST['post_category']); 230 254 unset($_POST['post_category']); 255 231 256 if($_POST['post_ID'] < 0) { 232 257 $_POST['temp_ID'] = $_POST['post_ID']; 233 258 $id = wp_write_post(); 234 if( is_wp_error($id))259 if( is_wp_error($id) ) 235 260 die($id->get_error_message()); 236 261 else
Note: See TracChangeset
for help on using the changeset viewer.