Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 03-16-2007, 03:44 PM
TheMilkCarton TheMilkCarton is offline
 
Join Date: Jan 2007
Posts: 294
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Adding Image Verification to a plugin

Hi,

I've had this hack installed for awhile, but just recently started tackling a few of its shortcomings.

Namely, for Unregistered users to use the form, Guest Post Image Verification has to be disabled entirely.

So I started adding code to the plugin to get Image Verification, and I've been successful.. except for one thing: If the user enters the incorrect code and presses submit, it does NOT give this error like it should
Quote:
The string you entered for the image verification did not match what was displayed.
The $vbphrase for it is "register_imagecheck" and I think there should be an "$errors[]=fetch_error" somewhere in there, but I just can't get it to work.

I'm really new to coding... so can anyone lend any hands?

I've added all the code in red.
Code:
removed code, in case anyone tries taking credit for my upcoming hack :)
I get the 'redirect_postthanks_moderate' redirect if I'm logged out (even if I enter the wrong image verification code), and the plugin takes me right to the thread it created if I'm logged in.
Reply With Quote
  #2  
Old 03-17-2007, 06:02 PM
TheMilkCarton TheMilkCarton is offline
 
Join Date: Jan 2007
Posts: 294
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anybody?

I figure I would need code in the format of this
Quote:
{
$vbulletin->url = 'forumdisplay.php?' . $vbulletin->session->vars['sessionurl'] . "f=$foruminfo[forumid]";
eval(print_standard_redirect('redirect_postthanks_ moderate', true, true));
}
but with the variables changed..

I only need the error message to pop up when you enter the wrong verification code.

I guess I can just put a warning above the Image Verification telling users to double check the code they input, because it won't tell them if they've input the wrong one.. but that could lead to users submitting the same form over and over again if they're not sure they input the right code.

Argh.
Reply With Quote
  #3  
Old 03-19-2007, 12:27 PM
TheMilkCarton TheMilkCarton is offline
 
Join Date: Jan 2007
Posts: 294
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

bump. Still haven't figured it out.
Reply With Quote
  #4  
Old 03-21-2007, 09:52 AM
TheMilkCarton TheMilkCarton is offline
 
Join Date: Jan 2007
Posts: 294
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Bump. In advance, excuse me for what will probably be improper terminology..

So the Form Hack uses the newthread_start hook, so I've been looking through newthread.php trying to find the code that shows
Quote:
"The string you entered for the image verification did not match what was displayed."
and it's just not in there.. So does it call on a separate hook for this?

When using image verification in newthread or newreply, if the code you input is wrong, the "String did not match" error message pops up where the Preview of your post would. So this is all done inside of the same PHP file.. and the code has to be somewhere in there.. but I just can't seem to find it. So is there some "error" section in newthread.php or does it use the same code that clicking the Preview button does?

So, since no one is helping me with the big problem... does anybody at least have these answers?

I've at least found this code that might be what I want:
Code:
// ### POST HAS ERRORS ###
		$postpreview = construct_errors($errors); // this will take the preview's place
		construct_checkboxes($newpost);
But I'm still not sure...
Reply With Quote
  #5  
Old 03-21-2007, 10:06 AM
sebbe's Avatar
sebbe sebbe is offline
 
Join Date: Feb 2006
Location: .se
Posts: 195
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try this:
PHP Code:
eval(standard_error(fetch_error('register_imagecheck'))); 
or even

PHP Code:
eval(print_standard_redirect('register_imagecheck'truetrue)); 
Reply With Quote
  #6  
Old 03-21-2007, 10:17 AM
TheMilkCarton TheMilkCarton is offline
 
Join Date: Jan 2007
Posts: 294
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have... but what is the if conditional I need?? "if condition="!reg_imagecheck"" Or something?

I've gotten one step closer. I added
Code:
if (sizeof($errors) > 0)
    {
        // ### POST HAS ERRORS ###
        if ($vbulletin->GPC['ajax'])
        {
            require_once(DIR . '/includes/class_xml.php');
            $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
            $xml->add_group('errors');
            foreach ($errors AS $error)
            {
                $xml->add_tag('error', $error);
            }
            $xml->close_group();
            $xml->print_xml();
        }
        else
        {
            $postpreview = construct_errors($errors); // this will take the preview's place
            construct_checkboxes($newpost);
            $_REQUEST['do'] = 'newreply';
            $newpost['message'] = htmlspecialchars_uni($newpost['message']);
        }
    }
but this was from newreply instead of newthread, because the code from newthread I tried didn't work...

But anyway, now if they get the Image Code wrong it redirects them to a blank box. (Instead of popping up a box with the error in the same window) So at least I'm getting somewhere. I'm a total n00b at coding, if you can't tell.

Yes yes yes yes yes. So I tried..
Code:
removed
And it takes me to another page that says the register_imagecheck phrase. YAY. Now I just need to make sure everything else still works.

Is there a way to change it so that it ONLY evaluates that if !=='register_imagecheck' ? I don't want just any error causing it to give that message. Or will it?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:35 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03861 seconds
  • Memory Usage 2,216KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (2)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete