Changeset 773028
- Timestamp:
- 09/16/2013 02:25:10 AM (13 years ago)
- Location:
- post-by-email/trunk
- Files:
-
- 3 edited
-
class-post-by-email-admin.php (modified) (3 diffs)
-
class-post-by-email.php (modified) (1 diff)
-
views/admin.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
post-by-email/trunk/class-post-by-email-admin.php
r773024 r773028 84 84 $default_options = Post_By_Email::$default_options; 85 85 86 $mailserver_url = trim( $input['mailserver_url'] ); 87 if ( $mailserver_url != $default_options['mailserver_url'] ) { 88 $options['mailserver_url'] = $mailserver_url; 89 } 86 $options['mailserver_url'] = trim( $input['mailserver_url'] ); 90 87 91 88 $mailserver_protocol = trim( $input['mailserver_protocol'] ); 92 if ( in_array( $ options['mailserver_protocol'], array( 'POP3', 'IMAP' ) ) ) {89 if ( in_array( $mailserver_protocol, array( 'POP3', 'IMAP' ) ) ) { 93 90 $options['mailserver_protocol'] = $mailserver_protocol; 94 91 } … … 100 97 } 101 98 102 $mailserver_login = trim( $input['mailserver_login'] ); 103 if ( $mailserver_login != $default_options['mailserver_login'] ) { 104 $options['mailserver_login'] = $mailserver_login; 105 } 106 107 $mailserver_pass = trim( $input['mailserver_pass'] ); 108 if ( '' != $mailserver_pass ) { 109 $options['mailserver_pass'] = $mailserver_pass; 110 } 99 $options['mailserver_login'] = trim( $input['mailserver_login'] ); 100 $options['mailserver_pass'] = trim( $input['mailserver_pass'] ); 111 101 112 102 // default email category must be the ID of a real category … … 119 109 $options['delete_messages'] = isset( $input['delete_messages'] ) && '' != $input['delete_messages']; 120 110 121 if ( $options['mailserver_url'] && $options['mailserver_port'] 122 && $options['mailserver_login'] && $options['mailserver_pass'] ) { 123 124 // clear the transient and any error conditions if options have been updated 111 $options['pin_required'] = isset( $input['pin_required'] ) && '' != $input['pin_required']; 112 $options['pin'] = trim( $input['pin'] ); 113 114 // this is ridiculous 115 if ( isset ( $input['status'] ) && in_array( $input['status'], array( 'unconfigured', 'error', '') ) ) { 116 // maintain saved state 117 $options['status'] = $input['status']; 118 } 119 elseif ( ( $options['mailserver_url'] == $default_options['mailserver_url'] ) 120 || ( '' == $options['mailserver_url'] ) 121 || ( $options['mailserver_login'] == $default_options['mailserver_login'] ) 122 || ( '' == $options['mailserver_login'] ) 123 || ( '' == $options['mailserver_pass'] ) 124 || ( '' == $options['mailserver_port'] ) 125 || ( '' == $options['mailserver_protocol' ] ) 126 ) { 127 // detect if settings are blank or defaults 128 $options['status'] = 'unconfigured'; 129 } 130 else { 131 // clear the transient and any error conditions if we have good options now 125 132 delete_transient( 'mailserver_last_checked' ); 126 133 $options['status'] = ''; 127 134 } 128 129 $options['pin_required'] = isset( $input['pin_required'] ) && '' != $input['pin_required'];130 $options['pin'] = trim( $input['pin'] );131 135 132 136 return $options; -
post-by-email/trunk/class-post-by-email.php
r773023 r773028 236 236 237 237 $options = get_option( 'post_by_email_options' ); 238 239 // if options aren't set, there's nothing to do, move along 240 if ( 'unconfigured' == $options['status'] ) { 241 return; 242 } 243 238 244 $options['last_checked'] = current_time( 'timestamp' ); 239 245 $options['status'] = ''; 240 246 update_option( 'post_by_email_options', $options ); 241 242 // if options aren't set, there's nothing to do, move along243 if ( 'unconfigured' == $options['status'] ) {244 return;245 }246 247 247 248 $this->connection = $this->open_mailbox_connection( $options ); -
post-by-email/trunk/views/admin.php
r773023 r773028 242 242 </p> 243 243 <p> 244 <a href="<?php echo add_query_arg( 'check_mail', true ); ?>" class="button-secondary"> 244 <a href="<?php echo add_query_arg( 'check_mail', true ); ?>" class="button-secondary" 245 <?php if ( 'unconfigured' == $options['status'] ) { echo 'disabled'; } ?> > 245 246 <?php _e( 'Check now', 'post-by-email' ); ?> 246 247 </a>
Note: See TracChangeset
for help on using the changeset viewer.