############################################################################### # Admin.pl # ############################################################################### # YaBB: Yet another Bulletin Board # # Open-Source Community Software for Webmasters # # Version: YaBB 1 Gold - SP 1.2 # # Released: December 2001; Updated January 27, 2003 # # Distributed by: http://www.yabbforum.com # # =========================================================================== # # Copyright (c) 2000-2003 YaBB (www.yabbforum.com) - All Rights Reserved. # # Software by: The YaBB Development Team # # with assistance from the YaBB community. # # Sponsored by: Xnull Internet Media, Inc. - http://www.ximinc.com # ############################################################################### $adminplver = "1 Gold - SP 1.2"; sub Admin { # Load data for the 'remove old messages' feature, get totals, and get moderators fopen(FILE, "$vardir/oldestmes.txt"); $maxdays = ; fclose(FILE); $yymain .= qq~
$txt{'208'}

$txt{'428'}
- $txt{'222'}
- $asmtxt{'01'}
- $txt{'7'}
- $txt{'216'}
- $txt{'764'}
- $txt{'135'}

$txt{'427'}
- $txt{'3'}
- $txt{'4'}
- Edit Sub Categories (create/remove)

$txt{'426'}
- $txt{'5'}
- $txt{'8'}
- $txt{'6'}
- $imtxt{'02'}
- $txt{'206'}
- $txt{'207'}
- $maptxt{'08'}

~; require "$sourcedir/ExtendedProfiles.pl"; $yymain .= qq~
$lang_ext{'Profiles_Controls'}
- $lang_ext{'admin_field'}

~; require "$sourcedir/ExtendedProfiles.pl"; $yymain .= qq~
$lang_ext{'Profiles_Controls'}
- $lang_ext{'admin_field'}

$txt{'501'}
- $txt{'202'}
- $txt{'502'}
- $txt{'504'}
- $txt{'593'}
- ($txt{'595'})
$txt{'124'} $txt{'579'}
 
$txt{'248'} $settings[1] ($username)!

$txt{'644'}

$txt{'645'}
$txt{'795'}
$txt{'693'}
$txt{'425'}: $YaBBversion/
($txt{'429'}) ~; if(-e ("$vardir/install.log")) { $yymain .= qq~

$modtxt{'01'} ~; } $yymain .= qq~

$txt{'571'}

Service Pack l: Special thanks to Corey Chapman, Bjoern Berg, Dave Baughman, Tim Ceuppens, Jay Silverman and Gunther Meyer.

YaBB 1 Gold: Corey Chapman, Darya Misse, Popeye, Michael Prager, Dave Baughman, Dave G, Carey P, Christian Land, Tim Ceuppens, ejdmoo, StarSaber, Parham and the rest for helping out with graphics, code and other things :-)

