$parts[0] = substr($textpieces[$i],0,$len);
$parts[1] = substr($textpieces[$i],$len);
$linktxt = ereg_replace('\?.*','',$parts[0]);
- if (!$GLOBALS['TSFE']->config['config']['jumpurl_enable'] || $GLOBALS['TSFE']->config['config']['jumpurl_mailto_disable']) {
- if ($GLOBALS['TSFE']->spamProtectEmailAddresses) {
- $mailToUrl = "javascript:linkTo_UnCryptMailto('".$GLOBALS['TSFE']->encryptEmail('mailto:'.$parts[0])."');";
- $atLabel = trim($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_atSubst']);
- $linktxt = str_replace('@',$atLabel ? $atLabel : '(at)', $linktxt);
+ if (!$GLOBALS['TSFE']->config['config']['jumpurl_enable'] || $GLOBALS['TSFE']->config['config']['jumpurl_mailto_disable']) {
+ if ($GLOBALS['TSFE']->spamProtectEmailAddresses) {
+ if ($GLOBALS['TSFE']->spamProtectEmailAddresses == 'ascii') {
+ $mailToUrl = $GLOBALS['TSFE']->encryptEmail('mailto:'.$parts[0]);
+ } else {
+ $mailToUrl = "javascript:linkTo_UnCryptMailto('".$GLOBALS['TSFE']->encryptEmail('mailto:'.$parts[0])."');";
+ }
+ if ($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_atSubst']) {
+ $atLabel = trim($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_atSubst']);
+ $linktxt = str_replace('@',$atLabel?$atLabel:'(at)',$linktxt);
+ }
+ if ($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_lastDotSubst']) {
+ $lastDotLabel = trim($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_lastDotSubst']);
+ $lastDotLabel = $lastDotLabel ? $lastDotLabel : '(dot)';
+ $linktxt = preg_replace('/\.([^\.]+)$/', $lastDotLabel.'$1', $linktxt);
+ }
} else {
$mailToUrl = 'mailto:'.$parts[0];
}
if ($linktxt=='') $linktxt = $link_param;
if (!$GLOBALS['TSFE']->config['config']['jumpurl_enable'] || $GLOBALS['TSFE']->config['config']['jumpurl_mailto_disable']) {
$this->lastTypoLinkUrl = 'mailto:'.$link_param;
- if ($GLOBALS['TSFE']->spamProtectEmailAddresses) {
- $this->lastTypoLinkUrl = "javascript:linkTo_UnCryptMailto('".$GLOBALS['TSFE']->encryptEmail($this->lastTypoLinkUrl)."');";
- $atLabel = trim($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_atSubst']);
- $linktxt=str_replace('@',$atLabel?$atLabel:'(at)',$linktxt);
+ if ($GLOBALS['TSFE']->spamProtectEmailAddresses) {
+ if ($GLOBALS['TSFE']->spamProtectEmailAddresses == 'ascii') {
+ $this->lastTypoLinkUrl = $GLOBALS['TSFE']->encryptEmail($this->lastTypoLinkUrl);
+ } else {
+ $this->lastTypoLinkUrl = "javascript:linkTo_UnCryptMailto('".$GLOBALS['TSFE']->encryptEmail($this->lastTypoLinkUrl)."');";
+ }
+ if ($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_atSubst']) {
+ $atLabel = trim($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_atSubst']);
+ $linktxt = str_replace('@',$atLabel?$atLabel:'(at)',$linktxt);
+ }
+ if ($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_lastDotSubst']) {
+ $lastDotLabel = trim($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_lastDotSubst']);
+ $lastDotLabel = $lastDotLabel ? $lastDotLabel : '(dot)';
+ $linktxt = preg_replace('/\.([^\.]+)$/', $lastDotLabel.'$1', $linktxt);
+ }
}
} else {
$this->lastTypoLinkUrl = $GLOBALS['TSFE']->absRefPrefix.$GLOBALS['TSFE']->config['mainScript'].$initP.'&jumpurl='.rawurlencode('mailto:'.$link_param).$GLOBALS['TSFE']->getMethodUrlIdToken;
$onClick="vHWin=window.open('".$GLOBALS['TSFE']->baseUrlWrap($finalTagParts['url'])."','FEopenLink','".$JSwindowParams."');vHWin.focus();return false;";
$res = '<a href="#" onclick="'.htmlspecialchars($onClick).'"'.($linkClass?' class="'.$linkClass.'"':'').$finalTagParts['aTagParams'].'>';
} else {
- $res = '<a href="'.htmlspecialchars($finalTagParts['url']).'"'.$finalTagParts['targetParams'].($linkClass?' class="'.$linkClass.'"':'').$finalTagParts['aTagParams'].'>';
+ if ($GLOBALS['TSFE']->spamProtectEmailAddresses == 'ascii') {
+ $res = '<a href="'.$finalTagParts['url'].'"'.$finalTagParts['targetParams'].($linkClass?' class="'.$linkClass.'"':'').$finalTagParts['aTagParams'].'>';
+ } else {
+ $res = '<a href="'.htmlspecialchars($finalTagParts['url']).'"'.$finalTagParts['targetParams'].($linkClass?' class="'.$linkClass.'"':'').$finalTagParts['aTagParams'].'>';
+ }
}
// Call user function:
*/
function encryptEmail($string,$back=0) {
$out = '';
- for ($a=0; $a<strlen($string); $a++) {
- $charValue = ord(substr($string,$a,1));
- $charValue+= intval($this->spamProtectEmailAddresses)*($back?-1:1);
- $out.= chr($charValue);
+
+ if ($this->spamProtectEmailAddresses == 'ascii') {
+ for ($a=0; $a<strlen($string); $a++) {
+ $out .= '&#'.ord(substr($string, $a, 1)).';';
+ }
+ } else {
+ for ($a=0; $a<strlen($string); $a++) {
+ $charValue = ord(substr($string,$a,1));
+ $charValue+= intval($this->spamProtectEmailAddresses)*($back?-1:1);
+ $out.= chr($charValue);
+ }
}
return $out;
}
// Internal and External target defaults
$GLOBALS['TSFE']->intTarget = ''.$GLOBALS['TSFE']->config['config']['intTarget'];
$GLOBALS['TSFE']->extTarget = ''.$GLOBALS['TSFE']->config['config']['extTarget'];
- $GLOBALS['TSFE']->spamProtectEmailAddresses = t3lib_div::intInRange($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses'],-5,5,0);
- if ($GLOBALS['TSFE']->spamProtectEmailAddresses) {
- $GLOBALS['TSFE']->additionalJavaScript['UnCryptMailto()']='
+ if ($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses'] == 'ascii') {
+ $GLOBALS['TSFE']->spamProtectEmailAddresses = 'ascii';
+ } else {
+ $GLOBALS['TSFE']->spamProtectEmailAddresses = t3lib_div::intInRange($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses'],-5,5,0);
+ if ($GLOBALS['TSFE']->spamProtectEmailAddresses) {
+ $GLOBALS['TSFE']->additionalJavaScript['UnCryptMailto()']='
// JS function for uncrypting spam-protected emails:
function UnCryptMailto(s) { //
var n=0;
location.href=UnCryptMailto(s);
}
';
+ }
}