Commit baee8673 authored by shammash's avatar shammash Committed by lechuck

Import wordpress 3.2.1

parent fbabcc6a
WordPress - Web publishing software
Copyright 2011 by the contributors
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
This program incorporates work covered by the following copyright and
permission notices:
b2 is (c) 2001, 2002 Michel Valdrighi - m@tidakada.com -
http://tidakada.com
Wherever third party code has been used, credit has been given in the code's
comments.
b2 is released under the GPL
and
WordPress - Web publishing software
Copyright 2003-2010 by the contributors
WordPress is released under the GPL
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies
......
......@@ -8,7 +8,7 @@
<body>
<h1 id="logo">
<a href="http://wordpress.org/"><img alt="WordPress" src="wp-admin/images/wordpress-logo.png" width="250" height="68" /></a>
<br /> Version 3.1.2
<br /> Version 3.2.1
</h1>
<p style="text-align: center">Semantic Personal Publishing Platform</p>
......@@ -55,8 +55,8 @@
<h1>System Requirements</h1>
<ul>
<li><a href="http://php.net/">PHP</a> version <strong>4.3</strong> or higher.</li>
<li><a href="http://www.mysql.com/">MySQL</a> version <strong>4.1.2</strong> or higher.</li>
<li><a href="http://php.net/">PHP</a> version <strong>5.2.4</strong> or higher.</li>
<li><a href="http://www.mysql.com/">MySQL</a> version <strong>5.0</strong> or higher.</li>
</ul>
<h2>System Recommendations</h2>
......
<?php
define( "WP_INSTALLING", true );
define( 'WP_INSTALLING', true );
/** Sets up the WordPress Environment. */
require( dirname(__FILE__) . '/wp-load.php' );
......@@ -14,10 +14,10 @@ if ( !is_multisite() ) {
if ( is_object( $wp_object_cache ) )
$wp_object_cache->cache_enabled = false;
do_action("activate_header");
do_action( 'activate_header' );
function do_activate_header() {
do_action("activate_wp_head");
do_action( 'activate_wp_head' );
}
add_action( 'wp_head', 'do_activate_header' );
......@@ -87,9 +87,9 @@ get_header();
</div>
<?php if ( $url != network_home_url('', 'http') ) : ?>
<p class="view"><?php printf( __('Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Login</a>'), $url, $url . 'wp-login.php' ); ?></p>
<p class="view"><?php printf( __('Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Log in</a>'), $url, $url . 'wp-login.php' ); ?></p>
<?php else: ?>
<p class="view"><?php printf( __('Your account is now activated. <a href="%1$s">Login</a> or go back to the <a href="%2$s">homepage</a>.' ), network_site_url('wp-login.php', 'login'), network_home_url() ); ?></p>
<p class="view"><?php printf( __('Your account is now activated. <a href="%1$s">Log in</a> or go back to the <a href="%2$s">homepage</a>.' ), network_site_url('wp-login.php', 'login'), network_home_url() ); ?></p>
<?php endif;
}
}
......
......@@ -396,7 +396,7 @@ case 'delete-meta' :
if ( !$meta = get_post_meta_by_id( $id ) )
die('1');
if ( !current_user_can( 'edit_post', $meta->post_id ) )
if ( !current_user_can( 'edit_post', $meta->post_id ) || is_protected_meta( $meta->meta_key ) )
die('-1');
if ( delete_meta( $meta->meta_id ) )
die('1');
......@@ -508,7 +508,7 @@ case 'add-link-category' : // On the Fly
$x->send();
break;
case 'add-tag' :
check_ajax_referer( 'add-tag' );
check_ajax_referer( 'add-tag', '_wpnonce_add-tag' );
$post_type = !empty($_POST['post_type']) ? $_POST['post_type'] : 'post';
$taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : 'post_tag';
$tax = get_taxonomy($taxonomy);
......@@ -609,15 +609,15 @@ case 'get-comments' :
if ( !$wp_list_table->has_items() )
die('1');
$comment_list_item = '';
$x = new WP_Ajax_Response();
ob_start();
foreach ( $wp_list_table->items as $comment ) {
get_comment( $comment );
ob_start();
$wp_list_table->single_row( $comment );
$comment_list_item .= ob_get_contents();
ob_end_clean();
$wp_list_table->single_row( $comment );
}
$comment_list_item = ob_get_contents();
ob_end_clean();
$x->add( array(
'what' => 'comments',
'data' => $comment_list_item
......@@ -660,15 +660,25 @@ case 'replyto-comment' :
die( __('Error: please type a comment.') );
$comment_parent = absint($_POST['comment_ID']);
$comment_auto_approved = false;
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID');
$comment_id = wp_new_comment( $commentdata );
$comment = get_comment($comment_id);
if ( ! $comment ) die('1');
$position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1';
$position = ( isset($_POST['position']) && (int) $_POST['position'] ) ? (int) $_POST['position'] : '-1';
$x = new WP_Ajax_Response();
// automatically approve parent comment
if ( !empty($_POST['approve_parent']) ) {
$parent = get_comment( $comment_parent );
if ( $parent && $parent->comment_approved === '0' && $parent->comment_post_ID == $comment_post_ID ) {
if ( wp_set_comment_status( $parent->comment_ID, 'approve' ) )
$comment_auto_approved = true;
}
}
ob_start();
if ( 'dashboard' == $_REQUEST['mode'] ) {
......@@ -685,13 +695,18 @@ case 'replyto-comment' :
$comment_list_item = ob_get_contents();
ob_end_clean();
$x->add( array(
$response = array(
'what' => 'comment',
'id' => $comment->comment_ID,
'data' => $comment_list_item,
'position' => $position
));
);
if ( $comment_auto_approved )
$response['supplemental'] = array( 'parent_approved' => $parent->comment_ID );
$x = new WP_Ajax_Response();
$x->add( $response );
$x->send();
break;
case 'edit-comment' :
......@@ -844,7 +859,7 @@ case 'add-meta' :
'supplemental' => array('postid' => $pid)
) );
} else { // Update?
$mid = (int) array_pop( $var_by_ref = array_keys($_POST['meta']) );
$mid = (int) array_pop( array_keys($_POST['meta']) );
$key = $_POST['meta'][$mid]['key'];
$value = $_POST['meta'][$mid]['value'];
if ( '' == trim($key) )
......@@ -855,6 +870,8 @@ case 'add-meta' :
die('0'); // if meta doesn't exist
if ( !current_user_can( 'edit_post', $meta->post_id ) )
die('-1');
if ( is_protected_meta( $meta->meta_key ) )
die('-1');
if ( $meta->meta_value != stripslashes($value) || $meta->meta_key != stripslashes($key) ) {
if ( !$u = update_meta( $mid, $key, $value ) )
die('0'); // We know meta exists; we also know it's unchanged (or DB error, in which case there are bigger problems).
......@@ -916,7 +933,7 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
$do_autosave = (bool) $_POST['autosave'];
$do_lock = true;
$data = '';
$data = $alert = '';
/* translators: draft saved date format, see http://php.net/date */
$draft_saved_date_format = __('g:i:s a');
/* translators: %s: date and time */
......@@ -924,7 +941,7 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
$supplemental = array();
if ( isset($login_grace_period) )
$supplemental['session_expired'] = add_query_arg( 'interim-login', 1, wp_login_url() );
$alert .= sprintf( __('Your login has expired. Please open a new browser window and <a href="%s" target="_blank">log in again</a>. '), add_query_arg( 'interim-login', 1, wp_login_url() ) );
$id = $revision_id = 0;
......@@ -939,12 +956,10 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
$last_user = get_userdata( $last );
$last_user_name = $last_user ? $last_user->display_name : __( 'Someone' );
$data = new WP_Error( 'locked', sprintf(
$_POST['post_type'] == 'page' ? __( 'Autosave disabled: %s is currently editing this page.' ) : __( 'Autosave disabled: %s is currently editing this post.' ),
esc_html( $last_user_name )
) );
$data = __( 'Autosave disabled.' );
$supplemental['disable_autosave'] = 'disable';
$alert .= sprintf( __( '%s is currently editing this article. If you update it, you will overwrite the changes.' ), esc_html( $last_user_name ) );
}
if ( 'page' == $post->post_type ) {
......@@ -990,6 +1005,9 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
}
}
if ( ! empty($alert) )
$supplemental['alert'] = $alert;
$x = new WP_Ajax_Response( array(
'what' => 'autosave',
'id' => $id,
......@@ -1467,6 +1485,68 @@ case 'date_format' :
case 'time_format' :
die( date_i18n( sanitize_option( 'time_format', $_POST['date'] ) ) );
break;
case 'wp-fullscreen-save-post' :
if ( isset($_POST['post_ID']) )
$post_id = (int) $_POST['post_ID'];
else
$post_id = 0;
$post = null;
$post_type_object = null;
$post_type = null;
if ( $post_id ) {
$post = get_post($post_id);
if ( $post ) {
$post_type_object = get_post_type_object($post->post_type);
if ( $post_type_object ) {
$post_type = $post->post_type;
$current_screen->post_type = $post->post_type;
$current_screen->id = $current_screen->post_type;
}
}
} elseif ( isset($_POST['post_type']) ) {
$post_type_object = get_post_type_object($_POST['post_type']);
if ( $post_type_object ) {
$post_type = $post_type_object->name;
$current_screen->post_type = $post_type;
$current_screen->id = $current_screen->post_type;
}
}
check_ajax_referer('update-' . $post_type . '_' . $post_id, '_wpnonce');
$post_id = edit_post();
if ( is_wp_error($post_id) ) {
if ( $post_id->get_error_message() )
$message = $post_id->get_error_message();
else
$message = __('Save failed');
echo json_encode( array( 'message' => $message, 'last_edited' => '' ) );
die();
} else {
$message = __('Saved.');
}
if ( $post ) {
$last_date = mysql2date( get_option('date_format'), $post->post_modified );
$last_time = mysql2date( get_option('time_format'), $post->post_modified );
} else {
$last_date = date_i18n( get_option('date_format') );
$last_time = date_i18n( get_option('time_format') );
}
if ( $last_id = get_post_meta($post_id, '_edit_last', true) ) {
$last_user = get_userdata($last_id);
$last_edited = sprintf( __('Last edited by %1$s on %2$s at %3$s'), esc_html( $last_user->display_name ), $last_date, $last_time );
} else {
$last_edited = sprintf( __('Last edited on %1$s at %2$s'), $last_date, $last_time );
}
echo json_encode( array( 'message' => $message, 'last_edited' => $last_edited ) );
die();
break;
default :
do_action( 'wp_ajax_' . $_POST['action'] );
die('0');
......
......@@ -14,14 +14,21 @@ if ( !defined('ABSPATH') )
<div class="clear"></div></div><!-- wpbody-content -->
<div class="clear"></div></div><!-- wpbody -->
<div class="clear"></div></div><!-- wpcontent -->
</div><!-- wpwrap -->
<div id="footer">
<?php do_action( 'in_admin_footer' ); ?>
<p id="footer-left" class="alignleft"><?php
do_action( 'in_admin_footer' );
$upgrade = apply_filters( 'update_footer', '' );
echo apply_filters( 'admin_footer_text', '<span id="footer-thankyou">' . __('Thank you for creating with <a href="http://wordpress.org/">WordPress</a>.').'</span> | '.__('<a href="http://codex.wordpress.org/">Documentation</a>').' | '.__('<a href="http://wordpress.org/support/forum/4">Feedback</a>') ); ?>
</p>
$footer_text = array(
'<span id="footer-thankyou">' . __( 'Thank you for creating with <a href="http://wordpress.org/">WordPress</a>.' ) . '</span>',
__( '<a href="http://codex.wordpress.org/">Documentation</a>' ),
sprintf( __( '<a href="%s">Freedoms</a>' ), admin_url( 'freedoms.php' ) ),
__('<a href="http://wordpress.org/support/forum/4">Feedback</a>'),
sprintf(__('<a href="%s">Credits</a>'), admin_url('credits.php') ),
);
echo apply_filters( 'admin_footer_text', implode( ' &bull; ', $footer_text ) );
unset( $footer_text );
?></p>
<p id="footer-upgrade" class="alignright"><?php echo $upgrade; ?></p>
<div class="clear"></div>
</div>
......@@ -38,6 +45,7 @@ if ( function_exists('get_site_option') ) {
?>
<div class="clear"></div></div><!-- wpwrap -->
<script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>
</body>
</html>
......@@ -28,7 +28,6 @@ else
$admin_title = apply_filters( 'admin_title', $admin_title, $title );
wp_user_settings();
wp_menu_unfold();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
......@@ -68,8 +67,6 @@ var userSettings = {
<?php
if ( in_array( $pagenow, array('post.php', 'post-new.php') ) ) {
add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 25 );
add_action( 'admin_print_footer_scripts', 'wp_tiny_mce_preload_dialogs', 30 );
wp_enqueue_script('quicktags');
}
......@@ -87,6 +84,13 @@ if ( get_user_setting('mfold') == 'f' )
if ( is_admin_bar_showing() )
$admin_body_class .= ' admin-bar';
if ( is_rtl() )
$admin_body_class .= ' rtl';
$admin_body_class .= ' branch-' . str_replace( '.', '-', floatval( $wp_version ) );
$admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', $wp_version ) );
$admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' );
if ( $is_iphone ) { ?>
<style type="text/css">.row-actions{visibility:visible;}</style>
<?php } ?>
......@@ -103,6 +107,7 @@ document.body.className = c;
</script>
<div id="wpwrap">
<?php require(ABSPATH . 'wp-admin/menu-header.php'); ?>
<div id="wpcontent">
<div id="wphead">
<?php
......@@ -132,48 +137,66 @@ if ( function_exists('mb_strlen') ) {
}
?>
<img id="header-logo" src="<?php echo esc_url( includes_url( 'images/blank.gif' ) ); ?>" alt="" width="32" height="32" />
<img id="header-logo" src="<?php echo esc_url( includes_url( 'images/blank.gif' ) ); ?>" alt="" width="16" height="16" />
<h1 id="site-heading" <?php echo $title_class ?>>
<a href="<?php echo trailingslashit( get_bloginfo( 'url' ) ); ?>" title="<?php esc_attr_e('Visit Site') ?>">
<span id="site-title"><?php echo $blog_name ?></span>
</a>
<?php if ( !is_network_admin() && !is_user_admin() && current_user_can('manage_options') && '1' != get_option('blog_public') ): ?>
<a id="privacy-on-link" href="options-privacy.php" title="<?php echo esc_attr( apply_filters('privacy_on_link_title', __('Your site is asking search engines not to index its content') ) ); ?>"><?php echo apply_filters('privacy_on_link_text', __('Search Engines Blocked') ); ?></a>
<?php endif; ?>
</h1>
<?php do_action('in_admin_header'); ?>
<?php
do_action('in_admin_header');
<div id="wphead-info">
<div id="user_info">
<p><?php
$links = array();
$links[5] = sprintf(__('Howdy, <a href="%1$s" title="Edit your profile">%2$s</a>'), 'profile.php', $user_identity);
// Generate user profile and info links.
$links[5] = sprintf( __('Howdy, %1$s'), $user_identity );
$links[8] = '<a href="profile.php" title="' . esc_attr__('Edit your profile') . '">' . __('Your Profile') . '</a>';
if ( is_multisite() && is_super_admin() ) {
if ( !is_network_admin() )
$links[10] = '| <a href="' . network_admin_url() . '" title="' . ( ! empty( $update_title ) ? $update_title : esc_attr__('Network Admin') ) . '">' . __('Network Admin') . ( ! empty( $total_update_count ) ? ' (' . number_format_i18n( $total_update_count ) . ')' : '' ) . '</a>';
$links[10] = '<a href="' . network_admin_url() . '" title="' . ( ! empty( $update_title ) ? $update_title : esc_attr__('Network Admin') ) . '">' . __('Network Admin') . ( ! empty( $total_update_count ) ? ' (' . number_format_i18n( $total_update_count ) . ')' : '' ) . '</a>';
else
$links[10] = '| <a href="' . get_dashboard_url( get_current_user_id() ) . '" title="' . esc_attr__('Site Admin') . '">' . __('Site Admin') . '</a>';
$links[10] = '<a href="' . get_dashboard_url( get_current_user_id() ) . '" title="' . esc_attr__('Site Admin') . '">' . __('Site Admin') . '</a>';
}
$links[15] = '| <a href="' . wp_logout_url() . '" title="' . esc_attr__('Log Out') . '">' . __('Log Out') . '</a>';
$links = apply_filters('admin_user_info_links', $links, $current_user);
ksort($links);
$links[15] = '<a href="' . wp_logout_url() . '" title="' . esc_attr__('Log Out') . '">' . __('Log Out') . '</a>';
echo implode(' ', $links);
?></p>
</div>
$links = apply_filters( 'admin_user_info_links', $links, $current_user );
ksort( $links );
<?php favorite_actions($current_screen); ?>
// Trim whitespace and pipes from links, then convert to list items.
$links = array_map( 'trim', $links, array_fill( 0, count( $links ), " |\n\t" ) );
$howdy = array_shift( $links );
$links_no_js = implode( ' | ', $links );
$links_js = '<li>' . implode( '</li><li>', $links ) . '</li>';
?>
<div id="wphead-info">
<div id="user_info">
<p class="hide-if-js"><?php echo "$howdy | $links_no_js"; ?></p>
<div class="hide-if-no-js">
<p><?php echo $howdy; ?></p>
<div id="user_info_arrow"></div>
<div id="user_info_links_wrap"><div id="user_info_links">
<ul><?php echo $links_js; ?></ul>
</div></div>
</div>
</div>
</div>
</div>
<div id="wpbody">
<?php
unset($title_class, $blog_name, $total_update_count, $update_title);
require(ABSPATH . 'wp-admin/menu-header.php');
$current_screen->parent_file = $parent_file;
$current_screen->parent_base = preg_replace('/\?.*$/', '', $parent_file);
$current_screen->parent_base = str_replace('.php', '', $current_screen->parent_base);
......
......@@ -6,7 +6,7 @@
* @subpackage Administration
*/
/** We are located in WordPress Administration Panels */
/** We are located in WordPress Administration Screens */
define('WP_ADMIN', true);
if ( defined('ABSPATH') )
......
......@@ -7,7 +7,7 @@
*/
/**
* In WordPress Administration Panels
* In WordPress Administration Screens
*
* @since 2.3.2
*/
......@@ -106,7 +106,7 @@ else
require(ABSPATH . 'wp-admin/menu.php');
if ( current_user_can( 'manage_options' ) )
@ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', '256M' ) );
@ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) );
do_action('admin_init');
......