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 |
|
|
|
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 |
1473
|
Luisehahne
|
$module_edit_link = ADMIN_URL .'/admintools/tool.php?tool=droplets';
|
33 |
1425
|
Luisehahne
|
// check website baker platform (with WB 2.7, Admin-Tools were moved out of settings dialogue)
|
34 |
|
|
if(file_exists(ADMIN_PATH .'/admintools/tool.php')) {
|
35 |
|
|
$admintool_link = ADMIN_URL .'/admintools/index.php';
|
36 |
1457
|
Luisehahne
|
$admin = new admin('admintools', 'admintools',false);
|
37 |
1425
|
Luisehahne
|
} else {
|
38 |
|
|
$admintool_link = ADMIN_URL .'/settings/index.php?advanced=yes#administration_tools"';
|
39 |
1457
|
Luisehahne
|
$admin = new admin('Settings', 'settings_advanced',false);
|
40 |
1425
|
Luisehahne
|
}
|
41 |
|
|
|
42 |
|
|
if (!$admin->checkFTAN())
|
43 |
|
|
{
|
44 |
1457
|
Luisehahne
|
$admin->print_header();
|
45 |
1425
|
Luisehahne
|
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], $module_edit_link);
|
46 |
|
|
}
|
47 |
1457
|
Luisehahne
|
$admin->print_header();
|
48 |
1425
|
Luisehahne
|
|
49 |
|
|
// Validate all fields
|
50 |
|
|
if($admin->get_post('title') == '') {
|
51 |
|
|
$admin->print_error($MESSAGE['GENERIC']['FILL_IN_ALL'], WB_URL.'/modules/droplets/modify_droplet.php?droplet_id='. $admin->getIDKEY($droplet_id));
|
52 |
|
|
} else {
|
53 |
|
|
$title = $admin->add_slashes($admin->get_post('title'));
|
54 |
|
|
$active = (int) $admin->get_post('active');
|
55 |
|
|
$admin_view = (int) $admin->get_post('admin_view');
|
56 |
|
|
$admin_edit = (int) $admin->get_post('admin_edit');
|
57 |
|
|
$show_wysiwyg = (int) $admin->get_post('show_wysiwyg');
|
58 |
|
|
$description = $admin->add_slashes($admin->get_post('description'));
|
59 |
|
|
$tags = array('<?php', '?>' , '<?');
|
60 |
|
|
$content = $admin->add_slashes(str_replace($tags, '', $_POST['savecontent']));
|
61 |
|
|
|
62 |
|
|
$comments = $admin->add_slashes($admin->get_post('comments'));
|
63 |
|
|
$modified_when = time();
|
64 |
|
|
$modified_by = (int) $admin->get_user_id();
|
65 |
|
|
}
|
66 |
|
|
|
67 |
|
|
// Update row
|
68 |
|
|
$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'");
|
69 |
|
|
|
70 |
|
|
// Check if there is a db error, otherwise say successful
|
71 |
|
|
if($database->is_error()) {
|
72 |
|
|
$admin->print_error($database->get_error(), WB_URL.'/modules/droplets/modify_droplet.php?droplet_id='. $admin->getIDKEY($droplet_id));
|
73 |
|
|
} else {
|
74 |
|
|
$admin->print_success($TEXT['SUCCESS'], $module_edit_link);
|
75 |
|
|
}
|
76 |
|
|
|
77 |
|
|
// Print admin footer
|
78 |
|
|
$admin->print_footer();
|