Index: /extensions/CryptograPHP/admin.php
===================================================================
--- /extensions/CryptograPHP/admin.php	(revision 14526)
+++ /extensions/CryptograPHP/admin.php	(revision 14527)
@@ -11,5 +11,5 @@
     'theme'           => $_POST['theme'],
     'captcha_type'    => $_POST['captcha_type'],
-    'case_sensitive'  => $conf['cryptographp']['case_sensitive'], //not used, problem with some fonts
+    'case_sensitive'  => 'false', //not used, problem with some fonts
     'width'           => (int)$_POST['width'], 
     'height'          => (int)$_POST['height'],
@@ -30,8 +30,8 @@
 
 $presets = array(
-  'bluenoise' => array('perturbation'=>0.25, 'image_bg_color'=>'ffffff', 'text_color'=>'0000ff', 'num_lines'=>2, 'line_color'=>'0000ff', 'noise_level'=>2, 'noise_color'=>'0000ff', 'ttf_file'=>'AlteHassGroteskB'),
-  'gray' => array('perturbation'=>1, 'image_bg_color'=>'ffffff', 'text_color'=>'8a8a8a', 'num_lines'=>2, 'line_color'=>'8a8a8a', 'noise_level'=>0.1, 'noise_color'=>'8a8a8a', 'ttf_file'=>'TopSecret'),
-  'xcolor' => array('perturbation'=>0.5, 'image_bg_color'=>'ffffff', 'text_color'=>'random', 'num_lines'=>1, 'line_color'=>'ffffff', 'noise_level'=>2, 'noise_color'=>'ffffff', 'ttf_file'=>'Dread'),
-  'pencil' => array('perturbation'=>0.8, 'image_bg_color'=>'9e9e9e', 'text_color'=>'363636', 'num_lines'=>0, 'line_color'=>'ffffff', 'noise_level'=>0, 'noise_color'=>'ffffff', 'ttf_file'=>'AllStar'),
+  'bluenoise' =>  array('perturbation'=>0.25, 'image_bg_color'=>'ffffff', 'text_color'=>'0000ff', 'num_lines'=>2, 'line_color'=>'0000ff', 'noise_level'=>2,   'noise_color'=>'0000ff', 'ttf_file'=>'AlteHassGroteskB'),
+  'gray' =>       array('perturbation'=>1,    'image_bg_color'=>'ffffff', 'text_color'=>'8a8a8a', 'num_lines'=>2, 'line_color'=>'8a8a8a', 'noise_level'=>0.1, 'noise_color'=>'8a8a8a', 'ttf_file'=>'TopSecret'),
+  'xcolor' =>     array('perturbation'=>0.5,  'image_bg_color'=>'ffffff', 'text_color'=>'random', 'num_lines'=>1, 'line_color'=>'ffffff', 'noise_level'=>2,   'noise_color'=>'ffffff', 'ttf_file'=>'Dread'),
+  'pencil' =>     array('perturbation'=>0.8,  'image_bg_color'=>'9e9e9e', 'text_color'=>'363636', 'num_lines'=>0, 'line_color'=>'ffffff', 'noise_level'=>0,   'noise_color'=>'ffffff', 'ttf_file'=>'AllStar'),
   );
   
@@ -67,5 +67,4 @@
   $("input[name=noise_color]").val("'.$param['noise_color'].'");
   $("input[name=ttf_file]").val(["'.$param['ttf_file'].'"]);
-
 }';
   }
Index: /extensions/CryptograPHP/include/category.inc.php
===================================================================
--- /extensions/CryptograPHP/include/category.inc.php	(revision 14526)
+++ /extensions/CryptograPHP/include/category.inc.php	(revision 14527)
@@ -2,6 +2,7 @@
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 
+load_language('plugin.lang', CRYPTO_PATH);
 add_event_handler('loc_begin_index', 'add_crypto');
