本文整理汇总了PHP中Horde::requireSecureConnection方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde::requireSecureConnection方法的具体用法?PHP Horde::requireSecureConnection怎么用?PHP Horde::requireSecureConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde
的用法示例。
在下文中一共展示了Horde::requireSecureConnection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkPassphrase
/**
* AJAX action: Check passphrase.
*
* Variables required in form input:
* - dialog_input: (string) Input from the dialog screen.
* - reload: (mixed) If set, reloads page instead of returning data.
* - symmetricid: (string) The symmetric ID to process.
* - type: (string) The passphrase type.
*
* @return boolean True on success.
*/
public function checkPassphrase()
{
global $injector, $notification;
$result = false;
if (!$this->vars->dialog_input) {
$notification->push(_("No passphrase entered."), 'horde.error');
return $result;
}
try {
Horde::requireSecureConnection();
switch ($this->vars->type) {
case 'pgpPersonal':
$result = $injector->getInstance('IMP_Pgp')->storePassphrase('personal', $this->vars->dialog_input);
break;
case 'pgpSymmetric':
$result = $injector->getInstance('IMP_Pgp')->storePassphrase('symmetric', $this->vars->dialog_input, $this->vars->symmetricid);
break;
case 'smimePersonal':
$result = $injector->getInstance('IMP_Smime')->storePassphrase($this->vars->dialog_input, $this->vars->secondary);
break;
}
if ($result) {
$notification->push(_("Passphrase verified."), 'horde.success');
} else {
$notification->push(_("Invalid passphrase entered."), 'horde.error');
}
} catch (Horde_Exception $e) {
$notification->push($e, 'horde.error');
}
return $result && $this->vars->reload ? new Horde_Core_Ajax_Response_HordeCore_Reload($this->vars->reload) : $result;
}
示例2: checkPassphrase
/**
* AJAX action: Check passphrase.
*
* Variables required in form input:
* - dialog_input: (string) Input from the dialog screen.
* - reload: (mixed) If set, reloads page instead of returning data.
* - symmetricid: (string) The symmetric ID to process.
* - type: (string) The passphrase type.
*
* @return boolean True on success.
*/
public function checkPassphrase()
{
global $injector, $notification;
$result = false;
try {
Horde::requireSecureConnection();
switch ($this->vars->type) {
case 'pgpPersonal':
case 'pgpSymmetric':
if ($this->vars->dialog_input) {
$imp_pgp = $injector->getInstance('IMP_Crypt_Pgp');
if ($this->vars->type == 'pgpPersonal' && $imp_pgp->storePassphrase('personal', $this->vars->dialog_input) || $this->vars->type == 'pgpSymmetric' && $imp_pgp->storePassphrase('symmetric', $this->vars->dialog_input, $this->vars->symmetricid)) {
$result = true;
$notification->push(_("PGP passhprase stored in session."), 'horde.success');
} else {
$notification->push(_("Invalid passphrase entered."), 'horde.error');
}
} else {
$notification->push(_("No passphrase entered."), 'horde.error');
}
break;
case 'smimePersonal':
if ($this->vars->dialog_input) {
$imp_smime = $injector->getInstance('IMP_Crypt_Smime');
if ($imp_smime->storePassphrase($this->vars->dialog_input)) {
$result = true;
$notification->push(_("S/MIME passphrase stored in session."), 'horde.success');
} else {
$notification->push(_("Invalid passphrase entered."), 'horde.error');
}
} else {
$notification->push(_("No passphrase entered."), 'horde.error');
}
break;
}
} catch (Horde_Exception $e) {
$notification->push($e, 'horde.error');
}
return $result && $this->vars->reload ? new Horde_Core_Ajax_Response_HordeCore_Reload($this->vars->reload) : $result;
}