Changeset 12619

Show
Ignore:
Timestamp:
11/13/11 13:19:28 (18 months ago)
Author:
mistic100
Message:

fix display on some themes, disable on ContactForm for simple and stripped themes (stupid bug)

Location:
extensions/CryptograPHP
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • extensions/CryptograPHP/admin.php

    r12617 r12619  
    22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 
    33 
    4 $conf['cryptographp'] = unserialize($conf['cryptographp']); 
     4// $conf['cryptographp'] = unserialize($conf['cryptographp']); 
    55load_language('plugin.lang', CRYPTO_PATH); 
    66 
  • extensions/CryptograPHP/include/category.inc.php

    r12617 r12619  
    1818  global $conf; 
    1919   
    20   $search = '<input type="hidden" name="key" value="{$comment_add.KEY}">'; 
    21   $replace = $search.' 
     20  $search = '#<input type="hidden" name="key" value="{\$comment_add\.KEY}"([ /]*)>#'; 
     21  $replace = '<input type="hidden" name="key" value="{$comment_add.KEY}"$1>'.' 
    2222  <label> 
    2323    <img id="captcha" src="'.CRYPTO_PATH.'securimage/securimage_show.php" alt="CAPTCHA Image"> 
     
    2929  </label>'; 
    3030 
    31   return str_replace($search, $replace, $content); 
     31  return preg_replace($search, $replace, $content); 
    3232} 
    3333 
  • extensions/CryptograPHP/include/picture.inc.php

    r12617 r12619  
    1818  global $conf; 
    1919   
    20   $search = '<input type="hidden" name="key" value="{$comment_add.KEY}">'; 
    21   $replace = $search.' 
     20  $search = '#<input type="hidden" name="key" value="{\$comment_add\.KEY}"([ /]*)>#'; 
     21  $replace = '<input type="hidden" name="key" value="{$comment_add.KEY}"$1>'.' 
    2222  <label> 
    2323    <img id="captcha" src="'.CRYPTO_PATH.'securimage/securimage_show.php" alt="CAPTCHA Image"> 
     
    2929  </label>'; 
    3030 
    31   return str_replace($search, $replace, $content); 
     31  return preg_replace($search, $replace, $content); 
    3232} 
    3333 
  • extensions/CryptograPHP/include/register.inc.php

    r12617 r12619  
    2020      <li> 
    2121        <span class="property"> 
    22           <label><img id="captcha" src="'.CRYPTO_PATH.'securimage/securimage_show.php" alt="CAPTCHA Image"></label> 
     22          <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> 
    2323        </span> 
    24         <b>{\''.($conf['cryptographp']['captcha_type']=='string'?'Enter code':'Solve equation').'\'|@translate} :</b><br> 
    2524        <input type="text" name="captcha_code" size="'.($conf['cryptographp']['code_length']+1).'" maxlength="'.$conf['cryptographp']['code_length'].'" /> 
    2625        <a href="#" onclick="document.getElementById(\'captcha\').src = \''.CRYPTO_PATH.'securimage/securimage_show.php?\' + Math.random(); return false"> 
  • extensions/CryptograPHP/main.inc.php

    r12617 r12619  
    2121define('CRYPTO_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/'); 
    2222 
    23 add_event_handler('loc_end_section_init', 'crypto_init'); 
     23add_event_handler('init', 'crypto_init'); 
     24add_event_handler('loc_end_section_init', 'crypto_section_init'); 
    2425 
    2526function crypto_init() 
    2627{ 
    27   global $conf, $pwg_loaded_plugins, $page; 
     28  global $conf, $user; 
    2829   
    2930  $conf['cryptographp'] = unserialize($conf['cryptographp']); 
     
    3839    include(CRYPTO_PATH.'include/picture.inc.php'); 
    3940  } 
    40   else if (isset($_GET['/contact']))  
     41  // because of ContactForm specificities, Captcha can't be displayed on these themes 
     42  else if ( isset($_GET['/contact']) and strstr($user['theme'], 'simple') === false and strstr($user['theme'], 'stripped') === false )  
    4143  { 
    4244    include(CRYPTO_PATH.'include/contactform.inc.php'); 
    4345  } 
    44   else if ( 
     46} 
     47 
     48function crypto_section_init() 
     49{ 
     50  global $conf, $pwg_loaded_plugins, $page; 
     51   
     52  if ( 
    4553    script_basename() == 'index' and $conf['cryptographp']['comments_action'] != 'inactive' and  
    4654    isset($pwg_loaded_plugins['Comments_on_Albums']) and isset($page['section']) and  
  • extensions/CryptograPHP/securimage/securimage_show.php

    r12617 r12619  
    4949include_once(PHPWG_ROOT_PATH.'include/common.inc.php'); 
    5050 
    51 $conf['cryptographp'] = unserialize($conf['cryptographp']); 
     51// $conf['cryptographp'] = unserialize($conf['cryptographp']); 
    5252 
    5353// randomize colors