Changeset 11495
- Timestamp:
- 05/30/2009 05:14:07 PM (16 years ago)
- Location:
- trunk/wp-admin/includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-wp-filesystem-ftpext.php
r11082 r11495 48 48 49 49 // Check if the options provided are OK. 50 if ( empty 50 if ( empty($opt['username']) ) 51 51 $this->errors->add('empty_username', __('FTP username is required')); 52 52 else 53 53 $this->options['username'] = $opt['username']; 54 54 55 if ( empty 55 if ( empty($opt['password']) ) 56 56 $this->errors->add('empty_password', __('FTP password is required')); 57 57 else … … 59 59 60 60 $this->options['ssl'] = false; 61 if ( isset($opt['ssl']) ) 62 $this->options['ssl'] = ( !empty($opt['ssl']) ); 63 elseif ( isset( $opt['connection_type']) ) 64 $this->options['ssl'] = ( 'ftps' == $opt['connection_type'] ); 61 if ( isset($opt['connection_type']) && 'ftps' == $opt['connection_type'] ) 62 $this->options['ssl'] = true; 65 63 } 66 64 67 65 function connect() { 68 66 if ( isset($this->options['ssl']) && $this->options['ssl'] && function_exists('ftp_ssl_connect') ) 69 $this->link = @ftp_ssl_connect($this->options['hostname'], $this->options['port'], $this->timeout);70 else 71 $this->link = @ftp_connect($this->options['hostname'], $this->options['port'], $this->timeout);67 $this->link = @ftp_ssl_connect($this->options['hostname'], $this->options['port'], $this->timeout); 68 else 69 $this->link = @ftp_connect($this->options['hostname'], $this->options['port'], $this->timeout); 72 70 73 71 if ( ! $this->link ) { -
trunk/wp-admin/includes/file.php
r11465 r11495 594 594 return false; 595 595 596 $abstraction_file = apply_filters('filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method); 597 if( ! file_exists($abstraction_file) ) 598 return; 599 600 require_once($abstraction_file); 596 if ( ! class_exists("WP_Filesystem_$method") ) { 597 $abstraction_file = apply_filters('filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method); 598 if( ! file_exists($abstraction_file) ) 599 return; 600 601 require_once($abstraction_file); 602 } 601 603 $method = "WP_Filesystem_$method"; 602 604 … … 686 688 unset($credentials['port']); 687 689 688 if ( defined('FTP_SSH') || ( isset($_POST['connection_type']) && 'ssh' == $_POST['connection_type']) )690 if ( defined('FTP_SSH') || (defined('FS_METHOD') && 'ssh' == FS_METHOD) ) 689 691 $credentials['connection_type'] = 'ssh'; 690 else if ( defined('FTP_SSL') || (isset($_POST['connection_type']) && 'ftps' == $_POST['connection_type']) )692 else if ( defined('FTP_SSL') && 'ftpext' == $type ) //Only the FTP Extension understands SSL 691 693 $credentials['connection_type'] = 'ftps'; 692 else if ( !isset($credentials['connection_type']) || (isset($_POST['connection_type']) && 'ftp' == $_POST['connection_type']) ) 694 else if ( !empty($_POST['connection_type']) ) 695 $credentials['connection_type'] = $_POST['connection_type']; 696 else if ( !isset($credentials['connection_type']) ) //All else fails (And its not defaulted to something else saved), Default to FTP 693 697 $credentials['connection_type'] = 'ftp'; 694 698 … … 751 755 <tr valign="top"> 752 756 <th scope="row"><label for="password"><?php _e('Password') ?></label></th> 753 <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) ) echo '<em>'.__('(Password not shown)').'</em>'; ?></td>757 <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> 754 758 </tr> 755 759 760 <?php if ( extension_loaded('ssh2') ) : ?> 756 761 <tr id="ssh_keys" valign="top" style="<?php if ( 'ssh' != $connection_type ) echo 'display:none' ?>"> 757 762 <th scope="row"><?php _e('Authentication Keys') ?> … … 763 768 <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> 764 769 </tr> 770 <?php endif; ?> 765 771 766 772 <tr valign="top"> … … 768 774 <td> 769 775 <fieldset><legend class="screen-reader-text"><span><?php _e('Connection Type') ?></span></legend> 770 <label><input id="ftp" name="connection_type" type="radio" value="ftp" <?php checked('ftp', $connection_type); if ( defined('FTP_SSL') || defined('FTP_SSH') ) echo ' disabled="disabled"'; ?>/> <?php _e('FTP') ?></label><br /> 771 <label><input id="ftps" name="connection_type" type="radio" value="ftps" <?php checked('ftps', $connection_type); if ( defined('FTP_SSH') || defined('FTP_SSH') ) echo ' disabled="disabled"'; ?>/> <?php _e('FTPS (SSL)') ?></label><br /> 772 <?php if ( extension_loaded('ssh2') ) { ?><label><input id="ssh" name="connection_type" type="radio" value="ssh" <?php checked('ssh', $connection_type); if ( defined('FTP_SSL') || defined('FTP_SSH') ) echo ' disabled="disabled"'; ?>/> <?php _e('SSH') ?></label><?php } ?> 776 <label><input id="ftp" name="connection_type" type="radio" value="ftp" <?php checked('ftp', $connection_type); if ( defined('FTP_SSL') || defined('FTP_SSH') ) echo ' disabled="disabled"'; ?>/> <?php _e('FTP') ?></label> 777 <?php if ( 'ftpext' == $type ) : ?> 778 <br /><label><input id="ftps" name="connection_type" type="radio" value="ftps" <?php checked('ftps', $connection_type); if ( defined('FTP_SSL') || defined('FTP_SSH') ) echo ' disabled="disabled"'; ?>/> <?php _e('FTPS (SSL)') ?></label> 779 <?php endif; ?> 780 <?php if ( extension_loaded('ssh2') ) : ?> 781 <br /><label><input id="ssh" name="connection_type" type="radio" value="ssh" <?php checked('ssh', $connection_type); if ( defined('FTP_SSL') || defined('FTP_SSH') ) echo ' disabled="disabled"'; ?>/> <?php _e('SSH') ?></label> 782 <?php endif; ?> 773 783 </fieldset> 774 784 </td>
Note: See TracChangeset
for help on using the changeset viewer.