// -*- c++ -*-
$faqtop = "../..";
$lamtop = "$faqtop/..";
$maintdir = "..";
$gendir = "$faqtop";
require("$maintdir/constants.php3");
require("$authdir/get-login.php3");
get_login(true);
// If we get past here, we're logged in
do_header("Generate new static FAQ pages");
require("$faqtop/display-question.php3");
require("$classdir/System.php3");
require("$classdir/Question.php3");
require("$classdir/Category.php3");
require("$classdir/CategoryXref.php3");
$tempfile = "$gendir/lam-faq-temp." . $theUser->getID();
$months["Jan"] = 1;
$months["Feb"] = 2;
$months["Mar"] = 3;
$months["Apr"] = 4;
$months["May"] = 5;
$months["Jun"] = 6;
$months["Jul"] = 7;
$months["Aug"] = 8;
$months["Sep"] = 9;
$months["Oct"] = 10;
$months["Nov"] = 11;
$months["Dec"] = 12;
// Some helpful functions first
// Announcement
function starting($filename) {
print("
Generating $filename... \n");
}
// Announce that we're finished with a file
function ending() {
print("Completed\n\n");
}
// Write the standard header to a file
function write_header($fp, $title) {
fputs($fp, ' // -*- c++ -*-
// Automatically generated file -- DO NOT EDIT!!
// Generated on: ' . date("F d, Y") . " at ". date("H:m:s") . '
$topdir = "..";
$faqtop = ".";
$maintdir = "admin";
require("$faqtop/admin/constants.php3");
require("$faqtop/nav.php3");
$title = "' . $title . '";
include("$topdir/includes/nav_header.php3");
?>
');
}
// Write the standard footer to a file
function write_footer($fp) {
fputs($fp, '
include("$lamtop/includes/nav_footer.php3");
');
}
//
// Top-level index file
//
starting("index.php3");
$fp = fopen($tempfile, "w");
$sys = new System();
$d = $sys->getLastModDate();
if ($d == "")
$sys->update();
// $title = "LAM FAQ
Last updated: " .
// $sys->getLastModDate() . "";
$title = "LAM FAQ";
// Write the header
write_header($fp, $title);
// Write the body
// Get all the categories, and then build an array of active,
// non-empty categories
$cats = getAllCats();
$c[] = new Category("");
$sizes[] = 0;
if (sizeof($cats) > 0) {
for ($i = 0; $i < sizeof($cats); $i++) {
if ($cats[$i]->getActive() == "1") {
$foo = getCatXrefsByCID($cats[$i]->getID());
if (!$foo[0]->isValid())
$s = 0;
else {
$c[] = $cats[$i];
$sizes[] = sizeof($foo);
}
}
}
}
if (sizeof($c) > 1) {
fputs($fp, "FAQ categories available:\n\n