Skip to content

Commit

Permalink
Revert "This can be moved to Deprecated class"
Browse files Browse the repository at this point in the history
This reverts commit 995b655.

Not worth it.
  • Loading branch information
slusarz committed Feb 6, 2014
1 parent bc440f5 commit d57b13a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 24 deletions.
28 changes: 23 additions & 5 deletions framework/Imap_Client/lib/Horde/Imap/Client/Base.php
Expand Up @@ -309,6 +309,22 @@ public function __construct(array $params = array())
$this->_initOb();
}

/**
* Get encryption key.
*
* @deprecated Pass callable into 'password' parameter instead.
*
* @return string The encryption key.
*/
protected function _getEncryptKey()
{
if (is_callable($ekey = $this->getParam('encryptKey'))) {
return call_user_func($ekey);
}

throw new InvalidArgumentException('encryptKey parameter is not a valid callback.');
}

/**
* Do initialization tasks.
*/
Expand Down Expand Up @@ -504,12 +520,14 @@ public function getParam($key)
return $this->_params[$key]->getPassword();
}

// @deprecated
// DEPRECATED
if (!empty($this->_params['_passencrypt'])) {
return Horde_Imap_Client_Base_Deprecated::getEncryptKey(
$this,
$this->_params['password']
);
try {
$secret = new Horde_Secret();
return $secret->read($this->_getEncryptKey(), $this->_params['password']);
} catch (Exception $e) {
return null;
}
}
break;
}
Expand Down
19 changes: 0 additions & 19 deletions framework/Imap_Client/lib/Horde/Imap/Client/Base/Deprecated.php
Expand Up @@ -106,23 +106,4 @@ static public function parseCacheId($id)
return $info;
}

/**
* Get encryption key.
*
* @deprecated Pass callable into 'password' parameter instead.
*
* @return string The encryption key.
*/
static public function getEncryptKey($base, $password)
{
if (is_callable($ekey = $base->getParam('encryptKey'))) {
try {
$secret = new Horde_Secret();
return $secret->read(call_user_func($ekey), $password);
} catch (Exception $e) {}
}

return null;
}

}

0 comments on commit d57b13a

Please sign in to comment.