Subversion Repositories taios

Rev

Rev 290 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
230 tom 1
<?php
2
 
3
require '../_taios.php';
4
 
486 muzer 5
if (get_magic_quotes_gpc()) {
6
    $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
7
    while (list($key, $val) = each($process)) {
8
        foreach ($val as $k => $v) {
9
            unset($process[$key][$k]);
10
            if (is_array($v)) {
11
                $process[$key][stripslashes($k)] = $v;
12
                $process[] = &$process[$key][stripslashes($k)];
13
            } else {
14
                $process[$key][stripslashes($k)] = stripslashes($v);
15
            }
16
        }
17
    }
18
    unset($process);
19
}
20
 
230 tom 21
$pageName = $_POST['page'];
22
if (empty($pageName))
23
{
24
    $pageName = 'Index';
25
}
26
 
27
$page = new Taios_Page('Edit Page - ' . $pageName, '../');
28
 
290 tom 29
$page->checkLoggedIn();
30
 
230 tom 31
if ($page->isUserGM($page->getLoggedInUser()))
32
{
486 muzer 33
    $pageName = str_replace("../", "/", $pageName);
34
 
230 tom 35
    $filename = 'pages/' . $pageName . '.txt';
486 muzer 36
 
37
    if(!is_dir(dirname($filename)))
38
        mkdir(dirname($filename), 0777, true);
230 tom 39
 
40
    $fp = @fopen($filename, 'w');
41
    if ($fp)
42
    {
43
        fwrite($fp, $_POST['content']);
44
        fclose($fp);
231 tom 45
 
46
        $page->redirect('index.php?page=' . $pageName);
230 tom 47
    }
48
    else
49
    {
50
        $page->drawError('Failed to write file.');
51
    }
52
}
53
else
54
{
55
    $page->drawError('You do not have permission to access this page.');
56
}
57
 
58
$page->drawFooter();
59
 
60
?>
61