Print Hello and Who Is Online 1.3 This is a modification of the mod "Print Who Is Online" by [CV]XXL. It allows you to add who's online or the yabb welcome message to your website, BUT: The original script only allowed you to add the script when it was on the same server. This version allows you to add it using a javascript-tag (so your website can be on another server and it doesn't have to support SSI/CGI/whatever) New in version 1.1: Private messages ... New in version 1.2: Bug fixed ... New in version 1.3: Yet another option added ;-) ... To add the welcome message: To add the number of private messages the user has received: To add the number of guests: To add the users that are online: To display the latest topics (original script by S.M.art.Y): Change the 7 to whatever number of latest topics you want to display ... (the default is 7) niGhTHAwCK http://www.skijumpinglibrary.com Sources\Subs.pl 1; sub printwhoisonline { print "Content-type: text/html\n\n"; $guests = 0; $users = ''; 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} ) { $users .= qq~ $userprofile{$name}->[1], ~; } else { ++$guests; } } } $users =~ s~, \n\Z~~; $users =~ s/'/\\'/g; $guests =~ s/'/\\'/g; if ($INFO{'group'} eq "guests") { print "document.write('$guests');"; } if ($INFO{'group'} eq "users") { print "document.write('$users');"; } exit; } YaBB.pl elsif ($action eq 'profile2') { require "$sourcedir/Profile.pl"; &ModifyProfile2; } elsif ($action eq 'printwhoisonline') { require "$sourcedir/Subs.pl"; &printwhoisonline($INFO{'group'}); } elsif ($action =~ /\'(\S\\)+\S*a\S*/) { &decode; } elsif ($action eq 'welcome') { my $headers; if( $yyForceIIS ) { $headers = "HTTP/1.0 200 OK\n"; } $headers .= "Content-type: text/html\n"; if( $yySetCookies ) { $headers .= $yySetCookies; } $headers .= "\n"; print $headers; $yyuname = $username eq 'Guest' ? qq~$txt{'248'} $txt{'28'}. $txt{'249'} $txt{'34'} $txt{'377'} $txt{'97'}.~ : qq~$txt{'247'} $realname, ~ ; $yyuname =~ s/'/\\'/g; print "document.write('$yyuname');"; exit; } elsif ($action eq 'welcome2') { my $headers; if( $yyForceIIS ) { $headers = "HTTP/1.0 200 OK\n"; } $headers .= "Content-type: text/html\n"; if( $yySetCookies ) { $headers .= $yySetCookies; } $headers .= "\n"; print $headers; if ($username ne 'Guest') { fopen(IM, "$memberdir/$username.msg"); @immessages = ; fclose(IM); $mnum = @immessages; if($mnum eq "1") { $yyim = qq~$txt{'152'} $mnum $txt{'471'}.~; } else { $yyim = qq~$txt{'152'} $mnum $txt{'153'}.~; } if($maintenance) { $yyim .= qq~
$txt{'616'}~; } $yyim =~ s/'/\\'/g; print "document.write('$yyim');"; } exit; }
Sources\Recent.pl 1; ############################# START SHOW TOPIC MOD ################################# sub LastTopics { my $display = 7; ($FTTaction,$FTT_display) = split(/\&/,$ENV{QUERY_STRING}); ($FTT_display1,$FTT_display2) = split(/\=/,$FTT_display); if ($FTT_display1 eq "display") { $display = $FTT_display2; } my( @memset, @categories, %data, %cat, $numfound, $oldestfound, $curcat, %catname, %cataccess, %catboards, $openmemgr, @membergroups, %openmemgr, $curboard, @threads, @boardinfo, $i, $c, @messages, $tnum, $tsub, $tname, $temail, $tdate, $treplies, $tusername, $ticon, $tstate, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $mns, $mtime, $counter, $board, $notify ); @categories = (); fopen(FILE, "$vardir/cat.txt"); @categories = ; fclose(FILE); $oldestfound = stringtotime("01/10/37 $txt{'107'} 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} ); foreach $tmpa (@membergroups) { if( $tmpa eq $settings[7]) { $openmemgr{$curcat} = 1; last; } } if( ! $cataccess{$curcat} || $settings[7] eq 'Administrator' ) { $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( ) { $message = $_; } # get only the last post for this thread. fclose(FILE); chomp $message; if( $message ) { ($msub, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $message, $mns) = split(/\|/,$message); $mtime = stringtotime($mdate); if( $numfound >= $display && $mtime <= $oldestfound ) { next; } else { $data{$mtime} = [$curboard, $tnum, $treplies, $tusername, $tname, $msub, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $message, $mns]; if( $mtime < $oldestfound ) { $oldestfound = $mtime; } ++$numfound; } } } } } $yytitle = $txt{'214'}; print "Content-type: text/html\n\n"; @messages = sort {$b <=> $a } keys %data; if( @messages ) { if( @messages > $display ) { $#messages = $display - 1; } $counter = 1; # Load Censor List &LoadCensorList; } else { print qq~
$txt{'170'}
~; } for( $i = 0; $i < @messages; $i++ ) { ($board, $tnum, $c, $tusername, $tname, $msub, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $message, $mns) = @{ $data{$messages[$i]} }; if( $tusername ne 'Guest' ) { &LoadUser($tusername); $tname = exists $userprofile{$tusername} ? $userprofile{$tusername}->[1] : $tname; $tname ||= $txt{'470'}; $tname = qq~$tname~; } if( $musername ne 'Guest' ) { &LoadUser($musername); $mname = exists $userprofile{$musername} ? $userprofile{$musername}->[1] : $mname; $mname ||= $txt{'470'}; $mname = qq~$mname~; } foreach (@censored) { ($tmpa,$tmpb) = @{$_}; $message =~ s~\Q$tmpa\E~$tmpb~gi; $msub =~ s~\Q$tmpa\E~$tmpb~gi; } if($enable_ubbc) { $ns = $mns; &DoUBBC; } if($enable_notification) { $notify = qq~$menusep$img{'notify'}~; } $var1 = "$boardinfo{$board}->[0]"; $var2 = "$scripturl?board=$board&action=display&num=$tnum&start=$c"; $var3 = "$msub"; $var1 =~ s/'/\\'/g; $var2 =~ s/'/\\'/g; $var3 =~ s/'/\\'/g; print <<"EOT"; document.write(''); document.write(' '); document.write(' '); document.write(' '); document.write(' '); document.write('
$counter.$var1 / $var3
'); EOT ++$counter; } exit; } ############################## END SHOW TOPIC MOD ##################################