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oWfE@ `Os&YI'7̀np_×bhܡ>yJѷQI D:DLR䎣EGv T7"Wc1Ew`DZ 덙*'=Q_e 4DL(EČsK L+tk~.GE 7þ7}YE֊iQ&h9MZ{an//Ǧ!$|kt[u Eͯ;,0-_*M @[4(1m)Fv!+I ː~ ~A# bm` ~7@㋯ vu8WB-z+Gw?-gSIOY}4.X <f+G5d=s&=Xj\tlxo=8ln6u"'54ڣ+~fSۙՉ7 xHCI2@D9lP)@kCPӁO% c)H=+I+OcٽH낷˿^R1kY*cײ{¢'xōHʒXK]̶)cuAem ٽ ̌>Be!9/P}20*/>lZ9okkG4YI<3Mua_=2ƒ% +KqOvբo}];BFݳ#߱fS Y1I^3Zr&"ϲ?rv r(WcLWR44oo½+7^B7$ *4!C/ 4@'jbCo zgY@x*;P,=([fܽAWHBO/z57*>AZ .烎J&MyWa\b ԃýIYtlo,cNhw,u:"tdQYL˭lӮȭ?~[x5qǕm # V2as1gE\Qr݂r B~tH.H+[H}KE-y#5)R:D>%.vQD8OmuBt _翥_7==18-#RZ֫C(p]l٭Ն#22:m^ڕȞA ~ [60{8~u";Fvy]~׶A SM!Mz;#/O 7!, An6T4uHG #~8w>O maúIJ,ᴱ<@ 9*q )#~v^+jeHn0ca˾483$b>nCP^z[T.Cz#9lg˪E3?jWȳg-'FyC՜ ."~Rp"ۻa!UJe1t5$ rTPareٱ}d9pgb(e6&MÚS$rbDyPb959>an"`ԐoռlM@15^!4E.v} QCom8e< @2sEpfǩ9RxF~!fvIx40wJ*zbfe 9眍Nccfz4%$0.}) { if ( !get_option( 'enable_xmlrpc' ) ) { $this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site. An admin user can enable them at %s'), admin_url('options-writing.php') ) ); return false; } if (!user_pass_ok($user_login, $user_pass)) { $this->error = new IXR_Error(403, __('Bad login/pass combination.')); return false; } return true; } /** * Log user in. * * @since 2.8 * * @param string $username User's username. * @param string $password User's password. * @return mixed WP_User object if authentication passed, false otherwise */ function login($username, $password) { if ( !get_option( 'enable_xmlrpc' ) ) { $this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site. An admin user can enable them at %s'), admin_url('options-writing.php') ) ); return false; } $user = wp_authenticate($username, $password); if (is_wp_error($user)) { $this->error = new IXR_Error(403, __('Bad login/pass combination.')); return false; } wp_set_current_user( $user->ID ); return $user; } /** * Sanitize string or array of strings for database. * * @since 1.5.2 * * @param string|array $array Sanitize single string or array of strings. * @return string|array Type matches $array and sanitized for the database. */ function escape(&$array) { global $wpdb; if (!is_array($array)) { return($wpdb->escape($array)); } else { foreach ( (array) $array as $k => $v ) { if ( is_array($v) ) { $this->escape($array[$k]); } else if ( is_object($v) ) { //skip } else { $array[$k] = $wpdb->escape($v); } } } } /** * Retrieve custom fields for post. * * @since 2.5.0 * * @param int $post_id Post ID. * @return array Custom fields, if exist. */ function get_custom_fields($post_id) { $post_id = (int) $post_id; $custom_fields = array(); foreach ( (array) has_meta($post_id) as $meta ) { // Don't expose protected fields. if ( strpos($meta['meta_key'], '_wp_') === 0 ) { continue; } $custom_fields[] = array( "id" => $meta['meta_id'], "key" => $meta['meta_key'], "value" => $meta['meta_value'] ); } return $custom_fields; } /** * Set custom fields for post. * * @since 2.5.0 * * @param int $post_id Post ID. * @param array $fields Custom fields. */ function set_custom_fields($post_id, $fields) { $post_id = (int) $post_id; foreach ( (array) $fields as $meta ) { if ( isset($meta['id']) ) { $meta['id'] = (int) $meta['id']; if ( isset($meta['key']) ) { update_meta($meta['id'], $meta['key'], $meta['value']); } else { delete_meta($meta['id']); } } else { $_POST['metakeyinput'] = $meta['key']; $_POST['metavalue'] = $meta['value']; add_meta($post_id); } } } /** * Set up blog options property. * * Passes property through 'xmlrpc_blog_options' filter. * * @since 2.6.0 */ function initialise_blog_option_info( ) { global $wp_version; $this->blog_options = array( // Read only options 'software_name' => array( 'desc' => __( 'Software Name' ), 'readonly' => true, 'value' => 'WordPress' ), 'software_version' => array( 'desc' => __( 'Software Version' ), 'readonly' => true, 'value' => $wp_version ), 'blog_url' => array( 'desc' => __( 'Site URL' ), 'readonly' => true, 'option' => 'siteurl' ), // Updatable options 'time_zone' => array( 'desc' => __( 'Time Zone' ), 'readonly' => false, 'option' => 'gmt_offset' ), 'blog_title' => array( 'desc' => __( 'Site Title' ), 'readonly' => false, 'option' => 'blogname' ), 'blog_tagline' => array( 'desc' => __( 'Site Tagline' ), 'readonly' => false, 'option' => 'blogdescription' ), 'date_format' => array( 'desc' => __( 'Date Format' ), 'readonly' => false, 'option' => 'date_format' ), 'time_format' => array( 'desc' => __( 'Time Format' ), 'readonly' => false, 'option' => 'time_format' ), 'users_can_register' => array( 'desc' => __( 'Allow new users to sign up' ), 'readonly' => false, 'option' => 'users_can_register' ) ); $this->blog_options = apply_filters( 'xmlrpc_blog_options', $this->blog_options ); } /** * Retrieve the blogs of the user. * * @since 2.6.0 * * @param array $args Method parameters. * @return array */ function wp_getUsersBlogs( $args ) { global $current_site; // If this isn't on WPMU then just use blogger_getUsersBlogs if ( !is_multisite() ) { array_unshift( $args, 1 ); return $this->blogger_getUsersBlogs( $args ); } $this->escape( $args ); $username = $args[0]; $password = $args[1]; if ( !$user = $this->login($username, $password) ) return $this->error; do_action( 'xmlrpc_call', 'wp.getUsersBlogs' ); $blogs = (array) get_blogs_of_user( $user->ID ); $struct = array( ); foreach ( $blogs as $blog ) { // Don't include blogs that aren't hosted at this site if ( $blog->site_id != $current_site->id ) continue; $blog_id = $blog->userblog_id; switch_to_blog($blog_id); $is_admin = current_user_can('manage_options'); $struct[] = array( 'isAdmin' => $is_admin, 'url' => get_option( 'home' ) . '/', 'blogid' => $blog_id, 'blogName' => get_option( 'blogname' ), 'xmlrpc' => site_url( 'xmlrpc.php' ) ); restore_current_blog( ); } return $struct; } /** * Retrieve page. * * @since 2.2.0 * * @param array $args Method parameters. * @return array */ function wp_getPage($args) { $this->escape($args); $blog_id = (int) $args[0]; $page_id = (int) $args[1]; $username = $args[2]; $password = $args[3]; if ( !$user = $this->login($username, $password) ) { return $this->error; } if ( !current_user_can( 'edit_page', $page_id ) ) return new IXR_Error( 401, __( 'Sorry, you cannot edit this page.' ) ); do_action('xmlrpc_call', 'wp.getPage'); // Lookup page info. $page = get_page($page_id); // If we found the page then format the data. if ( $page->ID && ($page->post_type == "page") ) { // Get all of the page content and link. $full_page = get_extended($page->post_content); $link = post_permalink($page->ID); // Get info the page parent if there is one. $parent_title = ""; if ( !empty($page->post_parent) ) { $parent = get_page($page->post_parent); $parent_title = $parent->post_title; } // Determine comment and ping settings. $allow_comments = comments_open($page->ID) ? 1 : 0; $allow_pings = pings_open($page->ID) ? 1 : 0; // Format page date. $page_date = mysql2date("Ymd\TH:i:s", $page->post_date, false); $page_date_gmt = mysql2date("Ymd\TH:i:s", $page->post_date_gmt, false); // For drafts use the GMT version of the date if ( $page->post_status == 'draft' ) $page_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $page->post_date ), 'Ymd\TH:i:s' ); // Pull the categories info together. $categories = array(); foreach ( wp_get_post_categories($page->ID) as $cat_id ) { $categories[] = get_cat_name($cat_id); } // Get the author info. $author = get_userdata($page->post_author); $page_template = get_post_meta( $page->ID, '_wp_page_template', true ); if ( empty( $page_template ) ) $page_template = 'default'; $page_struct = array( "dateCreated" => new IXR_Date($page_date), "userid" => $page->post_author, "page_id" => $page->ID, "page_status" => $page->post_status, "description" => $full_page["main"], "title" => $page->post_title, "link" => $link, "permaLink" => $link, "categ+`*vDI2*&|^3=LT!2rCj6Ce`A-{ltipuA-_.TY lP kӊF#gGƛ(x&Ȥ|l]d/$QPO@}qh?A˗Od86e=t|nf Uxͼ:ݢZ @DȶVkI$āAĎgh^Ew &(کk8 m{zS0 6XۅΙn8Z;Lz{-,W*/_[DI>g i-᪆ȜeQ@Jq3J_% nb`if)P#v <LuLy YV98y{J (mM/IX#D&3L7sx.">FMn9q2Zzq^yŔ(v1Qy"Q$ߊZ1q)izұaoxO;`\_w (az^\֜$liqok9&ȚAY w^nF8zQ2|uc(16_u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^GБAc+nPn!kd-CHV.6%m 3~Mߚ0-3f) >gdSką?o4ҏe<ǎ~Y]a&_?F YH?hp07T8~0Q:VhH=!i\f"~𓣲ғ~ H#g) HbߖwR9yJG6k~:g.,xˮ,s8)sܚW!PBF?k )k@}# a|5"fՐzx#P ˼ցe%((jCAԞK0;UKm) ["nwDLK^ǸzǮ*+Zw__w 6lTԴ \!r-eB*ke6[_pK7q|096|ZdO}5yN;|!9UWaiJ !/_ꨕ$ZgW=zs6{o#Mlte"ÝZqj(term_id; $struct['name'] = $tag->name; $struct['count'] = $tag->count; $struct['slug'] = $tag->slug; $struct['html_url'] = esc_html( get_tag_link( $tag->term_id ) ); $struct['rss_url'] = esc_html( get_tag_feed_link( $tag->term_id ) ); $tags[] = $struct; } } return $tags; } /** * Create new category. * * @since 2.2.0 * * @param array $args Method parameters. * @return int Category ID. */ function wp_newCategory($args) { $this->escape($args); $blog_id = (int) $args[0]; $username = $args[1]; $password = $args[2]; $category = $args[3]; if ( !$user = $this->login($username, $password) ) return $this->error; do_action('xmlrpc_call', 'wp.newCategory'); // Make sure the user is allowed to add a category. if ( !current_user_can("manage_categories") ) return(new IXR_Error(401, __("Sorry, you do not have the right to add a category."))); // If no slug was provided make it empty so that // WordPress will generate one. if ( empty($category["slug"]) ) $category["slug"] = ""; // If no parent_id was provided make it empty // so that it will be a top level page (no parent). if ( !isset($category["parent_id"]) ) $category["parent_id"] = ""; // If no description was provided make it empty. if ( empty($category["description"]) ) $category["description"] = ""; $new_category = array( "cat_name" => $category["name"], "category_nicename" => $category["slug"], "category_parent" => $category["parent_id"], "category_description" => $category["description"] ); $cat_id = wp_insert_category($new_category, true); if ( is_wp_error( $cat_id ) ) { if ( 'term_exists' == $cat_id->get_error_code() ) return (int) $cat_id->get_error_data(); else return(new IXR_Error(500, __("Sorry, the new category failed."))); } elseif ( ! $cat_id ) { return(new IXR_Error(500, __("Sorry, the new category failed."))); } return($cat_id); } /** * Remove category. * * @since 2.5.0 * * @param array $args Method parameters. * @return mixed See {@link wp_delete_category()} for return info. */ function wp_deleteCategory($args) { $this->escape($args); $blog_id = (int) $args[0]; $username = $args[1]; $password = $args[2]; $category_id = (int) $args[3]; if ( !$user = $this->login($username, $password) ) return $this->error; do_action('xmlrpc_call', 'wp.deleteCategory'); if ( !current_user_can("manage_categories") ) return new IXR_Error( 401, __( "Sorry, you do not have the right to delete a category." ) ); return wp_delete_category( $category_id ); } /** * Retrieve category list. * * @since 2.2.0 * * @param array $args Method parameters. * @return array */ function wp_suggestCategories($args) { $this->escape($args); $blog_id = (int) $args[0]; $username = $args[1]; $password = $args[2]; $category = $args[3]; $max_results = (int) $args[4]; if ( !$user = $this->login($username, $password) ) return $this->error; if ( !current_user_can( 'edit_posts' ) ) return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts to this site in order to view categories.' ) ); do_action('xmlrpc_call', 'wp.suggestCategories'); $category_suggestions = array(); $args = array('get' => 'all', 'number' => $max_results, 'name__like' => $category); foreach ( (array) get_categories($args) as $cat ) { $category_suggestions[] = array( "category_id" => $cat->cat_ID, "category_name" => $cat->cat_name ); } return($category_suggestions); } /** * Retrieve comment. * * @since 2.7.0 * * @param array $args Method parameters. * @return array */ function wp_getComment($args) { $this->escape($args); $blog_id = (int) $args[0]; $username = $args[1]; $password = $args[2]; $comment_id = (int) $args[3]; if ( !$user = $this->login($username, $password) ) return $this->error; if ( !current_user_can( 'moderate_comments' ) ) return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) ); do_action('xmlrpc_call', 'wp.getComment'); if ( ! $comment = get_comment($comment_id) ) return new IXR_Error( 404, __( 'Invalid comment ID.' ) ); // Format page date. $comment_date = mysql2date("Ymd\TH:i:s", $comment->comment_date, false); $comment_date_gmt = mysql2date("Ymd\TH:i:s", $comment->comment_date_gmt, false); if ( '0' == $comment->comment_approved ) $comment_status = 'hold'; else if ( 'spam' == $comment->comment_approved ) $comment_status = 'spam'; else if ( '1' == $comment->comment_approved ) $comment_status = 'approve'; else $comment_status = $comment->comment_approved; $link = get_comment_link($comment); $comment_struct = array( "date_created_gmt" => new IXR_Date($comment_date_gmt), "user_id" => $comment->user_id, "comment_id" => $comment->comment_ID, "parent" => $comment->comment_parent, "status" => $comment_status, "content" => $comment->comment_content, "link" => $link, "post_id" => $comment->comment_post_ID, "post_title" => get_the_title($comment->comment_post_ID), "author" => $comment->comment_author, "author_url" => $comment->comment_author_url, "author_email" => $comment->comment_author_email, "author_ip" => $comment->comment_author_IP, "type" => $comment->comment_type, ); return $comment_struct; } /** * Retrieve comments. * * @since 2.7.0 * * @param array $args Method parameters. * @return array */ function wp_getComments($args) { $raw_args = $args; $this->escape($args); $blog_id = (int) $args[0]; $username = $args[1]; $password = $args[2]; $struct = $args[3]; if ( !$user = $this->login($username, $password) ) return $this->error; if ( !current_user_can( 'moderate_comments' ) ) return new IXR_Error( 401, __( 'Sorry, you cannot edit comments.' ) ); do_action('xmlrpc_call', 'wp.getComments'); if ( isset($struct['status']) ) $status = $struct['status']; else $status = ''; $post_id = ''; if ( isset($struct['post_id']) ) $post_id = absint($struct['post_id']); $offset = 0; if ( isset($struct['offset']) ) $offset = absint($struct['offset']); $number = 10; if ( isset($struct['number']) ) $number = absint($struct['number']); $comments = get_comments( array('status' => $status, 'post_id' => $post_id, 'offset' => $offset, 'number' => $number ) ); $num_comments = count($comments); if ( ! $num_comments ) return array(); $comments_struct = array(); for ( $i = 0; $i < $num_comments; $i++ ) { $comment = wp_xmlrpc_server::wp_getComment(array( $raw_args[0], $raw_args[1], $raw_args[2], $comments[$i]->comment_ID, )); $comments_struct[] = $comment; } return $comments_struct; } /** * Remove comment. * * @since 2.7.0 * * @param array $args Method parameters. * @return mixed {@link wp_delete_comment()} */ function wp_deleteComment($args) { $this->escape($args); $blog_id = (int) $args[0]; $username = $args[1]; $password = $args[2]; $comment_ID = (int) $args[3]; if ( !$user = $this->login($username, $password) ) return $this->error; if ( !current_user_can( 'moderate_comments' ) ) return new IXR_Error( 403, __( 'You are not allowed to moderate comments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PZ#Oi=, 0퀏${->]M%Jȫ NW͂\`J# 0ԑw=G_TglR+?c,s9j} O5~8| uT N4N`Pz/a+նY ?dl Y\Be#464))c0ORjAmZ~escape( $args ); $blog_id = (int) $args[0]; $username = $args[1]; $password = $args[2]; $options = (array) $args[3]; if ( !$user = $this->login($username, $password) ) return $this->error; // If no specific options where asked for, return all of them if ( count( $options ) == 0 ) $options = array_keys($this->blog_options); return $this->_getOptions($options); } /** * Retrieve blog options value from list. * * @since 2.6.0 * * @param array $options Options to retrieve. * @return array */ function _getOptions($options) { $data = array( ); foreach ( $options as $option ) { if ( array_key_exists( $option, $this->blog_options ) ) { $data[$option] = $this->blog_options[$option]; //Is the value static or dynamic? if ( isset( $data[$option]['option'] ) ) { $data[$option]['value'] = get_option( $data[$option]['option'] ); unset($data[$option]['option']); } } } return $data; } /** * Update blog options. * * @since 2.6.0 * * @param array $args Method parameters. * @return unknown */ function wp_setOptions( $args ) { $this->escape( $args ); $blog_id = (int) $args[0]; $username = $args[1]; $password = $args[2]; $options = (array) $args[3]; if ( !$user = $this->login($username, $password) ) return $this->error; if ( !current_user_can( 'manage_options' ) ) return new IXR_Error( 403, __( 'You are not allowed to update options.' ) ); foreach ( $options as $o_name => $o_value ) { $option_names[] = $o_name; if ( !array_key_exists( $o_name, $this->blog_options ) ) continue; if ( $this->blog_options[$o_name]['readonly'] == true ) continue; update_option( $this->blog_options[$o_name]['option'], $o_value ); } //Now return the updated values return $this->_getOptions($option_names); } /* Blogger API functions. * specs on http://plant.blogger.com/api and http://groups.yahoo.com/group/bloggerDev/ */ /** * Retrieve blogs that user owns. * * Will make more sense once we support multiple blogs. * * @since 1.5.0 * * @param array $args Method parameters. * @return array */ function blogger_getUsersBlogs($args) { if ( is_multisite() ) return $this->_multisite_getUsersBlogs($args); $this->escape($args); $username = $args[1]; $password = $args[2]; if ( !$user = $this->login($username, $password) ) return $this->error; do_action('xmlrpc_call', 'blogger.getUsersBlogs'); $is_admin = current_user_can('manage_options'); $struct = array( 'isAdmin' => $is_admin, 'url' => get_option('home') . '/', 'blogid' => '1', 'blogName' => get_option('blogname'), 'xmlrpc' => site_url( 'xmlrpc.php' ) ); return array($struct); } /** * Private function for retrieving a users blogs for multisite setups * * @access protected */ function _multisite_getUsersBlogs($args) { global $current_blog; $domain = $current_blog->domain; $path = $current_blog->path . 'xmlrpc.php'; $protocol = is_ssl() ? 'https' : 'http'; $rpc = new IXR_Client("$protocol://{$domain}{$path}"); $rpc->query('wp.getUsersBlogs', $args[1], $args[2]); $blogs = $rpc->getResponse(); if ( isset($blogs['faultCode']) ) return new IXR_Error($blogs['faultCode'], $blogs['faultString']); if ( $_SERVER['HTTP_HOST'] == $domain && $_SERVER['REQUEST_URI'] == $path ) { return $blogs; } else { foreach ( (array) $blogs as $blog ) { if ( strpos($blog['url'], $_SERVER['HTTP_HOST']) ) return array($blog); } return array(); } } /** * Retrieve user's data. * * Gives your client some info about you, so you don't have to. * * @since 1.5.0 * * @param array $args Method parameters. * @return array */ function blogger_getUserInfo($args) { $this->escape($args); $username = $args[1]; $password = $args[2]; if ( !$user = $this->login($username, $password) ) return $this->error; if ( !current_user_can( 'edit_posts' ) ) return new IXR_Error( 401, __( 'Sorry, you do not have access to user data on this site.' ) ); do_action('xmlrpc_call', 'blogger.getUserInfo'); $struct = array( 'nickname' => $user->nickname, 'userid' => $user->ID, 'url' => $user->user_url, 'lastname' => $user->last_name, 'firstname' => $user->first_name ); return $struct; } /** * Retrieve post. * * @since 1.5.0 * * @param array $args Method parameters. * @return array */ function blogger_getPost($args) { $this->escape($args); $post_ID = (int) $args[1]; $username = $args[2]; $password = $args[3]; if ( !$user = $this->login($username, $password) ) return $this->error; if ( !current_user_can( 'edit_post', $post_ID ) ) return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) ); do_action('xmlrpc_call', 'blogger.getPost'); $post_data = wp_get_single_post($post_ID, ARRAY_A); $categories = implode(',', wp_get_post_categories($post_ID)); $content = ''.stripslashes($post_data['post_title']).''; $content .= ''.$categories.''; $content .= stripslashes($post_data['post_content']); $struct = array( 'userid' => $post_data['post_author'], 'dateCreated' => new IXR_Date(mysql2date('Ymd\TH:i:s', $post_data['post_date'], false)), 'content' => $content, 'postid' => $post_data['ID'] ); return $struct; } /** * Retrieve list of recent posts. * * @since 1.5.0 * * @param array $args Method parameters. * @return array */ function blogger_getRecentPosts($args) { $this->escape($args); $blog_ID = (int) $args[1]; /* though we don't use it yet */ $username = $args[2]; $password = $args[3]; $num_posts = $args[4]; if ( !$user = $this->login($username, $password) ) return $this->error; do_action('xmlrpc_call', 'blogger.getRecentPosts'); $posts_list = wp_get_recent_posts($num_posts); if ( !$posts_list ) { $this->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.')); return $this->error; } foreach ($posts_list as $entry) { if ( !current_user_can( 'edit_post', $entry['ID'] ) ) continue; $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date'], false); $categories = implode(',', wp_get_post_categories($entry['ID'])); $content = ''.stripslashes($entry['post_title']).''; $content .= ''.$categories.''; $content .= stripslashes($entry['post_content']); $struct[] = array( 'userid' => $entry['post_author'], 'dateCreated' => new IXR_Date($post_date), 'content' => $content, 'postid' => $entry['ID'], ); } $recent_posts = array(); for ( $j=0; $jescape($args); $blog_ID = (int) $args[1]; $username = $args[2]; $password = $args[3]; $template = $args[4]; /* could be 'main' or 'archiveIndex', but we don't use it */ if ( !$user = $this->login($username, $password) ) return $this->error; do_action('xmlrpc_call', 'blogger.getTemplate'); if ( !current_user_can('edit_themes') ) return new IXR_Error(401, __('Sorry, this user can not edit the template.')); /* warning: here we make the assumption that the blog's URL is on the same server */ $filename = get_option('home') . '/'; $filename = preg_replace('#https?://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename); $f = fopen($file>H>Uw +!C!Q/3{gG4I.Q&@ n!a^<g6!3WAWnw}oRO oMP1)3mkouSjAh"C 'Z‚?m`~+"]ةVy4>I@Ʀ8dqǬo'@s5/պ0W&h^Su_VBoQyt=`/yP P_3u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hUE /iwzvXHWK"7U<-ao4ax#9fmݘM7I(b!PǕ *)ۓ-zS; }saCjT}YE#,/Q6,VryWK-!٬KE&Z+/VCJQA<|]\Okmf!d>L>h8tcy2LUVkA~gj|[c֒iY5J)p@E ܍zVlyPXv x5K uL mu(\ v%ݼNиT huI$`pk3d'/Anff1z?A CS\dwBȷq5D|<;fMQ4<&}bG|tU .E\wZ8ɀ w B2qFwU3Xfsĵ墊"-sw pBuWkQ UbUB#{8O:iY{t^sW4aYnB>I5˞c ?GFj {iXĺm[0~չԤ+b |x*jq<ځ?y;v7ǒ-Ҵ1ҰM h,Z-ΎOY}(W/|NѵfamRoY=C ot"_zK@TGh):1R صI.ꎶh5yi F6JPrZVFLUt⚛"o,ˑf&k'JCM$IbYN>8q" . $post_more; $to_ping = $content_struct['mt_tb_ping_urls']; if ( is_array($to_ping) ) $to_ping = implode(' ', $to_ping); // Do some timestamp voodoo if ( !empty( $content_struct['date_created_gmt'] ) ) $dateCreated = str_replace( 'Z', '', $content_struct['date_created_gmt']->getIso() ) . 'Z'; // We know this is supposed to be GMT, so we're going to slap that Z on there by force elseif ( !empty( $content_struct['dateCreated']) ) $dateCreated = $content_struct['dateCreated']->getIso(); if ( !empty( $dateCreated ) ) { $post_date = get_date_from_gmt(iso8601_to_datetime($dateCreated)); $post_date_gmt = iso8601_to_datetime($dateCreated, GMT); } else { $post_date = current_time('mysql'); $post_date_gmt = current_time('mysql', 1); } $catnames = $content_struct['categories']; logIO('O', 'Post cats: ' . var_export($catnames,true)); $post_category = array(); if ( is_array($catnames) ) { foreach ($catnames as $cat) { $post_category[] = get_cat_ID($cat); } } // We've got all the data -- post it: $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping', 'post_type', 'post_name', 'post_password', 'post_parent', 'menu_order', 'tags_input', 'page_template'); $post_ID = wp_insert_post($postdata, true); if ( is_wp_error( $post_ID ) ) return new IXR_Error(500, $post_ID->get_error_message()); if ( !$post_ID ) return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.')); // Only posts can be sticky if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) { if ( $content_struct['sticky'] == true ) stick_post( $post_ID ); elseif ( $content_struct['sticky'] == false ) unstick_post( $post_ID ); } if ( isset($content_struct['custom_fields']) ) $this->set_custom_fields($post_ID, $content_struct['custom_fields']); // Handle enclosures $this->add_enclosure_if_new($post_ID, $content_struct['enclosure']); $this->attach_uploads( $post_ID, $post_content ); logIO('O', "Posted ! ID: $post_ID"); return strval($post_ID); } function add_enclosure_if_new($post_ID, $enclosure) { if ( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) { $encstring = $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type']; $found = false; foreach ( (array) get_post_custom($post_ID) as $key => $val) { if ($key == 'enclosure') { foreach ( (array) $val as $enc ) { if ($enc == $encstring) { $found = true; break 2; } } } } if (!$found) add_post_meta( $post_ID, 'enclosure', $encstring ); } } /** * Attach upload to a post. * * @since 2.1.0 * * @param int $post_ID Post ID. * @param string $post_content Post Content for attachment. */ function attach_uploads( $post_ID, $post_content ) { global $wpdb; // find any unattached files $attachments = $wpdb->get_results( "SELECT ID, guid FROM {$wpdb->posts} WHERE post_parent = '0' AND post_type = 'attachment'" ); if ( is_array( $attachments ) ) { foreach ( $attachments as $file ) { if ( strpos( $post_content, $file->guid ) !== false ) $wpdb->update($wpdb->posts, array('post_parent' => $post_ID), array('ID' => $file->ID) ); } } } /** * Edit a post. * * @since 1.5.0 * * @param array $args Method parameters. * @return bool True on success. */ function mw_editPost($args) { $this->escape($args); $post_ID = (int) $args[0]; $username = $args[1]; $password = $args[2]; $content_struct = $args[3]; $publish = $args[4]; if ( !$user = $this->login($username, $password) ) return $this->error; do_action('xmlrpc_call', 'metaWeblog.editPost'); $cap = ( $publish ) ? 'publish_posts' : 'edit_posts'; $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' ); $post_type = 'post'; $page_template = ''; if ( !empty( $content_struct['post_type'] ) ) { if ( $content_struct['post_type'] == 'page' ) { $cap = ( $publish ) ? 'publish_pages' : 'edit_pages'; $error_message = __( 'Sorry, you are not allowed to publish pages on this site.' ); $post_type = 'page'; if ( !empty( $content_struct['wp_page_template'] ) ) $page_template = $content_struct['wp_page_template']; } elseif ( $content_struct['post_type'] == 'post' ) { // This is the default, no changes needed } else { // No other post_type values are allowed here return new IXR_Error( 401, __( 'Invalid post type.' ) ); } } if ( !current_user_can( $cap ) ) return new IXR_Error( 401, $error_message ); $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."))); $this->escape($postdata); extract($postdata, EXTR_SKIP); // Let WordPress manage slug if none was provided. $post_name = ""; if ( isset($content_struct["wp_slukע x-B& a+}c'eZkưTOwAnӾo ui=R)R]_)yEə~Hl80gWCgÓIGFЇo~l=e3տֽW.iGڌIUB87[0"Kט"w+ojGZ[Q o䀂ĢˁϜx}zFO:uv_Y.[&e-Ƚ5 HRxE7@' O 3"dﱃ1uMbJۅ(MqHLz DGNPj5!(LGXuyGN1ZHA3ۍ\j &7}I5) ctO&Uti7]TY @H<5dxTL?.o-#d\$lzh :p܀S,*ItǾ[@;ΦCA*Ykud + +:vktKFs0P"B5і-j5mކNqs _{ +=w ($J&;]DiGcW+v_}PYK $E ЫzҲ)cT-$ceXz o\9)"PTSV]Pϐs=QgyڔWn A`rbU jp16&us9b&*Iu/5K!24WX~#vAy6? Unk@ %ϋ?3ygD/s&4{ +rr[u{#il]01\:(491}rw *Yf$չdhZ"^x+TXğnL?XZOh)et zC@o?k;7'd6ݷγː#.k oWÿC s+iԹifĴc0Fx6Pcaeif~[? !B10y ^~s9|Y9}5.נD=;a@ȏ9I2#Ph1":&Fzπ/ǻQ*N7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dzfB*wAc&9D3Ux&qwIG} B;W_8[? @省7}?Q UQ6".ُSThԨoMB2V=JW̍k.`\y{qߎCDq}:Jj*+ LEF0 s;6ŻŀPݾC'VyJO*onuվew&ؐu:KivGIQ?  ^p'&}+"ZLdQ0^ʌc&&&*p3zQ\q`>Ol9%.YX 6'&AA\?xRPx foreach ( (array) $val as $enc ) { $encdata = split("\n", $enc); $enclosure['url'] = trim(htmlspecialchars($encdata[0])); $enclosure['length'] = (int) trim($encdata[1]); $enclosure['type'] = trim($encdata[2]); break 2; } } } $resp = array( 'dateCreated' => new IXR_Date($post_date), 'userid' => $postdata['post_author'], 'postid' => $postdata['ID'], 'description' => $post['main'], 'title' => $postdata['post_title'], 'link' => $link, 'permaLink' => $link, // commented out because no other tool seems to use this // 'content' => $entry['post_content'], 'categories' => $categories, 'mt_excerpt' => $postdata['post_excerpt'], 'mt_text_more' => $post['extended'], 'mt_allow_comments' => $allow_comments, 'mt_allow_pings' => $allow_pings, 'mt_keywords' => $tagnames, 'wp_slug' => $postdata['post_name'], 'wp_password' => $postdata['post_password'], 'wp_author_id' => $author->ID, 'wp_author_display_name' => $author->display_name, 'date_created_gmt' => new IXR_Date($post_date_gmt), 'post_status' => $postdata['post_status'], 'custom_fields' => $this->get_custom_fields($post_ID), 'sticky' => $sticky ); if ( !empty($enclosure) ) $resp['enclosure'] = $enclosure; return $resp; } else { return new IXR_Error(404, __('Sorry, no such post.')); } } /** * Retrieve list of recent posts. * * @since 1.5.0 * * @param array $args Method parameters. * @return array */ function mw_getRecentPosts($args) { $this->escape($args); $blog_ID = (int) $args[0]; $username = $args[1]; $password = $args[2]; $num_posts = (int) $args[3]; if ( !$user = $this->login($username, $password) ) return $this->error; do_action('xmlrpc_call', 'metaWeblog.getRecentPosts'); $posts_list = wp_get_recent_posts($num_posts); if ( !$posts_list ) return array( ); foreach ($posts_list as $entry) { if ( !current_user_can( 'edit_post', $entry['ID'] ) ) continue; $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date'], false); $post_date_gmt = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt'], false); // For drafts use the GMT version of the date if ( $entry['post_status'] == 'draft' ) $post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $entry['post_date'] ), 'Ymd\TH:i:s' ); $categories = array(); $catids = wp_get_post_categories($entry['ID']); foreach( $catids as $catid ) $categories[] = get_cat_name($catid); $tagnames = array(); $tags = wp_get_post_tags( $entry['ID'] ); if ( !empty( $tags ) ) { foreach ( $tags as $tag ) { $tagnames[] = $tag->name; } $tagnames = implode( ', ', $tagnames ); } else { $tagnames = ''; } $post = get_extended($entry['post_content']); $link = post_permalink($entry['ID']); // Get the post author info. $author = get_userdata($entry['post_author']); $allow_comments = ('open' == $entry['comment_status']) ? 1 : 0; $allow_pings = ('open' == $entry['ping_status']) ? 1 : 0; // Consider future posts as published if ( $entry['post_status'] === 'future' ) $entry['post_status'] = 'publish'; $struct[] = array( 'dateCreated' => new IXR_Date($post_date), 'userid' => $entry['post_author'], 'postid' => $entry['ID'], 'description' => $post['main'], 'title' => $entry['post_title'], 'link' => $link, 'permaLink' => $link, // commented out because no other tool seems to use this // 'content' => $entry['post_content'], 'categories' => $categories, 'mt_excerpt' => $entry['post_excerpt'], 'mt_text_more' => $post['extended'], 'mt_allow_comments' => $allow_comments, 'mt_allow_pings' => $allow_pings, 'mt_keywords' => $tagnames, 'wp_slug' => $entry['post_name'], 'wp_password' => $entry['post_password'], 'wp_author_id' => $author->ID, 'wp_author_display_name' => $author->display_name, 'date_created_gmt' => new IXR_Date($post_date_gmt), 'post_status' => $entry['post_status'], 'custom_fields' => $this->get_custom_fields($entry['ID']) ); } $recent_posts = array(); for ( $j=0; $jescape($args); $blog_ID = (int) $args[0]; $username = $args[1]; $password = $args[2]; if ( !$user = $this->login($username, $password) ) return $this->error; if ( !current_user_can( 'edit_posts' ) ) return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) ); do_action('xmlrpc_call', 'metaWeblog.getCategories'); $categories_struct = array(); if ( $cats = get_categories(array('get' => 'all')) ) { foreach ( $cats as $cat ) { $struct['categoryId'] = $cat->term_id; $struct['parentId'] = $cat->parent; $struct['description'] = $cat->name; $struct['categoryDescription'] = $cat->description; $struct['categoryName'] = $cat->name; $struct['htmlUrl'] = esc_html(get_category_link($cat->term_id)); $struct['rssUrl'] = esc_html(get_category_feed_link($cat->term_id, 'rss2')); $categories_struct[] = $struct; } } return $categories_struct; } /** * Uploads a file, following your settings. * * Adapted from a patch by Johann Richard. * * @link http://mycvs.org/archives/2004/06/30/file-upload-to-wordpress-in-ecto/ * * @since 1.5.0 * * @param array $args Method parameters. * @return array */ function mw_newMediaObject($args) { global $wpdb; $blog_ID = (int) $args[0]; $username = $wpdb->escape($args[1]); $password = $wpdb->escape($args[2]); $data = $args[3]; $name = sanitize_file_name( $data['name'] ); $type = $data['type']; $bits = $data['bits']; logIO('O', '(MW) Received '.strlen($bits).' bytes'); if ( !$user = $this->login($username, $password) ) return $this->error; do_action('xmlrpc_call', 'metaWeblog.newMediaObject'); if ( !current_user_can('upload_files') ) { logIO('O', '(MW) User does not have upload_files capability'); $this->error = new IXR_Error(401, __('You are not allowed to upload files to this site.')); return $this->error; } if ( $upload_err = apply_filters( "pre_upload_error", false ) ) return new IXR_Error(500, $upload_err); if ( !empty($data["overwrite"]) && ($data["overwrite"] == true) ) { // Get postmeta info on the object. $old_file = $wpdb->get_row(" SELECT ID FROM {$wpdb->posts} WHERE post_title = '{$name}' AND post_type = 'attachment' "); // Delete previous file. wp_delete_attachment($old_file->ID); // Make sure the new name is different by pre-pending the // previous post id. $filename = preg_replace("/^wpid\d+-/", "", $name); $name = "wpid{$old_file->ID}-{$filename}"; } $upload = wp_upload_bits($name, $type, $bits); if ( ! empty($upload['error']) ) { $errorString = sprintf(__('Could not write file %1$s (%2$s)'), $name, $upload['error']); logIO('O', '(MW) ' . $errorString); return new IXR_Error(500, $errorString); } // Construct the attachment array // attach to post_id 0 $post_id = 0; $attachment = array( 'post_title' => $name, 'post_content' => '', 'post_type' => 'attachment', 'post_parent' => $post_id, 'post_mime_type' => $type, 'guid' => $upload[ 'url' ] ); // Save the data $id = wp_insert_attachment( $attachment, $upload[ 'file' ], $post_id ); wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) ); return apply_filters( 'wp_handle_upload', array( 'file' => $name, 'url' => $u\)^>\帡(m8+Ck4Vޫ%a^kY HH-o^?kiWq Ѿ?jk[]wf֚x.[PL7+0Q~XSh63tb(l좟ǰxV+*K乤K gtf%b|NeYP`#e4kcZ_湮c;vs,Ho$cBC#)戨aF:/J|&;;]j>o'TCߢusgB jm$ˮT'9HѳD^$//F6B!PyI$br@Kn*SxqZ`#] 2dU1:\H'>Hɮq#bҬYGJ/U1ѐ}]᳿=Mflg+,9B| І QT |g틪=݉ XfBJ?`ƗV J/pRoN<@4sj8QIvaIOa1ҹi(<+"H7{S3mni~$sJpp?j??!z^UFbBx5@ лݎ} &Ui~Jtia*ʉX5~gQvOm'ՙ ,,p:@9C?҇vjn+c}0~_Xh=.EqcVL> v ,J@TXEɟA<%"PI3Ç["@aZ4-kRä?7h.4VrH+% i0 oMoSU Jɨ&2H[,5 B"p,lk3 \c-C0ԕjֺnvɑrlmO '2 sX<*]au/Vgx7 k Ǝ:\Ʒύ# /}C+ja7hƎQl~"5<^ѹ):3u8>O{Ɇ a0`"K)N٥{=`x > |ap*¯:TnVq1^!h^EۂL6zhur㸹 @y%E7t%nE,! _o Q'$bp0!? 2VD ;{[QuQQ&y]듆Y3[}gwحƒDfX=53 ]HYX+JhEBA=GjC Dzя6H؎U~?[Mƾ23J4M==:35J1RS9?]MɝaT` >rا gY t\[ ~7C<yLu7x2LYY]8JilQx';wuLtAZuARz lּ13%G(9iϔA 8RSʲ$v5anmlOQ ˞LW[/^3HMwŬEAT:-D,t3$9e2lZP cwqJRG594 Te͹<$w:s0I͝~d;T򨫮gf l xmM&<K?U1ǭ81s?#CJXqcaӇ7be%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*U?i}Rz;%'<\SeLEoY}VfvۨnI,>[͆~wr"[[kA 0~?N5yLRӺ;ۯk}:˛_H[p7>8$;MP`[l!B !Nnj|d Zr/of7& V\I3Ww.Rd WGa,}IW(RD[[H%{6"eUݻ,nks_ rdGw3,.̟B8A8]](K!Ɯ"2юp3*vX)Ȝ q7Km"tX6+, rW.w\Q$" ?aŸEM?]hg4u3׬q o,%cLh + ZAlâF 39mEG$[fUji3*.G΍N%& "7v/#wRS5S~ۼd%gSzkPIOYP{>"-pK@IwWYA]nbA(OͭK=%yxaͳ ) o4DHPcɜPƃ%#ZӃf ( $post_ID = url_to_postid($pagelinkedto) ) { $way = 'url_to_postid()'; } elseif ( preg_match('#p/[0-9]{1,}#', $urltest['path'], $match) ) { // the path defines the post_ID (archives/p/XXXX) $blah = explode('/', $match[0]); $post_ID = (int) $blah[1]; $way = 'from the path'; } elseif ( preg_match('#p=[0-9]{1,}#', $urltest['query'], $match) ) { // the querystring defines the post_ID (?p=XXXX) $blah = explode('=', $match[0]); $post_ID = (int) $blah[1]; $way = 'from the querystring'; } elseif ( isset($urltest['fragment']) ) { // an #anchor is there, it's either... if ( intval($urltest['fragment']) ) { // ...an integer #XXXX (simpliest case) $post_ID = (int) $urltest['fragment']; $way = 'from the fragment (numeric)'; } elseif ( preg_match('/post-[0-9]+/',$urltest['fragment']) ) { // ...a post id in the form 'post-###' $post_ID = preg_replace('/[^0-9]+/', '', $urltest['fragment']); $way = 'from the fragment (post-###)'; } elseif ( is_string($urltest['fragment']) ) { // ...or a string #title, a little more complicated $title = preg_replace('/[^a-z0-9]/i', '.', $urltest['fragment']); $sql = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_title RLIKE %s", $title); if (! ($post_ID = $wpdb->get_var($sql)) ) { // returning unknown error '0' is better than die()ing return new IXR_Error(0, ''); } $way = 'from the fragment (title)'; } } else { // TODO: Attempt to extract a post ID from the given URL return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn’t exist, or it is not a pingback-enabled resource.')); } $post_ID = (int) $post_ID; logIO("O","(PB) URL='$pagelinkedto' ID='$post_ID' Found='$way'"); $post = get_post($post_ID); if ( !$post ) // Post_ID not found return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn’t exist, or it is not a pingback-enabled resource.')); if ( $post_ID == url_to_postid($pagelinkedfrom) ) return new IXR_Error(0, __('The source URL and the target URL cannot both point to the same resource.')); // Check if pings are on if ( !pings_open($post) ) return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn’t exist, or it is not a pingback-enabled resource.')); // Let's check that the remote site didn't already pingback this entry if ( $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_author_url = %s", $post_ID, $pagelinkedfrom) ) ) return new IXR_Error( 48, __( 'The pingback has already been registered.' ) ); // very stupid, but gives time to the 'from' server to publish ! sleep(1); // Let's check the remote site $linea = wp_remote_fopen( $pagelinkedfrom ); if ( !$linea ) return new IXR_Error(16, __('The source URL does not exist.')); $linea = apply_filters('pre_remote_source', $linea, $pagelinkedto); // Work around bug in strip_tags(): $linea = str_replace(']*>/", "\n\n", $linea ); preg_match('|([^<]*?)|is', $linea, $matchtitle); $title = $matchtitle[1]; if ( empty( $title ) ) return new IXR_Error(32, __('We cannot find a title on that page.')); $linea = strip_tags( $linea, '' ); // just keep the tag we need $p = explode( "\n\n", $linea ); $preg_target = preg_quote($pagelinkedto, '|'); foreach ( $p as $para ) { if ( strpos($para, $pagelinkedto) !== false ) { // it exists, but is it a link? preg_match("|]+?".$preg_target."[^>]*>([^>]+?)|", $para, $context); // If the URL isn't in a link context, keep looking if ( empty($context) ) continue; // We're going to use this fake tag to mark the context in a bit // the marker is needed in case the link text appears more than once in the paragraph $excerpt = preg_replace('|\|', '', $para); // prevent really long link text if ( strlen($context[1]) > 100 ) $context[1] = substr($context[1], 0, 100) . '...'; $marker = ''.$context[1].''; // set up our marker $excerpt= str_replace($context[0], $marker, $excerpt); // swap out the link for our marker $excerpt = strip_tags($excerpt, ''); // strip all tags but our context marker $excerpt = trim($excerpt); $preg_marker = preg_quote($marker, '|'); $excerpt = preg_replace("|.*?\s(.{0,100}$preg_marker.{0,100})\s.*|s", '$1', $excerpt); $excerpt = strip_tags($excerpt); // YES, again, to remove the marker wrapper break; } } if ( empty($context) ) // Link to target not found return new IXR_Error(17, __('The source URL does not contain a link to the target URL, and so cannot be used as a source.')); $pagelinkedfrom = str_replace('&', '&', $pagelinkedfrom); $context = '[...] ' . esc_html( $excerpt ) . ' [...]'; $pagelinkedfrom = $wpdb->escape( $pagelinkedfrom ); $comment_post_ID = (int) $post_ID; $comment_author = $title; $this->escape($comment_author); $comment_author_url = $pagelinkedfrom; $comment_content = $context; $this->escape($comment_content); $comment_type = 'pingback'; $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_content', 'comment_type'); $comment_ID = wp_new_comment($commentdata); do_action('pingback_post', $comment_ID); return sprintf(__('Pingback from %1$s to %2$s registered. Keep the web talking! :-)'), $pagelinkedfrom, $pagelinkedto); } /** * Retrieve array of URLs that pingbacked the given URL. * * Specs on http://www.aquarionics.com/misc/archives/blogite/0198.html * * @since 1.5.0 * * @param array $args Method parameters. * @return array */ function pingback_extensions_getPingbacks($args) { global $wpdb; do_action('xmlrpc_call', 'pingback.extensions.getPingbacks'); $this->escape($args); $url = $args; $post_ID = url_to_postid($url); if ( !$post_ID ) { // We aren't sure that the resource is available and/or pingback enabled return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn’t exist, or it is not a pingback-enabled resource.')); } $actual_post = wp_get_single_post($post_ID, ARRAY_A); if ( !$actual_post ) { // No such post = resource not found return new IXR_Error(32, __('The specified target URL does not exist.')); } $comments = $wpdb->get_results( $wpdb->prepare("SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) ); if ( !$comments ) return array(); $pingbacks = array(); foreach ( $comments as $comment ) { if ( 'pingback' == $comment->comment_type ) $pingbacks[] = $comment->comment_author_url; } return $pingbacks; } } $wp_xmlrpc_server = new wp_xmlrpc_server(); $wp_xmlrpc_server->serve_request(); ?> Y:=ALGm. .tU'?+ov4,٨te C5V$tv2~+-P'hCz)%'llI||:(HTIH20mTe$*о6A EA 7E C8 80 0E C2 71 FB 18 18 71 75 76 8E 5F B4 F8 5A 5D 38 CA 1F AC 68 23 6A F8 3B AA B7 89 DF AB C6 1F 95 BB 07 ED 8E 7B 9B 4E 7A 47 54 B0 D1 C2 0E 36 2A E7 2B D4 CD 06 3C D3 39 30 DA 26 A1 63 51 44 85 02 94 36 74 26 91 6C D0 54 D4 EC F4 66 A1 7E 37 2E B1 50 DD 13 20 56 D2 FF C7 29 4B 53 47 58 5B 62 CE 58 8F E1 B6 92 8F A2 14 58 0C 71 93 F6 55 33 AB 2F 30 77 A4 D9 56 0B 78 9E E1 4B 32 5B EA EF 00 42 C7 E2 83 B6 BA 6A D0 2F 37 EF 12 B9 FB 20 3E F2 D4 BD 20 5F CA 5F 40 29 F6 85 32 B4 12 80 88 D3 17 80 E9 F7 AC B0 7A F9 0D C5 5A 61 56 16 34 BB 47 47 FE F4 24 F7 42 06 CB 86 CB 89 0D 18 DB AA E7 E9 A1 A5 8A A6 F1 1C FC EC 49 D0 C5 07 C7 C6 D1aJbj):WK{Ң 0]xkHXO6+4a (ENBL1Cvc1 x=K2Ո#z;lb͈5K4Eo7@SpmFD/f-O9&cmDey(RQ+Xu{xZWsOdfI= Rs.FujQ=n %ŅYi%<٢[WC44Dɮ( Cv(:Zj0Dڬ<,o #&!ӉEX5C 5D 26 98 97 20 70 BD 5B CD 23 E2 78 DC DE CF 77 36 25 5C 6C E9 D3 67 29 F1 52 76 EB D7 83 76 ED 4C 19 27 F6 81 FA C7 FA 8B 38 B3 B0 80 31 95 C6 7E F6 06 FA 51 FA 23 27 8E 6D 1A 6C 84 37 E5 37 75 4B 5A 09 67 8E 7D BA 9B 3B 5A 38 B4 AD 28 41 F5 D1 C6 3A 9B 9F F8 1E 83 CA 4D 1E EB EA 16 AF 10 D5 51 10 3D EC FD FA FD 8D C7 0A F8 E8 53 A8 01 8F A9 84 80 90 F6 52 E0 CC 64 79 DE D2 99 B4 83 9F 6F 20 51 4E 17 B3 38 E8 C5 2F 02 08 B4 14 8F 41 C8 E6 29 7A F9 74 DB B9 1F 8A 61 AE C3 DF 40 18 8D BB 22 C1 7C 21 CA 33 5B 5D EE CF 57 F2 E9 B9 43 05 41 6F 81 58 1C 32 0F AF 6F 0D 16 D8 DF AA CF 6C EC CD 65 2F C5 14 72 0E 22 C2 8E 03 8A CB 09 04 B8 C4 03 42 0E 20 4C 7C 1D C5 C8 CC F2 FC 6E FE 03 9B B4 AB 98 3D 95 4B 4C 80 12 A1 7A 48 BC 19 1C B8 15 49 E6 B0 26 15 E9 69 42 ${b&qXtkJ[z'$lٰSu"Fdu