<html>
<head>
<title>bbs config </title>
<link rel="stylesheet" type="text/css" href="bbs.css" />
</head>
<body>
<table><tr><td>
<b style="color: red; font-weight: bold; font-size: x-large;">Manual steps:</b><br/>
<b> cp robopages.tgz /srv/www/htdocs</b> (for instance) <br/>
<b> cd '/srv/www/htdocs/' </b> <br/>
<b> tar -xvzf robopages.tgz</b> <br/>
<b> chmod 777 sys_config.inc </b> <br/>
<b> mkdir /srv/www/htdocs/bbs</b> <br/>
<b> mkdir /srv/www/htdocs/bbs/2006</b> (2006 is the default forum, for instance)<br/>
<b> chmod -R 777 /srv/www/htdocs/bbs </b> <br/>
</td><td>
<b style="color: red; font-weight: bold; font-size: x-large;">Form notes:</b><br/>
<b> file paths must end in '/'</b><br/>
<b> home link urls should NOT end in '/'</b><br/>
<b> set sys_realhome_link same as sys_home_link for most users'/'</b><br/>
<b> sys_whoami</b> can be left blank<br/>
<b> sys_keywords</b> can be left blank<br/>
<b> sys_quote</b> in 0,1<br/>
<b> sys_show_google_ads</b> in 0,1</td></tr><table><br/><br/>
<?php
$file_widget = "sys_config.inc";
function setVal($key, $default)
{
if($_POST[$key])
$ret = $_POST[$key];
elseif($_GET[$key])
$ret = $_GET[$key];
else
$ret = $default;
return(trim($ret));
}
function file_opener ($fp)
{
print_msg($fp, '<?php');
}
function file_closer ($fp)
{
print_msg ($fp, '?>');
fclose($fp);
}
function print_msg($fp, $msg)
{
$msg = trim($msg);
$msg = $msg."\n";
fwrite ($fp, $msg);
}
function print_pair($fp, $label, $value)
{
$label = trim($label);
$value = trim($value);
$line = sprintf("\$%s='%s';\n", $label, $value);
fwrite ($fp, $line);
}
function cleanit ($msg)
{
$value = trim ($msg);
$value = ereg_replace (";", "", $value);
$value = ereg_replace ("'", "", $value);
$value = ereg_replace ('\$', "", $value);
return ($value);
}
$mode = isset($_GET['mode']) ? $_GET['mode'] : '';
if ($mode == 'write')
{
//global $file_widget;
$fp = fopen ($file_widget, "w");
file_opener($fp);
while (list ($label, $value) = each ($_POST))
{
print_pair($fp,$label,$value);
}
file_closer($fp);
$getstr = sprintf("%s?file_widget=%s", $_SERVER['PHP_SELF'], $file_widget);
}
////read the file
$lines = @file (trim($file_widget));
$dir = getcwd ();
$line = sprintf ("\$sys_this_dir_path='%s'", $dir);
$lines[] = $line;
////transfer file lines to a hashed array, to remove any duplicates
$sysvalues = array ();
while (list ($num, $line) = each ($lines))
{
$tokens = array ();
$line = cleanit ($line);
$tokens = explode ("=", $line);
$label = $tokens[0];
$value = isset($tokens[1]) ? $tokens[1] : "";
if (strstr ($line, '<?php') || strstr ($line, '?>') || !$label)
continue;
if (strstr ($label, "path") || strstr ($label, "document_root"))
{
$lastchar = strlen ($value) - 1;
if ($value[$lastchar] != "/")
$value .= "/";
}
$sysvalues[$label] = $value;
}
////offer the write to file choice
echo "<form action=\"".$_SERVER['PHP_SELF']."?mode=write&file_widget=$file_widget\" method=\"post\">\n";
//if($posted_file)
//echo "<input type=hidden name=inc value=$posted_file>";
echo "<table border=\"0\">\n";
while (list ($label, $value) = each ($sysvalues))
{
echo "<tr><td width=150 align=\"right\"> $label </td>\n";
echo "<td colspan=4><input type=text size=64 name=\"$label\" value=\"$value\"></td></tr>\n";
}
echo "</table><br/>";
echo "<table style=\"width: 50%\"><tr><td colspan=2> <input type=submit style=\"color:black; background-color:#ccab99; border-width: 5px; border-color:#bbbbdd\" value=save_config> </td>";
echo "</form>";
echo '<td colspan="2"><a href="bbs.php"><b style="font-size: x-large;">start BBS</b></a></td></tr></table>';
?>
</body>
</html>