Changeset 17484 for extensions/CryptograPHP/include
- Timestamp:
- Aug 9, 2012, 12:11:10 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/CryptograPHP/include/contactform.inc.php
r17319 r17484 3 3 4 4 load_language('plugin.lang', CRYPTO_PATH); 5 add_event_handler(' display_contactform', 'add_crypto');6 add_event_handler('c heck_contactform_params', 'check_crypto');5 add_event_handler('loc_begin_index', 'add_crypto'); 6 add_event_handler('contact_form_check', 'check_crypto', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); 7 7 8 8 function add_crypto() … … 12 12 if (!is_a_guest()) return; 13 13 14 $template->set_prefilter(' cf_form', 'prefilter_crypto');14 $template->set_prefilter('index', 'prefilter_crypto'); 15 15 } 16 16 … … 19 19 global $conf; 20 20 21 $search = ' <td class="contact-form-right"><textarea name="cf_message" id="cf_message" rows="10" cols="40">{$CF.MESSAGE}</textarea></td>';21 $search = '{$contact.content}</textarea></td>'; 22 22 $replace = $search.' 23 23 </tr> 24 24 <tr> 25 <td class=" contact-form-left" style="vertical-align:top;">25 <td class="title"> 26 26 {\''.($conf['cryptographp']['captcha_type']=='string'?'Enter code':'Solve equation').'\'|@translate} 27 <img id="captcha" src="{$ROOT_URL}'.CRYPTO_PATH.'securimage/securimage_show.php" alt="CAPTCHA Image">28 <a href="#" onclick="document.getElementById(\'captcha\').src = \'{$ROOT_URL}'.CRYPTO_PATH.'securimage/securimage_show.php?\' + Math.random(); return false">29 <img src="{$ROOT_URL}'.CRYPTO_PATH.'template/refresh.png"></a>30 27 </td> 31 <td class="contact-form-right"><input type="text" name="captcha_code" size="'.($conf['cryptographp']['code_length']+1).'" maxlength="'.$conf['cryptographp']['code_length'].'" /></td>'; 28 <td> 29 <input type="text" name="captcha_code" id="captcha_code" size="'.($conf['cryptographp']['code_length']+1).'" maxlength="'.$conf['cryptographp']['code_length'].'" /> 30 <img id="captcha" src="{$ROOT_URL}'.CRYPTO_PATH.'securimage/securimage_show.php" alt="CAPTCHA Image" style="vertical-align:top;"> 31 <a href="#" id="captcha_refresh" onclick="document.getElementById(\'captcha\').src = \'{$ROOT_URL}'.CRYPTO_PATH.'securimage/securimage_show.php?\' + Math.random(); return false"> 32 <img src="{$ROOT_URL}'.CRYPTO_PATH.'template/refresh.png" style="vertical-align:bottom;"></a> 33 </td> 34 35 {footer_script} 36 var captcha_code = new LiveValidation("captcha_code", {ldelim} onlyOnSubmit: true, insertAfterWhatNode: "captcha_refresh" }); 37 captcha_code.add(Validate.Presence, {ldelim} failureMessage: "{\'Invalid Captcha\'|@translate}" }); 38 {/footer_script}'; 32 39 33 40 return str_replace($search, $replace, $content); 34 41 } 35 42 36 function check_crypto($ infos)43 function check_crypto($action, $comment) 37 44 { 38 if (!is_a_guest()) return $infos;45 global $conf, $page; 39 46 40 47 include_once(CRYPTO_PATH.'securimage/securimage.php'); 41 48 $securimage = new Securimage(); 42 49 50 if (!is_a_guest()) return $action; 51 43 52 if ($securimage->check($_POST['captcha_code']) == false) 44 53 { 45 array_push($infos['errors'], l10n('Invalid Captcha')); 54 array_push($page['errors'], l10n('Invalid Captcha')); 55 return 'reject'; 46 56 } 47 57 48 return $ infos;58 return $action; 49 59 } 50 60
Note: See TracChangeset
for help on using the changeset viewer.