Plugin Directory

Changeset 599294


Ignore:
Timestamp:
09/15/2012 02:17:51 PM (14 years ago)
Author:
jankarres
Message:

Update to 1.0.2; Edits see changelog in readme.txt

Location:
wp-pocket
Files:
2 edited
4 copied

Legend:

Unmodified
Added
Removed
  • wp-pocket/tags/1.0.2/readme.txt

    r598959 r599294  
    55Requires at least: 3.4
    66Tested up to: 3.4
    7 Stable tag: 1.0.1
     7Stable tag: 1.0.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5252== Changelog ==
    5353
    54 = 1.0 =
    55 Initial release
     54= 1.0.2 =
     55Fix encryption bug of the Pocket username, password and api key
     56Introduce version number in class
    5657
    5758= 1.0.1 =
    5859Fix encoding bug
     60
     61= 1.0 =
     62Initial release
    5963
    6064== Upgrade notice ==
  • wp-pocket/tags/1.0.2/wp-pocket.php

    r599051 r599294  
    66    Author: Jan Karres
    77    Author URI: http://www.jankarres.de/
    8     Version: 1.0.1
     8    Version: 1.0.2
    99*/
    1010
     
    1212    class wppocketer {
    1313        private $wpdb;
     14        private $version;
    1415       
    1516        // Pocket default API-Key by developer
     
    2122            // Set database
    2223            $this->wpdb = $wpdb;
     24           
     25            // Set plugin version
     26            $this->version = '1.0.2';
    2327       
    2428            // Check WP version
     
    6670
    6771        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           
    6884            // Create database table for links
    6985            $sql = '
     
    84100                `autoload`
    85101            ) VALUES
     102                ("wppocket_version", "' . $this->version . '", "yes"),
    86103                ("wppocket_links_to_use", "0", "yes"),
    87104                ("wppocket_order", "0", "yes"),
     
    115132            ';
    116133            $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            }
    117140        }
    118141
     
    138161       
    139162        // En- and decrypt strings
    140         private function xcrypt($mode, $string) {
     163        private function xcrypt($mode, $string, $nosalt = false) {
    141164            /*
    142165             * Required parameters:
     
    145168             */
    146169           
    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            }
    150175           
    151176            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']))));
    153178            }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");
    155180            }else { // False mode
    156181                return false;
  • wp-pocket/trunk/readme.txt

    r598959 r599294  
    55Requires at least: 3.4
    66Tested up to: 3.4
    7 Stable tag: 1.0.1
     7Stable tag: 1.0.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5252== Changelog ==
    5353
    54 = 1.0 =
    55 Initial release
     54= 1.0.2 =
     55Fix encryption bug of the Pocket username, password and api key
     56Introduce version number in class
    5657
    5758= 1.0.1 =
    5859Fix encoding bug
     60
     61= 1.0 =
     62Initial release
    5963
    6064== Upgrade notice ==
  • wp-pocket/trunk/wp-pocket.php

    r599051 r599294  
    66    Author: Jan Karres
    77    Author URI: http://www.jankarres.de/
    8     Version: 1.0.1
     8    Version: 1.0.2
    99*/
    1010
     
    1212    class wppocketer {
    1313        private $wpdb;
     14        private $version;
    1415       
    1516        // Pocket default API-Key by developer
     
    2122            // Set database
    2223            $this->wpdb = $wpdb;
     24           
     25            // Set plugin version
     26            $this->version = '1.0.2';
    2327       
    2428            // Check WP version
     
    6670
    6771        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           
    6884            // Create database table for links
    6985            $sql = '
     
    84100                `autoload`
    85101            ) VALUES
     102                ("wppocket_version", "' . $this->version . '", "yes"),
    86103                ("wppocket_links_to_use", "0", "yes"),
    87104                ("wppocket_order", "0", "yes"),
     
    115132            ';
    116133            $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            }
    117140        }
    118141
     
    138161       
    139162        // En- and decrypt strings
    140         private function xcrypt($mode, $string) {
     163        private function xcrypt($mode, $string, $nosalt = false) {
    141164            /*
    142165             * Required parameters:
     
    145168             */
    146169           
    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            }
    150175           
    151176            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']))));
    153178            }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");
    155180            }else { // False mode
    156181                return false;
Note: See TracChangeset for help on using the changeset viewer.