From 38d0e93746f13b12af360eb614ba5353e93ecf83 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 3 Apr 2012 19:27:45 +0300 Subject: Some very minor code style changes and comment fixes --- system/libraries/Encrypt.php | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'system/libraries/Encrypt.php') diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php index b29eb470e..54b5bf737 100644 --- a/system/libraries/Encrypt.php +++ b/system/libraries/Encrypt.php @@ -38,15 +38,15 @@ */ class CI_Encrypt { - public $encryption_key = ''; - protected $_hash_type = 'sha1'; - protected $_mcrypt_exists = FALSE; + public $encryption_key = ''; + protected $_hash_type = 'sha1'; + protected $_mcrypt_exists = FALSE; protected $_mcrypt_cipher; protected $_mcrypt_mode; public function __construct() { - $this->_mcrypt_exists = ( ! function_exists('mcrypt_encrypt')) ? FALSE : TRUE; + $this->_mcrypt_exists = function_exists('mcrypt_encrypt'); log_message('debug', 'Encrypt Class Initialized'); } @@ -349,8 +349,8 @@ class CI_Encrypt { * * Function description * - * @param type - * @return type + * @param string + * @return string */ protected function _remove_cipher_noise($data, $key) { @@ -382,8 +382,8 @@ class CI_Encrypt { /** * Set the Mcrypt Cipher * - * @param constant - * @return string + * @param int + * @return object */ public function set_cipher($cipher) { @@ -396,8 +396,8 @@ class CI_Encrypt { /** * Set the Mcrypt Mode * - * @param constant - * @return string + * @param int + * @return object */ public function set_mode($mode) { @@ -410,7 +410,7 @@ class CI_Encrypt { /** * Get Mcrypt cipher Value * - * @return string + * @return int */ protected function _get_cipher() { @@ -427,7 +427,7 @@ class CI_Encrypt { /** * Get Mcrypt Mode Value * - * @return string + * @return int */ protected function _get_mode() { @@ -464,7 +464,8 @@ class CI_Encrypt { { return ($this->_hash_type === 'sha1') ? sha1($str) : md5($str); } + } /* End of file Encrypt.php */ -/* Location: ./system/libraries/Encrypt.php */ +/* Location: ./system/libraries/Encrypt.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 0688ac9ad88a03f1c56cfcd9e3c475b83301344d Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Fri, 20 Apr 2012 10:25:04 -0400 Subject: Start comment cleanup of libraries --- system/libraries/Encrypt.php | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'system/libraries/Encrypt.php') diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php index 54b5bf737..17437c1ca 100644 --- a/system/libraries/Encrypt.php +++ b/system/libraries/Encrypt.php @@ -38,12 +38,44 @@ */ class CI_Encrypt { + /** + * Reference to the user's encryption key + * + * @var string + */ public $encryption_key = ''; + + /** + * Type of hash operation + * + * @var string + */ protected $_hash_type = 'sha1'; + + /** + * Flag for the existance of mcrypt + * + * @var bool + */ protected $_mcrypt_exists = FALSE; + + /** + * Current cipher to be used with mcrypt + * + * @var string + */ protected $_mcrypt_cipher; + + /** + * Method for encrypting/decrypting data + * + * @var int + */ protected $_mcrypt_mode; + /** + * Initialize Encryption class + */ public function __construct() { $this->_mcrypt_exists = function_exists('mcrypt_encrypt'); @@ -349,7 +381,8 @@ class CI_Encrypt { * * Function description * - * @param string + * @param string $data + * @param string $key * @return string */ protected function _remove_cipher_noise($data, $key) -- cgit v1.2.3-24-g4f1b From 5645479c622eb36cf9869797896dc0921568c4a9 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 17 May 2012 14:32:19 +0300 Subject: Clean up the libraries --- system/libraries/Encrypt.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'system/libraries/Encrypt.php') diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php index 17437c1ca..751557fab 100644 --- a/system/libraries/Encrypt.php +++ b/system/libraries/Encrypt.php @@ -44,28 +44,28 @@ class CI_Encrypt { * @var string */ public $encryption_key = ''; - + /** * Type of hash operation - * + * * @var string */ protected $_hash_type = 'sha1'; - + /** * Flag for the existance of mcrypt * * @var bool */ protected $_mcrypt_exists = FALSE; - + /** * Current cipher to be used with mcrypt * * @var string */ protected $_mcrypt_cipher; - + /** * Method for encrypting/decrypting data * @@ -75,6 +75,8 @@ class CI_Encrypt { /** * Initialize Encryption class + * + * @return void */ public function __construct() { -- cgit v1.2.3-24-g4f1b From d261b1e89c3d4d5191036d5a5660ef6764e593a0 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sat, 2 Jun 2012 11:12:16 +0100 Subject: Replaced `==` with `===` and `!=` with `!==` in /system/libraries --- system/libraries/Encrypt.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'system/libraries/Encrypt.php') diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php index 751557fab..102b1dfdd 100644 --- a/system/libraries/Encrypt.php +++ b/system/libraries/Encrypt.php @@ -97,9 +97,9 @@ class CI_Encrypt { */ public function get_key($key = '') { - if ($key == '') + if ($key === '') { - if ($this->encryption_key != '') + if ($this->encryption_key !== '') { return $this->encryption_key; } @@ -449,7 +449,7 @@ class CI_Encrypt { */ protected function _get_cipher() { - if ($this->_mcrypt_cipher == '') + if ($this->_mcrypt_cipher === '') { return $this->_mcrypt_cipher = MCRYPT_RIJNDAEL_256; } @@ -466,7 +466,7 @@ class CI_Encrypt { */ protected function _get_mode() { - if ($this->_mcrypt_mode == '') + if ($this->_mcrypt_mode === '') { return $this->_mcrypt_mode = MCRYPT_MODE_CBC; } -- cgit v1.2.3-24-g4f1b From 79eca3d6e5e3aec576410e3c533164d29196b0eb Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 4 Jun 2012 18:28:50 +0300 Subject: Fix issue #1423 --- system/libraries/Encrypt.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries/Encrypt.php') diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php index 102b1dfdd..959e2eea8 100644 --- a/system/libraries/Encrypt.php +++ b/system/libraries/Encrypt.php @@ -449,7 +449,7 @@ class CI_Encrypt { */ protected function _get_cipher() { - if ($this->_mcrypt_cipher === '') + if ($this->_mcrypt_cipher === NULL) { return $this->_mcrypt_cipher = MCRYPT_RIJNDAEL_256; } @@ -466,7 +466,7 @@ class CI_Encrypt { */ protected function _get_mode() { - if ($this->_mcrypt_mode === '') + if ($this->_mcrypt_mode === NULL) { return $this->_mcrypt_mode = MCRYPT_MODE_CBC; } -- cgit v1.2.3-24-g4f1b From ba7f50bf6553e2f4a3b81da9d5c2c9811e4022c8 Mon Sep 17 00:00:00 2001 From: Joffrey Jaffeux Date: Wed, 6 Jun 2012 01:40:01 +0200 Subject: replace get_config by config_item --- system/libraries/Encrypt.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'system/libraries/Encrypt.php') diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php index 959e2eea8..ce5e030b0 100644 --- a/system/libraries/Encrypt.php +++ b/system/libraries/Encrypt.php @@ -104,8 +104,7 @@ class CI_Encrypt { return $this->encryption_key; } - $CI =& get_instance(); - $key = $CI->config->item('encryption_key'); + $key = config_item('encryption_key'); if ($key === FALSE) { -- cgit v1.2.3-24-g4f1b