123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- <?php
- if ( ! isset( $_GET['inline'] ) )
- define( 'IFRAME_REQUEST' , true );
- require_once( dirname( __FILE__ ) . '/admin.php' );
- if ( ! current_user_can( 'upload_files' ) ) {
- wp_die( __( 'Sorry, you are not allowed to upload files.' ), 403 );
- }
- wp_enqueue_script('plupload-handlers');
- wp_enqueue_script('image-edit');
- wp_enqueue_script('set-post-thumbnail' );
- wp_enqueue_style('imgareaselect');
- wp_enqueue_script( 'media-gallery' );
- @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
- $ID = isset($ID) ? (int) $ID : 0;
- $post_id = isset($post_id)? (int) $post_id : 0;
- if ( isset( $action ) && $action == 'edit' && !$ID ) {
- wp_die(
- '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' .
- '<p>' . __( 'Invalid item ID.' ) . '</p>',
- 403
- );
- }
- if ( ! empty( $_REQUEST['post_id'] ) && ! current_user_can( 'edit_post' , $_REQUEST['post_id'] ) ) {
- wp_die(
- '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' .
- '<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>',
- 403
- );
- }
- if ( isset($_GET['type']) ) {
- $type = strval($_GET['type']);
- } else {
-
- $type = apply_filters( 'media_upload_default_type', 'file' );
- }
- if ( isset($_GET['tab']) ) {
- $tab = strval($_GET['tab']);
- } else {
-
- $tab = apply_filters( 'media_upload_default_tab', 'type' );
- }
- $body_id = 'media-upload';
- if ( $tab == 'type' || $tab == 'type_url' || ! array_key_exists( $tab , media_upload_tabs() ) ) {
-
- do_action( "media_upload_{$type}" );
- } else {
-
- do_action( "media_upload_{$tab}" );
- }
|