Project

General

Profile

Feature #14270 » 0000286-06_encryptEmailAddresses_new.diff

Administrator Admin, 2005-03-28 18:28

View differences:

typo3/sysext/cms/tslib/class.tslib_fe.php 28 Mar 2005 14:57:13 -0000
$out.= chr($charValue);
}
}
if(ereg('\|', $out)) { return false; } // Make sure that no "|" is in the encrypted email address. This is not very beautiful but needed because it would break table elements (the character would split a table element).
return $out;
}
-- typo3/sysext/cms/tslib/class.tslib_content.php.orig 28 Mar 2005 11:14:35 -0000 1.64
++ typo3/sysext/cms/tslib/class.tslib_content.php 28 Mar 2005 14:57:01 -0000
......
$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) {
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);
if (!$GLOBALS['TSFE']->config['config']['jumpurl_enable'] || $GLOBALS['TSFE']->config['config']['jumpurl_mailto_disable']) {
$mailToUrl = 'mailto:'.$parts[0]; // The email address is not protected by default
if($GLOBALS['TSFE']->spamProtectEmailAddresses) {
$encryptedEmail = $GLOBALS['TSFE']->encryptEmail('mailto:'.$parts[0]);
if($encryptedEmail) { // If the encryptEmail returns false, do not encrypted the address. See tslib_fe->encryptEmail() for better explanation.
if($GLOBALS['TSFE']->spamProtectEmailAddresses=='ascii') {
$mailToUrl = $encryptedEmail;
} else {
$mailToUrl = "javascript:linkTo_UnCryptMailto('".$encryptedEmail."');";
}
}
} else {
$mailToUrl = 'mailto:'.$parts[0];
$atLabel = trim($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_atSubst']);
$linktxt = str_replace('@', $atLabel ? $atLabel : '(at)', $linktxt);
}
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);
}
$res = '<a href="'.htmlspecialchars($mailToUrl).'"'.$aTagParams.'>';
} else {
$res = '<a href="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.$GLOBALS['TSFE']->config['mainScript'].$initP.'&jumpurl='.rawurlencode('mailto:'.$parts[0]).$GLOBALS['TSFE']->getMethodUrlIdToken).'"'.$aTagParams.'>';
......
$link_param = eregi_replace('^mailto:','',$link_param);
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) {
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);
$this->lastTypoLinkUrl = 'mailto:'.$link_param; // The email address is not protected by default
if($GLOBALS['TSFE']->spamProtectEmailAddresses) {
$encryptedEmail = $GLOBALS['TSFE']->encryptEmail('mailto:'.$link_param);
if($encryptedEmail) { // If the encryptEmail returns false, do not encrypted the address. See tslib_fe->encryptEmail() for better explanation.
if($GLOBALS['TSFE']->spamProtectEmailAddresses=='ascii') {
$this->lastTypoLinkUrl = $encryptedEmail;
} else {
$this->lastTypoLinkUrl = "javascript:linkTo_UnCryptMailto('".$encryptedEmail."');";
}
}
$atLabel = trim($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_atSubst']);
$linktxt = str_replace('@', $atLabel ? $atLabel : '(at)', $linktxt);
}
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;
(2-2/2)