Index: /trunk/admin.php
===================================================================
--- /trunk/admin.php	(revision 12886)
+++ /trunk/admin.php	(revision 12887)
@@ -190,8 +190,12 @@
     'U_ADD_PHOTOS' => $link_start.'photos_add',
     'U_CHANGE_THEME' => $change_theme_url,
-    'U_PENDING_COMMENTS' => $link_start.'comments',
     'U_UPDATES' => $link_start.'updates',
     )
   );
+  
+if ($conf['activate_comments'])
+{
+  $template->assign('U_PENDING_COMMENTS', $link_start.'comments');
+}
 
 // +-----------------------------------------------------------------------+
Index: /trunk/admin/cat_modify.php
===================================================================
--- /trunk/admin/cat_modify.php	(revision 12886)
+++ /trunk/admin/cat_modify.php	(revision 12887)
@@ -49,9 +49,13 @@
       'id' => $_GET['cat_id'],
       'name' => @$_POST['name'],
-      'commentable' => isset($_POST['commentable'])?$_POST['commentable']:'false',
       'comment' =>
         $conf['allow_html_descriptions'] ?
           @$_POST['comment'] : strip_tags(@$_POST['comment']),
       );
+     
+  if ($conf['activate_comments'])
+  {
+    $data['commentable'] = isset($_POST['commentable'])?$_POST['commentable']:'false';
+  }
 
   mass_updates(
@@ -223,5 +227,4 @@
     'CAT_STATUS'        => $category['status'],
     'CAT_VISIBLE'       => boolean_to_string($category['visible']),
-    'CAT_COMMENTABLE'   => boolean_to_string($category['commentable']),
 
     'U_JUMPTO' => make_index_url(
@@ -239,4 +242,9 @@
     )
   );
+ 
+if ($conf['activate_comments'])
+{
+  $template->assign('CAT_COMMENTABLE', boolean_to_string($category['commentable']));
+}
 
 
Index: /trunk/admin/cat_options.php
===================================================================
--- /trunk/admin/cat_options.php	(revision 12886)
+++ /trunk/admin/cat_options.php	(revision 12887)
@@ -143,5 +143,8 @@
 $tabsheet->add('status', l10n('Public / Private'), $opt_link.'status');
 $tabsheet->add('visible', l10n('Lock'), $opt_link.'visible');
-$tabsheet->add('comments', l10n('Comments'), $opt_link.'comments');
+if ($conf['activate_comments'])
+{
+  $tabsheet->add('comments', l10n('Comments'), $opt_link.'comments');
+}
 if ($conf['allow_random_representative'])
 {
Index: /trunk/admin/configuration.php
===================================================================
--- /trunk/admin/configuration.php	(revision 12886)
+++ /trunk/admin/configuration.php	(revision 12887)
@@ -67,4 +67,5 @@
 
 $comments_checkboxes = array(
+    'activate_comments',
     'comments_forall',
     'comments_validation',
Index: /trunk/admin/intro.php
===================================================================
--- /trunk/admin/intro.php	(revision 12886)
+++ /trunk/admin/intro.php	(revision 12887)
@@ -185,10 +185,4 @@
 ;';
 list($nb_groups) = pwg_db_fetch_row(pwg_query($query));
-
-$query = '
-SELECT COUNT(*)
-  FROM '.COMMENTS_TABLE.'
-;';
-list($nb_comments) = pwg_db_fetch_row(pwg_query($query));
 
 $query = '
@@ -219,5 +213,4 @@
     'DB_USERS' => l10n_dec('%d user', '%d users', $nb_users),
     'DB_GROUPS' => l10n_dec('%d group', '%d groups', $nb_groups),
-    'DB_COMMENTS' => l10n_dec('%d comment', '%d comments', $nb_comments),
 		'DB_RATES' => sprintf('%d rates', $nb_rates),
     'U_CHECK_UPGRADE' => PHPWG_ROOT_PATH.'admin.php?action=check_upgrade',
@@ -227,4 +220,33 @@
     )
   );
+  
+if ($conf['activate_comments'])
+{
+  $query = '
+SELECT COUNT(*)
+  FROM '.COMMENTS_TABLE.'
+;';
+  list($nb_comments) = pwg_db_fetch_row(pwg_query($query));
+  $template->assign('DB_COMMENTS', l10n_dec('%d comment', '%d comments', $nb_comments));
+  
+  // unvalidated comments
+  $query = '
+SELECT COUNT(*)
+  FROM '.COMMENTS_TABLE.'
+  WHERE validated=\'false\'
+;';
+  list($nb_comments) = pwg_db_fetch_row(pwg_query($query));
+
+  if ($nb_comments > 0)
+  {
+    $template->assign(
+      'unvalidated',
+      array(
+        'URL' => PHPWG_ROOT_PATH.'admin.php?page=comments',
+        'INFO' => sprintf(l10n('%d waiting for validation'), $nb_comments)
+        )
+      );
+  }
+}
 
 if ($nb_elements > 0)
