Project

General

Profile

1 4 ryan
<?php
2
3 47 stefan
// $Id$
4 4 ryan
5
/*
6
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2005, Ryan Djurovich
9
10
 Website Baker is free software; you can redistribute it and/or modify
11
 it under the terms of the GNU General Public License as published by
12
 the Free Software Foundation; either version 2 of the License, or
13
 (at your option) any later version.
14
15
 Website Baker is distributed in the hope that it will be useful,
16
 but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 GNU General Public License for more details.
19
20
 You should have received a copy of the GNU General Public License
21
 along with Website Baker; if not, write to the Free Software
22
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23
24
*/
25
26
// Get posted content
27
if(!isset($_POST['content'])) {
28
	header("Location: intro.php");
29
} else {
30 47 stefan
	$content = htmlspecialchars($_POST['content']);
31 4 ryan
}
32
33
// Create new admin object
34
require('../../config.php');
35
require_once(WB_PATH.'/framework/class.admin.php');
36
$admin = new admin('Pages', 'pages_intro');
37
38
// Include the WB functions file
39
require_once(WB_PATH.'/framework/functions.php');
40
41
// Write new content
42
$filename = WB_PATH.PAGES_DIRECTORY.'/intro.php';
43
$handle = fopen($filename, 'w');
44
if(is_writable($filename)) {
45
	if(fwrite($handle, $content)) {
46
		fclose($handle);
47
		change_mode($filename, 'file');
48
		$admin->print_success($MESSAGE['PAGES']['INTRO_SAVED']);
49
	} else {
50
		fclose($handle);
51
		$admin->print_error($MESSAGE['PAGES']['INTRO_NOT_WRITABLE']);
52
	}
53
} else {
54
	$admin->print_error($MESSAGE['PAGES']['INTRO_NOT_WRITABLE']);
55
}
56
57
// Print admin footer
58
$admin->print_footer();
59
60 47 stefan
?>