############################################################################### # Subs.pl # ############################################################################### # YaBB: Yet another Bulletin Board # # Open-Source Community Software for Webmasters # # Version: YaBB 1 Gold - SP 1.1 # # Released: December 2001; Updated March 22, 2002 # # Distributed by: http://www.yabbforum.com # # =========================================================================== # # Copyright (c) 2000-2002 Xnull (www.xnull.com) - All Rights Reserved. # # Software by: The YaBB Development Team # # with assistance from the YaBB community. # ############################################################################### $subsplver = "1 Gold - SP 1.1"; use subs 'exit'; $yymain = ""; # set body start to blank # Begin addon for BannerAdsSP1 if ($visualcluttert == 1){ $bannerstring = ''; $bannerfilename = qq~$vardir/crappyads.txt~; if ( -e $bannerfilename) { fopen(FILE, $bannerfilename); srand; rand($.) < 1 && ($bannerstring = $_) while ; fclose(FILE); chomp $bannerstring; } if ($bannerstring ne ''){ $bannerstring = qq~
$bannerstring


~; $yymain .= "$bannerstring" } } # End addon for BannerAdsSP1 &readform; # parse the query &get_date; # get the current date/time $currentboard = $INFO{'board'}; if ($currentboard =~ m~/~){ &fatal_error($txt{'399'}); } if ($currentboard =~ m~\\~){ &fatal_error($txt{'400'}); } if ($currentboard ne '' && currentboard !~ /\A[\s0-9A-Za-z#%+,-\.:=?@^_]+\Z/){ &fatal_error($txt{'399'}); } $currentcat = $INFO{'cat'}; if ($currentcat =~ m~/~){ &fatal_error($txt{'399a'}); } if ($currentcat =~ m~\\~){ &fatal_error($txt{'400a'}); } if ($currentcat ne '' && $currentcat !~ /\A[\s0-9A-Za-z#%+,-\.:=?@^_]+\Z/){ &fatal_error($txt{'399a'}); } $pwseed ||= 'yy'; $user_ip = $ENV{'REMOTE_ADDR'}; if ($user_ip eq "127.0.0.1") { if ($ENV{'HTTP_CLIENT_IP'} && $ENV{'HTTP_CLIENT_IP'} ne "127.0.0.1") {$user_ip = $ENV{'HTTP_CLIENT_IP'};} elsif ($ENV{'X_CLIENT_IP'} && $ENV{'X_CLIENT_IP'} ne "127.0.0.1") {$user_ip = $ENV{'X_CLIENT_IP'};} elsif ($ENV{'HTTP_X_FORWARDED_FOR'} && $ENV{'HTTP_X_FORWARDED_FOR'} ne "127.0.0.1") {$user_ip = $ENV{'HTTP_X_FORWARDED_FOR'};} else {$user_ip = $ENV{'REMOTE_ADDR'};} } $scripturl = qq~$boardurl/YaBB.$yyext~; if ($currentcat ne "") {$cgi = qq~$scripturl?cat=$currentcat~;} else {$cgi = qq~$scripturl?board=$currentboard~;} if ($currentboard && -e "$boardsdir/$currentboard.mbo" ) { require "$boardsdir/$currentboard.mbo"; } if (-e "$vardir/boards.pwd") {require "$vardir/boards.pwd";} if (-e "$vardir/cat.mco") {require "$vardir/cat.mco";} sub exit { local $| = 1; local $\ = ''; print ''; CORE::exit( $_[0] || 0 ); } sub Del_Max_IM { open(FILE, "$memberdir/$username.msg"); @messages = ; close(FILE); fopen(FILE, ">$memberdir/$username.msg", 1); for ($a = 0; $a < @messages; $a++) { chomp $messages[$a]; if($a < $numibox) { print FILE "$messages[$a]\n"; } } fclose(FILE); } sub Del_Max_IMOUT { open(FILE, "$memberdir/$username.outbox"); @omessages = ; close(FILE); fopen(FILE, ">$memberdir/$username.outbox", 1); for ($a = 0; $a < @omessages; $a++) { chomp $omessages[$a]; if($a < $numobox) { print FILE "$omessages[$a]\n"; } } fclose(FILE); } sub Del_Max_STORE { open(FILE, "$memberdir/$username.imstore"); @smessages = ; close(FILE); fopen(FILE, ">$memberdir/$username.imstore", 1); for ($a = 0; $a < @smessages; $a++) { chomp $smessages[$a]; if($a < $numstore) { print FILE "$smessages[$a]\n"; } } fclose(FILE); } sub redirectexit { print "Location: $yySetLocation\n\n"; exit; } sub redirectinternal { &LoadIMs; # Load IM's if($currentboard) { if($INFO{'num'}) { require "$sourcedir/Display.pl"; &Display; } else { require "$sourcedir/MessageIndex.pl"; &MessageIndex; } } else { require "$sourcedir/BoardIndex.pl"; &BoardIndex; } exit; } sub template { if($yySetCookies1 || $yySetCookies2 || scalar @otherCookies) { print header(-cookie=>[$yySetCookies1, $yySetCookies2, @otherCookies], -charset=>'$yycharset'); } else { print header(-status=>'200 OK', -charset=>'$yycharset'); } fopen(FILE, "$vardir/continent.txt"); @continent = ; fclose(FILE); chomp @continent; $defaultmap = $continent[0]; $defaultmap = lc($defaultmap); # Begin addon for BannerAdsSP1 if ($visualclutterb == 1){ $bannerstring = ''; $bannerfilename = qq~$vardir/crappyads.txt~; if ( -e $bannerfilename) { fopen(FILE, $bannerfilename); srand; rand($.) < 1 && ($bannerstring = $_) while ; fclose(FILE); chomp $bannerstring; } if ($bannerstring ne ''){ $bannerstring = qq~
$bannerstring


~; $yymain .= "$bannerstring" } } # End addon for BannerAdsSP1 $yyposition = $yytitle; $yytitle = "$mbname - $yytitle"; ############## Begin mod for MenuItems ################# if ($menuitems != 0) { require "$sourcedir/MenuItemsSP1.pl"; &InsertMenuItems; } else { if ($defaultml == 0) { $mldefault = "mlall"; } elsif ($defaultml == 1) { $mldefault = "mlpost"; } elsif ($defaultml == 2) { $mldefault = "mlalfa"; } elsif ($defaultml == 3) { $mldefault = "mlgrp"; } $yymenu = qq~$img{'home'}$menusep$img{'help'}$menusep$img{'search'}$menusep$img{'memberlist'}~; $yymenu .= qq~$menusep$img{'membermap'}~; $yymenu .= qq~$menusep$img{'quiz'}~; if($settings[7] eq 'Administrator') { $yymenu .= qq~$menusep$img{'admin'}~; } if($settings[7] eq 'Global Moderator' && $allow_mod == 1) { $yymenu .= qq~$menusep$img{'admin'}~; } if($username eq 'Guest') { $yymenu .= qq~$menusep$img{'login'}$menusep$img{'register'}~; } else { $yymenu .= qq~$menusep$img{'profile'}~; if ($enable_buddies == 1) { $yymenu .= qq~$menusep$img{'buddylist'}~; } if($enable_notification) { $yymenu .= qq~$menusep$img{'notification'}~; } $yymenu .= qq~$menusep$img{'logout'}~; } } ############### End mod for MenuItems ################# $yyimages = $imagesdir; fopen(TEMPLATE,"template.html") || die("$txt{'23'}: template.html"); @yytemplate =