Project

General

Profile

1
<?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: modify_droplet.php 1457 2011-06-25 17:18:50Z Luisehahne $
15
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/modules/droplets/modify_droplet.php $
16
 * @lastmodified    $Date: 2011-06-25 19:18:50 +0200 (Sat, 25 Jun 2011) $
17
 *
18
 */
19

    
20
require('../../config.php');
21

    
22
require_once(WB_PATH.'/framework/class.admin.php');
23
require_once(WB_PATH.'/framework/functions.php');
24

    
25
$admintool_link = ADMIN_URL .'/admintools/index.php';
26
$module_edit_link = ADMIN_URL .'/admintools/tool.php?tool=droplets';
27
$admin = new admin('admintools', 'admintools');
28

    
29
// Get id
30
$droplet_id = $admin->checkIDKEY('droplet_id', false, 'GET');
31
if (!$droplet_id) {
32
 $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], $module_edit_link);
33
 exit();
34
}
35

    
36
// check if backend.css file needs to be included into the <body></body> of modify.php
37
if(!method_exists($admin, 'register_backend_modfiles') && file_exists(WB_PATH ."/modules/droplets/backend.css")) {
38
	echo '<style type="text/css">';
39
	include(WB_PATH .'/modules/droplets/backend.css');
40
	echo "n</style>n";
41
}
42

    
43
// Load Language file
44
if(LANGUAGE_LOADED) {
45
	if(!file_exists(WB_PATH.'/modules/droplets/languages/'.LANGUAGE.'.php')) {
46
		require_once(WB_PATH.'/modules/droplets/languages/EN.php');
47
	} else {
48
		require_once(WB_PATH.'/modules/droplets/languages/'.LANGUAGE.'.php');
49
	}
50
}
51
require_once(WB_PATH . '/include/editarea/wb_wrapper_edit_area.php');
52
echo registerEditArea ('contentedit','php',true,'both',true,true,600,450,'search, fullscreen, |, undo, redo, |, select_font,|, highlight, reset_highlight, |, help');
53
		
54

    
55
$modified_when = time();
56
$modified_by = $admin->get_user_id();
57

    
58
// Get header and footer
59
$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_droplets WHERE id = '$droplet_id'");
60
$fetch_content = $query_content->fetchRow();
61
$content = (htmlspecialchars($fetch_content['code']));
62
?>
63
<h4 style="margin: 0; border-bottom: 1px solid #DDD; padding-bottom: 5px;">
64
	<a href="<?php echo $admintool_link;?>"><?php echo $HEADING['ADMINISTRATION_TOOLS']; ?></a>
65
	->
66
	<a href="<?php echo $module_edit_link;?>">Droplet Edit</a>
67
</h4>
68
<br />
69
<form name="modify" action="<?php echo WB_URL; ?>/modules/droplets/save_droplet.php" method="post" style="margin: 0;">
70
<input type="hidden" name="data_codepress" value="" />
71
<input type="hidden" name="droplet_id" value="<?php echo $droplet_id; ?>" />
72
<input type="hidden" name="show_wysiwyg" value="<?php echo $fetch_content['show_wysiwyg']; ?>" />
73
<?php echo $admin->getFTAN(); ?>
74

    
75
<table class="row_a" cellpadding="4" cellspacing="0" border="0" width="100%">
76
		<tr>
77
		<td width="10%" class="setting_name">
78
			<?php echo $TEXT['NAME']; ?>:
79
		</td>
80
		<td width="90%">
81
			<input type="text" name="title" value="<?php echo stripslashes($fetch_content['name']); ?>" style="width: 38%;" maxlength="32" />
82
		</td>
83
	</tr>
84
	<tr>
85
		<td valign="top" class="setting_name" width="60px"><?php echo $TEXT['DESCRIPTION']; ?>:</td>
86
		<td>
87
			<input type="text" name="description" value="<?php echo stripslashes($fetch_content['description']); ?>" style="width: 98%;" />
88
		</td>
89
	</tr>
90
	<tr>
91
		<td class="setting_name" width="60px">
92
			<?php echo $TEXT['ACTIVE']; ?>:
93
		</td>
94
		<td>	
95
			<input type="radio" name="active" id="active_true" value="1" <?php if($fetch_content['active'] == 1) { echo ' checked="checked"'; } ?> />
96
			<a href="#" onclick="javascript: document.getElementById('active_true').checked = true;">
97
			<label><?php echo $TEXT['YES']; ?></label>
98
			</a>
99
			<input type="radio" name="active" id="active_false" value="0" <?php if($fetch_content['active'] == 0) { echo ' checked="checked"'; } ?> />
100
			<a href="#" onclick="javascript: document.getElementById('active_false').checked = true;">
101
			<label><?php echo $TEXT['NO']; ?></label>
102
			</a>
103
		</td>
104
	</tr>
105
<?php
106
// Next show only if admin is logged in, user_id = 1
107
if ($modified_by == 1) {
108
	?>
109
	<tr>
110
		<td class="setting_name" width="60px">
111
			<?php echo $TEXT['ADMIN']; ?>:
112
		</td>
113
		<td> 
114
			<?php echo $DR_TEXT['ADMIN_EDIT']; ?>&nbsp;   	
115
			<input type="radio" name="admin_edit" id="admin_edit_true" value="1" <?php if($fetch_content['admin_edit'] == 1) { echo ' checked="checked"'; } ?> />
116
			<a href="#" onclick="javascript: document.getElementById('admin_edit_true').checked = true;">
117
			<label><?php echo $TEXT['YES']; ?></label>
118
			</a>
119
			<input type="radio" name="admin_edit" id="admin_edit_false" value="0" <?php if($fetch_content['admin_edit'] == 0) { echo ' checked="checked"'; } ?> />
120
			<a href="#" onclick="javascript: document.getElementById('admin_edit_false').checked = true;">
121
			<label><?php echo $TEXT['NO']; ?></label>
122
			</a>
123
			&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
124
			<?php echo $DR_TEXT['ADMIN_VIEW']; ?>:
125
			<input type="radio" name="admin_view" id="admin_view_true" value="1" <?php if($fetch_content['admin_view'] == 1) { echo ' checked="checked"'; } ?> />
126
			<a href="#" onclick="javascript: document.getElementById('admin_view_true').checked = true;">
127
			<label><?php echo $TEXT['YES']; ?></label>
128
			</a>
129
			<input type="radio" name="admin_view" id="admin_view_false" value="0" <?php if($fetch_content['admin_view'] == 0) { echo ' checked="checked"'; } ?> />
130
			<a href="#" onclick="javascript: document.getElementById('admin_view_false').checked = true;">
131
			<label><?php echo $TEXT['NO']; ?></label>
132
			</a>
133
		</td>
134
	</tr>
135
	<?php
136
}
137
?>
138
	<tr>
139
		<td valign="top" class="setting_name" width="60px"><?php echo $TEXT['CODE']; ?>:</td>
140
		<td ><textarea name="savecontent" id ="contentedit" style="width: 98%; height: 450px;" rows="50" cols="120"><?php echo $content; ?></textarea>&nbsp;
141
		</td>
142
	</tr>
143
	<tr>
144
		<td colspan="2">					
145
		</td>
146
	</tr>
147
	<tr>
148
		<td valign="top" class="setting_name" width="60px"><?php echo $TEXT['COMMENTS']; ?>:</td>
149
		<td>
150
			<textarea name="comments" style="width: 98%; height: 100px;" rows="50" cols="120"><?php echo stripslashes($fetch_content['comments']); ?></textarea>
151
		</td>
152
	</tr>
153
	<tr>
154
		<td colspan="2">&nbsp;					
155
		</td>
156
	</tr>
157
</table>
158
<br />
159
<table cellpadding="0" cellspacing="0" border="0" width="100%">
160
	<tr>
161
		<td align="left">
162
<?php
163
// Show only save button if allowed....
164
if ($modified_by == 1 OR $fetch_content['admin_edit'] == 0 ) {
165
	?>
166
			<button  class="save" name="save" type="submit"><?php echo $TEXT['SAVE']; ?></button>
167
	<?php
168
}
169
?>
170

    
171
		</td>
172
		<td align="right">
173
			<button class="cancel" type="button" onclick="javascript: window.location = '<?php echo $module_edit_link; ?>';"><?php echo $TEXT['CANCEL']; ?></button>
174
		</td>
175
	</tr>
176
</table>
177
</form>
178
<?php
179

    
180
// Print admin footer
181
$admin->print_footer();
182

    
183
?>
(9-9/13)