HTMLGenerator.pm 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822
  1. package Pisg::HTMLGenerator;
  2. # Copyright and license, as well as documentation(POD) for this module is
  3. # found at the end of the file.
  4. use strict;
  5. $^W = 1;
  6. sub new
  7. {
  8. my $type = shift;
  9. my %args = @_;
  10. my $self = {
  11. cfg => $args{cfg},
  12. stats => $args{stats},
  13. users => $args{users},
  14. tmps => $args{tmps},
  15. };
  16. # Import common functions in Pisg::Common
  17. require Pisg::Common;
  18. Pisg::Common->import();
  19. bless($self, $type);
  20. return $self;
  21. }
  22. sub create_html
  23. {
  24. # This subroutine calls all the subroutines which create their
  25. # individual stats. The name of the functions is somewhat saying - if
  26. # you don't understand it, most subs have a better explanation in the
  27. # sub itself.
  28. my $self = shift;
  29. print "Now generating HTML($self->{cfg}->{outputfile})...\n"
  30. unless ($self->{cfg}->{silent});
  31. open (OUTPUT, "> $self->{cfg}->{outputfile}") or
  32. die("$0: Unable to open outputfile($self->{cfg}->{outputfile}): $!\n");
  33. if ($self->{cfg}->{showtime}) {
  34. $self->{cfg}->{tablewidth} += 40;
  35. }
  36. if ($self->{cfg}->{showwords}) {
  37. $self->{cfg}->{tablewidth} += 40;
  38. }
  39. if ($self->{cfg}->{showwpl}) {
  40. $self->{cfg}->{tablewidth} += 40;
  41. }
  42. if ($self->{cfg}->{showcpl}) {
  43. $self->{cfg}->{tablewidth} += 40;
  44. }
  45. $self->{cfg}->{headwidth} = $self->{cfg}->{tablewidth} - 4;
  46. $self->_htmlheader();
  47. $self->_pageheader()
  48. if ($self->{cfg}->{pagehead} ne 'none');
  49. if ($self->{cfg}->{showactivetimes}) {
  50. $self->_activetimes();
  51. }
  52. $self->_activenicks();
  53. if ($self->{cfg}->{showmostactivebyhour}) {
  54. $self->_mostactivebyhour();
  55. }
  56. if ($self->{cfg}->{showbignumbers}) {
  57. $self->_headline($self->_template_text('bignumtopic'));
  58. _html("<table width=\"$self->{cfg}->{tablewidth}\">\n"); # Needed for sections
  59. $self->_questions();
  60. $self->_shoutpeople();
  61. $self->_capspeople();
  62. $self->_violent();
  63. $self->_mostsmiles();
  64. $self->_mostsad();
  65. $self->_linelengths();
  66. $self->_mostwords();
  67. $self->_mostwordsperline();
  68. _html("</table>"); # Needed for sections
  69. }
  70. if ($self->{cfg}->{showmostnicks}) {
  71. $self->_mostnicks();
  72. }
  73. if ($self->{cfg}->{showmuw}) {
  74. $self->_mostusedword();
  75. }
  76. if ($self->{cfg}->{showmrn}) {
  77. $self->_mostreferencednicks();
  78. }
  79. if ($self->{cfg}->{showmru}) {
  80. $self->_mosturls();
  81. }
  82. if ($self->{cfg}->{showbignumbers}) {
  83. $self->_headline($self->_template_text('othernumtopic'));
  84. _html("<table width=\"$self->{cfg}->{tablewidth}\">\n"); # Needed for sections
  85. $self->_gotkicks();
  86. $self->_mostkicks();
  87. $self->_mostop();
  88. $self->_mostvoice() if $self->{cfg}->{showvoices};
  89. $self->_mostactions();
  90. $self->_mostmonologues();
  91. $self->_mostjoins();
  92. $self->_mostfoul();
  93. _html("</table>"); # Needed for sections
  94. }
  95. $self->_headline($self->_template_text('latesttopic'));
  96. _html("<table width=\"$self->{cfg}->{tablewidth}\">\n"); # Needed for sections
  97. $self->_lasttopics()
  98. if ($self->{cfg}->{showtopics});
  99. _html("</table>"); # Needed for sections
  100. my %hash = ( lines => $self->{stats}->{totallines} );
  101. _html($self->_template_text('totallines', %hash) . "<br /><br />");
  102. $self->_pagefooter()
  103. if ($self->{cfg}->{pagefoot} ne 'none');
  104. $self->_htmlfooter();
  105. close(OUTPUT);
  106. }
  107. sub _htmlheader
  108. {
  109. my $self = shift;
  110. my $bgpic = "";
  111. my %hash = (
  112. network => $self->{cfg}->{network},
  113. maintainer => $self->{cfg}->{maintainer},
  114. days => $self->{stats}->{days},
  115. nicks => scalar keys %{ $self->{stats}->{lines} }
  116. );
  117. my $css_file = $self->{cfg}->{cssdir} . $self->{cfg}->{colorscheme} . ".css";
  118. # Get the chosen CSS file
  119. open(FILE, $css_file) or open (FILE, $self->{cfg}->{search_path} . "/$css_file") or die("$0: Unable to open stylesheet($css_file): $!\n");
  120. my @CSS = <FILE>;
  121. my $title = $self->_template_text('pagetitle1', %hash);
  122. if ($self->{cfg}->{bgpic}) {
  123. $bgpic = " background=\"$self->{cfg}->{bgpic}\"";
  124. }
  125. print OUTPUT <<HTML;
  126. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  127. <html>
  128. <head>
  129. <meta http-equiv="Content-Type" content="text/html; charset=$self->{cfg}->{charset}" />
  130. <title>$title</title>
  131. <style type="text/css">
  132. @CSS
  133. </style></head>
  134. <body$bgpic>
  135. <div align="center">
  136. HTML
  137. _html("<span class=\"title\">$title</span><br />");
  138. _html("<br />");
  139. _html($self->_template_text('pagetitle2', %hash) . " " . $self->get_time());
  140. _html("<br />" . $self->_template_text('pagetitle3', %hash) . "<br /><br />");
  141. }
  142. sub get_time
  143. {
  144. my $self = shift;
  145. my ($tday, %hash);
  146. my $month = $self->_template_text('month', %hash);
  147. my $day = $self->_template_text('day', %hash);
  148. my @month = split(" ", $month);
  149. my @day = split(" ", $day);
  150. # Get the Date from the users computer
  151. my $timezone = $self->{cfg}->{timeoffset} * 3600;
  152. my ($sec,$min,$hour,$mday,$mon,$year,$wday) = localtime(time+$timezone);
  153. $year += 1900; # Y2K Patch
  154. $min =~ s/^(.)$/0$1/; # Fixes the display of mins/secs below
  155. $sec =~ s/^(.)$/0$1/; # it displays 03 instead of 3
  156. if ($hour > '23') { # Checks to see if it Midnight
  157. $hour = 12; # Makes it display the hour 12
  158. $tday = "AM"; # Display AM
  159. } elsif($hour > '12') { # Get rid of the Military time and
  160. $hour -= 12; # put it into normal time
  161. $tday = "PM"; # If past Noon and before Midnight set
  162. } else {
  163. $tday = "AM"; # If it's past Midnight and before Noon
  164. } # set the time as AM
  165. # Use 24 hours pr. day
  166. if ($tday eq "PM" && $hour < '12') {
  167. $hour += 12;
  168. }
  169. return "$day[$wday] $mday $month[$mon] $year - $hour:$min:$sec";
  170. }
  171. sub _htmlfooter
  172. {
  173. my $self = shift;
  174. my %hash;
  175. my $pisg_hp = $self->_template_text('pisghomepage');
  176. $hash{pisg_url} = "<a href=\"http://pisg.sourceforge.net/\" title=\"$pisg_hp\" class=\"background\">pisg</a>";
  177. my $author_hp = $self->_template_text('authorhomepage');
  178. $hash{author_url} = "<a href=\"http://wtf.dk/hp/\" title=\"$author_hp\" class=\"background\">Morten Brix Pedersen</a>";
  179. $hash{version} = $self->{cfg}->{version};
  180. my $hours = $self->_template_text('hours');
  181. my $mins = $self->_template_text('minutes');
  182. my $secs = $self->_template_text('seconds');
  183. my $and = $self->_template_text('and');
  184. my $h = $self->{stats}->{processtime}{hours};
  185. my $m = $self->{stats}->{processtime}{mins};
  186. my $s = $self->{stats}->{processtime}{secs};
  187. $hash{time} = "$h $hours $m $mins $and $s $secs";
  188. my $stats_gen = $self->_template_text('stats_gen_by', %hash);
  189. my $author_text = $self->_template_text('author', %hash);
  190. my $stats_text = $self->_template_text('stats_gen_in', %hash);
  191. print OUTPUT <<HTML;
  192. <span class="small">
  193. $stats_gen<br />
  194. $author_text<br />
  195. $stats_text
  196. </span>
  197. </div>
  198. </body>
  199. </html>
  200. HTML
  201. }
  202. sub _headline
  203. {
  204. my $self = shift;
  205. my ($title) = (@_);
  206. print OUTPUT <<HTML;
  207. <br />
  208. <table width="$self->{cfg}->{headwidth}" cellpadding="1" cellspacing="0" border="0">
  209. <tr>
  210. <td class="headlinebg">
  211. <table width="100%" cellpadding="2" cellspacing="0" border="0">
  212. <tr>
  213. <td class="headtext">$title</td>
  214. </tr>
  215. </table>
  216. </td>
  217. </tr>
  218. </table>
  219. HTML
  220. }
  221. sub _pageheader
  222. {
  223. my $self = shift;
  224. open(PAGEHEAD, $self->{cfg}->{pagehead}) or die("$0: Unable to open $self->{cfg}->{pagehead} for reading: $!\n");
  225. while (<PAGEHEAD>) {
  226. _html($_);
  227. }
  228. }
  229. sub _pagefooter
  230. {
  231. my $self = shift;
  232. open(PAGEFOOT, $self->{cfg}->{pagefoot}) or die("$0: Unable to open $self->{cfg}->{pagefoot} for reading: $!\n");
  233. while (<PAGEFOOT>) {
  234. _html($_);
  235. }
  236. }
  237. sub _activetimes
  238. {
  239. # The most actives times on the channel
  240. my $self = shift;
  241. my (%output, $class);
  242. $self->_headline($self->_template_text('activetimestopic'));
  243. my @toptime = sort { $self->{stats}->{times}{$b} <=> $self->{stats}->{times}{$a} } keys %{ $self->{stats}->{times} };
  244. my $highest_value = $self->{stats}->{times}{$toptime[0]};
  245. my @now = localtime($self->{cfg}->{timestamp});
  246. my $image;
  247. for my $hour (sort keys %{ $self->{stats}->{times} }) {
  248. my $size = ($self->{stats}->{times}{$hour} / $highest_value) * 100;
  249. my $percent = ($self->{stats}->{times}{$hour} / $self->{stats}->{totallines}) * 100;
  250. $percent =~ s/(\.\d)\d+/$1/;
  251. if ($size < 1 && $size != 0) {
  252. # Opera doesn't understand '0.xxxx' in the height="xx" attr,
  253. # so we simply round up to 1.0 here.
  254. $size = 1.0;
  255. }
  256. $image = "pic_v_".(int($hour/6)*6);
  257. $image = $self->{cfg}->{$image};
  258. $output{$hour} = "<td align=\"center\" valign=\"bottom\" class=\"asmall\">$percent%<br /><img src=\"$self->{cfg}->{piclocation}/$image\" width=\"15\" height=\"$size\" alt=\"$percent\" /></td>\n";
  259. }
  260. _html("<table border=\"0\"><tr>\n");
  261. for ($b = 0; $b < 24; $b++) {
  262. $a = sprintf("%02d", $b);
  263. if (!defined($output{$a}) || $output{$a} eq "") {
  264. _html("<td align=\"center\" valign=\"bottom\" class=\"asmall\">0%</td>");
  265. } else {
  266. _html($output{$a});
  267. }
  268. }
  269. _html("</tr><tr>");
  270. # Remove leading zero
  271. $toptime[0] =~ s/0(\d)/$1/;
  272. for ($b = 0; $b < 24; $b++) {
  273. if ($toptime[0] == $b) {
  274. # Highlight the top time
  275. $class = 'hirankc10center';
  276. } else {
  277. $class = 'rankc10center';
  278. }
  279. _html("<td class=\"$class\" align=\"center\">$b</td>");
  280. }
  281. _html("</tr></table>");
  282. if($self->{cfg}->{showlegend} == 1) {
  283. $self->_legend();
  284. }
  285. }
  286. sub _activenicks
  287. {
  288. # The most active nicks (those who wrote most lines)
  289. my $self = shift;
  290. $self->_headline($self->_template_text('activenickstopic'));
  291. _html("<table border=\"0\" width=\"$self->{cfg}->{tablewidth}\"><tr>");
  292. _html("<td>&nbsp;</td>"
  293. . "<td class=\"tdtop\"><b>" . $self->_template_text('nick') . "</b></td>"
  294. . "<td class=\"tdtop\"><b>" . $self->_template_text('numberlines') . "</b></td>"
  295. . ($self->{cfg}->{showtime} ? "<td class=\"tdtop\"><b>".$self->_template_text('show_time')."</b></td>" : "")
  296. . ($self->{cfg}->{showwords} ? "<td class=\"tdtop\"><b>".$self->_template_text('show_words')."</b></td>" : "")
  297. . ($self->{cfg}->{showwpl} ? "<td class=\"tdtop\"><b>".$self->_template_text('show_wpl')."</b></td>" : "")
  298. . ($self->{cfg}->{showcpl} ? "<td class=\"tdtop\"><b>".$self->_template_text('show_cpl')."</b></td>" : "")
  299. . ($self->{cfg}->{showlastseen} ? "<td class=\"tdtop\"><b>".$self->_template_text('show_lastseen')."</b></td>" : "")
  300. . ($self->{cfg}->{showrandquote} ? "<td class=\"tdtop\"><b>".$self->_template_text('randquote')."</b></td>" : "")
  301. );
  302. my @active;
  303. if ($self->{cfg}->{sortbywords}) {
  304. @active = sort { $self->{stats}->{words}{$b} <=> $self->{stats}->{words}{$a} } keys %{ $self->{stats}->{words} };
  305. } else {
  306. @active = sort { $self->{stats}->{lines}{$b} <=> $self->{stats}->{lines}{$a} } keys %{ $self->{stats}->{lines} };
  307. }
  308. my $nicks = scalar keys %{ $self->{stats}->{lines} };
  309. if ($self->{cfg}->{activenicks} > $nicks) { $self->{cfg}->{activenicks} = $nicks; }
  310. my $have_userpics;
  311. for (my $c = 0; $c < $self->{cfg}->{activenicks}; $c++) {
  312. my $nick = $active[$c];
  313. if ($self->{users}->{userpics}{$nick} && $self->{cfg}->{userpics} !~ /n/i) {
  314. $have_userpics = 1;
  315. _html("<td class=\"tdtop\"><b>" . $self->_template_text('userpic') ."</b></td>");
  316. last;
  317. }
  318. }
  319. _html("</tr>");
  320. for (my $i = 0; $i < $self->{cfg}->{activenicks}; $i++) {
  321. my $c = $i + 1;
  322. my $nick = $active[$i];
  323. my $visiblenick = $active[$i];
  324. my $randomline;
  325. if (not defined $self->{stats}->{sayings}{$nick}) {
  326. $randomline = "";
  327. } else {
  328. $randomline = htmlentities($self->{stats}->{sayings}{$nick});
  329. }
  330. # Convert URLs and e-mail addys to links
  331. $randomline = $self->_replace_links($randomline);
  332. # Add a link to the nick if there is any
  333. if ($self->{users}->{userlinks}{$nick}) {
  334. $visiblenick = $self->_replace_links($self->{users}->{userlinks}{$nick}, $nick);
  335. }
  336. my $color = $self->generate_colors($c);
  337. my $class = 'rankc';
  338. if ($c == 1) {
  339. $class = 'hirankc';
  340. }
  341. my $lastseen;
  342. if ($self->{cfg}->{showlastseen}) {
  343. $lastseen = $self->{stats}->{days} - $self->{stats}->{lastvisited}{$nick};
  344. if ($lastseen == 0) {
  345. $lastseen = $self->_template_text('today');
  346. } elsif ($lastseen == 1) {
  347. $lastseen = "$lastseen " .$self->_template_text('lastseen1');
  348. } else {
  349. $lastseen = "$lastseen " .$self->_template_text('lastseen2');
  350. }
  351. }
  352. _html("<tr><td class=\"$class\" align=\"left\">$c</td>");
  353. my $line = $self->{stats}->{lines}{$nick};
  354. my $w = $self->{stats}->{words}{$nick} ? $self->{stats}->{words}{$nick} : 0;
  355. my $ch = $self->{stats}->{lengths}{$nick};
  356. _html("<td style=\"background-color: $color\">$visiblenick</td>"
  357. . ($self->{cfg}->{showlinetime} ?
  358. "<td style=\"background-color: $color\">".$self->_user_linetimes($nick,$active[0])."</td>"
  359. : "<td style=\"background-color: $color\">$line</td>")
  360. . ($self->{cfg}->{showtime} ?
  361. "<td style=\"background-color: $color\">".$self->_user_times($nick)."</td>"
  362. : "")
  363. . ($self->{cfg}->{showwords} ?
  364. "<td style=\"background-color: $color\">$w</td>"
  365. : "")
  366. . ($self->{cfg}->{showwpl} ?
  367. "<td style=\"background-color: $color\">".sprintf("%.1f",$w/$line)."</td>"
  368. : "")
  369. . ($self->{cfg}->{showcpl} ?
  370. "<td style=\"background-color: $color\">".sprintf("%.1f",$ch/$line)."</td>"
  371. : "")
  372. . ($self->{cfg}->{showlastseen} ?
  373. "<td style=\"background-color: $color\">$lastseen</td>"
  374. : "")
  375. . ($self->{cfg}->{showrandquote} ?
  376. "<td style=\"background-color: $color\" nowrap=\"nowrap\">\"$randomline\"</td>"
  377. : "")
  378. );
  379. my $height = $self->{cfg}->{picheight};
  380. my $width = $self->{cfg}->{picwidth};
  381. if ($self->{users}->{userpics}{$nick} && $self->{cfg}->{userpics} !~ /n/i) {
  382. _html("<td style=\"background-color: $color\" align=\"center\">");
  383. if (defined $self->{users}->{biguserpics}{$nick}) {
  384. _html("<a href=\"$self->{cfg}->{imagepath}$self->{users}->{biguserpics}{$nick}\">");
  385. }
  386. if ($width ne '') {
  387. _html("<img valign=\"middle\" src=\"$self->{cfg}->{imagepath}$self->{users}->{userpics}{$nick}\" width=\"$width\" height=\"$height\" alt=\"$nick\" />");
  388. } else {
  389. _html("<img valign=\"middle\" src=\"$self->{cfg}->{imagepath}$self->{users}->{userpics}{$nick}\" alt=\"$nick\" />");
  390. }
  391. if (defined $self->{users}->{biguserpics}{$nick}) {
  392. _html("</a>");
  393. }
  394. _html("</td>");
  395. } elsif ($self->{cfg}->{defaultpic} ne '' && $self->{cfg}->{userpics} !~ /n/i) {
  396. _html("<td style=\"background-color: $color\" align=\"center\"><img valign=\"middle\" src=\"$self->{cfg}->{imagepath}$self->{cfg}->{defaultpic}\" alt=\"\" /></td>");
  397. }
  398. _html("</tr>");
  399. }
  400. _html("</table><br />");
  401. # Almost as active nicks ('These didn't make it to the top..')
  402. my $toshow = $self->{cfg}->{activenicks2} - $self->{cfg}->{activenicks};
  403. my $remain = $self->{cfg}->{activenicks} + $toshow;
  404. unless ($toshow > $nicks) {
  405. $remain = $self->{cfg}->{activenicks} + $self->{cfg}->{activenicks2};
  406. if ($remain > $nicks) {
  407. $remain = $nicks;
  408. }
  409. if ($self->{cfg}->{activenicks} < $remain) {
  410. _html("<br /><b><i>" . $self->_template_text('nottop') . "</i></b><table><tr>");
  411. for (my $i = $self->{cfg}->{activenicks}; $i < $remain; $i++) {
  412. unless ($i % 5) { if ($i != $self->{cfg}->{activenicks}) { _html("</tr><tr>"); } }
  413. my $items;
  414. if ($self->{cfg}->{sortbywords}) {
  415. $items = $self->{stats}->{words}{$active[$i]};
  416. } else {
  417. $items = $self->{stats}->{lines}{$active[$i]};
  418. }
  419. _html("<td class=\"rankc10\">$active[$i] ($items)</td>");
  420. }
  421. _html("</tr></table>");
  422. }
  423. }
  424. my %hash;
  425. $hash{totalnicks} = $nicks - $remain;
  426. if ($hash{totalnicks} > 0) {
  427. _html("<br /><b>" . $self->_template_text('totalnicks', %hash) . "</b><br />");
  428. }
  429. }
  430. sub generate_colors
  431. {
  432. my $self = shift;
  433. my $c = shift;
  434. my $h = $self->{cfg}->{hicell};
  435. $h =~ s/^#//;
  436. $h = hex $h;
  437. my $h2 = $self->{cfg}->{hicell2};
  438. $h2 =~ s/^#//;
  439. $h2 = hex $h2;
  440. my $f_b = $h & 0xff;
  441. my $f_g = ($h & 0xff00) >> 8;
  442. my $f_r = ($h & 0xff0000) >> 16;
  443. my $t_b = $h2 & 0xff;
  444. my $t_g = ($h2 & 0xff00) >> 8;
  445. my $t_r = ($h2 & 0xff0000) >> 16;
  446. my $blue = sprintf "%0.2x", abs int(((($t_b - $f_b) / $self->{cfg}->{activenicks}) * +$c) + $f_b);
  447. my $green = sprintf "%0.2x", abs int(((($t_g - $f_g) / $self->{cfg}->{activenicks}) * +$c) + $f_g);
  448. my $red = sprintf "%0.2x", abs int(((($t_r - $f_r) / $self->{cfg}->{activenicks}) * +$c) + $f_r);
  449. return "#$red$green$blue";
  450. }
  451. sub _html
  452. {
  453. my $html = shift;
  454. print OUTPUT "$html\n";
  455. }
  456. sub _questions
  457. {
  458. # Persons who asked the most questions
  459. my $self = shift;
  460. my %qpercent;
  461. foreach my $nick (sort keys %{ $self->{stats}->{questions} }) {
  462. if ($self->{stats}->{lines}{$nick} > 100) {
  463. $qpercent{$nick} = ($self->{stats}->{questions}{$nick} / $self->{stats}->{lines}{$nick}) * 100;
  464. $qpercent{$nick} =~ s/(\.\d)\d+/$1/;
  465. }
  466. }
  467. my @question = sort { $qpercent{$b} <=> $qpercent{$a} } keys %qpercent;
  468. if (@question) {
  469. my %hash = (
  470. nick => $question[0],
  471. per => $qpercent{$question[0]}
  472. );
  473. my $text = $self->_template_text('question1', %hash);
  474. _html("<tr><td class=\"hicell\">$text");
  475. if (@question >= 2) {
  476. my %hash = (
  477. nick => $question[1],
  478. per => $qpercent{$question[1]}
  479. );
  480. my $text = $self->_template_text('question2', %hash);
  481. _html("<br /><span class=\"small\">$text</span>");
  482. }
  483. _html("</td></tr>");
  484. } else {
  485. _html("<tr><td class=\"hicell\">" . $self->_template_text('question3') . "</td></tr>");
  486. }
  487. }
  488. sub _shoutpeople
  489. {
  490. # The ones who speak with exclamation marks!
  491. my $self = shift;
  492. my %spercent;
  493. foreach my $nick (sort keys %{ $self->{stats}->{shouts} }) {
  494. if ($self->{stats}->{lines}{$nick} > 100) {
  495. $spercent{$nick} = ($self->{stats}->{shouts}{$nick} / $self->{stats}->{lines}{$nick}) * 100;
  496. $spercent{$nick} =~ s/(\.\d)\d+/$1/;
  497. }
  498. }
  499. my @shout = sort { $spercent{$b} <=> $spercent{$a} } keys %spercent;
  500. if (@shout) {
  501. my %hash = (
  502. nick => $shout[0],
  503. per => $spercent{$shout[0]}
  504. );
  505. my $text = $self->_template_text('shout1', %hash);
  506. _html("<tr><td class=\"hicell\">$text");
  507. if (@shout >= 2) {
  508. my %hash = (
  509. nick => $shout[1],
  510. per => $spercent{$shout[1]}
  511. );
  512. my $text = $self->_template_text('shout2', %hash);
  513. _html("<br /><span class=\"small\">$text</span>");
  514. }
  515. _html("</td></tr>");
  516. } else {
  517. my $text = $self->_template_text('shout3');
  518. _html("<tr><td class=\"hicell\">$text</td></tr>");
  519. }
  520. }
  521. sub _capspeople
  522. {
  523. # The ones who speak ALL CAPS.
  524. my $self = shift;
  525. my %cpercent;
  526. foreach my $nick (sort keys %{ $self->{stats}->{allcaps} }) {
  527. if ($self->{stats}->{lines}{$nick} > 100) {
  528. $cpercent{$nick} = $self->{stats}->{allcaps}{$nick} / $self->{stats}->{lines}{$nick} * 100;
  529. $cpercent{$nick} =~ s/(\.\d)\d+/$1/;
  530. }
  531. }
  532. my @caps = sort { $cpercent{$b} <=> $cpercent{$a} } keys %cpercent;
  533. if (@caps) {
  534. my %hash = (
  535. nick => $caps[0],
  536. per => $cpercent{$caps[0]},
  537. line => htmlentities($self->{stats}->{allcaplines}{$caps[0]})
  538. );
  539. my $text = $self->_template_text('allcaps1', %hash);
  540. if($self->{cfg}->{showshoutline}) {
  541. my $exttext = $self->_template_text('allcapstext', %hash);
  542. _html("<tr><td class=\"hicell\">$text<br /><span class=\"small\">$exttext</span><br />");
  543. } else {
  544. _html("<tr><td class=\"hicell\">$text");
  545. }
  546. if (@caps >= 2) {
  547. my %hash = (
  548. nick => $caps[1],
  549. per => $cpercent{$caps[1]}
  550. );
  551. my $text = $self->_template_text('allcaps2', %hash);
  552. _html("<br /><span class=\"small\">$text</span>");
  553. }
  554. _html("</td></tr>");
  555. } else {
  556. my $text = $self->_template_text('allcaps3');
  557. _html("<tr><td class=\"hicell\">$text</td></tr>");
  558. }
  559. }
  560. sub _violent
  561. {
  562. # They attacked others (words defined by $self->{cfg}->{violent})
  563. my $self = shift;
  564. my @aggressors;
  565. @aggressors = sort { $self->{stats}->{violence}{$b} <=> $self->{stats}->{violence}{$a} }
  566. keys %{ $self->{stats}->{violence} };
  567. if(@aggressors) {
  568. my %hash = (
  569. nick => $aggressors[0],
  570. attacks => $self->{stats}->{violence}{$aggressors[0]},
  571. line => htmlentities($self->{stats}->{violencelines}{$aggressors[0]})
  572. );
  573. my $text = $self->_template_text('violent1', %hash);
  574. if($self->{cfg}->{showviolentlines}) {
  575. my $exttext = $self->_template_text('violenttext', %hash);
  576. _html("<tr><td class=\"hicell\">$text<br /><span class=\"small\">$exttext</span><br />");
  577. } else {
  578. _html("<tr><td class=\"hicell\">$text");
  579. }
  580. if (@aggressors >= 2) {
  581. my %hash = (
  582. nick => $aggressors[1],
  583. attacks => $self->{stats}->{violence}{$aggressors[1]}
  584. );
  585. my $text = $self->_template_text('violent2', %hash);
  586. _html("<br /><span class=\"small\">$text</span>");
  587. }
  588. _html("</td></tr>");
  589. } else {
  590. my $text = $self->_template_text('violent3');
  591. _html("<tr><td class=\"hicell\">$text</td></tr>");
  592. }
  593. # They got attacked
  594. my @victims;
  595. @victims = sort { $self->{stats}->{attacked}{$b} <=> $self->{stats}->{attacked}{$a} }
  596. keys %{ $self->{stats}->{attacked} };
  597. if(@victims) {
  598. my %hash = (
  599. nick => $victims[0],
  600. attacks => $self->{stats}->{attacked}{$victims[0]},
  601. line => htmlentities($self->{stats}->{attackedlines}{$victims[0]})
  602. );
  603. my $text = $self->_template_text('attacked1', %hash);
  604. if($self->{cfg}->{showviolentlines}) {
  605. my $exttext = $self->_template_text('attackedtext', %hash);
  606. _html("<tr><td class=\"hicell\">$text<br /><span class=\"small\">$exttext</span><br />");
  607. } else {
  608. _html("<tr><td class=\"hicell\">$text");
  609. }
  610. if (@victims >= 2) {
  611. my %hash = (
  612. nick => $victims[1],
  613. attacks => $self->{stats}->{attacked}{$victims[1]}
  614. );
  615. my $text = $self->_template_text('attacked2', %hash);
  616. _html("<br /><span class=\"small\">$text</span>");
  617. }
  618. _html("</td></tr>");
  619. }
  620. }
  621. sub _gotkicks
  622. {
  623. # The persons who got kicked the most
  624. my $self = shift;
  625. my @gotkick = sort { $self->{stats}->{gotkicked}{$b} <=> $self->{stats}->{gotkicked}{$a} }
  626. keys %{ $self->{stats}->{gotkicked} };
  627. if (@gotkick) {
  628. my %hash = (
  629. nick => $gotkick[0],
  630. kicks => $self->{stats}->{gotkicked}{$gotkick[0]},
  631. line => $self->{stats}->{kicklines}{$gotkick[0]}
  632. );
  633. my $text = $self->_template_text('gotkick1', %hash);
  634. if ($self->{cfg}->{showkickline}) {
  635. my $exttext = $self->_template_text('kicktext', %hash);
  636. _html("<tr><td class=\"hicell\">$text<br /><span class=\"small\">$exttext</span><br />");
  637. } else {
  638. _html("<tr><td class=\"hicell\">$text");
  639. }
  640. if (@gotkick >= 2) {
  641. my %hash = (
  642. nick => $gotkick[1],
  643. kicks => $self->{stats}->{gotkicked}{$gotkick[1]}
  644. );
  645. my $text = $self->_template_text('gotkick2', %hash);
  646. _html("<br /><span class=\"small\">$text</span>");
  647. }
  648. _html("</td></tr>");
  649. }
  650. }
  651. sub _mostjoins
  652. {
  653. my $self = shift;
  654. my @joins = sort { $self->{stats}->{joins}{$b} <=> $self->{stats}->{joins}{$a} }
  655. keys %{ $self->{stats}->{joins} };
  656. if (@joins) {
  657. my %hash = (
  658. nick => $joins[0],
  659. joins => $self->{stats}->{joins}{$joins[0]}
  660. );
  661. my $text = $self->_template_text('joins', %hash);
  662. _html("<tr><td class=\"hicell\">$text</td></tr>");
  663. }
  664. }
  665. sub _mostwords
  666. {
  667. # The person who got words the most
  668. my $self = shift;
  669. my @words = sort { $self->{stats}->{words}{$b} <=> $self->{stats}->{words}{$a} }
  670. keys %{ $self->{stats}->{words} };
  671. if (@words) {
  672. my %hash = (
  673. nick => $words[0],
  674. words => $self->{stats}->{words}{$words[0]}
  675. );
  676. my $text = $self->_template_text('words1', %hash);
  677. _html("<tr><td class=\"hicell\">$text");
  678. if (@words >= 2) {
  679. my %hash = (
  680. oldnick => $words[0],
  681. nick => $words[1],
  682. words => $self->{stats}->{words}{$words[1]}
  683. );
  684. my $text = $self->_template_text('words2', %hash);
  685. _html("<br /><span class=\"small\">$text</span>");
  686. }
  687. _html("</td></tr>");
  688. } else {
  689. my $text = $self->_template_text('kick3');
  690. _html("<tr><td class=\"hicell\">$text</td></tr>");
  691. }
  692. }
  693. sub _mostkicks
  694. {
  695. # The person who kicked the most
  696. my $self = shift;
  697. my @kicked = sort { $self->{stats}->{kicked}{$b} <=> $self->{stats}->{kicked}{$a} }
  698. keys %{ $self->{stats}->{kicked} };
  699. if (@kicked) {
  700. my %hash = (
  701. nick => $kicked[0],
  702. kicked => $self->{stats}->{kicked}{$kicked[0]}
  703. );
  704. my $text = $self->_template_text('kick1', %hash);
  705. _html("<tr><td class=\"hicell\">$text");
  706. if (@kicked >= 2) {
  707. my %hash = (
  708. oldnick => $kicked[0],
  709. nick => $kicked[1],
  710. kicked => $self->{stats}->{kicked}{$kicked[1]}
  711. );
  712. my $text = $self->_template_text('kick2', %hash);
  713. _html("<br /><span class=\"small\">$text</span>");
  714. }
  715. _html("</td></tr>");
  716. } else {
  717. my $text = $self->_template_text('kick3');
  718. _html("<tr><td class=\"hicell\">$text</td></tr>");
  719. }
  720. }
  721. sub _mostmonologues
  722. {
  723. # The person who had the most monologues (speaking to himself)
  724. my $self = shift;
  725. my @monologue = sort { $self->{stats}->{monologues}{$b} <=> $self->{stats}->{monologues}{$a} } keys %{ $self->{stats}->{monologues} };
  726. if (@monologue) {
  727. my %hash = (
  728. nick => $monologue[0],
  729. monos => $self->{stats}->{monologues}{$monologue[0]}
  730. );
  731. my $text = $self->_template_text('mono1', %hash);
  732. _html("<tr><td class=\"hicell\">$text");
  733. if (@monologue >= 2) {
  734. my %hash = (
  735. nick => $monologue[1],
  736. monos => $self->{stats}->{monologues}{$monologue[1]}
  737. );
  738. my $text = $self->_template_text('mono2', %hash);
  739. _html("<br /><span class=\"small\">$text</span>");
  740. }
  741. _html("</td></tr>");
  742. }
  743. }
  744. sub _linelengths
  745. {
  746. # The person(s) who wrote the longest lines
  747. my $self = shift;
  748. my %len;
  749. foreach my $nick (sort keys %{ $self->{stats}->{lengths} }) {
  750. if ($self->{stats}->{lines}{$nick} > 100) {
  751. $len{$nick} = $self->{stats}->{lengths}{$nick} / $self->{stats}->{lines}{$nick};
  752. $len{$nick} =~ s/(\.\d)\d+/$1/;
  753. }
  754. }
  755. my @len = sort { $len{$b} <=> $len{$a} } keys %len;
  756. my $all_lines = 0;
  757. my $totallength;
  758. foreach my $nick (keys %{ $self->{stats}->{lines} }) {
  759. $all_lines += $self->{stats}->{lines}{$nick};
  760. $totallength += $self->{stats}->{lengths}{$nick};
  761. }
  762. my $totalaverage;
  763. if ($all_lines > 0) {
  764. $totalaverage = $totallength / $all_lines;
  765. $totalaverage =~ s/(\.\d)\d+/$1/;
  766. }
  767. if (@len) {
  768. my %hash = (
  769. nick => $len[0],
  770. letters => $len{$len[0]}
  771. );
  772. my $text = $self->_template_text('long1', %hash);
  773. _html("<tr><td class=\"hicell\">$text<br />");
  774. if (@len >= 2) {
  775. %hash = (
  776. avg => $totalaverage
  777. );
  778. $text = $self->_template_text('long2', %hash);
  779. _html("<span class=\"small\">$text</span></td></tr>");
  780. }
  781. }
  782. # The person(s) who wrote the shortest lines
  783. if (@len) {
  784. my %hash = (
  785. nick => $len[$#len],
  786. letters => $len{$len[$#len]}
  787. );
  788. my $text = $self->_template_text('short1', %hash);
  789. _html("<tr><td class=\"hicell\">$text<br />");
  790. if (@len >= 2) {
  791. %hash = (
  792. nick => $len[$#len - 1],
  793. letters => $len{$len[$#len - 1]}
  794. );
  795. $text = $self->_template_text('short2', %hash);
  796. _html("<span class=\"small\">$text</span></td></tr>");
  797. }
  798. }
  799. }
  800. sub _mostfoul
  801. {
  802. my $self = shift;
  803. my %spercent;
  804. foreach my $nick (sort keys %{ $self->{stats}->{foul} }) {
  805. if ($self->{stats}->{lines}{$nick} > 15) {
  806. $spercent{$nick} = $self->{stats}->{foul}{$nick} / $self->{stats}->{words}{$nick} * 100;
  807. $spercent{$nick} =~ s/(\.\d)\d+/$1/;
  808. }
  809. }
  810. my @foul = sort { $spercent{$b} <=> $spercent{$a} } keys %spercent;
  811. if (@foul) {
  812. my %hash = (
  813. nick => $foul[0],
  814. per => $spercent{$foul[0]},
  815. line => htmlentities($self->{stats}{foullines}{$foul[0]}),
  816. );
  817. my $text = $self->_template_text('foul1', %hash);
  818. if($self->{cfg}->{showfoulline}) {
  819. my $exttext = $self->_template_text('foultext', %hash);
  820. _html("<tr><td class=\"hicell\">$text<br /><span class=\"small\">$exttext</span><br />");
  821. } else {
  822. _html("<tr><td class=\"hicell\">$text");
  823. }
  824. if (@foul >= 2) {
  825. my %hash = (
  826. nick => $foul[1],
  827. per => $spercent{$foul[1]}
  828. );
  829. my $text = $self->_template_text('foul2', %hash);
  830. _html("<br /><span class=\"small\">$text</span>");
  831. }
  832. _html("</td></tr>");
  833. } else {
  834. my $text = $self->_template_text('foul3');
  835. _html("<tr><td class=\"hicell\">$text</td></tr>");
  836. }
  837. }
  838. sub _mostsad
  839. {
  840. my $self = shift;
  841. my %spercent;
  842. foreach my $nick (sort keys %{ $self->{stats}->{frowns} }) {
  843. if ($self->{stats}->{lines}{$nick} > 100) {
  844. $spercent{$nick} = $self->{stats}->{frowns}{$nick} / $self->{stats}->{lines}{$nick} * 100;
  845. $spercent{$nick} =~ s/(\.\d)\d+/$1/;
  846. }
  847. }
  848. my @sadface = sort { $spercent{$b} <=> $spercent{$a} } keys %spercent;
  849. if (@sadface) {
  850. my %hash = (
  851. nick => $sadface[0],
  852. per => $spercent{$sadface[0]}
  853. );
  854. my $text = $self->_template_text('sad1', %hash);
  855. _html("<tr><td class=\"hicell\">$text");
  856. if (@sadface >= 2) {
  857. my %hash = (
  858. nick => $sadface[1],
  859. per => $spercent{$sadface[1]}
  860. );
  861. my $text = $self->_template_text('sad2', %hash);
  862. _html("<br /><span class=\"small\">$text</span>");
  863. }
  864. _html("</td></tr>");
  865. } else {
  866. my $text = $self->_template_text('sad3');
  867. _html("<tr><td class=\"hicell\">$text</td></tr>");
  868. }
  869. }
  870. sub _mostop
  871. {
  872. my $self = shift;
  873. my @ops = sort { $self->{stats}->{gaveops}{$b} <=> $self->{stats}->{gaveops}{$a} }
  874. keys %{ $self->{stats}->{gaveops} };
  875. my @deops = sort { $self->{stats}->{tookops}{$b} <=> $self->{stats}->{tookops}{$a} }
  876. keys %{ $self->{stats}->{tookops} };
  877. if (@ops) {
  878. my %hash = (
  879. nick => $ops[0],
  880. ops => $self->{stats}->{gaveops}{$ops[0]}
  881. );
  882. my $text = $self->_template_text('mostop1', %hash);
  883. _html("<tr><td class=\"hicell\">$text");
  884. if (@ops >= 2) {
  885. my %hash = (
  886. nick => $ops[1],
  887. ops => $self->{stats}->{gaveops}{$ops[1]}
  888. );
  889. my $text = $self->_template_text('mostop2', %hash);
  890. _html("<br /><span class=\"small\">$text</span>");
  891. }
  892. _html("</td></tr>");
  893. } else {
  894. my $text = $self->_template_text('mostop3');
  895. _html("<tr><td class=\"hicell\">$text</td></tr>");
  896. }
  897. if (@deops) {
  898. my %hash = (
  899. nick => $deops[0],
  900. deops => $self->{stats}->{tookops}{$deops[0]}
  901. );
  902. my $text = $self->_template_text('mostdeop1', %hash);
  903. _html("<tr><td class=\"hicell\">$text");
  904. if (@deops >= 2) {
  905. my %hash = (
  906. nick => $deops[1],
  907. deops => $self->{stats}->{tookops}{$deops[1]}
  908. );
  909. my $text = $self->_template_text('mostdeop2', %hash);
  910. _html("<br /><span class=\"small\">$text</span>");
  911. }
  912. _html("</td></tr>");
  913. } else {
  914. my $text = $self->_template_text('mostdeop3');
  915. _html("<tr><td class=\"hicell\">$text</td></tr>");
  916. }
  917. }
  918. sub _mostvoice
  919. {
  920. my $self = shift;
  921. my @voice = sort { $self->{stats}->{gavevoice}{$b} <=> $self->{stats}->{gavevoice}{$a} }
  922. keys %{ $self->{stats}->{gavevoice} };
  923. my @devoice = sort { $self->{stats}->{tookvoice}{$b} <=> $self->{stats}->{tookvoice}{$a} }
  924. keys %{ $self->{stats}->{tookvoice} };
  925. if (@voice) {
  926. my %hash = (
  927. nick => $voice[0],
  928. voices => $self->{stats}->{gavevoice}{$voice[0]}
  929. );
  930. my $text = $self->_template_text('mostvoice1', %hash);
  931. _html("<tr><td class=\"hicell\">$text");
  932. if (@voice >= 2) {
  933. my %hash = (
  934. nick => $voice[1],
  935. voices => $self->{stats}->{gavevoice}{$voice[1]}
  936. );
  937. my $text = $self->_template_text('mostvoice2', %hash);
  938. _html("<br /><span class=\"small\">$text</span>");
  939. }
  940. _html("</td></tr>");
  941. } else {
  942. my $text = $self->_template_text('mostvoice3');
  943. _html("<tr><td class=\"hicell\">$text</td></tr>");
  944. }
  945. if (@devoice) {
  946. my %hash = (
  947. nick => $devoice[0],
  948. devoices => $self->{stats}->{tookvoice}{$devoice[0]}
  949. );
  950. my $text = $self->_template_text('mostdevoice1', %hash);
  951. _html("<tr><td class=\"hicell\">$text");
  952. if (@devoice >= 2) {
  953. my %hash = (
  954. nick => $devoice[1],
  955. devoices => $self->{stats}->{tookvoice}{$devoice[1]}
  956. );
  957. my $text = $self->_template_text('mostdevoice2', %hash);
  958. _html("<br /><span class=\"small\">$text</span>");
  959. }
  960. _html("</td></tr>");
  961. } else {
  962. my $text = $self->_template_text('mostdevoice3');
  963. _html("<tr><td class=\"hicell\">$text</td></tr>");
  964. }
  965. }
  966. sub _mostactions
  967. {
  968. # The person who did the most /me's
  969. my $self = shift;
  970. my @actions = sort { $self->{stats}->{actions}{$b} <=> $self->{stats}->{actions}{$a} }
  971. keys %{ $self->{stats}->{actions} };
  972. if (@actions) {
  973. my %hash = (
  974. nick => $actions[0],
  975. actions => $self->{stats}->{actions}{$actions[0]},
  976. line => htmlentities($self->{stats}->{actionlines}{$actions[0]})
  977. );
  978. my $text = $self->_template_text('action1', %hash);
  979. if($self->{cfg}->{showactionline}) {
  980. my $exttext = $self->_template_text('actiontext', %hash);
  981. _html("<tr><td class=\"hicell\">$text<br /><span class=\"small\">$exttext</span><br />");
  982. } else {
  983. _html("<tr><td class=\"hicell\">$text");
  984. }
  985. if (@actions >= 2) {
  986. my %hash = (
  987. nick => $actions[1],
  988. actions => $self->{stats}->{actions}{$actions[1]}
  989. );
  990. my $text = $self->_template_text('action2', %hash);
  991. _html("<br /><span class=\"small\">$text</span>");
  992. }
  993. _html("</td></tr>");
  994. } else {
  995. my $text = $self->_template_text('action3');
  996. _html("<tr><td class=\"hicell\">$text</td></tr>");
  997. }
  998. }
  999. sub _mostsmiles
  1000. {
  1001. # The person(s) who smiled the most :-)
  1002. my $self = shift;
  1003. my %spercent;
  1004. foreach my $nick (sort keys %{ $self->{stats}->{smiles} }) {
  1005. if ($self->{stats}->{lines}{$nick} > 100) {
  1006. $spercent{$nick} = $self->{stats}->{smiles}{$nick} / $self->{stats}->{lines}{$nick} * 100;
  1007. $spercent{$nick} =~ s/(\.\d)\d+/$1/;
  1008. }
  1009. }
  1010. my @smiles = sort { $spercent{$b} <=> $spercent{$a} } keys %spercent;
  1011. if (@smiles) {
  1012. my %hash = (
  1013. nick => $smiles[0],
  1014. per => $spercent{$smiles[0]}
  1015. );
  1016. my $text = $self->_template_text('smiles1', %hash);
  1017. _html("<tr><td class=\"hicell\">$text");
  1018. if (@smiles >= 2) {
  1019. my %hash = (
  1020. nick => $smiles[1],
  1021. per => $spercent{$smiles[1]}
  1022. );
  1023. my $text = $self->_template_text('smiles2', %hash);
  1024. _html("<br /><span class=\"small\">$text</span>");
  1025. }
  1026. _html("</td></tr>");
  1027. } else {
  1028. my $text = $self->_template_text('smiles3');
  1029. _html("<tr><td class=\"hicell\">$text</td></tr>");
  1030. }
  1031. }
  1032. sub _lasttopics
  1033. {
  1034. my $self = shift;
  1035. if ($self->{stats}->{topics}) {
  1036. my %topic_seen;
  1037. my %hash = (
  1038. total => scalar @{ $self->{stats}->{topics} }
  1039. );
  1040. my $ltopic = $#{ $self->{stats}->{topics} };
  1041. my $tlimit = 0;
  1042. $self->{cfg}->{topichistory} -= 1;
  1043. if ($ltopic > $self->{cfg}->{topichistory}) {
  1044. $tlimit = $ltopic - $self->{cfg}->{topichistory};
  1045. }
  1046. for (my $i = $ltopic; $i >= $tlimit; $i--) {
  1047. my $topic = htmlentities($self->{stats}->{topics}[$i]{topic});
  1048. # This code makes sure that we don't see the same topic twice
  1049. next if ($topic_seen{$topic});
  1050. $topic_seen{$topic} = 1;
  1051. $topic = $self->_replace_links($topic);
  1052. # Strip off the quotes (')
  1053. $topic =~ s/^\'(.*)\'$/$1/;
  1054. my $nick = $self->{stats}->{topics}[$i]{nick};
  1055. my $hour = $self->{stats}->{topics}[$i]{hour};
  1056. my $min = $self->{stats}->{topics}[$i]{min};
  1057. $hash{nick} = $nick;
  1058. $hash{time} = "$hour:$min";
  1059. _html("<tr><td class=\"hicell\"><i>$topic</i></td>");
  1060. _html("<td class=\"hicell\"><b>" . $self->_template_text('bylinetopic', %hash) ."</b></td></tr>");
  1061. }
  1062. _html("<tr><td align=\"center\" colspan=\"2\" class=\"asmall\">" . $self->_template_text('totaltopic', %hash) . "</td></tr>");
  1063. } else {
  1064. _html("<tr><td class=\"hicell\">" . $self->_template_text('notopic') ."</td></tr>");
  1065. }
  1066. }
  1067. sub _template_text
  1068. {
  1069. # This function is for the homemade template system. It receives a name
  1070. # of a template and a hash with the fields in the template to update to
  1071. # its corresponding value
  1072. my $self = shift;
  1073. my $template = shift;
  1074. my %hash = @_;
  1075. my $text;
  1076. unless ($text = $self->{tmps}->{lc($self->{cfg}->{lang})}{$template}) {
  1077. # Fall back to English if the language template doesn't exist
  1078. if ($text = $self->{tmps}->{en}{$template}) {
  1079. print "Note: No translation in '$self->{cfg}->{lang}' for '$template' - falling back to English..\n"
  1080. unless ($self->{cfg}->{silent});
  1081. } else {
  1082. die("No such template '$template' in language file.\n");
  1083. }
  1084. }
  1085. $hash{channel} = $self->{cfg}->{channel};
  1086. foreach my $key (sort keys %hash) {
  1087. $text =~ s/\[:$key\]/$hash{$key}/;
  1088. $text =~ s/ü/&uuml;/go;
  1089. $text =~ s/ö/&ouml;/go;
  1090. $text =~ s/ä/&auml;/go;
  1091. $text =~ s/ß/&szlig;/go;
  1092. $text =~ s/å/&aring;/go;
  1093. $text =~ s/æ/&aelig;/go;
  1094. $text =~ s/ø/&oslash;/go;
  1095. $text =~ s/Å/&Aring;/go;
  1096. $text =~ s/Æ/&AElig;/go;
  1097. $text =~ s/Ø/&Oslash;/go;
  1098. }
  1099. if ($text =~ /\[:.*?:.*?:\]/o) {
  1100. $text =~ s/\[:(.*?):(.*?):\]/$self->_get_subst($1,$2,\%hash)/geo;
  1101. }
  1102. return $text;
  1103. }
  1104. sub _get_subst
  1105. {
  1106. # This function looks at the user definition and see if there is sex
  1107. # defined. If yes, return the appropriate value. If no, just return the
  1108. # default he/she value.
  1109. my $self = shift;
  1110. my ($m,$f,$hash) = @_;
  1111. if ($hash->{nick} && $self->{users}->{sex}{$hash->{nick}}) {
  1112. if ($self->{users}->{sex}{$hash->{nick}} eq 'm') {
  1113. return $m;
  1114. } elsif ($self->{users}->{sex}{$hash->{nick}} eq 'f') {
  1115. return $f;
  1116. }
  1117. }
  1118. return "$m/$f";
  1119. }
  1120. sub _mostusedword
  1121. {
  1122. # Word usage statistics
  1123. my $self = shift;
  1124. my %usages;
  1125. foreach my $word (keys %{ $self->{stats}->{wordcounts} }) {
  1126. # Skip people's nicks.
  1127. next if exists $self->{stats}->{lines}{$word};
  1128. next if (length($word) < $self->{cfg}->{wordlength});
  1129. $usages{$word} = $self->{stats}->{wordcounts}{$word};
  1130. }
  1131. my @popular = sort { $usages{$b} <=> $usages{$a} } keys %usages;
  1132. if (@popular) {
  1133. $self->_headline($self->_template_text('mostwordstopic'));
  1134. _html("<table border=\"0\" width=\"$self->{cfg}->{tablewidth}\"><tr>");
  1135. _html("<td>&nbsp;</td><td class=\"tdtop\"><b>" . $self->_template_text('word') . "</b></td>");
  1136. _html("<td class=\"tdtop\"><b>" . $self->_template_text('numberuses') . "</b></td>");
  1137. _html("<td class=\"tdtop\"><b>" . $self->_template_text('lastused') . "</b></td></tr>");
  1138. my $count = 0;
  1139. for(my $i = 0; $count < $self->{cfg}->{wordhistory}; $i++) {
  1140. last unless $i < $#popular;
  1141. # Skip nicks. It's far more efficient to do this here than when
  1142. # @popular is created.
  1143. next if is_ignored($popular[$i]);
  1144. next if exists $self->{stats}->{lines}{find_alias($popular[$i])};
  1145. my $a = $count + 1;
  1146. my $popular = htmlentities($popular[$i]);
  1147. my $wordcount = $self->{stats}->{wordcounts}{$popular[$i]};
  1148. my $lastused = htmlentities($self->{stats}->{wordnicks}{$popular[$i]});
  1149. my $class;
  1150. if ($a == 1) {
  1151. $class = 'hirankc';
  1152. } else {
  1153. $class = 'rankc';
  1154. }
  1155. _html("<tr><td class=\"$class\">$a</td>");
  1156. _html("<td class=\"hicell\">$popular</td>");
  1157. _html("<td class=\"hicell\">$wordcount</td>");
  1158. _html("<td class=\"hicell\">$lastused</td>");
  1159. _html("</tr>");
  1160. $count++;
  1161. }
  1162. _html("</table>");
  1163. }
  1164. }
  1165. sub _mostwordsperline
  1166. {
  1167. # The person who got the most words per line
  1168. my $self = shift;
  1169. my %wpl = ();
  1170. my $numlines = 0;
  1171. my ($avg, $numwords);
  1172. foreach my $n (keys %{ $self->{stats}->{words} }) {
  1173. $wpl{$n} = sprintf("%.2f", $self->{stats}->{words}{$n}/$self->{stats}->{lines}{$n});
  1174. $numlines += $self->{stats}->{lines}{$n};
  1175. $numwords += $self->{stats}->{words}{$n};
  1176. }
  1177. if ($numlines > 0) {
  1178. $avg = sprintf("%.2f", $numwords/$numlines);
  1179. }
  1180. my @wpl = sort { $wpl{$b} <=> $wpl{$a} } keys %wpl;
  1181. if (@wpl) {
  1182. my %hash = (
  1183. nick => $wpl[0],
  1184. wpl => $wpl{$wpl[0]}
  1185. );
  1186. my $text = $self->_template_text('wpl1', %hash);
  1187. _html("<tr><td class=\"hicell\">$text");
  1188. $hash{avg} = $avg;
  1189. $text = $self->_template_text('wpl2', %hash);
  1190. _html("<br /><span class=\"small\">$text</span>");
  1191. _html("</td></tr>");
  1192. }
  1193. }
  1194. sub _mostreferencednicks
  1195. {
  1196. # List showing the most referenced nicks
  1197. my $self = shift;
  1198. my %usages;
  1199. foreach my $word (sort keys %{ $self->{stats}->{wordcounts} }) {
  1200. next if !exists $self->{stats}->{lines}{$word};
  1201. next if is_ignored($word);
  1202. $usages{$word} = $self->{stats}->{wordcounts}{$word};
  1203. }
  1204. my @popular = sort { $usages{$b} <=> $usages{$a} } keys %usages;
  1205. if (@popular) {
  1206. $self->_headline($self->_template_text('referencetopic'));
  1207. _html("<table border=\"0\" width=\"$self->{cfg}->{tablewidth}\"><tr>");
  1208. _html("<td>&nbsp;</td><td class=\"tdtop\"><b>" . $self->_template_text('nick') . "</b></td>");
  1209. _html("<td class=\"tdtop\"><b>" . $self->_template_text('numberuses') . "</b></td>");
  1210. _html("<td class=\"tdtop\"><b>" . $self->_template_text('lastused') . "</b></td></tr>");
  1211. for(my $i = 0; $i < $self->{cfg}->{nickhistory}; $i++) {
  1212. last unless $i < $#popular;
  1213. my $a = $i + 1;
  1214. my $popular = $popular[$i];
  1215. my $wordcount = $self->{stats}->{wordcounts}{$popular[$i]};
  1216. my $lastused = $self->{stats}->{wordnicks}{$popular[$i]};
  1217. my $class;
  1218. if ($a == 1) {
  1219. $class = 'hirankc';
  1220. } else {
  1221. $class = 'rankc';
  1222. }
  1223. _html("<tr><td class=\"$class\">$a</td>");
  1224. _html("<td class=\"hicell\">$popular</td>");
  1225. _html("<td class=\"hicell\">$wordcount</td>");
  1226. _html("<td class=\"hicell\">$lastused</td>");
  1227. _html("</tr>");
  1228. }
  1229. _html("</table>");
  1230. }
  1231. }
  1232. sub _mosturls
  1233. {
  1234. # List showing the most referenced URLs
  1235. my $self = shift;
  1236. my @sorturls = sort { $self->{stats}->{urlcounts}{$b} <=> $self->{stats}->{urlcounts}{$a} }
  1237. keys %{ $self->{stats}->{urlcounts} };
  1238. if (@sorturls) {
  1239. $self->_headline($self->_template_text('urlstopic'));
  1240. _html("<table border=\"0\" width=\"$self->{cfg}->{tablewidth}\"><tr>");
  1241. _html("<td>&nbsp;</td><td class=\"tdtop\"><b>" . $self->_template_text('url') . "</b></td>");
  1242. _html("<td class=\"tdtop\"><b>" . $self->_template_text('numberuses') . "</b></td>");
  1243. _html("<td class=\"tdtop\"><b>" . $self->_template_text('lastused') . "</b></td></tr>");
  1244. for(my $i = 0; $i < $self->{cfg}->{urlhistory}; $i++) {
  1245. last unless $i < @sorturls;
  1246. my $a = $i + 1;
  1247. my $sorturl = $sorturls[$i];
  1248. my $urlcount = $self->{stats}->{urlcounts}{$sorturls[$i]};
  1249. my $lastused = $self->{stats}->{urlnicks}{$sorturls[$i]};
  1250. if (length($sorturl) > 60) {
  1251. $sorturl = substr($sorturl, 0, 60);
  1252. }
  1253. my $class;
  1254. if ($a == 1) {
  1255. $class = 'hirankc';
  1256. } else {
  1257. $class = 'rankc';
  1258. }
  1259. _html("<tr><td class=\"$class\">$a</td>");
  1260. _html("<td class=\"hicell\"><a href=\"$sorturls[$i]\">$sorturl</a></td>");
  1261. _html("<td class=\"hicell\">$urlcount</td>");
  1262. _html("<td class=\"hicell\">$lastused</td>");
  1263. _html("</tr>");
  1264. }
  1265. _html("</table>");
  1266. }
  1267. }
  1268. sub _legend
  1269. {
  1270. # A legend showing the timebars and their associated time.
  1271. my $self = shift;
  1272. _html("<table align=\"center\" border=\"0\" width=\"520\"><tr>");
  1273. _html("<td align=\"center\" class=\"asmall\"><img src=\"$self->{cfg}->{piclocation}/$self->{cfg}->{pic_h_0}\" width=\"40\" height=\"15\" align=\"middle\" alt=\"0-5\" /> = 0-5</td>");
  1274. _html("<td align=\"center\" class=\"asmall\"><img src=\"$self->{cfg}->{piclocation}/$self->{cfg}->{pic_h_6}\" width=\"40\" height=\"15\" align=\"middle\" alt=\"6-11\" /> = 6-11</td>");
  1275. _html("<td align=\"center\" class=\"asmall\"><img src=\"$self->{cfg}->{piclocation}/$self->{cfg}->{pic_h_12}\" width=\"40\" height=\"15\" align=\"middle\" alt=\"12-17\" /> = 12-17</td>");
  1276. _html("<td align=\"center\" class=\"asmall\"><img src=\"$self->{cfg}->{piclocation}/$self->{cfg}->{pic_h_18}\" width=\"40\" height=\"15\" align=\"middle\" alt=\"18-23\" /> = 18-23</td>");
  1277. _html("</tr></table>\n");
  1278. }
  1279. sub _replace_links
  1280. {
  1281. # Sub to replace urls and e-mail addys to links
  1282. my $self = shift;
  1283. my $str = shift;
  1284. my $nick = shift;
  1285. # Regular expressions are taken from match_urls() and match_email() in
  1286. # Common.pm
  1287. my $texturl = $self->_template_text("newwindow");
  1288. my $textmail = $self->_template_text("mailto");
  1289. if ($nick) {
  1290. $str =~ s/(http|https|ftp|telnet|news)(:\/\/[-a-zA-Z0-9_\/~]+\.[-a-zA-Z0-9.,_~=:&amp;@%?#\/+]+)/<a href="$1$2" target="_blank" title="$texturl $1$2">$nick<\/a>/g;
  1291. $str =~ s/([-a-zA-Z0-9._]+@[-a-zA-Z0-9_]+\.[-a-zA-Z0-9._]+)/<a href="mailto:$1" title="$textmail $nick">$nick<\/a>/g;
  1292. } else {
  1293. $str =~ s/(http|https|ftp|telnet|news)(:\/\/[-a-zA-Z0-9_\/~]+\.[-a-zA-Z0-9.,_~=:&amp;@%?#\/+]+)/<a href="$1$2" target="_blank" title="$texturl $1$2">$1$2<\/a>/g;
  1294. $str =~ s/([-a-zA-Z0-9._]+@[-a-zA-Z0-9_]+\.[-a-zA-Z0-9._]+)/<a href="mailto:$1" title="$textmail $1">$1<\/a>/g;
  1295. }
  1296. return $str;
  1297. }
  1298. sub _user_linetimes
  1299. {
  1300. my $self = shift;
  1301. my $nick = shift;
  1302. my $top = shift;
  1303. my $bar = "";
  1304. my $len = ($self->{stats}->{lines}{$nick} / $self->{stats}->{lines}{$top}) * 100;
  1305. for (my $i = 0; $i <= 3; $i++) {
  1306. next if not defined $self->{stats}->{line_times}{$nick}[$i];
  1307. my $w = int(($self->{stats}->{line_times}{$nick}[$i] / $self->{stats}->{lines}{$nick}) * $len);
  1308. if ($w) {
  1309. my $pic = 'pic_h_'.(6*$i);
  1310. $bar .= "<img src=\"$self->{cfg}->{piclocation}/$self->{cfg}->{$pic}\" border=\"0\" width=\"$w\" height=\"15\" align=\"middle\" alt=\"\" />";
  1311. }
  1312. }
  1313. return "$bar&nbsp;$self->{stats}->{lines}{$nick}";
  1314. }
  1315. sub _user_times
  1316. {
  1317. my $self = shift;
  1318. my ($nick) = @_;
  1319. my $bar = "";
  1320. for (my $i = 0; $i <= 3; $i++) {
  1321. next if not defined $self->{stats}->{line_times}{$nick}[$i];
  1322. my $w = int(($self->{stats}->{line_times}{$nick}[$i] / $self->{stats}->{lines}{$nick}) * 40);
  1323. if ($w) {
  1324. my $pic = 'pic_h_'.(6*$i);
  1325. $bar .= "<img src=\"$self->{cfg}->{piclocation}/$self->{cfg}->{$pic}\" border=\"0\" width=\"$w\" height=\"15\" alt=\"\" />";
  1326. }
  1327. }
  1328. return $bar;
  1329. }
  1330. sub _mostnicks
  1331. {
  1332. # List showing the user with most used nicks
  1333. my $self = shift;
  1334. my @sortnicks = sort { @{ $self->{stats}->{nicks}->{$b} } <=> @{ $self->{stats}->{nicks}->{$a} } }
  1335. keys %{ $self->{stats}->{nicks} };
  1336. if (@{ $self->{stats}->{nicks}->{$sortnicks[0]} } > 1) {
  1337. $self->_headline($self->_template_text('mostnickstopic'));
  1338. my $names1 = $self->_template_text('names1');
  1339. my $names2 = $self->_template_text('names2');
  1340. my $nick_txt = $self->_template_text('nick');
  1341. my $names_txt = $self->_template_text('names');
  1342. _html("<table border=\"0\" width=\"$self->{cfg}->{tablewidth}\"><tr>");
  1343. _html("<td>&nbsp;</td><td class=\"tdtop\"><b>$nick_txt</b></td>");
  1344. _html("<td class=\"tdtop\"><b>$names_txt</b></td></tr>");
  1345. for(my $i = 0; $i < $self->{cfg}->{mostnickshistory}; $i++) {
  1346. next if is_ignored($sortnicks[$i]);
  1347. last unless $i < @sortnicks;
  1348. my $nickcount = scalar(@{ $self->{stats}->{nicks}->{$sortnicks[$i]} });
  1349. my $nickused = join(", ", @{ $self->{stats}->{nicks}->{$sortnicks[$i]} });
  1350. next unless ($nickcount > 1);
  1351. my $a = $i + 1;
  1352. my $class = $a == 1 ? 'hirankc' : 'rankc';
  1353. my $n = $nickcount > 1 ? $names1 : $names2;
  1354. _html("<tr><td class=\"$class\">$a</td>");
  1355. _html("<td class=\"hicell10\">$sortnicks[$i]<br />($nickcount $n)</td>");
  1356. _html("<td class=\"hicell10\" valign='top'>$nickused</td>");
  1357. _html("</tr>");
  1358. }
  1359. _html("</table>");
  1360. }
  1361. }
  1362. sub _mostactivebyhour
  1363. {
  1364. # List showing the user with most used nicks
  1365. my $self = shift;
  1366. my $sortnicks;
  1367. my $lastline=-1;
  1368. my $maxlines=0;
  1369. foreach my $period (0,1,2,3) {
  1370. my @sortnicks =
  1371. sort
  1372. {
  1373. (defined $self->{stats}->{line_times}{$b}[$period]?$self->{stats}->{line_times}{$b}[$period]:0)
  1374. <=>
  1375. (defined $self->{stats}->{line_times}{$a}[$period]?$self->{stats}->{line_times}{$a}[$period]:0)
  1376. }
  1377. keys %{ $self->{stats}->{nicks} } ;
  1378. for(my $i = 0; $i < $self->{cfg}->{activenicksbyhour}; $i++) {
  1379. next if is_ignored($sortnicks[$i]);
  1380. last unless $i < @sortnicks;
  1381. my $nick=$sortnicks[$i];
  1382. my $count=$self->{stats}->{line_times}{$nick}[$period] || 0;
  1383. last unless $nick;
  1384. last unless $count;
  1385. $sortnicks->[$period][$i]=$nick;
  1386. if ($lastline<$i) {
  1387. $lastline=$i;
  1388. }
  1389. if ($maxlines<$count) {
  1390. $maxlines=$count;
  1391. }
  1392. }
  1393. }
  1394. if ($lastline>=0) {
  1395. $self->_headline($self->_template_text('activenickbyhourtopic'));
  1396. _html("<table border=\"0\" width=\"$self->{cfg}->{tablewidth}\"><tr>");
  1397. _html("<td>&nbsp;</td>");
  1398. _html("<td class=\"tdtop\"><b>0-5</b></td>");
  1399. _html("<td class=\"tdtop\"><b>6-11</b></td>");
  1400. _html("<td class=\"tdtop\"><b>12-17</b></td>");
  1401. _html("<td class=\"tdtop\"><b>18-23</b></td>");
  1402. _html("</tr>");
  1403. for(my $i = 0; $i <= $lastline; $i++) {
  1404. my $a = $i + 1;
  1405. my $class = $a == 1 ? 'hirankc' : 'rankc';
  1406. _html("<tr><td class=\"$class\">$a</td>");
  1407. foreach my $period (0,1,2,3) {
  1408. my $nick=$sortnicks->[$period][$i];
  1409. if ($nick) {
  1410. my $count=$self->{stats}->{line_times}{$nick}[$period];
  1411. if ($count) {
  1412. _html("<td class=\"hicell\">".$nick." - ".$count);
  1413. if ($self->{cfg}->{showmostactivebyhourgraph}) {
  1414. my $pic = 'pic_h_'.(6*$period);
  1415. my $w = int(($count / $maxlines) * 100);
  1416. _html("<br><img src=\"$self->{cfg}->{piclocation}/$self->{cfg}->{$pic}\" border=\"0\" width=\"$w\" height=\"15\" align=\"middle\" alt=\"\" />");
  1417. }
  1418. _html("</td>");
  1419. } else {
  1420. _html("<td class=\"hicell\">&nbsp;</td>");
  1421. }
  1422. } else {
  1423. _html("<td class=\"hicell\">&nbsp;</td>");
  1424. }
  1425. }
  1426. _html("</tr>");
  1427. }
  1428. _html("</table>");
  1429. }
  1430. }
  1431. 1;
  1432. __END__
  1433. =head1 NAME
  1434. Pisg::HTMLGenerator - class to create a static HTML page out of data parsed
  1435. =head1 DESCRIPTION
  1436. C<Pisg::HTMLGenerator> uses the hash returned by Pisg::Parser::Logfile and turns it into a static HTML page.
  1437. =head1 SYNOPSIS
  1438. use Pisg::HTMLGenerator;
  1439. $generator = new Pisg::HTMLGenerator(
  1440. cfg => $cfg,
  1441. stats => $stats,
  1442. users => $users,
  1443. tmps => $tmps
  1444. );
  1445. =head1 CONSTRUCTOR
  1446. =over 4
  1447. =item new ( [ OPTIONS ] )
  1448. This is the constructor for a new Pisg::HTMLGenerator object. C<OPTIONS> are passed in a hash like fashion using key and value pairs.
  1449. Possible options are:
  1450. B<cfg> - hashref containing configuration variables, created by the Pisg module.
  1451. B<stats> - reference to the hash returned by Pisg::Parser::Logfile containing all stats.
  1452. B<users> - reference to a hash containg user information
  1453. B<tmps> - reference to a hash containing the language templates.
  1454. =back
  1455. =head1 AUTHOR
  1456. Morten Brix Pedersen <morten@wtf.dk>
  1457. =head1 COPYRIGHT
  1458. Copyright (C) 2001-2002 Morten Brix Pedersen. All rights reserved.
  1459. This program is free software; you can redistribute it and/or modify it
  1460. under the terms of the GPL, license is included with the distribution of
  1461. this file.
  1462. =cut