<?php
// PHP Doc System
// version 1.5.2, 2006-04-05
//
// Copyright (c) 2003-2006 Alex King
// http://www.alexking.org/software/phpdocsystem/
//
// **********************************************************************
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
// *****************************************************************
ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL);
$timer = microtime(); // start page timer
require_once('config.inc.php');
require_once('objects.inc.php');
require_once('functions.inc.php');
require_once($content_dir.'toc.php');
$err_msgs = array();
// override type if passed in (create static content)
if (isset($_REQUEST["type"])) {
$type = $_REQUEST["type"];
$toc_link = "index.html";
}
else {
$type = "dynamic";
$toc_link = "index.php";
}
$module = get_module();
if ($module != false) {
require_once($content_dir.$module.'.php');
$title = $application_name.': '.$$module->title;
}
else {
$title = $application_name;
}
ob_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- created with PHP Doc System
http://www.alexking.org/software/phpdocsystem/ -->
<html>
<head>
<title><?php print($title); ?></title>
<link rel="stylesheet" type="text/css" href="default.css" />
</head>
<body>
<div id="header">
<a href="<?php print($toc_link); ?>">Table of Contents</a>
<h1><?php print($title); ?></h1>
</div>
<?php
foreach ($err_msgs as $error) {
print('<p>'.$error.'</p>');
}
// show the content
if ($module != false) {
print(' <div id="content">'."\n");
show_module($$module);
show_prev_next($module);
$file_URL = $content_dir.$module.'.php';
}
else {
print(' <div id="content_home">'."\n");
print('<div class="toc">'."\n"
.'<h2>Table of Contents</h2>'."\n"
);
show_toc();
$file_URL = $content_dir.'toc.php';
print('</div>');
}
?>
<p id="last_modified">Last Modified: <?php print(date("F j, Y @ g:i a", filemtime($file_URL))); ?></p>
</div>
<div id="footer">
<a href="http://www.alexking.org/software/phpdocsystem/">PHP Doc System</a> Copyright 2003-2004 © 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>
<?php
$page = ob_get_contents();
ob_end_clean();
print($page);
if (!$module) {
$module = "index";
}
if ($type == "static") {
$file = fopen($output_dir.$module.'.html','w');
if (!fwrite($file, $page)) {
print('Error writing to '.$output_dir.$module.'.html');
}
fclose($file);
}
?>