@@ -248,23 +270,4 @@
 }
 
-// unvalidated comments
-$query = '
-SELECT COUNT(*)
-  FROM '.COMMENTS_TABLE.'
-  WHERE validated=\'false\'
-;';
-list($nb_comments) = pwg_db_fetch_row(pwg_query($query));
-
-if ($nb_comments > 0)
-{
-  $template->assign(
-    'unvalidated',
-    array(
-      'URL' => PHPWG_ROOT_PATH.'admin.php?page=comments',
-      'INFO' => sprintf(l10n('%d waiting for validation'), $nb_comments)
-      )
-    );
-}
-
 // graphics library
 switch (pwg_image::get_library())
Index: /trunk/admin/themes/default/template/admin.tpl
===================================================================
--- /trunk/admin/themes/default/template/admin.tpl	(revision 12886)
+++ /trunk/admin/themes/default/template/admin.tpl	(revision 12887)
@@ -75,5 +75,7 @@
 {/if}
         <li><a href="{$U_MAINTENANCE}">{'Maintenance'|@translate}</a></li>
+{if isset($U_PENDING_COMMENTS)}
         <li><a href="{$U_PENDING_COMMENTS}">{'Pending Comments'|@translate}</a></li>
+{/if}
         <li><a href="{$U_UPDATES}">{'Updates'|@translate}</a></li>
       </ul>
Index: /trunk/admin/themes/default/template/cat_modify.tpl
===================================================================
--- /trunk/admin/themes/default/template/cat_modify.tpl	(revision 12886)
+++ /trunk/admin/themes/default/template/cat_modify.tpl	(revision 12887)
@@ -83,4 +83,5 @@
       </td>
     </tr>
+  {if isset($CAT_COMMENTABLE)}
     <tr>
       <td><strong>{'Comments'|@translate}</strong>
@@ -89,4 +90,5 @@
       </td>
     </tr>
+  {/if}
   </table>
 </fieldset>
Index: /trunk/admin/themes/default/template/configuration.tpl
===================================================================
--- /trunk/admin/themes/default/template/configuration.tpl	(revision 12886)
+++ /trunk/admin/themes/default/template/configuration.tpl	(revision 12887)
@@ -184,4 +184,13 @@
     <li>
       <label>
+        <span class="property">{'Activate comments'|@translate}</span>
+        <input type="checkbox" name="activate_comments" id="activate_comments"{if ($comments.activate_comments)}checked="checked"{/if}>
+      </label>
+    </li>
+  </ul>
+  
+  <ul id="comments_param_warp"{if not ($comments.activate_comments)} style="display:none;"{/if}>
+    <li>
+      <label>
         <span class="property">{'Comments for all'|@translate}</span>
         <input type="checkbox" name="comments_forall" {if ($comments.comments_forall)}checked="checked"{/if}>
@@ -244,4 +253,15 @@
   </ul>
 </fieldset>
+{footer_script}{literal}
+$(document).ready(function(){
+  $("#activate_comments").change(function(){
+    if ($(this).attr('checked')) {
+      $("#comments_param_warp").css('display', '');
+    } else {
+      $("#comments_param_warp").css('display', 'none');
+    }
+  });
+});
+{/literal}{/footer_script}
 {/if}
 
Index: /trunk/admin/themes/default/template/intro.tpl
===================================================================
--- /trunk/admin/themes/default/template/intro.tpl	(revision 12886)
+++ /trunk/admin/themes/default/template/intro.tpl	(revision 12887)
@@ -73,4 +73,5 @@
       <li>{$DB_USERS}</li>
       <li>{$DB_GROUPS}</li>
+    {if isset($DB_COMMENTS)}
       <li>
         {$DB_COMMENTS}
@@ -79,4 +80,5 @@
         {/if}
       </li>
+    {/if}
 			<li>{$DB_RATES}</li>
     </ul>
Index: /trunk/admin/themes/default/template/profile_content.tpl
===================================================================
--- /trunk/admin/themes/default/template/profile_content.tpl	(revision 12886)
+++ /trunk/admin/themes/default/template/profile_content.tpl	(revision 12887)
@@ -48,5 +48,5 @@
         <input type="text" size="4" maxlength="3" name="nb_image_page" id="nb_image_page" value="{$NB_IMAGE_PAGE}">
       </li>
-{if not $SPECIAL_USER}
+    {if not $SPECIAL_USER}
       <li>
         <span class="property">
