Rev 486 | 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 | { |
||
522 | muzer | 33 | while (strpos($pageName, '../') !== false) { |
34 | $pageName = str_replace("../", "/", $pageName); |
||
35 | } |
||
486 | muzer | 36 | |
230 | tom | 37 | $filename = 'pages/' . $pageName . '.txt'; |
486 | muzer | 38 | |
39 | if(!is_dir(dirname($filename))) |
||
40 | mkdir(dirname($filename), 0777, true); |
||
230 | tom | 41 | |
42 | $fp = @fopen($filename, 'w'); |
||
43 | if ($fp) |
||
44 | { |
||
45 | fwrite($fp, $_POST['content']); |
||
46 | fclose($fp); |
||
231 | tom | 47 | |
48 | $page->redirect('index.php?page=' . $pageName); |
||
230 | tom | 49 | } |
50 | else |
||
51 | { |
||
52 | $page->drawError('Failed to write file.'); |
||
53 | } |
||
54 | } |
||
55 | else |
||
56 | { |
||
57 | $page->drawError('You do not have permission to access this page.'); |
||
58 | } |
||
59 | |||
60 | $page->drawFooter(); |
||
61 | |||
62 | ?> |
||
63 |