<?php
/**
 *
 * @category        admin
 * @package         pages
 * @author          WebsiteBaker Project
 * @author          WebsiteBaker Project
 * @copyright       Ryan Djurovich
 * @copyright       WebsiteBaker Org. e.V.
 * @link            http://websitebaker.org/
 * @license         http://www.gnu.org/licenses/gpl.html
 * @platform        WebsiteBaker 2.8.3
 * @requirements    PHP 5.3.6 and higher
 * @version         $Id: intro2.php 2 2017-07-02 15:14:29Z Manuela $
 * @filesource      $HeadURL: svn://isteam.dynxs.de/wb/2.10.x/trunk/admin/pages/intro2.php $
 * @lastmodified    $Date: 2017-07-02 17:14:29 +0200 (Sun, 02 Jul 2017) $
 *
 */

// Create new admin object
if ( !defined( 'WB_PATH' ) ){ require( dirname(dirname((__DIR__))).'/config.php' ); }
if ( !class_exists('admin', false) ) { require(WB_PATH.'/framework/class.admin.php'); }
$admin = new admin('Pages', 'pages_intro',false);
if (!$admin->checkFTAN())
{
    $admin->print_header();
    $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL );
}

// Get posted content
if(!isset($_POST['content'])) {
    $admin->print_error($MESSAGE['PAGES_NOT_SAVED']);
    exit(0);
} else {
    $content = $admin->strip_slashes($_POST['content']);
}

// Include the WB functions file
require_once(WB_PATH.'/framework/functions.php');

$admin->print_header();
// Write new content
$filename = WB_PATH.PAGES_DIRECTORY.'/intro'.PAGE_EXTENSION;
if(! file_put_contents( $filename, $content )){
    $admin->print_error($MESSAGE['PAGES_NOT_SAVED']);
} else {
    change_mode($filename);
    $admin->print_success($MESSAGE['PAGES']['INTRO_SAVED']);
}
if(!is_writable($filename)) {
    $admin->print_error($MESSAGE['PAGES']['INTRO_NOT_WRITABLE']);
}

// Print admin footer
$admin->print_footer();
