Make WordPress Core

Changeset 4742


Ignore:
Timestamp:
01/16/2007 03:00:35 AM (18 years ago)
Author:
ryan
Message:

Revert [4735]. Not needed.

File:
1 edited

Legend:

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

    r4735 r4742  
    4242        global $wpdb, $testing;
    4343        $users = $wpdb->get_results("SELECT * FROM $wpdb->users ORDER BY ID");
    44 ?><select name="userselect[<?php echo attribute_escape($n); ?>]">
     44?><select name="userselect[<?php echo $n; ?>]">
    4545    <option value="#NONE#">- Select -</option>
    4646    <?php
     
    101101            }
    102102        }
     103
    103104        // 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.
    104105        $authors[0] = array_shift($temp);
     
    113114    }
    114115
     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
    115142    function wp_authors_form() {
    116143?>
     
    128155            ++ $j;
    129156            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 />');
    130             $this->users_form($author);
     157            $this->users_form($j);
    131158            echo '</li>';
    132159        }
     
    281308
    282309        $this->file = get_attached_file($this->id);
     310        $this->get_authors_from_post();
    283311        $this->get_entries();
    284312        $this->process_categories();
Note: See TracChangeset for help on using the changeset viewer.