WordPress.org

Make WordPress Core

Ticket #10043: 10043.diff

File 10043.diff, 2.3 KB (added by dd32, 9 years ago)
  • wp-admin/includes/file.php

     
    678678        $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? $_POST['hostname'] : $credentials['hostname']);
    679679        $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? $_POST['username'] : $credentials['username']);
    680680        $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? $_POST['password'] : '');
     681        $credentials['store_details'] = isset($_POST['store_details']) ? (bool)$_POST['store_details'] : true;
    681682
    682683        // Check to see if we are setting the public/private keys for ssh
    683684        $credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : (!empty($_POST['public_key']) ? $_POST['public_key'] : '');
     
    710711                        $stored_credentials['hostname'] .= ':' . $stored_credentials['port'];
    711712
    712713                unset($stored_credentials['password'], $stored_credentials['port'], $stored_credentials['private_key'], $stored_credentials['public_key']);
     714                if ( ! $stored_credentials['store_details'] ) //Clear all details if user doesnt want to store their options.
     715                        $stored_credentials = array('store_details' => false );
     716
    713717                update_option('ftp_credentials', $stored_credentials);
    714718                return $credentials;
    715719        }
     
    717721        $username = '';
    718722        $password = '';
    719723        $connection_type = '';
     724        $store_details = true;
    720725        if ( !empty($credentials) )
    721726                extract($credentials, EXTR_OVERWRITE);
    722727        if ( $error ) {
     
    760765<th scope="row"><label for="password"><?php _e('Password') ?></label></th>
    761766<td><input name="password" type="password" id="password" value="<?php if ( defined('FTP_PASS') ) echo '*****'; ?>"<?php if ( defined('FTP_PASS') ) echo ' disabled="disabled"' ?> size="40" /></td>
    762767</tr>
     768<tr valign="top">
     769<th scope="row" colspan="2"><input type="checkbox" name="store_details" id="store_details" <?php checked($store_details, true); ?> /><label for="store_details"><?php _e('Remember hostname and Username') ?></label></th>
     770</tr>
    763771
    764772<?php if ( extension_loaded('ssh2') ) : ?>
    765773<tr id="ssh_keys" valign="top" style="<?php if ( 'ssh' != $connection_type ) echo 'display:none' ?>">