Index: /trunk/comments.php
===================================================================
--- /trunk/comments.php	(revision 17350)
+++ /trunk/comments.php	(revision 17351)
@@ -383,4 +383,5 @@
        com.author_id,
        com.date,
+       com.website_url,
        com.content,
        com.validated
@@ -478,4 +479,5 @@
       'ALT' => $name,
       'AUTHOR' => trigger_event('render_comment_author', $comment['author']),
+      'WEBSITE_URL' => $comment['website_url'],
       'DATE'=>format_date($comment['date'], true),
       'CONTENT'=>trigger_event('render_comment_content',$comment['content']),
Index: /trunk/include/functions.inc.php
===================================================================
--- /trunk/include/functions.inc.php	(revision 17350)
+++ /trunk/include/functions.inc.php	(revision 17351)
@@ -1693,3 +1693,19 @@
   return $is_mobile_theme;
 }
+
+/**
+ * check url format
+ */
+function url_check_format($url)
+{
+  if (version_compare(PHP_VERSION, '5.2.0') >= 0)
+  {
+    return filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED | FILTER_FLAG_HOST_REQUIRED)!==false;
+  }
+  else
+  {
+    // http://mathiasbynens.be/demo/url-regex @imme_emosol
+    return (bool)preg_match('@^https?://(-\.)?([^\s/?\.#-]+\.?)+(/[^\s]*)?$@iS', $url);
+  }
+}
 ?>
Index: /trunk/include/functions_comment.inc.php
===================================================================
--- /trunk/include/functions_comment.inc.php	(revision 17350)
+++ /trunk/include/functions_comment.inc.php	(revision 17351)
@@ -128,4 +128,15 @@
   }
   
+  // 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']);
@@ -169,5 +180,5 @@
     $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'].'\',
@@ -178,5 +189,6 @@
     \''.($comment_action=='validate' ? 'true':'false').'\',
     '.($comment_action=='validate' ? 'NOW()':'NULL').',
-    '.$comm['image_id'].'
+    '.$comm['image_id'].',
+    '.(!empty($comm['website_url']) ? '\''.$comm['website_url'].'\'' : 'NULL').'
   )
 ';
Index: /trunk/include/picture_comment.inc.php
===================================================================
--- /trunk/include/picture_comment.inc.php	(revision 17350)
+++ /trunk/include/picture_comment.inc.php	(revision 17351)
@@ -49,4 +49,5 @@
     'author' => trim( @$_POST['author'] ),
     'content' => trim( $_POST['content'] ),
+    'website_url' => trim( $_POST['website_url'] ),
     'image_id' => $page['image_id'],
    );
@@ -146,4 +147,5 @@
     date,
     image_id,
+    website_url,
     content,
     validated
@@ -179,4 +181,5 @@
           'DATE' => format_date($row['date'], true),
           'CONTENT' => trigger_event('render_comment_content',$row['content']),
+          'WEBSITE_URL' => $row['website_url'],
         );
 
@@ -242,9 +245,10 @@
   {
     $key = get_ephemeral_key(3, $page['image_id']);
-    $content = $author = '';
+    $content = $author = $website_url = '';
     if ('reject'===@$comment_action)
     {
       $content = htmlspecialchars( stripslashes($comm['content']) );
       $author = htmlspecialchars( stripslashes($comm['author']) );
+      $website_url = htmlspecialchars( stripslashes($comm['website_url']) );
     }
     $template->assign('comment_add',
@@ -255,4 +259,5 @@
           'SHOW_AUTHOR' => !is_classic_user(),
           'AUTHOR' => $author ,
+          'WEBSITE_URL' => $website_url, 
         ));
   }
Index: /trunk/install/db/129-database.php
===================================================================
--- /trunk/install/db/129-database.php	(revision 17351)
+++ /trunk/install/db/129-database.php	(revision 17351)
@@ -0,0 +1,38 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based photo gallery                                    |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2012 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+  die('Hacking attempt!');
+}
+
+$upgrade_description = 'add "website_url" field in comments table';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+$query = 'ALTER TABLE `'.COMMENTS_TABLE.'` ADD `website_url` varchar(255) DEFAULT NULL;';
+pwg_query($query);
+
+echo "\n".$upgrade_description."\n";
+
+?>
Index: /trunk/install/piwigo_structure-mysql.sql
===================================================================
--- /trunk/install/piwigo_structure-mysql.sql	(revision 17350)
+++ /trunk/install/piwigo_structure-mysql.sql	(revision 17351)
@@ -54,4 +54,5 @@
   `author_id` smallint(5) DEFAULT NULL,
   `anonymous_id` varchar(45) NOT NULL,
+  `website_url` varchar(255) DEFAULT NULL,
   `content` longtext,
   `validated` enum('true','false') NOT NULL default 'false',
Index: /trunk/themes/default/template/comment_list.tpl
===================================================================
--- /trunk/themes/default/template/comment_list.tpl	(revision 17350)
+++ /trunk/themes/default/template/comment_list.tpl	(revision 17351)
@@ -55,5 +55,6 @@
 		{/if}
 
-		<span class="commentAuthor">{$comment.AUTHOR}</span> - <span class="commentDate">{$comment.DATE}</span>
+		<span class="commentAuthor">{if $comment.WEBSITE_URL}<a href="{$comment.WEBSITE_URL}" class="external" target="_blank">{$comment.AUTHOR}</a>{else}{$comment.AUTHOR}{/if}</span> 
+      - <span class="commentDate">{$comment.DATE}</span>
 		{if isset($comment.IN_EDIT)}
 		<a name="edit_comment"></a>
Index: /trunk/themes/default/template/picture.tpl
===================================================================
--- /trunk/themes/default/template/picture.tpl	(revision 17350)
+++ /trunk/themes/default/template/picture.tpl	(revision 17351)
@@ -350,6 +350,8 @@
 					<p><label for="author">{'Author'|@translate} :</label></p>
 					<p><input type="text" name="author" id="author" value="{$comment_add.AUTHOR}"></p>
-					<p><label for="contentid">{'Comment'|@translate} :</label></p>
 				{/if}
+        <p><label for="website_url">{'Website'|@translate} :</label></p>
+			  <p><input type="text" name="website_url" id="website_url" value="{$comment_add.WEBSITE_URL}"></p>
+			  <p><label for="contentid">{'Comment'|@translate} :</label></p>
 				<p><textarea name="content" id="contentid" rows="5" cols="50">{$comment_add.CONTENT}</textarea></p>
 				<p><input type="hidden" name="key" value="{$comment_add.KEY}">
