WordPress.org

Make WordPress Core

Changeset 4735


Ignore:
Timestamp:
01/16/2007 01:35:19 AM (15 years ago)
Author:
ryan
Message:

Fix author mapping in the WP-to-WP importer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/import/wordpress.php

    r4608 r4735  
    4242        global $wpdb, $testing;
    4343        $users = $wpdb->get_results("SELECT * FROM $wpdb->users ORDER BY ID");
    44 ?><select name="userselect[<?php echo $n; ?>]">
     44?><select name="userselect[<?php echo attribute_escape($n); ?>]">
    4545    <option value="#NONE#">- Select -</option>
    4646    <?php
     
    101101            }
    102102        }
    103 
    104103        // We need to find unique values of author names, while preserving the order, so this function emulates the unique_value(); php function, without the sorting.
    105104        $authors[0] = array_shift($temp);
     
    114113    }
    115114
    116     function get_authors_from_post() {
    117         $formnames = array ();
    118         $selectnames = array ();
    119 
    120         foreach ($_POST['user'] as $key => $line) {
    121             $newname = trim(stripslashes($line));
    122             if ($newname == '')
    123                 $newname = 'left_blank'; //passing author names from step 1 to step 2 is accomplished by using POST. left_blank denotes an empty entry in the form.
    124             array_push($formnames, "$newname");
    125         } // $formnames is the array with the form entered names
    126 
    127         foreach ($_POST['userselect'] as $user => $key) {
    128             $selected = trim(stripslashes($key));
    129             array_push($selectnames, "$selected");
    130         }
    131 
    132         $count = count($formnames);
    133         for ($i = 0; $i < $count; $i ++) {
    134             if ($selectnames[$i] != '#NONE#') { //if no name was selected from the select menu, use the name entered in the form
    135                 array_push($this->newauthornames, "$selectnames[$i]");
    136             } else {
    137                 array_push($this->newauthornames, "$formnames[$i]");
    138             }
    139         }
    140     }
    141 
    142115    function wp_authors_form() {
    143116?>
     
    155128            ++ $j;
    156129            echo '<li>'.__('Current author:').' <strong>'.$author.'</strong><br />'.sprintf(__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user[]'.'" maxlength="30"> <br />');
    157             $this->users_form($j);
     130            $this->users_form($author);
    158131            echo '</li>';
    159132        }
     
    308281
    309282        $this->file = get_attached_file($this->id);
    310         $this->get_authors_from_post();
    311283        $this->get_entries();
    312284        $this->process_categories();
Note: See TracChangeset for help on using the changeset viewer.