1
|
<?php
|
2
|
|
3
|
// $Id: modify_droplet.php 991 2009-06-15 15:55:20Z Ruebenwurzel $
|
4
|
|
5
|
/*
|
6
|
* @version 1.0
|
7
|
* @author Ruud Eisinga (Ruud) John (PCWacht)
|
8
|
* @date June 2009
|
9
|
*
|
10
|
* droplets are small codeblocks that are called from anywhere in the template.
|
11
|
* To call a droplet just use [[dropletname]]. optional parameters for a droplet can be used like [[dropletname?parameter=value¶meter2=value]]
|
12
|
*/
|
13
|
|
14
|
require('../../config.php');
|
15
|
|
16
|
// Get id
|
17
|
if(!isset($_GET['droplet_id']) OR !is_numeric($_GET['droplet_id'])) {
|
18
|
header("Location: ".ADMIN_URL."/pages/index.php");
|
19
|
} else {
|
20
|
$droplet_id = $_GET['droplet_id'];
|
21
|
}
|
22
|
|
23
|
require_once(WB_PATH.'/framework/class.admin.php');
|
24
|
require_once(WB_PATH.'/framework/functions.php');
|
25
|
|
26
|
$admintool_link = ADMIN_URL .'/admintools/index.php';
|
27
|
$module_edit_link = ADMIN_URL .'/admintools/tool.php?tool=droplets';
|
28
|
$admin = new admin('admintools', 'admintools');
|
29
|
|
30
|
// check if backend.css file needs to be included into the <body></body> of modify.php
|
31
|
if(!method_exists($admin, 'register_backend_modfiles') && file_exists(WB_PATH ."/modules/droplets/backend.css")) {
|
32
|
echo '<style type="text/css">';
|
33
|
include(WB_PATH .'/modules/droplets/backend.css');
|
34
|
echo "n</style>n";
|
35
|
}
|
36
|
|
37
|
// Load Language file
|
38
|
if(LANGUAGE_LOADED) {
|
39
|
if(!file_exists(WB_PATH.'/modules/droplets/languages/'.LANGUAGE.'.php')) {
|
40
|
require_once(WB_PATH.'/modules/droplets/languages/EN.php');
|
41
|
} else {
|
42
|
require_once(WB_PATH.'/modules/droplets/languages/'.LANGUAGE.'.php');
|
43
|
}
|
44
|
}
|
45
|
require_once(WB_PATH . '/include/editarea/wb_wrapper_edit_area.php');
|
46
|
echo registerEditArea ('contentedit','php',true,'both',true,true,600,450,'search, fullscreen, |, undo, redo, |, select_font,|, highlight, reset_highlight, |, help');
|
47
|
|
48
|
|
49
|
$modified_when = mktime();
|
50
|
$modified_by = $admin->get_user_id();
|
51
|
|
52
|
// Get header and footer
|
53
|
$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_droplets WHERE id = '$droplet_id'");
|
54
|
$fetch_content = $query_content->fetchRow();
|
55
|
$content = (htmlspecialchars($fetch_content['code']));
|
56
|
?>
|
57
|
<h4 style="margin: 0; border-bottom: 1px solid #DDD; padding-bottom: 5px;">
|
58
|
<a href="<?php echo $admintool_link;?>"><?php echo $HEADING['ADMINISTRATION_TOOLS']; ?></a>
|
59
|
->
|
60
|
<a href="<?php echo $module_edit_link;?>">Droplet Edit</a>
|
61
|
</h4>
|
62
|
<br />
|
63
|
<form name="modify" action="<?php echo WB_URL; ?>/modules/droplets/save_droplet.php" method="post" style="margin: 0;">
|
64
|
<input type="hidden" name="data_codepress" value="" />
|
65
|
<input type="hidden" name="droplet_id" value="<?php echo $droplet_id; ?>">
|
66
|
<input type="hidden" name="show_wysiwyg" value="<?php echo $fetch_content['show_wysiwyg']; ?>">
|
67
|
|
68
|
<table class="row_a" cellpadding="4" cellspacing="0" border="0" width="100%">
|
69
|
<tr>
|
70
|
<td width="10%" class="setting_name">
|
71
|
<?php echo $TEXT['NAME']; ?>:
|
72
|
</td>
|
73
|
<td width="90%">
|
74
|
<input type="text" name="title" value="<?php echo stripslashes($fetch_content['name']); ?>" style="width: 38%;" maxlength="32" />
|
75
|
</td>
|
76
|
</tr>
|
77
|
<tr>
|
78
|
<td valign="top" class="setting_name" width="60px"><?php echo $TEXT['DESCRIPTION']; ?>:</td>
|
79
|
<td>
|
80
|
<input type="text" name="description" value="<?php echo stripslashes($fetch_content['description']); ?>" style="width: 98%;" />
|
81
|
</td>
|
82
|
</tr>
|
83
|
<tr>
|
84
|
<td class="setting_name" width="60px">
|
85
|
<?php echo $TEXT['ACTIVE']; ?>:
|
86
|
</td>
|
87
|
<td>
|
88
|
<input type="radio" name="active" id="active_true" value="1" <?php if($fetch_content['active'] == 1) { echo ' checked'; } ?> />
|
89
|
<a href="#" onclick="javascript: document.getElementById('active_true').checked = true;">
|
90
|
<label><?php echo $TEXT['YES']; ?></label>
|
91
|
</a>
|
92
|
<input type="radio" name="active" id="active_false" value="0" <?php if($fetch_content['active'] == 0) { echo ' checked'; } ?> />
|
93
|
<a href="#" onclick="javascript: document.getElementById('active_false').checked = true;">
|
94
|
<label><?php echo $TEXT['NO']; ?></label>
|
95
|
</a>
|
96
|
</td>
|
97
|
</tr>
|
98
|
<?php
|
99
|
// Next show only if admin is logged in, user_id = 1
|
100
|
if ($modified_by == 1) {
|
101
|
?>
|
102
|
<tr>
|
103
|
<td class="setting_name" width="60px">
|
104
|
<?php echo $TEXT['ADMIN']; ?>:
|
105
|
</td>
|
106
|
<td>
|
107
|
<?php echo $DR_TEXT['ADMIN_EDIT']; ?>
|
108
|
<input type="radio" name="admin_edit" id="admin_edit_true" value="1" <?php if($fetch_content['admin_edit'] == 1) { echo ' checked'; } ?> />
|
109
|
<a href="#" onclick="javascript: document.getElementById('admin_edit_true').checked = true;">
|
110
|
<label><?php echo $TEXT['YES']; ?></label>
|
111
|
</a>
|
112
|
<input type="radio" name="admin_edit" id="admin_edit_false" value="0" <?php if($fetch_content['admin_edit'] == 0) { echo ' checked'; } ?> />
|
113
|
<a href="#" onclick="javascript: document.getElementById('admin_edit_false').checked = true;">
|
114
|
<label><?php echo $TEXT['NO']; ?></label>
|
115
|
</a>
|
116
|
|
117
|
<?php echo $DR_TEXT['ADMIN_VIEW']; ?>:
|
118
|
<input type="radio" name="admin_view" id="admin_view_true" value="1" <?php if($fetch_content['admin_view'] == 1) { echo ' checked'; } ?> />
|
119
|
<a href="#" onclick="javascript: document.getElementById('admin_view_true').checked = true;">
|
120
|
<label><?php echo $TEXT['YES']; ?></label>
|
121
|
</a>
|
122
|
<input type="radio" name="admin_view" id="admin_view_false" value="0" <?php if($fetch_content['admin_view'] == 0) { echo ' checked'; } ?> />
|
123
|
<a href="#" onclick="javascript: document.getElementById('admin_view_false').checked = true;">
|
124
|
<label><?php echo $TEXT['NO']; ?></label>
|
125
|
</a>
|
126
|
</td>
|
127
|
</tr>
|
128
|
<?php
|
129
|
}
|
130
|
?>
|
131
|
<tr>
|
132
|
<td valign="top" class="setting_name" width="60px"><?php echo $TEXT['CODE']; ?>:</td>
|
133
|
<td ><textarea name="savecontent" id ="contentedit" style="width: 98%; height: 450px;" wrap="off"><?php echo $content; ?></textarea>
|
134
|
</td>
|
135
|
</tr>
|
136
|
<tr>
|
137
|
<td colspan="2">
|
138
|
</td>
|
139
|
</tr>
|
140
|
<tr>
|
141
|
<td valign="top" class="setting_name" width="60px"><?php echo $TEXT['COMMENTS']; ?>:</td>
|
142
|
<td>
|
143
|
<textarea name="comments" style="width: 98%; height: 100px;"><?php echo stripslashes($fetch_content['comments']); ?></textarea>
|
144
|
</td>
|
145
|
</tr>
|
146
|
<tr>
|
147
|
<td colspan="2">
|
148
|
</td>
|
149
|
</tr>
|
150
|
</table>
|
151
|
<br />
|
152
|
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
153
|
<tr>
|
154
|
<td align="left">
|
155
|
<?php
|
156
|
// Show only save button if allowed....
|
157
|
if ($modified_by == 1 OR $fetch_content['admin_edit'] == 0 ) {
|
158
|
?>
|
159
|
<button class="save" name="save" type="submit"><?php echo $TEXT['SAVE']; ?></button>
|
160
|
<?php
|
161
|
}
|
162
|
?>
|
163
|
</form>
|
164
|
</td>
|
165
|
<td align="right">
|
166
|
<button class="cancel" type="button" onclick="javascript: window.location = '<?php echo $module_edit_link; ?>';"><?php echo $TEXT['CANCEL']; ?></button>
|
167
|
</td>
|
168
|
</tr>
|
169
|
</table>
|
170
|
|
171
|
<?php
|
172
|
|
173
|
// Print admin footer
|
174
|
$admin->print_footer();
|
175
|
|
176
|
?>
|