#!/usr/bin/perl ############################################################################### # YaBB.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. # ############################################################################### ### Version Info ### $YaBBversion = '1 Gold - SP 1.1'; $whosonplver = '1 Gold - SP 1.1'; ###### &WhoHeader; if ($INFO{'action'} eq 'Members') { &WhoMembers; } elsif ($INFO{'action'} eq 'Users') { &WhoUsers; } elsif ($INFO{'action'} eq 'Time') { &WhatTime; } elsif ($INFO{'action'} eq 'IM') { &WhoIM; } elsif ($INFO{'action'} eq 'Recent') { &WhoRecent; } elsif ($INFO{'action'} eq 'Stats') { &WhoStats; } elsif ($INFO{'action'} eq 'Chat') { &WhoChat; } elsif ($INFO{'action'} eq 'Birthday') { &WhoBirthday; } elsif ($INFO{'action'} eq 'ShowAll') { &ShowAll; } exit; sub ShowAll { # Change the order to what you want or delete the ones you don't want # &WhatTime; &WhoIM; &WhoRecent; &WhoStats; &WhoUsers; #&WhoChat;# &WhoMembers; #&WhoBirthday;# } sub WhoHeader { ### This section is taken from YaBB.pl ### if( $ENV{'SERVER_SOFTWARE'} =~ /IIS/ ) { $yyIIS = 1; $0 =~ m~(.*)(\\|/)~; $yypath = $1; $yypath =~ s~\\~/~g; chdir($yypath); push(@INC,$yypath); } use CGI::Carp qw(fatalsToBrowser); require "Settings.pl"; require "$language"; require "$sourcedir/Subs.pl"; require "$sourcedir/Load.pl"; use CGI qw/:standard/; ### Load the user's cookie (or set to guest) ### &LoadCookie; if( fopen(FILE, "$memberdir/$username.dat") ) {; @settings=; fclose(FILE); for( $_ = 0; $_ < @settings; $_++ ) { $settings[$_] =~ s~[\n\r]~~g; } $realname = $settings[1]; } ### Prints HTTP headers - based on header in Sub.pl ### if( $yyForceIIS ) { $headers = "HTTP/1.0 200 OK\n"; } $headers .= "Content-type: text/html;CHARSET=$yycharset\n\n"; print $headers; } sub WhatTime { $yytime = &timeformat($date, 1); print qq~ » $whotxt{'13'}
$whotxt{'14'}  $yytime

