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