Project

General

Profile

1 2 Manuela
<?php
2
/**
3
 *
4
 * @category        admin
5
 * @package         pages
6
 * @author          WebsiteBaker Project
7
 * @author          WebsiteBaker Project
8
 * @copyright       Ryan Djurovich
9
 * @copyright       WebsiteBaker Org. e.V.
10
 * @link            http://websitebaker.org/
11
 * @license         http://www.gnu.org/licenses/gpl.html
12
 * @platform        WebsiteBaker 2.8.3
13
 * @requirements    PHP 5.3.6 and higher
14
 * @version         $Id$
15
 * @filesource      $HeadURL$
16
 * @lastmodified    $Date$
17
 *
18
 */
19
20
// Create new admin object
21
if ( !defined( 'WB_PATH' ) ){ require( dirname(dirname((__DIR__))).'/config.php' ); }
22
if ( !class_exists('admin', false) ) { require(WB_PATH.'/framework/class.admin.php'); }
23
$admin = new admin('Pages', 'pages_intro',false);
24
if (!$admin->checkFTAN())
25
{
26
    $admin->print_header();
27
    $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL );
28
}
29
30
// Get posted content
31
if(!isset($_POST['content'])) {
32
    $admin->print_error($MESSAGE['PAGES_NOT_SAVED']);
33
    exit(0);
34
} else {
35
    $content = $admin->strip_slashes($_POST['content']);
36
}
37
38
// Include the WB functions file
39
require_once(WB_PATH.'/framework/functions.php');
40
41
$admin->print_header();
42
// Write new content
43
$filename = WB_PATH.PAGES_DIRECTORY.'/intro'.PAGE_EXTENSION;
44
if(! file_put_contents( $filename, $content )){
45
    $admin->print_error($MESSAGE['PAGES_NOT_SAVED']);
46
} else {
47
    change_mode($filename);
48
    $admin->print_success($MESSAGE['PAGES']['INTRO_SAVED']);
49
}
50
if(!is_writable($filename)) {
51
    $admin->print_error($MESSAGE['PAGES']['INTRO_NOT_WRITABLE']);
52
}
53
54
// Print admin footer
55
$admin->print_footer();