Skip to content
Newer
Older
100644 107 lines (93 sloc) 3.13 KB
e61a7ce work in progress: replacement for xmlrpc.php, using IXR
michelvaldrighi authored
1 <?php
a6a1522 File file level phpdoc from jacobsantos. see #7037
ryan authored
2 /**
3 * XML-RPC protocol support for WordPress
4 *
5 * @package WordPress
6 */
7
8 /**
9 * Whether this is a XMLRPC Request
10 *
11 * @var bool
12 */
cb09336 Make the xmlrpc user the current user. fixes #2273
ryan authored
13 define('XMLRPC_REQUEST', true);
14
15 // Some browser-embedded clients send cookies. We don't want them.
16 $_COOKIE = array();
17
321c310 Remove trailing whitespace
ryan authored
18 // A bug in PHP < 5.2.2 makes $HTTP_RAW_POST_DATA not set by default,
f432ed6 Fix for PHP version 5.2.2 where $HTTP_RAW_POST_DATA isn't set. fixes …
rob1n authored
19 // but we can do it ourself.
20 if ( !isset( $HTTP_RAW_POST_DATA ) ) {
21 $HTTP_RAW_POST_DATA = file_get_contents( 'php://input' );
22 }
23
a6a1522 File file level phpdoc from jacobsantos. see #7037
ryan authored
24 // fix for mozBlog and other cases where '<?xml' isn't on the very first line
60ccea9 Check if HTTP_RAW_POST_DATA is set to avoid undefined var warning. Pr…
ryan authored
25 if ( isset($HTTP_RAW_POST_DATA) )
26 $HTTP_RAW_POST_DATA = trim($HTTP_RAW_POST_DATA);
e61a7ce work in progress: replacement for xmlrpc.php, using IXR
michelvaldrighi authored
27
a6a1522 File file level phpdoc from jacobsantos. see #7037
ryan authored
28 /** Include the bootstrap for setting up WordPress environment */
5b81135 Allow wp-config.php to exist one level up from WordPress root directo…
ryan authored
29 include('./wp-load.php');
af8c37f Add RSD support. See http://archipelago.phrasewise.com/rsd
matt authored
30
321c310 Remove trailing whitespace
ryan authored
31 if ( isset( $_GET['rsd'] ) ) { // http://archipelago.phrasewise.com/rsd
9ce729e Content-Type, not Content-type, as headers are case sensitive. Props …
rob1n authored
32 header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
af8c37f Add RSD support. See http://archipelago.phrasewise.com/rsd
matt authored
33 ?>
849a0d2 Use get_option instead of get_settings. Just 'cause.
ryan authored
34 <?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
af8c37f Add RSD support. See http://archipelago.phrasewise.com/rsd
matt authored
35 <rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
36 <service>
37 <engineName>WordPress</engineName>
38 <engineLink>http://wordpress.org/</engineLink>
39 <homePageLink><?php bloginfo_rss('url') ?></homePageLink>
40 <apis>
509df64 Add 'rpc' context to siteurl which obeys ADMIN and LOGIN forced SSL. …
ryan authored
41 <api name="WordPress" blogID="1" preferred="true" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
42 <api name="Movable Type" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
43 <api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
44 <api name="Blogger" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
45 <api name="Atom" blogID="" preferred="false" apiLink="<?php echo apply_filters('atom_service_url', site_url('wp-app.php/service', 'rpc') ) ?>" />
af8c37f Add RSD support. See http://archipelago.phrasewise.com/rsd
matt authored
46 </apis>
47 </service>
48 </rsd>
49 <?php
50 exit;
51 }
52
770613e Admin includes reorg. see #4334
ryan authored
53 include_once(ABSPATH . 'wp-admin/includes/admin.php');
a7322e8 big oopsie related to moving the xmlrpc.php file: somehow it got repl…
michelvaldrighi authored
54 include_once(ABSPATH . WPINC . '/class-IXR.php');
2bc7106 Rename new classes to match our coding standards. Fixes #15280.
westi authored
55 include_once(ABSPATH . WPINC . '/class-wp-xmlrpc-server.php');
e61a7ce work in progress: replacement for xmlrpc.php, using IXR
michelvaldrighi authored
56
57 // Turn off all warnings and errors.
a7322e8 big oopsie related to moving the xmlrpc.php file: somehow it got repl…
michelvaldrighi authored
58 // error_reporting(0);
e61a7ce work in progress: replacement for xmlrpc.php, using IXR
michelvaldrighi authored
59
a6a1522 File file level phpdoc from jacobsantos. see #7037
ryan authored
60 /**
61 * Posts submitted via the xmlrpc interface get that title
62 * @name post_default_title
63 * @var string
64 */
65 $post_default_title = "";
66
67 /**
68 * Whether to enable XMLRPC Logging.
69 *
70 * @name xmlrpc_logging
71 * @var int|bool
72 */
80b3445 fixed comment_status screwup, removed debug stuff, screwed up big tim…
michelvaldrighi authored
73 $xmlrpc_logging = 0;
e61a7ce work in progress: replacement for xmlrpc.php, using IXR
michelvaldrighi authored
74
a6a1522 File file level phpdoc from jacobsantos. see #7037
ryan authored
75 /**
76 * logIO() - Writes logging info to a file.
77 *
78 * @uses $xmlrpc_logging
79 * @package WordPress
80 * @subpackage Logging
81 *
82 * @param string $io Whether input or output
83 * @param string $msg Information describing logging reason.
84 * @return bool Always return true
85 */
e61a7ce work in progress: replacement for xmlrpc.php, using IXR
michelvaldrighi authored
86 function logIO($io,$msg) {
87 global $xmlrpc_logging;
88 if ($xmlrpc_logging) {
a7322e8 big oopsie related to moving the xmlrpc.php file: somehow it got repl…
michelvaldrighi authored
89 $fp = fopen("../xmlrpc.log","a+");
e61a7ce work in progress: replacement for xmlrpc.php, using IXR
michelvaldrighi authored
90 $date = gmdate("Y-m-d H:i:s ");
91 $iot = ($io == "I") ? " Input: " : " Output: ";
92 fwrite($fp, "\n\n".$date.$iot.$msg);
93 fclose($fp);
94 }
95 return true;
96 }
97
75ec542 avoid $HTTP_RAW_POST_DATA notices. props mgeisler and Nazgul. fixes #…
markjaquith authored
98 if ( isset($HTTP_RAW_POST_DATA) )
a6a1522 File file level phpdoc from jacobsantos. see #7037
ryan authored
99 logIO("I", $HTTP_RAW_POST_DATA);
100
b3054b3 Complete the move to a seperate class file for #14820 props filosofo.
westi authored
101 // Allow for a plugin to insert a different class to handle requests.
102 $wp_xmlrpc_server_class = apply_filters('wp_xmlrpc_server_class', 'wp_xmlrpc_server');
103 $wp_xmlrpc_server = new $wp_xmlrpc_server_class;
9b79d3d Integrate wpmu_blogger_getUsersBlogs() directly into xmlrpc.php. see …
ryan authored
104
b3054b3 Complete the move to a seperate class file for #14820 props filosofo.
westi authored
105 // Fire off the request
461f029 Seperate out the XML-RPC server active behaviour from object construc…
westi authored
106 $wp_xmlrpc_server->serve_request();
b3054b3 Complete the move to a seperate class file for #14820 props filosofo.
westi authored
107 ?>
Something went wrong with that request. Please try again.