<?php
include_once('./admin_header.php');

if (!$HTTP_POST_VARS['submit']) {

if ($newbbConfig['disc_show'] == 1) {
	$sel1 = " selected='selected'";
	} else if ($newbbConfig['disc_show'] == 2) {
		$sel2 = " selected='selected'";
		} else if ($newbbConfig['disc_show'] == 3) {
			$sel3 = " selected='selected'";
		}

$img_set = XoopsLists::getDirListAsArray("../images/imagesets/");

  echo '<table border="0" cellpadding="0" cellspacing="0" align="center" valign="top" width="100%"><tr><td class="bg2">';
  echo '<table border="0" cellpadding="4" cellspacing="1" width="100%">';
  echo '<tr class="bg3" align="center"><td colspan=7><b>'._MD_A_CONFIGFORUM.'</b></td></tr>';
  echo "</table>";
  echo "</table>";
  echo "<br><br>";

?>
<form method="post" action="forum_config.php">
<table width="100%" border="0" cellspacing="0" cellpadding="5"><tr>
<td width="30%"><?php echo _MD_A_IMG_SET;?>:</td>
<td><select class="select" name="image_set">
<?php
foreach ($img_set as $key) {
	echo "<option value='$key'";
	if ($newbbConfig['image_set'] == $key) {
		echo " selected='selected'";
	}
	echo ">$key</option>";
}
?>
</select></td>
</tr>
<tr>
<td><?php echo _MD_A_MAX_IMG_WIDTH;?></td>
<td><input type="text" class="text" name="max_img_width" value="<?php echo $newbbConfig['max_img_width'];?>"></td>
</tr>
<tr>
<td colspan="2"><hr size="1" noshade="noshade" /></td>
</tr><tr>
<td><?php echo _MD_A_SHOW_DIS;?>:</td>
<td><select class="select" name="disc_show">
<option value="0"><?php echo _NONE;?></option>
<option value="1"<?php echo $sel1;?>><?php echo _POST;?></option>
<option value="2"<?php echo $sel2;?>><?php echo _REPLY;?></option>
<option value="3"<?php echo $sel3;?>><?php echo _MD_A_BOTH;?></option>
</select></td>
</tr><tr>
<td valign="top"><?php echo _MD_A_DISCLAIMER;?>:</td>
<td>
<?php
$disclaimer = join('', file("../cache/disclaimer.php"));
$disclaimer = trim($disclaimer);
$desc       = new XoopsFormDhtmlTextArea('', 'disclaimer', $disclaimer, 10, 50);
echo $desc->render();
echo "<br /><br />";
echo _ALLOWEDHTML."<br />";
echo get_allowed_html();
?>
</td>
</tr>
<tr>
<td valign="top"><?php echo _MD_A_RSS_ENABLE;?>:</td>
<td valign="top"><input type='checkbox' name='rss_enable' <?php echo $newbbConfig['rss_enable'] ? 'checked' : ''; ?>></td>
</tr>
<tr>
<td valign="top"><?php echo _MD_A_RSS_MAX_ITEMS;?>:</td>
<td valign="top"><input type='text' class='text' name='rss_maxitems' value='<?php echo $newbbConfig['rss_maxitems']; ?>'></td>
</tr>
<tr>
<td valign="top"><?php echo _MD_A_RSS_MAX_DESCRIPTION;?>:</td>
<td valign="top"><input type='text' class='text' name='rss_maxdescription' value='<?php echo $newbbConfig['rss_maxdescription']; ?>'></td>
</tr>
<tr>
<td valign="top"><?php echo _MD_A_ALLOW_POSTANON;?>:</td>
<td valign="top"><input type='checkbox' class='checkbox' name='post_anon' <?php echo $newbbConfig['post_anon'] ? 'checked' : ''; ?>'></td>
</tr>
<tr>
<td colspan="2"><hr size="1" noshade="noshade" /></td>
</tr>
<tr>
<td valign="top"><?php echo _MD_A_WOL_ENABLE;?>:</td>
<td valign="top"><input type='checkbox' name='wol_enabled' <?php echo $newbbConfig['wol_enabled'] ? 'checked' : ''; ?>></td>
</tr>
<tr>
<td valign="top"><?php echo _MD_A_WOL_ADMIN_COL;?>:</td>
<td valign="top"><input type='text' class='text' name='wol_admin_col' value='<?php echo $newbbConfig['wol_admin_col']; ?>'></td>
</tr>
<tr>
<td valign="top"><?php echo _MD_A_WOL_MOD_COL;?>:</td>
<td valign="top"><input type='text' class='text' name='wol_mod_col' value='<?php echo $newbbConfig['wol_mod_col']; ?>'></td>
</tr>
<tr>
<td colspan="2"><hr size="1" noshade="noshade" /></td>
</tr>
<tr>
<td valign="top"><?php echo _MD_A_LEVELS_ENABLE;?>:</td>
<td valign="top"><input type='checkbox' name='levels_enabled' <?php echo $newbbConfig['levels_enabled'] ? 'checked' : ''; ?>></td>
</tr>
<tr>
<td colspan="2" align="center">
<br>
<input type="hidden" name="mode" value="config">
<input type="submit" class="button" name="submit" value="<?php echo _SAVE;?>">
</td>
</tr>
</form></table>

<?php
} else {
$content  = "<?php\n";
$content .= "\$newbbConfig['disc_show'] = ".intval($HTTP_POST_VARS['disc_show']).";\r\n";
$content .= "\$newbbConfig['image_set'] = '".$myts->makeTboxData4Save($HTTP_POST_VARS['image_set'])."';\r\n";
$content .= "\$newbbConfig['max_img_width'] = ".intval($HTTP_POST_VARS['max_img_width']).";\r\n";
$content .= "\$newbbConfig['post_anon'] = ".($HTTP_POST_VARS['post_anon']=='on' ? 1 : 0).";\n";
$content .= "\$newbbConfig['wol_enabled'] = ".($HTTP_POST_VARS['wol_enabled']=='on' ? 1 : 0).";\n";
$content .= "\$newbbConfig['wol_admin_col'] = '".$myts->makeTboxData4Save($HTTP_POST_VARS['wol_admin_col'])."';\r\n";
$content .= "\$newbbConfig['wol_mod_col'] = '".$myts->makeTboxData4Save($HTTP_POST_VARS['wol_mod_col'])."';\r\n";
$content .= "\$newbbConfig['levels_enabled'] = ".($HTTP_POST_VARS['levels_enabled']=='on' ? 1 : 0).";\n";
$content .= "\$newbbConfig['rss_enable'] = ".($HTTP_POST_VARS['rss_enable']=='on' ? 1 : 0).";\r\n";
$content .= "\$newbbConfig['rss_maxitems'] = ".intval($HTTP_POST_VARS['rss_maxitems']).";\r\n";;
$content .= "\$newbbConfig['rss_maxdescription'] = ".intval($HTTP_POST_VARS['rss_maxdescription']).";\r\n";;

$content .= "?>";

$filename = "../cache/config.php";
if ( $file = fopen($filename, "w") ) {
	fwrite($file, $content);
	fclose($file);
	} else {
		redirect_header("index.php", 1, _NOTUPDATED);
		exit();
	}

$filename = "../cache/disclaimer.php";
if ( $file = fopen($filename, "wb") ) {
	$disclaimer = $myts->oopsStripSlashesGPC($HTTP_POST_VARS['disclaimer']);
	fwrite($file, $disclaimer);
	fclose($file);
	} else {
		redirect_header("index.php", 1, _NOTUPDATED);
		exit();
}

redirect_header("index.php", 1, _UPDATED);
exit();
}

CloseTable();
xoops_cp_footer();
exit();

?>
