summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--wp-admin/admin-footer.php12
-rw-r--r--wp-admin/admin-functions.php44
-rw-r--r--wp-admin/edit-form-advanced.php2
-rw-r--r--wp-admin/edit-page-form.php2
-rw-r--r--wp-admin/edit.php4
-rw-r--r--wp-admin/index.php82
-rw-r--r--wp-admin/inline-uploading.php770
-rw-r--r--wp-admin/menu.php4
-rw-r--r--wp-admin/options-discussion.php2
-rw-r--r--wp-admin/options-general.php2
-rw-r--r--wp-admin/options.php55
-rw-r--r--wp-admin/page-new.php4
-rw-r--r--wp-admin/page.php4
-rw-r--r--wp-admin/plugins.php26
-rw-r--r--wp-admin/post-new.php4
-rw-r--r--wp-admin/post.php4
-rw-r--r--wp-admin/templates.php8
-rw-r--r--wp-admin/upgrade-functions.php5
-rw-r--r--wp-admin/upgrade-schema.php4
-rw-r--r--wp-admin/upload-functions.php358
-rw-r--r--wp-admin/upload-js.php242
-rw-r--r--wp-admin/upload-rtl.css22
-rw-r--r--wp-admin/upload.css137
-rw-r--r--wp-admin/upload.php125
-rw-r--r--wp-admin/users.php20
-rw-r--r--wp-admin/wp-admin.css65
-rw-r--r--wp-includes/category-template.php2
-rw-r--r--wp-includes/classes.php3
-rw-r--r--wp-includes/comment.php4
-rw-r--r--wp-includes/cron.php4
-rw-r--r--wp-includes/feed.php4
-rw-r--r--wp-includes/formatting.php19
-rw-r--r--wp-includes/general-template.php102
-rw-r--r--wp-includes/link-template.php2
-rw-r--r--wp-includes/pluggable.php10
-rw-r--r--wp-includes/plugin.php2
-rw-r--r--wp-includes/post-template.php2
-rw-r--r--wp-includes/rewrite.php1
-rw-r--r--wp-includes/script-loader.php9
-rw-r--r--wp-includes/vars.php48
-rw-r--r--wp-includes/version.php2
-rw-r--r--wp-settings.php5
-rw-r--r--xmlrpc.php31
43 files changed, 1263 insertions, 994 deletions
diff --git a/wp-admin/admin-footer.php b/wp-admin/admin-footer.php
index 783be91..7f3da52 100644
--- a/wp-admin/admin-footer.php
+++ b/wp-admin/admin-footer.php
@@ -1,10 +1,10 @@
-<div id="footer"><p><a href="http://wordpress.org/" id="wordpress-logo"><img src="images/wordpress-logo.png" alt="WordPress" /></a></p>
-<p>
-<a href="http://codex.wordpress.org/"><?php _e('Documentation'); ?></a> &#8212; <a href="http://wordpress.org/support/"><?php _e('Support Forums'); ?></a> <br />
-<?php bloginfo('version'); ?> &#8212; <?php printf(__('%s seconds'), number_format(timer_stop(), 2)); ?>
-</p>
-
+<div id="footer">
+ <p><a href="http://wordpress.org/" id="wordpress-logo"><img src="images/wordpress-logo.png" alt="WordPress" /></a></p>
+ <p>
+ <?php _e('<a href="http://codex.wordpress.org/">Documentation</a>'); ?> &#8212; <?php _e('<a href="http://wordpress.org/support/">Support Forums</a>'); ?> <br />
+ <?php bloginfo('version'); ?> &#8212; <?php printf(__('%s seconds'), timer_stop(0, 2)); ?>
+ </p>
</div>
<?php do_action('admin_footer', ''); ?>
<script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>
diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php
index 5c220a5..7eef22d 100644
--- a/wp-admin/admin-functions.php
+++ b/wp-admin/admin-functions.php
@@ -674,7 +674,7 @@ function dropdown_categories($default = 0) {
function return_link_categories_list($parent = 0) {
global $wpdb;
- return $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent AND link_count > 0");
+ return $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent ORDER BY link_count DESC");
}
function get_nested_link_categories( $default = 0, $parent = 0 ) {
@@ -1720,25 +1720,23 @@ function get_plugins() {
}
}
- if (!$plugins_dir || !$plugin_files) {
+ if ( !$plugins_dir || !$plugin_files )
return $wp_plugins;
- }
-
- sort($plugin_files);
- foreach ($plugin_files as $plugin_file) {
- if ( !is_readable("$plugin_root/$plugin_file"))
+ foreach ( $plugin_files as $plugin_file ) {
+ if ( !is_readable("$plugin_root/$plugin_file") )
continue;
$plugin_data = get_plugin_data("$plugin_root/$plugin_file");
- if (empty ($plugin_data['Name'])) {
+ if ( empty ($plugin_data['Name']) )
continue;
- }
$wp_plugins[plugin_basename($plugin_file)] = $plugin_data;
}
+ uasort($wp_plugins, create_function('$a, $b', 'return strnatcasecmp($a["Name"], $b["Name"]);'));
+
return $wp_plugins;
}
@@ -1988,16 +1986,28 @@ function the_attachment_links($id = false) {
$icon = get_attachment_icon($post->ID);
?>
-<p><?php _e('Text linked to file') ?><br />
-<textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo $post->guid ?>" class="attachmentlink"><?php echo basename($post->guid) ?></a></textarea></p>
-<p><?php _e('Text linked to subpost') ?><br />
-<textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link($post->ID) ?>" rel="attachment" id="<?php echo $post->ID ?>"><?php echo $post->post_title ?></a></textarea></p>
+<form id="the-attachment-links">
+<table>
+ <tr>
+ <th scope="row"><?php _e('Text linked to file') ?></th>
+ <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo $post->guid ?>" class="attachmentlink"><?php echo basename($post->guid) ?></a></textarea></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('Text linked to subpost') ?></th>
+ <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link($post->ID) ?>" rel="attachment" id="<?php echo $post->ID ?>"><?php echo $post->post_title ?></a></textarea></td>
+ </tr>
<?php if ( $icon ) : ?>
-<p><?php _e('Thumbnail linked to file') ?><br />
-<textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo $post->guid ?>" class="attachmentlink"><?php echo $icon ?></a></textarea></p>
-<p><?php _e('Thumbnail linked to subpost') ?><br />
-<textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link($post->ID) ?>" rel="attachment" id="<?php echo $post->ID ?>"><?php echo $icon ?></a></textarea></p>
+ <tr>
+ <th scope="row"><?php _e('Thumbnail linked to file') ?></th>
+ <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo $post->guid ?>" class="attachmentlink"><?php echo $icon ?></a></textarea></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('Thumbnail linked to subpost') ?></th>
+ <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link($post->ID) ?>" rel="attachment" id="<?php echo $post->ID ?>"><?php echo $icon ?></a></textarea></td>
+ </tr>
<?php endif; ?>
+</table>
+</form>
<?php
}
diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php
index 3ae45b9..076dfa9 100644
--- a/wp-admin/edit-form-advanced.php
+++ b/wp-admin/edit-form-advanced.php
@@ -188,7 +188,7 @@ else
<?php
if (current_user_can('upload_files')) {
$uploading_iframe_ID = (0 == $post_ID ? $temp_ID : $post_ID);
- $uploading_iframe_src = wp_nonce_url("inline-uploading.php?action=view&amp;post=$uploading_iframe_ID", 'inlineuploading');
+ $uploading_iframe_src = wp_nonce_url("upload.php?style=inline&amp;tab=upload&amp;post_id=$uploading_iframe_ID", 'inlineuploading');
$uploading_iframe_src = apply_filters('uploading_iframe_src', $uploading_iframe_src);
if ( false != $uploading_iframe_src )
echo '<iframe id="uploading" frameborder="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>';
diff --git a/wp-admin/edit-page-form.php b/wp-admin/edit-page-form.php
index d7216a3..2e4c19b 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):
<?php
if (current_user_can('upload_files')) {
$uploading_iframe_ID = (0 == $post_ID ? $temp_ID : $post_ID);
- $uploading_iframe_src = wp_nonce_url("inline-uploading.php?action=view&amp;post=$uploading_iframe_ID", 'inlineuploading');
+ $uploading_iframe_src = wp_nonce_url("upload.php?style=inline&amp;tab=upload&amp;post_id=$uploading_iframe_ID", 'inlineuploading');
$uploading_iframe_src = apply_filters('uploading_iframe_src', $uploading_iframe_src);
if ( false != $uploading_iframe_src )
echo '<iframe id="uploading" frameborder="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>';
diff --git a/wp-admin/edit.php b/wp-admin/edit.php
index 8ef71fd..4f2f332 100644
--- a/wp-admin/edit.php
+++ b/wp-admin/edit.php
@@ -115,11 +115,13 @@ if ( count($arc_result) ) { ?>
<form name="viewcat" id="viewcat" action="" method="get">
<fieldset>
<legend><?php _e('Browse Category&hellip;') ?></legend>
- <?php wp_dropdown_categories('show_option_all='.__('All').'&hide_empty=0&hierarchical=1&show_count=1&selected='.$cat);?>
+ <?php wp_dropdown_categories('show_option_all='.__('All').'&hide_empty=1&hierarchical=1&show_count=1&selected='.$cat);?>
<input type="submit" name="submit" value="<?php _e('Show Category') ?>" />
</fieldset>
</form>
+<?php do_action('restrict_manage_posts'); ?>
+
<br style="clear:both;" />
<?php
diff --git a/wp-admin/index.php b/wp-admin/index.php
index cb8b2ff..38b0007 100644
--- a/wp-admin/index.php
+++ b/wp-admin/index.php
@@ -26,7 +26,7 @@ if ( isset($rss->items) && 0 != count($rss->items) ) {
$rss->items = array_slice($rss->items, 0, 10);
foreach ($rss->items as $item ) {
?>
- <li><a href="<?php echo wp_filter_kses($item['link']); ?>"><?php echo wp_specialchars($item['title']); ?></a></li>
+ <li><a href="<?php echo wp_filter_kses($item['link']); ?>"><?php echo wptexturize(wp_specialchars($item['title'])); ?></a></li>
<?php } ?>
</ul>
</div>
@@ -118,45 +118,55 @@ if (0 < $numcats) $numcats = number_format($numcats);
<p><?php _e('Use these links to get started:'); ?></p>
<ul>
-<li><a href="post-new.php"><?php _e('Write a post'); ?></a></li>
-<li><a href="profile.php"><?php _e('Update your profile or change your password'); ?></a></li>
-<li><a href="link-add.php"><?php _e('Add a bookmark to your blogroll'); ?></a></li>
-<li><a href="themes.php"><?php _e('Change your site&#8217;s look or theme'); ?></a></li>
+<?php if ( current_user_can('edit_posts') ) : ?>
+ <li><a href="post-new.php"><?php _e('Write a post'); ?></a></li>
+<?php endif; ?>
+ <li><a href="profile.php"><?php _e('Update your profile or change your password'); ?></a></li>
+<?php if ( current_user_can('manage_links') ) : ?>
+ <li><a href="link-add.php"><?php _e('Add a bookmark to your blogroll'); ?></a></li>
+<?php endif; ?>
+<?php if ( current_user_can('switch_themes') ) : ?>
+ <li><a href="themes.php"><?php _e('Change your site&#8217;s look or theme'); ?></a></li>
+<?php endif; ?>
</ul>
- <p><?php _e("Below is the latest news from the official WordPress development blog, click on a title to read the full entry. If you need help with WordPress please see our <a href='http://codex.wordpress.org/'>great documentation</a> or if that doesn't help visit the <a href='http://wordpress.org/support/'>support forums</a>."); ?></p>
- <?php
- $rss = @fetch_rss('http://wordpress.org/development/feed/');
- if ( isset($rss->items) && 0 != count($rss->items) ) {
- ?>
- <h3><?php _e('WordPress Development Blog'); ?></h3>
- <?php
- $rss->items = array_slice($rss->items, 0, 3);
- foreach ($rss->items as $item ) {
- ?>
- <h4><a href='<?php echo wp_filter_kses($item['link']); ?>'><?php echo wp_specialchars($item['title']); ?></a> &#8212; <?php printf(__('%s ago'), human_time_diff(strtotime($item['pubdate'], time() ) ) ); ?></h4>
- <p><?php echo $item['description']; ?></p>
- <?php
- }
+<p><?php _e("Need help with WordPress? Please see our <a href='http://codex.wordpress.org/'>documentation</a> or visit the <a href='http://wordpress.org/support/'>support forums</a>."); ?></p>
+<?php
+$rss = @fetch_rss('http://wordpress.org/development/feed/');
+if ( isset($rss->items) && 0 != count($rss->items) ) {
+?>
+<h3><?php _e('WordPress Development News'); ?></h3>
+<?php
+$rss->items = array_slice($rss->items, 0, 3);
+foreach ($rss->items as $item ) {
+?>
+<h4><a href='<?php echo wp_filter_kses($item['link']); ?>'><?php echo wp_specialchars($item['title']); ?></a> &#8212; <?php printf(__('%s ago'), human_time_diff(strtotime($item['pubdate'], time() ) ) ); ?></h4>
+<p><?php echo $item['description']; ?></p>
+<?php
}
- $rss = @fetch_rss('http://planet.wordpress.org/feed/');
- if ( isset($rss->items) && 0 != count($rss->items) ) {
- ?>
- <div id="planetnews">
- <h3><?php _e('Other WordPress News'); ?> <a href="http://planet.wordpress.org/"><?php _e('more'); ?> &raquo;</a></h3>
- <ul>
- <?php
- $rss->items = array_slice($rss->items, 0, 20);
- foreach ($rss->items as $item ) {
- ?>
- <li><a href='<?php echo wp_filter_kses($item['link']); ?>'><?php echo wp_specialchars($item['title']); ?></a></li>
- <?php
- }
- ?>
- </ul>
- </div>
- <?php
+}
+?>
+
+
+<?php
+$rss = @fetch_rss('http://planet.wordpress.org/feed/');
+if ( isset($rss->items) && 0 != count($rss->items) ) {
+?>
+<div id="planetnews">
+<h3><?php _e('Other WordPress News'); ?> <a href="http://planet.wordpress.org/"><?php _e('more'); ?> &raquo;</a></h3>
+<ul>
+<?php
+$rss->items = array_slice($rss->items, 0, 20);
+foreach ($rss->items as $item ) {
+?>
+<li><a href='<?php echo wp_filter_kses($item['link']); ?>'><?php echo wp_specialchars($item['title']); ?></a></li>
+<?php
}
?>
+</ul>
+</div>
+<?php
+}
+?>
<div style="clear: both">&nbsp;
<br clear="all" />
</div>
diff --git a/wp-admin/inline-uploading.php b/wp-admin/inline-uploading.php
deleted file mode 100644
index c52a367..0000000
--- a/wp-admin/inline-uploading.php
+++ /dev/null
@@ -1,770 +0,0 @@
-<?php
-require_once('admin.php');
-@header('Content-type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
-
-if (!current_user_can('upload_files'))
- wp_die(__('You do not have permission to upload files.'));
-
-wp_reset_vars(array('action', 'post', 'all', 'last', 'link', 'sort', 'start', 'imgtitle', 'descr', 'attachment'));
-
-$post = (int) $post;
-$images_width = 1;
-
-switch($action) {
-case 'links':
-// Do not pass GO.
-break;
-
-case 'delete':
-
-check_admin_referer('inlineuploading');
-
-if ( !current_user_can('edit_post', (int) $attachment) )
- wp_die(__('You are not allowed to delete this attachment.').' <a href="'.basename(__FILE__)."?post=$post&amp;all=$all&amp;action=upload\">".__('Go back').'</a>');
-
-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' ] ) == false )
- $file[ 'error' ] = apply_filters( "check_uploaded_file", $file[ 'error' ] );
-
-if ( isset($file['error']) )
- wp_die($file['error'] . '<br /><a href="' . basename(__FILE__) . '?action=upload&post=' . $post . '">'.__('Back to Image Uploading').'</a>');
-
-$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 = '<del>'.__('No Thumbnail').'</del>';
- $__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 = "<noscript>
- <div class='caption'><a href=\"".basename(__FILE__)."?action=links&amp;attachment={$ID}&amp;post={$post}&amp;all={$all}&amp;start={$start}\">Choose Links</a></div>
- </noscript>
-";
- $send_delete_cancel = "<a onclick=\"sendToEditor({$ID});return false;\" href=\"javascript:void()\">$__send_to_editor</a>
-<a onclick=\"return confirm('$__confirmdelete')\" href=\"" . wp_nonce_url( basename(__FILE__) . "?action=delete&amp;attachment={$ID}&amp;all=$all&amp;start=$start&amp;post=$post", inlineuploading) . "\">$__delete</a>
- <a onclick=\"popup.style.display='none';return false;\" href=\"javascript:void()\">$__close</a>
-";
- $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}] = '<a id=\"p{$ID}\" rel=\"attachment\" class=\"imagelink\" href=\"$href\" onclick=\"doPopup({$ID});return false;\" title=\"{$title}\">';
-ab[{$ID}] = '<a class=\"imagelink\" href=\"{$image['guid']}\" onclick=\"doPopup({$ID});return false;\" title=\"{$title}\">';
-imga[{$ID}] = '<img id=\"image{$ID}\" src=\"$src\" alt=\"{$title}\" $height_width />';
-imgb[{$ID}] = '<img id=\"image{$ID}\" src=\"{$image['guid']}\" alt=\"{$title}\" $height_width />';
-";
- $html .= "<div id='target{$ID}' class='attwrap left'>
- <div id='div{$ID}' class='imagewrap' onclick=\"doPopup({$ID});\">
- <img id=\"image{$ID}\" src=\"$src\" alt=\"{$title}\" $height_width />
- </div>
- {$noscript}
-</div>
-";
- $popups .= "<div id='popup{$ID}' class='popup'>
- <a id=\"I{$ID}\" onclick=\"if($thumb)toggleImage({$ID});else alert('$__nothumb');return false;\" href=\"javascript:void()\">$thumbtext</a>
- <a id=\"L{$ID}\" onclick=\"toggleLink({$ID});return false;\" href=\"javascript:void()\">$__not_linked</a>
- {$send_delete_cancel}
-</div>
-";
- } else {
- $title = wp_specialchars($attachment['post_title'], ENT_QUOTES);
- $filename = basename($attachment['guid']);
- $icon = get_attachment_icon($ID);
- $toggle_icon = "<a id=\"I{$ID}\" onclick=\"toggleOtherIcon({$ID});return false;\" href=\"javascript:void()\">$__using_title</a>";
- $script .= "aa[{$ID}] = '<a id=\"p{$ID}\" rel=\"attachment\" href=\"$href\" onclick=\"doPopup({$ID});return false;\" title=\"{$title}\">';
-ab[{$ID}] = '<a id=\"p{$ID}\" href=\"{$filename}\" onclick=\"doPopup({$ID});return false;\" title=\"{$title}\">';
-title[{$ID}] = '{$title}';
-filename[{$ID}] = '{$filename}';
-icon[{$ID}] = '{$icon}';
-";
- $html .= "<div id='target{$ID}' class='attwrap left'>
- <div id='div{$ID}' class='otherwrap usingtext' onmousedown=\"selectLink({$ID})\" onclick=\"doPopup({$ID});return false;\">
- <a id=\"p{$ID}\" href=\"{$attachment['guid']}\" onmousedown=\"selectLink({$ID});\" onclick=\"return false;\">{$title}</a>
- </div>
- {$noscript}
-</div>
-";
- $popups .= "<div id='popup{$ID}' class='popup'>
- <div class='filetype'>".__('File Type:').' '.str_replace('/',"/\n",$attachment['post_mime_type'])."</div>
- <a id=\"L{$ID}\" onclick=\"toggleOtherLink({$ID});return false;\" href=\"javascript:void()\">$__linked_to_file</a>
- {$toggle_icon}
- {$send_delete_cancel}
-</div>
-";
- }
- }
-}
-
-$images_width = $uwidth_sum + ( count($images) * 6 ) + 35;
-
-break;
-
-default:
- wp_die(__('This script was not meant to be called directly.'));
-}
-
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
-<head>
-<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
-<title></title>
-<meta http-equiv="imagetoolbar" content="no" />
-<script type="text/javascript">
-// <![CDATA[
-/* Define any variables we'll need, such as alternate URLs. */
-<?php echo $script; ?>
-function htmldecode(st) {
- o = document.getElementById('htmldecode');
- if (! o) {
- o = document.createElement("A");
- o.id = "htmldecode"
- }
- o.innerHTML = st;
- r = o.innerHTML;
- return r;
-}
-function cancelUpload() {
- o = document.getElementById('uploadForm');
- o.method = 'GET';
- o.action.value = 'view';
- o.submit();
-}
-function doPopup(i) {
- if ( popup )
- popup.style.display = 'none';
- target = document.getElementById('target'+i);
- popup = document.getElementById('popup'+i);
- popup.style.left = (target.offsetLeft) + 'px';
- popup.style.top = (target.offsetTop) + 'px';
- popup.style.display = 'block';
-}
-popup = false;
-function selectLink(n) {
- o=document.getElementById('div'+n);
- if ( typeof document.body.createTextRange == 'undefined' || typeof win.tinyMCE == 'undefined' || win.tinyMCE.configs.length < 1 )
- return;
- r = document.body.createTextRange();
- if ( typeof r != 'undefined' ) {
- r.moveToElementText(o);
- r.select();
- }
-}
-function toggleLink(n) {
- ol=document.getElementById('L'+n);
- if ( ol.innerHTML == htmldecode(notlinked) ) {
- ol.innerHTML = linkedtoimage;
- } else if ( ol.innerHTML == htmldecode(linkedtoimage) ) {
- ol.innerHTML = linkedtopage;
- } else {
- ol.innerHTML = notlinked;
- }
- updateImage(n);
-}
-function toggleOtherLink(n) {
- ol=document.getElementById('L'+n);
- if ( ol.innerHTML == htmldecode(linkedtofile) ) {
- ol.innerHTML = linkedtopage;
- } else {
- ol.innerHTML = linkedtofile;
- }
- updateOtherIcon(n);
-}
-function toggleImage(n) {
- oi = document.getElementById('I'+n);
- if ( oi.innerHTML == htmldecode(usingthumbnail) ) {
- oi.innerHTML = usingoriginal;
- } else {
- oi.innerHTML = usingthumbnail;
- }
- updateImage(n);
-}
-function toggleOtherIcon(n) {
- od = document.getElementById('div'+n);
- oi = document.getElementById('I'+n);
- if ( oi.innerHTML == htmldecode(usingtitle) ) {
- oi.innerHTML = usingfilename;
- od.className = 'otherwrap usingtext';
- } else if ( oi.innerHTML == htmldecode(usingfilename) && icon[n] != '' ) {
- oi.innerHTML = usingicon;
- od.className = 'otherwrap usingicon';
- } else {
- oi.innerHTML = usingtitle;
- od.className = 'otherwrap usingtext';
- }
- updateOtherIcon(n);
-}
-function updateImage(n) {
- od=document.getElementById('div'+n);
- ol=document.getElementById('L'+n);
- oi=document.getElementById('I'+n);
- if ( oi.innerHTML == htmldecode(usingthumbnail) ) {
- img = imga[n];
- } else {
- img = imgb[n];
- }
- if ( ol.innerHTML == htmldecode(linkedtoimage) ) {
- od.innerHTML = ab[n]+img+'</a>';
- } else if ( ol.innerHTML == htmldecode(linkedtopage) ) {
- od.innerHTML = aa[n]+img+'</a>';
- } else {
- od.innerHTML = img;
- }
-}
-function updateOtherIcon(n) {
- od=document.getElementById('div'+n);
- ol=document.getElementById('L'+n);
- oi=document.getElementById('I'+n);
- if ( oi.innerHTML == htmldecode(usingfilename) ) {
- txt = filename[n];
- } else if ( oi.innerHTML == htmldecode(usingicon) ) {
- txt = icon[n];
- } else {
- txt = title[n];
- }
- if ( ol.innerHTML == htmldecode(linkedtofile) ) {
- od.innerHTML = ab[n]+txt+'</a>';
- } else if ( ol.innerHTML == htmldecode(linkedtopage) ) {
- od.innerHTML = aa[n]+txt+'</a>';
- } else {
- od.innerHTML = txt;
- }
-}
-
-var win = window.opener ? window.opener : window.dialogArguments;
-if (!win) win = top;
-tinyMCE = win.tinyMCE;
-function sendToEditor(n) {
- o = document.getElementById('div'+n);
- h = o.innerHTML.replace(new RegExp('^\\s*(.*?)\\s*$', ''), '$1'); // Trim
- h = h.replace(new RegExp(' (class|title|width|height|id|onclick|onmousedown)=([^\'"][^ ]*)( |/|>)', 'g'), ' $1="$2"$3'); // Enclose attribs in quotes
- h = h.replace(new RegExp(' (width|height)=".*?"', 'g'), ''); // Drop size constraints
- h = h.replace(new RegExp(' on(click|mousedown)="[^"]*"', 'g'), ''); // Drop menu events
- h = h.replace(new RegExp('<(/?)A', 'g'), '<$1a'); // Lowercase tagnames
- h = h.replace(new RegExp('<IMG', 'g'), '<img'); // Lowercase again
- h = h.replace(new RegExp('(<img .+?")>', 'g'), '$1 />'); // XHTML
- if ( typeof tinyMCE != 'undefined' && tinyMCE.getInstanceById('content') )
- win.tinyMCE.execCommand('mceInsertContent', false, h);
- else
- win.edInsertContent(win.edCanvas, h);
-}
-// ]]>
-</script>
-<style type="text/css">
- <?php if ( $action == 'links' ) : ?>
- * html { overflow-x: hidden; }
- <?php else : ?>
- * html { overflow-y: hidden; }
- <?php endif; ?>
-
- body {
- font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana;
- border: none;
- margin: 0px;
- height: 150px;
- background: #dfe8f1;
- }
-
- form { margin: 3px 2px 0px 6px; }
-
- #wrap {
- clear: both;
- padding: 0px;
- width: 100%;
- }
-
- #images {
- position: absolute;
- clear: both;
- margin: 0px;
- padding: 15px 15px;
- width: <?php echo $images_width; ?>px;
- }
-
- #images img { background-color: rgb(209, 226, 239); }
-
- <?php echo $style; ?>
-
- .attwrap, .attwrap * {
- margin: 0px;
- padding: 0px;
- border: 0px;
- }
-
- .imagewrap {
- margin-right: 5px;
- overflow: hidden;
- width: 128px;
- }
-
- .otherwrap {
- margin-right: 5px;
- overflow: hidden;
- background-color: #f9fcfe;
- }
-
- .otherwrap a { display: block; }
-
- .otherwrap a, .otherwrap a:hover, .otherwrap a:active, .otherwrap a:visited { color: blue; }
-
- .usingicon {
- padding: 0px;
- height: 96px;
- text-align: center;
- width: 128px;
- }
-
- .usingtext {
- padding: 3px;
- height: 90px;
- text-align: left;
- width: 122px;
- }
-
- .filetype {
- font-size: 80%;
- border-bottom: 3px double #89a;
- }
-
- .imagewrap, .imagewrap img, .imagewrap a, .imagewrap a img, .imagewrap a:hover img, .imagewrap a:visited img, .imagewrap a:active img { text-decoration: none; }
-
- #upload-menu {
- background: #fff;
- margin: 0px;
- padding: 0;
- list-style: none;
- height: 2em;
- border-bottom: 1px solid #448abd;
- width: 100%;
- }
-
- #upload-menu li {
- float: left;
- margin: 0 0 0 .75em;
- }
-
- #upload-menu a {
- display: block;
- padding: 5px;
- text-decoration: none;
- color: #000;
- border-top: 3px solid #fff;
- }
-
- #upload-menu .current a {
- background: #dfe8f1;
- border-right: 2px solid #448abd;
- }
-
- #upload-menu a:hover {
- background: #dfe8f1;
- color: #000;
- }
-
- .tip {
- color: rgb(68, 138, 189);
- padding: 2px 1em;
- }
-
- .inactive {
- color: #fff;
- padding: 1px 3px;
- }
-
- .left { float: left; }
-
- .right { float: right; }
-
- .center { text-align: center; }
-
- #upload-menu li.spacer { margin-left: 40px; }
-
- #title, #descr {
- width: 99%;
- margin-top: 1px;
- }
-
- th {
- text-align: right;
- width: 4.5em;
- }
-
- #descr { height: 36px; }
-
- #buttons {
- margin-top: 2px;
- text-align: right;
- }
-
- .popup {
- margin: 4px 4px;
- padding: 1px;
- position: absolute;
- width: 114px;
- display: none;
- background-color: rgb(240, 240, 238);
- border-top: 2px solid #fff;
- border-right: 2px solid #ddd;
- border-bottom: 2px solid #ddd;
- border-left: 2px solid #fff;
- text-align: center;
- }
-
- .imagewrap .popup {
- opacity: .90;
- filter:alpha(opacity=90);
- }
-
- .otherwrap .popup { padding-top: 20px; }
-
- .popup a, .popup a:visited, .popup a:active {
- background-color: transparent;
- display: block;
- width: 100%;
- text-decoration: none;
- color: #246;
- }
-
- .popup a:hover {
- background-color: #fff;
- color: #000;
- }
-
- .caption { text-align: center; }
-
- #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;
- }
-
- .zerosize {
- width: 0px;
- height: 0px;
- overflow: hidden;
- position: absolute;
- }
-
- #links {
- margin: 3px 8px;
- line-height: 2em;
- }
-
- #links textarea {
- width: 95%;
- height: 4.5em;
- }
-</style>
-<?php if ( ('rtl' == $wp_locale->text_direction) ): ?>
-<style type="text/css">
- body { font: 13px Tahoma, "Lucida Grande", "Lucida Sans Unicode", Verdana; }
-
- .usingtext { text-align: right; }
-
- th { text-align: left; }
-
- .left, #upload-menu li { float: right; }
-
- .right { float: left; }
-
- .popup {
- border-right: 2px solid #fff;
- border-left: 2px solid #ddd;
- }
-
- #upload-menu .current a {
- border-right: 0;
- border-left: 2px solid #448abd;
- }
-
- #submit input, #submit input:focus {
- border-left: 0;
- border-right-color: #ccc;
- }
-
- #submit input:active {
- border-left: 0;
- border-right-color: #999;
- }
-</style>
-<?php endif; ?>
-</head>
-<body>
-<ul id="upload-menu">
- <li<?php echo $current_1; ?>><a href="<?php echo basename(__FILE__) . "?action=upload&amp;post=$post&amp;all=$all&amp;start=$start"; ?>"><?php _e('Upload'); ?></a></li>
-
- <?php if ( $attachments = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE post_parent = '$post'") ): ?>
- <li<?php echo $current_2; ?>><a href="<?php echo basename(__FILE__) . "?action=view&amp;post=$post&amp;all=false"; ?>"><?php _e('Browse'); ?></a></li>
- <?php endif; ?>
-
- <?php if ($wpdb->get_var("SELECT count(ID) FROM $wpdb->posts WHERE post_type = 'attachment'")): ?>
- <li<?php echo $current_3; ?>><a href="<?php echo basename(__FILE__) . "?action=view&amp;post=$post&amp;all=true"; ?>"><?php _e('Browse All'); ?></a></li>
- <?php endif; ?>
-
- <li> </li>
-
- <?php if ( $action == 'view' ): ?>
- <?php if ( false !== $back ): ?>
- <li class="spacer"><a href="<?php echo basename(__FILE__) . "?action=$action&amp;post=$post&amp;all=$all&amp;start=0"; ?>" title="<?php _e('First'); ?>">|&laquo;</a></li>
- <li><a href="<?php echo basename(__FILE__) . "?action=$action&amp;post=$post&amp;all=$all&amp;start=$back"; ?>">&laquo; <?php _e('Back'); ?></a></li>
- <?php else: ?>
- <li class="inactive spacer">|&laquo;</li>
- <li class="inactive">&laquo; <?php _e('Back'); ?></li>
- <?php endif; ?>
-
- <?php if ( false !== $next ): ?>
- <li><a href="<?php echo basename(__FILE__) . "?action=$action&amp;post=$post&amp;all=$all&amp;start=$next"; ?>"><?php _e('Next &raquo;'); ?></a></li>
- <li><a href="<?php echo basename(__FILE__) . "?action=$action&amp;post=$post&amp;all=$all&amp;last=true"; ?>" title="<?php _e('Last'); ?>">&raquo;|</a></li>
- <?php else: ?>
- <li class="inactive"><?php _e('Next &raquo;'); ?></li>
- <li class="inactive">&raquo;|</li>
- <?php endif; ?>
- <?php endif; ?>
-</ul>
-
-<?php if ( $action == 'view' ): ?>
- <div id="wrap">
- <!--<div class="tip"><?php _e('You can drag and drop these items into your post. Click on one for more options.'); ?></div>-->
- <div id="images">
- <?php echo $html; ?>
- <?php echo $popups; ?>
- </div>
- </div>
-<?php elseif ( $action == 'upload' ): ?>
- <?php $upload_err = apply_filters( "pre_upload_error", false );
- if( $upload_err != false ) {
- ?><div class="center tip"><?php echo $upload_err ?></div><?php
- } else { ?>
- <div class="tip"></div>
- <form enctype="multipart/form-data" id="uploadForm" method="post" action="<?php echo basename(__FILE__); ?>">
- <table style="width: 99%">
- <tr>
- <th scope="row"><label for="upload"><?php _e('File:'); ?></label></th>
- <td><input type="file" id="upload" name="image" /></td>
- </tr>
- <tr>
- <th scope="row"><label for="title"><?php _e('Title:'); ?></label></th>
- <td><input type="text" id="title" name="imgtitle" /></td>
- </tr>
- <tr>
- <th scope="row"><label for="descr"><?php _e('Description:'); ?></label></th>
- <td><input type="textarea" name="descr" id="descr" value="" /></td>
- </tr>
- <tr id="buttons">
- <th></th>
- <td>
- <input type="hidden" name="action" value="save" />
- <input type="hidden" name="post" value="<?php echo $post; ?>" />
- <input type="hidden" name="all" value="<?php echo $all; ?>" />
- <input type="hidden" name="start" value="<?php echo $start; ?>" />
- <?php wp_nonce_field( 'inlineuploading' ); ?>
- <div id="submit">
- <input type="submit" value="<?php _e('Upload'); ?>" />
- <?php if ( !empty($all) ): ?>
- <input type="button" value="<?php _e('Cancel'); ?>" onclick="cancelUpload()" />
- <?php endif; ?>
- </div>
- </td>
- </tr>
- </table>
- </form>
- <?php } ?>
-<?php elseif ( $action == 'links' ) : ?>
- <div id="links">
- <?php the_attachment_links($attachment); ?>
- </div>
-<?php endif; ?>
-</body>
-</html>
diff --git a/wp-admin/menu.php b/wp-admin/menu.php
index 1752901..a506d1b 100644
--- a/wp-admin/menu.php
+++ b/wp-admin/menu.php
@@ -34,6 +34,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'");
@@ -128,6 +129,7 @@ foreach ( $menu as $id => $data ) {
}
}
+unset($id);
get_currentuserinfo();
if( is_site_admin() ) {
$menu[1] = array( __('Site Admin'), '10', 'wpmu-admin.php' );
@@ -137,7 +139,7 @@ if( is_site_admin() ) {
$submenu[ 'wpmu-admin.php' ][25] = array( __('Options'), '10', 'wpmu-options.php' );
$submenu[ 'wpmu-admin.php' ][30] = array( __('Upgrade'), '10', 'wpmu-upgrade-site.php' );
}
-ksort($menu); // make it all pretty
+uksort($menu, "strnatcasecmp"); // make it all pretty
if (! user_can_access_admin_page()) {
global $wpdb;
diff --git a/wp-admin/options-discussion.php b/wp-admin/options-discussion.php
index 0692f96..74503ed 100644
--- a/wp-admin/options-discussion.php
+++ b/wp-admin/options-discussion.php
@@ -61,7 +61,7 @@ include('admin-header.php');
</fieldset>
<fieldset class="options">
<legend><?php _e('Comment Moderation') ?></legend>
-<p><?php printf(__('Hold a comment in the queue if it contains more than %s links. (A common characteristic of comment spam is a large number of hyperlinks.)'), '<input name="comment_max_links" type="text" id="comment_max_links" size="3" value="' . get_option('comment_max_links'). '" />' ) ?></p>
+<p><?php printf(__('Hold a comment in the queue if it contains %s or more links. (A common characteristic of comment spam is a large number of hyperlinks.)'), '<input name="comment_max_links" type="text" id="comment_max_links" size="3" value="' . get_option('comment_max_links'). '" />' ) ?></p>
<p><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be held in the <a href="moderation.php">moderation queue</a>. One word or IP per line. It will match inside words, so "press" will match "WordPress".') ?></p>
<p>
diff --git a/wp-admin/options-general.php b/wp-admin/options-general.php
index 0e7a556..5c4fa8f 100644
--- a/wp-admin/options-general.php
+++ b/wp-admin/options-general.php
@@ -91,7 +91,7 @@ if( is_array( $lang_files ) && count($lang_files) > 1 ) {
</tr>
<tr>
<th scope="row">&nbsp;</th>
-<td><?php _e('<a href="http://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date formatting</a>. Save option to update sample output.') ?> </td>
+<td><?php _e('<a href="http://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date formatting</a>. Click "Update options" to update sample output.') ?> </td>
</tr>
<tr>
<th scope="row"><?php _e('Weeks in the calendar should start on:') ?></th>
diff --git a/wp-admin/options.php b/wp-admin/options.php
index 691c1ec..33f5acd 100644
--- a/wp-admin/options.php
+++ b/wp-admin/options.php
@@ -20,22 +20,24 @@ if( $_GET[ 'adminhash' ] ) {
exit;
}
-function sanitize_option($option, $value) {
+function sanitize_option($option, $value) { // Remember to call stripslashes!
switch ($option) {
case 'admin_email':
- case 'new_admin_email':
+ $value = stripslashes($value);
$value = sanitize_email($value);
break;
case 'default_post_edit_rows':
case 'mailserver_port':
case 'comment_max_links':
+ $value = stripslashes($value);
$value = abs((int) $value);
break;
case 'posts_per_page':
case 'posts_per_rss':
+ $value = stripslashes($value);
$value = (int) $value;
if ( empty($value) ) $value = 1;
if ( $value < -1 ) $value = abs($value);
@@ -43,6 +45,7 @@ function sanitize_option($option, $value) {
case 'default_ping_status':
case 'default_comment_status':
+ $value = stripslashes($value);
// Options that if not there have 0 value but need to be something like "closed"
if ( $value == '0' || $value == '')
$value = 'closed';
@@ -51,11 +54,12 @@ function sanitize_option($option, $value) {
case 'blogdescription':
case 'blogname':
if (current_user_can('unfiltered_html') == false)
- $value = wp_filter_post_kses( $value );
+ $value = wp_filter_post_kses( $value ); // calls stripslashes then addslashes
+ $value = stripslashes($value);
break;
case 'blog_charset':
- $value = preg_replace('/[^a-zA-Z0-9_-]/', '', $value);
+ $value = preg_replace('/[^a-zA-Z0-9_-]/', '', $value); // strips slashes
break;
case 'date_format':
@@ -66,17 +70,22 @@ function sanitize_option($option, $value) {
case 'ping_sites':
case 'upload_path':
$value = strip_tags($value);
- $value = wp_filter_kses($value);
+ $value = wp_filter_kses($value); // calls stripslashes then addslashes
+ $value = stripslashes($value);
break;
case 'gmt_offset':
- $value = preg_replace('/[^0-9:.-]/', '', $value);
+ $value = preg_replace('/[^0-9:.-]/', '', $value); // strips slashes
break;
case 'siteurl':
case 'home':
+ $value = stripslashes($value);
$value = clean_url($value);
break;
+ default :
+ $value = stripslashes($value);
+ break;
}
return $value;
@@ -89,9 +98,10 @@ case 'update':
check_admin_referer('update-options');
- if (!$_POST['page_options']) {
- foreach ($_POST as $key => $value) {
- $options[] = $key;
+ if ( !$_POST['page_options'] ) {
+ foreach ( (array) $_POST as $key => $value) {
+ if ( !in_array($key, array('_wpnonce', '_wp_http_referer')) )
+ $options[] = $key;
}
} else {
$options = explode(',', stripslashes($_POST['page_options']));
@@ -100,8 +110,8 @@ case 'update':
if ($options) {
foreach ($options as $option) {
$option = trim($option);
- $value = trim(stripslashes($_POST[$option]));
- $value = sanitize_option($option, $value);
+ $value = trim($_POST[$option]);
+ $value = sanitize_option($option, $value); // This does stripslashes on those that need it
update_option($option, $value);
}
}
@@ -119,26 +129,39 @@ if (!is_site_admin())
include('admin-header.php'); ?>
<div class="wrap">
- <h2><?php _e('All options'); ?></h2>
- <form name="form" action="options.php" method="post">
+ <h2><?php _e('All Options'); ?></h2>
+ <form name="form" action="options.php" method="post" id="all-options">
<?php wp_nonce_field('update-options') ?>
<input type="hidden" name="action" value="update" />
+ <p class="submit"><input type="submit" name="Update" value="<?php _e('Update Options &raquo;') ?>" /></p>
<table width="98%">
<?php
$options = $wpdb->get_results("SELECT * FROM $wpdb->options ORDER BY option_name");
+foreach ( (array) $options as $option )
+ $options_to_update[] = $option->option_name;
+$options_to_update = implode(',', $options_to_update);
+?>
+
+<input type="hidden" name="page_options" value="<?php echo $options_to_update; ?>" />
-foreach ($options as $option) :
+<?php
+foreach ( (array) $options as $option) :
$value = wp_specialchars($option->option_value, 'single');
echo "
<tr>
<th scope='row'><label for='$option->option_name'>$option->option_name</label></th>
- <td><input type='text' name='$option->option_name' id='$option->option_name' size='30' value='" . $value . "' /></td>
+<td>";
+
+ if (stristr($value, "\n")) echo "<textarea class='all-options' name='$option->option_name' id='$option->option_name' cols='30' rows='5'>$value</textarea>";
+ else echo "<input class='all-options' type='text' name='$option->option_name' id='$option->option_name' size='30' value='" . $value . "' />";
+
+ echo "</td>
<td>$option->option_description</td>
</tr>";
endforeach;
?>
</table>
-<p class="submit"><input type="submit" name="Update" value="<?php _e('Update Settings &raquo;') ?>" /></p>
+<p class="submit"><input type="submit" name="Update" value="<?php _e('Update Options &raquo;') ?>" /></p>
</form>
</div>
diff --git a/wp-admin/page-new.php b/wp-admin/page-new.php
index d4510ec..b581b38 100644
--- a/wp-admin/page-new.php
+++ b/wp-admin/page-new.php
@@ -8,8 +8,8 @@ wp_enqueue_script('autosave');
require_once('admin-header.php');
?>
-<?php if ( isset($_GET['saved']) || isset($_GET['posted']) ) : ?>
-<div id="message" class="updated fade"><p><strong><?php _e('Page saved.') ?> <a href="edit-pages.php"><?php _e('Manage pages'); ?></a> | <a href="<?php echo get_bloginfo('home') . '/'; ?>"><?php _e('View site') ; ?> &raquo;</a></strong></p></div>
+<?php if ( (isset($_GET['posted']) && $_GET['posted']) || isset($_GET['saved']) ) : ?>
+<div id="message" class="updated fade"><p><strong><?php _e('Page saved.') ?></strong> <a href="edit-pages.php"><?php _e('Manage pages'); ?></a> | <a href="<?php echo get_page_link( isset($_GET['posted']) ? $_GET['posted'] : $_GET['saved'] ); ?>"><?php _e('View page') ; ?> &raquo;</a></p></div>
<?php endif; ?>
<?php
diff --git a/wp-admin/page.php b/wp-admin/page.php
index 025014d..7abf8f2 100644
--- a/wp-admin/page.php
+++ b/wp-admin/page.php
@@ -30,7 +30,7 @@ case 'post':
break;
}
} else {
- $location = 'page-new.php?posted=true';
+ $location = "page-new.php?posted=$page_ID";
}
if ( isset($_POST['save']) )
@@ -104,7 +104,7 @@ case 'editpost':
break;
}
} else {
- $location = 'page-new.php?posted=true';
+ $location = "page-new.php?posted=$page_ID";
}
if ( isset($_POST['save']) )
diff --git a/wp-admin/plugins.php b/wp-admin/plugins.php
index 4b5e3b3..00aba5c 100644
--- a/wp-admin/plugins.php
+++ b/wp-admin/plugins.php
@@ -91,36 +91,40 @@ if (empty($plugins)) {
<th><?php _e('Plugin'); ?></th>
<th style="text-align: center"><?php _e('Version'); ?></th>
<th><?php _e('Description'); ?></th>
- <th style="text-align: center"><?php _e('Action'); ?></th>
+ <th style="text-align: center"<?php if ( current_user_can('edit_plugins') ) echo ' colspan="2"'; ?>><?php _e('Action'); ?></th>
</tr>
</thead>
<?php
$style = '';
- function sort_plugins($plug1, $plug2) {
- return strnatcasecmp($plug1['Name'], $plug2['Name']);
- }
-
- uksort($plugins, 'sort_plugins');
-
foreach($plugins as $plugin_file => $plugin_data) {
$style = ('class="alternate"' == $style|| 'class="alternate active"' == $style) ? '' : 'alternate';
if (!empty($current_plugins) && in_array($plugin_file, $current_plugins)) {
- $action = "<a href='" . wp_nonce_url("plugins.php?action=deactivate&amp;plugin=$plugin_file", 'deactivate-plugin_' . $plugin_file) . "' title='".__('Deactivate this plugin')."' class='delete'>".__('Deactivate')."</a>";
+ $toggle = "<a href='" . wp_nonce_url("plugins.php?action=deactivate&amp;plugin=$plugin_file", 'deactivate-plugin_' . $plugin_file) . "' title='".__('Deactivate this plugin')."' class='delete'>".__('Deactivate')."</a>";
$plugin_data['Title'] = "<strong>{$plugin_data['Title']}</strong>";
$style .= $style == 'alternate' ? ' active' : 'active';
} else {
- $action = "<a href='" . wp_nonce_url("plugins.php?action=activate&amp;plugin=$plugin_file", 'activate-plugin_' . $plugin_file) . "' title='".__('Activate this plugin')."' class='edit'>".__('Activate')."</a>";
+ $toggle = "<a href='" . wp_nonce_url("plugins.php?action=activate&amp;plugin=$plugin_file", 'activate-plugin_' . $plugin_file) . "' title='".__('Activate this plugin')."' class='edit'>".__('Activate')."</a>";
}
$plugin_data['Description'] = wp_kses($plugin_data['Description'], array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array()) ); ;
- if ($style != '') $style = 'class="' . $style . '"';
+ if ( $style != '' )
+ $style = 'class="' . $style . '"';
+ if ( is_writable(ABSPATH . 'wp-content/plugins/' . $plugin_file) )
+ $edit = "<a href='plugin-editor.php?file=$plugin_file' title='".__('Open this file in the Plugin Editor')."' class='edit'>".__('Edit')."</a>";
+ else
+ $edit = '';
+
echo "
<tr $style>
<td class='name'>{$plugin_data['Title']}</td>
<td class='vers'>{$plugin_data['Version']}</td>
<td class='desc'>{$plugin_data['Description']} <cite>".sprintf(__('By %s'), $plugin_data['Author']).".</cite></td>
- <td class='togl'>$action</td>
+ <td class='togl'>$toggle</td>";
+ if ( current_user_can('edit_plugins') )
+ echo "
+ <td>$edit</td>";
+ echo"
</tr>";
}
?>
diff --git a/wp-admin/post-new.php b/wp-admin/post-new.php
index 1fce819..4ecc804 100644
--- a/wp-admin/post-new.php
+++ b/wp-admin/post-new.php
@@ -19,8 +19,8 @@ When you&#8217;re promoted, just reload this page and you&#8217;ll be able to bl
exit();
}
-if ( isset($_GET['posted']) ) : ?>
-<div id="message" class="updated fade"><p><?php printf(__('Post saved. <a href="%s">View site &raquo;</a>'), get_bloginfo('home') . '/'); ?></p></div>
+if ( isset($_GET['posted']) && $_GET['posted'] ) : ?>
+<div id="message" class="updated fade"><p><strong><?php _e('Post saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View post'); ?> &raquo;</a></p></div>
<?php
endif;
diff --git a/wp-admin/post.php b/wp-admin/post.php
index 3c514c7..598f5d2 100644
--- a/wp-admin/post.php
+++ b/wp-admin/post.php
@@ -32,7 +32,7 @@ case 'post':
break;
}
} else {
- $location = 'post-new.php?posted=true';
+ $location = "post-new.php?posted=$post_ID";
}
if ( isset($_POST['save']) )
@@ -106,7 +106,7 @@ case 'editpost':
break;
}
} else {
- $location = 'post-new.php?posted=true';
+ $location = "post-new.php?posted=$post_ID";
}
if ( isset($_POST['save']) )
diff --git a/wp-admin/templates.php b/wp-admin/templates.php
index fa560c8..3608371 100644
--- a/wp-admin/templates.php
+++ b/wp-admin/templates.php
@@ -64,8 +64,12 @@ default:
if (!$error) {
$f = @ fopen($real_file, 'r');
if ( $f ) {
- $content = fread($f, filesize($real_file));
- $content = htmlspecialchars($content);
+ if ( filesize($real_file ) > 0 ) {
+ $content = fread($f, filesize($real_file));
+ $content = htmlspecialchars($content);
+ } else {
+ $content = '';
+ }
} else {
$error = true;
}
diff --git a/wp-admin/upgrade-functions.php b/wp-admin/upgrade-functions.php
index 03c34c2..a3cd623 100644
--- a/wp-admin/upgrade-functions.php
+++ b/wp-admin/upgrade-functions.php
@@ -92,10 +92,9 @@ function wp_install_defaults($user_id) {
$wpdb->query( "INSERT INTO $wpdb->post2cat (`rel_id`, `post_id`, `category_id`) VALUES (1, 1, 1)" );
// Default comment
- $wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_date, comment_date_gmt, comment_content) VALUES ('1', '".$wpdb->escape(__('Mr WordPress'))."', '', 'http://wordpress.org/', '$now', '$now_gmt', '".$wpdb->escape(__('Hi, this is a comment.<br />To delete a comment, just log in, and view the posts\' comments, there you will have the option to edit or delete them.'))."')");
+ $wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_date, comment_date_gmt, comment_content) VALUES ('1', '".$wpdb->escape(__('Mr WordPress'))."', '', 'http://wordpress.org/', '$now', '$now_gmt', '".$wpdb->escape(__('Hi, this is a comment.<br />To delete a comment, just log in and view the post&#039;s comments, there you will have the option to edit or delete them.'))."')");
// First Page
-
$wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, post_status, post_type, to_ping, pinged, post_content_filtered) VALUES ($user_id, '$now', '$now_gmt', '".$wpdb->escape(__('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'))."', '', '".$wpdb->escape(__('About'))."', '0', '".$wpdb->escape(__('about'))."', '$now', '$now_gmt', 'publish', 'page', '', '', '')");
}
endif;
@@ -105,7 +104,7 @@ function wp_new_blog_notification($blog_title, $blog_url, $user_id, $password) {
$user = new WP_User($user_id);
$email = $user->user_email;
$name = $user->user_login;
- $message_headers = 'From: ' . $blog_title . ' <wordpress@' . $_SERVER['SERVER_NAME'] . '>';
+ $message_headers = 'From: "' . $blog_title . '" <wordpress@' . $_SERVER['SERVER_NAME'] . '>';
$message = sprintf(__("Your new WordPress blog has been successfully set up at:
%1\$s
diff --git a/wp-admin/upgrade-schema.php b/wp-admin/upgrade-schema.php
index 20d170d..1875545 100644
--- a/wp-admin/upgrade-schema.php
+++ b/wp-admin/upgrade-schema.php
@@ -7,7 +7,7 @@ $wp_queries="CREATE TABLE $wpdb->categories (
cat_ID bigint(20) NOT NULL auto_increment,
cat_name varchar(55) NOT NULL default '',
category_nicename varchar(200) NOT NULL default '',
- category_description longtext NOT NULL default '',
+ category_description longtext NOT NULL,
category_parent bigint(20) NOT NULL default '0',
category_count bigint(20) NOT NULL default '0',
link_count bigint(20) NOT NULL default '0',
@@ -310,7 +310,7 @@ function populate_options() {
add_option('show_on_front', 'posts');
// Delete unused options
- $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog');
+ $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action');
foreach ($unusedoptions as $option) :
delete_option($option);
endforeach;
diff --git a/wp-admin/upload-functions.php b/wp-admin/upload-functions.php
new file mode 100644
index 0000000..00bccf7
--- /dev/null
+++ b/wp-admin/upload-functions.php
@@ -0,0 +1,358 @@
+<?php
+function wp_upload_display( $dims = false, $href = '' ) {
+ global $post;
+ $id = get_the_ID();
+ $attachment_data = get_post_meta( $id, '_wp_attachment_metadata', true );
+ if ( isset($attachment_data['width']) )
+ list($width,$height) = wp_shrink_dimensions($attachment_data['width'], $attachment_data['height'], 171, 128);
+ ob_start();
+ the_title();
+ $post_title = wp_specialchars( ob_get_contents(), 1 );
+ ob_end_clean();
+ $post_content = apply_filters( 'content_edit_pre', $post->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 = '&nbsp;' . $innerHTML;
+ }
+
+ $r = '';
+
+ if ( $href )
+ $r .= "<a id='file-link-$id' href='$href' title='$post_title' class='file-link $class'>\n";
+ if ( $href || $image_src )
+ $r .= "\t\t\t$innerHTML";
+ if ( $href )
+ $r .= "</a>\n";
+ $r .= "\n\t\t<div class='upload-file-data'>\n\t\t\t<p>\n";
+ $r .= "\t\t\t\t<input type='hidden' name='attachment-url-$id' id='attachment-url-$id' value='" . get_the_guid() . "' />\n";
+
+ if ( $image_src )
+ $r .= "\t\t\t\t<input type='hidden' name='attachment-thumb-url-$id' id='attachment-thumb-url-$id' value='$image_src' />\n";
+ if ( isset($width) ) {
+ $r .= "\t\t\t\t<input type='hidden' name='attachment-width-$id' id='attachment-width-$id' value='$width' />\n";
+ $r .= "\t\t\t\t<input type='hidden' name='attachment-height-$id' id='attachment-height-$id' value='$height' />\n";
+ }
+ $r .= "\t\t\t\t<input type='hidden' name='attachment-page-url-$id' id='attachment-page-url-$id' value='" . get_attachment_link( $id ) . "' />\n";
+ $r .= "\t\t\t\t<input type='hidden' name='attachment-title-$id' id='attachment-title-$id' value='$post_title' />\n";
+ $r .= "\t\t\t\t<input type='hidden' name='attachment-description-$id' id='attachment-description-$id' value='$post_content' />\n";
+ $r .= "\t\t\t</p>\n\t\t</div>\n";
+ return $r;
+}
+
+function wp_upload_view() {
+ global $style, $post_id;
+ $id = get_the_ID();
+ $attachment_data = get_post_meta( $id, '_wp_attachment_metadata', true );
+?>
+ <div id="upload-file">
+ <div id="file-title">
+ <h2><?php if ( !isset($attachment_data['width']) )
+ echo "<a href='" . get_the_guid() . "' title='" . __('Direct link to file') . "'>";
+ the_title();
+ if ( !isset($attachment_data['width']) )
+ echo '</a>';
+ ?></h2>
+ <span><?php
+ echo '[&nbsp;';
+ echo '<a href="' . get_permalink() . '">' . __('view') . '</a>';
+ echo '&nbsp;|&nbsp;';
+ echo '<a href="' . wp_specialchars( add_query_arg( 'action', 'edit' ), 1 ) . '" title="' . __('Edit this file') . '">' . __('edit') . '</a>';
+ echo '&nbsp;|&nbsp;';
+ echo '<a href="' . wp_specialchars( remove_query_arg( array('action', 'ID') ), 1 ) . '" title="' . __('Browse your files') . '">' . __('cancel') . '</a>';
+ echo '&nbsp;]'; ?></span>
+ </div>
+
+ <div id="upload-file-view" class="alignleft">
+<?php if ( isset($attachment_data['width']) )
+ echo "<a href='" . get_the_guid() . "' title='" . __('Direct link to file') . "'>";
+ echo wp_upload_display( array(171, 128) );
+ if ( isset($attachment_data['width']) )
+ echo '</a>'; ?>
+ </div>
+ <?php the_attachment_links( $id ); ?>
+ </div>
+<?php
+}
+
+function wp_upload_form() {
+ $id = get_the_ID();
+ global $post_id, $tab, $style;
+ $enctype = $id ? '' : ' enctype="multipart/form-data"';
+?>
+ <form<?php echo $enctype; ?> id="upload-file" method="post" action="<?php echo get_option('siteurl') . "/wp-admin/upload.php?style=$style&amp;tab=upload&amp;post_id=$post_id"; ?>">
+<?php
+ if ( $id ) :
+ $attachment = get_post_to_edit( $id );
+ $attachment_data = get_post_meta( $id, '_wp_attachment_metadata', true );
+?>
+ <div id="file-title">
+ <h2><?php if ( !isset($attachment_data['width']) )
+ echo "<a href='" . get_the_guid() . "' title='" . __('Direct link to file') . "'>";
+ the_title();
+ if ( !isset($attachment_data['width']) )
+ echo '</a>';
+ ?></h2>
+ <span><?php
+ echo '[&nbsp;';
+ echo '<a href="' . get_permalink() . '">' . __('view') . '</a>';
+ echo '&nbsp;|&nbsp;';
+ echo '<a href="' . wp_specialchars( add_query_arg( 'action', 'view' ), 1 ) . '">' . __('links') . '</a>';
+ echo '&nbsp;|&nbsp;';
+ echo '<a href="' . wp_specialchars( remove_query_arg( array('action','ID') ), 1 ) . '" title="' . __('Browse your files') . '">' . __('cancel') . '</a>';
+ echo '&nbsp;]'; ?></span>
+ </div>
+
+ <div id="upload-file-view" class="alignleft">
+<?php if ( isset($attachment_data['width']) )
+ echo "<a href='" . get_the_guid() . "' title='" . __('Direct link to file') . "'>";
+ echo wp_upload_display( array(171, 128) );
+ if ( isset($attachment_data['width']) )
+ echo '</a>'; ?>
+ </div>
+<?php endif; ?>
+ <table>
+<?php if ( !$id ): ?>
+ <tr>
+ <th scope="row"><label for="upload"><?php _e('File:'); ?></label></th>
+ <td><input type="file" id="upload" name="image" /></td>
+ </tr>
+<?php endif; ?>
+ <tr>
+ <th scope="row"><label for="post_title"><?php _e('Title:'); ?></label></th>
+ <td><input type="text" id="post_title" name="post_title" value="<?php echo $attachment->post_title; ?>" /></td>
+ </tr>
+ <tr>
+ <th scope="row"><label for="post_content"><?php _e('Description:'); ?></label></th>
+ <td><textarea name="post_content" id="post_content"><?php echo $attachment->post_content; ?></textarea></td>
+ </tr>
+ <tr id="buttons">
+ <th></th>
+ <td>
+ <input type="hidden" name="from_tab" value="<?php echo $tab; ?>" />
+ <input type="hidden" name="action" value="<?php echo $id ? 'save' : 'upload'; ?>" />
+<?php if ( $post_id ) : ?>
+ <input type="hidden" name="post_id" value="<?php echo $post_id; ?>" />
+<?php endif; if ( $id ) : ?>
+ <input type="hidden" name="ID" value="<?php echo $id; ?>" />
+<?php endif; ?>
+ <?php wp_nonce_field( 'inlineuploading' ); ?>
+ <div class="submit">
+ <input type="submit" value="<?php $id ? _e('Save') : _e('Upload'); ?>" />
+<?php if ( $id ) : ?>
+ <input type="submit" name="delete" class="delete" value="<?php _e('Delete'); ?>" />
+<?php endif; ?>
+ </div>
+ </td>
+ </tr>
+ </table>
+ </form>
+<?php
+}
+
+function wp_upload_tab_upload() {
+ wp_upload_form();
+}
+
+function wp_upload_tab_upload_action() {
+ global $action;
+ if ( isset($_POST['delete']) )
+ $action = 'delete';
+
+ switch ( $action ) :
+ case 'upload' :
+ global $from_tab, $post_id, $style;
+ if ( !$from_tab )
+ $from_tab = 'upload';
+
+ check_admin_referer( 'inlineuploading' );
+
+ global $post_id, $post_title, $post_content;
+
+ if ( !current_user_can( 'upload_files' ) )
+ wp_die( __('You are not allowed to upload files.')
+ . " <a href='" . get_option('siteurl') . "/wp-admin/upload.php?style=$style&amp;tab=browse-all&amp;post_id=$post_id'>"
+ . __('Browse Files') . '</a>'
+ );
+
+ $overrides = array('action'=>'upload');
+
+ $file = wp_handle_upload($_FILES['image'], $overrides);
+
+ if ( isset($file['error']) )
+ wp_die($file['error'] . "<br /><a href='" . get_option('siteurl')
+ . "/wp-admin/upload.php?style=$style&amp;tab=$from_tab&amp;post_id=$post_id'>'" . __('Back to Image Uploading') . '</a>'
+ );
+
+ $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.')
+ . " <a href='" . get_option('siteurl') . "/wp-admin/upload.php?style=$style&amp;tab=$from_tab&amp;post_id=$post_id'>"
+ . __('Go back') . '</a>'
+ );
+
+ 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, $style;
+ 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 "<ul id='upload-files'>\n";
+ if ( have_posts() ) : while ( have_posts() ) : the_post();
+ $href = wp_specialchars( add_query_arg( array(
+ 'action' => 'inline' == $style ? 'view' : 'edit',
+ 'ID' => get_the_ID())
+ ), 1 );
+
+ echo "\t<li id='file-";
+ the_ID();
+ echo "' class='alignleft'>\n";
+ echo wp_upload_display( array(128,128), $href );
+ echo "\t</li>\n";
+ endwhile;
+ else :
+ echo "\t<li>" . __('There are no attachments to show.') . "</li>\n";
+ endif;
+ echo "</ul>\n\n";
+
+ echo "<form action='' id='browse-form'><input type='hidden' id='nonce-value' value='" . wp_create_nonce( 'inlineuploading' ) . "' /></form>\n";
+ break;
+ endswitch;
+
+ extract($old_vars);
+}
+
+
+function wp_upload_tab_browse_action() {
+ global $style;
+ if ( 'inline' == $style )
+ 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 "<link rel='stylesheet' href='" . get_option('siteurl') . '/wp-admin/upload.css?version=' . get_bloginfo('version') . "' type='text/css' />\n";
+ if ( 'rtl' == $wp_locale->text_direction )
+ echo "<link rel='stylesheet' href='" . get_option('siteurl') . '/wp-admin/upload-rtl.css?version=' . get_bloginfo('version') . "' type='text/css' />\n";
+ if ( 'inline' == @$_GET['style'] ) {
+ echo "<style type='text/css'>\n";
+ echo "\tbody { height: 14em; overflow: hidden; }\n";
+ echo "\t#upload-content { overflow-y: auto; }\n";
+ echo "\t#upload-file { position: absolute; }\n";
+ echo "</style>";
+ }
+}
+
diff --git a/wp-admin/upload-js.php b/wp-admin/upload-js.php
new file mode 100644
index 0000000..c7b27aa
--- /dev/null
+++ b/wp-admin/upload-js.php
@@ -0,0 +1,242 @@
+<?php require_once('admin.php'); cache_javascript_headers(); ?>
+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[ 'inline' == theFileList.style ? 'imageView' : 'editView' ](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 += "<div id='upload-file'>"
+ h += "<div id='file-title'>"
+ if ( !this.currentImage.thumb )
+ h += "<h2><a href='" + this.currentImage.src + "' title='Direct link to file'>" + this.currentImage.title + "</a></h2>";
+ else
+ h += "<h2>" + this.currentImage.title + "</h2>";
+ h += "<span>[&nbsp;";
+ h += "<a href='#' onclick='theFileList.editView(" + id + ")'>edit</a>"
+ h += '&nbsp;|&nbsp;';
+ if ( this.ID ) {
+ var params = $H(this.params);
+ params.ID = '';
+ params.action = '';
+ h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "' title='Browse your files'>cancel</a>";
+ } else {
+ h += "<a href='#' onclick='theFileList.cancelView()' title='Browse your files'>cancel</a>";
+ }
+ h += "&nbsp;]</span>";
+ h += '</div>'
+ h += "<div id='upload-file-view' class='alignleft'>";
+ if ( this.currentImage.thumb )
+ h += "<a href='" + this.currentImage.src + "' title='Direct link to file'><img src='" + this.currentImage.thumb + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' /></a>";
+ else
+ h += '&nbsp;';
+ h += "</div>";
+
+ h += "<form name='uploadoptions' id='uploadoptions' class='alignleft'>";
+ h += "<table>";
+ if ( this.currentImage.thumb ) {
+ h += "<tr><th style='padding-bottom:.5em'>Show</th><td style='padding-bottom:.5em'>";
+ h += "<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' checked='checked' /> thumbnail</label><br />";
+ h += "<label for='display-full'><input type='radio' name='display' id='display-full' value='full' /> full size</label>";
+ h += "</td></tr>";
+ }
+
+ h += "<tr><th>Link</th><td>";
+ h += "<label for='link-file'><input type='radio' name='link' id='link-file' value='file' checked='checked'/> file</label><br />";
+ h += "<label for='link-page'><input type='radio' name='link' id='link-page' value='page' /> page</label><br />";
+ h += "<label for='link-none'><input type='radio' name='link' id='link-none' value='none' /> none</label>";
+ h += "</td></tr>";
+
+ h += "<tr><td colspan='2'>";
+ h += "<input type='button' class='button' name='send' onclick='theFileList.sendToEditor(" + id + ")' value='Send to editor &raquo;' />";
+ h += "</td></tr></table>";
+ h += "</form>";
+
+ h += "</div>";
+
+ new Insertion.Top('upload-content', h);
+ if (e) Event.stop(e);
+ return false;
+ },
+
+ editView: function(id, e) {
+ this.prepView(id);
+ var h = '';
+
+ var action = 'upload.php?style=' + this.style + '&amp;tab=upload';
+ if ( this.postID )
+ action += '&amp;post_id=' + this.postID;
+ h += "<form id='upload-file' method='post' action='" + action + "'>";
+ h += "<div id='file-title'>"
+ if ( !this.currentImage.thumb )
+ h += "<h2><a href='" + this.currentImage.src + "' title='Direct link to file'>" + this.currentImage.title + "</a></h2>";
+ else
+ h += "<h2>" + this.currentImage.title + "</h2>";
+ h += "<span>[&nbsp;";
+ h += "<a href='#' onclick='theFileList.imageView(" + id + ")'>options</a>"
+ h += '&nbsp;|&nbsp;';
+ if ( this.ID ) {
+ var params = $H(this.params);
+ params.ID = '';
+ params.action = '';
+ h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "' title='Browse your files'>cancel</a>";
+ } else {
+ h += "<a href='#' onclick='theFileList.cancelView()' title='Browse your files'>cancel</a>";
+ }
+ h += "&nbsp;]</span>";
+ h += '</div>'
+ h += "<div id='upload-file-view' class='alignleft'>";
+ if ( this.currentImage.thumb )
+ h += "<a href='" + this.currentImage.src + "' title='Direct link to file'><img src='" + this.currentImage.thumb + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' /></a>";
+ else
+ h += '&nbsp;';
+ h += "</div>";
+
+
+ h += "<table><tr>"
+ h += "<th scope='row'><label for='post_title'>Title:</label></th>";
+ h += "<td><input type='text' id='post_title' name='post_title' value='" + this.currentImage.title + "' /></td>";
+ h += "</tr><tr>";
+ h += "<th scope='row'><label for='post_content'>Description:</label></th>";
+ h += "<td><textarea name='post_content' id='post_content'>" + this.currentImage.description + "</textarea></td>";
+ h += "</tr><tr id='buttons'><th></th><td>";
+ h += "<input type='hidden' name='from_tab' value='" + this.tab + "' />";
+ h += "<input type='hidden' name='action' id='action-value' value='save' />";
+ h += "<input type='hidden' name='ID' value='" + id + "' />";
+ h += "<input type='hidden' name='_wpnonce' value='" + this.nonce + "' />";
+ h += "<div class='submit'><input type='submit' value='Save' />";
+ h += "<input type='button' name='delete' class='delete' value='Delete' onclick='theFileList.deleteFile(" + id + ");' />";
+ h += "</div></td></tr></table></form>";
+
+ 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();
+ var navEl = $('current-tab-nav');
+ if ( navEl )
+ navEl.hide();
+ this.grabImageData(id);
+ },
+
+ cancelView: function( prep ) {
+ if ( !prep ) {
+ var filesEl = $('upload-files');
+ if ( filesEl )
+ filesEl.show();
+ var navEl = $('current-tab-nav');
+ if ( navEl )
+ navEl.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 += "<a href='" + ( 'file' == link ? this.currentImage.src : this.currentImage.page ) + "' title='" + this.currentImage.title + "'>";
+ if ( display )
+ h += "<img src='" + ( 'thumb' == display ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' />";
+ else
+ h += this.currentImage.title;
+ if ( 'none' != link )
+ h += "</a>";
+
+ 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 0000000..b7bb3ae
--- /dev/null
+++ b/wp-admin/upload-rtl.css
@@ -0,0 +1,22 @@
+body { font: 13px Tahoma, "Lucida Grande", "Lucida Sans Unicode", Verdana; }
+
+#upload-menu li { margin: 0 .75em 0 0; }
+
+#upload-menu .current div {
+ border-right: 0;
+ border-left: 2px solid #448abd;
+}
+
+#upload-file-view { 0 15px 0 0 }
+
+#file-title { margin: 0 15px .2em 0; }
+
+h2 { margin: 0 0 0 .2em; }
+
+#upload-files li { margin: 0 15px 15px 0; }
+
+table { float: right; }
+
+#the-attachment-links { float: left; }
+
+#th { text-align: left; }
diff --git a/wp-admin/upload.css b/wp-admin/upload.css
new file mode 100644
index 0000000..485c6b7
--- /dev/null
+++ b/wp-admin/upload.css
@@ -0,0 +1,137 @@
+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 li div {
+ color: #000;
+ padding: 5px;
+ border-top: 3px solid #fff;
+}
+
+#upload-menu li a {
+ color: #000;
+ text-decoration: none;
+ border-bottom: none;
+}
+
+#upload-menu li span a.page-numbers { color: #00019b; }
+
+#upload-menu .current div {
+ background: #dfe8f1;
+ border-right: 2px solid #448abd;
+}
+
+#upload-menu div: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;
+}
+
+form#upload-file input, form#upload-file textarea, div#upload-content.upload table { width: 100%; }
+
+form#upload-file div.submit input { width: auto; }
+
+#upload-file-view { padding: 0 0 0 15px; }
+
+#file-title {
+ margin: 0 0 .2em 15px;
+ padding: 0;
+ display: block;
+}
+
+h2 {
+ margin: 0 .2em 0 0;
+ padding: 0;
+ display: inline;
+ border: none;
+ color: #000;
+ 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, #upload-file-view a, a.file-link {
+ border: none;
+ text-decoration: none;
+}
+
+#upload-file-view a img { padding-bottom: .2em; border-bottom: 1px solid #6699CC; }
+
+#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; padding: 0 15px; }
+
+table {
+ float: left;
+ margin: 0;
+ padding: 0;
+}
+
+th { text-align: right; vertical-align: text-top; }
+
+tr, td, th {
+ margin-top: 0;
+ padding-top: 0;
+}
diff --git a/wp-admin/upload.php b/wp-admin/upload.php
new file mode 100644
index 0000000..2293b8a
--- /dev/null
+++ b/wp-admin/upload.php
@@ -0,0 +1,125 @@
+<?php
+require_once('admin.php');
+
+@header('Content-type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
+
+if (!current_user_can('upload_files'))
+ wp_die(__('You do not have permission to upload files.'));
+
+wp_reset_vars(array('action', 'tab', 'from_tab', 'style', 'post_id', 'ID', 'paged', 'post_title', 'post_content', 'delete'));
+
+require_once('upload-functions.php');
+if ( !$tab )
+ $tab = 'browse-all';
+
+do_action( "upload_files_$tab" );
+
+$pid = 0;
+if ( $post_id < 0 )
+ $pid = $post_id;
+elseif ( get_post( $post_id ) )
+ $pid = $post_id;
+$wp_upload_tabs = array();
+$all_atts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'attachment'");
+$post_atts = 0;
+
+if ( $pid ) {
+ // 0 => tab display name, 1 => required cap, 2 => function that produces tab content, 3 => total number objects OR array(total, objects per page), 4 => add_query_args
+ $wp_upload_tabs['upload'] = array(__('Upload'), 'upload_files', 'wp_upload_tab_upload', 0);
+ 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", $action ? 0 : $post_atts);
+ if ( $post_atts < $all_atts )
+ $wp_upload_tabs['browse-all'] = array(__('Browse All'), 'upload_files', 'wp_upload_tab_browse', $action ? 0 : $all_atts);
+} else
+ $wp_upload_tabs['browse-all'] = array(__('Browse All'), 'upload_files', 'wp_upload_tab_browse', $action ? 0 : $all_atts);
+
+ $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"));
+ }
+}
+
+if ( 'inline' == $style ) : ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
+<head>
+<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
+<title><?php bloginfo('name') ?> &rsaquo; <?php _e('Uploads'); ?> &#8212; WordPress</title>
+<link rel="stylesheet" href="<?php echo get_option('siteurl') ?>/wp-admin/wp-admin.css?version=<?php bloginfo('version'); ?>" type="text/css" />
+<?php if ( ('rtl' == $wp_locale->text_direction) ) : ?>
+<link rel="stylesheet" href="<?php echo get_option('siteurl') ?>/wp-admin/rtl.css?version=<?php bloginfo('version'); ?>" type="text/css" />
+<?php endif; ?>
+<script type="text/javascript">
+//<![CDATA[
+function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}else{ var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}
+//]]>
+</script>
+<?php do_action('admin_print_scripts'); wp_upload_admin_head(); ?>
+</head>
+<body>
+<?php
+else :
+ add_action( 'admin_head', 'wp_upload_admin_head' );
+ include_once('admin-header.php');
+endif;
+
+echo "<ul id='upload-menu'>\n";
+foreach ( $wp_upload_tabs as $t => $tab_array ) { // We've already done the current_user_can check
+ $class = 'upload-tab';
+ $href = add_query_arg( array('tab' => $t, 'ID' => '', 'action' => '', 'paged' => '') );
+ if ( isset($tab_array[4]) && is_array($tab_array[4]) )
+ add_query_arg( $tab_array[4], $href );
+ $_href = wp_specialchars( $href, 1 );
+ $page_links = '';
+ if ( $tab == $t ) {
+ $class .= ' current';
+ if ( $tab_array[3] ) {
+ if ( is_array($tab_array[3]) ) {
+ $total = $tab_array[3][0];
+ $per = $tab_array[3][1];
+ } else {
+ $total = $tab_array[3];
+ $per = 10;
+ }
+ $page_links = paginate_links( array(
+ 'base' => add_query_arg( 'paged', '%#%' ),
+ 'format' => '',
+ 'total' => ceil($total / $per),
+ 'current' => $paged ? $paged : 1,
+ 'prev_text' => '&laquo;',
+ 'next_text' => '&raquo;'
+ ));
+ if ( $page_links )
+ $page_links = "<span id='current-tab-nav'>: $page_links</span>";
+ }
+ }
+
+ echo "\t<li class='$class alignleft'><div><a href='$_href' title='{$tab_array[0]}'>{$tab_array[0]}</a>$page_links</div></li>\n";
+}
+unset($t, $tab_array, $href, $_href, $page_links, $total, $per, $class);
+echo "</ul>\n\n";
+
+echo "<div id='upload-content' class='$tab'>\n";
+
+call_user_func( $wp_upload_tabs[$tab][2] );
+
+echo "</div>\n";
+
+if ( 'inline' != $style ) :
+ include_once('admin-footer.php');
+else : ?>
+<script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>
+
+</body>
+</html>
+<?php endif; ?>
diff --git a/wp-admin/users.php b/wp-admin/users.php
index f0277b0..45f7156 100644
--- a/wp-admin/users.php
+++ b/wp-admin/users.php
@@ -84,15 +84,15 @@ class WP_User_Search {
function do_paging() {
if ( $this->total_users_for_query > $this->users_per_page ) { // have to page the results
- $prev_page = ( $this->page > 1) ? true : false;
- $next_page = ( ($this->page * $this->users_per_page) < $this->total_users_for_query ) ? true : false;
- $this->paging_text = '';
- if ( $prev_page )
- $this->paging_text .= '<p class="alignleft"><a href="' . add_query_arg(array('usersearch' => $this->search_term, 'userspage' => $this->page - 1), 'users.php?') . '">&laquo; Previous Page</a></p>';
- if ( $next_page )
- $this->paging_text .= '<p class="alignright"><a href="' . add_query_arg(array('usersearch' => $this->search_term, 'userspage' => $this->page + 1), 'users.php?') . '">Next Page &raquo;</a></p>';
- if ( $prev_page || $next_page )
- $this->paging_text .= '<br style="clear:both" />';
+ $this->paging_text = paginate_links( array(
+ 'total' => ceil($this->total_users_for_query / $this->users_per_page),
+ 'current' => $this->page,
+ 'prev_text' => '&laquo; Previous Page',
+ 'next_text' => 'Next Page &raquo;',
+ 'base' => 'users.php?%_%',
+ 'format' => 'userspage=%#%',
+ 'add_args' => array( 'usersearch' => urlencode($this->search_term) )
+ ) );
}
}
@@ -497,7 +497,7 @@ default:
<table class="widefat">
<?php
foreach($roleclasses as $role => $roleclass) {
- ksort($roleclass);
+ uksort($roleclass, "strnatcasecmp");
?>
<tr>
diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css
index a4420cc..f8e6351 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;*/
}
@@ -400,6 +400,10 @@ table .vers {
text-align: center;
}
+textarea.all-options, input.all-options {
+ width: 250px;
+}
+
#adminmenu {
background: #83B4D8;
border-top: 3px solid #448abd;
@@ -589,11 +593,10 @@ input.delete:hover {
#login {
position: relative;
- background: url('images/login-bkg-tile.gif') no-repeat top center #fbfbfb;
+ background: url('images/login-bkg-tile.gif') no-repeat top center;
color: #fff;
- /* height: 430px; */
margin: 5em auto;
- padding: 45px 50px 0;
+ padding: 20px 50px 0;
width: 325px;
}
@@ -607,6 +610,11 @@ input.delete:hover {
text-align: center;
}
+#login #login_error a {
+ color: #ebcd4e;
+ border-color: #ebcd4e;
+}
+
#login #send {
color: #fff;
text-align: left;
@@ -614,20 +622,27 @@ input.delete:hover {
font-size: 1.1em;
}
-#login h1 {
- margin: 0 auto;
- padding-bottom: 10px;
- left: 137px;
- height: 75px;
- width: 75px;
-}
-
#login h1 a {
+ margin: 0 auto;
+ height: 88px;
+ width: 320px;
display: block;
- text-indent: -9999px;
border-bottom: none;
}
+#login .hide {
+ display: none;
+}
+
+#login .message {
+ font-size: 10pt;
+ text-align: center;
+}
+
+#login .register {
+ font-size: 20px;
+}
+
#login input {
padding: 4px;
}
@@ -636,21 +651,21 @@ input.delete:hover {
background: url('images/login-bkg-bottom.gif') no-repeat bottom center;
list-style: none;
margin: 0 -50px;
- padding: 0 50px 5px;
+ padding: 10px 50px 25px;;
}
#login ul:after {
- content: ".";
- display: block;
- height: 0;
- clear: both;
- visibility: hidden;
+ content: ".";
+ display: block;
+ height: 0;
+ clear: both;
+ visibility: hidden;
}
#login ul li {
float: left;
- font-size: 11px;
- padding: 15px 0;
+ font-size: 12px;
+ padding: 5px 0;
text-align: center;
}
@@ -669,7 +684,7 @@ input.delete:hover {
color: #fff;
}
-#login #log, #pwd, #user_login, #email {
+#login .input {
font-size: 1.8em;
margin-top: 3px;
width: 97%;
@@ -681,7 +696,11 @@ input.delete:hover {
#login #submit {
margin: 0;
- font-size: 1.2em;
+ font-size: 15px;
+}
+
+#login .fullwidth {
+ width: 320px;
}
#searchform {
diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php
index c6d1e45..e2a8c69 100644
--- a/wp-includes/category-template.php
+++ b/wp-includes/category-template.php
@@ -4,6 +4,8 @@ function get_category_children($id, $before = '/', $after = '') {
if ( 0 == $id )
return '';
+ $chain = '';
+
$cat_ids = get_all_category_ids();
foreach ( $cat_ids as $cat_id ) {
if ( $cat_id == $id)
diff --git a/wp-includes/classes.php b/wp-includes/classes.php
index 6d5fec7..aa19f3c 100644
--- a/wp-includes/classes.php
+++ b/wp-includes/classes.php
@@ -171,6 +171,8 @@ class WP {
nocache_headers();
if ( !empty($this->query_vars['error']) && '404' == $this->query_vars['error'] ) {
status_header( 404 );
+ if ( !is_user_logged_in() )
+ nocache_headers();
@header('Content-type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
} else if ( empty($this->query_vars['feed']) ) {
@header('Content-type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
@@ -260,6 +262,7 @@ class WP {
if ( (0 == count($wp_query->posts)) && !is_404() && !is_search() && ( $this->did_permalink || (!empty($_SERVER['QUERY_STRING']) && (false === strpos($_SERVER['REQUEST_URI'], '?'))) ) ) {
$wp_query->set_404();
status_header( 404 );
+ nocache_headers();
} elseif( is_404() != true ) {
status_header( 200 );
}
diff --git a/wp-includes/comment.php b/wp-includes/comment.php
index 6ffcfcc..e77f483 100644
--- a/wp-includes/comment.php
+++ b/wp-includes/comment.php
@@ -5,7 +5,7 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $
if (1 == get_option('comment_moderation')) return false; // If moderation is set to manual
- if ( (count(explode('http:', $comment)) - 1) >= get_option('comment_max_links') )
+ if ( preg_match_all("|(href\t*?=\t*?['\"]?)?(https?:)?//|i", $comment, $out) >= get_option('comment_max_links') )
return false; // Check # of external links
$mod_keys = trim( get_option('moderation_keys') );
@@ -173,8 +173,6 @@ function wp_allow_comment($commentdata) {
global $wpdb;
extract($commentdata);
- $comment_user_domain = apply_filters('pre_comment_user_domain', gethostbyaddr($comment_author_IP) );
-
// Simple duplicate check
$dupe = "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = '$comment_post_ID' AND ( comment_author = '$comment_author' ";
if ( $comment_author_email )
diff --git a/wp-includes/cron.php b/wp-includes/cron.php
index dd72d82..6731e70 100644
--- a/wp-includes/cron.php
+++ b/wp-includes/cron.php
@@ -5,7 +5,7 @@ function wp_schedule_single_event( $timestamp, $hook ) {
$crons = _get_cron_array();
$key = md5(serialize($args));
$crons[$timestamp][$hook][$key] = array( 'schedule' => false, 'args' => $args );
- ksort( $crons );
+ uksort( $crons, "strnatcasecmp" );
_set_cron_array( $crons );
}
@@ -17,7 +17,7 @@ function wp_schedule_event( $timestamp, $recurrence, $hook ) {
if ( !isset( $schedules[$recurrence] ) )
return false;
$crons[$timestamp][$hook][$key] = array( 'schedule' => $recurrence, 'args' => $args, 'interval' => $schedules[$recurrence]['interval'] );
- ksort( $crons );
+ uksort( $crons, "strnatcasecmp" );
_set_cron_array( $crons );
}
diff --git a/wp-includes/feed.php b/wp-includes/feed.php
index 7c3ce30..9068eb3 100644
--- a/wp-includes/feed.php
+++ b/wp-includes/feed.php
@@ -134,9 +134,9 @@ function get_the_category_rss($type = 'rss') {
foreach ($categories as $category) {
$category->cat_name = convert_chars($category->cat_name);
if ('rdf' == $type) {
- $the_list .= "\n\t<dc:subject>$category->cat_name</dc:subject>";
+ $the_list .= "\n\t\t<dc:subject>$category->cat_name</dc:subject>\n";
} else {
- $the_list .= "\n\t<category>$category->cat_name</category>";
+ $the_list .= "\n\t\t<category>$category->cat_name</category>\n";
}
}
return apply_filters('the_category_rss', $the_list, $type);
diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php
index 6094dcb..d153fb9 100644
--- a/wp-includes/formatting.php
+++ b/wp-includes/formatting.php
@@ -1,6 +1,7 @@
<?php
function wptexturize($text) {
+ global $wp_cockneyreplace;
$output = '';
// Capture tags and everything inside them
$textarr = preg_split("/(<.*>)/Us", $text, -1, PREG_SPLIT_DELIM_CAPTURE);
@@ -16,9 +17,15 @@ function wptexturize($text) {
$curl = str_replace('...', '&#8230;', $curl);
$curl = str_replace('``', '&#8220;', $curl);
- // This is a hack, look at this more later. It works pretty well though.
- $cockney = array("'tain't","'twere","'twas","'tis","'twill","'til","'bout","'nuff","'round","'cause");
- $cockneyreplace = array("&#8217;tain&#8217;t","&#8217;twere","&#8217;twas","&#8217;tis","&#8217;twill","&#8217;til","&#8217;bout","&#8217;nuff","&#8217;round","&#8217;cause");
+ // if a plugin has provided an autocorrect array, use it
+ if ( isset($wp_cockneyreplace) ) {
+ $cockney = array_keys($wp_cockneyreplace);
+ $cockney_replace = array_values($wp_cockneyreplace);
+ } else {
+ $cockney = array("'tain't","'twere","'twas","'tis","'twill","'til","'bout","'nuff","'round","'cause");
+ $cockneyreplace = array("&#8217;tain&#8217;t","&#8217;twere","&#8217;twas","&#8217;tis","&#8217;twill","&#8217;til","&#8217;bout","&#8217;nuff","&#8217;round","&#8217;cause");
+ }
+
$curl = str_replace($cockney, $cockneyreplace, $curl);
$curl = preg_replace("/'s/", '&#8217;s', $curl);
@@ -249,7 +256,9 @@ function remove_accents($string) {
chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z',
chr(197).chr(190) => 'z', chr(197).chr(191) => 's',
// Euro Sign
- chr(226).chr(130).chr(172) => 'E');
+ chr(226).chr(130).chr(172) => 'E',
+ // GBP (Pound) Sign
+ chr(194).chr(163) => '');
$string = strtr($string, $chars);
} else {
@@ -613,7 +622,7 @@ function convert_smilies($text) {
for ($i = 0; $i < $stop; $i++) {
$content = $textarr[$i];
if ((strlen($content) > 0) && ('<' != $content{0})) { // If it's not a tag
- $content = str_replace($wp_smiliessearch, $wp_smiliesreplace, $content);
+ $content = preg_replace($wp_smiliessearch, $wp_smiliesreplace, $content);
}
$output .= $content;
}
diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php
index 2cb5c02..ab68a5d 100644
--- a/wp-includes/general-template.php
+++ b/wp-includes/general-template.php
@@ -40,7 +40,7 @@ function wp_register( $before = '<li>', $after = '</li>' ) {
if ( ! is_user_logged_in() ) {
if ( get_option('users_can_register') )
- $link = $before . '<a href="' . get_option('siteurl') . '/wp-register.php">' . __('Register') . '</a>' . $after;
+ $link = $before . '<a href="' . get_option('siteurl') . '/wp-login.php?action=register">' . __('Register') . '</a>' . $after;
else
$link = '';
} else {
@@ -154,6 +154,7 @@ function wp_title($sep = '&raquo;', $display = true) {
$category_name = get_query_var('category_name');
$author = get_query_var('author');
$author_name = get_query_var('author_name');
+ $title = '';
// If there's a category
if ( !empty($cat) ) {
@@ -259,13 +260,17 @@ function single_month_title($prefix = '', $display = true ) {
$my_month = $wp_locale->get_month($monthnum);
} elseif ( !empty($m) ) {
$my_year = substr($m, 0, 4);
- $my_month = $wp_locale->get_month($m);
+ $my_month = $wp_locale->get_month(substr($m, 4, 2));
}
- if ( !empty($my_month) && $display )
- echo $prefix . $my_month . $prefix . $my_year;
- else
- return $monthnum;
+ if ( empty($my_month) )
+ return false;
+
+ $result = $prefix . $my_month . $prefix . $my_year;
+
+ if ( !$display )
+ return $result;
+ echo $result;
}
@@ -772,7 +777,7 @@ function the_editor($content, $id = 'content', $prev_id = 'title') {
</style>
<div id='edButtons' style='display:none;'>
<div class='zerosize'><input accesskey='e' type='button' onclick='switchEditors("<?php echo $id; ?>")' /></div>
- <input id='edButtonPreview' class='edButtonFore' type='button' value='<?php _e('Compose'); ?>' />
+ <input id='edButtonPreview' class='edButtonFore' type='button' value='<?php _e('Editor'); ?>' />
<input id='edButtonHTML' class='edButtonBack' type='button' value='<?php _e('HTML'); ?>' onclick='switchEditors("<?php echo $id; ?>")' />
</div>
<script type="text/javascript">
@@ -878,4 +883,87 @@ function language_attributes() {
echo $output;
}
+
+function paginate_links( $arg = '' ) {
+ if ( is_array($arg) )
+ $a = &$arg;
+ else
+ parse_str($arg, $a);
+
+ // Defaults
+ $base = '%_%'; // http://example.com/all_posts.php%_% : %_% is replaced by format (below)
+ $format = '?page=%#%'; // ?page=%#% : %#% is replaced by the page number
+ $total = 1;
+ $current = 0;
+ $show_all = false;
+ $prev_next = true;
+ $prev_text = __('&laquo; Previous');
+ $next_text = __('Next &raquo;');
+ $end_size = 1; // How many numbers on either end including the end
+ $mid_size = 2; // How many numbers to either side of current not including current
+ $type = 'plain';
+ $add_args = false; // array of query args to aadd
+
+ extract($a);
+
+ // Who knows what else people pass in $args
+ $total = (int) $total;
+ if ( $total < 2 )
+ return;
+ $current = (int) $current;
+ $end_size = 0 < (int) $end_size ? (int) $end_size : 1; // Out of bounds? Make it the default.
+ $mid_size = 0 <= (int) $mid_size ? (int) $mid_size : 2;
+ $add_args = is_array($add_args) ? $add_args : false;
+ $r = '';
+ $page_links = array();
+ $n = 0;
+ $dots = false;
+
+ if ( $prev_next && $current && 1 < $current ) :
+ $link = str_replace('%_%', 2 == $current ? '' : $format, $base);
+ $link = str_replace('%#%', $current - 1, $link);
+ if ( $add_args )
+ $link = add_query_arg( $add_args, $link );
+ $page_links[] = "<a class='prev page-numbers' href='" . wp_specialchars( $link, 1 ) . "'>$prev_text</a>";
+ endif;
+ for ( $n = 1; $n <= $total; $n++ ) :
+ if ( $n == $current ) :
+ $page_links[] = "<span class='page-numbers current'>$n</span>";
+ $dots = true;
+ else :
+ if ( $show_all || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) :
+ $link = str_replace('%_%', 1 == $n ? '' : $format, $base);
+ $link = str_replace('%#%', $n, $link);
+ if ( $add_args )
+ $link = add_query_arg( $add_args, $link );
+ $page_links[] = "<a class='page-numbers' href='" . wp_specialchars( $link, 1 ) . "'>$n</a>";
+ $dots = true;
+ elseif ( $dots && !$show_all ) :
+ $page_links[] = "<span class='page-numbers dots'>...</span>";
+ $dots = false;
+ endif;
+ endif;
+ endfor;
+ if ( $prev_next && $current && ( $current < $total || -1 == $total ) ) :
+ $link = str_replace('%_%', $format, $base);
+ $link = str_replace('%#%', $current + 1, $link);
+ if ( $add_args )
+ $link = add_query_arg( $add_args, $link );
+ $page_links[] = "<a class='next page-numbers' href='" . wp_specialchars( $link, 1 ) . "'>$next_text</a>";
+ endif;
+ switch ( $type ) :
+ case 'array' :
+ return $page_links;
+ break;
+ case 'list' :
+ $r .= "<ul class='page-numbers'>\n\t<li>";
+ $r .= join("</li>\n\t<li>", $page_links);
+ $r .= "</li>\n</ul>\n";
+ break;
+ default :
+ $r = join("\n", $page_links);
+ break;
+ endswitch;
+ return $r;
+}
?>
diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php
index 78e789f..3526f5c 100644
--- a/wp-includes/link-template.php
+++ b/wp-includes/link-template.php
@@ -476,7 +476,7 @@ function _max_num_pages() {
global $wpdb, $wp_query;
if (isset($max_num_pages)) return $max_num_pages;
- $posts_per = (int) get_option('posts_per_page');
+ $posts_per = get_query_var('posts_per_page');
if ( empty($posts_per) ) $posts_per = 1;
if ( 'posts' == get_query_var('what_to_show') ) {
diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php
index 71e28fa..afd5c59 100644
--- a/wp-includes/pluggable.php
+++ b/wp-includes/pluggable.php
@@ -184,7 +184,7 @@ function wp_login($username, $password, $already_md5 = false) {
return false;
if ( '' == $password ) {
- $error = __('<strong>Error</strong>: The password field is empty.');
+ $error = __('<strong>ERROR</strong>: The password field is empty.');
return false;
}
@@ -192,7 +192,7 @@ function wp_login($username, $password, $already_md5 = false) {
//$login = $wpdb->get_row("SELECT ID, user_login, user_pass FROM $wpdb->users WHERE user_login = '$username'");
if (!$login) {
- $error = __('<strong>Error</strong>: Wrong username.');
+ $error = __('<strong>ERROR</strong>: Invalid username.');
return false;
} else {
// If the password is already_md5, it has been double hashed.
@@ -200,7 +200,7 @@ function wp_login($username, $password, $already_md5 = false) {
if ( ($already_md5 && md5($login->user_pass) == $password) || ($login->user_login == $username && $login->user_pass == md5($password)) ) {
return true;
} else {
- $error = __('<strong>Error</strong>: Incorrect password.');
+ $error = __('<strong>ERROR</strong>: Incorrect password.');
$pwd = '';
return false;
}
@@ -343,7 +343,7 @@ function wp_notify_postauthor($comment_id, $comment_type='') {
if ('' == $user->user_email) return false; // If there's no email to send the comment to
- $comment_author_domain = gethostbyaddr($comment->comment_author_IP);
+ $comment_author_domain = @gethostbyaddr($comment->comment_author_IP);
$blogname = get_option('blogname');
@@ -421,7 +421,7 @@ function wp_notify_moderator($comment_id) {
$comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1");
$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID='$comment->comment_post_ID' LIMIT 1");
- $comment_author_domain = gethostbyaddr($comment->comment_author_IP);
+ $comment_author_domain = @gethostbyaddr($comment->comment_author_IP);
$comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'");
$notify_message = sprintf( __('A new comment on the post #%1$s "%2$s" is waiting for your approval'), $post->ID, $post->post_title ) . "\r\n";
diff --git a/wp-includes/plugin.php b/wp-includes/plugin.php
index 365a6f8..cac0897 100644
--- a/wp-includes/plugin.php
+++ b/wp-includes/plugin.php
@@ -70,7 +70,7 @@ function merge_filters($tag) {
}
if ( isset($wp_filter[$tag]) )
- ksort( $wp_filter[$tag] );
+ uksort( $wp_filter[$tag], "strnatcasecmp" );
}
diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php
index f0d1eab..7f84916 100644
--- a/wp-includes/post-template.php
+++ b/wp-includes/post-template.php
@@ -99,7 +99,7 @@ function get_the_content($more_link_text = '(more...)', $stripteaser = 0, $more_
} else {
$output = balanceTags($output);
if ( ! empty($more_link_text) )
- $output .= ' <a href="'. get_permalink() . "#more-$id\">$more_link_text</a>";
+ $output .= ' <a href="'. get_permalink() . "#more-$id\" class=\"more-link\">$more_link_text</a>";
}
}
diff --git a/wp-includes/rewrite.php b/wp-includes/rewrite.php
index 6f34b57..571f0c0 100644
--- a/wp-includes/rewrite.php
+++ b/wp-includes/rewrite.php
@@ -316,6 +316,7 @@ class WP_Rewrite {
$front = $front . 'date/';
break;
}
+ $tok_index++;
}
$this->date_structure = $front . $date_endian;
diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php
index 6d069c6..cf790ab 100644
--- a/wp-includes/script-loader.php
+++ b/wp-includes/script-loader.php
@@ -15,15 +15,17 @@ class WP_Scripts {
$this->add( 'sack', '/wp-includes/js/tw-sack.js', false, '1.6.1' );
$this->add( 'quicktags', '/wp-includes/js/quicktags.js', false, '3517' );
$this->add( 'colorpicker', '/wp-includes/js/colorpicker.js', false, '3517' );
- $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '09212006' );
- $this->add( 'wp_tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('tiny_mce'), '09212006' );
+ $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '09212006a' );
+ $mce_config = apply_filters('tiny_mce_config_url', '/wp-includes/js/tinymce/tiny_mce_config.php');
+ $this->add( 'wp_tiny_mce', $mce_config, array('tiny_mce'), '09212006' );
$this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.0');
- $this->add( 'autosave', '/wp-includes/js/autosave.js.php', array('prototype', 'sack'), '4206');
+ $this->add( 'autosave', '/wp-includes/js/autosave.js.php', array('prototype', 'sack'), '4211');
$this->add( 'wp-ajax', '/wp-includes/js/wp-ajax-js.php', array('prototype'), '4187');
$this->add( 'listman', '/wp-includes/js/list-manipulation-js.php', array('wp-ajax', 'fat'), '4187');
$this->add( 'scriptaculous', '/wp-includes/js/scriptaculous/scriptaculous.js', array('prototype'), '1.6.1');
$this->add( 'scriptaculous-dragdrop', '/wp-includes/js/scriptaculous/scriptaculous.js?load=builder,dragdrop', array('prototype'), '1.6.1');
$this->add( 'scriptaculous-controls', '/wp-includes/js/scriptaculous/scriptaculous.js?load=controls', array('prototype'), '1.6.1');
+ $this->add( 'cropper', '/wp-content/themes/connections/crop/cropper.js', array('scriptaculous-dragdrop'), '1');
$this->add( 'colorpicker', '/wp-includes/js/colorpicker.js', false, '1');
if ( is_admin() ) {
$this->add( 'dbx-admin-key', '/wp-admin/dbx-admin-key-js.php', array('dbx'), '3651' );
@@ -33,6 +35,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() );
}
}
diff --git a/wp-includes/vars.php b/wp-includes/vars.php
index 62253c1..82c7b10 100644
--- a/wp-includes/vars.php
+++ b/wp-includes/vars.php
@@ -43,7 +43,7 @@ if (!isset($wpsmiliestrans)) {
':arrow:' => 'icon_arrow.gif',
':shock:' => 'icon_eek.gif',
':smile:' => 'icon_smile.gif',
- ' :???:' => 'icon_confused.gif',
+ ':???:' => 'icon_confused.gif',
':cool:' => 'icon_cool.gif',
':evil:' => 'icon_evil.gif',
':grin:' => 'icon_biggrin.gif',
@@ -57,28 +57,28 @@ if (!isset($wpsmiliestrans)) {
':lol:' => 'icon_lol.gif',
':mad:' => 'icon_mad.gif',
':sad:' => 'icon_sad.gif',
- ' 8-)' => 'icon_cool.gif',
- ' 8-O' => 'icon_eek.gif',
- ' :-(' => 'icon_sad.gif',
- ' :-)' => 'icon_smile.gif',
- ' :-?' => 'icon_confused.gif',
- ' :-D' => 'icon_biggrin.gif',
- ' :-P' => 'icon_razz.gif',
- ' :-o' => 'icon_surprised.gif',
- ' :-x' => 'icon_mad.gif',
- ' :-|' => 'icon_neutral.gif',
- ' ;-)' => 'icon_wink.gif',
- ' 8)' => 'icon_cool.gif',
- ' 8O' => 'icon_eek.gif',
- ' :(' => 'icon_sad.gif',
- ' :)' => 'icon_smile.gif',
- ' :?' => 'icon_confused.gif',
- ' :D' => 'icon_biggrin.gif',
- ' :P' => 'icon_razz.gif',
- ' :o' => 'icon_surprised.gif',
- ' :x' => 'icon_mad.gif',
- ' :|' => 'icon_neutral.gif',
- ' ;)' => 'icon_wink.gif',
+ '8-)' => 'icon_cool.gif',
+ '8-O' => 'icon_eek.gif',
+ ':-(' => 'icon_sad.gif',
+ ':-)' => 'icon_smile.gif',
+ ':-?' => 'icon_confused.gif',
+ ':-D' => 'icon_biggrin.gif',
+ ':-P' => 'icon_razz.gif',
+ ':-o' => 'icon_surprised.gif',
+ ':-x' => 'icon_mad.gif',
+ ':-|' => 'icon_neutral.gif',
+ ';-)' => 'icon_wink.gif',
+ '8)' => 'icon_cool.gif',
+ '8O' => 'icon_eek.gif',
+ ':(' => 'icon_sad.gif',
+ ':)' => 'icon_smile.gif',
+ ':?' => 'icon_confused.gif',
+ ':D' => 'icon_biggrin.gif',
+ ':P' => 'icon_razz.gif',
+ ':o' => 'icon_surprised.gif',
+ ':x' => 'icon_mad.gif',
+ ':|' => 'icon_neutral.gif',
+ ';)' => 'icon_wink.gif',
':!:' => 'icon_exclaim.gif',
':?:' => 'icon_question.gif',
);
@@ -87,7 +87,7 @@ if (!isset($wpsmiliestrans)) {
// generates smilies' search & replace arrays
foreach($wpsmiliestrans as $smiley => $img) {
- $wp_smiliessearch[] = $smiley;
+ $wp_smiliessearch[] = '/(\s|^)?'.preg_quote($smiley, '/').'(\b|\s)/';
$smiley_masked = htmlspecialchars( trim($smiley) , ENT_QUOTES);
$wp_smiliesreplace[] = " <img src='" . get_option('siteurl') . "/wp-includes/images/smilies/$img' alt='$smiley_masked' class='wp-smiley' /> ";
}
diff --git a/wp-includes/version.php b/wp-includes/version.php
index fe526ab..49fffa5 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -3,6 +3,6 @@
// This holds the version number in a separate file so we can bump it without cluttering the SVN
$wp_version = 'wordpress-mu-1.0'; // Let's just avoid confusion
-$wp_db_version = 3846;
+$wp_db_version = 3845;
?>
diff --git a/wp-settings.php b/wp-settings.php
index 2ec8823..0b5350d 100644
--- a/wp-settings.php
+++ b/wp-settings.php
@@ -75,9 +75,10 @@ function timer_stop($display = 0, $precision = 3) { //if called like timer_stop(
$mtime = $mtime[1] + $mtime[0];
$timeend = $mtime;
$timetotal = $timeend-$timestart;
+ $r = number_format($timetotal, $precision);
if ( $display )
- echo number_format($timetotal,$precision);
- return $timetotal;
+ echo $r;
+ return $r;
}
timer_start();
diff --git a/xmlrpc.php b/xmlrpc.php
index d878cd4..c937122 100644
--- a/xmlrpc.php
+++ b/xmlrpc.php
@@ -58,31 +58,8 @@ function starify($string) {
return str_repeat('*', $i);
}
-logIO("I", $HTTP_RAW_POST_DATA);
-
-
-function mkdir_p($target) {
- // from php.net/mkdir user contributed notes
- if (file_exists($target)) {
- if (!is_dir($target)) {
- return false;
- } else {
- return true;
- }
- }
-
- // Attempting to create the directory may clutter up our display.
- if (@mkdir($target)) {
- return true;
- }
-
- // If the above failed, attempt to create the parent node, then try again.
- if (mkdir_p(dirname($target))) {
- return mkdir_p($target);
- }
-
- return false;
-}
+if ( isset($HTTP_RAW_POST_DATA) )
+ logIO("I", $HTTP_RAW_POST_DATA);
class wp_xmlrpc_server extends IXR_Server {
@@ -1238,8 +1215,8 @@ class wp_xmlrpc_server extends IXR_Server {
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_content', 'comment_type');
- $comment_ID = wp_new_comment($commentdata);
- do_action('pingback_post', $comment_ID);
+ wp_new_comment($commentdata);
+ do_action('pingback_post', $wpdb->insert_id);
return "Pingback from $pagelinkedfrom to $pagelinkedto registered. Keep the web talking! :-)";
}