#!/usr/bin/perl ########################################################## # Ikonboard Active Topics # ########################################################## # Author: ST8 <st8@q3f.net> # # Date: 18 April 2001 # ########################################################## # Lists active threads from the day # ########################################################## use CGI::Carp "fatalsToBrowser"; # Output errors to browser use CGI qw(:standard); # Saves loads of work $CGI::POST_MAX=1024 * 150; # limit post data $CGI::DISABLE_UPLOADS = 1; # Disable uploads $CGI::HEADERS_ONCE = 1; # Kill redundant headers eval { ($0 =~ m,(.*)/[^/]+,) and unshift (@INC, "$1"); ($0 =~ m,(.*)\\[^\\]+,) and unshift (@INC, "$1"); require "ikon.lib"; # Require ikonboard () require "data/progs.cgi"; # Require prog names require "data/boardinfo.cgi";# Require board info require "data/styles.cgi"; # Require styles info }; if ($@) { print header(); print start_html(-title=>"Ikonboard Error!"); print "Could not find these files: $@\nIf you are running NT you may need to enter the full path in each require statement in each script"; print end_html; exit; } ########################################################## # Configuration # List all forums in this array that u wish to be checked for active topics my @fnumbers = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15); # Max Number of threads to display my $maxthreads = 60; # Summary View set to yes to only display an overview rather than entire thread (yes/no) my $summary = "no"; # Turn images on? otherwise they will be linked (on/off) my $imgs = "off"; ########################################################## my $q = new CGI; $action = $q->param("action"); if ($action eq "ssi") { $recent_topics = &getrecenttopics; print qq~ <table width="120" border="0" cellspacing="1"> <tr> <td bgcolor=$titlecolor><font face="$font" color=$titlefontcolor size=2><b>Recent Topics</b></font></td> $recent_topics </table> ~; exit; } $inmembername = cookie("amembernamecookie"); if ($inmembername eq "") { $inmembername = "Guest"; } &whosonline("$inmembername|Viewing <a href=$boardurl/active.cgi>Todays Active Topics</a>|none"); $output .= qq~ <table cellspacing=0 border=0 width=$tablewidth bgcolor=$tablebordercolor align=center> <tr> <td valign=middle align=left width="100%" bgcolor="$menubackground" nowrap background=$imagesurl/images/bg.gif colspan=2><a href="$forumsummaryprog"><b><font face="$font" color=$titlefontcolor size=2> $boardname</a> » $ibtxt{'00335'}</font></b></td> </tr> <tr> <td> <table cellspacing=1 border=0 width=100%> <tr> <td bgcolor=$miscbacktwo valign=middle colspan=3 align=center><font face="$font" color=$fontcolormisc size=2><b>$ibtxt{'00336'}</b></font> </td> </tr> ~; foreach $number (@fnumbers) { opendir(THREADS, "$ikondir/forum$number"); my @threads = readdir(THREADS); closedir(THREADS); @unsortedthreads = grep(/\w+.pl/, @threads); @thethreads = sort {$b <=> $a} @unsortedthreads; $maxt = $maxthreads; $tcount = 0; (my $sec,my $min,my $hour,my $day,my $month,my $year,my $wday,my $yday,my $isdst) = localtime(); foreach $thread (@thethreads) { $tcount++; if ($tcount < $maxt) { open(DETAILS,"$ikondir/forum$number/$thread"); $details = <DETAILS>; close(DETAILS); # 1|FlipCom Interface Script|Script to work with the Flipcom irc/icq program.|open|0|1|ST8|980109695|ST8|980109695 ($tno,$title,$desc,$status,$replies,$views,$poster,$postdate,$lastrep,$lastrepdate) = split(/\|/,$details); open(TDETAILS,"$ikondir/forum$number/$tno.thd"); $Tdetails = <TDETAILS>; close(TDETAILS); # ST8|FlipCom Interface Script|213.1.155.243|yes|yes|980109695|bleh ($user,$title,$ip,$smilies,$signature,$postdate,$thread) = split(/\|/,$Tdetails); ($trash,$trash,$trash,$postday,$postmonth,$postyear,$trash,$trash,$trash) = localtime($lastrepdate); if (($day eq $postday) && ($month eq $postmonth) && ($year eq $postyear)) { $gubbins = qq~$lastrepdate|$lastrep|$poster|$title|$thread|$postdate|$replies|$number|$tno~; push(@finishedthreads2, $gubbins); } } } } @finishedthreads2 = sort {$b <=> $a} @finishedthreads2; $maxout = $maxthreads; $toutcount = 0; foreach $outthread (@finishedthreads2) { $toutcount++; if ($toutcount < $maxout) { ($lastrepdate,$lastrep,$poster,$title,$thread,$postdate,$replies,$number,$tno) = split(/\|/,$outthread); if ($imgs eq "off") { $thread =~ s/\[img\](.+?)\[\/img\]/<a href=$1 target=_blank><font size=2>[IMAGE]<\/font><\/a>/isg; } unless ($summary eq "yes") { #$thread = doemoticons("$thread"); $thread = ikoncode("$thread"); $thread = qq~<tr><td colspan="3" bgcolor=$miscbackone><font face="$font" color=$postfontcolorone size=2>$thread</font></td></tr>~; } else { undef $thread; } $postdate = $postdate + ($timedifferencevalue*3600) + ($timezone*3600); $postdate = &dateformat("$postdate"); $lastrepdate = $lastrepdate + ($timedifferencevalue*3600) + ($timezone*3600); $lastrepdate = &dateformat("$lastrepdate"); if ($lastrep) { $lastrep = "$ibtxt{'00332'} <a href=$boardurl/profile.cgi?action=show&member=$lastrep>$lastrep</a> @ $lastrepdate"; } open(TDETAILS,"$ikondir/forum$number/$tno.thd"); @Tdetails = <TDETAILS>;#читаем все посты в массив close(TDETAILS); $Tdetails_lastpost = $Tdetails[$#Tdetails];#а это последний. ($userlp,$titlelp,$iplp,$smilieslp,$signaturelp,$postdatelp,$threadlp) = split(/\|/,$Tdetails_lastpost); &getforum("$number"); $output .= qq~ <tr><td colspan="3" bgcolor=$titlecolor><font face="$font" color=$titlefontcolor size=2>$title $ibtxt{'00334'} $poster @ $postdate</font></td></tr> <tr><td colspan="3" bgcolor=$miscbackone><font face="$font" color=$postfontcolorone size=2><a href=$boardurl/ikonboard.cgi>$category</a> » <a href=$boardurl/forums.cgi?forum=$number>$forumname</a></font></td></tr> $thread <tr> <td colspan="3" width="100%" bgcolor=$miscbacktwo><font face="$font" color=$postfontcolortwo size=1><b>$ibtxt{'00333'} $replies $lastrep</b></font></td> </tr> <tr> <td colspan="3" width="100%" bgcolor=$miscbackone><font face="$font" color=$postfontcolortwo size=1><br>$threadlp </font></td> </tr> <tr> <td width="100%" bgcolor=$miscbacktwo align="right"><font face="$font" color=$postfontcolorone size=1><b><a href="$boardurl/post.cgi?action=reply&forum=$number&topic=$tno">$ibtxt{'00331'}</a></b></font> <font face="$font" color=$postfontcolorone size=1><b><a href="$boardurl/topic.cgi?forum=$number&topic=$tno">$ibtxt{'0033'}</a></b></font> </td> </tr> ~; } } $output .= qq~ </table></td></tr></table> ~; print header(); &output( -Title => "$boardname - Active Topics", -ToPrint => $output, -Version => $versionnumber ); |