summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-02-14 12:09:11 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-02-14 12:09:11 +0000
commit39854b3d3a80e4ac2bfee92a4b1210852baa7091 (patch)
tree95125abe2a96d8b137949ce71bc33340a0c6e376
parent5cd626aede5b92cd056bc0e205ac9dedfd96ae05 (diff)
downloadwordpress-mu-39854b3d3a80e4ac2bfee92a4b1210852baa7091.tar.gz
wordpress-mu-39854b3d3a80e4ac2bfee92a4b1210852baa7091.tar.xz
wordpress-mu-39854b3d3a80e4ac2bfee92a4b1210852baa7091.zip
WP Merge - requires upgrading of db through wp-admin/upgrade.php!
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@524 7be80a69-a1ef-0310-a953-fb0f7c49ff36
-rw-r--r--wp-inst/wp-admin/admin-db.php20
-rw-r--r--wp-inst/wp-admin/admin-functions.php109
-rw-r--r--wp-inst/wp-admin/admin-header.php3
-rw-r--r--wp-inst/wp-admin/admin.php18
-rw-r--r--wp-inst/wp-admin/bookmarklet.php6
-rw-r--r--wp-inst/wp-admin/cat-js.php14
-rw-r--r--wp-inst/wp-admin/categories.php2
-rw-r--r--wp-inst/wp-admin/edit-comments.php6
-rw-r--r--wp-inst/wp-admin/edit-form-advanced.php1
-rw-r--r--wp-inst/wp-admin/edit-form-ajax-cat.php6
-rw-r--r--wp-inst/wp-admin/edit-page-form.php17
-rw-r--r--wp-inst/wp-admin/edit-pages.php8
-rw-r--r--wp-inst/wp-admin/edit.php12
-rw-r--r--wp-inst/wp-admin/execute-pings.php4
-rw-r--r--wp-inst/wp-admin/import/blogger.php32
-rw-r--r--wp-inst/wp-admin/import/dotclear.php150
-rw-r--r--wp-inst/wp-admin/import/livejournal.php16
-rw-r--r--wp-inst/wp-admin/import/mt.php4
-rw-r--r--wp-inst/wp-admin/import/rss.php12
-rw-r--r--wp-inst/wp-admin/import/textpattern.php154
-rw-r--r--wp-inst/wp-admin/index.php6
-rw-r--r--wp-inst/wp-admin/inline-uploading.php8
-rw-r--r--wp-inst/wp-admin/link-manager.php16
-rw-r--r--wp-inst/wp-admin/list-manipulation.js4
-rw-r--r--wp-inst/wp-admin/list-manipulation.php4
-rw-r--r--wp-inst/wp-admin/menu-header.php10
-rw-r--r--wp-inst/wp-admin/moderation.php2
-rw-r--r--wp-inst/wp-admin/options-permalink.php8
-rw-r--r--wp-inst/wp-admin/options.php6
-rw-r--r--wp-inst/wp-admin/page-new.php4
-rw-r--r--wp-inst/wp-admin/plugin-editor.php6
-rw-r--r--wp-inst/wp-admin/plugins.php6
-rw-r--r--wp-inst/wp-admin/post.php28
-rw-r--r--wp-inst/wp-admin/setup-config.php2
-rw-r--r--wp-inst/wp-admin/templates.php6
-rw-r--r--wp-inst/wp-admin/theme-editor.php6
-rw-r--r--wp-inst/wp-admin/themes.php10
-rw-r--r--wp-inst/wp-admin/upgrade-functions.php77
-rw-r--r--wp-inst/wp-admin/upgrade-schema.php47
-rw-r--r--wp-inst/wp-admin/upgrade.php8
-rw-r--r--wp-inst/wp-admin/user-edit.php7
-rw-r--r--wp-inst/wp-admin/users.php18
-rw-r--r--wp-inst/wp-admin/wp-admin.css2
-rw-r--r--wp-inst/wp-admin/xfn.js4
-rw-r--r--wp-inst/wp-commentsrss2.php8
-rw-r--r--wp-inst/wp-content/themes/classic/comments-popup.php2
-rw-r--r--wp-inst/wp-content/themes/classic/header.php4
-rw-r--r--wp-inst/wp-content/themes/classic/index.php6
-rw-r--r--wp-inst/wp-content/themes/classic/sidebar.php2
-rw-r--r--wp-inst/wp-content/themes/default/archive.php20
-rw-r--r--wp-inst/wp-content/themes/default/archives.php2
-rw-r--r--wp-inst/wp-content/themes/default/attachment.php34
-rw-r--r--wp-inst/wp-content/themes/default/comments-popup.php2
-rw-r--r--wp-inst/wp-content/themes/default/comments.php10
-rw-r--r--wp-inst/wp-content/themes/default/functions.php10
-rw-r--r--wp-inst/wp-content/themes/default/header.php6
-rw-r--r--wp-inst/wp-content/themes/default/index.php12
-rw-r--r--wp-inst/wp-content/themes/default/links.php2
-rw-r--r--wp-inst/wp-content/themes/default/page.php6
-rw-r--r--wp-inst/wp-content/themes/default/search.php12
-rw-r--r--wp-inst/wp-content/themes/default/sidebar.php14
-rw-r--r--wp-inst/wp-content/themes/default/single.php38
-rw-r--r--wp-inst/wp-content/themes/default/style.css22
-rw-r--r--wp-inst/wp-includes/cache.php10
-rw-r--r--wp-inst/wp-includes/capabilities.php132
-rw-r--r--wp-inst/wp-includes/class-snoopy.php264
-rw-r--r--wp-inst/wp-includes/classes.php129
-rw-r--r--wp-inst/wp-includes/comment-functions.php24
-rw-r--r--wp-inst/wp-includes/default-filters.php2
-rw-r--r--wp-inst/wp-includes/functions-formatting.php12
-rw-r--r--wp-inst/wp-includes/functions-post.php179
-rw-r--r--wp-inst/wp-includes/functions.php167
-rw-r--r--wp-inst/wp-includes/js/colorpicker.js10
-rw-r--r--wp-inst/wp-includes/js/fat.js12
-rw-r--r--wp-inst/wp-includes/js/quicktags.js2
-rw-r--r--wp-inst/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js26
-rw-r--r--wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/image.js2
-rw-r--r--wp-inst/wp-includes/js/tinymce/tiny_mce.js2
-rw-r--r--wp-inst/wp-includes/js/tinymce/wp-mce-help.php2
-rw-r--r--wp-inst/wp-includes/js/tw-sack.js12
-rw-r--r--wp-inst/wp-includes/pluggable-functions.php26
-rw-r--r--wp-inst/wp-includes/registration-functions.php38
-rw-r--r--wp-inst/wp-includes/rss-functions.php214
-rw-r--r--wp-inst/wp-includes/template-functions-category.php2
-rw-r--r--wp-inst/wp-includes/template-functions-general.php27
-rw-r--r--wp-inst/wp-includes/template-functions-links.php26
-rw-r--r--wp-inst/wp-includes/template-functions-post.php6
-rw-r--r--wp-inst/wp-includes/template-loader.php2
-rw-r--r--wp-inst/wp-includes/version.php2
-rw-r--r--wp-inst/wp-includes/wp-db.php22
-rw-r--r--wp-inst/wp-includes/wp-l10n.php8
-rw-r--r--wp-inst/wp-login.php10
-rw-r--r--wp-inst/wp-mail.php4
-rw-r--r--wp-inst/wp-register.php22
-rw-r--r--wp-inst/wp-settings.php5
-rw-r--r--wp-inst/xmlrpc.php14
96 files changed, 1419 insertions, 1097 deletions
diff --git a/wp-inst/wp-admin/admin-db.php b/wp-inst/wp-admin/admin-db.php
index e10c765..e4cf6bf 100644
--- a/wp-inst/wp-admin/admin-db.php
+++ b/wp-inst/wp-admin/admin-db.php
@@ -243,7 +243,7 @@ function wp_delete_user($id, $reassign = 'novalue') {
function get_link($link_id, $output = OBJECT) {
global $wpdb;
-
+
$link = $wpdb->get_row("SELECT * FROM $wpdb->links WHERE link_id = '$link_id'");
if ( $output == OBJECT ) {
@@ -259,7 +259,7 @@ function get_link($link_id, $output = OBJECT) {
function wp_insert_link($linkdata) {
global $wpdb, $current_user;
-
+
extract($linkdata);
$update = false;
@@ -267,14 +267,14 @@ function wp_insert_link($linkdata) {
$update = true;
if ( empty($link_rating) )
- $link_rating = 0;
+ $link_rating = 0;
if ( empty($link_target) )
- $link_target = '';
+ $link_target = '';
if ( empty($link_visible) )
$link_visible = 'Y';
-
+
if ( empty($link_owner) )
$link_owner = $current_user->id;
@@ -293,7 +293,7 @@ function wp_insert_link($linkdata) {
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_category, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES('$link_url','$link_name', '$link_image', '$link_target', '$link_category', '$link_description', '$link_visible', '$link_owner', '$link_rating', '$link_rel', '$link_notes', '$link_rss')");
$link_id = $wpdb->insert_id;
}
-
+
if ( $update )
do_action('edit_link', $link_id);
else
@@ -306,12 +306,12 @@ function wp_update_link($linkdata) {
global $wpdb;
$link_id = (int) $linkdata['link_id'];
-
+
$link = get_link($link_id, ARRAY_A);
-
+
// Escape data pulled from DB.
$link = add_magic_quotes($link);
-
+
// Merge old and new fields with new fields overwriting old ones.
$linkdata = array_merge($link, $linkdata);
@@ -322,7 +322,7 @@ function wp_delete_link($link_id) {
global $wpdb;
do_action('delete_link', $link_id);
- return $wpdb->query("DELETE FROM $wpdb->links WHERE link_id = '$link_id'");
+ return $wpdb->query("DELETE FROM $wpdb->links WHERE link_id = '$link_id'");
}
function post_exists($title, $content = '', $post_date = '') {
diff --git a/wp-inst/wp-admin/admin-functions.php b/wp-inst/wp-admin/admin-functions.php
index d17a6ac..61d0097 100644
--- a/wp-inst/wp-admin/admin-functions.php
+++ b/wp-inst/wp-admin/admin-functions.php
@@ -4,8 +4,13 @@
function write_post() {
global $user_ID;
- if (!current_user_can('edit_posts'))
- die(__('You are not allowed to create posts or drafts on this blog.'));
+ if ( 'page' == $_POST['post_type'] ) {
+ if ( !current_user_can('edit_pages') )
+ die(__('You are not allowed to create pages on this blog.'));
+ } else {
+ if ( !current_user_can('edit_posts') )
+ die(__('You are not allowed to create posts or drafts on this blog.'));
+ }
// Rename.
$_POST['post_content'] = $_POST['content'];
@@ -15,15 +20,25 @@ function write_post() {
if (!empty ($_POST['post_author_override'])) {
$_POST['post_author'] = (int) $_POST['post_author_override'];
- } else
+ } else {
if (!empty ($_POST['post_author'])) {
$_POST['post_author'] = (int) $_POST['post_author'];
} else {
$_POST['post_author'] = (int) $_POST['user_ID'];
}
- if (($_POST['post_author'] != $_POST['user_ID']) && !current_user_can('edit_others_posts'))
- die(__('You cannot post as this user.'));
+ }
+
+ if ($_POST['post_author'] != $_POST['user_ID']) {
+ if ( 'page' == $_POST['post_type'] ) {
+ if ( !current_user_can('edit_others_pages') )
+ die(__('You cannot create pages as this user.'));
+ } else {
+ if ( !current_user_can('edit_others_posts') )
+ die(__('You cannot post as this user.'));
+
+ }
+ }
// What to do based on which button they pressed
if ('' != $_POST['saveasdraft'])
@@ -34,14 +49,14 @@ function write_post() {
$_POST['post_status'] = 'publish';
if ('' != $_POST['advanced'])
$_POST['post_status'] = 'draft';
- if ('' != $_POST['savepage'])
- $_POST['post_status'] = 'static';
-
- if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts'))
- $_POST['post_status'] = 'draft';
- if ('static' == $_POST['post_status'] && !current_user_can('edit_pages'))
- die(__('This user cannot edit pages.'));
+ if ( 'page' == $_POST['post_type'] ) {
+ if ('publish' == $_POST['post_status'] && !current_user_can('publish_pages'))
+ $_POST['post_status'] = 'draft';
+ } else {
+ if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts'))
+ $_POST['post_status'] = 'draft';
+ }
if (!empty ($_POST['edit_date'])) {
$aa = $_POST['aa'];
@@ -123,8 +138,13 @@ function edit_post() {
$post_ID = (int) $_POST['post_ID'];
- if (!current_user_can('edit_post', $post_ID))
- die(__('You are not allowed to edit this post.'));
+ if ( 'page' == $_POST['post_type'] ) {
+ if ( !current_user_can('edit_page', $post_ID) )
+ die(__('You are not allowed to edit this page.'));
+ } else {
+ if ( !current_user_can('edit_post', $post_ID) )
+ die(__('You are not allowed to edit this post.'));
+ }
// Rename.
$_POST['ID'] = (int) $_POST['post_ID'];
@@ -142,8 +162,16 @@ function edit_post() {
$_POST['post_author'] = (int) $_POST['user_ID'];
}
- if (($_POST['post_author'] != $_POST['user_ID']) && !current_user_can('edit_others_posts'))
- die(__('You cannot post as this user.'));
+ if ($_POST['post_author'] != $_POST['user_ID']) {
+ if ( 'page' == $_POST['post_type'] ) {
+ if ( !current_user_can('edit_others_pages') )
+ die(__('You cannot edit pages as this user.'));
+ } else {
+ if ( !current_user_can('edit_others_posts') )
+ die(__('You cannot edit posts as this user.'));
+
+ }
+ }
// What to do based on which button they pressed
if ('' != $_POST['saveasdraft'])
@@ -154,14 +182,14 @@ function edit_post() {
$_POST['post_status'] = 'publish';
if ('' != $_POST['advanced'])
$_POST['post_status'] = 'draft';
- if ('' != $_POST['savepage'])
- $_POST['post_status'] = 'static';
- if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts'))
- $_POST['post_status'] = 'draft';
-
- if ('static' == $_POST['post_status'] && !current_user_can('edit_pages'))
- die(__('This user cannot edit pages.'));
+ if ( 'page' == $_POST['post_type'] ) {
+ if ('publish' == $_POST['post_status'] && !current_user_can('edit_published_pages'))
+ $_POST['post_status'] = 'draft';
+ } else {
+ if ('publish' == $_POST['post_status'] && !current_user_can('edit_published_posts'))
+ $_POST['post_status'] = 'draft';
+ }
if (!isset ($_POST['comment_status']))
$_POST['comment_status'] = 'closed';
@@ -189,7 +217,7 @@ function edit_post() {
foreach ($_POST['meta'] as $key => $value)
update_meta($key, $value['key'], $value['value']);
}
-
+
if ($_POST['deletemeta']) {
foreach ($_POST['deletemeta'] as $key => $value)
delete_meta($key);
@@ -254,7 +282,7 @@ function get_post_to_edit($id) {
$post->post_title = format_to_edit($post->post_title);
$post->post_title = apply_filters('title_edit_pre', $post->post_title);
- if ($post->post_status == 'static')
+ if ($post->post_type == 'page')
$post->page_template = get_post_meta($id, '_wp_page_template', true);
return $post;
@@ -436,13 +464,13 @@ function edit_user($user_id = 0) {
function get_link_to_edit($link_id) {
$link = get_link($link_id);
-
+
$link->link_url = wp_specialchars($link->link_url, 1);
$link->link_name = wp_specialchars($link->link_name, 1);
$link->link_description = wp_specialchars($link->link_description);
$link->link_notes = wp_specialchars($link->link_notes);
$link->link_rss = wp_specialchars($link->link_rss);
-
+
return $link;
}
@@ -451,17 +479,17 @@ function get_default_link_to_edit() {
$link->link_url = wp_specialchars($_GET['linkurl'], 1);
else
$link->link_url = '';
-
+
if ( isset($_GET['name']) )
$link->link_name = wp_specialchars($_GET['name'], 1);
else
$link->link_name = '';
-
+
return $link;
}
function add_link() {
- return edit_link();
+ return edit_link();
}
function edit_link($link_id = '') {
@@ -474,7 +502,7 @@ function edit_link($link_id = '') {
$_POST['link_image'] = wp_specialchars($_POST['link_image']);
$_POST['link_rss'] = wp_specialchars($_POST['link_rss']);
$auto_toggle = get_autotoggle($_POST['link_category']);
-
+
// if we are in an auto toggle category and this one is visible then we
// need to make the others invisible before we add this new one.
// FIXME Add category toggle func.
@@ -549,7 +577,7 @@ function get_nested_categories($default = 0, $parent = 0) {
$result[$cat]['cat_name'] = get_the_category_by_ID($cat);
}
}
-
+
usort($result, 'sort_cats');
return $result;
@@ -582,12 +610,12 @@ function cat_rows($parent = 0, $level = 0, $categories = 0) {
foreach ($categories as $category) {
if ($category->category_parent == $parent) {
$category->cat_name = wp_specialchars($category->cat_name);
- $count = $wpdb->get_var("SELECT COUNT(post_id) FROM $wpdb->post2cat WHERE category_id = $category->cat_ID");
+ //$count = $wpdb->get_var("SELECT COUNT(post_id) FROM $wpdb->post2cat WHERE category_id = $category->cat_ID");
$pad = str_repeat('&#8212; ', $level);
if ( current_user_can('manage_categories') ) {
$edit = "<a href='categories.php?action=edit&amp;cat_ID=$category->cat_ID' class='edit'>".__('Edit')."</a></td>";
$default_cat_id = get_option('default_category');
-
+
if ($category->cat_ID != $default_cat_id)
$edit .= "<td><a href='categories.php?action=delete&amp;cat_ID=$category->cat_ID' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '".sprintf(__("You are about to delete the category &quot;%s&quot;. All of its posts will go to the default category.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), wp_specialchars($category->cat_name, 1))."' );\" class='delete'>".__('Delete')."</a>";
else
@@ -599,9 +627,10 @@ function cat_rows($parent = 0, $level = 0, $categories = 0) {
$class = ('alternate' == $class) ? '' : 'alternate';
echo "<tr id='cat-$category->cat_ID' class='$class'><th scope='row'>$category->cat_ID</th><td>$pad $category->cat_name</td>
<td>$category->category_description</td>
- <td>$count</td>
+ <td>$category->category_count</td>
<td>$edit</td>
</tr>";
+ //<td>$count</td>
cat_rows($category->cat_ID, $level +1, $categories);
}
}
@@ -613,7 +642,7 @@ function cat_rows($parent = 0, $level = 0, $categories = 0) {
function page_rows($parent = 0, $level = 0, $pages = 0) {
global $wpdb, $class, $post;
if (!$pages)
- $pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'static' ORDER BY menu_order");
+ $pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type = 'page' ORDER BY menu_order");
if ($pages) {
foreach ($pages as $post) {
@@ -671,7 +700,7 @@ function wp_dropdown_cats($currentcat = 0, $currentparent = 0, $parent = 0, $lev
function link_category_dropdown($fieldname, $selected = 0) {
global $wpdb;
-
+
$results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id");
echo "\n<select name='$fieldname' size='1'>\n";
foreach ($results as $row) {
@@ -1176,7 +1205,7 @@ function page_template_dropdown($default = '') {
function parent_dropdown($default = 0, $parent = 0, $level = 0) {
global $wpdb, $post_ID;
- $items = $wpdb->get_results("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = $parent AND post_status = 'static' ORDER BY menu_order");
+ $items = $wpdb->get_results("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = $parent AND post_type = 'page' ORDER BY menu_order");
if ($items) {
foreach ($items as $item) {
@@ -1806,7 +1835,7 @@ o.submit();
<input type="button" value="<?php _e('Cancel'); ?>" onclick="cancelUpload()" />
</div>
</form>
-<?php
+<?php
}
function wp_import_handle_upload() {
@@ -1848,7 +1877,7 @@ function the_attachment_links($id = false) {
$id = (int) $id;
$post = & get_post($id);
- if ( $post->post_status != 'attachment' )
+ if ( $post->post_type != 'attachment' )
return false;
$icon = get_attachment_icon($post->ID);
diff --git a/wp-inst/wp-admin/admin-header.php b/wp-inst/wp-admin/admin-header.php
index ec05aa0..b994f7c 100644
--- a/wp-inst/wp-admin/admin-header.php
+++ b/wp-inst/wp-admin/admin-header.php
@@ -3,7 +3,8 @@
if (!isset($_GET["page"])) require_once('admin.php');
if ( $editing ) {
$dbx_js = true;
- $cat_js = true;
+ if ( current_user_can('manage_categories') )
+ $cat_js = true;
}
if ( $list_js || $cat_js )
$sack_js = true;
diff --git a/wp-inst/wp-admin/admin.php b/wp-inst/wp-admin/admin.php
index ab1c8b3..ab53b4c 100644
--- a/wp-inst/wp-admin/admin.php
+++ b/wp-inst/wp-admin/admin.php
@@ -53,41 +53,41 @@ if (isset($_GET['page'])) {
if ( $page_hook ) {
if (! isset($_GET['noheader']))
require_once(ABSPATH . '/wp-admin/admin-header.php');
-
+
do_action($page_hook);
} else {
if ( validate_file($plugin_page) ) {
die(__('Invalid plugin page'));
}
-
+
if (! file_exists(ABSPATH . "wp-content/plugins/$plugin_page"))
die(sprintf(__('Cannot load %s.'), $plugin_page));
if (! isset($_GET['noheader']))
require_once(ABSPATH . '/wp-admin/admin-header.php');
-
+
include(ABSPATH . "wp-content/plugins/$plugin_page");
}
-
+
include(ABSPATH . 'wp-admin/admin-footer.php');
exit();
} else if (isset($_GET['import'])) {
-
+
$importer = $_GET['import'];
if ( validate_file($importer) ) {
die(__('Invalid importer.'));
}
-
+
if (! file_exists(ABSPATH . "wp-admin/import/$importer.php"))
die(__('Cannot load importer.'));
-
+
include(ABSPATH . "wp-admin/import/$importer.php");
$parent_file = 'import.php';
$title = __('Import');
-
+
if (! isset($_GET['noheader']))
require_once(ABSPATH . 'wp-admin/admin-header.php');
@@ -97,7 +97,7 @@ if (isset($_GET['page'])) {
kses_init_filters(); // Always filter imported data with kses.
call_user_func($wp_importers[$importer][2]);
-
+
include(ABSPATH . 'wp-admin/admin-footer.php');
exit();
diff --git a/wp-inst/wp-admin/bookmarklet.php b/wp-inst/wp-admin/bookmarklet.php
index 195e35c..4345340 100644
--- a/wp-inst/wp-admin/bookmarklet.php
+++ b/wp-inst/wp-admin/bookmarklet.php
@@ -25,16 +25,16 @@ $post = get_default_post_to_edit();
$popuptitle = wp_specialchars(stripslashes($popuptitle));
$text = wp_specialchars(stripslashes(urldecode($text)));
-
+
$popuptitle = funky_javascript_fix($popuptitle);
$text = funky_javascript_fix($text);
-
+
$post_title = wp_specialchars($_REQUEST['post_title']);
if (!empty($post_title))
$post->post_title = stripslashes($post_title);
else
$post->post_title = $popuptitle;
-
+
$content = wp_specialchars($_REQUEST['content']);
$popupurl = wp_specialchars($_REQUEST['popupurl']);
diff --git a/wp-inst/wp-admin/cat-js.php b/wp-inst/wp-admin/cat-js.php
index 8451873..e4fee46 100644
--- a/wp-inst/wp-admin/cat-js.php
+++ b/wp-inst/wp-admin/cat-js.php
@@ -78,7 +78,7 @@ function newCatCompletion() {
var id = 0;
var ids = new Array();
var names = new Array();
-
+
ids = myPload( ajaxCat.response );
names = myPload( newcat.value );
for ( i = 0; i < ids.length; i++ ) {
@@ -91,9 +91,9 @@ function newCatCompletion() {
p.innerHTML = "<?php echo addslashes(__('That category name is invalid. Try something else.')); ?>";
return;
}
-
+
var exists = document.getElementById('category-' + id);
-
+
if (exists) {
var moveIt = exists.parentNode;
var container = moveIt.parentNode;
@@ -111,20 +111,20 @@ function newCatCompletion() {
newLabel.setAttribute('for', 'category-' + id);
newLabel.id = 'new-category-' + id;
newLabel.className = 'selectit fade';
-
+
var newCheck = document.createElement('input');
newCheck.type = 'checkbox';
newCheck.value = id;
newCheck.name = 'post_category[]';
newCheck.id = 'category-' + id;
newLabel.appendChild(newCheck);
-
+
var newLabelText = document.createTextNode(' ' + names[i]);
newLabel.appendChild(newLabelText);
-
+
catDiv.insertBefore(newLabel, catDiv.firstChild);
newCheck.checked = 'checked';
-
+
Fat.fade_all();
newLabel.className = 'selectit';
}
diff --git a/wp-inst/wp-admin/categories.php b/wp-inst/wp-admin/categories.php
index a50deb2..e9b4890 100644
--- a/wp-inst/wp-admin/categories.php
+++ b/wp-inst/wp-admin/categories.php
@@ -27,7 +27,7 @@ case 'addcat':
if ( !current_user_can('manage_categories') )
die (__('Cheatin&#8217; uh?'));
-
+
wp_insert_category($_POST);
header('Location: categories.php?message=1#addcat');
diff --git a/wp-inst/wp-admin/edit-comments.php b/wp-inst/wp-admin/edit-comments.php
index e74ebb4..32ec092 100644
--- a/wp-inst/wp-admin/edit-comments.php
+++ b/wp-inst/wp-admin/edit-comments.php
@@ -88,9 +88,9 @@ if ('view' == $mode) {
if ($i % 2)
$class .= ' alternate';
echo "<li id='comment-$comment->comment_ID' class='$class'>";
-?>
+?>
<p><strong><?php _e('Name:') ?></strong> <?php comment_author() ?> <?php if ($comment->comment_author_email) { ?>| <strong><?php _e('E-mail:') ?></strong> <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url ) { ?> | <strong><?php _e('URI:') ?></strong> <?php comment_author_url_link() ?> <?php } ?>| <strong><?php _e('IP:') ?></strong> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p>
-
+
<?php comment_text() ?>
<p><?php _e('Posted'); echo ' '; comment_date('M j, g:i A');
@@ -118,7 +118,7 @@ if ('view' == $mode) {
?>
<p>
<strong><?php _e('No comments found.') ?></strong></p>
-
+
<?php
} // end if ($comments)
} elseif ('edit' == $mode) {
diff --git a/wp-inst/wp-admin/edit-form-advanced.php b/wp-inst/wp-admin/edit-form-advanced.php
index a30e0f1..b804c14 100644
--- a/wp-inst/wp-admin/edit-form-advanced.php
+++ b/wp-inst/wp-admin/edit-form-advanced.php
@@ -51,6 +51,7 @@ if (empty($post->post_status)) $post->post_status = 'draft';
<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
<input type="hidden" name="action" value="<?php echo $form_action ?>" />
<input type="hidden" name="post_author" value="<?php echo $post->post_author ?>" />
+<input type="hidden" name="post_type" value="post" />
<?php echo $form_extra ?>
<?php if (isset($_GET['message']) && 2 > $_GET['message']) : ?>
diff --git a/wp-inst/wp-admin/edit-form-ajax-cat.php b/wp-inst/wp-admin/edit-form-ajax-cat.php
index ce9e43f..4a4665c 100644
--- a/wp-inst/wp-admin/edit-form-ajax-cat.php
+++ b/wp-inst/wp-admin/edit-form-ajax-cat.php
@@ -17,16 +17,16 @@ $ids = array();
foreach ($names as $cat_name) {
$cat_name = trim( $cat_name );
-
+
if ( !$category_nicename = sanitize_title($cat_name) )
continue;
if ( $already = category_exists($cat_name) ) {
$ids[] = (string) $already;
continue;
}
-
+
$new_cat_id = wp_create_category($cat_name);
-
+
$ids[] = (string) $new_cat_id;
}
diff --git a/wp-inst/wp-admin/edit-page-form.php b/wp-inst/wp-admin/edit-page-form.php
index ae59489..2e3684c 100644
--- a/wp-inst/wp-admin/edit-page-form.php
+++ b/wp-inst/wp-admin/edit-page-form.php
@@ -30,7 +30,7 @@ if (isset($mode) && 'bookmarklet' == $mode) {
<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
<input type="hidden" name="action" value='<?php echo $form_action ?>' />
<?php echo $form_extra ?>
-<input type="hidden" name="post_status" value="static" />
+<input type="hidden" name="post_type" value="page" />
<script type="text/javascript">
<!--
@@ -55,8 +55,17 @@ addLoadEvent(focusit);
</div>
</fieldset>
+<fieldset class="dbx-box">
+<h3 class="dbx-handle"><?php _e('Page Status') ?></h3>
+<div class="dbx-content"><?php if ( current_user_can('publish_posts') ) : ?>
+<label for="post_status_publish" class="selectit"><input id="post_status_publish" name="post_status" type="radio" value="publish" <?php checked($post->post_status, 'publish'); ?> /> <?php _e('Published') ?></label>
+<?php endif; ?>
+ <label for="post_status_draft" class="selectit"><input id="post_status_draft" name="post_status" type="radio" value="draft" <?php checked($post->post_status, 'draft'); ?> /> <?php _e('Draft') ?></label>
+ <label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="radio" value="private" <?php checked($post->post_status, 'private'); ?> /> <?php _e('Private') ?></label></div>
+</fieldset>
+
<fieldset id="passworddiv" class="dbx-box">
-<h3 class="dbx-handle"><?php _e('Password-Protect Post') ?></h3>
+<h3 class="dbx-handle"><?php _e('Password-Protect Page') ?></h3>
<div class="dbx-content"><input name="post_password" type="text" size="13" id="post_password" value="<?php echo $post->post_password ?>" /></div>
</fieldset>
@@ -81,13 +90,13 @@ addLoadEvent(focusit);
<?php } ?>
<fieldset id="slugdiv" class="dbx-box">
-<h3 class="dbx-handle"><?php _e('Post slug') ?></h3>
+<h3 class="dbx-handle"><?php _e('Page slug') ?></h3>
<div class="dbx-content"><input name="post_name" type="text" size="13" id="post_name" value="<?php echo $post->post_name ?>" /></div>
</fieldset>
<?php if ( $authors = get_editable_authors( $current_user->id ) ) : // TODO: ROLE SYSTEM ?>
<fieldset id="authordiv" class="dbx-box">
-<h3 class="dbx-handle"><?php _e('Post author'); ?>:</h3>
+<h3 class="dbx-handle"><?php _e('Page author'); ?>:</h3>
<div class="dbx-content">
<select name="post_author_override" id="post_author_override">
<?php
diff --git a/wp-inst/wp-admin/edit-pages.php b/wp-inst/wp-admin/edit-pages.php
index 4e5a04d..6729f1b 100644
--- a/wp-inst/wp-admin/edit-pages.php
+++ b/wp-inst/wp-admin/edit-pages.php
@@ -25,7 +25,7 @@ $show_post_type = 'page';
if ( isset($_GET['s']) )
wp();
else
- $posts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'static'");
+ $posts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type = 'page'");
if ($posts) {
?>
@@ -43,7 +43,7 @@ if ($posts) {
if ( isset($_GET['s']) ) {
foreach ( $posts as $post ) :
$class = ('alternate' != $class) ? 'alternate' : ''; ?>
- <tr id='page-<?php echo $id; ?>' class='<?php echo $class; ?>'>
+ <tr id='page-<?php echo $post->ID; ?>' class='<?php echo $class; ?>'>
<th scope="row"><?php echo $post->ID; ?></th>
<td>
<?php echo $pad; ?><?php the_title() ?>
@@ -51,8 +51,8 @@ foreach ( $posts as $post ) :
<td><?php the_author() ?></td>
<td><?php echo mysql2date('Y-m-d g:i a', $post->post_modified); ?></td>
<td><a href="<?php the_permalink(); ?>" rel="permalink" class="edit"><?php _e('View'); ?></a></td>
- <td><?php if ( current_user_can('edit_pages') ) { echo "<a href='post.php?action=edit&amp;post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
- <td><?php if ( current_user_can('edit_pages') ) { echo "<a href='post.php?action=delete&amp;post=$id' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . sprintf(__("You are about to delete the &quot;%s&quot; page.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), wp_specialchars(get_the_title('','',0), 1)) . "' );\">" . __('Delete') . "</a>"; } ?></td>
+ <td><?php if ( current_user_can('edit_page', $post->ID) ) { echo "<a href='post.php?action=edit&amp;post=$post->ID' class='edit'>" . __('Edit') . "</a>"; } ?></td>
+ <td><?php if ( current_user_can('delete_page', $post->ID) ) { echo "<a href='post.php?action=delete&amp;post=$post->ID' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . sprintf(__("You are about to delete the &quot;%s&quot; page.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), wp_specialchars(get_the_title('','',0), 1)) . "' );\">" . __('Delete') . "</a>"; } ?></td>
</tr>
<?php
endforeach;
diff --git a/wp-inst/wp-admin/edit.php b/wp-inst/wp-admin/edit.php
index 27d3bc4..1776809 100644
--- a/wp-inst/wp-admin/edit.php
+++ b/wp-inst/wp-admin/edit.php
@@ -84,7 +84,7 @@ if ( is_month() ) {
</fieldset>
</form>
-<?php $arc_result = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_date != '0000-00-00 00:00:00' ORDER BY post_date DESC");
+<?php $arc_result = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC");
if ( count($arc_result) ) { ?>
@@ -93,15 +93,15 @@ if ( count($arc_result) ) { ?>
<legend><?php _e('Browse Month&hellip;') ?></legend>
<select name='m'>
<?php
- foreach ($arc_result as $arc_row) {
+ foreach ($arc_result as $arc_row) {
$arc_year = $arc_row->yyear;
$arc_month = $arc_row->mmonth;
-
+
if( isset($_GET['m']) && $arc_year . zeroise($arc_month, 2) == (int) $_GET['m'] )
$default = 'selected="selected"';
else
$default = null;
-
+
echo "<option $default value=\"" . $arc_year.zeroise($arc_month, 2) . '">';
echo $month[zeroise($arc_month, 2)] . " $arc_year";
echo "</option>\n";
@@ -157,7 +157,7 @@ $class = ('alternate' == $class) ? '' : 'alternate';
foreach($posts_columns as $column_name=>$column_display_name) {
switch($column_name) {
-
+
case 'id':
?>
<th scope="row"><?php echo $id ?></th>
@@ -210,7 +210,7 @@ foreach($posts_columns as $column_name=>$column_display_name) {
case 'control_delete':
?>
- <td><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='post.php?action=delete&amp;post=$id' class='delete' onclick=\"return deleteSomething( 'post', " . $id . ", '" . sprintf(__("You are about to delete this post &quot;%s&quot;.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), wp_specialchars(get_the_title('', ''), 1) ) . "' );\">" . __('Delete') . "</a>"; } ?></td>
+ <td><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='post.php?action=delete&amp;post=$id' class='delete' onclick=\"return deleteSomething( 'post', " . $id . ", '" . sprintf(__("You are about to delete this post &quot;%s&quot;.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), wp_specialchars(get_the_title('', ''), 1) ) . "' );\">" . __('Delete') . "</a>"; } ?></td>
<?php
break;
diff --git a/wp-inst/wp-admin/execute-pings.php b/wp-inst/wp-admin/execute-pings.php
index 8dc2945..a807223 100644
--- a/wp-inst/wp-admin/execute-pings.php
+++ b/wp-inst/wp-admin/execute-pings.php
@@ -15,11 +15,13 @@ while ($enclosure = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postme
}
// Do Trackbacks
-$trackbacks = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE CHAR_LENGTH(TRIM(to_ping)) > 7 AND post_status != 'draft'");
+$trackbacks = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE CHAR_LENGTH(TRIM(to_ping)) > 7 AND post_status = 'publish'");
if ( is_array($trackbacks) ) {
foreach ( $trackbacks as $trackback ) {
do_trackbacks($trackback->ID);
}
}
+generic_ping();
+
?>
diff --git a/wp-inst/wp-admin/import/blogger.php b/wp-inst/wp-admin/import/blogger.php
index 541c4f4..4d9f3c3 100644
--- a/wp-inst/wp-admin/import/blogger.php
+++ b/wp-inst/wp-admin/import/blogger.php
@@ -135,13 +135,13 @@ class Blogger_Import {
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
if ($header) curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$response = curl_exec ($ch);
-
+
if ($parse) {
$response = $this->parse_response($response);
$response['url'] = $url;
return $response;
}
-
+
return $response;
}
@@ -210,7 +210,7 @@ class Blogger_Import {
$this->import['blogs'][$_GET['blog']]['nextstep'] = $step;
update_option('import-blogger', $this->import);
}
-
+
// Redirects to next step
function do_next_step() {
header("Location: admin.php?import=blogger&noheader=true&blog={$_GET['blog']}");
@@ -224,13 +224,13 @@ class Blogger_Import {
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>');
}
-
- // Try logging in. If we get an array of cookies back, we at least connected.
+
+ // 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.'));
}
-
+
// Save the password so we can log the browser in when it's time to publish.
$this->import['pass'] = $_POST['pass'];
$this->import['user'] = $_POST['user'];
@@ -395,7 +395,7 @@ class Blogger_Import {
update_option('import-blogger', $import);
$archive = $this->get_blogger($url);
if ( $archive['code'] > 200 )
- continue;
+ continue;
$posts = explode('<wordpresspost>', $archive['body']);
for ($i = 1; $i < count($posts); $i = $i + 1) {
$postparts = explode('<wordpresscomment>', $posts[$i]);
@@ -409,7 +409,7 @@ class Blogger_Import {
$post_title = ( $postinfo[4] != '' ) ? $postinfo[4] : $postinfo[3];
$post_author_name = $wpdb->escape(trim($postinfo[1]));
$post_author_email = $postinfo[5] ? $postinfo[5] : 'user@wordpress.org';
-
+
if ( $this->lump_authors ) {
// Ignore Blogger authors. Use the current user_ID for all posts imported.
$post_author = $GLOBALS['user_ID'];
@@ -435,21 +435,21 @@ class Blogger_Import {
$posthour = zeroise($post_date_His[0], 2);
$postminute = zeroise($post_date_His[1], 2);
$postsecond = zeroise($post_date_His[2], 2);
-
+
if (($post_date[2] == 'PM') && ($posthour != '12'))
$posthour = $posthour + 12;
else if (($post_date[2] == 'AM') && ($posthour == '12'))
$posthour = '00';
-
+
$post_date = "$postyear-$postmonth-$postday $posthour:$postminute:$postsecond";
-
+
$post_content = addslashes($post_content);
$post_content = str_replace(array('<br>','<BR>','<br/>','<BR/>','<br />','<BR />'), "\n", $post_content); // the XHTML touch... ;)
-
+
$post_title = addslashes($post_title);
-
+
$post_status = 'publish';
-
+
if ( $ID = post_exists($post_title, '', $post_date) ) {
$post_array[$i]['ID'] = $ID;
$skippedpostcount++;
@@ -597,7 +597,7 @@ class Blogger_Import {
if ( $_GET['restart'] == 'true' ) {
$this->restart();
}
-
+
if ( isset($_GET['noheader']) ) {
$this->import = get_settings('import-blogger');
@@ -647,7 +647,7 @@ class Blogger_Import {
break;
}
die;
-
+
} else {
$this->greet();
}
diff --git a/wp-inst/wp-admin/import/dotclear.php b/wp-inst/wp-admin/import/dotclear.php
index 2caab8c..7d67509 100644
--- a/wp-inst/wp-admin/import/dotclear.php
+++ b/wp-inst/wp-admin/import/dotclear.php
@@ -7,10 +7,10 @@ if(!function_exists('get_catbynicename'))
function get_catbynicename($category_nicename)
{
global $wpdb;
-
+
$cat_id -= 0; // force numeric
$name = $wpdb->get_var('SELECT cat_ID FROM '.$wpdb->categories.' WHERE category_nicename="'.$category_nicename.'"');
-
+
return $name;
}
}
@@ -135,7 +135,7 @@ class Dotclear_Import {
{
echo '</div>';
}
-
+
function greet()
{
echo '<p>'.__('Howdy! This importer allows you to extract posts from a Dotclear database into your blog. Mileage may vary.').'</p>';
@@ -153,11 +153,11 @@ class Dotclear_Import {
$dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
set_magic_quotes_runtime(0);
$prefix = get_option('tpre');
-
+
// Get Categories
return $dcdb->get_results('SELECT * FROM dc_categorie', ARRAY_A);
}
-
+
function get_dc_users()
{
global $wpdb;
@@ -165,25 +165,25 @@ class Dotclear_Import {
$dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
set_magic_quotes_runtime(0);
$prefix = get_option('tpre');
-
+
// Get Users
-
+
return $dcdb->get_results('SELECT * FROM dc_user', ARRAY_A);
}
-
+
function get_dc_posts()
{
// General Housekeeping
$dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
set_magic_quotes_runtime(0);
$prefix = get_option('tpre');
-
+
// Get Posts
return $dcdb->get_results('SELECT dc_post.*, dc_categorie.cat_libelle_url AS post_cat_name
FROM dc_post INNER JOIN dc_categorie
ON dc_post.cat_id = dc_categorie.cat_id', ARRAY_A);
}
-
+
function get_dc_comments()
{
global $wpdb;
@@ -191,11 +191,11 @@ class Dotclear_Import {
$dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
set_magic_quotes_runtime(0);
$prefix = get_option('tpre');
-
+
// Get Comments
return $dcdb->get_results('SELECT * FROM dc_comment', ARRAY_A);
}
-
+
function get_dc_links()
{
//General Housekeeping
@@ -205,7 +205,7 @@ class Dotclear_Import {
return $dcdb->get_results('SELECT * FROM dc_link ORDER BY position', ARRAY_A);
}
-
+
function cat2wp($categories='')
{
// General Housekeeping
@@ -220,7 +220,7 @@ class Dotclear_Import {
{
$count++;
extract($category);
-
+
// Make Nice Variables
$name = $wpdb->escape($cat_libelle_url);
$title = $wpdb->escape(csc ($cat_libelle));
@@ -236,7 +236,7 @@ class Dotclear_Import {
}
$dccat2wpcat[$id] = $ret_id;
}
-
+
// Store category translation for future use
add_option('dccat2wpcat',$dccat2wpcat);
echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> categories imported.'), $count).'<br /><br /></p>';
@@ -245,14 +245,14 @@ class Dotclear_Import {
echo __('No Categories to Import!');
return false;
}
-
+
function users2wp($users='')
{
// General Housekeeping
global $wpdb;
$count = 0;
$dcid2wpid = array();
-
+
// Midnight Mojo
if(is_array($users))
{
@@ -261,14 +261,14 @@ class Dotclear_Import {
{
$count++;
extract($user);
-
+
// Make Nice Variables
$name = $wpdb->escape(csc ($name));
$RealName = $wpdb->escape(csc ($user_pseudo));
-
+
if($uinfo = get_userdatabylogin($name))
{
-
+
$ret_id = wp_insert_user(array(
'ID' => $uinfo->ID,
'user_login' => $user_id,
@@ -289,9 +289,9 @@ class Dotclear_Import {
);
}
$dcid2wpid[$user_id] = $ret_id;
-
+
// Set Dotclear-to-WordPress permissions translation
-
+
// Update Usermeta Data
$user = new WP_User($ret_id);
$wp_perms = $user_level + 1;
@@ -302,26 +302,26 @@ class Dotclear_Import {
else if(3 <= $wp_perms) { $user->set_role('contributor'); }
else if(2 <= $wp_perms) { $user->set_role('contributor'); }
else { $user->set_role('subscriber'); }
-
+
update_usermeta( $ret_id, 'wp_user_level', $wp_perms);
update_usermeta( $ret_id, 'rich_editing', 'false');
update_usermeta( $ret_id, 'first_name', csc ($user_prenom));
update_usermeta( $ret_id, 'last_name', csc ($user_nom));
}// End foreach($users as $user)
-
+
// Store id translation array for future use
add_option('dcid2wpid',$dcid2wpid);
-
-
+
+
echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> users imported.'), $count).'<br /><br /></p>';
return true;
}// End if(is_array($users)
-
+
echo __('No Users to Import!');
return false;
-
+
}// End function user2wp()
-
+
function posts2wp($posts='')
{
// General Housekeeping
@@ -338,11 +338,11 @@ class Dotclear_Import {
{
$count++;
extract($post);
-
+
// Set Dotclear-to-WordPress status translation
$stattrans = array(0 => 'draft', 1 => 'publish');
$comment_status_map = array (0 => 'closed', 1 => 'open');
-
+
//Can we do this more efficiently?
$uinfo = ( get_userdatabylogin( $user_id ) ) ? get_userdatabylogin( $user_id ) : 1;
$authorid = ( is_object( $uinfo ) ) ? $uinfo->ID : $uinfo ;
@@ -356,9 +356,9 @@ class Dotclear_Import {
$post_excerpt = $wpdb->escape ($post_excerpt);
$post_content = $wpdb->escape ($post_content);
$post_status = $stattrans[$post_pub];
-
+
// Import Post data into WordPress
-
+
if($pinfo = post_exists($Title,$post_content))
{
$ret_id = wp_insert_post(array(
@@ -397,7 +397,7 @@ class Dotclear_Import {
);
}
$dcposts2wpposts[$post_id] = $ret_id;
-
+
// Make Post-to-Category associations
$cats = array();
if($cat1 = get_catbynicename($post_cat_name)) { $cats[1] = $cat1; }
@@ -407,11 +407,11 @@ class Dotclear_Import {
}
// Store ID translation for later use
add_option('dcposts2wpposts',$dcposts2wpposts);
-
+
echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> posts imported.'), $count).'<br /><br /></p>';
- return true;
+ return true;
}
-
+
function comments2wp($comments='')
{
// General Housekeeping
@@ -419,7 +419,7 @@ class Dotclear_Import {
$count = 0;
$dccm2wpcm = array();
$postarr = get_option('dcposts2wpposts');
-
+
// Magic Mojo
if(is_array($comments))
{
@@ -428,7 +428,7 @@ class Dotclear_Import {
{
$count++;
extract($comment);
-
+
// WordPressify Data
$comment_ID = ltrim($comment_id, '0');
$comment_post_ID = $postarr[$post_id];
@@ -437,7 +437,7 @@ class Dotclear_Import {
$email = $wpdb->escape($comment_email);
$web = "http://".$wpdb->escape($comment_site);
$message = $wpdb->escape(textconv ($comment_content));
-
+
if($cinfo = comment_exists($name, $comment_dt))
{
// Update comments
@@ -472,25 +472,25 @@ class Dotclear_Import {
$dccm2wpcm[$comment_ID] = $ret_id;
}
// Store Comment ID translation for future use
- add_option('dccm2wpcm', $dccm2wpcm);
-
+ add_option('dccm2wpcm', $dccm2wpcm);
+
// Associate newly formed categories with posts
get_comment_count($ret_id);
-
-
+
+
echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> comments imported.'), $count).'<br /><br /></p>';
return true;
}
echo __('No Comments to Import!');
return false;
}
-
+
function links2wp($links='')
{
// General Housekeeping
global $wpdb;
$count = 0;
-
+
// Deal with the links
if(is_array($links))
{
@@ -499,7 +499,7 @@ class Dotclear_Import {
{
$count++;
extract($link);
-
+
if ($title != "") {
if ($cinfo = link_cat_exists (csc ($title))) {
$category = $cinfo;
@@ -511,7 +511,7 @@ class Dotclear_Import {
} else {
$linkname = $wpdb->escape(csc ($label));
$description = $wpdb->escape(csc ($title));
-
+
if($linfo = link_exists($linkname)) {
$ret_id = wp_insert_link(array(
'link_id' => $linfo,
@@ -540,67 +540,67 @@ class Dotclear_Import {
echo __('No Links to Import!');
return false;
}
-
+
function import_categories()
- {
- // Category Import
+ {
+ // Category Import
$cats = $this->get_dc_cats();
$this->cat2wp($cats);
add_option('dc_cats', $cats);
-
-
-
+
+
+
echo '<form action="admin.php?import=dotclear&amp;step=2" method="post">';
printf('<input type="submit" name="submit" value="%s" />', __('Import Users'));
echo '</form>';
}
-
+
function import_users()
{
// User Import
$users = $this->get_dc_users();
$this->users2wp($users);
-
+
echo '<form action="admin.php?import=dotclear&amp;step=3" method="post">';
printf('<input type="submit" name="submit" value="%s" />', __('Import Posts'));
echo '</form>';
}
-
+
function import_posts()
{
// Post Import
$posts = $this->get_dc_posts();
$this->posts2wp($posts);
-
+
echo '<form action="admin.php?import=dotclear&amp;step=4" method="post">';
printf('<input type="submit" name="submit" value="%s" />', __('Import Comments'));
echo '</form>';
}
-
+
function import_comments()
{
// Comment Import
$comments = $this->get_dc_comments();
$this->comments2wp($comments);
-
+
echo '<form action="admin.php?import=dotclear&amp;step=5" method="post">';
printf('<input type="submit" name="submit" value="%s" />', __('Import Links'));
echo '</form>';
}
-
+
function import_links()
{
//Link Import
$links = $this->get_dc_links();
$this->links2wp($links);
add_option('dc_links', $links);
-
+
echo '<form action="admin.php?import=dotclear&amp;step=6" method="post">';
printf('<input type="submit" name="submit" value="%s" />', __('Finish'));
echo '</form>';
}
-
+
function cleanup_dcimport()
{
delete_option('tpre');
@@ -617,7 +617,7 @@ class Dotclear_Import {
delete_option('dccharset');
$this->tips();
}
-
+
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 Dotclear, there are some things that we would like to point out. Hopefully, they will help your transition go as smoothly as possible.').'</p>';
@@ -636,7 +636,7 @@ class Dotclear_Import {
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()
{
echo '<ul>';
@@ -648,7 +648,7 @@ class Dotclear_Import {
printf('<li><label for="dccharset">%s</label> <input type="text" name="dccharset" value="ISO-8859-15"/></li>', __('Originating character set:'));
echo '</ul>';
}
-
+
function dispatch()
{
@@ -657,26 +657,26 @@ class Dotclear_Import {
else
$step = (int) $_GET['step'];
$this->header();
-
+
if ( $step > 0 )
{
if($_POST['dbuser'])
{
if(get_option('dcuser'))
- delete_option('dcuser');
+ delete_option('dcuser');
add_option('dcuser',$_POST['dbuser']);
}
if($_POST['dbpass'])
{
if(get_option('dcpass'))
- delete_option('dcpass');
+ delete_option('dcpass');
add_option('dcpass',$_POST['dbpass']);
}
-
+
if($_POST['dbname'])
{
if(get_option('dcname'))
- delete_option('dcname');
+ delete_option('dcname');
add_option('dcname',$_POST['dbname']);
}
if($_POST['dbhost'])
@@ -690,13 +690,13 @@ class Dotclear_Import {
if(get_option('dccharset'))
delete_option('dccharset');
add_option('dccharset',$_POST['dccharset']);
- }
+ }
if($_POST['dbprefix'])
{
if(get_option('tpre'))
delete_option('tpre');
add_option('tpre',$_POST['dbprefix']);
- }
+ }
}
@@ -726,13 +726,13 @@ class Dotclear_Import {
$this->cleanup_dcimport();
break;
}
-
+
$this->footer();
}
function Dotclear_Import()
{
- // Nothing.
+ // Nothing.
}
}
diff --git a/wp-inst/wp-admin/import/livejournal.php b/wp-inst/wp-admin/import/livejournal.php
index e8c48c4..40c14fc 100644
--- a/wp-inst/wp-admin/import/livejournal.php
+++ b/wp-inst/wp-admin/import/livejournal.php
@@ -18,7 +18,7 @@ class LJ_Import {
$trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
}
-
+
function greet() {
echo '<p>'.__('Howdy! This importer allows you to extract posts from LiveJournal XML export file into your blog. Pick a LiveJournal file to upload and click Import.').'</p>';
wp_import_upload_form("admin.php?import=livejournal&amp;step=1");
@@ -26,7 +26,7 @@ class LJ_Import {
function import_posts() {
global $wpdb, $current_user;
-
+
set_magic_quotes_runtime(0);
$importdata = file($this->file); // Read the file into an array
$importdata = implode('', $importdata); // squish it
@@ -35,7 +35,7 @@ class LJ_Import {
preg_match_all('|<entry>(.*?)</entry>|is', $importdata, $posts);
$posts = $posts[1];
unset($importdata);
- echo '<ol>';
+ echo '<ol>';
foreach ($posts as $post) {
flush();
preg_match('|<subject>(.*?)</subject>|is', $post, $post_title);
@@ -78,7 +78,7 @@ class LJ_Import {
preg_match_all('|<comment>(.*?)</comment>|is', $post, $comments);
$comments = $comments[1];
-
+
if ( $comments ) {
$comment_post_ID = $post_id;
$num_comments = 0;
@@ -134,7 +134,7 @@ class LJ_Import {
$this->file = $file['file'];
$this->import_posts();
wp_import_cleanup($file['id']);
-
+
echo '<h3>';
printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home'));
echo '</h3>';
@@ -147,7 +147,7 @@ class LJ_Import {
$step = (int) $_GET['step'];
$this->header();
-
+
switch ($step) {
case 0 :
$this->greet();
@@ -156,12 +156,12 @@ class LJ_Import {
$this->import();
break;
}
-
+
$this->footer();
}
function LJ_Import() {
- // Nothing.
+ // Nothing.
}
}
diff --git a/wp-inst/wp-admin/import/mt.php b/wp-inst/wp-admin/import/mt.php
index c64dae1..3a89d7b 100644
--- a/wp-inst/wp-admin/import/mt.php
+++ b/wp-inst/wp-admin/import/mt.php
@@ -379,7 +379,7 @@ class MT_Import {
}
if ( $num_pings )
printf(__('(%s pings)'), $num_pings);
-
+
echo "</li>";
}
flush();
@@ -420,7 +420,7 @@ class MT_Import {
}
function MT_Import() {
- // Nothing.
+ // Nothing.
}
}
diff --git a/wp-inst/wp-admin/import/rss.php b/wp-inst/wp-admin/import/rss.php
index e4a8167..69972f3 100644
--- a/wp-inst/wp-admin/import/rss.php
+++ b/wp-inst/wp-admin/import/rss.php
@@ -19,7 +19,7 @@ class RSS_Import {
$trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
}
-
+
function greet() {
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");
@@ -27,7 +27,7 @@ class RSS_Import {
function get_posts() {
global $wpdb;
-
+
set_magic_quotes_runtime(0);
$datalines = file($this->file); // Read the file into an array
$importdata = implode('', $datalines); // squish it
@@ -134,7 +134,7 @@ class RSS_Import {
$this->get_posts();
$this->import_posts();
wp_import_cleanup($file['id']);
-
+
echo '<h3>';
printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home'));
echo '</h3>';
@@ -147,7 +147,7 @@ class RSS_Import {
$step = (int) $_GET['step'];
$this->header();
-
+
switch ($step) {
case 0 :
$this->greet();
@@ -156,12 +156,12 @@ class RSS_Import {
$this->import();
break;
}
-
+
$this->footer();
}
function RSS_Import() {
- // Nothing.
+ // Nothing.
}
}
diff --git a/wp-inst/wp-admin/import/textpattern.php b/wp-inst/wp-admin/import/textpattern.php
index 2901081..17cae87 100644
--- a/wp-inst/wp-admin/import/textpattern.php
+++ b/wp-inst/wp-admin/import/textpattern.php
@@ -7,10 +7,10 @@ if(!function_exists('get_catbynicename'))
function get_catbynicename($category_nicename)
{
global $wpdb;
-
+
$cat_id -= 0; // force numeric
$name = $wpdb->get_var('SELECT cat_ID FROM '.$wpdb->categories.' WHERE category_nicename="'.$category_nicename.'"');
-
+
return $name;
}
}
@@ -49,7 +49,7 @@ class Textpattern_Import {
{
echo '</div>';
}
-
+
function greet()
{
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>';
@@ -67,7 +67,7 @@ class Textpattern_Import {
$txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
set_magic_quotes_runtime(0);
$prefix = get_option('tpre');
-
+
// Get Categories
return $txpdb->get_results('SELECT
id,
@@ -77,7 +77,7 @@ class Textpattern_Import {
WHERE type = "article"',
ARRAY_A);
}
-
+
function get_txp_users()
{
global $wpdb;
@@ -85,9 +85,9 @@ class Textpattern_Import {
$txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
set_magic_quotes_runtime(0);
$prefix = get_option('tpre');
-
+
// Get Users
-
+
return $txpdb->get_results('SELECT
user_id,
name,
@@ -96,14 +96,14 @@ class Textpattern_Import {
privs
FROM '.$prefix.'txp_users', ARRAY_A);
}
-
+
function get_txp_posts()
{
// General Housekeeping
$txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
set_magic_quotes_runtime(0);
$prefix = get_option('tpre');
-
+
// Get Posts
return $txpdb->get_results('SELECT
ID,
@@ -122,7 +122,7 @@ class Textpattern_Import {
FROM '.$prefix.'textpattern
', ARRAY_A);
}
-
+
function get_txp_comments()
{
global $wpdb;
@@ -130,18 +130,18 @@ class Textpattern_Import {
$txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
set_magic_quotes_runtime(0);
$prefix = get_option('tpre');
-
+
// Get Comments
return $txpdb->get_results('SELECT * FROM '.$prefix.'txp_discuss', ARRAY_A);
}
-
+
function get_txp_links()
{
//General Housekeeping
$txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
set_magic_quotes_runtime(0);
$prefix = get_option('tpre');
-
+
return $txpdb->get_results('SELECT
id,
date,
@@ -152,7 +152,7 @@ class Textpattern_Import {
FROM '.$prefix.'txp_link',
ARRAY_A);
}
-
+
function cat2wp($categories='')
{
// General Housekeeping
@@ -167,12 +167,12 @@ class Textpattern_Import {
{
$count++;
extract($category);
-
-
+
+
// Make Nice Variables
$name = $wpdb->escape($name);
$title = $wpdb->escape($title);
-
+
if($cinfo = category_exists($name))
{
$ret_id = wp_insert_category(array('cat_ID' => $cinfo, 'category_nicename' => $name, 'cat_name' => $title));
@@ -183,7 +183,7 @@ class Textpattern_Import {
}
$txpcat2wpcat[$id] = $ret_id;
}
-
+
// Store category translation for future use
add_option('txpcat2wpcat',$txpcat2wpcat);
echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> categories imported.'), $count).'<br /><br /></p>';
@@ -192,14 +192,14 @@ class Textpattern_Import {
echo __('No Categories to Import!');
return false;
}
-
+
function users2wp($users='')
{
// General Housekeeping
global $wpdb;
$count = 0;
$txpid2wpid = array();
-
+
// Midnight Mojo
if(is_array($users))
{
@@ -208,14 +208,14 @@ class Textpattern_Import {
{
$count++;
extract($user);
-
+
// Make Nice Variables
$name = $wpdb->escape($name);
$RealName = $wpdb->escape($RealName);
-
+
if($uinfo = get_userdatabylogin($name))
{
-
+
$ret_id = wp_insert_user(array(
'ID' => $uinfo->ID,
'user_login' => $name,
@@ -236,10 +236,10 @@ class Textpattern_Import {
);
}
$txpid2wpid[$user_id] = $ret_id;
-
+
// Set Textpattern-to-WordPress permissions translation
$transperms = array(1 => '10', 2 => '9', 3 => '5', 4 => '4', 5 => '3', 6 => '2', 7 => '0');
-
+
// Update Usermeta Data
$user = new WP_User($ret_id);
if('10' == $transperms[$privs]) { $user->set_role('administrator'); }
@@ -249,24 +249,24 @@ class Textpattern_Import {
if('3' == $transperms[$privs]) { $user->set_role('contributor'); }
if('2' == $transperms[$privs]) { $user->set_role('contributor'); }
if('0' == $transperms[$privs]) { $user->set_role('subscriber'); }
-
+
update_usermeta( $ret_id, 'wp_user_level', $transperms[$privs] );
update_usermeta( $ret_id, 'rich_editing', 'false');
}// End foreach($users as $user)
-
+
// Store id translation array for future use
add_option('txpid2wpid',$txpid2wpid);
-
-
+
+
echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> users imported.'), $count).'<br /><br /></p>';
return true;
}// End if(is_array($users)
-
+
echo __('No Users to Import!');
return false;
-
+
}// End function user2wp()
-
+
function posts2wp($posts='')
{
// General Housekeeping
@@ -283,10 +283,10 @@ class Textpattern_Import {
{
$count++;
extract($post);
-
+
// Set Textpattern-to-WordPress status translation
$stattrans = array(1 => 'draft', 2 => 'private', 3 => 'draft', 4 => 'publish', 5 => 'publish');
-
+
//Can we do this more efficiently?
$uinfo = ( get_userdatabylogin( $AuthorID ) ) ? get_userdatabylogin( $AuthorID ) : 1;
$authorid = ( is_object( $uinfo ) ) ? $uinfo->ID : $uinfo ;
@@ -295,9 +295,9 @@ class Textpattern_Import {
$Body = $wpdb->escape($Body);
$Excerpt = $wpdb->escape($Excerpt);
$post_status = $stattrans[$Status];
-
+
// Import Post data into WordPress
-
+
if($pinfo = post_exists($Title,$Body))
{
$ret_id = wp_insert_post(array(
@@ -332,7 +332,7 @@ class Textpattern_Import {
);
}
$txpposts2wpposts[$ID] = $ret_id;
-
+
// Make Post-to-Category associations
$cats = array();
if($cat1 = get_catbynicename($Category1)) { $cats[1] = $cat1; }
@@ -343,11 +343,11 @@ class Textpattern_Import {
}
// Store ID translation for later use
add_option('txpposts2wpposts',$txpposts2wpposts);
-
+
echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> posts imported.'), $count).'<br /><br /></p>';
- return true;
+ return true;
}
-
+
function comments2wp($comments='')
{
// General Housekeeping
@@ -355,7 +355,7 @@ class Textpattern_Import {
$count = 0;
$txpcm2wpcm = array();
$postarr = get_option('txpposts2wpposts');
-
+
// Magic Mojo
if(is_array($comments))
{
@@ -364,7 +364,7 @@ class Textpattern_Import {
{
$count++;
extract($comment);
-
+
// WordPressify Data
$comment_ID = ltrim($discussid, '0');
$comment_post_ID = $postarr[$parentid];
@@ -373,7 +373,7 @@ class Textpattern_Import {
$email = $wpdb->escape($email);
$web = $wpdb->escape($web);
$message = $wpdb->escape($message);
-
+
if($cinfo = comment_exists($name, $posted))
{
// Update comments
@@ -405,25 +405,25 @@ class Textpattern_Import {
$txpcm2wpcm[$comment_ID] = $ret_id;
}
// Store Comment ID translation for future use
- add_option('txpcm2wpcm', $txpcm2wpcm);
-
+ add_option('txpcm2wpcm', $txpcm2wpcm);
+
// Associate newly formed categories with posts
get_comment_count($ret_id);
-
-
+
+
echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> comments imported.'), $count).'<br /><br /></p>';
return true;
}
echo __('No Comments to Import!');
return false;
}
-
+
function links2wp($links='')
{
// General Housekeeping
global $wpdb;
$count = 0;
-
+
// Deal with the links
if(is_array($links))
{
@@ -432,12 +432,12 @@ class Textpattern_Import {
{
$count++;
extract($link);
-
+
// Make nice vars
$category = $wpdb->escape($category);
$linkname = $wpdb->escape($linkname);
$description = $wpdb->escape($description);
-
+
if($linfo = link_exists($linkname))
{
$ret_id = wp_insert_link(array(
@@ -470,67 +470,67 @@ class Textpattern_Import {
echo __('No Links to Import!');
return false;
}
-
+
function import_categories()
- {
- // Category Import
+ {
+ // Category Import
$cats = $this->get_txp_cats();
$this->cat2wp($cats);
add_option('txp_cats', $cats);
-
-
-
+
+
+
echo '<form action="admin.php?import=textpattern&amp;step=2" method="post">';
printf('<input type="submit" name="submit" value="%s" />', __('Import Users'));
echo '</form>';
}
-
+
function import_users()
{
// User Import
$users = $this->get_txp_users();
$this->users2wp($users);
-
+
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()
{
// Post Import
$posts = $this->get_txp_posts();
$this->posts2wp($posts);
-
+
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()
{
// Comment Import
$comments = $this->get_txp_comments();
$this->comments2wp($comments);
-
+
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()
{
//Link Import
$links = $this->get_txp_links();
$this->links2wp($links);
add_option('txp_links', $links);
-
+
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()
{
delete_option('tpre');
@@ -546,7 +546,7 @@ class Textpattern_Import {
delete_option('txphost');
$this->tips();
}
-
+
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>';
@@ -565,7 +565,7 @@ class Textpattern_Import {
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()
{
echo '<ul>';
@@ -576,7 +576,7 @@ class Textpattern_Import {
printf('<li><label for="dbprefix">%s</label> <input type="text" name="dbprefix" /></li>', __('Textpattern Table prefix (if any):'));
echo '</ul>';
}
-
+
function dispatch()
{
@@ -585,26 +585,26 @@ class Textpattern_Import {
else
$step = (int) $_GET['step'];
$this->header();
-
+
if ( $step > 0 )
{
if($_POST['dbuser'])
{
if(get_option('txpuser'))
- delete_option('txpuser');
+ delete_option('txpuser');
add_option('txpuser',$_POST['dbuser']);
}
if($_POST['dbpass'])
{
if(get_option('txppass'))
- delete_option('txppass');
+ delete_option('txppass');
add_option('txppass',$_POST['dbpass']);
}
-
+
if($_POST['dbname'])
{
if(get_option('txpname'))
- delete_option('txpname');
+ delete_option('txpname');
add_option('txpname',$_POST['dbname']);
}
if($_POST['dbhost'])
@@ -618,7 +618,7 @@ class Textpattern_Import {
if(get_option('tpre'))
delete_option('tpre');
add_option('tpre',$_POST['dbprefix']);
- }
+ }
}
@@ -648,13 +648,13 @@ class Textpattern_Import {
$this->cleanup_txpimport();
break;
}
-
+
$this->footer();
}
function Textpattern_Import()
{
- // Nothing.
+ // Nothing.
}
}
diff --git a/wp-inst/wp-admin/index.php b/wp-inst/wp-admin/index.php
index cbef7fd..b338cfd 100644
--- a/wp-inst/wp-admin/index.php
+++ b/wp-inst/wp-admin/index.php
@@ -60,7 +60,7 @@ foreach ($comments as $comment) {
<?php endif; ?>
<?php
-if ( $recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'publish' AND post_date_gmt < '$today' ORDER BY post_date DESC LIMIT 5") ) :
+if ( $recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' AND post_date_gmt < '$today' ORDER BY post_date DESC LIMIT 5") ) :
?>
<div>
<h3><?php _e('Posts'); ?> <a href="edit.php" title="<?php _e('More posts...'); ?>">&raquo;</a></h3>
@@ -79,7 +79,7 @@ foreach ($recentposts as $post) {
<?php endif; ?>
<?php
-if ( $scheduled = $wpdb->get_results("SELECT ID, post_title, post_date_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_date_gmt > '$today' ORDER BY post_date ASC") ) :
+if ( $scheduled = $wpdb->get_results("SELECT ID, post_title, post_date_gmt FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' AND post_date_gmt > '$today' ORDER BY post_date ASC") ) :
?>
<div>
<h3><?php _e('Scheduled Entries:') ?></h3>
@@ -98,7 +98,7 @@ foreach ($scheduled as $post) {
<div>
<h3><?php _e('Blog Stats'); ?></h3>
<?php
-$numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish'");
+$numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'");
if (0 < $numposts) $numposts = number_format($numposts);
$numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
diff --git a/wp-inst/wp-admin/inline-uploading.php b/wp-inst/wp-admin/inline-uploading.php
index 88b1239..f2a0b58 100644
--- a/wp-inst/wp-admin/inline-uploading.php
+++ b/wp-inst/wp-admin/inline-uploading.php
@@ -63,7 +63,7 @@ $filename = basename($file);
$attachment = array(
'post_title' => $imgtitle ? $imgtitle : $filename,
'post_content' => $descr,
- 'post_status' => 'attachment',
+ 'post_type' => 'attachment',
'post_parent' => $post,
'post_mime_type' => $type,
'guid' => $url
@@ -127,7 +127,7 @@ if (! current_user_can('edit_others_posts') )
$and_user = "AND post_author = " . $user_ID;
if ( $last )
- $start = $wpdb->get_var("SELECT count(ID) FROM $wpdb->posts WHERE post_status = 'attachment' $and_user $and_post") - $num;
+ $start = $wpdb->get_var("SELECT count(ID) FROM $wpdb->posts WHERE post_type = 'attachment' $and_user $and_post") - $num;
else
$start = (int) $start;
@@ -137,7 +137,7 @@ if ( $start < 0 )
if ( '' == $sort )
$sort = "post_date_gmt DESC";
-$attachments = $wpdb->get_results("SELECT ID, post_date, post_title, post_mime_type, guid FROM $wpdb->posts WHERE post_status = 'attachment' $and_type $and_post $and_user ORDER BY $sort LIMIT $start, $double", ARRAY_A);
+$attachments = $wpdb->get_results("SELECT ID, post_date, post_title, post_mime_type, guid FROM $wpdb->posts WHERE post_type = 'attachment' $and_type $and_post $and_user ORDER BY $sort LIMIT $start, $double", ARRAY_A);
if ( count($attachments) == 0 ) {
header("Location: ".basename(__FILE__)."?post=$post&action=upload");
@@ -646,7 +646,7 @@ th {
<?php if ( $attachments = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE post_parent = '$post'") ) { ?>
<li<?php echo $current_2; ?>><a href="<?php echo basename(__FILE__); ?>?action=view&amp;post=<?php echo $post; ?>&amp;all=false"><?php _e('Browse'); ?></a></li>
<?php } ?>
-<?php if ($wpdb->get_var("SELECT count(ID) FROM $wpdb->posts WHERE post_status = 'attachment'")) { ?>
+<?php if ($wpdb->get_var("SELECT count(ID) FROM $wpdb->posts WHERE post_type = 'attachment'")) { ?>
<li<?php echo $current_3; ?>><a href="<?php echo basename(__FILE__); ?>?action=view&amp;post=<?php echo $post; ?>&amp;all=true"><?php _e('Browse All'); ?></a></li>
<?php } ?>
<li> </li>
diff --git a/wp-inst/wp-admin/link-manager.php b/wp-inst/wp-admin/link-manager.php
index 5964478..26f3ef3 100644
--- a/wp-inst/wp-admin/link-manager.php
+++ b/wp-inst/wp-admin/link-manager.php
@@ -128,7 +128,7 @@ switch ($action) {
check_admin_referer();
add_link();
-
+
header('Location: ' . $_SERVER['HTTP_REFERER'] . '?added=true');
break;
} // end Add
@@ -137,7 +137,7 @@ switch ($action) {
{
check_admin_referer();
-
+
if (isset($links_show_cat_id) && ($links_show_cat_id != ''))
$cat_id = $links_show_cat_id;
@@ -149,7 +149,7 @@ switch ($action) {
$link_id = (int) $_POST['link_id'];
edit_link($link_id);
-
+
setcookie('links_show_cat_id_' . COOKIEHASH, $links_show_cat_id, time()+600);
wp_redirect($this_file);
break;
@@ -165,7 +165,7 @@ switch ($action) {
$link_id = (int) $_GET['link_id'];
wp_delete_link($link_id);
-
+
if (isset($links_show_cat_id) && ($links_show_cat_id != ''))
$cat_id = $links_show_cat_id;
@@ -184,12 +184,12 @@ switch ($action) {
include_once ('admin-header.php');
if ( !current_user_can('manage_links') )
die(__('You do not have sufficient permissions to edit the links for this blog.'));
-
+
$link_id = (int) $_GET['link_id'];
-
+
if ( !$link = get_link_to_edit($link_id) )
die( __('Link not found.') );
-
+
include('edit-link-form.php');
break;
} // end linkedit
@@ -372,7 +372,7 @@ function checkAll(form)
?>
<tr id="link-<?php echo $link->link_id; ?>" valign="middle" <?php echo $style; ?>>
<td><strong><?php echo $link->link_name; ?></strong><br />
-<?php
+<?php
echo sprintf(__('Description: %s'), $link->link_description) . "</td>";
echo "<td><a href=\"$link->link_url\" title=\"" . sprintf(__('Visit %s'), $link->link_name) . "\">$short_url</a></td>";
echo <<<LINKS
diff --git a/wp-inst/wp-admin/list-manipulation.js b/wp-inst/wp-admin/list-manipulation.js
index 38cc602..f61b407 100644
--- a/wp-inst/wp-admin/list-manipulation.js
+++ b/wp-inst/wp-admin/list-manipulation.js
@@ -51,7 +51,7 @@ function removeThisItem(id) {
listItems.splice(pos,1);
recolorList(pos);
ajaxDel.myResponseElement.parentNode.removeChild(ajaxDel.myResponseElement);
-
+
}
}
@@ -63,7 +63,7 @@ function getListPos(id) {
}
}
return pos;
-}
+}
function getListItems() {
if (list) return;
diff --git a/wp-inst/wp-admin/list-manipulation.php b/wp-inst/wp-admin/list-manipulation.php
index 308089f..9e44792 100644
--- a/wp-inst/wp-admin/list-manipulation.php
+++ b/wp-inst/wp-admin/list-manipulation.php
@@ -54,7 +54,7 @@ case 'delete-comment' :
if ( !$comment = get_comment($id) )
die('0');
- if ( !current_user_can('edit_post', $comment->comment_post_ID) )
+ if ( !current_user_can('edit_post', $comment->comment_post_ID) )
die('-1');
if ( wp_delete_comment($comment->comment_ID) ) {
@@ -77,5 +77,5 @@ case 'delete-link-category' :
die('0');
}
break;
-endswitch;
+endswitch;
?>
diff --git a/wp-inst/wp-admin/menu-header.php b/wp-inst/wp-admin/menu-header.php
index 12afbbc..aa318bb 100644
--- a/wp-inst/wp-admin/menu-header.php
+++ b/wp-inst/wp-admin/menu-header.php
@@ -13,7 +13,7 @@ foreach ($menu as $item) {
if ( current_user_can($item[1]) ) {
if ( file_exists(ABSPATH . "wp-content/plugins/{$item[2]}") )
- echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
+ echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
else
echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>";
}
@@ -52,4 +52,10 @@ endforeach;
?>
</ul>
-<?php endif; ?>
+<?php
+
+endif;
+
+do_action('admin_notices');
+
+?>
diff --git a/wp-inst/wp-admin/moderation.php b/wp-inst/wp-admin/moderation.php
index 48a8b23..9166536 100644
--- a/wp-inst/wp-admin/moderation.php
+++ b/wp-inst/wp-admin/moderation.php
@@ -115,7 +115,7 @@ if ( isset($_GET['deleted']) || isset($_GET['approved']) || isset($_GET['ignored
}
?>
-
+
<div class="wrap">
<?php
diff --git a/wp-inst/wp-admin/options-permalink.php b/wp-inst/wp-admin/options-permalink.php
index 3d953f0..ab63433 100644
--- a/wp-inst/wp-admin/options-permalink.php
+++ b/wp-inst/wp-admin/options-permalink.php
@@ -42,7 +42,7 @@ structure.onfocus = function () { document.getElementById('custom_selection').ch
var aInputs = document.getElementsByTagName('input');
-for (var i = 0; i < aInputs.length; i++) {
+for (var i = 0; i < aInputs.length; i++) {
aInputs[i].onclick = aInputs[i].onkeyup = upit;
}
}
@@ -65,7 +65,7 @@ if ( isset($_POST) ) {
$permalink_structure = preg_replace('#/+#', '/', '/' . $_POST['permalink_structure']);
$wp_rewrite->set_permalink_structure($permalink_structure);
}
-
+
if ( isset($_POST['category_base']) ) {
$category_base = $_POST['category_base'];
if (! empty($category_base) )
@@ -73,7 +73,7 @@ if ( isset($_POST) ) {
$wp_rewrite->set_category_base($category_base);
}
}
-
+
$permalink_structure = get_settings('permalink_structure');
$category_base = get_settings('category_base');
@@ -142,7 +142,7 @@ $structures = array(
checked="checked"
<?php } ?>
/>
-<?php _e('Custom, specify below'); ?>
+<?php _e('Custom, specify below'); ?>
</label>
<br />
</p>
diff --git a/wp-inst/wp-admin/options.php b/wp-inst/wp-admin/options.php
index 0536a7a..6214c2c 100644
--- a/wp-inst/wp-admin/options.php
+++ b/wp-inst/wp-admin/options.php
@@ -28,7 +28,7 @@ switch($action) {
case 'update':
$any_changed = 0;
-
+
check_admin_referer();
if (!$_POST['page_options']) {
@@ -52,11 +52,11 @@ case 'update':
$value = trim(stripslashes($_POST[$option]));
if( in_array($option, $nonbools) && ( $value == '0' || $value == '') )
$value = 'closed';
-
+
if( $option == 'blogdescription' || $option == 'blogname' )
if (current_user_can('unfiltered_html') == false)
$value = wp_filter_post_kses( $value );
-
+
if (update_option($option, $value) ) {
$any_changed++;
}
diff --git a/wp-inst/wp-admin/page-new.php b/wp-inst/wp-admin/page-new.php
index e5456cd..880b083 100644
--- a/wp-inst/wp-admin/page-new.php
+++ b/wp-inst/wp-admin/page-new.php
@@ -14,9 +14,9 @@ require_once('admin-header.php');
if ( current_user_can('edit_pages') ) {
$action = 'post';
get_currentuserinfo();
-
+
$post = get_default_post_to_edit();
- $post->post_status = 'static';
+ $post->post_type = 'page';
include('edit-page-form.php');
}
diff --git a/wp-inst/wp-admin/plugin-editor.php b/wp-inst/wp-admin/plugin-editor.php
index 4a46027..2cfe7b8 100644
--- a/wp-inst/wp-admin/plugin-editor.php
+++ b/wp-inst/wp-admin/plugin-editor.php
@@ -53,16 +53,16 @@ case 'update':
break;
default:
-
+
require_once('admin-header.php');
if ( !current_user_can('edit_plugins') )
die('<p>'.__('You have do not have sufficient permissions to edit plugins for this blog.').'</p>');
update_recently_edited("wp-content/plugins/$file");
-
+
if (!is_file($real_file))
$error = 1;
-
+
if (!$error) {
$f = fopen($real_file, 'r');
$content = fread($f, filesize($real_file));
diff --git a/wp-inst/wp-admin/plugins.php b/wp-inst/wp-admin/plugins.php
index 948bfcd..9f45c10 100644
--- a/wp-inst/wp-admin/plugins.php
+++ b/wp-inst/wp-admin/plugins.php
@@ -10,7 +10,7 @@ if( $menu_perms[ 'plugins' ] != 1 )
if ( isset($_GET['action']) ) {
check_admin_referer();
-
+
if ('activate' == $_GET['action']) {
$current = get_settings('active_plugins');
if (!in_array($_GET['plugin'], $current)) {
@@ -43,7 +43,7 @@ $check_plugins = get_settings('active_plugins');
// empty array.
if ( !is_array($check_plugins) ) {
$check_plugins = array();
- update_option('active_plugins', $check_plugins);
+ update_option('active_plugins', $check_plugins);
}
// If a plugin file does not exist, remove it from the list of active
@@ -98,7 +98,7 @@ if (empty($plugins)) {
function sort_plugins($plug1, $plug2) {
return strnatcasecmp($plug1['Name'], $plug2['Name']);
}
-
+
uksort($plugins, 'sort_plugins');
foreach($plugins as $plugin_file => $plugin_data) {
diff --git a/wp-inst/wp-admin/post.php b/wp-inst/wp-admin/post.php
index 026a453..4160ce5 100644
--- a/wp-inst/wp-admin/post.php
+++ b/wp-inst/wp-admin/post.php
@@ -23,7 +23,7 @@ $action = "delete";
}
// Fix submenu highlighting for pages.
-if ( isset($_REQUEST['post']) && 'static' == get_post_status($_REQUEST['post']) )
+if ( isset($_REQUEST['post']) && 'page' == get_post_type($_REQUEST['post']) )
$submenu_file = 'page-new.php';
$editing = true;
@@ -50,7 +50,7 @@ case 'post':
$location = 'post.php?posted=true';
}
- if ( 'static' == $_POST['post_status'] )
+ if ( 'page' == $_POST['post_type'] )
$location = "page-new.php?saved=true";
if ( isset($_POST['save']) )
@@ -71,8 +71,8 @@ case 'edit':
die ( __('You are not allowed to edit this post.') );
$post = get_post_to_edit($post_ID);
-
- if ($post->post_status == 'static')
+
+ if ($post->post_type == 'page')
include('edit-page-form.php');
else
include('edit-form-advanced.php');
@@ -90,7 +90,7 @@ case 'editattachment':
// Don't let these be changed
unset($_POST['guid']);
- $_POST['post_status'] = 'attachment';
+ $_POST['post_type'] = 'attachment';
// Update the thumbnail filename
$oldmeta = $newmeta = get_post_meta($post_id, '_wp_attachment_metadata', true);
@@ -130,11 +130,11 @@ case 'delete':
$post_id = (isset($_GET['post'])) ? intval($_GET['post']) : intval($_POST['post_ID']);
$post = & get_post($post_id);
-
- if ( !current_user_can('edit_post', $post_id) )
+
+ if ( !current_user_can('edit_post', $post_id) )
die( __('You are not allowed to delete this post.') );
- if ( $post->post_status == 'attachment' ) {
+ if ( $post->post_type == 'attachment' ) {
if ( ! wp_delete_attachment($post_id) )
die( __('Error in deleting...') );
} else {
@@ -161,7 +161,7 @@ case 'editcomment':
if ( ! $comment = get_comment($comment) )
die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'javascript:history.go(-1)'));
- if ( !current_user_can('edit_post', $comment->comment_post_ID) )
+ if ( !current_user_can('edit_post', $comment->comment_post_ID) )
die( __('You are not allowed to edit comments on this post.') );
$comment = get_comment_to_edit($comment);
@@ -180,7 +180,7 @@ case 'confirmdeletecomment':
if ( ! $comment = get_comment($comment) )
die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
- if ( !current_user_can('edit_post', $comment->comment_post_ID) )
+ if ( !current_user_can('edit_post', $comment->comment_post_ID) )
die( __('You are not allowed to delete comments on this post.') );
echo "<div class='wrap'>\n";
@@ -223,7 +223,7 @@ case 'deletecomment':
if ( ! $comment = get_comment($comment) )
die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'post.php'));
- if ( !current_user_can('edit_post', $comment->comment_post_ID) )
+ if ( !current_user_can('edit_post', $comment->comment_post_ID) )
die( __('You are not allowed to edit comments on this post.') );
wp_set_comment_status($comment->comment_ID, "delete");
@@ -252,7 +252,7 @@ case 'unapprovecomment':
if ( ! $comment = get_comment($comment) )
die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
- if ( !current_user_can('edit_post', $comment->comment_post_ID) )
+ if ( !current_user_can('edit_post', $comment->comment_post_ID) )
die( __('You are not allowed to edit comments on this post, so you cannot disapprove this comment.') );
wp_set_comment_status($comment->comment_ID, "hold");
@@ -272,7 +272,7 @@ case 'mailapprovecomment':
if ( ! $comment = get_comment($comment) )
die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
- if ( !current_user_can('edit_post', $comment->comment_post_ID) )
+ if ( !current_user_can('edit_post', $comment->comment_post_ID) )
die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
if ('1' != $comment->comment_approved) {
@@ -298,7 +298,7 @@ case 'approvecomment':
if ( ! $comment = get_comment($comment) )
die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
- if ( !current_user_can('edit_post', $comment->comment_post_ID) )
+ if ( !current_user_can('edit_post', $comment->comment_post_ID) )
die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
wp_set_comment_status($comment->comment_ID, "approve");
diff --git a/wp-inst/wp-admin/setup-config.php b/wp-inst/wp-admin/setup-config.php
index 38efd2b..d2c2829 100644
--- a/wp-inst/wp-admin/setup-config.php
+++ b/wp-inst/wp-admin/setup-config.php
@@ -103,7 +103,7 @@ switch($step) {
</form>
<?php
break;
-
+
case 2:
$dbname = trim($_POST['dbname']);
$uname = trim($_POST['uname']);
diff --git a/wp-inst/wp-admin/templates.php b/wp-inst/wp-admin/templates.php
index deb79f4..1938174 100644
--- a/wp-inst/wp-admin/templates.php
+++ b/wp-inst/wp-admin/templates.php
@@ -61,7 +61,7 @@ break;
default:
require_once('./admin-header.php');
-
+
if ( ! current_user_can('edit_files') )
die('<p>'.__('You have do not have sufficient permissions to edit templates for this blog.').'</p>');
@@ -72,7 +72,7 @@ default:
if (!is_file($real_file))
$error = true;
-
+
if (!$error) {
$f = @ fopen($real_file, 'r');
if ( $f ) {
@@ -89,7 +89,7 @@ default:
<div id="message" class="error"><p><?php _e('Could not save file.') ?></p></div>
<?php else: ?>
<div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
- <?php endif; ?>
+ <?php endif; ?>
<?php endif; ?>
<div class="wrap">
<?php
diff --git a/wp-inst/wp-admin/theme-editor.php b/wp-inst/wp-admin/theme-editor.php
index 5e5e3ca..d54788b 100644
--- a/wp-inst/wp-admin/theme-editor.php
+++ b/wp-inst/wp-admin/theme-editor.php
@@ -67,16 +67,16 @@ case 'update':
break;
default:
-
+
require_once('admin-header.php');
if ( !current_user_can('edit_themes') )
die('<p>'.__('You have do not have sufficient permissions to edit themes for this blog.').'</p>');
update_recently_edited($file);
-
+
if (!is_file($real_file))
$error = 1;
-
+
if (!$error && filesize($real_file) > 0) {
$f = fopen($real_file, 'r');
$content = fread($f, filesize($real_file));
diff --git a/wp-inst/wp-admin/themes.php b/wp-inst/wp-admin/themes.php
index 565d2aa..8f9e51b 100644
--- a/wp-inst/wp-admin/themes.php
+++ b/wp-inst/wp-admin/themes.php
@@ -3,16 +3,16 @@ require_once('admin.php');
if ( isset($_GET['action']) ) {
check_admin_referer();
-
+
if ('activate' == $_GET['action']) {
if ( isset($_GET['template']) )
update_option('template', $_GET['template']);
-
+
if ( isset($_GET['stylesheet']) )
update_option('stylesheet', $_GET['stylesheet']);
-
+
do_action('switch_theme', get_current_theme());
-
+
header('Location: themes.php?activated=true');
exit;
}
@@ -116,7 +116,7 @@ if ( count($broken_themes) ) {
</tr>
<?php
$theme = '';
-
+
$theme_names = array_keys($broken_themes);
natcasesort($theme_names);
diff --git a/wp-inst/wp-admin/upgrade-functions.php b/wp-inst/wp-admin/upgrade-functions.php
index a00e52e..80314c0 100644
--- a/wp-inst/wp-admin/upgrade-functions.php
+++ b/wp-inst/wp-admin/upgrade-functions.php
@@ -21,7 +21,7 @@ function upgrade_all() {
if ( !empty($template) )
$wp_current_db_version = 2541;
}
-
+
populate_options();
if ( $wp_current_db_version < 2541 ) {
@@ -30,12 +30,15 @@ function upgrade_all() {
upgrade_110();
upgrade_130();
}
-
+
if ( $wp_current_db_version < 3308 )
upgrade_160();
+ if ( $wp_current_db_version < 3514 )
+ upgrade_210();
+
$wp_rewrite->flush_rules();
-
+
update_option('db_version', $wp_db_version);
}
@@ -52,7 +55,7 @@ function upgrade_100() {
}
}
}
-
+
$categories = $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename FROM $wpdb->categories");
foreach ($categories as $category) {
if ('' == $category->category_nicename) {
@@ -75,7 +78,7 @@ function upgrade_100() {
else:
$catwhere = '';
endif;
-
+
$allposts = $wpdb->get_results("SELECT ID, post_category FROM $wpdb->posts WHERE post_category != '0' $catwhere");
if ($allposts) :
foreach ($allposts as $post) {
@@ -109,7 +112,7 @@ function upgrade_101() {
function upgrade_110() {
global $wpdb;
-
+
// Set user_nicename.
$users = $wpdb->get_results("SELECT ID, user_nickname, user_nicename FROM $wpdb->users");
foreach ($users as $user) {
@@ -288,7 +291,7 @@ function upgrade_160_helper( $users ) {
update_usermeta( $user->ID, $table_prefix . 'capabilities', array($role => true) );
}
}
-
+
endforeach;
}
@@ -303,7 +306,7 @@ function upgrade_160() {
foreach ( $old_user_fields as $old )
$wpdb->query("ALTER TABLE $wpdb->users DROP $old");
$wpdb->show_errors();
-
+
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 ) {
@@ -330,7 +333,7 @@ function upgrade_160() {
post_mime_type = '$object->post_type',
post_type = ''
WHERE ID = $object->ID");
-
+
$meta = get_post_meta($object->ID, 'imagedata', true);
if ( ! empty($meta['file']) )
add_post_meta($object->ID, '_wp_attached_file', $meta['file']);
@@ -338,6 +341,34 @@ function upgrade_160() {
}
}
+function upgrade_210() {
+ global $wpdb, $table_prefix, $wp_current_db_version;
+
+ if ( $wp_current_db_version < 3506 ) {
+ // Update status and type.
+ $posts = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts");
+
+ if ( ! empty($posts) ) foreach ($posts as $post) {
+ $status = $post->post_status;
+ $type = 'post';
+
+ if ( 'static' == $status ) {
+ $status = 'publish';
+ $type = 'page';
+ } else if ( 'attachment' == $status ) {
+ $status = 'inherit';
+ $type = 'attachment';
+ }
+
+ $wpdb->query("UPDATE $wpdb->posts SET post_status = '$status', post_type = '$type' WHERE ID = '$post->ID'");
+ }
+ }
+
+ if ( $wp_current_db_version < 3513 ) {
+ populate_roles_210();
+ }
+}
+
// The functions we use to actually do stuff
// General
@@ -458,17 +489,17 @@ function deslash($content) {
function dbDelta($queries, $execute = true) {
global $wpdb;
-
+
// Seperate individual queries into an array
if( !is_array($queries) ) {
$queries = explode( ';', $queries );
if('' == $queries[count($queries) - 1]) array_pop($queries);
}
-
+
$cqueries = array(); // Creation Queries
$iqueries = array(); // Insertion Queries
$for_update = array();
-
+
// Create a tablename index for an array ($cqueries) of queries
foreach($queries as $qry) {
if(preg_match("|CREATE TABLE ([^ ]*)|", $qry, $matches)) {
@@ -487,7 +518,7 @@ function dbDelta($queries, $execute = true) {
else {
// Unrecognized query type
}
- }
+ }
// Check to see which tables and fields exist
if($tables = $wpdb->get_col('SHOW TABLES;')) {
@@ -506,13 +537,13 @@ function dbDelta($queries, $execute = true) {
$flds = explode("\n", $qryline);
//echo "<hr/><pre>\n".print_r(strtolower($table), true).":\n".print_r($cqueries, true)."</pre><hr/>";
-
+
// For every field line specified in the query
foreach($flds as $fld) {
// Extract the field name
preg_match("|^([^ ]*)|", trim($fld), $fvals);
$fieldname = $fvals[1];
-
+
// Verify the found field name
$validfield = true;
switch(strtolower($fieldname))
@@ -528,18 +559,18 @@ function dbDelta($queries, $execute = true) {
break;
}
$fld = trim($fld);
-
+
// If it's a valid field, add it to the field array
if($validfield) {
$cfields[strtolower($fieldname)] = trim($fld, ", \n");
}
}
-
+
// Fetch the table column structure from the database
$tablefields = $wpdb->get_results("DESCRIBE {$table};");
-
+
// For every field in the table
- foreach($tablefields as $tablefield) {
+ foreach($tablefields as $tablefield) {
// If the table field exists in the field array...
if(array_key_exists(strtolower($tablefield->Field), $cfields)) {
// Get the field type from the query
@@ -552,7 +583,7 @@ function dbDelta($queries, $execute = true) {
$cqueries[] = "ALTER TABLE {$table} CHANGE COLUMN {$tablefield->Field} " . $cfields[strtolower($tablefield->Field)];
$for_update[$table.'.'.$tablefield->Field] = "Changed type of {$table}.{$tablefield->Field} from {$tablefield->Type} to {$fieldtype}";
}
-
+
// Get the default value from the array
//echo "{$cfields[strtolower($tablefield->Field)]}<br>";
if(preg_match("| DEFAULT '(.*)'|i", $cfields[strtolower($tablefield->Field)], $matches)) {
@@ -579,11 +610,11 @@ function dbDelta($queries, $execute = true) {
$cqueries[] = "ALTER TABLE {$table} ADD COLUMN $fielddef";
$for_update[$table.'.'.$fieldname] = 'Added column '.$table.'.'.$fieldname;
}
-
+
// Index stuff goes here
// Fetch the table index structure from the database
$tableindices = $wpdb->get_results("SHOW INDEX FROM {$table};");
-
+
if($tableindices) {
// Clear the index array
unset($index_ary);
@@ -612,7 +643,7 @@ function dbDelta($queries, $execute = true) {
}
$index_columns = '';
// For each column in the index
- foreach($index_data['columns'] as $column_data) {
+ foreach($index_data['columns'] as $column_data) {
if($index_columns != '') $index_columns .= ',';
// Add the field to the column list string
$index_columns .= $column_data['fieldname'];
diff --git a/wp-inst/wp-admin/upgrade-schema.php b/wp-inst/wp-admin/upgrade-schema.php
index 9715bfd..e0a8bab 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','attachment') NOT NULL default 'publish',
+ post_status enum('publish','draft','private','static','object','attachment','inherit','future') 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 '',
@@ -119,7 +119,7 @@ CREATE TABLE $wpdb->posts (
post_parent bigint(20) NOT NULL default '0',
guid varchar(255) NOT NULL default '',
menu_order int(11) NOT NULL default '0',
- post_type varchar(100) NOT NULL default '',
+ post_type varchar(100) NOT NULL default 'post',
post_mime_type varchar(100) NOT NULL default '',
comment_count bigint(20) NOT NULL default '0',
PRIMARY KEY (ID),
@@ -295,7 +295,8 @@ function populate_options() {
}
function populate_roles() {
- populate_roles_160();
+ populate_roles_160();
+ populate_roles_210();
}
function populate_roles_160() {
@@ -307,7 +308,7 @@ function populate_roles_160() {
add_role('author', __('Author'));
add_role('contributor', __('Contributor'));
add_role('subscriber', __('Subscriber'));
-
+
// Add caps for Administrator role
$role = get_role('administrator');
$role->add_cap('switch_themes');
@@ -340,7 +341,7 @@ function populate_roles_160() {
$role->add_cap('level_2');
$role->add_cap('level_1');
$role->add_cap('level_0');
-
+
// Add caps for Editor role
$role = get_role('editor');
$role->add_cap('moderate_comments');
@@ -362,7 +363,7 @@ function populate_roles_160() {
$role->add_cap('level_2');
$role->add_cap('level_1');
$role->add_cap('level_0');
-
+
// Add caps for Author role
$role = get_role('author');
$role->add_cap('upload_files');
@@ -373,18 +374,48 @@ function populate_roles_160() {
$role->add_cap('level_2');
$role->add_cap('level_1');
$role->add_cap('level_0');
-
+
// Add caps for Contributor role
$role = get_role('contributor');
$role->add_cap('edit_posts');
$role->add_cap('read');
$role->add_cap('level_1');
$role->add_cap('level_0');
-
+
// Add caps for Subscriber role
$role = get_role('subscriber');
$role->add_cap('read');
$role->add_cap('level_0');
}
+function populate_roles_210() {
+ $roles = array('administrator', 'editor');
+ foreach ($roles as $role) {
+ $role = get_role($role);
+ if ( empty($role) )
+ continue;
+
+ $role->add_cap('edit_others_pages');
+ $role->add_cap('edit_published_pages');
+ $role->add_cap('publish_pages');
+ $role->add_cap('delete_pages');
+ $role->add_cap('delete_others_pages');
+ $role->add_cap('delete_published_pages');
+ $role->add_cap('delete_posts');
+ $role->add_cap('delete_others_posts');
+ $role->add_cap('delete_published_posts');
+ }
+
+ $role = get_role('author');
+ if ( ! empty($role) ) {
+ $role->add_cap('delete_posts');
+ $role->add_cap('delete_published_posts');
+ }
+
+ $role = get_role('contributor');
+ if ( ! empty($role) ) {
+ $role->add_cap('delete_posts');
+ }
+}
+
?>
diff --git a/wp-inst/wp-admin/upgrade.php b/wp-inst/wp-admin/upgrade.php
index 53eb154..9c9ba81 100644
--- a/wp-inst/wp-admin/upgrade.php
+++ b/wp-inst/wp-admin/upgrade.php
@@ -27,17 +27,17 @@ header( 'Content-Type: text/html; charset=utf-8' );
margin-right: 20%;
padding: .2em 2em;
}
-
+
h1 {
color: #006;
font-size: 18px;
font-weight: lighter;
}
-
+
h2 {
font-size: 16px;
}
-
+
p, li, dt {
line-height: 140%;
padding-bottom: 2px;
@@ -73,7 +73,7 @@ switch($step) {
<h2 class="step"><a href="upgrade.php?step=1&amp;backto=<?php echo $goback; ?>"><?php _e('Upgrade WordPress &raquo;'); ?></a></h2>
<?php
break;
-
+
case 1:
wp_cache_flush();
make_db_current_silent();
diff --git a/wp-inst/wp-admin/user-edit.php b/wp-inst/wp-admin/user-edit.php
index 1cb1561..d6a3cd3 100644
--- a/wp-inst/wp-admin/user-edit.php
+++ b/wp-inst/wp-admin/user-edit.php
@@ -2,7 +2,7 @@
require_once('admin.php');
$title = __('Edit User');
-$parent_file = 'profile.php';
+$parent_file = 'profile.php';
$submenu_file = 'users.php';
$wpvarstoreset = array('action', 'redirect', 'profile', 'user_id');
@@ -65,7 +65,7 @@ if (!current_user_can('edit_users')) $errors['head'] = __('You do not have permi
<p><strong><?php _e('User updated.') ?></strong></p>
</div>
<?php endif; ?>
-<?php if ( count($errors) != 0 ) { ?>
+<?php if ( count($errors) != 0 ) : ?>
<div class="error">
<ul>
<?php
@@ -73,7 +73,7 @@ if (!current_user_can('edit_users')) $errors['head'] = __('You do not have permi
?>
</ul>
</div>
-<?php } else { ?>
+<?php endif; ?>
<div class="wrap">
<h2><?php _e('Edit User'); ?></h2>
@@ -233,7 +233,6 @@ if( $invites_list != '' )
?></table></div><?php
}
}
-}
break;
}
diff --git a/wp-inst/wp-admin/users.php b/wp-inst/wp-admin/users.php
index 35659fe..d3fdd79 100644
--- a/wp-inst/wp-admin/users.php
+++ b/wp-inst/wp-admin/users.php
@@ -4,7 +4,7 @@ require_once( ABSPATH . WPINC . '/registration-functions.php');
$title = __('Users');
$parent_file = 'profile.php';
-
+
$action = $_REQUEST['action'];
$update = '';
@@ -32,7 +32,7 @@ case 'promote':
$user = new WP_User($id);
$user->set_role($_POST['new_role']);
}
-
+
header('Location: users.php?update=' . $update);
break;
@@ -49,7 +49,7 @@ case 'dodelete':
die(__('You can&#8217;t delete users.'));
$userids = $_POST['users'];
-
+
$update = 'del';
foreach ($userids as $id) {
if($id == $current_user->id) {
@@ -133,9 +133,9 @@ break;
case 'adduser':
die( "This function is disabled. Add a user from your community." );
check_admin_referer();
-
+
$errors = add_user();
-
+
if(count($errors) == 0) {
header('Location: users.php?update=add');
die();
@@ -191,8 +191,8 @@ default:
$roles = $tmp_user->roles;
$role = array_shift($roles);
$roleclasses[$role][$tmp_user->user_login] = $tmp_user;
- }
-
+ }
+
?>
<?php
@@ -238,7 +238,7 @@ default:
<?php
endif;
?>
-
+
<form action="" method="post" name="updateusers" id="updateusers">
<div class="wrap">
<h2><?php _e('User List by Role'); ?></h2>
@@ -347,8 +347,8 @@ $role_select .= '</select>';
</p>
</form>
</div>
+ <?php
-<?php
break;
}
diff --git a/wp-inst/wp-admin/wp-admin.css b/wp-inst/wp-admin/wp-admin.css
index 439b58a..1b9ecc6 100644
--- a/wp-inst/wp-admin/wp-admin.css
+++ b/wp-inst/wp-admin/wp-admin.css
@@ -872,7 +872,7 @@ table .vers, table .name {
.dbx-handle-cursor {
cursor: move;
}
-
+
/* toggle images */
a.dbx-toggle, a.dbx-toggle:visited {
display:block;
diff --git a/wp-inst/wp-admin/xfn.js b/wp-inst/wp-admin/xfn.js
index 54c82fb..3cdf608 100644
--- a/wp-inst/wp-admin/xfn.js
+++ b/wp-inst/wp-admin/xfn.js
@@ -38,9 +38,9 @@ function blurry() {
var aInputs = document.getElementsByTagName('input');
- for (var i = 0; i < aInputs.length; i++) {
+ for (var i = 0; i < aInputs.length; i++) {
aInputs[i].onclick = aInputs[i].onkeyup = upit;
}
}
-addLoadEvent(blurry); \ No newline at end of file
+addLoadEvent(blurry);
diff --git a/wp-inst/wp-commentsrss2.php b/wp-inst/wp-commentsrss2.php
index caddaa0..2f0e47c 100644
--- a/wp-inst/wp-commentsrss2.php
+++ b/wp-inst/wp-commentsrss2.php
@@ -32,14 +32,14 @@ if (have_posts()) :
comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID,
$wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments
LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE comment_post_ID = '$id'
- AND $wpdb->comments.comment_approved = '1' AND $wpdb->posts.post_status IN ('publish', 'static', 'object')
+ AND $wpdb->comments.comment_approved = '1' AND $wpdb->posts.post_status = 'publish')
AND post_date_gmt < '" . gmdate("Y-m-d H:i:59") . "'
ORDER BY comment_date_gmt DESC LIMIT " . get_settings('posts_per_rss') );
} else { // if no post id passed in, we'll just ue the last 10 comments.
$comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email,
comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID,
$wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments
- LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE $wpdb->posts.post_status IN ('publish', 'static', 'object')
+ LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE $wpdb->posts.post_status = 'publish'
AND $wpdb->comments.comment_approved = '1' AND post_date_gmt < '" . gmdate("Y-m-d H:i:s") . "'
ORDER BY comment_date_gmt DESC LIMIT " . get_settings('posts_per_rss') );
}
@@ -56,8 +56,8 @@ if (have_posts()) :
$title = apply_filters('the_title', $title);
$title = apply_filters('the_title_rss', $title);
printf(__('Comment on %1$s by %2$s'), $title, get_comment_author_rss());
- } else {
- printf(__('by: %s'), get_comment_author_rss());
+ } else {
+ printf(__('by: %s'), get_comment_author_rss());
} ?></title>
<link><?php comment_link() ?></link>
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></pubDate>
diff --git a/wp-inst/wp-content/themes/classic/comments-popup.php b/wp-inst/wp-content/themes/classic/comments-popup.php
index f42d38d..7a209a2 100644
--- a/wp-inst/wp-content/themes/classic/comments-popup.php
+++ b/wp-inst/wp-content/themes/classic/comments-popup.php
@@ -103,7 +103,7 @@ if (!empty($commentstatus->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH
<?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?>
<script type="text/javascript">
<!--
-document.onkeypress = function esc(e) {
+document.onkeypress = function esc(e) {
if(typeof(e) == "undefined") { e=event; }
if (e.keyCode == 27) { self.close(); }
}
diff --git a/wp-inst/wp-content/themes/classic/header.php b/wp-inst/wp-content/themes/classic/header.php
index e505e29..7052ae7 100644
--- a/wp-inst/wp-content/themes/classic/header.php
+++ b/wp-inst/wp-content/themes/classic/header.php
@@ -5,7 +5,7 @@
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<title><?php bloginfo('name'); ?><?php wp_title(); ?></title>
-
+
<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats please -->
<style type="text/css" media="screen">
@@ -15,7 +15,7 @@
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />
-
+
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php wp_get_archives('type=monthly&format=link'); ?>
<?php //comments_popup_script(); // off by default ?>
diff --git a/wp-inst/wp-content/themes/classic/index.php b/wp-inst/wp-content/themes/classic/index.php
index bbee16e..2760bff 100644
--- a/wp-inst/wp-content/themes/classic/index.php
+++ b/wp-inst/wp-content/themes/classic/index.php
@@ -5,15 +5,15 @@ get_header();
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_date('','<h2>','</h2>'); ?>
-
+
<div class="post" id="post-<?php the_ID(); ?>">
<h3 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
<div class="meta"><?php _e("Filed under:"); ?> <?php the_category(',') ?> &#8212; <?php the_author() ?> @ <?php the_time() ?> <?php edit_post_link(__('Edit This')); ?></div>
-
+
<div class="storycontent">
<?php the_content(__('(more...)')); ?>
</div>
-
+
<div class="feedback">
<?php wp_link_pages(); ?>
<?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
diff --git a/wp-inst/wp-content/themes/classic/sidebar.php b/wp-inst/wp-content/themes/classic/sidebar.php
index 46dee78..24a1cdd 100644
--- a/wp-inst/wp-content/themes/classic/sidebar.php
+++ b/wp-inst/wp-content/themes/classic/sidebar.php
@@ -11,7 +11,7 @@
</ul>
</li>
<li id="search">
- <label for="s"><?php _e('Search:'); ?></label>
+ <label for="s"><?php _e('Search:'); ?></label>
<form id="searchform" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<div>
<input type="text" name="s" id="s" size="15" /><br />
diff --git a/wp-inst/wp-content/themes/default/archive.php b/wp-inst/wp-content/themes/default/archive.php
index 0aadc8f..c648abd 100644
--- a/wp-inst/wp-content/themes/default/archive.php
+++ b/wp-inst/wp-content/themes/default/archive.php
@@ -5,21 +5,21 @@
<?php if (have_posts()) : ?>
<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
-<?php /* If this is a category archive */ if (is_category()) { ?>
+<?php /* If this is a category archive */ if (is_category()) { ?>
<h2 class="pagetitle">Archive for the '<?php echo single_cat_title(); ?>' Category</h2>
-
+
<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
<h2 class="pagetitle">Archive for <?php the_time('F jS, Y'); ?></h2>
-
+
<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
<h2 class="pagetitle">Archive for <?php the_time('F, Y'); ?></h2>
<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
<h2 class="pagetitle">Archive for <?php the_time('Y'); ?></h2>
-
+
<?php /* If this is a search */ } elseif (is_search()) { ?>
<h2 class="pagetitle">Search Results</h2>
-
+
<?php /* If this is an author archive */ } elseif (is_author()) { ?>
<h2 class="pagetitle">Author Archive</h2>
@@ -38,29 +38,29 @@
<div class="post">
<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
<small><?php the_time('l, F jS, Y') ?></small>
-
+
<div class="entry">
<?php the_content() ?>
</div>
-
+
<p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p>
</div>
-
+
<?php endwhile; ?>
<div class="navigation">
<div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div>
</div>
-
+
<?php else : ?>
<h2 class="center">Not Found</h2>
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
<?php endif; ?>
-
+
</div>
<?php get_sidebar(); ?>
diff --git a/wp-inst/wp-content/themes/default/archives.php b/wp-inst/wp-content/themes/default/archives.php
index ae9d8dd..2c30466 100644
--- a/wp-inst/wp-content/themes/default/archives.php
+++ b/wp-inst/wp-content/themes/default/archives.php
@@ -20,6 +20,6 @@ Template Name: Archives
<?php wp_list_cats(); ?>
</ul>
-</div>
+</div>
<?php get_footer(); ?>
diff --git a/wp-inst/wp-content/themes/default/attachment.php b/wp-inst/wp-content/themes/default/attachment.php
index b8f3347..ad7c60d 100644
--- a/wp-inst/wp-content/themes/default/attachment.php
+++ b/wp-inst/wp-content/themes/default/attachment.php
@@ -1,9 +1,9 @@
<?php get_header(); ?>
<div id="content" class="widecolumn">
-
+
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
-
+
<div class="navigation">
<div class="alignleft">&nbsp;</div>
<div class="alignright">&nbsp;</div>
@@ -16,9 +16,9 @@
<p class="<?php echo $classname; ?>"><?php echo $attachment_link; ?><br /><?php echo basename($post->guid); ?></p>
<?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>
-
+
<?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?>
-
+
<p class="postmetadata alt">
<small>
This entry was posted
@@ -29,39 +29,39 @@
on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?>
and is filed under <?php the_category(', ') ?>.
You can follow any responses to this entry through the <?php comments_rss_link('RSS 2.0'); ?> feed.
-
+
<?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
// Both Comments and Pings are open ?>
You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(true); ?>" rel="trackback">trackback</a> from your own site.
-
+
<?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
// Only Pings are Open ?>
Responses are currently closed, but you can <a href="<?php trackback_url(true); ?> " rel="trackback">trackback</a> from your own site.
-
+
<?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
// Comments are open, Pings are not ?>
You can skip to the end and leave a response. Pinging is currently not allowed.
-
+
<?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
// Neither Comments, nor Pings are open ?>
- Both comments and pings are currently closed.
-
+ Both comments and pings are currently closed.
+
<?php } edit_post_link('Edit this entry.','',''); ?>
-
+
</small>
</p>
-
+
</div>
</div>
-
+
<?php comments_template(); ?>
-
+
<?php endwhile; else: ?>
-
+
<p>Sorry, no attachments matched your criteria.</p>
-
+
<?php endif; ?>
-
+
</div>
<?php get_footer(); ?>
diff --git a/wp-inst/wp-content/themes/default/comments-popup.php b/wp-inst/wp-content/themes/default/comments-popup.php
index d5dd176..f22b861 100644
--- a/wp-inst/wp-content/themes/default/comments-popup.php
+++ b/wp-inst/wp-content/themes/default/comments-popup.php
@@ -103,7 +103,7 @@ if (!empty($post->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH] != $pos
<?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?>
<script type="text/javascript">
<!--
-document.onkeypress = function esc(e) {
+document.onkeypress = function esc(e) {
if(typeof(e) == "undefined") { e=event; }
if (e.keyCode == 27) { self.close(); }
}
diff --git a/wp-inst/wp-content/themes/default/comments.php b/wp-inst/wp-content/themes/default/comments.php
index dff40d8..ecf0b34 100644
--- a/wp-inst/wp-content/themes/default/comments.php
+++ b/wp-inst/wp-content/themes/default/comments.php
@@ -5,9 +5,9 @@
if (!empty($post->post_password)) { // if there's a password
if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
?>
-
+
<p class="nocomments">This post is password protected. Enter the password to view comments.<p>
-
+
<?php
return;
}
@@ -39,7 +39,7 @@
</li>
- <?php /* Changes every other comment to a different class */
+ <?php /* Changes every other comment to a different class */
if ('alt' == $oddcomment) $oddcomment = '';
else $oddcomment = 'alt';
?>
@@ -52,11 +52,11 @@
<?php if ('open' == $post->comment_status) : ?>
<!-- If comments are open, but there are no comments. -->
-
+
<?php else : // comments are closed ?>
<!-- If comments are closed. -->
<p class="nocomments">Comments are closed.</p>
-
+
<?php endif; ?>
<?php endif; ?>
diff --git a/wp-inst/wp-content/themes/default/functions.php b/wp-inst/wp-content/themes/default/functions.php
index 5587a48..7917f01 100644
--- a/wp-inst/wp-content/themes/default/functions.php
+++ b/wp-inst/wp-content/themes/default/functions.php
@@ -57,7 +57,7 @@ function kubrick_header_color_string() {
$color = kubrick_header_color();
if ( false === $color )
return 'white';
-
+
return $color;
}
@@ -100,21 +100,21 @@ function kubrick_add_theme_page() {
}
}
} else {
-
+
if ( isset($_REQUEST['headerimage']) ) {
if ( '' == $_REQUEST['headerimage'] )
delete_option('kubrick_header_image');
else
update_option('kubrick_header_image', $_REQUEST['headerimage']);
}
-
+
if ( isset($_REQUEST['fontcolor']) ) {
if ( '' == $_REQUEST['fontcolor'] )
delete_option('kubrick_header_color');
else
update_option('kubrick_header_color', $_REQUEST['fontcolor']);
}
-
+
if ( isset($_REQUEST['fontdisplay']) ) {
if ( '' == $_REQUEST['fontdisplay'] || 'inline' == $_REQUEST['fontdisplay'] )
delete_option('kubrick_header_display');
@@ -268,7 +268,7 @@ function kubrick_theme_page_head() {
font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
font-size: 1.2em;
text-align: center;
- }
+ }
#kubrick-header #header {
text-decoration: none;
color: <?php echo kubrick_header_color_string(); ?>;
diff --git a/wp-inst/wp-content/themes/default/header.php b/wp-inst/wp-content/themes/default/header.php
index 65ea78b..434adcb 100644
--- a/wp-inst/wp-content/themes/default/header.php
+++ b/wp-inst/wp-content/themes/default/header.php
@@ -16,8 +16,8 @@
/* To accomodate differing install paths of WordPress, images are referred only here,
and not in the wp-layout.css file. If you prefer to use only CSS for colors and what
not, then go right ahead and delete the following lines, and the image files. */
-
- body { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgcolor.jpg"); }
+
+ body { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgcolor.jpg"); }
<?php /* Checks to see whether it needs a sidebar or not */ if ((! $withcomments) && (! is_single())) { ?>
#page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbg.jpg") repeat-y top; border: none; }
<?php } else { // No sidebar ?>
@@ -28,7 +28,7 @@
/* Because the template is slightly different, size-wise, with images, this needs to be set here
If you don't want to use the template's images, you can also delete the following two lines. */
-
+
#header { margin: 0 !important; margin: 0 0 0 1px; padding: 1px; height: 198px; width: 758px; }
#headerimg { margin: 7px 9px 0; height: 192px; width: 740px; }
diff --git a/wp-inst/wp-content/themes/default/index.php b/wp-inst/wp-content/themes/default/index.php
index 32a432e..ffb0779 100644
--- a/wp-inst/wp-content/themes/default/index.php
+++ b/wp-inst/wp-content/themes/default/index.php
@@ -3,27 +3,27 @@
<div id="content" class="narrowcolumn">
<?php if (have_posts()) : ?>
-
+
<?php while (have_posts()) : the_post(); ?>
-
+
<div class="post" id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
<small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
-
+
<div class="entry">
<?php the_content('Read the rest of this entry &raquo;'); ?>
</div>
-
+
<p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p>
</div>
-
+
<?php endwhile; ?>
<div class="navigation">
<div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div>
</div>
-
+
<?php else : ?>
<h2 class="center">Not Found</h2>
diff --git a/wp-inst/wp-content/themes/default/links.php b/wp-inst/wp-content/themes/default/links.php
index 2970897..3b2ad81 100644
--- a/wp-inst/wp-content/themes/default/links.php
+++ b/wp-inst/wp-content/themes/default/links.php
@@ -13,6 +13,6 @@ Template Name: Links
<?php get_links_list(); ?>
</ul>
-</div>
+</div>
<?php get_footer(); ?>
diff --git a/wp-inst/wp-content/themes/default/page.php b/wp-inst/wp-content/themes/default/page.php
index 5f914c1..c35a4dd 100644
--- a/wp-inst/wp-content/themes/default/page.php
+++ b/wp-inst/wp-content/themes/default/page.php
@@ -7,9 +7,9 @@
<h2><?php the_title(); ?></h2>
<div class="entrytext">
<?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
-
+
<?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?>
-
+
</div>
</div>
<?php endwhile; endif; ?>
@@ -18,4 +18,4 @@
<?php get_sidebar(); ?>
-<?php get_footer(); ?> \ No newline at end of file
+<?php get_footer(); ?>
diff --git a/wp-inst/wp-content/themes/default/search.php b/wp-inst/wp-content/themes/default/search.php
index d747870..3fafd0a 100644
--- a/wp-inst/wp-content/themes/default/search.php
+++ b/wp-inst/wp-content/themes/default/search.php
@@ -5,7 +5,7 @@
<?php if (have_posts()) : ?>
<h2 class="pagetitle">Search Results</h2>
-
+
<div class="navigation">
<div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div>
@@ -13,28 +13,28 @@
<?php while (have_posts()) : the_post(); ?>
-
+
<div class="post">
<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
<small><?php the_time('l, F jS, Y') ?></small>
-
+
<p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p>
</div>
-
+
<?php endwhile; ?>
<div class="navigation">
<div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div>
</div>
-
+
<?php else : ?>
<h2 class="center">No posts found. Try a different search?</h2>
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
<?php endif; ?>
-
+
</div>
<?php get_sidebar(); ?>
diff --git a/wp-inst/wp-content/themes/default/sidebar.php b/wp-inst/wp-content/themes/default/sidebar.php
index 03364b8..46d8ddd 100644
--- a/wp-inst/wp-content/themes/default/sidebar.php
+++ b/wp-inst/wp-content/themes/default/sidebar.php
@@ -1,6 +1,6 @@
<div id="sidebar">
<ul>
-
+
<li>
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
</li>
@@ -15,11 +15,11 @@
<?php /* If this is a 404 page */ if (is_404()) { ?>
<?php /* If this is a category archive */ } elseif (is_category()) { ?>
<p>You are currently browsing the archives for the <?php single_cat_title(''); ?> category.</p>
-
+
<?php /* If this is a yearly archive */ } elseif (is_day()) { ?>
<p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
for the day <?php the_time('l, F jS, Y'); ?>.</p>
-
+
<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
<p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
for <?php the_time('F, Y'); ?>.</p>
@@ -27,7 +27,7 @@
<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
<p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
for the year <?php the_time('Y'); ?>.</p>
-
+
<?php /* If this is a monthly archive */ } elseif (is_search()) { ?>
<p>You have searched the <a href="<?php echo bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
for <strong>'<?php echo wp_specialchars($s); ?>'</strong>. If you are unable to find anything in these search results, you can try one of these links.</p>
@@ -52,9 +52,9 @@
</ul>
</li>
- <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>
+ <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>
<?php get_links_list(); ?>
-
+
<li><h2>Meta</h2>
<ul>
<?php wp_register(); ?>
@@ -66,7 +66,7 @@
</ul>
</li>
<?php } ?>
-
+
</ul>
</div>
diff --git a/wp-inst/wp-content/themes/default/single.php b/wp-inst/wp-content/themes/default/single.php
index 1130d2f..05cc554 100644
--- a/wp-inst/wp-content/themes/default/single.php
+++ b/wp-inst/wp-content/themes/default/single.php
@@ -1,22 +1,22 @@
<?php get_header(); ?>
<div id="content" class="widecolumn">
-
+
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
-
+
<div class="navigation">
<div class="alignleft"><?php previous_post_link('&laquo; %link') ?></div>
<div class="alignright"><?php next_post_link('%link &raquo;') ?></div>
</div>
-
+
<div class="post" id="post-<?php the_ID(); ?>">
<h2><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h2>
-
+
<div class="entrytext">
<?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>
-
+
<?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?>
-
+
<p class="postmetadata alt">
<small>
This entry was posted
@@ -27,39 +27,39 @@
on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?>
and is filed under <?php the_category(', ') ?>.
You can follow any responses to this entry through the <?php comments_rss_link('RSS 2.0'); ?> feed.
-
+
<?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
// Both Comments and Pings are open ?>
You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(true); ?>" rel="trackback">trackback</a> from your own site.
-
+
<?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
// Only Pings are Open ?>
Responses are currently closed, but you can <a href="<?php trackback_url(true); ?> " rel="trackback">trackback</a> from your own site.
-
+
<?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
// Comments are open, Pings are not ?>
You can skip to the end and leave a response. Pinging is currently not allowed.
-
+
<?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
// Neither Comments, nor Pings are open ?>
- Both comments and pings are currently closed.
-
+ Both comments and pings are currently closed.
+
<?php } edit_post_link('Edit this entry.','',''); ?>
-
+
</small>
</p>
-
+
</div>
</div>
-
+
<?php comments_template(); ?>
-
+
<?php endwhile; else: ?>
-
+
<p>Sorry, no posts matched your criteria.</p>
-
+
<?php endif; ?>
-
+
</div>
<?php get_footer(); ?>
diff --git a/wp-inst/wp-content/themes/default/style.css b/wp-inst/wp-content/themes/default/style.css
index 667b7a5..665e719 100644
--- a/wp-inst/wp-content/themes/default/style.css
+++ b/wp-inst/wp-content/themes/default/style.css
@@ -14,7 +14,7 @@ Author URI: http://binarybonsai.com/
The CSS, XHTML and design is released under GPL:
http://www.opensource.org/licenses/gpl-license.php
-
+
*** REGARDING IMAGES ***
All CSS that involves the use of images, can be found in the 'index.php' file.
@@ -59,7 +59,7 @@ body {
.widecolumn {
line-height: 1.6em;
}
-
+
.narrowcolumn .postmetadata {
text-align: center;
}
@@ -132,7 +132,7 @@ h2, h2 a, h2 a:hover, h2 a:visited, h3, h3 a, h3 a:hover, h3 a:visited, #sidebar
.commentlist li, #commentform input, #commentform textarea {
font: 0.9em 'Lucida Grande', Verdana, Arial, Sans-Serif;
}
-
+
.commentlist li {
font-weight: bold;
}
@@ -164,7 +164,7 @@ h2, h2 a, h2 a:hover, h2 a:visited, h3, h3 a, h3 a:hover, h3 a:visited, #sidebar
small, #sidebar ul ul li, #sidebar ul ol li, .nocomments, .postmetadata, blockquote, strike {
color: #777;
}
-
+
code {
font: 1.1em 'Courier New', Courier, Fixed;
}
@@ -184,7 +184,7 @@ a:hover {
color: #147;
text-decoration: underline;
}
-
+
#wp-calendar #prev a {
font-size: 9pt;
}
@@ -219,7 +219,7 @@ body {
width: 760px;
border: 1px solid #959596;
}
-
+
#header {
padding: 0;
margin: 0 auto;
@@ -246,7 +246,7 @@ body {
margin: 5px 0 0 150px;
width: 450px;
}
-
+
.post {
margin: 0 0 40px;
text-align: justify;
@@ -339,13 +339,13 @@ p img {
thought?!) align the image to the right. And using 'class="centered',
will of course center the image. This is much better than using
align="center", being much more futureproof (and valid) */
-
+
img.centered {
display: block;
margin-left: auto;
margin-right: auto;
}
-
+
img.alignright {
padding: 4px;
margin: 0 0 2px 7px;
@@ -361,7 +361,7 @@ img.alignleft {
.alignright {
float: right;
}
-
+
.alignleft {
float: left
}
@@ -405,7 +405,7 @@ html>body .entry li {
list-style-type: none;
list-style-image: none;
}
-
+
#sidebar ul, #sidebar ul ol {
margin: 0;
padding: 0;
diff --git a/wp-inst/wp-includes/cache.php b/wp-inst/wp-includes/cache.php
index cb20209..be3e348 100644
--- a/wp-inst/wp-includes/cache.php
+++ b/wp-inst/wp-includes/cache.php
@@ -103,12 +103,12 @@ class WP_Object_Cache {
if ( ! $this->acquire_lock() )
return false;
-
+
$this->rm_cache_dir();
$this->cache = array ();
$this->dirty_objects = array ();
$this->non_existant_objects = array ();
-
+
$this->release_lock();
return true;
@@ -248,7 +248,7 @@ class WP_Object_Cache {
while (($file = @ readdir($dh)) !== false) {
if ($file == '.' or $file == '..')
continue;
-
+
if (@ is_dir($dir . DIRECTORY_SEPARATOR . $file))
$stack[] = $dir . DIRECTORY_SEPARATOR . $file;
else if (@ is_file($dir . DIRECTORY_SEPARATOR . $file))
@@ -354,7 +354,7 @@ class WP_Object_Cache {
if (@ copy($temp_file, $cache_file))
@ unlink($temp_file);
else
- $errors++;
+ $errors++;
}
@ chmod($cache_file, $file_perms);
}
@@ -363,7 +363,7 @@ class WP_Object_Cache {
$this->dirty_objects = array();
$this->release_lock();
-
+
if ( $errors )
return false;
diff --git a/wp-inst/wp-includes/capabilities.php b/wp-inst/wp-includes/capabilities.php
index f98d82d..4c8905a 100644
--- a/wp-inst/wp-includes/capabilities.php
+++ b/wp-inst/wp-includes/capabilities.php
@@ -34,15 +34,15 @@ class WP_Roles {
$this->role_names[$role] = $display_name;
return $this->role_objects[$role];
}
-
+
function remove_role($role) {
if ( ! isset($this->role_objects[$role]) )
return;
-
+
unset($this->role_objects[$role]);
unset($this->role_names[$role]);
unset($this->roles[$role]);
-
+
update_option($this->role_key, $this->roles);
}
@@ -70,7 +70,7 @@ class WP_Roles {
function is_role($role)
{
return isset($this->role_names[$role]);
- }
+ }
}
class WP_Role {
@@ -150,10 +150,10 @@ class WP_User {
$this->caps = array();
$this->get_role_caps();
}
-
+
function get_role_caps() {
global $wp_roles;
-
+
if ( ! isset($wp_roles) )
$wp_roles = new WP_Roles();
@@ -169,14 +169,14 @@ class WP_User {
}
$this->allcaps = array_merge($this->allcaps, $this->caps);
}
-
+
function add_role($role) {
$this->caps[$role] = true;
update_usermeta($this->id, $this->cap_key, $this->caps);
$this->get_role_caps();
$this->update_user_level_from_caps();
}
-
+
function remove_role($role) {
if ( empty($this->roles[$role]) || (count($this->roles) <= 1) )
return;
@@ -184,7 +184,7 @@ class WP_User {
update_usermeta($this->id, $this->cap_key, $this->caps);
$this->get_role_caps();
}
-
+
function set_role($role) {
foreach($this->roles as $oldrole)
unset($this->caps[$oldrole]);
@@ -203,13 +203,13 @@ class WP_User {
return $max;
}
}
-
+
function update_user_level_from_caps() {
global $table_prefix;
$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) {
$this->caps[$cap] = $grant;
update_usermeta($this->id, $this->cap_key, $this->caps);
@@ -220,13 +220,13 @@ class WP_User {
unset($this->caps[$cap]);
update_usermeta($this->id, $this->cap_key, $this->caps);
}
-
+
//has_cap(capability_or_role_name) or
//has_cap('edit_post', post_id)
function has_cap($cap) {
if ( is_numeric($cap) )
$cap = $this->translate_level_to_cap($cap);
-
+
$args = array_slice(func_get_args(), 1);
$args = array_merge(array($cap, $this->id), $args);
$caps = call_user_func_array('map_meta_cap', $args);
@@ -253,12 +253,64 @@ function map_meta_cap($cap, $user_id) {
$caps = array();
switch ($cap) {
+ case 'delete_post':
+ $author_data = get_userdata($user_id);
+ //echo "post ID: {$args[0]}<br/>";
+ $post = get_post($args[0]);
+ if ( 'page' == $post->post_type ) {
+ $args = array_merge(array('delete_page', $user_id), $args);
+ return call_user_func_array('map_meta_cap', $args);
+ }
+ $post_author_data = get_userdata($post->post_author);
+ //echo "current user id : $user_id, post author id: " . $post_author_data->ID . "<br/>";
+ // If the user is the author...
+ if ($user_id == $post_author_data->ID) {
+ // If the post is published...
+ if ($post->post_status == 'publish')
+ $caps[] = 'delete_published_posts';
+ else
+ // If the post is draft...
+ $caps[] = 'delete_posts';
+ } else {
+ // The user is trying to edit someone else's post.
+ $caps[] = 'delete_others_posts';
+ // The post is published, extra cap required.
+ if ($post->post_status == 'publish')
+ $caps[] = 'delete_published_posts';
+ }
+ break;
+ case 'delete_page':
+ $author_data = get_userdata($user_id);
+ //echo "post ID: {$args[0]}<br/>";
+ $page = get_page($args[0]);
+ $page_author_data = get_userdata($post->post_author);
+ //echo "current user id : $user_id, page author id: " . $page_author_data->ID . "<br/>";
+ // If the user is the author...
+ if ($user_id == $page_author_data->ID) {
+ // If the page is published...
+ if ($page->post_status == 'publish')
+ $caps[] = 'delete_published_pages';
+ else
+ // If the page is draft...
+ $caps[] = 'delete_pages';
+ } else {
+ // The user is trying to edit someone else's page.
+ $caps[] = 'delete_others_pages';
+ // The page is published, extra cap required.
+ if ($page->post_status == 'publish')
+ $caps[] = 'delete_published_pages';
+ }
+ break;
// edit_post breaks down to edit_posts, edit_published_posts, or
// edit_others_posts
case 'edit_post':
$author_data = get_userdata($user_id);
//echo "post ID: {$args[0]}<br/>";
$post = get_post($args[0]);
+ if ( 'page' == $post->post_type ) {
+ $args = array_merge(array('edit_page', $user_id), $args);
+ return call_user_func_array('map_meta_cap', $args);
+ }
$post_author_data = get_userdata($post->post_author);
//echo "current user id : $user_id, post author id: " . $post_author_data->ID . "<br/>";
// If the user is the author...
@@ -266,17 +318,10 @@ function map_meta_cap($cap, $user_id) {
// If the post is published...
if ($post->post_status == 'publish')
$caps[] = 'edit_published_posts';
- else if ($post->post_status == 'static')
- $caps[] = 'edit_pages';
else
// If the post is draft...
$caps[] = 'edit_posts';
} else {
- if ($post->post_status == 'static') {
- $caps[] = 'edit_pages';
- break;
- }
-
// The user is trying to edit someone else's post.
$caps[] = 'edit_others_posts';
// The post is published, extra cap required.
@@ -284,14 +329,40 @@ function map_meta_cap($cap, $user_id) {
$caps[] = 'edit_published_posts';
}
break;
+ case 'edit_page':
+ $author_data = get_userdata($user_id);
+ //echo "post ID: {$args[0]}<br/>";
+ $page = get_page($args[0]);
+ $page_author_data = get_userdata($post->post_author);
+ //echo "current user id : $user_id, page author id: " . $page_author_data->ID . "<br/>";
+ // If the user is the author...
+ if ($user_id == $page_author_data->ID) {
+ // If the page is published...
+ if ($page->post_status == 'publish')
+ $caps[] = 'edit_published_pages';
+ else
+ // If the page is draft...
+ $caps[] = 'edit_pages';
+ } else {
+ // The user is trying to edit someone else's page.
+ $caps[] = 'edit_others_pages';
+ // The page is published, extra cap required.
+ if ($page->post_status == 'publish')
+ $caps[] = 'edit_published_pages';
+ }
+ break;
case 'read_post':
$post = get_post($args[0]);
-
+ if ( 'page' == $post->post_type ) {
+ $args = array_merge(array('read_page', $user_id), $args);
+ return call_user_func_array('map_meta_cap', $args);
+ }
+
if ( 'private' != $post->post_status ) {
$caps[] = 'read';
- break;
+ break;
}
-
+
$author_data = get_userdata($user_id);
$post_author_data = get_userdata($post->post_author);
if ($user_id == $post_author_data->ID)
@@ -299,6 +370,21 @@ function map_meta_cap($cap, $user_id) {
else
$caps[] = 'read_private_posts';
break;
+ case 'read_page':
+ $page = get_page($args[0]);
+
+ if ( 'private' != $page->post_status ) {
+ $caps[] = 'read';
+ break;
+ }
+
+ $author_data = get_userdata($user_id);
+ $page_author_data = get_userdata($post->post_author);
+ if ($user_id == $page_author_data->ID)
+ $caps[] = 'read';
+ else
+ $caps[] = 'read_private_pages';
+ break;
default:
// If no meta caps match, return the original cap.
$caps[] = $cap;
diff --git a/wp-inst/wp-includes/class-snoopy.php b/wp-inst/wp-includes/class-snoopy.php
index 9b8a1d3..f669ba5 100644
--- a/wp-inst/wp-includes/class-snoopy.php
+++ b/wp-inst/wp-includes/class-snoopy.php
@@ -39,7 +39,7 @@ if ( !in_array('Snoopy', get_declared_classes() ) ) :
class Snoopy
{
/**** Public variables ****/
-
+
/* user definable vars */
var $host = "www.php.net"; // host name we are connecting to
@@ -48,7 +48,7 @@ class Snoopy
var $proxy_port = ""; // proxy port to use
var $proxy_user = ""; // proxy user to use
var $proxy_pass = ""; // proxy password to use
-
+
var $agent = "Snoopy v1.2.3"; // agent we masquerade as
var $referer = ""; // referer info to pass
var $cookies = array(); // array of cookies to pass
@@ -66,15 +66,15 @@ class Snoopy
var $passcookies = true; // pass set cookies back through redirects
// NOTE: this currently does not respect
// dates, domains or paths.
-
+
var $user = ""; // user for http authentication
var $pass = ""; // password for http authentication
-
+
// http accept types
var $accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*";
-
+
var $results = ""; // where the content is put
-
+
var $error = ""; // error messages sent here
var $response_code = ""; // response code returned from server
var $headers = array(); // headers returned from server sent here
@@ -100,11 +100,11 @@ class Snoopy
// library functions built into php,
// as these functions are not stable
// as of this Snoopy release.
-
- /**** Private variables ****/
-
+
+ /**** Private variables ****/
+
var $_maxlinelen = 4096; // max line length (headers)
-
+
var $_httpmethod = "GET"; // default http request method
var $_httpversion = "HTTP/1.0"; // default http request version
var $_submit_method = "POST"; // default submit method
@@ -114,7 +114,7 @@ class Snoopy
var $_redirectdepth = 0; // increments on an http redirect
var $_frameurls = array(); // frame src urls
var $_framedepth = 0; // increments on frame depth
-
+
var $_isproxy = false; // set if using a proxy server
var $_fp_timeout = 30; // timeout for socket connection
@@ -129,7 +129,7 @@ class Snoopy
function fetch($URI)
{
-
+
//preg_match("|^([^:]+)://([^:/]+)(:[\d]+)*(.*)|",$URI,$URI_PARTS);
$URI_PARTS = parse_url($URI);
if (!empty($URI_PARTS["user"]))
@@ -140,7 +140,7 @@ class Snoopy
$URI_PARTS["query"] = '';
if (empty($URI_PARTS["path"]))
$URI_PARTS["path"] = '';
-
+
switch(strtolower($URI_PARTS["scheme"]))
{
case "http":
@@ -160,7 +160,7 @@ class Snoopy
// no proxy, send only the path
$this->_httprequest($path, $fp, $URI, $this->_httpmethod);
}
-
+
$this->_disconnect($fp);
if($this->_redirectaddr)
@@ -183,7 +183,7 @@ class Snoopy
{
$frameurls = $this->_frameurls;
$this->_frameurls = array();
-
+
while(list(,$frameurl) = each($frameurls))
{
if($this->_framedepth < $this->maxframes)
@@ -194,13 +194,13 @@ class Snoopy
else
break;
}
- }
+ }
}
else
{
return false;
}
- return true;
+ return true;
break;
case "https":
if(!$this->curl_path)
@@ -254,15 +254,15 @@ class Snoopy
else
break;
}
- }
- return true;
+ }
+ return true;
break;
default:
// not a valid protocol
$this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n';
return false;
break;
- }
+ }
return true;
}
@@ -280,9 +280,9 @@ class Snoopy
function submit($URI, $formvars="", $formfiles="")
{
unset($postdata);
-
+
$postdata = $this->_prepare_post_body($formvars, $formfiles);
-
+
$URI_PARTS = parse_url($URI);
if (!empty($URI_PARTS["user"]))
$this->user = $URI_PARTS["user"];
@@ -312,17 +312,17 @@ class Snoopy
// no proxy, send only the path
$this->_httprequest($path, $fp, $URI, $this->_submit_method, $this->_submit_type, $postdata);
}
-
+
$this->_disconnect($fp);
if($this->_redirectaddr)
{
/* url was redirected, check if we've hit the max depth */
if($this->maxredirs > $this->_redirectdepth)
- {
+ {
if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr))
- $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]);
-
+ $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]);
+
// only follow redirect if it's on this site, or offsiteok is true
if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok)
{
@@ -341,9 +341,9 @@ class Snoopy
{
$frameurls = $this->_frameurls;
$this->_frameurls = array();
-
+
while(list(,$frameurl) = each($frameurls))
- {
+ {
if($this->_framedepth < $this->maxframes)
{
$this->fetch($frameurl);
@@ -352,14 +352,14 @@ class Snoopy
else
break;
}
- }
-
+ }
+
}
else
{
return false;
}
- return true;
+ return true;
break;
case "https":
if(!$this->curl_path)
@@ -386,9 +386,9 @@ class Snoopy
{
/* url was redirected, check if we've hit the max depth */
if($this->maxredirs > $this->_redirectdepth)
- {
+ {
if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr))
- $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]);
+ $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]);
// only follow redirect if it's on this site, or offsiteok is true
if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok)
@@ -410,7 +410,7 @@ class Snoopy
$this->_frameurls = array();
while(list(,$frameurl) = each($frameurls))
- {
+ {
if($this->_framedepth < $this->maxframes)
{
$this->fetch($frameurl);
@@ -419,16 +419,16 @@ class Snoopy
else
break;
}
- }
- return true;
+ }
+ return true;
break;
-
+
default:
// not a valid protocol
$this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n';
return false;
break;
- }
+ }
return true;
}
@@ -442,7 +442,7 @@ class Snoopy
function fetchlinks($URI)
{
if ($this->fetch($URI))
- {
+ {
if($this->lastredirectaddr)
$URI = $this->lastredirectaddr;
if(is_array($this->results))
@@ -470,9 +470,9 @@ class Snoopy
function fetchform($URI)
{
-
+
if ($this->fetch($URI))
- {
+ {
if(is_array($this->results))
{
@@ -481,14 +481,14 @@ class Snoopy
}
else
$this->results = $this->_stripform($this->results);
-
+
return true;
}
else
return false;
}
-
-
+
+
/*======================================================================*\
Function: fetchtext
Purpose: fetch the text from a web page, stripping the links
@@ -499,7 +499,7 @@ class Snoopy
function fetchtext($URI)
{
if($this->fetch($URI))
- {
+ {
if(is_array($this->results))
{
for($x=0;$x<count($this->results);$x++)
@@ -523,7 +523,7 @@ class Snoopy
function submitlinks($URI, $formvars="", $formfiles="")
{
if($this->submit($URI,$formvars, $formfiles))
- {
+ {
if($this->lastredirectaddr)
$URI = $this->lastredirectaddr;
if(is_array($this->results))
@@ -557,7 +557,7 @@ class Snoopy
function submittext($URI, $formvars = "", $formfiles = "")
{
if($this->submit($URI,$formvars, $formfiles))
- {
+ {
if($this->lastredirectaddr)
$URI = $this->lastredirectaddr;
if(is_array($this->results))
@@ -581,7 +581,7 @@ class Snoopy
return false;
}
-
+
/*======================================================================*\
Function: set_submit_multipart
@@ -593,7 +593,7 @@ class Snoopy
$this->_submit_type = "multipart/form-data";
}
-
+
/*======================================================================*\
Function: set_submit_normal
Purpose: Set the form submission content type to
@@ -604,14 +604,14 @@ class Snoopy
$this->_submit_type = "application/x-www-form-urlencoded";
}
-
-
+
+
/*======================================================================*\
Private functions
\*======================================================================*/
-
-
+
+
/*======================================================================*\
Function: _striplinks
Purpose: strip the hyperlinks from an html document
@@ -620,13 +620,13 @@ class Snoopy
\*======================================================================*/
function _striplinks($document)
- {
+ {
preg_match_all("'<\s*a\s.*?href\s*=\s* # find <a href=
([\"\'])? # find single or double quote
(?(1) (.*?)\\1 | ([^\s\>]+)) # if quote found, match up to next matching
# quote, otherwise match up to next space
'isx",$document,$links);
-
+
// catenate the non-empty matches from the conditional subpattern
@@ -634,14 +634,14 @@ class Snoopy
{
if(!empty($val))
$match[] = $val;
- }
-
+ }
+
while(list($key,$val) = each($links[3]))
{
if(!empty($val))
$match[] = $val;
- }
-
+ }
+
// return the links
return $match;
}
@@ -654,18 +654,18 @@ class Snoopy
\*======================================================================*/
function _stripform($document)
- {
+ {
preg_match_all("'<\/?(FORM|INPUT|SELECT|TEXTAREA|(OPTION))[^<>]*>(?(2)(.*(?=<\/?(option|select)[^<>]*>[\r\n]*)|(?=[\r\n]*))|(?=[\r\n]*))'Usi",$document,$elements);
-
+
// catenate the matches
$match = implode("\r\n",$elements[0]);
-
+
// return the links
return $match;
}
-
-
+
+
/*======================================================================*\
Function: _striptext
Purpose: strip the text from an html document
@@ -675,11 +675,11 @@ class Snoopy
function _striptext($document)
{
-
+
// I didn't use preg eval (//e) since that is only available in PHP 4.0.
// so, list your entities one by one here. I included some of the
// more common ones.
-
+
$search = array("'<script[^>]*?>.*?</script>'si", // strip out javascript
"'<[\/\!]*?[^<>]*?>'si", // strip out html tags
"'([\r\n])[\s]+'", // strip out white space
@@ -728,9 +728,9 @@ class Snoopy
"Ü",
"ß",
);
-
+
$text = preg_replace($search,$replace,$document);
-
+
return $text;
}
@@ -744,7 +744,7 @@ class Snoopy
function _expandlinks($links,$URI)
{
-
+
preg_match("/^[^\?]+/",$URI,$match);
$match = preg_replace("|/[^\/\.]+\.[^\/\.]+$|","",$match[0]);
@@ -752,21 +752,21 @@ class Snoopy
$match_part = parse_url($match);
$match_root =
$match_part["scheme"]."://".$match_part["host"];
-
+
$search = array( "|^http://".preg_quote($this->host)."|i",
"|^(\/)|i",
"|^(?!http://)(?!mailto:)|i",
"|/\./|",
"|/[^\/]+/\.\./|"
);
-
+
$replace = array( "",
$match_root."/",
$match."/",
"/",
"/"
- );
-
+ );
+
$expandedLinks = preg_replace($search,$replace,$links);
return $expandedLinks;
@@ -779,19 +779,19 @@ class Snoopy
$fp the current open file pointer
$URI the full URI
$body body contents to send if any (POST)
- Output:
+ Output:
\*======================================================================*/
-
+
function _httprequest($url,$fp,$URI,$http_method,$content_type="",$body="")
{
$cookie_headers = '';
if($this->passcookies && $this->_redirectaddr)
$this->setcookies();
-
+
$URI_PARTS = parse_url($URI);
if(empty($url))
$url = "/";
- $headers = $http_method." ".$url." ".$this->_httpversion."\r\n";
+ $headers = $http_method." ".$url." ".$this->_httpversion."\r\n";
if(!empty($this->agent))
$headers .= "User-Agent: ".$this->agent."\r\n";
if(!empty($this->host) && !isset($this->rawheaders['Host'])) {
@@ -805,10 +805,10 @@ class Snoopy
if(!empty($this->referer))
$headers .= "Referer: ".$this->referer."\r\n";
if(!empty($this->cookies))
- {
+ {
if(!is_array($this->cookies))
$this->cookies = (array)$this->cookies;
-
+
reset($this->cookies);
if ( count($this->cookies) > 0 ) {
$cookie_headers .= 'Cookie: ';
@@ -831,28 +831,28 @@ class Snoopy
$headers .= "; boundary=".$this->_mime_boundary;
$headers .= "\r\n";
}
- if(!empty($body))
+ if(!empty($body))
$headers .= "Content-length: ".strlen($body)."\r\n";
- if(!empty($this->user) || !empty($this->pass))
+ if(!empty($this->user) || !empty($this->pass))
$headers .= "Authorization: Basic ".base64_encode($this->user.":".$this->pass)."\r\n";
-
+
//add proxy auth headers
- if(!empty($this->proxy_user))
+ if(!empty($this->proxy_user))
$headers .= 'Proxy-Authorization: ' . 'Basic ' . base64_encode($this->proxy_user . ':' . $this->proxy_pass)."\r\n";
$headers .= "\r\n";
-
+
// set the read timeout if needed
if ($this->read_timeout > 0)
socket_set_timeout($fp, $this->read_timeout);
$this->timed_out = false;
-
+
fwrite($fp,$headers.$body,strlen($headers.$body));
-
+
$this->_redirectaddr = false;
unset($this->headers);
-
+
while($currentHeader = fgets($fp,$this->_maxlinelen))
{
if ($this->read_timeout > 0 && $this->_check_timeout($fp))
@@ -860,10 +860,10 @@ class Snoopy
$this->status=-100;
return false;
}
-
+
if($currentHeader == "\r\n")
break;
-
+
// if a header begins with Location: or URI:, set the redirect
if(preg_match("/^(Location:|URI:)/i",$currentHeader))
{
@@ -883,16 +883,16 @@ class Snoopy
else
$this->_redirectaddr = $matches[2];
}
-
+
if(preg_match("|^HTTP/|",$currentHeader))
{
if(preg_match("|^HTTP/[^\s]*\s(.*?)\s|",$currentHeader, $status))
{
$this->status= $status[1];
- }
+ }
$this->response_code = $currentHeader;
}
-
+
$this->headers[] = $currentHeader;
}
@@ -910,13 +910,13 @@ class Snoopy
$this->status=-100;
return false;
}
-
+
// check if there is a a redirect meta tag
-
+
if(preg_match("'<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"\']?\d+;[\s]*URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match))
{
- $this->_redirectaddr = $this->_expandlinks($match[1],$URI);
+ $this->_redirectaddr = $this->_expandlinks($match[1],$URI);
}
// have we hit our frame depth and is there frame src to fetch?
@@ -932,7 +932,7 @@ class Snoopy
// no framed content
else
$this->results = $results;
-
+
return true;
}
@@ -942,21 +942,21 @@ class Snoopy
Input: $url the url to fetch
$URI the full URI
$body body contents to send if any (POST)
- Output:
+ Output:
\*======================================================================*/
-
+
function _httpsrequest($url,$URI,$http_method,$content_type="",$body="")
{
if($this->passcookies && $this->_redirectaddr)
$this->setcookies();
- $headers = array();
-
+ $headers = array();
+
$URI_PARTS = parse_url($URI);
if(empty($url))
$url = "/";
// GET ... header not needed for curl
- //$headers[] = $http_method." ".$url." ".$this->_httpversion;
+ //$headers[] = $http_method." ".$url." ".$this->_httpversion;
if(!empty($this->agent))
$headers[] = "User-Agent: ".$this->agent;
if(!empty($this->host))
@@ -969,10 +969,10 @@ class Snoopy
if(!empty($this->referer))
$headers[] = "Referer: ".$this->referer;
if(!empty($this->cookies))
- {
+ {
if(!is_array($this->cookies))
$this->cookies = (array)$this->cookies;
-
+
reset($this->cookies);
if ( count($this->cookies) > 0 ) {
$cookie_str = 'Cookie: ';
@@ -995,44 +995,44 @@ class Snoopy
else
$headers[] = "Content-type: $content_type";
}
- if(!empty($body))
+ if(!empty($body))
$headers[] = "Content-length: ".strlen($body);
- if(!empty($this->user) || !empty($this->pass))
+ if(!empty($this->user) || !empty($this->pass))
$headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass);
-
+
for($curr_header = 0; $curr_header < count($headers); $curr_header++) {
$safer_header = strtr( $headers[$curr_header], "\"", " " );
$cmdline_params .= " -H \"".$safer_header."\"";
}
-
+
if(!empty($body))
$cmdline_params .= " -d \"$body\"";
-
+
if($this->read_timeout > 0)
$cmdline_params .= " -m ".$this->read_timeout;
-
+
$headerfile = tempnam($temp_dir, "sno");
$safer_URI = strtr( $URI, "\"", " " ); // strip quotes from the URI to avoid shell access
exec(escapeshellcmd($this->curl_path." -D \"$headerfile\"".$cmdline_params." \"".$safer_URI."\""),$results,$return);
-
+
if($return)
{
$this->error = "Error: cURL could not retrieve the document, error $return.";
return false;
}
-
-
+
+
$results = implode("\r\n",$results);
-
+
$result_headers = file("$headerfile");
-
+
$this->_redirectaddr = false;
unset($this->headers);
-
+
for($currentHeader = 0; $currentHeader < count($result_headers); $currentHeader++)
{
-
+
// if a header begins with Location: or URI:, set the redirect
if(preg_match("/^(Location: |URI: )/i",$result_headers[$currentHeader]))
{
@@ -1052,7 +1052,7 @@ class Snoopy
else
$this->_redirectaddr = $matches[2];
}
-
+
if(preg_match("|^HTTP/|",$result_headers[$currentHeader]))
$this->response_code = $result_headers[$currentHeader];
@@ -1060,10 +1060,10 @@ class Snoopy
}
// check if there is a a redirect meta tag
-
+
if(preg_match("'<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"\']?\d+;[\s]*URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match))
{
- $this->_redirectaddr = $this->_expandlinks($match[1],$URI);
+ $this->_redirectaddr = $this->_expandlinks($match[1],$URI);
}
// have we hit our frame depth and is there frame src to fetch?
@@ -1081,7 +1081,7 @@ class Snoopy
$this->results = $results;
unlink("$headerfile");
-
+
return true;
}
@@ -1089,7 +1089,7 @@ class Snoopy
Function: setcookies()
Purpose: set cookies for a redirection
\*======================================================================*/
-
+
function setcookies()
{
for($x=0; $x<count($this->headers); $x++)
@@ -1099,7 +1099,7 @@ class Snoopy
}
}
-
+
/*======================================================================*\
Function: _check_timeout
Purpose: checks whether timeout has occurred
@@ -1123,13 +1123,13 @@ class Snoopy
Purpose: make a socket connection
Input: $fp file pointer
\*======================================================================*/
-
+
function _connect(&$fp)
{
if(!empty($this->proxy_host) && !empty($this->proxy_port))
{
$this->_isproxy = true;
-
+
$host = $this->proxy_host;
$port = $this->proxy_port;
}
@@ -1138,9 +1138,9 @@ class Snoopy
$host = $this->host;
$port = $this->port;
}
-
+
$this->status = 0;
-
+
if($fp = fsockopen(
$host,
$port,
@@ -1176,13 +1176,13 @@ class Snoopy
Purpose: disconnect a socket connection
Input: $fp file pointer
\*======================================================================*/
-
+
function _disconnect($fp)
{
return(fclose($fp));
}
-
+
/*======================================================================*\
Function: _prepare_post_body
Purpose: Prepare post body according to encoding type
@@ -1190,7 +1190,7 @@ class Snoopy
$formfiles - form upload files
Output: post body
\*======================================================================*/
-
+
function _prepare_post_body($formvars, $formfiles)
{
settype($formvars, "array");
@@ -1199,7 +1199,7 @@ class Snoopy
if (count($formvars) == 0 && count($formfiles) == 0)
return;
-
+
switch ($this->_submit_type) {
case "application/x-www-form-urlencoded":
reset($formvars);
@@ -1215,7 +1215,7 @@ class Snoopy
case "multipart/form-data":
$this->_mime_boundary = "Snoopy".md5(uniqid(microtime()));
-
+
reset($formvars);
while(list($key,$val) = each($formvars)) {
if (is_array($val) || is_object($val)) {
@@ -1230,7 +1230,7 @@ class Snoopy
$postdata .= "$val\r\n";
}
}
-
+
reset($formfiles);
while (list($field_name, $file_names) = each($formfiles)) {
settype($file_names, "array");
diff --git a/wp-inst/wp-includes/classes.php b/wp-inst/wp-includes/classes.php
index c58751b..b9a76c9 100644
--- a/wp-inst/wp-includes/classes.php
+++ b/wp-inst/wp-includes/classes.php
@@ -53,7 +53,7 @@ class WP_Query {
$this->is_admin = false;
$this->is_attachment = false;
}
-
+
function init () {
unset($this->posts);
unset($this->query);
@@ -63,7 +63,7 @@ class WP_Query {
$this->post_count = 0;
$this->current_post = -1;
$this->in_the_loop = false;
-
+
$this->init_query_flags();
}
@@ -97,7 +97,7 @@ class WP_Query {
$qv['attachment'] = $qv['subpost'];
if ( '' != $qv['subpost_id'] )
$qv['attachment_id'] = $qv['subpost_id'];
-
+
if ( ('' != $qv['attachment']) || (int) $qv['attachment_id'] ) {
$this->is_single = true;
$this->is_attachment = true;
@@ -226,7 +226,7 @@ class WP_Query {
if ('' != $qv['comments_popup']) {
$this->is_comments_popup = true;
}
-
+
//if we're previewing inside the write screen
if ('' != $qv['preview']) {
$this->is_preview = true;
@@ -247,9 +247,9 @@ class WP_Query {
function set_404() {
$this->init_query_flags();
- $this->is_404 = true;
+ $this->is_404 = true;
}
-
+
function get($query_var) {
if (isset($this->query_vars[$query_var])) {
return $this->query_vars[$query_var];
@@ -268,7 +268,7 @@ class WP_Query {
do_action('pre_get_posts', array(&$this));
// Shorthand.
- $q = $this->query_vars;
+ $q = &$this->query_vars;
// First let's clear some variables
$whichcat = '';
@@ -306,7 +306,7 @@ class WP_Query {
$q['page'] = trim($q['page'], '/');
$q['page'] = (int) $q['page'];
}
-
+
$add_hours = intval(get_settings('gmt_offset'));
$add_minutes = intval(60 * (get_settings('gmt_offset') - $add_hours));
$wp_posts_post_date_field = "post_date"; // "DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)";
@@ -367,24 +367,12 @@ class WP_Query {
$q['name'] = sanitize_title($q['name']);
$where .= " AND post_name = '" . $q['name'] . "'";
} else if ('' != $q['pagename']) {
+ $reqpage = get_page_by_path($q['pagename']);
$q['pagename'] = str_replace('%2F', '/', urlencode(urldecode($q['pagename'])));
$page_paths = '/' . trim($q['pagename'], '/');
$q['pagename'] = sanitize_title(basename($page_paths));
$q['name'] = $q['pagename'];
- $page_paths = explode('/', $page_paths);
- foreach($page_paths as $pathdir)
- $page_path .= ($pathdir!=''?'/':'') . sanitize_title($pathdir);
-
- $all_page_ids = get_all_page_ids();
- $reqpage = 0;
- if (is_array($all_page_ids)) { foreach ( $all_page_ids as $page_id ) {
- $page = get_page($page_id);
- if ( $page->fullpath == $page_path ) {
- $reqpage = $page_id;
- break;
- }
- } }
-
+
$where .= " AND (ID = '$reqpage')";
} elseif ('' != $q['attachment']) {
$q['attachment'] = str_replace('%2F', '/', urlencode(urldecode($q['attachment'])));
@@ -501,11 +489,11 @@ class WP_Query {
$partial_match = $cat_id;
}
}
-
+
//if we don't match the entire hierarchy fallback on just matching the nicename
if (!$q['cat'] && $partial_match) {
$q['cat'] = $partial_match;
- }
+ }
$tables = ", $wpdb->post2cat, $wpdb->categories";
$join = " LEFT JOIN $wpdb->post2cat ON ($wpdb->posts.ID = $wpdb->post2cat.post_id) LEFT JOIN $wpdb->categories ON ($wpdb->post2cat.category_id = $wpdb->categories.cat_ID) ";
@@ -553,7 +541,7 @@ class WP_Query {
$q['author'] = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_nicename='".$q['author_name']."'");
$whichauthor .= ' AND (post_author = '.intval($q['author']).')';
}
-
+
$where .= $search.$whichcat.$whichauthor;
if ((empty($q['order'])) || ((strtoupper($q['order']) != 'ASC') && (strtoupper($q['order']) != 'DESC'))) {
@@ -583,33 +571,35 @@ class WP_Query {
}
}
- $now = gmdate('Y-m-d H:i:59');
+ //$now = gmdate('Y-m-d H:i:59');
//only select past-dated posts, except if a logged in user is viewing a single: then, if they
//can edit the post, we let them through
- if ($pagenow != 'post.php' && $pagenow != 'edit.php' && !($this->is_single && $user_ID)) {
- $where .= " AND post_date_gmt <= '$now'";
- $distinct = 'DISTINCT';
- }
+ //if ($pagenow != 'post.php' && $pagenow != 'edit.php' && !($this->is_single && $user_ID)) {
+ // $where .= " AND post_date_gmt <= '$now'";
+ // $distinct = 'DISTINCT';
+ //}
if ( $this->is_attachment ) {
- $where .= ' AND (post_status = "attachment")';
+ $where .= ' AND (post_type = "attachment")';
} elseif ($this->is_page) {
- $where .= ' AND (post_status = "static")';
+ $where .= ' AND (post_type = "page")';
} elseif ($this->is_single) {
- $where .= ' AND (post_status != "static")';
+ $where .= ' AND (post_type = "post")';
} else {
- $where .= ' AND (post_status = "publish"';
+ $where .= ' AND (post_type = "post" AND (post_status = "publish"';
- if (isset($user_ID) && ('' != intval($user_ID)))
- $where .= " OR post_author = $user_ID AND post_status != 'draft' AND post_status != 'static')";
+ if ( $pagenow == 'post.php' || $pagenow == 'edit.php' )
+ $where .= " OR post_status = 'future'";
+ else
+ $distinct = 'DISTINCT';
+
+ if ( is_user_logged_in() )
+ $where .= " OR post_author = $user_ID AND post_status = 'private'))";
else
- $where .= ')';
+ $where .= '))';
}
- 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.
$where = apply_filters('posts_where', $where);
@@ -654,10 +644,11 @@ class WP_Query {
$this->posts = $wpdb->get_results($this->request);
// Check post status to determine if post should be displayed.
- if ($this->is_single) {
+ if ($this->is_single || $this->is_page) {
$status = get_post_status($this->posts[0]);
- if ( ('publish' != $status) && ('static' != $status) ) {
- if ( ! (isset($user_ID) && ('' != intval($user_ID))) ) {
+ //$type = get_post_type($this->posts[0]);
+ if ( ('publish' != $status) ) {
+ if ( ! is_user_logged_in() ) {
// User must be logged in to view unpublished posts.
$this->posts = array();
} else {
@@ -669,18 +660,16 @@ class WP_Query {
$this->is_preview = true;
$this->posts[0]->post_date = current_time('mysql');
}
+ } else if ('future' == $status) {
+ $this->is_preview = true;
+ if (!current_user_can('edit_post', $this->posts[0]->ID)) {
+ $this->posts = array ( );
+ }
} else {
if (! current_user_can('read_post', $this->posts[0]->ID))
$this->posts = array();
}
}
- } else {
- if (mysql2date('U', $this->posts[0]->post_date_gmt) > mysql2date('U', $now)) { //it's future dated
- $this->is_preview = true;
- if (!current_user_can('edit_post', $this->posts[0]->ID)) {
- $this->posts = array ( );
- }
- }
}
}
@@ -691,9 +680,7 @@ class WP_Query {
if ($this->post_count > 0) {
$this->post = $this->posts[0];
}
-
- // Save any changes made to the query vars.
- $this->query_vars = $q;
+
return $this->posts;
}
@@ -852,7 +839,7 @@ class retrospam_mgr {
$head = '<div class="wrap"><h2>' . __('Check Comments Results:') . '</h2>';
$foot .= '<p><a href="options-discussion.php">' . __('&laquo; Return to Discussion Options page.') . '</a></p></div>';
-
+
return $head . $body . $foot;
} // End function display_edit_form
@@ -933,7 +920,7 @@ class WP_Rewrite {
return false;
else
return true;
- }
+ }
function using_index_permalinks() {
if (empty($this->permalink_structure)) {
@@ -953,7 +940,7 @@ class WP_Rewrite {
return true;
else
return false;
- }
+ }
function preg_index($number) {
$match_prefix = '$';
@@ -998,7 +985,7 @@ class WP_Rewrite {
$this->date_structure = '';
return false;
}
-
+
// The date permalink must have year, month, and day separated by slashes.
$endians = array('%year%/%monthnum%/%day%', '%day%/%monthnum%/%year%', '%monthnum%/%day%/%year%');
@@ -1081,7 +1068,7 @@ class WP_Rewrite {
$this->category_structure = $this->category_base . '/';
$this->category_structure .= '%category%';
-
+
return $this->category_structure;
}
@@ -1164,10 +1151,10 @@ class WP_Rewrite {
// If the tag already exists, replace the existing pattern and query for
// that tag, otherwise add the new tag, pattern, and query to the end of
// the arrays.
- $position = array_search($tag, $this->rewritecode);
+ $position = array_search($tag, $this->rewritecode);
if (FALSE !== $position && NULL !== $position) {
$this->rewritereplace[$position] = $pattern;
- $this->queryreplace[$position] = $query;
+ $this->queryreplace[$position] = $query;
} else {
$this->rewritecode[] = $tag;
$this->rewritereplace[] = $pattern;
@@ -1185,7 +1172,7 @@ class WP_Rewrite {
$trackbackregex = 'trackback/?$';
$pageregex = 'page/?([0-9]{1,})/?$';
-
+
$front = substr($permalink_structure, 0, strpos($permalink_structure, '%'));
preg_match_all('/%.+?%/', $permalink_structure, $tokens);
@@ -1315,13 +1302,13 @@ class WP_Rewrite {
// Date
$date_rewrite = $this->generate_rewrite_rules($this->get_date_permastruct());
$date_rewrite = apply_filters('date_rewrite_rules', $date_rewrite);
-
+
// Root
$root_rewrite = $this->generate_rewrite_rules($this->root . '/');
$root_rewrite = apply_filters('root_rewrite_rules', $root_rewrite);
// Comments
- $comments_rewrite = $this->generate_rewrite_rules($this->root . $this->comments_base, true, true, true);
+ $comments_rewrite = $this->generate_rewrite_rules($this->root . $this->comments_base, true, true, true, false);
$comments_rewrite = apply_filters('comments_rewrite_rules', $comments_rewrite);
// Search
@@ -1383,7 +1370,7 @@ class WP_Rewrite {
$rules .= "RewriteCond %{REQUEST_FILENAME} -f [OR]\n" .
"RewriteCond %{REQUEST_FILENAME} -d\n" .
"RewriteRule ^.*$ - [S=$num_rules]\n";
-
+
foreach ($rewrite as $match => $query) {
// Apache 1.3 does not support the reluctant (non-greedy) modifier.
$match = str_replace('.+?', '.+', $match);
@@ -1393,7 +1380,7 @@ class WP_Rewrite {
if ($match == '(.+)/?$' || $match == '([^/]+)/?$' ) {
//nada.
}
-
+
if (strstr($query, $this->index)) {
$rules .= 'RewriteRule ^' . $match . ' ' . $home_root . $query . " [QSA,L]\n";
} else {
@@ -1415,7 +1402,7 @@ class WP_Rewrite {
}
function flush_rules() {
- generate_page_rewrite_rules();
+ generate_page_uri_index();
delete_option('rewrite_rules');
$this->wp_rewrite_rules();
if ( function_exists('save_mod_rewrite_rules') )
@@ -1424,7 +1411,7 @@ class WP_Rewrite {
function init() {
$this->permalink_structure = get_settings('permalink_structure');
- $this->front = substr($this->permalink_structure, 0, strpos($this->permalink_structure, '%'));
+ $this->front = substr($this->permalink_structure, 0, strpos($this->permalink_structure, '%'));
$this->root = '';
if ($this->using_index_permalinks()) {
$this->root = $this->index . '/';
@@ -1504,7 +1491,7 @@ class WP {
// Trim path info from the end and the leading home path from the
// front. For path info requests, this leaves us with the requesting
// filename, if any. For 404 requests, this leaves us with the
- // requested permalink.
+ // requested permalink.
$req_uri = str_replace($pathinfo, '', $req_uri);
$req_uri = trim($req_uri, '/');
$req_uri = preg_replace("|^$home_path|", '', $req_uri);
@@ -1573,10 +1560,10 @@ class WP {
if (isset($error))
unset($error);
-
+
if ( isset($query_vars) && strstr($_SERVER['PHP_SELF'], 'wp-admin/') )
unset($query_vars);
-
+
$this->did_permalink = false;
}
}
@@ -1630,7 +1617,7 @@ class WP {
// If string is empty, return 0. If not, attempt to parse into a timestamp
$client_modified_timestamp = $client_last_modified ? strtotime($client_last_modified) : 0;
- // Make a timestamp for our most recent modification...
+ // Make a timestamp for our most recent modification...
$wp_modified_timestamp = strtotime($wp_last_modified);
if ( ($client_last_modified && $client_etag) ?
diff --git a/wp-inst/wp-includes/comment-functions.php b/wp-inst/wp-includes/comment-functions.php
index 8b9c30e..bada2dc 100644
--- a/wp-inst/wp-includes/comment-functions.php
+++ b/wp-inst/wp-includes/comment-functions.php
@@ -41,7 +41,7 @@ function wp_new_comment( $commentdata ) {
$commentdata['comment_date'] = current_time('mysql');
$commentdata['comment_date_gmt'] = current_time('mysql', 1);
-
+
$commentdata = wp_filter_comment($commentdata);
@@ -230,7 +230,7 @@ function get_comments_number( $post_id = 0 ) {
if ( !isset($comment_count_cache[$post_id]) )
$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]);
}
@@ -277,13 +277,13 @@ function comments_popup_script($width=400, $height=400, $file='') {
function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') {
global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post, $wpdb;
global $comment_count_cache;
-
+
if (! is_single() && ! is_page()) {
if ( !isset($comment_count_cache[$id]) )
$comment_count_cache[$id] = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved = '1';");
-
+
$number = $comment_count_cache[$id];
-
+
if (0 == $number && 'closed' == $post->comment_status && 'closed' == $post->ping_status) {
echo $none;
return;
@@ -344,7 +344,7 @@ function comment_author() {
function get_comment_author_email() {
global $comment;
- return apply_filters('get_comment_author_email', $comment->comment_author_email);
+ return apply_filters('get_comment_author_email', $comment->comment_author_email);
}
function comment_author_email() {
@@ -616,7 +616,7 @@ function pingback($content, $post_ID) {
// Debug
debug_fwrite($log, 'Post contents:');
debug_fwrite($log, $content."\n");
-
+
// Step 2.
// Walking thru the links array
// first we get rid of links pointing to sites, not to specific files
@@ -658,7 +658,7 @@ function pingback($content, $post_ID) {
// when set to true, this outputs debug messages by itself
$client->debug = false;
-
+
if ( $client->query('pingback.ping', $pagelinkedfrom, $pagelinkedto ) )
add_ping( $post_ID, $pagelinkedto );
else
@@ -769,7 +769,7 @@ function is_local_attachment($url) {
$post = & get_post($id);
if ( 'attachment' == $post->post_status )
return true;
- }
+ }
return false;
}
@@ -795,7 +795,7 @@ 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'" );
@@ -809,7 +809,7 @@ function wp_set_comment_status($comment_id, $comment_status) {
function wp_get_comment_status($comment_id) {
global $wpdb;
-
+
$result = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1");
if ($result == NULL) {
return 'deleted';
@@ -845,7 +845,7 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $
// Do some escaping magic so that '#' chars in the
// spam words don't break things:
$word = preg_quote($word, '#');
-
+
$pattern = "#$word#i";
if ( preg_match($pattern, $author) ) return false;
if ( preg_match($pattern, $email) ) return false;
diff --git a/wp-inst/wp-includes/default-filters.php b/wp-inst/wp-includes/default-filters.php
index e6ec97b..4ac9b68 100644
--- a/wp-inst/wp-includes/default-filters.php
+++ b/wp-inst/wp-includes/default-filters.php
@@ -82,7 +82,7 @@ add_filter('bloginfo_rss', 'ent2ncr', 8);
add_filter('the_author', 'ent2ncr', 8);
// Actions
-add_action('publish_post', 'generic_ping');
add_action('wp_head', 'rsd_link');
+add_action('publish_future_post', 'wp_publish_post', 10, 1);
?>
diff --git a/wp-inst/wp-includes/functions-formatting.php b/wp-inst/wp-includes/functions-formatting.php
index 6f955e8..c593bc8 100644
--- a/wp-inst/wp-includes/functions-formatting.php
+++ b/wp-inst/wp-includes/functions-formatting.php
@@ -32,7 +32,7 @@ function wptexturize($text) {
$curl = preg_replace("/'([\s.]|\Z)/", '&#8217;$1', $curl);
$curl = preg_replace("/ \(tm\)/i", ' &#8482;', $curl);
$curl = str_replace("''", '&#8221;', $curl);
-
+
$curl = preg_replace('/(\d+)x(\d+)/', "$1&#215;$2", $curl);
} elseif (strstr($curl, '<code') || strstr($curl, '<pre') || strstr($curl, '<kbd' || strstr($curl, '<style') || strstr($curl, '<script'))) {
@@ -74,7 +74,7 @@ function wpautop($pee, $br = 1) {
$pee = preg_replace('!(</?(?:table|thead|tfoot|caption|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*<br />!', "$1", $pee);
$pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)!', '$1', $pee);
$pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' ", $pee);
-
+
return $pee;
}
@@ -239,7 +239,7 @@ function remove_accents($string) {
chr(197).chr(190) => 'z', chr(197).chr(191) => 's',
// Euro Sign
chr(226).chr(130).chr(172) => 'E');
-
+
$string = strtr($string, $chars);
} else {
// Assume ISO-8859-1 if not UTF-8
@@ -374,10 +374,10 @@ function convert_chars($content, $flag = 'obsolete') {
function funky_javascript_fix($text) {
// Fixes for browsers' javascript bugs
global $is_macIE, $is_winIE;
-
+
if ( $is_winIE || $is_macIE )
$text = preg_replace("/\%u([0-9A-F]{4,4})/e", "'&#'.base_convert('\\1',16,10).';'", $text);
-
+
return $text;
}
@@ -401,7 +401,7 @@ function funky_javascript_fix($text) {
1.0 First Version
*/
function balanceTags($text, $is_comment = 0) {
-
+
if ( get_option('use_balanceTags') == 0)
return $text;
diff --git a/wp-inst/wp-includes/functions-post.php b/wp-inst/wp-includes/functions-post.php
index 842980f..c3f9bd1 100644
--- a/wp-inst/wp-includes/functions-post.php
+++ b/wp-inst/wp-includes/functions-post.php
@@ -31,7 +31,7 @@ function wp_insert_post($postarr = array()) {
$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);
-
+
// Make sure we set a valid category
if (0 == count($post_category) || !is_array($post_category)) {
$post_category = array(get_option('default_category'));
@@ -43,7 +43,10 @@ function wp_insert_post($postarr = array()) {
if ( empty($post_status) )
$post_status = 'draft';
-
+
+ if ( empty($post_type) )
+ $post_type = 'post';
+
// Get the post ID.
if ( $update )
$post_ID = $ID;
@@ -56,7 +59,7 @@ function wp_insert_post($postarr = array()) {
} else {
$post_name = sanitize_title($post_name);
}
-
+
// If the post date is empty (due to having been new or a draft) and status is not 'draft', set date to now
if (empty($post_date)) {
@@ -69,6 +72,12 @@ function wp_insert_post($postarr = array()) {
$post_date_gmt = get_gmt_from_date($post_date);
}
+ if ( 'publish' == $post_status ) {
+ $now = gmdate('Y-m-d H:i:59');
+ if ( mysql2date('U', $post_date_gmt) > mysql2date('U', $now) )
+ $post_status = 'future';
+ }
+
if ( empty($comment_status) ) {
if ( $update )
$comment_status = 'closed';
@@ -101,18 +110,14 @@ function wp_insert_post($postarr = array()) {
if ( !isset($post_password) )
$post_password = '';
- if ( ('publish' == $post_status) || ('static' == $post_status) ) {
- $post_name_check = ('publish' == $post_status)
- ? $wpdb->get_var("SELECT post_name FROM $wpdb->posts WHERE post_name = '$post_name' AND post_status = 'publish' AND ID != '$post_ID' LIMIT 1")
- : $wpdb->get_var("SELECT post_name FROM $wpdb->posts WHERE post_name = '$post_name' AND post_status = 'static' AND ID != '$post_ID' AND post_parent = '$post_parent' LIMIT 1");
+ if ( 'draft' != $post_status ) {
+ $post_name_check = $wpdb->get_var("SELECT post_name FROM $wpdb->posts WHERE post_name = '$post_name' AND post_type = '$post_type' AND ID != '$post_ID' AND post_parent = '$post_parent' LIMIT 1");
if ($post_name_check) {
$suffix = 2;
while ($post_name_check) {
$alt_post_name = $post_name . "-$suffix";
- $post_name_check = ('publish' == $post_status)
- ? $wpdb->get_var("SELECT post_name FROM $wpdb->posts WHERE post_name = '$alt_post_name' AND post_status = 'publish' AND ID != '$post_ID' LIMIT 1")
- : $wpdb->get_var("SELECT post_name FROM $wpdb->posts WHERE post_name = '$alt_post_name' AND post_status = 'static' AND ID != '$post_ID' AND post_parent = '$post_parent' LIMIT 1");
+ $post_name_check = $wpdb->get_var("SELECT post_name FROM $wpdb->posts WHERE post_name = '$alt_post_name' AND post_type = '$post_type' AND ID != '$post_ID' AND post_parent = '$post_parent' LIMIT 1");
$suffix++;
}
$post_name = $alt_post_name;
@@ -130,6 +135,7 @@ function wp_insert_post($postarr = array()) {
post_title = '$post_title',
post_excerpt = '$post_excerpt',
post_status = '$post_status',
+ post_type = '$post_type',
comment_status = '$comment_status',
ping_status = '$ping_status',
post_password = '$post_password',
@@ -144,10 +150,10 @@ function wp_insert_post($postarr = array()) {
} else {
$wpdb->query(
"INSERT IGNORE INTO $wpdb->posts
- (post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type)
+ (post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type)
VALUES
- ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_content_filtered', '$post_title', '$post_excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type')");
- $post_ID = $wpdb->insert_id;
+ ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_content_filtered', '$post_title', '$post_excerpt', '$post_status', '$post_type', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type')");
+ $post_ID = $wpdb->insert_id;
}
if ( empty($post_name) && 'draft' != $post_status ) {
@@ -157,7 +163,7 @@ function wp_insert_post($postarr = array()) {
wp_set_post_cats('', $post_ID, $post_category);
- if ( 'static' == $post_status ) {
+ if ( 'page' == $post_type ) {
clean_page_cache($post_ID);
wp_cache_delete($post_ID, 'pages');
} else {
@@ -174,11 +180,11 @@ function wp_insert_post($postarr = array()) {
$wpdb->query("UPDATE $wpdb->posts SET guid = '" . get_permalink($post_ID) . "' WHERE ID = '$post_ID'");
do_action('private_to_published', $post_ID);
}
-
+
do_action('edit_post', $post_ID);
}
- if ($post_status == 'publish') {
+ if ($post_status == 'publish' && $post_type == 'post') {
do_action('publish_post', $post_ID);
if ( !defined('WP_IMPORTING') ) {
@@ -195,7 +201,7 @@ function wp_insert_post($postarr = array()) {
");
spawn_pinger();
}
- } else if ($post_status == 'static') {
+ } else if ($post_type == 'page') {
wp_cache_delete('all_page_ids', 'pages');
$wp_rewrite->flush_rules();
@@ -204,6 +210,9 @@ function wp_insert_post($postarr = array()) {
add_post_meta($post_ID, '_wp_page_template', $page_template, true);
}
+ if ( 'future' == $post_status )
+ wp_schedule_event(mysql2date('U', $post_date), 'once', 'publish_future_post', $post_ID);
+
do_action('save_post', $post_ID);
do_action('wp_insert_post', $post_ID);
@@ -238,13 +247,14 @@ function wp_insert_attachment($object, $file = false, $post_parent = 0) {
if ( empty($post_author) )
$post_author = $user_ID;
- $post_status = 'attachment';
+ $post_type = 'attachment';
+ $post_status = 'inherit';
// Are we updating or creating?
$update = false;
if ( !empty($ID) ) {
$update = true;
- $post_ID = $ID;
+ $post_ID = $ID;
}
// Create a valid post name.
@@ -252,7 +262,7 @@ function wp_insert_attachment($object, $file = false, $post_parent = 0) {
$post_name = sanitize_title($post_title);
else
$post_name = sanitize_title($post_name);
-
+
if (empty($post_date))
$post_date = current_time('mysql');
if (empty($post_date_gmt))
@@ -305,6 +315,7 @@ function wp_insert_attachment($object, $file = false, $post_parent = 0) {
post_title = '$post_title',
post_excerpt = '$post_excerpt',
post_status = '$post_status',
+ post_type = '$post_type',
comment_status = '$comment_status',
ping_status = '$ping_status',
post_password = '$post_password',
@@ -321,12 +332,12 @@ function wp_insert_attachment($object, $file = false, $post_parent = 0) {
} 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, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type, guid)
+ (post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, 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', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type', '$guid')");
- $post_ID = $wpdb->insert_id;
+ ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_title', '$post_excerpt', '$post_status', '$post_type', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type', '$guid')");
+ $post_ID = $wpdb->insert_id;
}
-
+
if ( empty($post_name) ) {
$post_name = sanitize_title($post_title, $post_ID);
$wpdb->query( "UPDATE $wpdb->posts SET post_name = '$post_name' WHERE ID = '$post_ID'" );
@@ -344,7 +355,7 @@ function wp_insert_attachment($object, $file = false, $post_parent = 0) {
} else {
do_action('add_attachment', $post_ID);
}
-
+
return $post_ID;
}
@@ -355,7 +366,7 @@ function wp_delete_attachment($postid) {
if ( !$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = $postid") )
return $post;
- if ( 'attachment' != $post->post_status )
+ if ( 'attachment' != $post->post_type )
return false;
$meta = get_post_meta($postid, '_wp_attachment_metadata', true);
@@ -387,7 +398,7 @@ function wp_get_single_post($postid = 0, $mode = OBJECT) {
global $wpdb;
$post = get_post($postid, $mode);
-
+
// Set categories
if($mode == OBJECT) {
$post->post_category = wp_get_post_cats('',$postid);
@@ -407,7 +418,7 @@ function wp_get_recent_posts($num = 10) {
$limit = "LIMIT $num";
}
- $sql = "SELECT * FROM $wpdb->posts WHERE post_status IN ('publish', 'draft', 'private') ORDER BY post_date DESC $limit";
+ $sql = "SELECT * FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC $limit";
$result = $wpdb->get_results($sql,ARRAY_A);
return $result?$result:array();
@@ -420,7 +431,7 @@ function wp_update_post($postarr = array()) {
$postarr = get_object_vars($postarr);
// First, get all of the original fields
- $post = wp_get_single_post($postarr['ID'], ARRAY_A);
+ $post = wp_get_single_post($postarr['ID'], ARRAY_A);
// Escape data pulled from DB.
$post = add_magic_quotes($post);
@@ -441,21 +452,33 @@ function wp_update_post($postarr = array()) {
// Merge old and new fields with new fields overwriting old ones.
$postarr = array_merge($post, $postarr);
- $postarr['post_category'] = $post_cats;
+ $postarr['post_category'] = $post_cats;
if ( $clear_date ) {
$postarr['post_date'] = '';
$postarr['post_date_gmt'] = '';
}
- if ($postarr['post_status'] == 'attachment')
+ if ($postarr['post_type'] == 'attachment')
return wp_insert_attachment($postarr);
return wp_insert_post($postarr);
}
+function wp_publish_post($post_id) {
+ $post = get_post($post_id);
+
+ if ( empty($post) )
+ return;
+
+ if ( 'publish' == $post->post_status )
+ return;
+
+ return wp_update_post(array('post_status' => 'publish', 'ID' => $post_id));
+}
+
function wp_get_post_cats($blogid = '1', $post_ID = 0) {
global $wpdb;
-
+
$sql = "SELECT category_id
FROM $wpdb->post2cat
WHERE post_id = $post_ID
@@ -474,7 +497,7 @@ function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array(
// If $post_categories isn't already an array, make it one:
if (!is_array($post_categories) || 0 == count($post_categories))
$post_categories = array(get_option('default_category'));
-
+
$post_categories = array_unique($post_categories);
// First the old categories
@@ -482,7 +505,7 @@ function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array(
SELECT category_id
FROM $wpdb->post2cat
WHERE post_id = $post_ID");
-
+
if (!$old_categories) {
$old_categories = array();
} else {
@@ -512,13 +535,13 @@ function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array(
VALUES ($post_ID, $new_cat)");
}
}
-
+
// Update category counts.
$all_affected_cats = array_unique(array_merge($post_categories, $old_categories));
foreach ( $all_affected_cats 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'");
+ $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->post2cat, $wpdb->posts WHERE $wpdb->posts.ID=$wpdb->post2cat.post_id AND post_status = 'publish' AND post_type = 'post' 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_cache_delete($cat_id, 'category');
}
} // wp_set_post_cats()
@@ -529,12 +552,12 @@ function wp_delete_post($postid = 0) {
if ( !$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = $postid") )
return $post;
- if ( 'attachment' == $post->post_status )
+ if ( 'attachment' == $post->post_type )
return wp_delete_attachment($postid);
do_action('delete_post', $postid);
- if ( 'publish' == $post->post_status) {
+ if ( 'publish' == $post->post_status && 'post' == $post->post_type ) {
$categories = wp_get_post_cats('', $post->ID);
if( is_array( $categories ) ) {
foreach ( $categories as $cat_id ) {
@@ -544,18 +567,18 @@ function wp_delete_post($postid = 0) {
}
}
- if ( 'static' == $post->post_status )
- $wpdb->query("UPDATE $wpdb->posts SET post_parent = $post->post_parent WHERE post_parent = $postid AND post_status = 'static'");
+ if ( 'page' == $post->post_type )
+ $wpdb->query("UPDATE $wpdb->posts SET post_parent = $post->post_parent WHERE post_parent = $postid AND post_type = 'page'");
$wpdb->query("DELETE FROM $wpdb->posts WHERE ID = $postid");
-
+
$wpdb->query("DELETE FROM $wpdb->comments WHERE comment_post_ID = $postid");
$wpdb->query("DELETE FROM $wpdb->post2cat WHERE post_id = $postid");
$wpdb->query("DELETE FROM $wpdb->postmeta WHERE post_id = $postid");
- if ( 'static' == $post->post_status ) {
+ if ( 'page' == $post->type ) {
wp_cache_delete('all_page_ids', 'pages');
$wp_rewrite->flush_rules();
}
@@ -575,17 +598,17 @@ function post_permalink($post_id = 0, $mode = '') { // $mode legacy
// Get the name of a category from its ID
function get_cat_name($cat_id) {
global $wpdb;
-
+
$cat_id -= 0; // force numeric
$name = $wpdb->get_var("SELECT cat_name FROM $wpdb->categories WHERE cat_ID=$cat_id");
-
+
return $name;
}
// Get the ID of a category from its name
function get_cat_ID($cat_name='General') {
global $wpdb;
-
+
$cid = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$cat_name'");
return $cid?$cid:1; // default to cat 1
@@ -619,14 +642,14 @@ function trackback_url_list($tb_list, $post_id) {
// import postdata as variables
extract($postdata);
-
+
// form an excerpt
$excerpt = strip_tags($post_excerpt?$post_excerpt:$post_content);
-
+
if (strlen($excerpt) > 255) {
$excerpt = substr($excerpt,0,252) . '...';
}
-
+
$trackback_urls = explode(',', $tb_list);
foreach($trackback_urls as $tb_url) {
$tb_url = trim($tb_url);
@@ -643,6 +666,8 @@ function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_age
if ( preg_match_all('/&#(\d+);/', $comment . $author . $url, $chars) ) {
foreach ($chars[1] as $char) {
// If it's an encoded char in the normal ASCII set, reject
+ if ( 38 == $char )
+ continue; // Unless it's &
if ($char < 128)
return true;
}
@@ -662,7 +687,7 @@ function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_age
// Do some escaping magic so that '#' chars in the
// spam words don't break things:
$word = preg_quote($word, '#');
-
+
$pattern = "#$word#i";
if ( preg_match($pattern, $author ) ) return true;
if ( preg_match($pattern, $email ) ) return true;
@@ -671,7 +696,7 @@ function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_age
if ( preg_match($pattern, $user_ip ) ) return true;
if ( preg_match($pattern, $user_agent) ) return true;
}
-
+
if ( isset($_SERVER['REMOTE_ADDR']) ) {
if ( wp_proxy_check($_SERVER['REMOTE_ADDR']) ) return true;
}
@@ -700,7 +725,7 @@ function do_trackbacks($post_id) {
$wpdb->query("UPDATE $wpdb->posts SET to_ping = '' WHERE ID = '$post_id'");
return;
}
-
+
if (empty($post->post_excerpt))
$excerpt = apply_filters('the_content', $post->post_content);
else
@@ -788,38 +813,38 @@ function get_page_hierarchy($posts, $parent = 0) {
return $result;
}
-function generate_page_rewrite_rules() {
+function generate_page_uri_index() {
global $wpdb;
-
+
//get pages in order of hierarchy, i.e. children after parents
- $posts = get_page_hierarchy($wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_status = 'static'"));
+ $posts = get_page_hierarchy($wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'page'"));
//now reverse it, because we need parents after children for rewrite rules to work properly
$posts = array_reverse($posts, true);
- $page_rewrite_rules = array();
- $page_attachment_rewrite_rules = array();
+ $page_uris = array();
+ $page_attachment_uris = array();
if ($posts) {
-
+
foreach ($posts as $id => $post) {
// URI => page name
$uri = get_page_uri($id);
- $attachments = $wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_status = 'attachment' AND post_parent = '$id'");
+ $attachments = $wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = '$id'");
if ( $attachments ) {
foreach ( $attachments as $attachment ) {
$attach_uri = get_page_uri($attachment->ID);
- $page_attachment_rewrite_rules[$attach_uri] = $attachment->post_name;
+ $page_attachment_uris[$attach_uri] = $attachment->ID;
}
}
- $page_rewrite_rules[$uri] = $post;
+ $page_uris[$uri] = $id;
}
- update_option('page_uris', $page_rewrite_rules);
-
- if ( $page_attachment_rewrite_rules )
- update_option('page_attachment_uris', $page_attachment_rewrite_rules);
+ update_option('page_uris', $page_uris);
+
+ if ( $page_attachment_uris )
+ update_option('page_attachment_uris', $page_attachment_uris);
}
}
@@ -827,7 +852,7 @@ function get_post_status($ID = '') {
$post = get_post($ID);
if ( is_object($post) ) {
- if ( ('attachment' == $post->post_status) && $post->post_parent && ($post->ID != $post->post_parent) )
+ if ( ('attachment' == $post->post_type) && $post->post_parent && ($post->ID != $post->post_parent) )
return get_post_status($post->post_parent);
else
return $post->post_status;
@@ -836,6 +861,20 @@ function get_post_status($ID = '') {
return false;
}
+function get_post_type($post = false) {
+ global $wpdb, $posts;
+
+ if ( false === $post )
+ $post = $posts[0];
+ elseif ( (int) $post )
+ $post = get_post($post, OBJECT);
+
+ if ( is_object($post) )
+ return $post->post_type;
+
+ return false;
+}
+
// Takes a post ID, returns its mime type.
function get_post_mime_type($ID = '') {
$post = & get_post($ID);
@@ -867,7 +906,7 @@ function wp_mkdir_p($target) {
return true;
} else {
if ( is_dir(dirname($target)) )
- return false;
+ return false;
}
// If the above failed, attempt to create the parent node, then try again.
@@ -918,7 +957,7 @@ function wp_upload_bits($name, $type, $bits) {
return array('error' => "Empty filename");
$upload = wp_upload_dir();
-
+
if ( $upload['error'] !== false )
return $upload;
@@ -936,7 +975,7 @@ function wp_upload_bits($name, $type, $bits) {
else
$filename = str_replace("$number$ext", ++$number . $ext, $filename);
}
-
+
$new_file = $upload['path'] . "/$filename";
if ( ! wp_mkdir_p( dirname($new_file) ) ) {
$message = sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?'), dirname($new_file));
@@ -946,7 +985,7 @@ function wp_upload_bits($name, $type, $bits) {
$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
diff --git a/wp-inst/wp-includes/functions.php b/wp-inst/wp-includes/functions.php
index c596a98..136897c 100644
--- a/wp-inst/wp-includes/functions.php
+++ b/wp-inst/wp-includes/functions.php
@@ -22,7 +22,7 @@ function mysql2date($dateformatstring, $mysqlstring, $translate = true) {
return false;
}
$i = mktime(substr($m,11,2),substr($m,14,2),substr($m,17,2),substr($m,5,2),substr($m,8,2),substr($m,0,4));
-
+
if ( -1 == $i || false == $i )
$i = 0;
@@ -110,17 +110,16 @@ function get_lastpostdate($timezone = 'server') {
global $cache_lastpostdate, $pagenow, $wpdb;
$add_seconds_blog = get_settings('gmt_offset') * 3600;
$add_seconds_server = date('Z');
- $now = current_time('mysql', 1);
if ( !isset($cache_lastpostdate[$timezone]) ) {
switch(strtolower($timezone)) {
case 'gmt':
- $lastpostdate = $wpdb->get_var("SELECT post_date_gmt FROM $wpdb->posts WHERE post_date_gmt <= '$now' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");
+ $lastpostdate = $wpdb->get_var("SELECT post_date_gmt FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");
break;
case 'blog':
- $lastpostdate = $wpdb->get_var("SELECT post_date FROM $wpdb->posts WHERE post_date_gmt <= '$now' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");
+ $lastpostdate = $wpdb->get_var("SELECT post_date FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");
break;
case 'server':
- $lastpostdate = $wpdb->get_var("SELECT DATE_ADD(post_date_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_date_gmt <= '$now' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");
+ $lastpostdate = $wpdb->get_var("SELECT DATE_ADD(post_date_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");
break;
}
$cache_lastpostdate[$timezone] = $lastpostdate;
@@ -134,17 +133,16 @@ function get_lastpostmodified($timezone = 'server') {
global $cache_lastpostmodified, $pagenow, $wpdb;
$add_seconds_blog = get_settings('gmt_offset') * 3600;
$add_seconds_server = date('Z');
- $now = current_time('mysql', 1);
if ( !isset($cache_lastpostmodified[$timezone]) ) {
switch(strtolower($timezone)) {
case 'gmt':
- $lastpostmodified = $wpdb->get_var("SELECT post_modified_gmt FROM $wpdb->posts WHERE post_modified_gmt <= '$now' AND post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
+ $lastpostmodified = $wpdb->get_var("SELECT post_modified_gmt FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
break;
case 'blog':
- $lastpostmodified = $wpdb->get_var("SELECT post_modified FROM $wpdb->posts WHERE post_modified_gmt <= '$now' AND post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
+ $lastpostmodified = $wpdb->get_var("SELECT post_modified FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
break;
case 'server':
- $lastpostmodified = $wpdb->get_var("SELECT DATE_ADD(post_modified_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_modified_gmt <= '$now' AND post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
+ $lastpostmodified = $wpdb->get_var("SELECT DATE_ADD(post_modified_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
break;
}
$lastpostdate = get_lastpostdate($timezone);
@@ -171,7 +169,7 @@ function user_pass_ok($user_login,$user_pass) {
function get_usernumposts($userid) {
global $wpdb;
- return $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '$userid' AND post_status = 'publish'");
+ return $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '$userid' AND post_type = 'post' AND post_status = 'publish'");
}
@@ -312,7 +310,7 @@ function get_option($option) {
function get_user_option( $option, $user = 0 ) {
global $wpdb, $current_user;
-
+
if ( empty($user) )
$user = $current_user;
else
@@ -580,7 +578,7 @@ function &get_post(&$post, $output = OBJECT) {
else
$_post = null;
} elseif ( is_object($post) ) {
- if ( 'static' == $post->post_status )
+ if ( 'page' == $post->post_type )
return get_page($post, $output);
if ( !isset($post_cache[$post->ID]) )
$post_cache[$post->ID] = &$post;
@@ -593,7 +591,7 @@ function &get_post(&$post, $output = OBJECT) {
else {
$query = "SELECT * FROM $wpdb->posts WHERE ID = '$post' LIMIT 1";
$_post = & $wpdb->get_row($query);
- if ( 'static' == $_post->post_status )
+ if ( 'page' == $_post->post_type )
return get_page($_post, $output);
$post_cache[$post] = & $_post;
}
@@ -665,12 +663,43 @@ function set_page_path($page) {
$curpage = get_page($curpage->post_parent);
$path = '/' . $curpage->post_name . $path;
}
-
+
$page->fullpath = $path;
return $page;
}
+function get_page_by_path($page_path) {
+ global $wpdb;
+ $page_path = rawurlencode(urldecode($page_path));
+ $page_path = str_replace('%2F', '/', $page_path);
+ $page_path = str_replace('%20', ' ', $page_path);
+ $page_paths = '/' . trim($page_path, '/');
+ $leaf_path = sanitize_title(basename($page_paths));
+ $page_paths = explode('/', $page_paths);
+ foreach($page_paths as $pathdir)
+ $full_path .= ($pathdir!=''?'/':'') . sanitize_title($pathdir);
+
+ $pages = $wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_name = '$leaf_path'");
+
+ if ( empty($pages) )
+ return 0;
+
+ foreach ($pages as $page) {
+ $path = '/' . $leaf_path;
+ $curpage = $page;
+ while ($curpage->post_parent != 0) {
+ $curpage = $wpdb->get_row("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE ID = '$curpage->post_parent'");
+ $path = '/' . $curpage->post_name . $path;
+ }
+
+ if ( $path == $full_path )
+ return $page->ID;
+ }
+
+ return 0;
+}
+
// Retrieves page data given a page ID or page object.
// Handles page caching.
function &get_page(&$page, $output = OBJECT) {
@@ -684,7 +713,7 @@ function &get_page(&$page, $output = OBJECT) {
$_page = null;
}
} elseif ( is_object($page) ) {
- if ( 'static' != $page->post_status )
+ if ( 'post' == $page->post_type )
return get_post($page, $output);
wp_cache_add($page->ID, $page, 'pages');
$_page = $page;
@@ -699,15 +728,15 @@ function &get_page(&$page, $output = OBJECT) {
} else {
$query = "SELECT * FROM $wpdb->posts WHERE ID= '$page' LIMIT 1";
$_page = & $wpdb->get_row($query);
- if ( 'static' != $_page->post_status )
+ if ( 'post' == $_page->post_type )
return get_post($_page, $output);
wp_cache_add($_page->ID, $_page, 'pages');
}
}
-
+
if (!isset($_page->fullpath)) {
$_page = set_page_path($_page);
- wp_cache_replace($_page->cat_ID, $_page, 'pages');
+ wp_cache_replace($_page->ID, $_page, 'pages');
}
if ( $output == OBJECT ) {
@@ -729,7 +758,7 @@ function set_category_path($cat) {
$curcat = get_category($curcat->category_parent);
$path = '/' . $curcat->category_nicename . $path;
}
-
+
$cat->fullpath = $path;
return $cat;
@@ -755,7 +784,7 @@ function &get_category(&$category, $output = OBJECT) {
if ( !isset($_category->fullpath) ) {
$_category = set_category_path($_category);
- wp_cache_replace($_category->cat_ID, $_category, 'category');
+ wp_cache_replace($_category->cat_ID, $_category, 'category');
}
if ( $output == OBJECT ) {
@@ -808,23 +837,23 @@ function get_catname($cat_ID) {
function get_all_category_ids() {
global $wpdb;
-
+
if ( ! $cat_ids = wp_cache_get('all_category_ids', 'category') ) {
$cat_ids = $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories");
wp_cache_add('all_category_ids', $cat_ids, 'category');
}
-
+
return $cat_ids;
}
function get_all_page_ids() {
global $wpdb;
-
+
if ( ! $page_ids = wp_cache_get('all_page_ids', 'pages') ) {
- $page_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_status='static'");
+ $page_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type = 'page'");
wp_cache_add('all_page_ids', $page_ids, 'pages');
}
-
+
return $page_ids;
}
@@ -1326,12 +1355,10 @@ function get_posts($args) {
if ( !isset($r['order']) )
$r['order'] = 'DESC';
- $now = current_time('mysql');
-
$posts = $wpdb->get_results(
"SELECT DISTINCT * FROM $wpdb->posts " .
( empty( $r['category'] ) ? "" : ", $wpdb->post2cat " ) .
- " WHERE post_date <= '$now' AND (post_status = 'publish') ".
+ " WHERE (post_type = 'post' AND post_status = 'publish') ".
( empty( $r['category'] ) ? "" : "AND $wpdb->posts.ID = $wpdb->post2cat.post_id AND $wpdb->post2cat.category_id = " . $r['category']. " " ) .
" GROUP BY $wpdb->posts.ID ORDER BY " . $r['orderby'] . " " . $r['order'] . " LIMIT " . $r['offset'] . ',' . $r['numberposts'] );
@@ -1396,7 +1423,7 @@ function update_post_category_cache($post_ids) {
if ( empty($dogs) )
return;
-
+
foreach ($dogs as $catt)
$category_cache[$catt->post_id][$catt->category_id] = &get_category($catt->category_id);
}
@@ -1503,7 +1530,7 @@ function is_attachment () {
function is_preview() {
global $wp_query;
-
+
return $wp_query->is_preview;
}
@@ -2157,7 +2184,7 @@ function wp_remote_fopen( $uri ) {
function wp($query_vars = '') {
global $wp;
-
+
$wp->main($query_vars);
}
@@ -2227,7 +2254,7 @@ function update_usermeta( $user_id, $meta_key, $meta_value ) {
if ( is_array($meta_value) || is_object($meta_value) )
$meta_value = serialize($meta_value);
$meta_value = trim( $meta_value );
-
+
if (empty($meta_value)) {
delete_usermeta($user_id, $meta_key);
}
@@ -2240,13 +2267,13 @@ function update_usermeta( $user_id, $meta_key, $meta_value ) {
} else if ( $cur->meta_value != $meta_value ) {
$wpdb->query("UPDATE $wpdb->usermeta SET meta_value = '$meta_value' WHERE user_id = '$user_id' AND meta_key = '$meta_key'");
} else {
- return false;
+ return false;
}
-
+
$user = get_userdata($user_id);
wp_cache_delete($user_id, 'users');
wp_cache_delete($user->user_login, 'userlogins');
-
+
return true;
}
@@ -2264,11 +2291,11 @@ function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) {
$wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = '$user_id' AND meta_key = '$meta_key' AND meta_value = '$meta_value'");
else
$wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = '$user_id' AND meta_key = '$meta_key'");
-
+
$user = get_userdata($user_id);
wp_cache_delete($user_id, 'users');
wp_cache_delete($user->user_login, 'userlogins');
-
+
return true;
}
@@ -2295,4 +2322,70 @@ function get_num_queries() {
return $wpdb->num_queries;
}
+function wp_schedule_event($timestamp, $recurrence, $hook) {
+ $args = array_slice(func_get_args(), 3);
+ $crons = get_option('cron');
+ $crons[$timestamp][$hook] = array('recur' => $recurrence, 'args' => $args);
+ ksort($crons);
+ update_option('cron', $crons);
+}
+
+function wp_unschedule_event($timestamp, $hook) {
+ $crons = get_option('cron');
+ unset($crons[$timestamp][$hook]);
+ if ( empty($crons[$timestamp]) )
+ unset($crons[$timestamp]);
+ update_option('cron', $crons);
+}
+
+function wp_clear_scheduled_hook($hook) {
+ while($timestamp = next_scheduled('scheduled_hook'))
+ wp_unschedule_event($timestamp, 'scheduled_hook');
+}
+
+function next_scheduled($hook) {
+ $crons = get_option('cron');
+ if ( empty($crons) )
+ return false;
+ foreach($crons as $timestamp => $cron) {
+ //if($timestamp <= time()) continue;
+ if(isset($cron[$hook])) return $timestamp;
+ }
+ return false;
+}
+
+function spawn_cron() {
+ if (array_shift(array_keys(get_option('cron'))) > time()) return;
+
+ $cron_url = get_settings('siteurl') . '/wp-cron.php';
+ $parts = parse_url($cron_url);
+ $argyle = @ fsockopen($parts['host'], $_SERVER['SERVER_PORT'], $errno, $errstr, 0.01);
+ if ( $argyle )
+ fputs($argyle, "GET {$parts['path']}?time=" . time() . '&check='
+ . md5(DB_PASS . '187425') . " HTTP/1.0\r\nHost: {$_SERVER['HTTP_HOST']}\r\n\r\n");
+}
+
+function wp_cron() {
+ $crons = get_option('cron');
+ if (!is_array($crons) || array_shift(array_keys($crons)) > time())
+ return;
+
+ foreach ($crons as $timestamp => $cronhooks) {
+ if ($timestamp > time()) break;
+ foreach($cronhooks as $hook => $args) {
+ do_action($hook, $args['args']);
+ $recurrence = $args['recur'];
+ if ( 'hourly' == $recurrence ) {
+ $args = array_merge( array($timestamp + 3600, $recurrence, $hook), $args['args']);
+ call_user_func_array('wp_schedule_event', $args);
+ } else if ( 'daily' == $recurrence ) {
+ $args = array_merge( array($timestamp + 86400, $recurrence, $hook), $args['args']);
+ call_user_func_array('wp_schedule_event', $args);
+ }
+
+ wp_unschedule_event($timestamp, $hook);
+ }
+ }
+}
+
?>
diff --git a/wp-inst/wp-includes/js/colorpicker.js b/wp-inst/wp-includes/js/colorpicker.js
index 2f0438e..7d729db 100644
--- a/wp-inst/wp-includes/js/colorpicker.js
+++ b/wp-inst/wp-includes/js/colorpicker.js
@@ -139,7 +139,7 @@ function AnchorPosition_getPageOffsetLeft (el) {
}
function AnchorPosition_getWindowOffsetLeft (el) {
return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft;
- }
+ }
function AnchorPosition_getPageOffsetTop (el) {
var ot=el.offsetTop;
while((el=el.offsetParent) != null) { ot += el.offsetTop; }
@@ -434,7 +434,7 @@ function PopupWindow() {
this.populated = false;
this.visible = false;
this.autoHideEnabled = false;
-
+
this.contents = "";
this.url="";
this.windowProperties="toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,resizable,alwaysRaised,dependent,titlebar=no";
@@ -556,7 +556,7 @@ function ColorPicker_select(inputobj,linkname) {
window.ColorPicker_targetInput = inputobj;
this.show(linkname);
}
-
+
// This function runs when you move your mouse over a color block, if you have a newer browser
function ColorPicker_highlightColor(c) {
var thedoc = (arguments.length>1)?arguments[1]:window.document;
@@ -579,7 +579,7 @@ function ColorPicker() {
else {
var divname = arguments[0];
}
-
+
if (divname != "") {
var cp = new PopupWindow(divname);
}
@@ -590,7 +590,7 @@ function ColorPicker() {
// Object variables
cp.currentValue = "#FFFFFF";
-
+
// Method Mappings
cp.writeDiv = ColorPicker_writeDiv;
cp.highlightColor = ColorPicker_highlightColor;
diff --git a/wp-inst/wp-includes/js/fat.js b/wp-inst/wp-includes/js/fat.js
index e73bc50..ded85ae 100644
--- a/wp-inst/wp-includes/js/fat.js
+++ b/wp-inst/wp-includes/js/fat.js
@@ -31,22 +31,22 @@ var Fat = {
if (!duration) duration = 3000;
if (!from || from=="#") from = "#FFFF33";
if (!to) to = this.get_bgcolor(id);
-
+
var frames = Math.round(fps * (duration / 1000));
var interval = duration / frames;
var delay = interval;
var frame = 0;
-
+
if (from.length < 7) from += from.substr(1,3);
if (to.length < 7) to += to.substr(1,3);
-
+
var rf = parseInt(from.substr(1,2),16);
var gf = parseInt(from.substr(3,2),16);
var bf = parseInt(from.substr(5,2),16);
var rt = parseInt(to.substr(1,2),16);
var gt = parseInt(to.substr(3,2),16);
var bt = parseInt(to.substr(5,2),16);
-
+
var r,g,b,h;
while (frame < frames)
{
@@ -54,7 +54,7 @@ var Fat = {
g = Math.floor(gf * ((frames-frame)/frames) + gt * (frame/frames));
b = Math.floor(bf * ((frames-frame)/frames) + bt * (frame/frames));
h = this.make_hex(r,g,b);
-
+
setTimeout("Fat.set_bgcolor('"+id+"','"+h+"')", delay);
frame++;
@@ -87,4 +87,4 @@ var Fat = {
addLoadEvent(function () {
Fat.fade_all();
-}); \ No newline at end of file
+});
diff --git a/wp-inst/wp-includes/js/quicktags.js b/wp-inst/wp-includes/js/quicktags.js
index be628e0..12a95c7 100644
--- a/wp-inst/wp-includes/js/quicktags.js
+++ b/wp-inst/wp-includes/js/quicktags.js
@@ -205,7 +205,7 @@ function edCheckOpenTags(button) {
else {
return false; // tag not found
}
-}
+}
function edCloseAllTags() {
var count = edOpenTags.length;
diff --git a/wp-inst/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js b/wp-inst/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js
index 9f0957f..697ba72 100644
--- a/wp-inst/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js
+++ b/wp-inst/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js
@@ -87,13 +87,13 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
// Is selection a image
if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
flag = getAttrib(focusElm, 'class');
-
+
if (flag != 'mce_plugin_wordpress_more') // Not a wordpress
return true;
-
+
action = "update";
}
-
+
html = ''
+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
+ ' width="100%" height="10px" '
@@ -105,17 +105,17 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
var flag = "";
var template = new Array();
var altPage = tinyMCE.getLang('lang_wordpress_more_alt');
-
+
// Is selection a image
if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
flag = getAttrib(focusElm, 'name');
-
+
if (flag != 'mce_plugin_wordpress_page') // Not a wordpress
return true;
-
+
action = "update";
}
-
+
html = ''
+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
+ ' width="100%" height="10px" '
@@ -131,7 +131,7 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
function TinyMCE_wordpress_cleanup(type, content) {
switch (type) {
-
+
case "insert_to_editor":
var startPos = 0;
var altMore = tinyMCE.getLang('lang_wordpress_more_alt');
@@ -178,9 +178,9 @@ function TinyMCE_wordpress_cleanup(type, content) {
if (attribs['class'] == "mce_plugin_wordpress_more") {
endPos += 2;
-
+
var embedHTML = '<!--more-->';
-
+
// Insert embed/object chunk
chunkBefore = content.substring(0, startPos);
chunkAfter = content.substring(endPos);
@@ -188,9 +188,9 @@ function TinyMCE_wordpress_cleanup(type, content) {
}
if (attribs['class'] == "mce_plugin_wordpress_page") {
endPos += 2;
-
+
var embedHTML = '<!--nextpage-->';
-
+
// Insert embed/object chunk
chunkBefore = content.substring(0, startPos);
chunkAfter = content.substring(endPos);
@@ -221,7 +221,7 @@ function TinyMCE_wordpress_cleanup(type, content) {
content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'mg'), '<br />\n');
content = content.replace(new RegExp('^\\s*', ''), '');
content = content.replace(new RegExp('\\s*$', ''), '');
-
+
break;
}
diff --git a/wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/image.js b/wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/image.js
index 752e421..d97e79b 100644
--- a/wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/image.js
+++ b/wp-inst/wp-includes/js/tinymce/themes/advanced/jscripts/image.js
@@ -61,7 +61,7 @@ var preloadImg = new Image();
function resetImageData() {
var formObj = document.forms[0];
- formObj.width.value = formObj.height.value = "";
+ formObj.width.value = formObj.height.value = "";
}
function updateImageData() {
diff --git a/wp-inst/wp-includes/js/tinymce/tiny_mce.js b/wp-inst/wp-includes/js/tinymce/tiny_mce.js
index 3f6c6bf..4e92fdc 100644
--- a/wp-inst/wp-includes/js/tinymce/tiny_mce.js
+++ b/wp-inst/wp-includes/js/tinymce/tiny_mce.js
@@ -353,7 +353,7 @@ TinyMCE.prototype.updateContent = function(form_element_name) {
if (inst.formElement == formElement) {
var doc = inst.getDoc();
-
+
tinyMCE._setHTML(doc, inst.formElement.value);
if (!tinyMCE.isMSIE)
diff --git a/wp-inst/wp-includes/js/tinymce/wp-mce-help.php b/wp-inst/wp-includes/js/tinymce/wp-mce-help.php
index f347c92..a193ab9 100644
--- a/wp-inst/wp-includes/js/tinymce/wp-mce-help.php
+++ b/wp-inst/wp-includes/js/tinymce/wp-mce-help.php
@@ -93,7 +93,7 @@ require_once('../../../wp-config.php');
c = d('content'+i.toString());
t = d('tab'+i.toString());
if ( n == i ) {
- c.className = '';
+ c.className = '';
t.className = 'current';
} else {
c.className = 'hidden';
diff --git a/wp-inst/wp-includes/js/tw-sack.js b/wp-inst/wp-includes/js/tw-sack.js
index 956b3f0..cb275e1 100644
--- a/wp-inst/wp-includes/js/tw-sack.js
+++ b/wp-inst/wp-includes/js/tw-sack.js
@@ -32,7 +32,7 @@ function sack(file){
this.failed = true;
}
};
-
+
this.setVar = function(name, value){
if (this.URLString.length < 3){
this.URLString = name + "=" + value;
@@ -40,12 +40,12 @@ function sack(file){
this.URLString += "&" + name + "=" + value;
}
}
-
+
this.encVar = function(name, value){
var varString = encodeURIComponent(name) + "=" + encodeURIComponent(value);
return varString;
}
-
+
this.encodeURLString = function(string){
varArray = string.split('&');
for (i = 0; i < varArray.length; i++){
@@ -57,11 +57,11 @@ function sack(file){
}
return varArray.join('&');
}
-
+
this.runResponse = function(){
eval(this.response);
}
-
+
this.runAJAX = function(urlstring){
this.responseStatus = new Array(2);
if(this.failed && this.AjaxFailedAlert){
@@ -130,4 +130,4 @@ function sack(file){
}
};
this.createAJAX();
-} \ No newline at end of file
+}
diff --git a/wp-inst/wp-includes/pluggable-functions.php b/wp-inst/wp-includes/pluggable-functions.php
index c388e44..0795b05 100644
--- a/wp-inst/wp-includes/pluggable-functions.php
+++ b/wp-inst/wp-includes/pluggable-functions.php
@@ -62,7 +62,7 @@ function get_userdata( $user_id ) {
return false;
$user = wp_cache_get($user_id, 'users');
-
+
if ( $user )
return $user;
@@ -93,10 +93,10 @@ function get_userdata( $user_id ) {
$user->user_lastname = $user->last_name;
if ( isset($user->description) )
$user->user_description = $user->description;
-
+
wp_cache_add($user_id, $user, 'users');
wp_cache_add($user->user_login, $user, 'userlogins');
-
+
return $user;
}
endif;
@@ -114,7 +114,7 @@ function get_userdatabylogin($user_login) {
if ( empty( $user_login ) )
return false;
-
+
$userdata = wp_cache_get($user_login, 'userlogins');
if ( $userdata )
return $userdata;
@@ -208,7 +208,7 @@ endif;
if ( !function_exists('is_user_logged_in') ) :
function is_user_logged_in() {
global $current_user;
-
+
if ( $current_user->id == 0 )
return false;
return true;
@@ -222,7 +222,7 @@ function auth_redirect() {
!wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true)) ||
(empty($_COOKIE[USER_COOKIE])) ) {
nocache_headers();
-
+
header('Location: ' . get_settings('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI']));
exit();
}
@@ -309,9 +309,9 @@ function wp_notify_postauthor($comment_id, $comment_type='') {
$comment_author_domain = gethostbyaddr($comment->comment_author_IP);
$blogname = get_settings('blogname');
-
+
if ( empty( $comment_type ) ) $comment_type = 'comment';
-
+
if ('comment' == $comment_type) {
$notify_message = sprintf( __('New comment on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n";
$notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
@@ -413,14 +413,14 @@ endif;
if ( !function_exists('wp_new_user_notification') ) :
function wp_new_user_notification($user_id, $plaintext_pass = '') {
$user = new WP_User($user_id);
-
+
$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";
$message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
-
+
@wp_mail(get_settings('admin_email'), sprintf(__('[%s] New User Registration'), get_settings('blogname')), $message);
if ( empty($plaintext_pass) )
@@ -429,9 +429,9 @@ function wp_new_user_notification($user_id, $plaintext_pass = '') {
$message = sprintf(__('Username: %s'), $user_login) . "\r\n";
$message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
$message .= get_settings('siteurl') . "/wp-login.php\r\n";
-
+
wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_settings('blogname')), $message);
-
+
}
endif;
diff --git a/wp-inst/wp-includes/registration-functions.php b/wp-inst/wp-includes/registration-functions.php
index ff9db3d..26f0a80 100644
--- a/wp-inst/wp-includes/registration-functions.php
+++ b/wp-inst/wp-includes/registration-functions.php
@@ -10,14 +10,22 @@ function username_exists( $username ) {
return null;
}
+function email_exists( $email ) {
+ global $wpdb;
+ $email = addslashes( $email );
+ $email_exists = $wpdb->get_row("SELECT user_email FROM $wpdb->users WHERE user_email = '$email'");
+ if ( $email_exists)
+ return true;
+}
+
function validate_username( $username ) {
$name = sanitize_user($username, true);
$valid = true;
if ( $name != $username )
- $valid = false;
+ $valid = false;
- return apply_filters('validate_username', $valid, $username);
+ return apply_filters('validate_username', $valid, $username);
}
function wp_insert_user($userdata) {
@@ -33,7 +41,7 @@ function wp_insert_user($userdata) {
// Password is not hashed when creating new user.
$user_pass = md5($user_pass);
}
-
+
$user_login = sanitize_user($user_login, true);
if ( empty($user_nicename) )
@@ -41,10 +49,10 @@ function wp_insert_user($userdata) {
if ( empty($display_name) )
$display_name = $user_login;
-
+
if ( empty($nickname) )
$nickname = $user_login;
-
+
if ( empty($user_registered) )
$user_registered = gmdate('Y-m-d H:i:s');
@@ -62,7 +70,7 @@ function wp_insert_user($userdata) {
$wpdb->query( $query );
$user_id = $wpdb->insert_id;
}
-
+
update_usermeta( $user_id, 'first_name', $first_name);
update_usermeta( $user_id, 'last_name', $last_name);
update_usermeta( $user_id, 'nickname', $nickname );
@@ -83,22 +91,22 @@ function wp_insert_user($userdata) {
wp_cache_delete($user_id, 'users');
wp_cache_delete($user_login, 'userlogins');
-
+
if ( $update )
do_action('profile_update', $user_id);
else
do_action('user_register', $user_id);
-
- return $user_id;
+
+ return $user_id;
}
function wp_update_user($userdata) {
global $wpdb, $current_user;
$ID = (int) $userdata['ID'];
-
+
// First, get all of the original fields
- $user = get_userdata($ID);
+ $user = get_userdata($ID);
// Escape data pulled from DB.
$user = add_magic_quotes(get_object_vars($user));
@@ -113,20 +121,20 @@ function wp_update_user($userdata) {
$userdata = array_merge($user, $userdata);
$user_id = wp_insert_user($userdata);
- // Update the cookies if the password changed.
+ // Update the cookies if the password changed.
if( $current_user->id == $ID ) {
if ( isset($plaintext_pass) ) {
wp_clearcookie();
wp_setcookie($userdata['user_login'], $plaintext_pass);
}
}
-
+
return $user_id;
}
function wp_create_user( $username, $password, $email = '') {
global $wpdb;
-
+
$user_login = $wpdb->escape( $username );
$user_email = $wpdb->escape( $email );
$user_pass = $password;
@@ -137,7 +145,7 @@ function wp_create_user( $username, $password, $email = '') {
function create_user( $username, $password, $email ) {
- return wp_create_user( $username, $password, $email );
+ return wp_create_user( $username, $password, $email );
}
diff --git a/wp-inst/wp-includes/rss-functions.php b/wp-inst/wp-includes/rss-functions.php
index 71e4151..0c37c5a 100644
--- a/wp-inst/wp-includes/rss-functions.php
+++ b/wp-inst/wp-includes/rss-functions.php
@@ -30,37 +30,37 @@ class MagpieRSS {
var $inimage = false;
var $current_field = '';
var $current_namespace = false;
-
+
//var $ERROR = "";
-
+
var $_CONTENT_CONSTRUCTS = array('content', 'summary', 'info', 'title', 'tagline', 'copyright');
function MagpieRSS ($source) {
-
+
# if PHP xml isn't compiled in, die
#
if ( !function_exists('xml_parser_create') )
trigger_error( "Failed to load PHP's XML Extension. http://www.php.net/manual/en/ref.xml.php" );
-
+
$parser = @xml_parser_create();
-
+
if ( !is_resource($parser) )
trigger_error( "Failed to create an instance of PHP's XML parser. http://www.php.net/manual/en/ref.xml.php");
-
+
$this->parser = $parser;
-
+
# pass in parser, and a reference to this object
# setup handlers
#
xml_set_object( $this->parser, $this );
xml_set_element_handler($this->parser,
'feed_start_element', 'feed_end_element' );
-
+
xml_set_character_data_handler( $this->parser, 'feed_cdata' );
-
+
$status = xml_parse( $this->parser, $source );
-
+
if (! $status ) {
$errorcode = xml_get_error_code( $this->parser );
if ( $errorcode != XML_ERROR_NONE ) {
@@ -72,16 +72,16 @@ class MagpieRSS {
$this->error( $errormsg );
}
}
-
+
xml_parser_free( $this->parser );
$this->normalize();
}
-
+
function feed_start_element($p, $element, &$attrs) {
$el = $element = strtolower($element);
$attrs = array_change_key_case($attrs, CASE_LOWER);
-
+
// check for a namespace, and split if found
$ns = false;
if ( strpos( $element, ':' ) ) {
@@ -90,7 +90,7 @@ class MagpieRSS {
if ( $ns and $ns != 'rdf' ) {
$this->current_namespace = $ns;
}
-
+
# if feed type isn't set, then this is first element of feed
# identify feed from root element
#
@@ -110,7 +110,7 @@ class MagpieRSS {
}
return;
}
-
+
if ( $el == 'channel' )
{
$this->inchannel = true;
@@ -119,10 +119,10 @@ class MagpieRSS {
{
$this->initem = true;
if ( isset($attrs['rdf:about']) ) {
- $this->current_item['about'] = $attrs['rdf:about'];
+ $this->current_item['about'] = $attrs['rdf:about'];
}
}
-
+
// if we're in the default namespace of an RSS feed,
// record textinput or image fields
elseif (
@@ -132,7 +132,7 @@ class MagpieRSS {
{
$this->intextinput = true;
}
-
+
elseif (
$this->feed_type == RSS and
$this->current_namespace == '' and
@@ -140,7 +140,7 @@ class MagpieRSS {
{
$this->inimage = true;
}
-
+
# handle atom content constructs
elseif ( $this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) )
{
@@ -148,12 +148,12 @@ class MagpieRSS {
if ($el == 'content' ) {
$el = 'atom_content';
}
-
+
$this->incontent = $el;
-
-
+
+
}
-
+
// if inside an Atom content construct (e.g. content or summary) field treat tags as text
elseif ($this->feed_type == ATOM and $this->incontent )
{
@@ -162,12 +162,12 @@ class MagpieRSS {
array_map('map_attrs',
array_keys($attrs),
array_values($attrs) ) );
-
+
$this->append_content( "<$element $attrs_str>" );
-
+
array_unshift( $this->stack, $el );
}
-
+
// Atom support many links per containging element.
// Magpie treats link elements of type rel='alternate'
// as being equivalent to RSS's simple link element.
@@ -181,7 +181,7 @@ class MagpieRSS {
else {
$link_el = 'link_' . $attrs['rel'];
}
-
+
$this->append($link_el, $attrs['href']);
}
// set stack[0] to current element
@@ -189,11 +189,11 @@ class MagpieRSS {
array_unshift($this->stack, $el);
}
}
-
-
+
+
function feed_cdata ($p, $text) {
-
+
if ($this->feed_type == ATOM and $this->incontent)
{
$this->append_content( $text );
@@ -203,10 +203,10 @@ class MagpieRSS {
$this->append($current_el, $text);
}
}
-
+
function feed_end_element ($p, $el) {
$el = strtolower($el);
-
+
if ( $el == 'item' or $el == 'entry' )
{
$this->items[] = $this->current_item;
@@ -222,7 +222,7 @@ class MagpieRSS {
$this->inimage = false;
}
elseif ($this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) )
- {
+ {
$this->incontent = false;
}
elseif ($el == 'channel' or $el == 'feed' )
@@ -245,17 +245,17 @@ class MagpieRSS {
else {
array_shift( $this->stack );
}
-
+
$this->current_namespace = false;
}
-
+
function concat (&$str1, $str2="") {
if (!isset($str1) ) {
$str1="";
}
$str1 .= $str2;
}
-
+
function append_content($text) {
if ( $this->initem ) {
$this->concat( $this->current_item[ $this->incontent ], $text );
@@ -264,7 +264,7 @@ class MagpieRSS {
$this->concat( $this->channel[ $this->incontent ], $text );
}
}
-
+
// smart append - field and namespace aware
function append($el, $text) {
if (!$el) {
@@ -306,10 +306,10 @@ class MagpieRSS {
$this->concat(
$this->channel[ $el ], $text );
}
-
+
}
}
-
+
function normalize () {
// if atom populate rss fields
if ( $this->is_atom() ) {
@@ -320,9 +320,9 @@ class MagpieRSS {
$item['description'] = $item['summary'];
if ( isset($item['atom_content']))
$item['content']['encoded'] = $item['atom_content'];
-
+
$this->items[$i] = $item;
- }
+ }
}
elseif ( $this->is_rss() ) {
$this->channel['tagline'] = $this->channel['description'];
@@ -332,21 +332,21 @@ class MagpieRSS {
$item['summary'] = $item['description'];
if ( isset($item['content']['encoded'] ) )
$item['atom_content'] = $item['content']['encoded'];
-
+
$this->items[$i] = $item;
}
}
}
-
+
function is_rss () {
if ( $this->feed_type == RSS ) {
- return $this->feed_version;
+ return $this->feed_version;
}
else {
return false;
}
}
-
+
function is_atom() {
if ( $this->feed_type == ATOM ) {
return $this->feed_version;
@@ -378,12 +378,12 @@ require_once( dirname(__FILE__) . '/class-snoopy.php');
function fetch_rss ($url) {
// initialize constants
init();
-
+
if ( !isset($url) ) {
// error("fetch_rss called without a url");
return false;
}
-
+
// if cache is disabled
if ( !MAGPIE_CACHE_ON ) {
// fetch file, and parse it
@@ -403,19 +403,19 @@ function fetch_rss ($url) {
// 2. if there is a hit, make sure its fresh
// 3. if cached obj fails freshness check, fetch remote
// 4. if remote fails, return stale object, or error
-
+
$cache = new RSSCache( MAGPIE_CACHE_DIR, MAGPIE_CACHE_AGE );
-
+
if (MAGPIE_DEBUG and $cache->ERROR) {
debug($cache->ERROR, E_USER_WARNING);
}
-
-
+
+
$cache_status = 0; // response of check_cache
$request_headers = array(); // HTTP headers to send with fetch
$rss = 0; // parsed RSS object
$errormsg = 0; // errors, if any
-
+
if (!$cache->ERROR) {
// return cache HIT, MISS, or STALE
$cache_status = $cache->check_cache( $url );
@@ -432,9 +432,9 @@ function fetch_rss ($url) {
return $rss;
}
}
-
+
// else attempt a conditional get
-
+
// setup headers
if ( $cache_status == 'STALE' ) {
$rss = $cache->get( $url );
@@ -443,9 +443,9 @@ function fetch_rss ($url) {
$request_headers['If-Last-Modified'] = $rss->last_modified;
}
}
-
+
$resp = _fetch_remote_file( $url, $request_headers );
-
+
if (isset($resp) and $resp) {
if ($resp->status == '304' ) {
// we have the most current copy
@@ -483,9 +483,9 @@ function fetch_rss ($url) {
else {
$errormsg = "Unable to retrieve RSS file for unknown reasons.";
}
-
+
// else fetch failed
-
+
// attempt to return cached object
if ($rss) {
if ( MAGPIE_DEBUG ) {
@@ -493,12 +493,12 @@ function fetch_rss ($url) {
}
return $rss;
}
-
+
// else we totally failed
- // error( $errormsg );
-
+ // error( $errormsg );
+
return false;
-
+
} // end if ( !MAGPIE_CACHE_ON ) {
} // end fetch_rss()
@@ -511,7 +511,7 @@ function _fetch_remote_file ($url, $headers = "" ) {
if (is_array($headers) ) {
$client->rawheaders = $headers;
}
-
+
@$client->fetch($url);
return $client;
@@ -519,10 +519,10 @@ function _fetch_remote_file ($url, $headers = "" ) {
function _response_to_rss ($resp) {
$rss = new MagpieRSS( $resp->results );
-
- // if RSS parsed successfully
+
+ // if RSS parsed successfully
if ( $rss and !$rss->ERROR) {
-
+
// find Etag, and Last-Modified
foreach($resp->headers as $h) {
// 2003-03-02 - Nicola Asuni (www.tecnick.com) - fixed bug "Undefined offset: 1"
@@ -533,26 +533,26 @@ function _response_to_rss ($resp) {
$field = $h;
$val = "";
}
-
+
if ( $field == 'ETag' ) {
$rss->etag = $val;
}
-
+
if ( $field == 'Last-Modified' ) {
$rss->last_modified = $val;
}
}
-
- return $rss;
+
+ return $rss;
} // else construct error message
else {
$errormsg = "Failed to parse RSS file.";
-
+
if ($rss) {
$errormsg .= " (" . $rss->ERROR . ")";
}
// error($errormsg);
-
+
return false;
} // end if ($rss and !$rss->error)
}
@@ -569,7 +569,7 @@ function init () {
else {
define('MAGPIE_INITALIZED', 1);
}
-
+
if ( !defined('MAGPIE_CACHE_ON') ) {
define('MAGPIE_CACHE_ON', 1);
}
@@ -585,31 +585,31 @@ function init () {
if ( !defined('MAGPIE_CACHE_FRESH_ONLY') ) {
define('MAGPIE_CACHE_FRESH_ONLY', 0);
}
-
+
if ( !defined('MAGPIE_DEBUG') ) {
define('MAGPIE_DEBUG', 0);
}
if ( !defined('MAGPIE_USER_AGENT') ) {
$ua = 'WordPress/' . $wp_version;
-
+
if ( MAGPIE_CACHE_ON ) {
$ua = $ua . ')';
}
else {
$ua = $ua . '; No cache)';
}
-
+
define('MAGPIE_USER_AGENT', $ua);
}
-
+
if ( !defined('MAGPIE_FETCH_TIME_OUT') ) {
define('MAGPIE_FETCH_TIME_OUT', 2); // 2 second timeout
}
-
+
// use gzip encoding to fetch rss files if supported?
if ( !defined('MAGPIE_USE_GZIP') ) {
- define('MAGPIE_USE_GZIP', true);
+ define('MAGPIE_USE_GZIP', true);
}
}
@@ -641,7 +641,7 @@ class RSSCache {
var $BASE_CACHE = 'wp-content/cache'; // where the cache files are stored
var $MAX_AGE = 43200; // when are files stale, default twelve hours
var $ERROR = ''; // accumulate error messages
-
+
function RSSCache ($base='', $age='') {
if ( $base ) {
$this->BASE_CACHE = $base;
@@ -649,14 +649,14 @@ class RSSCache {
if ( $age ) {
$this->MAX_AGE = $age;
}
-
+
}
-
+
/*=======================================================================*\
Function: set
Purpose: add an item to the cache, keyed on url
Input: url from wich the rss file was fetched
- Output: true on sucess
+ Output: true on sucess
\*=======================================================================*/
function set ($url, $rss) {
global $wpdb;
@@ -673,26 +673,26 @@ class RSSCache {
return $cache_option;
}
-
+
/*=======================================================================*\
Function: get
Purpose: fetch an item from the cache
Input: url from wich the rss file was fetched
- Output: cached object on HIT, false on MISS
-\*=======================================================================*/
+ Output: cached object on HIT, false on MISS
+\*=======================================================================*/
function get ($url) {
$this->ERROR = "";
$cache_option = 'rss_' . $this->file_name( $url );
-
+
if ( ! get_site_option( $cache_option ) ) {
$this->debug(
"Cache doesn't contain: $url (cache option: $cache_option)"
);
return 0;
}
-
+
$rss = get_site_option( $cache_option );
-
+
return $rss;
}
@@ -701,8 +701,8 @@ class RSSCache {
Purpose: check a url for membership in the cache
and whether the object is older then MAX_AGE (ie. STALE)
Input: url from wich the rss file was fetched
- Output: cached object on HIT, false on MISS
-\*=======================================================================*/
+ Output: cached object on HIT, false on MISS
+\*=======================================================================*/
function check_cache ( $url ) {
$this->ERROR = "";
$cache_option = $this->file_name( $url );
@@ -729,32 +729,32 @@ class RSSCache {
/*=======================================================================*\
Function: serialize
-\*=======================================================================*/
+\*=======================================================================*/
function serialize ( $rss ) {
return serialize( $rss );
}
/*=======================================================================*\
Function: unserialize
-\*=======================================================================*/
+\*=======================================================================*/
function unserialize ( $data ) {
return unserialize( $data );
}
-
+
/*=======================================================================*\
Function: file_name
Purpose: map url to location in cache
Input: url from wich the rss file was fetched
Output: a file name
-\*=======================================================================*/
+\*=======================================================================*/
function file_name ($url) {
return md5( $url );
}
-
+
/*=======================================================================*\
Function: error
Purpose: register error
-\*=======================================================================*/
+\*=======================================================================*/
function error ($errormsg, $lvl=E_USER_WARNING) {
// append PHP's error message if track_errors enabled
if ( isset($php_errormsg) ) {
@@ -776,17 +776,17 @@ class RSSCache {
}
function parse_w3cdtf ( $date_str ) {
-
+
# regex to match wc3dtf
$pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/";
-
+
if ( preg_match( $pat, $date_str, $match ) ) {
list( $year, $month, $day, $hours, $minutes, $seconds) =
array( $match[1], $match[2], $match[3], $match[4], $match[5], $match[6]);
-
+
# calc epoch for current date assuming GMT
$epoch = gmmktime( $hours, $minutes, $seconds, $month, $day, $year);
-
+
$offset = 0;
if ( $match[10] == 'Z' ) {
# zulu time, aka GMT
@@ -794,20 +794,20 @@ function parse_w3cdtf ( $date_str ) {
else {
list( $tz_mod, $tz_hour, $tz_min ) =
array( $match[8], $match[9], $match[10]);
-
+
# zero out the variables
if ( ! $tz_hour ) { $tz_hour = 0; }
if ( ! $tz_min ) { $tz_min = 0; }
-
+
$offset_secs = (($tz_hour*60)+$tz_min)*60;
-
+
# is timezone ahead of GMT? then subtract offset
#
if ( $tz_mod == '+' ) {
$offset_secs = $offset_secs * -1;
}
-
- $offset = $offset_secs;
+
+ $offset = $offset_secs;
}
$epoch = $epoch + $offset;
return $epoch;
@@ -829,7 +829,7 @@ function wp_rss ($url, $num) {
echo htmlentities($item['title']);
echo "</a><br />\n";
echo "</li>\n";
- }
+ }
echo "</ul>";
}
else {
diff --git a/wp-inst/wp-includes/template-functions-category.php b/wp-inst/wp-includes/template-functions-category.php
index 1858bec..d4b19ce 100644
--- a/wp-inst/wp-includes/template-functions-category.php
+++ b/wp-inst/wp-includes/template-functions-category.php
@@ -308,7 +308,7 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
$cat_dates = $wpdb->get_results(" SELECT category_id,
UNIX_TIMESTAMP( MAX(post_date) ) AS ts
FROM $wpdb->posts, $wpdb->post2cat, $wpdb->categories
- WHERE post_status = 'publish' AND post_id = ID $exclusions
+ WHERE post_type = 'post' AND post_status = 'publish' AND post_id = ID $exclusions
GROUP BY category_id");
foreach ( $cat_dates as $cat_date ) {
$category_timestamp["$cat_date->category_id"] = $cat_date->ts;
diff --git a/wp-inst/wp-includes/template-functions-general.php b/wp-inst/wp-includes/template-functions-general.php
index 1fcda25..3994633 100644
--- a/wp-inst/wp-includes/template-functions-general.php
+++ b/wp-inst/wp-includes/template-functions-general.php
@@ -327,10 +327,8 @@ function get_archives($type='', $limit='', $format='html', $before = '', $after
$add_hours = intval(get_settings('gmt_offset'));
$add_minutes = intval(60 * (get_settings('gmt_offset') - $add_hours));
- $now = current_time('mysql');
-
if ( 'monthly' == $type ) {
- $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts WHERE post_date < '$now' AND post_date != '0000-00-00 00:00:00' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit);
+ $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit);
if ( $arcresults ) {
$afterafter = $after;
foreach ( $arcresults as $arcresult ) {
@@ -345,7 +343,7 @@ function get_archives($type='', $limit='', $format='html', $before = '', $after
}
}
} elseif ( 'daily' == $type ) {
- $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth` FROM $wpdb->posts WHERE post_date < '$now' AND post_date != '0000-00-00 00:00:00' AND post_status = 'publish' ORDER BY post_date DESC" . $limit);
+ $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth` FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC" . $limit);
if ( $arcresults ) {
foreach ( $arcresults as $arcresult ) {
$url = get_day_link($arcresult->year, $arcresult->month, $arcresult->dayofmonth);
@@ -356,7 +354,7 @@ function get_archives($type='', $limit='', $format='html', $before = '', $after
}
} elseif ( 'weekly' == $type ) {
$start_of_week = get_settings('start_of_week');
- $arcresults = $wpdb->get_results("SELECT DISTINCT WEEK(post_date, $start_of_week) AS `week`, YEAR(post_date) AS yr, DATE_FORMAT(post_date, '%Y-%m-%d') AS yyyymmdd FROM $wpdb->posts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit);
+ $arcresults = $wpdb->get_results("SELECT DISTINCT WEEK(post_date, $start_of_week) AS `week`, YEAR(post_date) AS yr, DATE_FORMAT(post_date, '%Y-%m-%d') AS yyyymmdd FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC" . $limit);
$arc_w_last = '';
if ( $arcresults ) {
foreach ( $arcresults as $arcresult ) {
@@ -373,7 +371,7 @@ function get_archives($type='', $limit='', $format='html', $before = '', $after
}
}
} elseif ( 'postbypost' == $type ) {
- $arcresults = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit);
+ $arcresults = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC" . $limit);
if ( $arcresults ) {
foreach ( $arcresults as $arcresult ) {
if ( $arcresult->post_date != '0000-00-00 00:00:00' ) {
@@ -403,7 +401,7 @@ function get_calendar($daylength = 1) {
// Quick check. If we have no posts at all, abort!
if ( !$posts ) {
- $gotsome = $wpdb->get_var("SELECT ID from $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date DESC LIMIT 1");
+ $gotsome = $wpdb->get_var("SELECT ID from $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC LIMIT 1");
if ( !$gotsome )
return;
}
@@ -443,14 +441,14 @@ function get_calendar($daylength = 1) {
$previous = $wpdb->get_row("SELECT DISTINCT MONTH(post_date) AS month, YEAR(post_date) AS year
FROM $wpdb->posts
WHERE post_date < '$thisyear-$thismonth-01'
- AND post_status = 'publish'
+ AND post_type = 'post' AND post_status = 'publish'
ORDER BY post_date DESC
LIMIT 1");
$next = $wpdb->get_row("SELECT DISTINCT MONTH(post_date) AS month, YEAR(post_date) AS year
FROM $wpdb->posts
WHERE post_date > '$thisyear-$thismonth-01'
AND MONTH( post_date ) != MONTH( '$thisyear-$thismonth-01' )
- AND post_status = 'publish'
+ AND post_type = 'post' AND post_status = 'publish'
ORDER BY post_date ASC
LIMIT 1");
@@ -482,7 +480,8 @@ function get_calendar($daylength = 1) {
if ( $previous ) {
echo "\n\t\t".'<td abbr="' . $month[zeroise($previous->month, 2)] . '" colspan="3" id="prev"><a href="' .
- get_month_link($previous->year, $previous->month) . '" title="' . sprintf(__('View posts for %1$s %2$s'), $month[zeroise($previous->month, 2)], date('Y', mktime(0, 0 , 0, $previous->month, 1, $previous->year))) . '">&laquo; ' . $month_abbrev[$month[zeroise($previous->month, 2)]] . '</a></td>';
+ get_month_link($previous->year, $previous->month) . '" title="' . sprintf(__('View posts for %1$s %2$s'), $month[zeroise($previous->month, 2)],
+ date('Y', mktime(0, 0 , 0, $previous->month, 1, $previous->year))) . '">&laquo; ' . $month_abbrev[$month[zeroise($previous->month, 2)]] . '</a></td>';
} else {
echo "\n\t\t".'<td colspan="3" id="prev" class="pad">&nbsp;</td>';
}
@@ -491,8 +490,8 @@ function get_calendar($daylength = 1) {
if ( $next ) {
echo "\n\t\t".'<td abbr="' . $month[zeroise($next->month, 2)] . '" colspan="3" id="next"><a href="' .
- get_month_link($next->year, $next->month) . '" title="View posts for ' . $month[zeroise($next->month, 2)] . ' ' .
- date('Y', mktime(0, 0 , 0, $next->month, 1, $next->year)) . '">' . $month_abbrev[$month[zeroise($next->month, 2)]] . ' &raquo;</a></td>';
+ get_month_link($next->year, $next->month) . '" title="' . sprintf(__('View posts for %1$s %2$s'), $month[zeroise($next->month, 2)],
+ date('Y', mktime(0, 0 , 0, $next->month, 1, $next->year))) . '">' . $month_abbrev[$month[zeroise($next->month, 2)]] . ' &raquo;</a></td>';
} else {
echo "\n\t\t".'<td colspan="3" id="next" class="pad">&nbsp;</td>';
}
@@ -508,7 +507,7 @@ function get_calendar($daylength = 1) {
$dayswithposts = $wpdb->get_results("SELECT DISTINCT DAYOFMONTH(post_date)
FROM $wpdb->posts WHERE MONTH(post_date) = $thismonth
AND YEAR(post_date) = $thisyear
- AND post_status = 'publish'
+ AND post_type = 'post' AND post_status = 'publish'
AND post_date < '" . current_time('mysql') . '\'', ARRAY_N);
if ( $dayswithposts ) {
foreach ( $dayswithposts as $daywith ) {
@@ -531,7 +530,7 @@ function get_calendar($daylength = 1) {
."WHERE YEAR(post_date) = '$thisyear' "
."AND MONTH(post_date) = '$thismonth' "
."AND post_date < '".current_time('mysql')."' "
- ."AND post_status = 'publish'"
+ ."AND post_type = 'post' AND post_status = 'publish'"
);
if ( $ak_post_titles ) {
foreach ( $ak_post_titles as $ak_post_title ) {
diff --git a/wp-inst/wp-includes/template-functions-links.php b/wp-inst/wp-includes/template-functions-links.php
index d949ea4..210d5ed 100644
--- a/wp-inst/wp-includes/template-functions-links.php
+++ b/wp-inst/wp-includes/template-functions-links.php
@@ -42,9 +42,9 @@ function get_permalink($id = 0) {
);
$post = &get_post($id);
- if ( $post->post_status == 'static' )
+ if ( $post->post_type == 'page' )
return get_page_link($post->ID);
- elseif ($post->post_status == 'attachment')
+ elseif ($post->post_type == 'attachment')
return get_attachment_link($post->ID);
$permalink = get_settings('permalink_structure');
@@ -252,14 +252,16 @@ function get_previous_post($in_same_cat = false, $excluded_categories = '') {
$sql_exclude_cats = '';
if ( !empty($excluded_categories) ) {
- $blah = explode('and', $excluded_categories);
+ $blah = explode(' and ', $excluded_categories);
foreach ( $blah as $category ) {
$category = intval($category);
- $sql_exclude_cats .= " AND post_category != $category";
+ $sql_cat_ids = " OR pc.category_ID = '$category'";
}
+ $posts_in_ex_cats = $wpdb->get_col("SELECT p.ID FROM $wpdb->posts p LEFT JOIN $wpdb->post2cat pc ON pc.post_id=p.ID WHERE 1 = 0 $sql_cat_ids GROUP BY p.ID");
+ $posts_in_ex_cats_sql = 'AND ID NOT IN (' . implode($posts_in_ex_cats, ',') . ')';
}
- return @$wpdb->get_row("SELECT ID, post_title FROM $wpdb->posts $join WHERE post_date < '$current_post_date' AND post_status = 'publish' $sqlcat $sql_exclude_cats ORDER BY post_date DESC LIMIT 1");
+ return @$wpdb->get_row("SELECT ID, post_title FROM $wpdb->posts $join WHERE post_date < '$current_post_date' AND post_type = 'post' AND post_status = 'publish' $posts_in_ex_cats_sql ORDER BY post_date DESC LIMIT 1");
}
function get_next_post($in_same_cat = false, $excluded_categories = '') {
@@ -269,7 +271,7 @@ function get_next_post($in_same_cat = false, $excluded_categories = '') {
return null;
$current_post_date = $post->post_date;
-
+
$join = '';
if ( $in_same_cat ) {
$join = " INNER JOIN $wpdb->post2cat ON $wpdb->posts.ID= $wpdb->post2cat.post_id ";
@@ -283,16 +285,16 @@ function get_next_post($in_same_cat = false, $excluded_categories = '') {
$sql_exclude_cats = '';
if ( !empty($excluded_categories) ) {
- $blah = explode('and', $excluded_categories);
+ $blah = explode(' and ', $excluded_categories);
foreach ( $blah as $category ) {
$category = intval($category);
- $sql_exclude_cats .= " AND post_category != $category";
+ $sql_cat_ids = " OR pc.category_ID = '$category'";
}
+ $posts_in_ex_cats = $wpdb->get_col("SELECT p.ID from $wpdb->posts p LEFT JOIN $wpdb->post2cat pc ON pc.post_id = p.ID WHERE 1 = 0 $sql_cat_ids GROUP BY p.ID");
+ $posts_in_ex_cats_sql = 'AND ID NOT IN (' . implode($posts_in_ex_cats, ',') . ')';
}
- $now = current_time('mysql');
-
- return @$wpdb->get_row("SELECT ID,post_title FROM $wpdb->posts $join WHERE post_date > '$current_post_date' AND post_date < '$now' AND post_status = 'publish' $sqlcat $sql_exclude_cats AND ID != $post->ID ORDER BY post_date ASC LIMIT 1");
+ return @$wpdb->get_row("SELECT ID,post_title FROM $wpdb->posts $join WHERE post_date > '$current_post_date' AND post_type = 'post' AND post_status = 'publish' $posts_in_ex_cats_sql AND ID != $post->ID ORDER BY post_date ASC LIMIT 1");
}
@@ -435,7 +437,7 @@ function get_pagenum_link($pagenum = 1) {
if ( $permalink )
$qstr = trailingslashit($qstr);
$qstr = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', trailingslashit( get_settings('home') ) . $qstr );
-
+
// showing /page/1/ or ?paged=1 is redundant
if ( 1 === $pagenum ) {
$qstr = str_replace('page/1/', '', $qstr); // for mod_rewrite style
diff --git a/wp-inst/wp-includes/template-functions-post.php b/wp-inst/wp-includes/template-functions-post.php
index 383acb3..07cfd14 100644
--- a/wp-inst/wp-includes/template-functions-post.php
+++ b/wp-inst/wp-includes/template-functions-post.php
@@ -211,7 +211,7 @@ function get_post_custom( $post_id = 0 ) {
// Force subkeys to be array type:
if ( !isset($post_meta_cache[$mpid]) || !is_array($post_meta_cache[$mpid]) )
$post_meta_cache[$mpid] = array();
-
+
if ( !isset($post_meta_cache[$mpid]["$mkey"]) || !is_array($post_meta_cache[$mpid]["$mkey"]) )
$post_meta_cache[$mpid]["$mkey"] = array();
@@ -314,7 +314,7 @@ function &get_pages($args = '') {
$pages = $wpdb->get_results("SELECT * " .
"FROM $wpdb->posts " .
- "WHERE post_status = 'static' " .
+ "WHERE post_type = 'page' AND post_status = 'publish' " .
"$exclusions " .
"ORDER BY " . $r['sort_column'] . " " . $r['sort_order']);
@@ -450,7 +450,7 @@ function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false)
$id = (int) $id;
$_post = & get_post($id);
- if ( ('attachment' != $_post->post_status) || ('' == $_post->guid) )
+ if ( ('attachment' != $_post->post_type) || ('' == $_post->guid) )
return __('Missing Attachment');
if (! empty($_post->guid) ) {
diff --git a/wp-inst/wp-includes/template-loader.php b/wp-inst/wp-includes/template-loader.php
index cf039f2..e3160f7 100644
--- a/wp-inst/wp-includes/template-loader.php
+++ b/wp-inst/wp-includes/template-loader.php
@@ -31,7 +31,7 @@ if ( defined('WP_USE_THEMES') && constant('WP_USE_THEMES') ) {
exit;
} else if ( is_category() && $template = get_category_template()) {
include($template);
- exit;
+ exit;
} else if ( is_author() && $template = get_author_template() ) {
include($template);
exit;
diff --git a/wp-inst/wp-includes/version.php b/wp-inst/wp-includes/version.php
index ea1c83a..47d8d36 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 = 3437;
+$wp_db_version = 3514;
?>
diff --git a/wp-inst/wp-includes/wp-db.php b/wp-inst/wp-includes/wp-db.php
index 810cc11..9faa97e 100644
--- a/wp-inst/wp-includes/wp-db.php
+++ b/wp-inst/wp-includes/wp-db.php
@@ -16,7 +16,7 @@ if (!defined('SAVEQUERIES'))
class wpdb {
var $show_errors = true;
- var $num_queries = 0;
+ var $num_queries = 0;
var $last_query;
var $col_info;
var $queries;
@@ -81,7 +81,7 @@ class wpdb {
// ====================================================================
// Format a string correctly for safe insert under all PHP conditions
-
+
function escape($string) {
return addslashes( $string ); // Disable rest for now, causing problems
if( !$this->dbh || version_compare( phpversion(), '4.3.0' ) == '-1' )
@@ -107,7 +107,7 @@ class wpdb {
<code>$this->last_query</code></p>
</div>";
} else {
- return false;
+ return false;
}
}
@@ -117,7 +117,7 @@ class wpdb {
function show_errors() {
$this->show_errors = true;
}
-
+
function hide_errors() {
$this->show_errors = false;
}
@@ -248,7 +248,7 @@ class wpdb {
// Log number of rows the query returned
$this->num_rows = $num_rows;
-
+
// Return number of rows selected
$return_val = $this->num_rows;
}
@@ -362,7 +362,7 @@ class wpdb {
$this->time_start = $mtime[1] + $mtime[0];
return true;
}
-
+
function timer_stop($precision = 3) {
$mtime = microtime();
$mtime = explode(' ', $mtime);
@@ -374,7 +374,7 @@ class wpdb {
function bail($message) { // Just wraps errors in a nice header and footer
if ( !$this->show_errors )
return false;
- header( 'Content-Type: text/html; charset=utf-8');
+ header( 'Content-Type: text/html; charset=utf-8');
echo <<<HEAD
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
@@ -394,22 +394,22 @@ class wpdb {
margin-right: 25%;
padding: .2em 2em;
}
-
+
h1 {
color: #006;
font-size: 18px;
font-weight: lighter;
}
-
+
h2 {
font-size: 16px;
}
-
+
p, li, dt {
line-height: 140%;
padding-bottom: 2px;
}
-
+
ul, ol {
padding: 5px 5px 5px 20px;
}
diff --git a/wp-inst/wp-includes/wp-l10n.php b/wp-inst/wp-includes/wp-l10n.php
index a259746..4fe1cc9 100644
--- a/wp-inst/wp-includes/wp-l10n.php
+++ b/wp-inst/wp-includes/wp-l10n.php
@@ -14,7 +14,7 @@ function get_locale() {
// WPLANG is defined in wp-config.
if (defined('WPLANG'))
$locale = WPLANG;
-
+
if (empty($locale))
$locale = 'en_US';
@@ -76,20 +76,20 @@ function load_default_textdomain() {
$locale = get_locale();
$mofile = ABSPATH . "wp-includes/languages/$locale.mo";
-
+
load_textdomain('default', $mofile);
}
function load_plugin_textdomain($domain, $path = 'wp-content/plugins') {
$locale = get_locale();
-
+
$mofile = ABSPATH . "$path/$domain-$locale.mo";
load_textdomain($domain, $mofile);
}
function load_theme_textdomain($domain) {
$locale = get_locale();
-
+
$mofile = get_template_directory() . "/$locale.mo";
load_textdomain($domain, $mofile);
}
diff --git a/wp-inst/wp-login.php b/wp-inst/wp-login.php
index ee9246b..97b55f5 100644
--- a/wp-inst/wp-login.php
+++ b/wp-inst/wp-login.php
@@ -28,7 +28,7 @@ case 'logout':
$redirect_to = 'wp-login.php';
if ( isset($_REQUEST['redirect_to']) )
$redirect_to = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $_REQUEST['redirect_to']);
-
+
wp_redirect($redirect_to);
exit();
@@ -139,7 +139,7 @@ case 'resetpass' :
$new_pass = substr( md5( uniqid( microtime() ) ), 0, 7);
$wpdb->query("UPDATE $wpdb->users SET user_pass = MD5('$new_pass'), user_activation_key = '' WHERE user_login = '$user->user_login'");
wp_cache_delete($user->ID, 'users');
- wp_cache_delete($user->user_login, 'userlogins');
+ wp_cache_delete($user->user_login, 'userlogins');
$message = sprintf(__('Username: %s'), $user->user_login) . "\r\n";
$message .= sprintf(__('Password: %s'), $new_pass) . "\r\n";
$message .= get_settings('siteurl') . "/wp-login.php\r\n";
@@ -190,11 +190,11 @@ default:
if ( $user_login && $user_pass ) {
$user = new WP_User(0, $user_login);
-
+
// If the user can't edit posts, send them to their profile.
if ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' ) )
$redirect_to = get_settings('siteurl') . '/wp-admin/profile.php';
-
+
if ( wp_login($user_login, $user_pass, $using_cookie) ) {
if ( !$using_cookie )
wp_setcookie($user_login, $user_pass, false, '', '', $rememberme);
@@ -202,7 +202,7 @@ default:
wp_redirect($redirect_to);
exit;
} else {
- if ( $using_cookie )
+ if ( $using_cookie )
$error = __('Your session has expired.');
}
}
diff --git a/wp-inst/wp-mail.php b/wp-inst/wp-mail.php
index d6f23a8..2512907 100644
--- a/wp-inst/wp-mail.php
+++ b/wp-inst/wp-mail.php
@@ -81,11 +81,11 @@ for ($i=1; $i <= $count; $i++) :
}
$date_arr = explode(' ', $ddate);
$date_time = explode(':', $date_arr[3]);
-
+
$ddate_H = $date_time[0];
$ddate_i = $date_time[1];
$ddate_s = $date_time[2];
-
+
$ddate_m = $date_arr[1];
$ddate_d = $date_arr[0];
$ddate_Y = $date_arr[2];
diff --git a/wp-inst/wp-register.php b/wp-inst/wp-register.php
index 1177c12..28aa5f2 100644
--- a/wp-inst/wp-register.php
+++ b/wp-inst/wp-register.php
@@ -14,9 +14,9 @@ case 'register':
$user_login = sanitize_user( $_POST['user_login'] );
$user_email = $_POST['user_email'];
-
+
$errors = array();
-
+
if ( $user_login == '' )
$errors['user_login'] = __('<strong>ERROR</strong>: Please enter a username.');
@@ -33,10 +33,8 @@ case 'register':
if ( username_exists( $user_login ) )
$errors['user_login'] = __('<strong>ERROR</strong>: This username is already registered, please choose another one.');
- /* checking the email isn't already used by another user */
- $email_exists = $wpdb->get_row("SELECT user_email FROM $wpdb->users WHERE user_email = '$user_email'");
- if ( $email_exists)
- die (__('<strong>ERROR</strong>: This email address is already registered, please supply another.'));
+ if ( email_exists( $user_email ) )
+ $errors['user_email'] = __('<strong>ERROR</strong>: This email is already registered, please choose another one.');
if ( 0 == count($errors) ) {
$password = substr( md5( uniqid( microtime() ) ), 0, 7);
@@ -47,15 +45,15 @@ case 'register':
else
wp_new_user_notification($user_id, $password);
}
-
+
if ( 0 == count($errors) ) {
-
+
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>WordPress &raquo; <?php _e('Registration Complete') ?></title>
- <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" />
+ <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" />
<link rel="stylesheet" href="wp-admin/wp-admin.css" type="text/css" />
<style type="text/css">
.submit {
@@ -101,11 +99,11 @@ default:
<h2><?php _e('Register for this blog') ?></h2>
<?php if ( isset($errors) ) : ?>
<div class="error">
- <ul>
+ <p>
<?php
- foreach($errors as $error) echo "<li>$error</li>";
+ foreach($errors as $error) echo "$error<br />";
?>
- </ul>
+ </p>
</div>
<?php endif; ?>
<form method="post" action="wp-register.php" id="registerform">
diff --git a/wp-inst/wp-settings.php b/wp-inst/wp-settings.php
index a046cdd..7a08048 100644
--- a/wp-inst/wp-settings.php
+++ b/wp-inst/wp-settings.php
@@ -12,7 +12,7 @@ function unregister_GLOBALS() {
// Variables that shouldn't be unset
$noUnset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix');
-
+
$input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array());
foreach ( $input as $k => $v )
if ( !in_array($k, $noUnset) && isset($GLOBALS[$k]) )
@@ -30,7 +30,7 @@ if ( ! isset($blog_id) )
// Fix for IIS, which doesn't set REQUEST_URI
if ( empty( $_SERVER['REQUEST_URI'] ) ) {
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME']; // Does this work under CGI?
-
+
// Append the query string if it exists and isn't null
if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
$_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
@@ -375,6 +375,7 @@ if ( file_exists(TEMPLATEPATH . "/functions.php") )
function shutdown_action_hook() {
do_action('shutdown');
+ wp_cron();
wp_cache_close();
}
register_shutdown_function('shutdown_action_hook');
diff --git a/wp-inst/xmlrpc.php b/wp-inst/xmlrpc.php
index 045acba..aa1c520 100644
--- a/wp-inst/xmlrpc.php
+++ b/wp-inst/xmlrpc.php
@@ -577,7 +577,7 @@ class wp_xmlrpc_server extends IXR_Server {
$post_category[] = get_cat_ID($cat);
}
}
-
+
// We've got all the data -- post it:
$postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping');
@@ -623,7 +623,7 @@ class wp_xmlrpc_server extends IXR_Server {
$catnames = $content_struct['categories'];
$post_category = array();
-
+
if (is_array($catnames)) {
foreach ($catnames as $cat) {
$post_category[] = get_cat_ID($cat);
@@ -861,7 +861,7 @@ class wp_xmlrpc_server extends IXR_Server {
logIO('O', '(MW) Could not write file '.$name);
return new IXR_Error(500, 'Could not write file '.$name);
}
-
+
return array('url' => $upload['url']);
}
@@ -995,7 +995,7 @@ class wp_xmlrpc_server extends IXR_Server {
foreach($categories as $cat) {
$catids[] = $cat['categoryId'];
}
-
+
wp_set_post_cats('', $post_ID, $catids);
return true;
@@ -1199,11 +1199,11 @@ class wp_xmlrpc_server extends IXR_Server {
$linea = strip_tags( $linea, '<a>' ); // just keep the tag we need
$p = explode( "\n\n", $linea );
-
+
$sem_regexp_pb = "/(\\/|\\\|\*|\?|\+|\.|\^|\\$|\(|\)|\[|\]|\||\{|\})/";
$sem_regexp_fix = "\\\\$1";
$link = preg_replace( $sem_regexp_pb, $sem_regexp_fix, $pagelinkedfrom );
-
+
$finished = false;
foreach ( $p as $para ) {
if ( $finished )
@@ -1238,7 +1238,7 @@ class wp_xmlrpc_server extends IXR_Server {
wp_new_comment($commentdata);
do_action('pingback_post', $wpdb->insert_id);
-
+
return "Pingback from $pagelinkedfrom to $pagelinkedto registered. Keep the web talking! :-)";
}