Index: /extensions/CryptograPHP/admin.php
===================================================================
--- /extensions/CryptograPHP/admin.php	(revision 11315)
+++ /extensions/CryptograPHP/admin.php	(revision 11316)
@@ -3,16 +3,13 @@
 
 load_language('plugin.lang', CRYPTO_PATH);
+$conf['cryptographp_theme'] = explode(',', $conf['cryptographp_theme']);
 
 if ( isset($_POST['submit']))
 {
-  $conf['cryptographp_theme'] = trim($_POST['cryptographp_theme']);
-
-  $query = '
-UPDATE '.CONFIG_TABLE.'
-  SET value="'.$conf['cryptographp_theme'].'"
-  WHERE param="cryptographp_theme"
-  LIMIT 1';
-  pwg_query($query);
-
+  $conf['cryptographp_theme'] = array(
+    $_POST['cryptographp_theme'],
+    $_POST['comments_action'],
+    );
+  conf_update_param('cryptographp_theme', implode(',', $conf['cryptographp_theme']));
   array_push($page['infos'], l10n('Information data registered in database'));
 }
@@ -21,5 +18,6 @@
 
 $template->assign(array(
-  'cryptographp_theme' => $conf['cryptographp_theme'],
+  'cryptographp_theme' => $conf['cryptographp_theme'][0],
+  'comments_action' => $conf['cryptographp_theme'][1],
   'available_themes' => array('cryptographp', 'bluenoise', 'gray', 'pencil', 'xcolor'),
   'CRYPTO_PATH' => CRYPTO_PATH,
@@ -27,5 +25,5 @@
 );
 
-$template->assign_var_from_handle( 'ADMIN_CONTENT', 'plugin_admin_content');
+$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
 
 ?>
Index: /extensions/CryptograPHP/admin.tpl
===================================================================
--- /extensions/CryptograPHP/admin.tpl	(revision 11315)
+++ /extensions/CryptograPHP/admin.tpl	(revision 11316)
@@ -5,12 +5,24 @@
 <form method="post" class="properties">
 <fieldset>
-  <legend>{'Captcha theme'|@translate}</legend>
+  <legend>{'Configuration'|@translate}</legend>
   
-  {foreach from=$available_themes item=theme}
-  <div style="display:inline-block;margin-top:5px;">
-   <label for="{$theme}-example"><img src="{$CRYPTO_PATH}cryptographp/images/{$theme}.png" alt="{$theme}"/></label> <br/>
-    <input type="radio" name="cryptographp_theme" id="{$theme}-example" value="{$theme}" {if $theme == $cryptographp_theme}checked="checked"{/if}/>
-  </div>
-  {/foreach}
+  <ul>			
+    <li style="text-align:center;">
+      <b>{'Captcha theme'|@translate}</b><br/>
+      {foreach from=$available_themes item=theme}
+      <div style="display:inline-block;margin-top:5px;">
+       <label for="{$theme}-example"><img src="{$CRYPTO_PATH}cryptographp/images/{$theme}.png" alt="{$theme}"/></label> <br/>
+        <input type="radio" name="cryptographp_theme" id="{$theme}-example" value="{$theme}" {if $theme == $cryptographp_theme}checked="checked"{/if}/>
+      </div>
+      {/foreach}
+    </li>
+
+    <li>
+      <span class="property">{'Comments action'|@translate}</span>
+      <label><input type="radio" name="comments_action" value="inactive" {if $comments_action == 'inactive'}checked="checked"{/if}/> {'No captcha'|@translate}</label>
+      <label><input type="radio" name="comments_action" value="reject" {if $comments_action == 'reject'}checked="checked"{/if}/> {'Reject'|@translate}</label>
+      <label><input type="radio" name="comments_action" value="moderate" {if $comments_action == 'moderate'}checked="checked"{/if}/> {'Moderate'|@translate}</label>
+    </li>
+  </ul>
   
   <p class="bottomButtons">
Index: tensions/CryptograPHP/contactform.inc.php
===================================================================
--- /extensions/CryptograPHP/contactform.inc.php	(revision 11315)
+++ 	(revision )
@@ -1,53 +1,0 @@
-<?php
-
-if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
-
-$cryptinstall = CRYPTO_PATH.'cryptographp/cryptographp.fct.php';
-include($cryptinstall);
-
-add_event_handler('display_contactform', 'add_captcha');
-add_event_handler('check_contactform_params', 'check_captcha');
-
-function add_captcha()
-{
-  global $template, $conf;
-
-  // if (!is_a_guest()) return;
-
-  $template->set_prefilter('cf_form', 'captcha_prefilter');
-  $template->assign('CAPTCHA', dsp_crypt($conf['cryptographp_theme'].'.cfg.php',1));
-}
-
-function captcha_prefilter($content, $smarty)
-{
-  $search = '
-      <tr>
-        <td class="contact-form-left">&nbsp;</td>
-        <td class="contact-form-right"><input class="submit" type="submit" value="{\'cf_submit\'|@translate}"></td>
-      </tr>';
-  $replace = '
-    <tr>
-      <td class="contact-form-left" style="vertical-align:top;">{\'Antibot test\'|@translate}</td>
-      <td class="contact-form-right"><input type="text" name="code"> <span style="vertical-align:top;">{$CAPTCHA}</span></td>
-    </tr>'
-  ."\n".$search;
-  
-  return str_replace($search, $replace, $content);
-}
-
-function check_captcha($infos)
-{
-  global $conf;
-
-  if (!is_a_guest()) return $infos;
-
-  if (!chk_crypt($_POST['code']))
-  {
-    load_language('plugin.lang', CRYPTO_PATH);
-    array_push($infos['errors'], l10n('Invalid Captcha'));
-  }
-
-  return $infos;
-}
-
-?>
Index: /extensions/CryptograPHP/include/category.inc.php
===================================================================
--- /extensions/CryptograPHP/include/category.inc.php	(revision 11316)
+++ /extensions/CryptograPHP/include/category.inc.php	(revision 11316)
@@ -0,0 +1,53 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+$cryptinstall = CRYPTO_PATH.'cryptographp/cryptographp.fct.php';
+include($cryptinstall);
+
+add_event_handler('loc_begin_index', 'add_captcha');
+add_event_handler('user_comment_check', 'check_captcha', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
+
+function add_captcha()
+{
+  global $template, $conf;
+  
+  if (!is_a_guest()) return;
+  
+  $template->set_prefilter('comments_on_albums', 'captcha_prefilter');
+  $template->assign('CAPTCHA', dsp_crypt($conf['cryptographp_theme'][0].'.cfg.php',1));
+}
+
+function captcha_prefilter($content, $smarty)
+{
+  load_language('plugin.lang', CRYPTO_PATH);
+  
+  $search = '<input type="hidden" name="key" value="{$comment_add.KEY}">';
+  $replace = $search.'
+  <label>{$CAPTCHA}<input type="text" name="code"></label>';
+
+  return str_replace($search, $replace, $content);
+}
+
+function check_captcha($action, $comment)
+{
+  global $conf, $user;
+  
+  $my_action = ($conf['cryptographp_theme'][1] == 'reject') ? 'reject':'moderate';
+
+  if ($action == 'reject' OR $action == $my_action OR !is_a_guest())
+  {
+    return $action;
+  }
+
+  if (!chk_crypt($_POST['code']))
+  {
+    return $my_action;
+  }
+  else
+  {
+    return $action;
+  }
+}
+
+?>
Index: /extensions/CryptograPHP/include/contactform.inc.php
===================================================================
--- /extensions/CryptograPHP/include/contactform.inc.php	(revision 11316)
+++ /extensions/CryptograPHP/include/contactform.inc.php	(revision 11316)
@@ -0,0 +1,51 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+$cryptinstall = CRYPTO_PATH.'cryptographp/cryptographp.fct.php';
+include($cryptinstall);
+
+add_event_handler('display_contactform', 'add_captcha');
+add_event_handler('check_contactform_params', 'check_captcha');
+
+function add_captcha()
+{
+  global $template, $conf;
+
+  if (!is_a_guest()) return;
+
+  $template->set_prefilter('cf_form', 'captcha_prefilter');
+  $template->assign('CAPTCHA', dsp_crypt($conf['cryptographp_theme'][0].'.cfg.php',1));
+}
+
+function captcha_prefilter($content, $smarty)
+{
+  $search = '
+      <tr>
+        <td class="contact-form-left">&nbsp;</td>
+        <td class="contact-form-right"><input class="submit" type="submit" value="{\'cf_submit\'|@translate}"></td>
+      </tr>';
+  $replace = '
+    <tr>
+      <td class="contact-form-left" style="vertical-align:top;">{\'Antibot test\'|@translate}</td>
+      <td class="contact-form-right"><input type="text" name="code"> <span style="vertical-align:top;">{$CAPTCHA}</span></td>
+    </tr>'
+  ."\n".$search;
+  
+  return str_replace($search, $replace, $content);
+}
+
+function check_captcha($infos)
+{
+  if (!is_a_guest()) return $infos;
+
+  if (!chk_crypt($_POST['code']))
+  {
+    load_language('plugin.lang', CRYPTO_PATH);
+    array_push($infos['errors'], l10n('Invalid Captcha'));
+  }
+
+  return $infos;
+}
+
+?>
Index: /extensions/CryptograPHP/include/picture.inc.php
===================================================================
--- /extensions/CryptograPHP/include/picture.inc.php	(revision 11316)
+++ /extensions/CryptograPHP/include/picture.inc.php	(revision 11316)
@@ -0,0 +1,53 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+$cryptinstall = CRYPTO_PATH.'cryptographp/cryptographp.fct.php';
+include($cryptinstall);
+
+add_event_handler('loc_begin_picture', 'add_captcha');
+add_event_handler('user_comment_check', 'check_captcha', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
+
+function add_captcha()
+{
+  global $template, $conf;
+  
+  if (!is_a_guest()) return;
+  
+  $template->set_prefilter('picture', 'captcha_prefilter');
+  $template->assign('CAPTCHA', dsp_crypt($conf['cryptographp_theme'][0].'.cfg.php',1));
+}
+
+function captcha_prefilter($content, $smarty)
+{
+  load_language('plugin.lang', CRYPTO_PATH);
+  
+  $search = '<input type="hidden" name="key" value="{$comment_add.KEY}">';
+  $replace = $search.'
+  <label>{$CAPTCHA}<input type="text" name="code"></label>';
+
+  return str_replace($search, $replace, $content);
+}
+
+function check_captcha($action, $comment)
+{
+  global $conf, $user;
+  
+  $my_action = ($conf['cryptographp_theme'][1] == 'reject') ? 'reject':'moderate';
+
+  if ($action == 'reject' OR $action == $my_action OR !is_a_guest())
+  {
+    return $action;
+  }
+
+  if (!chk_crypt($_POST['code']))
+  {
+    return $my_action;
+  }
+  else
+  {
+    return $action;
+  }
+}
+
+?>
Index: /extensions/CryptograPHP/include/register.inc.php
===================================================================
--- /extensions/CryptograPHP/include/register.inc.php	(revision 11316)
+++ /extensions/CryptograPHP/include/register.inc.php	(revision 11316)
@@ -0,0 +1,52 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+$cryptinstall = CRYPTO_PATH.'cryptographp/cryptographp.fct.php';
+include($cryptinstall);
+
+add_event_handler('loc_end_page_header', 'add_captcha');
+add_event_handler('register_user_check', 'check_captcha');
+
+function add_captcha()
+{
+  global $template, $conf;
+
+  $template->set_prefilter('register', 'captcha_prefilter');
+  $template->assign('CAPTCHA', dsp_crypt($conf['cryptographp_theme'][0].'.cfg.php',1));
+}
+
+function captcha_prefilter($content, $smarty)
+{
+  load_language('plugin.lang', CRYPTO_PATH);
+  
+  $search = '<p class="bottomButtons">';
+  $replace = '
+  <fieldset>
+    <legend>{\'Antibot test\'|@translate}</legend>
+    <ul>
+      <li>
+        <span class="property">
+          <label>{$CAPTCHA}</label>
+        </span>
+        <input type="text" name="code">
+      </li>
+    </ul>
+  </fieldset>'
+."\n".$search;
+
+  return str_replace($search, $replace, $content);
+}
+
+function check_captcha($errors)
+{
+  if (!chk_crypt($_POST['code']))
+  {
+    load_language('plugin.lang', CRYPTO_PATH);
+    array_push($errors, l10n('Invalid Captcha'));
+  }
+
+  return $errors;
+}
+
+?>
Index: /extensions/CryptograPHP/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/CryptograPHP/language/en_UK/plugin.lang.php	(revision 11315)
+++ /extensions/CryptograPHP/language/en_UK/plugin.lang.php	(revision 11316)
@@ -4,4 +4,7 @@
 $lang['Captcha theme'] = 'Captcha theme';
 $lang['Antibot test'] = 'Antibot test';
+$lang['Comments action'] = 'Comments action';
+$lang['Moderate'] = 'Moderate';
+$lang['No captcha'] = 'No captcha';
 
 ?>
Index: /extensions/CryptograPHP/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/CryptograPHP/language/fr_FR/plugin.lang.php	(revision 11315)
+++ /extensions/CryptograPHP/language/fr_FR/plugin.lang.php	(revision 11316)
@@ -4,4 +4,7 @@
 $lang['Captcha theme'] = 'Thème du captcha';
 $lang['Antibot test'] = 'Test anti-bots';
+$lang['Comments action'] = 'Action pour les commentaires';
+$lang['Moderate'] = 'Modérer';
+$lang['No captcha'] = 'Pas de captcha';
 
 ?>
Index: /extensions/CryptograPHP/main.inc.php
===================================================================
--- /extensions/CryptograPHP/main.inc.php	(revision 11315)
+++ /extensions/CryptograPHP/main.inc.php	(revision 11316)
@@ -12,16 +12,35 @@
 define('CRYPTO_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
 
-global $conf;
-
-add_event_handler('init', 'crypto_init');
+add_event_handler('loc_end_section_init', 'crypto_init');
 
 function crypto_init()
 {
-  if (script_basename() == 'register') 
-    include('register.inc.php');
-  elseif (isset($_GET['/contact'])) 
-    include('contactform.inc.php');
-  else if (script_basename() == 'admin')
-    add_event_handler('get_admin_plugin_menu_links', 'crypto_plugin_admin_menu' );
+  global $conf, $pwg_loaded_plugins, $page;
+  $conf['cryptographp_theme'] = explode(',', $conf['cryptographp_theme']);
+  
+  if (script_basename() == 'register')
+  {
+    include(CRYPTO_PATH.'include/register.inc.php');
+  }
+  else if (script_basename() == 'picture' AND $conf['cryptographp_theme'][1] != 'inactive')
+  {
+    include(CRYPTO_PATH.'include/picture.inc.php');
+  }
+  else if (
+    script_basename() == 'index' AND $conf['cryptographp_theme'][1] != 'inactive' AND 
+    isset($pwg_loaded_plugins['Comments_on_Albums']) AND 
+    $page['section'] == 'categories' AND isset($page['category'])
+  ) {
+    include(CRYPTO_PATH.'include/category.inc.php');
+  }
+  else if (isset($_GET['/contact'])) 
+  {
+    include(CRYPTO_PATH.'include/contactform.inc.php');
+  }
+}
+
+if (script_basename() == 'admin')
+{
+  add_event_handler('get_admin_plugin_menu_links', 'crypto_plugin_admin_menu' );
 }
 
@@ -30,9 +49,10 @@
 	global $page,$conf;
 
-	array_push($menu,
-			array(
-				'NAME' => 'CryptograPHP',
-				'URL' => get_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__))
-			)
+	array_push(
+    $menu,
+    array(
+      'NAME' => 'CryptograPHP',
+      'URL' => get_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__))
+      )
 		);
 	return $menu;
Index: /extensions/CryptograPHP/maintain.inc.php
===================================================================
--- /extensions/CryptograPHP/maintain.inc.php	(revision 11315)
+++ /extensions/CryptograPHP/maintain.inc.php	(revision 11316)
@@ -6,8 +6,18 @@
   if (!isset($conf['cryptographp_theme']))
   {
-    pwg_query('INSERT INTO '.CONFIG_TABLE.' (param,value,comment) VALUES ("cryptographp_theme","cryptographp","CryptograPHP theme");');
+    pwg_query('INSERT INTO '.CONFIG_TABLE.' (param,value,comment) VALUES ("cryptographp_theme","cryptographp,reject","CryptograPHP config");');
   }
 }
 
+function plugin_activate()
+{
+  global $conf;
+  $conf['cryptographp_theme'] = explode(',', $conf['cryptographp_theme']);
+  
+  if(count($conf['cryptographp_theme']) == 1)
+  {
+    pwg_query('UPDATE '.CONFIG_TABLE.' SET value = "'.$conf['cryptographp_theme'][0].',reject" WHERE param = "cryptographp_theme";');
+  }
+}
 function plugin_uninstall()
 {
Index: tensions/CryptograPHP/register.inc.php
===================================================================
--- /extensions/CryptograPHP/register.inc.php	(revision 11315)
+++ 	(revision )
@@ -1,54 +1,0 @@
-<?php
-
-if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
-
-$cryptinstall = CRYPTO_PATH.'cryptographp/cryptographp.fct.php';
-include($cryptinstall);
-
-add_event_handler('loc_end_page_header', 'add_captcha');
-add_event_handler('register_user_check', 'check_captcha');
-
-function add_captcha()
-{
-  global $template, $conf;
-
-  $template->set_prefilter('register', 'captcha_prefilter');
-  $template->assign('CAPTCHA', dsp_crypt($conf['cryptographp_theme'].'.cfg.php',1));
-}
-
-function captcha_prefilter($content, $smarty)
-{
-  load_language('plugin.lang', CRYPTO_PATH);
-  
-  $search = '<p class="bottomButtons">';
-  $replace = '
-  <fieldset>
-    <legend>{\'Antibot test\'|@translate}</legend>
-    <ul>
-      <li>
-        <span class="property">
-          <label>{$CAPTCHA}</label>
-        </span>
-        <input type="text" name="code">
-      </li>
-    </ul>
-  </fieldset>'
-."\n".$search;
-
-  return str_replace($search, $replace, $content);
-}
-
-function check_captcha($errors)
-{
-  global $conf;
-
-  if (!chk_crypt($_POST['code']))
-  {
-    load_language('plugin.lang', CRYPTO_PATH);
-    array_push($errors, l10n('Invalid Captcha'));
-  }
-
-  return $errors;
-}
-
-?>
