diff options
author | mistic100 <mistic@piwigo.org> | 2014-07-01 09:56:02 +0000 |
---|---|---|
committer | mistic100 <mistic@piwigo.org> | 2014-07-01 09:56:02 +0000 |
commit | 6cb53bb91bb2f5fef56b52d2e3013dd8ea4db952 (patch) | |
tree | 613b5c16c71ffe1c19fa1a754a4b60cc5e1f2df0 /include | |
parent | f279f62e12f48afb206390568a0b2ca5e79facfe (diff) |
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
Diffstat (limited to '')
-rw-r--r-- | include/functions_comment.inc.php | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/include/functions_comment.inc.php b/include/functions_comment.inc.php index 3cb0f79c7..9bd0b9f25 100644 --- a/include/functions_comment.inc.php +++ b/include/functions_comment.inc.php @@ -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 (!$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'; + } } } @@ -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'; } } |