1 |
2
|
Manuela
|
<?php
|
2 |
|
|
/**
|
3 |
|
|
*
|
4 |
|
|
* @category module
|
5 |
|
|
* @package droplet
|
6 |
|
|
* @author Ruud Eisinga (Ruud) John (PCWacht)
|
7 |
|
|
* @author WebsiteBaker Project
|
8 |
|
|
* @copyright Ryan Djurovich
|
9 |
|
|
* @copyright WebsiteBaker Org. e.V.
|
10 |
|
|
* @link http://websitebaker.org/
|
11 |
|
|
* @license http://www.gnu.org/licenses/gpl.html
|
12 |
|
|
* @platform WebsiteBaker 2.8.3
|
13 |
|
|
* @requirements PHP 5.3.6 and higher
|
14 |
|
|
* @version $Id$
|
15 |
|
|
* @filesource $HeadURL$
|
16 |
|
|
* @lastmodified $Date$
|
17 |
|
|
*
|
18 |
|
|
*/
|
19 |
|
|
/* -------------------------------------------------------- */
|
20 |
|
|
// Must include code to stop this file being accessed directly
|
21 |
|
|
if(!defined('WB_PATH')) {
|
22 |
|
|
require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
|
23 |
|
|
throw new IllegalFileException();
|
24 |
|
|
} else {
|
25 |
|
|
if ( !class_exists('admin', false) ) { require($oReg->AppPath.'/framework/class.admin.php'); }
|
26 |
|
|
// Include WB admin wrapper script
|
27 |
|
|
$oApp = new admin('admintools', 'admintools',false);
|
28 |
|
|
/* later
|
29 |
|
|
if (!$oApp->checkFTAN()) {
|
30 |
|
|
// $oApp->print_header();
|
31 |
|
|
$oApp->print_error('FTAN_DROPLET::'. $MESSAGE['GENERIC_SECURITY_ACCESS'], $ToolUrl );
|
32 |
|
|
}
|
33 |
|
|
*/
|
34 |
|
|
if (($droplet_id === false)) {
|
35 |
|
|
// $oApp->print_header();
|
36 |
|
|
$oApp->print_error('IDKEY_DROPLET::'. $oTrans->MESSAGE_GENERIC_SECURITY_ACCESS, $ToolUrl );
|
37 |
|
|
}
|
38 |
|
|
// Validate all fields
|
39 |
|
|
if( ($oApp->get_post('title') == '') && ($droplet_id==0) ) {
|
40 |
|
|
$oApp->print_error($MESSAGE['GENERIC_FILL_IN_ALL'].' ( Droplet Name )', $ToolUrl );
|
41 |
|
|
} else {
|
42 |
|
|
$title = $oApp->StripCodeFromText($oApp->get_post('title'));
|
43 |
|
|
$active = (int) $oApp->get_post('active');
|
44 |
|
|
$oApp_view = (int) $oApp->get_post('admin_view');
|
45 |
|
|
$oApp_edit = (int) $oApp->get_post('admin_edit');
|
46 |
|
|
$show_wysiwyg = (int) $oApp->get_post('show_wysiwyg');
|
47 |
|
|
$description = $oApp->get_post('description');
|
48 |
|
|
$aForbiddenTags = array('<?php', '?>' , '<?');
|
49 |
|
|
$content = str_replace($aForbiddenTags, '', $_POST['savecontent']);
|
50 |
|
|
$comments = trim(($oApp->get_post('comments')));
|
51 |
|
|
$modified_when = time();
|
52 |
|
|
$modified_by = (int) $oApp->get_user_id();
|
53 |
|
|
}
|
54 |
|
|
$sqlBody = ''
|
55 |
|
|
. '`active` = '.(int)$active.', '
|
56 |
|
|
. '`admin_view` = '.(int)$oApp_view.', '
|
57 |
|
|
. '`admin_edit` = '.(int)$oApp_edit.', '
|
58 |
|
|
. '`show_wysiwyg` = '.(int)$show_wysiwyg.', '
|
59 |
|
|
. '`description` = \''.$oDb->escapeString($description).'\', '
|
60 |
|
|
. '`code` = \''.$oDb->escapeString($content).'\', '
|
61 |
|
|
. '`comments` = \''.$oDb->escapeString($comments).'\', '
|
62 |
|
|
. '`modified_when` = '.(int)$modified_when.', '
|
63 |
|
|
. '`modified_by` = '.(int)$modified_by.' ';
|
64 |
|
|
|
65 |
|
|
if ($droplet_id == 0){
|
66 |
|
|
$title = getUniqueName($oDb, $title);
|
67 |
|
|
$sql = 'INSERT INTO `'.TABLE_PREFIX.'mod_droplets` SET '
|
68 |
|
|
. '`name` = \''.$oDb->escapeString($title).'\', ';
|
69 |
|
|
$sqlWhere = '';
|
70 |
|
|
if (!$oDb->query($sql.$sqlBody)) {
|
71 |
|
|
|
72 |
|
|
}
|
73 |
|
|
} else {
|
74 |
|
|
$sql = 'UPDATE `'.TABLE_PREFIX.'mod_droplets` SET ';
|
75 |
|
|
$sqlWhere = 'WHERE `id` = '.(int)$droplet_id;
|
76 |
|
|
$oDb->query($sql.$sqlBody.$sqlWhere);}
|
77 |
|
|
|
78 |
|
|
// Check if there is a db error, otherwise say successful
|
79 |
|
|
if($oDb->is_error()) {
|
80 |
|
|
msgQueue::add($oDb->get_error());
|
81 |
|
|
} else {
|
82 |
|
|
msgQueue::add( $oTrans->TEXT_SUCCESS, true );
|
83 |
|
|
}
|
84 |
|
|
}
|