META tags must be in HEAD tag to be correct HTML/XHTML.
So we need to disable prefetching for the entire page - but only on
pages where we are working with mail data.
}
/**
+ * Adds a META tag to disable DNS prefetching.
+ * See Horde Bug #8836.
+ */
+ static public function noDnsPrefetch()
+ {
+ self::addMetaTag('x-dns-prefetch-control', 'off');
+ }
+
+ /**
* Output META tags to page.
*/
static public function outputMetaTags()
// Make URLs clickable.
$text = Horde_Text_Filter::filter($text, 'linkurls', array(
- 'callback' => 'Horde::externalUrl',
- // See Ticket #8836
- 'noprefetch' => ($inline && $GLOBALS['browser']->isBrowser('mozilla') && !$GLOBALS['browser']->usingSSLConnection())
+ 'callback' => 'Horde::externalUrl'
));
/* Wordwrap -- note this could impact on our above RFC compliance *IF*
* DEFAULT: The base part charset.
* 'inline' => (boolean) Are we viewing inline?
* DEFAULT: false
+ * 'noprefetch' => (boolean) Disable DNS prefetching?
+ * DEFAULT: false
* 'phishing' => (boolean) Do phishing highlighting even if not viewing
* inline.
* DEFAULT: false.
),
array(
'body_only' => !empty($options['inline']),
- // See Ticket #8836
- 'noprefetch' => (!empty($options['inline']) && $browser->isBrowser('mozilla') && !$browser->usingSSLConnection()),
+ 'noprefetch' => !empty($options['noprefetch']),
'strip_styles' => $strip_styles,
'strip_style_attributes' => $strip_style_attributes
)
}
if ($this->_params['noprefetch']) {
- if (preg_match('/<html[^>]*>/si', $text, $matches, PREG_OFFSET_CAPTURE)) {
- preg_match('/<\/html>/si', $text, $matches2, PREG_OFFSET_CAPTURE);
+ if (preg_match('/<head[^>]*>/si', $text, $matches, PREG_OFFSET_CAPTURE)) {
$end = $matches[0][1] + strlen($matches[0][0]);
$text = substr($text, 0, $end) .
'<meta http-equiv="x-dns-prefetch-control" value="off" />' .
- substr($text, $end, $matches2[0][1] - $end) .
- '<meta http-equiv="x-dns-prefetch-control" value="on" />' .
- substr($text, $matches2[0][1]);
+ substr($text, $end);
} else {
- $text = '<meta http-equiv="x-dns-prefetch-control" value="off" />' .
- $text .
- '<meta http-equiv="x-dns-prefetch-control" value="on" />';
+ $text = '<meta http-equiv="x-dns-prefetch-control" value="off" />' . $text;
}
}
}
Horde::addInlineScript($js_code, 'load');
+Horde::noDnsPrefetch();
IMP_Dimp::header('', $scripts);
/* Get application folders list. */
$data = $this->_mimepart->getContents();
/* Sanitize the HTML. */
- $data = $this->_cleanHTML($data, array('phishing' => $inline));
+ $data = $this->_cleanHTML($data, array(
+ 'noprefetch' => ($inline && ($_SESSION['imp']['view'] != 'mimp')),
+ 'phishing' => $inline
+ ));
$status = array($this->_phishingStatus());
/* We are done processing if in mimp mode, or we are converting to
$filters = array(
'text2html' => array(
'charset' => $charset,
- // See Ticket #8836
- 'noprefetch' => ($GLOBALS['browser']->isBrowser('mozilla') && !$GLOBALS['browser']->usingSSLConnection()),
'parselevel' => $inline ? Horde_Text_Filter_Text2html::MICRO : Horde_Text_Filter_Text2html::MICRO_LINKURL
),
'tabs2spaces' => array(),
$filters = array(
'text2html' => array(
'charset' => Horde_Nls::getCharset(),
- // See Ticket #8836
- 'noprefetch' => ($GLOBALS['browser']->isBrowser('mozilla') && !$GLOBALS['browser']->usingSSLConnection()),
'parselevel' => Horde_Text_Filter_Text2html::MICRO
),
'tabs2spaces' => array(),
break;
} elseif (empty($data['email'])) {
if ($url = Horde_Text_Filter::filter($match, 'linkurls', array(
- 'callback' => 'Horde::externalUrl',
- // See Ticket #8836
- 'noprefetch' => ($GLOBALS['browser']->isBrowser('mozilla') && !$GLOBALS['browser']->usingSSLConnection())
+ 'callback' => 'Horde::externalUrl'
))) {
if (!empty($opts['raw'])) {
return $match;
public function getDisplaySubject($subject)
{
return Horde_Text_Filter::filter(preg_replace("/\b\s+\b/", ' ', IMP::filterText($subject)), 'text2html', array(
- // See Ticket #8836
- 'noprefetch' => ($GLOBALS['browser']->isBrowser('mozilla') && !$GLOBALS['browser']->usingSSLConnection()),
'parselevel' => Horde_Text_Filter_Text2html::MICRO
));
}
Horde::addInlineScript($js_out);
Horde::addInlineScript(array_filter($js_onload), 'load');
+Horde::noDnsPrefetch();
+
IMP::status();
IMP_Dimp::header($show_msg_result['title'], $scripts);
echo "<body>\n";
$title = $display_headers['subject'];
$t->set('title', ($status ? $status . ' ' : '') . sprintf(_("(Message %d of %d)"), $msgindex, $msgcount));
+Horde::noDnsPrefetch();
+
require IMP_TEMPLATES . '/common-header.inc';
IMP::status();
echo $t->fetch(IMP_TEMPLATES . '/mimp/message/message.html');
Horde::addScriptFile('imp.js', 'imp');
Horde::addScriptFile('message.js', 'imp');
IMP::prepareMenu();
+Horde::noDnsPrefetch();
+
require IMP_TEMPLATES . '/common-header.inc';
+
if (!empty($conf['maillog']['use_maillog'])) {
IMP_Maillog::displayLog($envelope['message-id']);
}
/* Output page. */
$title = ($mode == 'thread') ? _("Thread View") : _("Multiple Message View");
Horde::addScriptFile('stripe.js', 'horde');
+Horde::noDnsPrefetch();
IMP::prepareMenu();
require IMP_TEMPLATES . '/common-header.inc';
IMP::menu();