Index: xmlrpc.php
===================================================================
--- xmlrpc.php	(revision 8170)
+++ xmlrpc.php	(working copy)
@@ -111,7 +111,7 @@
 class wp_xmlrpc_server extends IXR_Server {
 
 	function wp_xmlrpc_server() {
-		$xmlrpc_methods = array(
+		$this->methods = array(
 			// WordPress API
 			'wp.getUsersBlogs'		=> 'this:wp_getUsersBlogs',
 			'wp.getPage'			=> 'this:wp_getPage',
@@ -167,10 +167,8 @@
 			'mt.supportedMethods' => 'this:mt_supportedMethods',
 			'mt.supportedTextFilters' => 'this:mt_supportedTextFilters',
 			'mt.getTrackbackPings' => 'this:mt_getTrackbackPings',
-			'mt.publishPost' => 'this:mt_publishPost'
-		);
-		
-		$xmlrpc_functions = array (
+			'mt.publishPost' => 'this:mt_publishPost',
+
 			// PingBack
 			'pingback.ping' => 'this:pingback_ping',
 			'pingback.extensions.getPingbacks' => 'this:pingback_extensions_getPingbacks',
@@ -179,13 +177,7 @@
 			'demo.addTwoNumbers' => 'this:addTwoNumbers'
 		);
 
-		if ( get_option('enable_xmlrpc') )
-		{
-			$this->methods = array_merge($xmlrpc_methods,$xmlrpc_functions);
-		} else {
-			$this->methods = $xmlrpc_functions;
-		}
-		
+		$this->enabled = ( get_option('enable_xmlrpc') ) ? true : false;
 		$this->initialise_blog_option_info( );
 		$this->methods = apply_filters('xmlrpc_methods', $this->methods);
 		$this->IXR_Server($this->methods);
@@ -328,6 +320,9 @@
 	 * wp_getUsersBlogs
 	 */
 	function wp_getUsersBlogs( $args ) {
+		if ( ! $this->enabled )
+			return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) );
+
 		// If this isn't on WPMU then just use blogger_getUsersBlogs
 		if( !function_exists( 'is_site_admin' ) ) {
 			array_unshift( $args, 1 );
@@ -375,6 +370,9 @@
 	 * wp_getPage
 	 */
 	function wp_getPage($args) {
+		if ( ! $this->enabled )
+			return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) );
+	
 		$this->escape($args);
 
 		$blog_id	= (int) $args[0];
@@ -469,6 +467,9 @@
  	 * wp_getPages
 	 */
 	function wp_getPages($args) {
+		if ( ! $this->enabled )
+			return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) );
+
 		$this->escape($args);
 
 		$blog_id	= (int) $args[0];
@@ -513,6 +514,9 @@
  	 * wp_newPage
 	 */
 	function wp_newPage($args) {
+		if ( ! $this->enabled )
+			return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) );
+
 		// Items not escaped here will be escaped in newPost.
 		$username	= $this->escape($args[1]);
 		$password	= $this->escape($args[2]);
@@ -544,6 +548,9 @@
 	 * wp_deletePage
 	 */
 	function wp_deletePage($args) {
+		if ( ! $this->enabled )
+			return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) );
+
 		$this->escape($args);
 
 		$blog_id	= (int) $args[0];
@@ -587,6 +594,9 @@
 	 * wp_editPage
 	 */
 	function wp_editPage($args) {
+		if ( ! $this->enabled )
+			return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) );
+
 		// Items not escaped here will be escaped in editPost.
 		$blog_id	= (int) $args[0];
 		$page_id	= (int) $this->escape($args[1]);
@@ -637,6 +647,9 @@
 	 * wp_getPageList
 	 */
 	function wp_getPageList($args) {
+		if ( ! $this->enabled )
+			return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) );
+
 		global $wpdb;
 
 		$this->escape($args);
@@ -688,6 +701,8 @@
 	 * wp_getAuthors
 	 */
 	function wp_getAuthors($args) {
+		if ( ! $this->enabled )
+			return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) );
 
 		$this->escape($args);
 
@@ -723,6 +738,9 @@
 	 * wp_newCategory
 	 */
 	function wp_newCategory($args) {
+		if ( ! $this->enabled )
+			return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) );
+
 		$this->escape($args);
 
 		$blog_id				= (int) $args[0];
@@ -779,6 +797,9 @@
 	 * wp_deleteCategory
 	 */
 	function wp_deleteCategory($args) {
+		if ( ! $this->enabled )
+			return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) );
+
 		$this->escape($args);
 
 		$blog_id		= (int) $args[0];
@@ -806,6 +827,9 @@
 	 * wp_suggestCategories
 	 */
 	function wp_suggestCategories($args) {
+		if ( ! $this->enabled )
+			return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) );
+
 		$this->escape($args);
 
 		$blog_id				= (int) $args[0];
@@ -837,6 +861,9 @@
 	}
 
 	function wp_getCommentCount( $args ) {
+		if ( ! $this->enabled )
+			return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) );
+
 		$this->escape($args);
 
 		$blog_id	= (int) $args[0];
@@ -866,6 +893,9 @@
 
 
 	function wp_getPostStatusList( $args ) {
+		if ( ! $this->enabled )
+			return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) );
+
 		$this->escape( $args );
 
 		$blog_id	= (int) $args[0];
@@ -888,6 +918,9 @@
 
 
 	function wp_getPageStatusList( $args ) {
+		if ( ! $this->enabled )
+			return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) );
+
 		$this->escape( $args );
 
 		$blog_id	= (int) $args[0];
@@ -909,6 +942,9 @@
 	}
 
 	function wp_getPageTemplates( $args ) {
+		if ( ! $this->enabled )
+			return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) );
+
 		$this->escape( $args );
 
 		$blog_id	= (int) $args[0];
@@ -931,6 +967,9 @@
 	}
 
 	function wp_getOptions( $args ) {
+		if ( ! $this->enabled )
+			return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) );
+
 		$this->escape( $args );
 
 		$blog_id	= (int) $args[0];
@@ -970,6 +1009,9 @@
 	}
 
 	function wp_setOptions( $args ) {
+		if ( ! $this->enabled )
+			return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) );
+
 		$this->escape( $args );
 
 		$blog_id	= (int) $args[0];
