website/doc_cvars.php
2011-12-11 18:19:48 +09:00

50 lines
1.6 KiB
PHP

<? // Preamble
$program = addSlashes ($_REQUEST['program']);
$pageName = "CVAR Documentation for " . $program;
require "parts/preamble.php"; // Load most of document
have ('cvar');
function printRow ($flags, $name, $description)
{
echo '<TR vAlign="top"><TD>' . $flags . '</TD><TD>' . $name . '</TD><TD>' . $description . '</TD></TR>';
}
function printArray ($cvar_list, $program)
{
tableBoxHeader ('black', tableHeadColor);
tableTitle ("cvars available in " . $program, 3, tableHeadColor);
printRow ('flags', 'name', 'description');
while (list (, $cvar) = each ($cvar_list)) {
$flags = str_replace (' ', '&nbsp;', substr ($cvar, 0, 4));
$pos = strpos ($cvar, ':');
$name = trim (substr ($cvar, 5, $pos - 6));
$description = trim (substr ($cvar, $pos + 1));
printRow ($flags, $name, $description);
}
tableBoxFooter ();
}
function printCvarlist ($program)
{
$cvar_list = file ('doc/' . $program . '-cvar.txt');
printArray ($cvar_list, $program);
}
if (strchr ($program, '.') || strchr ($program, '/') || !is_file ('doc/' . $program . '-cvar.txt')) {
echo 'no such program.';
} else {
tableBoxHeader ('black', tableHeadColor);
tableTitle ("cvar flags", 2, tableHeadColor);
echo '<TR><TD>r</TD><TD>read only. Must be set on command line or in the config file.</TD></TR>';
echo '<TR><TD>*</TD><TD>Archived. Will be saved to config.cfg.</TD></TR>';
echo '<TR><TD>u</TD><TD>Userinfo. Changes will be sent to the server.</TD></TR>';
echo '<TR><TD>s</TD><TD>Serverinfo. Changes will be sent to the clients.</TD></TR>';
tableBoxFooter ();
echo '<P></P>';
printCvarlist ($program);
}
?>