]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-admin/media-upload.php
Wordpress 2.5.1
[autoinstalls/wordpress.git] / wp-admin / media-upload.php
1 <?php
2 require_once('admin.php');
3 wp_enqueue_script('swfupload');
4 wp_enqueue_script('swfupload-degrade');
5 wp_enqueue_script('swfupload-queue');
6 wp_enqueue_script('swfupload-handlers');
7
8 @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
9
10 if (!current_user_can('upload_files'))
11         wp_die(__('You do not have permission to upload files.'));
12
13 // IDs should be integers
14 $ID = isset($ID)? (int) $ID : 0;
15 $post_id = isset($post_id)? (int) $post_id : 0;
16
17 // Require an ID for the edit screen
18 if ( isset($action) && $action == 'edit' && !$ID )
19         wp_die(__("You are not allowed to be here"));
20
21 // upload type: image, video, file, ..?
22 if ( isset($_GET['type']) )
23         $type = strval($_GET['type']);
24 else
25         $type = apply_filters('media_upload_default_type', 'file');
26
27 // tab: gallery, library, or type-specific
28 if ( isset($_GET['tab']) )
29         $tab = strval($_GET['tab']);
30 else
31         $tab = apply_filters('media_upload_default_tab', 'type');
32
33 $body_id = 'media-upload';
34
35 // let the action code decide how to handle the request
36 if ( $tab == 'type' )
37         do_action("media_upload_$type");
38 else
39         do_action("media_upload_$tab");
40
41 ?>