Project

General

Profile

1 1457 Luisehahne
<?php
2
/**
3
 *
4
 * @category        backend
5
 * @package         wysiwyg
6
 * @author          WebsiteBaker Project
7 1910 Luisehahne
 * @copyright       2009-2013, WebsiteBaker Org. e.V.
8
 * @link            http://www.websitebaker.org/
9 1457 Luisehahne
 * @license         http://www.gnu.org/licenses/gpl.html
10 1910 Luisehahne
 * @platform        WebsiteBaker 2.8.4
11 1457 Luisehahne
 * @requirements    PHP 5.2.2 and higher
12
 * @version         $Id$
13 1910 Luisehahne
 * @filesource      $HeadURL$
14 1457 Luisehahne
 * @lastmodified    $Date$
15
 *
16
*/
17
18
require('../../config.php');
19
20
// suppress to print the header, so no new FTAN will be set
21
$admin_header = false;
22
// Tells script to update when this page was last updated
23
$update_when_modified = true;
24
// Include WB admin wrapper script
25
require(WB_PATH.'/modules/admin.php');
26
27 1581 darkviper
if (!$admin->checkFTAN()) {
28 1457 Luisehahne
	$admin->print_header();
29
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
30
}
31
// After check print the header
32
$admin->print_header();
33
34
// Include the WB functions file
35
require_once(WB_PATH.'/framework/functions.php');
36 1640 Luisehahne
$aErrors = array();
37 1910 Luisehahne
//$sMediaUrl = WB_URL.MEDIA_DIRECTORY;
38 1457 Luisehahne
// Update the mod_wysiwygs table with the contents
39
if(isset($_POST['content'.$section_id])) {
40 1875 Luisehahne
	$content = $_POST['content'.$section_id];
41 1910 Luisehahne
	$content = $admin->ReplaceAbsoluteMediaUrl($content);
42 1457 Luisehahne
	// searching in $text will be much easier this way
43 1875 Luisehahne
	$content = WbDatabase::getInstance()->escapeString ($content);
44 1697 Luisehahne
	$text = umlauts_to_entities(strip_tags($content), strtoupper(DEFAULT_CHARSET), 0);
45 1581 darkviper
	$sql  = 'UPDATE `'.TABLE_PREFIX.'mod_wysiwyg` ';
46
	$sql .= 'SET `content`=\''.$content.'\', `text`=\''.$text.'\' ';
47
	$sql .= 'WHERE `section_id`='.(int)$section_id;
48 1875 Luisehahne
	if(!WbDatabase::getInstance()->query($sql)){
49
		$aErrors[] = $MESSAGE['GENERIC_NOT_UPGRADED'].((defined('DEBUG') && DEBUG) ? '<br />'.WbDatabase::getInstance()->get_error() : '');
50 1640 Luisehahne
	}
51
} else {
52
	$aErrors[] = $MESSAGE['GENERIC_NOT_UPGRADED'].((defined('DEBUG') && DEBUG) ? '<br />'.$MESSAGE['FRONTEND_SORRY_NO_ACTIVE_SECTIONS'] : '');
53 1457 Luisehahne
}
54
55 1910 Luisehahne
$sSectionIdPrefix = ( defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? SEC_ANCHOR : 'Sec' );
56 1581 darkviper
if(defined('EDIT_ONE_SECTION') and EDIT_ONE_SECTION){
57 1875 Luisehahne
	$edit_page = ADMIN_URL.'/pages/modify.php?page_id='.$page_id.'&wysiwyg='.$section_id;
58 1457 Luisehahne
} else {
59 1910 Luisehahne
	$edit_page = ADMIN_URL.'/pages/modify.php?page_id='.$page_id.'#'.$sSectionIdPrefix.$section_id;
60 1457 Luisehahne
}
61
62
// Check if there is a database error, otherwise say successful
63 1640 Luisehahne
if(sizeof($aErrors) ) {
64
	$admin->print_error( implode('<br />',$aErrors), $edit_page);
65 1457 Luisehahne
} else {
66 1640 Luisehahne
	$admin->print_success($MESSAGE['GENERIC_UPGRADED'], $edit_page );
67 1457 Luisehahne
}
68
69
// Print admin footer
70
$admin->print_footer();