<?php
// $Id: main.php,v 1.1 2004/10/13 12:00:05 Farsus Exp $
// -------------------------------------------------------------------------//
//			       RUNCMS                                                   //
//                                                                          //
//	 reliable - Unique - Nocost &  Simplicity & ease off use                //
//                       < http://www.runcms.org >                          //
// -------------------------------------------------------------------------//
// Original Author: Farsus
// Author Website : http://www.runcms.org
// License Type   : LGPL
// ------------------------------------------------------------------------- //

if ( !preg_match("/admin\.php/i", _PHP_SELF) ) {
	exit();
	}

if ( $xoopsUser->isAdmin($xoopsModule->mid()) ) {
	xoops_cp_header();

// ----------------------------------------------------------------------------------------//
function make_menu() {
global $myts;

OpenTable();
?>
<table align="center">
<div align="center">
<h3><u><?php echo _MI_DIS_NAME;?></u></h3>
<hr size="1" noshade="noshade" />
</div>
<form name="settings" action="./admin.php?fct=disclaimer" method="post">
<div align="center">
<textarea class="textarea" name="disclaimer" rows="20" cols="80">
<?php readfile("./cache/disclaimer.php");?>
</textarea>
</div><br>
<tr align="center" valign="middle">
<td colspan="4"><input type="submit" class="button" name="submit" value="<?php echo _AM_UPDATE;?>" /></td>
</tr>
</form></table>
<?php
echo _MI_DIS_NAME . " &copy; 2004 <a href='http://www.runcms.org' target='_blank'>www.runcms.org</a>";
CloseTable();
}
// ----------------------------------------------------------------------------------------//
function write_file($file, $content, $mode='wb') {

$file = fopen('./cache/'.$file.'.php', $mode);
fwrite($file, trim($content) );
fclose($file);
} 
// ----------------------------------------------------------------------------------------//
function write_disc() {
global $HTTP_POST_VARS, $myts;

write_file("disclaimer", $content, "w");
$content = $myts->oopsStripSlashesGPC($HTTP_POST_VARS["disclaimer"]);
write_file("disclaimer", $content, "wb");
}
// ----------------------------------------------------------------------------------------//

function clean_text($text) {
global $myts;

$text = $myts->oopsStripSlashesGPC($text);
$text = str_replace('"', "", $text);
return $text;
}
// ----------------------------------------------------------------------------------------//
switch($HTTP_POST_VARS[submit])
	{
 case _AM_MERGE:
if ($HTTP_POST_VARS["which"] && $HTTP_POST_FILES["merge"]["name"] && preg_match("/text\/plain/i", $HTTP_POST_FILES["merge"]["type"])) {
	if (function_exists('move_uploaded_file')) {
		$copymode = 'move_uploaded_file';
		} else {
			$copymode = 'copy';
		}
	$copymode($HTTP_POST_FILES["merge"]["tmp_name"], XOOPS_ROOT_PATH.'/modules/system/cache/merge.tmp');
	merge(XOOPS_ROOT_PATH.'/modules/system/cache/merge.tmp', $HTTP_POST_VARS["which"]);
	@unlink(XOOPS_ROOT_PATH.'/modules/system/cache/merge.tmp');
}
make_menu();
break;

case _AM_UPDATE:
write_disc();
make_menu();
break;


default:
make_menu();
break;
}
// ----------------------------------------------------------------------------------------//
xoops_cp_footer();
	} else {
		echo "Access Denied";
	}
?>
