From 89fe0ff804e7c6497ebacc8b341ac89974f6f255 Mon Sep 17 00:00:00 2001 From: donncha Date: Mon, 21 May 2007 18:37:58 +0000 Subject: WP Merge to rev 5499, this is a big one! Test it before you put it live! Test only, not for production use yet git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@972 7be80a69-a1ef-0310-a953-fb0f7c49ff36 --- wp-admin/admin-ajax.php | 25 +++ wp-admin/admin-db.php | 20 +++ wp-admin/admin-footer.php | 2 +- wp-admin/admin-functions.php | 93 ++++++++-- wp-admin/admin-header.php | 4 +- wp-admin/cat.js | 2 +- wp-admin/categories.js | 2 +- wp-admin/categories.php | 1 + wp-admin/comment.php | 2 +- wp-admin/custom-header.php | 17 +- wp-admin/dbx-admin-key.js | 2 +- wp-admin/edit-comments.js | 42 ++++- wp-admin/edit-comments.php | 161 +++++------------ wp-admin/edit-form-advanced.php | 11 +- wp-admin/edit-form-comment.php | 2 +- wp-admin/edit-link-form.php | 6 +- wp-admin/edit-page-form.php | 11 +- wp-admin/edit-pages.php | 6 +- wp-admin/edit.php | 4 +- wp-admin/export.php | 39 ++-- wp-admin/images/heading-bg.gif | Bin 0 -> 37 bytes wp-admin/import.php | 7 +- wp-admin/import/blogger.php | 4 +- wp-admin/import/dotclear.php | 32 ++-- wp-admin/import/greymatter.php | 8 +- wp-admin/import/livejournal.php | 3 +- wp-admin/import/mt.php | 3 + wp-admin/import/rss.php | 1 + wp-admin/import/textpattern.php | 36 ++-- wp-admin/import/utw.php | 270 ++++++++++++++++++++++++++++ wp-admin/import/wordpress.php | 242 +++++++++++++++---------- wp-admin/import/wp-cat2tag.php | 226 +++++++++++++++++++++++ wp-admin/index-extra.php | 14 +- wp-admin/index.php | 12 +- wp-admin/link-import.php | 8 +- wp-admin/link-manager.php | 2 +- wp-admin/menu.php | 1 + wp-admin/moderation.php | 8 +- wp-admin/options-permalink.php | 5 +- wp-admin/page.php | 6 - wp-admin/plugins.php | 20 +++ wp-admin/post-new.php | 4 +- wp-admin/post.php | 6 - wp-admin/profile.php | 24 +-- wp-admin/rtl.css | 9 +- wp-admin/themes.php | 2 +- wp-admin/upgrade-functions.php | 38 +++- wp-admin/upload-functions.php | 1 + wp-admin/upload.css | 1 + wp-admin/upload.php | 4 +- wp-admin/user-edit.php | 6 +- wp-admin/widgets-rtl.css | 39 ++++ wp-admin/widgets.css | 214 ++++++++++++++++++++++ wp-admin/widgets.php | 390 ++++++++++++++++++++++++++++++++++++++++ wp-admin/wp-admin.css | 30 ++-- 55 files changed, 1763 insertions(+), 365 deletions(-) create mode 100644 wp-admin/images/heading-bg.gif create mode 100644 wp-admin/import/utw.php create mode 100644 wp-admin/import/wp-cat2tag.php create mode 100644 wp-admin/widgets-rtl.css create mode 100644 wp-admin/widgets.css create mode 100644 wp-admin/widgets.php (limited to 'wp-admin') diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index 2ad2469..ad5064f 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -151,6 +151,31 @@ case 'add-cat' : // From Manage->Categories ) ); $x->send(); break; +case 'add-comment' : + if ( !current_user_can( 'edit_post', $id ) ) + die('-1'); + $search = isset($_POST['s']) ? $_POST['s'] : false; + $start = isset($_POST['page']) ? intval($_POST['page']) * 25 : 25; + + list($comments, $total) = _wp_get_comment_list( $search, $start, 1 ); + + if ( !$comments ) + die('1'); + $x = new WP_Ajax_Response(); + foreach ( (array) $comments as $comment ) { + get_comment( $comment ); + ob_start(); + _wp_comment_list_item( $comment->comment_ID ); + $comment_list_item = ob_get_contents(); + ob_end_clean(); + $x->add( array( + 'what' => 'comment', + 'id' => $comment->comment_ID, + 'data' => $comment_list_item + ) ); + } + $x->send(); + break; case 'add-meta' : if ( !current_user_can( 'edit_post', $id ) ) die('-1'); diff --git a/wp-admin/admin-db.php b/wp-admin/admin-db.php index de90ad7..24e2388 100644 --- a/wp-admin/admin-db.php +++ b/wp-admin/admin-db.php @@ -125,6 +125,11 @@ function wp_insert_category($catarr) { else $links_private = 0; + + // Let's check if we have this category already, if so just do an update + if ( !$update && $cat_ID = category_object_exists( $category_nicename ) ) + $update = true; + if (!$update) { $maxcat = $wpdb->get_var( "SELECT max(cat_ID) FROM {$wpdb->categories}" ); $cat_ID = mt_rand( $maxcat+100, $maxcat+4000 ); @@ -153,6 +158,11 @@ function wp_insert_category($catarr) { clean_category_cache($cat_ID); + if ($update) + do_action('edited_category', $cat_ID); + else + do_action('created_category', $cat_ID); + return $cat_ID; } @@ -245,6 +255,14 @@ function wp_create_categories($categories, $post_id = '') { return $cat_ids; } +function category_object_exists($cat_name) { + global $wpdb; + if (!$category_nicename = sanitize_title($cat_name)) + return 0; + + return (int) $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE category_nicename = '$category_nicename'"); +} + function category_exists($cat_name) { global $wpdb; if (!$category_nicename = sanitize_title($cat_name)) @@ -419,6 +437,8 @@ function wp_delete_link($link_id) { $wpdb->query("DELETE FROM $wpdb->link2cat WHERE link_id = '$link_id'"); return $wpdb->query("DELETE FROM $wpdb->links WHERE link_id = '$link_id'"); + + do_action('deleted_link', $link_id); } function wp_get_link_cats($link_ID = 0) { diff --git a/wp-admin/admin-footer.php b/wp-admin/admin-footer.php index 8e30631..40a3e8c 100644 --- a/wp-admin/admin-footer.php +++ b/wp-admin/admin-footer.php @@ -2,7 +2,7 @@ diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 7b9507c..10f8eeb 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -490,7 +490,7 @@ function edit_user( $user_id = 0 ) { if ( isset( $_POST['email'] )) $user->user_email = wp_specialchars( trim( $_POST['email'] )); if ( isset( $_POST['url'] ) ) { - $user->user_url = wp_specialchars( trim( $_POST['url'] )); + $user->user_url = clean_url( trim( $_POST['url'] )); $user->user_url = preg_match('/^(https?|ftps?|mailto|news|irc|gopher|nntp|feed|telnet):/is', $user->user_url) ? $user->user_url : 'http://'.$user->user_url; } if ( isset( $_POST['first_name'] )) @@ -702,6 +702,7 @@ function get_nested_categories( $default = 0, $parent = 0 ) { } } + $result = apply_filters('get_nested_categories', $result); usort( $result, 'sort_cats' ); return $result; @@ -774,6 +775,8 @@ function cat_rows( $parent = 0, $level = 0, $categories = 0 ) { if (!$categories ) $categories = get_categories( 'hide_empty=0' ); + $children = _get_category_hierarchy(); + if ( $categories ) { ob_start(); foreach ( $categories as $category ) { @@ -783,7 +786,8 @@ function cat_rows( $parent = 0, $level = 0, $categories = 0 ) { } if ( $category->category_parent == $parent) { echo "\t" . _cat_row( $category, $level ); - cat_rows( $category->cat_ID, $level +1, $categories ); + if ( isset($children[$category->cat_ID]) ) + cat_rows( $category->cat_ID, $level +1, $categories ); } } $output = ob_get_contents(); @@ -815,8 +819,8 @@ function _cat_row( $category, $level, $name_override = false ) { $class = ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || " class='alternate'" == $class ) ? '' : " class='alternate'"; - $category->category_count = number_format( $category->category_count ); - $category->link_count = number_format( $category->link_count ); + $category->category_count = number_format_i18n( $category->category_count ); + $category->link_count = number_format_i18n( $category->link_count ); $posts_count = ( $category->category_count > 0 ) ? "$category->category_count" : $category->category_count; return " $category->cat_ID @@ -898,6 +902,68 @@ function user_row( $user_object, $style = '' ) { return $r; } +function _wp_get_comment_list( $s = false, $start, $num ) { + global $wpdb; + + $start = (int) $start; + $num = (int) $num; + + if ( $s ) { + $s = $wpdb->escape($s); + $comments = $wpdb->get_results("SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE + (comment_author LIKE '%$s%' OR + comment_author_email LIKE '%$s%' OR + comment_author_url LIKE ('%$s%') OR + comment_author_IP LIKE ('%$s%') OR + comment_content LIKE ('%$s%') ) AND + comment_approved != 'spam' + ORDER BY comment_date DESC LIMIT $start, $num"); + } else { + $comments = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE comment_approved = '0' OR comment_approved = '1' ORDER BY comment_date DESC LIMIT $start, $num" ); + } + + $total = $wpdb->get_var( "SELECT FOUND_ROWS()" ); + + return array($comments, $total); +} + +function _wp_comment_list_item( $id, $alt = 0 ) { + global $authordata, $comment, $wpdb; + $id = (int) $id; + $comment =& get_comment( $id ); + $class = ''; + $authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID")); + $comment_status = wp_get_comment_status($comment->comment_ID); + if ( 'unapproved' == $comment_status ) + $class .= ' unapproved'; + if ( $alt % 2 ) + $class .= ' alternate'; + echo "
  • "; +?> +

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

    + + + +

    — [ +comment_post_ID) ) { + echo " " . __('Edit') . ''; + echo ' | comment_author)) . "', theCommentList );\">" . __('Delete') . ' '; + if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) { + echo ' | ' . __('Unapprove') . ' '; + echo ' | ' . __('Approve') . ' '; + } + 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') . " "; +} +$post = get_post($comment->comment_post_ID); +$post_title = wp_specialchars( $post->post_title, 'double' ); +$post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title; +?> + ] —

    +
  • +' . trim( $author_name[1] ) . ''; } - return array ('Name' => $name, 'Title' => $plugin, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template[1] ); + return array('Name' => $name, 'Title' => $plugin, 'Description' => $description, 'Author' => $author, 'Version' => $version); } function get_plugins() { @@ -1701,20 +1768,20 @@ function get_plugins() { $plugins_dir = @ dir( $plugin_root); if ( $plugins_dir ) { while (($file = $plugins_dir->read() ) !== false ) { - if ( preg_match( '|^\.+$|', $file )) + if ( substr($file, 0, 1) == '.' ) continue; if ( is_dir( $plugin_root.'/'.$file ) ) { $plugins_subdir = @ dir( $plugin_root.'/'.$file ); if ( $plugins_subdir ) { while (($subfile = $plugins_subdir->read() ) !== false ) { - if ( preg_match( '|^\.+$|', $subfile )) + if ( substr($subfile, 0, 1) == '.' ) continue; - if ( preg_match( '|\.php$|', $subfile )) + if ( substr($subfile, -4) == '.php' ) $plugin_files[] = "$file/$subfile"; } } } else { - if ( preg_match( '|\.php$|', $file )) + if ( substr($file, -4) == '.php' ) $plugin_files[] = $file; } } @@ -1795,7 +1862,7 @@ function register_importer( $id, $name, $description, $callback ) { function get_importers() { global $wp_importers; - + uasort($wp_importers, create_function('$a, $b', 'return strcmp($a[0], $b[0]);')); return $wp_importers; } @@ -1878,8 +1945,11 @@ function wp_handle_upload( &$file, $overrides = false ) { extract( $wp_filetype ); - if ( !$type || !$ext ) + if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) ) return $upload_error_handler( $file, __( 'File type does not meet security guidelines. Try another.' )); + + if ( !$ext ) + $ext = strrchr($file['name'], '.'); } // A writable uploads dir will pass this test. Again, there's no point overriding this one. @@ -1950,6 +2020,7 @@ function wp_import_upload_form( $action ) { ?>

    + ( ) diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php index 9f6402b..d6ff2ef 100644 --- a/wp-admin/admin-header.php +++ b/wp-admin/admin-header.php @@ -13,7 +13,7 @@ get_admin_page_title(); ?> -> + > <?php bloginfo('name') ?> › <?php echo wp_specialchars( strip_tags( $title ) ); ?> — WordPress @@ -44,7 +44,7 @@ do_action('admin_head');

    %s.'), $user_identity) ?> [, ]

    diff --git a/wp-admin/cat.js b/wp-admin/cat.js index ab94d4c..e93adfc 100644 --- a/wp-admin/cat.js +++ b/wp-admin/cat.js @@ -4,7 +4,7 @@ function newCatAddIn() { var jaxcat = $('jaxcat'); if ( !jaxcat ) return false; - Element.update(jaxcat,'' + catL10n.how + ''); + 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/categories.js b/wp-admin/categories.js index 8951df0..515d530 100644 --- a/wp-admin/categories.js +++ b/wp-admin/categories.js @@ -2,7 +2,7 @@ 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'); + 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); diff --git a/wp-admin/categories.php b/wp-admin/categories.php index 5e77e0f..40bdbf9 100644 --- a/wp-admin/categories.php +++ b/wp-admin/categories.php @@ -118,6 +118,7 @@ cat_rows(); + comment_author_url ) { ?> -comment_author_url; ?> +comment_author_url'>$comment->comment_author_url"; ?> diff --git a/wp-admin/custom-header.php b/wp-admin/custom-header.php index 5daad1e..d18ed87 100644 --- a/wp-admin/custom-header.php +++ b/wp-admin/custom-header.php @@ -23,6 +23,7 @@ class Custom_Image_Header { function js() { if ( isset( $_POST['textcolor'] ) ) { + check_admin_referer('custom-header'); if ( 'blank' == $_POST['textcolor'] ) { set_theme_mod('header_textcolor', 'blank'); } else { @@ -31,8 +32,10 @@ class Custom_Image_Header { set_theme_mod('header_textcolor', $color); } } - if ( isset($_POST['resetheader']) ) + if ( isset($_POST['resetheader']) ) { + check_admin_referer('custom-header'); remove_theme_mods(); + } ?> +≡' + : ''; + + $output = '
  • %2$s
  • '; + + printf( $output, $sanitized_name, $wp_registered_widgets[$name]['name'] . $popper ); +} + +$title = __( 'Widgets' ); +$parent_file = 'themes.php'; + +require_once 'admin-header.php'; + +if ( count( $wp_registered_sidebars ) < 1 ) { +?> +
    +

    + +

    follow these instructions.' ); /* TODO: article on codex */; ?>

    +
    + $sidebar ) { + $postindex = $index . 'order'; + + parse_str( $_POST[$postindex], $order ); + + $new_order = $order[$index]; + + if ( is_array( $new_order ) ) { + foreach ( $new_order as $sanitized_name ) { + foreach ( $wp_registered_widgets as $name => $widget ) { + if ( $sanitized_name == $widget['id'] ) { + $sidebars_widgets[$index][] = $name; + } + } + } + } + } + + wp_set_sidebars_widgets( $sidebars_widgets ); + break; + } +} + +ksort( $wp_registered_widgets ); + +$inactive_widgets = array(); + +foreach ( $wp_registered_widgets as $name => $widget ) { + $is_active = false; + + foreach ( $wp_registered_sidebars as $index => $sidebar ) { + if ( is_array( $sidebars_widgets[$index] ) && in_array( $name, $sidebars_widgets[$index] ) ) { + $is_active = true; + break; + } + } + + if ( !$is_active ) { + $inactive_widgets[] = $name; + } +} + +$containers = array( 'palette' ); + +foreach ( $wp_registered_sidebars as $index => $sidebar ) { + $containers[] = $index; +} + +$c_string = ''; + +foreach ( $containers as $container ) { + $c_string .= '"' . $container . '",'; +} + +$c_string = substr( $c_string, 0, -1 ); + +if ( isset( $_POST['action'] ) ) { +?> +
    +

    View site »' ), get_bloginfo( 'url' ) . '/' ); ?>

    +
    + +
    +

    + +

    + + +

    + +

    +
    + $sidebar ) { + ?> + + +
    +

    + +
    + +

    + +
    +
    + +
      + +
    +
    + + +
    + +
    + +
    +

    + +
      + +
    • +
    +
    + + + +

    + + + +

    + +
    + $widget ) { ?> + + +
    + + +
    +
    + +
    + + + + diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css index 6de69f4..14c93a2 100644 --- a/wp-admin/wp-admin.css +++ b/wp-admin/wp-admin.css @@ -120,7 +120,6 @@ a:visited { } a:hover { -/* border-bottom: 1px solid #3a75ae;*/ color: #069; } @@ -132,7 +131,7 @@ body { } body, td { - font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana; + font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif; } fieldset { @@ -170,10 +169,10 @@ form, label input { } h2 { - border-bottom: .5em solid #e5f3ff; color: #333; - font: normal 32px/5px serif; + font: normal 32px serif; margin: 5px 10px; + background: url( images/heading-bg.gif ) repeat-x bottom; } img, #footer a { @@ -437,7 +436,7 @@ form#upload #post_content { } .wrap h2 { - margin: .4em 0 .5em; + margin: 0 0 .5em; clear: both; } @@ -538,7 +537,7 @@ input.disabled, textarea.disabled { border: none; } -#postdiv, #titlediv, #guiddiv { +#postdiv, #titlediv, #guiddiv, #tagdiv { margin: 0 8px 0 0; padding: 0; } @@ -554,11 +553,11 @@ input.disabled, textarea.disabled { } #postdivrich #content { - padding: .7em; + padding: 5px; line-height: 140%; } -#titlediv input, #guiddiv input { +#titlediv input, #guiddiv input, #tagdiv input { margin: 0; width: 100%; } @@ -629,7 +628,7 @@ input.delete:hover { #title { font-size: 1.7em; - padding: 4px; + padding: 4px 3px; } #postexcerpt div, #attachmentlinks div { @@ -912,17 +911,13 @@ input.delete:hover { } #zeitgeist h2, fieldset legend a { - border-bottom: none; + background: none; } * html #zeitgeist h2 { padding-top: 10px; } -#zeitgeist h2 { - margin-top: .4em; -} - #zeitgeist h3 { border-bottom: 1px solid #ccc; font-size: 16px; @@ -1332,3 +1327,10 @@ a.page-numbers:hover { font-weight: bold; margin: 0 6px; } + +a.view-link { + position: absolute; + right: 5%; + margin-right: 220px; + text-decoration:underline; +} -- cgit