### This file adds Whoson functions to the SSI_Center as not SSI Content ### since Whoson already provides SSI statements. Most of this file written by LooneyPandora ### table formatting stripped to provide better compatibility $SSI_Center_ver = '1.0b5 special test'; ### Prints the time (obvious, no?) ### sub SSI_WhatTime { $whosontime = &timeformat($date, 1); $yywhosontime = qq~
$whosontime
~; } ### Displays the poll, it requires the beta version of showcase polls to be installed ### ### Still need CSS stuff for this part. sub SSI_WhoPoll { $who_poll = 1; ########showcase poll start # Look for a showcase.poll file. if (-e "$datadir/showcase.poll") { my ($board, $viewnum); fopen (FILE, "$datadir/showcase.poll"); @showdata = ; fclose (FILE); $showcasepoll = $showdata[0]; $showcasepoll =~ s~\n~~g; ($scboard, $viewnum) = split(/\|/, $showcasepoll); # Look for a valid poll file. if (-e "$datadir/$viewnum.poll") { $pollthread = 1; unless( &BoardAccessGet($scboard) ) { $pollthread = 0; } } if ($pollthread) { $yymain .= qq~~; require "$sourcedir/Poll.pl"; &display_poll($viewnum, 1, $scboard); } } #########showcase poll end if (-e "$datadir/showcase.poll") { $yywhosonpoll = qq~$yymain~; } } ### Displays the latest member, with link to memberlist (doesn't support YaMS default sorting) ### sub SSI_WhoMembers { my( $memcount, $latestmember ) = &MembershipGet; &LoadUser($latestmember); $thelatestmember = qq~$userprofile{$latestmember}->[1]~; $yywhosonlatestmember = qq~
$txt{'331'}
$txt{'201'}:
-- $thelatestmember

$ssicwhotxt{'12'}:
-- $txt{'303'}
-- $txt{'304'}
-- $txt{'305'} $txt{'411'} $TopAmmount $txt{'306'}
~; } ### Displays who is online currently ### sub SSI_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 = "$ssicwhotxt{'01'}"; } chomp $admins; if($admins eq '') { $admins = "$ssicwhotxt{'01'}"; } chomp $moderators; if($moderators eq '') { $moderators = "$ssicwhotxt{'01'}"; } if($countonl eq '') { $countonl = "$ssicwhotxt{'01'}"; } $yywhosonusers = qq~
$txt{'158'}
$txt{'94'}: $countonl

$txt{'684'}:
   $admins
$ssicwhotxt{'14'}:
   $moderators
$txt{'142'}:
   $users
