summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--wp-admin/admin-ajax.php6
-rw-r--r--wp-admin/admin-functions.php16
-rw-r--r--wp-admin/edit-comments.php4
-rw-r--r--wp-admin/link-manager.php3
-rw-r--r--wp-admin/menu.php5
-rw-r--r--wp-atom.php2
-rw-r--r--wp-includes/cache.php13
-rw-r--r--wp-includes/functions.php6
-rw-r--r--wp-includes/general-template.php4
-rw-r--r--wp-includes/js/autosave-js.php (renamed from wp-includes/js/autosave.js.php)0
-rw-r--r--wp-includes/locale.php16
-rw-r--r--wp-includes/post-template.php7
-rw-r--r--wp-includes/post.php38
-rw-r--r--wp-includes/script-loader.php27
-rw-r--r--wp-includes/wp-db.php22
-rw-r--r--wp-settings.php5
16 files changed, 107 insertions, 67 deletions
diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php
index fdfe5c7..0d94e6b 100644
--- a/wp-admin/admin-ajax.php
+++ b/wp-admin/admin-ajax.php
@@ -19,10 +19,10 @@ function wp_ajax_meta_row( $pid, $mid, $key, $value ) {
$r .= "<tr id='meta-$mid'><td valign='top'>";
$r .= "<input name='meta[$mid][key]' tabindex='6' onkeypress='return killSubmit(\"theList.ajaxUpdater(&#039;meta&#039;,&#039;meta-$mid&#039;);\",event);' type='text' size='20' value='$key' />";
$r .= "</td><td><textarea name='meta[$mid][value]' tabindex='6' rows='2' cols='30'>$value</textarea></td><td align='center'>";
- $r .= "<input name='updatemeta' type='button' class='updatemeta' tabindex='6' value='Update' onclick='return theList.ajaxUpdater(&#039;meta&#039;,&#039;meta-$mid&#039;);' /><br />";
+ $r .= "<input name='updatemeta' type='button' class='updatemeta' tabindex='6' value='".attribute_escape(__('Update'))."' onclick='return theList.ajaxUpdater(&#039;meta&#039;,&#039;meta-$mid&#039;);' /><br />";
$r .= "<input name='deletemeta[$mid]' type='submit' onclick=\"return deleteSomething( 'meta', $mid, '";
- $r .= sprintf(__("You are about to delete the &quot;%s&quot; custom field on this post.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), $key_js);
- $r .= "' );\" class='deletemeta' tabindex='6' value='Delete' /></td></tr>";
+ $r .= js_escape(sprintf(__("You are about to delete the '%s' custom field on this post.\n'OK' to delete, 'Cancel' to stop."), $key_js));
+ $r .= "' );\" class='deletemeta' tabindex='6' value='".attribute_escape(__('Delete'))."' /></td></tr>";
return $r;
}
diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php
index ca4a002..94f6cc8 100644
--- a/wp-admin/admin-functions.php
+++ b/wp-admin/admin-functions.php
@@ -497,7 +497,7 @@ function edit_user( $user_id = 0 ) {
if (!empty ( $pass1 ))
$user->user_pass = $pass1;
- if ( !validate_username( $user->user_login ) )
+ if ( !$update && !validate_username( $user->user_login ) )
$errors->add( 'user_login', __( '<strong>ERROR</strong>: This username is invalid. Please enter a valid username.' ));
if (!$update && username_exists( $user->user_login ))
@@ -600,7 +600,7 @@ function checked( $checked, $current) {
function return_categories_list( $parent = 0 ) {
global $wpdb;
- return $wpdb->get_col( "SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent ORDER BY category_count DESC" );
+ return $wpdb->get_col( "SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent AND ( link_count = 0 OR category_count != 0 ) ORDER BY category_count DESC" );
}
function sort_cats( $cat1, $cat2 ) {
@@ -678,7 +678,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 ORDER BY link_count DESC" );
+ return $wpdb->get_col( "SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent AND (category_count = 0 OR link_count != 0) ORDER BY link_count DESC" );
}
function get_nested_link_categories( $default = 0, $parent = 0 ) {
@@ -760,7 +760,7 @@ function _cat_row( $category, $level, $name_override = false ) {
$default_link_cat_id = get_option( 'default_link_category' );
if ( ($category->cat_ID != $default_cat_id ) && ($category->cat_ID != $default_link_cat_id ) )
- $edit .= "<td><a href='" . wp_nonce_url( "categories.php?action=delete&amp;cat_ID=$category->cat_ID", 'delete-category_' . $category->cat_ID ) . "' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '" . sprintf( __("You are about to delete the category &quot;%s&quot;.\\nAll of its posts will go into the default category of &quot;%s&quot;\\nAll of its bookmarks will go into the default category of &quot;%s&quot;.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop." ), js_escape( $category->cat_name ), js_escape( get_catname( $default_cat_id )), js_escape( get_catname( $default_link_cat_id ) ) ) . "' );\" class='delete'>".__( 'Delete' )."</a>";
+ $edit .= "<td><a href='" . wp_nonce_url( "categories.php?action=delete&amp;cat_ID=$category->cat_ID", 'delete-category_' . $category->cat_ID ) . "' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '" . js_escape(sprintf( __("You are about to delete the category '%s'.\nAll of its posts will go into the default category of '%s'\nAll of its bookmarks will go into the default category of '%s'.\n'OK' to delete, 'Cancel' to stop." ), $category->cat_name, get_catname( $default_cat_id ), get_catname( $default_link_cat_id ) )) . "' );\" class='delete'>".__( 'Delete' )."</a>";
else
$edit .= "<td style='text-align:center'>".__( "Default" );
} else
@@ -808,7 +808,7 @@ function page_rows( $parent = 0, $level = 0, $pages = 0, $hierarchy = true ) {
<td><?php if ( '0000-00-00 00:00:00' ==$post->post_modified ) _e('Unpublished'); else echo mysql2date( 'Y-m-d g:i a', $post->post_modified ); ?></td>
<td><a href="<?php the_permalink(); ?>" rel="permalink" class="edit"><?php _e( 'View' ); ?></a></td>
<td><?php if ( current_user_can( 'edit_page', $id ) ) { echo "<a href='page.php?action=edit&amp;post=$id' class='edit'>" . __( 'Edit' ) . "</a>"; } ?></td>
- <td><?php if ( current_user_can( 'delete_page', $id ) ) { echo "<a href='" . wp_nonce_url( "page.php?action=delete&amp;post=$id", 'delete-page_' . $id ) . "' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . sprintf( __("You are about to delete the &quot;%s&quot; page.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop." ), js_escape( get_the_title() ) ) . "' );\">" . __( 'Delete' ) . "</a>"; } ?></td>
+ <td><?php if ( current_user_can( 'delete_page', $id ) ) { echo "<a href='" . wp_nonce_url( "page.php?action=delete&amp;post=$id", 'delete-page_' . $id ) . "' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . js_escape(sprintf( __("You are about to delete the '%s' page.\n'OK' to delete, 'Cancel' to stop." ), get_the_title() ) ) . "' );\">" . __( 'Delete' ) . "</a>"; } ?></td>
</tr>
<?php
@@ -929,10 +929,10 @@ function list_meta( $meta ) {
$r .= "\n\t<tr id='meta-{$entry['meta_id']}' class='$style'>";
$r .= "\n\t\t<td valign='top'><input name='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' size='20' value='{$entry['meta_key']}' /></td>";
$r .= "\n\t\t<td><textarea name='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>";
- $r .= "\n\t\t<td align='center'><input name='updatemeta' type='submit' class='updatemeta' tabindex='6' value='".__( 'Update' )."' /><br />";
+ $r .= "\n\t\t<td align='center'><input name='updatemeta' type='submit' class='updatemeta' tabindex='6' value='".attribute_escape(__( 'Update' ))."' /><br />";
$r .= "\n\t\t<input name='deletemeta[{$entry['meta_id']}]' type='submit' onclick=\"return deleteSomething( 'meta', {$entry['meta_id']}, '";
- $r .= sprintf( __("You are about to delete the &quot;%s&quot; custom field on this post.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop." ), $key_js );
- $r .= "' );\" class='deletemeta' tabindex='6' value='".__( 'Delete' )."' /></td>";
+ $r .= js_escape(sprintf( __("You are about to delete the '%s' custom field on this post.\n'OK' to delete, 'Cancel' to stop." ), $key_js ) );
+ $r .= "' );\" class='deletemeta' tabindex='6' value='".attribute_escape(__( 'Delete' ))."' /></td>";
$r .= "\n\t</tr>";
}
echo $r;
diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php
index dfa1a23..f7d7a8b 100644
--- a/wp-admin/edit-comments.php
+++ b/wp-admin/edit-comments.php
@@ -157,12 +157,12 @@ $start = " start='$offset'";
<?php
if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
echo " <a href='comment.php?action=editcomment&amp;c=".$comment->comment_ID."'>" . __('Edit') . '</a>';
- echo ' | <a href="' . wp_nonce_url('comment.php?action=deletecomment&amp;p=' . $comment->comment_post_ID . '&amp;c=' . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . '" onclick="return deleteSomething( \'comment\', ' . $comment->comment_ID . ', \'' . js_escape(sprintf(__("You are about to delete this comment by &quot;%s&quot;.\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), $comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> ';
+ echo ' | <a href="' . wp_nonce_url('comment.php?action=deletecomment&amp;p=' . $comment->comment_post_ID . '&amp;c=' . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . '" onclick="return deleteSomething( \'comment\', ' . $comment->comment_ID . ', \'' . js_escape(sprintf(__("You are about to delete this comment by '%s'.\n'Cancel' to stop, 'OK' to delete."), $comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> ';
if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) {
echo '<span class="unapprove"> | <a href="' . wp_nonce_url('comment.php?action=unapprovecomment&amp;p=' . $comment->comment_post_ID . '&amp;c=' . $comment->comment_ID, 'unapprove-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Unapprove') . '</a> </span>';
echo '<span class="approve"> | <a href="' . wp_nonce_url('comment.php?action=approvecomment&amp;p=' . $comment->comment_post_ID . '&amp;c=' . $comment->comment_ID, 'approve-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Approve') . '</a> </span>';
}
- echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&amp;dt=spam&amp;p=" . $comment->comment_post_ID . "&amp;c=" . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to mark as spam this comment by &quot;%s&quot;.\n&quot;Cancel&quot; to stop, &quot;OK&quot; to mark as spam."), $comment->comment_author)) . "', theCommentList );\">" . __('Spam') . "</a> ";
+ echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&amp;dt=spam&amp;p=" . $comment->comment_post_ID . "&amp;c=" . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to mark as spam this comment by '%s'.\n'Cancel' to stop, 'OK' to mark as spam."), $comment->comment_author)) . "', theCommentList );\">" . __('Spam') . "</a> ";
}
$post = get_post($comment->comment_post_ID);
$post_title = wp_specialchars( $post->post_title, 'double' );
diff --git a/wp-admin/link-manager.php b/wp-admin/link-manager.php
index 05b1841..63a2c90 100644
--- a/wp-admin/link-manager.php
+++ b/wp-admin/link-manager.php
@@ -87,6 +87,7 @@ $select_order = "<select name=\"order_by\">\n";
$select_order .= '<option value="order_id"' . (($order_by == 'order_id') ? " selected='selected'" : '') . '>' . __('Link ID') . "</option>\n";
$select_order .= '<option value="order_name"' . (($order_by == 'order_name') ? " selected='selected'" : '') . '>' . __('Name') . "</option>\n";
$select_order .= '<option value="order_url"' . (($order_by == 'order_url') ? " selected='selected'" : '') . '>' . __('Address') . "</option>\n";
+$select_order .= '<option value="order_rating"' . (($order_by == 'order_rating') ? " selected='selected'" : '') . '>' . __('Rating') . "</option>\n";
$select_order .= "</select>\n";
printf(__('Currently showing %1$s links ordered by %2$s'), $select_cat, $select_order);
@@ -175,7 +176,7 @@ if ( $links ) {
break;
case 'action':
echo '<td><a href="link.php?link_id='.$link->link_id.'&amp;action=edit" class="edit">'.__('Edit').'</a></td>';
- echo '<td><a href="' . wp_nonce_url('link.php?link_id='.$link->link_id.'&amp;action=delete', 'delete-bookmark_' . $link->link_id ) . '"'." onclick=\"return deleteSomething( 'link', $link->link_id , '".js_escape(sprintf(__("You are about to delete the &quot;%s&quot; link to %s.\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), $link->link_name, $link->link_url )).'\' );" class="delete">'.__('Delete').'</a></td>';
+ echo '<td><a href="' . wp_nonce_url('link.php?link_id='.$link->link_id.'&amp;action=delete', 'delete-bookmark_' . $link->link_id ) . '"'." onclick=\"return deleteSomething( 'link', $link->link_id , '".js_escape(sprintf(__("You are about to delete the '%s' link to %s.\n'Cancel' to stop, 'OK' to delete."), $link->link_name, $link->link_url )).'\' );" class="delete">'.__('Delete').'</a></td>';
break;
default:
?>
diff --git a/wp-admin/menu.php b/wp-admin/menu.php
index bb82c1f..c12bb70 100644
--- a/wp-admin/menu.php
+++ b/wp-admin/menu.php
@@ -30,6 +30,7 @@ else
$menu[40] = array(__('Options'), 'manage_options', 'options-general.php');
+$_wp_real_parent_file['post.php'] = 'post-new.php'; // Back-compat
$submenu['post-new.php'][5] = array(__('Write Post'), 'edit_posts', 'post-new.php');
$submenu['post-new.php'][10] = array(__('Write Page'), 'edit_pages', 'page-new.php');
@@ -87,14 +88,14 @@ foreach ($submenu as $parent => $sub) {
$_wp_submenu_nopriv[$parent][$data[2]] = true;
}
}
-
+
if ( empty($submenu[$parent]) )
unset($submenu[$parent]);
}
// Loop over the top-level menu.
// Menus for which the original parent is not acessible due to lack of privs will have the next
-// submenu in line be assigned as the new menu parent.
+// submenu in line be assigned as the new menu parent.
foreach ( $menu as $id => $data ) {
if ( empty($submenu[$data[2]]) )
continue;
diff --git a/wp-atom.php b/wp-atom.php
index 0eacfe3..f9d0c9b 100644
--- a/wp-atom.php
+++ b/wp-atom.php
@@ -34,7 +34,7 @@ $more = 1;
<modified><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></modified>
<issued><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></issued>
<?php the_category_rss('rdf') ?>
- <summary type="text/plain" mode="escaped"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary>
+ <summary type="<?php bloginfo('html_type'); ?>" mode="escaped"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary>
<?php if ( !get_option('rss_use_excerpt') ) : ?>
<content type="<?php bloginfo('html_type'); ?>" mode="escaped" xml:base="<?php permalink_single_rss() ?>"><![CDATA[<?php the_content('', 0, '') ?>]]></content>
<?php endif; ?>
diff --git a/wp-includes/cache.php b/wp-includes/cache.php
index 6880624..b4c5b89 100644
--- a/wp-includes/cache.php
+++ b/wp-includes/cache.php
@@ -8,6 +8,8 @@ function wp_cache_add($key, $data, $flag = '', $expire = 0) {
function wp_cache_close() {
global $wp_object_cache;
+ if ( ! isset($wp_object_cache) )
+ return;
return $wp_object_cache->save();
}
@@ -415,8 +417,14 @@ class WP_Object_Cache {
}
function WP_Object_Cache() {
+ return $this->__construct();
+ }
+
+ function __construct() {
global $blog_id;
+ register_shutdown_function(array(&$this, "__destruct"));
+
if (defined('DISABLE_CACHE'))
return;
@@ -451,5 +459,10 @@ class WP_Object_Cache {
$this->blog_id = $this->hash($blog_id);
}
+
+ function __destruct() {
+ $this->save();
+ return true;
+ }
}
?>
diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index 102f12d..4f103e9 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -833,10 +833,10 @@ function status_header( $header ) {
elseif ( 410 == $header )
$text = 'Gone';
- if ( substr(php_sapi_name(), 0, 3) == 'cgi' )
+// if ( substr(php_sapi_name(), 0, 3) == 'cgi' )
@header("HTTP/1.1 $header $text");
- else
- @header("Status: $header $text");
+// else
+// @header("Status: $header $text");
}
function nocache_headers() {
diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php
index 9032c79..69470db 100644
--- a/wp-includes/general-template.php
+++ b/wp-includes/general-template.php
@@ -818,8 +818,10 @@ function the_editor($content, $id = 'content', $prev_id = 'title') {
<input id='edButtonHTML' class='edButtonBack' type='button' value='<?php _e('Code'); ?>' onclick='switchEditors("<?php echo $id; ?>")' />
</div>
<script type="text/javascript">
+ // <![CDATA[
if ( typeof tinyMCE != "undefined" && tinyMCE.configs.length > 0 )
document.getElementById('edButtons').style.display = 'block';
+ // ]]>
</script>
<?php endif; ?>
@@ -828,6 +830,7 @@ function the_editor($content, $id = 'content', $prev_id = 'title') {
<script type="text/javascript">edToolbar()</script>
</div>
<script type="text/javascript">
+ // <![CDATA[
if ( typeof tinyMCE != "undefined" && tinyMCE.configs.length > 0 )
document.getElementById("quicktags").style.display="none";
@@ -854,6 +857,7 @@ function the_editor($content, $id = 'content', $prev_id = 'title') {
myField.focus();
}
}
+ // ]]>
</script>
<?php
diff --git a/wp-includes/js/autosave.js.php b/wp-includes/js/autosave-js.php
index 67fcde7..67fcde7 100644
--- a/wp-includes/js/autosave.js.php
+++ b/wp-includes/js/autosave-js.php
diff --git a/wp-includes/locale.php b/wp-includes/locale.php
index 4b6c654..11903fc 100644
--- a/wp-includes/locale.php
+++ b/wp-includes/locale.php
@@ -87,20 +87,12 @@ class WP_Locale {
$this->meridiem['AM'] = __('AM');
$this->meridiem['PM'] = __('PM');
- $this->_load_locale_data();
- }
-
- function _load_locale_data() {
- $locale = get_locale();
- $locale_file = ABSPATH . "wp-includes/languages/$locale.php";
- if ( !file_exists($locale_file) )
- return;
-
- include($locale_file);
-
+ // Import global locale vars set during inclusion of $locale.php.
foreach ( $this->locale_vars as $var ) {
- $this->$var = $$var;
+ if ( isset($GLOBALS[$var]) )
+ $this->$var = $GLOBALS[$var];
}
+
}
function get_weekday($weekday_number) {
diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php
index 443f0c6..5ecebd9 100644
--- a/wp-includes/post-template.php
+++ b/wp-includes/post-template.php
@@ -378,7 +378,7 @@ function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) {
if ( !$post = & get_post($id) )
return false;
- if ( !$src = get_attachment_icon_src( $id, $fullsize ) )
+ if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) )
return false;
list($src, $src_file) = $src;
@@ -415,11 +415,12 @@ function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) {
function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) {
$id = (int) $id;
+ if ( !$post = & get_post($id) )
+ return false;
- if ( $innerHTML = get_attachment_icon($id, $fullsize, $max_dims))
+ if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims))
return $innerHTML;
- $post = & get_post($id);
$innerHTML = attribute_escape($post->post_title);
diff --git a/wp-includes/post.php b/wp-includes/post.php
index 904b2ee..c3d3b6a 100644
--- a/wp-includes/post.php
+++ b/wp-includes/post.php
@@ -1404,26 +1404,28 @@ function wp_delete_attachment($postid) {
function wp_get_attachment_metadata( $post_id, $unfiltered = false ) {
$post_id = (int) $post_id;
+ if ( !$post =& get_post( $post_id ) )
+ return false;
- $data = get_post_meta( $post_id, '_wp_attachment_metadata', true );
+ $data = get_post_meta( $post->ID, '_wp_attachment_metadata', true );
if ( $unfiltered )
return $data;
- return apply_filters( 'wp_get_attachment_metadata', $data, $post_id );
+ return apply_filters( 'wp_get_attachment_metadata', $data, $post->ID );
}
function wp_update_attachment_metadata( $post_id, $data ) {
$post_id = (int) $post_id;
- if ( !get_post( $post_id ) )
+ if ( !$post =& get_post( $post_id ) )
return false;
- $old_data = wp_get_attachment_metadata( $post_id, true );
+ $old_data = wp_get_attachment_metadata( $post->ID, true );
- $data = apply_filters( 'wp_update_attachment_metadata', $data, $post_id );
+ $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID );
if ( $old_data )
- return update_post_meta( $post_id, '_wp_attachment_metadata', $data, $old_data );
+ return update_post_meta( $post->ID, '_wp_attachment_metadata', $data, $old_data );
else
- return add_post_meta( $post_id, '_wp_attachment_metadata', $data );
+ return add_post_meta( $post->ID, '_wp_attachment_metadata', $data );
}
function wp_get_attachment_url( $post_id = 0 ) {
@@ -1431,37 +1433,41 @@ function wp_get_attachment_url( $post_id = 0 ) {
if ( !$post =& get_post( $post_id ) )
return false;
- $url = get_the_guid( $post_id );
+ $url = get_the_guid( $post->ID );
if ( 'attachment' != $post->post_type || !$url )
return false;
- return apply_filters( 'wp_get_attachment_url', $url, $post_id );
+ return apply_filters( 'wp_get_attachment_url', $url, $post->ID );
}
-function wp_get_attachment_thumb_file( $post_id ) {
+function wp_get_attachment_thumb_file( $post_id = 0 ) {
$post_id = (int) $post_id;
- if ( !$imagedata = wp_get_attachment_metadata( $post_id ) )
+ if ( !$post =& get_post( $post_id ) )
+ return false;
+ if ( !$imagedata = wp_get_attachment_metadata( $post->ID ) )
return false;
- $file = get_attached_file( $post_id );
+ $file = get_attached_file( $post->ID );
if ( !empty($imagedata['thumb']) && ($thumbfile = str_replace(basename($file), $imagedata['thumb'], $file)) && file_exists($thumbfile) )
- return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post_id );
+ return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post->ID );
return false;
}
function wp_get_attachment_thumb_url( $post_id = 0 ) {
$post_id = (int) $post_id;
- if ( !$url = wp_get_attachment_url( $post_id ) )
+ if ( !$post =& get_post( $post_id ) )
+ return false;
+ if ( !$url = wp_get_attachment_url( $post->ID ) )
return false;
- if ( !$thumb = wp_get_attachment_thumb_file( $post_id ) )
+ if ( !$thumb = wp_get_attachment_thumb_file( $post->ID ) )
return false;
$url = str_replace(basename($url), basename($thumb), $url);
- return apply_filters( 'wp_get_attachment_thumb_url', $url, $post_id );
+ return apply_filters( 'wp_get_attachment_thumb_url', $url, $post->ID );
}
function wp_attachment_is_image( $post_id = 0 ) {
diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php
index cc6c7aa..43e076d 100644
--- a/wp-includes/script-loader.php
+++ b/wp-includes/script-loader.php
@@ -19,13 +19,16 @@ class WP_Scripts {
$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'), '20061113' );
$this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.0');
- $this->add( 'autosave', '/wp-includes/js/autosave.js.php', array('prototype', 'sack'), '4508');
+ $this->add( 'autosave', '/wp-includes/js/autosave-js.php', array('prototype', 'sack'), '4508');
$this->add( 'wp-ajax', '/wp-includes/js/wp-ajax-js.php', array('prototype'), '4459');
$this->add( 'listman', '/wp-includes/js/list-manipulation-js.php', array('wp-ajax', 'fat'), '4583');
- $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-slider', '/wp-includes/js/scriptaculous/scriptaculous.js?load=slider,effects', array('prototype'), '1.6.1');
- $this->add( 'scriptaculous-controls', '/wp-includes/js/scriptaculous/scriptaculous.js?load=controls', array('prototype'), '1.6.1');
+ $this->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/wp-scriptaculous.js', array('prototype'), '1.6.1');
+ $this->add( 'scriptaculous-builder', '/wp-includes/js/scriptaculous/builder.js', array('scriptaculous-root'), '1.6.1');
+ $this->add( 'scriptaculous-dragdrop', '/wp-includes/js/scriptaculous/dragdrop.js', array('scriptaculous-builder'), '1.6.1');
+ $this->add( 'scriptaculous-effects', '/wp-includes/js/scriptaculous/effects.js', array('scriptaculous-root'), '1.6.1');
+ $this->add( 'scriptaculous-slider', '/wp-includes/js/scriptaculous/slider.js', array('scriptaculous-effects'), '1.6.1');
+ $this->add( 'scriptaculous-controls', '/wp-includes/js/scriptaculous/controls.js', array('scriptaculous-root'), '1.6.1');
+ $this->add( 'scriptaculous', '', array('scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls'), '1.6.1');
$this->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop'), '1');
if ( is_admin() ) {
$this->add( 'dbx-admin-key', '/wp-admin/dbx-admin-key-js.php', array('dbx'), '3651' );
@@ -70,12 +73,14 @@ class WP_Scripts {
elseif ( is_array($handles[$handle]) )
$this->_print_scripts( $handles[$handle] );
if ( !in_array($handle, $this->printed) && isset($this->scripts[$handle]) ) {
- $ver = $this->scripts[$handle]->ver ? $this->scripts[$handle]->ver : $wp_db_version;
- if ( isset($this->args[$handle]) )
- $ver .= '&amp;' . $this->args[$handle];
- $src = 0 === strpos($this->scripts[$handle]->src, 'http://') ? $this->scripts[$handle]->src : get_option( 'siteurl' ) . $this->scripts[$handle]->src;
- $src = add_query_arg('ver', $ver, $src);
- echo "<script type='text/javascript' src='$src'></script>\n";
+ if ( $this->scripts[$handle]->src ) { // Else it defines a group.
+ $ver = $this->scripts[$handle]->ver ? $this->scripts[$handle]->ver : $wp_db_version;
+ if ( isset($this->args[$handle]) )
+ $ver .= '&amp;' . $this->args[$handle];
+ $src = 0 === strpos($this->scripts[$handle]->src, 'http://') ? $this->scripts[$handle]->src : get_option( 'siteurl' ) . $this->scripts[$handle]->src;
+ $src = add_query_arg('ver', $ver, $src);
+ echo "<script type='text/javascript' src='$src'></script>\n";
+ }
$this->printed[] = $handle;
}
}
diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php
index ceab53f..1ed50b4 100644
--- a/wp-includes/wp-db.php
+++ b/wp-includes/wp-db.php
@@ -45,11 +45,13 @@ class wpdb {
* @param string $dbhost
*/
function wpdb($dbuser, $dbpassword, $dbname, $dbhost) {
-
- if( defined( "WP_USE_MULTIPLE_DB" ) && CONSTANT( "WP_USE_MULTIPLE_DB" ) == true ) {
+ if( defined( "WP_USE_MULTIPLE_DB" ) && CONSTANT( "WP_USE_MULTIPLE_DB" ) == true )
$this->db_connect();
- return true;
- }
+ return $this->__construct($dbuser, $dbpassword, $dbname, $dbhost);
+ }
+
+ function __construct($dbuser, $dbpassword, $dbname, $dbhost) {
+ register_shutdown_function(array(&$this, "__destruct"));
$this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword);
if (!$this->dbh) {
@@ -68,6 +70,10 @@ class wpdb {
$this->select($dbname, $this->dbh);
}
+ function __destruct() {
+ return true;
+ }
+
/**
* Selects a database using the current class's $this->dbh
* @param string $db name
@@ -420,6 +426,12 @@ class wpdb {
return false;
header('Content-Type: text/html; charset=utf-8');
+
+ if ( strstr($_SERVER['PHP_SELF'], 'wp-admin') )
+ $admin_dir = '';
+ else
+ $admin_dir = 'wp-admin/';
+
?>
<!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">
@@ -465,7 +477,7 @@ class wpdb {
</style>
</head>
<body>
- <h1 id="logo"><img alt="WordPress" src="<?php echo "wp-admin/images/wordpress-logo.png" ?>/></h1>
+ <h1 id="logo"><img alt="WordPress" src="<?php echo $admin_dir; ?>images/wordpress-logo.png" /></h1>
<p><?php echo $message; ?></p>
</body>
</html>
diff --git a/wp-settings.php b/wp-settings.php
index 021c082..482a5fa 100644
--- a/wp-settings.php
+++ b/wp-settings.php
@@ -300,6 +300,11 @@ define('STYLESHEETPATH', get_stylesheet_directory());
// Load the default text localization domain.
load_default_textdomain();
+$locale = get_locale();
+$locale_file = ABSPATH . LANGDIR . "/$locale.php";
+if ( is_readable($locale_file) )
+ require_once($locale_file);
+
// Pull in locale data after loading text domain.
require_once(ABSPATH . WPINC . '/locale.php');