Skip to content

Commit

Permalink
feature 3095 : block comment if website_url is not empty when field i…
Browse files Browse the repository at this point in the history
…s disabled

git-svn-id: http://piwigo.org/svn/trunk@28893 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
mistic100 committed Jul 1, 2014
1 parent f279f62 commit 6cb53bb
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions include/functions_comment.inc.php
Expand Up @@ -146,15 +146,23 @@ function insert_user_comment(&$comm, $key, &$infos)
// 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 (!$conf['comments_enable_website'])
{ // honeypot: if the field is disabled, it should be empty !
$comment_action='reject';
$_POST['cr'][] = 'website_url';
}
if (!url_check_format($comm['website_url']))
else
{
$infos[] = l10n('Your website URL is invalid');
$comment_action='reject';
$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';
}
}
}

Expand Down Expand Up @@ -206,6 +214,7 @@ function insert_user_comment(&$comm, $key, &$infos)
{
$infos[] = l10n('Anti-flood system : please wait for a moment before trying to post another comment');
$comment_action='reject';
$_POST['cr'][] = 'flood_time';
}
}

Expand Down

0 comments on commit 6cb53bb

Please sign in to comment.