~; } sub WhoMembers { my( $memcount, $latestmember ) = &MembershipGet; &LoadUser($latestmember); $thelatestmember = qq~$userprofile{$latestmember}->[1]~; print qq~ » $txt{'331'} $txt{'201'}:  $thelatestmember

$whotxt{'12'}:
-- $txt{'303'}
-- $txt{'304'}
-- $txt{'305'} $txt{'411'} $TopAmmount $txt{'306'}
~; } sub WhoUsers { $guests = 0; $counter = 0; $modcounter = 0; $admincounter = 0; $users = ''; $moderators = ''; $admins = ''; fopen(FILE, "$vardir/log.txt"); @entries = ; fclose(FILE); foreach $curentry (@entries) { chomp $curentry; ($name, $value) = split(/\|/, $curentry); if( $name ) { &LoadUser($name); if( exists $userprofile{$name} ) { if ($userprofile{$name}->[7] eq "Administrator") { $admins .= qq~ $userprofile{$name}->[1], \n~; $admincounter++; } elsif ($userprofile{$name}->[7] eq "Global Moderator") { $moderators .= qq~ $userprofile{$name}->[1], \n~; $modcounter++; } else { $users .= qq~ $userprofile{$name}->[1], \n~; $counter++; } } else { ++$guests; } } } $users =~ s~, \n\Z~~; $moderators =~ s~, \n\Z~~; $admins =~ s~, \n\Z~~; $countonl = $counter + $admincounter + $modcounter + $guests; chomp $users; if($users eq '') { $users = "$whotxt{'01'}"; } chomp $admins; if($admins eq '') { $admins = "$whotxt{'01'}"; } chomp $moderators; if($moderators eq '') { $moderators = "$whotxt{'01'}"; } if($countonl eq '') { $countonl = "$whotxt{'01'}"; } print qq~ » $txt{'158'} $txt{'94'}: $countonl

$txt{'684'}:
   $admins
$txt{'299'}:
   $moderators
$txt{'142'}:
   $users
$txt{'141'}: $guests
~; } sub WhoIM { if ($username ne 'Guest') { fopen(IM, "$memberdir/$username.msg"); @immessages = ; fclose(IM); $messnum = @immessages; print qq~ » $txt{'144'} $realname, $txt{'152'}
   $messnum ~; if($messnum == 1) { print $txt{'153a'}; } else { print $txt{'153'}; } print qq~ ...
~; } else { ### Quick Login Box by Michael ### print qq~ » $whotxt{'09'}
$txt{'761'}:
$txt{'36'}:
$whotxt{'10'}
~; } ###/Quick Login Box ### } sub WhoStats { fopen(FILE, "$vardir/cat.txt"); @categories = ; fclose(FILE); my( $memcount, $latestmember ) = &MembershipGet; print qq~ » $txt{'200'} ~; $totalm = 0; $totalt = 0; for( $catnum = 0; $catnum < @categories; $catnum++ ) { chomp $categories[$catnum]; $curcat = $categories[$catnum]; fopen(FILE, "$boardsdir/$curcat.cat"); $catname{$curcat} = ; chomp $catname{$curcat}; $cataccess{$curcat} = ; chomp $cataccess{$curcat}; @{$catboards{$curcat}} = ; fclose(FILE); @membergroups = split( /,/, $cataccess{$curcat} ); $openmemgr{$curcat} = 0; foreach $tmpa (@membergroups) { if( $tmpa eq $settings[7]) { $openmemgr{$curcat} = 1; last; } } if( ! $cataccess{$curcat} || $settings[7] eq 'Administrator' || $settings[7] eq 'Global Moderator' ) { $openmemgr{$curcat} = 1; } unless( $openmemgr{$curcat} ) { next; } foreach $curboard (@{$catboards{$curcat}}) { chomp $curboard; ( $threadcount, $messagecount, $lastposttime, $lastposter ) = &BoardCountGet($curboard); $lastposttime{$curboard} = $lastposttime eq 'N/A' || ! $lastposttime ? $txt{'470'} : &timeformat($lastposttime); $lastpostrealtime{$curboard} = $lastposttime eq 'N/A' || ! $lastposttime ? '' : $lastposttime; if( $lastposter =~ m~\AGuest-(.*)~ ) { $lastposter = $1; $lastposterguest{$curboard} = 1; } $lastposter{$curboard} = $lastposter eq 'N/A' || ! $lastposter ? $txt{'470'} : $lastposter; $messagecount{$curboard} = $messagecount || 0; $threadcount{$curboard} = $threadcount || 0; $totalm += $messagecount; $totalt += $threadcount; } } print qq~ $txt{'488'}  $memcount
$txt{'489'}  $totalm
$txt{'490'}  $totalt
~; } sub WhoRecent { print qq~ » $txt{'214'}   $txt{'792'}

~; fopen(FILE, "$vardir/cat.txt"); @categories = ; fclose(FILE); # Load Censor List &LoadCensorList; %data= (); foreach $curcat (@categories) { $curcat =~ s/[\n\r]//g; fopen(CAT, "$boardsdir/$curcat.cat"); $curcatname = ; $curcataccess = ; @catboards = ; fclose(CAT); chomp $curcatname; chomp $curcataccess; %membergroups = (); foreach(split(/\,/,$curcataccess)) { $membergroups{$_} = $_; } if($curcataccess) { if($settings[7] ne 'Administrator' && $settings[7] ne 'Global Moderator' && !exists $membergroups{$settings[7]}) { next; } } foreach $curboard (@catboards ) { chomp $curboard; fopen(BOARDDATA, "$boardsdir/$curboard.txt"); $message = ; fclose(BOARDDATA); ($mnum, $msub, $dummy, $dummy, $datetime, $mreplies) = split(/\|/, $message); $mydatetime = &timeformat($datetime); foreach (@censored) { ($tmpa,$tmpb) = @{$_}; $message =~ s~\Q$tmpa\E~$tmpb~gi; $msub =~ s~\Q$tmpa\E~$tmpb~gi; } if($recentsender eq "admin") { $post = qq~ $msub « $mydatetime »\n~; } else { $post = qq~$txt{'235'}:
 $msub
$txt{'105and5'}: $mydatetime
~; } $totaltime = stringtotime($datetime); $data{$totaltime}= $post; #### fopen(MBCO, "$boardsdir/$curboard.mbo"); @messages = ; fclose(MBCO); ($mbco_passw,$mbco_pic) = split(/\|/, $messages[0]); $forboardpw = "$cookiepassword$curboard"; $crypass=crypt($mbco_passw,$pwseed); if($mbco_passw && $yyCookies{$forboardpw} ne $crypass) { $data{$totaltime}= $mbco{'13'}; } #### } } @num = sort {$b <=> $a } keys %data; print "$data{$num[0]}"; print qq~
~; } sub WhoChat { $cguests = 0; $cusers = ''; open(OF,"$vardir/online.txt") or dienice ("Can't open file: $!"); @ary = ; foreach $line (@ary) { chomp($line); ($of,$name,$ip,$displayname,$level,$time,$non1,$non2) = split(/°¸/,$line); if( $name ) { if( exists $userprofile{$name} ) { $cusers .= qq~ $displayname, \n~; } else { ++$cguests; } } close(OF); } $cusers =~ s~, \n\Z~~; if($cusers eq '') { $cusers = "$whotxt{'01'}"; } if ($password eq ""){ $yymain .=qq~$chadmtxt{'8'}~;} else { $yymain .=qq~$chadmtxt{'10'} ~; } print qq~ » $chadmtxt{'7'}   $cusers 
$yymain ~; } sub WhoBirthday { ############################################### #Birthday mod plugin for YaBB 1Gold # # By Max : staff@my.netvigator.com # ############################################### &timeformat($date); ($tocheckm, $tocheckd, $trash) = split(/\//, $date); $whobd = ""; $countbd = 0; ## get the userlist to check open(FILE, "$memberdir/memberlist.txt") || die "cannot open list file"; @members = ; close(FILE); foreach $usernames (@members) { chomp $usernames; open(FILE, "$memberdir/$usernames.dat") || die "cannot open user file"; @userbd = ; close(FILE); chomp $userbd[16]; ($matchm, $matchd, $trash) = split(/\//, $userbd[16]); if(($tocheckm == $matchm) && ($tocheckd == $matchd)) { $userbd[6] =~ s/ //g; chomp $userbd[6]; $whobg .=qq~$userbd[1]
~; $countbd++; }#end if }#end foreach chomp $whobg; if($whobg eq '') { $whobg = "$whotxt{'01'}"; } print qq~ » $whotxt{'11'}    $whobg  ~; } exit;