Revision: 5807 http://ipcop.svn.sourceforge.net/ipcop/?rev=5807&view=rev Author: owes Date: 2011-08-18 12:56:06 +0000 (Thu, 18 Aug 2011)
Log Message: ----------- Make use of calculatedate and validatedate functions. Modified Paths: -------------- ipcop/trunk/html/cgi-bin/logsummary.cgi Modified: ipcop/trunk/html/cgi-bin/logsummary.cgi =================================================================== --- ipcop/trunk/html/cgi-bin/logsummary.cgi 2011-08-18 12:03:13 UTC (rev 5806) +++ ipcop/trunk/html/cgi-bin/logsummary.cgi 2011-08-18 12:56:06 UTC (rev 5807) @@ -60,52 +60,42 @@ &General::getcgihash(\%cgiparams); my $start = -1; +my @temp_then = (); if ($ENV{'QUERY_STRING'} && $cgiparams{'ACTION'} ne $Lang::tr{'update'}) { - my @temp = split(',', $ENV{'QUERY_STRING'}); - $start = $temp[0]; - $cgiparams{'MONTH'} = $temp[1]; - $cgiparams{'DAY'} = $temp[2]; + @temp_then = split(',', $ENV{'QUERY_STRING'}); + $start = $temp_then[0]; + $cgiparams{'MONTH'} = $temp_then[1]; + $cgiparams{'DAY'} = $temp_then[2]; } if ( !($cgiparams{'MONTH'} =~ /^(0|1|2|3|4|5|6|7|8|9|10|11)$/) || !($cgiparams{'DAY'} =~ /^(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)$/) ) { - # Reports are generated at the end of the day, so if nothing is selected # we need to display yesterdays (todays won't have been generated yet) - my @temp_then = (); - my @temp_now = localtime(time); - $temp_now[4] = $now[4]; - $temp_now[3] = $now[3]; - @temp_then = localtime(POSIX::mktime(@temp_now) - 86400); - ## Retrieve the same time on the previous day - - ## 86400 seconds in a day + @temp_then = &General::calculatedate(0, $now[4], $now[3], -1); $cgiparams{'MONTH'} = $temp_then[4]; $cgiparams{'DAY'} = $temp_then[3]; } elsif ($cgiparams{'ACTION'} eq '>>') { - my @temp_then = (); - my @temp_now = localtime(time); - $temp_now[4] = $cgiparams{'MONTH'}; - $temp_now[3] = $cgiparams{'DAY'}; - @temp_then = localtime(POSIX::mktime(@temp_now) + 86400); - ## Retrieve the same time on the next day + - ## 86400 seconds in a day + @temp_then = &General::calculatedate($year, $cgiparams{'MONTH'}, $cgiparams{'DAY'}, 1); + $year = $temp_then[5]+1900; $cgiparams{'MONTH'} = $temp_then[4]; $cgiparams{'DAY'} = $temp_then[3]; } elsif ($cgiparams{'ACTION'} eq '<<') { - my @temp_then = (); - my @temp_now = localtime(time); - $temp_now[4] = $cgiparams{'MONTH'}; - $temp_now[3] = $cgiparams{'DAY'}; - @temp_then = localtime(POSIX::mktime(@temp_now) - 86400); - ## Retrieve the same time on the previous day - - ## 86400 seconds in a day + @temp_then = &General::calculatedate($year, $cgiparams{'MONTH'}, $cgiparams{'DAY'}, -1); + $year = $temp_then[5]+1900; $cgiparams{'MONTH'} = $temp_then[4]; $cgiparams{'DAY'} = $temp_then[3]; } +else { + @temp_then = &General::validatedate(0, $cgiparams{'MONTH'}, $cgiparams{'DAY'}); + $year = $temp_then[5]+1900; + $cgiparams{'MONTH'} = $temp_then[4]; + $cgiparams{'DAY'} = $temp_then[3]; +} if (($cgiparams{'DAY'} ne $now[3]) || ($cgiparams{'MONTH'} ne $now[4])) { if ( ($cgiparams{'MONTH'} eq $now[4]) && ($cgiparams{'DAY'} > $now[3]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 _______________________________________________ Ipcop-svn mailing list Ipcop-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ipcop-svn