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 |
1425
|
Luisehahne
|
|
47 |
|
|
// 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 |
|
|
$title = $admin->add_slashes($admin->get_post('title'));
|
52 |
|
|
$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 |
|
|
$description = $admin->add_slashes($admin->get_post('description'));
|
57 |
|
|
$tags = array('<?php', '?>' , '<?');
|
58 |
|
|
$content = $admin->add_slashes(str_replace($tags, '', $_POST['savecontent']));
|
59 |
|
|
$comments = $admin->add_slashes($admin->get_post('comments'));
|
60 |
|
|
$modified_when = time();
|
61 |
1503
|
Luisehahne
|
$modified_by = (int) $admin->get_user_id();
|
62 |
1425
|
Luisehahne
|
}
|
63 |
|
|
|
64 |
|
|
// Update row
|
65 |
1503
|
Luisehahne
|
$sql = 'UPDATE `'.TABLE_PREFIX.'mod_droplets` SET ';
|
66 |
|
|
$sql .= '`name` = \''.$title.'\', ';
|
67 |
|
|
$sql .= '`active` = '.$active.', ';
|
68 |
|
|
$sql .= '`admin_view` = '.$admin_view.', ';
|
69 |
|
|
$sql .= '`admin_edit` = '.$admin_edit.', ';
|
70 |
|
|
$sql .= '`show_wysiwyg` = '.$show_wysiwyg.', ';
|
71 |
|
|
$sql .= '`description` = \''.$description.'\', ';
|
72 |
|
|
$sql .= '`code` = \''.$content.'\', ';
|
73 |
|
|
$sql .= '`comments` = \''.$comments.'\', ';
|
74 |
|
|
$sql .= '`modified_when` = '.$modified_when.', ';
|
75 |
|
|
$sql .= '`modified_by` = '.$modified_by.' ';
|
76 |
|
|
$sql .= 'WHERE `id` = '.$droplet_id;
|
77 |
|
|
$database->query($sql);
|
78 |
1425
|
Luisehahne
|
|
79 |
|
|
// Check if there is a db error, otherwise say successful
|
80 |
|
|
if($database->is_error()) {
|
81 |
|
|
$admin->print_error($database->get_error(), WB_URL.'/modules/droplets/modify_droplet.php?droplet_id='. $admin->getIDKEY($droplet_id));
|
82 |
|
|
} else {
|
83 |
|
|
$admin->print_success($TEXT['SUCCESS'], $module_edit_link);
|
84 |
|
|
}
|
85 |
|
|
|
86 |
|
|
// Print admin footer
|
87 |
|
|
$admin->print_footer();
|