Changeset 14527 for extensions/CryptograPHP/include/category.inc.php
- Timestamp:
- Apr 29, 2012, 5:04:37 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/CryptograPHP/include/category.inc.php
r12619 r14527 2 2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 3 3 4 load_language('plugin.lang', CRYPTO_PATH); 4 5 add_event_handler('loc_begin_index', 'add_crypto'); 5 add_event_handler('user_comment_check ', 'check_crypto', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);6 add_event_handler('user_comment_check_albums', 'check_crypto', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); 6 7 7 8 function add_crypto() … … 18 19 global $conf; 19 20 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>'; 30 30 31 return preg_replace($search, $replace, $content);31 return str_replace($search, $replace, $content); 32 32 } 33 33 34 34 function check_crypto($action, $comment) 35 35 { 36 global $conf ;36 global $conf, $page; 37 37 38 38 include_once(CRYPTO_PATH.'securimage/securimage.php'); … … 46 46 if ($securimage->check($_POST['captcha_code']) == false) 47 47 { 48 if ($conf['cryptographp']['comments_action'] == 'reject') array_push($page['errors'], l10n('Invalid Captcha')); 48 49 return $conf['cryptographp']['comments_action']; 49 50 }
Note: See TracChangeset
for help on using the changeset viewer.