[TYPO3-core] RFC: Bug 4476: Allow limitation of config.linkVars
Michael Stucki
michael at typo3.org
Tue Feb 6 08:02:23 CET 2007
Dmitry, could you have a look at this meanwhile? Otherwise I might suggest
that I commit the feature as is (since the basic idea seams to be approved)
and you change the details according to the comments below during the RC
phase...
- michael
Michael Stucki wrote:
> Hi Dmitry,
>
> sorry for the delayed response, but thanks a lot for looking so carefully
> at this issue!
>
>> Let's rename isAllowedLinkVar to isAllowedLinkVarValue because it checks
>> value, not variable [name].
>
> ACK
>
>> Second, if regular expression contains comma, logic breaks :( Not sure
>> how to fix it better.
>
> True. The solution might be to define the linkvar several times:
>
> config.linkVars = L(|aaa|), L(|bbb|)
>
> I didn't test this for now, but I think it should be possible this way...
>
>> Third, range check for numbers does not work (wrong comparison there),
>> should be:
>> if ($range[0] <= $haystack && $range[1] >= $haystack)
>> while now it is:
>> if ($range[0] >= $haystack && $range[1] <= $haystack)
>
> Right, how could I miss this?!
>
>> Forth, it is impossible to use comma inside regular expression (as I
>> wrote above) and modifiers after it (i.e. /[a-z]/ will work but /[a-z/i
>> will not). Modifiers can be fixed with:
>> preg_match('/^\/.+\/[imsxeADSUXu]*$/', $needle)
>
> Cool! The same might be good in t3lib_matchcondition, too... Can you do
> that, please?
>
>> Fifth, I am not sure if list should allow spaces between items, i.e.
>> (aaa | bbb | ccc), but I like spaces :) So I did comparison with regular
>> expression.
>
> I think this should have worked with my first solution already?
>
> + $haystack = str_replace(' ','',$haystack); // Trim the input
> + if (strstr('|'.$needle.'|', '|'.$haystack.'|')) {
> + $OK = TRUE;
> + }
>
> If there is a space in the list, then it will be removed here. There
> cannot be any spaces in a URL. So what is wrong with this attempt?
>
>> Otherwise all ok. I attach changes here as updated patch.
>
> Thanks a lot! I agree to all changes except the last one, because I think
> it is not neccessary to use preg_match here. But feel free to override my
> proposal if you are sure that I am wrong... ;-)
>
>> Sometimes I hate myself for being too pedantic :(
>
> That's the bad side of good quality :-)
>
> - michael
--
Use a newsreader! Check out
http://typo3.org/community/mailing-lists/use-a-news-reader/
More information about the TYPO3-team-core
mailing list