<?
ob_end_clean();
$sys['fullPath'] = gluePath($permissions['path'], $sys['path']);

if ($_GET['filename']) {
	$sys['filename'] = $_GET['filename'];
} else {
	$sys['filename'] = $_POST['filename'];
}
$sys['filename'] = $str->fromHTML($sys['filename']);

if (!isCleanFilename($sys['filename'])){
	$msg = $lang->get("A file or folder name cannot contain any of the following characters: \ / : * ? < > | &quot");
	$statusBarMessage[] = array($msg, 1);
	$cancelActing = true;
}



$filepath = gluePath($sys['fullPath'], $sys['filename']);

if ($_GET['new']) {
$showTextFromFile = false;
} else {
$showTextFromFile = true;
}


if ($_GET['action']) {
	$showTextFromFile = false;
	if (!$cancelActing) {

		if ($permissions['readonly']) {
			$msg = $lang->get("You are not allowed to modify or create files.");
			$statusBarMessage[] = array($msg, 0);
		} else {
			if ($_GET['action'] == "new") {
				require_once(gluePath($sys['root'], "system/includes/edittext/actions/createnew.inc"));
			} else {
				require_once(gluePath($sys['root'], "system/includes/edittext/actions/saveexisting.inc"));
			}
		}
	}
}

if ($showTextFromFile) {
	if (!file_exists($filepath)) {
		$msg = $lang->get("The file named \"%1\" does not exist anymore.", array($sys['filename']));
		$statusBarMessage[] = array($msg, 1);
		$_GET['new'] = "1";
	}
}
require_once(gluePath($sys['root'], "system/includes/edittext/editor.inc"));


?>