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


if ($HTTP_POST_VARS['submit'])
{
$content  = "<?php\r\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'] = ".intval($HTTP_POST_VARS['post_anon']).";\r\n";
$content .= "\$newbbConfig['wol_enabled'] = ".intval($HTTP_POST_VARS['wol_enabled']).";\r\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'] = ".intval($HTTP_POST_VARS['levels_enabled']).";\r\n";
$content .= "\$newbbConfig['rss_enable'] = ".intval($HTTP_POST_VARS['rss_enable']).";\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 .= "\$newbbConfig['similar_threads'] = ".intval($HTTP_POST_VARS['similar_threads']).";\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();
}


include_once(XOOPS_ROOT_PATH.'/class/xoopsformloader.php');

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 />";

$cfg_form = new XoopsThemeForm('', 'cfg_form', 'forum_config.php');

// General Options
$cfg_form->addElement(new XoopsFormLabel(_MD_A_GENERAL_OPTS.":"));
$cfg_form->addElement(new XoopsFormRadioYN(_MD_A_ALLOW_POSTANON,'post_anon',$newbbConfig['post_anon']));
$cfg_form->addElement(new XoopsFormRadioYN(_MD_A_LEVELS_ENABLE,'levels_enabled',$newbbConfig['levels_enabled']));
$img_sets = XoopsLists::getDirListAsArray("../images/imagesets/");
$img_set_sel = new XoopsFormSelect(_MD_A_IMG_SET, image_set, $newbbConfig['image_set']);
$img_set_sel->addOptionArray($img_sets);
$cfg_form->addElement($img_set_sel);
$cfg_form->addElement(new XoopsFormText(_MD_A_MAX_IMG_WIDTH,'max_img_width',10,10,$newbbConfig['max_img_width']));
$cfg_form->addElement(new XoopsFormRadioYN(_MD_A_ALLOW_SIMILAR_THREADS,'similar_threads',$newbbConfig['similar_threads']));

// Disclaimer
$cfg_form->addElement(new XoopsFormLabel(_MD_A_DISCLAIMER.":"));
$show_dislcaimer = new XoopsFormSelect(_MD_A_SHOW_DIS, "disc_show", $newbbConfig['disc_show']);
$show_dislcaimer->addOption(0,  _NONE);
$show_dislcaimer->addOption(1,  _POST);
$show_dislcaimer->addOption(2,  _REPLY);
$show_dislcaimer->addOption(3,  _MD_A_BOTH);
$cfg_form->addElement($show_dislcaimer);
$disclaimer = join('', file("../cache/disclaimer.php"));
$disclaimer = trim($disclaimer);
$desc       = new XoopsFormDhtmlTextArea(_MD_A_DISCLAIMER, 'disclaimer', $disclaimer, 10, 50);
$cfg_form->addElement($desc);


// RSS Feed
$cfg_form->addElement(new XoopsFormLabel(_MD_A_RSS_OPTS.":"));
$cfg_form->addElement(new XoopsFormRadioYN(_MD_A_RSS_ENABLE,'rss_enable',$newbbConfig['rss_enable']));
$cfg_form->addElement(new XoopsFormText(_MD_A_RSS_MAX_ITEMS,'rss_maxitems',10,10,$newbbConfig['rss_maxitems']));
$cfg_form->addElement(new XoopsFormText(_MD_A_RSS_MAX_DESCRIPTION,'rss_maxdescription',10,10,$newbbConfig['rss_maxdescription']));


// Who's Online
$cfg_form->addElement(new XoopsFormLabel(_MD_A_WOL_OPTS.":"));
$cfg_form->addElement(new XoopsFormRadioYN(_MD_A_WOL_ENABLE,'wol_enabled',$newbbConfig['wol_enabled']));
$cfg_form->addElement(new XoopsFormText(_MD_A_WOL_ADMIN_COL,'wol_admin_col',10,10,$newbbConfig['wol_admin_col']));
$cfg_form->addElement(new XoopsFormText(_MD_A_WOL_MOD_COL,'wol_mod_col',10,10,$newbbConfig['wol_mod_col']));


$cfg_form->addElement(new XoopsFormButton('','submit',_SAVE, 'submit'));
echo $cfg_form->render();


CloseTable();
xoops_cp_footer();
exit();
?>
