Horde::requireSecureConnection PHP Method

requireSecureConnection() public static method

Throws an exception if not using a secure connection.
public static requireSecureConnection ( )
    public static function requireSecureConnection()
    {
        if (!self::isConnectionSecure()) {
            throw new Horde_Exception(Horde_Core_Translation::t("The encryption features require a secure web connection."));
        }
    }

Usage Example

Beispiel #1
0
 /**
  * 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;
 }
All Usage Examples Of Horde::requireSecureConnection