summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-10-09 11:39:17 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-10-09 11:39:17 +0000
commit75e0ccc3a64e164d036da4f71f458520ddea3b24 (patch)
tree94f00db692e25c95030f7984c27178e1bd7e1bcd
parentca036ad95fc44c318275ab539a52f1eb6fddf060 (diff)
downloadwordpress-mu-75e0ccc3a64e164d036da4f71f458520ddea3b24.tar.gz
wordpress-mu-75e0ccc3a64e164d036da4f71f458520ddea3b24.tar.xz
wordpress-mu-75e0ccc3a64e164d036da4f71f458520ddea3b24.zip
WP Merge - needs testing.
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@797 7be80a69-a1ef-0310-a953-fb0f7c49ff36
-rw-r--r--wp-activate.php6
-rw-r--r--wp-admin/admin-functions.php28
-rw-r--r--wp-admin/comment.php3
-rw-r--r--wp-admin/edit-category-form.php6
-rw-r--r--wp-admin/edit-form-comment.php2
-rw-r--r--wp-admin/export.php1
-rw-r--r--wp-admin/import/mt.php43
-rw-r--r--wp-admin/import/wordpress.php8
-rw-r--r--wp-admin/options-privacy.php2
-rw-r--r--wp-admin/options-reading.php10
-rw-r--r--wp-admin/page.php8
-rw-r--r--wp-admin/profile-update.php5
-rw-r--r--wp-admin/themes.php8
-rw-r--r--wp-admin/upgrade-functions.php4
-rw-r--r--wp-admin/upgrade.php1
-rw-r--r--wp-admin/upload-functions.php68
-rw-r--r--wp-admin/upload-js.php62
-rw-r--r--wp-admin/upload.css11
-rw-r--r--wp-admin/upload.php2
-rw-r--r--wp-admin/user-edit.php3
-rw-r--r--wp-admin/users.php2
-rw-r--r--wp-admin/wp-admin.css73
-rw-r--r--wp-content/blogs.php9
-rw-r--r--wp-content/mu-plugins/pluggable.php28
-rw-r--r--wp-content/themes/classic/sidebar.php20
-rw-r--r--wp-content/themes/default/sidebar.php14
-rw-r--r--wp-cron.php2
-rw-r--r--wp-includes/bookmark-template.php9
-rw-r--r--wp-includes/category-template.php10
-rw-r--r--wp-includes/cron.php9
-rw-r--r--wp-includes/default-filters.php3
-rw-r--r--wp-includes/formatting.php18
-rw-r--r--wp-includes/functions.php140
-rw-r--r--wp-includes/general-template.php43
-rw-r--r--wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js5
-rw-r--r--wp-includes/js/tinymce/tiny_mce_config.php4
-rw-r--r--wp-includes/l10n.php8
-rw-r--r--wp-includes/pluggable.php2
-rw-r--r--wp-includes/plugin.php22
-rw-r--r--wp-includes/post-template.php5
-rw-r--r--wp-includes/post.php80
-rw-r--r--wp-includes/script-loader.php4
-rw-r--r--wp-includes/vars.php2
-rw-r--r--wp-includes/wpmu-functions.php149
-rw-r--r--wp-login.php18
-rw-r--r--wp-settings.php1
-rw-r--r--wp-signup.php16
-rw-r--r--xmlrpc.php49
48 files changed, 579 insertions, 447 deletions
diff --git a/wp-activate.php b/wp-activate.php
index 651bdc8..8713d43 100644
--- a/wp-activate.php
+++ b/wp-activate.php
@@ -25,16 +25,16 @@ form { margin-top: 2em; }
<?php
if ( empty($_GET['key']) && empty($_POST['key']) ) {
?>
-<h2>Activation Key Required</h2>
+<h2><?php _e('Activation Key Required') ?></h2>
<form name="activateform" id="activateform" method="post" action="/wp-activate.php">
<table border="0" width="100%" cellpadding="9">
<tr>
-<th valign="top">Activation Key:</th>
+<th valign="top"><?php _e('Activation Key:') ?></th>
<td><input name="key" type="text" id="key" value="" /></td>
</tr>
<tr>
<th scope="row" valign="top">&nbsp;</th>
-<td><input id="submit" type="submit" name="Submit" class="submit" value="Activate &raquo;" /></td>
+<td><input id="submit" type="submit" name="Submit" class="submit" value="<?php _e('Activate &raquo;') ?>" /></td>
</tr>
</table>
</form>
diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php
index 7eef22d..64cbb1c 100644
--- a/wp-admin/admin-functions.php
+++ b/wp-admin/admin-functions.php
@@ -1984,27 +1984,35 @@ function the_attachment_links($id = false) {
return false;
$icon = get_attachment_icon($post->ID);
-
+ $attachment_data = get_post_meta( $id, '_wp_attachment_metadata', true );
+ $thumb = isset($attachment_data['thumb']);
?>
<form id="the-attachment-links">
<table>
+ <col />
+ <col class="widefat" />
<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>
+ <th scope="row"><?php _e('URL') ?></th>
+ <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><?php echo $post->guid ?></textarea></td>
</tr>
<?php if ( $icon ) : ?>
<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>
+ <th scope="row"><?php $thumb ? _e('Thumbnail linked to file') : _e('Image linked to file'); ?></th>
+ <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo $post->guid; ?>" id="<?php echo $post->ID ?>"><?php echo $icon ?></a></textarea></td>
</tr>
<tr>
- <th scope="row"><?php _e('Thumbnail linked to subpost') ?></th>
+ <th scope="row"><?php $thumb ? _e('Thumbnail linked to page') : _e('Image linked to file'); ?></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 else : ?>
+ <tr>
+ <th scope="row"><?php _e('Link 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('Link to page') ?></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 the_title(); ?></a></textarea></td>
+ </tr>
<?php endif; ?>
</table>
</form>
diff --git a/wp-admin/comment.php b/wp-admin/comment.php
index 0b773b1..6589d8b 100644
--- a/wp-admin/comment.php
+++ b/wp-admin/comment.php
@@ -12,7 +12,8 @@ if ( isset( $_POST['deletecomment'] ) )
switch($action) {
case 'editcomment':
$title = __('Edit Comment');
-
+ if ( user_can_richedit() )
+ wp_enqueue_script( 'wp_tiny_mce' );
require_once ('admin-header.php');
$comment = (int) $_GET['comment'];
diff --git a/wp-admin/edit-category-form.php b/wp-admin/edit-category-form.php
index 9b700af..66581ae 100644
--- a/wp-admin/edit-category-form.php
+++ b/wp-admin/edit-category-form.php
@@ -29,10 +29,8 @@ if ( ! empty($cat_ID) ) {
<tr>
<th scope="row" valign="top"><label for="category_parent"><?php _e('Category parent:') ?></label></th>
<td>
- <select name='category_parent' id='category_parent'>
- <option value='0' <?php if (!$category->category_parent) echo " selected='selected'"; ?>><?php _e('None') ?></option>
- <?php wp_dropdown_cats($category->cat_ID, $category->category_parent); ?>
- </select></td>
+ <?php wp_dropdown_categories('hide_empty=0&name=category_parent&selected=' . $category->category_parent . '&hierarchical=1&show_option_none=' . __('None')); ?>
+ </td>
</tr>
<tr>
<th scope="row" valign="top"><label for="category_description"><?php _e('Description: (optional)') ?></label></th>
diff --git a/wp-admin/edit-form-comment.php b/wp-admin/edit-form-comment.php
index e90e059..26d79eb 100644
--- a/wp-admin/edit-form-comment.php
+++ b/wp-admin/edit-form-comment.php
@@ -36,7 +36,7 @@ addLoadEvent(focusit);
</div>
</fieldset>
-<fieldset style="clear: both;">
+<fieldset id="<?php echo user_can_richedit() ? 'commentdivrich' : 'commentdiv'; ?>" style="clear: both;">
<legend><?php _e('Comment') ?></legend>
<?php the_editor($comment->comment_content, 'content', 'newcomment_author_url'); ?>
</fieldset>
diff --git a/wp-admin/export.php b/wp-admin/export.php
index f0d7b7d..f50b8e0 100644
--- a/wp-admin/export.php
+++ b/wp-admin/export.php
@@ -19,6 +19,7 @@ require_once ('admin-header.php');
<input type="hidden" name="download" value="true" />
</p>
</form>
+<p><?php _e('If you are considering moving your blog to another host we recommend a number of <a href="http://wordpress.org/hosting/">hosting services</a>.'); ?></p>
</div>
</div>
diff --git a/wp-admin/import/mt.php b/wp-admin/import/mt.php
index 014529e..b86ae33 100644
--- a/wp-admin/import/mt.php
+++ b/wp-admin/import/mt.php
@@ -52,25 +52,8 @@ class MT_Import {
function checkauthor($author) {
global $wpdb;
//mtnames is an array with the names in the mt import file
- $pass = 'changeme';
- if (!(in_array($author, $this->mtnames))) { //a new mt author name is found
- ++ $this->j;
- $this->mtnames[$this->j] = $author; //add that new mt author name to an array
- $user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user
- if (!$user_id) { //banging my head against the desk now.
- if ($newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname
- $user_id = wp_create_user($author, $pass);
- $this->newauthornames[$this->j] = $author; //now we have a name, in the place of left_blank.
- } else {
- $user_id = wp_create_user($this->newauthornames[$this->j], $pass);
- }
- } else {
- return $user_id; // return pre-existing wp username if it exists
- }
- } else {
- $key = array_search($author, $this->mtnames); //find the array key for $author in the $mtnames array
- $user_id = username_exists($this->newauthornames[$key]); //use that key to get the value of the author's name from $newauthornames
- }
+ $key = array_search($author, $this->mtnames); //find the array key for $author in the $mtnames array
+ $user_id = username_exists($this->newauthornames[$key]); //use that key to get the value of the author's name from $newauthornames
return $user_id;
}
@@ -112,13 +95,6 @@ class MT_Import {
$formnames = array ();
$selectnames = array ();
- foreach ($_POST['user'] as $key => $line) {
- $newname = trim(stripslashes($line));
- if ($newname == '')
- $newname = 'left_blank'; //passing author names from step 1 to step 2 is accomplished by using POST. left_blank denotes an empty entry in the form.
- array_push($formnames, "$newname");
- } // $formnames is the array with the form entered names
-
foreach ($_POST['userselect'] as $user => $key) {
$selected = trim(stripslashes($key));
array_push($selectnames, "$selected");
@@ -150,12 +126,12 @@ class MT_Import {
$j = -1;
foreach ($authors as $author) {
++ $j;
- echo '<li>'.__('Current author:').' <strong>'.$author.'</strong><br />'.sprintf(__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user[]'.'" maxlength="30"> <br />');
+ echo '<li><i>'.$author.'</i><br />'.'<input type="text" value="'.$author.'" name="'.'user[]'.'" maxlength="30">';
$this->users_form($j);
echo '</li>';
}
- echo '<input type="submit" value="'.__('Submit').'">'.'<br/>';
+ echo '<input type="submit" value="Submit">'.'<br/>';
echo '</form>';
echo '</ol></div>';
@@ -164,10 +140,7 @@ class MT_Import {
function select_authors() {
$file = wp_import_handle_upload();
if ( isset($file['error']) ) {
- $this->header();
- echo '<p>'.__('Sorry, there has been an error').'.</p>';
- echo '<p><strong>' . $file['error'] . '</strong></p>';
- $this->footer();
+ echo $file['error'];
return;
}
$this->file = $file['file'];
@@ -199,7 +172,7 @@ class MT_Import {
// We want the excerpt
preg_match("|-----\nEXCERPT:(.*)|s", $post, $excerpt);
- $post_excerpt = $wpdb->escape(trim($excerpt[1]));
+ $excerpt = $wpdb->escape(trim($excerpt[1]));
$post = preg_replace("|(-----\nEXCERPT:.*)|s", '', $post);
// We're going to put extended body into main body with a more tag
@@ -336,7 +309,7 @@ class MT_Import {
}
}
if ( $num_comments )
- printf(' '.__('(%s comments)'), $num_comments);
+ printf(__(' (%s comments)'), $num_comments);
// Finally the pings
// fix the double newline on the first one
@@ -384,7 +357,7 @@ class MT_Import {
}
}
if ( $num_pings )
- printf(' '.__('(%s pings)'), $num_pings);
+ printf(__(' (%s pings)'), $num_pings);
echo "</li>";
}
diff --git a/wp-admin/import/wordpress.php b/wp-admin/import/wordpress.php
index 5c67eec..46f5892 100644
--- a/wp-admin/import/wordpress.php
+++ b/wp-admin/import/wordpress.php
@@ -26,7 +26,7 @@ class WP_Import {
function greet() {
echo '<div class="narrow">';
- echo '<p>'.__('Howdy! Upload your WordPress eXtended RSS (WXR) file and we&#8217;ll import the posts and comments into this blog.').'</p>';
+ echo '<p>'.__('Howdy! Upload your WordPress eXtended RSS (WXR) file and we&#8217;ll import the posts, comments, custom fields, and categories into this blog.').'</p>';
wp_import_upload_form("admin.php?import=wordpress&amp;step=1");
echo '</div>';
}
@@ -150,8 +150,8 @@ class WP_Import {
$j = -1;
foreach ($authors as $author) {
++ $j;
- echo '<li>'.__('Current author:').' <strong>'.$author.'</strong><br />'.sprintf(__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user[]'.'" maxlength="30"> <br />');
- $this->users_form($j);
+ echo '<li>Current author: <strong>'.$author.'</strong><br />'.'Map to existing: ';
+ $this->users_form($author);
echo '</li>';
}
@@ -308,6 +308,6 @@ class WP_Import {
$wp_import = new WP_Import();
-register_importer('wordpress', 'WordPress', __('Import posts from a WordPress export file'), array ($wp_import, 'dispatch'));
+register_importer('wordpress', 'WordPress', __('Import <strong>posts, comments, custom fields, and categories</strong> from a WordPress export file'), array ($wp_import, 'dispatch'));
?>
diff --git a/wp-admin/options-privacy.php b/wp-admin/options-privacy.php
index 18f71c5..61a9ed6 100644
--- a/wp-admin/options-privacy.php
+++ b/wp-admin/options-privacy.php
@@ -22,7 +22,7 @@ if( trim( get_option('blog_public') ) == '' )
<label for="blog-public"><?php _e('I would like my blog to be visible to anyone who visits, including search engines, archivers and in public listings around this site.') ?></label>
<br />
<input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked('0', get_option('blog_public')); ?> />
- <label for="blog-norobots"><?php _e('I would like to block search engines, but allow normal folks') ?></label>
+ <label for="blog-norobots"><?php _e( 'I would like to block search engines, but allow normal visitors' ); ?></label>
<?php do_action('blog_privacy_selector'); ?>
</td>
</tr>
diff --git a/wp-admin/options-reading.php b/wp-admin/options-reading.php
index bb7bd9e..fc73637 100644
--- a/wp-admin/options-reading.php
+++ b/wp-admin/options-reading.php
@@ -5,6 +5,16 @@ $title = __('Reading Options');
$parent_file = 'options-general.php';
include('admin-header.php');
+
+// Sanity checks
+if ( 'page' == get_option('show_on_front') ) {
+ $front_page = get_option('page_on_front');
+ if ( empty($front_page) ) {
+ update_option('show_on_front', 'posts');
+ delete_option('page_for_posts');
+ delete_option('page_on_front');
+ }
+}
?>
<div class="wrap">
diff --git a/wp-admin/page.php b/wp-admin/page.php
index 83bc1c4..4728b5d 100644
--- a/wp-admin/page.php
+++ b/wp-admin/page.php
@@ -45,14 +45,14 @@ case 'edit':
$editing = true;
$page_ID = $post_ID = $p = (int) $_GET['post'];
$post = get_post_to_edit($page_ID);
- if($post->post_status == 'draft') {
- wp_enqueue_script('prototype');
- wp_enqueue_script('autosave');
- }
if( $post->post_type == 'post' ) {
header( "Location: " . str_replace( "page.php", "post.php", $_SERVER[ 'REQUEST_URI' ] ) );
die();
}
+ if($post->post_status == 'draft') {
+ wp_enqueue_script('prototype');
+ wp_enqueue_script('autosave');
+ }
require_once('admin-header.php');
if ( !current_user_can('edit_page', $page_ID) )
diff --git a/wp-admin/profile-update.php b/wp-admin/profile-update.php
index 2c6028f..944f799 100644
--- a/wp-admin/profile-update.php
+++ b/wp-admin/profile-update.php
@@ -21,6 +21,11 @@ if ( !isset( $_POST['rich_editing'] ) )
$_POST['rich_editing'] = 'false';
update_user_option( $current_user->id, 'rich_editing', $_POST['rich_editing'], true );
+if ( isset( $_POST['primary_blog'] ) ) {
+ $primary_blog = (int) $_POST['primary_blog'];
+ update_user_option( $current_user->id, 'primary_blog', $primary_blog, true );
+}
+
do_action('personal_options_update');
if ( 'profile' == $_POST['from'] )
diff --git a/wp-admin/themes.php b/wp-admin/themes.php
index 3f7b2c6..9f6d7b5 100644
--- a/wp-admin/themes.php
+++ b/wp-admin/themes.php
@@ -69,9 +69,9 @@ require_once('admin-header.php');
<h2><?php _e('Current Theme'); ?></h2>
<div id="currenttheme">
<?php if ( $ct->screenshot ) : ?>
-<img src="<?php echo get_option('siteurl') . '/' . $ct->stylesheet_dir . '/' . $ct->screenshot; ?>" alt="<?php _e('Current theme preview'); ?>" />
+<img src="../<?php echo $ct->stylesheet_dir . '/' . $ct->screenshot; ?>" alt="<?php _e('Current theme preview'); ?>" />
<?php endif; ?>
-<h3><?php printf(__('%1$s %2$s by %3$s'), $ct->title, $ct->version, $ct->author) ; ?></h3>
+<h3><?php printf(__('%1$s %2$s by %3$s'), $ct->title, '', $ct->author) ; ?></h3>
<p><?php echo $ct->description; ?></p>
</div>
@@ -98,11 +98,11 @@ foreach ($theme_names as $theme_name) {
$activate_link = wp_nonce_url("themes.php?action=activate&amp;template=$template&amp;stylesheet=$stylesheet", 'switch-theme_' . $template);
?>
<div class="available-theme">
-<h3><a href="<?php echo $activate_link; ?>"><?php echo "$title $version"; ?></a></h3>
+<h3><a href="<?php echo $activate_link; ?>"><?php echo "$title"; ?></a></h3>
<a href="<?php echo $activate_link; ?>" class="screenshot">
<?php if ( $screenshot ) : ?>
-<img src="<?php echo get_option('siteurl') . '/' . $stylesheet_dir . '/' . $screenshot; ?>" alt="" />
+<img src="../<?php echo $stylesheet_dir . '/' . $screenshot; ?>" alt="" />
<?php endif; ?>
</a>
diff --git a/wp-admin/upgrade-functions.php b/wp-admin/upgrade-functions.php
index a3cd623..6e54544 100644
--- a/wp-admin/upgrade-functions.php
+++ b/wp-admin/upgrade-functions.php
@@ -512,7 +512,7 @@ function upgrade_210() {
$posts = $wpdb->get_results("SELECT ID, post_date FROM $wpdb->posts WHERE post_status ='future'");
if ( !empty($posts) )
foreach ( $posts as $post )
- wp_schedule_single_event(mysql2date('U', $post->post_date), 'publish_future_post', $post->ID);
+ wp_schedule_single_event(mysql2date('U', $post->post_date), 'publish_future_post', array($post->ID));
}
if ( $wp_current_db_version < 3570 ) {
// Create categories for link categories if a category with the same
@@ -686,7 +686,7 @@ function dbDelta($queries, $execute = true) {
// Create a tablename index for an array ($cqueries) of queries
foreach($queries as $qry) {
- if(preg_match("|CREATE TABLE ([^ ]*)|", $qry, $matches)) {
+ if(preg_match("|CREATE TABLE (?:IF NOT EXISTS )?([^ ]*)|", $qry, $matches)) {
$cqueries[strtolower($matches[1])] = $qry;
$for_update[$matches[1]] = 'Created table '.$matches[1];
}
diff --git a/wp-admin/upgrade.php b/wp-admin/upgrade.php
index a60e50a..c0a4f7e 100644
--- a/wp-admin/upgrade.php
+++ b/wp-admin/upgrade.php
@@ -46,7 +46,6 @@ switch($step) {
} else {
$wpdb->query( "INSERT INTO wp_blog_versions ( `blog_id` , `db_version` , `last_updated` ) VALUES ( '{$wpdb->blogid}', '{$wp_db_version}', NOW());" );
}
-
?>
<h2><?php _e('Step 1'); ?></h2>
<p><?php printf(__("There's actually only one step. So if you see this, you're done. <a href='%s'>Have fun</a>!"), $backto); ?></p>
diff --git a/wp-admin/upload-functions.php b/wp-admin/upload-functions.php
index 29b48d8..623daeb 100644
--- a/wp-admin/upload-functions.php
+++ b/wp-admin/upload-functions.php
@@ -16,10 +16,16 @@ function wp_upload_display( $dims = false, $href = '' ) {
if ( $image_src = strstr($innerHTML, 'src="') ) {
$image_src = explode('"', $image_src);
$image_src = $image_src[1];
+ $image_rel = wp_make_link_relative($image_src);
$class = 'image';
- $innerHTML = '&nbsp;' . $innerHTML;
+ $innerHTML = '&nbsp;' . str_replace($image_src, $image_rel, $innerHTML);
+ $image_base = str_replace($image_rel, '', $image_src);
}
+ $src_base = get_the_guid();
+ $src = wp_make_link_relative( $src_base );
+ $src_base = str_replace($src, '', $src_base);
+
$r = '';
if ( $href )
@@ -29,10 +35,14 @@ function wp_upload_display( $dims = false, $href = '' ) {
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";
+ $r .= "\t\t\t\t<input type='hidden' name='attachment-url-$id' id='attachment-url-$id' value='$src' />\n";
+ $r .= "\t\t\t\t<input type='hidden' name='attachment-url-base-$id' id='attachment-url-base-$id' value='$src_base' />\n";
+
+ if ( isset($attachment_data['thumb']) ) {
+ $r .= "\t\t\t\t<input type='hidden' name='attachment-thumb-url-$id' id='attachment-thumb-url-$id' value='$image_rel' />\n";
+ $r .= "\t\t\t\t<input type='hidden' name='attachment-thumb-url-base-$id' id='attachment-thumb-url-base-$id' value='$image_base' />\n";
+ } elseif ( $image_rel )
+ $r .= "\t\t\t\t<input type='hidden' name='attachment-is-image-$id' id='attachment-is-image-$id' value='1' />\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";
@@ -45,16 +55,16 @@ function wp_upload_display( $dims = false, $href = '' ) {
}
function wp_upload_view() {
- global $style, $post_id;
+ global $style, $post_id, $style;
$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']) )
+ <h2><?php if ( !isset($attachment_data['width']) && 'inline' != $style )
echo "<a href='" . get_the_guid() . "' title='" . __('Direct link to file') . "'>";
the_title();
- if ( !isset($attachment_data['width']) )
+ if ( !isset($attachment_data['width']) && 'inline' != $style )
echo '</a>';
?></h2>
<span><?php
@@ -68,15 +78,15 @@ function wp_upload_view() {
</div>
<div id="upload-file-view" class="alignleft">
-<?php if ( isset($attachment_data['width']) )
+<?php if ( isset($attachment_data['width']) && 'inline' != $style )
echo "<a href='" . get_the_guid() . "' title='" . __('Direct link to file') . "'>";
echo wp_upload_display( array(171, 128) );
- if ( isset($attachment_data['width']) )
+ if ( isset($attachment_data['width']) && 'inline' != $style )
echo '</a>'; ?>
</div>
<?php the_attachment_links( $id ); ?>
</div>
-<?php echo "<form action='' id='browse-form'><input type='hidden' id='nonce-value' value='" . wp_create_nonce( 'inlineuploading' ) . "' /></form>\n";
+<?php echo "<form action='' id='browse-form'><input type='hidden' id='nonce-value' value='" . wp_create_nonce( 'inlineuploading' ) . "' /></form>\n";
}
function wp_upload_form() {
@@ -91,10 +101,10 @@ function wp_upload_form() {
$attachment_data = get_post_meta( $id, '_wp_attachment_metadata', true );
?>
<div id="file-title">
- <h2><?php if ( !isset($attachment_data['width']) )
+ <h2><?php if ( !isset($attachment_data['width']) && 'inline' != $style )
echo "<a href='" . get_the_guid() . "' title='" . __('Direct link to file') . "'>";
the_title();
- if ( !isset($attachment_data['width']) )
+ if ( !isset($attachment_data['width']) && 'inline' != $style )
echo '</a>';
?></h2>
<span><?php
@@ -108,31 +118,38 @@ function wp_upload_form() {
</div>
<div id="upload-file-view" class="alignleft">
-<?php if ( isset($attachment_data['width']) )
+<?php if ( isset($attachment_data['width']) && 'inline' != $style )
echo "<a href='" . get_the_guid() . "' title='" . __('Direct link to file') . "'>";
echo wp_upload_display( array(171, 128) );
- if ( isset($attachment_data['width']) )
+ if ( isset($attachment_data['width']) && 'inline' != $style )
echo '</a>'; ?>
</div>
<?php endif; ?>
- <table>
-<?php if ( !$id ): ?>
+ <table><col /><col class="widefat" />
+<?php if ( $id ): ?>
+ <tr>
+ <th scope="row"><label for="url"><?php _e('URL'); ?></label></th>
+ <td><input type="text" id="url" class="readonly" value="<?php the_guid(); ?>" readonly="readonly" /></td>
+ </tr>
+<?php else : ?>
<tr>
- <th scope="row"><label for="upload"><?php _e('File:'); ?></label></th>
+ <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>
+ <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>
+ <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>
+ <tr id="buttons" class="submit">
+ <td colspan='2'>
+<?php if ( $id ) : ?>
+ <input type="submit" name="delete" id="delete" class="delete alignleft" value="<?php _e('Delete File'); ?>" />
+<?php endif; ?>
<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 ) : ?>
@@ -143,9 +160,6 @@ function wp_upload_form() {
<?php wp_nonce_field( 'inlineuploading' ); ?>
<div class="submit">
<input type="submit" value="<?php $id ? _e('Save') : _e('Upload'); ?> &raquo;" />
-<?php if ( $id ) : ?>
- <input type="submit" name="delete" class="delete" value="<?php _e('Delete'); ?>" />
-<?php endif; ?>
</div>
</td>
</tr>
@@ -349,7 +363,7 @@ function wp_upload_admin_head() {
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 "\tbody { height: 15em; 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
index c03746f..4d5b21f 100644
--- a/wp-admin/upload-js.php
+++ b/wp-admin/upload-js.php
@@ -37,11 +37,18 @@ addLoadEvent( function() {
if ( id == this.currentImage.ID )
return;
var thumbEl = $('attachment-thumb-url-' + id);
- if ( thumbEl )
+ this.currentImage.isImage = true;
+ if ( thumbEl ) {
this.currentImage.thumb = ( 0 == id ? '' : thumbEl.value );
- else
+ this.currentImage.thumbBase = ( 0 == id ? '' : $('attachment-thumb-url-base-' + id).value );
+ } else {
this.currentImage.thumb = false;
+ var isImageEl = $('attachment-is-image-' + id);
+ if ( !isImageEl )
+ this.currentImage.isImage = false;
+ }
this.currentImage.src = ( 0 == id ? '' : $('attachment-url-' + id).value );
+ this.currentImage.srcBase = ( 0 == id ? '' : $('attachment-url-base-' + 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 );
@@ -65,13 +72,13 @@ addLoadEvent( function() {
var params = $H(this.params);
params.ID = '';
params.action = '';
- h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "' title='Browse your files' class='back'>&laquo; Back</a>";
+ h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "' title='Browse your files' class='back'>&laquo; Back</a>";
} else {
h += "<a href='#' onclick='theFileList.cancelView()' title='Browse your files' class='back'>&laquo; Back</a>";
}
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>";
+ if ( !this.currentImage.isImage )
+ h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='Direct link to file'>" + this.currentImage.title + "</a></h2>";
else
h += "<h2>" + this.currentImage.title + "</h2>";
h += " &#8212; <span>";
@@ -79,9 +86,11 @@ addLoadEvent( function() {
h += "</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
+ if ( this.currentImage.isImage ) {
+ h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='Direct link to file'>";
+ h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />";
+ h += "</a>";
+ } else
h += '&nbsp;';
h += "</div>";
@@ -119,6 +128,7 @@ addLoadEvent( function() {
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 + "'>";
if ( this.ID ) {
var params = $H(this.params);
@@ -129,8 +139,8 @@ addLoadEvent( function() {
h += "<a href='#' onclick='theFileList.cancelView()' title='Browse your files' class='back'>&laquo; Back</a>";
}
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>";
+ if ( !this.currentImage.isImage )
+ h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='Direct link to file'>" + this.currentImage.title + "</a></h2>";
else
h += "<h2>" + this.currentImage.title + "</h2>";
h += " &#8212; <span>";
@@ -138,26 +148,31 @@ addLoadEvent( function() {
h += "</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
+ if ( this.currentImage.isImage ) {
+ h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='Direct link to file'>";
+ h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />";
+ h += "</a>";
+ } else
h += '&nbsp;';
h += "</div>";
- h += "<table><tr>"
- h += "<th scope='row'><label for='post_title'>Title:</label></th>";
+ h += "<table><col /><col class='widefat' /><tr>"
+ h += "<th scope='row'><label for='url'>URL</label></th>";
+ h += "<td><input type='text' id='url' class='readonly' value='" + this.currentImage.srcBase + this.currentImage.src + "' readonly='readonly' /></td>";
+ h += "</tr><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 += "<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><input type='button' name='delete' class='delete button' value='Delete' onclick='theFileList.deleteFile(" + id + ");' /></th><td>";
+ h += "</tr><tr id='buttons' class='submit'><td colspan='2'><input type='button' id='delete' name='delete' class='delete alignleft' value='Delete File' onclick='theFileList.deleteFile(" + id + ");' />";
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 &raquo;' />";
- h += "</div></td></tr></table></form>";
+ h += "<div class='submit'><input type='submit' value='Save &raquo;' /></div>";
+ h += "</td></tr></table></form>";
new Insertion.Top('upload-content', h);
if (e) Event.stop(e);
@@ -202,11 +217,13 @@ addLoadEvent( function() {
displayEl = $A(document.forms.uploadoptions.elements.display).detect( function(i) { return i.checked; } )
if ( displayEl )
display = displayEl.value;
+ else if ( this.currentImage.isImage )
+ display = 'full';
if ( 'none' != link )
- h += "<a href='" + ( 'file' == link ? this.currentImage.src : this.currentImage.page ) + "' title='" + this.currentImage.title + "'>";
+ h += "<a href='" + ( 'file' == link ? ( this.currentImage.srcBase + this.currentImage.src ) : ( this.currentImage.page + "' rel='attachment" ) ) + "' title='" + this.currentImage.title + "'>";
if ( display )
- h += "<img src='" + ( 'thumb' == display ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' />";
+ h += "<img src='" + ( 'thumb' == display ? ( this.currentImage.thumbBase + this.currentImage.thumb ) : ( this.currentImage.srcBase + this.currentImage.src ) ) + "' alt='" + this.currentImage.title + "' />";
else
h += this.currentImage.title;
if ( 'none' != link )
@@ -220,7 +237,8 @@ addLoadEvent( function() {
win.tinyMCE.execCommand('mceInsertContent', false, h);
else
win.edInsertContent(win.edCanvas, h);
- this.cancelView();
+ if ( !this.ID )
+ this.cancelView();
return false;
},
diff --git a/wp-admin/upload.css b/wp-admin/upload.css
index a04bdf6..0358471 100644
--- a/wp-admin/upload.css
+++ b/wp-admin/upload.css
@@ -57,17 +57,18 @@ body { background: #f9fcfe; }
margin: 0 auto;
top: 0;
left: 0;
- width: 45em;
+ width: 95%;
height: 100%;
background: #f9fcfe;
}
-#upload-file th {
+
+#uupload-file th {
width: 8em;
}
form#upload-file input, form#upload-file textarea, div#upload-content.upload table { width: 100%; }
-form#upload-file div.submit input { width: auto; }
+form#upload-file .submit input { width: auto; }
#upload-file-view { padding: 0 0 0 75px; }
@@ -134,8 +135,6 @@ h2 {
#upload-files a.file-link img { vertical-align: middle; }
-#the-attachment-links { float: right; }
-
#the-attachment-links textarea {
font-size: 10px;
overflow: hidden;
@@ -173,3 +172,5 @@ tr, td, th {
#uploadoptions table {
width: 300px;
}
+
+input.readonly { background-color: #ddd; }
diff --git a/wp-admin/upload.php b/wp-admin/upload.php
index a992570..acf3a75 100644
--- a/wp-admin/upload.php
+++ b/wp-admin/upload.php
@@ -14,6 +14,8 @@ if ( !$tab )
do_action( "upload_files_$tab" );
+add_action( 'admin_head', 'wp_upload_admin_head' );
+
$pid = 0;
if ( $post_id < 0 )
$pid = $post_id;
diff --git a/wp-admin/user-edit.php b/wp-admin/user-edit.php
index ccb8c78..164464d 100644
--- a/wp-admin/user-edit.php
+++ b/wp-admin/user-edit.php
@@ -36,7 +36,10 @@ check_admin_referer('update-user_' . $user_id);
if ( !current_user_can('edit_user', $user_id) )
wp_die(__('You do not have permission to edit this user.'));
+$cap = $wpdb->get_var( "SELECT meta_value FROM {$wpdb->usermeta} WHERE user_id = '{$user_id}' AND meta_key = '{$wpmuBaseTablePrefix}{$wpdb->blogid}_capabilities' AND meta_value = 'a:0:{}'" );
$errors = edit_user($user_id);
+if( $cap == null )
+ $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE user_id = '{$user_id}' AND meta_key = '{$wpmuBaseTablePrefix}{$wpdb->blogid}_capabilities' AND meta_value = 'a:0:{}'" );
if( !is_wp_error( $errors ) ) {
$redirect = "user-edit.php?user_id=$user_id&updated=true";
diff --git a/wp-admin/users.php b/wp-admin/users.php
index 96e9730..51e2b31 100644
--- a/wp-admin/users.php
+++ b/wp-admin/users.php
@@ -219,7 +219,7 @@ case 'delete':
$go_delete = true;
}
}
- $all_logins = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users, $wpdb->usermeta WHERE $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '".$wpdb->prefix."capabilities'");
+ $all_logins = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users, $wpdb->usermeta WHERE $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '".$wpdb->prefix."capabilities' ORDER BY user_login");
$user_dropdown = '<select name="reassign_user">';
foreach ( (array) $all_logins as $login )
if ( $login->ID == $current_user->id || !in_array($login->ID, $userids) )
diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css
index 241c627..3b8595c 100644
--- a/wp-admin/wp-admin.css
+++ b/wp-admin/wp-admin.css
@@ -51,6 +51,7 @@ a.delete:hover {
font-size: 18px;
display: block;
height: 60px;
+ overflow: hidden;
}
#planetnews .hidden {
@@ -171,6 +172,19 @@ h2 {
margin: 5px 10px;
}
+h2 small.quickjump {
+ display: block;
+ text-align: right;
+}
+
+h2 small.quickjump a {
+ text-decoration: none;
+ border-bottom: 0;
+ font-size: 15px;
+ background: #f0f8ff;
+ padding: 5px 10px;
+}
+
img, #footer a {
border: 0;
}
@@ -205,7 +219,7 @@ textarea, input, select {
border-style: none;
padding: 0px;
margin-bottom: 16px;
- height: 16em;
+ height: 17em;
width: 100%;
/* overflow-y: hidden;*/
}
@@ -574,7 +588,7 @@ input.delete:hover {
color: #fff;
}
-#postdivrich #quicktags {
+#postdivrich #quicktags, #commentdivrich #quicktags {
background: #f0f0ee;
padding: 0px;
border: 1px solid #ccc;
@@ -648,9 +662,6 @@ input.delete:hover {
#footer {
clear: both;
text-align: center;
- width: 500px;
- margin: auto;
- height: 100px;
}
#footer .docs {
@@ -674,6 +685,12 @@ input.delete:hover {
margin: 5em auto;
padding: 20px 50px 0;
width: 325px;
+ _width: 390px;
+}
+
+#login form {
+ _width: 325px;
+ _margin: 0 auto;
}
#login #login_error {
@@ -696,6 +713,8 @@ input.delete:hover {
text-align: left;
font-weight: normal;
font-size: 1.1em;
+ _width: 325px;
+ _margin: 0 auto 15px;
}
#login h1 a {
@@ -719,6 +738,21 @@ input.delete:hover {
font-size: 20px;
}
+#register #login h2 {
+ border-bottom: 1px solid #1e6491;
+ padding-bottom: 15px;
+ color: #fff;
+ text-align: left;
+ font-weight: normal;
+ font-size: 1.7em;
+ font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana;
+ letter-spacing: -1px;
+ margin: 15px 0 0;
+ _width: 325px;
+ _padding: 15px 0;
+ _margin: 10px auto 5px;
+}
+
#login input {
padding: 4px;
}
@@ -727,7 +761,9 @@ input.delete:hover {
background: url('images/login-bkg-bottom.gif') no-repeat bottom center;
list-style: none;
margin: 0 -50px;
+ _margin: 10px auto 0;
padding: 10px 50px 25px;;
+ _padding: 0 0 5px 30px;
}
#login ul:after {
@@ -738,6 +774,13 @@ input.delete:hover {
visibility: hidden;
}
+#login ul {display: inline-block;}
+
+/* Hides from IE-mac \*/
+* html #login ul {height: 1%;}
+#login ul {display: block;}
+/* End hide from IE-mac */
+
#login ul li {
float: left;
font-size: 12px;
@@ -753,6 +796,10 @@ input.delete:hover {
width: 160px;
}
+#register #login ul li a {
+ width: 106px;
+}
+
#login ul li a:hover {
background: #0e3350;
border: 1px solid #2571ab;
@@ -1282,7 +1329,7 @@ input #catadd {
padding-left: 3px;
}
-#postdivrich #content, #postdivrich #content:active {
+#postdivrich #content, #postdivrich #content:active, #commentdivrich #content, #commentdivrich #content:active {
border: 1px solid #ccc;
}
@@ -1300,6 +1347,20 @@ input #catadd {
border-bottom: 1px solid #ccc;
}
+#postdivrich .switched table, #postdivrich #quicktags, #commentdivrich .switched table, #commentdivrich #quicktags {
+ border-top: none;
+}
+
+#postdivrich #quicktags, #commentdivrich #quicktags {
+ border-bottom: none;
+ padding-bottom: 2px;
+ margin-bottom: -1px;
+}
+
+#edButtons {
+ border-bottom: 1px solid #ccc
+}
+
.page-numbers {
padding: 4px 7px;
border: 1px solid #fff;
diff --git a/wp-content/blogs.php b/wp-content/blogs.php
index 16cb742..cf01353 100644
--- a/wp-content/blogs.php
+++ b/wp-content/blogs.php
@@ -8,7 +8,7 @@ if (
$current_blog->deleted == '1'
) {
header("HTTP/1.1 404 Not Found");
- die('404 &#8212; File not found.');
+ graceful_fail('404 &#8212; File not found.');
}
if ( !function_exists('wp_check_filetype') ) :
@@ -68,19 +68,20 @@ function wp_check_filetype($filename, $mimes = null) {
}
endif;
+
$file = $_GET[ 'file' ];
-$file = constant( "ABSPATH" ) . constant( "UPLOADS" ) . $file;
+$file = constant( "ABSPATH" ) . constant( "UPLOADS" ) . $file;
if ( !is_file( $file ) ) {
header("HTTP/1.1 404 Not Found");
- die('404 &#8212; File not found.');
+ graceful_fail('404 &#8212; File not found.');
}
// These should never, ever be served
$never = array( 'js', 'exe', 'swf', 'class', 'tar', 'zip', 'rar' );
if ( in_array( preg_replace( '|.*\.(.*)$|', '$1', $file ), $never ) ) {
header("HTTP/1.1 404 Not Found");
- die('404 &#8212; File not found.');
+ graceful_fail('404 &#8212; File not found.');
}
$mime = wp_check_filetype( $_SERVER[ 'REQUEST_URI' ] );
diff --git a/wp-content/mu-plugins/pluggable.php b/wp-content/mu-plugins/pluggable.php
index f1cf497..7990a3a 100644
--- a/wp-content/mu-plugins/pluggable.php
+++ b/wp-content/mu-plugins/pluggable.php
@@ -42,14 +42,11 @@ function wp_login($username, $password, $already_md5 = false) {
$error = __('<strong>Error</strong>: Wrong username.');
return false;
} else {
- $primary_blog = get_usermeta( $login->ID, "primary_blog" );
- if( $primary_blog ) {
+ if( is_site_admin( $username ) == false && ( $primary_blog = get_usermeta( $login->ID, "primary_blog" ) ) ) {
$details = get_blog_details( $primary_blog );
- if( is_object( $details ) ) {
- if( $details->archived == 1 || $details->spam == 1 || $details->deleted == 1 ) {
- $error = __('<strong>Error</strong>: Blog suspended.');
- return false;
- }
+ if( is_object( $details ) && $details->archived == 1 || $details->spam == 1 || $details->deleted == 1 ) {
+ $error = __('<strong>Error</strong>: Blog suspended.');
+ return false;
}
}
// If the password is already_md5, it has been double hashed.
@@ -72,15 +69,14 @@ function get_userdata( $user_id ) {
$user = wp_cache_get($user_id, 'users');
$user_level = $wpmuBaseTablePrefix . $wpdb->blogid . '_user_level';
- if( $user->$user_level != '' || $user->user_level != '' ) {
- if( $user && is_site_admin( $user->user_login ) == true ) {
- $user->$user_level = 10;
- $user->user_level = 10;
- $cap_key = $wpdb->prefix . 'capabilities';
- $user->{$cap_key} = array( 'administrator' => '1' );
- return $user;
- } elseif ( $user )
- return $user;
+ if ( $user && is_site_admin( $user->user_login ) ) {
+ $user->$user_level = 10;
+ $user->user_level = 10;
+ $cap_key = $wpdb->prefix . 'capabilities';
+ $user->{$cap_key} = array( 'administrator' => '1' );
+ return $user;
+ } elseif ( $user ) {
+ return $user;
}
if ( !$user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE ID = '$user_id'") )
diff --git a/wp-content/themes/classic/sidebar.php b/wp-content/themes/classic/sidebar.php
index 24a1cdd..8e34c73 100644
--- a/wp-content/themes/classic/sidebar.php
+++ b/wp-content/themes/classic/sidebar.php
@@ -3,13 +3,19 @@
<div id="menu">
<ul>
- <?php wp_list_pages(); ?>
- <?php get_links_list(); ?>
- <li id="categories"><?php _e('Categories:'); ?>
- <ul>
- <?php wp_list_cats(); ?>
- </ul>
- </li>
+<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar() ) : ?>
+
+</ul>
+
+</div>
+
+<?php return; ?>
+
+<?php endif; ?>
+
+ <?php wp_list_pages('title_li=' . __('Pages:')); ?>
+ <?php wp_list_bookmarks('title_after=&title_before='); ?>
+ <?php wp_list_categories('title_li=' . __('Categories:')); ?>
<li id="search">
<label for="s"><?php _e('Search:'); ?></label>
<form id="searchform" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
diff --git a/wp-content/themes/default/sidebar.php b/wp-content/themes/default/sidebar.php
index b20b5de..a45b1bb 100644
--- a/wp-content/themes/default/sidebar.php
+++ b/wp-content/themes/default/sidebar.php
@@ -1,6 +1,14 @@
<div id="sidebar">
<ul>
+<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar() ) : ?>
+
+ </ul>
+ </div>
+<?php return; ?>
+
+<?php endif; ?>
+
<li>
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
</li>
@@ -24,11 +32,11 @@
<p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
for <?php the_time('F, Y'); ?>.</p>
- <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
+ <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
<p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
for the year <?php the_time('Y'); ?>.</p>
- <?php /* If this is a monthly archive */ } elseif (is_search()) { ?>
+ <?php /* If this is a monthly archive */ } elseif (is_search()) { ?>
<p>You have searched the <a href="<?php echo bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
for <strong>'<?php the_search_query(); ?>'</strong>. If you are unable to find anything in these search results, you can try one of these links.</p>
@@ -38,7 +46,7 @@
<?php } ?>
</li>
- <?php wp_list_pages('title_li=<h2>Pages</h2>' ); ?>
+ <?php wp_list_pages('title_li=<h2>Pages</h2>&sort_column=post_title&sort_order=ASC'); ?>
<li><h2>Archives</h2>
<ul>
diff --git a/wp-cron.php b/wp-cron.php
index d992601..45cb9f3 100644
--- a/wp-cron.php
+++ b/wp-cron.php
@@ -17,7 +17,7 @@ foreach ($crons as $timestamp => $cronhooks) {
do_action_ref_array($hook, $args['args']);
$schedule = $args['schedule'];
if ($schedule != false) {
- $new_args = array_merge( array($timestamp, $schedule, $hook), $args['args']);
+ $new_args = array($timestamp, $schedule, $hook, $args['args']);
call_user_func_array('wp_reschedule_event', $new_args);
}
wp_unschedule_event($timestamp, $hook, $args['args']);
diff --git a/wp-includes/bookmark-template.php b/wp-includes/bookmark-template.php
index 446ea46..c5c2505 100644
--- a/wp-includes/bookmark-template.php
+++ b/wp-includes/bookmark-template.php
@@ -319,12 +319,15 @@ function wp_list_bookmarks($args = '') {
$defaults = array('orderby' => 'name', 'order' => 'ASC', 'limit' => -1, 'category' => '',
'category_name' => '', 'hide_invisible' => 1, 'show_updated' => 0, 'echo' => 1,
'categorize' => 1, 'title_li' => __('Bookmarks'), 'title_before' => '<h2>', 'title_after' => '</h2>',
- 'category_orderby' => 'name', 'category_order' => 'ASC');
+ 'category_orderby' => 'name', 'category_order' => 'ASC', 'class' => 'linkcat');
$r = array_merge($defaults, $r);
extract($r);
$output = '';
+ if ( is_array($class) )
+ $class = trim(join(' ', $class));
+
if ( $categorize ) {
//Split the bookmarks into ul's for each category
$cats = get_categories("type=link&category_name=$category_name&include=$category&orderby=$category_orderby&order=$category_order&hierarchical=0");
@@ -333,7 +336,7 @@ function wp_list_bookmarks($args = '') {
$bookmarks = get_bookmarks("limit=$limit&category={$cat->cat_ID}&show_updated=$show_updated&orderby=$orderby&order=$order&hide_invisible=$hide_inivisible&show_updated=$show_updated");
if ( empty($bookmarks) )
continue;
- $output .= "<li id='linkcat-$cat->cat_ID' class='linkcat'>$title_before$cat->cat_name$title_after\n\t<ul>\n";
+ $output .= "<li id='linkcat-$cat->cat_ID' class='$class'>$title_before$cat->cat_name$title_after\n\t<ul>\n";
$output .= _walk_bookmarks($bookmarks, $r);
$output .= "\n\t</ul>\n</li>\n";
}
@@ -342,7 +345,7 @@ function wp_list_bookmarks($args = '') {
$bookmarks = get_bookmarks("limit=$limit&category=$category&show_updated=$show_updated&orderby=$orderby&order=$order&hide_invisible=$hide_inivisible&show_updated=$show_updated");
if ( !empty($bookmarks) ) {
- $output .= "<li id='linkuncat' class='linkcat'>$title_before$title_li$title_after\n\t<ul>\n";
+ $output .= "<li id='linkuncat' class='$class'>$title_before$title_li$title_after\n\t<ul>\n";
$output .= _walk_bookmarks($bookmarks, $r);
$output .= "\n\t</ul>\n</li>\n";
}
diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php
index e2a8c69..c15a4f8 100644
--- a/wp-includes/category-template.php
+++ b/wp-includes/category-template.php
@@ -60,15 +60,15 @@ function get_category_parents($id, $link = FALSE, $separator = '/', $nicename =
}
function get_the_category($id = false) {
-global $post, $category_cache;
+global $post, $category_cache, $blog_id;
if ( !$id )
$id = $post->ID;
- if ( !isset($category_cache[$id]) )
+ if ( !isset($category_cache[$blog_id][$id]) )
update_post_category_cache($id);
- $categories = $category_cache[$id];
+ $categories = $category_cache[$blog_id][$id];
if ( !empty($categories) )
sort($categories);
@@ -140,9 +140,9 @@ function get_the_category_list($separator = '', $parents='') {
}
function in_category($category) { // Check if the current post is in the given category
- global $category_cache, $post;
+ global $category_cache, $post, $blog_id;
- if ( isset( $category_cache[$post->ID][$category] ) )
+ if ( isset( $category_cache[$blog_id][$post->ID][$category] ) )
return true;
else
return false;
diff --git a/wp-includes/cron.php b/wp-includes/cron.php
index 6731e70..2310b40 100644
--- a/wp-includes/cron.php
+++ b/wp-includes/cron.php
@@ -1,7 +1,6 @@
<?php
-function wp_schedule_single_event( $timestamp, $hook ) {
- $args = array_slice( func_get_args(), 2 );
+function wp_schedule_single_event( $timestamp, $hook, $args = array()) {
$crons = _get_cron_array();
$key = md5(serialize($args));
$crons[$timestamp][$hook][$key] = array( 'schedule' => false, 'args' => $args );
@@ -9,8 +8,7 @@ function wp_schedule_single_event( $timestamp, $hook ) {
_set_cron_array( $crons );
}
-function wp_schedule_event( $timestamp, $recurrence, $hook ) {
- $args = array_slice( func_get_args(), 3 );
+function wp_schedule_event( $timestamp, $recurrence, $hook, $args = array()) {
$crons = _get_cron_array();
$schedules = wp_get_schedules();
$key = md5(serialize($args));
@@ -21,8 +19,7 @@ function wp_schedule_event( $timestamp, $recurrence, $hook ) {
_set_cron_array( $crons );
}
-function wp_reschedule_event( $timestamp, $recurrence, $hook ) {
- $args = array_slice( func_get_args(), 3 );
+function wp_reschedule_event( $timestamp, $recurrence, $hook, $args = array()) {
$crons = _get_cron_array();
$schedules = wp_get_schedules();
$key = md5(serialize($args));
diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php
index ad60242..4dd3f7d 100644
--- a/wp-includes/default-filters.php
+++ b/wp-includes/default-filters.php
@@ -145,6 +145,7 @@ add_filter('option_ping_sites', 'privacy_ping_filter');
add_filter('option_blog_charset', 'wp_specialchars');
add_filter('mce_plugins', '_mce_load_rtl_plugin');
add_filter('mce_buttons', '_mce_add_direction_buttons');
+add_filter('tiny_mce_config_url', '_mce_config_url');
// Actions
add_action('wp_head', 'rsd_link');
@@ -152,7 +153,7 @@ add_action('wp_head', 'locale_stylesheet');
add_action('publish_future_post', 'wp_publish_post', 10, 1);
add_action('wp_head', 'noindex', 1);
add_action('wp_head', 'wp_print_scripts');
-if(!defined('DOING_CRON'))
+if(!defined('DOING_CRON') && !strstr( $_SERVER['REQUEST_URI'], 'wp-cron.php' ) )
add_action('init', 'wp_cron');
add_action('do_feed_rdf', 'do_feed_rdf', 10, 1);
add_action('do_feed_rss', 'do_feed_rss', 10, 1);
diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php
index 11f0067..5c96044 100644
--- a/wp-includes/formatting.php
+++ b/wp-includes/formatting.php
@@ -618,14 +618,7 @@ function convert_smilies($text) {
if (get_option('use_smilies')) {
// HTML loop taken from texturize function, could possible be consolidated
$textarr = preg_split("/(<.*>)/U", $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between
- $stop = count($textarr);// loop stuff
- for ($i = 0; $i < $stop; $i++) {
- $content = $textarr[$i];
- if ((strlen($content) > 0) && ('<' != $content{0})) { // If it's not a tag
- $content = preg_replace($wp_smiliessearch, $wp_smiliesreplace, $content);
- }
- $output .= $content;
- }
+ $output = implode('', preg_replace($wp_smiliessearch, $wp_smiliesreplace, $textarr));
} else {
// return default text.
$output = $text;
@@ -1070,11 +1063,8 @@ function js_escape($text) {
return preg_replace("/\r?\n/", "\\n", addslashes($text));
}
-function wp_make_link_relative( $link, $base = '' ) {
- if ( !$base )
- $base = get_option( 'home' );
- if ( 0 === strpos($link, $base) )
- $link = substr_replace($link, '', 0, strlen($base));
- return $link;
+function wp_make_link_relative( $link ) {
+ return preg_replace('|https?://[^/]+(/.*)|i', '$1', $link );
}
+
?>
diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index 1762e89..6dc1f7f 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -106,10 +106,10 @@ function get_weekstartend($mysqlstring, $start_of_week) {
}
function get_lastpostdate($timezone = 'server') {
- global $cache_lastpostdate, $pagenow, $wpdb;
+ global $cache_lastpostdate, $pagenow, $wpdb, $blog_id;
$add_seconds_blog = get_option('gmt_offset') * 3600;
$add_seconds_server = date('Z');
- if ( !isset($cache_lastpostdate[$timezone]) ) {
+ if ( !isset($cache_lastpostdate[$blog_id][$timezone]) ) {
switch(strtolower($timezone)) {
case 'gmt':
$lastpostdate = $wpdb->get_var("SELECT post_date_gmt FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");
@@ -121,18 +121,18 @@ function get_lastpostdate($timezone = 'server') {
$lastpostdate = $wpdb->get_var("SELECT DATE_ADD(post_date_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");
break;
}
- $cache_lastpostdate[$timezone] = $lastpostdate;
+ $cache_lastpostdate[$blog_id][$timezone] = $lastpostdate;
} else {
- $lastpostdate = $cache_lastpostdate[$timezone];
+ $lastpostdate = $cache_lastpostdate[$blog_id][$timezone];
}
return $lastpostdate;
}
function get_lastpostmodified($timezone = 'server') {
- global $cache_lastpostmodified, $pagenow, $wpdb;
+ global $cache_lastpostmodified, $pagenow, $wpdb, $blog_id;
$add_seconds_blog = get_option('gmt_offset') * 3600;
$add_seconds_server = date('Z');
- if ( !isset($cache_lastpostmodified[$timezone]) ) {
+ if ( !isset($cache_lastpostmodified[$blog_id][$timezone]) ) {
switch(strtolower($timezone)) {
case 'gmt':
$lastpostmodified = $wpdb->get_var("SELECT post_modified_gmt FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
@@ -148,9 +148,9 @@ function get_lastpostmodified($timezone = 'server') {
if ( $lastpostdate > $lastpostmodified ) {
$lastpostmodified = $lastpostdate;
}
- $cache_lastpostmodified[$timezone] = $lastpostmodified;
+ $cache_lastpostmodified[$blog_id][$timezone] = $lastpostmodified;
} else {
- $lastpostmodified = $cache_lastpostmodified[$timezone];
+ $lastpostmodified = $cache_lastpostmodified[$blog_id][$timezone];
}
return $lastpostmodified;
}
@@ -204,7 +204,7 @@ function get_option($setting) {
$value = $row->option_value;
wp_cache_set($setting, ($value=='')?'emptystringindb':$value, 'options');
} else {
- wp_cache_set($setting, 'novalueindb', 'options', 5);
+ wp_cache_set($setting, 'novalueindb', 'options');
return false;
}
}
@@ -491,41 +491,41 @@ function is_new_day() {
}
function update_post_cache(&$posts) {
- global $post_cache;
+ global $post_cache, $blog_id;
if ( !$posts )
return;
for ($i = 0; $i < count($posts); $i++) {
- $post_cache[$posts[$i]->ID] = &$posts[$i];
+ $post_cache[$blog_id][$posts[$i]->ID] = &$posts[$i];
}
}
function clean_post_cache($id) {
- global $post_cache;
+ global $post_cache, $blog_id;
- if ( isset( $post_cache[$id] ) )
- unset( $post_cache[$id] );
+ if ( isset( $post_cache[$blog_id][$id] ) )
+ unset( $post_cache[$blog_id][$id] );
}
function update_page_cache(&$pages) {
- global $page_cache;
+ global $page_cache, $blog_id;
if ( !$pages )
return;
for ($i = 0; $i < count($pages); $i++) {
- $page_cache[$pages[$i]->ID] = &$pages[$i];
+ $page_cache[$blog_id][$pages[$i]->ID] = &$pages[$i];
wp_cache_add($pages[$i]->ID, $pages[$i], 'pages');
}
}
function clean_page_cache($id) {
- global $page_cache, $wpdb;
+ global $page_cache, $wpdb, $blog_id;
- if ( isset( $page_cache[$id] ) )
- unset( $page_cache[$id] );
+ if ( isset( $page_cache[$blog_id][$id] ) )
+ unset( $page_cache[$blog_id][$id] );
$page_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type='page'");
wp_cache_delete('all_page_ids','pages');
@@ -533,7 +533,7 @@ function clean_page_cache($id) {
}
function update_post_category_cache($post_ids) {
- global $wpdb, $category_cache;
+ global $wpdb, $category_cache, $blog_id;
if ( empty($post_ids) )
return;
@@ -547,12 +547,12 @@ function update_post_category_cache($post_ids) {
return;
foreach ($dogs as $catt)
- $category_cache[$catt->post_id][$catt->category_id] = &get_category($catt->category_id);
+ $category_cache[$blog_id][$catt->post_id][$catt->category_id] = &get_category($catt->category_id);
}
function update_post_caches(&$posts) {
global $post_cache, $category_cache, $post_meta_cache;
- global $wpdb;
+ global $wpdb, $blog_id;
// No point in doing all this work if we didn't match any posts.
if ( !$posts )
@@ -561,7 +561,7 @@ function update_post_caches(&$posts) {
// Get the categories for all the posts
for ($i = 0; $i < count($posts); $i++) {
$post_id_array[] = $posts[$i]->ID;
- $post_cache[$posts[$i]->ID] = &$posts[$i];
+ $post_cache[$blog_id][$posts[$i]->ID] = &$posts[$i];
}
$post_id_list = implode(',', $post_id_array);
@@ -571,20 +571,20 @@ function update_post_caches(&$posts) {
// Get post-meta info
if ( $meta_list = $wpdb->get_results("SELECT post_id, meta_key, meta_value FROM $wpdb->postmeta WHERE post_id IN($post_id_list) ORDER BY post_id, meta_key", ARRAY_A) ) {
// Change from flat structure to hierarchical:
- $post_meta_cache = array();
+ $post_meta_cache[$blog_id] = array();
foreach ($meta_list as $metarow) {
$mpid = $metarow['post_id'];
$mkey = $metarow['meta_key'];
$mval = $metarow['meta_value'];
// Force subkeys to be array type:
- if ( !isset($post_meta_cache[$mpid]) || !is_array($post_meta_cache[$mpid]) )
- $post_meta_cache[$mpid] = array();
- if ( !isset($post_meta_cache[$mpid]["$mkey"]) || !is_array($post_meta_cache[$mpid]["$mkey"]) )
- $post_meta_cache[$mpid]["$mkey"] = array();
+ if ( !isset($post_meta_cache[$blog_id][$mpid]) || !is_array($post_meta_cache[$blog_id][$mpid]) )
+ $post_meta_cache[$blog_id][$mpid] = array();
+ if ( !isset($post_meta_cache[$blog_id][$mpid]["$mkey"]) || !is_array($post_meta_cache[$blog_id][$mpid]["$mkey"]) )
+ $post_meta_cache[$blog_id][$mpid]["$mkey"] = array();
// Add a value to the current pid/key:
- $post_meta_cache[$mpid][$mkey][] = $mval;
+ $post_meta_cache[$blog_id][$mpid][$mkey][] = $mval;
}
}
}
@@ -812,6 +812,7 @@ function do_feed_atom() {
function do_robots() {
global $current_blog;
do_action('do_robotstxt');
+
if ( '0' == $current_blog->public ) {
echo "User-agent: *\n";
echo "Disallow: /\n";
@@ -1127,62 +1128,31 @@ function wp_nonce_ays($action) {
}
function wp_die($message, $title = '') {
+ global $wp_locale;
+
header('Content-Type: text/html; charset=utf-8');
if ( empty($title) )
$title = __('WordPress &rsaquo; Error');
if ( strstr($_SERVER['PHP_SELF'], 'wp-admin') )
- $logo_src = 'images/wordpress-logo.png';
+ $admin_dir = '';
else
- $logo_src = 'wp-admin/images/wordpress-logo.png';
+ $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">
+<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head>
<title><?php echo $title ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <style media="screen" type="text/css">
- <!--
- html {
- background: #eee;
- }
- body {
- background: #fff;
- color: #000;
- font-family: Georgia, "Times New Roman", Times, serif;
- margin-left: 25%;
- margin-right: 25%;
- padding: .2em 2em;
- }
-
- h1 {
- color: #006;
- font-size: 18px;
- font-weight: lighter;
- }
-
- h2 {
- font-size: 16px;
- }
-
- p, li, dt {
- line-height: 140%;
- padding-bottom: 2px;
- }
-
- ul, ol {
- padding: 5px 5px 5px 20px;
- }
- #logo {
- margin-bottom: 2em;
- }
- -->
- </style>
+ <link rel="stylesheet" href="<?php echo $admin_dir; ?>install.css" type="text/css" />
+<?php if ( ('rtl' == $wp_locale->text_direction) ) : ?>
+ <link rel="stylesheet" href="<?php echo $admin_dir; ?>install-rtl.css" type="text/css" />
+<?php endif; ?>
</head>
<body>
- <h1 id="logo"><img alt="WordPress" src="<?php echo $logo_src; ?>" /></h1>
+ <h1 id="logo"><img alt="WordPress" src="<?php echo $admin_dir; ?>images/wordpress-logo.png" /></h1>
<p><?php echo $message; ?></p>
</body>
</html>
@@ -1191,10 +1161,24 @@ function wp_die($message, $title = '') {
die();
}
+function _mce_config_url($url) {
+ global $wp_locale;
+
+ if ( 'rtl' == $wp_locale->text_direction )
+ $url = add_query_arg('mce_text_direction', 'rtl', $url);
+
+ return $url;
+}
+
function _mce_set_direction() {
global $wp_locale;
- if ('rtl' == $wp_locale->text_direction) {
+ if ( isset($_GET['mce_text_direction']) && 'rtl' == $_GET['mce_text_direction'] )
+ $dir = 'rtl';
+ else
+ $dir = $wp_locale->text_direction;
+
+ if ( 'rtl' == $dir ) {
echo 'directionality : "rtl" ,';
echo 'theme_advanced_toolbar_align : "right" ,';
}
@@ -1203,7 +1187,12 @@ function _mce_set_direction() {
function _mce_load_rtl_plugin($input) {
global $wp_locale;
- if ('rtl' == $wp_locale->text_direction)
+ if ( isset($_GET['mce_text_direction']) && 'rtl' == $_GET['mce_text_direction'] )
+ $dir = 'rtl';
+ else
+ $dir = $wp_locale->text_direction;
+
+ if ( 'rtl' == $dir )
$input[] = 'directionality';
return $input;
@@ -1212,7 +1201,12 @@ function _mce_load_rtl_plugin($input) {
function _mce_add_direction_buttons($input) {
global $wp_locale;
- if ('rtl' == $wp_locale->text_direction) {
+ if ( isset($_GET['mce_text_direction']) && 'rtl' == $_GET['mce_text_direction'] )
+ $dir = 'rtl';
+ else
+ $dir = $wp_locale->text_direction;
+
+ if ( 'rtl' == $dir ) {
$new_buttons = array('separator', 'ltr', 'rtl');
$input = array_merge($input, $new_buttons);
}
diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php
index ab68a5d..d5c2e49 100644
--- a/wp-includes/general-template.php
+++ b/wp-includes/general-template.php
@@ -206,7 +206,7 @@ function wp_title($sep = '&raquo;', $display = true) {
}
$prefix = '';
- if ( isset($title) )
+ if ( !empty($title) )
$prefix = " $sep ";
$title = $prefix . $title;
@@ -333,7 +333,11 @@ function wp_get_archives($args = '') {
$add_minutes = intval(60 * (get_option('gmt_offset') - $add_hours));
if ( 'monthly' == $type ) {
- $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit);
+ $arcresults = wp_cache_get( md5('archives' . $type . $limit), 'general');
+ if ( !$arcresults ) {
+ $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit);
+ wp_cache_set( md5('archives' . $type . $limit), $arcresults, 'general', 600 );
+ }
if ( $arcresults ) {
$afterafter = $after;
foreach ( $arcresults as $arcresult ) {
@@ -452,8 +456,8 @@ function get_calendar($initial = true) {
else
$thismonth = ''.zeroise(intval(substr($m, 4, 2)), 2);
} else {
- $thisyear = gmdate('Y', current_time('timestamp') + get_option('gmt_offset') * 3600);
- $thismonth = gmdate('m', current_time('timestamp') + get_option('gmt_offset') * 3600);
+ $thisyear = gmdate('Y', current_time('timestamp'));
+ $thismonth = gmdate('m', current_time('timestamp'));
}
$unixmonth = mktime(0, 0 , 0, $thismonth, 1, $thisyear);
@@ -758,6 +762,24 @@ function user_can_richedit() {
return apply_filters('user_can_richedit', $can);
}
+function user_can_switchedit() {
+ $can = true;
+
+ $ua = $_SERVER['HTTP_USER_AGENT'];
+
+ if (
+ !user_can_richedit() ||
+ ( // Mozilla Test
+ strstr($ua, 'Mozilla/5.0') &&
+ !strstr($ua, 'ompatible') &&
+ !strstr($ua, 'irefox')
+ )
+ )
+ $can = false;
+
+ return apply_filters('user_can_switchedit', $can);
+}
+
function the_editor($content, $id = 'content', $prev_id = 'title') {
$rows = get_option('default_post_edit_rows');
if (($rows < 3) || ($rows > 100))
@@ -768,13 +790,8 @@ function the_editor($content, $id = 'content', $prev_id = 'title') {
if ( user_can_richedit() ) :
add_filter('the_editor_content', 'wp_richedit_pre');
- // The following line moves the border so that the active button "attaches" to the toolbar. Only IE needs it.
+ if ( user_can_switchedit() ) :
?>
- <style type="text/css">
- #postdivrich table, #postdivrich #quicktags {border-top: none;}
- #quicktags {border-bottom: none; padding-bottom: 2px; margin-bottom: -1px;}
- #edButtons {border-bottom: 1px solid #ccc;}
- </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('Editor'); ?>' />
@@ -785,7 +802,7 @@ function the_editor($content, $id = 'content', $prev_id = 'title') {
document.getElementById('edButtons').style.display = 'block';
</script>
- <?php endif; ?>
+ <?php endif; endif; ?>
<div id="quicktags">
<?php wp_print_scripts( 'quicktags' ); ?>
<script type="text/javascript">edToolbar()</script>
@@ -820,7 +837,9 @@ function the_editor($content, $id = 'content', $prev_id = 'title') {
</script>
<?php
- $the_editor = apply_filters('the_editor', "<div><textarea class='mceEditor' $rows cols='40' name='$id' tabindex='2' id='$id'>%s</textarea></div>\n");
+ $class = user_can_switchedit() ? 'switched' : 'unswitched';
+
+ $the_editor = apply_filters('the_editor', "<div class='$class'><textarea class='mceEditor' $rows cols='40' name='$id' tabindex='2' id='$id'>%s</textarea></div>\n");
$the_editor_content = apply_filters('the_editor_content', $content);
printf($the_editor, $the_editor_content);
diff --git a/wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js b/wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js
index c266c82..b7dadc6 100644
--- a/wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js
+++ b/wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js
@@ -17,6 +17,11 @@ function onLoadInit() {
document.forms[0].htmlSource.value = fixContent(tinyMCE.getContent(tinyMCE.getWindowArg('editor_id')));
resizeInputs();
+
+ if (tinyMCE.getParam("theme_advanced_source_editor_wrap", true)) {
+ setWrap('soft');
+ document.forms[0].wraped.checked = true;
+ }
}
function setWrap(val) {
diff --git a/wp-includes/js/tinymce/tiny_mce_config.php b/wp-includes/js/tinymce/tiny_mce_config.php
index 808cfb6..697100f 100644
--- a/wp-includes/js/tinymce/tiny_mce_config.php
+++ b/wp-includes/js/tinymce/tiny_mce_config.php
@@ -31,6 +31,9 @@
$mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'separator', 'bullist', 'numlist', 'outdent', 'indent', 'separator', 'justifyleft', 'justifycenter', 'justifyright', 'separator', 'link', 'unlink', 'image', 'wp_more', 'separator', 'spellchecker', 'separator', 'wp_help', 'wp_adv_start', 'wp_adv', 'separator', 'formatselect', 'underline', 'justifyfull', 'forecolor', 'separator', 'pastetext', 'pasteword', 'separator', 'removeformat', 'cleanup', 'separator', 'charmap', 'separator', 'undo', 'redo', 'wp_adv_end'));
$mce_buttons = implode($mce_buttons, ',');
+ if ( !user_can_switchedit() )
+ $mce_buttons = str_replace('wp_help', 'wp_help,code', $mce_buttons);
+
$mce_buttons_2 = apply_filters('mce_buttons_2', array());
$mce_buttons_2 = implode($mce_buttons_2, ',');
@@ -62,6 +65,7 @@ initArray = {
theme_advanced_toolbar_align : "left",
theme_advanced_path_location : "bottom",
theme_advanced_resizing : true,
+ theme_advanced_source_editor_wrap : true,
browsers : "<?php echo $mce_browsers; ?>",
dialog_type : "modal",
theme_advanced_resize_horizontal : false,
diff --git a/wp-includes/l10n.php b/wp-includes/l10n.php
index b2b099c..a29bf26 100644
--- a/wp-includes/l10n.php
+++ b/wp-includes/l10n.php
@@ -6,11 +6,15 @@ function get_locale() {
return $locale;
// WPLANG is defined in wp-config.
- if (defined('WPLANG'))
+ if ( defined('WPLANG') && '' != WPLANG )
$locale = WPLANG;
+ else if ( is_admin() )
+ $locale = get_user_lang_code();
+ else
+ $locale = get_blog_lang_code();
if (empty($locale))
- $locale = 'en_US';
+ $locale = 'en';
$locale = apply_filters('locale', $locale);
diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php
index afd5c59..57ae28a 100644
--- a/wp-includes/pluggable.php
+++ b/wp-includes/pluggable.php
@@ -227,6 +227,8 @@ function auth_redirect() {
(empty($_COOKIE[USER_COOKIE])) ) {
nocache_headers();
+ wp_clearcookie();
+
wp_redirect(get_option('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI']));
exit();
}
diff --git a/wp-includes/plugin.php b/wp-includes/plugin.php
index cac0897..7c58519 100644
--- a/wp-includes/plugin.php
+++ b/wp-includes/plugin.php
@@ -100,7 +100,8 @@ function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1)
}
function do_action($tag, $arg = '') {
- global $wp_filter;
+ global $wp_filter, $wp_actions;
+
$args = array();
if ( is_array($arg) && 1 == count($arg) && is_object($arg[0]) ) // array(&$this)
$args[] =& $arg[0];
@@ -132,10 +133,27 @@ function do_action($tag, $arg = '') {
}
}
}
+
+ if ( is_array($wp_actions) )
+ $wp_actions[] = $tag;
+ else
+ $wp_actions = array($tag);
+}
+
+// Returns the number of times an action has been done
+function did_action($tag) {
+ global $wp_actions;
+
+ return count(array_keys($wp_actions, $tag));
}
function do_action_ref_array($tag, $args) {
- global $wp_filter;
+ global $wp_filter, $wp_actions;
+
+ if ( !is_array($wp_actions) )
+ $wp_actions = array($tag);
+ else
+ $wp_actions[] = $tag;
merge_filters($tag);
diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php
index 7f84916..32006b8 100644
--- a/wp-includes/post-template.php
+++ b/wp-includes/post-template.php
@@ -349,6 +349,8 @@ function get_attachment_icon($id = 0, $fullsize = false, $max_dims = false) {
$file = get_post_meta($post->ID, '_wp_attached_file', true);
+ $exts = array('jpg', 'gif', 'png');
+
if ( !$fullsize && !empty($imagedata['thumb'])
&& ($thumbfile = str_replace(basename($file), $imagedata['thumb'], $file))
&& file_exists($thumbfile) ) {
@@ -359,7 +361,7 @@ function get_attachment_icon($id = 0, $fullsize = false, $max_dims = false) {
$src_file = $thumbfile;
$class = 'attachmentthumb';
- } elseif ( substr($mime, 0, 6) == 'image/'
+ } elseif ( ( substr($mime, 0, 6) == 'image/' || 'import' == $mime && in_array(substr($file, -3), $exts) )
&& file_exists($file) ) {
// We have an image without a thumbnail
@@ -374,7 +376,6 @@ function get_attachment_icon($id = 0, $fullsize = false, $max_dims = false) {
$icon_dir_uri = apply_filters('icon_dir_uri', get_template_directory_uri().'/images');
$types = array(substr($mime, 0, strpos($mime, '/')), substr($mime, strpos($mime, '/') + 1), str_replace('/', '_', $mime));
- $exts = array('jpg', 'gif', 'png');
foreach ($types as $type) {
foreach ($exts as $ext) {
$src_file = "$icon_dir/$type.$ext";
diff --git a/wp-includes/post.php b/wp-includes/post.php
index 1968714..04f104e 100644
--- a/wp-includes/post.php
+++ b/wp-includes/post.php
@@ -9,7 +9,7 @@ function get_attached_file($attachment_id) {
}
function &get_children($post = 0, $output = OBJECT) {
- global $post_cache, $wpdb;
+ global $post_cache, $wpdb, $blog_id;
if ( empty($post) ) {
if ( isset($GLOBALS['post']) )
@@ -30,7 +30,7 @@ function &get_children($post = 0, $output = OBJECT) {
if ( $children ) {
foreach ( $children as $key => $child ) {
- $post_cache[$child->ID] =& $children[$key];
+ $post_cache[$blog_id][$child->ID] =& $children[$key];
$kids[$child->ID] =& $children[$key];
}
} else {
@@ -72,7 +72,7 @@ function get_extended($post) {
// Retrieves post data given a post ID or post object.
// Handles post caching.
function &get_post(&$post, $output = OBJECT) {
- global $post_cache, $wpdb;
+ global $post_cache, $wpdb, $blog_id;
if ( empty($post) ) {
if ( isset($GLOBALS['post']) )
@@ -82,25 +82,25 @@ function &get_post(&$post, $output = OBJECT) {
} elseif ( is_object($post) ) {
if ( 'page' == $post->post_type )
return get_page($post, $output);
- if ( !isset($post_cache[$post->ID]) )
- $post_cache[$post->ID] = &$post;
- $_post = & $post_cache[$post->ID];
+ if ( !isset($post_cache[$blog_id][$post->ID]) )
+ $post_cache[$blog_id][$post->ID] = &$post;
+ $_post = & $post_cache[$blog_id][$post->ID];
} else {
if ( $_post = wp_cache_get($post, 'pages') )
return get_page($_post, $output);
- elseif ( isset($post_cache[$post]) )
- $_post = & $post_cache[$post];
+ elseif ( isset($post_cache[$blog_id][$post]) )
+ $_post = & $post_cache[$blog_id][$post];
else {
$query = "SELECT * FROM $wpdb->posts WHERE ID = '$post' LIMIT 1";
$_post = & $wpdb->get_row($query);
if ( 'page' == $_post->post_type )
return get_page($_post, $output);
- $post_cache[$post] = & $_post;
+ $post_cache[$blog_id][$post] = & $_post;
}
}
if ( defined('WP_IMPORTING') )
- unset($post_cache);
+ unset($post_cache[$blog_id]);
if ( $output == OBJECT ) {
return $_post;
@@ -219,7 +219,7 @@ function get_posts($args) {
//
function add_post_meta($post_id, $key, $value, $unique = false) {
- global $wpdb, $post_meta_cache;
+ global $wpdb, $post_meta_cache, $blog_id;
if ( $unique ) {
if ( $wpdb->get_var("SELECT meta_key FROM $wpdb->postmeta WHERE meta_key
@@ -234,13 +234,13 @@ function add_post_meta($post_id, $key, $value, $unique = false) {
$wpdb->query("INSERT INTO $wpdb->postmeta (post_id,meta_key,meta_value) VALUES ('$post_id','$key','$value')");
- $post_meta_cache['$post_id'][$key][] = $original;
+ $post_meta_cache[$blog_id]['$post_id'][$key][] = $original;
return true;
}
function delete_post_meta($post_id, $key, $value = '') {
- global $wpdb, $post_meta_cache;
+ global $wpdb, $post_meta_cache, $blog_id;
if ( empty($value) ) {
$meta_id = $wpdb->get_var("SELECT meta_id FROM $wpdb->postmeta WHERE
@@ -256,29 +256,29 @@ post_id = '$post_id' AND meta_key = '$key' AND meta_value = '$value'");
if ( empty($value) ) {
$wpdb->query("DELETE FROM $wpdb->postmeta WHERE post_id = '$post_id'
AND meta_key = '$key'");
- unset($post_meta_cache['$post_id'][$key]);
+ unset($post_meta_cache[$blog_id]['$post_id'][$key]);
} else {
$wpdb->query("DELETE FROM $wpdb->postmeta WHERE post_id = '$post_id'
AND meta_key = '$key' AND meta_value = '$value'");
- $cache_key = $post_meta_cache['$post_id'][$key];
+ $cache_key = $post_meta_cache[$blog_id]['$post_id'][$key];
if ($cache_key) foreach ( $cache_key as $index => $data )
if ( $data == $value )
- unset($post_meta_cache['$post_id'][$key][$index]);
+ unset($post_meta_cache[$blog_id]['$post_id'][$key][$index]);
}
- unset($post_meta_cache['$post_id'][$key]);
+ unset($post_meta_cache[$blog_id]['$post_id'][$key]);
return true;
}
function get_post_meta($post_id, $key, $single = false) {
- global $wpdb, $post_meta_cache;
+ global $wpdb, $post_meta_cache, $blog_id;
- if ( isset($post_meta_cache[$post_id][$key]) ) {
+ if ( isset($post_meta_cache[$blog_id][$post_id][$key]) ) {
if ( $single ) {
- return maybe_unserialize( $post_meta_cache[$post_id][$key][0] );
+ return maybe_unserialize( $post_meta_cache[$blog_id][$post_id][$key][0] );
} else {
- return maybe_unserialize( $post_meta_cache[$post_id][$key] );
+ return maybe_unserialize( $post_meta_cache[$blog_id][$post_id][$key] );
}
}
@@ -305,7 +305,7 @@ function get_post_meta($post_id, $key, $single = false) {
}
function update_post_meta($post_id, $key, $value, $prev_value = '') {
- global $wpdb, $post_meta_cache;
+ global $wpdb, $post_meta_cache, $blog_id;
$original_value = $value;
if ( is_array($value) || is_object($value) )
@@ -323,18 +323,18 @@ function update_post_meta($post_id, $key, $value, $prev_value = '') {
if ( empty($prev_value) ) {
$wpdb->query("UPDATE $wpdb->postmeta SET meta_value = '$value' WHERE
meta_key = '$key' AND post_id = '$post_id'");
- $cache_key = $post_meta_cache['$post_id'][$key];
+ $cache_key = $post_meta_cache[$blog_id]['$post_id'][$key];
if ( !empty($cache_key) )
foreach ($cache_key as $index => $data)
- $post_meta_cache['$post_id'][$key][$index] = $original_value;
+ $post_meta_cache[$blog_id]['$post_id'][$key][$index] = $original_value;
} else {
$wpdb->query("UPDATE $wpdb->postmeta SET meta_value = '$value' WHERE
meta_key = '$key' AND post_id = '$post_id' AND meta_value = '$prev_value'");
- $cache_key = $post_meta_cache['$post_id'][$key];
+ $cache_key = $post_meta_cache[$blog_id]['$post_id'][$key];
if ( !empty($cache_key) )
foreach ($cache_key as $index => $data)
if ( $data == $original_prev )
- $post_meta_cache['$post_id'][$key][$index] = $original_value;
+ $post_meta_cache[$blog_id]['$post_id'][$key][$index] = $original_value;
}
return true;
@@ -342,13 +342,13 @@ meta_key = '$key' AND post_id = '$post_id' AND meta_value = '$prev_value'");
function get_post_custom( $post_id = 0 ) {
- global $id, $post_meta_cache, $wpdb;
+ global $id, $post_meta_cache, $wpdb, $blog_id;
if ( ! $post_id )
$post_id = $id;
- if ( isset($post_meta_cache[$post_id]) )
- return $post_meta_cache[$post_id];
+ if ( isset($post_meta_cache[$blog_id][$post_id]) )
+ return $post_meta_cache[$blog_id][$post_id];
if ( $meta_list = $wpdb->get_results("SELECT post_id, meta_key, meta_value FROM $wpdb->postmeta WHERE post_id = '$post_id' ORDER BY post_id, meta_key", ARRAY_A) ) {
// Change from flat structure to hierarchical:
@@ -359,16 +359,16 @@ function get_post_custom( $post_id = 0 ) {
$mval = $metarow['meta_value'];
// Force subkeys to be array type:
- if ( !isset($post_meta_cache[$mpid]) || !is_array($post_meta_cache[$mpid]) )
- $post_meta_cache[$mpid] = array();
+ if ( !isset($post_meta_cache[$blog_id][$mpid]) || !is_array($post_meta_cache[$blog_id][$mpid]) )
+ $post_meta_cache[$blog_id][$mpid] = array();
- if ( !isset($post_meta_cache[$mpid]["$mkey"]) || !is_array($post_meta_cache[$mpid]["$mkey"]) )
- $post_meta_cache[$mpid]["$mkey"] = array();
+ if ( !isset($post_meta_cache[$blog_id][$mpid]["$mkey"]) || !is_array($post_meta_cache[$blog_id][$mpid]["$mkey"]) )
+ $post_meta_cache[$blog_id][$mpid]["$mkey"] = array();
// Add a value to the current pid/key:
- $post_meta_cache[$mpid][$mkey][] = $mval;
+ $post_meta_cache[$blog_id][$mpid][$mkey][] = $mval;
}
- return $post_meta_cache[$mpid];
+ return $post_meta_cache[$blog_id][$mpid];
}
}
@@ -698,7 +698,7 @@ function wp_insert_post($postarr = array()) {
// Schedule publication.
if ( 'future' == $post_status )
- wp_schedule_single_event(strtotime($post_date_gmt. ' GMT'), 'publish_future_post', $post_ID);
+ wp_schedule_single_event(strtotime($post_date_gmt. ' GMT'), 'publish_future_post', array($post_ID));
do_action('save_post', $post_ID);
do_action('wp_insert_post', $post_ID);
@@ -908,7 +908,7 @@ function get_all_page_ids() {
// Retrieves page data given a page ID or page object.
// Handles page caching.
function &get_page(&$page, $output = OBJECT) {
- global $wpdb;
+ global $wpdb, $blog_id;
if ( empty($page) ) {
if ( isset($GLOBALS['page']) ) {
@@ -926,7 +926,7 @@ function &get_page(&$page, $output = OBJECT) {
if ( isset($GLOBALS['page']->ID) && ($page == $GLOBALS['page']->ID) ) {
$_page = & $GLOBALS['page'];
wp_cache_add($_page->ID, $_page, 'pages');
- } elseif ( isset($_page) && $_page == $GLOBALS['post_cache'][$page] ) {
+ } elseif ( isset($_page) && $_page == $GLOBALS['post_cache'][$blog_id][$page] ) {
return get_post($page, $output);
} elseif ( isset($_page) && $_page == wp_cache_get($page, 'pages') ) {
// Got it.
@@ -982,10 +982,10 @@ function get_page_by_path($page_path, $output = OBJECT) {
}
function &get_page_children($page_id, $pages) {
- global $page_cache;
+ global $page_cache, $blog_id;
if ( empty($pages) )
- $pages = &$page_cache;
+ $pages = &$page_cache[$blog_id];
$page_list = array();
foreach ( $pages as $page ) {
diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php
index cf790ab..f5585ec 100644
--- a/wp-includes/script-loader.php
+++ b/wp-includes/script-loader.php
@@ -17,7 +17,7 @@ class WP_Scripts {
$this->add( 'colorpicker', '/wp-includes/js/colorpicker.js', false, '3517' );
$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( 'wp_tiny_mce', $mce_config, array('tiny_mce'), '20061006' );
$this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.0');
$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');
@@ -35,7 +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() );
+ $this->add( 'upload', '/wp-admin/upload-js.php', array('prototype'), '4355b' );
}
}
diff --git a/wp-includes/vars.php b/wp-includes/vars.php
index 82c7b10..5bf2807 100644
--- a/wp-includes/vars.php
+++ b/wp-includes/vars.php
@@ -87,7 +87,7 @@ if (!isset($wpsmiliestrans)) {
// generates smilies' search & replace arrays
foreach($wpsmiliestrans as $smiley => $img) {
- $wp_smiliessearch[] = '/(\s|^)?'.preg_quote($smiley, '/').'(\b|\s)/';
+ $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/wpmu-functions.php b/wp-includes/wpmu-functions.php
index cf41fee..27a158d 100644
--- a/wp-includes/wpmu-functions.php
+++ b/wp-includes/wpmu-functions.php
@@ -1,4 +1,4 @@
-<?PHP
+<?php
/*
Helper functions for WPMU
*/
@@ -163,7 +163,7 @@ function get_user_details( $username ) {
}
function get_blog_details( $id, $all = true ) {
- global $wpdb, $wpmuBaseTablePrefix;
+ global $wpdb;
$details = wp_cache_get( $id, 'blog-details' );
@@ -177,9 +177,11 @@ function get_blog_details( $id, $all = true ) {
if( $all == true ) {
$wpdb->hide_errors();
+ switch_to_blog($id);
$details->blogname = get_blog_option($id, 'blogname');
$details->siteurl = get_blog_option($id, 'siteurl');
$details->post_count = get_blog_option($id, 'post_count');
+ restore_current_blog();
$wpdb->show_errors();
wp_cache_set( $id, serialize( $details ), 'blog-details' );
@@ -288,50 +290,40 @@ function update_site_option( $key, $value ) {
}
function get_blog_option( $id, $key, $default='na' ) {
- global $wpdb, $wpmuBaseTablePrefix, $blog_id, $switched;
-
- $current_blog_id = $blog_id;
- $current_options_table = $wpdb->options;
- $wpdb->options = $wpmuBaseTablePrefix . $id . "_options";
- $blog_id = $id;
- if ($id != $current_blog_id)
- $switched = true;
+ switch_to_blog($id);
$opt = get_option( $key );
- $switched = false;
- $blog_id = $current_blog_id;
- $wpdb->options = $current_options_table;
+ restore_current_blog();
return $opt;
}
function add_blog_option( $id, $key, $value ) {
- global $wpdb, $wpmuBaseTablePrefix, $blog_id;
-
- $current_blog_id = $blog_id;
- $current_options_table = $wpdb->options;
- $wpdb->options = $wpmuBaseTablePrefix . $id . "_options";
- $blog_id = $id;
- $opt = add_option( $key, $value );
- $blog_id = $current_blog_id;
- $wpdb->options = $current_options_table;
+ switch_to_blog($id);
+ add_option( $key, $value );
+ restore_current_blog();
}
function update_blog_option( $id, $key, $value ) {
- global $wpdb, $wpmuBaseTablePrefix, $blog_id;
-
- $current_blog_id = $blog_id;
- $current_options_table = $wpdb->options;
- $wpdb->options = $wpmuBaseTablePrefix . $id . "_options";
- $blog_id = $id;
+ switch_to_blog($id);
$opt = update_option( $key, $value );
- $blog_id = $current_blog_id;
- $wpdb->options = $current_options_table;
+ restore_current_blog();
refresh_blog_details( $id );
}
function switch_to_blog( $new_blog ) {
- global $tmpoldblogdetails, $wpdb, $wpmuBaseTablePrefix, $table_prefix, $cache_settings, $category_cache, $cache_categories, $post_cache, $wp_object_cache, $blog_id, $switched, $wp_roles, $current_user;
+ global $tmpoldblogdetails, $wpdb, $wpmuBaseTablePrefix, $table_prefix, $blog_id, $switched, $switched_stack, $wp_roles, $current_user;
+
+ if ( empty($new_blog) )
+ $new_blog = $blog_id;
+
+ if ( empty($switched_stack) )
+ $switched_stack = array();
+
+ $switched_stack[] = $blog_id;
+
+ if ( $new_blog == $blog_id )
+ return;
// backup
$tmpoldblogdetails[ 'blogid' ] = $wpdb->blogid;
@@ -345,12 +337,7 @@ function switch_to_blog( $new_blog ) {
$tmpoldblogdetails[ 'options' ] = $wpdb->options;
$tmpoldblogdetails[ 'postmeta' ] = $wpdb->postmeta;
$tmpoldblogdetails[ 'prefix' ] = $wpdb->prefix;
- $tmpoldblogdetails[ 'cache_settings' ] = $cache_settings;
- $tmpoldblogdetails[ 'category_cache' ] = $category_cache;
- $tmpoldblogdetails[ 'cache_categories' ] = $cache_categories;
$tmpoldblogdetails[ 'table_prefix' ] = $table_prefix;
- $tmpoldblogdetails[ 'post_cache' ] = $post_cache;
- $tmpoldblogdetails[ 'wp_object_cache' ] = $wp_object_cache;
$tmpoldblogdetails[ 'blog_id' ] = $blog_id;
// fix the new prefix.
@@ -368,16 +355,6 @@ function switch_to_blog( $new_blog ) {
$wpdb->postmeta = $table_prefix . 'postmeta';
$blog_id = $new_blog;
- $cache_settings = array();
- unset( $cache_settings );
- unset( $category_cache );
- unset( $cache_categories );
- unset( $post_cache );
- //unset( $wp_object_cache );
- //$wp_object_cache = new WP_Object_Cache();
- //$wp_object_cache->cache_enabled = false;
- wp_cache_flush();
- wp_cache_close();
if( is_object( $wp_roles ) ) {
$wpdb->hide_errors();
$wp_roles->_init();
@@ -386,7 +363,6 @@ function switch_to_blog( $new_blog ) {
if ( is_object( $current_user ) ) {
$current_user->_init_caps();
}
- wp_cache_init();
do_action('switch_blog', $blog_id, $tmpoldblogdetails[ 'blog_id' ]);
@@ -394,7 +370,16 @@ function switch_to_blog( $new_blog ) {
}
function restore_current_blog() {
- global $table_prefix, $tmpoldblogdetails, $wpdb, $wpmuBaseTablePrefix, $cache_settings, $category_cache, $cache_categories, $post_cache, $wp_object_cache, $blog_id, $switched, $wp_roles;
+ global $table_prefix, $tmpoldblogdetails, $wpdb, $wpmuBaseTablePrefix, $blog_id, $switched, $switched_stack, $wp_roles, $current_user;
+
+ if ( !$switched )
+ return;
+
+ $blog = array_pop($switched_stack);
+
+ if ( $blog_id == $blog )
+ return;
+
// backup
$wpdb->blogid = $tmpoldblogdetails[ 'blogid' ];
$wpdb->posts = $tmpoldblogdetails[ 'posts' ];
@@ -407,24 +392,19 @@ function restore_current_blog() {
$wpdb->options = $tmpoldblogdetails[ 'options' ];
$wpdb->postmeta = $tmpoldblogdetails[ 'postmeta' ];
$wpdb->prefix = $tmpoldblogdetails[ 'prefix' ];
- $cache_settings = $tmpoldblogdetails[ 'cache_settings' ];
- $category_cache = $tmpoldblogdetails[ 'category_cache' ];
- $cache_categories = $tmpoldblogdetails[ 'cache_categories' ];
$table_prefix = $tmpoldblogdetails[ 'table_prefix' ];
- $post_cache = $tmpoldblogdetails[ 'post_cache' ];
- $wp_object_cache = $tmpoldblogdetails[ 'wp_object_cache' ];
$prev_blog_id = $blog_id;
$blog_id = $tmpoldblogdetails[ 'blog_id' ];
unset( $tmpoldblogdetails );
- wp_cache_flush();
- wp_cache_close();
+
if( is_object( $wp_roles ) ) {
$wpdb->hide_errors();
$wp_roles->_init();
$wpdb->show_errors();
}
- wp_cache_init();
-
+ if ( is_object( $current_user ) ) {
+ $current_user->_init_caps();
+ }
do_action('switch_blog', $blog_id, $prev_blog_id);
$switched = false;
@@ -453,7 +433,7 @@ function get_blogs_of_user( $id ) {
if ( strstr( $key, '_capabilities') && strstr( $key, 'wp_') ) {
preg_match('/wp_(\d+)_capabilities/', $key, $match);
$blog = get_blog_details( $match[1] );
- if ( $blog && isset( $blog->domain ) ) {
+ if ( $blog && $blog->deleted == 0 && isset( $blog->domain ) ) {
$blogs[$match[1]]->userblog_id = $match[1];
$blogs[$match[1]]->domain = $blog->domain;
$blogs[$match[1]]->path = $blog->path;
@@ -614,7 +594,7 @@ function get_blog_post( $blog_id, $post_id ) {
$post = wp_cache_get( $key, "site-options" );
if( $post == false ) {
$post = $wpdb->get_row( "SELECT * FROM {$wpmuBaseTablePrefix}{$blog_id}_posts WHERE ID = '{$post_id}'" );
- wp_cache_set( $key, $post, "site-options", 30 );
+ wp_cache_set( $key, $post, "site-options", 120 );
}
return $post;
@@ -622,17 +602,7 @@ function get_blog_post( $blog_id, $post_id ) {
}
function add_user_to_blog( $blog_id, $user_id, $role ) {
- global $wpdb;
-
- $switch = false;
-
- if ( empty($blog_id) )
- $blog_id = $wpdb->blogid;
-
- if ( $blog_id != $wpdb->blogid ) {
- $switch = true;
- switch_to_blog($blog_id);
- }
+ switch_to_blog($blog_id);
$user = new WP_User($user_id);
@@ -656,21 +626,13 @@ function add_user_to_blog( $blog_id, $user_id, $role ) {
do_action('add_user_to_blog', $user_id, $role, $blog_id);
- if ( $switch )
- restore_current_blog();
+ restore_current_blog();
}
function remove_user_from_blog($user_id, $blog_id = '') {
global $wpdb;
- if ( empty($blog_id) )
- $blog_id = $wpdb->blogid;
-
- $blog_id = (int) $blog_id;
- if ( $blog_id != $wpdb->blogid ) {
- $switch = true;
- switch_to_blog($blog_id);
- }
+ switch_to_blog($blog_id);
$user_id = (int) $user_id;
@@ -704,8 +666,7 @@ function remove_user_from_blog($user_id, $blog_id = '') {
update_usermeta($user_id, 'source_domain', '');
}
- if ( $switch )
- restore_current_blog();
+ restore_current_blog();
}
function create_empty_blog( $domain, $path, $weblog_title, $site_id = 1 ) {
@@ -823,7 +784,7 @@ function validate_email( $email, $check_domain = true) {
}
function wpmu_validate_user_signup($user_name, $user_email) {
- global $wpdb;
+ global $wpdb, $current_site;
$errors = new WP_Error();
@@ -1070,8 +1031,9 @@ function wpmu_activate_signup($key) {
return new WP_Error('invalid_key', __('Invalid activation key.'));
if ( $signup->active )
- return new WP_Error('already_active', __('The blog is already active.'));
+ return new WP_Error('already_active', __('The blog is already active.'), $signup);
+ $meta = unserialize($signup->meta);
$user_login = $wpdb->escape($signup->user_login);
$user_email = $wpdb->escape($signup->user_email);
$password = generate_random_password();
@@ -1080,25 +1042,37 @@ function wpmu_activate_signup($key) {
if ( ! $user_id )
$user_id = wpmu_create_user($user_login, $password, $user_email);
+ else
+ $user_already_exists = true;
if ( ! $user_id )
- return new WP_Error('create_user', __('Could not create user'));
+ return new WP_Error('create_user', __('Could not create user'), $signup);
$now = current_time('mysql', true);
if ( empty($signup->domain) ) {
$wpdb->query("UPDATE $wpdb->signups SET active = '1', activated = '$now' WHERE activation_key = '$key'");
+ if ( isset($user_already_exists) )
+ return new WP_Error('user_already_exists', __('That username is already activated.'), $signup);
wpmu_welcome_user_notification($user_id, $password, $meta);
do_action('wpmu_activate_user', $user_id, $password, $meta);
return array('user_id' => $user_id, 'password' => $password, 'meta' => $meta);
}
- $meta = unserialize($signup->meta);
$blog_id = wpmu_create_blog($signup->domain, $signup->path, $signup->title, $user_id, $meta);
// TODO: What to do if we create a user but cannot create a blog?
- if ( is_wp_error($blog_id) )
+ if ( is_wp_error($blog_id) ) {
+ // If blog is taken, that means a previous attempt to activate this blog failed in between creating the blog and
+ // setting the activation flag. Let's just set the active flag and instruct the user to reset their password.
+ if ( 'blog_taken' == $blog_id->get_error_code() ) {
+ $blog_id->add_data($signup);
+ $wpdb->query("UPDATE $wpdb->signups SET active = '1', activated = '$now' WHERE activation_key = '$key'");
+ error_log("Blog $blog_id failed to complete activation.", 0);
+ }
+
return $blog_id;
+ }
$wpdb->query("UPDATE $wpdb->signups SET active = '1', activated = '$now' WHERE activation_key = '$key'");
@@ -1123,7 +1097,6 @@ function wpmu_create_user( $user_name, $password, $email) {
if ( email_exists($email) )
return false;
-
$user_id = wp_create_user( $user_name, $password, $email );
$user = new WP_User($user_id);
// Newly created users have no roles or caps until they are added to a blog.
diff --git a/wp-login.php b/wp-login.php
index c70515b..cfc10f7 100644
--- a/wp-login.php
+++ b/wp-login.php
@@ -23,15 +23,18 @@ if ( defined('RELOCATE') ) { // Move flag is set
// Rather than duplicating this HTML all over the place, we'll stick it in function
function login_header($title = 'Login', $message = '') {
- global $errors, $error;
+ global $errors, $error, $wp_locale;
?>
<!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">
+<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head>
<title><?php bloginfo('name'); ?> &rsaquo; <?php echo $title; ?></title>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<link rel="stylesheet" href="<?php bloginfo('wpurl'); ?>/wp-admin/wp-admin.css?version=<?php bloginfo('version'); ?>" type="text/css" />
+<?php if ( ('rtl' == $wp_locale->text_direction) ) : ?>
+ <link rel="stylesheet" href="<?php bloginfo('wpurl'); ?>/wp-admin/rtl.css?version=<?php bloginfo('version'); ?>" type="text/css" />
+<?php endif; ?>
<!--[if IE]><style type="text/css">#login h1 a { margin-top: 35px; } #login ul { padding-bottom: 65px; }</style><![endif]--><!-- Curse you, IE! -->
<script type="text/javascript">
function focusit() {
@@ -43,8 +46,7 @@ function login_header($title = 'Login', $message = '') {
</head>
<body>
-<div id="login">
-<h1><a href="<?php echo apply_filters('login_headerurl', 'http://' . $current_site->domain . $current_site->path ); ?>" title="<?php echo apply_filters('login_headertitle', $current_site->site_name ); ?>"><span class="hide"><?php bloginfo('name'); ?></span></a></h1>
+<div id="login"><h1><a href="<?php echo apply_filters('login_headerurl', 'http://' . $current_site->domain . $current_site->path ); ?>" title="<?php echo apply_filters('login_headertitle', $current_site->site_name ); ?>"><span class="hide"><?php bloginfo('name'); ?></span></a></h1>
<?php
if ( !empty( $message ) ) echo apply_filters('login_message', $message) . "\n";
@@ -210,9 +212,9 @@ default:
$redirect_to = $_REQUEST['redirect_to'];
if ( $_POST ) {
- $user_login = $_POST['user_login'];
+ $user_login = $_POST['log'];
$user_login = sanitize_user( $user_login );
- $user_pass = $_POST['user_pass'];
+ $user_pass = $_POST['pwd'];
$rememberme = $_POST['rememberme'];
} else {
$cookie_login = wp_get_cookie_login();
@@ -264,11 +266,11 @@ default:
<form name="loginform" id="loginform" action="wp-login.php" method="post">
<p>
<label><?php _e('Username:') ?><br />
- <input type="text" name="user_login" id="user_login" class="input" value="<?php echo wp_specialchars(stripslashes($user_login), 1); ?>" size="20" tabindex="10" /></label>
+ <input type="text" name="log" id="user_login" class="input" value="<?php echo wp_specialchars(stripslashes($user_login), 1); ?>" size="20" tabindex="10" /></label>
</p>
<p>
<label><?php _e('Password:') ?><br />
- <input type="password" name="user_pass" id="user_pass" class="input" value="" size="20" tabindex="20" /></label>
+ <input type="password" name="pwd" id="user_pass" class="input" value="" size="20" tabindex="20" /></label>
</p>
<?php do_action('login_form'); ?>
<p><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90" /> <?php _e('Remember me'); ?></label></p>
diff --git a/wp-settings.php b/wp-settings.php
index 0b5350d..54a24df 100644
--- a/wp-settings.php
+++ b/wp-settings.php
@@ -99,7 +99,6 @@ if ( file_exists(ABSPATH . 'wp-content/db.php') )
else
require_once (ABSPATH . WPINC . '/wp-db.php');
-// Table names
$wpdb->blogs = $table_prefix . 'blogs';
$wpdb->users = $table_prefix . 'users';
$wpdb->usermeta = $table_prefix . 'usermeta';
diff --git a/wp-signup.php b/wp-signup.php
index c20a3c1..71f0871 100644
--- a/wp-signup.php
+++ b/wp-signup.php
@@ -27,6 +27,7 @@ form { margin-top: 2em; }
<?php
function show_blog_form($blog_id = '', $blog_title = '', $errors = '') {
global $current_site;
+ $locale = get_locale();
// Blog name/Username
if ( $errors->get_error_message('blog_id') )
@@ -105,7 +106,7 @@ function show_user_form($user_name = '', $user_email = '', $errors = '') {
}
print '<input name="user_name" type="text" id="user_name" value="'.$user_name.'" maxlength="50" style="width:50%; font-size: 30px;" /><br />';
- print __('(Must be at least 4 characters, letters and numbers only.)') . '</td> </tr>';
+ _e('(Must be at least 4 characters, letters and numbers only.)'); echo '</td> </tr>';
// User Email
if ( $errors->get_error_message('user_email') ) {
@@ -118,10 +119,10 @@ function show_user_form($user_name = '', $user_email = '', $errors = '') {
if ( $errmsg = $errors->get_error_message('user_email') ) {
?><p><strong><?php echo $errmsg ?></strong></p><?php
}
- print '
- <input name="user_email" type="text" id="user_email" value="'.wp_specialchars($user_email, 1).'" maxlength="200" /><br /> ' . __('(We&#8217;ll send your password to this address, so <strong>triple-check it</strong>.)') . '</td>
- </tr>';
-
+ ?>
+ <input name="user_email" type="text" id="user_email" value="<?php echo wp_specialchars($user_email, 1) ?>" maxlength="200" /><br /><?php _e('(We&#8217;ll send your password to this address, so <strong>triple-check it</strong>.)') ?></td>
+ </tr>
+ <?php
if ( $errmsg = $errors->get_error_message('generic') )
print '<tr class="error"> <th colspan="2">'.$errmsg.'</th> </tr>';
}
@@ -147,11 +148,11 @@ function signup_another_blog($blog_id = '', $blog_title = '', $errors = '') {
echo '<h2>' . sprintf( __('Get <em>another</em> %s blog in seconds'), $current_site->site_name ) . '</h2>';
if ( $errors->get_error_code() ) {
- print '<p>'.__('There was a problem, please correct the form below and try again.').'</p>';
+ echo "<p>" . __('There was a problem, please correct the form below and try again.') . "</p>";
}
?>
-<?php printf(__("<p>Welcome back, %s. By filling out the form below, you can <strong>add another blog to your account</strong>. There is no limit to the number of blogs you can have, so create to your heart's content, but blog responsibly.</p>"), $current_user->display_name) ?>
+<p><?php printf(__("Welcome back, %s. By filling out the form below, you can <strong>add another blog to your account</strong>. There is no limit to the number of blogs you can have, so create to your heart's content, but blog responsibly."), $current_user->display_name) ?></p>
<?php
$blogs = get_blogs_of_user($current_user->ID);
@@ -165,6 +166,7 @@ function signup_another_blog($blog_id = '', $blog_title = '', $errors = '') {
<p><?php _e("If you&#8217;re not going to use a great blog domain, leave it for a new user. Now have at it!") ?></p>
<form name="setupform" id="setupform" method="post" action="wp-signup.php">
<input type="hidden" name="stage" value="gimmeanotherblog">
+<?php do_action( "signup_hidden_fields" ); ?>
<table border="0" width="100%" cellpadding="9">
<?php
show_blog_form($blog_id, $blog_title, $errors);
diff --git a/xmlrpc.php b/xmlrpc.php
index c937122..d8f75df 100644
--- a/xmlrpc.php
+++ b/xmlrpc.php
@@ -155,24 +155,34 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args);
- $user_login = $args[1];
- $user_pass = $args[2];
+ $user_login = $args[1];
+ $user_pass = $args[2];
- if (!$this->login_pass_ok($user_login, $user_pass)) {
- return $this->error;
- }
+ if (!$this->login_pass_ok($user_login, $user_pass))
+ return $this->error;
- set_current_user(0, $user_login);
- $is_admin = current_user_can('level_8');
+ $user = set_current_user(0, $user_login);
- $struct = array(
- 'isAdmin' => $is_admin,
- 'url' => get_option('home') . '/',
- 'blogid' => '1',
- 'blogName' => get_option('blogname')
- );
+ $blogs = (array) get_blogs_of_user($user->ID);
+
+ $struct = array();
+
+ foreach ( $blogs as $blog ) {
+ $blog_id = $blog->userblog_id;
+
+ switch_to_blog($blog_id);
+
+ $is_admin = current_user_can('level_8');
- return array($struct);
+ $struct[] = array(
+ 'isAdmin' => $is_admin,
+ 'url' => get_settings('home') . '/',
+ 'blogid' => $blog_id,
+ 'blogName' => get_settings('blogname')
+ );
+ }
+
+ return $struct;
}
@@ -833,6 +843,9 @@ class wp_xmlrpc_server extends IXR_Server {
return $this->error;
}
+ if ( $upload_err = apply_filters( "pre_upload_error", false ) )
+ return new IXR_Error(500, $upload_err);
+
$upload = wp_upload_bits($name, $type, $bits);
if ( ! empty($upload['error']) ) {
logIO('O', '(MW) Could not write file '.$name);
@@ -1207,16 +1220,16 @@ class wp_xmlrpc_server extends IXR_Server {
$comment_post_ID = (int) $post_ID;
$comment_author = $title;
- $this->escape($comment_author);
+ $wpdb->escape($comment_author);
$comment_author_url = $pagelinkedfrom;
$comment_content = $context;
- $this->escape($comment_content);
+ $wpdb->escape($comment_content);
$comment_type = 'pingback';
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_content', 'comment_type');
- wp_new_comment($commentdata);
- do_action('pingback_post', $wpdb->insert_id);
+ $comment_ID = wp_new_comment($commentdata);
+ do_action('pingback_post', $comment_ID);
return "Pingback from $pagelinkedfrom to $pagelinkedto registered. Keep the web talking! :-)";
}