Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        backend
5
 * @package         wysiwyg
6
 * @author          WebsiteBaker Project
7
 * @copyright       2009-2013, WebsiteBaker Org. e.V.
8
 * @link            http://www.websitebaker.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.4
11
 * @requirements    PHP 5.2.2 and higher
12
 * @version         $Id: save.php 1910 2013-06-07 03:14:18Z Luisehahne $
13
 * @filesource      $HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/modules/wysiwyg/save.php $
14
 * @lastmodified    $Date: 2013-06-07 05:14:18 +0200 (Fri, 07 Jun 2013) $
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
if (!$admin->checkFTAN()) {
28
	$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
$aErrors = array();
37
//$sMediaUrl = WB_URL.MEDIA_DIRECTORY;
38
// Update the mod_wysiwygs table with the contents
39
if(isset($_POST['content'.$section_id])) {
40
	$content = $_POST['content'.$section_id];
41
	$content = $admin->ReplaceAbsoluteMediaUrl($content);
42
	// searching in $text will be much easier this way
43
	$content = WbDatabase::getInstance()->escapeString ($content);
44
	$text = umlauts_to_entities(strip_tags($content), strtoupper(DEFAULT_CHARSET), 0);
45
	$sql  = 'UPDATE `'.TABLE_PREFIX.'mod_wysiwyg` ';
46
	$sql .= 'SET `content`=\''.$content.'\', `text`=\''.$text.'\' ';
47
	$sql .= 'WHERE `section_id`='.(int)$section_id;
48
	if(!WbDatabase::getInstance()->query($sql)){
49
		$aErrors[] = $MESSAGE['GENERIC_NOT_UPGRADED'].((defined('DEBUG') && DEBUG) ? '<br />'.WbDatabase::getInstance()->get_error() : '');
50
	}
51
} else {
52
	$aErrors[] = $MESSAGE['GENERIC_NOT_UPGRADED'].((defined('DEBUG') && DEBUG) ? '<br />'.$MESSAGE['FRONTEND_SORRY_NO_ACTIVE_SECTIONS'] : '');
53
}
54

    
55
$sSectionIdPrefix = ( defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? SEC_ANCHOR : 'Sec' );
56
if(defined('EDIT_ONE_SECTION') and EDIT_ONE_SECTION){
57
	$edit_page = ADMIN_URL.'/pages/modify.php?page_id='.$page_id.'&wysiwyg='.$section_id;
58
} else {
59
	$edit_page = ADMIN_URL.'/pages/modify.php?page_id='.$page_id.'#'.$sSectionIdPrefix.$section_id;
60
}
61

    
62
// Check if there is a database error, otherwise say successful
63
if(sizeof($aErrors) ) {
64
	$admin->print_error( implode('<br />',$aErrors), $edit_page);
65
} else {
66
	$admin->print_success($MESSAGE['GENERIC_UPGRADED'], $edit_page );
67
}
68

    
69
// Print admin footer
70
$admin->print_footer();
(7-7/10)