Changeset 8540 for trunk/wp-admin/update.php
- Timestamp:
- 08/04/2008 09:01:09 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/update.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/update.php
r8060 r8540 5 5 if ( ! current_user_can('update_plugins') ) 6 6 wp_die(__('You do not have sufficient permissions to update plugins for this blog.')); 7 8 function request_filesystem_credentials($form_post, $type = '', $error = false) {9 $req_cred = apply_filters('request_filesystem_credentials', '', $form_post, $type, $error);10 if ( '' !== $req_cred )11 return $req_cred;12 13 if ( empty($type) )14 $type = get_filesystem_method();15 16 if ( 'direct' == $type )17 return true;18 19 if( ! $credentials = get_option('ftp_credentials') )20 $credentials = array();21 // 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)22 $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? $_POST['hostname'] : $credentials['hostname']);23 $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? $_POST['username'] : $credentials['username']);24 $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? $_POST['password'] : $credentials['password']);25 $credentials['ssl'] = defined('FTP_SSL') ? FTP_SSL : ( isset($_POST['ssl']) ? $_POST['ssl'] : $credentials['ssl']);26 27 if ( ! $error && !empty($credentials['password']) && !empty($credentials['username']) && !empty($credentials['hostname']) ) {28 $stored_credentials = $credentials;29 unset($stored_credentials['password']);30 update_option('ftp_credentials', $stored_credentials);31 return $credentials;32 }33 $hostname = '';34 $username = '';35 $password = '';36 $ssl = '';37 if ( !empty($credentials) )38 extract($credentials, EXTR_OVERWRITE);39 if( $error )40 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>';41 ?>42 <form action="<?php echo $form_post ?>" method="post">43 <div class="wrap">44 <h2><?php _e('FTP Connection Information') ?></h2>45 <p><?php _e('To perform the requested update, FTP connection information is required.') ?></p>46 <table class="form-table">47 <tr valign="top">48 <th scope="row"><label for="hostname"><?php _e('Hostname:') ?></label></th>49 <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>50 </tr>51 <tr valign="top">52 <th scope="row"><label for="username"><?php _e('Username:') ?></label></th>53 <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>54 </tr>55 <tr valign="top">56 <th scope="row"><label for="password"><?php _e('Password:') ?></label></th>57 <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>58 </tr>59 <tr valign="top">60 <th scope="row"><label for="ssl"><?php _e('Use SSL:') ?></label></th>61 <td>62 <select name="ssl" id="ssl"<?php if( defined('FTP_SSL') ) echo ' disabled="disabled"' ?>>63 <?php64 foreach ( array(0 => __('No'), 1 => __('Yes')) as $key => $value ) :65 $selected = ($ssl == $value) ? 'selected="selected"' : '';66 echo "\n\t<option value='$key' $selected>" . $value . '</option>';67 endforeach;68 ?>69 </select>70 </td>71 </tr>72 </table>73 <p class="submit">74 <input type="submit" name="submit" value="<?php _e('Proceed'); ?>" />75 </p>76 </div>77 </form>78 <?php79 return false;80 }81 82 function show_message($message) {83 if( is_wp_error($message) ){84 if( $message->get_error_data() )85 $message = $message->get_error_message() . ': ' . $message->get_error_data();86 else87 $message = $message->get_error_message();88 }89 echo "<p>$message</p>\n";90 }91 7 92 8 function do_plugin_upgrade($plugin) {
Note: See TracChangeset
for help on using the changeset viewer.