Changeset 11063 for trunk/wp-admin/includes/file.php
- Timestamp:
- 04/22/2009 11:38:01 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/includes/file.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/file.php
r11005 r11063 631 631 } 632 632 633 if ( ! $method && isset($args['connection_type']) && 'ssh' == $args['connection_type'] && extension_loaded('ssh2') ) $method = 'ssh2';633 if ( ! $method && isset($args['connection_type']) && 'ssh' == $args['connection_type'] && extension_loaded('ssh2') && extension_loaded('sockets') ) $method = 'ssh2'; 634 634 if ( ! $method && extension_loaded('ftp') ) $method = 'ftpext'; 635 635 if ( ! $method && ( extension_loaded('sockets') || function_exists('fsockopen') ) ) $method = 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread … … 658 658 return true; 659 659 660 $credentials = get_option('ftp_credentials', array()); 660 $credentials = get_option('ftp_credentials', array( 'hostname' => '', 'username' => '')); 661 661 662 // 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) 662 663 $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? $_POST['hostname'] : $credentials['hostname']); 663 664 $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? $_POST['username'] : $credentials['username']); 664 $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? $_POST['password'] : $credentials['password']);665 $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? $_POST['password'] : ''); 665 666 666 667 // Check to see if we are setting the public/private keys for ssh 667 $credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : (!empty($_POST['public_key']) ? $_POST['public_key'] : $credentials['public_key']);668 $credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : (!empty($_POST['private_key']) ? $_POST['private_key'] : $credentials['private_key']);668 $credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : (!empty($_POST['public_key']) ? $_POST['public_key'] : ''); 669 $credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : (!empty($_POST['private_key']) ? $_POST['private_key'] : ''); 669 670 670 671 //sanitize the hostname, Some people might pass in odd-data: … … 683 684 $credentials['connection_type'] = 'ftp'; 684 685 685 if ( ! $error && !empty($credentials['password']) && !empty($credentials['username']) && !empty($credentials['hostname']) ) { 686 if ( ! $error && 687 ( 688 ( !empty($credentials['password']) && !empty($credentials['username']) && !empty($credentials['hostname']) ) || 689 ( 'ssh' == $credentials['connection_type'] && !empty($credentials['public_key']) && !empty($credentials['private_key']) ) 690 ) ) { 686 691 $stored_credentials = $credentials; 687 692 if ( !empty($stored_credentials['port']) ) //save port as part of hostname to simplify above code. … … 746 751 <label for="private_key"><?php _e('Private Key:') ?></label> 747 752 </div></th> 748 <td><br /><input name="public_key" type="text" id="public_key" value=" "<?php if( defined('FTP_PUBKEY') ) echo ' disabled="disabled"' ?> size="40" /><br /><input name="private_key" type="text" id="private_key" value=""<?php if( defined('FTP_PRIKEY') ) echo ' disabled="disabled"' ?> size="40" />753 <td><br /><input name="public_key" type="text" id="public_key" value="<?php echo attribute_escape($public_key) ?>"<?php if( defined('FTP_PUBKEY') ) echo ' disabled="disabled"' ?> size="40" /><br /><input name="private_key" type="text" id="private_key" value="<?php echo attribute_escape($private_key) ?>"<?php if( defined('FTP_PRIKEY') ) echo ' disabled="disabled"' ?> size="40" /> 749 754 <div><?php _e('Enter the location on the server where the keys are located. If a passphrase is needed, enter that in the password field above.') ?></div></td> 750 755 </tr>
Note: See TracChangeset
for help on using the changeset viewer.