D:\my docs\My Received Files\Yabb\Yabb\YaBB_2.5_AEB\cgi-bin\yabb2_old\Admin\Settings_Antispam.pl D:\WEBSITES\testbed\cgi-bin\yabb252\Admin\Settings_Antispam.pl
############################################################################### ###############################################################################
# Settings_Antispam.pl                                                        # # Settings_Antispam.pl                                                        #
############################################################################### ###############################################################################
# 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 Anniversary Edition                                # # Version:        YaBB 2.5.2                                                  #
# Packaged:       July 04, 2010                                               # # Packaged:       September 30, 2012                                          #
# Distributed by: http://www.yabbforum.com                                    # # Distributed by: http://www.yabbforum.com                                    #
# =========================================================================== # # =========================================================================== #
# Copyright (c) 2000-2010 YaBB (www.yabbforum.com) - All Rights Reserved.     # # Copyright (c) 2000-2012 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.                      #
# Sponsored by: Xnull Internet Media, Inc. - http://www.ximinc.com            #    
#               Your source for web hosting, web design, and domains.         #    
############################################################################### ###############################################################################
   
$settings_antispamplver = 'YaBB 2.5 AE $Revision: 1.11 $'; $settings_antispamplver = 'YaBB 2.5.2 $Revision: 1.0 $';
if ($action eq 'detailedversion') { return 1; } if ($action eq 'detailedversion') { return 1; }
   
# TSC # TSC
if (-e "$vardir/spamrules.txt" ) { if (-e "$vardir/spamrules.txt" ) {
   fopen(SPAM, "$vardir/spamrules.txt") || &fatal_error("cannot_open","spamrules.txt", 1);    fopen(SPAM, "$vardir/spamrules.txt") || &fatal_error("cannot_open","spamrules.txt", 1);
   $spamlist = join('', <SPAM>);    $spamlist = join('', <SPAM>);
   fclose(SPAM);    fclose(SPAM);
} }
   
# Email Domain Filter # Email Domain Filter
if (-e "$vardir/email_domain_filter.txt" ) { if (-e "$vardir/email_domain_filter.txt" ) {
   require "$vardir/email_domain_filter.txt";    require "$vardir/email_domain_filter.txt";
} }
$adomains =~ s~,~\n~g; $adomains =~ s~,~\n~g;
$bdomains =~ s~,~\n~g; $bdomains =~ s~,~\n~g;
   