@@ -61,5 +61,5 @@
         {html_options id=language name=language options=$language_options selected=$language_selection}
       </li>
-{/if}
+    {/if}
       <li>
         <span class="property">
@@ -72,8 +72,10 @@
         {html_radios name='expand' options=$radio_options selected=$EXPAND}
       </li>
+    {if $ACTIVATE_COMMENTS}
       <li>
         <span class="property">{'Show number of comments'|@translate}</span>
         {html_radios name='show_nb_comments' options=$radio_options selected=$NB_COMMENTS}
       </li>
+    {/if}
       <li>
         <span class="property">{'Show number of hits'|@translate}</span>
Index: /trunk/admin/themes/default/template/user_list.tpl
===================================================================
--- /trunk/admin/themes/default/template/user_list.tpl	(revision 12886)
+++ /trunk/admin/themes/default/template/user_list.tpl	(revision 12887)
@@ -236,4 +236,5 @@
   </tr>
 
+{if $ACTIVATE_COMMENTS}
   <tr>
     <td>{'Show number of comments'|@translate}</td>
@@ -245,4 +246,5 @@
     </td>
   </tr>
+{/if}
 
   <tr>
Index: /trunk/admin/user_list.php
===================================================================
--- /trunk/admin/user_list.php	(revision 12886)
+++ /trunk/admin/user_list.php	(revision 12887)
@@ -416,12 +416,17 @@
   $dbfields = array('primary' => array('user_id'), 'update' => array());
 
-  $formfields =
-    array('nb_image_page', 'theme', 'language',
-          'recent_period', 'expand', 'show_nb_comments',
-          'show_nb_hits', 'status', 'enabled_high',
-          'level');
-
-  $true_false_fields = array('expand', 'show_nb_comments',
-                       'show_nb_hits', 'enabled_high');
+  $formfields = array(
+          'nb_image_page', 'theme', 'language',
+          'recent_period', 'expand', 'show_nb_hits', 
+          'status', 'enabled_high', 'level'
+          );
+  
+  $true_false_fields = array('expand', 'show_nb_hits', 'enabled_high');
+  
+  if ($conf['activate_comments'])
+  {
+    array_push($formfields, 'show_nb_comments');
+    array_push($true_false_fields, 'show_nb_comments');
+  }
 
   foreach ($formfields as $formfield)
@@ -556,5 +561,7 @@
     'F_ADD_ACTION' => $base_url,
     'F_USERNAME' => @htmlentities($_GET['username'], ENT_COMPAT, 'UTF-8'),
-    'F_FILTER_ACTION' => get_root_url().'admin.php'
+    'F_FILTER_ACTION' => get_root_url().'admin.php',
+    
+    'ACTIVATE_COMMENTS' => $conf['activate_comments'],
     ));
 
Index: /trunk/comments.php
===================================================================
--- /trunk/comments.php	(revision 12886)
+++ /trunk/comments.php	(revision 12887)
@@ -28,4 +28,9 @@
 include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
 include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
+
+if (!$conf['activate_comments'])
+{
+  page_not_found(null);
+}
 
 // +-----------------------------------------------------------------------+
Index: /trunk/include/category_default.inc.php
===================================================================
--- /trunk/include/category_default.inc.php	(revision 12886)
+++ /trunk/include/category_default.inc.php	(revision 12887)
@@ -75,5 +75,5 @@
     );
 
-  if ($user['show_nb_comments'])
+  if ($conf['activate_comments'] and $user['show_nb_comments'])
   {
     $query = '
Index: /trunk/include/menubar.inc.php
===================================================================
--- /trunk/include/menubar.inc.php	(revision 12886)
+++ /trunk/include/menubar.inc.php	(revision 12887)
@@ -258,11 +258,14 @@
       );
 
-    // comments link
-    $block->data['comments'] =
-      array(
-        'TITLE'=>l10n('display last user comments'),
-        'NAME'=>l10n('Comments'),
-        'URL'=> get_root_url().'comments.php',
-      );
+    if ($conf['activate_comments'])
+    {
+      // comments link
+      $block->data['comments'] =
+        array(
+          'TITLE'=>l10n('display last user comments'),
+          'NAME'=>l10n('Comments'),
+          'URL'=> get_root_url().'comments.php',
+        );
+    }
 
     // about link
Index: /trunk/install/config.sql
===================================================================
--- /trunk/install/config.sql	(revision 12886)
+++ /trunk/install/config.sql	(revision 12887)
@@ -1,4 +1,5 @@
 -- initial configuration for Piwigo
 
+INSERT INTO piwigo_config (param,value,comment) VALUES ('activate_comments','true','Global parameter for usage of comments system');
 INSERT INTO piwigo_config (param,value,comment) VALUES ('nb_comment_page','10','number of comments to display on each page');
 INSERT INTO piwigo_config (param,value,comment) VALUES ('log','true','keep an history of visits on your website');
