Ticket #10396: 10396_g.diff
File 10396_g.diff, 13.2 KB (added by , 15 years ago) |
---|
-
wp-admin/includes/upgrade.php
33 33 * @param null $deprecated Optional. Not used. 34 34 * @return array Array keys 'url', 'user_id', 'password', 'password_message'. 35 35 */ 36 function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated = '' ) {36 function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '' ) { 37 37 global $wp_rewrite; 38 38 39 39 if ( !empty( $deprecated ) ) … … 60 60 // Create default user. If the user already exists, the user tables are 61 61 // being shared among blogs. Just set the role in that case. 62 62 $user_id = username_exists($user_name); 63 if ( !$user_id ) {64 $ random_password = wp_generate_password();63 if ( !$user_id && $user_password == '' ) { 64 $user_password = wp_generate_password(); 65 65 $message = __('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.'); 66 $user_id = wp_create_user($user_name, $random_password, $user_email); 67 update_user_option($user_id, 'default_password_nag', true, true); 66 $user_id = wp_create_user($user_name, $user_password, $user_email); 67 update_usermeta($user_id, 'default_password_nag', true); 68 } else if ( !$user_id ) { 69 $message = __('<strong><em>Note that password</em></strong> carefully!'); 70 $user_id = wp_create_user($user_name, $user_password, $user_email); 68 71 } else { 69 $random_password = '';70 72 $message = __('User already exists. Password inherited.'); 71 73 } 72 74 … … 77 79 78 80 $wp_rewrite->flush_rules(); 79 81 80 wp_new_blog_notification($blog_title, $guessurl, $user_id, $ random_password);82 wp_new_blog_notification($blog_title, $guessurl, $user_id, $user_password); 81 83 82 84 wp_cache_flush(); 83 85 84 return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $ random_password, 'password_message' => $message);86 return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message); 85 87 } 86 88 endif; 87 89 -
wp-admin/css/install.css
1 html{background:#f7f7f7;}body{background:#fff;color:#333;font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;margin:2em auto 0 auto;width:700px;padding:1em 2em;-moz-border-radius:11px;-khtml-border-radius:11px;-webkit-border-radius:11px;border-radius:11px;border:1px solid #dfdfdf;}a{color:#2583ad;text-decoration:none;}a:hover{color:#d54e21;}h1{border-bottom:1px solid #dadada;clear:both;color:#666;font:24px Georgia,"Times New Roman",Times,serif;margin:5px 0 0 -4px;padding:0;padding-bottom:7px;}h2{font-size:16px;}p,li{padding-bottom:2px;font-size:12px;line-height:18px;}code{font-size:13px;}ul,ol{padding:5px 5px 5px 22px;}#logo{margin:6px 0 14px 0;border-bottom:none;}.step{margin:20px 0 15px;}.step,th{text-align:left;padding:0;}.submit input,.button,.button-secondary{font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;text-decoration:none;font-size:14px!important;line-height:16px;padding:6px 12px;cursor:pointer;border:1px solid #bbb;color:#464646;-moz-border-radius:15px;-khtml-border-radius:15px;-webkit-border-radius:15px;border-radius:15px;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;-khtml-box-sizing:content-box;box-sizing:content-box;}.button:hover,.button-secondary:hover,.submit input:hover{color:#000;border-color:#666;}.button,.submit input,.button-secondary{background:#f2f2f2 url(../images/white-grad.png) repeat-x scroll left top;}.button:active,.submit input:active,.button-secondary:active{background:#eee url(../images/white-grad-active.png) repeat-x scroll left top;}.form-table{border-collapse:collapse;margin-top:1em;width:100%;}.form-table td{margin-bottom:9px;padding:10px;border-bottom:8px solid #fff;font-size:12px;}.form-table th{font-size:13px;text-align:left;padding:16px 10px 10px 10px;border-bottom:8px solid #fff;width:110px;vertical-align:top;}.form-table tr{background:#f3f3f3;}.form-table code{line-height:18px;font-size:18px;}.form-table p{margin:4px 0 0 0;font-size:11px;}.form-table input{line-height:20px;font-size:15px;padding:2px;}#error-page{margin-top:50px;}#error-page p{font-size:12px;line-height:18px;margin:25px 0 20px;}#error-page code{font-family:Consolas,Monaco,Courier,monospace;} 2 No newline at end of file 1 html{background:#f7f7f7;}body{background:#fff;color:#333;font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;margin:2em auto 0 auto;width:700px;padding:1em 2em;-moz-border-radius:11px;-khtml-border-radius:11px;-webkit-border-radius:11px;border-radius:11px;border:1px solid #dfdfdf;}a{color:#2583ad;text-decoration:none;}a:hover{color:#d54e21;}h1{border-bottom:1px solid #dadada;clear:both;color:#666;font:24px Georgia,"Times New Roman",Times,serif;margin:5px 0 0 -4px;padding:0;padding-bottom:7px;}h2{font-size:16px;}p,li{padding-bottom:2px;font-size:12px;line-height:18px;}code{font-size:13px;}ul,ol{padding:5px 5px 5px 22px;}#logo{margin:6px 0 14px 0;border-bottom:none;}.step{margin:20px 0 15px;}.step,th{text-align:left;padding:0;}.submit input,.button,.button-secondary{font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;text-decoration:none;font-size:14px!important;line-height:16px;padding:6px 12px;cursor:pointer;border:1px solid #bbb;color:#464646;-moz-border-radius:15px;-khtml-border-radius:15px;-webkit-border-radius:15px;border-radius:15px;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;-khtml-box-sizing:content-box;box-sizing:content-box;}.button:hover,.button-secondary:hover,.submit input:hover{color:#000;border-color:#666;}.button,.submit input,.button-secondary{background:#f2f2f2 url(../images/white-grad.png) repeat-x scroll left top;}.button:active,.submit input:active,.button-secondary:active{background:#eee url(../images/white-grad-active.png) repeat-x scroll left top;}.form-table{border-collapse:collapse;margin-top:1em;width:100%;}.form-table td{margin-bottom:9px;padding:10px;border-bottom:8px solid #fff;font-size:12px;}.form-table th{font-size:13px;text-align:left;padding:16px 10px 10px 10px;border-bottom:8px solid #fff;width:110px;vertical-align:top;}.form-table tr{background:#f3f3f3;}.form-table code{line-height:18px;font-size:18px;}.form-table p{margin:4px 0 0 0;font-size:11px;}.form-table input{line-height:20px;font-size:15px;padding:2px;}#error-page{margin-top:50px;}#error-page p{font-size:12px;line-height:18px;margin:25px 0 20px;}#error-page code{font-family:Consolas,Monaco,Courier,monospace;}#pass-strength-result {background-color: #EEEEEE;border-color: #DDDDDD !important;border-style: solid;border-width: 1px;float: left;margin: 12px 5px 5px 1px;padding: 5px;text-align: center;width: 200px;}#pass-strength-result.bad {background-color: #FFB78C;border-color: #FF853C !important;}#pass-strength-result.good {background-color: #FFEC8B;border-color: #FFCC00 !important;}#pass-strength-result.short {background-color: #FFA0A0;border-color: #F04040 !important;}#pass-strength-result.strong {background-color: #C3FF88;border-color: #8DFF1C !important;} -
wp-admin/css/install.dev.css
131 131 } 132 132 133 133 #error-page code { font-family: Consolas, Monaco, Courier, monospace; } 134 135 #pass-strength-result { 136 background-color: #EEEEEE; 137 border-color: #DDDDDD !important; 138 border-style: solid; 139 border-width: 1px; 140 float: left; 141 margin: 12px 5px 5px 1px; 142 padding: 5px; 143 text-align: center; 144 width: 200px; 145 } 146 147 #pass-strength-result.bad { 148 background-color: #FFB78C; 149 border-color: #FF853C !important; 150 } 151 152 #pass-strength-result.good { 153 background-color: #FFEC8B; 154 border-color: #FFCC00 !important; 155 } 156 157 #pass-strength-result.short { 158 background-color: #FFA0A0; 159 border-color: #F04040 !important; 160 } 161 162 #pass-strength-result.strong { 163 background-color: #C3FF88; 164 border-color: #8DFF1C !important; 165 } -
wp-admin/install.php
20 20 /** Load WordPress Administration Upgrade API */ 21 21 require_once(dirname(__FILE__) . '/includes/upgrade.php'); 22 22 23 /** Load wpdb */ 24 require_once(dirname(dirname(__FILE__)) . '/wp-includes/wp-db.php'); 25 23 26 if (isset($_GET['step'])) 24 27 $step = $_GET['step']; 25 28 else … … 49 52 }//end function display_header(); 50 53 51 54 function display_setup_form( $error = null ) { 55 global $wpdb; 56 $user_table = ( $wpdb->get_var("SHOW TABLES LIKE '$table_name'") != null ) ? true : false; 57 52 58 // Ensure that Blogs appear in search engines by default 53 59 $blog_public = 1; 54 60 if ( isset($_POST) && !empty($_POST) ) { … … 66 72 <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 73 </tr> 68 74 <tr> 75 <th scope="row"><label for="user_name"><?php _e('User Name'); ?></label></th> 76 <td> 77 <?php if ( $user_table ) { _e('User(s) already exists.'); } else { ?><input name="user_name" type="text" id="user_login" size="25" value="<?php echo ( isset($_POST['user_name']) ? esc_attr($_POST['user_name']) : 'admin' ); ?>" /><?php } ?> 78 </td> 79 </tr> 80 <tr> 81 <th scope="row"><label for="admin_password"><?php _e('Password'); ?></label></th> 82 <td> 83 <?php if ( $user_table ) { 84 _e('No user is being created, so no new password is needed.'); 85 } 86 else { 87 ?><input name="admin_password" type="password" id="pass1" size="25" value="<?php echo ( isset($_POST['admin_password']) ? esc_attr($_POST['admin_password']) : '' ); ?>" /> 88 <br /><?php _e('A password will be automatically generated for you if this field is blank.'); ?> 89 <br /><div id="pass-strength-result"><?php _e('Strength indicator'); ?></div> 90 <p class="description indicator-hint"><?php _e('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ & ).'); ?></p><?php 91 } ?> 92 </td> 93 </tr> 94 <tr> 69 95 <th scope="row"><label for="admin_email"><?php _e('Your E-mail'); ?></label></th> 70 96 <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 97 <?php _e('Double-check your email address before continuing.'); ?></td> … … 123 149 display_header(); 124 150 // Fill in the data we gathered 125 151 $weblog_title = isset($_POST['weblog_title']) ? stripslashes($_POST['weblog_title']) : ''; 152 $user_name = isset($_POST['user_name']) ? stripslashes($_POST['user_name']) : ''; 153 $admin_password = isset($_POST['admin_password']) ? stripslashes($_POST['admin_password']) : ''; 126 154 $admin_email = isset($_POST['admin_email']) ? stripslashes($_POST['admin_email']) : ''; 127 155 $public = isset($_POST['blog_public']) ? (int) $_POST['blog_public'] : 0; 128 156 // check e-mail address 129 157 $error = false; 130 if ( empty($admin_email)) {158 if ( empty( $user_name ) ) { 131 159 // TODO: poka-yoke 160 display_setup_form( __('you must provide a valid user name.') ); 161 $error = true; 162 } else if ( empty( $admin_email ) ) { 163 // TODO: poka-yoke 132 164 display_setup_form( __('you must provide an e-mail address.') ); 133 165 $error = true; 134 } else if ( !is_email($admin_email)) {166 } else if ( !is_email( $admin_email ) ) { 135 167 // TODO: poka-yoke 136 168 display_setup_form( __('that isn’t a valid e-mail address. E-mail addresses look like: <code>username@example.com</code>') ); 137 169 $error = true; … … 139 171 140 172 if ( $error === false ) { 141 173 $wpdb->show_errors(); 142 $result = wp_install($weblog_title, 'admin', $admin_email, $public);174 $result = wp_install($weblog_title, $user_name, $admin_email, $public, '', $admin_password); 143 175 extract($result, EXTR_SKIP); 144 176 ?> 145 177 … … 150 182 <table class="form-table"> 151 183 <tr> 152 184 <th><?php _e('Username'); ?></th> 153 <td><code> admin</code></td>185 <td><code><?php echo esc_html($user_name); ?></code></td> 154 186 </tr> 155 187 <tr> 156 188 <th><?php _e('Password'); ?></th> 157 189 <td><?php if ( !empty( $password ) ) { 158 echo '<code>'. $password.'</code><br />';190 echo '<code>'. esc_html($password) .'</code><br />'; 159 191 } 160 192 echo '<p>'. $password_message .'</p>'; ?></td> 161 193 </tr> … … 169 201 } 170 202 ?> 171 203 <script type="text/javascript">var t = document.getElementById('weblog_title'); if (t){ t.focus(); }</script> 204 <script type="text/javascript" src="../wp-includes/js/jquery/jquery.js"></script> 205 <script type="text/javascript" src="js/password-strength-meter.js"></script> 206 <script type="text/javascript" src="js/user-profile.js"></script> 207 <script type="text/javascript" src="js/utils.js"></script> 208 <script type='text/javascript'> 209 /* <![CDATA[ */ 210 try{convertEntities(commonL10n);}catch(e){}; 211 var pwsL10n = { 212 empty: "Strength indicator", 213 short: "Very weak", 214 bad: "Weak", 215 good: "Medium", 216 strong: "Strong" 217 }; 218 try{convertEntities(pwsL10n);}catch(e){}; 219 /* ]]> */ 220 </script> 172 221 </body> 173 222 </html>