| ############################################################################### |
| ############################################################################### |
| # AntispamQuestions.pl # |
| # AntispamQuestions.pm # |
| |
| # $Date: 01.05.16 $ # |
| ############################################################################### |
| ############################################################################### |
| # YaBB: Yet another Bulletin Board # |
| # YaBB: Yet another Bulletin Board # |
| # Open-Source Community Software for Webmasters # |
| # Open-Source Community Software for Webmasters # |
| # Version: YaBB 2.5.2 # |
| # Version: YaBB 2.6.12 # |
| # Packaged: October 21, 2012 # |
| # Packaged: January 5, 2016 # |
| # Distributed by: http://www.yabbforum.com # |
| # Distributed by: http://www.yabbforum.com # |
| # =========================================================================== # |
| # =========================================================================== # |
| # Copyright (c) 2000-2012 YaBB (www.yabbforum.com) - All Rights Reserved. # |
| # Copyright (c) 2000-2016 YaBB (www.yabbforum.com) - All Rights Reserved. # |
| # Software by: The YaBB Development Team # |
| # Software by: The YaBB Development Team # |
| # with assistance from the YaBB community. # |
| # with assistance from the YaBB community. # |
| ############################################################################### |
| ############################################################################### |
| |
| use CGI::Carp qw(fatalsToBrowser); |
| |
| our $VERSION = '2.6.12'; |
| |
| |
| $antispamquestionsplver = 'YaBB 2.5.2 $Revision: 1.1 $'; |
| $antispamquestionspmver = 'YaBB 2.6.12 $Revision: 1710 $'; |
| if ($action eq 'detailedversion') { return 1; } |
| if ( $action eq 'detailedversion' ) { return 1; } |
| |
| |
| |
| my $questions_language = $FORM{'questions_language'} || $INFO{'questions_language'} || $lang; |
| |
| |
| sub SpamQuestions { |
| sub SpamQuestions { |
| |
| |
| &is_admin_or_gmod; |
| is_admin_or_gmod(); |
| |
| |
| if ($en_spam_questions) { $chk_spam_question = qq~ checked="checked"~; } |
| if ($en_spam_questions) { $chk_spam_question = q~ checked="checked"~; } |
| if ($spam_questions_case) { $chk_spam_question_case = qq~ checked="checked"~; } |
| if ($spam_questions_send) { $chk_spam_question_send = q~ checked="checked"~; } |
| |
| if ($spam_questions_gp) { $chk_spam_question_gp = q~ checked="checked"~; } |
| |
| opendir LNGDIR, $langdir; |
| |
| my @lfilesanddirs = readdir LNGDIR; |
| |
| closedir LNGDIR; |
| |
| |
| |
| foreach my $fld (sort {lc($a) cmp lc $b} @lfilesanddirs) { |
| |
| if (-e "$langdir/$fld/Main.lng") { |
| |
| my $displang = $fld; |
| |
| $displang =~ s/(.+?)\_(.+?)$/$1 ($2)/gism; |
| |
| if ($questions_language eq $fld) { $drawnldirs .= qq~<option value="$fld" selected="selected">$displang</option>~; } |
| |
| else { $drawnldirs .= qq~<option value="$fld">$displang</option>~; } |
| |
| } |
| |
| } |
| |
| |
| fopen(SPAMQUESTIONS, "<$langdir/$language/spam.questions") || &admin_fatal_error("cannot_open","$langdir/$language/spam.questions", 1); |
| if (-e "$langdir/$questions_language/spam.questions") { |
| |
| fopen(SPAMQUESTIONS, "<$langdir/$questions_language/spam.questions") || fatal_error('cannot_open',"$langdir/$questions_language/spam.questions", 1); |
| @spam_questions = <SPAMQUESTIONS>; |
| @spam_questions = <SPAMQUESTIONS>; |
| fclose(SPAMQUESTIONS); |
| fclose(SPAMQUESTIONS); |
| |
| } |
| |
| |
| $total_questions = @spam_questions || 0; |
| $total_questions = @spam_questions || 0; |
| |
| |
| if ($total_questions) { |
| if ($total_questions) { |
| $header_row = qq~ colspan="4"~; |
| $header_row = q~ colspan="5"~; |
| $show_questions = qq~ |
| $show_questions = |
| <tr class="catbg" style="font-weight: bold; font-size: 11px;"> |
| qq~ <tr class="catbg"> |
| <td style="width: 43%;">$spam_question_txt{'question'}</td> |
| <td><b>$spam_question_txt{'question'}</b></td> |
| <td style="width: 43%;">$spam_question_txt{'answer'}</td> |
| <td><b>$spam_question_txt{'answer'}</b></td> |
| <td style="width: 7%;">$spam_question_txt{'edit'}</td> |
| <td><b>$spam_question_txt{'image'}</b></td> |
| <td style="width: 7%;">$spam_question_txt{'delete'}</td> |
| <td><b>$admin_txt{'edit'}</b></td> |
| </tr>~; |
| <td><b>$admin_txt{'delete'}</b></td> |
| |
| </tr>~; |
| |
| |
| foreach my $question (sort { $a <=> $b } @spam_questions) { |
| foreach my $question ( sort { $a <=> $b } @spam_questions ) { |
| chomp $question; |
| chomp $question; |
| ($spam_question_id, $spam_question, $spam_answer) = split(/\|/, $question); |
| ( $spam_question_id, $spam_question, $spam_answer, undef, $spam_image ) = split /\|/xsm, |
| $show_questions .= qq~ |
| $question; |
| <tr class="windowbg2"> |
| $spam_image = $spam_image ? qq~<a href="$defaultimagesdir/Spam_Img/$spam_image" target="_blank">$spam_image</a>~ : $spam_question_txt{'na'}; |
| <td>$spam_question</td> |
| $show_questions .= qq~ <tr class="windowbg2"> |
| <td>$spam_answer</td> |
| <td>$spam_question</td> |
| <td> |
| <td>$spam_answer</td> |
| <form action="$adminurl?action=spam_questions_edit" method="post"> |
| <td>$spam_image</td> |
| <input type="hidden" name="spam_question_id" value="$spam_question_id" /> |
| <td> |
| <input class="button" type="submit" value="$spam_question_txt{'edit'}" /> |
| <form action="$adminurl?action=spam_questions_edit" method="post"> |
| </form> |
| <input type="hidden" name="spam_question_id" value="$spam_question_id" /> |
| </td> |
| <input class="button" type="submit" value="$admin_txt{'edit'}" /> |
| <td> |
| <input type="hidden" name="questions_language" value="$questions_language" /> |
| <form action="$adminurl?action=spam_questions_delete" method="post"> |
| </form> |
| <input type="hidden" name="spam_question_id" value="$spam_question_id" /> |
| </td> |
| <input class="button" type="submit" value="$spam_question_txt{'delete'}" onclick="return confirm('$spam_question_txt{'confirm'}');"/> |
| <td> |
| </form> |
| <form action="$adminurl?action=spam_questions_delete" method="post"> |
| </td> |
| <input type="hidden" name="spam_question_id" value="$spam_question_id" /> |
| </tr>~; |
| <input class="button" type="submit" value="$admin_txt{'delete'}" onclick="return confirm('$spam_question_txt{'confirm'}');"/> |
| |
| <input type="hidden" name="questions_language" value="$questions_language" /> |
| |
| </form> |
| |
| </td> |
| |
| </tr>~; |
| } |
| } |
| } else { |
| } |
| $header_row = ""; |
| else { |
| $show_questions = qq~ |
| $header_row = q~ colspan="5"~; |
| <tr class="windowbg2"> |
| $show_questions = qq~ <tr class="windowbg2"> |
| <td>$spam_question_txt{'no_questions'}</td> |
| <td colspan="5">$spam_question_txt{'no_questions'}</td> |
| </tr>~; |
| </tr>~; |
| } |
| } |
| |
| |
| $yymain = qq~ |
| $yymain = qq~ |
| <form action="$adminurl?action=spam_questions2" method="post"> |
| <form action="$adminurl?action=spam_questions2" method="post"> |
| <div class="bordercolor" style="padding: 0px; width: 99%; margin-left: 0px; margin-right: auto;"> |
| <div class="bordercolor rightboxdiv"> |
| <table width="100%" cellspacing="1" cellpadding="4"> |
| <table class="border-space pad-cell" style="margin-bottom: .5em;"> |
| <colgroup> |
| <colgroup> |
| <col width="50%" /> |
| <col span="2" style="width: 50%" /> |
| <col width="50%" /> |
| </colgroup> |
| </colgroup> |
| <tr> |
| <tr> |
| <th class="titlebg" colspan="2">$admin_img{'prefimg'} $spam_question_txt{'question_settings'}</th> |
| <th class="titlebg" colspan="2" style="text-align: left; vertical-align: middle;"><img src="$imagesdir/preferences.gif" alt="" border="0" /> $spam_question_txt{'question_settings'}</th> |
| </tr><tr class="windowbg2 vtop"> |
| </tr> |
| <td><label for="en_spam_questions">$spam_question_txt{'enable_question'}</label></td> |
| <tr class="windowbg2" style="vertical-align: top;"> |
| <td><input type="checkbox" name="en_spam_questions" id="en_spam_questions" value="1"$chk_spam_question /></td> |
| <td><label for="en_spam_questions">$spam_question_txt{'enable_question'}</label></td> |
| </tr><tr class="windowbg2 vtop"> |
| <td><input type="checkbox" name="en_spam_questions" id="en_spam_questions" value="1"$chk_spam_question /></td> |
| <td><label for="spam_questions_send">$spam_question_txt{'enable_question_send'}</label></td> |
| </tr> |
| <td><input type="checkbox" name="spam_questions_send" id="spam_questions_send" value="1"$chk_spam_question_send /></td> |
| <tr class="windowbg2" style="vertical-align: top;"> |
| </tr><tr class="windowbg2 vtop"> |
| <td><label for="spam_questions_case">$spam_question_txt{'case_sensitive'}</label></td> |
| <td><label for="spam_questions_gp">$spam_question_txt{'enable_question_gp'}</label></td> |
| <td><input type="checkbox" name="spam_questions_case" id="spam_questions_case" value="1"$chk_spam_question_case /></td> |
| <td><input type="checkbox" name="spam_questions_gp" id="spam_questions_gp" value="1"$chk_spam_question_gp /></td> |
| </tr> |
| </tr> |
| </table> |
| </table> |
| </div> |
| </div> |
| <div class="bordercolor" style="padding: 0px; width: 99%; margin-top: 1em; margin-left: 0px; margin-right: auto;"> |
| <div class="bordercolor rightboxdiv"> |
| <table width="100%" cellspacing="1" cellpadding="4"> |
| <table class="border-space pad-cell" style="margin-bottom: .5em;"> |
| <tr> |
| <tr> |
| <th class="titlebg" style="text-align: left; vertical-align: middle;"><img src="$imagesdir/preferences.gif" alt="" border="0" /> $admin_txt{'10'}</th> |
| <th class="titlebg">$admin_img{'prefimg'} $admin_txt{'10'}</th> |
| </tr> |
| </tr><tr> |
| <tr> |
| <td class="catbg center"> |
| <td class="catbg" style="text-align: center; vertical-align: middle;"><input class="button" type="submit" value="$admin_txt{'10'}" /></td> |
| <input class="button" type="submit" value="$admin_txt{'10'}" /> |
| </tr> |
| <input type="hidden" name="questions_language" value="$questions_language" /> |
| </table> |
| </td> |
| |
| </tr> |
| |
| </table> |
| </div> |
| </div> |
| </form> |
| </form> |
| <div class="bordercolor" style="padding: 0px; width: 99%; margin-top: 1em; margin-left: 0px; margin-right: auto;"> |
| <div class="bordercolor rightboxdiv" style="margin-bottom: .5em;"> |
| <table width="100%" cellspacing="1" cellpadding="4"> |
| <table class="border-space pad-cell"> |
| <tr> |
| <colgroup> |
| <th class="titlebg"$header_row style="text-align: left; vertical-align: middle;"><img src="$imagesdir/preferences.gif" alt="" border="0" /> $spam_question_txt{'questions'} ($total_questions)</th> |
| <col span="2" style="width: 30%;" /> |
| </tr> |
| <col span="1" style="width: 26%;" /> |
| |
| <col span="2" style="width: 7%" /> |
| |
| </colgroup> |
| |
| <tr> |
| |
| <th class="titlebg"$header_row>$admin_img{'prefimg'} $spam_question_txt{'questions'} ($total_questions) |
| |
| <div style="display: inline; float: right;"> |
| |
| <form action="$adminurl?action=spam_questions" method="post" enctype="application/x-www-form-urlencoded"> |
| |
| <select name="questions_language" id="questions_language" size="1"> |
| |
| $drawnldirs |
| |
| </select> |
| |
| <input type="submit" value="$admin_txt{'462'}" class="button" /> |
| |
| </form> |
| |
| </div> |
| |
| </th> |
| |
| </tr> |
| $show_questions |
| $show_questions |
| </table> |
| </table> |
| </div> |
| </div> |
| <form action="$adminurl?action=spam_questions_add" method="post"> |
| <form action="$adminurl?action=spam_questions_add" method="post" enctype="multipart/form-data" accept-charset="$yymycharset"> |
| <div class="bordercolor" style="padding: 0px; width: 99%; margin-top: 1em; margin-left: 0px; margin-right: auto;"> |
| <div class="bordercolor rightboxdiv"> |
| <table width="100%" cellspacing="1" cellpadding="4"> |
| <table class="border-space pad-cell" style="margin-bottom: .5em;"> |
| <colgroup> |
| <colgroup> |
| <col width="25%" /> |
| <col style="width: 25%" /> |
| <col width="75%" /> |
| <col style="width: 75%" /> |
| </colgroup> |
| </colgroup> |
| <tr> |
| <tr> |
| <th class="titlebg" colspan="2" style="text-align: left; vertical-align: middle;"><img src="$imagesdir/preferences.gif" alt="" border="0" /> $spam_question_txt{'new_question'}</th> |
| <th class="titlebg" colspan="2">$admin_img{'prefimg'} $spam_question_txt{'new_question'}</th> |
| </tr> |
| </tr><tr class="windowbg2 vtop bold"> |
| <tr class="windowbg2" style="vertical-align: top; font-weight: bold;"> |
| <td><label for="spam_question">$spam_question_txt{'question'}:</label></td> |
| <td><label for="spam_question">$spam_question_txt{'question'}:</label></td> |
| <td><input type="text" name="spam_question" id="spam_question" size="60" maxlength="100" /></td> |
| <td><input type="text" name="spam_question" id="spam_question" size="60" /></td> |
| </tr><tr class="windowbg2 vtop bold"> |
| </tr> |
| <td><label for="spam_answer">$spam_question_txt{'answer'}:<br /><span class="small" style="font-weight: normal;">$spam_question_txt{'answer_desc'}</span></label></td> |
| <tr class="windowbg2" style="vertical-align: top; font-weight: bold;"> |
| <td><input type="text" name="spam_answer" id="spam_answer" size="60" maxlength="50" /></td> |
| <td><label for="spam_answer">$spam_question_txt{'answer'}:<br /><span class="small" style="font-weight: normal;">$spam_question_txt{'answer_desc'}</span></label></td> |
| </tr><tr class="windowbg2 vtop bold"> |
| <td><input type="text" name="spam_answer" id="spam_answer" size="60" /></td> |
| <td><label for="spam_case">$spam_question_txt{'case_sensitive'}:<br /><span class="small" style="font-weight: normal;">$spam_question_txt{'case_sensitive_desc'}</span></label></td> |
| </tr> |
| <td><input type="checkbox" name="spam_case" id="spam_case" value="1" /></td> |
| </table> |
| </tr><tr class="windowbg2 vtop bold"> |
| |
| <td><label for="spam_image">$spam_question_txt{'image'} $spam_question_txt{'optional'}:<br /><span class="small" style="font-weight: normal;">$spam_question_txt{'image_desc'}</span></label></td> |
| |
| <td><input type="file" name="spam_image" id="spam_image" size="35" /> <span class="cursor small bold" title="$admin_txt{'remove_file'}" onclick="document.getElementById('spam_image').value='';">X</span></td> |
| |
| </tr> |
| |
| </table> |
| </div> |
| </div> |
| <div class="bordercolor" style="padding: 0px; width: 99%; margin-top: 1em; margin-left: 0px; margin-right: auto;"> |
| <div class="bordercolor rightboxdiv"> |
| <table width="100%" cellspacing="1" cellpadding="4"> |
| <table class="border-space pad-cell" style="margin-bottom: .5em;"> |
| <tr> |
| <tr> |
| <th class="titlebg" style="text-align: left; vertical-align: middle;"><img src="$imagesdir/preferences.gif" alt="" border="0" /> $admin_txt{'10'}</th> |
| <th class="titlebg">$admin_img{'prefimg'} $admin_txt{'10'}</th> |
| </tr> |
| </tr><tr> |
| <tr> |
| <td class="catbg center"> |
| <td class="catbg" style="text-align: center; vertical-align: middle;"><input class="button" type="submit" value="$spam_question_txt{'add_question'}" /></td> |
| <input class="button" type="submit" value="$spam_question_txt{'add_question'}" /> |
| </tr> |
| <input type="hidden" name="questions_language" value="$questions_language" /> |
| </table> |
| </td> |
| |
| </tr> |
| |
| </table> |
| </div> |
| </div> |
| </form> |
| </form> |
| ~; |
| ~; |
| |
| |
| $yytitle = $admintxt{'a3_sub6'}; |
| $yytitle = $admintxt{'a3_sub6'}; |
| $action_area = "spam_questions"; |
| $action_area = 'spam_questions'; |
| &AdminTemplate; |
| AdminTemplate(); |
| exit; |
| exit; |
| |
| |
| } |
| } |
| |
| |
| sub SpamQuestions2 { |
| sub SpamQuestions2 { |
| |
| is_admin_or_gmod(); |
| |
| |
| &is_admin_or_gmod; |
| $en_spam_questions = $FORM{'en_spam_questions'} || '0'; |
| |
| $spam_questions_send = $FORM{'spam_questions_send'} || '0'; |
| $en_spam_questions = $FORM{'en_spam_questions'} || "0"; |
| $spam_questions_gp = $FORM{'spam_questions_gp'} || '0'; |
| $spam_questions_case = $FORM{'spam_questions_case'} || "0"; |
| |
| |
| require Admin::NewSettings; |
| require "$admindir/NewSettings.pl"; |
| SaveSettingsTo('Settings.pm'); |
| &SaveSettingsTo('Settings.pl'); |
| |
| |
| if ( $action eq 'spam_questions2' ) { |
| if ($action eq "spam_questions2") { |
| $yySetLocation = qq~$adminurl?action=spam_questions;questions_language=$FORM{'questions_language'}~; |
| $yySetLocation = qq~$adminurl?action=spam_questions~; |
| redirectexit(); |
| &redirectexit; |
| |
| } |
| } |
| |
| return; |
| } |
| } |
| |
| |
| sub SpamQuestionsAdd { |
| sub SpamQuestionsAdd { |
| |
| is_admin_or_gmod(); |
| &is_admin_or_gmod; |
| |
| |
| |
| $spam_question = $FORM{'spam_question'}; |
| $spam_question = $FORM{'spam_question'}; |
| $spam_answer = $FORM{'spam_answer'}; |
| $spam_answer = $FORM{'spam_answer'}; |
| |
| $spam_case = $FORM{'spam_case'} || '0'; |
| |
| |
| if ($spam_question eq '') { &admin_fatal_error("invalid_value","$spam_question_txt{'question'}"); } |
| if ( $spam_question eq q{} ) { |
| if ($spam_answer eq '') { &admin_fatal_error("invalid_value","$spam_question_txt{'answer'}"); } |
| fatal_error( 'invalid_value', "$spam_question_txt{'question'}" ); |
| |
| } |
| |
| if ( $spam_answer eq q{} ) { |
| |
| fatal_error( 'invalid_value', "$spam_question_txt{'answer'}" ); |
| |
| } |
| |
| |
| fopen(SPAMQUESTIONS, ">>$langdir/$language/spam.questions") || &admin_fatal_error("cannot_open","$langdir/$language/spam.questions", 1); |
| $spam_image = UploadFile('spam_image', 'Templates/Forum/default/Spam_Img', 'png jpg jpeg gif', '250', '0'); |
| print SPAMQUESTIONS "$date|$spam_question|$spam_answer\n"; |
| |
| |
| fopen( SPAMQUESTIONS, ">>$langdir/$questions_language/spam.questions" ) |
| |
| || fatal_error( 'cannot_open', "$langdir/$questions_language/spam.questions", |
| |
| 1 ); |
| |
| print {SPAMQUESTIONS} "$date|$spam_question|$spam_answer|$spam_case|$spam_image\n" |
| |
| or croak "$croak{'print'} SPAMQUESTIONS"; |
| fclose(SPAMQUESTIONS); |
| fclose(SPAMQUESTIONS); |
| |
| |
| if ($action eq "spam_questions_add") { |
| if ( $action eq 'spam_questions_add' ) { |
| $yySetLocation = qq~$adminurl?action=spam_questions~; |
| $yySetLocation = qq~$adminurl?action=spam_questions;questions_language=$FORM{'questions_language'}~; |
| &redirectexit; |
| redirectexit(); |
| } |
| } |
| |
| return; |
| } |
| } |
| |
| |
| sub SpamQuestionsEdit { |
| sub SpamQuestionsEdit { |
| |
| is_admin_or_gmod(); |
| &is_admin_or_gmod; |
| |
| |
| |
| $id = $FORM{'spam_question_id'}; |
| $id = $FORM{'spam_question_id'}; |
| my $question_edit = ""; |
| my $question_edit = q{}; |
| |
| |
| fopen(SPAMQUESTIONS, "<$langdir/$language/spam.questions") || &admin_fatal_error("cannot_open","$langdir/$language/spam.questions", 1); |
| fopen( SPAMQUESTIONS, "<$langdir/$questions_language/spam.questions" ) |
| |
| || fatal_error( 'cannot_open', "$langdir/$questions_language/spam.questions", |
| |
| 1 ); |
| @spam_questions = <SPAMQUESTIONS>; |
| @spam_questions = <SPAMQUESTIONS>; |
| fclose(SPAMQUESTIONS); |
| fclose(SPAMQUESTIONS); |
| |
| |
| foreach my $question (@spam_questions) { |
| foreach my $question (@spam_questions) { |
| chomp $question; |
| chomp $question; |
| if ($question =~ /$id/) { |
| if ( $question =~ /$id/xsm ) { |
| $question_edit = $question; last; |
| $question_edit = $question; |
| |
| last; |
| } |
| } |
| } |
| } |
| ($spam_question_id, $spam_question, $spam_answer) = split(/\|/, $question_edit); |
| ( $spam_question_id, $spam_question, $spam_answer, $spam_case, $spam_image ) = split /\|/xsm, |
| |
| $question_edit; |
| |
| if ($spam_case) { $chk_spam_case = q~ checked="checked"~; } |
| |
| my $spam_image_value = q{}; |
| |
| if ( $spam_image ) { |
| |
| $spam_image_value = qq~<div class="small bold">$admin_txt{'current_img'}: <a href="$defaultimagesdir/Spam_Img/$spam_image" target="_blank">$spam_image</a><br /><input type="checkbox" name="del_spam_image" id="del_spam_image" value="1" /> <label for="del_spam_image">$admin_txt{'remove_img'}</label></div>~; |
| |
| } |
| $yymain = qq~ |
| $yymain = qq~ |
| <form action="$adminurl?action=spam_questions_edit2" method="post"> |
| <form action="$adminurl?action=spam_questions_edit2" method="post" enctype="multipart/form-data" accept-charset="$yymycharset"> |
| <div class="bordercolor" style="padding: 0px; width: 99%; margin-left: 0px; margin-right: auto;"> |
| <div class="bordercolor rightboxdiv"> |
| <table width="100%" cellspacing="1" cellpadding="4"> |
| <table class="border-space pad-cell" style="margin-bottom: .5em;"> |
| <colgroup> |
| <colgroup> |
| <col width="25%" /> |
| <col style="width: 25%" /> |
| <col width="75%" /> |
| <col style="width: 75%" /> |
| </colgroup> |
| </colgroup> |
| <tr> |
| <tr> |
| <th class="titlebg" colspan="2" style="text-align: left; vertical-align: middle;"><img src="$imagesdir/preferences.gif" alt="" border="0" /> $spam_question_txt{'edit_question'}</th> |
| <th class="titlebg" colspan="2">$admin_img{'prefimg'} $spam_question_txt{'edit_question'}</th> |
| </tr> |
| </tr><tr class="windowbg2 vtop bold"> |
| <tr class="windowbg2" style="vertical-align: top; font-weight: bold;"> |
| <td><label for="spam_question">$spam_question_txt{'question'}:</label></td> |
| <td><label for="spam_question">$spam_question_txt{'question'}:</label></td> |
| <td><input type="text" name="spam_question" id="spam_question" size="60" maxlength="100" value="$spam_question" /></td> |
| <td><input type="text" name="spam_question" id="spam_question" size="60" value="$spam_question" /></td> |
| </tr><tr class="windowbg2 vtop bold"> |
| </tr> |
| <td><label for="spam_answer">$spam_question_txt{'answer'}:<br /><span class="small" style="font-weight: normal;">$spam_question_txt{'answer_desc'}</span></label></td> |
| <tr class="windowbg2" style="vertical-align: top; font-weight: bold;"> |
| <td><input type="text" name="spam_answer" id="spam_answer" size="60" maxlength="50" value="$spam_answer" /><input type="hidden" name="spam_question_id" id="spam_question_id" value="$spam_question_id" /></td> |
| <td><label for="spam_answer">$spam_question_txt{'answer'}:<br /><span class="small" style="font-weight: normal;">$spam_question_txt{'answer_desc'}</span></label></td> |
| </tr><tr class="windowbg2 vtop bold"> |
| <td><input type="text" name="spam_answer" id="spam_answer" size="60" value="$spam_answer" /><input type="hidden" name="spam_question_id" id="spam_question_id" value="$spam_question_id" /></td> |
| <td><label for="spam_case">$spam_question_txt{'case_sensitive'}:<br /><span class="small" style="font-weight: normal;">$spam_question_txt{'case_sensitive_desc'}</span></label></td> |
| </tr> |
| <td><input type="checkbox" name="spam_case" id="spam_case" value="1"$chk_spam_case /></td> |
| </table> |
| </tr /> |
| |
| <tr class="windowbg2 vtop bold"> |
| |
| <td><label for="spam_image">$spam_question_txt{'image'} $spam_question_txt{'optional'}:<br /><span class="small" style="font-weight: normal;">$spam_question_txt{'image_desc'}</span></label></td> |
| |
| <td><input type="file" name="spam_image" id="spam_image" size="35" /><input type="hidden" name="cur_spam_image" value="$spam_image" /> <span class="cursor small bold" title="$admin_txt{'remove_file'}" onclick="document.getElementById('spam_image').value='';">X</span>$spam_image_value</td> |
| |
| </tr> |
| |
| </table> |
| </div> |
| </div> |
| <div class="bordercolor" style="padding: 0px; width: 99%; margin-top: 1em; margin-left: 0px; margin-right: auto;"> |
| <div class="bordercolor rightboxdiv"> |
| <table width="100%" cellspacing="1" cellpadding="4"> |
| <table class="border-space pad-cell"> |
| <tr> |
| <tr> |
| <th class="titlebg" style="text-align: left; vertical-align: middle;"><img src="$imagesdir/preferences.gif" alt="" border="0" /> $admin_txt{'10'}</th> |
| <th class="titlebg">$admin_img{'prefimg'} $admin_txt{'10'}</th> |
| </tr> |
| </tr><tr> |
| <tr> |
| <td class="catbg center"> |
| <td class="catbg" style="text-align: center; vertical-align: middle;"><input class="button" type="submit" value="$admin_txt{'10'} $spam_question_txt{'question'}" /> <input type="button" class="button" value="$spam_question_txt{'cancel'}" onclick="location.href='$adminurl?action=spam_questions';" /></td> |
| <input class="button" type="submit" value="$admin_txt{'10'} $spam_question_txt{'question'}" /> <input type="button" class="button" value="$admin_txt{'cancel'}" onclick="location.href='$adminurl?action=spam_questions;questions_language=$FORM{'questions_language'}';" /> |
| </tr> |
| <input type="hidden" name="questions_language" value="$questions_language" /> |
| </table> |
| </td> |
| |
| </tr> |
| |
| </table> |
| </div> |
| </div> |
| </form>~; |
| </form>~; |
| |
| |
| $yytitle = $admintxt{'a3_sub6'}; |
| $yytitle = $admintxt{'a3_sub6'}; |
| &AdminTemplate; |
| AdminTemplate(); |
| exit; |
| exit; |
| |
| |
| } |
| } |
| |
| |
| sub SpamQuestionsEdit2 { |
| sub SpamQuestionsEdit2 { |
| |
| is_admin_or_gmod(); |
| &is_admin_or_gmod; |
| |
| |
| |
| $spam_question_id = $FORM{'spam_question_id'}; |
| $spam_question_id = $FORM{'spam_question_id'}; |
| $spam_question = $FORM{'spam_question'}; |
| $spam_question = $FORM{'spam_question'}; |
| $spam_answer = $FORM{'spam_answer'}; |
| $spam_answer = $FORM{'spam_answer'}; |
| |
| $spam_case = $FORM{'spam_case'} || '0'; |
| |
| $spam_image = $FORM{'spam_image'}; |
| |
| $cur_spam_image = $FORM{'cur_spam_image'}; |
| |
| $del_spam_image = $FORM{'del_spam_image'}; |
| |
| |
| if ($spam_question eq '') { &admin_fatal_error("invalid_value","$spam_question_txt{'question'}"); } |
| if ( $spam_question eq q{} ) { |
| if ($spam_answer eq '') { &admin_fatal_error("invalid_value","$spam_question_txt{'answer'}"); } |
| fatal_error( 'invalid_value', "$spam_question_txt{'question'}" ); |
| |
| } |
| |
| if ( $spam_answer eq q{} ) { |
| |
| fatal_error( 'invalid_value', "$spam_question_txt{'answer'}" ); |
| |
| } |
| |
| |
| fopen(SPAMQUESTIONS, "<$langdir/$language/spam.questions") || &admin_fatal_error("cannot_open","$langdir/$language/spam.questions", 1); |
| if ( $spam_image ne q{} ) { |
| |
| $spam_image = UploadFile('spam_image', 'Templates/Forum/default/Spam_Img', 'png jpg jpeg gif', '250', '0'); |
| |
| unlink "$htmldir/Templates/Forum/default/Spam_Img/$cur_spam_image"; |
| |
| } |
| |
| else { |
| |
| $spam_image = $cur_spam_image; |
| |
| } |
| |
| if ( $del_spam_image ) { |
| |
| unlink "$htmldir/Templates/Forum/default/Spam_Img/$cur_spam_image"; |
| |
| $spam_image = q{}; |
| |
| } |
| |
| |
| |
| fopen( SPAMQUESTIONS, "<$langdir/$questions_language/spam.questions" ) |
| |
| || fatal_error( 'cannot_open', "$langdir/$questions_language/spam.questions", |
| |
| 1 ); |
| @spam_questions = <SPAMQUESTIONS>; |
| @spam_questions = <SPAMQUESTIONS>; |
| fclose(SPAMQUESTIONS); |
| fclose(SPAMQUESTIONS); |
| |
| |
| @question = grep (!/$spam_question_id/, @spam_questions); |
| @question = grep { !/$spam_question_id/xsm } @spam_questions; |
| push(@question, "$spam_question_id|$spam_question|$spam_answer"); |
| push @question, "$spam_question_id|$spam_question|$spam_answer|$spam_case|$spam_image"; |
| $question = join("", @question); |
| $question = join q{}, @question; |
| |
| |
| fopen(SPAMQUESTIONS, ">$langdir/$language/spam.questions") || &admin_fatal_error("cannot_open","$langdir/$language/spam.questions", 1); |
| fopen( SPAMQUESTIONS, ">$langdir/$questions_language/spam.questions" ) |
| print SPAMQUESTIONS "$question\n"; |
| || fatal_error( 'cannot_open', "$langdir/$questions_language/spam.questions", |
| |
| 1 ); |
| |
| print {SPAMQUESTIONS} "$question\n" or croak "$croak{'print'} SPAMQUESTIONS"; |
| fclose(SPAMQUESTIONS); |
| fclose(SPAMQUESTIONS); |
| |
| |
| if ($action eq "spam_questions_edit2") { |
| if ( $action eq 'spam_questions_edit2' ) { |
| $yySetLocation = qq~$adminurl?action=spam_questions~; |
| $yySetLocation = qq~$adminurl?action=spam_questions;questions_language=$FORM{'questions_language'}~; |
| &redirectexit; |
| redirectexit(); |
| } |
| } |
| |
| return; |
| } |
| } |
| |
| |
| sub SpamQuestionsDelete { |
| sub SpamQuestionsDelete { |
| |
| is_admin_or_gmod(); |
| |
| |
| &is_admin_or_gmod; |
| fopen( SPAMQUESTIONS, "<$langdir/$questions_language/spam.questions" ) |
| |
| || fatal_error( 'cannot_open', "$langdir/$questions_language/spam.questions", |
| fopen(SPAMQUESTIONS, "<$langdir/$language/spam.questions") || &admin_fatal_error("cannot_open","$langdir/$language/spam.questions", 1); |
| 1 ); |
| @spam_questions = <SPAMQUESTIONS>; |
| @spam_questions = <SPAMQUESTIONS>; |
| fclose(SPAMQUESTIONS); |
| fclose(SPAMQUESTIONS); |
| |
| |
| fopen(SPAMQUESTIONS, ">$langdir/$language/spam.questions") || &admin_fatal_error("cannot_open","$langdir/$language/spam.questions", 1); |
| fopen( SPAMQUESTIONS, ">$langdir/$questions_language/spam.questions" ) |
| print SPAMQUESTIONS grep (!/$FORM{'spam_question_id'}/, @spam_questions); |
| || fatal_error( 'cannot_open', "$langdir/$questions_language/spam.questions", |
| |
| 1 ); |
| |
| print {SPAMQUESTIONS} |
| |
| grep { !/$FORM{'spam_question_id'}/xsm } @spam_questions |
| |
| or croak "$croak{'print'} SPAMQUESTIONS"; |
| fclose(SPAMQUESTIONS); |
| fclose(SPAMQUESTIONS); |
| |
| |
| if ($action eq "spam_questions_delete") { |
| foreach my $spam_image (@spam_questions) { |
| $yySetLocation = qq~$adminurl?action=spam_questions~; |
| chomp $spam_image; |
| &redirectexit; |
| if ( $spam_image =~ /$FORM{'spam_question_id'}/xsm ) { |
| |
| $spam_image_delete = $spam_image; |
| |
| last; |
| |
| } |
| |
| } |
| |
| ( undef, undef, undef, undef, $spam_image ) = split /\|/xsm, |
| |
| $spam_image_delete; |
| |
| |
| |
| if ( $spam_image ) { |
| |
| unlink "$htmldir/Templates/Forum/default/Spam_Img/$spam_image"; |
| } |
| } |
| |
| |
| |
| if ( $action eq 'spam_questions_delete' ) { |
| |
| $yySetLocation = qq~$adminurl?action=spam_questions;questions_language=$FORM{'questions_language'}~; |
| |
| redirectexit(); |
| |
| } |
| |
| return; |
| } |
| } |
| |
| |
| 1; |
| 1; |
| |
| |