aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_comment.inc.php
diff options
context:
space:
mode:
authormistic100 <mistic@piwigo.org>2012-08-03 17:02:24 +0000
committermistic100 <mistic@piwigo.org>2012-08-03 17:02:24 +0000
commitd7bf41b3ef59453e5e84e0d5352e698e9274f660 (patch)
tree10f65c86201cecb06615f5cc199be219080014a1 /include/functions_comment.inc.php
parentefdb998cee7d3a6cdeda811fd86f04f3092fd467 (diff)
feature 2380: add URL for user comment
git-svn-id: http://piwigo.org/svn/trunk@17351 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions_comment.inc.php')
-rw-r--r--include/functions_comment.inc.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/include/functions_comment.inc.php b/include/functions_comment.inc.php
index 51e83cd81..e812a1c6f 100644
--- a/include/functions_comment.inc.php
+++ b/include/functions_comment.inc.php
@@ -127,6 +127,17 @@ SELECT COUNT(*) AS user_exists
$_POST['cr'][] = 'key'; // rvelices: I use this outside to see how spam robots work
}
+ // website
+ if ( !empty($comm['website_url']) and !preg_match('/^https?/i', $comm['website_url']) )
+ {
+ $comm['website_url'] = 'http://'.$comm['website_url'];
+ }
+ if ( !empty($comm['website_url']) and !url_check_format($comm['website_url']) )
+ {
+ array_push($infos, l10n('Your website URL is invalid'));
+ $comment_action='reject';
+ }
+
// anonymous id = ip address
$ip_components = explode('.', $comm['ip']);
if (count($ip_components) > 3)
@@ -168,7 +179,7 @@ SELECT count(1) FROM '.COMMENTS_TABLE.'
{
$query = '
INSERT INTO '.COMMENTS_TABLE.'
- (author, author_id, anonymous_id, content, date, validated, validation_date, image_id)
+ (author, author_id, anonymous_id, content, date, validated, validation_date, image_id, website_url)
VALUES (
\''.$comm['author'].'\',
'.$comm['author_id'].',
@@ -177,7 +188,8 @@ INSERT INTO '.COMMENTS_TABLE.'
NOW(),
\''.($comment_action=='validate' ? 'true':'false').'\',
'.($comment_action=='validate' ? 'NOW()':'NULL').',
- '.$comm['image_id'].'
+ '.$comm['image_id'].',
+ '.(!empty($comm['website_url']) ? '\''.$comm['website_url'].'\'' : 'NULL').'
)
';