Hi Support!
I'm getting flooded with comments containing URLs in various cases (Http, HTTP, hTtP, etc)
The Link check is not working, I have the config set to allow "0" links
Can your preg_match_all check for case-insensitive URLs?
// we do here only BASIC spam check (plugins can do more)
if ( !is_a_guest() )
return $action;
$link_count = preg_match_all( '/https?:\/\//',
$comment['content'], $matches);
if ( strpos($comment['author'], 'http://')!==false )
{
$link_count++;
}
Piwigo 2.9.5
Operating system: Linux
PHP: 7.1.27 (Show info) [2019-04-10 12:20:17]
MySQL: 5.5.60-0+deb7u1-log [2019-04-10 12:20:17]
Graphics Library: External ImageMagick 6.8.9-9
Piwigo URL: http://www.popasmoke.com/visions
Offline
You could do a 'strtoupper' fucntion on the comment URL, and then match it to "HTTP".
But I think you would be better off using a dedicated plugin.
Offline
open an issue to github https://github.com/Piwigo/Piwigo/issues
until then try this code to see if it works, i made it case insensitive and switched author to regex to detect also 'https'
$link_count = preg_match_all( '/https?:\/\//i', $comment['content'], $matches); if (preg_match('/https?:\/\//i', $comment['author'])) { $link_count++; }
Last edited by eliz82 (2019-04-11 11:46:24)
Offline
Thanks, that seems to work! Much appreciated.
Offline