Ticket #10396: 10396_b.diff
File 10396_b.diff, 2.6 KB (added by , 15 years ago) |
---|
-
wp-admin/install.php
66 66 <td><input name="weblog_title" type="text" id="weblog_title" size="25" value="<?php echo ( isset($_POST['weblog_title']) ? esc_attr($_POST['weblog_title']) : '' ); ?>" /></td> 67 67 </tr> 68 68 <tr> 69 <th scope="row"><label for="user_name"><?php _e('User Name'); ?></label></th> 70 <td> 71 <?php if (username_exists('admin')) { echo 'admin <input type="hidden" id="user_name" value="admin" />'; } else { ?><input name="user_name" type="text" id="user_name" size="25" value="<?php echo ( isset($_POST['user_name']) ? esc_attr($_POST['user_name']) : '' ); ?>" /><?php } ?> 72 </td> 73 </tr> 74 <tr> 69 75 <th scope="row"><label for="admin_email"><?php _e('Your E-mail'); ?></label></th> 70 76 <td><input name="admin_email" type="text" id="admin_email" size="25" value="<?php echo ( isset($_POST['admin_email']) ? esc_attr($_POST['admin_email']) : '' ); ?>" /><br /> 71 77 <?php _e('Double-check your email address before continuing.'); ?></td> … … 106 112 display_header(); 107 113 // Fill in the data we gathered 108 114 $weblog_title = isset($_POST['weblog_title']) ? stripslashes($_POST['weblog_title']) : ''; 115 $user_name = isset($_POST['user_name']) ? stripslashes($_POST['user_name']) : ''; 109 116 $admin_email = isset($_POST['admin_email']) ? stripslashes($_POST['admin_email']) : ''; 110 117 $public = isset($_POST['blog_public']) ? (int) $_POST['blog_public'] : 0; 111 118 // check e-mail address … … 114 121 // TODO: poka-yoke 115 122 display_setup_form( __('you must provide an e-mail address.') ); 116 123 $error = true; 124 } else if (empty($user_name)) { 125 // TODO: poka-yoke 126 display_setup_form( __('you must provide a valid user name.') ); 127 $error = true; 117 128 } else if (!is_email($admin_email)) { 118 129 // TODO: poka-yoke 119 130 display_setup_form( __('that isn’t a valid e-mail address. E-mail addresses look like: <code>username@example.com</code>') ); 120 131 $error = true; 121 132 } 133 // Don't allow a second administrator on a re-install 134 if (username_exists('admin')) { 135 $user_name = 'admin' 136 } 122 137 123 138 if ( $error === false ) { 124 139 $wpdb->show_errors(); 125 $result = wp_install($weblog_title, 'admin', $admin_email, $public);140 $result = wp_install($weblog_title, $user_name, $admin_email, $public); 126 141 extract($result, EXTR_SKIP); 127 142 ?> 128 143 … … 133 148 <table class="form-table"> 134 149 <tr> 135 150 <th><?php _e('Username'); ?></th> 136 <td><code> admin</code></td>151 <td><code><?php echo $user_name; ?></code></td> 137 152 </tr> 138 153 <tr> 139 154 <th><?php _e('Password'); ?></th>