From d85d717aedbc7690e2a450e40dab8fcebd94b38c Mon Sep 17 00:00:00 2001 From: donncha Date: Tue, 30 Oct 2007 16:49:38 +0000 Subject: Merge with WordPress 2.3.1 git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1139 7be80a69-a1ef-0310-a953-fb0f7c49ff36 --- wp-admin/admin-ajax.php | 190 +++--- wp-admin/categories.php | 2 +- wp-admin/edit-category-form.php | 2 +- wp-admin/edit-comments.php | 24 +- wp-admin/edit-form-advanced.php | 4 +- wp-admin/edit-link-form.php | 4 +- wp-admin/edit-pages.php | 11 +- wp-admin/edit-post-rows.php | 11 +- wp-admin/edit.php | 111 +++- wp-admin/export.php | 2 +- wp-admin/import/mt.php | 2 +- wp-admin/includes/plugin.php | 42 -- wp-admin/includes/post.php | 47 -- wp-admin/includes/schema.php | 12 +- wp-admin/includes/template.php | 143 ++--- wp-admin/includes/upgrade.php | 10 +- wp-admin/includes/user.php | 12 +- wp-admin/js/cat.js | 16 +- wp-admin/js/categories.js | 24 +- wp-admin/js/custom-fields.js | 55 +- wp-admin/js/edit-comments.js | 71 ++- wp-admin/js/edit-posts.js | 22 - wp-admin/js/link-cat.js | 11 + wp-admin/js/users.js | 41 +- wp-admin/link-add.php | 2 +- wp-admin/link-manager.php | 15 +- wp-admin/menu.php | 2 +- wp-admin/page.php | 10 +- wp-admin/plugins.php | 33 +- wp-admin/post.php | 10 +- wp-admin/setup-config.php | 5 +- wp-admin/users.php | 2 +- wp-admin/wp-admin.css | 4 - wp-app.php | 40 +- wp-content/themes/classic/header.php | 4 +- wp-content/themes/default/footer.php | 2 +- wp-content/themes/default/header.php | 2 + wp-content/themes/default/index.php | 2 +- wp-includes/bookmark.php | 3 +- wp-includes/canonical.php | 8 +- wp-includes/category-template.php | 2 +- wp-includes/classes.php | 4 +- wp-includes/comment-template.php | 8 +- wp-includes/comment.php | 21 +- wp-includes/default-filters.php | 1 - wp-includes/feed-atom-comments.php | 2 +- wp-includes/feed-atom.php | 11 +- wp-includes/feed-rdf.php | 3 +- wp-includes/feed-rss.php | 2 +- wp-includes/feed-rss2-comments.php | 5 +- wp-includes/feed-rss2.php | 5 +- wp-includes/feed.php | 43 -- wp-includes/functions.php | 1111 ++++++++++++++++------------------ wp-includes/general-template.php | 52 +- wp-includes/js/wp-lists.js | 374 ------------ wp-includes/link-template.php | 12 +- wp-includes/pluggable.php | 47 +- wp-includes/plugin.php | 228 +------ wp-includes/post-template.php | 35 -- wp-includes/post.php | 565 ++++++++++------- wp-includes/query.php | 9 +- wp-includes/registration.php | 19 +- wp-includes/rss.php | 5 +- wp-includes/script-loader.php | 23 +- wp-includes/taxonomy.php | 724 +++++++--------------- wp-includes/user.php | 8 +- wp-includes/version.php | 2 +- wp-includes/widgets.php | 7 +- wp-includes/wp-db.php | 54 -- wp-links-opml.php | 2 +- wp-settings.php | 27 +- xmlrpc.php | 3 +- 72 files changed, 1709 insertions(+), 2718 deletions(-) delete mode 100644 wp-admin/js/edit-posts.js delete mode 100644 wp-includes/js/wp-lists.js diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index 64c9b06..013e375 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -4,47 +4,50 @@ require_once('includes/admin.php'); define('DOING_AJAX', true); +check_ajax_referer(); if ( !is_user_logged_in() ) die('-1'); function get_out_now() { exit; } add_action( 'shutdown', 'get_out_now', -1 ); +function wp_ajax_meta_row( $pid, $mid, $key, $value ) { + $value = attribute_escape($value); + $key_js = addslashes(wp_specialchars($key, 'double')); + $key = attribute_escape($key); + $r .= ""; + $r .= ""; + $r .= ""; + $r .= "
"; + $r .= ""; + return $r; +} + $id = (int) $_POST['id']; -switch ( $action = $_POST['action'] ) : -case 'add-post' : - check_ajax_referer( 'add-post' ); - add_filter( 'post_limits', $limit_filter = create_function( '$a', '$b = split(" ",$a); if ( !isset($b[2]) ) return $a; $start = intval(trim($b[1])) / 20 * 15; if ( !is_int($start) ) return $a; $start += intval(trim($b[2])) - 1; return "LIMIT $start, 1";' ) ); - wp_edit_posts_query( $_POST ); - if ( !have_posts() ) - die('1'); - $posts_columns = wp_manage_posts_columns(); - ob_start(); - include( 'edit-post-rows.php' ); - $data = ob_get_contents(); - ob_end_clean(); - if ( !preg_match('|(.+)|s', $data, $matches) ) - my_dump($data); - $data = trim($matches[1]); - $x = new WP_Ajax_Response( array( 'what' => 'post', 'id' => $id, 'data' => $data ) ); - $x->send(); - break; +switch ( $_POST['action'] ) : case 'delete-comment' : - check_ajax_referer( "delete-comment_$id" ); if ( !$comment = get_comment( $id ) ) die('0'); if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) ) die('-1'); - if ( isset($_POST['spam']) && 1 == $_POST['spam'] ) - $r = wp_set_comment_status( $comment->comment_ID, 'spam' ); - else - $r = wp_delete_comment( $comment->comment_ID ); + if ( wp_delete_comment( $comment->comment_ID ) ) + die('1'); + else die('0'); + break; +case 'delete-comment-as-spam' : + if ( !$comment = get_comment( $id ) ) + die('0'); + if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) ) + die('-1'); - die( $r ? '1' : '0' ); + if ( wp_set_comment_status( $comment->comment_ID, 'spam' ) ) + die('1'); + else die('0'); break; case 'delete-cat' : - check_ajax_referer( "delete-category_$id" ); if ( !current_user_can( 'manage_categories' ) ) die('-1'); @@ -53,7 +56,6 @@ case 'delete-cat' : else die('0'); break; case 'delete-link' : - check_ajax_referer( "delete-bookmark_$id" ); if ( !current_user_can( 'manage_links' ) ) die('-1'); @@ -62,7 +64,6 @@ case 'delete-link' : else die('0'); break; case 'delete-meta' : - check_ajax_referer( 'change_meta' ); if ( !$meta = get_post_meta_by_id( $id ) ) die('0'); if ( !current_user_can( 'edit_post', $meta->post_id ) ) @@ -72,17 +73,14 @@ case 'delete-meta' : die('0'); break; case 'delete-post' : - check_ajax_referer( "{$action}_$id" ); if ( !current_user_can( 'delete_post', $id ) ) die('-1'); if ( wp_delete_post( $id ) ) die('1'); - else - die('0'); + else die('0'); break; case 'delete-page' : - check_ajax_referer( "{$action}_$id" ); if ( !current_user_can( 'delete_page', $id ) ) die('-1'); @@ -99,18 +97,15 @@ case 'dim-comment' : die('-1'); if ( 'unapproved' == wp_get_comment_status($comment->comment_ID) ) { - check_ajax_referer( "approve-comment_$id" ); if ( wp_set_comment_status( $comment->comment_ID, 'approve' ) ) die('1'); } else { - check_ajax_referer( "unapprove-comment_$id" ); if ( wp_set_comment_status( $comment->comment_ID, 'hold' ) ) die('1'); } die('0'); break; case 'add-category' : // On the Fly - check_ajax_referer( $action ); if ( !current_user_can( 'manage_categories' ) ) die('-1'); $names = explode(',', $_POST['newcat']); @@ -125,14 +120,12 @@ case 'add-category' : // On the Fly $x->add( array( 'what' => 'category', 'id' => $cat_id, - 'data' => "
  • ", - 'position' => -1 + 'data' => "
  • " ) ); } $x->send(); break; case 'add-link-category' : // On the Fly - check_ajax_referer( $action ); if ( !current_user_can( 'manage_categories' ) ) die('-1'); $names = explode(',', $_POST['newcat']); @@ -143,20 +136,18 @@ case 'add-link-category' : // On the Fly die('0'); if ( !$cat_id = is_term( $cat_name, 'link_category' ) ) { $cat_id = wp_insert_term( $cat_name, 'link_category' ); + $cat_id = $cat_id['term_id']; } - $cat_id = $cat_id['term_id']; $cat_name = wp_specialchars(stripslashes($cat_name)); $x->add( array( 'what' => 'link-category', 'id' => $cat_id, - 'data' => "", - 'position' => -1 + 'data' => "" ) ); } $x->send(); break; case 'add-cat' : // From Manage->Categories - check_ajax_referer( 'add-category' ); if ( !current_user_can( 'manage_categories' ) ) die('-1'); if ( !$cat = wp_insert_category( $_POST ) ) @@ -164,29 +155,28 @@ case 'add-cat' : // From Manage->Categories if ( !$cat = get_category( $cat ) ) die('0'); $level = 0; - $cat_full_name = $cat->name; + $cat_full_name = $cat->cat_name; $_cat = $cat; - while ( $_cat->parent ) { - $_cat = get_category( $_cat->parent ); - $cat_full_name = $_cat->name . ' — ' . $cat_full_name; + while ( $_cat->category_parent ) { + $_cat = get_category( $_cat->category_parent ); + $cat_full_name = $_cat->cat_name . ' — ' . $cat_full_name; $level++; } $cat_full_name = attribute_escape($cat_full_name); $x = new WP_Ajax_Response( array( 'what' => 'cat', - 'id' => $cat->term_id, + 'id' => $cat->cat_ID, 'data' => _cat_row( $cat, $level, $cat_full_name ), - 'supplemental' => array('name' => $cat_full_name, 'show-link' => sprintf(__( 'Category %s added' ), "cat-$cat->term_id", $cat_full_name)) + 'supplemental' => array('name' => $cat_full_name, 'show-link' => sprintf(__( 'Category %s added' ), "cat-$cat->cat_ID", $cat_full_name)) ) ); $x->send(); break; case 'add-comment' : - check_ajax_referer( $action ); if ( !current_user_can( 'edit_post', $id ) ) die('-1'); $search = isset($_POST['s']) ? $_POST['s'] : false; - $start = isset($_POST['page']) ? intval($_POST['page']) * 25 - 1: 24; + $start = isset($_POST['page']) ? intval($_POST['page']) * 25 : 25; list($comments, $total) = _wp_get_comment_list( $search, $start, 1 ); @@ -208,70 +198,58 @@ case 'add-comment' : $x->send(); break; case 'add-meta' : - check_ajax_referer( 'change_meta' ); - $c = 0; - $pid = (int) $_POST['post_id']; - if ( isset($_POST['addmeta']) ) { - if ( !current_user_can( 'edit_post', $pid ) ) - die('-1'); - if ( $pid < 0 ) { - $now = current_time('timestamp', 1); - if ( $pid = wp_insert_post( array( - 'post_title' => sprintf('Draft created on %s at %s', date(get_option('date_format'), $now), date(get_option('time_format'), $now)) - ) ) ) { - if ( is_wp_error( $pid ) ) { - $x = new WP_Ajax_Response( array( - 'what' => 'meta', - 'data' => $pid - ) ); - $x->send(); - } - $mid = add_meta( $pid ); - } else { - die('0'); - } - } else if ( !$mid = add_meta( $pid ) ) { - die('0'); + if ( !current_user_can( 'edit_post', $id ) ) + die('-1'); + if ( $id < 0 ) { + $now = current_time('timestamp', 1); + if ( $pid = wp_insert_post( array( + 'post_title' => sprintf('Draft created on %s at %s', date(get_option('date_format'), $now), date(get_option('time_format'), $now)) + ) ) ) { + if ( is_wp_error( $pid ) ) + return $pid; + $mid = add_meta( $pid ); } + else + die('0'); + } else if ( !$mid = add_meta( $id ) ) { + die('0'); + } - $meta = get_post_meta_by_id( $mid ); - $pid = (int) $meta->post_id; - $meta = get_object_vars( $meta ); - $x = new WP_Ajax_Response( array( - 'what' => 'meta', - 'id' => $mid, - 'data' => _list_meta_row( $meta, $c ), - 'position' => 1, - 'supplemental' => array('postid' => $pid) - ) ); - } else { - $mid = (int) array_pop(array_keys($_POST['meta'])); - $key = $_POST['meta'][$mid]['key']; - $value = $_POST['meta'][$mid]['value']; - if ( !$meta = get_post_meta_by_id( $mid ) ) - die('0'); // if meta doesn't exist - if ( !current_user_can( 'edit_post', $meta->post_id ) ) - die('-1'); - if ( !$u = update_meta( $mid, $key, $value ) ) - die('1'); // We know meta exists; we also know it's unchanged (or DB error, in which case there are bigger problems). + $meta = get_post_meta_by_id( $mid ); + $key = $meta->meta_key; + $value = $meta->meta_value; + $pid = (int) $meta->post_id; + + $x = new WP_Ajax_Response( array( + 'what' => 'meta', + 'id' => $mid, + 'data' => wp_ajax_meta_row( $pid, $mid, $key, $value ), + 'supplemental' => array('postid' => $pid) + ) ); + $x->send(); + break; +case 'update-meta' : + $mid = (int) array_pop(array_keys($_POST['meta'])); + $key = $_POST['meta'][$mid]['key']; + $value = $_POST['meta'][$mid]['value']; + if ( !$meta = get_post_meta_by_id( $mid ) ) + die('0'); // if meta doesn't exist + if ( !current_user_can( 'edit_post', $meta->post_id ) ) + die('-1'); + if ( $u = update_meta( $mid, $key, $value ) ) { $key = stripslashes($key); $value = stripslashes($value); $x = new WP_Ajax_Response( array( 'what' => 'meta', - 'id' => $mid, 'old_id' => $mid, - 'data' => _list_meta_row( array( - 'meta_key' => $key, - 'meta_value' => $value, - 'meta_id' => $mid - ), $c ), - 'position' => 0, + 'id' => $mid, + 'data' => wp_ajax_meta_row( $meta->post_id, $mid, $key, $value ), 'supplemental' => array('postid' => $meta->post_id) ) ); + $x->send(); } - $x->send(); + die('1'); // We know meta exists; we also know it's unchanged (or DB error, in which case there are bigger problems). break; case 'add-user' : - check_ajax_referer( $action ); if ( !current_user_can('edit_users') ) die('-1'); require_once(ABSPATH . WPINC . '/registration.php'); @@ -283,20 +261,15 @@ case 'add-user' : exit; } $user_object = new WP_User( $user_id ); - $x = new WP_Ajax_Response( array( 'what' => 'user', 'id' => $user_id, 'data' => user_row( $user_object ), - 'supplemental' => array( - 'show-link' => sprintf(__( 'User %s added' ), "user-$user_id", $user_object->user_login), - 'role' => $user_object->roles[0] - ) + 'supplemental' => array('show-link' => sprintf(__( 'User %s added' ), "user-$user_id", $user_object->user_login)) ) ); $x->send(); break; case 'autosave' : // The name of this action is hardcoded in edit_post() - check_ajax_referer( $action ); $_POST['post_content'] = $_POST['content']; $_POST['post_excerpt'] = $_POST['excerpt']; $_POST['post_status'] = 'draft'; @@ -327,7 +300,6 @@ case 'autosave' : // The name of this action is hardcoded in edit_post() die('0'); break; case 'autosave-generate-nonces' : - check_ajax_referer( $action ); $ID = (int) $_POST['post_ID']; if($_POST['post_type'] == 'post') { if(current_user_can('edit_post', $ID)) diff --git a/wp-admin/categories.php b/wp-admin/categories.php index 6e83a61..59ff4eb 100644 --- a/wp-admin/categories.php +++ b/wp-admin/categories.php @@ -102,7 +102,7 @@ $messages[5] = __('Category not updated.'); - + diff --git a/wp-admin/edit-category-form.php b/wp-admin/edit-category-form.php index 69f0528..4696129 100644 --- a/wp-admin/edit-category-form.php +++ b/wp-admin/edit-category-form.php @@ -9,7 +9,7 @@ if ( ! empty($cat_ID) ) { } else { $heading = __('Add Category'); $submit_text = __('Add Category »'); - $form = '
    '; + $form = ''; $action = 'addcat'; $nonce_action = 'add-category'; do_action('add_category_form_pre', $category); diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php index c761e8c..ab1bdbc 100644 --- a/wp-admin/edit-comments.php +++ b/wp-admin/edit-comments.php @@ -102,27 +102,24 @@ if ('view' == $mode) { $offset = $offset + 1; $start = " start='$offset'"; - echo "
      \n"; + echo "
        \n"; $i = 0; foreach ( $comments as $comment ) { + get_comment( $comment ); // Cache it _wp_comment_list_item( $comment->comment_ID, ++$i ); } echo "
      \n\n"; if ( $extra_comments ) : ?> @@ -152,8 +149,7 @@ if ( $extra_comments ) : ?> ' . __('Comment Excerpt') . ' ' . __('Actions') . ' - -'; +'; foreach ($comments as $comment) { $post = get_post($comment->comment_post_ID); $authordata = get_userdata($post->post_author); @@ -163,7 +159,7 @@ if ( $extra_comments ) : ?> ?> comment_post_ID) ) { ?> - + @@ -177,14 +173,12 @@ if ( $extra_comments ) : ?> comment_post_ID) ) { echo "" . __('Edit') . ""; } ?> comment_post_ID) ) { - $url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) ); - echo "" . __('Delete') . " "; + echo "comment_post_ID."&c=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to delete this comment by '%s'. \n 'Cancel' to stop, 'OK' to delete."), $comment->comment_author )) . "', theCommentList );\" class='delete'>" . __('Delete') . " "; } ?> - + ?>

      '); return false } return confirm('')" /> '); return false } return confirm('')" />

      diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index 35726f3..ab3adff 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -74,8 +74,8 @@ addLoadEvent(focusit);

      -

      -
      +

      +
      diff --git a/wp-admin/edit-link-form.php b/wp-admin/edit-link-form.php index 920ebe4..e281d30 100644 --- a/wp-admin/edit-link-form.php +++ b/wp-admin/edit-link-form.php @@ -42,8 +42,8 @@ function xfn_check($class, $value = '', $type = 'check') {

      -

      - +

      +
      diff --git a/wp-admin/edit-pages.php b/wp-admin/edit-pages.php index d9fa2ff..f263348 100644 --- a/wp-admin/edit-pages.php +++ b/wp-admin/edit-pages.php @@ -2,7 +2,7 @@ require_once('admin.php'); $title = __('Pages'); $parent_file = 'edit.php'; -wp_enqueue_script( 'wp-lists' ); +wp_enqueue_script( 'listman' ); require_once('admin-header.php'); $post_stati = array( // array( adj, noun ) @@ -20,12 +20,9 @@ if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($ } ?> - +
      +

      - + diff --git a/wp-admin/edit-post-rows.php b/wp-admin/edit-post-rows.php index d41f2df..c5e3a58 100644 --- a/wp-admin/edit-post-rows.php +++ b/wp-admin/edit-post-rows.php @@ -9,16 +9,13 @@ - + \n\t\n"; // Hack! -$class = ( $i_post > 15 || 'alternate' == $class) ? '' : 'alternate'; +while (have_posts()) : the_post(); +$class = ('alternate' == $class) ? '' : 'alternate'; global $current_user; $post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' ); ?> @@ -94,7 +91,7 @@ foreach($posts_columns as $column_name=>$column_display_name) { case 'control_delete': ?> - ID) ) { echo "ID) . "' class='delete:the-list:post-$post->ID delete'>" . __('Delete') . ""; } ?> + ID) ) { echo "ID) . "' class='delete' onclick=\"return deleteSomething( 'post', " . $id . ", '" . js_escape(sprintf(__("You are about to delete this post '%s'.\n'OK' to delete, 'Cancel' to stop."), get_the_title())) . "' );\">" . __('Delete') . ""; } ?> max_num_pages = ceil( $wp_query->found_posts / 15 ); // We grab 20 but only show 15 ( 5 more for ajax extra ) +$_GET['m'] = (int) $_GET['m']; +$_GET['cat'] = (int) $_GET['cat']; +$post_stati = array( // array( adj, noun ) + 'publish' => array(__('Published'), __('Published posts')), + 'future' => array(__('Scheduled'), __('Scheduled posts')), + 'pending' => array(__('Pending Review'), __('Pending posts')), + 'draft' => array(__('Draft'), _c('Drafts|manage posts header')), + 'private' => array(__('Private'), __('Private posts')) + ); + +$avail_post_stati = $wpdb->get_col("SELECT DISTINCT post_status FROM $wpdb->posts WHERE post_type = 'post'"); + +$post_status_q = ''; +$post_status_label = __('Posts'); +if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) { + $post_status_label = $post_stati[$_GET['post_status']][1]; + $post_status_q = '&post_status=' . $_GET['post_status']; +} ?>
      'display name' +$posts_columns = array(); +$posts_columns['id'] = '
      ' . __('ID') . '
      '; +if ( 'draft' === $_GET['post_status'] ) + $posts_columns['modified'] = __('Modified'); +elseif ( 'pending' === $_GET['post_status'] ) + $posts_columns['modified'] = __('Submitted'); +else + $posts_columns['date'] = __('When'); +$posts_columns['title'] = __('Title'); +$posts_columns['categories'] = __('Categories'); +if ( !in_array($_GET['post_status'], array('pending', 'draft', 'future')) ) + $posts_columns['comments'] = '
      ' . __('Comments') . '
      '; +$posts_columns['author'] = __('Author'); + +$posts_columns = apply_filters('manage_posts_columns', $posts_columns); + +// you can not edit these at the moment +$posts_columns['control_view'] = ''; +$posts_columns['control_edit'] = ''; +$posts_columns['control_delete'] = ''; ?> @@ -116,10 +162,6 @@ if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ? - -
      diff --git a/wp-admin/export.php b/wp-admin/export.php index b3d9495..69741bc 100644 --- a/wp-admin/export.php +++ b/wp-admin/export.php @@ -182,7 +182,7 @@ echo '\n"; - + '.$author.'
      '.''; + echo '
    1. '.__('Current author:').' '.$author.'
      '.''; $this->users_form($j); echo '
    2. '; } diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php index 3c4f474..e5911bd 100644 --- a/wp-admin/includes/plugin.php +++ b/wp-admin/includes/plugin.php @@ -86,48 +86,6 @@ function get_plugins() { return $wp_plugins; } -function activate_plugin($plugin) { - $current = get_option('active_plugins'); - $plugin = trim($plugin); - - if ( validate_file($plugin) ) - return new WP_Error('plugin_invalid', __('Invalid plugin.')); - if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) ) - return new WP_Error('plugin_not_found', __('Plugin file does not exist.')); - - if (!in_array($plugin, $current)) { - wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), 'plugins.php?error=true&plugin=' . $plugin)); // we'll override this later if the plugin can be included without fatal error - ob_start(); - @include(ABSPATH . PLUGINDIR . '/' . $plugin); - $current[] = $plugin; - sort($current); - update_option('active_plugins', $current); - do_action('activate_' . $plugin); - ob_end_clean(); - } - - return null; -} - -function deactivate_plugins($plugins) { - $current = get_option('active_plugins'); - - if(!is_array($plugins)) - $plugins = array($plugins); - - foreach($plugins as $plugin) { - array_splice($current, array_search( $plugin, $current), 1 ); // Array-fu! - do_action('deactivate_' . trim( $plugin )); - } - - update_option('active_plugins', $current); -} - -function deactivate_all_plugins() { - $current = get_option('active_plugins'); - deactivate_plugins($current); -} - // // Menu // diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index 3c9cc77..acd6e64 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -348,8 +348,6 @@ function add_meta( $post_ID ) { if ( in_array($metakey, $protected) ) return false; - wp_cache_delete($post_ID, 'post_meta'); - $result = $wpdb->query( " INSERT INTO $wpdb->postmeta (post_id,meta_key,meta_value ) @@ -364,9 +362,6 @@ function delete_meta( $mid ) { global $wpdb; $mid = (int) $mid; - $post_id = $wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = '$mid'"); - wp_cache_delete($post_id, 'post_meta'); - return $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_id = '$mid'" ); } @@ -413,9 +408,6 @@ function update_meta( $mid, $mkey, $mvalue ) { if ( in_array($mkey, $protected) ) return false; - $post_id = $wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = '$mid'"); - wp_cache_delete($post_id, 'post_meta'); - $mvalue = maybe_serialize( stripslashes( $mvalue )); $mvalue = $wpdb->escape( $mvalue ); $mid = (int) $mid; @@ -476,43 +468,4 @@ function _relocate_children( $old_ID, $new_ID ) { return $wpdb->query( "UPDATE $wpdb->posts SET post_parent = $new_ID WHERE post_parent = $old_ID" ); } -function wp_edit_posts_query( $q = false ) { - global $wpdb; - if ( false === $q ) - $q = $_GET; - $q['m'] = (int) $q['m']; - $q['cat'] = (int) $q['cat']; - $post_stati = array( // array( adj, noun ) - 'draft' => array(__('Draft'), _c('Drafts|manage posts header')), - 'future' => array(__('Scheduled'), __('Scheduled posts')), - 'pending' => array(__('Pending Review'), __('Pending posts')), - 'private' => array(__('Private'), __('Private posts')), - 'publish' => array(__('Published'), __('Published posts')) - ); - - $avail_post_stati = $wpdb->get_col("SELECT DISTINCT post_status FROM $wpdb->posts WHERE post_type = 'post'"); - - $post_status_q = ''; - $post_status_label = _c('Posts|manage posts header'); - if ( isset($q['post_status']) && in_array( $q['post_status'], array_keys($post_stati) ) ) { - $post_status_label = $post_stati[$q['post_status']][1]; - $post_status_q = '&post_status=' . $q['post_status']; - } - - if ( 'pending' === $q['post_status'] ) { - $order = 'ASC'; - $orderby = 'modified'; - } elseif ( 'draft' === $q['post_status'] ) { - $order = 'DESC'; - $orderby = 'modified'; - } else { - $order = 'DESC'; - $orderby = 'date'; - } - - wp("what_to_show=posts$post_status_q&posts_per_page=20&order=$order&orderby=$orderby"); - - return array($post_stati, $avail_post_stati); -} - ?> diff --git a/wp-admin/includes/schema.php b/wp-admin/includes/schema.php index d76d5f7..de4e949 100644 --- a/wp-admin/includes/schema.php +++ b/wp-admin/includes/schema.php @@ -4,7 +4,7 @@ global $wp_queries; $charset_collate = ''; -if ( $wpdb->supports_collation() ) { +if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) { if ( ! empty($wpdb->charset) ) $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; if ( ! empty($wpdb->collate) ) @@ -334,11 +334,11 @@ function populate_roles_160() { global $wp_roles; // Add roles - add_role('administrator', _c('Administrator|User role')); - add_role('editor', _c('Editor|User role')); - add_role('author', _c('Author|User role')); - add_role('contributor', _c('Contributor|User role')); - add_role('subscriber', _c('Subscriber|User role')); + add_role('administrator', __('Administrator')); + add_role('editor', __('Editor')); + add_role('author', __('Author')); + add_role('contributor', __('Contributor')); + add_role('subscriber', __('Subscriber')); // Add caps for Administrator role $role = get_role('administrator'); diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index c604d4c..ff809ec 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -41,7 +41,7 @@ function _cat_row( $category, $level, $name_override = false ) { $default_link_cat_id = (int) get_option( 'default_link_category' ); if ( $category->term_id != $default_cat_id ) - $edit .= "term_id ) . "' class='delete:the-list:cat-$category->term_id delete'>".__( 'Delete' ).""; + $edit .= "term_id ) . "' onclick=\"return deleteSomething( 'cat', $category->term_id, '" . js_escape(sprintf( __("You are about to delete the category '%s'.\nAll posts that were only assigned to this category will be assigned to the '%s' category.\nAll links that were only assigned to this category will be assigned to the '%s' category.\n'OK' to delete, 'Cancel' to stop." ), $category->name, get_catname( $default_cat_id ), get_catname( $default_link_cat_id ) )) . "' );\" class='delete'>".__( 'Delete' ).""; else $edit .= "".__( "Default" ); } else @@ -164,31 +164,6 @@ function dropdown_link_categories( $default = 0 ) { } } -// define the columns to display, the syntax is 'internal name' => 'display name' -function wp_manage_posts_columns() { - $posts_columns = array(); - $posts_columns['id'] = '
      ' . __('ID') . '
      '; - if ( 'draft' === $_GET['post_status'] ) - $posts_columns['modified'] = __('Modified'); - elseif ( 'pending' === $_GET['post_status'] ) - $posts_columns['modified'] = __('Submitted'); - else - $posts_columns['date'] = __('When'); - $posts_columns['title'] = __('Title'); - $posts_columns['categories'] = __('Categories'); - if ( !in_array($_GET['post_status'], array('pending', 'draft', 'future')) ) - $posts_columns['comments'] = '
      ' . __('Comments') . '
      '; - $posts_columns['author'] = __('Author'); - $posts_columns = apply_filters('manage_posts_columns', $posts_columns); - - // you can not edit these at the moment - $posts_columns['control_view'] = ''; - $posts_columns['control_edit'] = ''; - $posts_columns['control_delete'] = ''; - - return $posts_columns; -} - function page_rows( $parent = 0, $level = 0, $pages = 0, $hierarchy = true ) { global $wpdb, $class, $post; @@ -215,9 +190,9 @@ function page_rows( $parent = 0, $level = 0, $pages = 0, $hierarchy = true ) { post_modified ) _e('Unpublished'); else echo mysql2date( __('Y-m-d g:i a'), $post->post_modified ); ?> - + " . __( 'Edit' ) . ""; } ?> - " . __( 'Delete' ) . ""; } ?> + " . __( 'Delete' ) . ""; } ?> comment_ID; $class = ''; $post = get_post($comment->comment_post_ID); $authordata = get_userdata($post->post_author); - $comment_status = wp_get_comment_status($id); + $comment_status = wp_get_comment_status($comment->comment_ID); if ( 'unapproved' == $comment_status ) $class .= ' unapproved'; if ( $alt % 2 ) $class .= ' alternate'; - echo "
    3. "; + echo "
    4. "; ?> -

      comment_author_email) { ?>| comment_author_url && 'http://' != $comment->comment_author_url) { ?> | |

      +

      comment_author_email) { ?>| comment_author_url && 'http://' != $comment->comment_author_url) { ?> | |

      — [ comment_post_ID) ) { - echo " " . __('Edit') . ''; - $url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$id", "delete-comment_$id" ) ); - echo " | " . __('Delete') . ' '; + echo " " . __('Edit') . ''; + echo ' | comment_author)) . "', theCommentList );\">" . __('Delete') . ' '; if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) { - $url = clean_url( wp_nonce_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$id", "unapprove-comment_$id" ) ); - echo " | " . __('Unapprove') . ' '; - $url = clean_url( wp_nonce_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$id", "approve-comment_$id" ) ); - echo " | " . __('Approve') . ' '; + echo ' | ' . __('Unapprove') . ' '; + echo ' | ' . __('Approve') . ' '; } - $url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$id", "delete-comment_$id" ) ); - echo " | " . __('Spam') . ' '; + echo " | comment_post_ID . "&c=" . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to mark as spam this comment by '%s'.\n'Cancel' to stop, 'OK' to mark as spam."), $comment->comment_author)) . "', theCommentList );\">" . __('Spam') . " "; } -if ( !is_single() ) { - $post = get_post($comment->comment_post_ID, OBJECT, 'display'); - $post_title = wp_specialchars( $post->post_title, 'double' ); - $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title; +$post = get_post($comment->comment_post_ID, OBJECT, 'display'); +$post_title = wp_specialchars( $post->post_title, 'double' ); +$post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title; ?> - ] — - -

      + ] —

    5.  '; //TBODY needed for list-manipulation JS + echo ' '; //TBODY needed for list-manipulation JS return; } $count = 0; @@ -370,47 +338,43 @@ function list_meta( $meta ) { - "; -} - -function _list_meta_row( $entry, &$count ) { - $r = ''; - ++ $count; - if ( $count % 2 ) - $style = 'alternate'; - else - $style = ''; - if ('_' == $entry['meta_key'] { 0 } ) - $style .= ' hidden'; - - if ( is_serialized( $entry['meta_value'] ) ) { - if ( is_serialized_string( $entry['meta_value'] ) ) { - // this is a serialized string, so we should display it - $entry['meta_value'] = maybe_unserialize( $entry['meta_value'] ); - } else { - // this is a serialized array/object so we should NOT display it - --$count; - return; + $r ="\n\t"; + foreach ( $meta as $entry ) { + ++ $count; + if ( $count % 2 ) + $style = 'alternate'; + else + $style = ''; + if ('_' == $entry['meta_key'] { 0 } ) + $style .= ' hidden'; + + if ( is_serialized( $entry['meta_value'] ) ) { + if ( is_serialized_string( $entry['meta_value'] ) ) { + // this is a serialized string, so we should display it + $entry['meta_value'] = maybe_unserialize( $entry['meta_value'] ); + } else { + // this is a serialized array/object so we should NOT display it + --$count; + continue; + } } - } - $key_js = js_escape( $entry['meta_key'] ); - $entry['meta_key'] = attribute_escape($entry['meta_key']); - $entry['meta_value'] = attribute_escape($entry['meta_value']); - $entry['meta_id'] = (int) $entry['meta_id']; - $r .= "\n\t"; - $r .= "\n\t\t"; - $r .= "\n\t\t"; - $r .= "\n\t\t
      "; - $r .= "\n\t\t"; - $r .= ""; - $r .= "\n\t"; - return $r; + $key_js = js_escape( $entry['meta_key'] ); + $entry['meta_key'] = attribute_escape($entry['meta_key']); + $entry['meta_value'] = attribute_escape($entry['meta_value']); + $entry['meta_id'] = (int) $entry['meta_id']; + $r .= "\n\t"; + $r .= "\n\t\t"; + $r .= "\n\t\t"; + $r .= "\n\t\t
      "; + $r .= "\n\t\t"; + $r .= "\n\t"; + } + echo $r; + echo "\n\t"; } function meta_form() { @@ -451,11 +415,8 @@ function meta_form() { - - - - +

      check_database_version(); - if ( is_wp_error( $result ) ) - die( $result->get_error_message() ); + global $wp_version; + + // Make sure the server has MySQL 4.0 + $mysql_version = preg_replace('|[^0-9\.]|', '', @mysql_get_server_info()); + if ( version_compare($mysql_version, '4.0.0', '<') ) + die(sprintf(__('ERROR: WordPress %s requires MySQL 4.0.0 or higher'), $wp_version)); } function maybe_disable_automattic_widgets() { diff --git a/wp-admin/includes/user.php b/wp-admin/includes/user.php index bd017a4..ca15057 100644 --- a/wp-admin/includes/user.php +++ b/wp-admin/includes/user.php @@ -87,7 +87,7 @@ function edit_user( $user_id = 0 ) { $errors->add( 'pass', __( 'ERROR: Please enter your password twice.' )); } else { if ((empty ( $pass1 ) && !empty ( $pass2 ) ) || (empty ( $pass2 ) && !empty ( $pass1 ) ) ) - $errors->add( 'pass', __( 'ERROR: You entered your new password only once.' )); + $errors->add( 'pass', __( "ERROR: you typed your new password only once." )); } /* Check for "\" in password */ @@ -96,23 +96,23 @@ function edit_user( $user_id = 0 ) { /* checking the password has been typed twice the same */ if ( $pass1 != $pass2 ) - $errors->add( 'pass', __( 'ERROR: Please enter the same password in the two password fields.' )); + $errors->add( 'pass', __( 'ERROR: Please type the same password in the two password fields.' )); if (!empty ( $pass1 )) $user->user_pass = $pass1; if ( !$update && !validate_username( $user->user_login ) ) - $errors->add( 'user_login', __( 'ERROR: This username is invalid. Please enter a valid username.' )); + $errors->add( 'user_login', __( 'ERROR: This username is invalid. Please enter a valid username.' )); if (!$update && username_exists( $user->user_login )) - $errors->add( 'user_login', __( 'ERROR: This username is already registered. Please choose another one.' )); + $errors->add( 'user_login', __( 'ERROR: This username is already registered, please choose another one.' )); /* checking e-mail address */ if ( empty ( $user->user_email ) ) { - $errors->add( 'user_email', __( 'ERROR: Please enter an e-mail address.' )); + $errors->add( 'user_email', __( "ERROR: please type an e-mail address" )); } else if (!is_email( $user->user_email ) ) { - $errors->add( 'user_email', __( "ERROR: The e-mail address isn't correct." )); + $errors->add( 'user_email', __( "ERROR: the email address isn't correct" )); } if ( $errors->get_error_codes() ) diff --git a/wp-admin/js/cat.js b/wp-admin/js/cat.js index 9cb81cf..b486996 100644 --- a/wp-admin/js/cat.js +++ b/wp-admin/js/cat.js @@ -1,4 +1,12 @@ -jQuery( function($) { - $('#jaxcat').prepend('' + catL10n.how + '') - var a = $('#categorychecklist').wpList( { alt: '', response: 'cat-ajax-response' } ); -} ); +addLoadEvent(function(){catList=new listMan('categorychecklist');catList.ajaxRespEl='jaxcat';catList.topAdder=1;catList.alt=0;catList.showLink=0;}); +addLoadEvent(newCatAddIn); +function newCatAddIn() { + var jaxcat = $('jaxcat'); + if ( !jaxcat ) + return false; + // These multiple blank hidden inputs are needed: https://bugzilla.mozilla.org/show_bug.cgi?id=377815 , #3895 , #4664 + Element.update(jaxcat,'' + catL10n.how + ''); + $('newcat').onkeypress = function(e) { return killSubmit("catList.ajaxAdder('category','jaxcat');", e); }; + $('catadd').onclick = function() { catList.ajaxAdder('category', 'jaxcat'); }; +} + diff --git a/wp-admin/js/categories.js b/wp-admin/js/categories.js index 23a67c5..3cee6c6 100644 --- a/wp-admin/js/categories.js +++ b/wp-admin/js/categories.js @@ -1,18 +1,16 @@ -jQuery(function($) { - var options = document.forms['addcat'].category_parent.options; - - var addAfter = function( r, settings ) { - var name = $("" + $('name', r).text() + "").html(); - var id = $('cat', r).attr('id'); +addLoadEvent(function() { + if (!theList.theList) return false; + document.forms.addcat.submit.onclick = function(e) {return killSubmit('theList.ajaxAdder("cat", "addcat");', e); }; + theList.addComplete = function(what, where, update, transport) { + var name = getNodeValue(transport.responseXML, 'name').unescapeHTML(); + var id = transport.responseXML.getElementsByTagName(what)[0].getAttribute('id'); + var options = document.forms['addcat'].category_parent.options; options[options.length] = new Option(name, id); - } - - var delAfter = function( r, settings ) { - var id = $('cat', r).attr('id'); + }; + theList.delComplete = function(what, id) { + var options = document.forms['addcat'].category_parent.options; for ( var o = 0; o < options.length; o++ ) if ( id == options[o].value ) options[o] = null; - } - - var a = $('#the-list').wpList( { addAfter: addAfter, delAfter: delAfter } ); + }; }); diff --git a/wp-admin/js/custom-fields.js b/wp-admin/js/custom-fields.js index 8f2b1a5..ad7a2db 100644 --- a/wp-admin/js/custom-fields.js +++ b/wp-admin/js/custom-fields.js @@ -1,33 +1,26 @@ -jQuery( function($) { - var before = function() { - var nonce = $('#newmeta [@name=_ajax_nonce]').val(); - var postId = $('#post_ID').val(); - if ( !nonce || !postId ) { return false; } - return [nonce,postId]; +function customFieldsOnComplete( what, where, update, transport ) { + var pidEl = $('post_ID'); + pidEl.name = 'post_ID'; + pidEl.value = getNodeValue(transport.responseXML, 'postid'); + var aEl = $('hiddenaction') + if ( aEl.value == 'post' ) aEl.value = 'postajaxpost'; +} +addLoadEvent(customFieldsAddIn); +function customFieldsAddIn() { + theList.showLink=0; + theList.addComplete = customFieldsOnComplete; + if (!theList.theList) return false; + inputs = theList.theList.getElementsByTagName('input'); + for ( var i=0; i < inputs.length; i++ ) { + if ('text' == inputs[i].type) { + inputs[i].setAttribute('autocomplete', 'off'); + inputs[i].onkeypress = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.name.slice(5),10) + '");', e); }; + } + if ('updatemeta' == inputs[i].className) { + inputs[i].onclick = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.parentNode.parentNode.id.slice(5),10) + '");', e); }; + } } - var addBefore = function( s ) { - var b = before(); - if ( !b ) { return false; } - s.data = s.data.replace(/_ajax_nonce=[a-f0-9]+/, '_ajax_nonce=' + b[0]) + '&post_id=' + b[1]; - return s; - }; - - var addAfter = function( r, s ) { - var postId = $('postid', r).text(); - if ( !postId ) { return; } - $('#post_ID').attr( 'name', 'post_ID' ).val( postId ); - var h = $('#hiddenaction'); - if ( 'post' == h.val() ) { h.val( 'postajaxpost' ); } - }; - - var delBefore = function( s ) { - var b = before(); if ( !b ) return false; - s.data._ajax_nonce = b[0]; s.data.post_id = b[1]; - return s; - } - - $('#the-list') - .wpList( { addBefore: addBefore, addAfter: addAfter, delBefore: delBefore } ) - .find('.updatemeta, .deletemeta').attr( 'type', 'button' ); -} ); + $('metakeyinput').onkeypress = function(e) {return killSubmit('theList.inputData+="&id="+$("post_ID").value;theList.ajaxAdder("meta", "newmeta");', e); }; + $('updatemetasub').onclick = function(e) {return killSubmit('theList.inputData+="&id="+$("post_ID").value;theList.ajaxAdder("meta", "newmeta");', e); }; +} diff --git a/wp-admin/js/edit-comments.js b/wp-admin/js/edit-comments.js index a185774..e1fc68f 100644 --- a/wp-admin/js/edit-comments.js +++ b/wp-admin/js/edit-comments.js @@ -1,26 +1,59 @@ -var list; var extra; -jQuery(function($) { +addLoadEvent(function() { + theCommentList = new listMan('the-comment-list'); + if ( !theCommentList ) + return false; -var dimAfter = function( r, settings ) { - var a = $('#awaitmod'); - a.html( parseInt(a.html(),10) + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 ) ); -} - -var delAfter = function( r, settings ) { - var a = $('#awaitmod'); - if ( $('#' + settings.element).is('.unapproved') && parseInt(a.html(),10) > 0 ) { - a.html( parseInt(a.html(),10) - 1 ); + theExtraCommentList = new listMan('the-extra-comment-list'); + if ( theExtraCommentList ) { + theExtraCommentList.showLink = 0; + theExtraCommentList.altOffset = 1; + if ( theExtraCommentList.theList && theExtraCommentList.theList.childNodes ) + var commentNum = $A(theExtraCommentList.theList.childNodes).findAll( function(i) { return Element.visible(i) } ).length; + else + var commentNum = 0; + var urlQ = document.location.href.split('?'); + var params = urlQ[1] ? urlQ[1].toQueryParams() : []; + var search = params['s'] ? params['s'] : ''; + var page = params['apage'] ? params['apage'] : 1; } - if ( extra.size() == 0 || extra.children().size() == 0 ) { - return; + theCommentList.dimComplete = function(what,id,dimClass) { + var m = document.getElementById('awaitmod'); + if ( document.getElementById(what + '-' + id).className.match(dimClass) ) + m.innerHTML = parseInt(m.innerHTML,10) + 1; + else + m.innerHTML = parseInt(m.innerHTML,10) - 1; } - list[0].wpList.add( extra.children(':eq(0)').remove().clone() ); - $('#get-extra-comments').submit(); -} + theCommentList.delComplete = function(what,id) { + var m = document.getElementById('awaitmod'); + what = what.split('-')[0]; + if ( document.getElementById(what + '-' + id).className.match('unapproved') ) + m.innerHTML = parseInt(m.innerHTML,10) - 1; + if ( theExtraCommentList && commentNum ) { + var theMover = theExtraCommentList.theList.childNodes[0]; + Element.removeClassName(theMover,'alternate'); + theCommentList.theList.appendChild(theMover); + theExtraCommentList.inputData += '&page=' + page; + if ( search ) + theExtraCommentList.inputData += '&s=' + search; // trust the URL not the search box + theExtraCommentList.addComplete = function() { + if ( theExtraCommentList.theList.childNodes ) + var commentNum = $A(theExtraCommentList.theList.childNodes).findAll( function(i) { return Element.visible(i) } ).length; + else + var commentNum = 0; + } + theExtraCommentList.ajaxAdder( 'comment', 'ajax-response' ); // Dummy Request + } + } -extra = $('#the-extra-comment-list').wpList( { alt: '', delColor: 'none', addColor: 'none' } ); -list = $('#the-comment-list').wpList( { dimAfter : dimAfter, delAfter : delAfter, addColor: 'none' } ); + if ( theList ) // the post list: edit.php + theList.delComplete = function() { + var comments = document.getElementById('comments'); + var commdel = encloseFunc(function(a){a.parentNode.removeChild(a);},comments); + var listdel = encloseFunc(function(a){a.parentNode.removeChild(a);},theCommentList.theList); + setTimeout(commdel,705); + setTimeout(listdel,705); + } +}); -} ); diff --git a/wp-admin/js/edit-posts.js b/wp-admin/js/edit-posts.js deleted file mode 100644 index 5241c4c..0000000 --- a/wp-admin/js/edit-posts.js +++ /dev/null @@ -1,22 +0,0 @@ -jQuery(function($) { -var delAfter; var extra; var list; - -if ( document.location.href.match(/(\?|&)c=/) ) - delAfter = function() { $('#comments, #the-comment-list').remove(); } -else - delAfter = function() { - list[0].wpList.add( extra.children(':eq(0)').remove().clone() ); - $('#get-extra-posts').submit(); - } - -var addBefore = function ( settings ) { - var q = document.location.href.split('?'); - if ( q[1] ) - settings.data += '&' + q[1]; - return settings; -} - -extra = $('#the-extra-list').wpList( { alt: '', addBefore: addBefore, addColor: 'none', delColor: 'none' } ); -list = $('#the-list').wpList( { delAfter: delAfter, addColor: 'none' } ); - -} ); diff --git a/wp-admin/js/link-cat.js b/wp-admin/js/link-cat.js index e69de29..1e95fa3 100644 --- a/wp-admin/js/link-cat.js +++ b/wp-admin/js/link-cat.js @@ -0,0 +1,11 @@ +addLoadEvent(function(){linkcatList=new listMan('linkcategorychecklist');linkcatList.ajaxRespEl='jaxcat';linkcatList.topAdder=1;linkcatList.alt=0;linkcatList.showLink=0;}); +addLoadEvent(newLinkCatAddIn); +function newLinkCatAddIn() { + var jaxcat = $('jaxcat'); + if ( !jaxcat ) + return false; + Element.update(jaxcat,'' + linkcatL10n.how + ''); + $('newcat').onkeypress = function(e) { return killSubmit("linkcatList.ajaxAdder('link-category','jaxcat');", e); }; + $('catadd').onclick = function() { linkcatList.ajaxAdder('link-category', 'jaxcat'); }; +} + diff --git a/wp-admin/js/users.js b/wp-admin/js/users.js index 5b89d0f..f249f65 100644 --- a/wp-admin/js/users.js +++ b/wp-admin/js/users.js @@ -1,22 +1,21 @@ -jQuery( function($) { - var userLists; var list; var addBefore; var addAfter; +addLoadEvent(function() { + theListEls = document.getElementsByTagName('tbody'); + theUserLists = new Array(); + for ( var l = 0; l < theListEls.length; l++ ) { + if ( theListEls[l].id ) + theUserLists[theListEls[l].id] = new listMan(theListEls[l].id); + } + addUserInputs = document.getElementById('adduser').getElementsByTagName('input'); + for ( var i = 0; i < addUserInputs.length; i++ ) { + addUserInputs[i].onkeypress = function(e) { return killSubmit('addUserSubmit();', e); } + } + document.getElementById('addusersub').onclick = function(e) { return killSubmit('addUserSubmit();', e); } +} +); - addBefore = function( s ) { - if ( $( '#role-' + $('#role').val() ).size() ) - return s; - return false; - }; - - addAfter = function( r, s ) { - var roleTable = $( '#role-' + $('role', r).text() ); - - var e = $('#user-' + $('user', r).attr('id') ); - if ( !roleTable.size() ) { return; } - if ( !e.size() ) { return; } - - roleTable[0].wpList.add(e.remove().clone()); - }; - - userLists = $('.user-list').wpList(); - list = $('#user-list').wpList( { addBefore: addBefore, addAfter: addAfter } ); -} ); +function addUserSubmit() { + var roleEl = document.getElementById('role'); + var role = roleEl.options[roleEl.selectedIndex].value; + if ( !theUserLists['role-' + role] ) return true; + return theUserLists['role-' + role].ajaxAdder('user', 'adduser'); +} diff --git a/wp-admin/link-add.php b/wp-admin/link-add.php index 1e48fe8..2b06d8e 100644 --- a/wp-admin/link-add.php +++ b/wp-admin/link-add.php @@ -13,7 +13,7 @@ wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image', wp_enqueue_script( array('xfn', 'dbx-admin-key?pagenow=link.php') ); if ( current_user_can( 'manage_categories' ) ) - wp_enqueue_script( 'ajaxcat' ); + wp_enqueue_script( 'ajaxlinkcat' ); require('admin-header.php'); ?> diff --git a/wp-admin/link-manager.php b/wp-admin/link-manager.php index d9240de..ade3143 100644 --- a/wp-admin/link-manager.php +++ b/wp-admin/link-manager.php @@ -6,7 +6,7 @@ require_once ('admin.php'); -wp_enqueue_script( 'wp-lists' ); +wp_enqueue_script( 'listman' ); wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]')); @@ -46,7 +46,7 @@ switch ($order_by) { } ?> - + " . __('Edit') . ''; - echo "link_id ) . "' class='delete:the-list:link-$link->link_id delete'>" . __('Delete') . ''; + echo ''.__('Edit').''; + echo 'link_id , '".js_escape(sprintf(__("You are about to delete the '%s' link to %s.\n'Cancel' to stop, 'OK' to delete."), $link->link_name, $link->link_url )).'\' );" class="delete">'.__('Delete').''; break; default: ?> diff --git a/wp-admin/menu.php b/wp-admin/menu.php index 89337b8..11e04f4 100644 --- a/wp-admin/menu.php +++ b/wp-admin/menu.php @@ -150,7 +150,7 @@ unset($id); uksort($menu, "strnatcasecmp"); // make it all pretty -if ( !user_can_access_admin_page() ) { +if (! user_can_access_admin_page()) { // find the blog of this user first $primary_blog = (int) get_usermeta( $user_ID, 'primary_blog' ); if( $primary_blog != 0 ) { diff --git a/wp-admin/page.php b/wp-admin/page.php index c68901d..7a373e9 100644 --- a/wp-admin/page.php +++ b/wp-admin/page.php @@ -108,14 +108,10 @@ case 'editpost': } else { if ($_POST['save']) { $location = "page.php?action=edit&post=$page_ID"; - } elseif ($_POST['addemeta']) { - $location = add_query_arg( 'message', 2, wp_get_referer() ); - $location = explode('#', $location); - $location = $location[0] . '#postcustom'; + } elseif ($_POST['updatemeta']) { + $location = wp_get_referer() . '&message=2#postcustom'; } elseif ($_POST['deletemeta']) { - $location = add_query_arg( 'message', 3, wp_get_referer() ); - $location = explode('#', $location); - $location = $location[0] . '#postcustom'; + $location = wp_get_referer() . '&message=3#postcustom'; } elseif (!empty($_POST['referredby']) && $_POST['referredby'] != wp_get_referer()) { $location = $_POST['referredby']; if ( $_POST['referredby'] == 'redo' ) diff --git a/wp-admin/plugins.php b/wp-admin/plugins.php index 5e7bcf2..8593424 100644 --- a/wp-admin/plugins.php +++ b/wp-admin/plugins.php @@ -11,9 +11,22 @@ if( $menu_perms[ 'plugins' ] != 1 ) if ( isset($_GET['action']) ) { if ('activate' == $_GET['action']) { check_admin_referer('activate-plugin_' . $_GET['plugin']); - $result = activate_plugin($_GET['plugin']); - if( is_wp_error( $result ) ) - wp_die( $result->get_error_message() ); + $current = get_option('active_plugins'); + $plugin = trim($_GET['plugin']); + if ( validate_file($plugin) ) + wp_die(__('Invalid plugin.')); + if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) ) + wp_die(__('Plugin file does not exist.')); + if (!in_array($plugin, $current)) { + wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), 'plugins.php?error=true&plugin=' . $plugin)); // we'll override this later if the plugin can be included without fatal error + ob_start(); + @include(ABSPATH . PLUGINDIR . '/' . $plugin); + $current[] = $plugin; + sort($current); + update_option('active_plugins', $current); + do_action('activate_' . $plugin); + ob_end_clean(); + } wp_redirect('plugins.php?activate=true'); // overrides the ?error=true one above } elseif ('error_scrape' == $_GET['action']) { $plugin = trim($_GET['plugin']); @@ -25,11 +38,21 @@ if ( isset($_GET['action']) ) { include(ABSPATH . PLUGINDIR . '/' . $plugin); } elseif ('deactivate' == $_GET['action']) { check_admin_referer('deactivate-plugin_' . $_GET['plugin']); - deactivate_plugins($_GET['plugin']); + $current = get_option('active_plugins'); + array_splice($current, array_search( $_GET['plugin'], $current), 1 ); // Array-fu! + update_option('active_plugins', $current); + do_action('deactivate_' . trim( $_GET['plugin'] )); wp_redirect('plugins.php?deactivate=true'); } elseif ($_GET['action'] == 'deactivate-all') { check_admin_referer('deactivate-all'); - deactivate_all_plugins(); + $current = get_option('active_plugins'); + + foreach ($current as $plugin) { + array_splice($current, array_search($plugin, $current), 1); + do_action('deactivate_' . $plugin); + } + + update_option('active_plugins', array()); wp_redirect('plugins.php?deactivate-all=true'); } exit; diff --git a/wp-admin/post.php b/wp-admin/post.php index 4609bae..680f8ab 100644 --- a/wp-admin/post.php +++ b/wp-admin/post.php @@ -121,14 +121,10 @@ case 'editpost': if ($_POST['save']) { $location = "post.php?action=edit&post=$post_ID"; - } elseif ($_POST['addemeta']) { - $location = add_query_arg( 'message', 2, wp_get_referer() ); - $location = explode('#', $location); - $location = $location[0] . '#postcustom'; + } elseif ($_POST['updatemeta']) { + $location = wp_get_referer() . '&message=2#postcustom'; } elseif ($_POST['deletemeta']) { - $location = add_query_arg( 'message', 3, wp_get_referer() ); - $location = explode('#', $location); - $location = $location[0] . '#postcustom'; + $location = wp_get_referer() . '&message=3#postcustom'; } elseif (!empty($referredby) && $referredby != $referer) { $location = $_POST['referredby']; if ( $_POST['referredby'] == 'redo' ) diff --git a/wp-admin/setup-config.php b/wp-admin/setup-config.php index 976c5ac..139ccd3 100644 --- a/wp-admin/setup-config.php +++ b/wp-admin/setup-config.php @@ -1,9 +1,6 @@ $line) { diff --git a/wp-admin/users.php b/wp-admin/users.php index c4a5917..83c6cb5 100644 --- a/wp-admin/users.php +++ b/wp-admin/users.php @@ -523,7 +523,7 @@ foreach($roleclasses as $role => $roleclass) { -">max_num_pages #)"); @@ -739,7 +739,7 @@ EOD; Copyright - +WordPress.com Atom API ATOM_NS ?>" xmlns:app="ATOMPUB_NS ?>" xml:lang=""> ID); ?> - +prep_content(get_the_title()); ?> <?php echo $content ?> @@ -806,7 +806,7 @@ EOD; post_content ) ) : -list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?> +list($content_type, $content) = $this->prep_content(get_the_content()); ?> @@ -814,11 +814,37 @@ list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?> - +prep_content(get_the_excerpt()); ?> ' . $data . '
      ', true); + $code = xml_get_error_code($parser); + xml_parser_free($parser); + + if (!$code) { + if (strpos($data, '<') === false) { + return array('text', $data); + } else { + $data = "
      $data
      "; + return array('xhtml', $data); + } + } + + if (strpos($data, ']]>') == false) { + return array('html', ""); + } else { + return array('html', htmlspecialchars($data)); + } + } + function ok() { log_app('Status','200: OK'); header('Content-Type: text/plain'); diff --git a/wp-content/themes/classic/header.php b/wp-content/themes/classic/header.php index 4a3e0b4..2c02a89 100644 --- a/wp-content/themes/classic/header.php +++ b/wp-content/themes/classic/header.php @@ -6,13 +6,15 @@ <?php bloginfo('name'); ?><?php wp_title(); ?> + + - + diff --git a/wp-content/themes/default/footer.php b/wp-content/themes/default/footer.php index 68e9e5f..50611ab 100644 --- a/wp-content/themes/default/footer.php +++ b/wp-content/themes/default/footer.php @@ -2,7 +2,7 @@