******************************************************************************** ******************************************************************************** * HACK NAME: Spoiler Hack * ******************************************************************************** * DESCRIPTION: Allow people to post spoilers and only people who want to * * see them do * * CREATED BY: Dave2/Dave Wickham * * DATE: 07/12/2002 * * VERSION: Version 1.0beta1.1 * * DEMO: http://www.aagames.co.uk/cgi-bin/ultimatebb.cgi * * CREDITS: LK, for the code to refresh back * ******************************************************************************** * REQUIREMENTS: Valid licence, UBB.classic >= 6.3.0, modification wordlets * * COMPATABILITY: Tested on UBB.classic 6.3.0, works with modification on 6.2 * ******************************************************************************** * INSTALLATION: 1) Hack the files as noted. * * 2) Upload ALL the files in ASCII. * * 3) Set the image for the UBBCode spoiler button via CP styles* ******************************************************************************** * DISCLAIMER: By using this hack, the user implicitly agrees that they * * are willingly modifying any and all files at their own * * risk. Should any errors occur either as a direct or * * indirect result of said modifications the user agrees not * * to hold Infopop Corporation or any of the individuals * * listed above accountable. * * * * * * IN OTHER WORDS: PLEASE MAKE BACKUP COPIES OF EVERY FILE YOU PLAN TO * * MODIFY PRIOR TO MODIFICATION!! * * * * * * FOR MORE TIPS AND TRICKS FOR USE WITH THE ULTIMATE BULLETIN BOARD * * PLEASE VISIT US AT: * * * * http://www.ubbdev.com/ * * (c)2001 UBB Developers Network * ******************************************************************************** ################################################################################ ##############################BEGIN HACK######################################## ################################################################################ ########## MODIFY: cgi/ubb_lib.cgi ########## #### FIND: $match++ if $_[0] =~ s/\n?\r?(\[\*\])/<\/font><\/li>
  • /isg; #### ADD BELOW: $match++ if $_[0] =~ s/(\[SPOILER\])(.+?)(\[\/SPOILER\])(\s|\n|\r)*/ <\/font>
    $vars_wordlets_mods{ubbcode_spoiler}:<\/font>
    $2<\/font><\/span>
    <\/blockquote>/isg; #### #### ########## END ubb_lib.cgi ########## ########## MODIFY: cgi/ubb_lib_posting.cgi ########## #### FIND: $match++ if $_[0] =~ s/()(\S+)(<\/a>)/\[EMAIL\]$2\[\/EMAIL\]/isg; #### ADD BELOW: # spoiler... $match++ if $_[0] =~ s/(<\/font>
    $vars_wordlets_mods{ubbcode_spoiler}:<\/font>
    )(.+?)(<\/font><\/span>
    <\/blockquote>)/\[SPOILER\]$2\[\/SPOILER\]/isg; #### #### ########## END ubb_lib_posting.cgi ########## ########## MODIFY: cgi/ultimatebb.cgi ########## #### FIND: &set_page_elements; &StandardHTML($vars_wordlets{logged_off}); exit(0); } # end logoff #### ADD BELOW: # Show spoilers? if ($ubb eq 'showspoilers') { my $spoiler_cookie = cookie( -name => "spoiler", -value => "yes", -path => '/' ); print header( -cookie => [$spoiler_cookie], -charset => "$masterCharset", ); my $clean_cgi = quotemeta("$vars_config{CGIURL}/ultimatebb.cgi"); my $clean_non = quotemeta($ULTIMATEBB); # Accelerator if (($ENV{HTTP_REFERER} ne '') && ($ENV{HTTP_REFERER} !~ m/register|age|coppa/i) && ($ENV{HTTP_REFERER} !~ /(logoff|cookies|find_lost|password)$/) # Comment out the following line to allow redirects back to anywhere && ($ENV{HTTP_REFERER} =~ /^($clean_cgi|$clean_non)/) ) { # take viewer back to topic &set_page_elements; &Transition("$ENV{HTTP_REFERER}", "$vars_wordlets_mods{spoilers_enabled}", "$ENV{HTTP_REFERER}"); } else { &set_page_elements; &StandardHTML("$vars_wordlets_mods{spoilers_enabled}"); } exit(0); } # end showspoilers # Hide spoilers? if ($ubb eq 'hidespoilers') { my $spoiler_cookie = cookie( -name => "spoiler", -value => "no", -path => '/' ); print header( -cookie => [$spoiler_cookie], -charset => "$masterCharset", ); my $clean_cgi = quotemeta("$vars_config{CGIURL}/ultimatebb.cgi"); my $clean_non = quotemeta($ULTIMATEBB); # Accelerator if (($ENV{HTTP_REFERER} ne '') && ($ENV{HTTP_REFERER} !~ m/register|age|coppa/i) && ($ENV{HTTP_REFERER} !~ /(logoff|cookies|find_lost|password)$/) # Comment out the following line to allow redirects back to anywhere && ($ENV{HTTP_REFERER} =~ /^($clean_cgi|$clean_non)/) ) { # take viewer back to topic &set_page_elements; &Transition("$ENV{HTTP_REFERER}", "$vars_wordlets_mods{spoilers_disabled}", "$ENV{HTTP_REFERER}"); } else { &set_page_elements; &StandardHTML("$vars_wordlets_mods{spoilers_disabled}"); } exit(0); } # end showspoilers #### ########## END ultimatebb.cgi ########## Save and close ########## MODIFY: cgi/cp_styles.cgi ########## #### FIND: ubbcode_list_end ubbcode_image #### APPEND: ubbcode_spoiler #### #### ########## END cp_styles.cgi ########## Save and close ########## MODIFY: Templates/public_common.pl ########## #### FIND: TAG ADD: #### #### FIND TWICE: document.writeln('[
    ' ,'' ,'$vars_wordlets{logout} ]'); } //--> #### ADD AFTER:
    » #### #### FIND: if (action == "code") { insertAtCaret(document.replier.message, ' ' + "[CODE] [/CODE]" + ' ' ); document.replier.message.focus(); return; } #### ADD AFTER: if (action == "spoiler") { insertAtCaret(document.replier.message, ' ' + "[SPOILER] [/SPOILER]" + ' ' ); document.replier.message.focus(); return; } #### #### FIND: if ($ubb_images_wording eq '') { $ubb_code_buttons .= qq~ $vars_wordlets_img{ubb_code_image} ~; } $ubb_code_buttons .= qq~ #### REPLACE WITH: if ($ubb_images_wording eq '') { $ubb_code_buttons .= qq~ $vars_wordlets_img{ubb_code_image}
    ~; } $ubb_code_buttons .= qq~ $vars_wordlets_img{ubb_code_spoiler} #### #### ########## END of public_common.pl ########## Save and close ########## MODIFY templates/cp_vars_style_core.pl ########## #### FIND: &RegField(qq!UBB Code - Image


    !, "ubbcode_image", "yes", "30", "60", "", "$vars_style{ubbcode_image}"); #### ADD BELOW: &RegField(qq!UBB Code - Spoiler


    !, "ubbcode_spoiler", "yes", "30", "60", "", "$vars_style{ubbcode_spoiler}"); #### #### ########## END of cp_vars_style_core.pl ########## Save and close ########## MODIFY templates/public_ubb_code_page.pl ########## #### FIND: To reference something specific that someone has posted, just cut and paste the applicable verbiage and enclose it as shown below

    [QUOTE]Ask not what your country can do for you....
    ask what you can do for your country.[/QUOTE]


    In the example above, the UBBCode$trade automatically blockquotes the text you reference.
    #### ADD BELOW: Posting Spoilers If you want to say something which may spoil, for example, a game for others, you may enclose it in spoiler tags; this makes the text invisible unless the reader specifically enables spoilers to be displayed. Use spoiler tags as shown below

    [SPOILER]To get the blue twig, you must go to the top right of the screen[/SPOILER]
    In the example above, the text would be invisible unless the reader had enabled spoilers.
    #### #### ########## END of public_ubb_code_page.pl ########## Save and close ########## MODIFY variables/vars_wordlets_mods.cgi ########## #### ADD: q!spoilers_enabled! => q!Spoilers are enabled!, q!spoilers_disabled! => q!Spoilers are disabled!, q!spoilers_enable! => q!enable!, q!spoilers_disable! => q!disable!, q!ubbcode_spoiler! => q!Spoiler!, #### #### ########## END of vars_wordlets_mods.cgi ########## Save and close ################################################################################ ################################END HACK######################################## ################################################################################ ########## POSSIBLE PROBLEMS ########## #### If the client doesn't support CSS, then they will see the spoiler. ########## ########## #### UBB.classic >= 6.3.1 have wordletised CPs; the CP part will need a bit of #### modification to work. ########## ##########