diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php
index a779cc8b51..658e50c9d9 100644
--- a/wp-admin/admin-functions.php
+++ b/wp-admin/admin-functions.php
@@ -1973,16 +1973,28 @@ function the_attachment_links($id = false) {
$icon = get_attachment_icon($post->ID);
?>
-
-
-
-
+
' . __('This feature requires iframe support.') . '';
diff --git a/wp-admin/edit-page-form.php b/wp-admin/edit-page-form.php
index d7216a3bc3..2e4c19ba7f 100644
--- a/wp-admin/edit-page-form.php
+++ b/wp-admin/edit-page-form.php
@@ -156,7 +156,7 @@ if ('publish' != $post->post_status || 0 == $post_ID):
' . __('This feature requires iframe support.') . '';
diff --git a/wp-admin/inline-uploading.php b/wp-admin/inline-uploading.php
deleted file mode 100644
index b75a9af7e0..0000000000
--- a/wp-admin/inline-uploading.php
+++ /dev/null
@@ -1,762 +0,0 @@
-".__('Go back').'');
-
-wp_delete_attachment($attachment);
-
-wp_redirect(basename(__FILE__) ."?post=$post&all=$all&action=view&start=$start");
-die;
-
-case 'save':
-
-check_admin_referer('inlineuploading');
-
-$overrides = array('action'=>'save');
-
-$file = wp_handle_upload($_FILES['image'], $overrides);
-
-if ( isset($file['error']) )
- wp_die($file['error'] . '
'.__('Back to Image Uploading').'');
-
-$url = $file['url'];
-$type = $file['type'];
-$file = $file['file'];
-$filename = basename($file);
-
-// Construct the attachment array
-$attachment = array(
- 'post_title' => $imgtitle ? $imgtitle : $filename,
- 'post_content' => $descr,
- 'post_type' => 'attachment',
- 'post_parent' => $post,
- 'post_mime_type' => $type,
- 'guid' => $url
- );
-
-// Save the data
-$id = wp_insert_attachment($attachment, $file, $post);
-
-if ( preg_match('!^image/!', $attachment['post_mime_type']) ) {
- // Generate the attachment's postmeta.
- $imagesize = getimagesize($file);
- $imagedata['width'] = $imagesize['0'];
- $imagedata['height'] = $imagesize['1'];
- list($uwidth, $uheight) = get_udims($imagedata['width'], $imagedata['height']);
- $imagedata['hwstring_small'] = "height='$uheight' width='$uwidth'";
- $imagedata['file'] = $file;
-
- add_post_meta($id, '_wp_attachment_metadata', $imagedata);
-
- if ( $imagedata['width'] * $imagedata['height'] < 3 * 1024 * 1024 ) {
- if ( $imagedata['width'] > 128 && $imagedata['width'] >= $imagedata['height'] * 4 / 3 )
- $thumb = wp_create_thumbnail($file, 128);
- elseif ( $imagedata['height'] > 96 )
- $thumb = wp_create_thumbnail($file, 96);
-
- if ( @file_exists($thumb) ) {
- $newdata = $imagedata;
- $newdata['thumb'] = basename($thumb);
- update_post_meta($id, '_wp_attachment_metadata', $newdata, $imagedata);
- } else {
- $error = $thumb;
- }
- }
-} else {
- add_post_meta($id, '_wp_attachment_metadata', array());
-}
-
-wp_redirect(basename(__FILE__) . "?post=$post&all=$all&action=view&start=0");
-die();
-
-case 'upload':
-
-$current_1 = ' class="current"';
-$back = $next = false;
-break;
-
-case 'view':
-
-// How many images do we show? How many do we query?
-$num = 5;
-$double = $num * 2;
-
-if ( $post && (empty($all) || $all == 'false') ) {
- $and_post = "AND post_parent = '$post'";
- $current_2 = ' class="current"';
-} else {
- $current_3 = ' class="current"';
-}
-
-if (! current_user_can('edit_others_posts') )
- $and_user = "AND post_author = " . $user_ID;
-
-if ( $last )
- $start = $wpdb->get_var("SELECT count(ID) FROM $wpdb->posts WHERE post_type = 'attachment' $and_user $and_post") - $num;
-else
- $start = (int) $start;
-
-if ( $start < 0 )
- $start = 0;
-
-if ( '' == $sort )
- $sort = "post_date_gmt DESC";
-
-$attachments = $wpdb->get_results("SELECT ID, post_date, post_title, post_mime_type, guid FROM $wpdb->posts WHERE post_type = 'attachment' $and_type $and_post $and_user ORDER BY $sort LIMIT $start, $double", ARRAY_A);
-
-if ( count($attachments) == 0 ) {
- wp_redirect( basename(__FILE__) ."?post=$post&action=upload" );
- die;
-} elseif ( count($attachments) > $num ) {
- $next = $start + count($attachments) - $num;
-} else {
- $next = false;
-}
-
-if ( $start > 0 ) {
- $back = $start - $num;
- if ( $back < 1 )
- $back = '0';
-} else {
- $back = false;
-}
-
-$uwidth_sum = 0;
-$html = '';
-$popups = '';
-$style = '';
-$script = '';
-if ( count($attachments) > 0 ) {
- $attachments = array_slice( $attachments, 0, $num );
- $__delete = __('Delete');
- $__not_linked = __('Not Linked');
- $__linked_to_page = __('Linked to Page');
- $__linked_to_image = __('Linked to Image');
- $__linked_to_file = __('Linked to File');
- $__using_thumbnail = __('Using Thumbnail');
- $__using_original = __('Using Original');
- $__using_title = __('Using Title');
- $__using_filename = __('Using Filename');
- $__using_icon = __('Using Icon');
- $__no_thumbnail = ''.__('No Thumbnail').'';
- $__send_to_editor = __('Send to editor');
- $__close = __('Close Options');
- $__confirmdelete = __('Delete this file from the server?');
- $__nothumb = __('There is no thumbnail associated with this photo.');
- $script .= "notlinked = '$__not_linked';
-linkedtoimage = '$__linked_to_image';
-linkedtopage = '$__linked_to_page';
-linkedtofile = '$__linked_to_file';
-usingthumbnail = '$__using_thumbnail';
-usingoriginal = '$__using_original';
-usingtitle = '$__using_title';
-usingfilename = '$__using_filename';
-usingicon = '$__using_icon';
-var aa = new Array();
-var ab = new Array();
-var imga = new Array();
-var imgb = new Array();
-var srca = new Array();
-var srcb = new Array();
-var title = new Array();
-var filename = new Array();
-var icon = new Array();
-";
- foreach ( $attachments as $key => $attachment ) {
- $ID = $attachment['ID'];
- $href = get_attachment_link($ID);
- $meta = get_post_meta($ID, '_wp_attachment_metadata', true);
- if (!is_array($meta)) {
- $meta = get_post_meta($ID, 'imagedata', true); // Try 1.6 Alpha meta key
- if (!is_array($meta)) {
- $meta = array();
- }
- add_post_meta($ID, '_wp_attachment_metadata', $meta);
- }
- $attachment = array_merge($attachment, $meta);
- $noscript = "
-";
- $send_delete_cancel = "$__send_to_editor
-$__delete
- $__close
-";
- $uwidth_sum += 128;
- if ( preg_match('!^image/!', $attachment['post_mime_type'] ) ) {
- $image = & $attachment;
- if ( ($image['width'] > 128 || $image['height'] > 96) && !empty($image['thumb']) && file_exists(dirname($image['file']).'/'.$image['thumb']) ) {
- $src = str_replace(basename($image['guid']), $image['thumb'], $image['guid']);
- $script .= "srca[{$ID}] = '$src';
-srcb[{$ID}] = '{$image['guid']}';
-";
- $thumb = 'true';
- $thumbtext = $__using_thumbnail;
- } else {
- $src = $image['guid'];
- $thumb = 'false';
- $thumbtext = $__no_thumbnail;
- }
- list($image['uwidth'], $image['uheight']) = get_udims($image['width'], $image['height']);
- $height_width = 'height="'.$image['uheight'].'" width="'.$image['uwidth'].'"';
- $xpadding = (128 - $image['uwidth']) / 2;
- $ypadding = (96 - $image['uheight']) / 2;
- $style .= "#target{$ID} img { padding: {$ypadding}px {$xpadding}px; }\n";
- $title = wp_specialchars($image['post_title'], ENT_QUOTES);
- $script .= "aa[{$ID}] = '';
-ab[{$ID}] = '';
-imga[{$ID}] = '';
-imgb[{$ID}] = '';
-";
- $html .= "
-
-
-
- {$noscript}
-
-";
- $popups .= "
-";
- } else {
- $title = wp_specialchars($attachment['post_title'], ENT_QUOTES);
- $filename = basename($attachment['guid']);
- $icon = get_attachment_icon($ID);
- $toggle_icon = "$__using_title";
- $script .= "aa[{$ID}] = '';
-ab[{$ID}] = '';
-title[{$ID}] = '{$title}';
-filename[{$ID}] = '{$filename}';
-icon[{$ID}] = '{$icon}';
-";
- $html .= "
-";
- $popups .= "
-";
- }
- }
-}
-
-$images_width = $uwidth_sum + ( count($images) * 6 ) + 35;
-
-break;
-
-default:
- wp_die(__('This script was not meant to be called directly.'));
-}
-
-?>
-
->
-
-
-
-
-
-
-text_direction) ): ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/wp-admin/menu.php b/wp-admin/menu.php
index 19b64c02b9..108a67bc18 100644
--- a/wp-admin/menu.php
+++ b/wp-admin/menu.php
@@ -30,6 +30,7 @@ $submenu['post-new.php'][10] = array(__('Write Page'), 'edit_pages', 'page-new.p
$submenu['edit.php'][5] = array(__('Posts'), 'edit_posts', 'edit.php');
$submenu['edit.php'][10] = array(__('Pages'), 'edit_pages', 'edit-pages.php');
+$submenu['edit.php'][12] = array(__('Uploads'), 'upload_files', 'upload.php');
$submenu['edit.php'][15] = array(__('Categories'), 'manage_categories', 'categories.php');
$submenu['edit.php'][20] = array(__('Comments'), 'edit_posts', 'edit-comments.php');
$awaiting_mod = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'");
@@ -124,6 +125,8 @@ foreach ( $menu as $id => $data ) {
}
}
+unset($id);
+
ksort($menu); // make it all pretty
if (! user_can_access_admin_page()) {
diff --git a/wp-admin/upload-functions.php b/wp-admin/upload-functions.php
new file mode 100644
index 0000000000..1586336448
--- /dev/null
+++ b/wp-admin/upload-functions.php
@@ -0,0 +1,336 @@
+post_content );
+
+ $class = 'text';
+ $innerHTML = get_attachment_innerHTML( $id, false, $dims );
+ if ( $image_src = strstr($innerHTML, 'src="') ) {
+ $image_src = explode('"', $image_src);
+ $image_src = $image_src[1];
+ $class = 'image';
+ $innerHTML = ' ' . $innerHTML;
+ }
+
+ $r = '';
+
+ if ( $href )
+ $r .= "\n";
+ if ( $href || $image_src )
+ $r .= "\t\t\t$innerHTML";
+ if ( $href )
+ $r .= "\n";
+ $r .= "\n\t\t\n\t\t\t
\n";
+ $r .= "\t\t\t\t\n";
+
+ if ( $image_src )
+ $r .= "\t\t\t\t\n";
+ if ( isset($width) ) {
+ $r .= "\t\t\t\t\n";
+ $r .= "\t\t\t\t\n";
+ }
+ $r .= "\t\t\t\t\n";
+ $r .= "\t\t\t\t\n";
+ $r .= "\t\t\t\t\n";
+ $r .= "\t\t\t
\n\t\t
\n";
+ return $r;
+}
+
+function wp_upload_view() {
+ global $style, $post_id;
+ $id = get_the_ID();
+?>
+
+
+
+"
+ . __('Browse Files') . ''
+ );
+
+ $overrides = array('action'=>'upload');
+
+ $file = wp_handle_upload($_FILES['image'], $overrides);
+
+ if ( isset($file['error']) )
+ wp_die($file['error'] . "
'" . __('Back to Image Uploading') . ''
+ );
+
+ $url = $file['url'];
+ $type = $file['type'];
+ $file = $file['file'];
+ $filename = basename($file);
+
+ // Construct the attachment array
+ $attachment = array(
+ 'post_title' => $post_title ? $post_title : $filename,
+ 'post_content' => $post_content,
+ 'post_type' => 'attachment',
+ 'post_parent' => $post_id,
+ 'post_mime_type' => $type,
+ 'guid' => $url
+ );
+
+ // Save the data
+ $id = wp_insert_attachment($attachment, $file, $post_id);
+
+ if ( preg_match('!^image/!', $attachment['post_mime_type']) ) {
+ // Generate the attachment's postmeta.
+ $imagesize = getimagesize($file);
+ $imagedata['width'] = $imagesize['0'];
+ $imagedata['height'] = $imagesize['1'];
+ list($uwidth, $uheight) = get_udims($imagedata['width'], $imagedata['height']);
+ $imagedata['hwstring_small'] = "height='$uheight' width='$uwidth'";
+ $imagedata['file'] = $file;
+
+ add_post_meta($id, '_wp_attachment_metadata', $imagedata);
+
+ if ( $imagedata['width'] * $imagedata['height'] < 3 * 1024 * 1024 ) {
+ if ( $imagedata['width'] > 128 && $imagedata['width'] >= $imagedata['height'] * 4 / 3 )
+ $thumb = wp_create_thumbnail($file, 128);
+ elseif ( $imagedata['height'] > 96 )
+ $thumb = wp_create_thumbnail($file, 96);
+
+ if ( @file_exists($thumb) ) {
+ $newdata = $imagedata;
+ $newdata['thumb'] = basename($thumb);
+ update_post_meta($id, '_wp_attachment_metadata', $newdata, $imagedata);
+ } else {
+ $error = $thumb;
+ }
+ }
+ } else {
+ add_post_meta($id, '_wp_attachment_metadata', array());
+ }
+
+ wp_redirect( get_option('siteurl') . "/wp-admin/upload.php?style=$style&tab=browse&action=view&ID=$id&post_id=$post_id");
+ die;
+ break;
+
+ case 'save' :
+ global $from_tab, $post_id, $style;
+ if ( !$from_tab )
+ $from_tab = 'upload';
+ check_admin_referer( 'inlineuploading' );
+
+ wp_update_post($_POST);
+ wp_redirect( get_option('siteurl') . "/wp-admin/upload.php?style=$style&tab=$from_tab&post_id=$post_id");
+ die;
+ break;
+
+ case 'delete' :
+ global $ID, $post_id, $from_tab, $style;
+ if ( !$from_tab )
+ $from_tab = 'upload';
+
+ check_admin_referer( 'inlineuploading' );
+
+ if ( !current_user_can('edit_post', (int) $ID) )
+ wp_die( __('You are not allowed to delete this attachment.')
+ . " "
+ . __('Go back') . ''
+ );
+
+ wp_delete_attachment($ID);
+
+ wp_redirect( get_option('siteurl') . "/wp-admin/upload.php?style=$style&tab=$from_tab&post_id=$post_id" );
+ die;
+ break;
+
+ endswitch;
+}
+
+add_action( 'upload_files_upload', 'wp_upload_tab_upload_action' );
+
+function wp_upload_grab_attachments( $obj ) {
+ $obj->is_attachment = true;
+}
+
+function wp_upload_posts_where( $where ) {
+ global $post_id;
+ return $where . " AND post_parent = '" . (int) $post_id . "'";
+}
+
+function wp_upload_tab_browse() {
+ global $wpdb, $action, $paged;
+ $old_vars = compact( 'paged' );
+
+ switch ( $action ) :
+ case 'edit' :
+ case 'view' :
+ global $ID;
+ $attachments = query_posts("attachment_id=$ID");
+ if ( have_posts() ) : while ( have_posts() ) : the_post();
+ 'edit' == $action ? wp_upload_form() : wp_upload_view();
+ endwhile; endif;
+ break;
+ default :
+ global $tab, $post_id;
+ add_action( 'pre_get_posts', 'wp_upload_grab_attachments' );
+ if ( 'browse' == $tab && $post_id )
+ add_filter( 'posts_where', 'wp_upload_posts_where' );
+ $attachments = query_posts("what_to_show=posts&posts_per_page=10&paged=$paged");
+ $count_query = "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'attachment'";
+ if ( $post_id )
+ $count_query .= " AND post_parent = '$post_id'";
+ $total = $wpdb->get_var($count_query);
+
+ echo "\n";
+ if ( have_posts() ) : while ( have_posts() ) : the_post();
+ $href = wp_specialchars( add_query_arg( array('action' => 'view', 'ID' => get_the_ID()) ), 1 );
+
+ echo "\t- \n";
+ echo wp_upload_display( array(128,128), $href );
+ echo "\t
\n";
+ endwhile;
+ else :
+ echo "\t- " . __('There are no attachments to show.') . "
\n";
+ endif;
+ echo "
\n\n";
+
+ echo "\n";
+
+// echo $total;
+ break;
+ endswitch;
+
+ extract($old_vars);
+}
+
+
+function wp_upload_tab_browse_action() {
+ wp_enqueue_script('upload');
+}
+
+add_action( 'upload_files_browse', 'wp_upload_tab_browse_action' );
+add_action( 'upload_files_browse-all', 'wp_upload_tab_browse_action' );
+
+function wp_upload_admin_head() {
+ global $wp_locale;
+ echo "\n";
+ if ( 'rtl' == $wp_locale->text_direction )
+ echo "\n";
+ if ( 'inline' == @$_GET['style'] ) {
+ echo "";
+ }
+}
+
diff --git a/wp-admin/upload-js.php b/wp-admin/upload-js.php
new file mode 100644
index 0000000000..e11de55293
--- /dev/null
+++ b/wp-admin/upload-js.php
@@ -0,0 +1,229 @@
+
+addLoadEvent( function() {
+ theFileList = {
+ currentImage: {ID: 0},
+ nonce: '',
+ tab: '',
+ postID: 0,
+
+ initializeVars: function() {
+ this.urlData = document.location.href.split('?');
+ this.params = this.urlData[1].toQueryParams();
+ this.postID = this.params['post_id'];
+ this.tab = this.params['tab'];
+ this.style = this.params['style'];
+ this.ID = this.params['ID'];
+ if ( !this.style )
+ this.style = 'default';
+ var nonceEl = $('nonce-value');
+ if ( nonceEl )
+ this.nonce = nonceEl.value;
+ if ( this.ID ) {
+ this.grabImageData( this.ID );
+ this.imageView( this.ID );
+ }
+ },
+
+ initializeLinks: function() {
+ if ( this.ID )
+ return;
+ $$('a.file-link').each( function(i) {
+ var id = i.id.split('-').pop();
+ i.onclick = function(e) { theFileList.imageView(id, e); }
+ } );
+ },
+
+ grabImageData: function(id) {
+ if ( id == this.currentImage.ID )
+ return;
+ var thumbEl = $('attachment-thumb-url-' + id);
+ if ( thumbEl )
+ this.currentImage.thumb = ( 0 == id ? '' : thumbEl.value );
+ else
+ this.currentImage.thumb = false;
+ this.currentImage.src = ( 0 == id ? '' : $('attachment-url-' + id).value );
+ this.currentImage.page = ( 0 == id ? '' : $('attachment-page-url-' + id).value );
+ this.currentImage.title = ( 0 == id ? '' : $('attachment-title-' + id).value );
+ this.currentImage.description = ( 0 == id ? '' : $('attachment-description-' + id).value );
+ var widthEl = $('attachment-width-' + id);
+ if ( widthEl ) {
+ this.currentImage.width = ( 0 == id ? '' : widthEl.value );
+ this.currentImage.height = ( 0 == id ? '' : $('attachment-height-' + id).value );
+ } else {
+ this.currentImage.width = false;
+ this.currentImage.height = false;
+ }
+ this.currentImage.ID = id;
+ },
+
+ imageView: function(id, e) {
+ this.prepView(id);
+ var h = '';
+
+ h += "";
+
+ new Insertion.Top('upload-content', h);
+ if (e) Event.stop(e);
+ return false;
+ },
+
+ editView: function(id, e) {
+ this.prepView(id);
+ var h = '';
+
+ h += "";
+
+ new Insertion.Top('upload-content', h);
+ if (e) Event.stop(e);
+ return false;
+ },
+
+ prepView: function(id) {
+ this.cancelView( true );
+ var filesEl = $('upload-files');
+ if ( filesEl )
+ filesEl.hide();
+ this.grabImageData(id);
+ },
+
+ cancelView: function( prep ) {
+ if ( !prep ) {
+ var filesEl = $('upload-files');
+ if ( filesEl )
+ filesEl.show();
+ }
+ if ( !this.ID )
+ this.grabImageData(0);
+ var div = $('upload-file');
+ if ( div )
+ div.remove();
+ return false;
+ },
+
+ sendToEditor: function(id) {
+ this.grabImageData(id);
+ var link = '';
+ var display = '';
+ var h = '';
+
+ link = $A(document.forms.uploadoptions.elements.link).detect( function(i) { return i.checked; } ).value;
+ displayEl = $A(document.forms.uploadoptions.elements.display).detect( function(i) { return i.checked; } )
+ if ( displayEl )
+ display = displayEl.value;
+
+ if ( 'none' != link )
+ h += "";
+ if ( display )
+ h += "";
+ else
+ h += this.currentImage.title;
+ if ( 'none' != link )
+ h += "";
+
+ var win = window.opener ? window.opener : window.dialogArguments;
+ if ( !win )
+ win = top;
+ tinyMCE = win.tinyMCE;
+ if ( typeof tinyMCE != 'undefined' && tinyMCE.getInstanceById('content') )
+ win.tinyMCE.execCommand('mceInsertContent', false, h);
+ else
+ win.edInsertContent(win.edCanvas, h);
+ this.cancelView();
+ return false;
+ },
+
+ deleteFile: function(id) {
+ if ( confirm("Are you sure you want to delete the file '" + this.currentImage.title + "'?\nClick ok to delete or cancel to go back.") ) {
+ $('action-value').value = 'delete';
+ $('upload-file').submit();
+ return true;
+ }
+ return false;
+ }
+
+ };
+ theFileList.initializeVars();
+ theFileList.initializeLinks();
+} );
diff --git a/wp-admin/upload-rtl.css b/wp-admin/upload-rtl.css
new file mode 100644
index 0000000000..73357e0613
--- /dev/null
+++ b/wp-admin/upload-rtl.css
@@ -0,0 +1,30 @@
+body { font: 13px Tahoma, "Lucida Grande", "Lucida Sans Unicode", Verdana; }
+
+#upload-menu li { margin: 0 .75em 0 0; }
+
+#upload-menu .current a {
+ border-right: 0;
+ border-left: 2px solid #448abd;
+}
+
+#file-title { margin: 0 15px 0 0; }
+
+h2 { margin: 0 0 0 .2em; }
+
+#upload-files li { margin: 0 15px 15px 0; }
+
+th { text-align: right; }
+
+.left, table { float: right; }
+
+.right, #the-attachment-links { float: left; }
+
+#submit input, #submit input:focus {
+ border-left: 0;
+ border-right-color: #ccc;
+}
+
+#submit input:active {
+ border-left: 0;
+ border-right-color: #999;
+}
diff --git a/wp-admin/upload.css b/wp-admin/upload.css
new file mode 100644
index 0000000000..2a54a1f08c
--- /dev/null
+++ b/wp-admin/upload.css
@@ -0,0 +1,159 @@
+body { background: #dfe8f1; }
+
+.upload-file-data { display: none; }
+
+#upload-menu {
+ background: #fff;
+ margin: 0px;
+ padding: 0;
+ list-style: none;
+ height: 2em;
+ border-bottom: 1px solid #448abd;
+ width: 100%;
+}
+
+#upload-menu li { margin: 0 0 0 .75em; }
+
+#upload-menu a {
+ display: block;
+ padding: 5px;
+ color: #000;
+ border-top: 3px solid #fff;
+ text-decoration: none;
+ border-bottom: none;
+}
+
+#upload-menu .current a {
+ background: #dfe8f1;
+ border-right: 2px solid #448abd;
+}
+
+#upload-menu a:hover {
+ background: #dfe8f1;
+ color: #000;
+}
+
+#upload-content {
+ position: relative;
+ clear: both;
+ margin: 0;
+ padding: 0;
+ border: none;
+ width: 100%;
+ height: 100%;
+ background: none;
+}
+
+#upload-file {
+ position: relative;
+ margin: 0;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ background: #dfe8f1;
+}
+
+#upload-file-view { padding: 0 15px; }
+
+#file-title {
+ margin: 0 0 0 15px;
+ padding: 0;
+ display: block;
+}
+
+h2 {
+ margin: 0 .2em 0 0;
+ padding: 0;
+ display: inline;
+ border: none;
+ font-weight: bold;
+ font-size: 1.4em;
+ line-height: 1.4em;
+}
+
+#upload-files {
+ list-style-type: none;
+ margin: 0;
+ padding: 15px 0 0;
+}
+
+#upload-files li { margin: 0 0 15px 15px; }
+
+#upload-files a, a.file-link {
+ border: none;
+ text-decoration: none;
+}
+
+#upload-files a.file-link {
+ display: block;
+ width: 130px;
+ height: 128px;
+ background-color: rgb(209, 226, 239);
+ text-align: center;
+ overflow-y: hidden;
+}
+
+#upload-files a.file-link.image {
+ line-height: 128px;
+ font-size: 2px;
+ letter-spacing: 0;
+}
+
+#upload-files a.file-link img {
+ vertical-align: middle;
+}
+
+#the-attachment-links { float: right; }
+
+#the-attachment-links textarea {
+ font-size: 10px;
+ overflow: hidden;
+}
+
+form table { float: none; }
+
+table {
+ float: left;
+ margin: 0;
+ padding: 0 15px;
+}
+
+.left { float: left; }
+
+.right { float: right; }
+
+.center { text-align: center; }
+
+th { text-align: left; }
+
+tr, td, th {
+ margin-top: 0;
+ padding-top: 0;
+}
+
+#submit {
+ margin: 1px;
+ width: 99%;
+}
+
+#submit input, #submit input:focus {
+ background: url( images/fade-butt.png );
+ border: 3px double #999;
+ border-left-color: #ccc;
+ border-top-color: #ccc;
+ color: #333;
+ padding: 0.25em;
+}
+
+#submit input:active {
+ background: #f4f4f4;
+ border: 3px double #ccc;
+ border-left-color: #999;
+ border-top-color: #999;
+}
+
+#submit input.delete:hover {
+ background: #ce0000;
+ color: #fff;
+}
diff --git a/wp-admin/upload.php b/wp-admin/upload.php
new file mode 100644
index 0000000000..32d82daf2a
--- /dev/null
+++ b/wp-admin/upload.php
@@ -0,0 +1,74 @@
+get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'attachment'");
+$post_atts = 0;
+if ( $pid ) {
+ $wp_upload_tabs['upload'] = array(__('Upload'), 'upload_files', 'wp_upload_tab_upload');
+ if ( $all_atts && $post_atts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = '$post_id'") )
+ $wp_upload_tabs['browse'] = array(__('Browse'), 'upload_files', "wp_upload_tab_browse");
+ if ( $post_atts < $all_atts )
+ $wp_upload_tabs['browse-all'] = array(__('Browse All'), 'upload_files', 'wp_upload_tab_browse');
+} else
+ $wp_upload_tabs['browse-all'] = array(__('Browse All'), 'upload_files', 'wp_upload_tab_browse');
+
+ $wp_upload_tabs = array_merge($wp_upload_tabs, apply_filters( 'wp_upload_tabs', array() ));
+
+if ( !function_exists($wp_upload_tabs[$tab][2]) ) {
+ $to_tab = isset($wp_upload_tabs['upload']) ? 'upload' : 'browse-all';
+ wp_redirect( add_query_arg( 'tab', $to_tab ) );
+ exit;
+}
+
+foreach ( $wp_upload_tabs as $t => $tab_array ) {
+ if ( !current_user_can( $tab_array[1] ) ) {
+ unset($wp_upload_tabs[$t]);
+ if ( $tab == $t )
+ wp_die(__("You are not allowed to be here"));
+ }
+}
+
+include_once('admin-header.php');
+
+echo "\n\n";
+
+echo "\n";
+
+call_user_func( $wp_upload_tabs[$tab][2] );
+
+echo "
\n";
+
+include_once('admin-footer.php');
+?>
diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css
index a4420cced3..bf3ff8eb94 100644
--- a/wp-admin/wp-admin.css
+++ b/wp-admin/wp-admin.css
@@ -186,7 +186,7 @@ textarea, input, select {
border-style: none;
padding: 0px;
margin-bottom: 16px;
- height: 15em;
+ height: 16em;
width: 100%;
/* overflow-y: hidden;*/
}
diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php
index 6a709ec1ae..ca80aa3e63 100644
--- a/wp-includes/script-loader.php
+++ b/wp-includes/script-loader.php
@@ -29,6 +29,7 @@ class WP_Scripts {
$this->add( 'admin-comments', '/wp-admin/edit-comments.js', array('listman'), '3847' );
$this->add( 'admin-users', '/wp-admin/users.js', array('listman'), '3684' );
$this->add( 'xfn', '/wp-admin/xfn.js', false, '3517' );
+ $this->add( 'upload', '/wp-admin/upload-js.php', array('prototype'), mt_rand() );
}
}