feature 3095 : block comment if website_url is not empty when field is disabled

git-svn-id: http://piwigo.org/svn/trunk@28893 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
mistic100
2014-07-01 09:56:02 +00:00
parent f279f62e12
commit 6cb53bb91b

View File

@@ -146,15 +146,23 @@ SELECT COUNT(*) AS user_exists
// website
if (!empty($comm['website_url']))
{
$comm['website_url'] = strip_tags($comm['website_url']);
if (!preg_match('/^https?/i', $comm['website_url']))
{
$comm['website_url'] = 'http://'.$comm['website_url'];
}
if (!url_check_format($comm['website_url']))
{
$infos[] = l10n('Your website URL is invalid');
if (!$conf['comments_enable_website'])
{ // honeypot: if the field is disabled, it should be empty !
$comment_action='reject';
$_POST['cr'][] = 'website_url';
}
else
{
$comm['website_url'] = strip_tags($comm['website_url']);
if (!preg_match('/^https?/i', $comm['website_url']))
{
$comm['website_url'] = 'http://'.$comm['website_url'];
}
if (!url_check_format($comm['website_url']))
{
$infos[] = l10n('Your website URL is invalid');
$comment_action='reject';
}
}
}
@@ -206,6 +214,7 @@ SELECT count(1) FROM '.COMMENTS_TABLE.'
{
$infos[] = l10n('Anti-flood system : please wait for a moment before trying to post another comment');
$comment_action='reject';
$_POST['cr'][] = 'flood_time';
}
}