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') == false) { die('Cannot access '.basename(__DIR__).'/'.basename(__FILE__).' directly'); }
|
22 |
|
|
/* -------------------------------------------------------- */
|
23 |
|
|
// Get id
|
24 |
|
|
if(!isset($iDropletAddId)) {
|
25 |
|
|
$droplet_id = (@$droplet_id?:'droplet_id');
|
26 |
|
|
$droplet_id = ($oApp->checkIDKEY($droplet_id, false, ''));
|
27 |
|
|
}
|
28 |
|
|
if ($droplet_id === false) {
|
29 |
|
|
$oApp->print_error('MODIFY_DROPLET_IDKEY::'.$oTrans->MESSAGE_GENERIC_SECURITY_ACCESS, $ToolUrl);
|
30 |
|
|
exit();
|
31 |
|
|
}
|
32 |
|
|
$sOverviewDroplets = $oTrans->DR_TEXT_DROPLETS;
|
33 |
|
|
$sTimeStamp = (@$sTimeStamp?:'');
|
34 |
|
|
$modified_by = $oApp->get_user_id();
|
35 |
|
|
$sHeaderDroplet = $oTrans->DR_TEXT_ADD_DROPLET;
|
36 |
|
|
$sDropletHelp = $oTrans->DROPLET_HELP_DROPLET_RENAME_ADD;
|
37 |
|
|
if (($droplet_id > 0)) {
|
38 |
|
|
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'mod_droplets` '
|
39 |
|
|
. 'WHERE `id` = '.$droplet_id;
|
40 |
|
|
$oDroplet = $oDb->query($sql);
|
41 |
|
|
$aDroplet = $oDroplet->fetchRow(MYSQLI_ASSOC);
|
42 |
|
|
$content = (htmlspecialchars($aDroplet['code']));
|
43 |
|
|
$DropletName = $aDroplet['name'];
|
44 |
|
|
$sSubmitButton = $oTrans->TEXT_SAVE;
|
45 |
|
|
$iDropletIdKey = $oApp->getIDKEY($droplet_id);
|
46 |
|
|
$iDropletAddId = $droplet_id;
|
47 |
|
|
$sHeaderDroplet = $oTrans->DROPLET_HEADER_RENAME_DROPLET;
|
48 |
|
|
$sDropletHelp = $oTrans->DROPLET_HELP_DROPLET_RENAME;
|
49 |
|
|
} else if (isset($aCopyDroplet)){
|
50 |
|
|
$aDroplet = $aCopyDroplet;
|
51 |
|
|
$DropletName = $aDroplet['name'];
|
52 |
|
|
$sSubmitButton = $oTrans->TEXT_ADD;
|
53 |
|
|
$iDropletIdKey = $droplet_id;
|
54 |
|
|
} else {
|
55 |
|
|
$aDroplet = array();
|
56 |
|
|
// check if it is a normal add or a copy
|
57 |
|
|
if (sizeof($aDroplet)==0) {
|
58 |
|
|
$aDroplet = array(
|
59 |
|
|
'id' => 0,
|
60 |
|
|
'name' => 'Dropletname',
|
61 |
|
|
'code' => 'return true;',
|
62 |
|
|
'description' => '',
|
63 |
|
|
'modified_when' => 0,
|
64 |
|
|
'modified_by' => 0,
|
65 |
|
|
'active' => 0,
|
66 |
|
|
'admin_edit' => 0,
|
67 |
|
|
'admin_view' => 0,
|
68 |
|
|
'show_wysiwyg' => 0,
|
69 |
|
|
'comments' => ''
|
70 |
|
|
);
|
71 |
|
|
$DropletName = $aDroplet['name'];
|
72 |
|
|
$content = '';
|
73 |
|
|
}
|
74 |
|
|
$sDropletHelp = $oTrans->DROPLET_HELP_DROPLET_RENAME_ADD;
|
75 |
|
|
$sSubmitButton = $oTrans->TEXT_ADD;
|
76 |
|
|
$iDropletIdKey = $oApp->getIDKEY($aDroplet['id']);
|
77 |
|
|
}
|
78 |
|
|
$aFtan = $admin->getFTAN('');
|
79 |
|
|
// prepare default data for phplib and twig
|
80 |
|
|
$aTplData = array (
|
81 |
|
|
'action' => $action,
|
82 |
|
|
'FTAN_NAME' => $aFtan['name'],
|
83 |
|
|
'FTAN_VALUE' => $aFtan['value'],
|
84 |
|
|
'DropletName' => $aDroplet['name'],
|
85 |
|
|
'iDropletAddId' => $iDropletAddId,
|
86 |
|
|
'iDropletIdKey' => $iDropletIdKey,
|
87 |
|
|
'show_wysiwyg' => $aDroplet['show_wysiwyg'],
|
88 |
|
|
'sSubmitButton' => $sSubmitButton,
|
89 |
|
|
'HEADER_DROPLET' => $sHeaderDroplet,
|
90 |
|
|
'sDropletHelp' => $sDropletHelp,
|
91 |
|
|
);
|
92 |
|
|
// Create new template object with phplib
|
93 |
|
|
$oTpl = new Template($sAddonThemePath, 'keep' );
|
94 |
|
|
$oTpl->set_file('page', 'rename_droplet.htt');
|
95 |
|
|
$oTpl->set_block('page', 'main_block', 'main');
|
96 |
|
|
$oTpl->set_var($aLang);
|
97 |
|
|
$oTpl->set_var($aTplDefaults);
|
98 |
|
|
$oTpl->set_var($aTplData);
|
99 |
|
|
$oTpl->set_block('main_block', 'show_admin_edit_block', 'show_admin_edit');
|
100 |
|
|
if ($admin->ami_group_member('1') || $aDroplet['admin_edit'] == 0 ) {
|
101 |
|
|
$oTpl->parse('show_admin_edit', 'show_admin_edit_block', true);
|
102 |
|
|
} else {
|
103 |
|
|
$oTpl->set_block('show_admin_edit', '');
|
104 |
|
|
}
|
105 |
|
|
/*-- finalize the page -----------------------------------------------------------------*/
|
106 |
|
|
$oTpl->parse('main', 'main_block', false);
|
107 |
|
|
$oTpl->pparse('output', 'page');
|