diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2005-11-16 11:46:05 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2005-11-16 11:46:05 +0000 |
commit | b6afd61f8d70c0bdb1201064a5d6e5910d644d91 (patch) | |
tree | 2b21b4d4c4eaee0cdf0d1443ac0aa7dffeb51c46 /wp-inst | |
parent | ac41b79ab6266ccd35d1ebf747e4135d53d04035 (diff) | |
download | wordpress-mu-b6afd61f8d70c0bdb1201064a5d6e5910d644d91.tar.gz wordpress-mu-b6afd61f8d70c0bdb1201064a5d6e5910d644d91.tar.xz wordpress-mu-b6afd61f8d70c0bdb1201064a5d6e5910d644d91.zip |
WP Merge
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@436 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-inst')
26 files changed, 393 insertions, 239 deletions
diff --git a/wp-inst/wp-admin/admin-functions.php b/wp-inst/wp-admin/admin-functions.php index f0e35f4..aea5881 100644 --- a/wp-inst/wp-admin/admin-functions.php +++ b/wp-inst/wp-admin/admin-functions.php @@ -59,7 +59,7 @@ function write_post() { $post_ID = wp_insert_post($_POST); add_meta($post_ID); - // Reunite any orphaned subposts with their parent + // Reunite any orphaned attachments with their parent if ( $_POST['temp_ID'] ) relocate_children($_POST['temp_ID'], $post_ID); @@ -91,7 +91,7 @@ function edit_post() { $_POST['to_ping'] = $_POST['trackback_url']; if (!empty ($_POST['post_author_override'])) { - $_POST['$post_author'] = (int) $_POST['post_author_override']; + $_POST['post_author'] = (int) $_POST['post_author_override']; } else if (!empty ($_POST['post_author'])) { $_POST['post_author'] = (int) $_POST['post_author']; @@ -1449,6 +1449,9 @@ function get_plugins() { sort($plugin_files); foreach ($plugin_files as $plugin_file) { + if ( !is_readable("$plugin_root/$plugin_file")) + continue; + $plugin_data = get_plugin_data("$plugin_root/$plugin_file"); if (empty ($plugin_data['Name'])) { @@ -1730,6 +1733,55 @@ function wp_shrink_dimensions($width, $height, $wmax = 128, $hmax = 96) { return array((int) ($width / $height * $hmax), $hmax); } +function wp_import_cleanup($id) { + wp_delete_attachment($id); +} + +function wp_import_upload_form($action) { +?> +<script type="text/javascript"> +function cancelUpload() { +o = document.getElementById('uploadForm'); +o.method = 'GET'; +o.action.value = 'view'; +o.submit(); +} +</script> +<form enctype="multipart/form-data" id="uploadForm" method="POST" action="<?php echo $action ?>"> +<label for="upload"><?php _e('File:'); ?></label><input type="file" id="upload" name="import" /> +<input type="hidden" name="action" value="save" /> +<div id="buttons"> +<input type="submit" value="<?php _e('Import'); ?>" /> +<input type="button" value="<?php _e('Cancel'); ?>" onclick="cancelUpload()" /> +</div> +</form> +<?php +} + +function wp_import_handle_upload() { + $overrides = array('test_form' => false, 'test_type' => false); + $file = wp_handle_upload($_FILES['import'], $overrides); + + if ( isset($file['error']) ) + return $file; + + $url = $file['url']; + $file = $file['file']; + $filename = basename($file); + + // Construct the object array + $object = array( + 'post_title' => $filename, + 'post_content' => $url, + 'post_mime_type' => 'import', + 'guid' => $url + ); + + // Save the data + $id = wp_insert_attachment($object, $file); + + return array('file' => $file, 'id' => $id); +} function AJAX_search_box( $get_url, $search_field = 'newvalue', $search_results_field = 'searchresults' ) { ?> <script language="JavaScript"> diff --git a/wp-inst/wp-admin/edit-form-advanced.php b/wp-inst/wp-admin/edit-form-advanced.php index 8e22819..b1575b7 100644 --- a/wp-inst/wp-admin/edit-form-advanced.php +++ b/wp-inst/wp-admin/edit-form-advanced.php @@ -198,7 +198,7 @@ else <p class="submit"><?php echo $saveasdraft; ?> <input type="submit" name="submit" value="<?php _e('Save') ?>" style="font-weight: bold;" tabindex="4" /> <?php -if ('publish' != $post_status || 0 == $post_ID) { +if ('publish' != $post->post_status || 0 == $post_ID) { ?> <?php if ( current_user_can('publish_posts') ) : ?> <input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" /> diff --git a/wp-inst/wp-admin/edit-page-form.php b/wp-inst/wp-admin/edit-page-form.php index 3a34091..803884b 100644 --- a/wp-inst/wp-admin/edit-page-form.php +++ b/wp-inst/wp-admin/edit-page-form.php @@ -140,7 +140,7 @@ edCanvas = document.getElementById('content'); <p class="submit"> <?php if ( $post_ID ) : ?> <input name="save" type="submit" id="save" tabindex="5" value=" <?php _e('Save and Continue Editing'); ?> "/> -<input name="savepage" type="submit" id="savepage" tabindex="6" value="<?php $post_ID ? _e('Edit Page') : _e('Create New Page') ?> »" /> +<input name="savepage" type="submit" id="savepage" tabindex="6" value="<?php $post_ID ? _e('Save') : _e('Create New Page') ?> »" style="font-weight: bold;"/> <?php else : ?> <input name="savepage" type="submit" id="savepage" tabindex="6" value="<?php _e('Create New Page') ?> »" /> <?php endif; ?> diff --git a/wp-inst/wp-admin/import/greymatter.php b/wp-inst/wp-admin/import/greymatter.php index 803ae0e..e69de29 100644 --- a/wp-inst/wp-admin/import/greymatter.php +++ b/wp-inst/wp-admin/import/greymatter.php @@ -1,4 +0,0 @@ -<?php -register_importer('greymatter', 'GreyMatter', 'Import posts from your Greymatter blog', array($greymatter_import, 'dispatch')); -?> - diff --git a/wp-inst/wp-admin/import/mt.php b/wp-inst/wp-admin/import/mt.php index ec0a3f4..ce645e8 100644 --- a/wp-inst/wp-admin/import/mt.php +++ b/wp-inst/wp-admin/import/mt.php @@ -8,6 +8,8 @@ define('MTEXPORT', 'import.txt'); class MT_Import { var $posts = array (); + var $file; + var $id; var $mtnames = array (); var $newauthornames = array (); var $j = -1; @@ -24,12 +26,8 @@ class MT_Import { function greet() { $this->header(); ?> -<p>Howdy! We’re about to begin the process to import all of your Movable Type entries into WordPress. Before we get started, you need to edit this file (<code>import/mt.php</code>) and change one line so we know where to find your MT export file. To make this easy put the import file into the <code>wp-admin/import</code> directory. Look for the line that says:</p> -<p><code>define('MTEXPORT', '');</code></p> -<p>and change it to</p> -<p><code>define('MTEXPORT', 'import.txt');</code></p> -<p>You have to do this manually for security reasons.</p> -<p>If you've done that and you’re all ready, <a href="<?php echo add_query_arg('step', 1) ?>">let's go</a>! Remember that the import process may take a minute or so if you have a large number of entries and comments. Think of all the rebuilding time you'll be saving once it's done. :)</p> +<p>Howdy! We’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—for whatever reason—it doesn't finish. If you get an <strong>out of memory</strong> error try splitting up the import file into pieces. </p> <?php @@ -85,7 +83,7 @@ class MT_Import { function get_entries() { set_magic_quotes_runtime(0); - $importdata = file(MTEXPORT); // Read the file into an array + $importdata = file($this->file); // Read the file into an array $importdata = implode('', $importdata); // squish it $importdata = preg_replace("/(\r\n|\n|\r)/", "\n", $importdata); $importdata = preg_replace("/\n--------\n/", "--MT-ENTRY--\n", $importdata); @@ -152,7 +150,7 @@ class MT_Import { $authors = $this->get_mt_authors(); echo '<ol id="authors">'; - echo '<form action="?import=mt&step=2" method="post">'; + echo '<form action="?import=mt&step=2&id=' . $this->id . '" method="post">'; $j = -1; foreach ($authors as $author) { ++ $j; @@ -169,13 +167,17 @@ class MT_Import { } function select_authors() { - if ('' != MTEXPORT && !file_exists(MTEXPORT)) - die("The file you specified does not seem to exist. Please check the path you've given."); - if ('' == MTEXPORT) - die("You must edit the MTEXPORT line as described on the <a href='import-mt.php'>previous page</a> to continue."); + $file = wp_import_handle_upload(); + if ( isset($file['error']) ) { + echo $file['error']; + return; + } + $this->file = $file['file']; + $this->id = $file['id']; $this->get_entries(); $this->mt_authors_form(); + wp_import_cleanup($this->id); } function process_posts() { @@ -401,6 +403,9 @@ class MT_Import { case 1 : $this->select_authors(); break; + case 2: + echo "ID: {$_GET['id']}<br/>"; + break; } } diff --git a/wp-inst/wp-admin/import/rss.php b/wp-inst/wp-admin/import/rss.php index 5ed8416..e902d7a 100644 --- a/wp-inst/wp-admin/import/rss.php +++ b/wp-inst/wp-admin/import/rss.php @@ -7,6 +7,7 @@ define('RSSFILE', 'rss.xml'); class RSS_Import { var $posts = array (); + var $file; function header() { echo '<div class="wrap">'; @@ -24,20 +25,15 @@ 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. To get started you must edit the following line in this file (<code>import/rss.php</code>) </p> -<p><code>define('RSSFILE', '');</code></p> -<p>You want to define where the RSS file we'll be working with is, for example: </p> -<p><code>define('RSSFILE', 'rss.xml');</code></p> -<p>You have to do this manually for security reasons. When you're done reload this page and we'll take you to the next step.</p>"); - if ('' != RSSFILE) - echo '<a href="admin.php?import=rss&step=1">' . __('Begin RSS Import »') . '</a>'; + _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>"); + wp_import_upload_form("admin.php?import=rss&step=1"); } function get_posts() { global $wpdb; set_magic_quotes_runtime(0); - $datalines = file(RSSFILE); // Read the file into an array + $datalines = file($this->file); // Read the file into an array $importdata = implode('', $datalines); // squish it $importdata = str_replace(array ("\r\n", "\r"), "\n", $importdata); @@ -115,9 +111,11 @@ class RSS_Import { echo __('Post already imported'); } else { $post_id = wp_insert_post($post); - if (!$post_id) - die(__("Couldn't get post ID")); - + if (!$post_id) { + echo(__("Couldn't get post ID")); + return; + } + if (0 != count($categories)) wp_create_categories($categories, $post_id); echo __('Done !'); @@ -130,15 +128,17 @@ class RSS_Import { } function import() { - // FIXME: Don't die - if ('' == RSSFILE) - die("You must edit the RSSFILE line as described on the <a href='import-mt.php'>previous page</a> to continue."); - - if (!file_exists(RSSFILE)) - die("The file you specified does not seem to exist. Please check the path you've given."); + $file = wp_import_handle_upload(); + if ( isset($file['error']) ) { + echo $file['error']; + return; + } + $this->file = $file['file']; $this->get_posts(); $this->import_posts(); + wp_import_cleanup($file['id']); + echo '<h3>All done. <a href="' . get_option('home') . '">Have fun!</a></h3>'; } diff --git a/wp-inst/wp-admin/import/textpattern.php b/wp-inst/wp-admin/import/textpattern.php index e229e7d..e69de29 100644 --- a/wp-inst/wp-admin/import/textpattern.php +++ b/wp-inst/wp-admin/import/textpattern.php @@ -1,4 +0,0 @@ -<?php -register_importer('textpattern', 'Textpattern', 'Import posts from your Textpattern blog', array($textpattern_import, 'dispatch')); -?> - diff --git a/wp-inst/wp-admin/inline-uploading.php b/wp-inst/wp-admin/inline-uploading.php index e5d5f8e..fcfad48 100644 --- a/wp-inst/wp-admin/inline-uploading.php +++ b/wp-inst/wp-admin/inline-uploading.php @@ -5,7 +5,7 @@ require_once('admin.php'); if (!current_user_can('edit_posts'))
die(__('You do not have permission to edit posts.'));
-$wpvarstoreset = array('action', 'post', 'all', 'last', 'link', 'sort', 'start', 'imgtitle', 'descr', 'object', 'flickrtag');
+$wpvarstoreset = array('action', 'post', 'all', 'last', 'link', 'sort', 'start', 'imgtitle', 'descr', 'attachment', 'flickrtag');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
@@ -37,7 +37,7 @@ function get_udims($width, $height) { switch($action) {
case 'delete':
-wp_delete_object($object);
+wp_delete_attachment($attachment);
header("Location: ".basename(__FILE__)."?post=$post&all=$all&action=view&start=$start");
die;
@@ -58,20 +58,20 @@ $url = $file['url']; $file = $file['file'];
$filename = basename($file);
-// Construct the object array
-$object = array(
+// Construct the attachment array
+$attachment = array(
'post_title' => $imgtitle ? $imgtitle : $filename,
'post_content' => $descr,
- 'post_status' => 'object',
+ 'post_status' => 'attachment',
'post_parent' => $post,
- 'post_type' => $_FILES['image']['type'],
+ 'post_mime_type' => $_FILES['image']['type'],
'guid' => $url
);
// Save the data
-$id = wp_attach_object($object, $post);
+$id = wp_insert_attachment($attachment, $file, $post);
-// Generate the object's postmeta.
+// Generate the attachment's postmeta.
$imagesize = getimagesize($file);
$imagedata['width'] = $imagesize['0'];
$imagedata['height'] = $imagesize['1'];
@@ -84,7 +84,7 @@ add_post_meta($id, 'imagedata', $imagedata); if ( $imagedata['width'] * $imagedata['height'] < 3 * 1024 * 1024 ) {
if ( $imagedata['width'] > 128 && $imagedata['width'] >= $imagedata['height'] * 4 / 3 )
- $error = wp_create_thumbnail($file['file'], 128);
+ $error = wp_create_thumbnail($file, 128);
elseif ( $imagedata['height'] > 96 )
$error = wp_create_thumbnail($file, 96);
}
@@ -112,7 +112,7 @@ if ( $post && empty($all) ) { }
if ( $last )
- $start = $wpdb->get_var("SELECT count(ID) FROM $wpdb->posts WHERE post_status = 'object' AND left(post_type, 5) = 'image' $and_post") - $num;
+ $start = $wpdb->get_var("SELECT count(ID) FROM $wpdb->posts WHERE post_status = 'attachment' AND left(post_mime_type, 5) = 'image' $and_post") - $num;
else
$start = (int) $start;
@@ -122,7 +122,7 @@ if ( $start < 0 ) if ( '' == $sort )
$sort = "ID";
-$images = $wpdb->get_results("SELECT ID, post_date, post_title, guid FROM $wpdb->posts WHERE post_status = 'object' AND left(post_type, 5) = 'image' $and_post ORDER BY $sort LIMIT $start, $double", ARRAY_A);
+$images = $wpdb->get_results("SELECT ID, post_date, post_title, guid FROM $wpdb->posts WHERE post_status = 'attachment' AND left(post_mime_type, 5) = 'image' $and_post ORDER BY $sort LIMIT $start, $double", ARRAY_A);
if ( count($images) > $num ) {
$next = $start + count($images) - $num;
@@ -146,20 +146,19 @@ $images_script = ''; if ( count($images) > 0 ) {
$images = array_slice( $images, 0, $num );
$__delete = __('DELETE');
- $__subpost_on = __('SUBPOST <strong>ON</strong>');
- $__subpost_off = __('SUBPOST <strong>OFF</strong>');
+ $__attachment_on = __('ATTACHMENT <strong>ON</strong>');
$__thumbnail_on = __('THUMBNAIL <strong>ON</strong>');
$__thumbnail_off = __('THUMBNAIL <strong>OFF</strong>');
$__no_thumbnail = __('<del>THUMBNAIL</del>');
$__close = __('CLOSE');
$__confirmdelete = __('Delete this photo from the server?');
$__nothumb = __('There is no thumbnail associated with this photo.');
- $images_script .= "subposton = '$__subpost_on';\nsubpostoff = '$__subpost_off';\n";
+ $images_script .= "attachmenton = '$__attachment_on';\nattachmentoff = '$__attachment_off';\n";
$images_script .= "thumbnailon = '$__thumbnail_on';\nthumbnailoff = '$__thumbnail_off';\n";
foreach ( $images as $key => $image ) {
$meta = get_post_meta($image['ID'], 'imagedata', true);
if (!is_array($meta)) {
- wp_delete_object($image['ID']);
+ wp_delete_attachment($image['ID']);
continue;
}
$image = array_merge($image, $meta);
@@ -178,16 +177,16 @@ if ( count($images) > 0 ) { $uwidth_sum += 128;
$xpadding = (128 - $image['uwidth']) / 2;
$ypadding = (96 - $image['uheight']) / 2;
- $object = $image['ID'];
+ $attachment = $image['ID'];
$images_style .= "#target$i img { padding: {$ypadding}px {$xpadding}px; }\n";
- $href = get_subpost_link($object);
+ $href = get_attachment_link($attachment);
$images_script .= "href".$i."a = '$href';\nhref".$i."b = '{$image['guid']}';\n";
$images_html .= "
<div id='target$i' class='imagewrap left'>
<div id='popup$i' class='popup'>
- <a id=\"L$i\" onclick=\"toggleLink($i);return false;\" href=\"javascript:void();\">$__subpost_on</a>
+ <a id=\"L$i\" onclick=\"toggleLink($i);return false;\" href=\"javascript:void();\">$__attachment_on</a>
<a id=\"I$i\" onclick=\"if($thumb)toggleImage($i);else alert('$__nothumb');return false;\" href=\"javascript:void();\">$thumbtext</a>
- <a onclick=\"return confirm('$__confirmdelete')\" href=\"".basename(__FILE__)."?action=delete&object=$object&all=$all&start=$start&post=$post\">$__delete</a>
+ <a onclick=\"return confirm('$__confirmdelete')\" href=\"".basename(__FILE__)."?action=delete&attachment=$attachment&all=$all&start=$start&post=$post\">$__delete</a>
<a onclick=\"popup.style.display='none';return false;\" href=\"javascript:void()\">$__close</a>
</div>
<a id=\"link$i\" class=\"imagelink\" href=\"$href\" onclick=\"imagePopup($i);return false;\" title=\"{$image['post_title']}\">
@@ -247,12 +246,12 @@ popup = false; function toggleLink(n) {
o=document.getElementById('link'+n);
oi=document.getElementById('L'+n);
- if ( oi.innerHTML == subposton ) {
+ if ( oi.innerHTML == attachmenton ) {
o.href = eval('href'+n+'b');
- oi.innerHTML = subpostoff;
+ oi.innerHTML = attachmentoff;
} else {
o.href = eval('href'+n+'a');
- oi.innerHTML = subposton;
+ oi.innerHTML = attachmenton;
}
}
function toggleImage(n) {
diff --git a/wp-inst/wp-admin/list-manipulation.php b/wp-inst/wp-admin/list-manipulation.php index b056ff4..97f144a 100644 --- a/wp-inst/wp-admin/list-manipulation.php +++ b/wp-inst/wp-admin/list-manipulation.php @@ -56,8 +56,7 @@ case 'delete-comment' : if ( !current_user_can('edit_post', $comment->comment_post_ID) ) die('-1'); - if ( wp_set_comment_status($comment->comment_ID, "delete") ) { - do_action('delete_comment', $comment->comment_ID); + if ( wp_delete_comment($comment->comment_ID) ) { die('1'); } else { die('0'); diff --git a/wp-inst/wp-admin/profile.php b/wp-inst/wp-admin/profile.php index 5c43ab5..2b031f4 100644 --- a/wp-inst/wp-admin/profile.php +++ b/wp-inst/wp-admin/profile.php @@ -28,32 +28,32 @@ $bookmarklet_height= 440; <fieldset> <legend><?php _e('Name'); ?></legend> <p><label><?php _e('Username: (no editing)'); ?><br /> -<input type="text" name="user_login" value="<?php echo $profiledata->user_login; ?>" disabled="disabled" /> +<input type="text" name="user_login" value="<?php echo $profileuser->user_login; ?>" disabled="disabled" /> </label></p> <p><label><?php _e('First name:') ?><br /> -<input type="text" name="first_name" value="<?php echo $profiledata->first_name ?>" /></label></p> +<input type="text" name="first_name" value="<?php echo $profileuser->first_name ?>" /></label></p> <p><label><?php _e('Last name:') ?><br /> -<input type="text" name="last_name" value="<?php echo $profiledata->last_name ?>" /></label></p> +<input type="text" name="last_name" value="<?php echo $profileuser->last_name ?>" /></label></p> <p><label><?php _e('Nickname:') ?><br /> -<input type="text" name="nickname" value="<?php echo $profiledata->nickname ?>" /></label></p> +<input type="text" name="nickname" value="<?php echo $profileuser->nickname ?>" /></label></p> </p><label><?php _e('Display name publicly as:') ?> <br /> <select name="display_name"> -<option value="<?php echo $profiledata->display_name; ?>"><?php echo $profiledata->display_name; ?></option> -<option value="<?php echo $profiledata->nickname ?>"><?php echo $profiledata->nickname ?></option> -<option value="<?php echo $profiledata->user_login ?>"><?php echo $profiledata->user_login ?></option> -<?php if ( !empty( $profiledata->first_name ) ) : ?> -<option value="<?php echo $profiledata->first_name ?>"><?php echo $profiledata->first_name ?></option> +<option value="<?php echo $profileuser->display_name; ?>"><?php echo $profileuser->display_name; ?></option> +<option value="<?php echo $profileuser->nickname ?>"><?php echo $profileuser->nickname ?></option> +<option value="<?php echo $profileuser->user_login ?>"><?php echo $profileuser->user_login ?></option> +<?php if ( !empty( $profileuser->first_name ) ) : ?> +<option value="<?php echo $profileuser->first_name ?>"><?php echo $profileuser->first_name ?></option> <?php endif; ?> -<?php if ( !empty( $profiledata->last_name ) ) : ?> -<option value="<?php echo $profiledata->last_name ?>"><?php echo $profiledata->last_name ?></option> +<?php if ( !empty( $profileuser->last_name ) ) : ?> +<option value="<?php echo $profileuser->last_name ?>"><?php echo $profileuser->last_name ?></option> <?php endif; ?> -<?php if ( !empty( $profiledata->first_name ) && !empty( $profiledata->last_name ) ) : ?> -<option value="<?php echo $profiledata->first_name." ".$profiledata->last_name ?>"><?php echo $profiledata->first_name." ".$profiledata->last_name ?></option> -<option value="<?php echo $profiledata->last_name." ".$profiledata->first_name ?>"><?php echo $profiledata->last_name." ".$profiledata->first_name ?></option> +<?php if ( !empty( $profileuser->first_name ) && !empty( $profileuser->last_name ) ) : ?> +<option value="<?php echo $profileuser->first_name." ".$profileuser->last_name ?>"><?php echo $profileuser->first_name." ".$profileuser->last_name ?></option> +<option value="<?php echo $profileuser->last_name." ".$profileuser->first_name ?>"><?php echo $profileuser->last_name." ".$profileuser->first_name ?></option> <?php endif; ?> </select></label></p> </fieldset> @@ -62,29 +62,29 @@ $bookmarklet_height= 440; <legend><?php _e('Contact Info'); ?></legend> <p><label><?php _e('E-mail: (required)') ?><br /> -<input type="text" name="email" value="<?php echo $profiledata->user_email ?>" /></label></p> +<input type="text" name="email" value="<?php echo $profileuser->user_email ?>" /></label></p> <p><label><?php _e('Website:') ?><br /> -<input type="text" name="url" value="<?php echo $profiledata->user_url ?>" /> +<input type="text" name="url" value="<?php echo $profileuser->user_url ?>" /> </label></p> <p><label><?php _e('AIM:') ?><br /> -<input type="text" name="aim" value="<?php echo $profiledata->aim ?>" /> +<input type="text" name="aim" value="<?php echo $profileuser->aim ?>" /> </label></p> <p><label><?php _e('Yahoo IM:') ?><br /> -<input type="text" name="yim" value="<?php echo $profiledata->yim ?>" /> +<input type="text" name="yim" value="<?php echo $profileuser->yim ?>" /> </label></p> <p><label><?php _e('Jabber / Google Talk:') ?> -<input type="text" name="jabber" value="<?php echo $profiledata->jabber ?>" /></label> +<input type="text" name="jabber" value="<?php echo $profileuser->jabber ?>" /></label> </p> </fieldset> <br clear="all" /> <fieldset> <legend><?php _e('About yourself'); ?></legend> <p class="desc"><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.'); ?></p> -<p><textarea name="description" rows="5" cols="30"><?php echo $profiledata->description ?></textarea></p> +<p><textarea name="description" rows="5" cols="30"><?php echo $profileuser->description ?></textarea></p> </fieldset> <?php diff --git a/wp-inst/wp-admin/upgrade-functions.php b/wp-inst/wp-admin/upgrade-functions.php index 0a9b0e0..bfb16ef 100644 --- a/wp-inst/wp-admin/upgrade-functions.php +++ b/wp-inst/wp-admin/upgrade-functions.php @@ -31,7 +31,7 @@ function upgrade_all() { upgrade_130(); } - if ( $wp_current_db_version < 2966 ) + if ( $wp_current_db_version < 3104 ) upgrade_160(); save_mod_rewrite_rules(); @@ -307,10 +307,35 @@ function upgrade_160() { if ( 0 == $wpdb->get_var("SELECT SUM(category_count) FROM $wpdb->categories") ) { // Create counts $categories = $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories"); foreach ( $categories as $cat_id ) { - $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->post2cat WHERE category_id = '$cat_id'"); + $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->post2cat, $wpdb->posts WHERE $wpdb->posts.ID=$wpdb->post2cat.post_id AND post_status='publish' AND category_id = '$cat_id'"); $wpdb->query("UPDATE $wpdb->categories SET category_count = '$count' WHERE cat_ID = '$cat_id'"); } } + + // populate comment_count field of posts table + $comments = $wpdb->get_results( "SELECT comment_post_ID, COUNT(*) as c FROM $wpdb->comments GROUP BY comment_post_ID" ); + if( is_array( $comments ) ) { + foreach ($comments as $comment) { + $wpdb->query( "UPDATE $wpdb->posts SET comment_count = $comment->c WHERE ID = '$comment->comment_post_ID}'" ); + } + } + + // Some alpha versions used a post status of object instead of attachment and put + // the mime type in post_type instead of post_mime_type. + if ( $wp_current_db_version > 2541 && $wp_current_db_version <= 3091 ) { + $objects = $wpdb->get_results("SELECT ID, post_type FROM $wpdb->posts WHERE post_status = 'object'"); + foreach ($objects as $object) { + $wpdb->query("UPDATE $wpdb->posts SET post_status = 'attachment', + post_mime_type = '$object->post_type', + post_type = '', + guid = '$guid' + WHERE ID = $object->ID"); + + $meta = get_post_meta($postid, 'imagedata', true); + if ( ! empty($meta['file']) ) + add_post_meta($object->ID, '_wp_attached_file', $meta['file']); + } + } } // The functions we use to actually do stuff diff --git a/wp-inst/wp-admin/upgrade-schema.php b/wp-inst/wp-admin/upgrade-schema.php index ab2a105..74b61bb 100644 --- a/wp-inst/wp-admin/upgrade-schema.php +++ b/wp-inst/wp-admin/upgrade-schema.php @@ -106,7 +106,7 @@ CREATE TABLE $wpdb->posts ( post_title text NOT NULL, post_category int(4) NOT NULL default '0', post_excerpt text NOT NULL, - post_status enum('publish','draft','private','static','object') NOT NULL default 'publish', + post_status enum('publish','draft','private','static','object','attachment') NOT NULL default 'publish', comment_status enum('open','closed','registered_only') NOT NULL default 'open', ping_status enum('open','closed') NOT NULL default 'open', post_password varchar(20) NOT NULL default '', @@ -120,6 +120,7 @@ CREATE TABLE $wpdb->posts ( guid varchar(255) NOT NULL default '', menu_order int(11) NOT NULL default '0', post_type varchar(100) NOT NULL, + post_mime_type varchar(100) NOT NULL, comment_count bigint(20) NOT NULL default '0', PRIMARY KEY (ID), KEY post_name (post_name) @@ -261,7 +262,7 @@ function populate_options() { // 1.5.1 add_option('use_trackback', 0); // 1.6 - add_option('default_role', 'inactive'); + add_option('default_role', 'subscriber'); add_option('rich_editing', 'true'); add_site_option( 'customizefeed1', '0' ); diff --git a/wp-inst/wp-admin/user-edit.php b/wp-inst/wp-admin/user-edit.php index dbbad69..6489d6d 100644 --- a/wp-inst/wp-admin/user-edit.php +++ b/wp-inst/wp-admin/user-edit.php @@ -56,7 +56,6 @@ default: include ('admin-header.php'); $profileuser = new WP_User($user_id); -$profiledata = $profileuser->data; if (!current_user_can('edit_users')) $errors['head'] = __('You do not have permission to edit this user.'); ?> @@ -88,7 +87,7 @@ if (!current_user_can('edit_users')) $errors['head'] = __('You do not have permi <fieldset> <legend><?php _e('Name'); ?></legend> <p><label><?php _e('Username: (no editing)'); ?><br /> -<input type="text" name="user_login" value="<?php echo $profiledata->user_login; ?>" disabled="disabled" /> +<input type="text" name="user_login" value="<?php echo $profileuser->user_login; ?>" disabled="disabled" /> </label></p> <?php if( is_site_admin() ) {?> <p><label><?php _e('Invites Left:') ?><br /> @@ -97,28 +96,28 @@ if (!current_user_can('edit_users')) $errors['head'] = __('You do not have permi } // is_site_admin ?> <p><label><?php _e('First name:') ?><br /> -<input type="text" name="first_name" value="<?php echo $profiledata->first_name ?>" /></label></p> +<input type="text" name="first_name" value="<?php echo $profileuser->first_name ?>" /></label></p> <p><label><?php _e('Last name:') ?><br /> -<input type="text" name="last_name" value="<?php echo $profiledata->last_name ?>" /></label></p> +<input type="text" name="last_name" value="<?php echo $profileuser->last_name ?>" /></label></p> <p><label><?php _e('Nickname:') ?><br /> -<input type="text" name="nickname" value="<?php echo $profiledata->nickname ?>" /></label></p> +<input type="text" name="nickname" value="<?php echo $profileuser->nickname ?>" /></label></p> </p><label><?php _e('Display name publicly as:') ?> <br /> <select name="display_name"> -<option value="<?php echo $profiledata->display_name; ?>"><?php echo $profiledata->display_name; ?></option> -<option value="<?php echo $profiledata->nickname ?>"><?php echo $profiledata->nickname ?></option> -<option value="<?php echo $profiledata->user_login ?>"><?php echo $profiledata->user_login ?></option> -<?php if ( !empty( $profiledata->first_name ) ) : ?> -<option value="<?php echo $profiledata->first_name ?>"><?php echo $profiledata->first_name ?></option> +<option value="<?php echo $profileuser->display_name; ?>"><?php echo $profileuser->display_name; ?></option> +<option value="<?php echo $profileuser->nickname ?>"><?php echo $profileuser->nickname ?></option> +<option value="<?php echo $profileuser->user_login ?>"><?php echo $profileuser->user_login ?></option> +<?php if ( !empty( $profileuser->first_name ) ) : ?> +<option value="<?php echo $profileuser->first_name ?>"><?php echo $profileuser->first_name ?></option> <?php endif; ?> -<?php if ( !empty( $profiledata->last_name ) ) : ?> -<option value="<?php echo $profiledata->last_name ?>"><?php echo $profiledata->last_name ?></option> +<?php if ( !empty( $profileuser->last_name ) ) : ?> +<option value="<?php echo $profileuser->last_name ?>"><?php echo $profileuser->last_name ?></option> <?php endif; ?> -<?php if ( !empty( $profiledata->first_name ) && !empty( $profiledata->last_name ) ) : ?> -<option value="<?php echo $profiledata->first_name." ".$profiledata->last_name ?>"><?php echo $profiledata->first_name." ".$profiledata->last_name ?></option> -<option value="<?php echo $profiledata->last_name." ".$profiledata->first_name ?>"><?php echo $profiledata->last_name." ".$profiledata->first_name ?></option> +<?php if ( !empty( $profileuser->first_name ) && !empty( $profileuser->last_name ) ) : ?> +<option value="<?php echo $profileuser->first_name." ".$profileuser->last_name ?>"><?php echo $profileuser->first_name." ".$profileuser->last_name ?></option> +<option value="<?php echo $profileuser->last_name." ".$profileuser->first_name ?>"><?php echo $profileuser->last_name." ".$profileuser->first_name ?></option> <?php endif; ?> </select></label></p> </fieldset> @@ -127,29 +126,29 @@ if (!current_user_can('edit_users')) $errors['head'] = __('You do not have permi <legend><?php _e('Contact Info'); ?></legend> <p><label><?php _e('E-mail: (required)') ?><br /> -<input type="text" name="email" value="<?php echo $profiledata->user_email ?>" /></label></p> +<input type="text" name="email" value="<?php echo $profileuser->user_email ?>" /></label></p> <p><label><?php _e('Website:') ?><br /> -<input type="text" name="url" value="<?php echo $profiledata->user_url ?>" /> +<input type="text" name="url" value="<?php echo $profileuser->user_url ?>" /> </label></p> <p><label><?php _e('AIM:') ?><br /> -<input type="text" name="aim" value="<?php echo $profiledata->aim ?>" /> +<input type="text" name="aim" value="<?php echo $profileuser->aim ?>" /> </label></p> <p><label><?php _e('Yahoo IM:') ?><br /> -<input type="text" name="yim" value="<?php echo $profiledata->yim ?>" /> +<input type="text" name="yim" value="<?php echo $profileuser->yim ?>" /> </label></p> <p><label><?php _e('Jabber / Google Talk:') ?> -<input type="text" name="jabber" value="<?php echo $profiledata->jabber ?>" /></label> +<input type="text" name="jabber" value="<?php echo $profileuser->jabber ?>" /></label> </p> </fieldset> <br clear="all" /> <fieldset> <legend><?php _e('About the user'); ?></legend> <p class="desc"><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.'); ?></p> -<p><textarea name="description" rows="5" cols="30"><?php echo $profiledata->description ?></textarea></p> +<p><textarea name="description" rows="5" cols="30"><?php echo $profileuser->description ?></textarea></p> </fieldset> <?php diff --git a/wp-inst/wp-admin/users.php b/wp-inst/wp-admin/users.php index ae87269..611f7af 100644 --- a/wp-inst/wp-admin/users.php +++ b/wp-inst/wp-admin/users.php @@ -104,9 +104,9 @@ case 'delete': foreach ($userids as $id) { $user = new WP_User($id); if ($id == $current_user->id) { - echo "<li>" . sprintf('ID #%1s: %2s <strong>The current user will not be deleted.</strong>', $id, $user->data->user_login) . "</li>\n"; + echo "<li>" . sprintf('ID #%1s: %2s <strong>The current user will not be deleted.</strong>', $id, $user->user_login) . "</li>\n"; } else { - echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />" . sprintf('ID #%1s: %2s', $id, $user->data->user_login) . "</li>\n"; + echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />" . sprintf('ID #%1s: %2s', $id, $user->user_login) . "</li>\n"; $go_delete = true; } } @@ -212,7 +212,7 @@ default: $tmp_user = new WP_User($userid); $roles = $tmp_user->roles; $role = $roles[0]; - $roleclasses[$role][$tmp_user->data->user_login] = $tmp_user; + $roleclasses[$role][$tmp_user->user_login] = $tmp_user; } ?> @@ -287,10 +287,9 @@ default: <?php $style = ''; foreach ($roleclass as $user_object) { - $user_data = &$user_object->data; - if( $user_data->ID != get_site_option( "admin_user_id" ) ) { - $email = $user_data->user_email; - $url = $user_data->user_url; + if( $user_object->ID != get_site_option( "admin_user_id" ) ) { + $email = $user_object->user_email; + $url = $user_object->user_url; $short_url = str_replace('http://', '', $url); $short_url = str_replace('www.', '', $short_url); if ('/' == substr($short_url, -1)) @@ -298,31 +297,27 @@ default: if (strlen($short_url) > 35) $short_url = substr($short_url, 0, 32).'...'; $style = ('class="alternate"' == $style) ? '' : 'class="alternate"'; - $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '$user_data->ID' and post_status = 'publish'"); - if (0 < $numposts) $numposts = "<a href='edit.php?author=$user_data->ID' title='" . __('View posts') . "'>$numposts</a>"; + $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '$user_object->ID' and post_status = 'publish'"); + if (0 < $numposts) $numposts = "<a href='edit.php?author=$user_object->ID' title='" . __('View posts') . "'>$numposts</a>"; echo " <tr $style> - <td><input type='checkbox' name='users[]' id='user_{$user_data->ID}' value='{$user_data->ID}' /> <label for='user_{$user_data->ID}'>{$user_data->ID}</label></td> - <td><label for='user_{$user_data->ID}'><strong>$user_data->user_login</strong></label></td> - <td><label for='user_{$user_data->ID}'>$user_data->first_name $user_data->last_name</label></td> - <td><a href='mailto:$email' title='" . sprintf(__('e-mail: %s'), $email) . "'>$email</a></td>"; - ?> - <td><select name="new_roles[<?php echo $user_data->ID ?>]" id="new_role"><?php - foreach($wp_roles->role_names as $roleid => $name) { - $selected = ''; - if( $role == $roleid) - $selected = 'selected="selected"'; - echo "<option {$selected} value=\"{$roleid}\">{$name}</option>"; - } - ?></select></td> <?php - echo "<td align='right'>$numposts</td>"; - echo '<td>'; + <td><input type='checkbox' name='users[]' id='user_{$user_object->ID}' value='{$user_object->ID}' /> <label for='user_{$user_object->ID}'>{$user_object->ID}</label></td> + <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">"; + foreach($wp_roles->role_names as $roleid => $name) { + $selected = ''; + if( $role == $roleid) + $selected = 'selected="selected"'; + echo "<option {$selected} value=\"{$roleid}\">{$name}</option>"; + } + echo "</select></td><td align='right'>$numposts</td><td>"; if (is_site_admin()) - echo "<a href='user-edit.php?user_id=$user_data->ID' class='edit'>".__('Edit')."</a>"; - echo '</td>'; - echo '</tr>'; + echo "<a href='user-edit.php?user_id=$user_object->ID' class='edit'>".__('Edit')."</a>"; + echo '</td></tr>'; } else { - echo "<tr class='alternate'><td><label for='user_{$user_data->ID}'>{$user_data->ID}</label></td><td><label for='user_{$user_data->ID}'><strong>$user_data->user_login</strong></label></td><td><label for='user_{$user_data->ID}'>$user_data->first_name $user_data->last_name</label></td><td colspan='4'><strong>Cannot Edit Site Administrator</strong></td></tr>"; + echo "<tr class='alternate'><td><label for='user_{$user_object->ID}'>{$user_object->ID}</label></td><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 colspan='4'><strong>Cannot Edit Site Administrator</strong></td></tr>"; } } } diff --git a/wp-inst/wp-includes/capabilities.php b/wp-inst/wp-includes/capabilities.php index 63ff5e1..07d48d6 100644 --- a/wp-inst/wp-includes/capabilities.php +++ b/wp-inst/wp-includes/capabilities.php @@ -123,9 +123,13 @@ class WP_User { if ( empty($this->data->ID) ) return; - $this->id = $this->data->ID; + foreach (get_object_vars($this->data) as $key => $value) { + $this->{$key} = $value; + } + + $this->id = $this->ID; $this->cap_key = $table_prefix . 'capabilities'; - $this->caps = &$this->data->{$this->cap_key}; + $this->caps = &$this->{$this->cap_key}; if ( ! is_array($this->caps) ) $this->caps = array(); $this->get_role_caps(); @@ -182,8 +186,8 @@ class WP_User { function update_user_level_from_caps() { global $table_prefix; - $this->data->user_level = array_reduce(array_keys($this->allcaps), array(&$this, 'level_reduction'), 0); - update_usermeta($this->id, $table_prefix.'user_level', $this->data->user_level); + $this->user_level = array_reduce(array_keys($this->allcaps), array(&$this, 'level_reduction'), 0); + update_usermeta($this->id, $table_prefix.'user_level', $this->user_level); } function add_cap($cap, $grant = true) { diff --git a/wp-inst/wp-includes/classes.php b/wp-inst/wp-includes/classes.php index 135ada6..99c2b3a 100644 --- a/wp-inst/wp-includes/classes.php +++ b/wp-inst/wp-includes/classes.php @@ -30,7 +30,7 @@ class WP_Query { var $is_404 = false; var $is_comments_popup = false; var $is_admin = false; - var $is_subpost = false; + var $is_attachment = false; function init_query_flags() { $this->is_single = false; @@ -50,7 +50,7 @@ class WP_Query { $this->is_404 = false; $this->is_paged = false; $this->is_admin = false; - $this->is_subpost = false; + $this->is_attachment = false; } function init () { @@ -91,9 +91,15 @@ class WP_Query { $qv['m'] = (int) $qv['m']; $qv['p'] = (int) $qv['p']; - if ( ('' != $qv['subpost']) || $qv['subpost_id'] ) { + // Compat. Map subpost to attachment. + if ( '' != $qv['subpost'] ) + $qv['attachment'] = $qv['subpost']; + if ( '' != $qv['subpost_id'] ) + $qv['attachment_id'] = $qv['subpost_id']; + + if ( ('' != $qv['attachment']) || $qv['attachment_id'] ) { $this->is_single = true; - $this->is_subpost = true; + $this->is_attachment = true; } if ('' != $qv['name']) { @@ -214,7 +220,7 @@ class WP_Query { $this->is_admin = true; } - if ( ! ($this->is_subpost || $this->is_archive || $this->is_single || $this->is_page || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup)) { + if ( ! ($this->is_attachment || $this->is_archive || $this->is_single || $this->is_page || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup)) { $this->is_home = true; } @@ -334,6 +340,12 @@ class WP_Query { $where .= " AND DAYOFMONTH(post_date)='" . $q['day'] . "'"; } + // Compat. Map subpost to attachment. + if ( '' != $q['subpost'] ) + $q['attachment'] = $q['subpost']; + if ( '' != $q['subpost_id'] ) + $q['attachment_id'] = $q['subpost_id']; + if ('' != $q['name']) { $q['name'] = sanitize_title($q['name']); $where .= " AND post_name = '" . $q['name'] . "'"; @@ -341,10 +353,10 @@ class WP_Query { $q['pagename'] = sanitize_title(basename(str_replace('%2F', '/', urlencode($q['pagename'])))); $q['name'] = $q['pagename']; $where .= " AND post_name = '" . $q['pagename'] . "'"; - } elseif ('' != $q['subpost']) { - $q['subpost'] = sanitize_title($q['subpost']); - $q['name'] = $q['subpost']; - $where .= " AND post_name = '" . $q['subpost'] . "'"; + } elseif ('' != $q['attachment']) { + $q['attachment'] = sanitize_title($q['attachment']); + $q['name'] = $q['attachment']; + $where .= " AND post_name = '" . $q['attachment'] . "'"; } if ( (int) $q['w'] ) { @@ -355,9 +367,9 @@ class WP_Query { if ( intval($q['comments_popup']) ) $q['p'] = intval($q['comments_popup']); - // If a subpost is requested by number, let it supercede any post number. - if ( ($q['subpost_id'] != '') && (intval($q['subpost_id']) != 0) ) - $q['p'] = (int) $q['subpost_id']; + // If a attachment is requested by number, let it supercede any post number. + if ( ($q['attachment_id'] != '') && (intval($q['attachment_id']) != 0) ) + $q['p'] = (int) $q['attachment_id']; // If a post number is specified, load that post if (($q['p'] != '') && intval($q['p']) != 0) { @@ -538,8 +550,8 @@ class WP_Query { $distinct = 'DISTINCT'; } - if ( $this->is_subpost ) { - $where .= ' AND (post_status = "object")'; + if ( $this->is_attachment ) { + $where .= ' AND (post_status = "attachment")'; } elseif ($this->is_page) { $where .= ' AND (post_status = "static")'; } elseif ($this->is_single) { @@ -553,8 +565,8 @@ class WP_Query { $where .= ')'; } - if (! $this->is_subpost ) - $where .= ' AND post_status != "object"'; + if (! $this->is_attachment ) + $where .= ' AND post_status != "attachment"'; // Apply filters on where and join prior to paging so that any // manipulations to them are reflected in the paging by day queries. @@ -607,7 +619,7 @@ class WP_Query { } else { if ('draft' == $status) { // User must have edit permissions on the draft to preview. - if (! user_can_edit_post($user_ID, $this->posts[0]->ID)) { + if (! current_user_can('edit_post', $this->posts[0]->ID)) { $this->posts = array(); } else { $this->is_preview = true; @@ -1199,12 +1211,12 @@ class WP_Rewrite { $sub1feed = $sub1 . $feedregex; $sub1feed2 = $sub1 . $feedregex2; $sub1 .= '?$'; - $sub2 = $submatchbase . '/subpost/([^/]+)/'; + $sub2 = $submatchbase . '/attachment/([^/]+)/'; $sub2tb = $sub2 . $trackbackregex; $sub2feed = $sub2 . $feedregex; $sub2feed2 = $sub2 . $feedregex2; $sub2 .= '?$'; - $subquery = $index . '?subpost=' . $this->preg_index(1); + $subquery = $index . '?attachment=' . $this->preg_index(1); $subtbquery = $subquery . '&tb=1'; $subfeedquery = $subquery . '&feed=' . $this->preg_index(2); $match = $match . '(/[0-9]+)?/?$'; @@ -1381,7 +1393,7 @@ class WP_Rewrite { } class WP { - var $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 's', 'search', 'exact', 'sentence', 'debug', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup', 'subpost', 'subpost_id'); + var $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 's', 'search', 'exact', 'sentence', 'debug', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup', 'attachment', 'attachment_id', 'subpost', 'subpost_id'); var $private_query_vars = array('posts_per_page', 'posts_per_archive_page', 'what_to_show', 'showposts', 'nopaging'); @@ -1405,8 +1417,7 @@ class WP { ('/' != $_SERVER['PATH_INFO']) && (false === strpos($_SERVER['PATH_INFO'], '.php')) ) || - ((false === strpos($_SERVER['REQUEST_URI'], '.php')) && - ('/' != $_SERVER['REQUEST_URI'])) + (false === strpos($_SERVER['REQUEST_URI'], '.php')) ) { $this->did_permalink = true; @@ -1477,6 +1488,17 @@ class WP { break; } } + + // If req_uri is empty, the home page was requested. Unset error. + if ( empty($req_uri) ) { + if (isset($_GET['error'])) { + unset($_GET['error']); + } + + if (isset($error)) { + unset($error); + } + } } } @@ -1497,6 +1519,9 @@ class WP { else $this->query_vars[$wpvar] = ''; } + + if ( isset($error) ) + $this->query_vars['error'] = $error; } function send_headers() { @@ -1591,12 +1616,10 @@ class WP { // issue a 404 if one was already issued, if the request was a search, // or if the request was a regular query string request rather than a // permalink request. - if ( (0 == count($wp_query->posts)) && !is_404() && !is_search() - && ( $this->did_permalink || (!empty($_SERVER['QUERY_STRING']) && - (false === strpos($_SERVER['REQUEST_URI'], '?'))) ) ) { + if ( (0 == count($wp_query->posts)) && !is_404() && !is_search() && ( $this->did_permalink || (!empty($_SERVER['QUERY_STRING']) && (false === strpos($_SERVER['REQUEST_URI'], '?'))) ) ) { $wp_query->set_404(); status_header( 404 ); - } else { + } elseif( is_404() != true ) { status_header( 200 ); } } diff --git a/wp-inst/wp-includes/comment-functions.php b/wp-inst/wp-includes/comment-functions.php index 566d8ef..ee1a666 100644 --- a/wp-inst/wp-includes/comment-functions.php +++ b/wp-inst/wp-includes/comment-functions.php @@ -81,7 +81,12 @@ function wp_insert_comment($commentdata) { ('$comment_post_ID', '$comment_author', '$comment_author_email', '$comment_author_url', '$comment_author_IP', '$comment_date', '$comment_date_gmt', '$comment_content', '$comment_approved', '$comment_agent', '$comment_type', '$comment_parent', '$user_id') "); - return $wpdb->insert_id; + $id = $wpdb->insert_id; + + if ( $comment_approved == 1) + $wpdb->query( "UPDATE $wpdb->posts SET comment_count = comment_count + 1 WHERE ID = '$comment_post_ID'" ); + + return $id; } function wp_filter_comment($commentdata) { @@ -176,9 +181,30 @@ function wp_update_comment($commentarr) { $rval = $wpdb->rows_affected; + $c = $wpdb->get_row( "SELECT count(*) as c FROM {$wpdb->comments} WHERE comment_post_ID = '$comment_post_ID' AND comment_approved = '1'" ); + if( is_object( $c ) ) + $wpdb->query( "UPDATE $wpdb->posts SET comment_count = '$c->c' WHERE ID = '$comment_post_ID'" ); + do_action('edit_comment', $comment_ID); - return $rval; + return $rval; +} + +function wp_delete_comment($comment_id) { + global $wpdb; + do_action('delete_comment', $comment_id); + + $comment = get_comment($comment_id); + + if ( ! $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1") ) + return false; + + $post_id = $comment->comment_post_ID; + if ( $post_id ) + $wpdb->query( "UPDATE $wpdb->posts SET comment_count = comment_count - 1 WHERE ID = '$post_id'" ); + + do_action('wp_set_comment_status', $comment_id, 'delete'); + return true; } function clean_url( $url ) { @@ -198,7 +224,7 @@ function get_comments_number( $post_id = 0 ) { $post_id = $id; if ( !isset($comment_count_cache[$post_id]) ) - $comment_count_cache[$post_id] = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = '$post_id' AND comment_approved = '1'"); + $comment_count_cache[$id] = $wpdb->get_var("SELECT comment_count FROM $wpdb->posts WHERE ID = '$post_id'"); return apply_filters('get_comments_number', $comment_count_cache[$post_id]); } @@ -742,7 +768,7 @@ function wp_set_comment_status($comment_id, $comment_status) { $query = "UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID='$comment_id' LIMIT 1"; break; case 'delete': - $query = "DELETE FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1"; + return wp_delete_comment($comment_id); break; default: return false; @@ -750,6 +776,12 @@ function wp_set_comment_status($comment_id, $comment_status) { if ($wpdb->query($query)) { do_action('wp_set_comment_status', $comment_id, $comment_status); + + $comment = get_comment($comment_id); + $comment_post_ID = $comment->comment_post_ID; + $c = $wpdb->get_row( "SELECT count(*) as c FROM {$wpdb->comments} WHERE comment_post_ID = '$comment_post_ID' AND comment_approved = '1'" ); + if( is_object( $c ) ) + $wpdb->query( "UPDATE $wpdb->posts SET comment_count = '$c->c' WHERE ID = '$comment_post_ID'" ); return true; } else { return false; diff --git a/wp-inst/wp-includes/functions-formatting.php b/wp-inst/wp-includes/functions-formatting.php index 58661f4..f73382f 100644 --- a/wp-inst/wp-includes/functions-formatting.php +++ b/wp-inst/wp-includes/functions-formatting.php @@ -176,7 +176,7 @@ function remove_accents($string) { chr(196).chr(128) => 'A', chr(196).chr(129) => 'a', chr(196).chr(130) => 'A', chr(196).chr(131) => 'a', chr(196).chr(132) => 'A', chr(196).chr(133) => 'a', - chr(196).chr(134) => 'C', chr(196).chr(134) => 'c', + chr(196).chr(134) => 'C', chr(196).chr(135) => 'c', chr(196).chr(136) => 'C', chr(196).chr(137) => 'c', chr(196).chr(138) => 'C', chr(196).chr(139) => 'c', chr(196).chr(140) => 'C', chr(196).chr(141) => 'c', @@ -205,15 +205,15 @@ function remove_accents($string) { chr(196).chr(186) => 'l', chr(196).chr(187) => 'L', chr(196).chr(188) => 'l', chr(196).chr(189) => 'L', chr(196).chr(190) => 'l', chr(196).chr(191) => 'L', - chr(197).chr(128) => 'l', chr(196).chr(129) => 'L', - chr(197).chr(130) => 'l', chr(196).chr(131) => 'N', - chr(197).chr(132) => 'n', chr(196).chr(133) => 'N', - chr(197).chr(134) => 'n', chr(196).chr(135) => 'N', - chr(197).chr(136) => 'n', chr(196).chr(137) => 'N', - chr(197).chr(138) => 'n', chr(196).chr(139) => 'N', - chr(197).chr(140) => 'O', chr(196).chr(141) => 'o', - chr(197).chr(142) => 'O', chr(196).chr(143) => 'o', - chr(197).chr(144) => 'O', chr(196).chr(145) => 'o', + chr(197).chr(128) => 'l', chr(197).chr(129) => 'L', + chr(197).chr(130) => 'l', chr(197).chr(131) => 'N', + chr(197).chr(132) => 'n', chr(197).chr(133) => 'N', + chr(197).chr(134) => 'n', chr(197).chr(135) => 'N', + chr(197).chr(136) => 'n', chr(197).chr(137) => 'N', + chr(197).chr(138) => 'n', chr(197).chr(139) => 'N', + chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', + chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', + chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', diff --git a/wp-inst/wp-includes/functions-post.php b/wp-inst/wp-includes/functions-post.php index 14c8f86..872c029 100644 --- a/wp-inst/wp-includes/functions-post.php +++ b/wp-inst/wp-includes/functions-post.php @@ -131,9 +131,9 @@ function wp_insert_post($postarr = array()) { } else { $wpdb->query( "INSERT INTO $wpdb->posts - (post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, post_modified, post_modified_gmt, post_parent, menu_order, post_type) + (post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type) VALUES - ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_title', '$post_excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_type')"); + ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_title', '$post_excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type')"); $post_ID = $wpdb->insert_id; } @@ -167,6 +167,7 @@ function wp_insert_post($postarr = array()) { if ($post_status == 'publish') { do_action('publish_post', $post_ID); + if ($post_pingback && !defined('WP_IMPORTING')) $result = $wpdb->query(" INSERT INTO $wpdb->postmeta @@ -195,7 +196,7 @@ function wp_insert_post($postarr = array()) { return $post_ID; } -function wp_attach_object($object, $post_parent = 0) { +function wp_insert_attachment($object, $file, $post_parent = 0) { global $wpdb, $user_ID; // Export array as variables @@ -209,7 +210,7 @@ function wp_attach_object($object, $post_parent = 0) { $post_name = apply_filters('name_save_pre', $post_name); $comment_status = apply_filters('comment_status_pre', $comment_status); $ping_status = apply_filters('ping_status_pre', $ping_status); - $post_type = apply_filters('post_type_pre', $post_type); + $post_mime_type = apply_filters('post_mime_type_pre', $post_mime_type); // Make sure we set a valid category if (0 == count($post_category) || !is_array($post_category)) { @@ -220,7 +221,7 @@ function wp_attach_object($object, $post_parent = 0) { if ( empty($post_author) ) $post_author = $user_ID; - $post_status = 'object'; + $post_status = 'attachment'; // Get the post ID. if ( $update ) @@ -282,15 +283,15 @@ function wp_attach_object($object, $post_parent = 0) { post_modified_gmt = '$post_date_gmt', post_parent = '$post_parent', menu_order = '$menu_order', - post_type = '$post_type', + post_mime_type = '$post_mime_type', guid = '$guid' WHERE ID = $post_ID"); } else { $wpdb->query( "INSERT INTO $wpdb->posts - (post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, post_modified, post_modified_gmt, post_parent, menu_order, post_type, guid) + (post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type, guid) VALUES - ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_title', '$post_excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_type', '$guid')"); + ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_title', '$post_excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type', '$guid')"); $post_ID = $wpdb->insert_id; } @@ -301,28 +302,31 @@ function wp_attach_object($object, $post_parent = 0) { wp_set_post_cats('', $post_ID, $post_category); + add_post_meta($post_ID, '_wp_attached_file', $file); + clean_post_cache($post_ID); if ( $update) { - do_action('edit_object', $post_ID); + do_action('edit_attachment', $post_ID); } else { - do_action('attach_object', $post_ID); + do_action('add_attachment', $post_ID); } return $post_ID; } -function wp_delete_object($postid) { +function wp_delete_attachment($postid) { global $wpdb; $postid = (int) $postid; if ( !$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = $postid") ) return $post; - if ( 'object' != $post->post_status ) + if ( 'attachment' != $post->post_status ) return false; - $obj_meta = get_post_meta($postid, 'imagedata', true); + $meta = get_post_meta($postid, 'imagedata', true); + $file = get_post_meta($postid, '_wp_attached_file', true); $wpdb->query("DELETE FROM $wpdb->posts WHERE ID = $postid"); @@ -332,9 +336,13 @@ function wp_delete_object($postid) { $wpdb->query("DELETE FROM $wpdb->postmeta WHERE post_id = $postid"); - @ unlink($obj_meta['file']); + if ( ! empty($meta['file']) ) + @ unlink($meta['file']); + + if ( ! empty($file) ) + @ unlink($file); - do_action('delete_object', $postid); + do_action('delete_attachment', $postid); return $post; } @@ -466,6 +474,13 @@ function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array( VALUES ($post_ID, $new_cat)"); } } + + // Update category counts. + foreach ( $post_categories as $cat_id ) { + $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->post2cat, $wpdb->posts WHERE $wpdb->posts.ID=$wpdb->post2cat.post_id AND post_status='publish' AND category_id = '$cat_id'"); + $wpdb->query("UPDATE $wpdb->categories SET category_count = '$count' WHERE cat_ID = '$cat_id'"); + wp_cache_delete($cat_id, 'category'); + } } // wp_set_post_cats() function wp_delete_post($postid = 0) { @@ -477,6 +492,16 @@ function wp_delete_post($postid = 0) { do_action('delete_post', $postid); + if ( 'publish' == $post->post_status) { + $categories = wp_get_post_cats('', $post->ID); + if( is_array( $categories ) ) { + foreach ( $categories as $cat_id ) { + $wpdb->query("UPDATE $wpdb->categories SET category_count = category_count - 1 WHERE cat_ID = '$cat_id'"); + wp_cache_delete($cat_id, 'category'); + } + } + } + if ( 'static' == $post->post_status ) $wpdb->query("UPDATE $wpdb->posts SET post_parent = $post->post_parent WHERE post_parent = $postid AND post_status = 'static'"); @@ -726,7 +751,7 @@ function get_post_status($post = false) { $post = get_post($post, OBJECT); if ( is_object($post) ) { - if ( ('object' == $post->post_status) && $post->post_parent && ($post->ID != $post->post_parent) ) + if ( ('attachment' == $post->post_status) && $post->post_parent && ($post->ID != $post->post_parent) ) return get_post_status($post->post_parent); else return $post->post_status; diff --git a/wp-inst/wp-includes/functions.php b/wp-inst/wp-includes/functions.php index cd96216..e3a6a0d 100644 --- a/wp-inst/wp-includes/functions.php +++ b/wp-inst/wp-includes/functions.php @@ -299,10 +299,10 @@ function get_option($option) { function get_user_option( $option ) { global $wpdb, $current_user; - if ( isset( $current_user->data->{$wpdb->prefix . $option} ) ) // Blog specific - return $current_user->data->{$wpdb->prefix . $option}; - elseif ( isset( $current_user->data->{$option} ) ) // User specific and cross-blog - return $current_user->data->{$option}; + if ( isset( $current_user->{$wpdb->prefix . $option} ) ) // Blog specific + return $current_user->{$wpdb->prefix . $option}; + elseif ( isset( $current_user->{$option} ) ) // User specific and cross-blog + return $current_user->{$option}; else // Blog global return get_option( $option ); } @@ -1306,11 +1306,7 @@ function update_post_caches(&$posts) { update_post_category_cache($post_id_list); // Do the same for comment numbers - $comment_counts = $wpdb->get_results("SELECT comment_post_ID, COUNT( comment_ID ) AS ccount - FROM $wpdb->comments - WHERE comment_post_ID IN ($post_id_list) - AND comment_approved = '1' - GROUP BY comment_post_ID"); + $comment_counts = $wpdb->get_results( "SELECT ID as comment_post_ID, comment_count as ccount FROM $wpdb->posts WHERE ID in ($post_id_list)" ); if ( $comment_counts ) { foreach ($comment_counts as $comment_count) { @@ -1397,10 +1393,10 @@ function is_page ($page = '') { return false; } -function is_subpost () { +function is_attachment () { global $wp_query; - return $wp_query->is_subpost; + return $wp_query->is_attachment; } function is_preview() { @@ -1686,6 +1682,11 @@ function get_themes() { sort($theme_files); foreach($theme_files as $theme_file) { + if ( ! is_readable("$theme_root/$theme_file") ) { + $wp_broken_themes[$theme_file] = array('Name' => $theme_file, 'Title' => $theme_file, 'Description' => __('File not readable.')); + continue; + } + $theme_data = get_theme_data("$theme_root/$theme_file"); $name = $theme_data['Name']; @@ -1894,9 +1895,9 @@ function get_single_template() { return get_query_template('single'); } -function get_subpost_template() { +function get_attachment_template() { global $posts; - $type = explode('/', $posts[0]->post_type); + $type = explode('/', $posts[0]->post_mime_type); if ( $template = get_query_template($type[0]) ) return $template; elseif ( $template = get_query_template($type[1]) ) @@ -1904,7 +1905,7 @@ function get_subpost_template() { elseif ( $template = get_query_template("$type[0]_$type[1]") ) return $template; else - return get_query_template('subpost'); + return get_query_template('attachment'); } function get_comments_popup_template() { diff --git a/wp-inst/wp-includes/pluggable-functions.php b/wp-inst/wp-includes/pluggable-functions.php index 606e666..b8435fa 100644 --- a/wp-inst/wp-includes/pluggable-functions.php +++ b/wp-inst/wp-includes/pluggable-functions.php @@ -370,8 +370,8 @@ function wp_new_user_notification($user_id, $plaintext_pass = '') { for ($i = 0; $i < strlen($pass1); $i = $i + 1) $stars .= '*'; - $user_login = stripslashes($user->data->user_login); - $user_email = stripslashes($user->data->user_email); + $user_login = stripslashes($user->user_login); + $user_email = stripslashes($user->user_email); $message = sprintf(__('New user registration on your blog %s:'), get_settings('blogname')) . "\r\n\r\n"; $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; diff --git a/wp-inst/wp-includes/template-functions-links.php b/wp-inst/wp-includes/template-functions-links.php index 07b3aa5..b800010 100644 --- a/wp-inst/wp-includes/template-functions-links.php +++ b/wp-inst/wp-includes/template-functions-links.php @@ -44,8 +44,8 @@ function get_permalink($id = 0) { $post = &get_post($id); if ( $post->post_status == 'static' ) return get_page_link($post->ID); - elseif ($post->post_status == 'object') - return get_subpost_link($post->ID); + elseif ($post->post_status == 'attachment') + return get_attachment_link($post->ID); $permalink = get_settings('permalink_structure'); @@ -102,7 +102,7 @@ function get_page_link($id = false) { return apply_filters('page_link', $link, $id); } -function get_subpost_link($id = false) { +function get_attachment_link($id = false) { global $post, $wp_rewrite; $link = false; @@ -120,10 +120,10 @@ function get_subpost_link($id = false) { } if (! $link ) { - $link = get_bloginfo('home') . "/?subpost_id=$id"; + $link = get_bloginfo('home') . "/?attachment_id=$id"; } - return apply_filters('object_link', $link, $id); + return apply_filters('attachment_link', $link, $id); } function get_year_link($year) { @@ -209,7 +209,7 @@ function edit_post_link($link = 'Edit This', $before = '', $after = '') { get_currentuserinfo(); - if ( !user_can_edit_post($user_ID, $post->ID) || is_subpost() ) { + if ( !user_can_edit_post($user_ID, $post->ID) || is_attachment() ) { return; } @@ -234,7 +234,7 @@ function edit_comment_link($link = 'Edit This', $before = '', $after = '') { function get_previous_post($in_same_cat = false, $excluded_categories = '') { global $post, $wpdb; - if( !is_single() || is_subpost() ) + if( !is_single() || is_attachment() ) return null; $current_post_date = $post->post_date; @@ -265,7 +265,7 @@ function get_previous_post($in_same_cat = false, $excluded_categories = '') { function get_next_post($in_same_cat = false, $excluded_categories = '') { global $post, $wpdb; - if( !is_single() || is_subpost() ) + if( !is_single() || is_attachment() ) return null; $current_post_date = $post->post_date; @@ -297,7 +297,7 @@ function get_next_post($in_same_cat = false, $excluded_categories = '') { function previous_post_link($format='« %link', $link='%title', $in_same_cat = false, $excluded_categories = '') { - if ( is_subpost() ) { + if ( is_attachment() ) { $post = & get_post($GLOBALS['post']->post_parent); $pre = __('Belongs to '); } else { diff --git a/wp-inst/wp-includes/template-functions-post.php b/wp-inst/wp-includes/template-functions-post.php index 13ee081..e356aeb 100644 --- a/wp-inst/wp-includes/template-functions-post.php +++ b/wp-inst/wp-includes/template-functions-post.php @@ -437,16 +437,16 @@ function _page_level_out($parent, $page_tree, $args, $depth = 0, $echo = true) { return $output; } -function prepend_object($content) { +function prepend_attachment($content) { global $post; - $p = '<p class="subpostobject">'; + $p = '<p class="attachment">'; if ( '' != $post->guid ) { - if ( substr($post->post_type, 0, 6) == 'image/' ) - $p .= '<a href="' . $post->guid . '" title="Click for full-size image" ><img class="subpostimage" src="' . $post->guid . '" alt="' . $post->post_title . '" /></a>'; + if ( substr($post->post_mime_type, 0, 6) == 'image/' ) + $p .= '<a href="' . $post->guid . '" title="Click for full-size image" ><img class="attachmentimage" src="' . $post->guid . '" alt="' . $post->post_title . '" /></a>'; else - $p .= __('Attachment') . ' (' . $post->post_type . ')'; + $p .= __('Attachment') . ' (' . $post->post_mime_type . ')'; } else { $p .= __('Missing attachment'); } diff --git a/wp-inst/wp-includes/template-loader.php b/wp-inst/wp-includes/template-loader.php index 6678027..fcab1a8 100644 --- a/wp-inst/wp-includes/template-loader.php +++ b/wp-inst/wp-includes/template-loader.php @@ -16,17 +16,17 @@ if ( defined('WP_USE_THEMES') && constant('WP_USE_THEMES') ) { } else if ( is_home() && get_home_template() ) { include(get_home_template()); exit; - } else if ( is_subpost() && get_subpost_template() ) { - include(get_subpost_template()); + } else if ( is_attachment() && get_attachment_template() ) { + include(get_attachment_template()); exit; } else if ( is_single() && get_single_template() ) { - if ( is_subpost() ) - add_filter('the_content', 'prepend_object'); + if ( is_attachment() ) + add_filter('the_content', 'prepend_attachment'); include(get_single_template()); exit; } else if ( is_page() && get_page_template() ) { - if ( is_subpost() ) - add_filter('the_content', 'prepend_object'); + if ( is_attachment() ) + add_filter('the_content', 'prepend_attachment'); include(get_page_template()); exit; } else if ( is_category() && get_category_template()) { diff --git a/wp-inst/wp-includes/version.php b/wp-inst/wp-includes/version.php index f4acd41..527b1ab 100644 --- a/wp-inst/wp-includes/version.php +++ b/wp-inst/wp-includes/version.php @@ -3,6 +3,6 @@ // This just holds the version number, in a separate file so we can bump it without cluttering the SVN $wp_version = 'MU'; // Let's just avoid confusion -$wp_db_version = 2966; +$wp_db_version = 3104; ?> diff --git a/wp-inst/wp-trackback.php b/wp-inst/wp-trackback.php index 10cb22c..1a1d826 100644 --- a/wp-inst/wp-trackback.php +++ b/wp-inst/wp-trackback.php @@ -68,12 +68,14 @@ if ( !empty($tb_url) && !empty($title) && !empty($tb_url) ) { trackback_response(1, 'Sorry, trackbacks are closed for this item.'); $title = wp_specialchars( strip_tags( $title ) ); - $title = (strlen($title) > 250) ? substr($title, 0, 250) . '...' : $title; $excerpt = strip_tags($excerpt); - if ( function_exists('mb_strcut') ) // For international trackbacks - $excerpt = mb_strcut($excerpt, 0, 252, get_settings('blog_charset')) . '...'; - else + if ( function_exists('mb_substr') ) { // For international trackbacks + $excerpt = mb_substr($excerpt, 0, 252, get_settings('blog_charset')) . '...'; + $title = mb_substr($title, 0, 250, get_settings('blog_charset')) . '...'; + } else { $excerpt = (strlen($excerpt) > 255) ? substr($excerpt, 0, 252) . '...' : $excerpt; + $title = (strlen($title) > 250) ? substr($title, 0, 250) . '...' : $title; + } $comment_post_ID = $tb_id; $comment_author = $blog_name; |