<?
function smarty_function_admin_schema_save($params, &$smarty) {
	//
	global $section;
	$schema = HOME_DIR."data/".$section."/schema/schema.php";
	$new_schema = $_POST['schema'];
	$smarty->assign("success", "unknown problem.");
	
	print_r($_POST);
	die();
	//
	if(@copy($schema, $schema.".backup_".time())) {
		$handle = fopen($schema, "w");
		if(@fwrite($handle, $new_schema)) {
			fclose($handle);
			$smarty->assign("success", "true");
		} else {
			$smarty->assign("success", "problem saving");
		}
	} else {
		$smarty->assign("success", "problem with backup");
	}
}
?>