1 |
238
|
stefan
|
<?php
|
2 |
|
|
|
3 |
|
|
/*
|
4 |
|
|
|
5 |
|
|
Website Baker Project <http://www.websitebaker.org/>
|
6 |
310
|
ryan
|
Copyright (C) 2004-2006, Ryan Djurovich
|
7 |
238
|
stefan
|
|
8 |
|
|
Website Baker is free software; you can redistribute it and/or modify
|
9 |
|
|
it under the terms of the GNU General Public License as published by
|
10 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
11 |
|
|
(at your option) any later version.
|
12 |
|
|
|
13 |
|
|
Website Baker is distributed in the hope that it will be useful,
|
14 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
|
|
GNU General Public License for more details.
|
17 |
|
|
|
18 |
|
|
You should have received a copy of the GNU General Public License
|
19 |
|
|
along with Website Baker; if not, write to the Free Software
|
20 |
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
21 |
|
|
|
22 |
|
|
*/
|
23 |
|
|
|
24 |
|
|
require('../../config.php');
|
25 |
|
|
require_once(WB_PATH.'/framework/class.admin.php');
|
26 |
|
|
$admin = new admin('Pages', 'pages');
|
27 |
|
|
// Include the WB functions file
|
28 |
|
|
require_once(WB_PATH.'/framework/functions.php');
|
29 |
|
|
|
30 |
|
|
?>
|
31 |
|
|
<script type="text/javascript" language="javascript">
|
32 |
|
|
function toggle_viewers() {
|
33 |
|
|
if(document.add.visibility.value == 'private') {
|
34 |
|
|
document.getElementById('private_viewers').style.display = 'block';
|
35 |
|
|
document.getElementById('registered_viewers').style.display = 'none';
|
36 |
|
|
} else if(document.add.visibility.value == 'registered') {
|
37 |
|
|
document.getElementById('private_viewers').style.display = 'none';
|
38 |
|
|
document.getElementById('registered_viewers').style.display = 'block';
|
39 |
|
|
} else {
|
40 |
|
|
document.getElementById('private_viewers').style.display = 'none';
|
41 |
|
|
document.getElementById('registered_viewers').style.display = 'none';
|
42 |
|
|
}
|
43 |
|
|
}
|
44 |
|
|
function toggle_visibility(id){
|
45 |
|
|
if(document.getElementById(id).style.display == "block") {
|
46 |
|
|
document.getElementById(id).style.display = "none";
|
47 |
|
|
} else {
|
48 |
|
|
document.getElementById(id).style.display = "block";
|
49 |
|
|
}
|
50 |
|
|
}
|
51 |
|
|
var plus = new Image;
|
52 |
|
|
plus.src = "<?php echo ADMIN_URL; ?>/images/plus_16.png";
|
53 |
|
|
var minus = new Image;
|
54 |
|
|
minus.src = "<?php echo ADMIN_URL; ?>/images/minus_16.png";
|
55 |
|
|
function toggle_plus_minus(id) {
|
56 |
|
|
var img_src = document.images['plus_minus_' + id].src;
|
57 |
|
|
if(img_src == plus.src) {
|
58 |
|
|
document.images['plus_minus_' + id].src = minus.src;
|
59 |
|
|
} else {
|
60 |
|
|
document.images['plus_minus_' + id].src = plus.src;
|
61 |
|
|
}
|
62 |
|
|
}
|
63 |
|
|
</script>
|
64 |
|
|
|
65 |
|
|
<style type="text/css">
|
66 |
|
|
.pages_list img {
|
67 |
|
|
display: block;
|
68 |
|
|
}
|
69 |
|
|
ul, li {
|
70 |
|
|
list-style: none;
|
71 |
|
|
margin: 0;
|
72 |
|
|
padding: 0;
|
73 |
|
|
}
|
74 |
|
|
.page_list {
|
75 |
|
|
display: none;
|
76 |
|
|
}
|
77 |
|
|
</style>
|
78 |
|
|
|
79 |
|
|
<noscript>
|
80 |
|
|
<style type="text/css">
|
81 |
|
|
.page_list {
|
82 |
|
|
display: block;
|
83 |
|
|
}
|
84 |
|
|
</style>
|
85 |
|
|
</noscript>
|
86 |
|
|
<?php
|
87 |
|
|
|
88 |
|
|
function make_list($parent, $editable_pages) {
|
89 |
|
|
// Get objects and vars from outside this function
|
90 |
|
|
global $admin, $template, $database, $TEXT, $MESSAGE;
|
91 |
|
|
?>
|
92 |
|
|
<ul id="p<?php echo $parent; ?>" <?php if($parent != 0) { echo 'class="page_list"'; } ?>>
|
93 |
|
|
<?php
|
94 |
|
|
// Get page list from database
|
95 |
|
|
$database = new database();
|
96 |
|
|
if(PAGE_TRASH != 'inline') {
|
97 |
|
|
$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' AND visibility != 'deleted' ORDER BY position ASC";
|
98 |
|
|
} else {
|
99 |
|
|
$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' ORDER BY position ASC";
|
100 |
|
|
}
|
101 |
|
|
$get_pages = $database->query($query);
|
102 |
|
|
|
103 |
|
|
// Insert values into main page list
|
104 |
|
|
if($get_pages->numRows() > 0) {
|
105 |
|
|
while($page = $get_pages->fetchRow()) {
|
106 |
|
|
// Get user perms
|
107 |
|
|
$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
|
108 |
|
|
$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
|
109 |
|
|
if(is_numeric(array_search($admin->get_group_id(), $admin_groups)) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) {
|
110 |
|
|
if($page['visibility'] == 'deleted') {
|
111 |
|
|
if(PAGE_TRASH == 'inline') {
|
112 |
|
|
$can_modify = true;
|
113 |
|
|
$editable_pages = $editable_pages+1;
|
114 |
|
|
} else {
|
115 |
|
|
$can_modify = false;
|
116 |
|
|
}
|
117 |
|
|
} elseif($page['visibility'] != 'deleted') {
|
118 |
|
|
$can_modify = true;
|
119 |
|
|
$editable_pages = $editable_pages+1;
|
120 |
|
|
}
|
121 |
|
|
} else {
|
122 |
|
|
$can_modify = false;
|
123 |
|
|
}
|
124 |
|
|
|
125 |
|
|
// Work out if we should show a plus or not
|
126 |
|
|
if(PAGE_TRASH != 'inline') {
|
127 |
|
|
$get_page_subs = $database->query("SELECT page_id,admin_groups,admin_users FROM ".TABLE_PREFIX."pages WHERE parent = '".$page['page_id']."' AND visibility!='deleted'");
|
128 |
|
|
} else {
|
129 |
|
|
$get_page_subs = $database->query("SELECT page_id,admin_groups,admin_users FROM ".TABLE_PREFIX."pages WHERE parent = '".$page['page_id']."'");
|
130 |
|
|
}
|
131 |
|
|
if($get_page_subs->numRows() > 0) {
|
132 |
|
|
$display_plus = true;
|
133 |
|
|
} else {
|
134 |
|
|
$display_plus = false;
|
135 |
|
|
}
|
136 |
|
|
|
137 |
|
|
// Work out how many pages there are for this parent
|
138 |
|
|
$num_pages = $get_pages->numRows();
|
139 |
|
|
?>
|
140 |
|
|
|
141 |
|
|
<li id="p<?php echo $page['parent']; ?>" style="padding: 2px 0px 2px 0px;">
|
142 |
|
|
<table width="720" cellpadding="1" cellspacing="0" border="0" style="background-color: #F0F0F0;">
|
143 |
|
|
<tr>
|
144 |
|
|
<td width="20" style="padding-left: <?php echo $page['level']*20; ?>px;">
|
145 |
|
|
<?php
|
146 |
|
|
if($display_plus == true) {
|
147 |
|
|
?>
|
148 |
|
|
<a href="javascript: toggle_visibility('p<?php echo $page['page_id']; ?>');" title="<?php echo $TEXT['EXPAND'].'/'.$TEXT['COLLAPSE']; ?>">
|
149 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/plus_16.png" onclick="toggle_plus_minus('<?php echo $page['page_id']; ?>');" name="plus_minus_<?php echo $page['page_id']; ?>" border="0" alt="+" />
|
150 |
|
|
</a>
|
151 |
|
|
<?php
|
152 |
|
|
}
|
153 |
|
|
?>
|
154 |
|
|
</td>
|
155 |
|
|
<?php if($admin->get_permission('pages_modify') == true AND $can_modify == true) { ?>
|
156 |
|
|
<td>
|
157 |
|
|
<a href="<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>"><?php echo ($page['page_title']); ?></a>
|
158 |
|
|
</td>
|
159 |
|
|
<?php } else { ?>
|
160 |
|
|
<td>
|
161 |
|
|
<?php echo ($page['page_title']); ?>
|
162 |
|
|
</td>
|
163 |
|
|
<?php } ?>
|
164 |
|
|
<td align="left" width="232">
|
165 |
|
|
<font color="#999999"><?php echo ($page['menu_title']); ?></font>
|
166 |
|
|
</td>
|
167 |
|
|
<td align="center" valign="middle" width="90">
|
168 |
|
|
<?php if($page['visibility'] == 'public') { ?>
|
169 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/visible_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PUBLIC']; ?>" border="0" />
|
170 |
|
|
<?php } elseif($page['visibility'] == 'private') { ?>
|
171 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/private_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PRIVATE']; ?>" border="0" />
|
172 |
|
|
<?php } elseif($page['visibility'] == 'registered') { ?>
|
173 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/keys_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['REGISTERED']; ?>" border="0" />
|
174 |
|
|
<?php } elseif($page['visibility'] == 'hidden') { ?>
|
175 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/hidden_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['HIDDEN']; ?>" border="0" />
|
176 |
|
|
<?php } elseif($page['visibility'] == 'none') { ?>
|
177 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/none_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['NONE']; ?>" border="0" />
|
178 |
|
|
<?php } elseif($page['visibility'] == 'deleted') { ?>
|
179 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/deleted_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['DELETED']; ?>" border="0" />
|
180 |
|
|
<?php } ?>
|
181 |
|
|
</td>
|
182 |
|
|
<td width="20">
|
183 |
|
|
<?php if($page['visibility'] != 'deleted') { ?>
|
184 |
|
|
<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
|
185 |
|
|
<a href="<?php echo ADMIN_URL; ?>/pages/settings.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['SETTINGS']; ?>">
|
186 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/modify_16.png" border="0" alt="<?php echo $TEXT['SETTINGS']; ?>" />
|
187 |
|
|
</a>
|
188 |
|
|
<?php } ?>
|
189 |
|
|
<?php } else { ?>
|
190 |
|
|
<a href="<?php echo ADMIN_URL; ?>/pages/restore.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['RESTORE']; ?>">
|
191 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/restore_16.png" border="0" alt="<?php echo $TEXT['RESTORE']; ?>" />
|
192 |
|
|
</a>
|
193 |
|
|
<?php } ?>
|
194 |
|
|
</td>
|
195 |
|
|
<td width="20">
|
196 |
|
|
<?php if($page['position'] != 1) { ?>
|
197 |
|
|
<?php if($page['visibility'] != 'deleted') { ?>
|
198 |
|
|
<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
|
199 |
|
|
<a href="<?php echo ADMIN_URL; ?>/pages/move_up.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MOVE_UP']; ?>">
|
200 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/up_16.png" border="0" alt="^" />
|
201 |
|
|
</a>
|
202 |
|
|
<?php } ?>
|
203 |
|
|
<?php } ?>
|
204 |
|
|
<?php } ?>
|
205 |
|
|
</td>
|
206 |
|
|
<td width="20">
|
207 |
|
|
<?php if($page['position'] != $num_pages) { ?>
|
208 |
|
|
<?php if($page['visibility'] != 'deleted') { ?>
|
209 |
|
|
<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
|
210 |
|
|
<a href="<?php echo ADMIN_URL; ?>/pages/move_down.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>">
|
211 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/down_16.png" border="0" alt="v" />
|
212 |
|
|
</a>
|
213 |
|
|
<?php } ?>
|
214 |
|
|
<?php } ?>
|
215 |
|
|
<?php } ?>
|
216 |
|
|
</td>
|
217 |
|
|
<td width="20">
|
218 |
|
|
<?php if($admin->get_permission('pages_delete') == true AND $can_modify == true) { ?>
|
219 |
|
|
<a href="javascript: confirm_link('<?php echo $MESSAGE['PAGES']['DELETE_CONFIRM']; ?>?', '<?php echo ADMIN_URL; ?>/pages/delete.php?page_id=<?php echo $page['page_id']; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
|
220 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" border="0" alt="X" />
|
221 |
|
|
</a>
|
222 |
|
|
<?php } ?>
|
223 |
|
|
</td>
|
224 |
|
|
<td width="20">
|
225 |
|
|
<?php if($page['visibility'] != 'deleted' AND $page['visibility'] != 'none') { ?>
|
226 |
242
|
stefan
|
<a href="<?php echo $admin->page_link($page['link']); ?>" target="_blank">
|
227 |
238
|
stefan
|
<img src="<?php echo ADMIN_URL; ?>/images/view_16.png" border="0" alt="<?php echo $TEXT['VIEW']; ?>" />
|
228 |
|
|
</a>
|
229 |
|
|
<?php } ?>
|
230 |
|
|
</td>
|
231 |
|
|
</tr>
|
232 |
|
|
</table>
|
233 |
|
|
</li>
|
234 |
|
|
|
235 |
|
|
<?php
|
236 |
|
|
// Get subs
|
237 |
|
|
$editable_pages=make_list($page['page_id'], $editable_pages);
|
238 |
|
|
}
|
239 |
|
|
|
240 |
|
|
}
|
241 |
|
|
?>
|
242 |
|
|
</ul>
|
243 |
|
|
<?php
|
244 |
|
|
return $editable_pages;
|
245 |
|
|
}
|
246 |
|
|
|
247 |
|
|
// Generate pages list
|
248 |
|
|
if($admin->get_permission('pages_view') == true) {
|
249 |
|
|
?>
|
250 |
|
|
<table cellpadding="0" cellspacing="0" width="100%" border="0">
|
251 |
|
|
<tr>
|
252 |
|
|
<td>
|
253 |
|
|
<h2><?php echo $HEADING['MODIFY_DELETE_PAGE']; ?></h2>
|
254 |
|
|
</td>
|
255 |
|
|
<td align="right">
|
256 |
|
|
<?php
|
257 |
|
|
// Check if there are any pages that are in trash, and if we should show a link to the trash page
|
258 |
|
|
if(PAGE_TRASH == 'separate') {
|
259 |
|
|
$query_trash = $database->query("SELECT page_id FROM ".TABLE_PREFIX."pages WHERE visibility = 'deleted'");
|
260 |
|
|
if($query_trash->numRows() > 0) {
|
261 |
|
|
?>
|
262 |
|
|
<a href="<?php echo ADMIN_URL; ?>/pages/trash.php">
|
263 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" alt="<?php echo $TEXT['PAGE_TRASH']; ?>" border="0" />
|
264 |
|
|
<?php echo $TEXT['VIEW_DELETED_PAGES']; ?></a>
|
265 |
|
|
<?php
|
266 |
|
|
}
|
267 |
|
|
}
|
268 |
|
|
?>
|
269 |
|
|
</td>
|
270 |
|
|
</tr>
|
271 |
|
|
</table>
|
272 |
|
|
<div class="pages_list">
|
273 |
|
|
<table cellpadding="1" cellspacing="0" width="720" border="0">
|
274 |
|
|
<tr>
|
275 |
|
|
<td width="20">
|
276 |
|
|
|
277 |
|
|
</td>
|
278 |
|
|
<td>
|
279 |
|
|
<?php echo $TEXT['PAGE_TITLE']; ?>:
|
280 |
|
|
</td>
|
281 |
|
|
<td width="175" align="left">
|
282 |
|
|
<?php echo $TEXT['MENU_TITLE']; ?>:
|
283 |
|
|
</td>
|
284 |
|
|
<td width="130" align="right">
|
285 |
|
|
<?php echo $TEXT['VISIBILITY']; ?>:
|
286 |
|
|
</td>
|
287 |
|
|
<td width="125" align="center">
|
288 |
|
|
<?php echo $TEXT['ACTIONS']; ?>:
|
289 |
|
|
</td>
|
290 |
|
|
</tr>
|
291 |
|
|
</table>
|
292 |
|
|
<?php
|
293 |
|
|
$editable_pages = make_list(0, 0);
|
294 |
|
|
?>
|
295 |
|
|
</div>
|
296 |
|
|
<div class="empty_list">
|
297 |
|
|
<?php echo $TEXT['NONE_FOUND']; ?>
|
298 |
|
|
</div>
|
299 |
|
|
<?php
|
300 |
|
|
} else {
|
301 |
|
|
$editable_pages = 0;
|
302 |
|
|
}
|
303 |
|
|
|
304 |
|
|
// Setup template object
|
305 |
|
|
$template = new Template(ADMIN_PATH.'/pages');
|
306 |
|
|
$template->set_file('page', 'template.html');
|
307 |
|
|
$template->set_block('page', 'main_block', 'main');
|
308 |
|
|
|
309 |
|
|
// Figure out if the no pages found message should be shown or not
|
310 |
|
|
if($editable_pages == 0) {
|
311 |
|
|
?>
|
312 |
|
|
<style type="text/css">
|
313 |
|
|
.pages_list {
|
314 |
|
|
display: none;
|
315 |
|
|
}
|
316 |
|
|
</style>
|
317 |
|
|
<?php
|
318 |
|
|
} else {
|
319 |
|
|
?>
|
320 |
|
|
<style type="text/css">
|
321 |
|
|
.empty_list {
|
322 |
|
|
display: none;
|
323 |
|
|
}
|
324 |
|
|
</style>
|
325 |
|
|
<?php
|
326 |
|
|
}
|
327 |
|
|
|
328 |
|
|
// Insert values into the add page form
|
329 |
|
|
|
330 |
|
|
// Group list 1
|
331 |
|
|
if($admin->get_group_id() == 1) {
|
332 |
|
|
$query = "SELECT * FROM ".TABLE_PREFIX."groups";
|
333 |
|
|
} else {
|
334 |
|
|
$query = "SELECT * FROM ".TABLE_PREFIX."groups WHERE group_id != '".$admin->get_group_id()."'";
|
335 |
|
|
}
|
336 |
|
|
$get_groups = $database->query($query);
|
337 |
|
|
$template->set_block('main_block', 'group_list_block', 'group_list');
|
338 |
|
|
// Insert admin group and current group first
|
339 |
|
|
$admin_group_name = $get_groups->fetchRow();
|
340 |
|
|
$template->set_var(array(
|
341 |
|
|
'ID' => 1,
|
342 |
|
|
'TOGGLE' => '',
|
343 |
|
|
'DISABLED' => ' disabled',
|
344 |
|
|
'LINK_COLOR' => '000000',
|
345 |
|
|
'CURSOR' => 'default',
|
346 |
|
|
'NAME' => $admin_group_name['name'],
|
347 |
|
|
'CHECKED' => ' checked'
|
348 |
|
|
)
|
349 |
|
|
);
|
350 |
|
|
$template->parse('group_list', 'group_list_block', true);
|
351 |
|
|
if($admin->get_group_id() != 1) {
|
352 |
|
|
$template->set_var(array(
|
353 |
|
|
'ID' => $admin->get_group_id(),
|
354 |
|
|
'TOGGLE' => '',
|
355 |
|
|
'DISABLED' => ' disabled',
|
356 |
|
|
'LINK_COLOR' => '000000',
|
357 |
|
|
'CURSOR' => 'default',
|
358 |
|
|
'NAME' => $admin->get_group_name(),
|
359 |
|
|
'CHECKED' => ' checked'
|
360 |
|
|
)
|
361 |
|
|
);
|
362 |
|
|
$template->parse('group_list', 'group_list_block', true);
|
363 |
|
|
}
|
364 |
|
|
while($group = $get_groups->fetchRow()) {
|
365 |
|
|
// Check if the group is allowed to edit pages
|
366 |
|
|
$system_permissions = explode(',', $group['system_permissions']);
|
367 |
|
|
if(is_numeric(array_search('pages_modify', $system_permissions))) {
|
368 |
|
|
$template->set_var(array(
|
369 |
|
|
'ID' => $group['group_id'],
|
370 |
|
|
'TOGGLE' => $group['group_id'],
|
371 |
|
|
'CHECKED' => '',
|
372 |
|
|
'DISABLED' => '',
|
373 |
|
|
'LINK_COLOR' => '',
|
374 |
|
|
'CURSOR' => 'pointer',
|
375 |
|
|
'NAME' => $group['name'],
|
376 |
|
|
'CHECKED' => ''
|
377 |
|
|
)
|
378 |
|
|
);
|
379 |
|
|
$template->parse('group_list', 'group_list_block', true);
|
380 |
|
|
}
|
381 |
|
|
}
|
382 |
|
|
// Group list 2
|
383 |
|
|
if($admin->get_group_id() == 1) {
|
384 |
|
|
$query = "SELECT * FROM ".TABLE_PREFIX."groups";
|
385 |
|
|
} else {
|
386 |
|
|
$query = "SELECT * FROM ".TABLE_PREFIX."groups WHERE group_id != '".$admin->get_group_id()."'";
|
387 |
|
|
}
|
388 |
|
|
$get_groups = $database->query($query);
|
389 |
|
|
$template->set_block('main_block', 'group_list_block2', 'group_list2');
|
390 |
|
|
// Insert admin group and current group first
|
391 |
|
|
$admin_group_name = $get_groups->fetchRow();
|
392 |
|
|
$template->set_var(array(
|
393 |
|
|
'ID' => 1,
|
394 |
|
|
'TOGGLE' => '',
|
395 |
|
|
'DISABLED' => ' disabled',
|
396 |
|
|
'LINK_COLOR' => '000000',
|
397 |
|
|
'CURSOR' => 'default',
|
398 |
|
|
'NAME' => $admin_group_name['name'],
|
399 |
|
|
'CHECKED' => ' checked'
|
400 |
|
|
)
|
401 |
|
|
);
|
402 |
|
|
$template->parse('group_list2', 'group_list_block2', true);
|
403 |
|
|
if($admin->get_group_id() != 1) {
|
404 |
|
|
$template->set_var(array(
|
405 |
|
|
'ID' => $admin->get_group_id(),
|
406 |
|
|
'TOGGLE' => '',
|
407 |
|
|
'DISABLED' => ' disabled',
|
408 |
|
|
'LINK_COLOR' => '000000',
|
409 |
|
|
'CURSOR' => 'default',
|
410 |
|
|
'NAME' => $admin->get_group_name(),
|
411 |
|
|
'CHECKED' => ' checked'
|
412 |
|
|
)
|
413 |
|
|
);
|
414 |
|
|
$template->parse('group_list2', 'group_list_block2', true);
|
415 |
|
|
}
|
416 |
|
|
while($group = $get_groups->fetchRow()) {
|
417 |
|
|
$template->set_var(array(
|
418 |
|
|
'ID' => $group['group_id'],
|
419 |
|
|
'TOGGLE' => $group['group_id'],
|
420 |
|
|
'CHECKED' => '',
|
421 |
|
|
'DISABLED' => '',
|
422 |
|
|
'LINK_COLOR' => '',
|
423 |
|
|
'CURSOR' => 'pointer',
|
424 |
|
|
'NAME' => $group['name'],
|
425 |
|
|
'CHECKED' => ''
|
426 |
|
|
)
|
427 |
|
|
);
|
428 |
|
|
$template->parse('group_list2', 'group_list_block2', true);
|
429 |
|
|
}
|
430 |
|
|
|
431 |
|
|
// Parent page list
|
432 |
|
|
$database = new database();
|
433 |
|
|
function parent_list($parent) {
|
434 |
|
|
global $admin, $database, $template;
|
435 |
|
|
$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' AND visibility!='deleted' ORDER BY position ASC";
|
436 |
|
|
$get_pages = $database->query($query);
|
437 |
|
|
while($page = $get_pages->fetchRow()) {
|
438 |
|
|
// Stop users from adding pages with a level of more than the set page level limit
|
439 |
|
|
if($page['level']+1 < PAGE_LEVEL_LIMIT) {
|
440 |
|
|
// Get user perms
|
441 |
|
|
$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
|
442 |
|
|
$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
|
443 |
|
|
if(is_numeric(array_search($admin->get_group_id(), $admin_groups)) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) {
|
444 |
|
|
$can_modify = true;
|
445 |
|
|
} else {
|
446 |
|
|
$can_modify = false;
|
447 |
|
|
}
|
448 |
|
|
// Title -'s prefix
|
449 |
|
|
$title_prefix = '';
|
450 |
|
|
for($i = 1; $i <= $page['level']; $i++) { $title_prefix .= ' - '; }
|
451 |
|
|
$template->set_var(array(
|
452 |
|
|
'ID' => $page['page_id'],
|
453 |
|
|
'TITLE' => ($title_prefix.$page['page_title'])
|
454 |
|
|
)
|
455 |
|
|
);
|
456 |
|
|
if($can_modify == true) {
|
457 |
|
|
$template->set_var('DISABLED', '');
|
458 |
|
|
} else {
|
459 |
|
|
$template->set_var('DISABLED', ' disabled');
|
460 |
|
|
}
|
461 |
|
|
$template->parse('page_list2', 'page_list_block2', true);
|
462 |
|
|
}
|
463 |
|
|
parent_list($page['page_id']);
|
464 |
|
|
}
|
465 |
|
|
}
|
466 |
|
|
$template->set_block('main_block', 'page_list_block2', 'page_list2');
|
467 |
|
|
if($admin->get_permission('pages_add_l0') == true) {
|
468 |
|
|
$template->set_var(array(
|
469 |
|
|
'ID' => '0',
|
470 |
|
|
'TITLE' => $TEXT['NONE'],
|
471 |
|
|
'SELECTED' => ' selected',
|
472 |
|
|
'DISABLED' => ''
|
473 |
|
|
)
|
474 |
|
|
);
|
475 |
|
|
$template->parse('page_list2', 'page_list_block2', true);
|
476 |
|
|
}
|
477 |
|
|
parent_list(0);
|
478 |
|
|
|
479 |
|
|
// Explode module permissions
|
480 |
|
|
$module_permissions = $_SESSION['MODULE_PERMISSIONS'];
|
481 |
|
|
// Modules list
|
482 |
|
|
$template->set_block('main_block', 'module_list_block', 'module_list');
|
483 |
|
|
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'page'");
|
484 |
|
|
if($result->numRows() > 0) {
|
485 |
|
|
while ($module = $result->fetchRow()) {
|
486 |
|
|
// Check if user is allowed to use this module
|
487 |
|
|
if(!isset($module['function'])) { $module['function'] = 'unknown'; }
|
488 |
|
|
if(!is_numeric(array_search($module['directory'], $module_permissions))) {
|
489 |
|
|
$template->set_var('VALUE', $module['directory']);
|
490 |
|
|
$template->set_var('NAME', $module['name']);
|
491 |
|
|
if($module['directory'] == 'wysiwyg') {
|
492 |
|
|
$template->set_var('SELECTED', ' selected');
|
493 |
|
|
} else {
|
494 |
|
|
$template->set_var('SELECTED', '');
|
495 |
|
|
}
|
496 |
|
|
$template->parse('module_list', 'module_list_block', true);
|
497 |
|
|
}
|
498 |
|
|
if(isset($module_function)) { unset($module_function); } // Unset module type
|
499 |
|
|
}
|
500 |
|
|
}
|
501 |
|
|
|
502 |
|
|
// Insert language headings
|
503 |
|
|
$template->set_var(array(
|
504 |
|
|
'HEADING_ADD_PAGE' => $HEADING['ADD_PAGE'],
|
505 |
|
|
'HEADING_MODIFY_INTRO_PAGE' => $HEADING['MODIFY_INTRO_PAGE']
|
506 |
|
|
)
|
507 |
|
|
);
|
508 |
|
|
// Insert language text and messages
|
509 |
|
|
$template->set_var(array(
|
510 |
|
|
'TEXT_TITLE' => $TEXT['TITLE'],
|
511 |
|
|
'TEXT_TYPE' => $TEXT['TYPE'],
|
512 |
|
|
'TEXT_PARENT' => $TEXT['PARENT'],
|
513 |
|
|
'TEXT_VISIBILITY' => $TEXT['VISIBILITY'],
|
514 |
|
|
'TEXT_PUBLIC' => $TEXT['PUBLIC'],
|
515 |
|
|
'TEXT_PRIVATE' => $TEXT['PRIVATE'],
|
516 |
|
|
'TEXT_REGISTERED' => $TEXT['REGISTERED'],
|
517 |
|
|
'TEXT_HIDDEN' => $TEXT['HIDDEN'],
|
518 |
|
|
'TEXT_NONE' => $TEXT['NONE'],
|
519 |
|
|
'TEXT_NONE_FOUND' => $TEXT['NONE_FOUND'],
|
520 |
|
|
'TEXT_ADD' => $TEXT['ADD'],
|
521 |
|
|
'TEXT_RESET' => $TEXT['RESET'],
|
522 |
|
|
'TEXT_ADMINISTRATORS' => $TEXT['ADMINISTRATORS'],
|
523 |
|
|
'TEXT_PRIVATE_VIEWERS' => $TEXT['PRIVATE_VIEWERS'],
|
524 |
|
|
'TEXT_REGISTERED_VIEWERS' => $TEXT['REGISTERED_VIEWERS'],
|
525 |
|
|
'INTRO_LINK' => $MESSAGE['PAGES']['INTRO_LINK'],
|
526 |
|
|
)
|
527 |
|
|
);
|
528 |
|
|
|
529 |
|
|
// Insert permissions values
|
530 |
|
|
if($admin->get_permission('pages_add') != true) {
|
531 |
|
|
$template->set_var('DISPLAY_ADD', 'hide');
|
532 |
|
|
} elseif($admin->get_permission('pages_add_l0') != true AND $editable_pages == 0) {
|
533 |
|
|
$template->set_var('DISPLAY_ADD', 'hide');
|
534 |
|
|
}
|
535 |
|
|
if($admin->get_permission('pages_intro') != true OR INTRO_PAGE != 'enabled') {
|
536 |
|
|
$template->set_var('DISPLAY_INTRO', 'hide');
|
537 |
|
|
}
|
538 |
|
|
|
539 |
|
|
|
540 |
|
|
// Parse template object
|
541 |
|
|
$template->parse('main', 'main_block', false);
|
542 |
|
|
$template->pparse('output', 'page');
|
543 |
|
|
|
544 |
|
|
// Print admin
|
545 |
|
|
$admin->print_footer();
|
546 |
|
|
|
547 |
239
|
stefan
|
?>
|