Changeset 1822254
- Timestamp:
- 02/14/2018 06:52:44 PM (8 years ago)
- Location:
- userecho
- Files:
-
- 2 edited
- 3 copied
-
tags/1.0.11 (copied) (copied from userecho/trunk)
-
tags/1.0.11/readme.txt (copied) (copied from userecho/trunk/readme.txt) (2 diffs)
-
tags/1.0.11/userecho.php (copied) (copied from userecho/trunk/userecho.php) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/userecho.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
userecho/tags/1.0.11/readme.txt
r1821744 r1822254 4 4 Tags: feedback, users community, widget, ideas, helpdesk, livechat 5 5 Requires at least: 2.8 6 Tested up to: 4.9. 17 Stable tag: 1.0.1 06 Tested up to: 4.9.4 7 Stable tag: 1.0.11 8 8 9 9 Integrate UserEcho - customer feedback and helpdesk system into your blog. Using widget or link. Support SSO. … … 45 45 == Changelog == 46 46 47 = 1.0.11 = 48 * SSO integration - mcrypt module is deprecated in php 7.2.0 (replace with openssl) 47 49 = 1.0.10 = 48 50 * SSO integration - Add case when the WordPress login page is not default (wp-login.php) -
userecho/tags/1.0.11/userecho.php
r1821744 r1822254 2 2 /* 3 3 Plugin Name: UserEcho for Wordpress - collect feedback for your blog 4 Version: 1.0.1 04 Version: 1.0.11 5 5 Plugin URI: https://userecho.com 6 6 Author: UserEcho … … 495 495 class UeSsoCipher 496 496 { 497 const BLOCK_SIZE = 16; 498 497 const CIPHER = "AES-256-CBC"; 499 498 /* 500 Generate sso_token499 Generates sso_token 501 500 @param $key - your sso_key 502 501 @param $data_json - prepared data in json format 503 @return string502 @returns string 504 503 */ 505 504 public function encrypt($key, $data_json) 506 505 { 507 506 // add expires if does not exist 508 if (!array_key_exists('expires',$data_json)) 509 { 507 if (!array_key_exists('expires',$data_json)){ 510 508 # add 1 hour 511 509 $data_json['expires'] = time()+3600; 512 510 } 513 514 $iv = $this->getRandomString(self::BLOCK_SIZE); 515 $raw = $this->pad(json_encode($data_json)); 516 $cipher = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', 'cbc', ''); 517 mcrypt_generic_init($cipher, $key, $iv); 518 $encryptedBytes = mcrypt_generic($cipher, $raw); 519 mcrypt_generic_deinit($cipher); 520 return urlencode(base64_encode($iv . $encryptedBytes)); 521 } 522 523 /* Padding string */ 524 private function pad($raw) 525 { 526 $pad = self::BLOCK_SIZE - (strlen($raw) % self::BLOCK_SIZE); 527 return ($pad == self::BLOCK_SIZE)? $raw : $raw . str_repeat(chr($pad), $pad); 528 } 529 530 private function getRandomString($length) 531 { 532 $str = 'abcdefjhigklmnopqrstuvwzxyABCDEFGHJKLMNPQRSTUVWXYZ123456789'; 533 $strLength = strlen($str); 534 $res = ''; 535 for ($i = 0; $i < $length; $i++) { 536 $res .= $str[rand(0, $strLength - 1)]; 537 } 538 return $res; 511 $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length($cipher=self::CIPHER)); 512 $ciphertext_raw = openssl_encrypt(json_encode($data_json), self::CIPHER, $key, $options=OPENSSL_RAW_DATA, $iv); 513 return urlencode(base64_encode($iv . $ciphertext_raw)); 539 514 } 540 515 } … … 542 517 $ue = new UserEcho(); 543 518 544 # Redirect back to UE after login if it's login via SSO519 # Redirects back to UE after login if it's login via SSO 545 520 add_filter( 'login_redirect', 'ue_sso_login_redirect', 10, 3 ); 546 521 function ue_sso_login_redirect($url, $request, $user) { -
userecho/trunk/readme.txt
r1821744 r1822254 4 4 Tags: feedback, users community, widget, ideas, helpdesk, livechat 5 5 Requires at least: 2.8 6 Tested up to: 4.9. 17 Stable tag: 1.0.1 06 Tested up to: 4.9.4 7 Stable tag: 1.0.11 8 8 9 9 Integrate UserEcho - customer feedback and helpdesk system into your blog. Using widget or link. Support SSO. … … 45 45 == Changelog == 46 46 47 = 1.0.11 = 48 * SSO integration - mcrypt module is deprecated in php 7.2.0 (replace with openssl) 47 49 = 1.0.10 = 48 50 * SSO integration - Add case when the WordPress login page is not default (wp-login.php) -
userecho/trunk/userecho.php
r1821744 r1822254 2 2 /* 3 3 Plugin Name: UserEcho for Wordpress - collect feedback for your blog 4 Version: 1.0.1 04 Version: 1.0.11 5 5 Plugin URI: https://userecho.com 6 6 Author: UserEcho … … 495 495 class UeSsoCipher 496 496 { 497 const BLOCK_SIZE = 16; 498 497 const CIPHER = "AES-256-CBC"; 499 498 /* 500 Generate sso_token499 Generates sso_token 501 500 @param $key - your sso_key 502 501 @param $data_json - prepared data in json format 503 @return string502 @returns string 504 503 */ 505 504 public function encrypt($key, $data_json) 506 505 { 507 506 // add expires if does not exist 508 if (!array_key_exists('expires',$data_json)) 509 { 507 if (!array_key_exists('expires',$data_json)){ 510 508 # add 1 hour 511 509 $data_json['expires'] = time()+3600; 512 510 } 513 514 $iv = $this->getRandomString(self::BLOCK_SIZE); 515 $raw = $this->pad(json_encode($data_json)); 516 $cipher = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', 'cbc', ''); 517 mcrypt_generic_init($cipher, $key, $iv); 518 $encryptedBytes = mcrypt_generic($cipher, $raw); 519 mcrypt_generic_deinit($cipher); 520 return urlencode(base64_encode($iv . $encryptedBytes)); 521 } 522 523 /* Padding string */ 524 private function pad($raw) 525 { 526 $pad = self::BLOCK_SIZE - (strlen($raw) % self::BLOCK_SIZE); 527 return ($pad == self::BLOCK_SIZE)? $raw : $raw . str_repeat(chr($pad), $pad); 528 } 529 530 private function getRandomString($length) 531 { 532 $str = 'abcdefjhigklmnopqrstuvwzxyABCDEFGHJKLMNPQRSTUVWXYZ123456789'; 533 $strLength = strlen($str); 534 $res = ''; 535 for ($i = 0; $i < $length; $i++) { 536 $res .= $str[rand(0, $strLength - 1)]; 537 } 538 return $res; 511 $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length($cipher=self::CIPHER)); 512 $ciphertext_raw = openssl_encrypt(json_encode($data_json), self::CIPHER, $key, $options=OPENSSL_RAW_DATA, $iv); 513 return urlencode(base64_encode($iv . $ciphertext_raw)); 539 514 } 540 515 } … … 542 517 $ue = new UserEcho(); 543 518 544 # Redirect back to UE after login if it's login via SSO519 # Redirects back to UE after login if it's login via SSO 545 520 add_filter( 'login_redirect', 'ue_sso_login_redirect', 10, 3 ); 546 521 function ue_sso_login_redirect($url, $request, $user) {
Note: See TracChangeset
for help on using the changeset viewer.