Project

General

Profile

1 1425 Luisehahne
<?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$
15
 * @filesource		$HeadURL$
16
 * @lastmodified    $Date$
17
 *
18
 */
19
20
require('../../config.php');
21
// Get id
22 1503 Luisehahne
/*
23 1425 Luisehahne
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 1503 Luisehahne
*/
29
30 1425 Luisehahne
// Include WB admin wrapper script
31
require_once(WB_PATH.'/framework/class.admin.php');
32
require_once(WB_PATH.'/framework/functions.php');
33
34 1503 Luisehahne
$admintool_link = ADMIN_URL .'/admintools/index.php';
35 1473 Luisehahne
$module_edit_link = ADMIN_URL .'/admintools/tool.php?tool=droplets';
36 1425 Luisehahne
37 1503 Luisehahne
$admin = new admin('admintools', 'admintools',false);
38
39
$droplet_id = intval($admin->checkIDKEY('droplet_id', false, 'POST'));
40
41
if(!$admin->checkFTAN() || !$droplet_id ) {
42 1457 Luisehahne
	$admin->print_header();
43 1503 Luisehahne
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], $module_edit_link );
44 1425 Luisehahne
}
45 1457 Luisehahne
$admin->print_header();
46 1948 darkviper
$oDb = WbDatabase::getInstance();
47 1425 Luisehahne
// Validate all fields
48
if($admin->get_post('title') == '') {
49
	$admin->print_error($MESSAGE['GENERIC']['FILL_IN_ALL'], WB_URL.'/modules/droplets/modify_droplet.php?droplet_id='. $admin->getIDKEY($droplet_id));
50
} else {
51 1948 darkviper
	$title = $admin->get_post('title');
52 1425 Luisehahne
	$active = (int) $admin->get_post('active');
53
	$admin_view = (int) $admin->get_post('admin_view');
54
	$admin_edit = (int) $admin->get_post('admin_edit');
55
	$show_wysiwyg = (int) $admin->get_post('show_wysiwyg');
56 1948 darkviper
	$description = $admin->get_post('description');
57 1425 Luisehahne
	$tags = array('<?php', '?>' , '<?');
58 1948 darkviper
	$content = str_replace($tags, '', $_POST['savecontent']);
59
	$comments = $admin->get_post('comments');
60 1425 Luisehahne
	$modified_when = time();
61 1503 Luisehahne
	$modified_by = (int) $admin->get_user_id();
62 1425 Luisehahne
}
63
64
// Update row
65 1948 darkviper
$sql = 'UPDATE `'.$oDb->TablePrefix.'mod_droplets` SET ';
66
$sql .= '`name` = \''.$oDb->escapeString($title).'\', ';
67 1503 Luisehahne
$sql .= '`active` = '.$active.', ';
68
$sql .= '`admin_view` = '.$admin_view.', ';
69
$sql .= '`admin_edit` = '.$admin_edit.', ';
70
$sql .= '`show_wysiwyg` = '.$show_wysiwyg.', ';
71 1948 darkviper
$sql .= '`description` = \''.$oDb->escapeString($description).'\', ';
72
$sql .= '`code` = \''.$oDb->escapeString($content).'\', ';
73
$sql .= '`comments` = \''.$oDb->escapeString($comments).'\', ';
74 1503 Luisehahne
$sql .= '`modified_when` = '.$modified_when.', ';
75
$sql .= '`modified_by` = '.$modified_by.' ';
76
$sql .= 'WHERE `id` = '.$droplet_id;
77 1948 darkviper
$oDb->query($sql);
78 1425 Luisehahne
79
// Check if there is a db error, otherwise say successful
80 1948 darkviper
if($oDb->is_error()) {
81
	$admin->print_error($oDb->get_error(), WB_URL.'/modules/droplets/modify_droplet.php?droplet_id='. $admin->getIDKEY($droplet_id));
82 1425 Luisehahne
} else {
83
    $admin->print_success($TEXT['SUCCESS'], $module_edit_link);
84
}
85
86
// Print admin footer
87
$admin->print_footer();