Edit: /usr/share/usermin/date_chooser.cgi (2241B)
#!/usr/bin/perl
# date_chooser.cgi
# Display a table of days in the current month
BEGIN { push(@INC, "."); };
use WebminCore;
use Time::Local;
&init_config();
&ReadParse();
@daysin = ( 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 );
$daysin[1] = $in{'year'}%400 == 0 ? 29 :
$in{'year'}%100 == 0 ? 28 :
$in{'year'}%4 == 0 ? 29 : 28;
@tm = localtime(time());
if ($in{'day'} !~ /^\d+$/ || $in{'day'} < 1 || $in{'year'} !~ /^\d+$/) {
$in{'day'} = $tm[3];
$in{'month'} = $tm[4];
$in{'year'} = $tm[5]+1900;
}
if ($in{'day'} > $daysin[$in{'month'}]) {
$in{'day'} = $daysin[$in{'month'}];
}
$tm = timelocal(0, 0, 12, $in{'day'}, $in{'month'}, $in{'year'});
&popup_header($text{'chooser_date'});
$uday = &urlize($in{'day'});
$umonth = &urlize($in{'month'});
$uyear = &urlize($in{'year'});
print <
function newmonth(m)
{
location = "date_chooser.cgi?day=$uday&month="+m.selectedIndex+"&year=$uyear";
}
function newyear(y)
{
location = "date_chooser.cgi?day=$uday&month=$umonth&year="+(y.selectedIndex+$in{'year'}-10);
}
function newday(d)
{
opener.dfield.value = d;
opener.mfield.selectedIndex = $umonth;
opener.yfield.value = $uyear;
close();
}
\n";
&popup_footer();