[TYPO3-core] RFC: Bug 3985: Wrong spamProtectEmailAddresses_lastDotSubst

Patrick Broens patrick at patrickbroens.nl
Tue Feb 6 15:45:43 CET 2007


Ingmar Schlecht wrote:
> Sounds reasonable, +1 by looking at the patch.
> 
> Due to personal taste, I would change the line
>    $linktxtIsMailAddress = $linktxt == $mailAddress ? true : false;
> to either
>    $linktxtIsMailAddress = ($linktxt == $mailAddress ? true : false);
> or
>    $linktxtIsMailAddress = ($linktxt == $mailAddress);
> 
Looking at the patch +1
I agree with Ingmar about the coding style :-)

Cheers,

Patrick
> cheers
> Ingmar
> 
> Ps.: Stucki just said he'll package RC1 tonight, so until then trunk is
> open.
> 
> 
> Oliver Hader schrieb:
>> This is a SVN patch request.
>>
>> Problem:
>> spamProtectEmailAddresses_atSubst and
>> spamProtectEmailAddresses_lastDotSubst substitutes tokens, that are not
>> part of the initial e-mail address. A TypoScript example:
>> page = PAGE
>> page {
>>   typeNum = 0
>>   config {
>>     spamProtectEmailAddresses = 2
>>     spamProtectEmailAddresses_lastDotSubst = [dot]
>>   }
>>   10 = TEXT
>>   10.value = typo3.org e-mail
>>   10.typolink.parameter = someone at typo3.org
>> }
>> Result: "typo3[dot]org e-mail", substituted in text-value
>>
>> Solution:
>> Check if the link text processed is the initial e-mail address. If so,
>> do the substitutions. Otherwise don't.
>>
>> Bugtracker references:
>> http://bugs.typo3.org/view.php?id=3985
>>
>> Branch: Trunk
>>
>>
>> olly
>>
>>
>> ------------------------------------------------------------------------
>>
>> Index: typo3/sysext/cms/tslib/class.tslib_content.php
>> ===================================================================
>> --- typo3/sysext/cms/tslib/class.tslib_content.php	(Revision 2005)
>> +++ typo3/sysext/cms/tslib/class.tslib_content.php	(Arbeitskopie)
>> @@ -5475,6 +5475,7 @@
>>  	 */
>>  	function getMailTo($mailAddress,$linktxt,$initP='?') {
>>  		if(!strcmp($linktxt,''))	{ $linktxt = $mailAddress; }
>> +		$linktxtIsMailAddress = $linktxt == $mailAddress ? true : false;
>>  
>>  		$mailToUrl = 'mailto:'.$mailAddress;
>>  
>> @@ -5488,12 +5489,16 @@
>>  				if ($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_atSubst']) {
>>  					$atLabel = trim($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_atSubst']);
>>  				}
>> -				$linktxt = str_replace('@',$atLabel?$atLabel:'(at)',$linktxt);
>> +				if ($linktxtIsMailAddress) {
>> +					$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 ($linktxtIsMailAddress) {
>> +						$linktxt = preg_replace('/\.([^\.]+)$/', $lastDotLabel.'$1', $linktxt);
>> +					}
>>  				}
>>  			}
>>  		} else {
> 
> 


More information about the TYPO3-team-core mailing list