Ticket #5586: 5586.10.diff
File 5586.10.diff, 3.6 KB (added by , 17 years ago) |
---|
-
wp-admin/update.php
11 11 12 12 if ( 'direct' == $type ) 13 13 return array(); 14 15 if( ! $credentials = get_option('ftp_credentials') ) 16 $credentials = array(); 17 // If defined, set it to that, Else, If POST'd, set it to that, If not, Set it to whatever it previously was(saved details in option) 18 $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? $_POST['hostname'] : $credentials['hostname']); 19 $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? $_POST['username'] : $credentials['username']); 20 $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? $_POST['password'] : $credentials['password']); 21 $credentials['ssl'] = defined('FTP_SSL') ? FTP_SSL : (!empty($_POST['ssl']) ? $_POST['ssl'] : $credentials['ssl']); 14 22 15 if ( ! $error && !empty($_POST['password']) && !empty($_POST['username']) && !empty($_POST['hostname']) ) { 16 $credentials = array('hostname' => $_POST['hostname'], 'username' => $_POST['username'], 17 'password' => $_POST['password'], 'ssl' => $_POST['ssl']); 23 if ( ! $error && !empty($credentials['password']) && !empty($credentials['username']) && !empty($credentials['hostname']) ) { 18 24 $stored_credentials = $credentials; 19 25 unset($stored_credentials['password']); 20 26 update_option('ftp_credentials', $stored_credentials); … … 24 30 $username = ''; 25 31 $password = ''; 26 32 $ssl = ''; 27 if ( $credentials = get_option('ftp_credentials') )33 if ( !empty($credentials) ) 28 34 extract($credentials, EXTR_OVERWRITE); 29 if( $error ) {35 if( $error ) 30 36 echo '<div id="message" class="error"><p>' . __('<strong>Error:</strong> There was an error connecting to the server, Please verify the settings are correct.') . '</p></div>'; 31 }32 37 ?> 33 38 <form action="<?php echo $form_post ?>" method="post"> 34 39 <div class="wrap"> … … 37 42 <table class="form-table"> 38 43 <tr valign="top"> 39 44 <th scope="row"><?php _e('Hostname:') ?></th> 40 <td><input name="hostname" type="text" id="hostname" value="<?php echo attribute_escape($hostname) ?>" size="40" /></td>45 <td><input name="hostname" type="text" id="hostname" value="<?php echo attribute_escape($hostname) ?>"<?php if( defined('FTP_HOST') ) echo ' disabled="disabled"' ?> size="40" /></td> 41 46 </tr> 42 47 <tr valign="top"> 43 48 <th scope="row"><?php _e('Username:') ?></th> 44 <td><input name="username" type="text" id="username" value="<?php echo attribute_escape($username) ?>" size="40" /></td>49 <td><input name="username" type="text" id="username" value="<?php echo attribute_escape($username) ?>"<?php if( defined('FTP_USER') ) echo ' disabled="disabled"' ?> size="40" /></td> 45 50 </tr> 46 51 <tr valign="top"> 47 52 <th scope="row"><?php _e('Password:') ?></th> 48 <td><input name="password" type="password" id="password" value=" <?php echo attribute_escape($password) ?>" size="40" /></td>53 <td><input name="password" type="password" id="password" value=""<?php if( defined('FTP_PASS') ) echo ' disabled="disabled"' ?> size="40" /><?php if( defined('FTP_PASS') && !empty($password) ) _e('<em>(Password not shown)</em>'); ?></td> 49 54 </tr> 50 55 <tr valign="top"> 51 56 <th scope="row"><?php _e('Use SSL:') ?></th> 52 57 <td> 53 <select name="ssl" id="ssl" >58 <select name="ssl" id="ssl"<?php if( defined('FTP_SSL') ) echo ' disabled="disabled"' ?>> 54 59 <?php 55 60 foreach ( array(0 => __('No'), 1 => __('Yes')) as $key => $value ) : 56 61 $selected = ($ssl == $value) ? 'selected="selected"' : '';