Index: /extensions/CryptograPHP/admin.php
===================================================================
--- /extensions/CryptograPHP/admin.php	(revision 26071)
+++ /extensions/CryptograPHP/admin.php	(revision 26072)
@@ -20,5 +20,5 @@
   
   $conf['cryptographp'] = array(
-    'activate_on'     => array(
+    'activate_on' => array(
       'picture'     => in_array('picture', $_POST['activate_on']),
       'category'    => in_array('category', $_POST['activate_on']) || !$loaded['category'],
Index: /extensions/CryptograPHP/include/category.inc.php
===================================================================
--- /extensions/CryptograPHP/include/category.inc.php	(revision 26071)
+++ /extensions/CryptograPHP/include/category.inc.php	(revision 26072)
@@ -2,5 +2,7 @@
 defined('CRYPTO_ID') or die('Hacking attempt!');
 
+$conf['cryptographp']['template'] = 'comment';
 include(CRYPTO_PATH.'include/common.inc.php');
+
 add_event_handler('loc_begin_index', 'add_crypto');
 add_event_handler('user_comment_check_albums', 'check_crypto', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
@@ -15,5 +17,5 @@
 {
   $search = '{$comment_add.CONTENT}</textarea></p>';
-  return str_replace($search, $search."\n{\$CRYPTOGRAPHP}", $content);
+  return str_replace($search, $search."\n{\$CRYPTO.parsed_content}", $content);
 }
 
Index: /extensions/CryptograPHP/include/common.inc.php
===================================================================
--- /extensions/CryptograPHP/include/common.inc.php	(revision 26071)
+++ /extensions/CryptograPHP/include/common.inc.php	(revision 26072)
@@ -15,5 +15,5 @@
   'CRYPTO_PATH' => get_absolute_root_url().CRYPTO_PATH,
   ));
-  
+
 $template->set_filename('cryptographp', realpath(CRYPTO_PATH.'template/'.$conf['cryptographp']['template'].'.tpl'));
-$template->assign_var_from_handle('CRYPTOGRAPHP', 'cryptographp');
+$template->append('CRYPTO', array('parsed_content' => $template->parse('cryptographp', true)), true);
Index: /extensions/CryptograPHP/include/contactform.inc.php
===================================================================
--- /extensions/CryptograPHP/include/contactform.inc.php	(revision 26071)
+++ /extensions/CryptograPHP/include/contactform.inc.php	(revision 26072)
@@ -2,19 +2,8 @@
 defined('CRYPTO_ID') or die('Hacking attempt!');
 
+$conf['cryptographp']['template'] = 'contactform';
 include(CRYPTO_PATH.'include/common.inc.php');
-add_event_handler('loc_begin_index', 'add_crypto');
+
 add_event_handler('contact_form_check', 'check_crypto', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
-
-function add_crypto()
-{
-  global $template;
-  $template->set_prefilter('contactform', 'prefilter_crypto');
-}
-
-function prefilter_crypto($content, $smarty)
-{
-  $search = '{$contact.content}</textarea></td>';
-  return str_replace($search, $search."\n{\$CRYPTOGRAPHP}", $content);
-}
 
 function check_crypto($action, $comment)
Index: /extensions/CryptograPHP/include/guestbook.inc.php
===================================================================
--- /extensions/CryptograPHP/include/guestbook.inc.php	(revision 26071)
+++ /extensions/CryptograPHP/include/guestbook.inc.php	(revision 26072)
@@ -2,19 +2,8 @@
 defined('CRYPTO_ID') or die('Hacking attempt!');
 
+$conf['cryptographp']['template'] = 'guestbook';
 include(CRYPTO_PATH.'include/common.inc.php');
-add_event_handler('loc_begin_index', 'add_crypto');
+
 add_event_handler('user_comment_check', 'check_crypto', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
-
-function add_crypto()
-{
-  global $template;
-  $template->set_prefilter('guestbook', 'prefilter_crypto');
-}
-
-function prefilter_crypto($content, $smarty)
-{
-  $search = '{$comment_add.CONTENT}</textarea>';
-  return str_replace($search, $search."\n{\$CRYPTOGRAPHP}", $content);
-}
 
 function check_crypto($action, $comment)
Index: /extensions/CryptograPHP/include/picture.inc.php
===================================================================
--- /extensions/CryptograPHP/include/picture.inc.php	(revision 26071)
+++ /extensions/CryptograPHP/include/picture.inc.php	(revision 26072)
@@ -2,5 +2,7 @@
 defined('CRYPTO_ID') or die('Hacking attempt!');
 
+$conf['cryptographp']['template'] = 'comment';
 include(CRYPTO_PATH.'include/common.inc.php');
+
 add_event_handler('loc_end_picture', 'add_crypto');
 add_event_handler('user_comment_check', 'check_crypto', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
@@ -15,5 +17,5 @@
 {
   $search = '{$comment_add.CONTENT}</textarea></p>';
-  return str_replace($search, $search."\n{\$CRYPTOGRAPHP}", $content);
+  return str_replace($search, $search."\n{\$CRYPTO.parsed_content}", $content);
 }
 
Index: /extensions/CryptograPHP/include/register.inc.php
===================================================================
--- /extensions/CryptograPHP/include/register.inc.php	(revision 26071)
+++ /extensions/CryptograPHP/include/register.inc.php	(revision 26072)
@@ -2,5 +2,7 @@
 defined('CRYPTO_ID') or die('Hacking attempt!');
 
+$conf['cryptographp']['template'] = 'register';
 include(CRYPTO_PATH.'include/common.inc.php');
+
 add_event_handler('loc_end_page_header', 'add_crypto');
 add_event_handler('register_user_check', 'check_crypto');
@@ -14,6 +16,6 @@
 function prefilter_crypto($content, $smarty)
 {
-  $search = '#\(\{\'useful when password forgotten\'\|@translate\}\)(\s*)((\{/if\})?)#i';
-  $replace = '({\'useful when password forgotten\'|@translate})$1$2'."\n".'{\$CRYPTOGRAPHP}';
+  $search = '#\(\{\'useful when password forgotten\'\|(@?)translate\}\)(\s*)((?:\{/if\})?)#i';
+  $replace = '({\'useful when password forgotten\'|$1translate})$2$3'."\n".'{\$CRYPTO.parsed_content}';
   return preg_replace($search, $replace, $content);
 }
Index: /extensions/CryptograPHP/main.inc.php
===================================================================
--- /extensions/CryptograPHP/main.inc.php	(revision 26071)
+++ /extensions/CryptograPHP/main.inc.php	(revision 26072)
@@ -38,4 +38,5 @@
 {
   add_event_handler('loc_end_section_init', 'crypto_document_init', EVENT_HANDLER_PRIORITY_NEUTRAL+30);
+  add_event_handler('loc_begin_register', 'crypto_register_init', EVENT_HANDLER_PRIORITY_NEUTRAL+30);
 }
 
@@ -64,13 +65,7 @@
     return;
   }
-  
-  if (script_basename() == 'register' and $conf['cryptographp']['activate_on']['register'])
+
+  if (script_basename() == 'picture' and $conf['cryptographp']['activate_on']['picture'])
   {
-    $conf['cryptographp']['template'] = 'register';
-    include(CRYPTO_PATH . 'include/register.inc.php');
-  }
-  else if (script_basename() == 'picture' and $conf['cryptographp']['activate_on']['picture'])
-  {
-    $conf['cryptographp']['template'] = 'comment';
     include(CRYPTO_PATH . 'include/picture.inc.php');
   }
@@ -84,17 +79,28 @@
       )
     {
-      $conf['cryptographp']['template'] = 'comment';
       include(CRYPTO_PATH . 'include/category.inc.php');
     }
     else if ($page['section'] == 'contact' && $conf['cryptographp']['activate_on']['contactform'])
     {
-      $conf['cryptographp']['template'] = 'contactform';
       include(CRYPTO_PATH . 'include/contactform.inc.php');
     }
     else if ($page['section'] == 'guestbook' && $conf['cryptographp']['activate_on']['guestbook'])
     {
-      $conf['cryptographp']['template'] = 'guestbook';
       include(CRYPTO_PATH . 'include/guestbook.inc.php');
     }
+  }
+}
+function crypto_register_init()
+{
+  global $conf;
+  
+  if (!is_a_guest())
+  {
+    return;
+  }
+
+  if ($conf['cryptographp']['activate_on']['register'])
+  {
+    include(CRYPTO_PATH . 'include/register.inc.php');
   }
 }
Index: /extensions/CryptograPHP/maintain.inc.php
===================================================================
--- /extensions/CryptograPHP/maintain.inc.php	(revision 26071)
+++ /extensions/CryptograPHP/maintain.inc.php	(revision 26072)
@@ -8,4 +8,6 @@
   function install($plugin_version, &$errors=array())
   {
+    global $conf;
+    
     if (isset($conf['cryptograph_theme']))
     {
Index: /extensions/CryptograPHP/template/contactform.tpl
===================================================================
--- /extensions/CryptograPHP/template/contactform.tpl	(revision 26071)
+++ /extensions/CryptograPHP/template/contactform.tpl	(revision 26072)
@@ -1,3 +1,2 @@
-</tr>     
 <tr>
   <td class="title">
@@ -11,6 +10,7 @@
   </td>
 
-{footer_script}
-var captcha_code = new LiveValidation("captcha_code", {ldelim} onlyOnSubmit: true, insertAfterWhatNode: "captcha_refresh" });
-captcha_code.add(Validate.Presence, {ldelim} failureMessage: "{'Invalid Captcha'|translate}" });
-{/footer_script}
+  {footer_script}
+  var captcha_code = new LiveValidation("captcha_code", {ldelim} onlyOnSubmit: true, insertAfterWhatNode: "captcha_refresh" });
+  captcha_code.add(Validate.Presence, {ldelim} failureMessage: "{'Invalid Captcha'|translate}" });
+  {/footer_script}
+</tr>
Index: /extensions/CryptograPHP/template/guestbook.tpl
===================================================================
--- /extensions/CryptograPHP/template/guestbook.tpl	(revision 26071)
+++ /extensions/CryptograPHP/template/guestbook.tpl	(revision 26072)
@@ -1,4 +1,2 @@
-  </td>
-</tr>
 <tr>
   <td>
@@ -10,7 +8,9 @@
     <a href="#" id="captcha_refresh" onclick="document.getElementById('captcha').src = '{$CRYPTO_PATH}securimage/securimage_show.php?'+Math.random(); return false;">
       <img src="{$CRYPTO_PATH}template/refresh_{$CRYPTO.button_color}.png" style="vertical-align:bottom;"></a>
+  </td>
 
-{footer_script}
-var captcha_code = new LiveValidation("captcha_code", {ldelim} onlyOnSubmit: true });
-captcha_code.add(Validate.Presence, {ldelim} failureMessage: "{'Invalid Captcha'|translate}" });
-{/footer_script}
+  {footer_script}
+  var captcha_code = new LiveValidation("captcha_code", {ldelim} onlyOnSubmit: true });
+  captcha_code.add(Validate.Presence, {ldelim} failureMessage: "{'Invalid Captcha'|translate}" });
+  {/footer_script}
+</tr>
