Index: extensions/Comments_Access_Manager/admin.php
===================================================================
--- extensions/Comments_Access_Manager/admin.php	(revision 11017)
+++ extensions/Comments_Access_Manager/admin.php	(revision 11017)
@@ -0,0 +1,123 @@
+<?php
+
+global $lang, $conf, $errors;
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+// +-----------------------------------------------------------------------+
+// | Check Access and exit when user status is not ok                      |
+// +-----------------------------------------------------------------------+
+check_status(ACCESS_ADMINISTRATOR);
+
+if (!defined('CM_PATH')) define('CM_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
+
+//ini_set('error_reporting', E_ALL);
+//ini_set('display_errors', true);
+
+include_once (PHPWG_ROOT_PATH.'/include/constants.php');
+
+load_language('plugin.lang', CM_PATH);
+load_language('help/plugin.lang', CM_PATH);
+
+
+// +-----------------------------------------------------------------------+
+// |                      Getting plugin version                           |
+// +-----------------------------------------------------------------------+
+$plugin =  CM_Infos(CM_PATH);
+$version = $plugin['version'];
+
+
+// *************************************************************************
+// +-----------------------------------------------------------------------+
+// |                           Plugin Config                               |
+// +-----------------------------------------------------------------------+
+// *************************************************************************
+
+	if (isset($_POST['submit']) and isset($_POST['CM_No_Comment_Anonymous']) and isset($_POST['CM_GroupComm']))
+  {
+
+		$newconf_CM = array(
+      $version,
+      $_POST['CM_No_Comment_Anonymous'],
+      $_POST['CM_GroupComm'],
+      (isset($_POST['CM_AllowComm_Group'])?$_POST['CM_AllowComm_Group']:''),
+      );
+
+    $conf['CommentsManager'] = serialize($newconf_CM);
+
+    conf_update_param('CommentsManager', pwg_db_real_escape_string($conf['CommentsManager']));
+
+		array_push($page['infos'], l10n('CM_save_config'));
+  }
+
+  $conf_CM = unserialize($conf['CommentsManager']);
+
+
+  //Group setting
+  $groups[-1] = '---------';
+  $AllowComm = -1;
+	
+  //Check groups list in database 
+  $query = '
+SELECT id, name
+FROM '.GROUPS_TABLE.'
+ORDER BY name ASC
+;';
+	
+  $result = pwg_query($query);
+	
+  while ($row = pwg_db_fetch_assoc($result))
+  {
+    $groups[$row['id']] = $row['name'];
+
+    //configuration value for users group allowed to post comments
+    if (isset($conf_CM[3]) and $conf_CM[3] == $row['id'])
+		{
+	  	$AllowComm = $row['id'];
+		}
+  }
+
+  //Template initialization for allowed group for comments
+  $template->assign(
+    'AllowComm_Group',
+		array(
+      'group_options'=> $groups,
+      'group_selected' => $AllowComm
+			)
+  	);
+
+
+  // Template initialization for forms and data
+  $themeconf=$template->get_template_vars('themeconf');
+  $CM_theme=$themeconf['id'];
+
+  $template->assign(
+    array(
+    'CM_PATH'                       => CM_PATH,
+    'CM_VERSION'                    => $conf_CM[0],
+		'CM_NO_COMMENT_ANO_TRUE'        => $conf_CM[1]=='true' ?  'checked="checked"' : '' ,
+		'CM_NO_COMMENT_ANO_FALSE'       => $conf_CM[1]=='false' ?  'checked="checked"' : '' ,
+    'CM_GROUPCOMM_TRUE'             => $conf_CM[2]=='true' ?  'checked="checked"' : '' ,
+    'CM_GROUPCOMM_FALSE'            => $conf_CM[2]=='false' ?  'checked="checked"' : '' ,
+    'CM_ALLOWCOMM_GROUP'            => $conf_CM[3],
+    )
+  );
+
+
+// +-----------------------------------------------------------------------+
+// |                             errors display                            |
+// +-----------------------------------------------------------------------+
+  if (isset ($errors) and count($errors) != 0)
+  {
+	  $template->assign('errors',array());
+	  foreach ($errors as $error)
+	  {
+		  array_push($page['errors'], $error);
+		}
+	}
+
+// +-----------------------------------------------------------------------+
+// |                           templates display                           |
+// +-----------------------------------------------------------------------+
+  $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/template/admin.tpl');
+  $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+?>
Index: extensions/Comments_Access_Manager/include/functions.inc.php
===================================================================
--- extensions/Comments_Access_Manager/include/functions.inc.php	(revision 11017)
+++ extensions/Comments_Access_Manager/include/functions.inc.php	(revision 11017)
@@ -0,0 +1,186 @@
+<?php
+load_language('plugin.lang', CM_PATH);
+
+
+/**
+ * Triggered on get_admin_plugin_menu_links
+ * 
+ * Plugin's administration menu 
+ */
+function CM_admin_menu($menu)
+{
+// +-----------------------------------------------------------------------+
+// |                      Getting plugin name                              |
+// +-----------------------------------------------------------------------+
+  $plugin =  CM_Infos(CM_PATH);
+  $name = $plugin['name'];
+  
+  array_push($menu,
+    array(
+      'NAME' => $name,
+      'URL' => get_root_url().'admin.php?page=plugin-'.basename(CM_PATH)
+    )
+  );
+
+  return $menu;
+}
+
+
+/**
+ * checks if author is mandatory and set on comments post when comments for all is set
+ * 
+ * cheks if author is in an allowed group to post comment when comments for all is not set
+ *
+ * @param : comment action, comment
+ * 
+ * @return : comment action
+ * 
+ */
+function CM_CheckCommentAuthor($comment_action, $comm)
+{
+  load_language('plugin.lang', CM_PATH);
+  global $infos, $conf, $user;
+
+  $conf_CM = unserialize($conf['CommentsManager']);
+
+// Does not allow empty author name on comments for all
+  if (isset($conf_CM[1]) and $conf_CM[1] == 'true' and $comm['author'] == 'guest' and $conf['comments_forall'])
+  {
+    $comment_action = 'reject';
+
+    array_push($infos, l10n('CM_Empty Author'));
+  }
+
+
+// Do not allow comments if user is not in an allowed group
+  if (isset($conf_CM[2]) and $conf_CM[2] == 'true' and !$conf['comments_forall'] and !is_admin())
+  {
+    if (!CM_CheckAuthor($comm['author']))
+    {
+      $comment_action = 'reject';
+
+      array_push($infos, l10n('CM_Not_Allowed_Author'));
+    }
+  }
+
+  return $comment_action;
+}
+
+
+/**
+ * Checks if comment's author name is in the allowed group
+ * 
+ * @author   : author's name
+ * 
+ * @returns  : Boolean (true is user is allowed to post / false if not allowed)
+ * 
+ */
+function CM_CheckAuthor($author)
+{
+  global $conf;
+  
+	// Get CM configuration
+  $conf_CM = unserialize($conf['CommentsManager']);
+  
+  if (isset($conf_CM[3]) and $conf_CM[3] <> -1)
+  {
+    $query = '
+SELECT u.id,
+       u.username,
+       ug.user_id,
+       ug.group_id
+FROM '.USERS_TABLE.' AS u
+  INNER JOIN '.USER_GROUP_TABLE.' AS ug
+    ON u.id = ug.user_id
+WHERE u.username LIKE "'.$author.'"
+  AND ug.group_id = '.$conf_CM[3].'
+;';
+
+    $count = pwg_db_num_rows(pwg_query($query));
+
+    if (is_null($count) or $count == 0)
+    {
+      return false;
+    }
+    else
+      return true;
+  }
+}
+
+
+/**
+ * Get the plugin version and name
+ *
+ * @param : plugin directory
+ * 
+ * @return : plugin's version and name
+ * 
+ */
+function CM_Infos($dir)
+{
+  $path = $dir;
+
+  $plg_data = implode( '', file($path.'main.inc.php') );
+  if ( preg_match("|Plugin Name: (.*)|", $plg_data, $val) )
+  {
+    $plugin['name'] = trim( $val[1] );
+  }
+  if (preg_match("|Version: (.*)|", $plg_data, $val))
+  {
+    $plugin['version'] = trim($val[1]);
+  }
+  if ( preg_match("|Plugin URI: (.*)|", $plg_data, $val) )
+  {
+    $plugin['uri'] = trim($val[1]);
+  }
+  if ($desc = load_language('description.txt', $path.'/', array('return' => true)))
+  {
+    $plugin['description'] = trim($desc);
+  }
+  elseif ( preg_match("|Description: (.*)|", $plg_data, $val) )
+  {
+    $plugin['description'] = trim($val[1]);
+  }
+  if ( preg_match("|Author: (.*)|", $plg_data, $val) )
+  {
+    $plugin['author'] = trim($val[1]);
+  }
+  if ( preg_match("|Author URI: (.*)|", $plg_data, $val) )
+  {
+    $plugin['author uri'] = trim($val[1]);
+  }
+  if (!empty($plugin['uri']) and strpos($plugin['uri'] , 'extension_view.php?eid='))
+  {
+    list( , $extension) = explode('extension_view.php?eid=', $plugin['uri']);
+    if (is_numeric($extension)) $plugin['extension'] = $extension;
+  }
+// IMPORTANT SECURITY !
+  $plugin = array_map('htmlspecialchars', $plugin);
+
+  return $plugin ;
+}
+
+
+/**
+ * Delete obsolete files on plugin upgrade
+ * Obsolete files are listed in file obsolete.list
+ *
+ */
+function CM_Obsolete_Files()
+{
+  if (file_exists(CM_PATH.'obsolete.list')
+    and $old_files = file(CM_PATH.'obsolete.list', FILE_IGNORE_NEW_LINES)
+    and !empty($old_files))
+  {
+    array_push($old_files, 'obsolete.list');
+    foreach($old_files as $old_file)
+    {
+      $path = CM_PATH.$old_file;
+      if (is_file($path))
+      {
+        @unlink($path);
+      }
+    }
+  }
+}
+?>
Index: extensions/Comments_Access_Manager/include/index.php
===================================================================
--- extensions/Comments_Access_Manager/include/index.php	(revision 11017)
+++ extensions/Comments_Access_Manager/include/index.php	(revision 11017)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | 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.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: extensions/Comments_Access_Manager/include/upgradedb.inc.php
===================================================================
--- extensions/Comments_Access_Manager/include/upgradedb.inc.php	(revision 11017)
+++ extensions/Comments_Access_Manager/include/upgradedb.inc.php	(revision 11017)
@@ -0,0 +1,76 @@
+<?php
+/**
+ * @author Eric@piwigo.org
+ *  
+ * Upgrade processes for old plugin version
+ * Called from maintain.inc.php on plugin activation
+ * 
+ */
+
+if(!defined('CM_PATH'))
+{
+  define('CM_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
+}
+
+include_once (CM_PATH.'include/functions.inc.php');
+
+// +----------------------------------------------------------+
+// |       Upgrading database from old plugin versions        |
+// +----------------------------------------------------------+
+
+
+/* *************************************** */
+/* Update plugin version in conf table     */
+/* Used everytime a new version is updated */
+/* even if no database upgrade is needed   */
+/* *************************************** */
+function CM_version_update()
+{
+  global $conf;
+  
+  // Get current plugin version
+  $plugin =  CM_Infos(CM_PATH);
+  $version = $plugin['version'];
+
+  // Upgrading options
+  $query = '
+SELECT value
+  FROM '.CONFIG_TABLE.'
+WHERE param = "CommentsManager"
+;';
+
+  $result = pwg_query($query);
+  $conf_CM = pwg_db_fetch_assoc($result);
+    
+  $Newconf_CM = unserialize($conf_CM['value']);
+  
+  $Newconf_CM[0] = $version;
+  
+  $update_conf = serialize($Newconf_CM);
+
+  conf_update_param('CommentsManager', pwg_db_real_escape_string($update_conf));
+
+
+// Check #_plugin table consistency
+// Only useful if a previous version upgrade has not worked correctly (rare case)
+  $query = '
+SELECT version
+  FROM '.PLUGINS_TABLE.'
+WHERE id = "CommentsManager"
+;';
+  
+  $data = pwg_db_fetch_assoc(pwg_query($query));
+  
+  if (empty($data['version']) or $data['version'] <> $version)
+  {
+    $query = '
+UPDATE '.PLUGINS_TABLE.'
+SET version="'.$version.'"
+WHERE id = "CommentsManager"
+LIMIT 1
+;';
+
+    pwg_query($query);
+  }
+}
+?>
Index: extensions/Comments_Access_Manager/index.php
===================================================================
--- extensions/Comments_Access_Manager/index.php	(revision 11017)
+++ extensions/Comments_Access_Manager/index.php	(revision 11017)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | 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.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: extensions/Comments_Access_Manager/language/en_UK/description.txt
===================================================================
--- extensions/Comments_Access_Manager/language/en_UK/description.txt	(revision 11017)
+++ extensions/Comments_Access_Manager/language/en_UK/description.txt	(revision 11017)
@@ -0,0 +1,1 @@
+Manage comments access
Index: extensions/Comments_Access_Manager/language/en_UK/help/index.php
===================================================================
--- extensions/Comments_Access_Manager/language/en_UK/help/index.php	(revision 11017)
+++ extensions/Comments_Access_Manager/language/en_UK/help/index.php	(revision 11017)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | 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.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: extensions/Comments_Access_Manager/language/en_UK/help/plugin.lang.php
===================================================================
--- extensions/Comments_Access_Manager/language/en_UK/help/plugin.lang.php	(revision 11017)
+++ extensions/Comments_Access_Manager/language/en_UK/help/plugin.lang.php	(revision 11017)
@@ -0,0 +1,8 @@
+<?php
+$lang['CM_commentTitle'] = 'Nickname mandatory for guests comments';
+$lang['CM_commentTitle_d'] = 'If <b>&quot;Comments for all&quot;</b> is active (authority to unregistered visitors to post comments), this option allows to force the non-registered visitor to enter a nickname that the comment is accepted.';
+$lang['CM_GroupCommTitle'] = 'Allow comments to a group of users';
+$lang['CM_GroupCommTitle_d'] = 'This option lets you specify a group of users who will allowed to post comments when the gallery is configured to not allow comments for all.
+<br><br>
+By default, when <b>&quot;comments for all&quot;</b> option is disabled, only registered users can post comments. With this option, you can restrict this behavior by specifying a user group. Thus, only registered users and members of this group may post comments.';
+?>
Index: extensions/Comments_Access_Manager/language/en_UK/index.php
===================================================================
--- extensions/Comments_Access_Manager/language/en_UK/index.php	(revision 11017)
+++ extensions/Comments_Access_Manager/language/en_UK/index.php	(revision 11017)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | 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.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: extensions/Comments_Access_Manager/language/en_UK/plugin.lang.php
===================================================================
--- extensions/Comments_Access_Manager/language/en_UK/plugin.lang.php	(revision 11017)
+++ extensions/Comments_Access_Manager/language/en_UK/plugin.lang.php	(revision 11017)
@@ -0,0 +1,16 @@
+<?php
+$lang['CM_submit'] = 'Save settings';
+$lang['CM_save_config'] = 'Configuration successfully saved !';
+$lang['CM_Title'] = 'Comments Access Manager - Version : ';
+$lang['CM_SubTitle'] = 'Plugin configuration';
+$lang['CM_Disable'] = ' Disable (default)';
+$lang['CM_Enable'] = ' Enable ';
+$lang['CM_No_Anonymous_Comments'] = 'Nickname mandatory for guests comments';
+$lang['CM_Comments_For_Group'] = 'Allow comments to a group of users';
+$lang['CM_AllowedComm_Group'] = 'Select the group of users allowed to post comments:';
+$lang['CM_Not_Allowed_Author'] = 'Sorry, you are not authorized to post a comment. Please contact the site administrator.';
+$lang['CM_Support_txt'] = 'The official support on this plugin is only on these Piwigo forum topic:<br>
+<a href="http://piwigo.org/forum/viewtopic.php?id=[todefine]" onclick="window.open(this.href);return false;">English forum - http://piwigo.org/forum/viewtopic.php?id=[todefine]</a><br><br>
+Also available, the project\'s bugtracker: <a href="http://piwigo.org/bugs/" onclick="window.open(this.href);return false;">http://piwigo.org/bugs/</a>';
+$lang['CM_Empty Author'] = 'Comments author nickname is mandatory !';
+?>
Index: extensions/Comments_Access_Manager/language/fr_FR/description.txt
===================================================================
--- extensions/Comments_Access_Manager/language/fr_FR/description.txt	(revision 11017)
+++ extensions/Comments_Access_Manager/language/fr_FR/description.txt	(revision 11017)
@@ -0,0 +1,1 @@
+Gérer les accès aux commentaires
Index: extensions/Comments_Access_Manager/language/fr_FR/help/index.php
===================================================================
--- extensions/Comments_Access_Manager/language/fr_FR/help/index.php	(revision 11017)
+++ extensions/Comments_Access_Manager/language/fr_FR/help/index.php	(revision 11017)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | 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.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: extensions/Comments_Access_Manager/language/fr_FR/help/plugin.lang.php
===================================================================
--- extensions/Comments_Access_Manager/language/fr_FR/help/plugin.lang.php	(revision 11017)
+++ extensions/Comments_Access_Manager/language/fr_FR/help/plugin.lang.php	(revision 11017)
@@ -0,0 +1,8 @@
+<?php
+$lang['CM_commentTitle'] = 'Commentaires : pseudo obligatoire pour les non-inscrits.';
+$lang['CM_commentTitle_d'] = 'Lorsque les visiteurs non inscrits sont autorisés à poster des commentaires (<b>&quot;Commentaires pour tous&quot;</b> actif), cette option oblige le visiteur non inscrit à saisir un pseudo pour que le commentaire soit accepté.';
+$lang['CM_GroupCommTitle'] = 'Autoriser les commentaires pour un groupe d\'utilisateurs';
+$lang['CM_GroupCommTitle_d'] = 'Cette option permet de spécifier un groupe d\'utilisateurs qui seront autorisés à poster des commentaires lorsque la galerie est configurée pour ne pas autoriser les commentaires pour tous.
+<br><br>
+Par défaut, lorsque les <b>&quot;commentaires pour tous&quot;</b> sont désactivés, seuls les utilisateurs inscrits peuvent poster des commentaires. Avec cette option, vous pouvez restreindre d\'avantage ce fonctionnement en précisant un groupe d\'utilisateurs. Ainsi, seuls les utilisateurs inscrits et faisant partie de ce groupe pourront poster des commentaires.';
+?>
Index: extensions/Comments_Access_Manager/language/fr_FR/index.php
===================================================================
--- extensions/Comments_Access_Manager/language/fr_FR/index.php	(revision 11017)
+++ extensions/Comments_Access_Manager/language/fr_FR/index.php	(revision 11017)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | 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.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: extensions/Comments_Access_Manager/language/fr_FR/plugin.lang.php
===================================================================
--- extensions/Comments_Access_Manager/language/fr_FR/plugin.lang.php	(revision 11017)
+++ extensions/Comments_Access_Manager/language/fr_FR/plugin.lang.php	(revision 11017)
@@ -0,0 +1,17 @@
+<?php
+$lang['CM_submit'] = 'Sauvegarder les paramètres';
+$lang['CM_save_config'] = 'Configuration sauvegardée avec succès !';
+$lang['CM_Title'] = 'Comments Access Manager - Version: ';
+$lang['CM_SubTitle'] = 'Configuration du plugin';
+$lang['CM_Disable'] = ' Désactiver (valeur par défaut)';
+$lang['CM_Enable'] = ' Activer ';
+$lang['CM_No_Anonymous_Comments'] = 'Commentaires : Pseudo obligatoire pour les non-inscrits';
+$lang['CM_Comments_For_Group'] = 'Autoriser les commentaires pour un groupe d\'utilisateurs';
+$lang['CM_AllowedComm_Group'] = 'Sélectionnez le groupe d\'utilisateurs autorisé à poster des commentaires :';
+$lang['CM_Not_Allowed_Author'] = 'Désolé, vous n\'êtes pas autorisé à poster un commentaire. Veuillez contacter l\'administrateur du site.';
+$lang['CM_Support_txt'] = 'Le support officiel sur ce plugin se fait exclusivement sur ce fil du forum FR de Piwigo:<br>
+<a href="http://fr.piwigo.org/forum/viewtopic.php?id=[todefine]" onclick="window.open(this.href);return false;">Forum français - http://fr.piwigo.org/forum/viewtopic.php?id=[todefine]</a>
+<br><br>
+Egalement disponible, le bugtracker du projet: <a href="http://piwigo.org/bugs/" onclick="window.open(this.href);return false;">http://piwigo.org/bugs/</a>';
+$lang['CM_Empty Author'] = 'Le nom de l\'auteur du commentaire est obligatoire !';
+?>
Index: extensions/Comments_Access_Manager/language/index.php
===================================================================
--- extensions/Comments_Access_Manager/language/index.php	(revision 11017)
+++ extensions/Comments_Access_Manager/language/index.php	(revision 11017)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | 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.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: extensions/Comments_Access_Manager/main.inc.php
===================================================================
--- extensions/Comments_Access_Manager/main.inc.php	(revision 11017)
+++ extensions/Comments_Access_Manager/main.inc.php	(revision 11017)
@@ -0,0 +1,29 @@
+<?php
+/*
+Plugin Name: Comments Access Manager
+Version: 2.2.0
+Description: Gérer l'accès aux commentaites - Manage comments access
+Plugin URI: http://piwigo.org/ext/extension_view.php?eid=
+Author: Eric
+Author URI: http://www.infernoweb.net
+*/
+
+/* History:  CM_PATH.'Changelog.txt' */
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+if (!defined('CM_PATH')) define('CM_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
+
+global $conf;
+
+include_once (CM_PATH.'include/functions.inc.php');
+
+load_language('plugin.lang', CM_PATH);
+$conf_CM = unserialize($conf['CommentsManager']);
+
+
+// Plugin administration panel
+add_event_handler('get_admin_plugin_menu_links', 'CM_admin_menu');
+
+// Comments authorisation check
+add_event_handler('user_comment_check', 'CM_CheckCommentAuthor', 50, 2);
+?>
Index: extensions/Comments_Access_Manager/maintain.inc.php
===================================================================
--- extensions/Comments_Access_Manager/maintain.inc.php	(revision 11017)
+++ extensions/Comments_Access_Manager/maintain.inc.php	(revision 11017)
@@ -0,0 +1,69 @@
+<?php
+
+if(!defined('CM_PATH'))
+{
+  define('CM_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
+}
+
+include_once (CM_PATH.'include/functions.inc.php');
+
+function plugin_install()
+{
+	global $conf;
+  
+  // Set current plugin version in config table
+  $plugin =  CM_Infos(CM_PATH);
+  $version = $plugin['version'];
+	
+  $default = array($version,'false','false',-1);
+
+	$query = '
+SELECT param
+  FROM '.CONFIG_TABLE.'
+WHERE param = "CommentsManager"
+;';
+  $count = pwg_db_num_rows(pwg_query($query));
+  
+  if ($count == 0)
+  {
+    $q = '
+INSERT INTO '.CONFIG_TABLE.' (param, value, comment)
+VALUES ("CommentsManager","'.pwg_db_real_escape_string(serialize($default)).'","Comments Access Manager parameters")
+  ;';
+    pwg_query($q);
+  }
+}
+
+
+function plugin_activate()
+{
+  global $conf;
+
+/* Cleaning obsolete files */
+/* *********************** */
+  CM_Obsolete_Files();
+  
+  include_once (CM_PATH.'include/upgradedb.inc.php');
+
+  // Update plugin version number in #_config table and check consistency of #_plugins table
+  CM_version_update();
+
+  load_conf_from_db('param like \'UserAdvManager\\_%\'');
+}
+
+
+function plugin_uninstall()
+{
+  global $conf;
+
+  if (isset($conf['CommentsManager']))
+  {
+    $q = '
+DELETE FROM '.CONFIG_TABLE.'
+WHERE param="CommentsManager"
+;';
+
+    pwg_query($q);
+  }
+}
+?>
Index: extensions/Comments_Access_Manager/template/admin.tpl
===================================================================
--- extensions/Comments_Access_Manager/template/admin.tpl	(revision 11017)
+++ extensions/Comments_Access_Manager/template/admin.tpl	(revision 11017)
@@ -0,0 +1,86 @@
+{combine_script id='jquery' path='themes/default/js/jquery.min.js'}
+{combine_script id='jquery.cluetip' require='jquery' path='themes/default/js/plugins/jquery.cluetip.js'}
+
+{combine_css path= $CM_PATH|@cat:'template/cm.css'}
+
+<script type="text/javascript">
+jQuery().ready(function()
+{ldelim}
+  jQuery('.cluetip').cluetip(
+  {ldelim}
+    width: 550,
+    splitTitle: '|'
+  {rdelim});
+{rdelim});
+</script>
+
+<div class="titrePage">
+  <h2>{'CM_Title'|@translate} {$CM_VERSION}<br>{'CM_SubTitle'|@translate}</h2>
+</div>
+
+<form method="post" action="" class="general">
+
+  <p>
+    <input class="submit" type="submit" value="{'CM_submit'|@translate}" name="submit" {$TAG_INPUT_ENABLED}>
+  </p>
+
+  <fieldset>
+    <ul>
+      <li>
+        <label class="cluetip" title="{'CM_commentTitle'|translate}|{'CM_commentTitle_d'|translate}">
+          {'CM_No_Anonymous_Comments'|@translate}
+        </label>
+      <br><br>
+        <input type="radio" value="false" {$CM_NO_COMMENT_ANO_FALSE} name="CM_No_Comment_Anonymous">
+          {'CM_Disable'|@translate}
+      <br>
+        <input type="radio" value="true" {$CM_NO_COMMENT_ANO_TRUE} name="CM_No_Comment_Anonymous">
+          {'CM_Enable'|@translate}
+      <br><br>
+      </li>
+
+      <li>
+        <label class="cluetip" title="{'CM_GroupCommTitle'|translate}|{'CM_GroupCommTitle_d'|translate}">
+          {'CM_Comments_For_Group'|@translate}
+        </label>
+      <br><br>
+        <input type="radio" value="false" {$CM_GROUPCOMM_FALSE} name="CM_GroupComm">
+          {'CM_Disable'|@translate}
+      <br>
+        <input type="radio" value="true" {$CM_GROUPCOMM_TRUE} name="CM_GroupComm">
+          {'CM_Enable'|@translate}
+      <br><br>
+
+      <ul>
+        <li>
+          <label>
+            {'CM_AllowedComm_Group'|@translate}
+          </label>
+        <br><br>
+            {html_options name="CM_AllowComm_Group" options=$AllowComm_Group.group_options selected=$AllowComm_Group.group_selected}
+        </li>
+      </ul>
+      <br><br>
+      </li>
+    </ul>
+  </fieldset>
+
+  <p>
+    <input class="submit" type="submit" value="{'CM_submit'|@translate}" name="submit" {$TAG_INPUT_ENABLED} >
+  </p>
+</form>
+
+
+<fieldset>
+  {'CM_Support_txt'|@translate}
+</fieldset>
+
+{html_head}
+<script type="text/javascript">
+jQuery(document).ready(function() {ldelim}
+  jQuery('#theAdminPage #the_page').addClass('{$themeconf.name}');
+	jQuery(".infos").fadeOut(800).fadeIn(1200).fadeOut(400).fadeIn(800).fadeOut(400);
+	jQuery(".errors").fadeOut(200).fadeIn(200).fadeOut(300).fadeIn(300).fadeOut(400).fadeIn(400); 
+});
+</script>
+{/html_head}
Index: extensions/Comments_Access_Manager/template/cm.css
===================================================================
--- extensions/Comments_Access_Manager/template/cm.css	(revision 11017)
+++ extensions/Comments_Access_Manager/template/cm.css	(revision 11017)
@@ -0,0 +1,5 @@
+/* jQuery cluetip instructions */
+label.cluetip
+{
+  font-weight:bold;
+}
Index: extensions/Comments_Access_Manager/template/index.php
===================================================================
--- extensions/Comments_Access_Manager/template/index.php	(revision 11017)
+++ extensions/Comments_Access_Manager/template/index.php	(revision 11017)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | 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.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
