Esempio n. 1
0
 /**
  * Decrypt $value using public $type method in Security class
  * @param array $values Values to decrypt
  * @return string decrypted string
  */
 protected static function decrypt($values)
 {
     $decrypted = null;
     if (!is_array($values)) {
         $values = array($values);
         $decrypted = null;
     } else {
         $decrypted = array();
     }
     foreach ((array) $values as $name => $value) {
         if (is_array($value)) {
             $decryptedVal = self::decrypt($value);
         } else {
             $pos = strpos($value, self::$encryptionPrefix);
             if ($pos === false) {
                 $decryptedVal = self::explode($value);
             } else {
                 $value = substr($value, strlen(self::$encryptionPrefix));
                 $decryptedVal = self::explode(Crypt::cookie_decrypt(base64_decode($value), self::getEncryptionKey()));
             }
         }
         if (is_array($decrypted)) {
             $decrypted[$name] = $decryptedVal;
         } else {
             $decrypted = $decryptedVal;
         }
     }
     return $decrypted;
 }