Project

General

Profile

1
<?php
2

    
3
// $Id: save_droplet.php 991 2009-06-15 15:55:20Z Ruebenwurzel $
4

    
5
/*
6
*	@version	1.0
7
*	@author		Ruud Eisinga (Ruud) John (PCWacht)
8
*	@date		June 2009
9
*
10
*	droplets are small codeblocks that are called from anywhere in the template. 
11
* 	To call a droplet just use [[dropletname]]. optional parameters for a droplet can be used like [[dropletname?parameter=value&parameter2=value]]
12
*/
13

    
14
require('../../config.php');
15

    
16
// Get id
17
if(!isset($_POST['droplet_id']) OR !is_numeric($_POST['droplet_id'])) {
18
	header("Location: ".ADMIN_URL."/pages/index.php");
19
} else {
20
	$droplet_id = $_POST['droplet_id'];
21
}
22
// Include WB admin wrapper script
23
require_once(WB_PATH.'/framework/class.admin.php');
24
require_once(WB_PATH.'/framework/functions.php');
25

    
26
// check website baker platform (with WB 2.7, Admin-Tools were moved out of settings dialogue)
27
if(file_exists(ADMIN_PATH .'/admintools/tool.php')) {
28
	$admintool_link = ADMIN_URL .'/admintools/index.php';
29
	$module_edit_link = ADMIN_URL .'/admintools/tool.php?tool=droplets';
30
	$admin = new admin('admintools', 'admintools');
31
} else {
32
	$admintool_link = ADMIN_URL .'/settings/index.php?advanced=yes#administration_tools"';
33
	$module_edit_link = ADMIN_URL .'/settings/tool.php?tool=droplets';
34
	$admin = new admin('Settings', 'settings_advanced');
35
}
36

    
37
// Validate all fields
38
if($admin->get_post('title') == '') {
39
	$admin->print_error($MESSAGE['GENERIC']['FILL_IN_ALL'], WB_URL.'/modules/droplets/modify_droplet.php?droplet_id='.$droplet_id);
40
} else {
41
	$title = $admin->add_slashes($admin->get_post('title'));
42
	$active = $admin->get_post('active');
43
	$admin_view = $admin->get_post('admin_view');
44
	$admin_edit = $admin->get_post('admin_edit');
45
	$show_wysiwyg = $admin->get_post('show_wysiwyg');
46
	$description = $admin->add_slashes($admin->get_post('description'));
47
	$tags = array('<?php', '?>' , '<?');
48
	$content = $admin->add_slashes(str_replace($tags, '', $_POST['savecontent']));
49
	
50
	$comments = $admin->add_slashes($admin->get_post('comments'));
51
	$modified_when = mktime();
52
	$modified_by = $admin->get_user_id(); 
53
}
54

    
55
// Update row
56
$database->query("UPDATE ".TABLE_PREFIX."mod_droplets SET name = '$title', active = '$active', admin_view = '$admin_view', admin_edit = '$admin_edit', show_wysiwyg = '$show_wysiwyg', description = '$description', code = '$content', comments = '$comments', modified_when = '$modified_when', modified_by = '$modified_by' WHERE id = '$droplet_id'");
57

    
58
// Check if there is a db error, otherwise say successful
59
if($database->is_error()) {
60
	$admin->print_error($database->get_error(), WB_URL.'/modules/droplets/modify_droplet.php?droplet_id='.$droplet_id);
61
} else {
62
    $admin->print_success($TEXT['SUCCESS'], $module_edit_link);
63
}
64

    
65
// Print admin footer
66
$admin->print_footer();
67

    
68
?>
(10-10/13)