Project

General

Profile

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

    
11
require('../../config.php');
12

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

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

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

    
52
// Update row
53
$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'");
54

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

    
62
// Print admin footer
63
$admin->print_footer();
64

    
65
?>
(10-10/13)