Ignore:
Timestamp:
Apr 29, 2012, 5:04:37 PM (12 years ago)
Author:
mistic100
Message:

update for 2.4
deactivated for smartpocket, now compatible with simple and stripped on ContactForm
live update of preview on admin page

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/CryptograPHP/include/category.inc.php

    r12619 r14527  
    22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    33
     4load_language('plugin.lang', CRYPTO_PATH);
    45add_event_handler('loc_begin_index', 'add_crypto');
    5 add_event_handler('user_comment_check', 'check_crypto', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
     6add_event_handler('user_comment_check_albums', 'check_crypto', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
    67
    78function add_crypto()
     
    1819  global $conf;
    1920 
    20   $search = '#<input type="hidden" name="key" value="{\$comment_add\.KEY}"([ /]*)>#';
    21   $replace = '<input type="hidden" name="key" value="{$comment_add.KEY}"$1>'.'
    22   <label>
    23     <img id="captcha" src="'.CRYPTO_PATH.'securimage/securimage_show.php" alt="CAPTCHA Image">
    24     <a href="#" onclick="document.getElementById(\'captcha\').src = \''.CRYPTO_PATH.'securimage/securimage_show.php?\' + Math.random(); return false">
    25       <img src="'.CRYPTO_PATH.'template/refresh.png"></a>
    26     <br>{\''.($conf['cryptographp']['captcha_type']=='string'?'Enter code':'Solve equation').'\'|@translate} :
    27     <input type="text" name="captcha_code" size="'.($conf['cryptographp']['code_length']+1).'" maxlength="'.$conf['cryptographp']['code_length'].'" />
    28    
    29   </label>';
     21  $search = '<p><textarea name="content" id="contentid" rows="5" cols="50">{$comment_add.CONTENT}</textarea></p>';
     22  $replace = $search.'
     23                                <p><label>{\''.($conf['cryptographp']['captcha_type']=='string'?'Enter code':'Solve equation').'\'|@translate} :</label></p>
     24                                <p>
     25                                  <img id="captcha" src="'.CRYPTO_PATH.'securimage/securimage_show.php" alt="CAPTCHA Image">
     26                                  <a href="#" onclick="document.getElementById(\'captcha\').src = \''.CRYPTO_PATH.'securimage/securimage_show.php?\' + Math.random(); return false">
     27                                    <img src="'.CRYPTO_PATH.'template/refresh.png"></a>
     28          <input type="text" name="captcha_code" style="width:'.$conf['cryptographp']['code_length'].'em;" maxlength="'.$conf['cryptographp']['code_length'].'" />
     29                                </p>';
    3030
    31   return preg_replace($search, $replace, $content);
     31  return str_replace($search, $replace, $content);
    3232}
    3333
    3434function check_crypto($action, $comment)
    3535{
    36   global $conf;
     36  global $conf, $page;
    3737 
    3838  include_once(CRYPTO_PATH.'securimage/securimage.php');
     
    4646  if ($securimage->check($_POST['captcha_code']) == false)
    4747  {
     48    if ($conf['cryptographp']['comments_action'] == 'reject') array_push($page['errors'], l10n('Invalid Captcha'));
    4849    return $conf['cryptographp']['comments_action'];
    4950  }
Note: See TracChangeset for help on using the changeset viewer.