Index: /trunk/install/db/114-database.php
===================================================================
--- /trunk/install/db/114-database.php	(revision 12887)
+++ /trunk/install/db/114-database.php	(revision 12887)
@@ -0,0 +1,42 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based photo gallery                                    |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2011 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 = 'new parameter: Activate comments';
+
+$query = '
+INSERT INTO piwigo_config (param,value,comment) 
+  VALUES (\'activate_comments\',\'true\',\'Global parameter for usage of comments system\')
+;';
+pwg_query($query);
+
+echo
+"\n"
+. $upgrade_description
+."\n"
+;
+?>
Index: /trunk/language/en_UK/admin.lang.php
===================================================================
--- /trunk/language/en_UK/admin.lang.php	(revision 12886)
+++ /trunk/language/en_UK/admin.lang.php	(revision 12887)
@@ -102,4 +102,5 @@
 $lang['Activate Navigation Bar'] = 'Activate navigation bar';
 $lang['Activate Navigation Thumbnails'] = 'Activate navigation thumbnails';
+$lang['Activate comments'] = 'Activate comments';
 $lang['Activate'] = "Activate";
 $lang['Active Languages'] = 'Active Languages';
Index: /trunk/language/fr_CA/admin.lang.php
===================================================================
--- /trunk/language/fr_CA/admin.lang.php	(revision 12886)
+++ /trunk/language/fr_CA/admin.lang.php	(revision 12887)
@@ -846,4 +846,5 @@
 $lang['Piwigo cannot retrieve upgrade file from server'] = 'Piwigo ne peut pas récupérer le fichier de mise à jour depuis le serveur';
 $lang['Send connection settings by email'] = 'Envoyer les identifiants par email';
+$lang['Activate comments'] = 'Activate comments';
 
 ?>
Index: /trunk/language/fr_FR/admin.lang.php
===================================================================
--- /trunk/language/fr_FR/admin.lang.php	(revision 12886)
+++ /trunk/language/fr_FR/admin.lang.php	(revision 12887)
@@ -845,4 +845,5 @@
 $lang['Original Size'] = 'Taille originale';
 $lang['Send connection settings by email'] = 'Envoyer les identifiants par email';
+$lang['Activate comments'] = 'Activate comments';
 
 ?>
Index: /trunk/picture.php
===================================================================
--- /trunk/picture.php	(revision 12886)
+++ /trunk/picture.php	(revision 12887)
@@ -966,5 +966,8 @@
 
 include(PHPWG_ROOT_PATH.'include/picture_rate.inc.php');
-include(PHPWG_ROOT_PATH.'include/picture_comment.inc.php');
+if ($conf['activate_comments'])
+{
+  include(PHPWG_ROOT_PATH.'include/picture_comment.inc.php');
+}
 if ($metadata_showable and pwg_get_session_var('show_metadata') <> null )
 {
Index: /trunk/profile.php
===================================================================
--- /trunk/profile.php	(revision 12886)
+++ /trunk/profile.php	(revision 12887)
@@ -257,6 +257,11 @@
       $fields = array(
         'nb_image_page', 'language',
-        'expand', 'show_nb_comments', 'show_nb_hits', 'recent_period', 'theme'
+        'expand', 'show_nb_hits', 'recent_period', 'theme'
         );
+        
+      if ($conf['activate_comments'])
+      {
+        array_push($fields, 'show_nb_comments');
+      }
 
       $data = array();
@@ -301,4 +306,5 @@
       'EMAIL'=>get_email_address_as_display_text(@$userdata['email']),
       'ALLOW_USER_CUSTOMIZATION'=>$conf['allow_user_customization'],
+      'ACTIVATE_COMMENTS'=>$conf['activate_comments'],
       'NB_IMAGE_PAGE'=>$userdata['nb_image_page'],
       'RECENT_PERIOD'=>$userdata['recent_period'],
Index: /trunk/themes/default/template/profile_content.tpl
===================================================================
--- /trunk/themes/default/template/profile_content.tpl	(revision 12886)
+++ /trunk/themes/default/template/profile_content.tpl	(revision 12887)
@@ -71,8 +71,10 @@
         {html_radios name='expand' options=$radio_options selected=$EXPAND}
       </li>
+    {if $ACTIVATE_COMMENTS}
       <li>
         <span class="property">{'Show number of comments'|@translate}</span>
         {html_radios name='show_nb_comments' options=$radio_options selected=$NB_COMMENTS}
       </li>
+    {/if}
       <li>
         <span class="property">{'Show number of hits'|@translate}</span>
