Changeset 26069
- Timestamp:
- Dec 21, 2013, 6:37:54 PM (10 years ago)
- Location:
- extensions/EasyCaptcha
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/EasyCaptcha/include/category.inc.php
r26025 r26069 2 2 defined('EASYCAPTCHA_ID') or die('Hacking attempt!'); 3 3 4 $conf['EasyCaptcha']['template'] = 'comment'; 4 5 include(EASYCAPTCHA_PATH.'include/common.inc.php'); 6 5 7 add_event_handler('loc_begin_index', 'add_easycaptcha'); 6 8 add_event_handler('user_comment_check_albums', 'check_easycaptcha', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); … … 15 17 { 16 18 $search = '{$comment_add.CONTENT}</textarea></p>'; 17 return str_replace($search, $search."\n{\$EASYCAPTCHA _CONTENT}", $content);19 return str_replace($search, $search."\n{\$EASYCAPTCHA.parsed_content}", $content); 18 20 } 19 21 -
extensions/EasyCaptcha/include/common.inc.php
r26025 r26069 27 27 28 28 $conf['EasyCaptcha']['drag']['selected'] = array_rand($conf['EasyCaptcha']['drag']['selection']); 29 $conf['EasyCaptcha']['drag']['text'] 30 $conf['EasyCaptcha']['key'] 29 $conf['EasyCaptcha']['drag']['text'] = l10n($drag_images[ $conf['EasyCaptcha']['drag']['selected'] ]); 30 $conf['EasyCaptcha']['key'] = $conf['EasyCaptcha']['challenge'] .'-'. pwg_password_hash($conf['secret_key'] . $conf['EasyCaptcha']['drag']['selected']); 31 31 } 32 32 // Tic-tac-toe … … 49 49 50 50 $template->set_filename('EasyCaptcha', realpath(EASYCAPTCHA_PATH.'template/'.$conf['EasyCaptcha']['template'].'.tpl')); 51 $template->a ssign_var_from_handle('EASYCAPTCHA_CONTENT', 'EasyCaptcha');51 $template->append('EASYCAPTCHA', array('parsed_content' => $template->parse('EasyCaptcha', true)), true); 52 52 53 53 -
extensions/EasyCaptcha/include/contactform.inc.php
r26068 r26069 2 2 defined('EASYCAPTCHA_ID') or die('Hacking attempt!'); 3 3 4 $conf['EasyCaptcha']['template'] = 'contactform'; 4 5 include(EASYCAPTCHA_PATH.'include/common.inc.php'); 5 add_event_handler('loc_begin_index', 'add_easycaptcha'); 6 6 7 add_event_handler('contact_form_check', 'check_easycaptcha', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); 7 8 function add_easycaptcha()9 {10 global $template;11 $template->set_prefilter('contactform', 'prefilter_easycaptcha');12 }13 14 function prefilter_easycaptcha($content, $smarty)15 {16 $search = '{$contact.content}</textarea></td>';17 return str_replace($search, $search."\n{\$EASYCAPTCHA_CONTENT}", $content);18 }19 8 20 9 function check_easycaptcha($action, $comment) -
extensions/EasyCaptcha/include/guestbook.inc.php
r26068 r26069 2 2 defined('EASYCAPTCHA_ID') or die('Hacking attempt!'); 3 3 4 $conf['EasyCaptcha']['template'] = 'guestbook'; 4 5 include(EASYCAPTCHA_PATH.'include/common.inc.php'); 5 add_event_handler('loc_begin_index', 'add_easycaptcha'); 6 6 7 add_event_handler('user_comment_check', 'check_easycaptcha', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); 7 8 function add_easycaptcha()9 {10 global $template;11 $template->set_prefilter('guestbook', 'prefilter_easycaptcha');12 }13 14 function prefilter_easycaptcha($content, $smarty)15 {16 $search = '#{\$comment_add\.CONTENT}</textarea>(\s*)</td>(\s*)</tr>#';17 $replace = '{\$comment_add.CONTENT}</textarea>$1</td>$2</tr>'."\n".'{\$EASYCAPTCHA_CONTENT}';18 return preg_replace($search, $replace, $content);19 }20 8 21 9 function check_easycaptcha($action, $comment) -
extensions/EasyCaptcha/include/picture.inc.php
r26025 r26069 2 2 defined('EASYCAPTCHA_ID') or die('Hacking attempt!'); 3 3 4 $conf['EasyCaptcha']['template'] = 'comment'; 4 5 include(EASYCAPTCHA_PATH.'include/common.inc.php'); 6 5 7 add_event_handler('loc_end_picture', 'add_easycaptcha'); 6 8 add_event_handler('user_comment_check', 'check_easycaptcha', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); … … 15 17 { 16 18 $search = '{$comment_add.CONTENT}</textarea></p>'; 17 return str_replace($search, $search."\n{\$EASYCAPTCHA _CONTENT}", $content);19 return str_replace($search, $search."\n{\$EASYCAPTCHA.parsed_content}", $content); 18 20 } 19 21 -
extensions/EasyCaptcha/include/register.inc.php
r26025 r26069 2 2 defined('EASYCAPTCHA_ID') or die('Hacking attempt!'); 3 3 4 $conf['EasyCaptcha']['template'] = 'register'; 4 5 include(EASYCAPTCHA_PATH.'include/common.inc.php'); 6 5 7 add_event_handler('loc_end_page_header', 'add_easycaptcha'); 6 8 add_event_handler('register_user_check', 'check_easycaptcha'); … … 15 17 { 16 18 $search = '<input type="checkbox" name="send_password_by_mail" id="send_password_by_mail" value="1" checked="checked">'; 17 return str_replace($search, $search."\n{\$EASYCAPTCHA _CONTENT}", $content);19 return str_replace($search, $search."\n{\$EASYCAPTCHA.parsed_content}", $content); 18 20 } 19 21 -
extensions/EasyCaptcha/main.inc.php
r26025 r26069 32 32 { 33 33 add_event_handler('loc_end_section_init', 'easycaptcha_document_init', EVENT_HANDLER_PRIORITY_NEUTRAL+30); 34 add_event_handler('loc_begin_register', 'easycaptcha_register_init', EVENT_HANDLER_PRIORITY_NEUTRAL+30); 34 35 } 35 36 … … 59 60 } 60 61 61 if (script_basename() == ' register' && $conf['EasyCaptcha']['activate_on']['register'])62 if (script_basename() == 'picture' && $conf['EasyCaptcha']['activate_on']['picture']) 62 63 { 63 $conf['EasyCaptcha']['template'] = 'register';64 include(EASYCAPTCHA_PATH . 'include/register.inc.php');65 }66 else if (script_basename() == 'picture' && $conf['EasyCaptcha']['activate_on']['picture'])67 {68 $conf['EasyCaptcha']['template'] = 'comment';69 64 include(EASYCAPTCHA_PATH . 'include/picture.inc.php'); 70 65 } … … 78 73 ) 79 74 { 80 $conf['EasyCaptcha']['template'] = 'comment';81 75 include(EASYCAPTCHA_PATH . 'include/category.inc.php'); 82 76 } 83 77 else if ($page['section'] == 'contact' && $conf['EasyCaptcha']['activate_on']['contactform']) 84 78 { 85 $conf['EasyCaptcha']['template'] = 'contactform';86 79 include(EASYCAPTCHA_PATH . 'include/contactform.inc.php'); 87 80 } 88 81 else if ($page['section'] == 'guestbook' && $conf['EasyCaptcha']['activate_on']['guestbook']) 89 82 { 90 $conf['EasyCaptcha']['template'] = 'guestbook';91 83 include(EASYCAPTCHA_PATH . 'include/guestbook.inc.php'); 92 84 } 85 } 86 } 87 function easycaptcha_register_init() 88 { 89 global $conf; 90 91 if (!is_a_guest()) 92 { 93 return; 94 } 95 96 if ($conf['EasyCaptcha']['activate_on']['register']) 97 { 98 include(EASYCAPTCHA_PATH . 'include/register.inc.php'); 93 99 } 94 100 } -
extensions/EasyCaptcha/template/contactform.tpl
r26025 r26069 1 </tr>2 1 <tr> 3 2 {include file=$EASYCAPTCHA_ABS_PATH|cat:'template/common.inc.tpl'} … … 5 4 {* <!-- DRAG & DROP --> *} 6 5 {if $EASYCAPTCHA.challenge == 'drag'} 7 <td class="title">{'To verify you are a human, please place the <b>%s</b> in the most right box bellow.'|translate:$EASYCAPTCHA.drag.text}</td> 6 <td class="title"></td> 7 <td> 8 {'To verify you are a human, please place the <b>%s</b> in the most right box bellow.'|translate:$EASYCAPTCHA.drag.text} 9 {$smarty.capture.easycaptcha} 10 </td> 8 11 9 12 {footer_script} … … 13 16 14 17 {* <!-- TIC TAC TOE --> *} 15 {else if $EASYCAPTCHA..challenge == 'tictac'} 16 <td class="title">{'You are player X, click on the right case to complete the line.'|translate}</td> 18 {else if $EASYCAPTCHA.challenge == 'tictac'} 19 <td class="title"></td> 20 <td> 21 {'You are player X, click on the right case to complete the line.'|translate} 22 {$smarty.capture.easycaptcha} 23 </td> 17 24 18 25 {footer_script} … … 27 34 28 35 {/if} 29 <td> 30 {$smarty.capture.easycaptcha} 31 </td> 36 </tr>
Note: See TracChangeset
for help on using the changeset viewer.