@@ -324,22 +324,21 @@ private function display_pb()
324324 $ captcha = $ this ->captcha_factory ->get_instance ($ this ->config ['captcha_plugin ' ]);
325325 $ captcha ->init ($ this ::CONFIRM_PASTEBIN );
326326
327- if (!$ captcha ->is_solved ())
327+ $ vc_response = $ captcha ->validate ($ data );
328+ if ($ vc_response !== false )
328329 {
329- $ error [] = $ this ->language ->lang ('PASTEBIN_CONFIRM_CODE_WRONG ' );
330- }
331- else if (!empty ($ error ))
332- {
333- $ captcha ->new_attempt ();
334- }
335- else
336- {
337- $ captcha ->garbage_collect ($ this ::CONFIRM_PASTEBIN );
330+ $ error [] = $ vc_response ;
338331 }
339332 }
340333
341334 if (!empty ($ error ))
342335 {
336+ // Okay, captcha, your job is done.
337+ if (isset ($ captcha ))
338+ {
339+ $ captcha ->reset ();
340+ }
341+
343342 // Remove duplicate entries of the error array
344343 $ error = array_unique ($ error );
345344 // We have errors, we don't insert here, but instead go back to the posting page and tell the user what he did wrong
@@ -545,14 +544,15 @@ private function display_pb()
545544 $ s_hidden_fields ['mode ' ] = 'post ' ;
546545
547546 // Visual Confirmation - Show images (borrowed from includes/ucp/ucp_register.php)
548- $ confirm_image = '' ;
549547 if (!$ this ->auth ->acl_get ('u_pastebin_post_novc ' ))
550548 {
551549 if (!isset ($ captcha ))
552550 {
553551 $ captcha = $ this ->captcha_factory ->get_instance ($ this ->config ['captcha_plugin ' ]);
554552 $ captcha ->init ($ this ::CONFIRM_PASTEBIN );
555553 }
554+ $ s_hidden_fields = array_merge ($ s_hidden_fields , $ captcha ->get_hidden_fields ());
555+
556556 $ this ->template ->assign_var ('PASTEBIN_CAPTCHA_TEMPLATE ' , $ captcha ->get_template ());
557557 }
558558
@@ -608,8 +608,6 @@ private function display_pb()
608608
609609 'FILESIZE ' => $ this ->config ['max_filesize ' ],
610610
611- 'CONFIRM_IMG ' => $ confirm_image ,
612-
613611 'S_FORM_ENCTYPE ' => ' enctype="multipart/form-data" ' ,
614612 'S_ERROR ' => (isset ($ s_error )) ? $ s_error : '' ,
615613 'S_HIDDEN_FIELDS ' => (sizeof ($ s_hidden_fields )) ? build_hidden_fields ($ s_hidden_fields ) : '' ,
0 commit comments