Changeset 599294
- Timestamp:
- 09/15/2012 02:17:51 PM (14 years ago)
- Location:
- wp-pocket
- Files:
-
- 2 edited
- 4 copied
-
tags/1.0.2 (copied) (copied from wp-pocket/trunk)
-
tags/1.0.2/readme.txt (copied) (copied from wp-pocket/trunk/readme.txt) (2 diffs)
-
tags/1.0.2/screenshot-1.png (copied) (copied from wp-pocket/trunk/screenshot-1.png)
-
tags/1.0.2/wp-pocket.php (copied) (copied from wp-pocket/trunk/wp-pocket.php) (8 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/wp-pocket.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-pocket/tags/1.0.2/readme.txt
r598959 r599294 5 5 Requires at least: 3.4 6 6 Tested up to: 3.4 7 Stable tag: 1.0. 17 Stable tag: 1.0.2 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 52 52 == Changelog == 53 53 54 = 1.0 = 55 Initial release 54 = 1.0.2 = 55 Fix encryption bug of the Pocket username, password and api key 56 Introduce version number in class 56 57 57 58 = 1.0.1 = 58 59 Fix encoding bug 60 61 = 1.0 = 62 Initial release 59 63 60 64 == Upgrade notice == -
wp-pocket/tags/1.0.2/wp-pocket.php
r599051 r599294 6 6 Author: Jan Karres 7 7 Author URI: http://www.jankarres.de/ 8 Version: 1.0. 18 Version: 1.0.2 9 9 */ 10 10 … … 12 12 class wppocketer { 13 13 private $wpdb; 14 private $version; 14 15 15 16 // Pocket default API-Key by developer … … 21 22 // Set database 22 23 $this->wpdb = $wpdb; 24 25 // Set plugin version 26 $this->version = '1.0.2'; 23 27 24 28 // Check WP version … … 66 70 67 71 function activate() { 72 // Check if version under 1.0.2, if true, replace Pocket username, password and api-key 73 $version = explode('.', get_option('wppocket_version')); 74 if ( 75 ($version[0] == 1 && $version[1] == 0 && $version[2] < 2) || 76 ($version[0] == '' && $version[1] == '' && $version[2] == '') 77 ) { 78 // Update Pocket username, password and api-key 79 update_option('wppocket_pocket_username', $this->xcrypt(0, $this->xcrypt(1, get_option('wppocket_pocket_username'), true))); 80 update_option('wppocket_pocket_password', $this->xcrypt(0, $this->xcrypt(1, get_option('wppocket_pocket_password'), true))); 81 update_option('wppocket_pocket_api_key', $this->xcrypt(0, $this->xcrypt(1, get_option('wppocket_pocket_api_key'), true))); 82 } 83 68 84 // Create database table for links 69 85 $sql = ' … … 84 100 `autoload` 85 101 ) VALUES 102 ("wppocket_version", "' . $this->version . '", "yes"), 86 103 ("wppocket_links_to_use", "0", "yes"), 87 104 ("wppocket_order", "0", "yes"), … … 115 132 '; 116 133 $this->wpdb->query($sql); 134 135 // Check if plugin version number up to date 136 if (get_option('wppocket_version') != $this->version) { 137 // Update version number 138 update_option('wppocket_version', $this->version); 139 } 117 140 } 118 141 … … 138 161 139 162 // En- and decrypt strings 140 private function xcrypt($mode, $string ) {163 private function xcrypt($mode, $string, $nosalt = false) { 141 164 /* 142 165 * Required parameters: … … 145 168 */ 146 169 147 // Get crypt keys 148 $sql = 'SELECT `wppocket_key_a`, `wppocket_key_b` FROM `' . $this->wpdb->prefix . 'options`'; 149 $keys = $this->wpdb->get_row($sql); 170 // Get crypt keys, if should 171 if (!$nosalt) { 172 $keys['a'] = get_option('wppocket_key_a'); 173 $key['b'] = get_option('wppocket_key_b'); 174 } 150 175 151 176 if ($mode == 0) { // Encrypt 152 return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($keys ->wppocket_key_a), $string, MCRYPT_MODE_CBC, md5(md5($keys->wppocket_key_b))));177 return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($keys['a']), $string, MCRYPT_MODE_CBC, md5(md5($keys['b'])))); 153 178 }elseif ($mode == 1) { // Decrypt 154 return rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($keys ->wppocket_key_a), base64_decode($string), MCRYPT_MODE_CBC, md5(md5($keys->wppocket_key_b))), "\0");179 return rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($keys['a']), base64_decode($string), MCRYPT_MODE_CBC, md5(md5($keys['b']))), "\0"); 155 180 }else { // False mode 156 181 return false; -
wp-pocket/trunk/readme.txt
r598959 r599294 5 5 Requires at least: 3.4 6 6 Tested up to: 3.4 7 Stable tag: 1.0. 17 Stable tag: 1.0.2 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 52 52 == Changelog == 53 53 54 = 1.0 = 55 Initial release 54 = 1.0.2 = 55 Fix encryption bug of the Pocket username, password and api key 56 Introduce version number in class 56 57 57 58 = 1.0.1 = 58 59 Fix encoding bug 60 61 = 1.0 = 62 Initial release 59 63 60 64 == Upgrade notice == -
wp-pocket/trunk/wp-pocket.php
r599051 r599294 6 6 Author: Jan Karres 7 7 Author URI: http://www.jankarres.de/ 8 Version: 1.0. 18 Version: 1.0.2 9 9 */ 10 10 … … 12 12 class wppocketer { 13 13 private $wpdb; 14 private $version; 14 15 15 16 // Pocket default API-Key by developer … … 21 22 // Set database 22 23 $this->wpdb = $wpdb; 24 25 // Set plugin version 26 $this->version = '1.0.2'; 23 27 24 28 // Check WP version … … 66 70 67 71 function activate() { 72 // Check if version under 1.0.2, if true, replace Pocket username, password and api-key 73 $version = explode('.', get_option('wppocket_version')); 74 if ( 75 ($version[0] == 1 && $version[1] == 0 && $version[2] < 2) || 76 ($version[0] == '' && $version[1] == '' && $version[2] == '') 77 ) { 78 // Update Pocket username, password and api-key 79 update_option('wppocket_pocket_username', $this->xcrypt(0, $this->xcrypt(1, get_option('wppocket_pocket_username'), true))); 80 update_option('wppocket_pocket_password', $this->xcrypt(0, $this->xcrypt(1, get_option('wppocket_pocket_password'), true))); 81 update_option('wppocket_pocket_api_key', $this->xcrypt(0, $this->xcrypt(1, get_option('wppocket_pocket_api_key'), true))); 82 } 83 68 84 // Create database table for links 69 85 $sql = ' … … 84 100 `autoload` 85 101 ) VALUES 102 ("wppocket_version", "' . $this->version . '", "yes"), 86 103 ("wppocket_links_to_use", "0", "yes"), 87 104 ("wppocket_order", "0", "yes"), … … 115 132 '; 116 133 $this->wpdb->query($sql); 134 135 // Check if plugin version number up to date 136 if (get_option('wppocket_version') != $this->version) { 137 // Update version number 138 update_option('wppocket_version', $this->version); 139 } 117 140 } 118 141 … … 138 161 139 162 // En- and decrypt strings 140 private function xcrypt($mode, $string ) {163 private function xcrypt($mode, $string, $nosalt = false) { 141 164 /* 142 165 * Required parameters: … … 145 168 */ 146 169 147 // Get crypt keys 148 $sql = 'SELECT `wppocket_key_a`, `wppocket_key_b` FROM `' . $this->wpdb->prefix . 'options`'; 149 $keys = $this->wpdb->get_row($sql); 170 // Get crypt keys, if should 171 if (!$nosalt) { 172 $keys['a'] = get_option('wppocket_key_a'); 173 $key['b'] = get_option('wppocket_key_b'); 174 } 150 175 151 176 if ($mode == 0) { // Encrypt 152 return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($keys ->wppocket_key_a), $string, MCRYPT_MODE_CBC, md5(md5($keys->wppocket_key_b))));177 return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($keys['a']), $string, MCRYPT_MODE_CBC, md5(md5($keys['b'])))); 153 178 }elseif ($mode == 1) { // Decrypt 154 return rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($keys ->wppocket_key_a), base64_decode($string), MCRYPT_MODE_CBC, md5(md5($keys->wppocket_key_b))), "\0");179 return rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($keys['a']), base64_decode($string), MCRYPT_MODE_CBC, md5(md5($keys['b']))), "\0"); 155 180 }else { // False mode 156 181 return false;
Note: See TracChangeset
for help on using the changeset viewer.