(root)/wiki/edit-do.php - Rev 499
Rev 290 |
Go to most recent revision |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
<?php
require '../_taios.php';
if (get_magic_quotes_gpc()) {
$process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
while (list($key, $val) = each($process)) {
foreach ($val as $k => $v) {
unset($process[$key][$k]);
if (is_array($v)) {
$process[$key][stripslashes($k)] = $v;
$process[] = &$process[$key][stripslashes($k)];
} else {
$process[$key][stripslashes($k)] = stripslashes($v);
}
}
}
unset($process);
}
$pageName = $_POST['page'];
if (empty($pageName))
{
$pageName = 'Index';
}
$page = new Taios_Page
('Edit Page - ' . $pageName, '../');
$page->checkLoggedIn();
if ($page->isUserGM($page->getLoggedInUser()))
{
$pageName = str_replace("../", "/", $pageName);
$filename = 'pages/' . $pageName . '.txt';
if(!is_dir(dirname($filename)))
mkdir(dirname($filename), 0777, true);
$fp = @fopen($filename, 'w');
if ($fp)
{
fwrite($fp, $_POST['content']);
fclose($fp);
$page->redirect('index.php?page=' . $pageName);
}
else
{
$page->drawError('Failed to write file.');
}
}
else
{
$page->drawError('You do not have permission to access this page.');
}
$page->drawFooter();
?>