Changeset 23032 for trunk/wp-admin/includes/ajax-actions.php
- Timestamp:
- 12/04/2012 06:33:51 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/ajax-actions.php
r22994 r23032 1813 1813 wp_send_json_error(); 1814 1814 1815 if ( ! current_user_can( 'read_post', $id ) ) 1815 if ( ! $post = get_post( $id ) ) 1816 wp_send_json_error(); 1817 1818 if ( 'attachment' != $post->post_type ) 1819 wp_send_json_error(); 1820 1821 if ( ! current_user_can( 'upload_files' ) ) 1816 1822 wp_send_json_error(); 1817 1823 … … 1828 1834 */ 1829 1835 function wp_ajax_query_attachments() { 1836 if ( ! current_user_can( 'upload_files' ) ) 1837 wp_send_json_error(); 1838 1830 1839 $query = isset( $_REQUEST['query'] ) ? (array) $_REQUEST['query'] : array(); 1831 1840 $query = array_intersect_key( $query, array_flip( array( … … 1989 1998 wp_send_json_error(); 1990 1999 1991 if ( ! current_user_can( 'edit_post', $id ) )1992 wp_send_json_error();1993 1994 2000 if ( 'attachment' != $post->post_type ) 1995 2001 wp_send_json_error(); 1996 2002 1997 // If this attachment is unattached, attach it. Primarily a back compat thing. 1998 if ( 0 == $post->post_parent && $insert_into_post_id = intval( $_POST['post_id'] ) ) { 1999 wp_update_post( array( 'ID' => $id, 'post_parent' => $insert_into_post_id ) ); 2003 if ( current_user_can( 'edit_post', $id ) ) { 2004 // If this attachment is unattached, attach it. Primarily a back compat thing. 2005 if ( 0 == $post->post_parent && $insert_into_post_id = intval( $_POST['post_id'] ) ) { 2006 wp_update_post( array( 'ID' => $id, 'post_parent' => $insert_into_post_id ) ); 2007 } 2000 2008 } 2001 2009
Note: See TracChangeset
for help on using the changeset viewer.