Ticket #13458: 13458_2.diff
| File 13458_2.diff, 6.8 KB (added by ampt, 3 years ago) |
|---|
-
wp-admin/import/blogger.php
162 162 if ( $tag['tag'] == 'TITLE' ) { 163 163 $blog['title'] = $tag['value']; 164 164 } elseif ( $tag['tag'] == 'SUMMARY' ) { 165 $blog['summary'] = $tag['value'];165 $blog['summary'] = ( isset( $tag['value'] ) ) ? $tag['value'] : ''; 166 166 } elseif ( $tag['tag'] == 'LINK' ) { 167 167 if ( $tag['attributes']['REL'] == 'alternate' && $tag['attributes']['TYPE'] == 'text/html' ) { 168 168 $parts = parse_url( $tag['attributes']['HREF'] ); … … 205 205 $posts = __('Posts'); 206 206 $comments = __('Comments'); 207 207 $noscript = __('This feature requires Javascript but it seems to be disabled. Please enable Javascript and then reload this page. Don’t worry, you can turn it back off when you’re done.'); 208 $init = ''; 209 $rows = ''; 208 210 209 211 $interval = STATUS_INTERVAL * 1000; 210 212 … … 499 501 if ( preg_match('/rel=.previous./', $match) ) 500 502 $query = @html_entity_decode( preg_replace('/^.*href=[\'"].*\?(.+)[\'"].*$/', '$1', $match), ENT_COMPAT, get_option('blog_charset') ); 501 503 502 parse_str($query, $q); 503 504 $this->blogs[$importing_blog]['comments_start_index'] = (int) $q['start-index']; 504 if ( $query ) { 505 parse_str($query, $q); 506 $this->blogs[$importing_blog]['comments_start_index'] = (int) $q['start-index']; 507 } else 508 $this->blogs[$importing_blog]['comments_start_index'] = 0; 505 509 $this->save_vars(); 506 510 } while ( !empty( $query ) && $this->have_time() ); 507 511 } … … 560 564 $post_content = str_replace('<br>', '<br />', $post_content); 561 565 $post_content = str_replace('<hr>', '<hr />', $post_content); 562 566 567 if( !isset( $this->blogs[$importing_blog]['posts_skipped'] ) ) { 568 $this->blogs[$importing_blog]['posts_skipped'] = 0; 569 } 570 563 571 // Checks for duplicates 564 572 if ( isset( $this->blogs[$importing_blog]['posts'][$entry->old_permalink] ) ) { 565 573 ++$this->blogs[$importing_blog]['posts_skipped']; … … 582 590 add_post_meta( $post_id, 'blogger_permalink', $entry->old_permalink, true ); 583 591 584 592 $this->blogs[$importing_blog]['posts'][$entry->old_permalink] = $post_id; 593 if( !isset( $this->blogs[$importing_blog]['posts_done'] ) ) { 594 $this->blogs[$importing_blog]['posts_done'] = 0; 595 } 585 596 ++$this->blogs[$importing_blog]['posts_done']; 586 597 } 587 598 $this->save_vars(); … … 602 613 } 603 614 604 615 $comment_post_ID = (int) $this->blogs[$importing_blog]['posts'][$entry->old_post_permalink]; 605 preg_match('#<name>(.+?)</name>.*(?:\<uri>(.+?)</uri>)?#', $entry->author, $matches); 616 preg_match('#<name>(.+?)</name>.*?(?:\<uri>(.+?)</uri>)?#', $entry->author, $matches); 617 618 // Not all comments have an author url 619 $comment_author_url = isset( $matches[2] ) ? $matches[2] : ''; 620 606 621 $comment_author = addslashes( $this->no_apos( strip_tags( (string) $matches[1] ) ) ); 607 $comment_author_url = addslashes( $this->no_apos( strip_tags( (string) $ matches[2]) ) );622 $comment_author_url = addslashes( $this->no_apos( strip_tags( (string) $comment_author_url ) ) ); 608 623 $comment_date = $this->convert_date( $entry->updated ); 609 624 $comment_content = addslashes( $this->no_apos( @html_entity_decode( $entry->content, ENT_COMPAT, get_option('blog_charset') ) ) ); 610 625 … … 618 633 isset( $this->blogs[$importing_blog]['comments'][$entry->old_permalink] ) || 619 634 comment_exists( $comment_author, $comment_date ) 620 635 ) { 636 if( !isset( $this->blogs[$importing_blog]['comments_skipped'] ) ) { 637 $this->blogs[$importing_blog]['comments_skipped'] = 0; 638 } 621 639 ++$this->blogs[$importing_blog]['comments_skipped']; 622 640 } else { 623 641 $comment = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_date', 'comment_content'); … … 627 645 628 646 $this->blogs[$importing_blog]['comments'][$entry->old_permalink] = $comment_id; 629 647 648 if( !isset( $this->blogs[$importing_blog]['comments_done'] ) ) { 649 $this->blogs[$importing_blog]['comments_done'] = 0; 650 } 651 630 652 ++$this->blogs[$importing_blog]['comments_done']; 631 653 } 632 654 $this->save_vars(); … … 665 687 $mapthis = __('Blogger username'); 666 688 $tothis = __('WordPress login'); 667 689 $submit = esc_js( __('Save Changes') ); 690 $rows = ''; 668 691 669 692 foreach ( $blog['authors'] as $i => $author ) 670 693 $rows .= "<tr><td><label for='authors[$i]'>{$author[0]}</label></td><td><select name='authors[$i]' id='authors[$i]'>" . $this->get_user_options($author[1]) . "</select></td></tr>"; … … 674 697 675 698 function get_user_options($current) { 676 699 global $importer_users; 700 $options = ''; 677 701 if ( ! isset( $importer_users ) ) 678 702 $importer_users = (array) get_users_of_blog(); 679 703 … … 743 767 } 744 768 745 769 function _txrx( $sock, $request ) { 770 $response = ''; 746 771 fwrite( $sock, $request ); 747 772 while ( ! feof( $sock ) ) 748 773 $response .= @ fread ( $sock, 8192 ); … … 787 812 $response_header_array = array(); 788 813 foreach($response_header_lines as $header_line) { 789 814 list($header,$value) = explode(': ', $header_line, 2); 790 $response_header_array[$header] .= $value."\n";815 $response_header_array[$header] = $value."\n"; 791 816 } 792 817 793 818 $cookie_array = array(); 794 $cookies = explode("\n", $response_header_array["Set-Cookie"]); 819 $cookies = array(); 820 if( isset($response_header_array["Set-Cookie"]) ) { 821 $cookies = explode("\n", $response_header_array["Set-Cookie"]); 822 } 795 823 foreach($cookies as $this_cookie) { array_push($cookie_array, "Cookie: ".$this_cookie); } 796 824 797 825 return array("code" => $response_code, "header" => $response_header_array, "cookies" => $cookie_array, "body" => $response_body); … … 983 1011 array_push($this->in_content, "<". $this->ns_to_prefix($name) ."{$xmlns_str}{$attrs_str}"); 984 1012 } else if (in_array($tag, $this->ATOM_CONTENT_ELEMENTS) || in_array($tag, $this->ATOM_SIMPLE_ELEMENTS)) { 985 1013 $this->in_content = array(); 986 $this->is_xhtml = $attrs['type'] == 'xhtml'; 1014 1015 if( isset( $attrs['type'] ) ) { 1016 $this->is_xhtml = $attrs['type'] == 'xhtml'; 1017 } else { 1018 $this->is_xhtml = false; 1019 } 1020 987 1021 array_push($this->in_content, array($tag,$this->depth)); 988 1022 } else if ($tag == 'link') { 989 1023 array_push($this->entry->links, $attrs); … … 1036 1070 function cdata($parser, $data) { 1037 1071 #print str_repeat(" ", $this->depth * $this->indent) . "data: #" . $data . "#\n"; 1038 1072 if (!empty($this->in_content)) { 1073 $in_content = $this->in_content[count($this->in_content)-1]; 1074 if( is_array( $in_content ) ) { 1075 $in_content = $in_content[0]; 1076 } 1077 1039 1078 // handle self-closing tags (case: text node found, need to close element started) 1040 if (strpos($ this->in_content[count($this->in_content)-1], '<') !== false) {1079 if (strpos($in_content, '<') !== false) { 1041 1080 array_push($this->in_content, ">"); 1042 1081 } 1043 1082 array_push($this->in_content, $this->xml_escape($data));
