// -*- c++ -*- $included_files[] = "$topdir/faq/display-question.php3"; if ($maintdir == "") $maintdir = "admin"; if ($have_display_question_php3 == "") { $have_display_question_php3 = "1"; require("$faqtop/version.php3"); require("$lamtop/includes/mail_archives.php3"); require("$lamtop/includes/faq_link.php3"); require("$maintdir/constants.php3"); require("$classdir/Question.php3"); require("$classdir/Version.php3"); require("$classdir/VersionXref.php3"); // Function for sorting array of versions function vercompare($a, $b) { if ($a->getID() == $b->getID()) return 0; else if ($a->getMajor() > $b->getMajor()) return 1; else if ($a->getMajor() < $b->getMajor()) return -1; else if ($a->getMinor() > $b->getMinor()) return 1; else if ($a->getMinor() < $b->getMinor()) return -1; else if ($a->getRelease() > $b->getRelease()) return 1; else if ($a->getRelease() < $b->getRelease()) return -1; else if ($a->getBeta() > $b->getBeta()) return 1; else if ($a->getBeta() < $b->getBeta()) return -1; else if ($a->getPatchlevel() > $b->getPatchlevel()) return 1; else if ($a->getPatchlevel() < $b->getPatchlevel()) return -1; } // // Simple macro to start a code block // function code_start() { return "
\n
\n";
}
//
// Simple macro to end a code block
//
function code_end() {
return "\n\n";
}
function print_me($fp, $string) {
if ($fp == -1)
print($string);
else
fputs($fp, $string);
}
function display_question($q, $num, $fp = -1) {
global $disp_quest_ver_xrefs;
global $lamversion;
global $lamversiondir;
global $topdir;
$table_start = "\n| \n";
print_me($fp, $table_start);
if ($num <= 0)
print_me($fp, $q->getTitle());
else
print_me($fp, "$num. " . $q->getTitle());
$vxs = getVerXrefsByQID($q->getID());
if ($vxs[0]->isValid()) {
// Obtain all the versions
$vers = getAllVersAssoc();
// Make an array of the ones that we're interested in
for ($i = 0; $i < sizeof($vxs); $i++) {
$id = $vxs[$i]->getVersionID();
if (isset($vers[$id]) && $vers[$id]->isValid()) {
$foundvers[] = $vers[$id];
$andup[$id] = $vxs[$i]->getAndUp();
}
}
// Sort the interesting ones
if (sizeof($foundvers) > 0) {
usort($foundvers, vercompare);
// Now build the string to print -- stop when we hit a version
// that has "and up" set in it
$ver_string = "";
for ($i = 0; $i < sizeof($foundvers); $i++) {
$ver_string .= $foundvers[$i]->getName();
if ($andup[$foundvers[$i]->getID()] == 1) {
$ver_string .= " and above";
break;
}
if ($i < sizeof($foundvers) - 1)
$ver_string .= ", ";
}
// Sanity check before printing it
if ($ver_string != "") {
print_me($fp, "\n " . "Applies to LAM $ver_string"); } } } $table_end = " | \n
" . $ans . "\n\n"); } function display_question_id($qid, $num, $fp = -1) { $q = getQuestByID($qid); if (!$q->isValid()) print_me($fp, "
Sorry, this does not appear to be a valid question.\n"); else display_question($q, $num, $fp); } }