#!/usr/bin/perl # index.cgi # Display available apache or squid logfiles use strict; use warnings; no warnings 'redefine'; no warnings 'uninitialized'; our (%text, %config, %gconfig, %access, $module_name); require './webalizer-lib.pl'; &foreign_require("cron", "cron-lib.pl"); # Check if webalizer is actually installed if (!&has_command($config{'webalizer'})) { &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1, 0, &help_search_link("webalizer", "man", "doc", "google")); print &text('index_ewebalizer', "<tt>$config{'webalizer'}</tt>", "@{[&get_webprefix()]}/config.cgi?$module_name"),"<p>\n"; &foreign_require("software", "software-lib.pl"); my $lnk = &software::missing_install_link( "webalizer", $text{'index_webalizer'}, "../$module_name/", $text{'index_title'}); print $lnk,"<p>\n" if ($lnk); &ui_print_footer("/", $text{'index'}); exit; } # Get the version number my $out; my $webalizer_version = &get_webalizer_version(\$out); if (!$webalizer_version) { &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1, 0, &help_search_link("webalizer", "man", "doc", "google")); print &text('index_egetversion', "<tt>$config{'webalizer'} -v</tt>", "<pre>$out</pre>"),"<p>\n"; &ui_print_footer("/", $text{'index'}); exit; } if (&compare_version_numbers($webalizer_version, 2) < 0) { &main_header(); print &text('index_eversion', "<tt>$config{'webalizer'}</tt>", "$webalizer_version", "2.0"),"<p>\n"; &ui_print_footer("/", $text{'index'}); exit; } # Check if the config file exists if (!-r $config{'webalizer_conf'}) { &main_header(); print &text('index_econf', "<tt>$config{'webalizer_conf'}</tt>", "@{[&get_webprefix()]}/config.cgi?$module_name"),"<p>\n"; &ui_print_footer("/", $text{'index'}); exit; } # Query apache and squid for their logfiles my @logs = &get_all_logs(); # Remove in-accessible logs, and redirect if only one @logs = grep { &can_edit_log($_->{'file'}) } @logs; if (@logs == 1 && -r $logs[0]->{'file'} && $access{'noconfig'} && !$access{'add'} && !$access{'global'}) { # User can only edit/view one log file .. my $l = $logs[0]; if ($access{'view'}) { &redirect("view_log.cgi/".&urlize(&urlize($l->{'file'})). "/index.html"); } else { &redirect("edit_log.cgi?file=".&urlize($l->{'file'}). "&type=$l->{'type'}&custom=$l->{'custom'}"); } exit; } &main_header(); my @links = ( ); if (@logs) { if (!$access{'view'}) { print &ui_form_start("mass.cgi", "post"); push(@links, &select_all_link("d"), &select_invert_link("d")); } push(@links, &ui_link("edit_log.cgi?new=1", $text{'index_add'})) if (!$access{'view'} && $access{'add'}); print &ui_links_row(\@links); my @tds = ( "width=5" ); print &ui_columns_start([ $access{'view'} ? ( ) : ( "" ), $text{'index_path'}, $text{'index_type'}, $text{'index_size'}, $text{'index_sched'}, $text{'index_rep'} ], 100, 0, \@tds); my %done; foreach my $l (@logs) { next if ($done{$l->{'file'}}++); my @files = &all_log_files($l->{'file'}); next if (!@files); my $lconf = &get_log_config($l->{'file'}); my @cols; my $short = $l->{'file'}; if (length($short) > 40) { $short = "...".substr($short, -40); } if ($access{'view'}) { push(@cols, $short); } else { push(@cols, &ui_link("edit_log.cgi?file=". &urlize($l->{'file'}). "&type=$l->{'type'}&custom=$l->{'custom'}", $short)); } push(@cols, &text('index_type'.$l->{'type'})); my ($size, $latest) = (0, 0); foreach my $f (@files) { my @st = stat($f); $size += $st[7]; $latest = $st[9] if ($st[9] > $latest); } $latest = $latest ? localtime($latest) : "<br>"; push(@cols, $size ? &nice_size($size) : $text{'index_empty'}); push(@cols, $lconf->{'sched'} ? &text('index_when', &cron::when_text($lconf)) : $text{'no'}); if ($lconf->{'dir'} && -r "$lconf->{'dir'}/index.html") { push(@cols, &ui_link("view_log.cgi/". &urlize(&urlize($l->{'file'})). "/index.html", $text{'index_view'})); } else { push(@cols, ""); } if ($access{'view'}) { print &ui_columns_row(\@cols); } elsif (!%$lconf) { print &ui_columns_row([ ui_img("images/empty.gif"), @cols ]); } else { print &ui_checked_columns_row(\@cols, \@tds, "d", $l->{'file'}); } } print &ui_columns_end(); } else { print "<p><b>$text{'index_nologs'}</b><p>\n"; push(@links, &ui_link("edit_log.cgi?new=1", $text{'index_add'})) if (!$access{'view'} && $access{'add'}); } print &ui_links_row(\@links); if (@logs && !$access{'view'}) { print &ui_form_end([ [ "enable", $text{'index_enable'} ], [ "disable", $text{'index_disable'} ] ]); } if (!$access{'view'} && $access{'global'}) { print &ui_hr(); print &ui_buttons_start(); print &ui_buttons_row("edit_global.cgi", $text{'index_global'}, $text{'index_globaldesc'}); print &ui_buttons_end(); } &ui_print_footer("/", $text{'index'}); sub main_header { my $prog = &get_webalizer_prog(); &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1, 0, &help_search_link($prog, "man", "doc", "google"), undef, undef, &text('index_version_'.$prog, $webalizer_version)); }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
images | Folder | 0755 |
|
|
lang | Folder | 0755 |
|
|
CHANGELOG | File | 855 B | 0644 |
|
acl_security.pl | File | 1.2 KB | 0755 |
|
backup_config.pl | File | 1.63 KB | 0755 |
|
cgi_args.pl | File | 840 B | 0755 |
|
config | File | 158 B | 0644 |
|
config-ALL-linux | File | 107 B | 0644 |
|
config-debian-linux-4.0-ALL | File | 172 B | 0644 |
|
config-freebsd | File | 176 B | 0644 |
|
config-gentoo-linux | File | 107 B | 0644 |
|
config-mandrake-linux-10.3-ALL | File | 107 B | 0644 |
|
config-netbsd | File | 120 B | 0644 |
|
config-openbsd | File | 179 B | 0644 |
|
config-openmamba-linux | File | 113 B | 0644 |
|
config-solaris-10-ALL | File | 175 B | 0644 |
|
config-syno-linux | File | 222 B | 0644 |
|
config.info | File | 425 B | 0644 |
|
config.info.ca | File | 514 B | 0644 |
|
config.info.cs | File | 226 B | 0644 |
|
config.info.de | File | 471 B | 0644 |
|
config.info.es | File | 310 B | 0644 |
|
config.info.fa | File | 365 B | 0644 |
|
config.info.fi | File | 0 B | 0644 |
|
config.info.fr | File | 465 B | 0644 |
|
config.info.hr | File | 0 B | 0644 |
|
config.info.hu | File | 407 B | 0644 |
|
config.info.ms | File | 387 B | 0644 |
|
config.info.nl | File | 396 B | 0644 |
|
config.info.no | File | 379 B | 0644 |
|
config.info.pl | File | 488 B | 0644 |
|
config.info.ru | File | 308 B | 0644 |
|
config.info.tr | File | 372 B | 0644 |
|
config.info.uk | File | 314 B | 0644 |
|
defaultacl | File | 46 B | 0644 |
|
edit_global.cgi | File | 4.8 KB | 0755 |
|
edit_log.cgi | File | 3.67 KB | 0755 |
|
index.cgi | File | 5.13 KB | 0755 |
|
install_check.pl | File | 545 B | 0755 |
|
log_parser.pl | File | 707 B | 0755 |
|
mass.cgi | File | 1.81 KB | 0755 |
|
module.info | File | 201 B | 0644 |
|
module.info.af | File | 0 B | 0644 |
|
module.info.af.auto | File | 131 B | 0644 |
|
module.info.ar | File | 0 B | 0644 |
|
module.info.ar.auto | File | 184 B | 0644 |
|
module.info.be | File | 0 B | 0644 |
|
module.info.be.auto | File | 224 B | 0644 |
|
module.info.bg | File | 0 B | 0644 |
|
module.info.bg.auto | File | 203 B | 0644 |
|
module.info.ca | File | 156 B | 0644 |
|
module.info.ca.auto | File | 21 B | 0644 |
|
module.info.cs | File | 46 B | 0644 |
|
module.info.cs.auto | File | 108 B | 0644 |
|
module.info.da | File | 0 B | 0644 |
|
module.info.da.auto | File | 119 B | 0644 |
|
module.info.de | File | 113 B | 0644 |
|
module.info.de.auto | File | 18 B | 0644 |
|
module.info.el | File | 0 B | 0644 |
|
module.info.el.auto | File | 248 B | 0644 |
|
module.info.es | File | 52 B | 0644 |
|
module.info.es.auto | File | 118 B | 0644 |
|
module.info.eu | File | 0 B | 0644 |
|
module.info.eu.auto | File | 153 B | 0644 |
|
module.info.fa | File | 0 B | 0644 |
|
module.info.fa.auto | File | 230 B | 0644 |
|
module.info.fi | File | 0 B | 0644 |
|
module.info.fi.auto | File | 151 B | 0644 |
|
module.info.fr | File | 45 B | 0644 |
|
module.info.fr.auto | File | 125 B | 0644 |
|
module.info.he | File | 0 B | 0644 |
|
module.info.he.auto | File | 154 B | 0644 |
|
module.info.hr | File | 0 B | 0644 |
|
module.info.hr.auto | File | 142 B | 0644 |
|
module.info.hu | File | 37 B | 0644 |
|
module.info.hu.auto | File | 116 B | 0644 |
|
module.info.it | File | 0 B | 0644 |
|
module.info.it.auto | File | 142 B | 0644 |
|
module.info.ja | File | 0 B | 0644 |
|
module.info.ja.auto | File | 181 B | 0644 |
|
module.info.ko | File | 0 B | 0644 |
|
module.info.ko.auto | File | 147 B | 0644 |
|
module.info.lt | File | 0 B | 0644 |
|
module.info.lt.auto | File | 164 B | 0644 |
|
module.info.lv | File | 0 B | 0644 |
|
module.info.lv.auto | File | 153 B | 0644 |
|
module.info.ms | File | 118 B | 0644 |
|
module.info.ms.auto | File | 18 B | 0644 |
|
module.info.mt | File | 0 B | 0644 |
|
module.info.mt.auto | File | 138 B | 0644 |
|
module.info.nl | File | 34 B | 0644 |
|
module.info.nl.auto | File | 101 B | 0644 |
|
module.info.no | File | 33 B | 0644 |
|
module.info.no.auto | File | 93 B | 0644 |
|
module.info.pl | File | 91 B | 0644 |
|
module.info.pl.auto | File | 18 B | 0644 |
|
module.info.pt | File | 0 B | 0644 |
|
module.info.pt.auto | File | 152 B | 0644 |
|
module.info.pt_BR | File | 0 B | 0644 |
|
module.info.pt_BR.auto | File | 161 B | 0644 |
|
module.info.ro | File | 0 B | 0644 |
|
module.info.ro.auto | File | 145 B | 0644 |
|
module.info.ru | File | 53 B | 0644 |
|
module.info.ru.auto | File | 153 B | 0644 |
|
module.info.sk | File | 0 B | 0644 |
|
module.info.sk.auto | File | 174 B | 0644 |
|
module.info.sl | File | 0 B | 0644 |
|
module.info.sl.auto | File | 160 B | 0644 |
|
module.info.sv | File | 0 B | 0644 |
|
module.info.sv.auto | File | 130 B | 0644 |
|
module.info.th | File | 0 B | 0644 |
|
module.info.th.auto | File | 294 B | 0644 |
|
module.info.tr | File | 0 B | 0644 |
|
module.info.tr.auto | File | 154 B | 0644 |
|
module.info.uk | File | 0 B | 0644 |
|
module.info.uk.auto | File | 225 B | 0644 |
|
module.info.ur | File | 0 B | 0644 |
|
module.info.ur.auto | File | 194 B | 0644 |
|
module.info.vi | File | 0 B | 0644 |
|
module.info.vi.auto | File | 147 B | 0644 |
|
module.info.zh | File | 0 B | 0644 |
|
module.info.zh.auto | File | 130 B | 0644 |
|
module.info.zh_TW | File | 24 B | 0644 |
|
module.info.zh_TW.auto | File | 100 B | 0644 |
|
save_global.cgi | File | 4.14 KB | 0755 |
|
save_log.cgi | File | 5.38 KB | 0755 |
|
view_log.cgi | File | 1.74 KB | 0755 |
|
webalizer-lib.pl | File | 8.74 KB | 0755 |
|
webalizer.pl | File | 822 B | 0755 |
|