$txt{'141'}: $guests
~; } ### Shows the IM info ### sub SSI_WhoIM { if ($username ne 'Guest') { require "$sourcedir/Load.pl"; &LoadIMs; ### Sees if adv IM box is installed via setting in WhosonSettings.pl prints the 'have x new' bit ### if ($adv_imbox eq '1') { $yywhosonIM = qq~
$ssicwhotxt{'15'}
$txt{'247'} $realname,
$txt{'152'} $minnum ~; if($minnum == 1) { $yywhosonIM .= $ssicwhotxt{'13'}; } else { $yywhosonIM .= $ssicwhotxt{'05'}; } $yywhosonIM .= qq~ $imnewcount $imnewtext
~; } else { $yywhosonIM = qq~
$ssicwhotxt{'15'}
$txt{'247'} $realname,
$txt{'152'} $mnum ~; if($messnum == 1) { $yywhosonIM .= $txt{'153a'}; } else { $yywhosonIM .= $ssicwhotxt{'05'}; } $yywhosonIM .= qq~
~; } } else { ### Quick Login Box by Michael ### $yywhosonIM = qq~
$ssicwhotxt{'09'}
$txt{'35'}:
$txt{'36'}:
$ssicwhotxt{'10'}
~; } ###/Quick Login Box ### } ### Shows the stats that are shown in the info centre ### sub SSI_WhoStats { fopen(FILE, "$vardir/cat.txt"); @categories = ; fclose(FILE); my( $memcount, $latestmember ) = &MembershipGet; $yywhosonstats = qq~ ~; $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; } } $yywhosonstats .= qq~
$txt{'200'}
$txt{'488'}  $memcount
$txt{'489'}  $totalm
$txt{'490'}  $totalt
~; } ########## Insert Newcalendar Stuff ########## sub SSI_CalStuff { if(-e("$sourcedir/Newcalendar.pl")) { $yywhosonnewcal = qq~
$ssicwhotxt{'16'}
~; require "$sourcedir/NewcalIndex.pl"; $messageholdercal = $message; &WhosCal; $message = $messageholdercal; $yywhosonnewcal .= qq~$SSI_whoscal~; $yywhosonnewcal .= qq~
~; } 1; } ######### End Newcalendar Stuff ############# ### Next few suds ripped straight out of the print headlines.mod not sure what it all does, but it works ### sub SSI_WhoRecent { $recentdisplay = 5; @categories = (); fopen(FILE, "$vardir/cat.txt"); @categories = ; fclose(FILE); $oldestfound = stringtotime("01/10/37 at 00:00:00"); foreach $curcat (@categories) { chomp $curcat; fopen(FILE, "$boardsdir/$curcat.cat"); $catname{$curcat} = ; chomp $catname{$curcat}; $cataccess{$curcat} = ; chomp $cataccess{$curcat}; @{$catboards{$curcat}} = ; fclose(FILE); $openmemgr{$curcat} = 0; @membergroups = split( /,/, $cataccess{$curcat} ); if( ! $cataccess{$curcat} ) { $openmemgr{$curcat} = 1; } unless( $openmemgr{$curcat} ) { next; } foreach $curboard (@{$catboards{$curcat}}) { chomp $curboard; fopen(FILE, "$boardsdir/$curboard.txt"); @threads = ; fclose(FILE); fopen(FILE, "$boardsdir/$curboard.dat"); @boardinfo = ; fclose(FILE); foreach (@boardinfo) { chomp; } @{$boardinfo{$curboard}} = @boardinfo; $cat{$curboard} = $curcat; for ($i = 0; $i < @threads; $i++) { chomp $threads[$i]; ($tnum, $tsub, $tname, $temail, $tdate, $treplies, $tusername, $ticon, $tstate) = split( /\|/, $threads[$i] ); fopen(FILE, "$datadir/$tnum.txt") || next; while( ) { $recentmessage = $_; } # get only the last post for this thread. fclose(FILE); chomp $recentmessage; if( $recentmessage ) { ($msub, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $recentmessage, $mns) = split(/\|/,$recentmessage); $mtime = stringtotime($mdate); if( $numfound >= $recentdisplay && $mtime <= $oldestfound ) { next; } else { # Decide if thread should have the "NEW" indicator next to it. # Do this by reading the user's log for last read time on thread, # and compare to the last post time on the thread. $dlp = &getlog($tnum); $threaddate = stringtotime($tdate); if( $max_log_days_old && $dlp < $threaddate && $username ne 'Guest' && &getlog("$currentboard--mark") < $threaddate ) { $tmpx = &getlog("$curboard--mark"); $new = qq~ NEW~; } else { $new = ''; } $data{$mtime} = [$curboard, $tnum, $treplies, $tusername, $tname, $tsub, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $recentmessage, $mns, $new]; if( $mtime < $oldestfound ) { $oldestfound = $mtime; } ++$numfound; } } } } } @messages = sort {$b <=> $a } keys %data; if( @messages ) { if( @messages > $recentdisplay ) { $#messages = $recentdisplay - 1; } $counter = 1; fopen(FILE,"$vardir/censor.txt"); while( chomp( $buffer = ) ) { ($tmpa,$tmpb) = split(/=/,$buffer); push(@censored,[$tmpa,$tmpb]); } fclose(FILE); } else { $yywhosonrecent = qq~
$ssicwhotxt{'48'}
~; } $yywhosonrecent .= qq~
$ssicwhotxt{'17'}
~; for( $i = 0; $i < @messages; $i++ ) { ($board, $tnum, $c, $tusername, $tname, $msub, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $recentmessage, $mns, $new) = @{ $data{$messages[$i]} }; foreach (@censored) { ($tmpa,$tmpb) = @{$_}; $recentmessage =~ s~\Q$tmpa\E~$tmpb~gi; $msub =~ s~\Q$tmpa\E~$tmpb~gi; } if ($snip_headlines) { if (length($msub) > $snip_headlines) { $msub = substr($msub,0,$snip_headlines); $msub .= "...";} } $yywhosonrecent .= qq~ $counter.   $msub$new
~; ++$counter; } $yywhosonrecent .= qq~
~; } ### Shows the chat info, completely untested, as I don't have chat mod installed. I think it works ### sub SSI_WhoChat { if ( -e("$sourcedir/Chat.pl") ) { $cguests = 0; $cusers = ''; fopen(OF,"$vardir/online.txt") or dienice ("Can't open file: $!"); @ary = ; fclose(OF); foreach $line (@ary) { chomp($line); ($of,$name,$ip,$displayname,$level,$time,$non7,$non8,$non9,$non10,$non11) = split(/°¸/,$line); if( $name ) { &LoadUser($name); if( exists $userprofile{$name} ) { $cusers .= qq~ $displayname, \n~; } else { $cguests++; } } } $cusers =~ s~, \n\Z~~; if($cusers eq '') { $cusers = "$ssicwhotxt{'01'}"; } if ($password eq ""){ $yywhochat =qq~$chadmtxt{'8'}~; } else { $yywhochat =qq~$chadmtxt{'10'}~; } $yywhosonchat = qq~
$chadmtxt{'7'}
   $cusers  

$yywhochat
~; } } sub SSI_WhoBirthday { ############################################### #Birthday mod plugin for YaBB 1Gold # # By Max : staff@my.netvigator.com # ############################################### &timeformat($date); ($tocheckm, $tocheckd, $trash) = split(/\//, $date); $whobd = ""; $countbd = 0; 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 = qq~$ssicwhotxt{'01'}~; } $yywhosonbirth = qq~
$ssicwhotxt{'11'}
   $whobg  
~; } # exit; 1;