<?php

################################################
# EVILCMS FLATFILE RECODE - 100% FUNCTIONALITY #
################################################

Session_Start();

If($CMS->LoggedIn):
	If($_USER['rank'] == "admin") {
		If(isset($_POST['edArticle'])) {
			$fileHandler = fopen($CMS->Conf['NEWSFILE'], "w");
			fwrite($fileHandler, $_POST['edArticle']);
			fclose($fileHandler);
			Echo "Article(s) updated.<br />";
		}
		Echo "<form method=\"post\" action=\"?p=editarticles\">";
		Echo "<textarea name=\"edArticle\" style=\"height: 200px; width: 400px;\">";
		Echo str_ireplace("</textarea>", "&lt;/textarea&gt;", file_get_contents($CMS->Conf['NEWSFILE']));
		Echo "</textarea><br />";
		Echo "<input type=\"submit\" value=\"Update\">";
		Echo "</form>";
	}else{
		Echo "You dont have sufficient rights.";
	}
Else:
	Echo "Please login first.";
EndIf;

?>