diff options
-rw-r--r-- | wp-admin/edit.php | 2 | ||||
-rw-r--r-- | wp-admin/upgrade-functions.php | 7 | ||||
-rw-r--r-- | wp-admin/wp-admin.css | 1 | ||||
-rw-r--r-- | wp-content/themes/default/archive.php | 2 | ||||
-rw-r--r-- | wp-includes/comment-template.php | 2 | ||||
-rw-r--r-- | wp-includes/default-filters.php | 2 | ||||
-rw-r--r-- | wp-includes/formatting.php | 3 | ||||
-rw-r--r-- | wp-includes/functions.php | 16 | ||||
-rw-r--r-- | wp-includes/general-template.php | 3 | ||||
-rw-r--r-- | wp-includes/js/tinymce/tiny_mce_gzip.php | 331 | ||||
-rw-r--r-- | wp-includes/script-loader.php | 2 | ||||
-rw-r--r-- | wp-includes/template-loader.php | 38 | ||||
-rw-r--r-- | xmlrpc.php | 13 |
13 files changed, 235 insertions, 187 deletions
diff --git a/wp-admin/edit.php b/wp-admin/edit.php index 44a3ddb..47f5ad8 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -64,7 +64,7 @@ if ( is_month() ) { printf(__('Search for “%s”'), wp_specialchars($_GET['s']) ); } else { if ( is_single() ) - printf(__('Comments on %s'), $post->post_title); + printf(__('Comments on %s'), apply_filters( "the_title", $post->post_title)); elseif ( ! is_paged() || get_query_var('paged') == 1 ) _e('Last 15 Posts'); else diff --git a/wp-admin/upgrade-functions.php b/wp-admin/upgrade-functions.php index b7a1f93..35095d0 100644 --- a/wp-admin/upgrade-functions.php +++ b/wp-admin/upgrade-functions.php @@ -21,7 +21,12 @@ function wp_install($blog_title, $user_name, $user_email, $public, $meta='') { update_option('admin_email', $user_email); update_option('blog_public', $public); $schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://'; - $guessurl = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); + + if ( defined('WP_SITEURL') && '' != WP_SITEURL ) + $guessurl = WP_SITEURL; + else + $guessurl = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); + update_option('siteurl', $guessurl); // If not a public blog, don't ping. diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css index d3d7b1f..6de69f4 100644 --- a/wp-admin/wp-admin.css +++ b/wp-admin/wp-admin.css @@ -488,6 +488,7 @@ input.disabled, textarea.disabled { line-height: 200%; list-style: none; text-align: center; + white-space: nowrap; } #adminmenu a.current { diff --git a/wp-content/themes/default/archive.php b/wp-content/themes/default/archive.php index f5881f8..1d2b1de 100644 --- a/wp-content/themes/default/archive.php +++ b/wp-content/themes/default/archive.php @@ -6,7 +6,7 @@ <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?> <?php /* If this is a category archive */ if (is_category()) { ?> - <h2 class="pagetitle">Archive for the ‘<?php echo single_cat_title(); ?>’ Category</h2> + <h2 class="pagetitle">Archive for the ‘<?php single_cat_title(); ?>’ Category</h2> <?php /* If this is a daily archive */ } elseif (is_day()) { ?> <h2 class="pagetitle">Archive for <?php the_time('F jS, Y'); ?></h2> diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index 19fed0c..0c16240 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -161,7 +161,7 @@ function get_comments_number( $post_id = 0 ) { return apply_filters('get_comments_number', $count); } -function comments_number( $zero = false, $one = false, $more = false, $number = '' ) { +function comments_number( $zero = false, $one = false, $more = false, $deprecated = '' ) { global $id; $number = get_comments_number($id); diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index 35cd104..cda3cc9 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -145,6 +145,8 @@ add_filter('the_author', 'ent2ncr', 8); // Misc filters add_filter('option_ping_sites', 'privacy_ping_filter'); add_filter('option_blog_charset', 'wp_specialchars'); +add_filter('option_home', '_config_wp_home'); +add_filter('option_siteurl', '_config_wp_siteurl'); add_filter('mce_plugins', '_mce_load_rtl_plugin'); add_filter('mce_buttons', '_mce_add_direction_buttons'); diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index a0c13db..d497819 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -1074,10 +1074,9 @@ function clean_url( $url, $protocols = null ) { $url = str_replace(';//', '://', $url); // Append http unless a relative link starting with / or a php file. if ( strpos($url, '://') === false && - substr( $url, 0, 1 ) != '/' && !preg_match('/^[a-z0-9]+.php/i', $url) ) + substr( $url, 0, 1 ) != '/' && !preg_match('/^[a-z0-9]+?\.php/i', $url) ) $url = 'http://' . $url; - $url = (strpos($url, '://') === false && substr( $url, 0, 1 ) != '/' ) ? 'http://'.$url : $url; $url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&$1', $url); if ( !is_array($protocols) ) $protocols = array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet'); diff --git a/wp-includes/functions.php b/wp-includes/functions.php index ba67d5f..dbe728f 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1012,7 +1012,9 @@ function is_blog_installed() { $wpdb->hide_errors(); $installed = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'"); $wpdb->show_errors(); - return $installed; + + $install_status = !empty( $installed ) ? TRUE : FALSE; + return $install_status; } function wp_nonce_url($actionurl, $action = -1) { @@ -1370,6 +1372,18 @@ function wp_die( $message, $title = '' ) { die(); } +function _config_wp_home($url = '') { + if ( defined( 'WP_HOME' ) ) + return WP_HOME; + else return $url; +} + +function _config_wp_siteurl($url = '') { + if ( defined( 'WP_SITEURL' ) ) + return WP_SITEURL; + else return $url; +} + function _mce_set_direction() { global $wp_locale; diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index 37d80d6..7b21003 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -201,7 +201,8 @@ function wp_title($sep = '»', $display = true) { if ( !empty($m) ) { $my_year = substr($m, 0, 4); $my_month = $wp_locale->get_month($m); - $title = "$my_year $sep $my_month"; + $my_day = intval(substr($m, 6, 2)); + $title = "$my_year" . ($my_month ? "$sep $my_month" : "") . ($my_day ? "$sep $my_day" : ""); } if ( !empty($year) ) { diff --git a/wp-includes/js/tinymce/tiny_mce_gzip.php b/wp-includes/js/tinymce/tiny_mce_gzip.php index 0de8f42..d3d7c79 100644 --- a/wp-includes/js/tinymce/tiny_mce_gzip.php +++ b/wp-includes/js/tinymce/tiny_mce_gzip.php @@ -1,10 +1,7 @@ <?php /** - * $RCSfile: tiny_mce_gzip.php,v $ - * $Revision: $ - * $Date: $ + * $Id: tiny_mce_gzip.php 158 2006-12-21 14:32:19Z spocke $ * - * @version 1.08 * @author Moxiecode * @copyright Copyright 2005-2006, Moxiecode Systems AB, All rights reserved. * @@ -13,201 +10,223 @@ * Notice: This script defaults the button_tile_map option to true for extra performance. */ -@require_once('../../../wp-config.php'); - -// gzip_compression(); - -function wp_tinymce_lang($path) { - global $language; + @require_once('../../../wp-config.php'); // For get_bloginfo(). + + // Get input + $plugins = explode(',', getParam("plugins", "")); + $languages = explode(',', getParam("languages", "")); + $themes = explode(',', getParam("themes", "")); + $diskCache = getParam("diskcache", "") == "true"; + $isJS = getParam("js", "") == "true"; + $compress = getParam("compress", "true") == "true"; + $suffix = getParam("suffix", "_src") == "_src" ? "_src" : ""; + $cachePath = realpath("."); // Cache path, this is where the .gz files will be stored + $expiresOffset = 3600 * 24 * 10; // Cache for 10 days in browser cache + $content = ""; + $encodings = array(); + $supportsGzip = false; + $enc = ""; + $cacheKey = ""; + + // Custom extra javascripts to pack + $custom = array(/* + "some custom .js file", + "some custom .js file" + */); + + // WP + $index = getParam("index", -1); + $theme = getParam("theme", ""); + $themes = array($theme); + $language = getParam("language", "en"); + if ( empty($language) ) + $language = 'en'; + $languages = array($language); + if ( $language != strtolower($language) ) + $languages[] = strtolower($language); + if ( $language != substr($language, 0, 2) ) + $languages[] = substr($language, 0, 2); + $diskCache = false; + $isJS = true; + $suffix = ''; + + // Headers + header("Content-Type: text/javascript; charset=" . get_bloginfo('charset')); + header("Vary: Accept-Encoding"); // Handle proxies + header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT"); + + // Is called directly then auto init with default settings + if (!$isJS) { + echo getFileContents("tiny_mce_gzip.js"); + echo "tinyMCE_GZ.init({});"; + die(); + } - $text = ''; + // Setup cache info + if ($diskCache) { + if (!$cachePath) + die("alert('Real path failed.');"); - // Look for xx_YY.js, xx_yy.js, xx.js - $file = realpath(sprintf($path, $language)); - if ( file_exists($file) ) - $text = file_get_contents($file); - $file = realpath(sprintf($path, strtolower($language))); - if ( file_exists($file) ) - $text = file_get_contents($file); - $file = realpath(sprintf($path, substr($language, 0, 2))); - if ( file_exists($file) ) - $text = file_get_contents($file); + $cacheKey = getParam("plugins", "") . getParam("languages", "") . getParam("themes", ""); + foreach ($custom as $file) + $cacheKey .= $file; - // Fall back on en.js - $file = realpath(sprintf($path, 'en')); - if ( empty($text) && file_exists($file) ) - $text = file_get_contents($file); + $cacheKey = md5($cacheKey); - // Send lang file through gettext - if ( function_exists('__') && strtolower(substr($language, 0, 2)) != 'en' ) { - $search1 = "/^tinyMCELang\\[(['\"])(.*)\\1\]( ?= ?)(['\"])(.*)\\4/Uem"; - $replace1 = "'tinyMCELang[\\1\\2\\1]\\3'.stripslashes('\\4').__('\\5').stripslashes('\\4')"; + if ($compress) + $cacheFile = $cachePath . "/tiny_mce_" . $cacheKey . ".gz"; + else + $cacheFile = $cachePath . "/tiny_mce_" . $cacheKey . ".js"; + } - $search2 = "/\\s:\\s(['\"])(.*)\\1(,|\\s*})/Uem"; - $replace2 = "' : '.stripslashes('\\1').__('\\2').stripslashes('\\1').'\\3'"; + // Check if it supports gzip + if (isset($_SERVER['HTTP_ACCEPT_ENCODING'])) + $encodings = explode(',', strtolower(preg_replace("/\s+/", "", $_SERVER['HTTP_ACCEPT_ENCODING']))); - $search = array($search1, $search2); - $replace = array($replace1, $replace2); + if ((in_array('gzip', $encodings) || in_array('x-gzip', $encodings) || isset($_SERVER['---------------'])) && function_exists('ob_gzhandler') && !ini_get('zlib.output_compression')) { + $enc = in_array('x-gzip', $encodings) ? "x-gzip" : "gzip"; + $supportsGzip = true; + } - $text = preg_replace($search, $replace, $text); + // Use cached file disk cache + if ($diskCache && $supportsGzip && file_exists($cacheFile)) { + if ($compress) + header("Content-Encoding: " . $enc); - return $text; + echo getFileContents($cacheFile); + die(); } - return $text; -} - -function wp_compact_tinymce_js($text) { - // This function was custom-made for TinyMCE 2.0, not expected to work with any other JS. +if ($index > -1) { + // Write main script and patch some things + if ( $index == 0 ) { + // Add core + $content .= wp_compact_tinymce_js(getFileContents("tiny_mce" . $suffix . ".js")); + $content .= 'TinyMCE.prototype.orgLoadScript = TinyMCE.prototype.loadScript;'; + $content .= 'TinyMCE.prototype.loadScript = function() {};var realTinyMCE = tinyMCE;'; + } else + $content .= 'tinyMCE = realTinyMCE;'; - // Strip comments - $text = preg_replace("!(^|\s+)//.*$!m", '', $text); - $text = preg_replace("!/\*.*?\*/!s", '', $text); + // Patch loading functions + //$content .= "tinyMCE_GZ.start();"; + + // Do init based on index + $content .= "tinyMCE.init(tinyMCECompressed.configs[" . $index . "]);"; - // Strip leading tabs, carriage returns and unnecessary line breaks. - $text = preg_replace("!^\t+!m", '', $text); - $text = str_replace("\r", '', $text); - $text = preg_replace("!(^|{|}|;|:|\))\n!m", '\\1', $text); + // Load external plugins + if ( $index == 0 ) + $content .= "tinyMCECompressed.loadPlugins();"; - return "$text\n"; -} + // Add core languages + foreach ($languages as $lang) + $content .= getFileContents("langs/" . $lang . ".js"); + // Add themes + foreach ($themes as $theme) { + $content .= wp_compact_tinymce_js(getFileContents( "themes/" . $theme . "/editor_template" . $suffix . ".js")); -// General options -$suffix = ""; // Set to "_src" to use source version -$expiresOffset = 3600 * 24 * 10; // 10 days util client cache expires -$diskCache = false; // If you enable this option gzip files will be cached on disk. -$cacheDir = realpath("."); // Absolute directory path to where cached gz files will be stored -$debug = false; // Enable this option if you need debuging info - -// Headers -header("Content-Type: text/javascript; charset=" . get_bloginfo('charset')); -// header("Cache-Control: must-revalidate"); -header("Vary: Accept-Encoding"); // Handle proxies -header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT"); - -// Get data to load -$theme = isset($_GET['theme']) ? TinyMCE_cleanInput($_GET['theme']) : ""; -$language = isset($_GET['language']) ? TinyMCE_cleanInput($_GET['language']) : ""; -$plugins = isset($_GET['plugins']) ? TinyMCE_cleanInput($_GET['plugins']) : ""; -$lang = isset($_GET['lang']) ? TinyMCE_cleanInput($_GET['lang']) : "en"; -$index = isset($_GET['index']) ? TinyMCE_cleanInput($_GET['index']) : -1; -$cacheKey = md5($theme . $language . $plugins . $lang . $index . $debug); -$cacheFile = $cacheDir == "" ? "" : $cacheDir . "/" . "tinymce_" . $cacheKey . ".gz"; -$cacheData = ""; - -// Patch older versions of PHP < 4.3.0 -if (!function_exists('file_get_contents')) { - function file_get_contents($filename) { - $fd = fopen($filename, 'rb'); - $content = fread($fd, filesize($filename)); - fclose($fd); - return $content; + foreach ($languages as $lang) + $content .= getFileContents("themes/" . $theme . "/langs/" . $lang . ".js"); } -} -// Security check function, can only contain a-z 0-9 , _ - and whitespace. -function TinyMCE_cleanInput($str) { - return preg_replace("/[^0-9a-z\-_,]+/i", "", $str); // Remove anything but 0-9,a-z,-_ -} + // Add plugins + foreach ($plugins as $plugin) { + $content .= getFileContents("plugins/" . $plugin . "/editor_plugin" . $suffix . ".js"); -function TinyMCE_echo($str) { - global $cacheData, $diskCache; + foreach ($languages as $lang) + $content .= getFileContents("plugins/" . $plugin . "/langs/" . $lang . ".js"); + } - if ($diskCache) - $cacheData .= $str; - else - echo $str; -} + // Add custom files + foreach ($custom as $file) + $content .= getFileContents($file); -// Only gzip the contents if clients and server support it -$encodings = array(); + // Reset tinyMCE compressor engine + $content .= "tinyMCE = tinyMCECompressed;"; -if (isset($_SERVER['HTTP_ACCEPT_ENCODING'])) - $encodings = explode(',', strtolower(preg_replace("/\s+/", "", $_SERVER['HTTP_ACCEPT_ENCODING']))); + // Restore loading functions + //$content .= "tinyMCE_GZ.end();"; -// Check for gzip header or northon internet securities -if ((in_array('gzip', $encodings) || in_array('x-gzip', $encodings) || isset($_SERVER['---------------'])) && function_exists('ob_gzhandler') && !ini_get('zlib.output_compression')) { - $enc = in_array('x-gzip', $encodings) ? "x-gzip" : "gzip"; + // Generate GZIP'd content + if ($supportsGzip) { + if ($compress) { + header("Content-Encoding: " . $enc); + $cacheData = gzencode($content, 9, FORCE_GZIP); + } else + $cacheData = $content; - // Use cached file if it exists but not in debug mode - if (file_exists($cacheFile) && !$debug) { - header("Content-Encoding: " . $enc); - echo file_get_contents($cacheFile); - die; - } + // Write gz file + if ($diskCache && $cacheKey != "") + putFileContents($cacheFile, $cacheData); - if (!$diskCache) - ob_start("ob_gzhandler"); -} else - $diskCache = false; + // Stream to client + echo $cacheData; + } else { + // Stream uncompressed content + echo $content; + } -if ($index > -1) { - // Write main script and patch some things - if ($index == 0) { - TinyMCE_echo(wp_compact_tinymce_js(file_get_contents(realpath("tiny_mce" . $suffix . ".js")))); // WP - TinyMCE_echo('TinyMCE.prototype.orgLoadScript = TinyMCE.prototype.loadScript;'); - TinyMCE_echo('TinyMCE.prototype.loadScript = function() {};var realTinyMCE = tinyMCE;'); - } else - TinyMCE_echo('tinyMCE = realTinyMCE;'); + die; +} - // Do init based on index - TinyMCE_echo("tinyMCE.init(tinyMCECompressed.configs[" . $index . "]);"); + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - // Load external plugins - if ($index == 0) - TinyMCE_echo("tinyMCECompressed.loadPlugins();"); + function getParam($name, $def = false) { + if (!isset($_GET[$name])) + return $def; - // Load theme, language pack and theme language packs - if ($theme) { - TinyMCE_echo(wp_compact_tinymce_js(file_get_contents(realpath("themes/" . $theme . "/editor_template" . $suffix . ".js")))); // WP - TinyMCE_echo(wp_tinymce_lang("themes/" . $theme . "/langs/%s.js")); // WP + return preg_replace("/[^0-9a-z\-_,]+/i", "", $_GET[$name]); // Remove anything but 0-9,a-z,-_ } - /* WP if ($language) WP */ - TinyMCE_echo(wp_tinymce_lang("langs/%s.js")); // WP + function getFileContents($path) { + $path = realpath($path); - // Load all plugins and their language packs - $plugins = explode(",", $plugins); - foreach ($plugins as $plugin) { - $pluginFile = realpath("plugins/" . $plugin . "/editor_plugin" . $suffix . ".js"); - /* WP $languageFile = realpath("plugins/" . $plugin . "/langs/" . $lang . ".js"); WP */ + if (!$path || !@is_file($path)) + return ""; - if ($pluginFile) - TinyMCE_echo(file_get_contents($pluginFile)); + if (function_exists("file_get_contents")) + return @file_get_contents($path); - /* WP if ($languageFile) WP */ - TinyMCE_echo(wp_tinymce_lang("plugins/" . $plugin . "/langs/%s.js")); // WP - } + $content = ""; + $fp = @fopen($path, "r"); + if (!$fp) + return ""; - // Reset tinyMCE compressor engine - TinyMCE_echo("tinyMCE = tinyMCECompressed;"); + while (!feof($fp)) + $content .= fgets($fp); - // Write to cache - if ($diskCache) { - // Calculate compression ratio and debug target output path - if ($debug) { - $ratio = round(100 - strlen(gzencode($cacheData, 9, FORCE_GZIP)) / strlen($cacheData) * 100.0); - TinyMCE_echo("alert('TinyMCE was compressed by " . $ratio . "%.\\nOutput cache file: " . $cacheFile . "');"); - } + fclose($fp); + + return $content; + } - $cacheData = gzencode($cacheData, 9, FORCE_GZIP); + function putFileContents($path, $content) { + if (function_exists("file_put_contents")) + return @file_put_contents($path, $content); - // Write to file if possible - $fp = @fopen($cacheFile, "wb"); + $fp = @fopen($path, "wb"); if ($fp) { - fwrite($fp, $cacheData); + fwrite($fp, $content); fclose($fp); } - - // Output - header("Content-Encoding: " . $enc); - echo $cacheData; } - die; -} + // WP specific + function wp_compact_tinymce_js($text) { + // This function was custom-made for TinyMCE 2.0, not expected to work with any other JS. + + // Strip comments + $text = preg_replace("!(^|\s+)//.*$!m", '', $text); + $text = preg_replace("!/\*.*?\*/!s", '', $text); + + // Strip leading tabs, carriage returns and unnecessary line breaks. + $text = preg_replace("!^\t+!m", '', $text); + $text = str_replace("\r", '', $text); + $text = preg_replace("!(^|{|}|;|:|\))\n!m", '\\1', $text); + + return "$text\n"; + } ?> function TinyMCECompressed() { diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index cd3dfbc..625ec29 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -15,7 +15,7 @@ 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, '20070124' ); + $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '20070325' ); $mce_config = apply_filters('tiny_mce_config_url', '/wp-includes/js/tinymce/tiny_mce_config.php'); $this->add( 'wp_tiny_mce', $mce_config, array('tiny_mce'), '20070225' ); $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.0-0'); diff --git a/wp-includes/template-loader.php b/wp-includes/template-loader.php index 8b44d89..7b654b8 100644 --- a/wp-includes/template-loader.php +++ b/wp-includes/template-loader.php @@ -3,70 +3,70 @@ if ( defined('WP_USE_THEMES') && constant('WP_USE_THEMES') ) { do_action('template_redirect'); if ( is_robots() ) { do_action('do_robots'); - exit; + return; } else if ( is_feed() ) { do_feed(); - exit; + return; } else if ( is_trackback() ) { include(ABSPATH . '/wp-trackback.php'); - exit; + return; } else if ( is_404() && $template = get_404_template() ) { include($template); - exit; + return; } else if ( is_search() && $template = get_search_template() ) { include($template); - exit; + return; } else if ( is_home() && $template = get_home_template() ) { include($template); - exit; + return; } else if ( is_attachment() && $template = get_attachment_template() ) { include($template); - exit; + return; } else if ( is_single() && $template = get_single_template() ) { if ( is_attachment() ) add_filter('the_content', 'prepend_attachment'); include($template); - exit; + return; } else if ( is_page() && $template = get_page_template() ) { if ( is_attachment() ) add_filter('the_content', 'prepend_attachment'); include($template); - exit; + return; } else if ( is_category() && $template = get_category_template()) { include($template); - exit; + return; } else if ( is_author() && $template = get_author_template() ) { include($template); - exit; + return; } else if ( is_date() && $template = get_date_template() ) { include($template); - exit; + return; } else if ( is_archive() && $template = get_archive_template() ) { include($template); - exit; + return; } else if ( is_comments_popup() && $template = get_comments_popup_template() ) { include($template); - exit; + return; } else if ( is_paged() && $template = get_paged_template() ) { include($template); - exit; + return; } else if ( file_exists(TEMPLATEPATH . "/index.php") ) { if ( is_attachment() ) add_filter('the_content', 'prepend_attachment'); include(TEMPLATEPATH . "/index.php"); - exit; + return; } } else { // Process feeds and trackbacks even if not using themes. if ( is_robots() ) { do_action('do_robots'); - exit; + return; } else if ( is_feed() ) { do_feed(); - exit; + return; } else if ( is_trackback() ) { include(ABSPATH . '/wp-trackback.php'); - exit; + return; } } @@ -261,7 +261,6 @@ class wp_xmlrpc_server extends IXR_Server { } // Lookup info on pages. - $pages = array(); $pages = get_pages(); $num_pages = count($pages); @@ -280,7 +279,7 @@ class wp_xmlrpc_server extends IXR_Server { } // If no pages were found return an error. else { - return(new IXR_Error(404, "Sorry, no pages were found.")); + return(array()); } } @@ -1100,6 +1099,14 @@ class wp_xmlrpc_server extends IXR_Server { return new IXR_Error(401, 'Sorry, you can not edit this post.'); $postdata = wp_get_single_post($post_ID, ARRAY_A); + + // If there is no post data for the give post id, stop + // now and return an error. Other wise a new post will be + // created (which was the old behavior). + if(empty($postdata["ID"])) { + return(new IXR_Error(404, "Invalid post id.")); + } + extract($postdata); $this->escape($postdata); @@ -1615,7 +1622,7 @@ class wp_xmlrpc_server extends IXR_Server { /* mt.supportedTextFilters ...returns an empty array because we don't support per-post text filters yet */ function mt_supportedTextFilters($args) { - return array(); + return apply_filters('xmlrpc_text_filters', array()); } |