YaBB 1 Final: Zef Hemel, Jeff Lewis, Christian Land, Corey Chapman, Peter Crouch and a bunch of others we want to thank!
~; $yytitle = "$txt{'208'}"; &template; exit; } sub InstalledMods { &is_admin; if(-e ("$vardir/install.log")) { fopen(FILE, "$vardir/install.log"); @modsinst = ; fclose(FILE); chomp(@modsinst); (@file_status) = stat("$vardir/install.log"); ($mod_sec,$mod_min,$mod_hour,$mod_day,$mod_mon,$m_year,$w_day,$y_day,$is_dst) = localtime($file_status[9]); $mod_mon = $mod_mon+1; $mod_hour = "0$mod_hour" if ($mod_hour < 10); $mod_min = "0$mod_min" if ($mod_min < 10); $mod_sec = "0$mod_sec" if ($mod_sec < 10); $mod_year = ($m_year % 100); $mod_mon = "0$mod_mon" if ($mod_mon < 10); $mod_day = "0$mod_day" if ($mod_day < 10); $mod_year = "0$mod_year" if ($mod_year < 10); $mod_date = "$mod_mon/$mod_day/$mod_year $txt{'107'} $mod_hour\:$mod_min\:$mod_sec"; $log_upload = &timeformat($mod_date); for($i=0;$i<@modsinst;$i++) { (@modsinstalled) = split(/\\/, $modsinst[$i]); $insttst = substr($modsinstalled[0],0,9); $modnam = pop @modsinstalled; $tempmodlist[$i] .= qq($modnam|$insttst); } @SortModList = sort{lc($a) cmp lc($b)} (@tempmodlist); ($namecheck, $dummy) = split(/\|/, $SortModList[0]); ($modname[0], $insttest) = split(/\|/, $SortModList[0]); $i=0; $x=0; $is_inst=0; fopen(FILE, ">$vardir/modlist.txt", 1); while($i@modsinst) { while($modname[$i] eq $namecheck) { if($insttest eq "Installed") { $is_inst++ } else { $is_inst-- } $i++; ($modname[$i], $insttest) = split(/\|/, $SortModList[$i]); } $x = $i - 1; if($is_inst) { ($prmodname, $modext) = split(/\./, $modname[$x]); print FILE "$prmodname\n"; } $namecheck = $modname[$i]; $is_inst=0; } fclose(FILE); fopen(FILE, "$vardir/modlist.txt"); @modslist = FILE>; $modsnum = @modslist; fclose(FILE); chomp(@modslist); $yymain .= qq~
 $modtxt{'02'}
~; for($i=0;$i<$modsnum;$i++) { $modslist[$i] =~ s/\_/ /g; $yymain .= qq~ ~; } $yymain .= qq~
$modsnum $modtxt{'03'}:
$modslist[$i]
$modtxt{'04'} $log_upload
~; $yytitle = $modtxt{'02'}; &template; exit; } else { $yySetLocation = qq~$cgi;action=admin~; &redirectexit; } } sub FullStats { &is_admin; my($numcats, $numboards, @categories, @catboards, @curcataccess, $curcat, $curcatname, $curcataccess, $curboard, $threadcount, $messagecount, $maxdays, $totalt, $totalm, $avgt, $avgm); my($memcount, $latestmember) = &MembershipGet; &LoadUser($latestmember); $thelatestmember = qq~$txt{'656'} $userprofile{$latestmember}->[1]~; $memcount ||= 1; fopen(FILE, "$vardir/cat.txt"); @categories = ; fclose(FILE); $numcats = @categories; # get the number of categories foreach $curcat (@categories) { chomp $curcat; fopen(CATFILE, "$boardsdir/$curcat.cat"); $curcatname = ; $curcataccess = ; @catboards = ; fclose(CATFILE); chomp $curcatname; chomp $curcataccess; $yyAccessCat{$curcat} = $settings[7] eq 'Administrator' || $moderators{$username} || ! $curcataccess; unless( $yyAccessCat{$curcat} ) { foreach ( split(/\,/, $curcataccess) ) { if( $_ && $_ eq $settings[7] ) { $yyAccessCat{$curcat} = 1; last; } } } foreach $curboard (@catboards) { chomp $curboard; $numboards++; ( $threadcount, $messagecount ) = &BoardCountGet($curboard); $totalt += $threadcount; $totalm += $messagecount; } } $avgt = $totalt / $memcount; $avgm = $totalm / $memcount; &LoadAdmins; &LoadLogCount; $yymain .= qq~
$txt{'645'}
$txt{'94'}
$txt{'488'} $memcount
$txt{'489'} $totalm
$txt{'490'} $totalt
$txt{'658'} $numcats
$txt{'665'} $numboards
$txt{'691'} ($txt{'692'}): $yyclicks  ($txt{'693'})
$txt{'657'}
$thelatestmember
$txt{'659'} ~; require "$sourcedir/Recent.pl"; $recentsender = "admin"; &LastPost; $yymain .= qq~

$txt{'684'}: $administrators

$txt{'425'}: $YaBBversion/
($txt{'429'})
~; $yytitle = "$txt{'208'}"; &template; exit; } sub ShowClickLog { &is_admin; my($totalip,$totalclick,$totalbrow,$totalos,@log,@iplist,$date,@to,@from,@info,@os,@browser,@newiplist,@newbrowser,@newoslist,@newtolist,@newfromlist,$i,$curentry); fopen(LOG, "$vardir/clicklog.txt"); @log = ; fclose(LOG); $i = 0; foreach $curentry (@log) { ($iplist[$i],$date,$to[$i],$from[$i],$info[$i]) = split(/\|/, $curentry); $i++; } $i = 0; foreach $curentry (@info) { if ($curentry !~ /\s\(Win/i || $curentry !~ /\s\(mac/) { $curentry =~ s/\s\((compatible;\s)*/ - /ig; } else { $curentry =~ s/(\S)*\(/; /g; } if ($curentry =~ /\s-\sWin/i) { $curentry =~ s/\s-\sWin/; win/ig; } if ($curentry =~ /\s-\sMac/i) { $curentry =~ s/\s-\sMac/; mac/ig; } ($browser[$i],$os[$i]) = split(/\;\s/, $curentry); if($os[$i] =~ /\)\s\S/) { ($os[$i],$browser[$i]) = split(/\)\s/, $os[$i]); } $os[$i] =~ s/\)//g; $i++; } $yymain .= qq~
  $txt{'693'}

$txt{'697'}

$txt{'694'}
~; for($i = 0; $i < @iplist; $i++) { $iplist{$iplist[$i]}++; } $i = 0; while(($key, $val ) = each(%iplist)) { $newiplist[$i] = [ $key, $val ]; $i++; } $totalclick = @iplist; $totalip = @newiplist; $yymain .= qq~$txt{'742'}: $totalclick
~; $yymain .= qq~$txt{'743'}: $totalip

~; for($i = 0; $i < @newiplist; $i++) { if($newiplist[$i]->[0] =~ /\S+/) { $yymain .= "$newiplist[$i]->[0]  ($newiplist[$i]->[1])
\n"; } } $yymain .= qq~
$txt{'695'}
~; for($i = 0; $i < @browser; $i++) { $browser{$browser[$i]}++; } $i = 0; while(($key, $val ) = each(%browser)) { $newbrowser[$i] = [ $key, $val ]; $i++; } $totalbrow = @newbrowser; $yymain .= qq~$txt{'744'}: $totalbrow

~; for($i = 0; $i < @newbrowser; $i++) { if($newbrowser[$i]->[0] =~ /\S+/) { $yymain .= "$newbrowser[$i]->[0]  ($newbrowser[$i]->[1])
\n"; } } $yymain .= qq~
$txt{'696'}
~; for($i = 0; $i < @os; $i++) { $os{$os[$i]}++; } $i = 0; while(($key, $val ) = each(%os) ) { $newoslist[$i] = [ $key, $val ]; $i++; } $totalos = @newoslist; $yymain .= qq~$txt{'745'}: $totalos

~; for($i = 0; $i < @newoslist; $i++) { if($newoslist[$i]->[0] =~ /\S+/) { $yymain .= "$newoslist[$i]->[0]  ($newoslist[$i]->[1])
\n"; } } $yymain .= qq~
Pages Visited
~; for($i = 0; $i < @to; $i++) { $to{$to[$i]}++; } $i = 0; while(($key, $val ) = each(%to)) { $newtolist[$i] = [ $key, $val ]; $i++; } for($i = 0; $i < @newtolist; $i++) { if($newtolist[$i]->[0] =~ /\S+/) { $yymain .= "[0]\" target=\"_blank\">$newtolist[$i]->[0]  ($newtolist[$i]->[1])
\n"; } } $yymain .= qq~
Referring Pages
~; for($i = 0; $i < @from; $i++) { $from{$from[$i]}++; } $i = 0; while(($key, $val ) = each(%from)) { $newfromlist[$i] = [ $key, $val ]; $i++; } for($i = 0; $i < @newfromlist; $i++) { if($newfromlist[$i]->[0] =~ /\S+/ && $newfromlist[$i]->[0] !~ m~$boardurl~i) { $yymain .= "[0]\" target=\"_blank\">$newfromlist[$i]->[0]  ($newfromlist[$i]->[1])
\n"; } } $yymain .= qq~
~; $yytitle = $txt{'693'}; &template; exit; } sub AdminMembershipRecount { &is_admin; &MembershipCountTotal; $yymain .= qq~$txt{'505'}~; $yytitle = $txt{'504'}; &template; exit; } sub AdminBoardRecount { &is_admin; my( $curcat, $curcatname, $curcataccess ); my( @categories, @catboards ); fopen(FILE, "$vardir/cat.txt"); @categories = ; fclose(FILE); foreach $curcat (@categories) { chomp $curcat; fopen(FILE, "$boardsdir/$curcat.cat"); chomp( $curcatname = ); chomp( $curcataccess = ); @catboards = ; fclose(FILE); foreach (@catboards) { chomp; &BoardCountTotals($_); } } $yymain .= qq~$txt{'503'}~; $yytitle = $txt{'502'}; &template; exit; } sub case_insensitive { uc($::a) cmp uc ($::b); } sub RebuildMemList { &is_admin; opendir(DIR, "$memberdir") || die "$txt{'230'} ($memberdir) :: $!"; @contents = readdir(DIR); closedir(DIR); fopen(MEMLIST, ">$memberdir/memberlist.txt", 1); foreach $line (sort case_insensitive @contents){ $line =~ m~(.+)\.(.+)~; if ($2 eq 'dat'){ print MEMLIST "$1\n"; } } fclose(MEMLIST); $yymain .= qq~$txt{'594'}~; $yytitle = "$txt{'593'}"; &template; exit; } sub ViewMembers { &is_admin; # Load member list fopen(FILE, "$memberdir/memberlist.txt"); @memberlist = ; fclose(FILE); $yymain .= qq~
  $txt{'9'}
~; $count = 0; foreach $curmem (@memberlist) { $curmem =~ s/[\n\r]//g; &FormatUserName($curmem); if ($curmem eq "admin") { $yymain .= qq~ \n \n \n~; } else { $yymain .= qq~ \n \n \n~; } $count++; } $yymain .= qq~
$curmem   
$curmem   
~; $yytitle = "$txt{'9'}"; &template; exit; } sub DeleteMultiMembers { &is_admin; my($count, $memnum, $currentmem, @deademails); fopen(FILE, "$memberdir/memberlist.txt"); @memnum = ; fclose(FILE); $count = 0; while (@memnum > $count) { $currentmem = $FORM{"member$count"}; if (exists $FORM{"member$count"}) { fopen(FILE, "$memberdir/$currentmem.dat"); @memsettings=; fclose(FILE); foreach (@memsettings) { $_ =~ s~[\n\r]~~g; } push(@deademails,$memsettings[2]); unlink("$memberdir/$currentmem.dat"); unlink("$memberdir/$currentmem.msg"); unlink("$memberdir/$currentmem.log"); unlink("$memberdir/$currentmem.outbox"); unlink("$memberdir/$currentmem.imconfig"); unlink("$memberdir/$currentmem.buddy"); unlink("$memberdir/$currentmem.storage"); opendir (DIRECTORY,"$datadir"); @dirdata = readdir(DIRECTORY); closedir (DIRECTORY); $umail = $memsettings[2]; foreach $filename (@dirdata) { unless( $filename =~ m~mail\A~ ) { next; } fopen(FILE, "$datadir/$filename"); @entries = ; fclose(FILE); fopen(FILE, ">$datadir/$filename"); foreach $entry (@entries) { $entry =~ s/[\n\r]//g; if ($entry ne $umail) { print FILE "$entry\n"; } } fclose(FILE); } fopen(FILE, "$memberdir/memberlist.txt"); @members = ; fclose(FILE); fopen(FILE, ">$memberdir/memberlist.txt", 1); my $memberfound = 0; my $lastvalidmember = ''; foreach $curmem (@members) { chomp $curmem; if($curmem ne $currentmem) { print FILE "$curmem\n"; $lastvalidmember = $curmem; } else { ++$memberfound; } } fclose(FILE); my $membershiptotal = @members - $memberfound; fopen(FILE, "+>$memberdir/members.ttl"); print FILE qq~$membershiptotal|$lastvalidmember~; fclose(FILE); # For security, remove username from mod position fopen(FILE, "$vardir/cat.txt"); @categories = ; fclose(FILE); foreach $curcat (@categories) { $curcat =~ s/[\n\r]//g; fopen(CAT, "$boardsdir/$curcat.cat"); @catinfo = ; fclose(CAT); foreach $curboard (@catinfo) { $curboard =~ s/[\n\r]//g; chomp $curboard; fopen(BOARD, "$boardsdir/$curboard.dat"); @boardinfo = ; fclose(BOARD); $boardinfo[2] =~ s/[\n\r]//g; $boardinfo[2] =~ /^\|(.*?)\|$/; $mods = $1 or $mods = $boardinfo[2]; $mods =~ s/\|(\S?)/,$1/g; $mods_changed=0; if($currentmem && $mods =~ /(,*)$currentmem(,*)/g) {$mods =~ s~(,*)$currentmem(,*)~~; $mods_changed=1;} if ($mods_changed == 1) { $boardinfo[2] = $mods; fopen(BOARD, ">$boardsdir/$curboard.dat", 1); print BOARD @boardinfo; fclose(BOARD); } } } } $count++; } require "$sourcedir/Notify.pl"; remove_notifications(@deademails); $yySetLocation = qq~$scripturl?action=viewmembers~; &redirectexit; } sub MailingList { &is_admin; fopen(FILE, "$memberdir/memberlist.txt"); @memberlist = ; fclose(FILE); $yymain .= qq~
  $txt{'6'}

$txt{'735'}



$txt{'338'}




~; $yytitle = "$txt{'6'}"; &template; exit; } sub ml { &is_admin; &is_admin; $FORM{'emails'} = "; " . $FORM{'emails'}; @emails = split(/;\s*/, $FORM{'emails'}); foreach $curmem (@emails) { &sendmail( $curmem, "$mbname: $FORM{'subject'}", "$FORM{'message'}\n\n$txt{'130'}\n\n$scripturl"); } $yySetLocation = qq~$cgi;action=admin~; &redirectexit; } sub clean_log { &is_admin; $yymain .= qq~
$txt{'202'}
$txt{'203'} $txt{'163'}  $txt{'164'}
~; $yytitle = $txt{'202'}; &template; exit; } sub do_clean_log { &is_admin; # Overwrite with a blank file fopen(FILE, ">$vardir/log.txt"); print FILE ''; fclose(FILE); &Admin; } sub ipban { &is_admin; my( @ipban, @emailban, $curban ); fopen(FILE, "$vardir/ban.txt"); @ipban = ; fclose(FILE); fopen(FILE, "$vardir/ban_email.txt"); @emailban = ; fclose(FILE); fopen(FILE, "$vardir/ban_memname.txt"); @memnameban = ; fclose(FILE); $yymain .= qq~
$txt{'340'}

$txt{'724'}


$txt{'725'}


$txt{'725a'}


~; $yytitle = "$txt{'340'}"; &template; exit; } sub ipban2 { &is_admin; $FORM{'ban'} =~ tr/\r//d; $FORM{'ban'} =~ s~\A[\s\n]+~~; $FORM{'ban'} =~ s~[\s\n]+\Z~~; $FORM{'ban'} =~ s~\n\s*\n~\n~g; $FORM{'ban_email'} =~ tr/\r//d; $FORM{'ban_email'} =~ s~\A[\s\n]+~~; $FORM{'ban_email'} =~ s~[\s\n]+\Z~~; $FORM{'ban_email'} =~ s~\n\s*\n~\n~g; $FORM{'ban_memname'} =~ tr/\r//d; $FORM{'ban_memname'} =~ s~\A[\s\n]+~~; $FORM{'ban_memname'} =~ s~[\s\n]+\Z~~; $FORM{'ban_memname'} =~ s~\n\s*\n~\n~g; fopen(FILE, ">$vardir/ban.txt", 1); print FILE "$FORM{'ban'}"; fclose(FILE); fopen(FILE, ">$vardir/ban_email.txt", 1); print FILE "$FORM{'ban_email'}"; fclose(FILE); fopen(FILE, ">$vardir/ban_memname.txt", 1); print FILE "$FORM{'ban_memname'}"; fclose(FILE); $yySetLocation = qq~$cgi;action=admin~; &redirectexit; } sub ver_detail { &is_admin; &loadfiles; $yymain .= qq~
 $txt{'429'}

$txt{'495'}

$txt{'494'}

$txt{'493'}

$txt{'496'}$YaBBversion
YaBB.$yyext$YaBBplver
$language$englishlngver
Admin.pl$adminplver
AdminEdit.pl$admineditplver
BoardIndex.pl$boardindexplver
Display.pl$displayplver
ICQPager.pl$icqpagerplver
InstantMessage.pl$instantmessageplver
Load.pl$loadplver
LockThread.pl$lockthreadplver
LogInOut.pl$loginoutplver
Maintenance.pl$maintenanceplver
ManageBoards.pl$manageboardsplver
ManageCats.pl$managecatsplver
Memberlist.pl$memberlistplver
MessageIndex.pl$messageindexplver
ModifyMessage.pl$modifymessageplver
MoveThread.pl$movethreadplver
Notify.pl$notifyplver
Post.pl$postplver
Printpage.pl$printplver
Profile.pl$profileplver
Recent.pl$recentplver
Register.pl$registerplver
RemoveOldThreads.pl$removeoldthreadsplver
RemoveThread.pl$removethreadplver
Search.pl$searchplver
Security.pl$securityplver
SendTopic.pl$sendtopicplver
Subs.pl$subsplver
YaBBC.pl$yabbcplver

~; $yytitle = $txt{'429'}; &template; exit; } 1;