0) trigger_error( "No blank line after caption in $filename", E_USER_ERROR ); if ($intro) { $content = ""; while (($line = fgets( $file, 1024 )) && strlen(trim($line)) > 0) $content .= $line; } else if (!($content = fread( $file, filesize( $filename ) ))) trigger_error( "Error reading news content from $filename", E_USER_ERROR ); fclose( $file ); print( "
\n" ); print( "

\n" ); if ($intro) print( " \n" ); print( " $date  \n" ); print( " $caption\n" ); if ($intro) print( " \n" ); print( "

\n" ); print( "
\n" ); print( " $content\n" ); print( "

$author

\n" ); print( "
\n" ); print( "
\n" ); } function show_news( $num, $intro, $year ) { global $NEWSDIR; if ($year >= 2000) $match = "/($year\-\d\d\-\d\d)/"; else $match = "/(\d\d\d\d\-\d\d\-\d\d)/"; if (!is_dir( $NEWSDIR )) trigger_error( "No directory '$NEWSDIR'", E_USER_ERROR ); $entries = array(); if (!($dir = opendir( $NEWSDIR ))) trigger_error( "Could not open directory '$NEWSDIR'", E_USER_ERROR ); while (($file = readdir( $dir ))) { if (!preg_match( $match, $file )) continue; $entries[] = $file; } closedir( $dir ); rsort( $entries ); $count = count($entries); if ($num < 1 || $num > $count) $num = $count; for ($index=0; $index<$num; $index++) read_news( $entries[$index], $intro ); } ?>