Changeset 543280
- Timestamp:
- 05/12/2012 11:25:51 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
smtp/trunk/smtp.php
r402025 r543280 2 2 /* 3 3 Plugin Name: SMTP 4 Version: 1. 05 Plugin URI: http://hel.io/wordpress/smtp 4 Version: 1.1 5 Plugin URI: http://hel.io/wordpress/smtp/ 6 6 Description: Allows you to configure and use a SMTP server (such as Gmail) for sending emails. 7 7 Author: Sorin Iclanzan 8 8 Author URI: http://hel.io/ 9 9 */ 10 11 // Key used for encrypting and decrypting passwords 12 define( CRYPT_KEY, '-J5:2Yqd?Ri9wLjN' ); 10 13 11 14 // This is run when you activate the plugin, adding the default options to the database … … 149 152 function smtp_password() { 150 153 $options = get_option('smtp_options'); 151 echo "<input id='password' name='smtp_options[password]' type=' text' class='regular-text' value='{$options['password']}'/>";154 echo "<input id='password' name='smtp_options[password]' type='password' value='' " . $options['password'] ? "placeholder='••••••••••'" : "" . " />"; 152 155 } 153 156 … … 173 176 if ($input['password'] == '') 174 177 $input['password'] = $smtp_options['password']; 178 else 179 $input['password'] = encrypt_string( $input['password'], CRYPT_KEY ); 175 180 176 181 return $input; 182 } 183 184 /* 185 * Encrypt $string using $key 186 */ 187 function encrypt_string( $string, $key ) { 188 return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, md5(md5($key)))); 189 } 190 191 /* 192 * Decrypt $string using $key 193 */ 194 function decrypt_string( $string, $key ) { 195 return rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($encrypted), MCRYPT_MODE_CBC, md5(md5($key))), "\0"); 177 196 } 178 197 … … 206 225 $phpmailer->SMTPAuth = true; 207 226 $phpmailer->Username = $smtp_options['username']; 208 $phpmailer->Password = $smtp_options['password'];227 $phpmailer->Password = decrypt_string( $smtp_options['password'], CRYPT_KEY ); 209 228 } 210 229 }
Note: See TracChangeset
for help on using the changeset viewer.