~katiekitty/+junk/wordpress-byet

« back to all changes in this revision

Viewing changes to xmlrpc.php

  • Committer: kserver
  • Date: 2010-05-15 01:16:36 UTC
  • Revision ID: kserver@kserver-desktop-20100515011636-mnr1j7t637suptdq
Wordpress 2.9.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
201
201
 
202
202
                $this->initialise_blog_option_info( );
203
203
                $this->methods = apply_filters('xmlrpc_methods', $this->methods);
 
204
        }
 
205
 
 
206
        function serve_request() {
204
207
                $this->IXR_Server($this->methods);
205
208
        }
206
209
 
419
422
                                'desc'                  => __( 'Time Format' ),
420
423
                                'readonly'              => false,
421
424
                                'option'                => 'time_format'
 
425
                        ),
 
426
                        'users_can_register'    => array(
 
427
                                'desc'                  => __( 'Allow new users to sign up' ),
 
428
                                'readonly'              => false,
 
429
                                'option'                => 'users_can_register'
422
430
                        )
423
431
                );
424
432
 
593
601
                $blog_id        = (int) $args[0];
594
602
                $username       = $args[1];
595
603
                $password       = $args[2];
596
 
                $num_pages      = (int) $args[3];
 
604
                $num_pages      = isset($args[3]) ? (int) $args[3] : 10;
597
605
 
598
606
                if ( !$user = $this->login($username, $password) ) {
599
607
                        return $this->error;
604
612
 
605
613
                do_action('xmlrpc_call', 'wp.getPages');
606
614
 
607
 
                $page_limit = 10;
608
 
                if( isset( $num_pages ) ) {
609
 
                        $page_limit = $num_pages;
610
 
                }
611
 
 
612
 
                $pages = get_posts( array('post_type' => 'page', 'post_status' => 'all', 'numberposts' => $page_limit) );
 
615
                $pages = get_posts( array('post_type' => 'page', 'post_status' => 'any', 'numberposts' => $num_pages) );
613
616
                $num_pages = count($pages);
614
617
 
615
618
                // If we have pages, put together their info.
1063
1066
                $comment_date = mysql2date("Ymd\TH:i:s", $comment->comment_date, false);
1064
1067
                $comment_date_gmt = mysql2date("Ymd\TH:i:s", $comment->comment_date_gmt, false);
1065
1068
 
1066
 
                if ( 0 == $comment->comment_approved )
 
1069
                if ( '0' == $comment->comment_approved )
1067
1070
                        $comment_status = 'hold';
1068
1071
                else if ( 'spam' == $comment->comment_approved )
1069
1072
                        $comment_status = 'spam';
1070
 
                else if ( 1 == $comment->comment_approved )
 
1073
                else if ( '1' == $comment->comment_approved )
1071
1074
                        $comment_status = 'approve';
1072
1075
                else
1073
1076
                        $comment_status = $comment->comment_approved;
1564
1567
 
1565
1568
                foreach( $options as $o_name => $o_value ) {
1566
1569
                        $option_names[] = $o_name;
1567
 
                        if( empty( $o_value ) )
1568
 
                                continue;
1569
 
 
1570
1570
                        if( !array_key_exists( $o_name, $this->blog_options ) )
1571
1571
                                continue;
1572
1572
 
2092
2092
                }
2093
2093
 
2094
2094
                $post_title = $content_struct['title'];
2095
 
                $post_content = apply_filters( 'content_save_pre', $content_struct['description'] );
 
2095
                $post_content = $content_struct['description'];
2096
2096
 
2097
2097
                $post_status = $publish ? 'publish' : 'draft';
2098
2098
 
2282
2282
                global $wpdb;
2283
2283
 
2284
2284
                // find any unattached files
2285
 
                $attachments = $wpdb->get_results( "SELECT ID, guid FROM {$wpdb->posts} WHERE post_parent = '-1' AND post_type = 'attachment'" );
 
2285
                $attachments = $wpdb->get_results( "SELECT ID, guid FROM {$wpdb->posts} WHERE post_parent = '0' AND post_type = 'attachment'" );
2286
2286
                if( is_array( $attachments ) ) {
2287
2287
                        foreach( $attachments as $file ) {
2288
2288
                                if( strpos( $post_content, $file->guid ) !== false ) {
2459
2459
                }
2460
2460
 
2461
2461
                $post_title = $content_struct['title'];
2462
 
                $post_content = apply_filters( 'content_save_pre', $content_struct['description'] );
 
2462
                $post_content = $content_struct['description'];
2463
2463
                $catnames = $content_struct['categories'];
2464
2464
 
2465
2465
                $post_category = array();
2889
2889
                        return new IXR_Error(500, $errorString);
2890
2890
                }
2891
2891
                // Construct the attachment array
2892
 
                // attach to post_id -1
2893
 
                $post_id = -1;
 
2892
                // attach to post_id 0
 
2893
                $post_id = 0;
2894
2894
                $attachment = array(
2895
2895
                        'post_title' => $name,
2896
2896
                        'post_content' => '',
3424
3424
}
3425
3425
 
3426
3426
$wp_xmlrpc_server = new wp_xmlrpc_server();
3427
 
 
 
3427
$wp_xmlrpc_server->serve_request();
3428
3428
?>