287 |
|
|
288 |
|
|
289 |
# |
# |
290 |
|
# Return the date the given file was last modified. |
291 |
|
# |
292 |
|
# Returns in the form eg: "Saturday 27 September 2003" |
293 |
|
# |
294 |
|
sub getModifiedDate( $ ) |
295 |
|
{ |
296 |
|
my ( $file ) = ( @_ ); |
297 |
|
|
298 |
|
my @MONTHS = ( "Dummy", |
299 |
|
"January", |
300 |
|
"February", |
301 |
|
"March", |
302 |
|
"April", |
303 |
|
"May", |
304 |
|
"June", |
305 |
|
"July", |
306 |
|
"August", |
307 |
|
"September", |
308 |
|
"October", |
309 |
|
"November", |
310 |
|
"December" ); |
311 |
|
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blks); |
312 |
|
|
313 |
|
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blks)= stat($file); |
314 |
|
|
315 |
|
my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst); |
316 |
|
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst)= localtime($mtime); |
317 |
|
$year= 1900 + $year; |
318 |
|
|
319 |
|
return( $mday . " " . $MONTHS[$mon+1] . " " . $year); |
320 |
|
|
321 |
|
} |
322 |
|
|
323 |
|
|
324 |
|
# |
325 |
# Read a file whist honouring the Server Side Include (SSI) features we |
# Read a file whist honouring the Server Side Include (SSI) features we |
326 |
# support for including other files, or the output of commands. |
# support for including other files, or the output of commands. |
327 |
# |
# |
357 |
my $action = $1; |
my $action = $1; |
358 |
my $params = $2; |
my $params = $2; |
359 |
|
|
360 |
|
if ( $action eq "echo" ) |
361 |
|
{ |
362 |
|
if ( $params eq "LAST_MODIFIED" ) |
363 |
|
{ |
364 |
|
print "Finding date for $file\n"; |
365 |
|
my $timestamp = &getModifiedDate( $file ); |
366 |
|
push @CONTENTS, $pre . $timestamp . $post; |
367 |
|
} |
368 |
|
else |
369 |
|
{ |
370 |
|
push @CONTENTS, $pre . "unknown variable $params" . $post; |
371 |
|
} |
372 |
|
} |
373 |
if ( $action eq "exec" ) |
if ( $action eq "exec" ) |
374 |
{ |
{ |
375 |
my $output = `$params`; |
my $output = `$params`; |