<?	// Preamble
	$pageName = "State of the Code";
	$focused = "none";					// Dock icon name to gets a border
	$currPage = "sotc";					// Name of the page, for the menu
	require "../parts/preamble.php";	// Load most of document
?>	
<!--SEARCHME-->
<P>The State of the Code address is a not-frequently-enough updated article
written by one of the QuakeForge developers, primarily for other QuakeForge
developers and other people who consider themselves to be knee-deep in the
code, whether they happen to be writing it or just testing it.  What you won't
find here is a lot of the fluff news that tells the casual onlooker that the
project is actually doing stuff without really telling you what the state of
things are.

<P>No attempt will be made to soften technical issues so anyone can	understand
them.  If you want to really know what's going on, you probably don't want
details left out because they might not make a whole lot of sense to a
non-coder.  Feedback is always welcome.  So	are corrections if they're
necessary.
<?										// Display latest update
	function sotcShowLatest ($year) {
		$i = 0;

		$dirHandle = @opendir ($year);
		if ($dirHandle) {
			while ($fileName = readdir ($dirHandle)) {
				if ($fileName != '.' && $fileName != '..' && $fileName != 'CVS') {
					$sotcList[$i++] = $fileName;
				}
			}
			closedir ($dirHandle);
			rsort ($sotcList);
			include ($year . '/' . $sotcList[0]);
		} else {
			echo '<P>Sorry, there are no State of the Code announcements for this year yet.';
		}
	}

	function sotcYears() {
		$i = 0;

		$dirHandle = opendir('./');
		if ($dirHandle) {
			while ($year = readdir($dirHandle)) {
				if (is_dir ($year) && $year != '.' && $year != '..' && $year != 'CVS') {
					$years[$i++] = $year;
				}
			}
			closedir ($dirHandle);
			rsort ($years);
			return $years;
		}
	}	

	function sotcListFiles( $year ) {
		$i = 0;

		$dirHandle = opendir ($year);
		if ($dirHandle) {
			while ($fileName = readdir($dirHandle)) {
				if ($fileName != '.' && $fileName != '..' && $fileName != 'CVS') {
					$sotcList[$i++] = $fileName;
				}
			}
			closedir ($dirHandle);
			rsort ($sotcList);
			if (count ($sotcList) > 0) {
				tableBoxHeader('black', tableHeadColor);
				tableTitle('SotC Archives for ' . $year, 3, tableHeadColor);
				for ($i = 0; $i < count ($sotcList); $i++) {
					$file = fopen ($year . '/' . $sotcList[$i], 'r');
					$line = fgets ($file, 4096);
					fclose($file);
					$line = ereg_replace('<!--', '', ereg_replace('-->', '', $line));
					echo '<TR><TD>' . $line . '</TD></TR>';
				}
				tableBoxFooter ();
			}
		}
	}
				
	if (!$year) {
		$year = date('Y', time ());
	}

	sotcShowLatest ($year);
	echo '<P>';
	sotcListFiles ($year);
?>			
<!--NOSEARCH-->
<?
	require "../parts/postamble.php";	// Finish this sucker up
?>
