本文整理汇总了PHP中Horde::selfUrlParams方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde::selfUrlParams方法的具体用法?PHP Horde::selfUrlParams怎么用?PHP Horde::selfUrlParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde
的用法示例。
在下文中一共展示了Horde::selfUrlParams方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _init
/**
*/
protected function _init()
{
global $injector, $notification, $page_output, $registry, $session;
$imp_mailbox = $this->indices->mailbox->list_ob;
switch ($mode = $this->vars->get('mode', 'thread')) {
case 'thread':
/* THREAD MODE: Make sure we have a valid index. */
list($m, $u) = $this->indices->getSingle();
$imp_indices = $imp_mailbox->getFullThread($u, $m);
break;
default:
/* MSGVIEW MODE: Make sure we have a valid list of messages. */
$imp_indices = $this->indices;
break;
}
if (!count($imp_indices)) {
$notification->push(_("Could not load message."), 'horde.error');
$this->indices->mailbox->url('mailbox')->redirect();
}
/* Run through action handlers. */
switch ($this->vars->actionID) {
case 'add_address':
try {
$contact_link = $injector->getInstance('IMP_Contacts')->addAddress($this->vars->address, $this->vars->name);
$notification->push(sprintf(_("Entry \"%s\" was successfully added to the address book"), $contact_link), 'horde.success', array('content.raw'));
} catch (Horde_Exception $e) {
$notification->push($e);
}
break;
}
$msgs = $tree = array();
$subject = '';
$page_label = $this->indices->mailbox->label;
$imp_ui = $injector->getInstance('IMP_Message_Ui');
$query = new Horde_Imap_Client_Fetch_Query();
$query->envelope();
/* Force images to show in HTML data. */
$injector->getInstance('IMP_Images')->alwaysShow = true;
$multiple = count($imp_indices) > 1;
foreach ($imp_indices as $ob) {
$imp_imap = $ob->mbox->imp_imap;
$fetch_res = $imp_imap->fetch($ob->mbox, $query, array('ids' => $imp_imap->getIdsOb($ob->uids)));
foreach ($ob->uids as $idx) {
$envelope = $fetch_res[$idx]->getEnvelope();
/* Get the body of the message. */
$curr_msg = $curr_tree = array();
$contents = $injector->getInstance('IMP_Factory_Contents')->create($ob->mbox->getIndicesOb($idx));
$mime_id = $contents->findBody();
if ($contents->canDisplay($mime_id, IMP_Contents::RENDER_INLINE)) {
$ret = $contents->renderMIMEPart($mime_id, IMP_Contents::RENDER_INLINE);
$ret = reset($ret);
$curr_msg['body'] = $ret['data'];
if (!empty($ret['js'])) {
$page_output->addInlineScript($ret['js'], true);
}
} else {
$curr_msg['body'] = '<em>' . _("There is no text that can be displayed inline.") . '</em>';
}
$curr_msg['idx'] = $idx;
/* Get headers for the message. */
$date_ob = new IMP_Message_Date($envelope->date);
$curr_msg['date'] = $date_ob->format($date_ob::DATE_LOCAL);
if ($this->indices->mailbox->special_outgoing) {
$curr_msg['addr_to'] = true;
$curr_msg['addr'] = _("To:") . ' ' . $imp_ui->buildAddressLinks($envelope->to, Horde::selfUrlParams());
$addr = _("To:") . ' ' . htmlspecialchars($envelope->to[0]->label, ENT_COMPAT, 'UTF-8');
} else {
$from = $envelope->from;
$curr_msg['addr_to'] = false;
$curr_msg['addr'] = $imp_ui->buildAddressLinks($from, Horde::selfUrlParams());
$addr = htmlspecialchars($from[0]->label, ENT_COMPAT, 'UTF-8');
}
$subject_header = htmlspecialchars($envelope->subject, ENT_COMPAT, 'UTF-8');
switch ($mode) {
case 'thread':
if (empty($subject)) {
$subject = preg_replace('/^re:\\s*/i', '', $subject_header);
}
$curr_msg['link'] = $multiple ? Horde::widget(array('url' => '#display', 'title' => _("Thread List"), 'nocheck' => true)) : '';
$curr_tree['subject'] = $imp_mailbox->getThreadOb($imp_mailbox->getArrayIndex($fetch_res[$idx]->getUid(), $ob->mbox) + 1)->img;
break;
default:
$curr_msg['link'] = Horde::widget(array('url' => '#display', 'title' => _("Back to Multiple Message View Index"), 'nocheck' => true));
$curr_tree['subject'] = '';
break;
}
switch ($registry->getView()) {
case $registry::VIEW_BASIC:
$curr_msg['link'] .= ' | ' . Horde::widget(array('url' => $this->indices->mailbox->url('message', $idx), 'title' => _("Go to Message"), 'nocheck' => true)) . ' | ' . Horde::widget(array('url' => $this->indices->mailbox->url('mailbox')->add(array('start' => $imp_mailbox->getArrayIndex($idx))), 'title' => sprintf(_("Bac_k to %s"), $page_label)));
break;
}
$curr_tree['subject'] .= Horde::link('#i' . $idx) . Horde_String::truncate($subject_header, 60) . '</a> (' . $addr . ')';
$msgs[] = $curr_msg;
$tree[] = $curr_tree;
}
}
/* Flag messages as seen. */
$injector->getInstance('IMP_Message')->flag(array('add' => array(Horde_Imap_Client::FLAG_SEEN)), $imp_indices);
//.........这里部分代码省略.........
示例2: getSummary
//.........这里部分代码省略.........
*
* IMP_Contents::SUMMARY_ICON
* IMP_Contents::SUMMARY_ICON_RAW
* Output: parts = 'icon'
*
* IMP_Contents::SUMMARY_DESCRIP
* Output: parts = 'description_raw'
*
* IMP_Contents::SUMMARY_DESCRIP_LINK
* Output: parts = 'description'
*
* IMP_Contents::SUMMARY_DOWNLOAD
* Output: parts = 'download', 'download_url'
*
* IMP_Contents::SUMMARY_IMAGE_SAVE
* Output: parts = 'img_save'
*
* IMP_Contents::SUMMARY_PRINT
* IMP_Contents::SUMMARY_PRINT_STUB
* Output: parts = 'print'
*
* IMP_Contents::SUMMARY_STRIP
* Output: parts = 'strip'
* </pre>
*
* @return array An array with the requested information.
*/
public function getSummary($id, $mask = 0)
{
$autodetect_link = false;
$param_array = array();
$this->_buildMessage();
$part = array('bytes' => null, 'download' => null, 'download_url' => null, 'id' => $id, 'img_save' => null, 'size' => null, 'strip' => null);
$mime_part = $this->getMimePart($id, array('nocontents' => true));
if (!$mime_part) {
return $part;
}
$mime_type = $mime_part->getType();
/* If this is an attachment that has no specific MIME type info, see
* if we can guess a rendering type. */
if (in_array($mime_type, array('application/octet-stream', 'application/base64'))) {
$mime_type = Horde_Mime_Magic::filenameToMIME($mime_part->getName());
if ($mime_type == $mime_part->getType()) {
$autodetect_link = true;
} else {
$mime_part = clone $mime_part;
$mime_part->setType($mime_type);
$param_array['ctype'] = $mime_type;
}
}
$part['type'] = $mime_type;
/* Is this part an attachment? */
$is_atc = $mime_part->isAttachment();
/* Get bytes/size information. */
if ($mask & self::SUMMARY_BYTES || $mask & self::SUMMARY_SIZE) {
$part['bytes'] = $size = $mime_part->getBytes();
$part['size'] = $size > 1048576 ? sprintf(_("%s MB"), IMP::numberFormat($size / 1048576, 1)) : sprintf(_("%s KB"), max(round($size / 1024), 1));
}
/* Get part's icon. */
if ($mask & self::SUMMARY_ICON || $mask & self::SUMMARY_ICON_RAW) {
$part['icon'] = $GLOBALS['injector']->getInstance('IMP_Factory_MimeViewer')->getIcon($mime_type);
if ($mask & self::SUMMARY_ICON) {
$part['icon'] = Horde_Themes_Image::tag($part['icon'], array('attr' => array('title' => $mime_type)));
}
} else {
$part['icon'] = null;
}
/* Get part's description. */
$description = $this->getPartName($mime_part, true);
if ($mask & self::SUMMARY_DESCRIP_LINK) {
if (($can_d = $this->canDisplay($mime_part, self::RENDER_FULL)) || $autodetect_link) {
$part['description'] = $this->linkViewJS($mime_part, 'view_attach', htmlspecialchars($description), array('jstext' => sprintf(_("View %s"), $description), 'params' => array_filter(array_merge($param_array, array('autodetect' => !$can_d)))));
} else {
$part['description'] = htmlspecialchars($description);
}
}
if ($mask & self::SUMMARY_DESCRIP) {
$part['description_raw'] = $description;
}
/* Download column. */
if ($is_atc && $mask & self::SUMMARY_DOWNLOAD) {
$part['download'] = $this->linkView($mime_part, 'download_attach', '', array('attr' => array('download' => $mime_part->getName(true) ?: $mime_part->getPrimaryType()), 'class' => 'iconImg downloadAtc', 'jstext' => _("Download")));
$part['download_url'] = $this->urlView($mime_part, 'download_attach');
}
/* Display the image save link if the required registry calls are
* present. */
if ($mask & self::SUMMARY_IMAGE_SAVE && $GLOBALS['registry']->hasMethod('images/selectGalleries') && $mime_part->getPrimaryType() == 'image') {
$part['img_save'] = Horde::link('#', _("Save Image in Gallery"), 'iconImg saveImgAtc', null, Horde::popupJs(IMP_Basic_Saveimage::url(), array('params' => array('muid' => strval($this->getIndicesOb()), 'id' => $id), 'height' => 200, 'width' => 450, 'urlencode' => true)) . 'return false;') . '</a>';
}
/* Add print link? */
if (($mask & self::SUMMARY_PRINT || $mask & self::SUMMARY_PRINT_STUB) && $this->canDisplay($id, self::RENDER_FULL)) {
$part['print'] = $mask & self::SUMMARY_PRINT ? $this->linkViewJS($mime_part, 'print_attach', '', array('css' => 'iconImg printAtc', 'jstext' => _("Print"), 'onload' => 'IMP_JS.printWindow', 'params' => $param_array)) : Horde::link('#', _("Print"), 'iconImg printAtc', null, null, null, null, array('mimeid' => $id)) . '</a>';
}
/* Strip Attachment? Allow stripping of base parts other than the
* base multipart and the base text (body) part. */
if ($mask & self::SUMMARY_STRIP && $id != 0 && intval($id) != 1 && strpos($id, '.') === false) {
$part['strip'] = Horde::link(Horde::selfUrlParams()->add(array('actionID' => 'strip_attachment', 'imapid' => $id, 'muid' => strval($this->getIndicesOb()), 'token' => $GLOBALS['session']->getToken())), _("Strip Attachment"), 'iconImg deleteImg stripAtc', null, null, null, null, array('mimeid' => $id)) . '</a>';
}
return $part;
}
示例3: _init
//.........这里部分代码省略.........
if (!empty($envelope->reply_to) && $envelope->from[0]->bare_address != $envelope->reply_to[0]->bare_address && ($reply_to = $imp_ui->buildAddressLinks($envelope->reply_to, $self_link))) {
$display_headers['reply-to'] = $reply_to;
}
/* Determine if all/list/user-requested headers needed. */
$all_headers = $this->vars->show_all_headers;
$user_hdrs = $imp_ui->getUserHeaders();
/* Check for the presence of mailing list information. */
$list_info = $imp_ui->getListInformation($mime_headers);
/* Display all headers or, optionally, the user-specified headers for
* the current identity. */
$full_headers = array();
if ($all_headers) {
$header_array = $mime_headers->toArray();
foreach ($header_array as $head => $val) {
$lc_head = strtolower($head);
/* Skip the header if we have already dealt with it. */
if (!isset($display_headers[$lc_head]) && (!in_array($lc_head, array('importance', 'x-priority')) || !isset($display_headers['priority']))) {
$full_headers[$lc_head] = $val;
}
}
} elseif (!empty($user_hdrs)) {
foreach ($user_hdrs as $user_hdr) {
$user_val = $mime_headers->getValue($user_hdr);
if (!empty($user_val)) {
$full_headers[$user_hdr] = $user_val;
}
}
}
ksort($full_headers);
/* For the self URL link, we can't trust the index in the query string
* as it may have changed if we deleted/copied/moved messages. We may
* need other stuff in the query string, so we need to do an
* add/remove of uid info. */
$selfURL = $mailbox->url(Horde::selfUrlParams()->remove(array('actionID')), $buid)->add('token', $token);
$headersURL = $selfURL->copy()->remove(array('show_all_headers'));
/* Generate previous/next links. */
$prev_msg = $imp_mailbox[$imp_mailbox->getIndex() - 1];
if ($prev_msg) {
$prev_url = self::url(array('buid' => $imp_mailbox->getBuid($prev_msg['m'], $prev_msg['u']), 'mailbox' => $mailbox))->setRaw(true);
$page_output->addLinkTag(array('href' => $prev_url, 'id' => 'prev', 'rel' => 'Previous', 'type' => null));
} else {
$prev_url = null;
}
$next_msg = $imp_mailbox[$imp_mailbox->getIndex() + 1];
if ($next_msg) {
$next_url = self::url(array('buid' => $imp_mailbox->getBuid($next_msg['m'], $next_msg['u']), 'mailbox' => $mailbox))->setRaw(true);
$page_output->addLinkTag(array('href' => $next_url, 'id' => 'next', 'rel' => 'Next', 'type' => null));
} else {
$next_url = null;
}
/* Generate the mailbox link. */
$mailbox_url = $mailbox->url('mailbox')->add('start', $msgindex);
/* Everything below here is related to preparing the output. */
$js_vars = array('ImpMessage.text' => array('innocent_report' => _("Are you sure you wish to report this message as innocent?"), 'moveconfirm' => _("Are you sure you want to move the message(s)? (Some message information might get lost, like message headers, text formatting or attachments!)"), 'newmbox' => _("You are copying/moving to a new mailbox.") . "\n" . _("Please enter a name for the new mailbox:") . "\n", 'spam_report' => _("Are you sure you wish to report this message as spam?"), 'target_mbox' => _("You must select a target mailbox first.")));
/* Set the status information of the message. */
$msgAddresses[] = $mime_headers->getValue('from');
$identity = $match_identity = $imp_identity->getMatchingIdentity($msgAddresses);
if (is_null($identity)) {
$identity = $imp_identity->getDefault();
}
$flag_parse = $imp_flags->parse(array('flags' => $flags, 'personal' => $match_identity));
$status = '';
foreach ($flag_parse as $val) {
if ($val instanceof IMP_Flag_User) {
$status .= '<span class="' . $val->css . '" style="' . ($val->bgdefault ? '' : 'background:' . htmlspecialchars($val->bgcolor) . ';') . 'color:' . htmlspecialchars($val->fgcolor) . '">' . htmlspecialchars($val->label) . '</span>';
} else {
示例4: _outputPGPSigned
/**
* Generates HTML output for 'multipart/signed' MIME parts.
*
* @return string The HTML output.
*/
protected function _outputPGPSigned()
{
global $conf, $injector, $prefs, $registry, $session;
$partlist = array_keys($this->_mimepart->contentTypeMap());
$base_id = reset($partlist);
$signed_id = next($partlist);
$sig_id = Horde_Mime::mimeIdArithmetic($signed_id, 'next');
if (!$prefs->getValue('use_pgp') || empty($conf['gnupg']['path'])) {
return array($sig_id => null);
}
$status = new IMP_Mime_Status();
$status->addText(_("The data in this part has been digitally signed via PGP."));
$status->icon('mime/encryption.png', 'PGP');
$ret = array($base_id => array('data' => '', 'nosummary' => true, 'status' => array($status), 'type' => 'text/html; charset=' . $this->getConfigParam('charset'), 'wrap' => 'mimePartWrap'), $sig_id => null);
if ($prefs->getValue('pgp_verify') || $injector->getInstance('Horde_Variables')->pgp_verify_msg) {
$imp_contents = $this->getConfigParam('imp_contents');
$sig_part = $imp_contents->getMIMEPart($sig_id);
$status2 = new IMP_Mime_Status();
if (!$sig_part) {
$status2->action(IMP_Mime_Status::ERROR);
$sig_text = _("This digitally signed message is broken.");
$ret[$base_id]['wrap'] = 'mimePartWrapInvalid';
} else {
/* Close session, since this may be a long-running
* operation. */
$session->close();
try {
$imp_pgp = $injector->getInstance('IMP_Crypt_Pgp');
if ($sig_raw = $sig_part->getMetadata(Horde_Crypt_Pgp_Parse::SIG_RAW)) {
$sig_result = $imp_pgp->verifySignature($sig_raw, $this->_getSender()->bare_address, null, $sig_part->getMetadata(Horde_Crypt_Pgp_Parse::SIG_CHARSET));
} else {
$stream = $imp_contents->isEmbedded($signed_id) ? $this->_mimepart->getMetadata(self::PGP_SIGN_ENC) : $imp_contents->getBodyPart($signed_id, array('mimeheaders' => true, 'stream' => true))->data;
rewind($stream);
stream_filter_register('horde_eol', 'Horde_Stream_Filter_Eol');
stream_filter_append($stream, 'horde_eol', STREAM_FILTER_READ, array('eol' => Horde_Mime_Part::RFC_EOL));
$sig_result = $imp_pgp->verifySignature(stream_get_contents($stream), $this->_getSender()->bare_address, $sig_part->getContents());
}
$status2->action(IMP_Mime_Status::SUCCESS);
$sig_text = $sig_result->message;
$ret[$base_id]['wrap'] = 'mimePartWrapValid';
} catch (Horde_Exception $e) {
$status2->action(IMP_Mime_Status::ERROR);
$sig_text = $e->getMessage();
$ret[$base_id]['wrap'] = 'mimePartWrapInvalid';
}
}
$status2->addText($this->_textFilter($sig_text, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::NOHTML)));
$ret[$base_id]['status'][] = $status2;
} else {
switch ($registry->getView()) {
case Horde_Registry::VIEW_BASIC:
$status->addText(Horde::link(Horde::selfUrlParams()->add(array('pgp_verify_msg' => 1))) . _("Click HERE to verify the message.") . '</a>');
break;
case Horde_Registry::VIEW_DYNAMIC:
$status->addText(Horde::link('#', '', 'pgpVerifyMsg') . _("Click HERE to verify the message.") . '</a>');
break;
}
}
return $ret;
}
示例5: _parseSignedData
/**
* Parse signed data.
*
* @param boolean $sig_only Only do signature checking?
*
* @return mixed See self::_getEmbeddedMimeParts().
*/
protected function _parseSignedData($sig_only = false)
{
$partlist = array_keys($this->_mimepart->contentTypeMap());
$base_id = reset($partlist);
$data_id = next($partlist);
$sig_id = Horde_Mime::mimeIdArithmetic($data_id, 'next');
/* Initialize inline data. */
$status = new IMP_Mime_Status(_("The data in this part has been digitally signed via S/MIME."));
$status->icon('mime/encryption.png', 'S/MIME');
$cache = $this->getConfigParam('imp_contents')->getViewCache();
$cache->smime[$base_id] = array('sig' => $sig_id, 'status' => $status, 'wrap' => 'mimePartWrap');
if (!$GLOBALS['prefs']->getValue('use_smime')) {
$status->addText(_("S/MIME support is not enabled so the digital signature is unable to be verified."));
return null;
}
/* Sanity checking to make sure MIME structure is correct. */
if (!in_array($sig_id, $partlist)) {
$status->action(IMP_Mime_Status::ERROR);
$cache->smime[$base_id]['wrap'] = 'mimePartWrapInvalid';
$status->addText(_("Invalid S/MIME data."));
/* This will suppress displaying the invalid part. */
$cache->smime[$base_id]['sig'] = $data_id;
return null;
}
$imp_contents = $this->getConfigParam('imp_contents');
$stream = $imp_contents->isEmbedded($base_id) ? $this->_mimepart->getMetadata('imp-smime-decrypt')->stream : $this->_getPartStream($base_id);
$raw_text = $this->_mimepart->replaceEOL($stream, Horde_Mime_Part::RFC_EOL);
$this->_initSmime();
$sig_result = null;
if ($GLOBALS['prefs']->getValue('smime_verify') || $GLOBALS['injector']->getInstance('Horde_Variables')->smime_verify_msg) {
try {
$sig_result = $this->_impsmime->verifySignature($raw_text);
if ($sig_result->verify) {
$status->action(IMP_Mime_Status::SUCCESS);
} else {
$status->action(IMP_Mime_Status::WARNING);
}
$cache->smime[$base_id]['wrap'] = 'mimePartWrapValid';
$email = is_array($sig_result->email) ? implode(', ', $sig_result->email) : $sig_result->email;
$status->addText($sig_result->msg);
if (!empty($sig_result->cert)) {
$cert = $this->_impsmime->parseCert($sig_result->cert);
if (isset($cert['certificate']['subject']['CommonName']) && strcasecmp($email, $cert['certificate']['subject']['CommonName']) !== 0) {
$email = $cert['certificate']['subject']['CommonName'] . ' (' . trim($email) . ')';
}
}
if (!empty($sig_result->cert) && isset($sig_result->email) && $GLOBALS['registry']->hasMethod('contacts/addField') && $GLOBALS['prefs']->getValue('add_source')) {
$status->addText(sprintf(_("Sender: %s"), $imp_contents->linkViewJS($this->_mimepart, 'view_attach', htmlspecialchars(strlen($email) ? $email : $sig_result->email), array('jstext' => _("View certificate details"), 'params' => array('mode' => IMP_Contents::RENDER_INLINE, 'view_smime_key' => 1)))));
try {
$this->_impsmime->getPublicKey($sig_result->email);
} catch (Horde_Exception $e) {
$imple = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Imple')->create('IMP_Ajax_Imple_ImportEncryptKey', array('mime_id' => $base_id, 'muid' => strval($imp_contents->getIndicesOb()), 'type' => 'smime'));
$status->addText(Horde::link('#', '', '', '', '', '', '', array('id' => $imple->getDomId())) . _("Save the certificate to your Address Book.") . '</a>');
}
} elseif (strlen($email)) {
$status->addText(sprintf(_("Sender: %s"), htmlspecialchars($email)));
}
} catch (Horde_Exception $e) {
$status->action(IMP_Mime_Status::ERROR);
$cache->smime[$base_id]['wrap'] = 'mimePartWrapInvalid';
$status->addText($e->getMessage());
}
} else {
switch ($GLOBALS['registry']->getView()) {
case Horde_Registry::VIEW_BASIC:
$status->addText(Horde::link(Horde::selfUrlParams()->add('smime_verify_msg', 1)) . _("Click HERE to verify the data.") . '</a>');
break;
case Horde_Registry::VIEW_DYNAMIC:
$status->addText(Horde::link('#', '', 'smimeVerifyMsg') . _("Click HERE to verify the data.") . '</a>');
break;
}
}
if ($sig_only) {
return;
}
$subpart = $imp_contents->getMIMEPart($sig_id);
if (empty($subpart)) {
try {
$msg_data = $this->_impsmime->extractSignedContents($raw_text);
$subpart = Horde_Mime_Part::parseMessage($msg_data, array('forcemime' => true));
} catch (Horde_Exception $e) {
$status->addText($e->getMessage());
return null;
}
}
return $subpart;
}