website/doc_cvars.php
Jeff Teunissen 9e6f75ccbd Update for PHP 7.x
PHP 7 doesn't like the old short tags we were using (it's possible to re-enable
them, but won't be for version 8, so we might as well switch now), and the old
MySQL APIs are now gone entirely, replaced with something different.

This should make everything work at least as well as it used to.

Also, one file used to be checked in with CRLF line endings. ??
2022-04-27 13:14:47 -04:00

50 lines
1.6 KiB
PHP

<?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);
}
?>