本文整理汇总了PHP中Horde::isConnectionSecure方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde::isConnectionSecure方法的具体用法?PHP Horde::isConnectionSecure怎么用?PHP Horde::isConnectionSecure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde
的用法示例。
在下文中一共展示了Horde::isConnectionSecure方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showPassphrase
/**
* Encryption tests.
*/
function showPassphrase($memo)
{
global $notification;
if (!$memo['body'] instanceof Mnemo_Exception) {
return false;
}
/* Check for secure connection. */
$secure_check = Horde::isConnectionSecure();
if ($memo['body']->getCode() == Mnemo::ERR_NO_PASSPHRASE) {
if ($secure_check) {
$notification->push(_("This note has been encrypted, please provide the password."), 'horde.message');
return true;
}
$notification->push(_("This note has been encrypted, and cannot be decrypted without a secure web connection"), 'horde.error');
$memo['body'] = '';
return false;
}
if ($memo['body']->getCode() == Mnemo::ERR_DECRYPT) {
if ($secure_check) {
$notification->push(_("This note cannot be decrypted:") . ' ' . $memo['body']->getMessage(), 'horde.message');
return true;
}
$notification->push(_("This note has been encrypted, and cannot be decrypted without a secure web connection"), 'horde.error');
$memo['body'] = '';
return false;
}
$notification->push($memo['body'], 'horde.error');
$memo['body'] = '';
return false;
}
示例2: display
/**
*/
public function display(Horde_Core_Prefs_Ui $ui)
{
global $injector, $page_output, $prefs, $session;
$page_output->addScriptPackage('IMP_Script_Package_Imp');
$view = new Horde_View(array('templatePath' => IMP_TEMPLATES . '/prefs'));
$view->addHelper('Horde_Core_View_Helper_Help');
if (!Horde::isConnectionSecure()) {
$view->notsecure = true;
} else {
$smime_url = IMP_Basic_Smime::url();
$view->has_key = $prefs->getValue('smime_public_key') && $prefs->getValue('smime_private_key');
if ($view->has_key) {
$view->viewpublic = Horde::link($smime_url->copy()->add('actionID', 'view_personal_public_key'), _("View Personal Public Certificate"), null, 'view_key');
$view->infopublic = Horde::link($smime_url->copy()->add('actionID', 'info_personal_public_key'), _("Information on Personal Public Certificate"), null, 'info_key');
if ($injector->getInstance('IMP_Crypt_Smime')->getPassphrase()) {
$view->passphrase = Horde::link($ui->selfUrl(array('special' => true, 'token' => true))->add('unset_smime_passphrase', 1), _("Unload Passphrase")) . _("Unload Passphrase");
} else {
$imple = $injector->getInstance('Horde_Core_Factory_Imple')->create('IMP_Ajax_Imple_PassphraseDialog', array('params' => array('reload' => $ui->selfUrl()->setRaw(true)), 'type' => 'smimePersonal'));
$view->passphrase = Horde::link('#', _("Enter Passphrase"), null, null, null, null, null, array('id' => $imple->getDomId())) . _("Enter Passphrase");
}
$view->viewprivate = Horde::link($smime_url->copy()->add('actionID', 'view_personal_private_key'), _("View Personal Private Key"), null, 'view_key');
$page_output->addInlineScript(array('$("delete_smime_personal").observe("click", function(e) { if (!window.confirm(' . json_encode(_("Are you sure you want to delete your keypair? (This is NOT recommended!)")) . ')) { e.stop(); } })'), true);
} elseif ($session->get('imp', 'file_upload')) {
$view->import = true;
$page_output->addInlineScript(array('$("import_smime_personal").observe("click", function(e) { ' . Horde::popupJs($smime_url, array('params' => array('actionID' => 'import_personal_certs', 'reload' => base64_encode($ui->selfUrl()->setRaw(true))), 'height' => 275, 'width' => 750, 'urlencode' => true)) . '; e.stop(); })'), true);
}
}
return $view->render('smimeprivatekey');
}
示例3: display
/**
*/
public function display(Horde_Core_Prefs_Ui $ui)
{
global $browser, $injector, $page_output, $prefs;
$page_output->addScriptPackage('IMP_Script_Package_Imp');
$p_css = new Horde_Themes_Element('prefs.css');
$page_output->addStylesheet($p_css->fs, $p_css->uri);
$view = new Horde_View(array('templatePath' => IMP_TEMPLATES . '/prefs'));
$view->addHelper('Horde_Core_View_Helper_Help');
if (!Horde::isConnectionSecure()) {
$view->notsecure = true;
return $view->render('smimeprivatekey');
}
$smime_url = IMP_Basic_Smime::url();
$view->has_key = $prefs->getValue('smime_public_key') && $prefs->getValue('smime_private_key');
$view->has_sign_key = $prefs->getValue('smime_public_sign_key') && $prefs->getValue('smime_private_sign_key');
if ($browser->allowFileUploads()) {
$view->import = true;
$page_output->addInlineScript(array('$("import_smime_personal").observe("click", function(e) { ' . Horde::popupJs($smime_url, array('params' => array('actionID' => 'import_personal_certs', 'reload' => base64_encode($ui->selfUrl()->setRaw(true))), 'height' => 450, 'width' => 750, 'urlencode' => true)) . '; e.stop(); })'), true);
}
if (!$view->has_key) {
return $view->render('smimeprivatekey');
}
$smime = $injector->getInstance('IMP_Smime');
foreach (array('' => false, '_sign' => true) as $suffix => $secondary) {
if ($secondary && !$view->has_sign_key) {
continue;
}
$cert = $smime->parseCert($smime->getPersonalPublicKey($secondary));
if (!empty($cert['validity']['notafter'])) {
$expired = new Horde_Date($cert['validity']['notafter']);
if ($expired->before(time())) {
$view->{'expiredate' . $suffix} = $expired->strftime($prefs->getValue('date_format'));
$view->{'expiretime' . $suffix} = $expired->strftime($prefs->getValue('time_format'));
}
}
$view->{'viewpublic' . $suffix} = $smime_url->copy()->add('actionID', 'view_personal_public' . $suffix . '_key')->link(array('title' => $secondary ? _("View Secondary Personal Public Certificate") : _("View Personal Public Certificate"), 'target' => 'view_key')) . _("View") . '</a>';
$view->{'infopublic' . $suffix} = $smime_url->copy()->add('actionID', 'info_personal_public' . $suffix . '_key')->link(array('title' => _("Information on Personal Public Certificate"), 'target' => 'info_key')) . _("Details") . '</a>';
if ($smime->getPassphrase($secondary)) {
$view->{'passphrase' . $suffix} = $ui->selfUrl(array('special' => true, 'token' => true))->add('unset_smime' . $suffix . '_passphrase', 1)->link(array('title' => _("Unload Passphrase"))) . _("Unload Passphrase") . '</a>';
} else {
$imple = $injector->getInstance('Horde_Core_Factory_Imple')->create('IMP_Ajax_Imple_PassphraseDialog', array('params' => array('reload' => $ui->selfUrl()->setRaw(true), 'secondary' => intval($secondary)), 'type' => 'smimePersonal'));
$view->{'passphrase' . $suffix} = Horde::link('#', _("Enter Passphrase"), null, null, null, null, null, array('id' => $imple->getDomId())) . _("Enter Passphrase");
}
$view->{'viewprivate' . $suffix} = $smime_url->copy()->add('actionID', 'view_personal_private' . $suffix . '_key')->link(array('title' => _("View Secondary Personal Private Key"), 'target' => 'view_key')) . _("View") . '</a>';
$page_output->addInlineScript(array('$("delete_smime_personal' . $suffix . '").observe("click", function(e) { if (!window.confirm(' . json_encode(_("Are you sure you want to delete your keypair? (This is NOT recommended!)")) . ')) { e.stop(); } })'), true);
}
return $view->render('smimeprivatekey');
}
示例4: display
/**
*/
public function display(Horde_Core_Prefs_Ui $ui)
{
global $browser, $conf, $injector, $page_output, $prefs;
$page_output->addScriptPackage('IMP_Script_Package_Imp');
$p_css = new Horde_Themes_Element('prefs.css');
$page_output->addStylesheet($p_css->fs, $p_css->uri);
$view = new Horde_View(array('templatePath' => IMP_TEMPLATES . '/prefs'));
$view->addHelper('Horde_Core_View_Helper_Help');
if (!Horde::isConnectionSecure()) {
$view->notsecure = true;
} else {
$pgp_url = IMP_Basic_Pgp::url();
$view->has_key = $prefs->getValue('pgp_public_key') && $prefs->getValue('pgp_private_key');
if ($view->has_key) {
$view->viewpublic = Horde::link($pgp_url->copy()->add('actionID', 'view_personal_public_key'), _("View Personal Public Key"), null, 'view_key');
$view->infopublic = Horde::link($pgp_url->copy()->add('actionID', 'info_personal_public_key'), _("Information on Personal Public Key"), null, 'info_key');
$view->sendkey = Horde::link($ui->selfUrl(array('special' => true, 'token' => true))->add('send_pgp_key', 1), _("Send Key to Public Keyserver"));
if ($injector->getInstance('IMP_Pgp')->getPassphrase('personal')) {
$view->passphrase = Horde::link($ui->selfUrl(array('special' => true, 'token' => true))->add('unset_pgp_passphrase', 1), _("Unload Passphrase")) . _("Unload Passphrase");
} else {
$imple = $injector->getInstance('Horde_Core_Factory_Imple')->create('IMP_Ajax_Imple_PassphraseDialog', array('params' => array('reload' => $ui->selfUrl()->setRaw(true)), 'type' => 'pgpPersonal'));
$view->passphrase = Horde::link('#', _("Enter Passphrase"), null, null, null, null, null, array('id' => $imple->getDomId())) . _("Enter Passphrase");
}
$view->viewprivate = Horde::link($pgp_url->copy()->add('actionID', 'view_personal_private_key'), _("View Personal Private Key"), null, 'view_key');
$view->infoprivate = Horde::link($pgp_url->copy()->add('actionID', 'info_personal_private_key'), _("Information on Personal Private Key"), null, 'info_key');
$page_output->addInlineScript(array('$("delete_pgp_privkey").observe("click", function(e) { if (!window.confirm(' . json_encode(_("Are you sure you want to delete your keypair? (This is NOT recommended!)")) . ')) { e.stop(); } })'), true);
} else {
$page_output->addScriptFile('prefs/pgp.js');
Horde_Core_Ui_JsCalendar::init();
$page_output->addInlineJsVars(array('ImpPgp.months' => Horde_Core_Ui_JsCalendar::months()));
$imp_identity = $injector->getInstance('IMP_Identity');
$view->fullname = $imp_identity->getFullname();
$view->fromaddr = $imp_identity->getFromAddress()->bare_address;
if (!empty($conf['pgp']['keylength'])) {
$view->create_pgp_keypair = true;
$page_output->addInlineScript(array('$("create_pgp_key").observe("click", function(e) { if (!window.confirm(' . json_encode(_("Key generation may take a long time to complete. Continue with key generation?")) . ')) { e.stop(); } })'), true);
}
if ($browser->allowFileUploads()) {
$view->import_pgp_private = true;
$page_output->addInlineScript(array('$("import_pgp_personal").observe("click", function(e) { ' . Horde::popupJs($pgp_url, array('params' => array('actionID' => 'import_personal_key', 'reload' => base64_encode($ui->selfUrl()->setRaw(true))), 'height' => 300, 'width' => 750, 'urlencode' => true)) . '; e.stop(); })'), true);
}
}
}
return $view->render('pgpprivatekey');
}
示例5: encryptionSupported
/**
* Returns whether note encryption is supported.
*
* Checks if PGP support could be loaded, if it supports symmetric
* encryption, and if we have a secure connection.
*
* @return boolean Whether encryption is suppoted.
*/
public function encryptionSupported()
{
try {
$this->_loadPGP();
} catch (Mnemo_Exception $e) {
}
return is_callable(array($this->_pgp, 'encryptedSymmetrically')) && Horde::isConnectionSecure();
}
示例6: elseif
if (!$share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
$notification->push(_("You do not have permission to view this notepad."), 'horde.error');
Horde::url('list.php', true)->redirect();
}
/* If the requested note doesn't exist, display an error message. */
if (!$memo || !isset($memo['memo_id'])) {
$notification->push(_("Note not found."), 'horde.error');
Horde::url('list.php', true)->redirect();
}
/* Get the note's history. */
$userId = $GLOBALS['registry']->getAuth();
/* Encryption tests. */
$show_passphrase = false;
if ($memo['body'] instanceof Mnemo_Exception) {
/* Check for secure connection. */
$secure_check = Horde::isConnectionSecure();
if ($memo['body']->getCode() == Mnemo::ERR_NO_PASSPHRASE) {
if ($secure_check) {
$notification->push(_("This note has been encrypted, please provide the password."), 'horde.message');
$show_passphrase = true;
} else {
$notification->push(_("This note has been encrypted, and cannot be decrypted without a secure web connection"), 'horde.error');
$memo['body'] = '';
}
} elseif ($memo['body']->getCode() == Mnemo::ERR_DECRYPT) {
if ($secure_check) {
$notification->push(_("This note cannot be decrypted:") . ' ' . $memo['body']->getMessage(), 'horde.message');
$show_passphrase = true;
} else {
$notification->push(_("This note has been encrypted, and cannot be decrypted without a secure web connection"), 'horde.error');
$memo['body'] = '';