Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        module
5
 * @package         droplet
6
 * @author          Ruud Eisinga (Ruud) John (PCWacht)
7
 * @author          WebsiteBaker Project
8
 * @copyright       2004-2009, Ryan Djurovich
9
 * @copyright       2009-2011, Website Baker Org. e.V.
10
 * @link			http://www.websitebaker2.org/
11
 * @license         http://www.gnu.org/licenses/gpl.html
12
 * @platform        WebsiteBaker 2.8.x
13
 * @requirements    PHP 5.2.2 and higher
14
 * @version         $Id: save_droplet.php 1457 2011-06-25 17:18:50Z Luisehahne $
15
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/modules/droplets/save_droplet.php $
16
 * @lastmodified    $Date: 2011-06-25 19:18:50 +0200 (Sat, 25 Jun 2011) $
17
 *
18
 */
19

    
20
require('../../config.php');
21

    
22
// Get id
23
if(!isset($_POST['droplet_id']) OR !is_numeric($_POST['droplet_id'])) {
24
	header("Location: ".ADMIN_URL."/pages/index.php");
25
} else {
26
	$droplet_id = (int) $_POST['droplet_id'];
27
}
28
// Include WB admin wrapper script
29
require_once(WB_PATH.'/framework/class.admin.php');
30
require_once(WB_PATH.'/framework/functions.php');
31

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

    
43
if (!$admin->checkFTAN())
44
{
45
	$admin->print_header();
46
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], $module_edit_link);
47
}
48
$admin->print_header();
49

    
50
// Validate all fields
51
if($admin->get_post('title') == '') {
52
	$admin->print_error($MESSAGE['GENERIC']['FILL_IN_ALL'], WB_URL.'/modules/droplets/modify_droplet.php?droplet_id='. $admin->getIDKEY($droplet_id));
53
} else {
54
	$title = $admin->add_slashes($admin->get_post('title'));
55
	$active = (int) $admin->get_post('active');
56
	$admin_view = (int) $admin->get_post('admin_view');
57
	$admin_edit = (int) $admin->get_post('admin_edit');
58
	$show_wysiwyg = (int) $admin->get_post('show_wysiwyg');
59
	$description = $admin->add_slashes($admin->get_post('description'));
60
	$tags = array('<?php', '?>' , '<?');
61
	$content = $admin->add_slashes(str_replace($tags, '', $_POST['savecontent']));
62

    
63
	$comments = $admin->add_slashes($admin->get_post('comments'));
64
	$modified_when = time();
65
	$modified_by = (int) $admin->get_user_id(); 
66
}
67

    
68
// Update row
69
$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'");
70

    
71
// Check if there is a db error, otherwise say successful
72
if($database->is_error()) {
73
	$admin->print_error($database->get_error(), WB_URL.'/modules/droplets/modify_droplet.php?droplet_id='. $admin->getIDKEY($droplet_id));
74
} else {
75
    $admin->print_success($TEXT['SUCCESS'], $module_edit_link);
76
}
77

    
78
// Print admin footer
79
$admin->print_footer();
(10-10/13)