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($dropletAddId)) {
|
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 |
|
|
|
33 |
|
|
$sOverviewDroplets = $oTrans->DR_TEXT_DROPLETS;
|
34 |
|
|
$sTimeStamp = (@$sTimeStamp?:'');
|
35 |
|
|
$modified_by = $oApp->get_user_id();
|
36 |
|
|
if (($droplet_id > 0)) {
|
37 |
|
|
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'mod_droplets` '
|
38 |
|
|
. 'WHERE `id` = '.$droplet_id;
|
39 |
|
|
$oDroplet = $oDb->query($sql);
|
40 |
|
|
$aDroplet = $oDroplet->fetchRow(MYSQLI_ASSOC);
|
41 |
|
|
$content = (htmlspecialchars($aDroplet['code']));
|
42 |
|
|
$sSubmitButton = $oTrans->TEXT_SAVE;
|
43 |
|
|
$iDropletIdKey = $oApp->getIDKEY($droplet_id);
|
44 |
|
|
$dropletAddId = $droplet_id;
|
45 |
|
|
} else {
|
46 |
|
|
$aDroplet = array();
|
47 |
|
|
// check if it is a normal add or a copy
|
48 |
|
|
if (sizeof($aDroplet)==0) {
|
49 |
|
|
$aDroplet = array(
|
50 |
|
|
'id' => $dropletAddId,
|
51 |
|
|
'name' => 'Dropletname',
|
52 |
|
|
'code' => 'return true;',
|
53 |
|
|
'description' => '',
|
54 |
|
|
'modified_when' => 0,
|
55 |
|
|
'modified_by' => 0,
|
56 |
|
|
'active' => 0,
|
57 |
|
|
'admin_edit' => 0,
|
58 |
|
|
'admin_view' => 0,
|
59 |
|
|
'show_wysiwyg' => 0,
|
60 |
|
|
'comments' => ''
|
61 |
|
|
);
|
62 |
|
|
$content = '';
|
63 |
|
|
}
|
64 |
|
|
$dropletAddId = 0;
|
65 |
|
|
$sSubmitButton = $oTrans->TEXT_ADD;
|
66 |
|
|
$iDropletIdKey = $oApp->getIDKEY($droplet_id);
|
67 |
|
|
}
|
68 |
|
|
require_once($oReg->AppPath . '/include/editarea/wb_wrapper_edit_area.php');
|
69 |
|
|
echo registerEditArea ('contentedit','php');
|
70 |
|
|
//'contentedit','php',true,'both',true,true,600,450,'search,fullscreen, |, undo, redo, |, select_font,|,highlight, reset_highlight, |, help');
|
71 |
|
|
|
72 |
|
|
?><br /><div class="block-outer droplets">
|
73 |
|
|
<form name="modify" action="<?php echo $ToolUrl; ?>" method="post" style="margin: 0;">
|
74 |
|
|
<input type="hidden" name="command" value="save_droplet" />
|
75 |
|
|
<input type="hidden" name="data_codepress" value="" />
|
76 |
|
|
<input type="hidden" name="droplet_id" value="<?php echo $iDropletIdKey; ?>" />
|
77 |
|
|
<input type="hidden" name="id" value="<?php echo $dropletAddId; ?>" />
|
78 |
|
|
<input type="hidden" name="show_wysiwyg" value="<?php echo $aDroplet['show_wysiwyg']; ?>" />
|
79 |
|
|
<?php echo $oApp->getFTAN(); ?>
|
80 |
|
|
<table class="droplets droplets-modify" style="width: 100%;">
|
81 |
|
|
<tbody>
|
82 |
|
|
<tr>
|
83 |
|
|
<td class="setting_name">
|
84 |
|
|
<?php echo $oTrans->TEXT_NAME; ?>:
|
85 |
|
|
</td>
|
86 |
|
|
<td >
|
87 |
|
|
<div class="block-outer" style="width: 98%;">
|
88 |
|
|
<?php if ($droplet_id ==0 ){ ?>
|
89 |
|
|
<input type="text" class="rename-input" name="title" value="<?php echo stripslashes($aDroplet['name']).$sTimeStamp; ?>" style="width: 100%;" maxlength="32" />
|
90 |
|
|
<?php } else { ?>
|
91 |
|
|
<div class="noInput"><?php echo stripslashes($aDroplet['name']).$sTimeStamp; ?></div>
|
92 |
|
|
<?php }?>
|
93 |
|
|
</div>
|
94 |
|
|
</td>
|
95 |
|
|
</tr>
|
96 |
|
|
<tr>
|
97 |
|
|
<td class="setting_name" ><?php echo $oTrans->TEXT_DESCRIPTION; ?>:</td>
|
98 |
|
|
<td>
|
99 |
|
|
<input type="text" name="description" value="<?php echo stripslashes($aDroplet['description']); ?>" style="width: 98%;" />
|
100 |
|
|
</td>
|
101 |
|
|
</tr>
|
102 |
|
|
<tr>
|
103 |
|
|
<td class="setting_name" >
|
104 |
|
|
<?php echo $oTrans->TEXT_ACTIVE; ?>:
|
105 |
|
|
</td>
|
106 |
|
|
<td>
|
107 |
|
|
<input type="radio" name="active" id="active_true" value="1" <?php if($aDroplet['active'] == 1) { echo ' checked="checked"'; } ?> />
|
108 |
|
|
<a href="#" onclick="javascript: document.getElementById('active_true').checked = true;">
|
109 |
|
|
<label><?php echo $oTrans->TEXT_YES; ?></label>
|
110 |
|
|
</a>
|
111 |
|
|
<input type="radio" name="active" id="active_false" value="0" <?php if($aDroplet['active'] == 0) { echo ' checked="checked"'; } ?> />
|
112 |
|
|
<a href="#" onclick="javascript: document.getElementById('active_false').checked = true;">
|
113 |
|
|
<label><?php echo $oTrans->TEXT_NO; ?></label>
|
114 |
|
|
</a>
|
115 |
|
|
</td>
|
116 |
|
|
</tr>
|
117 |
|
|
<?php
|
118 |
|
|
// Next show only if admin is logged in, user_id = 1
|
119 |
|
|
if ($modified_by == 1) {
|
120 |
|
|
?>
|
121 |
|
|
<tr>
|
122 |
|
|
<td class="setting_name">
|
123 |
|
|
<?php echo $oTrans->TEXT_ADMIN; ?>:
|
124 |
|
|
</td>
|
125 |
|
|
<td>
|
126 |
|
|
<?php echo $oTrans->DR_TEXT_ADMIN_EDIT; ?>
|
127 |
|
|
<input type="radio" name="admin_edit" id="admin_edit_true" value="1" <?php if($aDroplet['admin_edit'] == 1) { echo ' checked="checked"'; } ?> />
|
128 |
|
|
<a href="#" onclick="document.getElementById('admin_edit_true').checked = true;">
|
129 |
|
|
<label><?php echo $oTrans->TEXT_YES; ?></label>
|
130 |
|
|
</a>
|
131 |
|
|
<input type="radio" name="admin_edit" id="admin_edit_false" value="0" <?php if($aDroplet['admin_edit'] == 0) { echo ' checked="checked"'; } ?> />
|
132 |
|
|
<a href="#" onclick="document.getElementById('admin_edit_false').checked = true;">
|
133 |
|
|
<label><?php echo $oTrans->TEXT_NO; ?></label>
|
134 |
|
|
</a>
|
135 |
|
|
|
136 |
|
|
<?php echo $oTrans->DR_TEXT_ADMIN_VIEW; ?>:
|
137 |
|
|
<input type="radio" name="admin_view" id="admin_view_true" value="1" <?php if($aDroplet['admin_view'] == 1) { echo ' checked="checked"'; } ?> />
|
138 |
|
|
<a href="#" onclick="document.getElementById('admin_view_true').checked = true;">
|
139 |
|
|
<label><?php echo $oTrans->TEXT_YES; ?></label>
|
140 |
|
|
</a>
|
141 |
|
|
<input type="radio" name="admin_view" id="admin_view_false" value="0" <?php if($aDroplet['admin_view'] == 0) { echo ' checked="checked"'; } ?> />
|
142 |
|
|
<a href="#" onclick="document.getElementById('admin_view_false').checked = true;">
|
143 |
|
|
<label><?php echo $oTrans->TEXT_NO; ?></label>
|
144 |
|
|
</a>
|
145 |
|
|
</td>
|
146 |
|
|
</tr>
|
147 |
|
|
<?php
|
148 |
|
|
}
|
149 |
|
|
?>
|
150 |
|
|
<tr>
|
151 |
|
|
<td class="setting_name"><?php echo $oTrans->TEXT_CODE; ?>:</td>
|
152 |
|
|
<td >
|
153 |
|
|
<textarea name="savecontent" id ="contentedit" style="width: 98%; height: 450px;" rows="50" cols="120"><?php echo $content; ?></textarea>
|
154 |
|
|
</td>
|
155 |
|
|
</tr>
|
156 |
|
|
<tr>
|
157 |
|
|
<td colspan="2"></td>
|
158 |
|
|
</tr>
|
159 |
|
|
<tr>
|
160 |
|
|
<td class="setting_name" ><?php echo $oTrans->TEXT_COMMENTS; ?>:</td>
|
161 |
|
|
<td>
|
162 |
|
|
<textarea name="comments" style="width: 98%; height: 100px;" rows="50" cols="120"><?php echo ($aDroplet['comments']); ?></textarea>
|
163 |
|
|
</td>
|
164 |
|
|
</tr>
|
165 |
|
|
<tr>
|
166 |
|
|
<td colspan="2"> </td>
|
167 |
|
|
</tr>
|
168 |
|
|
</tbody>
|
169 |
|
|
</table>
|
170 |
|
|
<br />
|
171 |
|
|
<table>
|
172 |
|
|
<tr>
|
173 |
|
|
<td>
|
174 |
|
|
<?php
|
175 |
|
|
// Show only save button if allowed....
|
176 |
|
|
if ($modified_by == 1 || $aDroplet['admin_edit'] == 0 ) {
|
177 |
|
|
?>
|
178 |
|
|
<button class="btn" name="command" value="save_droplet?droplet_id=<?php echo $iDropletIdKey; ?>" type="submit"><?php echo $sSubmitButton; ?></button>
|
179 |
|
|
<?php
|
180 |
|
|
}
|
181 |
|
|
?>
|
182 |
|
|
<button class="btn" type="button" onclick="window.location = '<?php echo $ToolUrl; ?>';"><?php echo $TEXT['CANCEL']; ?></button>
|
183 |
|
|
</td>
|
184 |
|
|
</tr>
|
185 |
|
|
</table>
|
186 |
|
|
</form>
|
187 |
|
|
<br />
|
188 |
|
|
</div>
|