See Horde_Registry_Application for a summary of the API callbacks that are available. Session variables set (stored in 'horde_prefs'): 'advanced' - (boolean) If true, display advanced prefs.
Автор: Chuck Hagenbuch (chuck@horde.org)
Автор: Michael Slusarz (slusarz@horde.org)
Пример #1
0
 /**
  */
 public function display(Horde_Core_Prefs_Ui $ui)
 {
     global $injector, $page_output, $prefs, $session;
     $page_output->addScriptPackage('IMP_Script_Package_Imp');
     $imp_pgp = $injector->getInstance('IMP_Crypt_Pgp');
     /* Get list of Public Keys on keyring. */
     try {
         $pubkey_list = $imp_pgp->listPublicKeys();
     } catch (Horde_Exception $e) {
         $pubkey_list = array();
     }
     $pgp_url = IMP_Basic_Pgp::url();
     $view = new Horde_View(array('templatePath' => IMP_TEMPLATES . '/prefs'));
     $view->addHelper('Horde_Core_View_Helper_Help');
     $view->addHelper('Text');
     if (!empty($pubkey_list)) {
         $plist = array();
         $self_url = $ui->selfUrl(array('special' => true, 'token' => true));
         foreach ($pubkey_list as $val) {
             $plist[] = array('name' => $val['name'], 'email' => $val['email'], 'view' => Horde::link($pgp_url->copy()->add(array('actionID' => 'view_public_key', 'email' => $val['email'])), sprintf(_("View %s Public Key"), $val['name']), null, 'view_key'), 'info' => Horde::link($pgp_url->copy()->add(array('actionID' => 'info_public_key', 'email' => $val['email'])), sprintf(_("Information on %s Public Key"), $val['name']), null, 'info_key'), 'delete' => Horde::link($self_url->copy()->add(array('delete_pgp_pubkey' => 1, 'email' => $val['email'])), sprintf(_("Delete %s Public Key"), $val['name']), null, null, "window.confirm('" . addslashes(_("Are you sure you want to delete this public key?")) . "')"));
         }
         $view->pubkey_list = $plist;
     }
     if ($session->get('imp', 'file_upload')) {
         $view->can_import = true;
         $view->no_source = !$prefs->getValue('add_source');
         if (!$view->no_source) {
             $page_output->addInlineScript(array('$("import_pgp_public").observe("click", function(e) { ' . Horde::popupJs($pgp_url, array('params' => array('actionID' => 'import_public_key', 'reload' => base64_encode($ui->selfUrl()->setRaw(true))), 'height' => 275, 'width' => 750, 'urlencode' => true)) . '; e.stop(); })'), true);
         }
     }
     return $view->render('pgppublickey');
 }
Пример #2
0
 /**
  */
 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
0
 /**
  */
 public function display(Horde_Core_Prefs_Ui $ui)
 {
     global $injector, $page_output, $prefs, $registry;
     try {
         $state = $injector->getInstance('Horde_ActiveSyncState');
     } catch (Horde_Exception $e) {
         return _("ActiveSync not activated.");
     }
     $devices = $state->listDevices($registry->getAuth());
     $view = new Horde_View(array('templatePath' => array(HORDE_TEMPLATES . '/prefs', HORDE_TEMPLATES . '/activesync')));
     $view->addHelper('Tag');
     $view->isAdmin = false;
     $selfurl = $ui->selfUrl();
     $view->reset = $selfurl->copy()->add('reset', 1);
     $devs = array();
     $js = array();
     $collections = array();
     foreach ($devices as $device) {
         $dev = $state->loadDeviceInfo($device['device_id'], $registry->getAuth());
         try {
             $dev = $GLOBALS['injector']->getInstance('Horde_Core_Hooks')->callHook('activesync_device_modify', 'horde', array($dev));
         } catch (Horde_Exception_HookNotSet $e) {
         }
         $js[$dev->id . ':' . $registry->getAuth()] = array('id' => $dev->id, 'user' => $dev->user);
         $syncCache = new Horde_ActiveSync_SyncCache($state, $dev->id, $dev->user, $injector->getInstance('Horde_Log_Logger'));
         $dev->hbinterval = $syncCache->hbinterval ? $syncCache->hbinterval : ($syncCache->wait ? $syncCache->wait * 60 : _("Unavailable"));
         $devs[] = $dev;
         $collection = array();
         foreach ($syncCache->getCollections() as $id => $c) {
             $collection[] = array(_("Collection id") => $id, _("Class") => $c['class'], _("Server Id") => $c['serverid'], _("Last synckey") => $c['lastsynckey']);
         }
         $collections[] = $collection;
     }
     $view->collections = $collections;
     // Identities
     if (!$prefs->isLocked('activesync_identity')) {
         $ident = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Identity')->create($registry->getAuth());
         $view->identities = $ident->getAll('id');
         $view->identities['horde'] = _("Use Horde Default");
         $view->default = $prefs->getValue('activesync_identity');
         if (is_null($view->default)) {
             $view->default = $prefs->getValue('default_identity');
         }
     }
     $page_output->addScriptFile('activesyncprefs.js', 'horde');
     $page_output->addInlineJsVars(array('HordeActiveSyncPrefs.devices' => $js));
     $view->devices = $devs;
     return $view->render('activesync');
 }
Пример #4
0
 /**
  */
 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');
 }
Пример #5
0
 /**
  */
 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');
 }
Пример #6
0
<?php

/**
 * Preferences UI page.
 *
 * URL Parameters
 * --------------
 *   - actionID: (string) Action ID.
 *   - app: (string) The current Horde application.
 *   - group: (string) The current preferences group.
 *
 * Copyright 1999-2014 Horde LLC (http://www.horde.org/)
 *
 * See the enclosed file COPYING for license information (LGPL-2). If you
 * did not receive this file, see http://www.horde.org/licenses/lgpl.
 *
 * @author   Chuck Hagenbuch <*****@*****.**>
 * @author   Jan Schneider <*****@*****.**>
 * @category Horde
 * @license  http://www.horde.org/licenses/lgpl LGPL-2
 * @package  Horde
 */
require_once __DIR__ . '/../lib/Application.php';
Horde_Registry::appInit('horde');
$prefs_ui = new Horde_Core_Prefs_Ui($injector->getInstance('Horde_Variables'));
/* Handle form submission. */
$prefs_ui->handleForm();
/* Generate the UI. */
$prefs_ui->generateUI();