# List of settings # List of settings
@settings = ( @settings = (
{ {
   name  => $settings_txt{'generalspam'},    name  => $settings_txt{'generalspam'},
   id    => 'spam',    id    => 'spam',
   items => [    items => [
       {        {
           description => qq~<label for="post_speed_count">$admin_txt{'91'}<br /><span class="small">$admin_txt{'91a'}</span></label>~,            description => qq~<label for="post_speed_count">$admin_txt{'91'}<br /><span class="small">$admin_txt{'91a'}</span></label>~,
           input_html => qq~<input type="text" name="post_speed_count" id="post_speed_count" size="5" value="$post_speed_count" />~,            input_html => qq~<input type="text" name="post_speed_count" id="post_speed_count" size="5" value="$post_speed_count" />~,
           name => 'post_speed_count',            name => 'post_speed_count',
           validate => 'number',            validate => 'number',
       },        },
       {        {
           description => qq~<label for="minlinkpost">$admin_txt{'minlinkpost'}<br /><span class="small">$admin_txt{'minlinkpost_exp'}</span></label>~,            description => qq~<label for="minlinkpost">$admin_txt{'minlinkpost'}<br /><span class="small">$admin_txt{'minlinkpost_exp'}</span></label>~,
           input_html => qq~<input type="text" name="minlinkpost" id="minlinkpost" size="5" value="$minlinkpost" />~,            input_html => qq~<input type="text" name="minlinkpost" id="minlinkpost" size="5" value="$minlinkpost" />~,
           name => 'minlinkpost',            name => 'minlinkpost',
           validate => 'number',            validate => 'number',
       },        },
       {        {
           description => qq~<label for="minlinksig">$admin_txt{'minlinksig'}<br /><span class="small">$admin_txt{'minlinksig_exp'}</span></label>~,            description => qq~<label for="minlinksig">$admin_txt{'minlinksig'}<br /><span class="small">$admin_txt{'minlinksig_exp'}</span></label>~,
           input_html => qq~<input type="text" name="minlinksig" id="minlinksig" size="5" value="$minlinksig" />~,            input_html => qq~<input type="text" name="minlinksig" id="minlinksig" size="5" value="$minlinksig" />~,
           name => 'minlinksig',            name => 'minlinksig',
             validate => 'number',  
         },  
         {  
             description => qq~<label for="minlinkweb">$admin_txt{'minlinkweb'}<br /><span class="small">$admin_txt{'minlinkweb_exp'}</span></label>~,  
             input_html => qq~<input type="text" name="minlinkweb" id="minlinkweb" size="5" value="$minlinkweb" />~,  
             name => 'minlinkweb',  
           validate => 'number',            validate => 'number',
       },        },
       {        {
           description => qq~<label for="spd_detention_time">$admin_txt{'92'}<br /><span class="small">$admin_txt{'93'}</span></label>~,            description => qq~<label for="spd_detention_time">$admin_txt{'92'}<br /><span class="small">$admin_txt{'93'}</span></label>~,
           input_html => qq~<input type="text" name="spd_detention_time" id="spd_detention_time" size="5" value="$spd_detention_time" />~,            input_html => qq~<input type="text" name="spd_detention_time" id="spd_detention_time" size="5" value="$spd_detention_time" />~,
           name => 'spd_detention_time',            name => 'spd_detention_time',
           validate => 'number',            validate => 'number',
       },        },
       {        {
           description => qq~<label for="timeout">$admin_txt{'408'}</label>~,            description => qq~<label for="timeout">$admin_txt{'408'}</label>~,
           input_html => qq~<input type="text" name="timeout" id="timeout" size="4" value="$timeout" />~,            input_html => qq~<input type="text" name="timeout" id="timeout" size="4" value="$timeout" />~,
           name => 'timeout',            name => 'timeout',
           validate => 'number',            validate => 'number',
       },        },
       {        {
           header => $settings_txt{'speedban'},            header => $settings_txt{'speedban'},
       },        },
       {        {
           description => qq~<label for="speedpostdetection">$admin_txt{'89'}</label>~,            description => qq~<label for="speedpostdetection">$admin_txt{'89'}</label>~,
           input_html => qq~<input type="checkbox" name="speedpostdetection" id="speedpostdetection" value="1" ${ischecked($speedpostdetection)}/>~,            input_html => qq~<input type="checkbox" name="speedpostdetection" id="speedpostdetection" value="1" ${ischecked($speedpostdetection)}/>~,
           name => 'speedpostdetection',            name => 'speedpostdetection',
           validate => 'boolean',            validate => 'boolean',
       },        },
       {        {
           description => qq~<label for="min_post_speed">$admin_txt{'90'}</label>~,            description => qq~<label for="min_post_speed">$admin_txt{'90'}</label>~,
           input_html => qq~<input type="text" name="min_post_speed" id="min_post_speed" size="5" value="$min_post_speed" />~,            input_html => qq~<input type="text" name="min_post_speed" id="min_post_speed" size="5" value="$min_post_speed" />~,
           name => 'min_post_speed',            name => 'min_post_speed',
           validate => 'number',            validate => 'number',
           depends_on => ['speedpostdetection'],            depends_on => ['speedpostdetection'],
       },        },
   ],    ],
}, },
{ {
   name  => $tsc_txt{'2'},    name  => $tsc_txt{'2'},
   id    => 'tsc',    id    => 'tsc',
   items => [    items => [
       {        {
           description => qq~<label for="spamrules"><b>$tsc_txt{'4'}</b><br /><span class="small">$tsc_txt{'3'}</span></label>~,            description => qq~<label for="spamrules"><b>$tsc_txt{'4'}</b><br /><span class="small">$tsc_txt{'3'}</span></label>~,
           input_html => qq~<textarea cols="60" rows="35" name="spamrules" id="spamrules" style="width: 95%">$spamlist</textarea>~,            input_html => qq~<textarea cols="60" rows="35" name="spamrules" id="spamrules" style="width: 95%">$spamlist</textarea>~,
           two_rows => 1,            two_rows => 1,
           name => 'spamrules',            name => 'spamrules',
           validate => 'fulltext,null',            validate => 'fulltext,null',
       },        },
   ],    ],
}, },
{ {
   name  => $domain_filter_txt{'2'},    name  => $domain_filter_txt{'2'},
   id    => 'emailfilter',    id    => 'emailfilter',
   items => [    items => [
       {        {
           description => qq~<label for="adomains"><b>$domain_filter_txt{'4'}</b><br /><span class="small">$domain_filter_txt{'3'}</span></label>~,            description => qq~<label for="adomains"><b>$domain_filter_txt{'4'}</b><br /><span class="small">$domain_filter_txt{'3'}</span></label>~,
           input_html => qq~<textarea cols="60" rows="35" name="adomains" id="adomains" style="width: 95%">$adomains</textarea>~,            input_html => qq~<textarea cols="60" rows="35" name="adomains" id="adomains" style="width: 95%">$adomains</textarea>~,
           two_rows => 1,            two_rows => 1,
           name => 'adomains',            name => 'adomains',
           validate => 'fulltext,null',            validate => 'fulltext,null',
       },        },
       {        {
           description => qq~<label for="bdomains"><b>$domain_filter_txt{'6'}</b><br /><span class="small">$domain_filter_txt{'7'}</span></label>~,            description => qq~<label for="bdomains"><b>$domain_filter_txt{'6'}</b><br /><span class="small">$domain_filter_txt{'7'}</span></label>~,
           input_html => qq~<textarea cols="60" rows="35" name="bdomains" id="bdomains" style="width: 95%">$bdomains</textarea>~,            input_html => qq~<textarea cols="60" rows="35" name="bdomains" id="bdomains" style="width: 95%">$bdomains</textarea>~,
           two_rows => 1,            two_rows => 1,
           name => 'bdomains',            name => 'bdomains',
           validate => 'fulltext,null',            validate => 'fulltext,null',
       },        },
   ],    ],
}, },
); );
   
