Project

General

Profile

« Previous | Next » 

Revision 1581

Added by darkviper almost 13 years ago

some little fixes in wysiwyg module

View differences:

save.php
24 24
// Include WB admin wrapper script
25 25
require(WB_PATH.'/modules/admin.php');
26 26

  
27
if (!$admin->checkFTAN())
28
{
27
if (!$admin->checkFTAN()) {
29 28
	$admin->print_header();
30 29
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
31 30
}
......
35 34
// Include the WB functions file
36 35
require_once(WB_PATH.'/framework/functions.php');
37 36

  
38
$MEDIA_URL = WB_URL.MEDIA_DIRECTORY;
37
$sMediaUrl = WB_URL.MEDIA_DIRECTORY;
39 38
// Update the mod_wysiwygs table with the contents
40 39
if(isset($_POST['content'.$section_id])) {
41 40
    $content = $_POST['content'.$section_id];
42
    $searchfor = '#(<.*= *\")('.quotemeta($MEDIA_URL).')(.*\".*>)#iU';
41
	$searchfor = '@(<[^>]*=\s*")('.preg_quote($sMediaUrl).')([^">]*".*>)@siU';
43 42
    $content = preg_replace($searchfor, '$1{SYSVAR:MEDIA_REL}$3', $content);
44
    $content = $admin->add_slashes($content);
45 43
	// searching in $text will be much easier this way
46 44
	$text = umlauts_to_entities(strip_tags($content), strtoupper(DEFAULT_CHARSET), 0);
47
	$query = "UPDATE ".TABLE_PREFIX."mod_wysiwyg SET content = '$content', text = '$text' WHERE section_id = '$section_id'";
48
	$database->query($query);	
45
    $content = $admin->add_slashes($content);
46
	$sql  = 'UPDATE `'.TABLE_PREFIX.'mod_wysiwyg` ';
47
	$sql .= 'SET `content`=\''.$content.'\', `text`=\''.$text.'\' ';
48
	$sql .= 'WHERE `section_id`='.(int)$section_id;
49
	$database->query($sql);
49 50
}
50 51

  
51 52
$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : '' );
52
if(defined('EDIT_ONE_SECTION') and EDIT_ONE_SECTION)
53
{
53
if(defined('EDIT_ONE_SECTION') and EDIT_ONE_SECTION){
54 54
    $edit_page = ADMIN_URL.'/pages/modify.php?page_id='.$page_id.'&wysiwyg='.$section_id;
55 55
} else {
56 56
    $edit_page = ADMIN_URL.'/pages/modify.php?page_id='.$page_id.$sec_anchor;
......
60 60
if($database->is_error()) {
61 61
	$admin->print_error($database->get_error(), $js_back);
62 62
} else {
63
	$admin->print_success($MESSAGE['PAGES']['SAVED'], $edit_page );
63
	$admin->print_success($MESSAGE['PAGES_SAVED'], $edit_page );
64 64
}
65 65

  
66 66
// Print admin footer

Also available in: Unified diff