Project

General

Profile

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