Feature #14270
closedspamprotect if mail adress bug
Added by old_hoang over 20 years ago. Updated over 18 years ago.
0%
Description
in function typoLink in class.tslib_content.php the line
if(strstr($link_param,'@') && !$pU['scheme']) { // If it's a mail address:
is strange. I remember $pU['scheme'] is not set everytime correctly. So I changed it to:
if(strstr($link_param,'@')) { // If it's a mail address:
Now even mailtos in tables where spamprotected! Unfortunately there is an error in table element, which split encrypted code into to table cells! I will try to fix it!
Chi Hoang
(issue imported from #M286)
Files
0000286-encryptEmailAddresses.diff (3.41 KB) 0000286-encryptEmailAddresses.diff | Administrator Admin, 2005-03-27 21:11 | ||
0000286-06_encryptEmailAddresses_new.diff (6.56 KB) 0000286-06_encryptEmailAddresses_new.diff | Administrator Admin, 2005-03-28 18:28 |
Updated by old_hoang over 20 years ago
in table element some adresses get split because of the split token "|".
see:
styles.content.table = TEXT
styles.content.table {
current = 1
if.isTrue.current = 1
trim = 1
parseFunc < styles.content.parseFunc
split {
token.char = 10
cObjNum = 1 || 2
1.current = 1
1.trim =1
1.required = 1
1.split {
token = |
max.field = cols
min.field = cols
cObjNum = 1 || 2
1.current = 1
1.fontTag = |
1.textStyle < styles.content.textStyle
1.textStyle.altWrap = {$styles.content.table.altWrap}
1.wrap = <td valign="top">|</td>
2 < .1
}
2 < .1
wrap = <tr>|</tr>
}
tableStyle < styles.content.tableStyle
}
and example for a encrypted mailto:
ocknvq<Mctn/Jgkp|0JqtpBNchctig0eqo
result:
mailto get splited in the middle and ended up in 2 table cells!
suggestion:
put a modulo into it? like:
http://mitglied.lycos.de/cthoeing/crypto/classic.htm
edited on: 12.08.04 17:04
Updated by old_hoang over 20 years ago
Here is my bugfix:
in class.tslib_pagegen.php in function pagegenInit():
if ($GLOBALS['TSFE']->spamProtectEmailAddresses) {
$GLOBALS['TSFE']->additionalJavaScript['UnCryptMailto()']='
// JS function for uncrypting spam-protected emails:
function UnCryptMailto(s) { //
var n=0;
var r="";
for(var i=0; i < s.length; i++) {
n=s.charCodeAt(i);
//chi hoang 12.08.04
if (n>=8364) {n = 128;}
var temp = (n-('.$GLOBALS['TSFE']->spamProtectEmailAddresses.') + 123) % 123 ;
if (temp < 36) {
temp+=36;
}
r += String.fromCharCode(temp);
}
return r;
}
// JS function for uncrypting spam-protected emails:
function linkTo_UnCryptMailto(s) { //
location.href=UnCryptMailto(s);
}
';
}
and in class.tslib_fe.php
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);
//chi hoang 12.08.04
$charValue = bcmod($charValue, 123);
if ($charValue < 36) {
$charValue+=36;
}
$out.= chr($charValue);
}
return $out;
}
Updated by Michael Stucki about 20 years ago
Looks like two different subjects.
The $pU (= parsed url) thing won't be touched until I see a good reason for this.
The 2nd problem (mail addresses in tables) is not reproducable here. There are two possible reasons:
- it is fixed already
- config.spamProtectEmailAddresses is not 1. What value did you set here?
Updated by old_chihoang about 20 years ago
1. this is for T3 3.5
2. config.spamProtectEmailAddresses is set to 1 of course.
3. I posted this very long ago, nobody seems to care (and I forgot some of my way to the solution, but it works)
4. I left out the $pU (dont know what it is for)
5. There is a problem in encryption if the value of the char to be encrypted ( either if the char is greater then ascii table or if the encrypted char is the "|". ) which cause bugs in the table object. Please read carefully my advise.
Updated by Michael Stucki about 20 years ago
1. this is for T3 3.5
There will be no more fixed for 3.5.0. Please make sure the bug still exists in 3.7.0, otherwise it's just a waste of time.
2. config.spamProtectEmailAddresses is set to 1 of course.
Sure? "Other than 1" doesn't mean it's disabled, see TSref. I asked this because of #5, see below.
3. I posted this very long ago, nobody seems to care (and I forgot some of my way to the solution, but it works)
Sorry for that, we are only a very small team. Feel free to help us and we have more time to look at all problems.
4. I left out the $pU (dont know what it is for)
OK, drop this.
5. There is a problem in encryption if the value of the char to be encrypted ( either if the char is greater then ascii table or if the encrypted
char is the "|". ) which cause bugs in the table object. Please read carefully my advise.
I know. However as long as I cannot reproduce it I will not fix this because it is not needed eventually.
I suppose that this problem is caused on a special value for config.spamProtectEmailAddresses that translates one of the characters to a "|". So please tell me how you made this.
Updated by old_chihoang about 20 years ago
sorry, i used this settings (default):
config.spamProtectEmailAddresses = 2
config.spamProtectEmailAddresses_atSubst = (at)
Sure? "Other than 1" doesn't mean it's disabled, see TSref. I asked this because of 5, see below.
link didn't work
I suppose that this problem is caused on a special value for >config.spamProtectEmailAddresses that translates one of the >characters to a "|". So please tell me how you made this.
No, function encryptEmail uses a "Verschiebechiffren" (i dont know english word for it) with no start and stop parameter (encryption table is the whole ascii charset and no start and stop!)
Updated by Michael Stucki over 19 years ago
I have attached a new patch against todays CVS HEAD (was changed because of #0000351).
Please check this and tell me if it works. I tested it here and it seems to work fine.
Updated by Michael Stucki over 19 years ago
Fixed but totally different:
config.spamProtectEmailAddresses now only accepts values from -2 to 2. This will never cause a "|" to be generated, thus the problem is solved.