]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - html/cgi-bin/index.cgi
kleine fixes am nettraffic
[people/teissler/ipfire-2.x.git] / html / cgi-bin / index.cgi
index c984300e48ec57a97b81376c2510bb655fd1ab09..9135b75f8bbea74012ba305f24e9d5b3dd94775c 100644 (file)
@@ -37,6 +37,11 @@ $pppsettings{'PROFILENAME'} = 'None';
 &General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
 &General::readhash("${General::swroot}/ddns/settings", \%ddnssettings);
 
+my %color = ();
+my %mainsettings = ();
+&General::readhash("${General::swroot}/main/settings", \%mainsettings);
+&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
+
 my $connstate = &Header::connectionstatus();
 if ($connstate =~ /$Lang::tr{'dod waiting'}/ || -e "${General::swroot}/main/refreshindex") {
        $refresh = "<meta http-equiv='refresh' content='30;'>";
@@ -67,7 +72,7 @@ my $dialButtonDisabled = "disabled='disabled'";
 &Header::openbigbox('', 'center');
 &Header::openbox('100%', 'center', &Header::cleanhtml(`/bin/uname -n`,"y"));
 
-if ( ( $pppsettings{'VALID'} eq 'yes' && $modemsettings{'VALID'} eq 'yes' ) || ( $netsettings{'CONFIG_TYPE'} =~ /^(2|3|6|7)$/ && $netsettings{'RED_TYPE'} =~ /^(DHCP|STATIC)$/ )) {
+if ( ( $pppsettings{'VALID'} eq 'yes' && $modemsettings{'VALID'} eq 'yes' ) || ( $netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/ && $netsettings{'RED_TYPE'} =~ /^(DHCP|STATIC)$/ )) {
        if (open(IPADDR,"${General::swroot}/ddns/ipcache")) {
            $ipaddr = <IPADDR>;
            close IPADDR;
@@ -98,12 +103,15 @@ print <<END;
 
 <!-- Table of networks -->
 <table border='0' width=80%>
-  <tr> <th bgcolor='lightgrey'>$Lang::tr{'network'}
-       <th bgcolor='lightgrey'>IP
-       <th bgcolor='lightgrey'>$Lang::tr{'status'}
+  <tr> <th bgcolor='$color{'color20'}'>$Lang::tr{'network'}
+       <th bgcolor='$color{'color20'}'>IP
+       <th bgcolor='$color{'color20'}'>$Lang::tr{'status'}
   <tr> <td bgcolor='$Header::colourred' width='25%'><a href="/cgi-bin/pppsetup.cgi"><font size='2' color='white'><b>$Lang::tr{'internet'}:</b></font></a><br>
        <td width='30%'>$ipaddr 
        <td width='45%'>$connstate
+END
+print `/usr/local/bin/dialctrl.pl show`;
+print <<END;
        <tr><td colspan='2'>
                <form method='post' action='/cgi-bin/dial.cgi'>$Lang::tr{'profile'}:
                        <select name='PROFILE'>
@@ -116,7 +124,7 @@ END
                }
        }
        $dialButtonDisabled = "disabled='disabled'" if (-e '/var/run/ppp-ipfire.pid' || -e "${General::swroot}/red/active");
-       if ( ( $pppsettings{'VALID'} eq 'yes' ) || ( $netsettings{'CONFIG_TYPE'} =~ /^(2|3|6|7)$/ && $netsettings{'RED_TYPE'} =~ /^(DHCP|STATIC)$/ ) ) {
+       if ( ( $pppsettings{'VALID'} eq 'yes' ) || ( $netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/ && $netsettings{'RED_TYPE'} =~ /^(DHCP|STATIC)$/ ) ) {
                print <<END;
                                </select>
                                <input type='submit' name='ACTION' value='$Lang::tr{'dial profile'}' $dialButtonDisabled />
@@ -282,7 +290,63 @@ if ($warnmessage) {
 }
 print <<END;
 </table>
+
 END
+
+require "${General::swroot}/net-traffic/net-traffic-admin.pl";
+
+if($NETTRAFF::settings{'SHOW_AT_HOME'} eq 'on')
+{
+       my %calc = ();
+       $calc{'CALC_VOLUME_TOTAL'} = 0;
+       $calc{'CALC_VOLUME_IN'} = 0;
+       $calc{'CALC_VOLUME_OUT'} = 0;
+       $calc{'CALC_WEEK_TOTAL'} = 0;
+       $calc{'CALC_WEEK_IN'} = 0;
+       $calc{'CALC_WEEK_OUT'} = 0;
+       $calc{'CALC_LAST_RUN'} = 0;
+       $calc{'CALC_PERCENT'} = 0;
+
+       &General::readhash($NETTRAFF::logfile, \%calc);
+
+       my $calctime = &NETTRAFF::getFormatedDate($calc{'CALC_LAST_RUN'});
+
+       print <<END;
+               <hr /><br />
+
+                               <table width='80%'>
+                               <tr>
+                               <td colspan='4' align='center' nowrap='nowrap' >$Lang::tr{'traffic monitor'} ($Lang::tr{'traffic calc time'} $calctime)</td>
+                               </tr>
+                               <tr>
+                                       <td align='center' nowrap='nowrap' > </td>
+                                       <td align='center' nowrap='nowrap' class='boldbase'><font color='$Header::colourred'><b>$Lang::tr{'trafficin'}</b></font></td>
+                                       <td align='center' nowrap='nowrap' class='boldbase'><font color='$Header::colourred'><b>$Lang::tr{'trafficout'}</b></font></td>
+                                       <td align='center' nowrap='nowrap' class='boldbase'><font color='$Header::colourred'><b>$Lang::tr{'trafficsum'}</b></font></td>
+                               </tr>
+                               <tr>
+                                       <td align='center' nowrap='nowrap' >$Lang::tr{'this weeks volume'} (MB):</td>
+                                       <td align='center' nowrap='nowrap' class='boldbase'>$calc{'CALC_WEEK_IN'}</td>
+                                       <td align='center' nowrap='nowrap' class='boldbase'>$calc{'CALC_WEEK_OUT'}</td>
+                                       <td align='center' nowrap='nowrap' class='boldbase'>$calc{'CALC_WEEK_TOTAL'}</td>
+                               </tr>
+                               <tr>
+                                       <td align='center' nowrap='nowrap' >$Lang::tr{'this months volume'} (MB):</td>
+                                       <td align='center' nowrap='nowrap' class='boldbase'>$calc{'CALC_VOLUME_IN'}</td>
+                                       <td align='center' nowrap='nowrap' class='boldbase'>$calc{'CALC_VOLUME_OUT'}</td>
+                                       <td align='center' nowrap='nowrap' class='boldbase'>$calc{'CALC_VOLUME_TOTAL'}</td>
+                               </tr>
+END
+
+       if($NETTRAFF::settings{'MONTHLY_VOLUME_ON'} eq 'on')
+       {
+print "<tr><td align='center'>max. $NETTRAFF::settings{'MONTHLY_VOLUME'} MB</td><td align='left' colspan='3' nowrap='nowrap'>";
+&NETTRAFF::traffPercentbar("$calc{'CALC_PERCENT'}%"); 
+print "</td><td align='left' nowrap='nowrap'>&nbsp; $calc{'CALC_PERCENT'}%</td></tr>";
+       }
+       print "</table>";
+}
+
 &Header::closebox();
 
 &Header::closebigbox();