/** * Returns a value from the internal params array. * * @param string $key The param key. * * @return mixed The param value, or null if not found. */ public function getParam($key) { /* Passwords may be stored encrypted. */ if ($key == 'password' && !empty($this->_params['_passencrypt'])) { try { $secret = new Horde_Secret(); return $secret->read($this->_getEncryptKey(), $this->_params['password']); } catch (Exception $e) { return null; } } return isset($this->_params[$key]) ? $this->_params[$key] : null; }
/** * Returns a value from the internal params array. * * @param string $key The param key. * * @return mixed The param value, or null if not found. */ public function getParam($key) { /* Passwords may be stored encrypted. */ switch ($key) { case 'password': case 'xoauth2_token': if (isset($this->_params[$key]) && $this->_params[$key] instanceof Horde_Smtp_Password) { return $this->_params[$key]->getPassword(); } // DEPRECATED if ($key == 'password' && !empty($this->_params['_passencrypt'])) { try { $secret = new Horde_Secret(); return $secret->read($this->_getEncryptKey(), $this->_params['password']); } catch (Exception $e) { return null; } } break; } return isset($this->_params[$key]) ? $this->_params[$key] : null; }
public function testShortKeyRead() { $secret = new Horde_Secret(); $this->assertEquals('', $secret->read('', "")); }