summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2005-12-03 13:49:00 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2005-12-03 13:49:00 +0000
commitfba798a103256f5f400cb1a1dcb9cc5b45cf8166 (patch)
treec3855c768b2e80ff237fb92101285733277f96c5
parent5133ce3a39180e0fa922a1d403224f5650089d95 (diff)
WP Merge and misc fixes, worth upgrading for!
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@460 7be80a69-a1ef-0310-a953-fb0f7c49ff36
-rw-r--r--wp-inst/wp-admin/admin-db.php2
-rw-r--r--wp-inst/wp-admin/admin-header.php2
-rw-r--r--wp-inst/wp-admin/edit-link-form.php6
-rw-r--r--wp-inst/wp-admin/import.php2
-rw-r--r--wp-inst/wp-admin/import/blogger.php22
-rw-r--r--wp-inst/wp-admin/import/mt.php12
-rw-r--r--wp-inst/wp-admin/import/rss.php14
-rw-r--r--wp-inst/wp-admin/import/textpattern.php108
-rw-r--r--wp-inst/wp-admin/inline-uploading.php44
-rw-r--r--wp-inst/wp-admin/install.php2
-rw-r--r--wp-inst/wp-admin/post.php4
-rw-r--r--wp-inst/wp-admin/users.php120
-rw-r--r--wp-inst/wp-admin/wp-admin.css4
-rw-r--r--wp-inst/wp-includes/functions-post.php33
-rw-r--r--wp-inst/wp-includes/pluggable-functions.php2
-rw-r--r--wp-inst/xmlrpc.php88
16 files changed, 200 insertions, 265 deletions
diff --git a/wp-inst/wp-admin/admin-db.php b/wp-inst/wp-admin/admin-db.php
index 3eeffef..d0194dd 100644
--- a/wp-inst/wp-admin/admin-db.php
+++ b/wp-inst/wp-admin/admin-db.php
@@ -239,7 +239,7 @@ function wp_delete_user($id, $reassign = 'novalue') {
}
// FINALLY, delete user
- $wpdb->query("DELETE FROM $wpdb->users WHERE ID = $id");
+ $wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = $id AND meta_key = '{$wpdb->prefix}capabilities'");
wp_cache_delete($id, 'users');
wp_cache_delete($user->user_login, 'users');
diff --git a/wp-inst/wp-admin/admin-header.php b/wp-inst/wp-admin/admin-header.php
index 0e42e58..c09fa5d 100644
--- a/wp-inst/wp-admin/admin-header.php
+++ b/wp-inst/wp-admin/admin-header.php
@@ -47,7 +47,7 @@ function meChecked() {
function upit() {
var isMe = meChecked(); //document.getElementById('me').checked;
var inputColl = GetElementsWithClassName('input', 'valinp');
- var results = document.getElementById('rel');
+ var results = document.getElementById('link_rel');
var linkText, linkUrl, inputs = '';
for (i = 0; i < inputColl.length; i++) {
inputColl[i].disabled = isMe;
diff --git a/wp-inst/wp-admin/edit-link-form.php b/wp-inst/wp-admin/edit-link-form.php
index 06f0416..8a049b7 100644
--- a/wp-inst/wp-admin/edit-link-form.php
+++ b/wp-inst/wp-admin/edit-link-form.php
@@ -203,10 +203,10 @@ function xfn_check($class, $value = '', $type = 'check') {
<tr>
<th scope="row"><?php _e('Target') ?></th>
<td><label>
- <input type="radio" name="target" value="_blank" <?php echo(($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />
+ <input type="radio" name="link_target" value="_blank" <?php echo(($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />
<code>_blank</code></label><br />
<label>
-<input type="radio" name="target" value="_top" <?php echo(($link->link_target == '_top') ? 'checked="checked"' : ''); ?> />
+<input type="radio" name="link_target" value="_top" <?php echo(($link->link_target == '_top') ? 'checked="checked"' : ''); ?> />
<code>_top</code></label><br />
<label>
<input type="radio" name="link_target" value="" <?php echo(($link->link_target == '') ? 'checked="checked"' : ''); ?> />
@@ -218,7 +218,7 @@ function xfn_check($class, $value = '', $type = 'check') {
<td><label>
<input type="radio" name="link_visible" <?php if ($link->link_visible == 'Y') echo "checked='checked'"; ?> value="Y" />
<?php _e('Yes') ?></label><br /><label>
-<input type="radio" name="visible" <?php if ($link->link_visible == 'N') echo "checked='checked'"; ?> value="N" />
+<input type="radio" name="link_visible" <?php if ($link->link_visible == 'N') echo "checked='checked'"; ?> value="N" />
<?php _e('No') ?></label></td>
</tr>
</table>
diff --git a/wp-inst/wp-admin/import.php b/wp-inst/wp-admin/import.php
index 93fa7e9..2ed94ee 100644
--- a/wp-inst/wp-admin/import.php
+++ b/wp-inst/wp-admin/import.php
@@ -27,7 +27,7 @@ if ($imports_dir) {
$importers = get_importers();
if (empty ($importers)) {
- _e("<p>No importers are available.</p>"); // TODO: make more helpful
+ echo '<p>'.__('No importers are available.').'</p>'; // TODO: make more helpful
} else {
?>
<table width="100%" cellpadding="3" cellspacing="3">
diff --git a/wp-inst/wp-admin/import/blogger.php b/wp-inst/wp-admin/import/blogger.php
index c200fba..c05823d 100644
--- a/wp-inst/wp-admin/import/blogger.php
+++ b/wp-inst/wp-admin/import/blogger.php
@@ -222,13 +222,13 @@ class Blogger_Import {
if ( ( ! $this->import['user'] && ! is_array($this->import['cookies']) ) ) {
// The user must provide a Blogger username and password.
if ( ! ( $_POST['user'] && $_POST['pass'] ) ) {
- $this->login_form(__('The script will log into your Blogger account, change some settings so it can read your blog, and restore the original settings when it\'s done. Here\'s what you do:</p><ol><li>Back up your Blogger template.</li><li>Back up any other Blogger settings you might need later.</li><li>Log out of Blogger</li><li>Log in <em>here</em> with your Blogger username and password.</li><li>On the next screen, click one of your Blogger blogs.</li><li>Do not close this window or navigate away until the process is complete.</li></ol>'));
+ $this->login_form(__('The script will log into your Blogger account, change some settings so it can read your blog, and restore the original settings when it\'s done. Here\'s what you do:').'</p><ol><li>'.__('Back up your Blogger template.').'</li><li>'.__('Back up any other Blogger settings you might need later.').'</li><li>'.__('Log out of Blogger').'</li><li>'.__('Log in <em>here</em> with your Blogger username and password.').'</li><li>'.__('On the next screen, click one of your Blogger blogs.').'</li><li>'.__('Do not close this window or navigate away until the process is complete.').'</li></ol>');
}
// Try logging in. If we get an array of cookies back, we at least connected.
$this->import['cookies'] = $this->login_blogger($_POST['user'], $_POST['pass']);
if ( !is_array( $this->import['cookies'] ) ) {
- $this->login_form("Login failed. Please enter your credentials again.");
+ $this->login_form(__('Login failed. Please enter your credentials again.'));
}
// Save the password so we can log the browser in when it's time to publish.
@@ -237,7 +237,7 @@ class Blogger_Import {
// Get the Blogger welcome page and scrape the blog numbers and names from it
$response = $this->get_blogger('http://www.blogger.com/home', $this->import['cookies']);
- if (! stristr($response['body'], 'signed in as') ) $this->login_form("Login failed. Please re-enter your username and password.");
+ if (! stristr($response['body'], 'signed in as') ) $this->login_form(__('Login failed. Please re-enter your username and password.'));
$blogsary = array();
preg_match_all('#posts\.g\?blogID=(\d+)">([^<]+)</a>#U', $response['body'], $blogsary);
if ( ! count( $blogsary[1] < 1 ) )
@@ -290,7 +290,7 @@ class Blogger_Import {
// Step 2: Backup the Blogger options pages, updating some of them.
function backup_settings() {
- $output.= "<h1>Backing up Blogger options</h1>\n";
+ $output.= '<h1>'.__('Backing up Blogger options')."</h1>\n";
$form = false;
foreach ($this->import['blogs'][$_GET['blog']]['options'] as $blog_opt => $optary) {
if ( $blog_opt == $_GET['form'] ) {
@@ -341,7 +341,7 @@ class Blogger_Import {
$form = "<div style='height:0px;width:0px;overflow:hidden;'>";
$form.= $body;
$form.= "</div><script type='text/javascript'>forms=document.getElementsByTagName('form');for(i=0;i<forms.length;i++){if(forms[i].action.search('{$blog_opt}')){forms[i].submit();break;}}</script>";
- $output.= "<p><strong>$blog_opt</strong> in progress, please wait...</p>\n";
+ $output.= '<p>'.sprintf('<strong>%s</strong> in progress, please wait...', $blog_opt)."</p>\n";
} else {
$output.= "<p>$blog_opt</p>\n";
}
@@ -420,7 +420,7 @@ class Blogger_Import {
$user_email = $wpdb->escape($post_author_email);
$user_password = substr(md5(uniqid(microtime())), 0, 6);
$result = wp_create_user( $user_login, $user_password, $user_email );
- $status.= "Registered user <strong>$user_login</strong>. ";
+ $status.= sprintf('Registered user <strong>%s</strong>.', $user_login);
$this->import['blogs'][$_GET['blog']]['newusers'][] = $user_login;
}
$userdata = get_userdatabylogin( $post_author_name );
@@ -508,7 +508,9 @@ class Blogger_Import {
}
}
}
- $status = "$postcount ".__('post(s) parsed,')." $skippedpostcount ".__('skipped...')." $commentcount ".__('comment(s) parsed,')." $skippedcommentcount ".__('skipped...').' <strong>'.__('Done').'</strong>';
+ $status = sprintf(__('%s post(s) parsed, %s skipped...'), $postcount, $skippedpostcount).' '.
+ sprintf(__('%s comment(s) parsed, %s skipped...'), $commentcoun, $skippedcommentcount).' '.
+ ' <strong>'.__('Done').'</strong>';
$import = $this->import;
$import['blogs'][$_GET['blog']]['archives']["$url"] = $status;
update_option('import-blogger', $import);
@@ -552,11 +554,11 @@ class Blogger_Import {
if ( $response['code'] >= 400 || strstr($response['body'], 'There are errors on this form') ) {
$this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['error'] = true;
update_option('import-blogger', $this->import);
- $output .= "<p><strong>$blog_opt</strong> ".__('failed. Trying again.').'</p>';
+ $output .= sprintf(__('%s failed. Trying again.'), "<p><strong>$blog_opt</strong> ").'</p>';
} else {
$this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['restored'] = true;
update_option('import-blogger', $this->import);
- $output .= "<p><strong>$blog_opt</strong> ".__('restored.').'</p>';
+ $output .= sprintf(__('%s restored.'), "<p><strong>$blog_opt</strong> ").'</p>';
}
}
$did_one = true;
@@ -585,7 +587,7 @@ class Blogger_Import {
if ( count($this->import['blogs']) > 1 )
echo '<li>'.__('In case you haven\'t done it already, you can import the posts from your other blogs:'). $this->show_blogs() . '</li>';
if ( $n = count($this->import['blogs'][$_GET['blog']]['newusers']) )
- echo '<li>'.__('Go to <a href="users.php" target="_parent">Authors & Users</a>, where you can modify the new user(s) or delete them. If you want to make all of the imported posts yours, you will be given that option when you delete the new authors.').'</li>';
+ echo '<li>'.sptintf(__('Go to <a href="%s" target="%s">Authors &amp; Users</a>, where you can modify the new user(s) or delete them. If you want to make all of the imported posts yours, you will be given that option when you delete the new authors.'), 'users.php', '_parent').'</li>';
echo '<li>'.__('For security, click the link below to reset this importer. That will clear your Blogger credentials and options from the database.').'</li>';
echo '</ul>';
}
diff --git a/wp-inst/wp-admin/import/mt.php b/wp-inst/wp-admin/import/mt.php
index 093b651..4a505ba 100644
--- a/wp-inst/wp-admin/import/mt.php
+++ b/wp-inst/wp-admin/import/mt.php
@@ -21,9 +21,9 @@ class MT_Import {
function greet() {
$this->header();
?>
-<p>Howdy! We&#8217;re about to begin the process to import all of your Movable Type entries into WordPress. To begin, select a file to upload and click Import.</p>
+<p><?php _e('Howdy! We&#8217;re about to begin the process to import all of your Movable Type entries into WordPress. To begin, select a file to upload and click Import.'); ?></p>
<?php wp_import_upload_form( add_query_arg('step', 1) ); ?>
-<p>The importer is smart enough not to import duplicates, so you can run this multiple times without worry if&#8212;for whatever reason&#8212;it doesn't finish. If you get an <strong>out of memory</strong> error try splitting up the import file into pieces. </p>
+ <p><?php _e('The importer is smart enough not to import duplicates, so you can run this multiple times without worry if&#8212;for whatever reason&#8212;it doesn\'t finish. If you get an <strong>out of memory</strong> error try splitting up the import file into pieces.'); ?> </p>
<?php
$this->footer();
}
@@ -178,7 +178,7 @@ class MT_Import {
if ('' != trim($post)) {
++ $i;
unset ($post_categories);
- echo "<li>Processing post... ";
+ echo '<li>'.__('Processing post...');
// Take the pings out first
preg_match("|(-----\n\nPING:.*)|s", $post, $pings);
@@ -270,7 +270,7 @@ class MT_Import {
// Let's check to see if it's in already
if ($post_id = posts_exists($post_title, '', $post_date)) {
- echo "Post already imported.";
+ _e('Post already imported.');
} else {
$post_author = checkauthor($post_author); //just so that if a post already exists, new users are not created by checkauthor
@@ -280,7 +280,7 @@ class MT_Import {
if (0 != count($post_categories)) {
wp_create_categories($post_categories);
}
- echo " Post imported successfully...";
+ _e(' Post imported successfully...');
}
$comment_post_ID = $post_id;
@@ -362,7 +362,7 @@ class MT_Import {
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_author_IP', 'comment_date', 'comment_content', 'comment_type');
$commentdata = wp_filter_comment($commentdata);
wp_insert_comment($commentdata);
- echo "Comment added.";
+ _e('Comment added.');
}
}
}
diff --git a/wp-inst/wp-admin/import/rss.php b/wp-inst/wp-admin/import/rss.php
index e902d7a..c79bf99 100644
--- a/wp-inst/wp-admin/import/rss.php
+++ b/wp-inst/wp-admin/import/rss.php
@@ -25,7 +25,7 @@ class RSS_Import {
}
function greet() {
- _e("<p>Howdy! This importer allows you to extract posts from any RSS 2.0 file into your blog. This is useful if you want to import your posts from a system that is not handled by a custom import tool. Pick an RSS file to upload and click Import.</p>");
+ echo '<p>'.__('Howdy! This importer allows you to extract posts from any RSS 2.0 file into your blog. This is useful if you want to import your posts from a system that is not handled by a custom import tool. Pick an RSS file to upload and click Import.').'</p>';
wp_import_upload_form("admin.php?import=rss&amp;step=1");
}
@@ -108,17 +108,17 @@ class RSS_Import {
extract($post);
if ($post_id = post_exists($post_title, $post_content, $post_date)) {
- echo __('Post already imported');
+ _e('Post already imported');
} else {
$post_id = wp_insert_post($post);
if (!$post_id) {
- echo(__("Couldn't get post ID"));
+ _e("Couldn't get post ID");
return;
}
if (0 != count($categories))
wp_create_categories($categories, $post_id);
- echo __('Done !');
+ _e('Done !');
}
echo '</li>';
}
@@ -138,8 +138,10 @@ class RSS_Import {
$this->get_posts();
$this->import_posts();
wp_import_cleanup($file['id']);
-
- echo '<h3>All done. <a href="' . get_option('home') . '">Have fun!</a></h3>';
+
+ echo '<h3>';
+ printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home'));
+ echo '</h3>';
}
function dispatch() {
diff --git a/wp-inst/wp-admin/import/textpattern.php b/wp-inst/wp-admin/import/textpattern.php
index fa9e4a6..48202a9 100644
--- a/wp-inst/wp-admin/import/textpattern.php
+++ b/wp-inst/wp-admin/import/textpattern.php
@@ -42,7 +42,7 @@ class Textpattern_Import {
{
echo '<div class="wrap">';
echo '<h2>'.__('Import Textpattern').'</h2>';
- echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.</p>');
+ echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'</p>';
}
function footer()
@@ -52,12 +52,12 @@ class Textpattern_Import {
function greet()
{
- _e('<p>Howdy! This importer allows you to extract posts from any Textpattern 4.0.2+ into your blog. This has not been tested on previous versions of Textpattern. Mileage may vary.</p>');
- _e('<p>Your Textpattern Configuration settings are as follows:</p>');
- _e('<form action="admin.php?import=textpattern&amp;step=1" method="post">');
+ echo '<p>'.__('Howdy! This importer allows you to extract posts from any Textpattern 4.0.2+ into your blog. This has not been tested on previous versions of Textpattern. Mileage may vary.').'</p>';
+ echo '<p>'.__('Your Textpattern Configuration settings are as follows:').'</p>';
+ echo '<form action="admin.php?import=textpattern&amp;step=1" method="post">';
$this->db_form();
- _e('<input type="submit" name="submit" value="Import Categories" />');
- _e('</form>');
+ echo '<input type="submit" name="submit" value="Import Categories" />';
+ echo '</form>';
}
function get_txp_cats()
@@ -162,7 +162,7 @@ class Textpattern_Import {
// Do the Magic
if(is_array($categories))
{
- echo __('<p>Importing Categories...<br /><br /></p>');
+ echo '<p>'.__('Importing Categories...').'<br /><br /></p>';
foreach ($categories as $category)
{
$count++;
@@ -186,7 +186,7 @@ class Textpattern_Import {
// Store category translation for future use
add_option('txpcat2wpcat',$txpcat2wpcat);
- echo __('<p>Done! <strong>'.$count.'</strong> categories imported.<br /><br /></p>');
+ echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> categories imported.'), $count).'<br /><br /></p>';
return true;
}
echo __('No Categories to Import!');
@@ -203,7 +203,7 @@ class Textpattern_Import {
// Midnight Mojo
if(is_array($users))
{
- echo __('<p>Importing Users...<br /><br /></p>');
+ echo '<p>'.__('Importing Users...').'<br /><br /></p>';
foreach($users as $user)
{
$count++;
@@ -258,7 +258,7 @@ class Textpattern_Import {
add_option('txpid2wpid',$txpid2wpid);
- echo __('<p>Done! <strong>'.$count.'</strong> users imported.<br /><br /></p>');
+ echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> users imported.'), $count).'<br /><br /></p>';
return true;
}// End if(is_array($users)
@@ -278,7 +278,7 @@ class Textpattern_Import {
// Do the Magic
if(is_array($posts))
{
- echo __('<p>Importing Posts...<br /><br /></p>');
+ echo '<p>'.__('Importing Posts...').'<br /><br /></p>';
foreach($posts as $post)
{
$count++;
@@ -344,7 +344,7 @@ class Textpattern_Import {
// Store ID translation for later use
add_option('txpposts2wpposts',$txpposts2wpposts);
- echo __('<p>Done! <strong>'.$count.'</strong> posts imported.<br /><br /></p>');
+ echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> posts imported.'), $count).'<br /><br /></p>';
return true;
}
@@ -359,7 +359,7 @@ class Textpattern_Import {
// Magic Mojo
if(is_array($comments))
{
- echo __('<p>Importing Comments...<br /><br /></p>');
+ echo '<p>'.__('Importing Comments...').'<br /><br /></p>';
foreach($comments as $comment)
{
$count++;
@@ -411,7 +411,7 @@ class Textpattern_Import {
get_comment_count($ret_id);
- echo __('<p>Done! <strong>'.$count.'</strong> comments imported.<br /><br /></p>');
+ echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> comments imported.'), $count).'<br /><br /></p>';
return true;
}
echo __('No Comments to Import!');
@@ -427,7 +427,7 @@ class Textpattern_Import {
// Deal with the links
if(is_array($links))
{
- echo __('<p>Importing Links...<br /><br /></p>');
+ echo '<p>'.__('Importing Links...').'<br /><br /></p>';
foreach($links as $link)
{
$count++;
@@ -462,7 +462,9 @@ class Textpattern_Import {
$txplinks2wplinks[$link_id] = $ret_id;
}
add_option('txplinks2wplinks',$txplinks2wplinks);
- echo __('<p>Done! <strong>'.$count.'</strong> Links imported.<br /><br /></p>');
+ echo '<p>';
+ printf(__('Done! <strong>%s</strong> Links imported'), $count);
+ echo '<br /><br /></p>';
return true;
}
echo __('No Links to Import!');
@@ -478,9 +480,9 @@ class Textpattern_Import {
- _e('<form action="admin.php?import=textpattern&amp;step=2" method="post">');
- _e('<input type="submit" name="submit" value="Import Users" />');
- _e('</form>');
+ echo '<form action="admin.php?import=textpattern&amp;step=2" method="post">';
+ printf('<input type="submit" name="submit" value="%s" />', __('Import Users'));
+ echo '</form>';
}
@@ -490,9 +492,9 @@ class Textpattern_Import {
$users = $this->get_txp_users();
$this->users2wp($users);
- _e('<form action="admin.php?import=textpattern&amp;step=3" method="post">');
- _e('<input type="submit" name="submit" value="Import Posts" />');
- _e('</form>');
+ echo '<form action="admin.php?import=textpattern&amp;step=3" method="post">';
+ printf('<input type="submit" name="submit" value="%s" />', __('Import Posts'));
+ echo '</form>';
}
function import_posts()
@@ -501,9 +503,9 @@ class Textpattern_Import {
$posts = $this->get_txp_posts();
$this->posts2wp($posts);
- _e('<form action="admin.php?import=textpattern&amp;step=4" method="post">');
- _e('<input type="submit" name="submit" value="Import Comments" />');
- _e('</form>');
+ echo '<form action="admin.php?import=textpattern&amp;step=4" method="post">';
+ printf('<input type="submit" name="submit" value="%s" />', __('Import Comments'));
+ echo '</form>';
}
function import_comments()
@@ -512,9 +514,9 @@ class Textpattern_Import {
$comments = $this->get_txp_comments();
$this->comments2wp($comments);
- _e('<form action="admin.php?import=textpattern&amp;step=5" method="post">');
- _e('<input type="submit" name="submit" value="Import Links" />');
- _e('</form>');
+ echo '<form action="admin.php?import=textpattern&amp;step=5" method="post">';
+ printf('<input type="submit" name="submit" value="%s" />', __('Import Links'));
+ echo '</form>';
}
function import_links()
@@ -524,9 +526,9 @@ class Textpattern_Import {
$this->links2wp($links);
add_option('txp_links', $links);
- _e('<form action="admin.php?import=textpattern&amp;step=6" method="post">');
- _e('<input type="submit" name="submit" value="Finish" />');
- _e('</form>');
+ echo '<form action="admin.php?import=textpattern&amp;step=6" method="post">';
+ printf('<input type="submit" name="submit" value="%s" />', __('Finish'));
+ echo '</form>';
}
function cleanup_txpimport()
@@ -547,32 +549,32 @@ class Textpattern_Import {
function tips()
{
- echo __('<p>Welcome to WordPress. We hope (and expect!) that you will find this platform incredibly rewarding! As a new WordPress user coming from Textpattern, there are some things that we would like to point out. Hopefully, they will help your transition go as smoothly as possible.</p>');
- echo __('<h3>Users</h3>');
- echo __('<p>You have already setup WordPress and have been assigned an administrative login and password. Forget it. You didn\'t have that login in Textpattern, why should you have it here? Instead we have taken care to import all of your users into our system. Unfortunately there is one downside. Because both WordPress and Textpattern uses a strong encryption hash with passwords, it is impossible to decrypt it and we are forced to assign temporary passwords to all your users. <strong>Every user has the same username, but their passwords are reset to password123.</strong> So <a href="/wp-login.php">Login</a> and change it.</p>');
- echo __('<h3>Preserving Authors</h3>');
- echo __('<p>Secondly, we have attempted to preserve post authors. If you are the only author or contributor to your blog, then you are safe. In most cases, we are successful in this preservation endeavor. However, if we cannot ascertain the name of the writer due to discrepancies between database tables, we assign it to you, the administrative user.</p>');
- echo __('<h3>Textile</h3>');
- echo __('<p>Also, since you\'re coming from Textpattern, you probably have been using Textile to format your comments and posts. If this is the case, we recommend downloading and installing <a href="http://www.huddledmasses.org/2004/04/19/wordpress-plugin-textile-20/">Textile for WordPress</a>. Trust me... You\'ll want it.</p>');
- echo __('<h3>WordPress Resources</h3>');
- echo __('<p>Finally, there are numerous WordPress resources around the internet. Some of them are:</p>');
- echo __('<ul>');
- echo __('<li><a href="http://www.wordpress.org">The official WordPress site</a></li>');
- echo __('<li><a href="http://wordpress.org/support/">The WordPress support forums</li>');
- echo __('<li><a href="http://codex.wordpress.org">The Codex (In other words, the WordPress Bible)</a></li>');
- echo __('</ul>');
- echo __('<p>That\'s it! What are you waiting for? Go <a href="/wp-login.php">login</a>!</p>');
+ echo '<p>'.__('Welcome to WordPress. We hope (and expect!) that you will find this platform incredibly rewarding! As a new WordPress user coming from Textpattern, there are some things that we would like to point out. Hopefully, they will help your transition go as smoothly as possible.').'</p>';
+ echo '<h3>'.__('Users').'</h3>';
+ echo '<p>'.sprintf(__('You have already setup WordPress and have been assigned an administrative login and password. Forget it. You didn\'t have that login in Textpattern, why should you have it here? Instead we have taken care to import all of your users into our system. Unfortunately there is one downside. Because both WordPress and Textpattern uses a strong encryption hash with passwords, it is impossible to decrypt it and we are forced to assign temporary passwords to all your users. <strong>Every user has the same username, but their passwords are reset to password123.</strong> So <a href="%1$s">Login</a> and change it.'), '/wp-login.php').'</p>';
+ echo '<h3>'.__('Preserving Authors').'</h3>';
+ echo '<p>'.__('Secondly, we have attempted to preserve post authors. If you are the only author or contributor to your blog, then you are safe. In most cases, we are successful in this preservation endeavor. However, if we cannot ascertain the name of the writer due to discrepancies between database tables, we assign it to you, the administrative user.').'</p>';
+ echo '<h3>'.__('Textile').'</h3>';
+ echo '<p>'.__('Also, since you\'re coming from Textpattern, you probably have been using Textile to format your comments and posts. If this is the case, we recommend downloading and installing <a href="http://www.huddledmasses.org/2004/04/19/wordpress-plugin-textile-20/">Textile for WordPress</a>. Trust me... You\'ll want it.').'</p>';
+ echo '<h3>'.__('WordPress Resources').'</h3>';
+ echo '<p>'.__('Finally, there are numerous WordPress resources around the internet. Some of them are:').'</p>';
+ echo '<ul>';
+ echo '<li>'.__('<a href="http://www.wordpress.org">The official WordPress site</a>').'</li>';
+ echo '<li>'.__('<a href="http://wordpress.org/support/">The WordPress support forums').'</li>';
+ echo '<li>'.__('<a href="http://codex.wordpress.org">The Codex (In other words, the WordPress Bible)</a>').'</li>';
+ echo '</ul>';
+ echo '<p>'.sprintf(__('That\'s it! What are you waiting for? Go <a href="%1$s">login</a>!'), '/wp-login.php').'</p>';
}
function db_form()
{
- _e('<ul>');
- _e('<li><label for="dbuser">Textpattern Database User:</label> <input type="text" name="dbuser" /></li>');
- _e('<li><label for="dbpass">Textpattern Database Password:</label> <input type="password" name="dbpass" /></li>');
- _e('<li><label for="dbname">Textpattern Database Name:</label> <input type="text" name="dbname" /></li>');
- _e('<li><label for="dbhost">Textpattern Database Host:</label> <input type="text" name="dbhost" value="localhost" /></li>');
- _e('<li><label for="dbprefix">Textpattern Table prefix (if any)t:</label> <input type="text" name="dbprefix" /></li>');
- _e('</ul>');
+ echo '<ul>';
+ printf('<li><label for="dbuser">%s</label> <input type="text" name="dbuser" /></li>', __('Textpattern Database User:'));
+ printf('<li><label for="dbpass">%s</label> <input type="password" name="dbpass" /></li>', __('Textpattern Database Password:'));
+ printf('<li><label for="dbname">%s</label> <input type="text" name="dbname" /></li>', __('Textpattern Database Name:'));
+ printf('<li><label for="dbhost">%s</label> <input type="text" name="dbhost" value="localhost" /></li>', __('Textpattern Database Host:'));
+ printf('<li><label for="dbprefix">%s</label> <input type="text" name="dbprefix" /></li>', __('Textpattern Table prefix (if any):'));
+ echo '</ul>';
}
function dispatch()
diff --git a/wp-inst/wp-admin/inline-uploading.php b/wp-inst/wp-admin/inline-uploading.php
index 0295200..69c5c78 100644
--- a/wp-inst/wp-admin/inline-uploading.php
+++ b/wp-inst/wp-admin/inline-uploading.php
@@ -38,7 +38,7 @@ switch($action) {
case 'delete':
if ( !current_user_can('edit_post', (int) $attachment) )
- die(printf(__('You are not allowed to delete this attachment. %sGo back</a>'), '<a href="'.basename(__FILE__)."?post=$post&amp;all=$all&amp;action=upload\">") );
+die(__('You are not allowed to delete this attachment.').' <a href="'.basename(__FILE__)."?post=$post&amp;all=$all&amp;action=upload\">".__('Go back').'</a>');
wp_delete_attachment($attachment);
@@ -55,7 +55,7 @@ if( isset( $file[ 'error' ] ) == false )
$file[ 'error' ] = apply_filters( "check_uploaded_file", $file[ 'error' ] );
if ( isset($file['error']) )
- die($file['error'] . '<a href="' . basename(__FILE__) . '?action=upload&post="' . $post . '">Back to Image Uploading</a>');
+ die($file['error'] . '<a href="' . basename(__FILE__) . '?action=upload&post="' . $post . '">'.__('Back to Image Uploading').'</a>');
$url = $file['url'];
$file = $file['file'];
@@ -97,7 +97,7 @@ if ( preg_match('!^image/!', $attachment['post_mime_type']) ) {
}
header("Location: ".basename(__FILE__)."?post=$post&all=$all&action=view&last=true");
-die;
+die();
case 'upload':
@@ -164,7 +164,7 @@ if ( count($attachments) > 0 ) {
$__linked_to_file = __('Linked to File');
$__using_thumbnail = __('Using Thumbnail');
$__using_original = __('Using Original');
- $__no_thumbnail = __('<del>No Thumbnail</del>');
+ $__no_thumbnail = '<del>'.__('No Thumbnail').'</del>';
$__close = __('Close Options');
$__confirmdelete = __('Delete this file from the server?');
$__nothumb = __('There is no thumbnail associated with this photo.');
@@ -174,6 +174,12 @@ linkedtopage = '$__linked_to_page';
linkedtofile = '$__linked_to_file';
usingthumbnail = '$__using_thumbnail';
usingoriginal = '$__using_original';
+var aa = new Array();
+var ab = new Array();
+var imga = new Array();
+var imgb = new Array();
+var srca = new Array();
+var srcb = new Array();
";
foreach ( $attachments as $key => $attachment ) {
$ID = $attachment['ID'];
@@ -195,8 +201,8 @@ usingoriginal = '$__using_original';
$image = & $attachment;
if ( ($image['width'] > 128 || $image['height'] > 96) && !empty($image['thumb']) && file_exists(dirname($image['file']).'/'.$image['thumb']) ) {
$src = str_replace(basename($image['guid']), $image['thumb'], $image['guid']);
- $script .= "src{$ID}a = '$src';
-src{$ID}b = '{$image['guid']}';
+ $script .= "srca[{$ID}] = '$src';
+srcb[{$ID}] = '{$image['guid']}';
";
$thumb = 'true';
$thumbtext = $__using_thumbnail;
@@ -210,10 +216,10 @@ src{$ID}b = '{$image['guid']}';
$xpadding = (128 - $image['uwidth']) / 2;
$ypadding = (96 - $image['uheight']) / 2;
$style .= "#target{$ID} img { padding: {$ypadding}px {$xpadding}px; }\n";
- $script .= "a{$ID}a = '<a id=\"{$ID}\" rel=\"attachment\" class=\"imagelink\" href=\"$href\" onclick=\"doPopup({$ID});return false;\" title=\"{$image['post_title']}\">';
-a{$ID}b = '<a class=\"imagelink\" href=\"{$image['guid']}\" onclick=\"doPopup({$ID});return false;\" title=\"{$image['post_title']}\">';
-img{$ID}a = '<img id=\"image{$ID}\" src=\"$src\" alt=\"{$image['post_title']}\" $height_width />';
-img{$ID}b = '<img id=\"image{$ID}\" src=\"{$image['guid']}\" alt=\"{$image['post_title']}\" $height_width />';
+ $script .= "aa[{$ID}] = '<a id=\"{$ID}\" rel=\"attachment\" class=\"imagelink\" href=\"$href\" onclick=\"doPopup({$ID});return false;\" title=\"{$image['post_title']}\">';
+ab[{$ID}] = '<a class=\"imagelink\" href=\"{$image['guid']}\" onclick=\"doPopup({$ID});return false;\" title=\"{$image['post_title']}\">';
+imga[{$ID}] = '<img id=\"image{$ID}\" src=\"$src\" alt=\"{$image['post_title']}\" $height_width />';
+imgb[{$ID}] = '<img id=\"image{$ID}\" src=\"{$image['guid']}\" alt=\"{$image['post_title']}\" $height_width />';
";
$html .= "<div id='target{$ID}' class='attwrap left'>
<div id='popup{$ID}' class='popup'>
@@ -250,7 +256,7 @@ $images_width = $uwidth_sum + ( count($images) * 6 ) + 35;
break;
default:
-die('This script was not meant to be called directly.');
+die(__('This script was not meant to be called directly.'));
}
?>
@@ -293,15 +299,15 @@ function toggleLink(n) {
ol=document.getElementById('L'+n);
oi=document.getElementById('I'+n);
if ( oi.innerHTML == usingthumbnail ) {
- img = eval('img'+n+'a');
+ img = imga[n];
} else {
- img = eval('img'+n+'b');
+ img = imgb[n];
}
if ( ol.innerHTML == notlinked ) {
- od.innerHTML = eval('a'+n+'b')+img+'</a>';
+ od.innerHTML = ab[n]+img+'</a>';
ol.innerHTML = linkedtoimage;
} else if ( ol.innerHTML == linkedtoimage ) {
- od.innerHTML = eval('a'+n+'a')+img+'</a>';
+ od.innerHTML = aa[n]+img+'</a>';
ol.innerHTML = linkedtopage;
} else {
od.innerHTML = img;
@@ -312,10 +318,10 @@ function toggleOtherLink(n) {
od=document.getElementById('div'+n);
ol=document.getElementById('L'+n);
if ( ol.innerHTML == linkedtofile ) {
- od.innerHTML = eval('a'+n+'a');
+ od.innerHTML = aa[n];
ol.innerHTML = linkedtopage;
} else {
- od.innerHTML = eval('a'+n+'b');
+ od.innerHTML = ab[n];
ol.innerHTML = linkedtofile;
}
}
@@ -323,10 +329,10 @@ function toggleImage(n) {
o = document.getElementById('image'+n);
oi = document.getElementById('I'+n);
if ( oi.innerHTML == usingthumbnail ) {
- o.src = eval('src'+n+'b');
+ o.src = srcb[n];
oi.innerHTML = usingoriginal;
} else {
- o.src = eval('src'+n+'a');
+ o.src = srca[n];
oi.innerHTML = usingthumbnail;
}
}
diff --git a/wp-inst/wp-admin/install.php b/wp-inst/wp-admin/install.php
index 33dd4e3..5dc4f75 100644
--- a/wp-inst/wp-admin/install.php
+++ b/wp-inst/wp-admin/install.php
@@ -79,7 +79,7 @@ header( 'Content-Type: text/html; charset=utf-8' );
// Let's check to make sure WP isn't already installed.
$wpdb->hide_errors();
$installed = $wpdb->get_results("SELECT * FROM $wpdb->users");
-if ($installed) die(__('<h1>Already Installed</h1><p>You appear to have already installed WordPress. To reinstall please clear your old database tables first.</p>') . '</body></html>');
+if ($installed) die('<h1>'.__('Already Installed').'</h1><p>'.__('You appear to have already installed WordPress. To reinstall please clear your old database tables first.').'</p></body></html>');
$wpdb->show_errors();
switch($step) {
diff --git a/wp-inst/wp-admin/post.php b/wp-inst/wp-admin/post.php
index e7a72b4..b61aa16 100644
--- a/wp-inst/wp-admin/post.php
+++ b/wp-inst/wp-admin/post.php
@@ -345,8 +345,8 @@ default:
include('edit-form-advanced.php');
?>
<div class="wrap">
-<?php _e('<h3>WordPress bookmarklet</h3>
-<p>Right click on the following link and choose "Add to favorites" to create a posting shortcut.</p>') ?>
+<?php echo '<h3>'.__('WordPress bookmarklet').'</h3>
+<p>'.__('Right click on the following link and choose "Add to favorites" to create a posting shortcut.').'</p>'; ?>
<p>
<?php
diff --git a/wp-inst/wp-admin/users.php b/wp-inst/wp-admin/users.php
index 611f7af..c0f20b9 100644
--- a/wp-inst/wp-admin/users.php
+++ b/wp-inst/wp-admin/users.php
@@ -45,7 +45,7 @@ case 'dodelete':
header('Location: users.php?update=del');
exit;
}
- if (empty($_POST['users'])) {
+ if ( empty($_POST['users']) ) {
header('Location: users.php');
}
@@ -110,7 +110,7 @@ case 'delete':
$go_delete = true;
}
}
- $all_logins = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users ORDER BY user_login");
+ $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'");
$user_dropdown = '<select name="reassign_user">';
foreach ($all_logins as $login) {
if ( $login->ID == $current_user->id || !in_array($login->ID, $userids) ) {
@@ -126,7 +126,7 @@ case 'delete':
<li><label><input type="radio" id="delete_option0" name="delete_option" value="delete" checked="checked" />
<?php _e('Delete all posts and links.'); ?></label></li>
<li><input type="radio" id="delete_option1" name="delete_option" value="reassign" />
- <?php echo sprintf(__('<label for="delete_option1">Attribute all posts and links to:</label> %s'), $user_dropdown); ?></li>
+ <?php echo '<label for="delete_option1">'.__('Attribute all posts and links to:')."</label> $user_dropdown"; ?></li>
</ul>
<input type="hidden" name="action" value="dodelete" />
<p class="submit"><input type="submit" name="submit" value="<?php _e('Confirm Deletion'); ?>" /></p>
@@ -141,45 +141,25 @@ break;
case 'addexistinguser':
check_admin_referer();
+ if ( !current_user_can('edit_users') )
+ die(__('You can&#8217;t edit users.'));
+
$new_user_login = wp_specialchars(trim($_POST['newuser']));
/* checking that username has been typed */
- if ($new_user_login == '')
- $errors['user_login'] = __('<strong>ERROR</strong>: Please enter a username.');
- if ( username_exists( $new_user_login ) ) {
- $user_ID = $wpdb->get_var( "SELECT ID FROM $wpdb->users WHERE user_login = '$new_user_login'" );
- $user = new WP_User($user_ID);
- $user->set_role( $_POST[ 'new_role' ] );
- }
- header('Location: users.php?update=add');
- die();
-break;
-
-case 'adduser':
- exit;
- check_admin_referer();
-
- $errors = add_user();
-
- if(count($errors) == 0) {
- header('Location: users.php?update=add');
- die();
- }
-
-case "searchusers":
- $search = $_GET[ 'search' ];
- $id = $_GET[ 'id' ];
- $query = "SELECT " . $wpdb->users . ".ID, " . $wpdb->users . ".user_login FROM " . $wpdb->users . ", " . $wpdb->usermeta . " WHERE " . $wpdb->users . ".ID = " . $wpdb->usermeta . ".user_id AND " . $wpdb->usermeta . ".meta_key = '" . $wpmuBaseTablePrefix . $id . "_capabilities'";
- $query = "SELECT " . $wpdb->users . ".ID, " . $wpdb->users . ".user_login FROM " . $wpdb->users . " WHERE user_login LIKE '%" . $search . "%' limit 0,10";
- $users = $wpdb->get_results( $query );
- if( is_array( $users ) ) {
- while( list( $key, $val ) = each( $users ) )
- {
- print '<span onclick="javascript:return update_AJAX_search_box(\'' . $val->user_login . '\');"><a>' . $val->user_login . '</a></span><br>';
+ if ($new_user_login != '' && $new_user_login != 'admin' ) {
+ if ( username_exists( $new_user_login ) ) {
+ $user_ID = $wpdb->get_var( "SELECT ID FROM $wpdb->users WHERE user_login = '$new_user_login'" );
+ if( $wpdb->get_var( "SELECT user_id FROM {$wpdb->usermeta} WHERE user_id = '{$user_ID}' AND meta_key = '{$wpdb->prefix}capabilities'" ) == false ) {
+ $user = new WP_User($user_ID);
+ $user->set_role( $_POST[ 'new_role' ] );
+ do_action( "added_existing_user", $user_ID );
+ header('Location: users.php?update=add');
+ die();
}
- } else {
- print "No Users Found";
}
- exit;
+ }
+ header('Location: users.php');
+ die();
break;
default:
if( is_array( $_POST[ 'new_roles' ] ) ) {
@@ -202,11 +182,7 @@ default:
include ('admin-header.php');
- if( is_site_admin() ) {
- $userids = $wpdb->get_col("SELECT ID FROM $wpdb->users");
- } else {
- $userids = $wpdb->get_col("SELECT ID FROM $wpdb->users, $wpdb->usermeta WHERE $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '".$wpdb->prefix."capabilities'");
- }
+ $userids = $wpdb->get_col("SELECT ID FROM $wpdb->users, $wpdb->usermeta WHERE $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '".$wpdb->prefix."capabilities'");
foreach($userids as $userid) {
$tmp_user = new WP_User($userid);
@@ -305,7 +281,7 @@ default:
<td><label for='user_{$user_object->ID}'><strong>$user_object->user_login</strong></label></td>
<td><label for='user_{$user_object->ID}'>$user_object->first_name $user_object->last_name</label></td>
<td><a href='mailto:$email' title='" . sprintf(__('e-mail: %s'), $email) . "'>$email</a></td>
- <td><select name="new_roles[{$user_object->ID}]" id="new_role">";
+ <td><select name='new_roles[{$user_object->ID}]' id='new_role'>";
foreach($wp_roles->role_names as $roleid => $name) {
$selected = '';
if( $role == $roleid)
@@ -334,10 +310,8 @@ foreach($wp_roles->role_names as $role => $name) {
$role_select .= '</select>';
?>
<ul style="list-style:none;">
- <?php if( is_site_admin() ) { ?>
<li><input type="radio" name="action" id="action0" value="delete" /> <label for="action0"><?php _e('Delete checked users.'); ?></label></li>
- <?php } ?>
- <li><input type="radio" name="action" id="action1" value="promote" /> <?php echo sprintf(__('<label for="action1">Set the Role of checked users to:</label> %s'), $role_select); ?></li>
+ <li><input type="radio" name="action" id="action1" value="promote" /> <?php echo '<label for="action1">'.__('Set the Role of checked users to:')."</label> $role_select"; ?></li>
</ul>
<p class="submit"><input type="submit" value="<?php _e('Update &raquo;'); ?>" /></p>
</div>
@@ -347,10 +321,9 @@ $role_select .= '</select>';
<h2><?php _e('Add User From Community') ?></h2>
<form action="" method="post" name="adduser" id="adduser">
<input type='hidden' name='action' value='addexistinguser'>
-<p>As you type WordPress will offer you a choice of usernames.<br /> Click one to select and hit <em>Add User</em> to add the user.</p>
+<p>Type the username of another user to add them to your blog.</p>
<table>
-<tr><th scope="row">User&nbsp;Login: </th><td><input type="text" name="newuser" id="newuser"></td><td><a href="javascript:doSearch();">Search</a></td></tr>
-<tr><td></td><td colspan='2'><div style='display:none; height: 60px; width: 200px; overflow: auto; border: 1px solid #ccc; background: #eee; margin: 5px; padding: 5px;' id="searchresults"><?php _e( 'Search Results' ) ?></div></td> </tr>
+<tr><th scope="row">User&nbsp;Login: </th><td><input type="text" name="newuser" id="newuser"></td></tr>
<tr>
<th scope="row"><?php _e('Role:') ?></th>
<td><select name="new_role" id="new_role"><?php
@@ -364,7 +337,6 @@ $role_select .= '</select>';
</tr>
</table>
<br />
-<?php AJAX_search_box( "users.php?action=searchusers&search=", "newuser", "searchresults" ); ?>
</td>
</table>
@@ -374,53 +346,7 @@ $role_select .= '</select>';
</form>
</div>
-<?php /*
-<div class="wrap">
-<h2><?php _e('Add New User') ?></h2>
-<?php printf(__('<p>Users can <a href="%s/wp-register.php">register themselves</a> or you can manually create users here.</p>'), get_settings('siteurl')); ?>
-<form action="" method="post" name="adduser" id="adduser">
- <table class="editform" width="100%" cellspacing="2" cellpadding="5">
- <tr>
- <th scope="row" width="33%"><?php _e('Nickname') ?>
- <input name="action" type="hidden" id="action" value="adduser" /></th>
- <td width="66%"><input name="user_login" type="text" id="user_login" value="<?php echo $new_user_login; ?>" /></td>
- </tr>
- <tr>
- <th scope="row"><?php _e('First Name') ?> </th>
- <td><input name="first_name" type="text" id="first_name" value="<?php echo $new_user_firstname; ?>" /></td>
- </tr>
- <tr>
- <th scope="row"><?php _e('Last Name') ?> </th>
- <td><input name="last_name" type="text" id="last_name" value="<?php echo $new_user_lastname; ?>" /></td>
- </tr>
- <tr>
- <th scope="row"><?php _e('E-mail') ?></th>
- <td><input name="email" type="text" id="email" value="<?php echo $new_user_email; ?>" /></td>
- </tr>
- <tr>
- <th scope="row"><?php _e('Website') ?></th>
- <td><input name="url" type="text" id="url" value="<?php echo $new_user_uri; ?>" /></td>
- </tr>
<?php
-$show_password_fields = apply_filters('show_password_fields', true);
-if ( $show_password_fields ) :
-?>
- <tr>
- <th scope="row"><?php _e('Password (twice)') ?> </th>
- <td><input name="pass1" type="password" id="pass1" />
- <br />
- <input name="pass2" type="password" id="pass2" /></td>
- </tr>
-<?php endif; ?>
- </table>
- <p class="submit">
- <input name="adduser" type="submit" id="adduser" value="<?php _e('Add User') ?> &raquo;" />
- </p>
- </form>
-</div>
-*/ ?>
- <?php
-
break;
}
diff --git a/wp-inst/wp-admin/wp-admin.css b/wp-inst/wp-admin/wp-admin.css
index 0a030e5..d4d14f6 100644
--- a/wp-inst/wp-admin/wp-admin.css
+++ b/wp-inst/wp-admin/wp-admin.css
@@ -458,6 +458,10 @@ table .vers, table .name {
margin-right: 8px;
}
+* html #postexcerpt .dbx-toggle-open {
+ padding-right: 8px;
+}
+
#excerpt {
margin: 0px;
height: 4em;
diff --git a/wp-inst/wp-includes/functions-post.php b/wp-inst/wp-includes/functions-post.php
index c4205cb..38c1cfe 100644
--- a/wp-inst/wp-includes/functions-post.php
+++ b/wp-inst/wp-includes/functions-post.php
@@ -778,4 +778,37 @@ function get_post_mime_type($ID = '') {
function get_attached_file($attachment_id) {
return get_post_meta($attachment_id, '_wp_attached_file', true);
}
+
+function wp_upload_bits($name, $type, $bits) {
+ if ( empty($name) )
+ return array('error' => "Empty filename");
+
+ $upload = wp_upload_dir();
+
+ if ( $upload['error'] !== false )
+ return $upload;
+
+ $number = '';
+ $filename = $name;
+ while ( file_exists($upload['path'] . "/$filename") )
+ $filename = str_replace("$number.$ext", ++$number . ".$ext", $filename);
+
+ $new_file = $uploads['path'] . "/$filename";
+ $ifp = @ fopen($new_file, 'wb');
+ if ( ! $ifp )
+ return array('error' => "Could not write file $new_file.");
+
+ $success = @ fwrite($ifp, $bits);
+ fclose($ifp);
+ // Set correct file permissions
+ $stat = @ stat(dirname($new_file));
+ $perms = $stat['mode'] & 0000777;
+ @ chmod($new_file, $perms);
+
+ // Compute the URL
+ $url = $upload['url'] . "/$filename";
+
+ return array('file' => $new_file, 'url' => $url);
+}
+
?>
diff --git a/wp-inst/wp-includes/pluggable-functions.php b/wp-inst/wp-includes/pluggable-functions.php
index 1399ec5..3314794 100644
--- a/wp-inst/wp-includes/pluggable-functions.php
+++ b/wp-inst/wp-includes/pluggable-functions.php
@@ -262,7 +262,7 @@ function wp_notify_postauthor($comment_id, $comment_type='') {
$notify_message = sprintf( __('New pingback on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n";
$notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
$notify_message .= sprintf( __('URI : %s'), $comment->comment_author_url ) . "\r\n";
- $notify_message .= __('Excerpt: ') . "\r\n" . sprintf( __('[...] %s [...]'), $comment->comment_content ) . "\r\n\r\n";
+ $notify_message .= __('Excerpt: ') . "\r\n" . sprintf('[...] %s [...]', $comment->comment_content ) . "\r\n\r\n";
$notify_message .= __('You can see all pingbacks on this post here: ') . "\r\n";
$subject = sprintf( __('[%1$s] Pingback: "%2$s"'), $blogname, $post->post_title );
}
diff --git a/wp-inst/xmlrpc.php b/wp-inst/xmlrpc.php
index d0942dd..dd574d5 100644
--- a/wp-inst/xmlrpc.php
+++ b/wp-inst/xmlrpc.php
@@ -825,83 +825,43 @@ class wp_xmlrpc_server extends IXR_Server {
/* metaweblog.newMediaObject uploads a file, following your settings */
function mw_newMediaObject($args) {
- // adapted from a patch by Johann Richard
- // http://mycvs.org/archives/2004/06/30/file-upload-to-wordpress-in-ecto/
+ // adapted from a patch by Johann Richard
+ // http://mycvs.org/archives/2004/06/30/file-upload-to-wordpress-in-ecto/
global $wpdb;
- $blog_ID = $wpdb->escape($args[0]);
- $user_login = $wpdb->escape($args[1]);
+ $blog_ID = $wpdb->escape($args[0]);
+ $user_login = $wpdb->escape($args[1]);
$user_pass = $wpdb->escape($args[2]);
- $data = $args[3];
+ $data = $args[3];
- $name = $data['name'];
- $type = $data['type'];
- $bits = $data['bits'];
+ $name = $data['name'];
+ $type = $data['type'];
+ $bits = $data['bits'];
- $file_realpath = get_settings('fileupload_realpath');
- $file_url = get_settings('fileupload_url');
+ logIO('O', '(MW) Received '.strlen($bits).' bytes');
- logIO('O', '(MW) Received '.strlen($bits).' bytes');
+ if ( !$this->login_pass_ok($user_login, $user_pass) )
+ return $this->error;
- if (!$this->login_pass_ok($user_login, $user_pass)) {
- return $this->error;
- }
-
- $user_data = get_userdatabylogin($user_login);
-
- if(!get_settings('use_fileupload')) {
- // Uploads not allowed
- logIO('O', '(MW) Uploads not allowed');
- $this->error = new IXR_Error(405, 'No uploads allowed for this site.');
- return $this->error;
- }
-
- $user = new WP_User($user_login);
- if ( !$user->has_cap('upload_files') ) {
- logIO('O', '(MW) User does not have upload_files capability');
- $this->error = new IXR_Error(401, 'You are not allowed to upload files to this site.');
- return $this->error;
- }
-
- if(trim($file_realpath) == '' || trim($file_url) == '' ) {
- // WordPress is not correctly configured
- logIO('O', '(MW) Bad configuration. Real/URL path not defined');
- $this->error = new IXR_Error(500, 'Please configure WordPress with valid paths for file upload.');
- return $this->error;
- }
-
- $prefix = '/';
-
- if(!empty($name)) {
- // Create the path
- $localpath = $file_realpath.$prefix.$name;
- $url = $file_url.$prefix.$name;
-
- if (mkdir_p(dirname($localpath))) {
-
- /* encode & write data (binary) */
- $ifp = fopen($localpath, 'wb');
- $success = fwrite($ifp, $bits);
- fclose($ifp);
- @chmod($localpath, 0666);
+ $user = new WP_User($user_login);
- if($success) {
- $resp = array('url' => $url);
- return $resp;
- } else {
- logIO('O', '(MW) Could not write file '.$name.' to '.$localpath);
- return new IXR_Error(500, 'Could not write file '.$name);
- }
+ if ( !$user->has_cap('upload_files') ) {
+ logIO('O', '(MW) User does not have upload_files capability');
+ $this->error = new IXR_Error(401, 'You are not allowed to upload files to this site.');
+ return $this->error;
+ }
- } else {
- return new IXR_Error(500, 'Could not create directories for '.$name);
- }
- }
+ $upload = wp_upload_bits($name, $type, $bits);
+ if ( $upload['error'] !== false ) {
+ logIO('O', '(MW) Could not write file '.$name);
+ return new IXR_Error(500, 'Could not write file '.$name);
+ }
+
+ return array('url' => $upload['url']);
}
-
/* MovableType API functions
* specs on http://www.movabletype.org/docs/mtmanual_programmatic.html
*/