Make emtpy/invalid links non-clickable

pull/1/head
thomascube 13 years ago
parent c886de7ff4
commit c8c53f4ad1

@ -1231,7 +1231,8 @@ function rcmail_alter_html_link($matches)
$end = '>'; $end = '>';
// Remove non-printable characters in URL (#1487805) // Remove non-printable characters in URL (#1487805)
$attrib['href'] = preg_replace('/[\x00-\x1F]/', '', $attrib['href']); if ($attrib['href'])
$attrib['href'] = preg_replace('/[\x00-\x1F]/', '', $attrib['href']);
if ($tag == 'link' && preg_match('/^https?:\/\//i', $attrib['href'])) { if ($tag == 'link' && preg_match('/^https?:\/\//i', $attrib['href'])) {
$tempurl = 'tmp-' . md5($attrib['href']) . '.css'; $tempurl = 'tmp-' . md5($attrib['href']) . '.css';
@ -1246,6 +1247,10 @@ function rcmail_alter_html_link($matches)
JS_OBJECT_NAME, JS_OBJECT_NAME,
JQ($mailto[1].$mailto[3])); JQ($mailto[1].$mailto[3]));
} }
else if (empty($attrib['href']) && !$attrib['name']) {
$attrib['href'] = './#NOP';
$attrib['onclick'] = 'return false';
}
else if (!empty($attrib['href']) && $attrib['href'][0] != '#') { else if (!empty($attrib['href']) && $attrib['href'][0] != '#') {
$attrib['target'] = '_blank'; $attrib['target'] = '_blank';
} }

Loading…
Cancel
Save