diff options
32 files changed, 451 insertions, 219 deletions
diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 5b9ca47..1cfda29 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -797,7 +797,7 @@ function page_rows($parent = 0, $level = 0, $pages = 0, $hierarchy = true) { <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_page', $id) ) { echo "<a href='page.php?action=edit&post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td> - <td><?php if ( current_user_can('edit_page', $id) ) { echo "<a href='" . wp_nonce_url("page.php?action=delete&post=$id", 'delete-page_' . $id) . "' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . sprintf(__("You are about to delete the "%s" page.\\n"OK" to delete, "Cancel" to stop."), js_escape(get_the_title()) ) . "' );\">" . __('Delete') . "</a>"; } ?></td> + <td><?php if ( current_user_can('delete_page', $id) ) { echo "<a href='" . wp_nonce_url("page.php?action=delete&post=$id", 'delete-page_' . $id) . "' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . sprintf(__("You are about to delete the "%s" page.\\n"OK" to delete, "Cancel" to stop."), js_escape(get_the_title()) ) . "' );\">" . __('Delete') . "</a>"; } ?></td> </tr> <?php @@ -1265,47 +1265,6 @@ function save_mod_rewrite_rules() { insert_with_markers($home_path.'.htaccess', 'WordPress', $rules); } -function the_quicktags() { - echo ' - <div id="quicktags"> - '; - wp_print_scripts( 'quicktags' ); - echo ' <script type="text/javascript"> - //<![CDATA[ - if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 ) edToolbar(); - //]]> - </script> - </div> -'; - echo ' -<script type="text/javascript"> -function edInsertContent(myField, myValue) { - //IE support - if (document.selection) { - myField.focus(); - sel = document.selection.createRange(); - sel.text = myValue; - myField.focus(); - } - //MOZILLA/NETSCAPE support - else if (myField.selectionStart || myField.selectionStart == "0") { - var startPos = myField.selectionStart; - var endPos = myField.selectionEnd; - myField.value = myField.value.substring(0, startPos) - + myValue - + myField.value.substring(endPos, myField.value.length); - myField.focus(); - myField.selectionStart = startPos + myValue.length; - myField.selectionEnd = startPos + myValue.length; - } else { - myField.value += myValue; - myField.focus(); - } -} -</script> -'; -} - function get_broken_themes() { global $wp_broken_themes; @@ -1736,8 +1695,7 @@ function get_plugins() { } $wp_plugins = array (); - $plugin_loc = 'wp-content/plugins'; - $plugin_root = ABSPATH.$plugin_loc; + $plugin_root = ABSPATH . PLUGINDIR; // Files in wp-content/plugins directory $plugins_dir = @ dir($plugin_root); @@ -2020,16 +1978,6 @@ function wp_import_handle_upload() { return array('file' => $file, 'id' => $id); } -function user_can_richedit() { - if ( 'true' != get_user_option('rich_editing') ) - return false; - - if ( preg_match('!opera[ /][2-8]|konqueror|safari!i', $_SERVER['HTTP_USER_AGENT']) ) - return false; - - return true; // Best guess -} - function the_attachment_links($id = false) { $id = (int) $id; $post = & get_post($id); @@ -2083,6 +2031,10 @@ function wp_reset_vars($vars) { // If siteurl or home changed, reset cookies and flush rewrite rules. function update_home_siteurl($old_value, $value) { global $wp_rewrite, $user_login, $user_pass_md5; + + if ( defined("WP_INSTALLING") ) + return; + // If home changed, write rewrite rules to new location. $wp_rewrite->flush_rules(); // Clear cookies for old paths. diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php index 9a9eec0..663efa9 100644 --- a/wp-admin/admin-header.php +++ b/wp-admin/admin-header.php @@ -13,7 +13,7 @@ get_admin_page_title(); ?> <!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"> +<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> <head> <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" /> <title><?php bloginfo('name') ?> › <?php echo $title; ?> — WordPress</title> diff --git a/wp-admin/admin.php b/wp-admin/admin.php index 655ebf1..d5226b4 100644 --- a/wp-admin/admin.php +++ b/wp-admin/admin.php @@ -60,7 +60,7 @@ if (isset($plugin_page)) { wp_die(__('Invalid plugin page')); } - if (! file_exists(ABSPATH . "wp-content/plugins/$plugin_page") && ! file_exists(ABSPATH . "wp-content/mu-plugins/$plugin_page")) + if (! file_exists(ABSPATH . PLUGINDIR . "/$plugin_page") && ! file_exists(ABSPATH . "wp-content/mu-plugins/$plugin_page")) wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page))); do_action('load-' . $plugin_page); @@ -71,7 +71,7 @@ if (isset($plugin_page)) { if ( file_exists(ABSPATH . "wp-content/mu-plugins/$plugin_page") ) include(ABSPATH . "wp-content/mu-plugins/$plugin_page"); else - include(ABSPATH . "wp-content/plugins/$plugin_page"); + include(ABSPATH . PLUGINDIR . "/$plugin_page"); } include(ABSPATH . 'wp-admin/admin-footer.php'); diff --git a/wp-admin/comment.php b/wp-admin/comment.php index 27652aa..6b14034 100644 --- a/wp-admin/comment.php +++ b/wp-admin/comment.php @@ -12,8 +12,7 @@ if ( isset( $_POST['deletecomment'] ) ) switch($action) { case 'editcomment': $title = __('Edit Comment'); - if ( user_can_richedit() ) - wp_enqueue_script( 'wp_tiny_mce' ); + require_once ('admin-header.php'); $comment = (int) $_GET['comment']; diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index 336bae3..7f9a97a 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -104,7 +104,7 @@ addLoadEvent(focusit); <div class="dbx-content"><input name="post_name" type="text" size="13" id="post_name" value="<?php echo $post->post_name ?>" /></div> </fieldset> -<fieldset class="dbx-box"> +<fieldset id="poststatusdiv" class="dbx-box"> <h3 class="dbx-handle"><?php _e('Post 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'); checked($post->post_status, 'future'); ?> /> <?php _e('Published') ?></label> @@ -114,13 +114,16 @@ addLoadEvent(focusit); </fieldset> <?php if ( current_user_can('edit_posts') ) : ?> -<fieldset class="dbx-box"> +<fieldset id="posttimestampdiv" class="dbx-box"> <h3 class="dbx-handle"><?php _e('Post Timestamp'); ?>:</h3> <div class="dbx-content"><?php touch_time(($action == 'edit')); ?></div> </fieldset> <?php endif; ?> -<?php if ( $authors = get_editable_authors( $current_user->id ) ) : // TODO: ROLE SYSTEM ?> +<?php +$authors = get_editable_authors( $current_user->id ); // TODO: ROLE SYSTEM +if ( $authors && count( $authors ) > 1 ) : +?> <fieldset id="authordiv" class="dbx-box"> <h3 class="dbx-handle"><?php _e('Post Author'); ?>:</h3> <div class="dbx-content"> @@ -206,7 +209,7 @@ if (current_user_can('upload_files')) { </div> <div class="dbx-box-wrapper"> -<fieldset class="dbx-box"> +<fieldset id="trackbacksdiv" class="dbx-box"> <div class="dbx-handle-wrapper"> <h3 class="dbx-handle"><?php _e('Trackbacks') ?></h3> </div> diff --git a/wp-admin/inline-uploading.php b/wp-admin/inline-uploading.php index d65f450..1dbb7db 100644 --- a/wp-admin/inline-uploading.php +++ b/wp-admin/inline-uploading.php @@ -413,7 +413,6 @@ function updateOtherIcon(n) { var win = window.opener ? window.opener : window.dialogArguments;
if (!win) win = top;
tinyMCE = win.tinyMCE;
-richedit = ( typeof tinyMCE == 'object' && tinyMCE.configs.length > 0 );
function sendToEditor(n) {
o = document.getElementById('div'+n);
h = o.innerHTML.replace(new RegExp('^\\s*(.*?)\\s*$', ''), '$1'); // Trim
@@ -423,7 +422,7 @@ function sendToEditor(n) { h = h.replace(new RegExp('<(/?)A', 'g'), '<$1a'); // Lowercase tagnames
h = h.replace(new RegExp('<IMG', 'g'), '<img'); // Lowercase again
h = h.replace(new RegExp('(<img .+?")>', 'g'), '$1 />'); // XHTML
- if ( richedit )
+ if ( typeof tinyMCE != 'undefined' && tinyMCE.getInstanceById('content') )
win.tinyMCE.execCommand('mceInsertContent', false, h);
else
win.edInsertContent(win.edCanvas, h);
diff --git a/wp-admin/menu-header.php b/wp-admin/menu-header.php index 64aa41f..99c02a5 100644 --- a/wp-admin/menu-header.php +++ b/wp-admin/menu-header.php @@ -12,7 +12,7 @@ foreach ($menu as $item) { if (( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file))) $class = ' class="current"'; if ( !empty($submenu[$item[2]]) || current_user_can($item[1]) ) { - if ( file_exists(ABSPATH . "wp-content/plugins/{$item[2]}") ) + if ( file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") ) echo "\n\t<li><a href='" . get_option('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>"; else echo "\n\t<li><a href='" . get_option('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>"; @@ -40,7 +40,7 @@ else $class = ''; $menu_hook = get_plugin_page_hook($item[2], $parent_file); -if (file_exists(ABSPATH . "wp-content/plugins/{$item[2]}") || ! empty($menu_hook)) { +if (file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") || ! empty($menu_hook)) { if ( 'admin.php' == $pagenow ) echo "\n\t<li><a href='" . get_option('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>"; else diff --git a/wp-admin/plugin-editor.php b/wp-admin/plugin-editor.php index c604d19..42fe9d4 100644 --- a/wp-admin/plugin-editor.php +++ b/wp-admin/plugin-editor.php @@ -15,7 +15,7 @@ if (empty($file)) { } $file = validate_file_to_edit($file, $plugin_files); -$real_file = get_real_file_to_edit("wp-content/plugins/$file"); +$real_file = get_real_file_to_edit( PLUGINDIR . "/$file"); switch($action) { @@ -47,7 +47,7 @@ default: require_once('admin-header.php'); - update_recently_edited("wp-content/plugins/$file"); + update_recently_edited(PLUGINDIR . "/$file"); if (!is_file($real_file)) $error = 1; diff --git a/wp-admin/plugins.php b/wp-admin/plugins.php index 55f6bb5..1be16fb 100644 --- a/wp-admin/plugins.php +++ b/wp-admin/plugins.php @@ -16,7 +16,7 @@ if ( isset($_GET['action']) ) { $current[] = trim( $_GET['plugin'] ); sort($current); update_option('active_plugins', $current); - include(ABSPATH . 'wp-content/plugins/' . trim( $_GET['plugin'] )); + include(ABSPATH . PLUGINDIR . '/' . trim( $_GET['plugin'] )); do_action('activate_' . trim( $_GET['plugin'] )); } wp_redirect('plugins.php?activate=true'); @@ -49,7 +49,7 @@ if ( !is_array($check_plugins) ) { // If a plugin file does not exist, remove it from the list of active // plugins. foreach ($check_plugins as $check_plugin) { - if (!file_exists(ABSPATH . 'wp-content/plugins/' . $check_plugin)) { + if (!file_exists(ABSPATH . PLUGINDIR . '/' . $check_plugin)) { $current = get_option('active_plugins'); $key = array_search($check_plugin, $current); if ( false !== $key && NULL !== $key ) { @@ -130,10 +130,10 @@ if (empty($plugins)) { } ?> -<p><?php _e('If something goes wrong with a plugin and you can’t use WordPress, delete or rename that file in the <code>wp-content/plugins</code> directory and it will be automatically deactivated.'); ?></p> +<p><?php _e(sprintf('If something goes wrong with a plugin and you can’t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.', PLUGINDIR)); ?></p> <h2><?php _e('Get More Plugins'); ?></h2> -<p><?php _e('You can find additional plugins for your site in the <a href="http://wordpress.org/extend/plugins/">WordPress plugin directory</a>. To install a plugin you generally just need to upload the plugin file into your <code>wp-content/plugins</code> directory. Once a plugin is uploaded, you may activate it here.'); ?></p> +<p><?php _e(sprintf('You can find additional plugins for your site in the <a href="http://wordpress.org/extend/plugins/">WordPress plugin directory</a>. To install a plugin you generally just need to upload the plugin file into your <code>%s</code> directory. Once a plugin is uploaded, you may activate it here.', PLUGINDIR)); ?></p> </div> diff --git a/wp-admin/post-new.php b/wp-admin/post-new.php index 45a5a5e..1fce819 100644 --- a/wp-admin/post-new.php +++ b/wp-admin/post-new.php @@ -54,7 +54,7 @@ include('edit-form-advanced.php'); ?> <?php if ( $is_NS4 || $is_gecko || $is_winIE ) { ?> -<div class="wrap"> +<div id="wp-bookmarklet" class="wrap"> <h3><?php _e('WordPress bookmarklet'); ?></h3> <p><?php _e('Right click on the following link and choose "Add to favorites" to create a posting shortcut.'); ?></p> <p> diff --git a/wp-admin/user-edit.php b/wp-admin/user-edit.php index 9583ddf..ccb8c78 100644 --- a/wp-admin/user-edit.php +++ b/wp-admin/user-edit.php @@ -15,6 +15,11 @@ $wp_http_referer = remove_query_arg(array('update', 'delete_count'), stripslashe if ( !is_site_admin() && ($user_id != $current_user->ID) ) $errors = new WP_Error('head', __('You do not have permission to edit this user.')); +$user_id = (int) $user_id; + +if ( !$user_id ) + wp_die(__('Invalid user ID.')); + switch ($action) { case 'switchposts': @@ -29,10 +34,9 @@ case 'update': check_admin_referer('update-user_' . $user_id); if ( !current_user_can('edit_user', $user_id) ) - $errors = new WP_Error('head', __('You do not have permission to edit this user.')); + wp_die(__('You do not have permission to edit this user.')); -if ( !isset($errors) ) - $errors = edit_user($user_id); +$errors = edit_user($user_id); if( !is_wp_error( $errors ) ) { $redirect = "user-edit.php?user_id=$user_id&updated=true"; @@ -42,13 +46,12 @@ if( !is_wp_error( $errors ) ) { } default: -include ('admin-header.php'); - $profileuser = get_user_to_edit($user_id); if ( !current_user_can('edit_user', $user_id) ) - if ( !is_wp_error( $errors ) ) - $errors = new WP_Error('head', __('You do not have permission to edit this user.')); + wp_die(__('You do not have permission to edit this user.')); + +include ('admin-header.php'); ?> <?php if ( isset($_GET['updated']) ) : ?> diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css index b7efc50..d4c4f33 100644 --- a/wp-admin/wp-admin.css +++ b/wp-admin/wp-admin.css @@ -490,10 +490,6 @@ table .vers { width: 100%; } -#quicktags { - margin-left: -1px; -} - #currenttheme img { float: left; border: 1px solid #666; @@ -512,6 +508,27 @@ table .vers { color: #fff; } +#postdivrich #quicktags { + background: #f0f0ee; + padding: 0px; + border: 1px solid #ccc; + border-bottom: none; +} +#postdiv #quicktags { + padding-right: 6px; +} +#postdivrich #quicktags { + display: none; +} +#quicktags #ed_toolbar { + padding: 0px 2px; +} + +#ed_toolbar input { + background: #fff url( images/fade-butt.png ) repeat-x 0px -2px; + margin: 3px 2px 2px; +} + #quicktags #ed_strong { font-weight: bold; } @@ -531,6 +548,7 @@ table .vers { #quicktags #ed_code { font-family: "Courier New", Courier, mono; + margin-bottom: 3px; } #title { @@ -987,6 +1005,8 @@ table .vers { margin-left: 7px; margin-bottom: -7px; padding: 6px 1em 0 3px; + height: 19px; + font-size: 12px; background: #2685af url(images/box-head-right.gif) no-repeat top right; } @@ -1118,3 +1138,20 @@ input#catadd { background: #a4a4a4; #ajax-response.alignleft { margin-left: 2em; } +#postdivrich #edButtons { + padding-left: 3px; +} +#postdivrich #content, #postdivrich #content:active { + border: 1px solid #ccc; +} +#edButtons input, #edButtons input:active { + margin: 0px 2px -1px; +} +#edButtons input.edButtonFore, #edButtons input.edButtonFore:active { + background: #f0f0ee; + border-bottom: 1px solid #f0f0ee; +} +#edButtons input.edButtonBack, #edButtons input.edButtonBack:active { + background: #fff url( images/fade-butt.png ) repeat-x 0px 15px; + border-bottom: 1px solid #ccc; +} diff --git a/wp-includes/bookmark-template.php b/wp-includes/bookmark-template.php index 3c14c3c..d16f6a0 100644 --- a/wp-includes/bookmark-template.php +++ b/wp-includes/bookmark-template.php @@ -230,7 +230,7 @@ function get_links_list($order = 'name', $hide_if_empty = 'obsolete') { // Handle each category. // Display the category name - echo ' <li id="linkcat-' . $cat->cat_ID . '"><h2>' . $cat->cat_name . "</h2>\n\t<ul>\n"; + echo ' <li id="linkcat-' . $cat->cat_ID . '" class="linkcat"><h2>' . $cat->cat_name . "</h2>\n\t<ul>\n"; // Call get_links() with all the appropriate params get_links($cat->cat_ID, '<li>', "</li>", "\n", true, 'name', false); @@ -340,7 +340,7 @@ function wp_list_bookmarks($args = '') { $bookmarks = get_bookmarks($r); if ( empty($bookmarks) ) continue; - $output .= "<li id=\"linkcat-$cat->cat_ID\">$title_before$cat->cat_name$title_after\n\t<ul>\n"; + $output .= "<li id='linkcat-$cat->cat_ID' class='linkcat'>$title_before$cat->cat_name$title_after\n\t<ul>\n"; $output .= _walk_bookmarks($bookmarks, $r); $output .= "\n\t</ul>\n</li>\n"; } diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php index b2d2662..adc1827 100644 --- a/wp-includes/capabilities.php +++ b/wp-includes/capabilities.php @@ -324,7 +324,7 @@ function map_meta_cap($cap, $user_id) { $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); + $page_author_data = get_userdata($page->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) { @@ -378,7 +378,7 @@ function map_meta_cap($cap, $user_id) { $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); + $page_author_data = get_userdata($page->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) { diff --git a/wp-includes/classes.php b/wp-includes/classes.php index b5f0a68..6d5fec7 100644 --- a/wp-includes/classes.php +++ b/wp-includes/classes.php @@ -1,77 +1,5 @@ <?php -class retrospam_mgr { - var $spam_words; - var $comments_list; - var $found_comments; - - function retrospam_mgr() { - global $wpdb; - - $list = explode("\n", get_option('moderation_keys') ); - $list = array_unique( $list ); - $this->spam_words = $list; - - $this->comment_list = $wpdb->get_results("SELECT comment_ID AS ID, comment_content AS text, comment_approved AS approved, comment_author_url AS url, comment_author_ip AS ip, comment_author_email AS email FROM $wpdb->comments ORDER BY comment_ID ASC"); - } // End of class constructor - - function move_spam( $id_list ) { - global $wpdb; - $cnt = 0; - $id_list = explode( ',', $id_list ); - - foreach ( $id_list as $comment ) { - if ( $wpdb->query("update $wpdb->comments set comment_approved = '0' where comment_ID = '$comment'") ) { - $cnt++; - } - } - echo "<div class='updated'><p> "; - printf(__('%d comment(s) moved to the moderation queue.'), $cnt); - echo "</p></div>\n"; - } // End function move_spam - - function find_spam() { - $in_queue = 0; - - foreach( $this->comment_list as $comment ) { - if( $comment->approved == 1 ) { - foreach( $this->spam_words as $word ) { - $word = trim($word); - if ( empty( $word ) ) - continue; - $fulltext = strtolower($comment->email.' '.$comment->url.' '.$comment->ip.' '.$comment->text); - if( false !== strpos( $fulltext, strtolower($word) ) ) { - $this->found_comments[] = $comment->ID; - break; - } - } - } else { - $in_queue++; - } - } - return array( 'found' => $this->found_comments, 'in_queue' => $in_queue ); - } // End function find_spam - - function display_edit_form( $counters ) { - $numfound = count($counters[found]); - $numqueue = $counters[in_queue]; - - $body = '<p>' . sprintf(__('Suspected spam comments: %s'), "<strong>$numfound</strong>") . '</p>'; - - if ( count($counters[found]) > 0 ) { - $id_list = implode( ',', $counters[found] ); - $body .= '<p><a href="options-discussion.php?action=retrospam&move=true&ids='.$id_list.'">'. __('Move suspect comments to moderation queue »') . '</a></p>'; - - } - $head = '<div class="wrap"><h2>' . __('Check Comments Results:') . '</h2>'; - - $foot .= '<p><a href="options-discussion.php">' . __('« Return to Discussion Options page.') . '</a></p></div>'; - - return $head . $body . $foot; - } // End function display_edit_form - -} - class WP { var $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 's', 'search', 'exact', 'sentence', 'debug', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots'); @@ -109,7 +37,10 @@ class WP { $error = '404'; $this->did_permalink = true; - $pathinfo = $_SERVER['PATH_INFO']; + if ( isset($_SERVER['PATH_INFO']) ) + $pathinfo = $_SERVER['PATH_INFO']; + else + $pathinfo = ''; $pathinfo_array = explode('?', $pathinfo); $pathinfo = str_replace("%", "%25", $pathinfo_array[0]); $req_uri = $_SERVER['REQUEST_URI']; @@ -117,7 +48,10 @@ class WP { $req_uri = $req_uri_array[0]; $self = $_SERVER['PHP_SELF']; $home_path = parse_url(get_option('home')); - $home_path = $home_path['path']; + if ( isset($home_path['path']) ) + $home_path = $home_path['path']; + else + $home_path = ''; $home_path = trim($home_path, '/'); // Trim path info from the end and the leading home path from the diff --git a/wp-includes/cron.php b/wp-includes/cron.php index 677fc3c..dd72d82 100644 --- a/wp-includes/cron.php +++ b/wp-includes/cron.php @@ -102,7 +102,7 @@ function wp_cron() { return;
$keys = array_keys( $crons );
- if ( $keys[0] > time() )
+ if ( isset($keys[0]) && $keys[0] > time() )
return;
$schedules = wp_get_schedules();
@@ -125,6 +125,18 @@ function wp_get_schedules() { return array_merge( apply_filters( 'cron_schedules', array() ), $schedules );
}
+function wp_get_schedule($hook, $args = array()) {
+ $crons = _get_cron_array();
+ $key = md5(serialize($args));
+ if ( empty($crons) )
+ return false;
+ foreach ( $crons as $timestamp => $cron ) {
+ if ( isset( $cron[$hook][$key] ) )
+ return $cron[$hook][$key]['schedule'];
+ }
+ return false;
+}
+
//
// Private functions
//
diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index dd390aa..2cb5c02 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -127,6 +127,14 @@ function get_bloginfo($show='') { global $wp_version; $output = $wp_version; break; + case 'language': + $output = get_locale(); + $output = str_replace('_', '-', $output); + break; + case 'text_direction': + global $wp_locale; + $output = $wp_locale->text_direction; + break; case 'name': default: $output = get_option('blogname'); @@ -736,13 +744,15 @@ function noindex() { echo "<meta name='robots' content='noindex,nofollow' />\n"; } -/** - * Places a textarea according to the current user's preferences, filled with $content. - * Also places a script block that enables tabbing between Title and Content. - * - * @param string Editor contents - * @param string (optional) Previous form field's ID (for tabbing support) - */ +function user_can_richedit() { + $can = true; + + if ( 'true' != get_user_option('rich_editing') || preg_match('!opera[ /][2-8]|konqueror|safari!i', $_SERVER['HTTP_USER_AGENT']) ) + $can = false; + + return apply_filters('user_can_richedit', $can); +} + function the_editor($content, $id = 'content', $prev_id = 'title') { $rows = get_option('default_post_edit_rows'); if (($rows < 3) || ($rows > 100)) @@ -750,11 +760,61 @@ function the_editor($content, $id = 'content', $prev_id = 'title') { $rows = "rows='$rows'"; - the_quicktags(); - - if ( user_can_richedit() ) + if ( user_can_richedit() ) : add_filter('the_editor_content', 'wp_richedit_pre'); + // The following line moves the border so that the active button "attaches" to the toolbar. Only IE needs it. + ?> + <style type="text/css"> + #postdivrich table, #postdivrich #quicktags {border-top: none;} + #quicktags {border-bottom: none; padding-bottom: 2px; margin-bottom: -1px;} + #edButtons {border-bottom: 1px solid #ccc;} + </style> + <div id='edButtons' style='display:none;'> + <div class='zerosize'><input accesskey='e' type='button' onclick='switchEditors("<?php echo $id; ?>")' /></div> + <input id='edButtonPreview' class='edButtonFore' type='button' value='<?php _e('Compose'); ?>' /> + <input id='edButtonHTML' class='edButtonBack' type='button' value='<?php _e('HTML'); ?>' onclick='switchEditors("<?php echo $id; ?>")' /> + </div> + <script type="text/javascript"> + if ( typeof tinyMCE != "undefined" && tinyMCE.configs.length > 0 ) + document.getElementById('edButtons').style.display = 'block'; + </script> + + <?php endif; ?> + <div id="quicktags"> + <?php wp_print_scripts( 'quicktags' ); ?> + <script type="text/javascript">edToolbar()</script> + </div> + <script type="text/javascript"> + if ( typeof tinyMCE != "undefined" && tinyMCE.configs.length > 0 ) + document.getElementById("quicktags").style.display="none"; + + function edInsertContent(myField, myValue) { + //IE support + if (document.selection) { + myField.focus(); + sel = document.selection.createRange(); + sel.text = myValue; + myField.focus(); + } + //MOZILLA/NETSCAPE support + else if (myField.selectionStart || myField.selectionStart == "0") { + var startPos = myField.selectionStart; + var endPos = myField.selectionEnd; + myField.value = myField.value.substring(0, startPos) + + myValue + + myField.value.substring(endPos, myField.value.length); + myField.focus(); + myField.selectionStart = startPos + myValue.length; + myField.selectionEnd = startPos + myValue.length; + } else { + myField.value += myValue; + myField.focus(); + } + } + </script> + <?php + $the_editor = apply_filters('the_editor', "<div><textarea class='mceEditor' $rows cols='40' name='$id' tabindex='2' id='$id'>%s</textarea></div>\n"); $the_editor_content = apply_filters('the_editor_content', $content); @@ -764,17 +824,17 @@ function the_editor($content, $id = 'content', $prev_id = 'title') { <script type="text/javascript"> //<!-- edCanvas = document.getElementById('<?php echo $id; ?>'); - <?php if ( user_can_richedit() ) : ?> + <?php if ( $prev_id && user_can_richedit() ) : ?> // This code is meant to allow tabbing from Title to Post (TinyMCE). if ( tinyMCE.isMSIE ) document.getElementById('<?php echo $prev_id; ?>').onkeydown = function (e) { e = e ? e : window.event; if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) { - var i = tinyMCE.selectedInstance; + var i = tinyMCE.getInstanceById('<?php echo $id; ?>'); if(typeof i == 'undefined') return true; - tinyMCE.execCommand("mceStartTyping"); + tinyMCE.execCommand("mceStartTyping"); this.blur(); i.contentWindow.focus(); e.returnValue = false; @@ -786,10 +846,10 @@ function the_editor($content, $id = 'content', $prev_id = 'title') { { e = e ? e : window.event; if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) { - var i = tinyMCE.selectedInstance; + var i = tinyMCE.getInstanceById('<?php echo $id; ?>'); if(typeof i == 'undefined') return true; - tinyMCE.execCommand("mceStartTyping"); + tinyMCE.execCommand("mceStartTyping"); this.blur(); i.contentWindow.focus(); e.returnValue = false; @@ -807,4 +867,15 @@ function the_search_query() { echo wp_specialchars( stripslashes($s), 1 ); } +function language_attributes() { + $output = ''; + if ( $dir = get_bloginfo('text_direction') ) + $output = "dir=\"$dir\""; + if ( $lang = get_bloginfo('language') ) { + if ( $dir ) $output .= ' '; + $output .= "lang=\"$lang\" xml:lang=\"$lang\""; + } + + echo $output; +} ?> diff --git a/wp-includes/js/autosave.js.php b/wp-includes/js/autosave.js.php index cbd8e57..a8648f0 100644 --- a/wp-includes/js/autosave.js.php +++ b/wp-includes/js/autosave.js.php @@ -72,11 +72,12 @@ function autosave_saved() { function autosave() { var form = $('post'); + var rich = ((typeof tinyMCE != "undefined") && tinyMCE.getInstanceById('content')) ? true : false; autosaveAjax = new sack(); /* Gotta do this up here so we can check the length when tinyMCE is in use */ - if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 ) { + if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 || rich == false ) { autosaveAjax.setVar("content", form.content.value); } else { if(tinyMCE.selectedInstance.spellcheckerOn) return; @@ -110,7 +111,7 @@ function autosave() { if(form.excerpt) autosaveAjax.setVar("excerpt", form.excerpt.value); - if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 ) { + if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 || rich == false ) { autosaveAjax.setVar("content", form.content.value); } else { tinyMCE.wpTriggerSave(); diff --git a/wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js b/wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js new file mode 100644 index 0000000..102d69b --- /dev/null +++ b/wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js @@ -0,0 +1,30 @@ +/* Import plugin specific language pack */
+tinyMCE.importPluginLanguagePack('autosave', 'en,sv,cs,he,no,hu,de,da,ru,ru_KOI8-R,ru_UTF-8,fi,cy,es,is,pl');
+
+function TinyMCE_autosave_getInfo() {
+ return {
+ longname : 'Auto save',
+ author : 'Moxiecode Systems',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html',
+ version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
+ };
+};
+
+function TinyMCE_autosave_beforeUnloadHandler() {
+ var msg = tinyMCE.getLang("lang_autosave_unload_msg");
+
+ var anyDirty = false;
+ for (var n in tinyMCE.instances) {
+ var inst = tinyMCE.instances[n];
+ if (!tinyMCE.isInstance(inst))
+ continue;
+
+ if (inst.isDirty())
+ return msg;
+ }
+
+ return;
+}
+
+window.onbeforeunload = TinyMCE_autosave_beforeUnloadHandler;
diff --git a/wp-includes/js/tinymce/plugins/autosave/readme.txt b/wp-includes/js/tinymce/plugins/autosave/readme.txt new file mode 100644 index 0000000..4fdb78a --- /dev/null +++ b/wp-includes/js/tinymce/plugins/autosave/readme.txt @@ -0,0 +1 @@ +Check the TinyMCE documentation for details on this plugin.
diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin_src.js b/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin_src.js new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin_src.js diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/readme.txt b/wp-includes/js/tinymce/plugins/inlinepopups/readme.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/inlinepopups/readme.txt diff --git a/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js b/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js index 9a118f9..a596b83 100644 --- a/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js @@ -38,9 +38,9 @@ var TinyMCE_wordpressPlugin = { + '<input type="button" accesskey="g" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpPage\');" />' + '<input type="button" accesskey="u" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Undo\',false);" />' + '<input type="button" accesskey="y" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Redo\',false);" />' - + '<input type="button" accesskey="e" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceCodeEditor\',false);" />' + '<input type="button" accesskey="h" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpHelp\',false);" />' - + '<input type="button" accesskey="b" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpAdv\',false);" />' + + '<input type="button" accesskey="b" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Bold\',false);" />' + + '<input type="button" accesskey="v" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpAdv\',false);" />' + '</div>'; return buttons+hiddenControls; case "wp_adv": @@ -241,18 +241,18 @@ var TinyMCE_wordpressPlugin = { // Remove anonymous, empty paragraphs. content = content.replace(new RegExp('<p>(\\s| )*</p>', 'mg'), ''); - + // Handle table badness. content = content.replace(new RegExp('<(table( [^>]*)?)>.*?<((tr|thead)( [^>]*)?)>', 'mg'), '<$1><$3>'); content = content.replace(new RegExp('<(tr|thead|tfoot)>.*?<((td|th)( [^>]*)?)>', 'mg'), '<$1><$2>'); content = content.replace(new RegExp('</(td|th)>.*?<(td( [^>]*)?|th( [^>]*)?|/tr|/thead|/tfoot)>', 'mg'), '</$1><$2>'); content = content.replace(new RegExp('</tr>.*?<(tr|/table)>', 'mg'), '</tr><$1>'); content = content.replace(new RegExp('<(/?(table|tbody|tr|th|td)[^>]*)>(\\s*|(<br ?/?>)*)*', 'g'), '<$1>'); - + // Pretty it up for the source editor. var blocklist = 'blockquote|ul|ol|li|table|thead|tr|th|td|div|h\\d|pre|p'; content = content.replace(new RegExp('\\s*</('+blocklist+')>\\s*', 'mg'), '</$1>\n'); - content = content.replace(new RegExp('\\s*<(('+blocklist+')[^>]*)>\\s*', 'mg'), '\n<$1>'); + content = content.replace(new RegExp('\\s*<(('+blocklist+')[^>]*)>', 'mg'), '\n<$1>'); content = content.replace(new RegExp('<((li|/?tr|/?thead|/?tfoot)( [^>]*)?)>', 'g'), '\t<$1>'); content = content.replace(new RegExp('<((td|th)( [^>]*)?)>', 'g'), '\t\t<$1>'); content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'mg'), '<br />\n'); @@ -294,9 +294,9 @@ var TinyMCE_wordpressPlugin = { // content = content.replace(new RegExp('&', 'g'), '&'); // Get it ready for wpautop. - content = content.replace(new RegExp('[\\s]*<p>[\\s]*', 'mgi'), ''); - content = content.replace(new RegExp('[\\s]*</p>[\\s]*', 'mgi'), '\n\n'); - content = content.replace(new RegExp('\\n\\s*\\n\\s*\\n*', 'mgi'), '\n\n'); + content = content.replace(new RegExp('\\s*<p>', 'mgi'), ''); + content = content.replace(new RegExp('\\s*</p>\\s*', 'mgi'), '\n\n'); + content = content.replace(new RegExp('\\n\\s*\\n', 'mgi'), '\n\n'); content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n'); // Fix some block element newline issues @@ -309,8 +309,7 @@ var TinyMCE_wordpressPlugin = { content = content.replace(new RegExp('</p#>', 'g'), '</p>\n'); content = content.replace(new RegExp('\\s*(<p[^>]+>.*</p>)', 'mg'), '\n$1'); - // Trim any whitespace - content = content.replace(new RegExp('^\\s*', ''), ''); + // Trim trailing whitespace content = content.replace(new RegExp('\\s*$', ''), ''); // Hope. @@ -468,3 +467,126 @@ tinyMCE.wpTriggerSave = function () { inst.wpTriggerSave(false, false); } } + +function switchEditors(id) { + var inst = tinyMCE.getInstanceById(id); + var qt = document.getElementById('quicktags'); + var H = document.getElementById('edButtonHTML'); + var P = document.getElementById('edButtonPreview'); + var ta = document.getElementById(id); + var pdr = ta.parentNode; + + if ( inst ) { + edToggle(H, P); + + if ( tinyMCE.isMSIE && !tinyMCE.isOpera ) { + // IE rejects the later overflow assignment so we skip this step. + // Alternate code might be nice. Until then, IE reflows. + } else { + // Lock the fieldset's height to prevent reflow/flicker + pdr.style.height = pdr.clientHeight + 'px'; + pdr.style.overflow = 'hidden'; + } + + // Save the coords of the bottom right corner of the rich editor + var table = document.getElementById(inst.editorId + '_parent').getElementsByTagName('table')[0]; + var y1 = table.offsetTop + table.offsetHeight; + + if ( TinyMCE_AdvancedTheme._getCookie("TinyMCE_" + inst.editorId + "_height") == null ) { + var expires = new Date(); + expires.setTime(expires.getTime() + 3600000 * 24 * 30); + var offset = tinyMCE.isMSIE ? 1 : 2; + TinyMCE_AdvancedTheme._setCookie("TinyMCE_" + inst.editorId + "_height", "" + (table.offsetHeight - offset), expires); + } + + // Unload the rich editor + inst.triggerSave(false, false); + htm = inst.formElement.value; + tinyMCE.removeMCEControl(id); + document.getElementById(id).value = htm; + --tinyMCE.idCounter; + + // Reveal Quicktags and textarea + qt.style.display = 'block'; + ta.style.display = 'inline'; + + // Set the textarea height to match the rich editor + y2 = ta.offsetTop + ta.offsetHeight; + ta.style.height = (ta.clientHeight + y1 - y2) + 'px'; + + // Tweak the widths + ta.parentNode.style.paddingRight = '2px'; + + if ( tinyMCE.isMSIE && !tinyMCE.isOpera ) { + } else { + // Unlock the fieldset's height + pdr.style.height = 'auto'; + pdr.style.overflow = 'display'; + } + } else { + edToggle(P, H); + edCloseAllTags(); // :-( + + if ( tinyMCE.isMSIE && !tinyMCE.isOpera ) { + } else { + // Lock the fieldset's height + pdr.style.height = pdr.clientHeight + 'px'; + pdr.style.overflow = 'hidden'; + } + + // Hide Quicktags and textarea + qt.style.display = 'none'; + ta.style.display = 'none'; + + // Tweak the widths + ta.parentNode.style.paddingRight = '0px'; + + // Load the rich editor with formatted html + if ( tinyMCE.isMSIE ) { + ta.value = wpautop(ta.value); + tinyMCE.addMCEControl(ta, id); + } else { + htm = wpautop(ta.value); + tinyMCE.addMCEControl(ta, id); + tinyMCE.getInstanceById(id).execCommand('mceSetContent', null, htm); + } + + if ( tinyMCE.isMSIE && !tinyMCE.isOpera ) { + } else { + // Unlock the fieldset's height + pdr.style.height = 'auto'; + pdr.style.overflow = 'display'; + } + } +} + +function edToggle(A, B) { + A.className = 'edButtonFore'; + B.className = 'edButtonBack'; + + B.onclick = A.onclick; + A.onclick = null; +} + +function wpautop(pee) { + pee = pee + "\n\n"; + pee = pee.replace(new RegExp('<br />\\s*<br />', 'gi'), "\n\n"); + pee = pee.replace(new RegExp('(<(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)', 'gi'), "\n$1"); + pee = pee.replace(new RegExp('(</(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])>)', 'gi'), "$1\n\n"); + pee = pee.replace(new RegExp("\\r\\n|\\r", 'g'), "\n"); + pee = pee.replace(new RegExp("\\n\\s*\\n+", 'g'), "\n\n"); + pee = pee.replace(new RegExp('\n*([^\Z]+?)\\n{2}', 'mg'), "<p>$1</p>\n"); + pee = pee.replace(new RegExp('<p>\\s*?</p>', 'gi'), ''); + pee = pee.replace(new RegExp('<p>\\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\\s*</p>', 'gi'), "$1"); + pee = pee.replace(new RegExp("<p>(<li.+?)</p>", 'gi'), "$1"); + pee = pee.replace(new RegExp('<p><blockquote([^>]*)>', 'gi'), "<blockquote$1><p>"); + pee = pee.replace(new RegExp('</blockquote></p>', 'gi'), '</p></blockquote>'); + pee = pee.replace(new RegExp('<p>\\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)', 'gi'), "$1"); + pee = pee.replace(new RegExp('(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\\s*</p>', 'gi'), "$1"); + pee = pee.replace(new RegExp('\\s*\\n', 'gi'), "<br />\n"); + pee = pee.replace(new RegExp('(</?(?: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 />', 'gi'), "$1"); + pee = pee.replace(new RegExp('<br />(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)', 'gi'), '$1'); + pee = pee.replace(new RegExp('^((?: )*)\\s', 'mg'), '$1 '); + //pee = pee.replace(new RegExp('(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' "); // Hmm... + return pee; +} diff --git a/wp-includes/js/tinymce/tiny_mce_config.php b/wp-includes/js/tinymce/tiny_mce_config.php index dad3aff..808cfb6 100644 --- a/wp-includes/js/tinymce/tiny_mce_config.php +++ b/wp-includes/js/tinymce/tiny_mce_config.php @@ -28,7 +28,7 @@ $plugins = apply_filters('mce_plugins', $plugins); $plugins = implode($plugins, ','); - $mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'separator', 'bullist', 'numlist', 'outdent', 'indent', 'separator', 'justifyleft', 'justifycenter', 'justifyright', 'separator', 'link', 'unlink', 'image', 'wp_more', 'separator', 'spellchecker', 'separator', 'code', 'wp_help', 'wp_adv_start', 'wp_adv', 'separator', 'formatselect', 'underline', 'justifyfull', 'forecolor', 'separator', 'pastetext', 'pasteword', 'separator', 'removeformat', 'cleanup', 'separator', 'charmap', 'separator', 'undo', 'redo', 'wp_adv_end')); + $mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'separator', 'bullist', 'numlist', 'outdent', 'indent', 'separator', 'justifyleft', 'justifycenter', 'justifyright', 'separator', 'link', 'unlink', 'image', 'wp_more', 'separator', 'spellchecker', 'separator', 'wp_help', 'wp_adv_start', 'wp_adv', 'separator', 'formatselect', 'underline', 'justifyfull', 'forecolor', 'separator', 'pastetext', 'pasteword', 'separator', 'removeformat', 'cleanup', 'separator', 'charmap', 'separator', 'undo', 'redo', 'wp_adv_end')); $mce_buttons = implode($mce_buttons, ','); $mce_buttons_2 = apply_filters('mce_buttons_2', array()); diff --git a/wp-includes/js/tinymce/tiny_mce_gzip.php b/wp-includes/js/tinymce/tiny_mce_gzip.php index d92e08e..686fb61 100644 --- a/wp-includes/js/tinymce/tiny_mce_gzip.php +++ b/wp-includes/js/tinymce/tiny_mce_gzip.php @@ -35,8 +35,9 @@ function wp_tinymce_lang($path) { // Fall back on en.js - if ( empty($text) ) - $text = file_get_contents(realpath(sprintf($path, 'en'))); + $file = realpath(sprintf($path, 'en')); + if ( empty($text) && file_exists($file) ) + $text = file_get_contents($file); // Send lang file through gettext if ( function_exists('__') && strtolower(substr($language, 0, 2)) != 'en' ) { diff --git a/wp-includes/l10n.php b/wp-includes/l10n.php index ba77c23..b2b099c 100644 --- a/wp-includes/l10n.php +++ b/wp-includes/l10n.php @@ -1,10 +1,4 @@ <?php - -if ( defined('WPLANG') && '' != constant('WPLANG') ) { - include_once(ABSPATH . 'wp-includes/streams.php'); - include_once(ABSPATH . 'wp-includes/gettext.php'); -} - function get_locale() { global $locale; @@ -75,13 +69,15 @@ function load_default_textdomain() { global $l10n; $locale = get_locale(); - $mofile = ABSPATH . "wp-includes/languages/$locale.mo"; + $mofile = ABSPATH . LANGDIR . "/$locale.mo"; load_textdomain('default', $mofile); } -function load_plugin_textdomain($domain, $path = 'wp-content/plugins') { +function load_plugin_textdomain($domain, $path = false) { $locale = get_locale(); + if ( false === $path ) + $path = PLUGINDIR; $mofile = ABSPATH . "$path/$domain-$locale.mo"; load_textdomain($domain, $mofile); @@ -94,4 +90,4 @@ function load_theme_textdomain($domain) { load_textdomain($domain, $mofile); } -?>
\ No newline at end of file +?> diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 965c4e4..78e789f 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -482,7 +482,7 @@ function _max_num_pages() { if ( 'posts' == get_query_var('what_to_show') ) { preg_match('#FROM\s(.*)\sORDER BY#siU', $wp_query->request, $matches); $fromwhere = $matches[1]; - $numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere"); + $numposts = $wpdb->get_var("SELECT COUNT(DISTINCT $wpdb->posts.ID) FROM $fromwhere"); $max_num_pages = ceil($numposts / $posts_per); } else { preg_match('#FROM\s(.*)\sORDER BY#siU', $wp_query->request, $matches); diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php index 2750942..0c33ad7 100644 --- a/wp-includes/pluggable.php +++ b/wp-includes/pluggable.php @@ -263,7 +263,7 @@ endif; // Cookie safe redirect. Works around IIS Set-Cookie bug. // http://support.microsoft.com/kb/q176113/ if ( !function_exists('wp_redirect') ) : -function wp_redirect($location) { +function wp_redirect($location, $status = 302) { global $is_IIS; $location = preg_replace('|[^a-z0-9-~+_.?#=&;,/:%]|i', '', $location); @@ -272,6 +272,8 @@ function wp_redirect($location) { $strip = array('%0d', '%0a'); $location = str_replace($strip, '', $location); + status_header($status); + if ($is_IIS) header("Refresh: 0;url=$location"); else @@ -294,22 +296,40 @@ function wp_setcookie($username, $password, $already_md5 = false, $home = '', $s if ( !$already_md5 ) $password = md5( md5($password) ); // Double hash the password in the cookie. + if ( empty($home) ) + $cookiepath = COOKIEPATH; + else + $cookiepath = preg_replace('|https?://[^/]+|i', '', $home . '/' ); + + if ( empty($siteurl) ) { + $sitecookiepath = SITECOOKIEPATH; + $cookiehash = COOKIEHASH; + } else { + $sitecookiepath = preg_replace('|https?://[^/]+|i', '', $siteurl . '/' ); + $cookiehash = md5($siteurl); + } + if ( $remember ) $expire = time() + 31536000; else $expire = 0; - global $base; - setcookie(USER_COOKIE, $username, $expire, $base, COOKIE_DOMAIN); - setcookie(PASS_COOKIE, $password, $expire, $base, COOKIE_DOMAIN); + setcookie(USER_COOKIE, $username, $expire, $cookiepath, COOKIE_DOMAIN); + setcookie(PASS_COOKIE, $password, $expire, $cookiepath, COOKIE_DOMAIN); + + if ( $cookiepath != $sitecookiepath ) { + setcookie(USER_COOKIE, $username, $expire, $sitecookiepath, COOKIE_DOMAIN); + setcookie(PASS_COOKIE, $password, $expire, $sitecookiepath, COOKIE_DOMAIN); + } } endif; if ( !function_exists('wp_clearcookie') ) : function wp_clearcookie() { - global $base; - setcookie(USER_COOKIE, ' ', time() - 31536000, $base, COOKIE_DOMAIN); - setcookie(PASS_COOKIE, ' ', time() - 31536000, $base, COOKIE_DOMAIN); + setcookie(USER_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN); + setcookie(PASS_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN); + setcookie(USER_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN); + setcookie(PASS_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN); } endif; diff --git a/wp-includes/query.php b/wp-includes/query.php index 689b27f..c1b88ec 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -329,6 +329,44 @@ class WP_Query { function parse_query_vars() {
$this->parse_query('');
}
+
+ function fill_query_vars($array) {
+ $keys = array(
+ 'error'
+ , 'm'
+ , 'p'
+ , 'subpost'
+ , 'subpost_id'
+ , 'attachment'
+ , 'attachment_id'
+ , 'name'
+ , 'hour'
+ , 'static'
+ , 'pagename'
+ , 'page_id'
+ , 'second'
+ , 'minute'
+ , 'hour'
+ , 'day'
+ , 'monthnum'
+ , 'year'
+ , 'w'
+ , 'category_name'
+ , 'author_name'
+ , 'feed'
+ , 'tb'
+ , 'paged'
+ , 'comments_popup'
+ , 'preview'
+ );
+
+ foreach ($keys as $key) {
+ if ( !isset($array[$key]))
+ $array[$key] = '';
+ }
+
+ return $array;
+ }
// Parse a query string and set query type booleans.
function parse_query ($query) {
@@ -341,7 +379,9 @@ class WP_Query { $this->query = $query;
$this->query_vars = $qv;
}
-
+
+ $qv = $this->fill_query_vars($qv);
+
if ( ! empty($qv['robots']) ) {
$this->is_robots = true;
return;
@@ -530,6 +570,8 @@ class WP_Query { // Shorthand.
$q = &$this->query_vars;
+
+ $q = $this->fill_query_vars($q);
// First let's clear some variables
$distinct = '';
@@ -540,6 +582,7 @@ class WP_Query { $where = '';
$limits = '';
$join = '';
+ $search = '';
if ( !isset($q['post_type']) )
$q['post_type'] = 'post';
@@ -909,12 +952,12 @@ class WP_Query { }
if (($q['what_to_show'] == 'posts')) {
- $q['offset'] = abs(intval($q['offset']));
if ( empty($q['offset']) ) {
$pgstrt = '';
$pgstrt = (intval($page) -1) * $q['posts_per_page'] . ', ';
$limits = 'LIMIT '.$pgstrt.$q['posts_per_page'];
} else { // we're ignoring $page and using 'offset'
+ $q['offset'] = abs(intval($q['offset']));
$pgstrt = $q['offset'] . ', ';
$limits = 'LIMIT ' . $pgstrt . $q['posts_per_page'];
}
diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 6fc2bdd..6d069c6 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -15,10 +15,10 @@ class WP_Scripts { $this->add( 'sack', '/wp-includes/js/tw-sack.js', false, '1.6.1' ); $this->add( 'quicktags', '/wp-includes/js/quicktags.js', false, '3517' ); $this->add( 'colorpicker', '/wp-includes/js/colorpicker.js', false, '3517' ); - $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '08152006' ); - $this->add( 'wp_tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('tiny_mce'), '04162006' ); + $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '09212006' ); + $this->add( 'wp_tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('tiny_mce'), '09212006' ); $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.0'); - $this->add( 'autosave', '/wp-includes/js/autosave.js.php', array('prototype', 'sack'), '4183'); + $this->add( 'autosave', '/wp-includes/js/autosave.js.php', array('prototype', 'sack'), '4206'); $this->add( 'wp-ajax', '/wp-includes/js/wp-ajax-js.php', array('prototype'), '4187'); $this->add( 'listman', '/wp-includes/js/list-manipulation-js.php', array('wp-ajax', 'fat'), '4187'); $this->add( 'scriptaculous', '/wp-includes/js/scriptaculous/scriptaculous.js', array('prototype'), '1.6.1'); diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index d02606b..f543099 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -283,6 +283,9 @@ class wpdb { $this->func_call = "\$db->get_row(\"$query\",$output,$y)"; if ( $query ) $this->query($query); + + if ( !isset($this->last_result[$y]) ) + return null; if ( $output == OBJECT ) { return $this->last_result[$y] ? $this->last_result[$y] : null; @@ -433,5 +436,6 @@ class wpdb { } } -$wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST); +if ( ! isset($wpdb) ) + $wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST); ?> diff --git a/wp-settings.php b/wp-settings.php index f91d822..57bce50 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -3,7 +3,7 @@ if( defined( 'ABSPATH' ) == false ) die(); // Turn register globals off -function unregister_GLOBALS() { +function wp_unregister_GLOBALS() { if ( !ini_get('register_globals') ) return; @@ -19,7 +19,7 @@ function unregister_GLOBALS() { unset($GLOBALS[$k]); } -unregister_GLOBALS(); +wp_unregister_GLOBALS(); unset( $wp_filter, $cache_userdata, $cache_lastcommentmodified, $cache_lastpostdate, $cache_settings, $category_cache, $cache_categories ); @@ -84,6 +84,10 @@ if ( defined('WP_CACHE') ) require (ABSPATH . 'wp-content/advanced-cache.php'); define('WPINC', 'wp-includes'); +if ( !defined('LANGDIR') ) + define('LANGDIR', WPINC . '/languages'); // no leading slash, no trailing slash +if ( !defined('PLUGINDIR') ) + define('PLUGINDIR', 'wp-content/plugins'); // no leading slash, no trailing slash if ( file_exists(ABSPATH . 'wp-content/db.php') ) require (ABSPATH . 'wp-content/db.php'); else |