-add_event_handler('user_comment_check', 'check_crypto', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
+add_event_handler('user_comment_check_albums', 'check_crypto', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
 
 function add_crypto()
@@ -18,21 +19,20 @@
   global $conf;
   
-  $search = '#<input type="hidden" name="key" value="{\$comment_add\.KEY}"([ /]*)>#';
-  $replace = '<input type="hidden" name="key" value="{$comment_add.KEY}"$1>'.'
-  <label>
-    <img id="captcha" src="'.CRYPTO_PATH.'securimage/securimage_show.php" alt="CAPTCHA Image">
-    <a href="#" onclick="document.getElementById(\'captcha\').src = \''.CRYPTO_PATH.'securimage/securimage_show.php?\' + Math.random(); return false">
-      <img src="'.CRYPTO_PATH.'template/refresh.png"></a>
-    <br>{\''.($conf['cryptographp']['captcha_type']=='string'?'Enter code':'Solve equation').'\'|@translate} :
-    <input type="text" name="captcha_code" size="'.($conf['cryptographp']['code_length']+1).'" maxlength="'.$conf['cryptographp']['code_length'].'" />
-    
-  </label>';
+  $search = '<p><textarea name="content" id="contentid" rows="5" cols="50">{$comment_add.CONTENT}</textarea></p>';
+  $replace = $search.'
+				<p><label>{\''.($conf['cryptographp']['captcha_type']=='string'?'Enter code':'Solve equation').'\'|@translate} :</label></p>
+				<p>
+				  <img id="captcha" src="'.CRYPTO_PATH.'securimage/securimage_show.php" alt="CAPTCHA Image">
+				  <a href="#" onclick="document.getElementById(\'captcha\').src = \''.CRYPTO_PATH.'securimage/securimage_show.php?\' + Math.random(); return false">
+				    <img src="'.CRYPTO_PATH.'template/refresh.png"></a>
+          <input type="text" name="captcha_code" style="width:'.$conf['cryptographp']['code_length'].'em;" maxlength="'.$conf['cryptographp']['code_length'].'" />
+				</p>';
 
-  return preg_replace($search, $replace, $content);
+  return str_replace($search, $replace, $content);
 }
 
 function check_crypto($action, $comment)
 {
-  global $conf;
+  global $conf, $page;
   
   include_once(CRYPTO_PATH.'securimage/securimage.php');
@@ -46,4 +46,5 @@
   if ($securimage->check($_POST['captcha_code']) == false)
   {
+    if ($conf['cryptographp']['comments_action'] == 'reject') array_push($page['errors'], l10n('Invalid Captcha'));
     return $conf['cryptographp']['comments_action'];
   }
Index: /extensions/CryptograPHP/include/contactform.inc.php
===================================================================
--- /extensions/CryptograPHP/include/contactform.inc.php	(revision 14526)
+++ /extensions/CryptograPHP/include/contactform.inc.php	(revision 14527)
@@ -2,4 +2,5 @@
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 
+load_language('plugin.lang', CRYPTO_PATH);
 add_event_handler('display_contactform', 'add_crypto');
 add_event_handler('check_contactform_params', 'check_crypto');
@@ -18,21 +19,15 @@
   global $conf;
   
-  $search = '
+  $search = '<td class="contact-form-right"><textarea name="cf_message" id="cf_message" rows="10" cols="40">{$CF.MESSAGE}</textarea></td>';
+  $replace = $search.'
+      </tr>     
       <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;">
-        {\''.($conf['cryptographp']['captcha_type']=='string'?'Enter code':'Solve equation').'\'|@translate}
-        <img id="captcha" src="'.CRYPTO_PATH.'securimage/securimage_show.php" alt="CAPTCHA Image">
-      </td>
-      <td class="contact-form-right"><input type="text" name="captcha_code" size="'.($conf['cryptographp']['code_length']+1).'" maxlength="'.$conf['cryptographp']['code_length'].'" />
-        <a href="#" onclick="document.getElementById(\'captcha\').src = \''.CRYPTO_PATH.'securimage/securimage_show.php?\' + Math.random(); return false">
-          <img src="'.CRYPTO_PATH.'template/refresh.png"></a>
-      </td>
-    </tr>'
-  ."\n".$search;
+        <td class="contact-form-left" style="vertical-align:top;">
+          {\''.($conf['cryptographp']['captcha_type']=='string'?'Enter code':'Solve equation').'\'|@translate}
+          <img id="captcha" src="'.CRYPTO_PATH.'securimage/securimage_show.php" alt="CAPTCHA Image">
+          <a href="#" onclick="document.getElementById(\'captcha\').src = \''.CRYPTO_PATH.'securimage/securimage_show.php?\' + Math.random(); return false">
+            <img src="'.CRYPTO_PATH.'template/refresh.png"></a>
+        </td>
+        <td class="contact-form-right"><input type="text" name="captcha_code" size="'.($conf['cryptographp']['code_length']+1).'" maxlength="'.$conf['cryptographp']['code_length'].'" /></td>';
   
   return str_replace($search, $replace, $content);
Index: /extensions/CryptograPHP/include/picture.inc.php
===================================================================
--- /extensions/CryptograPHP/include/picture.inc.php	(revision 14526)
+++ /extensions/CryptograPHP/include/picture.inc.php	(revision 14527)
@@ -2,4 +2,5 @@
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 
+load_language('plugin.lang', CRYPTO_PATH);
 add_event_handler('loc_end_picture', 'add_crypto');
 add_event_handler('user_comment_check', 'check_crypto', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
@@ -18,21 +19,20 @@
   global $conf;
   
-  $search = '#<input type="hidden" name="key" value="{\$comment_add\.KEY}"([ /]*)>#';
-  $replace = '<input type="hidden" name="key" value="{$comment_add.KEY}"$1>'.'
-  <label>
-    <img id="captcha" src="'.CRYPTO_PATH.'securimage/securimage_show.php" alt="CAPTCHA Image">
-    <a href="#" onclick="document.getElementById(\'captcha\').src = \''.CRYPTO_PATH.'securimage/securimage_show.php?\' + Math.random(); return false">
-      <img src="'.CRYPTO_PATH.'template/refresh.png"></a>
-    <br>{\''.($conf['cryptographp']['captcha_type']=='string'?'Enter code':'Solve equation').'\'|@translate} :
-    <input type="text" name="captcha_code" size="'.($conf['cryptographp']['code_length']+1).'" maxlength="'.$conf['cryptographp']['code_length'].'" />
-    
-  </label>';
+  $search = '<p><textarea name="content" id="contentid" rows="5" cols="50">{$comment_add.CONTENT}</textarea></p>';
+  $replace = $search.'
+				<p><label>{\''.($conf['cryptographp']['captcha_type']=='string'?'Enter code':'Solve equation').'\'|@translate} :</label></p>
+				<p>
+				  <img id="captcha" src="'.CRYPTO_PATH.'securimage/securimage_show.php" alt="CAPTCHA Image">
+				  <a href="#" onclick="document.getElementById(\'captcha\').src = \''.CRYPTO_PATH.'securimage/securimage_show.php?\' + Math.random(); return false">
+				    <img src="'.CRYPTO_PATH.'template/refresh.png"></a>
+          <input type="text" name="captcha_code" style="width:'.$conf['cryptographp']['code_length'].'em;" maxlength="'.$conf['cryptographp']['code_length'].'" />
+				</p>';
 
-  return preg_replace($search, $replace, $content);
+  return str_replace($search, $replace, $content);
 }
 
 function check_crypto($action, $comment)
 {
-  global $conf;
+  global $conf, $page;
   
   include_once(CRYPTO_PATH.'securimage/securimage.php');
@@ -46,4 +46,5 @@
   if ($securimage->check($_POST['captcha_code']) == false)
   {
+    if ($conf['cryptographp']['comments_action'] == 'reject') array_push($page['errors'], l10n('Invalid Captcha'));
     return $conf['cryptographp']['comments_action'];
   }
Index: /extensions/CryptograPHP/include/register.inc.php
===================================================================
--- /extensions/CryptograPHP/include/register.inc.php	(revision 14526)
+++ /extensions/CryptograPHP/include/register.inc.php	(revision 14527)
@@ -2,4 +2,5 @@
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 
+load_language('plugin.lang', CRYPTO_PATH);
 add_event_handler('loc_end_page_header', 'add_crypto');
 add_event_handler('register_user_check', 'check_crypto');
@@ -14,21 +15,16 @@
 function prefilter_crypto($content, $smarty)
 {
-  global $conf;
-  
-  $search = '#\<\/ul\>(.{0,10})\<\/fieldset\>(.{0,10})\<p class\=\"bottomButtons\"\>#is';
-  $replace = '
+  global $conf, $user;
+    
+  $search = '#\(\{\'useful when password forgotten\'\|@translate\}\)(\s*)((\{/if\})?)#i';
+  $replace = '({\'useful when password forgotten\'|@translate})$1$2
+      </li>
       <li>
         <span class="property">
-          <label>{\''.($conf['cryptographp']['captcha_type']=='string'?'Enter code':'Solve equation').'\'|@translate} <img id="captcha" src="'.CRYPTO_PATH.'securimage/securimage_show.php" alt="CAPTCHA Image"></label>
+          <label for="captcha_code">{\''.($conf['cryptographp']['captcha_type']=='string'?'Enter code':'Solve equation').'\'|@translate} <img id="captcha" src="'.CRYPTO_PATH.'securimage/securimage_show.php" alt="CAPTCHA Image"></label>
+          <a href="#" onclick="document.getElementById(\'captcha\').src = \''.CRYPTO_PATH.'securimage/securimage_show.php?\' + Math.random(); return false">
+            <img src="'.CRYPTO_PATH.'template/refresh.png"></a>
         </span>
-        <input type="text" name="captcha_code" size="'.($conf['cryptographp']['code_length']+1).'" maxlength="'.$conf['cryptographp']['code_length'].'" />
-        <a href="#" onclick="document.getElementById(\'captcha\').src = \''.CRYPTO_PATH.'securimage/securimage_show.php?\' + Math.random(); return false">
-          <img src="'.CRYPTO_PATH.'template/refresh.png"></a>
-      </li>
-  </ul>
-
-  </fieldset>
-
-  <p class="bottomButtons">';
+        <input type="text" id="captcha_code" name="captcha_code" size="'.($conf['cryptographp']['code_length']+1).'" maxlength="'.$conf['cryptographp']['code_length'].'" />';
 
   return preg_replace($search, $replace, $content);
Index: /extensions/CryptograPHP/language/de_DE/index.php
===================================================================
--- /extensions/CryptograPHP/language/de_DE/index.php	(revision 14527)
+++ /extensions/CryptograPHP/language/de_DE/index.php	(revision 14527)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture 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.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/CryptograPHP/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/CryptograPHP/language/en_UK/plugin.lang.php	(revision 14526)
+++ /extensions/CryptograPHP/language/en_UK/plugin.lang.php	(revision 14527)
@@ -18,4 +18,5 @@
 $lang['Perturbation'] = 'Perturbation';
 $lang['range:'] = 'range:';
+$lang['random'] = 'random';
 $lang['Background color'] = 'Background color';
 $lang['Text color'] = 'Text color';
Index: /extensions/CryptograPHP/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/CryptograPHP/language/fr_FR/plugin.lang.php	(revision 14526)
+++ /extensions/CryptograPHP/language/fr_FR/plugin.lang.php	(revision 14527)
@@ -2,5 +2,5 @@
 
 $lang['Invalid Captcha'] = 'Captcha non valide';
-$lang['Enter code'] = 'Entrez le code';
+$lang['Enter code'] = 'Recopiez le code';
 $lang['Solve equation'] = 'Resolvez l\'équation';
 
@@ -18,4 +18,5 @@
 $lang['Perturbation'] = 'Perturbation';
 $lang['range:'] = 'plage:';
+$lang['random'] = 'aléatoire';
 $lang['Background color'] = 'Couleur de fond';
 $lang['Text color'] = 'Couleur du texte';
Index: /extensions/CryptograPHP/language/ru_RU/index.php
===================================================================
--- /extensions/CryptograPHP/language/ru_RU/index.php	(revision 14527)
+++ /extensions/CryptograPHP/language/ru_RU/index.php	(revision 14527)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture 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.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/CryptograPHP/language/uk_UA/index.php
===================================================================
--- /extensions/CryptograPHP/language/uk_UA/index.php	(revision 14527)
+++ /extensions/CryptograPHP/language/uk_UA/index.php	(revision 14527)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture 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.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/CryptograPHP/main.inc.php
===================================================================
--- /extensions/CryptograPHP/main.inc.php	(revision 14526)
+++ /extensions/CryptograPHP/main.inc.php	(revision 14527)
@@ -28,6 +28,8 @@
   global $conf, $user;
   
+  // brace yourself, smartphones spammers are comming !
+  if ($user['theme'] == 'smartpocket') return;
+  
   $conf['cryptographp'] = unserialize($conf['cryptographp']);
-  load_language('plugin.lang', CRYPTO_PATH);
   
   if (script_basename() == 'register')
@@ -39,6 +41,5 @@
     include(CRYPTO_PATH.'include/picture.inc.php');
   }
-  // because of ContactForm specificities, Captcha can't be displayed on these themes
-  else if ( isset($_GET['/contact']) and strstr($user['theme'], 'simple') === false and strstr($user['theme'], 'stripped') === false ) 
+  else if (isset($_GET['/contact'])) 
   {
     include(CRYPTO_PATH.'include/contactform.inc.php');
Index: /extensions/CryptograPHP/maintain.inc.php
===================================================================
--- /extensions/CryptograPHP/maintain.inc.php	(revision 14526)
+++ /extensions/CryptograPHP/maintain.inc.php	(revision 14527)
@@ -1,4 +1,4 @@
 <?php
-define('default_config', serialize(array(
+define('crypto_default_config', serialize(array(
   'comments_action' => 'reject',
   'theme'           => 'gray',
@@ -24,5 +24,5 @@
   if (!isset($conf['cryptographp']))
   {
-    pwg_query('INSERT INTO '.CONFIG_TABLE.' (param,value,comment) VALUES ("cryptographp",\''.default_config.'\',"CryptograPHP config");');
+    pwg_query('INSERT INTO '.CONFIG_TABLE.' (param,value,comment) VALUES ("cryptographp",\''.crypto_default_config.'\',"CryptograPHP config");');
   }
 }
@@ -34,12 +34,13 @@
   if (isset($conf['cryptograph_theme']))
   {
-    pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param="cryptographp_theme" LIMIT 1');
+    pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param="cryptographp_theme" LIMIT 1;');
   }
   
-  if (!isset($conf['cryptograph']))
+  if (!isset($conf['cryptographp']))
   {
-    pwg_query('INSERT INTO '.CONFIG_TABLE.' (param,value,comment) VALUES ("cryptographp",\''.default_config.'\',"CryptograPHP config");');
+    pwg_query('INSERT INTO '.CONFIG_TABLE.' (param,value,comment) VALUES ("cryptographp",\''.crypto_default_config.'\',"CryptograPHP config");');
   }
 }
+
 function plugin_uninstall()
 {
Index: /extensions/CryptograPHP/securimage/securimage_preview.php
===================================================================
--- /extensions/CryptograPHP/securimage/securimage_preview.php	(revision 14527)
+++ /extensions/CryptograPHP/securimage/securimage_preview.php	(revision 14527)
@@ -0,0 +1,62 @@
+<?php
+/**
+ * this file take parameters from $_GET, reserved for admin usage
+ */
+ 
+define('PHPWG_ROOT_PATH','../../../');
+include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
+
+if (!is_admin()) die('Hacking attempt!');
+
+$temp_conf = array(
+  'captcha_type'    => $_GET['captcha_type'],
+  'width'           => (int)$_GET['width'], 
+  'height'          => (int)$_GET['height'],
+  'perturbation'    => (float)$_GET['perturbation'],
+  'image_bg_color'  => $_GET['image_bg_color'],
+  'code_length'     => (int)$_GET['code_length'],
+  'text_color'      => $_GET['text_color'],
+  'num_lines'       => (float)$_GET['num_lines'],
+  'line_color'      => $_GET['line_color'],
+  'noise_level'     => (float)$_GET['noise_level'],
+  'noise_color'     => $_GET['noise_color'],
+  'ttf_file'        => $_GET['ttf_file'],
+  );
+
+// randomize colors
+function randomColor()
+{
+  mt_srand((double)microtime()*1000000);
+  $c = null;
+  while(strlen($c)<6)
+  {
+      $c .= sprintf("%02X", mt_rand(0, 255));
+  }
+  return $c;
+}
+
+foreach (array('image_bg_color','text_color','line_color','noise_color') as $color)
+{
+  if ($temp_conf[$color] == 'random') $temp_conf[$color] = randomColor();
+}
+
+require_once dirname(__FILE__) . '/securimage.php';
+$img = new securimage();
+
+$img->ttf_file        = './fonts/'.$temp_conf['ttf_file'].'.ttf';
+$img->captcha_type    = ($temp_conf['captcha_type'] == 'string') ? Securimage::SI_CAPTCHA_STRING : Securimage::SI_CAPTCHA_MATHEMATIC;
+// $img->case_sensitive  = get_boolean($temp_conf['case_sensitive']);
+$img->image_width     = $temp_conf['width']; 
+$img->image_height    = $temp_conf['height'];
+$img->perturbation    = $temp_conf['perturbation'];
+$img->image_bg_color  = new Securimage_Color('#'.$temp_conf['image_bg_color']);
+$img->text_color      = new Securimage_Color('#'.$temp_conf['text_color']); 
+$img->num_lines       = $temp_conf['num_lines'];
+$img->line_color      = new Securimage_Color('#'.$temp_conf['line_color']);
+$img->noise_level     = $temp_conf['noise_level'];
+$img->noise_color     = new Securimage_Color('#'.$temp_conf['noise_color']);
+$img->code_length     = $temp_conf['code_length'];
+
+$img->show();
+
+?>
Index: /extensions/CryptograPHP/template/admin.tpl
===================================================================
--- /extensions/CryptograPHP/template/admin.tpl	(revision 14526)
+++ /extensions/CryptograPHP/template/admin.tpl	(revision 14527)
@@ -4,28 +4,30 @@
 {footer_script require='jquery.colorpicker'}{literal}
 jQuery(document).ready(function() {
+  // colorpicker
   $('.colorpicker-input')
-  .ColorPicker({
-    onSubmit: function(hsb, hex, rgb, el) { 
-      $(el).val(hex); 
-      $(el).ColorPickerHide(); 
-    },
-    onChange: function(hsb, hex, rgb, el) { 
-      $(el).val(hex); 
-      changeColor(el, hex); 
-      $('.preset').removeClass('selected'); 
-      $('input[name=theme]').val('custom');
-    },
-    onBeforeShow: function () { 
-      $(this).ColorPickerSetColor(this.value); 
-    }
-  })
-  .bind('keyup', function(){ 
-    $(this).ColorPickerSetColor(this.value);
-    changeColor(this, $(this).val());
-  })
-  .each(function() {
-    changeColor(this, $(this).val());
-  });
-  
+    .ColorPicker({
+      onSubmit: function(hsb, hex, rgb, el) { 
+        $(el).val(hex); 
+        $(el).ColorPickerHide(); 
+      },
+      onChange: function(hsb, hex, rgb, el) { 
+        $(el).val(hex); 
+        changeColor(el, hex);
+        changePreview();
+        setThemeCutom();
+      },
+      onBeforeShow: function () { 
+        $(this).ColorPickerSetColor(this.value); 
+      }
+    })
+    .bind('keyup', function(){ 
+      $(this).ColorPickerSetColor(this.value);
+      changeColor(this, $(this).val());
+    })
+    .each(function() {
+      changeColor(this, $(this).val());
+    });
+  
+  // apply a preset
   $('.preset').click(function() {
     $('.preset').removeClass('selected');
@@ -34,15 +36,53 @@
     $('.colorpicker-input').each(function() { changeColor(this, $(this).val()); });
     $('input[name=theme]').val($(this).attr('title'));
-  });
-  
+    changePreview();
+  });
+  
+  // display customization panel
   $('.customize').click(function() {
-    $('#theming').fadeToggle();
-  });
-  
+    $('#theming').toggle();
+  });
+  
+  // change theme to 'custom' if a parameter is changed
   $('input.istheme').change(function() {
-    $('.preset').removeClass('selected');
-    $('input[name=theme]').val('custom');
+    setThemeCutom();
+  });
+  
+  // update the preview
+  $('input.istheme, input.preview').change(function() {
+    changePreview();
+  });
+  $('#captcha').click(function() {
+    changePreview();
+  });
+  
+  // links for random color
+  $('a.random').click(function() {
+    $(this).prev('label').children('input').val('random');
+    changeColor($(this).prev('label').children('input'), 'random');
+    changePreview();
+    setThemeCutom();
   });
 });
+
+function setThemeCutom() {
+  $('.preset').removeClass('selected');
+  $('input[name=theme]').val('custom');
+}
+
+function changePreview()
+{
+  options = new Array();
+  str = '';
+  
+  $('input[type="text"], input[type="radio"]:checked').each(function() {
+    options[$(this).attr('name')] = $(this).val();
+  });
+  
+  for (x in options) {
+    str+= '&' + x + '=' + options[x];
+  }
+  $('#captcha').attr('src', '{/literal}{$CRYPTO_PATH}{literal}securimage/securimage_preview.php?' + new Date().getTime() + str);
+}
 
 function changeColor(target, color) {
@@ -68,4 +108,5 @@
 }
 {/foreach}
+
 .preset img {ldelim}
   margin:1px;
@@ -96,6 +137,6 @@
     <li>
       <span class="property">{'Captcha type'|@translate}</span>
-      <label><input type="radio" name="captcha_type" value="string" {if $crypto.captcha_type == 'string'}checked="checked"{/if}> {'Random string'|@translate}</label>
-      <label><input type="radio" name="captcha_type" value="math" {if $crypto.captcha_type == 'math'}checked="checked"{/if}> {'Simple equation'|@translate}</label>
+      <label><input type="radio" name="captcha_type" class="preview" value="string" {if $crypto.captcha_type == 'string'}checked="checked"{/if}> {'Random string'|@translate}</label>
+      <label><input type="radio" name="captcha_type" class="preview" value="math" {if $crypto.captcha_type == 'math'}checked="checked"{/if}> {'Simple equation'|@translate}</label>
     </li>
     <!--<li>
@@ -106,13 +147,13 @@
     <li>
       <span class="property">{'Code lenght'|@translate}</span>
-      <label><input type="text" name="code_length" value="{$crypto.code_length}" size="6" maxlength="2"></label>
+      <label><input type="text" name="code_length" class="preview" value="{$crypto.code_length}" size="6" maxlength="2"></label>
     </li>
     <li>
       <span class="property">{'Width'|@translate}</span>
-      <label><input type="text" name="width" value="{$crypto.width}" size="6" maxlength="3"> {'good value:'|@translate} lenght*20</label>
+      <label><input type="text" name="width" class="preview" value="{$crypto.width}" size="6" maxlength="3"> {'good value:'|@translate} lenght&times;20</label>
     </li>
     <li>
       <span class="property">{'Height'|@translate}</span>
-      <label><input type="text" name="height" value="{$crypto.height}" size="6" maxlength="3"> {'good value:'|@translate} width/4</label>
+      <label><input type="text" name="height" class="preview" value="{$crypto.height}" size="6" maxlength="3"> {'good value:'|@translate} width/4</label>
     </li>
     <li>
@@ -133,29 +174,33 @@
       <li>
         <span class="property">{'Perturbation'|@translate}</span>
-        <label><input type="text" name="perturbation" value="{$crypto.perturbation}" class="istheme" size="6" maxlength="4"> {'range:'|@translate} 0 to 1</label>
+        <label><input type="text" name="perturbation" value="{$crypto.perturbation}" class="istheme" size="6" maxlength="4"> {'range:'|@translate} 0 - 1</label>
       </li>
       <li>
         <span class="property">{'Background color'|@translate}</span>
-        <label><input type="text" name="image_bg_color" value="{$crypto.image_bg_color}" class="colorpicker-input istheme" size="6" maxlength="6"></label>
+        <label><input type="text" name="image_bg_color" value="{$crypto.image_bg_color}" class="colorpicker-input istheme" size="6" maxlength="6"></label> 
+        <a class="random" title="{'random'|@translate}"><img src="{$CRYPTO_PATH}/template/arrow_switch.png"></a>
       </li>
       <li>
         <span class="property">{'Text color'|@translate}</span>
-        <label><input type="text" name="text_color" value="{$crypto.text_color}" class="colorpicker-input istheme" size="6" maxlength="6"></label>
+        <label><input type="text" name="text_color" value="{$crypto.text_color}" class="colorpicker-input istheme" size="6" maxlength="6"></label> 
+        <a class="random" title="{'random'|@translate}"><img src="{$CRYPTO_PATH}/template/arrow_switch.png"></a>
       </li>
       <li>
         <span class="property">{'Lines density'|@translate}</span>
-        <label><input type="text" name="num_lines" value="{$crypto.num_lines}" class="istheme" size="6" maxlength="4"> {'range:'|@translate} 0 to 10</label>
+        <label><input type="text" name="num_lines" value="{$crypto.num_lines}" class="istheme" size="6" maxlength="4"> {'range:'|@translate} 0 - 10</label>
       </li>
       <li>
         <span class="property">{'Lines color'|@translate}</span>
-        <label><input type="text" name="line_color" value="{$crypto.line_color}" class="colorpicker-input istheme" size="6" maxlength="6"></label>
+        <label><input type="text" name="line_color" value="{$crypto.line_color}" class="colorpicker-input istheme" size="6" maxlength="6"></label> 
+        <a class="random" title="{'random'|@translate}"><img src="{$CRYPTO_PATH}/template/arrow_switch.png"></a>
       </li>
       <li>
         <span class="property">{'Noise level'|@translate}</span>
-        <label><input type="text" name="noise_level" value="{$crypto.noise_level}" class="istheme" size="6" maxlength="4"> {'range:'|@translate} 0 to 10</label>
+        <label><input type="text" name="noise_level" value="{$crypto.noise_level}" class="istheme" size="6" maxlength="4"> {'range:'|@translate} 0 - 10</label>
       </li>
       <li>
         <span class="property">{'Noise color'|@translate}</span>
-        <label><input type="text" name="noise_color" value="{$crypto.noise_color}" class="colorpicker-input istheme" size="6" maxlength="6"></label>
+        <label><input type="text" name="noise_color" value="{$crypto.noise_color}" class="colorpicker-input istheme" size="6" maxlength="6"></label> 
+        <a class="random" title="{'random'|@translate}"><img src="{$CRYPTO_PATH}/template/arrow_switch.png"></a>
       </li>
       <li>
