From 2fa1013ace21fe6df7beb9c8505a256244fa637e Mon Sep 17 00:00:00 2001 From: mistic100 Date: Sun, 11 Nov 2012 15:01:09 +0000 Subject: feature:2786 Allow to edit website url in user comments + improve "user experience" on comment edition git-svn-id: http://piwigo.org/svn/trunk@18995 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/functions_comment.inc.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'include/functions_comment.inc.php') diff --git a/include/functions_comment.inc.php b/include/functions_comment.inc.php index 67716216c..b388439f5 100644 --- a/include/functions_comment.inc.php +++ b/include/functions_comment.inc.php @@ -309,7 +309,7 @@ $user_where_clause.' function update_user_comment($comment, $post_key) { - global $conf; + global $conf, $page; $comment_action = 'validate'; @@ -335,6 +335,20 @@ function update_user_comment($comment, $post_key) ) ); + // website + if (!empty($comment['website_url'])) + { + if (!preg_match('/^https?/i', $comment['website_url'])) + { + $comment['website_url'] = 'http://'.$comment['website_url']; + } + if (!url_check_format($comment['website_url'])) + { + array_push($page['errors'], l10n('Your website URL is invalid')); + $comment_action='reject'; + } + } + if ( $comment_action!='reject' ) { $user_where_clause = ''; @@ -347,6 +361,7 @@ function update_user_comment($comment, $post_key) $query = ' UPDATE '.COMMENTS_TABLE.' SET content = \''.$comment['content'].'\', + website_url = '.(!empty($comment['website_url']) ? '\''.$comment['website_url'].'\'' : 'NULL').', validated = \''.($comment_action=='validate' ? 'true':'false').'\', validation_date = '.($comment_action=='validate' ? 'NOW()':'NULL').' WHERE id = '.$comment['comment_id']. -- cgit v1.2.3