Ticket #986: 986-import.diff

File 986-import.diff, 23.2 KB (added by Nazgul, 6 years ago)
  • wp-admin/import/blogger.php

     
    517517                                $did_one = true; 
    518518                        } 
    519519                        $output.= "<p>$archivename $status</p>\n"; 
    520                 } 
     520                } 
    521521                if ( ! $did_one ) 
    522522                        $this->set_next_step(7); 
    523523                die( $this->refresher(1000) . $output ); 
  • wp-admin/import/blogware.php

     
    2020                $trans_tbl = array_flip($trans_tbl); 
    2121                return strtr($string, $trans_tbl); 
    2222        } 
    23          
     23 
    2424        function greet() { 
    2525                echo '<p>'.__('Howdy! This importer allows you to extract posts from Blogware XML export file into your blog.  Pick a Blogware file to upload and click Import.').'</p>'; 
    2626                wp_import_upload_form("admin.php?import=blogware&amp;step=1"); 
     
    2828 
    2929        function import_posts() { 
    3030                global $wpdb, $current_user; 
    31                  
     31 
    3232                set_magic_quotes_runtime(0); 
    3333                $importdata = file($this->file); // Read the file into an array 
    3434                $importdata = implode('', $importdata); // squish it 
     
    3737                preg_match_all('|(<item[^>]+>(.*?)</item>)|is', $importdata, $posts); 
    3838                $posts = $posts[1]; 
    3939                unset($importdata); 
    40                 echo '<ol>';             
     40                echo '<ol>'; 
    4141                foreach ($posts as $post) { 
    4242                        flush(); 
    4343                        preg_match('|<item type=\"(.*?)\">|is', $post, $post_type); 
     
    100100 
    101101                        preg_match_all('|<comment>(.*?)</comment>|is', $post, $comments); 
    102102                        $comments = $comments[1]; 
    103                          
     103 
    104104                        if ( $comments ) { 
    105105                                $comment_post_ID = $post_id; 
    106106                                $num_comments = 0; 
     
    155155                $this->file = $file['file']; 
    156156                $this->import_posts(); 
    157157                wp_import_cleanup($file['id']); 
    158                  
     158 
    159159                echo '<h3>'; 
    160160                printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home')); 
    161161                echo '</h3>'; 
     
    168168                        $step = (int) $_GET['step']; 
    169169 
    170170                $this->header(); 
    171                  
     171 
    172172                switch ($step) { 
    173173                        case 0 : 
    174174                                $this->greet(); 
     
    177177                                $this->import(); 
    178178                                break; 
    179179                } 
    180                  
     180 
    181181                $this->footer(); 
    182182        } 
    183183 
    184184        function BW_Import() { 
    185                 // Nothing.      
     185                // Nothing. 
    186186        } 
    187187} 
    188188 
  • wp-admin/import/dotclear.php

     
    99**/ 
    1010if(!function_exists('get_catbynicename')) 
    1111{ 
    12         function get_catbynicename($category_nicename)  
     12        function get_catbynicename($category_nicename) 
    1313        { 
    1414        global $wpdb; 
    1515 
     
    6060// 
    6161//    This cries out for a C-implementation to be included in PHP core 
    6262// 
    63    function valid_1byte($char) { 
    64        if(!is_int($char)) return false; 
    65        return ($char & 0x80) == 0x00; 
    66    } 
    67    
    68    function valid_2byte($char) { 
    69        if(!is_int($char)) return false; 
    70        return ($char & 0xE0) == 0xC0; 
    71    } 
    7263 
    73    function valid_3byte($char) { 
    74        if(!is_int($char)) return false; 
    75        return ($char & 0xF0) == 0xE0; 
    76    } 
     64function valid_1byte($char) { 
     65        if(!is_int($char)) return false; 
     66                return ($char & 0x80) == 0x00; 
     67} 
    7768 
    78    function valid_4byte($char) { 
    79        if(!is_int($char)) return false; 
    80        return ($char & 0xF8) == 0xF0; 
    81    } 
    82    
    83    function valid_nextbyte($char) { 
    84        if(!is_int($char)) return false; 
    85        return ($char & 0xC0) == 0x80; 
    86    } 
    87    
    88    function valid_utf8($string) { 
    89        $len = strlen($string); 
    90        $i = 0;    
    91        while( $i < $len ) { 
    92            $char = ord(substr($string, $i++, 1)); 
    93            if(valid_1byte($char)) {    // continue 
    94                continue; 
    95            } else if(valid_2byte($char)) { // check 1 byte 
    96                if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 
    97                    return false; 
    98            } else if(valid_3byte($char)) { // check 2 bytes 
    99                if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 
    100                    return false; 
    101                if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 
    102                    return false; 
    103            } else if(valid_4byte($char)) { // check 3 bytes 
    104                if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 
    105                    return false; 
    106                if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 
    107                    return false; 
    108                if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 
    109                    return false; 
    110            } // goto next char 
    111        } 
    112        return true; // done 
    113    } 
     69function valid_2byte($char) { 
     70        if(!is_int($char)) return false; 
     71                return ($char & 0xE0) == 0xC0; 
     72} 
    11473 
     74function valid_3byte($char) { 
     75        if(!is_int($char)) return false; 
     76                return ($char & 0xF0) == 0xE0; 
     77} 
     78 
     79function valid_4byte($char) { 
     80        if(!is_int($char)) return false; 
     81                return ($char & 0xF8) == 0xF0; 
     82} 
     83 
     84function valid_nextbyte($char) { 
     85        if(!is_int($char)) return false; 
     86                return ($char & 0xC0) == 0x80; 
     87} 
     88 
     89function valid_utf8($string) { 
     90        $len = strlen($string); 
     91        $i = 0; 
     92        while( $i < $len ) { 
     93                $char = ord(substr($string, $i++, 1)); 
     94                if(valid_1byte($char)) {    // continue 
     95                        continue; 
     96                } else if(valid_2byte($char)) { // check 1 byte 
     97                        if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 
     98                                return false; 
     99                } else if(valid_3byte($char)) { // check 2 bytes 
     100                        if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 
     101                                return false; 
     102                        if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 
     103                                return false; 
     104                } else if(valid_4byte($char)) { // check 3 bytes 
     105                        if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 
     106                                return false; 
     107                        if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 
     108                                return false; 
     109                        if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 
     110                                return false; 
     111                } // goto next char 
     112        } 
     113        return true; // done 
     114} 
     115 
    115116function csc ($s) { 
    116117        if (valid_utf8 ($s)) { 
    117118                return $s; 
     
    129130**/ 
    130131class Dotclear_Import { 
    131132 
    132         function header()  
     133        function header() 
    133134        { 
    134135                echo '<div class="wrap">'; 
    135136                echo '<h2>'.__('Import Dotclear').'</h2>'; 
    136137                echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'</p>'; 
    137138        } 
    138139 
    139         function footer()  
     140        function footer() 
    140141        { 
    141142                echo '</div>'; 
    142143        } 
    143144 
    144         function greet()  
     145        function greet() 
    145146        { 
    146147                echo '<p>'.__('Howdy! This importer allows you to extract posts from a Dotclear database into your blog.  Mileage may vary.').'</p>'; 
    147148                echo '<p>'.__('Your Dotclear Configuration settings are as follows:').'</p>'; 
     
    151152                echo '</form>'; 
    152153        } 
    153154 
    154         function get_dc_cats()  
     155        function get_dc_cats() 
    155156        { 
    156157                global $wpdb; 
    157158                // General Housekeeping 
     
    186187                // Get Posts 
    187188                return $dcdb->get_results('SELECT '.$dbprefix.'post.*, '.$dbprefix.'categorie.cat_libelle_url AS post_cat_name 
    188189                                                FROM '.$dbprefix.'post INNER JOIN '.$dbprefix.'categorie 
    189                                                   ON '.$dbprefix.'post.cat_id = '.$dbprefix.'categorie.cat_id', ARRAY_A); 
     190                                                ON '.$dbprefix.'post.cat_id = '.$dbprefix.'categorie.cat_id', ARRAY_A); 
    190191        } 
    191192 
    192193        function get_dc_comments() 
     
    211212                return $dcdb->get_results('SELECT * FROM '.$dbprefix.'link ORDER BY position', ARRAY_A); 
    212213        } 
    213214 
    214         function cat2wp($categories='')  
     215        function cat2wp($categories='') 
    215216        { 
    216217                // General Housekeeping 
    217218                global $wpdb; 
     
    221222                if(is_array($categories)) 
    222223                { 
    223224                        echo '<p>'.__('Importing Categories...').'<br /><br /></p>'; 
    224                         foreach ($categories as $category)  
     225                        foreach ($categories as $category) 
    225226                        { 
    226227                                $count++; 
    227228                                extract($category); 
     
    283284                                                                'display_name'  => $Realname) 
    284285                                                                ); 
    285286                                } 
    286                                 else  
     287                                else 
    287288                                { 
    288289                                        $ret_id = wp_insert_user(array( 
    289290                                                                'user_login'    => $user_id, 
     
    384385                                                        'comment_count'         => $post_nb_comment + $post_nb_trackback) 
    385386                                                        ); 
    386387                                } 
    387                                 else  
     388                                else 
    388389                                { 
    389390                                        $ret_id = wp_insert_post(array( 
    390391                                                        'post_author'           => $authorid, 
     
    460461                                                        'comment_approved'      => $comment_approved) 
    461462                                                        ); 
    462463                                } 
    463                                 else  
     464                                else 
    464465                                { 
    465466                                        // Insert comments 
    466467                                        $ret_id = wp_insert_comment(array( 
     
    547548                return false; 
    548549        } 
    549550 
    550         function import_categories()  
     551        function import_categories() 
    551552        { 
    552553                // Category Import 
    553554                $cats = $this->get_dc_cats(); 
     
    565566        function import_users() 
    566567        { 
    567568                // User Import 
    568                 $users = $this->get_dc_users();  
     569                $users = $this->get_dc_users(); 
    569570                $this->users2wp($users); 
    570571 
    571572                echo '<form action="admin.php?import=dotclear&amp;step=3" method="post">'; 
     
    655656                echo '</ul>'; 
    656657        } 
    657658 
    658         function dispatch()  
     659        function dispatch() 
    659660        { 
    660661 
    661662                if (empty ($_GET['step'])) 
     
    664665                        $step = (int) $_GET['step']; 
    665666                $this->header(); 
    666667 
    667                 if ( $step > 0 )  
     668                if ( $step > 0 ) 
    668669                { 
    669670                        if($_POST['dbuser']) 
    670671                        { 
     
    689690                        { 
    690691                                if(get_option('dchost')) 
    691692                                        delete_option('dchost'); 
    692                                 add_option('dchost',$_POST['dbhost']);  
     693                                add_option('dchost',$_POST['dbhost']); 
    693694                        } 
    694695                        if($_POST['dccharset']) 
    695696                        { 
    696697                                if(get_option('dccharset')) 
    697698                                        delete_option('dccharset'); 
    698                                 add_option('dccharset',$_POST['dccharset']);  
     699                                add_option('dccharset',$_POST['dccharset']); 
    699700                        } 
    700701                        if($_POST['dbprefix']) 
    701702                        { 
    702703                                if(get_option('dcdbprefix')) 
    703704                                        delete_option('dcdbprefix'); 
    704                                 add_option('dcdbprefix',$_POST['dbprefix']);  
     705                                add_option('dcdbprefix',$_POST['dbprefix']); 
    705706                        } 
    706707 
    707708 
    708709                } 
    709710 
    710                 switch ($step)  
     711                switch ($step) 
    711712                { 
    712713                        default: 
    713714                        case 0 : 
     
    736737                $this->footer(); 
    737738        } 
    738739 
    739         function Dotclear_Import()  
     740        function Dotclear_Import() 
    740741        { 
    741742                // Nothing. 
    742743        } 
  • wp-admin/import/greymatter.php

     
    6666                $string = str_replace("|*|","<br />\n",$string); 
    6767                return($string); 
    6868        } 
    69          
     69 
    7070        function import() { 
    7171                global $wpdb; 
    72          
     72 
    7373                $wpvarstoreset = array('gmpath', 'archivespath', 'lastentry'); 
    7474                for ($i=0; $i<count($wpvarstoreset); $i += 1) { 
    7575                        $wpvar = $wpvarstoreset[$i]; 
     
    9191 
    9292                if (!chdir($gmpath)) 
    9393                        die("Wrong path, $gmpath\ndoesn't exist\non the server"); 
    94                          
     94 
    9595                $this->header(); 
    9696?> 
    9797<p>The importer is running...</p> 
     
    128128                $user_info = array("user_login"=>"$user_login", "user_pass"=>"$pass1", "user_nickname"=>"$user_nickname", "user_email"=>"$user_email", "user_url"=>"$user_url", "user_ip"=>"$user_ip", "user_domain"=>"$user_domain", "user_browser"=>"$user_browser", "dateYMDhour"=>"$user_joindate", "user_level"=>"1", "user_idmode"=>"nickname"); 
    129129                $user_id = wp_insert_user($user_info); 
    130130                $this->gmnames[$userdata[0]] = $user_id; 
    131                  
     131 
    132132                echo "<li>user <i>$user_login</i>... <b>Done</b></li>"; 
    133133 
    134134        } 
     
    137137<li>importing posts, comments, and karma...<br /><ul><?php 
    138138 
    139139        chdir($archivespath); 
    140          
     140 
    141141        for($i = 0; $i <= $lastentry; $i = $i + 1) { 
    142                  
     142 
    143143                $entryfile = ""; 
    144                  
     144 
    145145                if ($i<10000000) { 
    146146                        $entryfile .= "0"; 
    147147                        if ($i<1000000) { 
     
    196196                        $post_status = 'publish'; //in greymatter, there are no drafts 
    197197                        $comment_status = 'open'; 
    198198                        $ping_status = 'closed'; 
    199                          
     199 
    200200                        if ($post_ID = post_exists($post_title, '', $post_date)) { 
    201201                                echo ' (already exists)'; 
    202202                        } else { 
     
    214214                                        $user_email=$wpdb->escape("user@deleted.com"); 
    215215                                        $user_url=$wpdb->escape(""); 
    216216                                        $user_joindate=$wpdb->escape($user_joindate); 
    217                                          
     217 
    218218                                        $user_info = array("user_login"=>$user_login, "user_pass"=>$pass1, "user_nickname"=>$user_nickname, "user_email"=>$user_email, "user_url"=>$user_url, "user_ip"=>$user_ip, "user_domain"=>$user_domain, "user_browser"=>$user_browser, "dateYMDhour"=>$user_joindate, "user_level"=>0, "user_idmode"=>"nickname"); 
    219219                                        $user_id = wp_insert_user($user_info); 
    220220                                        $this->gmnames[$postinfo[1]] = $user_id; 
    221                                          
     221 
    222222                                        echo ": registered deleted user <i>$user_login</i> at level 0 "; 
    223223                                } 
    224                          
     224 
    225225                                if (array_key_exists($postinfo[1], $this->gmnames)) { 
    226226                                        $post_author = $this->gmnames[$postinfo[1]]; 
    227227                                } else { 
    228228                                        $post_author = $user_id; 
    229229                                } 
    230                          
     230 
    231231                                $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_excerpt', 'post_status', 'comment_status', 'ping_status', 'post_modified', 'post_modified_gmt'); 
    232232                                $post_ID = wp_insert_post($postdata); 
    233233                        } 
     
    302302        } 
    303303 
    304304        function GM_Import() { 
    305                 // Nothing.      
     305                // Nothing. 
    306306        } 
    307307} 
    308308 
  • wp-admin/import/mt.php

     
    5353                $pass = 'changeme'; 
    5454                if (!(in_array($author, $this->mtnames))) { //a new mt author name is found 
    5555                        ++ $this->j; 
    56                         $this->mtnames[$this->j] = $author; //add that new mt author name to an array  
     56                        $this->mtnames[$this->j] = $author; //add that new mt author name to an array 
    5757                        $user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user 
    58                         if (!$user_id) { //banging my head against the desk now.  
     58                        if (!$user_id) { //banging my head against the desk now. 
    5959                                if ($newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname 
    6060                                        $user_id = wp_create_user($author, $pass); 
    6161                                        $this->newauthornames[$this->j] = $author; //now we have a name, in the place of left_blank. 
     
    397397 
    398398        function import() { 
    399399                $this->id = (int) $_GET['id']; 
    400                  
     400 
    401401                $this->file = get_attached_file($this->id); 
    402402                $this->get_authors_from_post(); 
    403403                $this->get_entries(); 
  • wp-admin/import/textpattern.php

     
    44**/ 
    55if(!function_exists('get_catbynicename')) 
    66{ 
    7         function get_catbynicename($category_nicename)  
     7        function get_catbynicename($category_nicename) 
    88        { 
    99        global $wpdb; 
    1010 
     
    3838**/ 
    3939class Textpattern_Import { 
    4040 
    41         function header()  
     41        function header() 
    4242        { 
    4343                echo '<div class="wrap">'; 
    4444                echo '<h2>'.__('Import Textpattern').'</h2>'; 
    4545                echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'</p>'; 
    4646        } 
    4747 
    48         function footer()  
     48        function footer() 
    4949        { 
    5050                echo '</div>'; 
    5151        } 
    5252 
    53         function greet()  
     53        function greet() 
    5454        { 
    5555                echo '<p>'.__('Howdy! This importer allows you to extract posts from any Textpattern 4.0.2+ into your blog. This has not been tested on previous versions of Textpattern.  Mileage may vary.').'</p>'; 
    5656                echo '<p>'.__('Your Textpattern Configuration settings are as follows:').'</p>'; 
     
    6969                $prefix = get_option('tpre'); 
    7070 
    7171                // Get Categories 
    72                 return $txpdb->get_results('SELECT  
    73                                                                                 id, 
    74                                                                                 name, 
    75                                                                                 title 
    76                                                                          FROM '.$prefix.'txp_category  
    77                                                                          WHERE type = "article"',  
    78                                                                          ARRAY_A); 
     72                return $txpdb->get_results('SELECT 
     73                        id, 
     74                        name, 
     75                        title 
     76                        FROM '.$prefix.'txp_category 
     77                        WHERE type = "article"', 
     78                        ARRAY_A); 
    7979        } 
    8080 
    8181        function get_txp_users() 
     
    8989                // Get Users 
    9090 
    9191                return $txpdb->get_results('SELECT 
    92                                                                                 user_id, 
    93                                                                                 name, 
    94                                                                                 RealName, 
    95                                                                                 email, 
    96                                                                                 privs 
    97                                                                         FROM '.$prefix.'txp_users', ARRAY_A); 
     92                        user_id, 
     93                        name, 
     94                        RealName, 
     95                        email, 
     96                        privs 
     97                        FROM '.$prefix.'txp_users', ARRAY_A); 
    9898        } 
    9999 
    100100        function get_txp_posts() 
     
    105105                $prefix = get_option('tpre'); 
    106106 
    107107                // Get Posts 
    108                 return $txpdb->get_results('SELECT  
    109                                                                                 ID, 
    110                                                                                 Posted, 
    111                                                                                 AuthorID, 
    112                                                                                 LastMod, 
    113                                                                                 Title, 
    114                                                                                 Body, 
    115                                                                                 Excerpt, 
    116                                                                                 Category1, 
    117                                                                                 Category2, 
    118                                                                                 Status, 
    119                                                                                 Keywords, 
    120                                                                                 url_title, 
    121                                                                                 comments_count 
    122                                                                         FROM '.$prefix.'textpattern 
    123                                                                         ', ARRAY_A); 
     108                return $txpdb->get_results('SELECT 
     109                        ID, 
     110                        Posted, 
     111                        AuthorID, 
     112                        LastMod, 
     113                        Title, 
     114                        Body, 
     115                        Excerpt, 
     116                        Category1, 
     117                        Category2, 
     118                        Status, 
     119                        Keywords, 
     120                        url_title, 
     121                        comments_count 
     122                        FROM '.$prefix.'textpattern 
     123                        ', ARRAY_A); 
    124124        } 
    125125 
    126126        function get_txp_comments() 
     
    142142                set_magic_quotes_runtime(0); 
    143143                $prefix = get_option('tpre'); 
    144144 
    145                 return $txpdb->get_results('SELECT  
    146                                                                                 id, 
    147                                                                                 date, 
    148                                                                                 category, 
    149                                                                                 url, 
    150                                                                                 linkname, 
    151                                                                                 description 
    152                                                                           FROM '.$prefix.'txp_link',  
    153                                                                           ARRAY_A);                                                
     145                return $txpdb->get_results('SELECT 
     146                        id, 
     147                        date, 
     148                        category, 
     149                        url, 
     150                        linkname, 
     151                        description 
     152                        FROM '.$prefix.'txp_link', 
     153                        ARRAY_A); 
    154154        } 
    155155 
    156         function cat2wp($categories='')  
     156        function cat2wp($categories='') 
    157157        { 
    158158                // General Housekeeping 
    159159                global $wpdb; 
     
    163163                if(is_array($categories)) 
    164164                { 
    165165                        echo '<p>'.__('Importing Categories...').'<br /><br /></p>'; 
    166                         foreach ($categories as $category)  
     166                        foreach ($categories as $category) 
    167167                        { 
    168168                                $count++; 
    169169                                extract($category); 
     
    225225                                                                'display_name'  => $name) 
    226226                                                                ); 
    227227                                } 
    228                                 else  
     228                                else 
    229229                                { 
    230230                                        $ret_id = wp_insert_user(array( 
    231231                                                                'user_login'    => $name, 
     
    301301                                if($pinfo = post_exists($Title,$Body)) 
    302302                                { 
    303303                                        $ret_id = wp_insert_post(array( 
    304                                                         'ID'                            => $pinfo, 
    305                                                         'post_date'                     => $Posted, 
    306                                                         'post_date_gmt'         => $post_date_gmt, 
    307                                                         'post_author'           => $authorid, 
    308                                                         'post_modified'         => $LastMod, 
    309                                                         'post_modified_gmt' => $post_modified_gmt, 
    310                                                         'post_title'            => $Title, 
    311                                                         'post_content'          => $Body, 
    312                                                         'post_excerpt'          => $Excerpt, 
    313                                                         'post_status'           => $post_status, 
    314                                                         'post_name'                     => $url_title, 
    315                                                         'comment_count'         => $comments_count) 
    316                                                         ); 
     304                                                'ID'                            => $pinfo, 
     305                                                'post_date'                     => $Posted, 
     306                                                'post_date_gmt'         => $post_date_gmt, 
     307                                                'post_author'           => $authorid, 
     308                                                'post_modified'         => $LastMod, 
     309                                                'post_modified_gmt' => $post_modified_gmt, 
     310                                                'post_title'            => $Title, 
     311                                                'post_content'          => $Body, 
     312                                                'post_excerpt'          => $Excerpt, 
     313                                                'post_status'           => $post_status, 
     314                                                'post_name'                     => $url_title, 
     315                                                'comment_count'         => $comments_count) 
     316                                                ); 
    317317                                } 
    318                                 else  
     318                                else 
    319319                                { 
    320320                                        $ret_id = wp_insert_post(array( 
    321                                                         'post_date'                     => $Posted, 
    322                                                         'post_date_gmt'         => $post_date_gmt, 
    323                                                         'post_author'           => $authorid, 
    324                                                         'post_modified'         => $LastMod, 
    325                                                         'post_modified_gmt' => $post_modified_gmt, 
    326                                                         'post_title'            => $Title, 
    327                                                         'post_content'          => $Body, 
    328                                                         'post_excerpt'          => $Excerpt, 
    329                                                         'post_status'           => $post_status, 
    330                                                         'post_name'                     => $url_title, 
    331                                                         'comment_count'         => $comments_count) 
    332                                                         ); 
     321                                                'post_date'                     => $Posted, 
     322                                                'post_date_gmt'         => $post_date_gmt, 
     323                                                'post_author'           => $authorid, 
     324                                                'post_modified'         => $LastMod, 
     325                                                'post_modified_gmt' => $post_modified_gmt, 
     326                                                'post_title'            => $Title, 
     327                                                'post_content'          => $Body, 
     328                                                'post_excerpt'          => $Excerpt, 
     329                                                'post_status'           => $post_status, 
     330                                                'post_name'                     => $url_title, 
     331                                                'comment_count'         => $comments_count) 
     332                                                ); 
    333333                                } 
    334334                                $txpposts2wpposts[$ID] = $ret_id; 
    335335 
     
    378378                                { 
    379379                                        // Update comments 
    380380                                        $ret_id = wp_update_comment(array( 
    381                                                         'comment_ID'                    => $cinfo, 
    382                                                         'comment_post_ID'               => $comment_post_ID, 
    383                                                         'comment_author'                => $name, 
    384                                                         'comment_author_email'  => $email, 
    385                                                         'comment_author_url'    => $web, 
    386                                                         'comment_date'                  => $posted, 
    387                                                         'comment_content'               => $message, 
    388                                                         'comment_approved'              => $comment_approved) 
    389                                                         ); 
     381                                                'comment_ID'                    => $cinfo, 
     382                                                'comment_post_ID'               => $comment_post_ID, 
     383                                                'comment_author'                => $name, 
     384                                                'comment_author_email'  => $email, 
     385                                                'comment_author_url'    => $web, 
     386                                                'comment_date'                  => $posted, 
     387                                                'comment_content'               => $message, 
     388                                                'comment_approved'              => $comment_approved) 
     389                                                ); 
    390390                                } 
    391                                 else  
     391                                else 
    392392                                { 
    393393                                        // Insert comments 
    394394                                        $ret_id = wp_insert_comment(array( 
    395                                                         'comment_post_ID'               => $comment_post_ID, 
    396                                                         'comment_author'                => $name, 
    397                                                         'comment_author_email'  => $email, 
    398                                                         'comment_author_url'    => $web, 
    399                                                         'comment_author_IP'             => $ip, 
    400                                                         'comment_date'                  => $posted, 
    401                                                         'comment_content'               => $message, 
    402                                                         'comment_approved'              => $comment_approved) 
    403                                                         ); 
     395                                                'comment_post_ID'               => $comment_post_ID, 
     396                                                'comment_author'                => $name, 
     397                                                'comment_author_email'  => $email, 
     398                                                'comment_author_url'    => $web, 
     399                                                'comment_author_IP'             => $ip, 
     400                                                'comment_date'                  => $posted, 
     401                                                'comment_content'               => $message, 
     402                                                'comment_approved'              => $comment_approved) 
     403                                                ); 
    404404                                } 
    405405                                $txpcm2wpcm[$comment_ID] = $ret_id; 
    406406                        } 
     
    449449                                                                'link_updated'          => $date) 
    450450                                                                ); 
    451451                                } 
    452                                 else  
     452                                else 
    453453                                { 
    454454                                        $ret_id = wp_insert_link(array( 
    455455                                                                'link_url'                      => $url, 
     
    471471                return false; 
    472472        } 
    473473 
    474         function import_categories()  
     474        function import_categories() 
    475475        { 
    476476                // Category Import 
    477477                $cats = $this->get_txp_cats(); 
     
    489489        function import_users() 
    490490        { 
    491491                // User Import 
    492                 $users = $this->get_txp_users();  
     492                $users = $this->get_txp_users(); 
    493493                $this->users2wp($users); 
    494494 
    495495                echo '<form action="admin.php?import=textpattern&amp;step=3" method="post">'; 
     
    577577                echo '</ul>'; 
    578578        } 
    579579 
    580         function dispatch()  
     580        function dispatch() 
    581581        { 
    582582 
    583583                if (empty ($_GET['step'])) 
     
    586586                        $step = (int) $_GET['step']; 
    587587                $this->header(); 
    588588 
    589                 if ( $step > 0 )  
     589                if ( $step > 0 ) 
    590590                { 
    591591                        if($_POST['dbuser']) 
    592592                        { 
     
    611611                        { 
    612612                                if(get_option('txphost')) 
    613613                                        delete_option('txphost'); 
    614                                 add_option('txphost',$_POST['dbhost']);  
     614                                add_option('txphost',$_POST['dbhost']); 
    615615                        } 
    616616                        if($_POST['dbprefix']) 
    617617                        { 
    618618                                if(get_option('tpre')) 
    619619                                        delete_option('tpre'); 
    620                                 add_option('tpre',$_POST['dbprefix']);  
     620                                add_option('tpre',$_POST['dbprefix']); 
    621621                        } 
    622622 
    623623 
    624624                } 
    625625 
    626                 switch ($step)  
     626                switch ($step) 
    627627                { 
    628628                        default: 
    629629                        case 0 : 
     
    652652                $this->footer(); 
    653653        } 
    654654 
    655         function Textpattern_Import()  
     655        function Textpattern_Import() 
    656656        { 
    657657                // Nothing. 
    658658        } 
  • wp-admin/import/wordpress.php

     
    5656                $pass = 'changeme'; 
    5757                if (!(in_array($author, $this->mtnames))) { //a new mt author name is found 
    5858                        ++ $this->j; 
    59                         $this->mtnames[$this->j] = $author; //add that new mt author name to an array  
     59                        $this->mtnames[$this->j] = $author; //add that new mt author name to an array 
    6060                        $user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user 
    61                         if (!$user_id) { //banging my head against the desk now.  
     61                        if (!$user_id) { //banging my head against the desk now. 
    6262                                if ($newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname 
    6363                                        $user_id = wp_create_user($author, $pass); 
    6464                                        $this->newauthornames[$this->j] = $author; //now we have a name, in the place of left_blank. 
     
    271271 
    272272        function import() { 
    273273                $this->id = (int) $_GET['id']; 
    274                  
     274 
    275275                $this->file = get_attached_file($this->id); 
    276276                $this->get_authors_from_post(); 
    277277                $this->get_entries();