use Getopt::Std;
# enable only the following on debugging purpose
-use warnings;
-use CGI::Carp 'fatalsToBrowser';
+#use warnings;
+#use CGI::Carp 'fatalsToBrowser';
require '/var/ipfire/general-functions.pl';
require "${General::swroot}/lang.pl";
use POSIX();
-#workaround to suppress a warning when a variable is used only once
-my @dummy = ( ${Header::table2colour} );
-undef (@dummy);
-
my %cgiparams=();
my %settings=();
my $pienumber;
&Header::closebox();
}
-&Header::openbox('100%', 'left', "$Lang::tr{'settings'}:");
+&Header::openbox('100%', 'left', "$Lang::tr{'settings'}");
print <<END
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
</td>
<td width='5%' align='center'><input type='submit' name='ACTION' title='$Lang::tr{'day before'}' value='<<' /></td>
<td width='5%' align='center'><input type='submit' name='ACTION' title='$Lang::tr{'day after'}' value='>>' /></td>
-<td width='20%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'update'}' /></td>
+<td width='20%' align='right'><input type='submit' name='ACTION' value='$Lang::tr{'update'}' /></td>
+</tr>
+<tr>
+ <td colspan='3' align='left' valign="left">$Lang::tr{'Number of IPs for the pie chart'}:</td>
+ <td colspan='3' align='left' valign="center"><input type='text' name='pienumber' value='$pienumber' size='4'></td>
+ <td align='right'><input type='submit' name='ACTION' value='$Lang::tr{'save'}' /></td>
</tr>
</table>
-<table width='100%'>
-<tr><td width='20%' align='right' valign="center">$Lang::tr{'Number of IPs for the pie chart'}:</td>
- <td width='10%' align='left' valign="center"><input type='text' name='pienumber' value='$pienumber' size='4'></td>
- <td width='20%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'save'}' /></td></tr>
- </table>
- </form>
+</form>
END
;
print FILE $myimage->png;
close(FILE);
#####################################################
- print "<table align='center'><tr><td>";
+ print "<div style='text-align:center'>";
print "<img src='/graphs/fwlog-ip$imagerandom.png'>";
- print "</td></tr></table>";
+ print "</div>";
}
print <<END
-<TABLE WIDTH='100%'>
-<TR>
-<TD WIDTH='10%' ALIGN='CENTER' CLASS='boldbase'></TD>
-<TD WIDTH='30%' ALIGN='CENTER' CLASS='boldbase'><B>IP</B></TD>
-<TD WIDTH='10%' ALIGN='CENTER' CLASS='boldbase'><B>Flag</B></TD>
-<TD WIDTH='10%' ALIGN='CENTER' CLASS='boldbase'><B>Count</B></TD>
-<TD WIDTH='30%' ALIGN='CENTER' CLASS='boldbase'><B>Percent</B></TD>
-</TR>
+<table width='100%' class='tbl'>
+<tr>
+<th width='10%' align='center' class='boldbase'></th>
+<th width='30%' align='center' class='boldbase'><b>$Lang::tr{'ip address'}</b></th>
+<th width='10%' align='center' class='boldbase'><b>$Lang::tr{'country'}</b></th>
+<th width='10%' align='center' class='boldbase'><b>$Lang::tr{'count'}</b></th>
+<th width='30%' align='center' class='boldbase'><b>$Lang::tr{'percentage'}</b></th>
+</tr>
END
;
my $s;
my $percent;
+my $col="";
+
for($s=0;$s<$lines;$s++)
{
$show++;
$percent = $value[$s] * 100 / $linesjc;
$percent = sprintf("%.f", $percent);
$total = $total + $value[$s];
- if ( ($color % 10) == 1 ){print "<TR BGCOLOR='$color{'color1'}'>\n";}
- if ( ($color % 10) == 2 ){print "<TR BGCOLOR='$color{'color2'}'>\n";}
- if ( ($color % 10) == 3 ){print "<TR BGCOLOR='$color{'color3'}'>\n";}
- if ( ($color % 10) == 4 ){print "<TR BGCOLOR='$color{'color4'}'>\n";}
- if ( ($color % 10) == 5 ){print "<TR BGCOLOR='$color{'color5'}'>\n";}
- if ( ($color % 10) == 6 ){print "<TR BGCOLOR='$color{'color6'}'>\n";}
- if ( ($color % 10) == 7 ){print "<TR BGCOLOR='$color{'color7'}'>\n";}
- if ( ($color % 10) == 8 ){print "<TR BGCOLOR='$color{'color8'}'>\n";}
- if ( ($color % 10) == 9 ){print "<TR BGCOLOR='$color{'color9'}'>\n";}
- if ( ($color % 10) == 0 ){print "<TR BGCOLOR='$color{'color10'}'>\n";}
+ my $colorIndex = $color % 10;
+ if($colorIndex == 0) {
+ $colorIndex = 10;
+ }
+ $col="bgcolor='$color{\"color$colorIndex\"}'";
+ print "<tr>";
my $gi = Geo::IP::PurePerl->new();
my $ccode = $gi->country_code_by_name($key[$s]);
my $fcode = lc($ccode);
$color++;
- print "<TD ALIGN='CENTER'><form method='post' action='showrequestfromip.dat'><input type='hidden' name='MONTH' value='$cgiparams{'MONTH'}'> <input type='hidden' name='DAY' value='$cgiparams{'DAY'}'> <input type='hidden' name='ip' value='$key[$s]'> <input type='submit' value='details'></form></TD>";
- print "<TD ALIGN='CENTER'><a href='/cgi-bin/ipinfo.cgi?ip=$key[$s]'>$key[$s]</a></TD>";
- print "<TD ALIGN='CENTER'><a href='/cgi-bin/country.cgi#$fcode'><img src='/images/flags/$fcode.png' border='0' align='absmiddle' alt='$ccode'></a></TD>";
- print "<TD ALIGN='CENTER'>$value[$s]</TD>";
- print "<TD ALIGN='CENTER'>$percent</TD>";
- print "</TR>";
-}
+ print "<td align='center' $col><form method='post' action='showrequestfromip.dat'><input type='hidden' name='MONTH' value='$cgiparams{'MONTH'}'> <input type='hidden' name='DAY' value='$cgiparams{'DAY'}'> <input type='hidden' name='ip' value='$key[$s]'> <input type='submit' value='$Lang::tr{'details'}'></form></td>";
+ print "<td align='center' $col><a href='/cgi-bin/ipinfo.cgi?ip=$key[$s]'>$key[$s]</a></td>";
+ if ( $fcode ne "" ){
+ print "<td align='center' $col><a href='/cgi-bin/country.cgi#$fcode'><img src='/images/flags/$fcode.png' border='0' align='absmiddle' alt='$ccode' title='$ccode'></a></td>";}
+ else {
+ print "<td align='center' $col></td>";}
+ print "<td align='center' $col>$value[$s]</td>";
+ print "<td align='center' $col>$percent</td>";
+ print "</tr>";
+ }
if($cgiparams{'otherspie'} == 2 ){}
else{
-if ( ($color % 10) == 1 ){print "<TR BGCOLOR='$color{'color1'}'>\n";}
-if ( ($color % 10) == 2 ){print "<TR BGCOLOR='$color{'color2'}'>\n";}
-if ( ($color % 10) == 3 ){print "<TR BGCOLOR='$color{'color3'}'>\n";}
-if ( ($color % 10) == 4 ){print "<TR BGCOLOR='$color{'color4'}'>\n";}
-if ( ($color % 10) == 5 ){print "<TR BGCOLOR='$color{'color5'}'>\n";}
-if ( ($color % 10) == 6 ){print "<TR BGCOLOR='$color{'color6'}'>\n";}
-if ( ($color % 10) == 7 ){print "<TR BGCOLOR='$color{'color7'}'>\n";}
-if ( ($color % 10) == 8 ){print "<TR BGCOLOR='$color{'color8'}'>\n";}
-if ( ($color % 10) == 9 ){print "<TR BGCOLOR='$color{'color9'}'>\n";}
-if ( ($color % 10) == 0 ){print "<TR BGCOLOR='$color{'color10'}'>\n";}
+ my $colorIndex = $color % 10;
+ if($colorIndex == 0) {
+ $colorIndex = 10;
+ }
+ $col="bgcolor='$color{\"color$colorIndex\"}'";
+ print "<tr>";
+if ( $linesjc ne "0")
+{
my $dif;
$dif = $linesjc - $total;
$percent = $dif * 100 / $linesjc;
$percent = sprintf("%.f", $percent);
print <<END
-<TD ALIGN='CENTER'></TD>
-<TD ALIGN='CENTER'>$Lang::tr{'otherip'}</TD>
-<TD ALIGN='CENTER'></TD>
-<TD ALIGN='CENTER'>$dif</TD>
-<TD ALIGN='CENTER'>$percent</TD>
-</TR>
+<td align='center' $col></td>
+<td align='center' $col>$Lang::tr{'otherip'}</td>
+<td align='center' $col></td>
+<td align='center' $col>$dif</td>
+<td align='center' $col>$percent</td>
+</tr>
END
;
}
+}
print <<END
-</TABLE>
+</table>
END
;
last;
}
}
-}sub checkversion {
- #Automatic Updates is disabled
- return "0","0";
- }
+}
+
+sub checkversion {
+ #Automatic Updates is disabled
+ return "0","0";
+}
+