+2004-03-31 Kasper Skårhøj,,, <kasper@typo3.com>
+
+ * Fixed spam-protection of email adresses inserted by "mailto:..." in text.
+
2004-03-31 Kasper Skårhøj,,, <kasper@typo3.com>
* Fixed another small bug in detection of simulateStaticDocuments.
$textstr = $textpieces[0];
$initP = '?id='.$GLOBALS['TSFE']->id.'&type='.$GLOBALS['TSFE']->type;
for($i=1; $i<$pieces; $i++) {
- $len=strcspn($textpieces[$i],chr(32).chr(9).chr(13).chr(10));
+ $len = strcspn($textpieces[$i],chr(32).chr(9).chr(13).chr(10));
if (trim(substr($textstr,-1))=='' && $len) {
- $lastChar=substr($textpieces[$i],$len-1,1);
+ $lastChar = substr($textpieces[$i],$len-1,1);
if (!ereg('[A-Za-z0-9]',$lastChar)) {$len--;}
- $parts[0]=substr($textpieces[$i],0,$len);
- $parts[1]=substr($textpieces[$i],$len);
- $linktxt=ereg_replace('\?.*','',$parts[0]);
+ $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']) {
- $res = '<a href="mailto:'.htmlspecialchars($parts[0]).'"'.$aTagParams.'>';
+ 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);
+ } else {
+ $mailToUrl = 'mailto:'.$parts[0];
+ }
+ $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.'>';
}
* 2342: function makeSimulFileName($inTitle,$page,$type,$addParams='',$no_cache='')
* 2389: function simulateStaticDocuments_pEnc_onlyP_proc($linkVars)
* 2417: function getSimulFileName()
- * 2430: function encryptEmail($string,$back=0)
+ * 2430: function encryptEmail($string,$back=0)
* 2447: function checkFileInclude($incFile)
* 2462: function newCObj()
* 2475: function setAbsRefPrefix()
* @return string encoded/decoded version of $string
*/
function encryptEmail($string,$back=0) {
- $out='';
- for ($a=0;$a<strlen($string);$a++) {
+ $out = '';
+ for ($a=0; $a<strlen($string); $a++) {
$charValue = ord(substr($string,$a,1));
- $charValue+=intval($GLOBALS['TSFE']->spamProtectEmailAddresses)*($back?-1:1);
- $out.=chr($charValue);
+ $charValue+= intval($GLOBALS['TSFE']->spamProtectEmailAddresses)*($back?-1:1);
+ $out.= chr($charValue);
}
return $out;
}
* @see tslib_cObj::PHP_SCRIPT(), tslib_feTCE::includeScripts(), tslib_menu::includeMakeMenu()
*/
function checkFileInclude($incFile) {
- return !$GLOBALS['TYPO3_CONF_VARS']['FE']['noPHPscriptInclude']
+ return !$GLOBALS['TYPO3_CONF_VARS']['FE']['noPHPscriptInclude']
|| substr($incFile,0,14)=='media/scripts/'
|| substr($incFile,0,4+strlen(TYPO3_mainDir))==TYPO3_mainDir.'ext/'
|| substr($incFile,0,7+strlen(TYPO3_mainDir))==TYPO3_mainDir.'sysext/'