# Routine to save them # Routine to save them
sub SaveSettings { sub SaveSettings {
   my %settings = @_;    my %settings = @_;
         
   # TSC    # TSC
   $settings{'spamrules'} =~ s/\r(?=\n*)//g;    $settings{'spamrules'} =~ s/\r(?=\n*)//g;
   fopen(SPAM, ">$vardir/spamrules.txt");    fopen(SPAM, ">$vardir/spamrules.txt");
   print SPAM delete($settings{'spamrules'});    print SPAM delete($settings{'spamrules'});
   fclose(SPAM);    fclose(SPAM);
   
   # email domain filter    # email domain filter
   my @domains = (delete $settings{'adomains'}, delete $settings{'bdomains'});    my @domains = (delete $settings{'adomains'}, delete $settings{'bdomains'});
   foreach (@domains){    foreach (@domains){
       s~\n~,~g;        s~\n~,~g;
       s~\s+~~g;        s~\s+~~g;
       s~(^,+|,+$)~~g;        s~(^,+|,+$)~~g;
       s~,+~,~g;        s~,+~,~g;
       s~\@~\\@~g;        s~\@~\\@~g;
   }    }
   fopen(FILE, ">$vardir/email_domain_filter.txt");    fopen(FILE, ">$vardir/email_domain_filter.txt");
   print FILE qq~\$adomains = "$domains[0]";\n~;    print FILE qq~\$adomains = "$domains[0]";\n~;
   print FILE qq~\$bdomains = "$domains[1]";\n~;    print FILE qq~\$bdomains = "$domains[1]";\n~;
   print FILE qq~1;~;    print FILE qq~1;~;
   fclose(FILE);    fclose(FILE);
   
   # Settings.pl    # Settings.pl
   &SaveSettingsTo('Settings.pl', %settings);    &SaveSettingsTo('Settings.pl', %settings);
} }
   
1; 1;