Plugin Directory

Changeset 1822254


Ignore:
Timestamp:
02/14/2018 06:52:44 PM (8 years ago)
Author:
MVR
Message:

tagging version 1.0.11

Location:
userecho
Files:
2 edited
3 copied

Legend:

Unmodified
Added
Removed
  • userecho/tags/1.0.11/readme.txt

    r1821744 r1822254  
    44Tags: feedback, users community, widget, ideas, helpdesk, livechat
    55Requires at least: 2.8
    6 Tested up to: 4.9.1
    7 Stable tag: 1.0.10
     6Tested up to: 4.9.4
     7Stable tag: 1.0.11
    88
    99Integrate UserEcho - customer feedback and helpdesk system into your blog. Using widget or link. Support SSO.
     
    4545== Changelog ==
    4646
     47= 1.0.11 =
     48* SSO integration - mcrypt module is deprecated in php 7.2.0 (replace with openssl)
    4749= 1.0.10 =
    4850* SSO integration - Add case when the WordPress login page is not default (wp-login.php)
  • userecho/tags/1.0.11/userecho.php

    r1821744 r1822254  
    22/*
    33Plugin Name: UserEcho for Wordpress - collect feedback for your blog
    4 Version: 1.0.10
     4Version: 1.0.11
    55Plugin URI: https://userecho.com
    66Author: UserEcho
     
    495495class UeSsoCipher
    496496{
    497     const BLOCK_SIZE = 16;
    498 
     497    const CIPHER = "AES-256-CBC";
    499498    /*
    500         Generate sso_token
     499        Generates sso_token
    501500        @param  $key - your sso_key
    502501        @param  $data_json - prepared data in json format
    503         @return string
     502        @returns string
    504503     */
    505504    public function encrypt($key, $data_json)
    506505    {
    507506        // add expires if does not exist
    508         if (!array_key_exists('expires',$data_json))
    509         {
     507        if (!array_key_exists('expires',$data_json)){
    510508            # add 1 hour
    511509            $data_json['expires'] = time()+3600;
    512510        }
    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));
    539514    }
    540515}
     
    542517$ue = new UserEcho();
    543518
    544 # Redirect back to UE after login if it's login via SSO
     519# Redirects back to UE after login if it's login via SSO
    545520add_filter( 'login_redirect', 'ue_sso_login_redirect', 10, 3 );
    546521function ue_sso_login_redirect($url, $request, $user) {
  • userecho/trunk/readme.txt

    r1821744 r1822254  
    44Tags: feedback, users community, widget, ideas, helpdesk, livechat
    55Requires at least: 2.8
    6 Tested up to: 4.9.1
    7 Stable tag: 1.0.10
     6Tested up to: 4.9.4
     7Stable tag: 1.0.11
    88
    99Integrate UserEcho - customer feedback and helpdesk system into your blog. Using widget or link. Support SSO.
     
    4545== Changelog ==
    4646
     47= 1.0.11 =
     48* SSO integration - mcrypt module is deprecated in php 7.2.0 (replace with openssl)
    4749= 1.0.10 =
    4850* SSO integration - Add case when the WordPress login page is not default (wp-login.php)
  • userecho/trunk/userecho.php

    r1821744 r1822254  
    22/*
    33Plugin Name: UserEcho for Wordpress - collect feedback for your blog
    4 Version: 1.0.10
     4Version: 1.0.11
    55Plugin URI: https://userecho.com
    66Author: UserEcho
     
    495495class UeSsoCipher
    496496{
    497     const BLOCK_SIZE = 16;
    498 
     497    const CIPHER = "AES-256-CBC";
    499498    /*
    500         Generate sso_token
     499        Generates sso_token
    501500        @param  $key - your sso_key
    502501        @param  $data_json - prepared data in json format
    503         @return string
     502        @returns string
    504503     */
    505504    public function encrypt($key, $data_json)
    506505    {
    507506        // add expires if does not exist
    508         if (!array_key_exists('expires',$data_json))
    509         {
     507        if (!array_key_exists('expires',$data_json)){
    510508            # add 1 hour
    511509            $data_json['expires'] = time()+3600;
    512510        }
    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));
    539514    }
    540515}
     
    542517$ue = new UserEcho();
    543518
    544 # Redirect back to UE after login if it's login via SSO
     519# Redirects back to UE after login if it's login via SSO
    545520add_filter( 'login_redirect', 'ue_sso_login_redirect', 10, 3 );
    546521function ue_sso_login_redirect($url, $request, $user) {
Note: See TracChangeset for help on using the changeset viewer.