diff options
author | mistic100 <mistic@piwigo.org> | 2012-11-11 15:01:09 +0000 |
---|---|---|
committer | mistic100 <mistic@piwigo.org> | 2012-11-11 15:01:09 +0000 |
commit | 2fa1013ace21fe6df7beb9c8505a256244fa637e (patch) | |
tree | 47546c1d28894f816779758385e53f5c31c2f66e /include | |
parent | c81093b0e943d3625554c808ecb072ef20615d6f (diff) |
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
Diffstat (limited to 'include')
-rw-r--r-- | include/functions_comment.inc.php | 17 |
1 files changed, 16 insertions, 1 deletions
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']. |