<?php
require_once('config.inc.php');
require_once('objects.inc.php');
require_once('functions.inc.php');
$timer = microtime(); // start page timer
$title = 'Pages';
if (!isset($_REQUEST["generate"]) || $_REQUEST["generate"] != "all") {
$title .= ' (click each link to create a static page)';
}
?>
<html>
<head>
<title><?php print($application_name); ?></title>
<link rel="stylesheet" type="text/css" href="default.css" />
</head>
<body>
<div id="header">
<h1><?php print($application_name); ?></h1>
</div>
<div id="content">
<div class="toc_title"><?php print($title); ?></div>
<div>
<ul>
<?php
$pages = 0;
$error = 0;
if (isset($_REQUEST["generate"]) && $_REQUEST["generate"] == "all") {
if (fopen($location.'index.php?type=static', r)) {
print('<li>index.html created</li>'."\n");
}
else {
print('<li><b>Error creating index.html</b></li>'."\n");
}
if ($handle = opendir($content_dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && $file != "toc.php") {
if (is_file($content_dir.$file) && strtolower(substr($file, -4, 4)) == ".php") {
if (fopen($location.'index.php?type=static&show='.substr($file, 0, (strlen($file) - 4)), r)) {
print('<li>'.substr($file, 0, (strlen($file) - 4)).'.html created</li>'."\n");
$pages++;
}
else {
print('<li><b>Error creating '.substr($file, 0, (strlen($file) - 4)).'.html</b></li>'."\n");
$error++;
}
}
}
}
closedir($handle);
}
}
else {
?>
<li><a href="static.php?generate=all">Create All Static Content</a><br /> </li>
<li><a href="index.php?type=static">index.php</a></li>
<?php
if ($handle = opendir($content_dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && $file != "toc.php") {
if (is_file($content_dir.$file) && strtolower(substr($file, -4, 4)) == ".php") {
print('<li><a href="index.php?type=static&show='.substr($file, 0, (strlen($file) - 4)).'">'.$file.'</a></li>'."\n");
}
}
}
closedir($handle);
}
}
?>
</ul>
<?php
if ($error + $pages > 0) {
print('<p>Created '.$pages.' pages ('.$error.' errors)</p>'."\n");
}
?>
</div>
</div>
<div id="footer">
<a href="http://www.alexking.org/software/phpdocsystem/">PHP Doc System</a> copyright 2003<?php date("Y") > 2003 ? print('-'.date("Y")) : print(''); ?> © Alex King. all rights reserved.<br />
<?php
$timer = microtime_diff($timer, microtime());
$timer = sprintf("%0.3f", $timer);
if ($type != "static") {
print("screen rendered in ".$timer." seconds.");
}
?>
</div>
</body>
</html>