<?php
session_start();
include('classes/auth.php');
include('classes/access.php');
include('classes/header.php');
require_once('classes/content.php');
require_once('classes/conf.php');

if($_REQUEST['pagekey'])
$key = $_REQUEST['pagekey'];

if($_POST['pagekey'])
$key = $_POST['pagekey'];

$content = new content(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE, $key);

if($_POST['pagekey']) {
	if($content->write($_POST['title'], $_POST['bodytext']))
	echo 'Saved';
}

echo $content->display_editor();

include('classes/footer.php');
?>
