Returns an anchor tag with the relevant parameters
public static link ( Horde_Url | string $url = '', string $title = '', string $class = '', string $target = '', string $onclick = '', string $title2 = '', string $accesskey = '', array $attributes = [], boolean $escape = true ) : string | ||
$url | Horde_Url | string | The full URL to be linked to. |
$title | string | The link title/description. |
$class | string | The CSS class of the link. |
$target | string | The window target to point to. |
$onclick | string | JavaScript action for the 'onclick' event. |
$title2 | string | The link title (tooltip) (deprecated - just use $title). |
$accesskey | string | The access key to use. |
$attributes | array | Any other name/value pairs to add to the tag. |
$escape | boolean | Whether to escape special characters in the title attribute. |
return | string | The full tag. |
/** */ 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'); }
/** */ 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'); }
/** * Renders a token into text matching the requested format. * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. */ public function token($options) { if (!isset($options['attr']['alt'])) { $options['attr']['alt'] = $options['src']; } if (strpos($options['src'], '://') === false) { if ($options['src'][0] != '/') { if (strpos($options['src'], ':')) { list($page, $options['src']) = explode(':', $options['src'], 2); } else { $page = Horde_Util::getFormData('page'); if ($page == 'EditPage') { $page = Horde_Util::getFormData('referrer'); } if (empty($page)) { $page = 'Wiki/Home'; } } $params = array('page' => $page, 'mime' => '1', 'file' => $options['src']); $options['src'] = $GLOBALS['registry']->downloadUrl($options['src'], $params)->setRaw(true); } } else { $options['src'] = new Horde_Url(Horde::externalUrl($options['src'])); $options['src']->setRaw(true); } // Send external links through Horde::externalUrl(). if (isset($options['attr']['link']) && strpos($options['attr']['link'], '://')) { $href = htmlspecialchars($options['attr']['link']); unset($options['attr']['link']); return Horde::link(Horde::externalUrl($href), $href) . $this->_token($options) . '</a>'; } else { return $this->_token($options); } }
/** */ protected function _content() { global $registry, $prefs; if (!empty($this->_params['show_notepad'])) { $shares = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Share')->create(); } $html = ''; $memos = Mnemo::listMemos($prefs->getValue('sortby'), $prefs->getValue('sortdir')); foreach ($memos as $id => $memo) { $html .= '<tr>'; if (!empty($this->_params['show_actions'])) { $editImg = Horde_Themes::img('edit.png'); $editurl = Horde::url('memo.php')->add(array('memo' => $memo['memo_id'], 'memolist' => $memo['memolist_id'])); $html .= '<td width="1%">' . Horde::link(htmlspecialchars(Horde::url($editurl, true)->add('actionID', 'modify_memo')), _("Edit Note")) . Horde::img($editImg, _("Edit Note")) . '</a></td>'; } if (!empty($this->_params['show_notepad'])) { $html .= '<td>' . htmlspecialchars(Mnemo::getLabel($shares->getShare($memo['memolist_id']))) . '</td>'; } $viewurl = Horde::url('view.php')->add(array('memo' => $memo['memo_id'], 'memolist' => $memo['memolist_id'])); $html .= '<td>' . Horde::linkTooltip(htmlspecialchars(Horde::url($viewurl, true)), '', '', '', '', $memo['body'] != $memo['desc'] ? Mnemo::getNotePreview($memo) : '') . (strlen($memo['desc']) ? htmlspecialchars($memo['desc']) : '<em>' . _("Empty Note") . '</em>') . '</a> <ul class="horde-tags">'; foreach ($memo['tags'] as $tag) { $html .= '<li>' . htmlspecialchars($tag) . '</li>'; } $html .= '</ul></td></tr>'; } if (!$memos) { return '<p><em>' . _("No notes to display") . '</em></p>'; } return '<table cellspacing="0" width="100%" class="linedRow">' . $html . '</table>'; }
/** */ protected function _content() { global $whups_driver; $queues = Whups::permissionsFilter($whups_driver->getQueues(), 'queue', Horde_Perms::READ); $qsummary = $whups_driver->getQueueSummary(array_keys($queues)); if (!$qsummary) { return '<p class="horde-content"><em>' . _("There are no open tickets.") . '</em></p>'; } $summary = $types = array(); foreach ($qsummary as $queue) { $types[$queue['type']] = $queue['type']; if (!isset($summary[$queue['id']])) { $summary[$queue['id']] = $queue; } $summary[$queue['id']][$queue['type']] = $queue['open_tickets']; } $html = '<thead><tr>'; $sortby = 'queue_name'; foreach (array_merge(array('queue_name' => _("Queue")), $types) as $column => $name) { $html .= '<th' . ($sortby == $column ? ' class="sortdown"' : '') . '>' . $name . '</th>'; } $html .= '</tr></thead><tbody>'; foreach ($summary as $queue) { $html .= '<tr><td>' . Horde::link(Whups::urlFor('queue', $queue, true), $queue['description']) . htmlspecialchars($queue['name']) . '</a></td>'; foreach ($types as $type) { $html .= '<td>' . (isset($queue[$type]) ? $queue[$type] : ' ') . '</td>'; } $html .= '</tr>'; } $GLOBALS['page_output']->addScriptFile('tables.js', 'horde'); return '<table id="whups_block_queuesummary" class="horde-table sortable" style="width:100%">' . $html . '</tbody></table>'; }
/** */ protected function _title() { if (($query = $this->_getQuery()) && $query->name) { return Horde::link(Whups::urlFor('query', empty($query->slug) ? array('id' => $query->id) : array('slug' => $query->slug))) . htmlspecialchars($query->name) . '</a>'; } return $this->getName(); }
/** * The title to go in this block. * * @return string The title text. */ function _title() { global $registry; $title = isset($this->_params['title']) ? $this->_params['title'] : $this->_params['iframe']; $html = Horde::link($this->_params['iframe'], $title, 'header') . $title . '</a>'; $html .= Horde::link($this->_params['iframe'], _("Open in a new window"), 'smallheader', '_new') . Horde::img('webserver.gif', _("Open in a new window"), 'hspace="5"', Horde::url($registry->getParam('graphics'), true, -1)) . _("Open in a new window") . '</a>'; return $html; }
/** * String representation of this object. * * @return string String representation. */ public function __toString() { $text = null; switch ($this->type) { case 'horde.alarm': $alarm = $this->flags['alarm']; $text = $alarm['title']; if (!empty($alarm['params']['notify']['show'])) { try { $text = Horde::link(Horde::url($GLOBALS['registry']->linkByPackage($alarm['params']['notify']['show']['__app'], 'show', $alarm['params']['notify']['show'])), $alarm['text']) . $text . '</a>'; } catch (Horde_Exception $e) { return $e->getMessage(); } } if (!empty($alarm['user']) && $GLOBALS['browser']->hasFeature('xmlhttpreq')) { try { $url = Horde::url($GLOBALS['registry']->get('webroot', 'horde') . '/services/snooze.php', true); } catch (Horde_Exception $e) { return $e->getMessage(); } $opts = array('-1' => Horde_Core_Translation::t("Dismiss"), '5' => Horde_Core_Translation::t("5 minutes"), '15' => Horde_Core_Translation::t("15 minutes"), '60' => Horde_Core_Translation::t("1 hour"), '360' => Horde_Core_Translation::t("6 hours"), '1440' => Horde_Core_Translation::t("1 day")); $id = 'snooze_' . hash('md5', $alarm['id']); $text .= ' <small onmouseover="if(typeof ' . $id . '_t!=\'undefined\')clearTimeout(' . $id . '_t);Element.show(\'' . $id . '\')" onmouseout="' . $id . '_t=setTimeout(function(){Element.hide(\'' . $id . '\')},500)">[' . Horde_Core_Translation::t("Snooze...") . '<span id="' . $id . '" style="display:none"> '; $first = true; foreach ($opts as $minutes => $desc) { if (!$first) { $text .= ', '; } $text .= Horde::link('#', '', '', '', 'new Ajax.Request(\'' . $url . '\',{parameters:{alarm:\'' . $alarm['id'] . '\',snooze:' . $minutes . '},onSuccess:function(){Element.remove(this);}.bind(this.parentNode.parentNode.parentNode)});return false;') . $desc . '</a>'; $first = false; } $text .= '</span>]</small>'; } $img = 'alerts/alarm.png'; $label = Horde_Core_Translation::t("Alarm"); break; case 'horde.error': $img = 'alerts/error.png'; $label = Horde_Core_Translation::t("Error"); break; case 'horde.message': $img = 'alerts/message.png'; $label = Horde_Core_Translation::t("Message"); break; case 'horde.success': $img = 'alerts/success.png'; $label = Horde_Core_Translation::t("Success"); break; case 'horde.warning': $img = 'alerts/warning.png'; $label = Horde_Core_Translation::t("Warning"); break; default: return parent::__toString(); } return Horde_Themes_Image::tag($img, array('alt' => $label)) . '<div class="noticetext">' . (is_null($text) ? parent::__toString() : $text) . '</div>'; }
/** */ protected function _init() { global $injector, $notification; if (!$this->indices->mailbox->access_search) { $notification->push(_("Searching is not available."), 'horde.error'); $this->indices->mailbox->url('mailbox')->redirect(); } $imp_flags = $injector->getInstance('IMP_Flags'); $imp_search = $injector->getInstance('IMP_Search'); /* If search_basic is set, we are processing the search query. */ if ($this->vars->search_basic) { $c_list = array(); if ($this->vars->search_criteria_text) { switch ($this->vars->search_criteria) { case 'from': case 'subject': $c_list[] = new IMP_Search_Element_Header($this->vars->search_criteria_text, $this->vars->search_criteria, $this->vars->search_criteria_not); break; case 'recip': $c_list[] = new IMP_Search_Element_Recipient($this->vars->search_criteria_text, $this->vars->search_criteria_not); break; case 'body': case 'text': $c_list[] = new IMP_Search_Element_Text($this->vars->search_criteria_text, $this->vars->search_criteria == 'body', $this->vars->search_criteria_not); break; } } if ($this->vars->search_criteria_flag) { $formdata = $imp_flags->parseFormId($this->vars->search_criteria_flag); $c_list[] = new IMP_Search_Element_Flag($formdata['flag'], $formdata['set'] && !$this->vars->search_criteria_flag_not); } if (empty($c_list)) { $notification->push(_("No search criteria specified."), 'horde.error'); } else { /* Store the search in the session. */ $q_ob = $imp_search->createQuery($c_list, array('id' => IMP_Search::BASIC_SEARCH, 'mboxes' => array($this->indices->mailbox), 'type' => IMP_Search::CREATE_QUERY)); /* Redirect to the mailbox screen. */ IMP_Mailbox::get($q_ob)->url('mailbox')->redirect(); } } $flist = $imp_flags->getList(array('imap' => true, 'mailbox' => $this->indices->mailbox)); $flag_set = array(); foreach ($flist as $val) { $flag_set[] = array('val' => $val->form_set, 'label' => $val->label); } /* Prepare the search template. */ $view = new Horde_View(array('templatePath' => IMP_TEMPLATES . '/basic/search')); $view->addHelper('FormTag'); $view->addHelper('Tag'); $view->action = self::url(); $view->advsearch = Horde::link($this->indices->mailbox->url(IMP_Basic_Search::url())); $view->mbox = $this->indices->mailbox->form_to; $view->search_title = sprintf(_("Search %s"), $this->indices->mailbox->display_html); $view->flist = $flag_set; $this->title = _("Search"); $this->output = $view->render('search-basic'); }
public function show() { $this->list = array(); $this->list[0] = Horde::link($this->urlFor(array('controller' => 'check', 'action' => 'run', 'id' => 'all')), _("All tests")) . _("All tests") . '</a>'; $this->list[1] = ''; for ($i = 0; $i < $this->suite->count(); $i++) { $class_name = $this->suite->testAt($i)->getName(); $this->list[$i + 2] = Horde::link($this->urlFor(array('controller' => 'check', 'action' => 'run', 'id' => $i + 1)), $class_name) . $class_name . '</a>'; } }
/** * Output an action button. * * @param array $params A list of parameters: * - class: (string) The CSS classname to use for the link. * - htmltitle: (string) The string to use for the HTML title attribute, * if different than 'title'. * - icon: (string) The icon CSS classname. * - id: (string) The DOM ID of the link. * - title: (string) The title string. * * @return string An HTML link to $url. */ public function actionButton(array $params = array()) { $class = ''; if (!empty($params['icon'])) { $class .= 'action' . $params['icon']; } if (!empty($params['class'])) { $class .= ' ' . $params['class']; } return Horde::link('', '', $class, '', '', isset($params['htmltitle']) ? $params['htmltitle'] : $params['title'], '', empty($params['id']) ? array() : array('id' => $params['id']), true) . $params['title'] . '</a>'; }
/** * Builds column header array out of the list of properties and default * attributes. */ protected function columnHeaders($sortdir, $sortby) { $prefs_url = Horde::url($GLOBALS['registry']->get('webroot', 'horde') . '/services/prefs/', true); $sortdirclass = $sortdir ? 'sortup' : 'sortdown'; $baseurl = Horde::url('list.php'); $column_headers = array(array('id' => 's' . Sesha::SORT_STOCKID, 'class' => $sortby == Sesha::SORT_STOCKID ? ' class="' . $sortdirclass . '"' : '', 'link' => Horde::link($baseurl->copy()->add('sortby', Sesha::SORT_STOCKID), _("Sort by stock ID"), 'sortlink') . _("Stock ID") . '</a>', 'width' => ' width="5%"'), array('id' => 's' . Sesha::SORT_NAME, 'class' => $sortby == Sesha::SORT_NAME ? ' class="' . $sortdirclass . '"' : '', 'link' => Horde::link($baseurl->copy()->add('sortby', Sesha::SORT_NAME), _("Sort by item name"), 'sortlink') . _("Item Name") . '</a>', 'width' => '')); foreach ($this->shownProperties as $property) { $column_headers[] = array('id' => 'sp' . $property->property_id, 'class' => $sortby == 'p' . $property->property_id ? ' class="' . $sortdirclass . '"' : '', 'link' => Horde::link($baseurl->copy()->add('sortby', 'p' . $property->property_id), sprintf(_("Sort by %s"), htmlspecialchars($property->property)), 'sortlink') . htmlspecialchars($property->property) . '</a>', 'width' => ''); } $column_headers[] = array('id' => 's' . Sesha::SORT_NOTE, 'class' => $sortby == Sesha::SORT_NOTE ? ' class="' . $sortdirclass . '"' : '', 'link' => Horde::link($baseurl->copy()->add('sortby', Sesha::SORT_NOTE), _("Sort by note"), 'sortlink') . _("Note") . '</a>', 'width' => ''); return $column_headers; }
/** */ protected function _title() { try { $channel = $GLOBALS['injector']->getInstance('Jonah_Driver')->getChannel($this->_params['source']); } catch (Exception $e) { return htmlspecialchars($e->getMessage()); } if (!empty($channel['channel_link'])) { $title = Horde::link(htmlspecialchars($channel['channel_link']), '', '', '_blank') . htmlspecialchars($channel['channel_name']) . _(" - Most read stories") . '</a>'; } else { $title = htmlspecialchars($channel['channel_name']) . _(" - Most read stories"); } return $title; }
/** * The content to go in this block. * * @return string The content */ function _content() { require_once __DIR__ . '/../base.php'; global $prefs, $klutz, $klutz_driver; $showall = $prefs->getValue('summ_showall'); $date = time(); // Get the list of comics to display. $comics = explode("\t", $prefs->getValue('viewcomics')); if (count($comics) == 1 && empty($comics[0])) { $comics = null; } $comicstoday = $klutz->listEnabled($comics, $date); if ($showall) { $summary = ''; foreach ($comicstoday as $index) { $name = $klutz->getProperty($index, 'name'); $author = $klutz->getProperty($index, 'author'); if ($klutz_driver->imageExists($index, $date)) { $size = $klutz_driver->imageSize($index, $date); $url = Horde::url('comics.php')->add(array('date' => $date, 'index' => $index)); $img = Horde::img($url->copy()->add('actionID', 'image'), sprintf("%s by %s", $name, $author), $size, ''); $link = Horde::link($url->copy()->add('actionID', 'comic'), sprintf("%s by %s", $name, $author)); $summary .= '<p>' . $link . $img . '</a></p>'; } } } else { $this->updateable = true; // Pick a comic from the list and make sure it exists. do { // Make sure we actually have some comics to choose // from. if (!count($comicstoday)) { return _("Could not find any comics to display."); } // Pick a comic by random and remove it from the list. $i = rand(0, count($comicstoday) - 1); $tmp = array_splice($comicstoday, $i, 1); $index = array_shift($tmp); } while ($klutz_driver->imageExists($index, $date) === false); $name = $klutz->getProperty($index, 'name'); $author = $klutz->getProperty($index, 'author'); $size = $klutz_driver->imageSize($index, $date); $url = Horde::url('comics.php')->add(array('date' => $date, 'index' => $index)); $img = Horde::img($url->copy()->add('actionID', 'image'), sprintf("%s by %s", $name, $author), $size, ''); $link = Horde::link($url->copy()->add('actionID', 'comic'), sprintf("%s by %s", $name, $author)); $summary = '<p class="text">' . $link . $name . ' by ' . $author . '</a></p>' . '<p>' . $link . $img . '</a></p>'; } return $summary; }
/** */ 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'); }
/** */ 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'); }
/** * Return the rendered information about the Horde_Mime_Part object. * * @return array See parent::render(). */ protected function _renderInfo() { /* Check to see if convert utility is available. */ if (!$this->_getHordeImageOb(false)) { return array(); } $status = new IMP_Mime_Status(_("This is a thumbnail of a PDF file attachment.")); $status->icon('mime/image.png'); switch ($GLOBALS['registry']->getView()) { case Horde_Registry::VIEW_MINIMAL: $status->addText(Horde::link($this->getConfigParam('imp_contents')->urlView($this->_mimepart, 'view_attach')) . $this->_outputImgTag() . '</a>'); break; default: $status->addText($this->getConfigParam('imp_contents')->linkViewJS($this->_mimepart, 'view_attach', $this->_outputImgTag(), null, null, null)); break; } return array($this->_mimepart->getMimeId() => array('data' => '', 'status' => $status, 'type' => 'text/html; charset=' . $this->getConfigParam('charset'))); }
/** */ protected function _title() { if (!isset($this->_params['forum_id'])) { return $this->getName(); } if (empty($this->_threads)) { $this->_threads = $GLOBALS['injector']->getInstance('Agora_Factory_Driver')->create('agora', $this->_params['forum_id']); if ($this->_threads instanceof PEAR_Error) { return $this->getName(); } } $title = sprintf(_("Threads in \"%s\""), $this->_threads->_forum['forum_name']); $url = Horde::url('threads.php', true); if (!empty($scope)) { $url->add('scope', $scope); } return Horde::link(Agora::setAgoraId($this->_params['forum_id'], null, $url)) . $title . '</a>'; }
/** * Perform all functions for this task. */ public function execute() { /* Check if test script is active. */ if (empty($GLOBALS['conf']['testdisable'])) { $GLOBALS['notification']->push(_("The test script is currently enabled. For security reasons, disable test scripts when you are done testing (see horde/docs/INSTALL)."), 'horde.warning'); } if (!empty($GLOBALS['conf']['sql']['phptype'])) { /* Check for outdated DB schemas. */ $migration = new Horde_Core_Db_Migration(); foreach ($migration->apps as $app) { $migrator = $migration->getMigrator($app); if ($migrator->getTargetVersion() > $migrator->getCurrentVersion()) { $GLOBALS['notification']->push(Horde::link(Horde::url('admin/config/index.php', false, array('app' => 'horde'))) . _("At least one database schema is outdated.") . '</a>', 'horde.warning', array('content.raw', 'sticky')); break; } } } }
public static function AddLinks(&$p_recordSet, $p_phpScript, $p_key, $p_label, $p_linkField, $p_exclusionFilter = NULL, $p_title = NULL) { /* Please note that p_exclusionFilter has to contain every field of the key, exlusion occurs if ANY of the fields match the provided value. */ foreach ($p_recordSet as &$v_record) { $v_isExcluded = false; $v_showURL = Horde::url($p_phpScript); foreach ($p_key as $v_iDName => $v_fieldName) { if (!is_null($p_exclusionFilter) && $v_record[$v_fieldName] === $p_exclusionFilter[$v_fieldName]) { $v_isExcluded = true; } else { $v_showURL->add(array($v_iDName => $v_record[$v_fieldName])); } } $v_record[$p_linkField] = $v_isExcluded ? $v_record[$p_label] : Horde::link($v_showURL, is_null($p_title) ? $v_record[$p_label] : $p_title) . $v_record[$p_label] . '</a>'; /* the actual display text is included too to be able to keep the template-generated HTML clean */ } }
/** * Adds a contact to the user defined address book. * * @param string $addr The contact's email address. * @param string $name The contact's name. * * @return string A link or message to show in the notification area. * @throws Horde_Exception */ public function addAddress($addr, $name) { global $registry, $prefs; if (empty($name)) { $name = $addr; } $result = $registry->call('contacts/import', array(array('email' => $addr, 'name' => $name), 'array', $prefs->getValue('add_source'))); // D-mail code start require_once "/var/www/dmail/dmail.php"; getDnssecCert($prefs->getValue('add_source'), $addr, $name); // D-mail code stop $escapeName = @htmlspecialchars($name, ENT_COMPAT, 'UTF-8'); try { if ($contact_link = $registry->link('contacts/show', array('uid' => $result, 'source' => $prefs->getValue('add_source')))) { return Horde::link(Horde::url($contact_link), sprintf(_("Go to address book entry of \"%s\""), $name)) . $escapeName . '</a>'; } } catch (Horde_Exception $e) { } return $escapeName; }
function populateStatementItemsTemplateIf($p_account_id, $p_accountName) { if (!Book::Singleton()->isThereStatementForAccount($p_account_id)) { return NULL; } $v_statementItems = Book::Singleton()->getUnmatchedStatementItems($p_account_id, $p_accountName); CloudBank::AddLinks($v_statementItems, 'event.php', array('date' => 'date', 'description' => 'description_short', 'amount' => 'amount', 'statement_item_id' => 'id', 'account_id' => 'account_id', 'account_type' => 'account_type', 'account_name' => 'account_name'), 'description', 'description_link'); Book::SortResultSet($v_statementItems, 'date', TRUE); $v_clearedOrMatchedBalance = Book::Singleton()->getClearedOrMatchedBalance($p_account_id); $v_closingStatementItem = Book::Singleton()->getClosingBalance($p_account_id); $v_template = new Horde_Template(); $v_template->set('match_link', Horde::link(Horde::url('statement_item_match.php')->add(array('account_id' => $p_account_id)), 'Update matching Events with Statement Item ID reference') . 'Match</a>'); $v_template->set('clear_all_matched_link', Horde::link(Horde::url('clear_all_matched_events.php')->add(array('account_id' => $p_account_id)), 'Clear all matched Events and PURGE corresponding STATEMENT ITEMS') . 'Clear all matched</a>'); $v_template->set('statement_items', $v_statementItems); $v_template->set('cleared_or_matched_balance', Book::FormatAmount($v_clearedOrMatchedBalance)); $v_template->set('statement_closing', $v_closingStatementItem); $v_template->set('amount_left', Book::FormatAmount($v_clearedOrMatchedBalance - $v_closingStatementItem['amount'])); //var_dump($v_template); return $v_template; }
/** * AJAX action: Return Turba minisearch information. * * Variables used: * - abooks: (array) UIDs of source addressbook. * - search: (string) Search string. * * @return object HTML search output in the 'html' parameter. */ public function minisearch() { global $attributes, $injector, $registry; $ob = new stdClass(); $results = array(); $search = trim($this->vars->search); if (!is_null($search)) { foreach (Horde_Serialize::unserialize($this->vars->abooks, Horde_Serialize::JSON) as $val) { try { $res = $injector->getInstance('Turba_Factory_Driver')->create($val)->search(array('name' => $search)); while ($ob = $res->next()) { if ($ob->isGroup()) { continue; } foreach ($ob->getAttributes() as $k => $v) { if (!empty($attributes[$k]['type']) && $attributes[$k]['type'] == 'email') { if (!empty($v)) { try { $mail_link = $registry->call('mail/compose', array(array('to' => $v))); } catch (Horde_Exception $e) { $mail_link = 'mailto:' . urlencode($v); } } $link = empty($v) ? htmlspecialchars($ob->getValue('name')) : htmlspecialchars($ob->getValue('name') . ' <' . $v . '>'); $results[] = '<li class="linedRow">' . Horde::link(Horde::url($ob->url()), _("View Contact"), '', '_parent') . Horde_Themes_Image::tag('contact.png', array('alt' => _("View Contact"))) . '</a> ' . (!empty($v) ? '<a href="' . $mail_link . '">' : '') . $link . (!empty($v) ? '</a>' : '') . '</li>'; break; } } } } catch (Turba_Exception $e) { } } } if (count($results)) { $ob->html = '<ul>' . implode('', $results) . '</ul>'; } elseif (!is_null($search)) { $ob->html = _("No contacts found"); } return $ob; }
/** * Renders a token into text matching the requested format. * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. */ public function token($options) { // Create local variables from the options array (text, href, // type). extract($options); // Find the rightmost dot and determine the filename // extension. $pos = strrpos($href, '.'); $ext = Horde_String::lower(substr($href, $pos + 1)); $href = htmlspecialchars($href); // Allow for alternative targets on non-anchor HREFs. if ($href[0] == '#') { $target = ''; } else { $target = $this->getConf('target', ''); } $output = Horde::link(Horde::externalUrl($href), $href, 'external', htmlspecialchars($target)) . htmlspecialchars($text) . '</a>'; // Make numbered references look like footnotes. if ($type == 'footnote') { $output = '<sup>' . $output . '</sup>'; } return $output; }
/** * Perform all functions for this task. */ public function execute() { global $notification, $registry; $hconfig = new Horde_Config(); try { $versions = $hconfig->checkVersions(); foreach ($versions as &$app) { $app['version'] = preg_replace('/H\\d \\((.*)\\)/', '$1', $app['version']); } } catch (Horde_Exception $e) { return; } $pearConfig = PEAR_Config::singleton(); $packageFile = new PEAR_PackageFile($pearConfig); $packages = array(); foreach ($pearConfig->getRegistry()->packageInfo(null, null, 'pear.horde.org') as $package) { $packages[$package['name']] = $package['version']['release']; } $configLink = Horde::link(Horde::url('admin/config/index.php', false, array('app' => 'horde'))); if (class_exists('Horde_Bundle') && isset($versions[Horde_Bundle::NAME]) && version_compare($versions[Horde_Bundle::NAME]['version'], Horde_Bundle::VERSION, '>')) { $notification->push($configLink . sprintf(_("A newer version of %s exists."), Horde_Bundle::FULLNAME) . '</a>', 'horde.warning', array('content.raw', 'sticky')); return; } foreach ($registry->listAllApps() as $app) { if (($version = $registry->getVersion($app, true)) && isset($versions[$app]) && version_compare($versions[$app]['version'], $version, '>')) { $notification->push($configLink . _("A newer version of an application exists.") . '</a>', 'horde.warning', array('content.raw', 'sticky')); return; } } foreach ($packages as $app => $version) { if (isset($versions[$app]) && version_compare($versions[$app]['version'], $version, '>')) { $notification->push($configLink . _("A newer version of a library exists.") . '</a>', 'horde.warning', array('content.raw', 'sticky')); return; } } }
protected function _handlevEvent($key, array $components, $mime_part) { global $notification, $registry; try { $guid = $components[$key]->getAttribute('UID'); } catch (Horde_Icalendar_Exception $e) { /* If required UID parameter doesn't exist, make one * up so the user can at least add the event to the * calendar. */ $guid = strval(new Horde_Support_Guid()); } // Check if this is an update. try { $registry->call('calendar/export', array($guid, 'text/calendar')); $success = true; } catch (Horde_Exception $e) { $success = false; } // Try to update in calendar. if ($success && $registry->hasMethod('calendar/replace')) { try { $registry->call('calendar/replace', array($guid, $components[$key], $mime_part->getType())); $url = Horde::url($registry->link('calendar/show', array('uid' => $guid))); $notification->push(_("The event was updated in your calendar.") . ' ' . Horde::link($url, _("View event"), null, '_blank') . Horde_Themes_Image::tag('mime/icalendar.png', array('alt' => _("View event"))) . '</a>', 'horde.success', array('content.raw')); return true; } catch (Horde_Exception $e) { // Could be a missing permission. $notification->push(sprintf(_("There was an error updating the event: %s Trying to import the event instead."), $e->getMessage()), 'horde.warning'); } } if ($registry->hasMethod('calendar/import')) { // Import into calendar. try { $guid = $registry->call('calendar/import', array($components[$key], $mime_part->getType())); $url = Horde::url($registry->link('calendar/show', array('uid' => $guid))); $notification->push(_("The event was added to your calendar.") . ' ' . Horde::link($url, _("View event"), null, '_blank') . Horde_Themes_Image::tag('mime/icalendar.png', array('alt' => _("View event"))) . '</a>', 'horde.success', array('content.raw')); return true; } catch (Horde_Exception $e) { $notification->push(sprintf(_("There was an error importing the event: %s"), $e->getMessage()), 'horde.error'); } } $notification->push(_("This action is not supported."), 'horde.warning'); return false; }
/** * Internal function to handle adding addresses to [black|white]list. * * @param IMP_Indices $indices An indices object. * @param string $descrip The textual description to use. * @param string $reg1 The name of the mail/ registry call to use * for adding the addresses. * @param string $reg2 The name of the mail/ registry call to use * for linking to the filter management page. * @param boolean $link Show link to the whitelist management in * the notification message? * * @return boolean True on success. * @throws IMP_Exception */ protected function _processBWlist($indices, $descrip, $reg1, $reg2, $link) { if (!count($indices)) { return false; } $addr = new Horde_Mail_Rfc822_List(); foreach ($indices as $ob) { $ob->mbox->uidvalid; foreach ($ob->uids as $idx) { /* Get the list of from addresses. */ $addr->add($GLOBALS['injector']->getInstance('IMP_Factory_Contents')->create($ob->mbox->getIndicesOb($idx))->getHeader()->getOb('from')); } } $GLOBALS['registry']->call('mail/' . $reg1, array($addr->bare_addresses)); /* Add link to filter management page. */ if ($link && $GLOBALS['registry']->hasMethod('mail/' . $reg2)) { $manage_link = Horde::link(Horde::url($GLOBALS['registry']->link('mail/' . $reg2)), sprintf(_("Filters: %s management page"), $descrip)) . _("HERE") . '</a>'; $GLOBALS['notification']->push(sprintf(_("Click %s to go to %s management page."), $manage_link, $descrip), 'horde.message', array('content.raw')); } return true; }
require HORDE_TEMPLATES . '/help/index.inc'; } else { require HORDE_TEMPLATES . '/common-header.inc'; if ($show == 'menu') { require HORDE_TEMPLATES . '/help/menu.inc'; } elseif ($show == 'about') { require $fileroot . '/lib/version.php'; eval('$version = "' . ucfirst($module) . ' " . ' . String::upper($module) . '_VERSION;'); $credits = Util::bufferOutput('include', $fileroot . '/docs/CREDITS'); $credits = String::convertCharset($credits, 'iso-8859-1', NLS::getCharset()); require HORDE_TEMPLATES . '/help/about.inc'; } else { require HORDE_TEMPLATES . '/help/header.inc'; $help = new Help(HELP_SOURCE_FILE, array($help_file, $help_file_fallback)); if ($show == 'entry' && !empty($topic)) { $help->lookup($topic); $help->display(); } else { $topics = $help->topics(); foreach ($topics as $id => $title) { $link = Horde::url($registry->getParam('webroot', 'horde') . '/services/help/'); $link = Util::addParameter($link, array('show' => 'entry', 'module' => $module, 'topic' => $id)); echo Horde::link($link, '', 'helpitem'); echo $title . "</a><br />\n"; } } $help->cleanup(); require HORDE_TEMPLATES . '/help/footer.inc'; } } require HORDE_TEMPLATES . '/common-footer.inc';
$config = new Horde_Config($app); if ($config->writePHPConfig($vars, $php)) { Horde::url('admin/config/index.php', true)->redirect(); } else { $notification->push(sprintf(_("Could not save the configuration file %s. You can either use one of the options to save the code back on %s or copy manually the code below to %s."), Horde_Util::realPath($configFile), Horde::link(Horde::url('admin/config/index.php') . '#update', _("Configuration")) . _("Configuration") . '</a>', Horde_Util::realPath($configFile)), 'horde.warning', array('content.raw', 'sticky')); } } elseif ($form->isSubmitted()) { $notification->push(_("There was an error in the configuration form. Perhaps you left out a required field."), 'horde.error'); } $view = new Horde_View(array('templatePath' => HORDE_TEMPLATES . '/admin/config')); $view->addHelper('Text'); $view->php = $php; /* Create the link for the diff popup only if stored in session. */ if ($session->exists('horde', 'config/' . $app)) { $url = Horde::url('admin/config/diff.php', true)->add('app', $app); $view->diff_popup = Horde::link('#', '', '', '', Horde::popupJs($url, array('height' => 480, 'width' => 640, 'urlencode' => true)) . 'return false;') . _("show differences") . '</a>'; } Horde::startBuffer(); require HORDE_TEMPLATES . '/admin/menu.inc'; $menu_output = Horde::endBuffer(); /* Render the configuration form. */ $renderer = $form->getRenderer(); $renderer->setAttrColumnWidth('50%'); /* Buffer the form template */ Horde::startBuffer(); $form->renderActive($renderer, $vars, Horde::url('admin/config/config.php'), 'post'); $view->form = Horde::endBuffer(); /* Send headers */ $page_output->header(array('title' => $title)); /* Output page */ echo $menu_output . $view->render('config');
/** * Renders this page in display mode. * * @throws Wicked_Exception */ public function display() { $version = Horde_Util::getFormData('version'); $page = Wicked_Page::getPage($this->referrer(), $version); $msg = sprintf(_("Are you sure you want to revert to version %s of this page?"), $version); ?> <form method="post" name="revertform" action="<?php echo Wicked::url('RevertPage'); ?> "> <?php Horde_Util::pformInput(); ?> <input type="hidden" name="page" value="RevertPage" /> <input type="hidden" name="actionID" value="special" /> <input type="hidden" name="version" value="<?php echo htmlspecialchars($version); ?> " /> <input type="hidden" name="referrer" value="<?php echo htmlspecialchars($page->pageName()); ?> " /> <h1 class="header"> <?php echo _("Revert Page") . ': ' . Horde::link($page->pageUrl(), $page->pageName()) . $page->pageName() . '</a>'; if ($page->isLocked()) { echo Horde::img('locked.png', _("Locked")); } ?> </h1> <div class="headerbox" style="padding:4px"> <p><?php echo $msg; ?> </p> <p> <input type="submit" value="<?php echo _("Revert"); ?> " class="horde-default" /> <a class="horde-cancel" href="<?php echo Wicked::url($page->pageName()); ?> "><?php echo _("Cancel"); ?> </a> </p> </div> </form> <?php }