Project

General

Profile

1 1009 Ruebenwurz
<?php
2
3
// $Id$
4
5
/*
6
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2009, Ryan Djurovich
9
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
function make_list($parent, $editable_pages) {
33
	// Get objects and vars from outside this function
34
	global $admin, $template, $database, $TEXT, $MESSAGE, $HEADING, $page_tmp_id;
35
	?>
36
	<ul id="p<?php echo $parent; ?>" <?php if($parent != 0) { echo 'class="page_list" '; if(isset($_COOKIE['p'.$parent]) && $_COOKIE['p'.$parent] == '1'){ echo 'style="display:block"'; }} ?>>
37
	<?php
38
	// Get page list from database
39
	$database = new database();
40
	if(PAGE_TRASH != 'inline') {
41
		$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' AND visibility != 'deleted' ORDER BY position ASC";
42
	} else {
43
		$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' ORDER BY position ASC";
44
	}
45
	$get_pages = $database->query($query);
46
	// Insert values into main page list
47
	if($get_pages->numRows() > 0) {
48
		while($page = $get_pages->fetchRow()) {
49
			// Get user perms
50
			$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
51
			$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
52
			$in_group = FALSE;
53
			foreach($admin->get_groups_id() as $cur_gid) {
54
				if (in_array($cur_gid, $admin_groups)) {
55
					$in_group = TRUE;
56
				}
57
			}
58
			if(($in_group) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) {
59
				if($page['visibility'] == 'deleted') {
60
					if(PAGE_TRASH == 'inline') {
61
						$can_modify = true;
62
						$editable_pages = $editable_pages+1;
63
					} else {
64
						$can_modify = false;
65
					}
66
				} elseif($page['visibility'] != 'deleted') {
67
					$can_modify = true;
68
					$editable_pages = $editable_pages+1;
69
				}
70
			} else {
71
				if($page['visibility'] == 'private') {
72
					continue;
73
				}
74
				else {
75
					$can_modify = false;
76
				}
77
			}
78
			// Work out if we should show a plus or not
79
			if(PAGE_TRASH != 'inline') {
80
				$get_page_subs = $database->query("SELECT page_id,admin_groups,admin_users FROM ".TABLE_PREFIX."pages WHERE parent = '".$page['page_id']."' AND visibility!='deleted'");
81
			} else {
82
				$get_page_subs = $database->query("SELECT page_id,admin_groups,admin_users FROM ".TABLE_PREFIX."pages WHERE parent = '".$page['page_id']."'");
83
			}
84
			if($get_page_subs->numRows() > 0) {
85
				$display_plus = true;
86
			} else {
87
				$display_plus = false;
88
			}
89
			// Work out how many pages there are for this parent
90
			$num_pages = $get_pages->numRows();
91
			?>
92
			<li class="p<?php echo $page['parent']; ?>">
93 1128 Ruebenwurz
			<table class="pages_view" border="0" cellpadding="0" cellspacing="0">
94 1009 Ruebenwurz
			<tr>
95 1128 Ruebenwurz
				<td valign="middle" width="20" style="padding-left: <?php if($page['level'] > 0){ echo $page['level']*20; } else { echo '7'; } ?>px;">
96 1009 Ruebenwurz
					<?php
97
					if($display_plus == true) {
98
					?>
99
					<a href="javascript: toggle_visibility('p<?php echo $page['page_id']; ?>');" title="<?php echo $TEXT['EXPAND'].'/'.$TEXT['COLLAPSE']; ?>">
100
						<img src="<?php echo THEME_URL; ?>/images/<?php if(isset($_COOKIE['p'.$page['page_id']]) && $_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="+" />
101
					</a>
102
					<?php
103
					}
104
					?>
105
				</td>
106
				<?php if($admin->get_permission('pages_modify') == true AND $can_modify == true) { ?>
107 1148 Luisehahne
				<td class="list_menu_title">
108 1009 Ruebenwurz
					<a href="<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>">
109
						<?php if($page['visibility'] == 'public') { ?>
110
							<img src="<?php echo THEME_URL; ?>/images/visible_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PUBLIC']; ?>" class="page_list_rights" />
111
						<?php } elseif($page['visibility'] == 'private') { ?>
112
							<img src="<?php echo THEME_URL; ?>/images/private_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PRIVATE']; ?>" class="page_list_rights" />
113
						<?php } elseif($page['visibility'] == 'registered') { ?>
114
							<img src="<?php echo THEME_URL; ?>/images/keys_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['REGISTERED']; ?>" class="page_list_rights" />
115
						<?php } elseif($page['visibility'] == 'hidden') { ?>
116
							<img src="<?php echo THEME_URL; ?>/images/hidden_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['HIDDEN']; ?>" class="page_list_rights" />
117
						<?php } elseif($page['visibility'] == 'none') { ?>
118
							<img src="<?php echo THEME_URL; ?>/images/none_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['NONE']; ?>" class="page_list_rights" />
119
						<?php } elseif($page['visibility'] == 'deleted') { ?>
120
							<img src="<?php echo THEME_URL; ?>/images/deleted_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['DELETED']; ?>" class="page_list_rights" />
121
						<?php }
122 1148 Luisehahne
						echo '<span class="modify_link">'.($page['menu_title']).'</span>'; ?>
123 1009 Ruebenwurz
					</a>
124
				</td>
125
				<?php } else { ?>
126 1148 Luisehahne
				<td class="list_menu_title">
127 1009 Ruebenwurz
					<?php if($page['visibility'] == 'public') { ?>
128
						<img src="<?php echo THEME_URL; ?>/images/visible_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PUBLIC']; ?>" class="page_list_rights" />
129
					<?php } elseif($page['visibility'] == 'private') { ?>
130
						<img src="<?php echo THEME_URL; ?>/images/private_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PRIVATE']; ?>" class="page_list_rights" />
131
					<?php } elseif($page['visibility'] == 'registered') { ?>
132
						<img src="<?php echo THEME_URL; ?>/images/keys_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['REGISTERED']; ?>" class="page_list_rights" />
133
					<?php } elseif($page['visibility'] == 'hidden') { ?>
134
						<img src="<?php echo THEME_URL; ?>/images/hidden_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['HIDDEN']; ?>" class="page_list_rights" />
135
					<?php } elseif($page['visibility'] == 'none') { ?>
136
						<img src="<?php echo THEME_URL; ?>/images/none_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['NONE']; ?>" class="page_list_rights" />
137
					<?php } elseif($page['visibility'] == 'deleted') { ?>
138
						<img src="<?php echo THEME_URL; ?>/images/deleted_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['DELETED']; ?>" class="page_list_rights" />
139
					<?php }
140 1148 Luisehahne
					echo ($page['menu_title']); ?>
141 1009 Ruebenwurz
				</td>
142
				<?php } ?>
143 1148 Luisehahne
				<td class="list_page_title">
144
					<?php echo ($page['page_title']); ?>
145 1009 Ruebenwurz
				</td>
146 1128 Ruebenwurz
				<td class="list_page_id">
147
					<?php echo $page['page_id']; ?>
148
				</td>
149 1035 Ruebenwurz
				<td class="list_actions">
150 1009 Ruebenwurz
					<?php if($page['visibility'] != 'deleted' AND $page['visibility'] != 'none') { ?>
151
					<a href="<?php echo $admin->page_link($page['link']); ?>" target="_blank" title="<?php echo $TEXT['VIEW']; ?>">
152
						<img src="<?php echo THEME_URL; ?>/images/view_16.png" border="0" alt="<?php echo $TEXT['VIEW']; ?>" />
153
					</a>
154
					<?php } ?>
155
				</td>
156 1035 Ruebenwurz
				<td class="list_actions">
157 1009 Ruebenwurz
					<?php if($page['visibility'] != 'deleted') { ?>
158
						<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
159
						<a href="<?php echo ADMIN_URL; ?>/pages/settings.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['SETTINGS']; ?>">
160
							<img src="<?php echo THEME_URL; ?>/images/modify_16.png" border="0" alt="<?php echo $TEXT['SETTINGS']; ?>" />
161
						</a>
162
						<?php } ?>
163
					<?php } else { ?>
164
						<a href="<?php echo ADMIN_URL; ?>/pages/restore.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['RESTORE']; ?>">
165
							<img src="<?php echo THEME_URL; ?>/images/restore_16.png" border="0" alt="<?php echo $TEXT['RESTORE']; ?>" />
166
						</a>
167
					<?php } ?>
168
				</td>
169
				<!-- MANAGE SECTIONS AND DATES BUTTONS -->
170 1035 Ruebenwurz
				<td class="list_actions">
171 1009 Ruebenwurz
				<?php
172
				// Work-out if we should show the "manage dates" link
173
				if(MANAGE_SECTIONS == 'enabled' && $admin->get_permission('pages_modify')==true && $can_modify==true) {
174
					$query_sections = $database->query("SELECT publ_start, publ_end FROM ".TABLE_PREFIX."sections WHERE page_id = '{$page['page_id']}' AND module != 'menu_link'");
175
					if($query_sections->numRows() > 0) {
176
						$mdate_display=false;
177
						while($mdate_res = $query_sections->fetchRow()) {
178
							if($mdate_res['publ_start']!='0' || $mdate_res['publ_end']!='0') {
179
								$mdate_display=true;
180
								break;
181
							}
182
						}
183
						if($mdate_display==1) {
184
							$file=$admin->page_is_active($page)?"clock_16.png":"clock_red_16.png";
185
							?>
186
							<a href="<?php echo ADMIN_URL; ?>/pages/sections.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $HEADING['MANAGE_SECTIONS']; ?>">
187
							<img src="<?php echo THEME_URL."/images/$file"; ?>" border="0" alt="<?php echo $HEADING['MANAGE_SECTIONS']; ?>" />
188
							</a>
189
						<?php } else { ?>
190
							<a href="<?php echo ADMIN_URL; ?>/pages/sections.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $HEADING['MANAGE_SECTIONS']; ?>">
191
							<img src="<?php echo THEME_URL; ?>/images/noclock_16.png" border="0" alt="<?php echo $HEADING['MANAGE_SECTIONS']; ?>" /></a>
192
						<?php } ?>
193
					<?php } ?>
194
				<?php } ?>
195
				</td>
196 1035 Ruebenwurz
				<td class="list_actions">
197 1009 Ruebenwurz
				<?php if($page['position'] != 1) { ?>
198
					<?php if($page['visibility'] != 'deleted') { ?>
199
						<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
200
						<a href="<?php echo ADMIN_URL; ?>/pages/move_up.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MOVE_UP']; ?>">
201 1078 Ruebenwurz
							<img src="<?php echo THEME_URL; ?>/images/up_16.png" border="0" alt="<?php echo $TEXT['MOVE_UP']; ?>" />
202 1009 Ruebenwurz
						</a>
203
						<?php } ?>
204
					<?php } ?>
205
				<?php } ?>
206
				</td>
207 1035 Ruebenwurz
				<td class="list_actions">
208 1009 Ruebenwurz
				<?php if($page['position'] != $num_pages) { ?>
209
					<?php if($page['visibility'] != 'deleted') { ?>
210
						<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
211
						<a href="<?php echo ADMIN_URL; ?>/pages/move_down.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>">
212 1078 Ruebenwurz
							<img src="<?php echo THEME_URL; ?>/images/down_16.png" border="0" alt="<?php echo $TEXT['MOVE_DOWN']; ?>" />
213 1009 Ruebenwurz
						</a>
214
						<?php } ?>
215
					<?php } ?>
216
				<?php } ?>
217
				</td>
218 1035 Ruebenwurz
				<td class="list_actions">
219 1009 Ruebenwurz
					<?php if($admin->get_permission('pages_delete') == true AND $can_modify == true) { ?>
220
					<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']; ?>">
221 1078 Ruebenwurz
						<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="<?php echo $TEXT['DELETE']; ?>" />
222 1009 Ruebenwurz
					</a>
223
					<?php } ?>
224
				</td>
225
			</tr>
226
			</table>
227
			</li>
228
			<?php
229
			if ( $page['parent'] = 0) {
230
				$page_tmp_id = $page['page_id'];
231
			}
232
			// Get subs
233
			$editable_pages=make_list($page['page_id'], $editable_pages);
234
		}
235
	}
236
	?>
237
	</ul>
238
	<?php
239
	return $editable_pages;
240
}
241
242
// Generate pages list
243
if($admin->get_permission('pages_view') == true) {
244
	?>
245
	<div class="jsadmin hide"></div>
246
	<table cellpadding="0" cellspacing="0" width="100%" border="0">
247
	<tr>
248
		<td>
249
			<h2><?php echo $HEADING['MODIFY_DELETE_PAGE']; ?></h2>
250
		</td>
251
		<td align="right">
252
			<?php
253
				// Check if there are any pages that are in trash, and if we should show a link to the trash page
254
				if(PAGE_TRASH == 'separate') {
255
					$query_trash = $database->query("SELECT page_id FROM ".TABLE_PREFIX."pages WHERE visibility = 'deleted'");
256
					if($query_trash->numRows() > 0) {
257
						?>
258
						<a href="<?php echo ADMIN_URL; ?>/pages/trash.php">
259
						<img src="<?php echo THEME_URL; ?>/images/delete_16.png" alt="<?php echo $TEXT['PAGE_TRASH']; ?>" border="0" />
260
						<?php echo $TEXT['VIEW_DELETED_PAGES']; ?></a>
261
						<?php
262
					}
263
				}
264
			?>
265
		</td>
266
	</tr>
267
	</table>
268
	<div class="pages_list">
269
	<table cellpadding="0" cellspacing="0" border="0">
270
	<tr>
271 1148 Luisehahne
		<td class="header_list_menu_title">
272
			<?php echo $TEXT['VISIBILITY'] .' / ' .$TEXT['MENU_TITLE']; ?>:
273
		</td>
274 1035 Ruebenwurz
		<td class="header_list_page_title">
275 1148 Luisehahne
			<?php echo $TEXT['PAGE_TITLE']; ?>:
276 1009 Ruebenwurz
		</td>
277 1128 Ruebenwurz
		<td class="header_list_page_id">
278
			ID:
279
		</td>
280 1035 Ruebenwurz
		<td class="header_list_actions">
281 1009 Ruebenwurz
			<?php echo $TEXT['ACTIONS']; ?>:
282 1035 Ruebenwurz
		</td>
283 1009 Ruebenwurz
	</tr>
284
	</table>
285
	<?php
286
	$page_tmp_id = 0;
287
	$editable_pages = make_list(0, 0);
288
	?>
289
	</div>
290
	<div class="empty_list">
291
		<?php echo $TEXT['NONE_FOUND']; ?>
292
	</div>
293
	<?php
294
} else {
295
	$editable_pages = 0;
296
}
297
298
// Setup template object
299
$template = new Template(THEME_PATH.'/templates');
300
$template->set_file('page', 'pages.htt');
301
$template->set_block('page', 'main_block', 'main');
302
303
// Figure out if the no pages found message should be shown or not
304
if($editable_pages == 0) {
305
	?>
306
	<style type="text/css">
307
	.pages_list {
308
		display: none;
309
	}
310
	</style>
311
	<?php
312
} else {
313
	?>
314
	<style type="text/css">
315
	.empty_list {
316
		display: none;
317
	}
318
	</style>
319
	<?php
320
}
321
322
// Insert values into the add page form
323
324
// Group list 1
325
326
	$query = "SELECT * FROM ".TABLE_PREFIX."groups";
327
	$get_groups = $database->query($query);
328
	$template->set_block('main_block', 'group_list_block', 'group_list');
329
	// Insert admin group and current group first
330
	$admin_group_name = $get_groups->fetchRow();
331
	$template->set_var(array(
332
									'ID' => 1,
333
									'TOGGLE' => '',
334
									'DISABLED' => ' disabled="disabled"',
335
									'LINK_COLOR' => '000000',
336
									'CURSOR' => 'default',
337
									'NAME' => $admin_group_name['name'],
338 1069 Ruebenwurz
									'CHECKED' => ' checked="checked"'
339 1009 Ruebenwurz
									)
340
							);
341
	$template->parse('group_list', 'group_list_block', true);
342
343
	while($group = $get_groups->fetchRow()) {
344
		// check if the user is a member of this group
345
		$flag_disabled = '';
346
		$flag_checked =  '';
347
		$flag_cursor =   'pointer';
348
		$flag_color =    '';
349
		if (in_array($group["group_id"], $admin->get_groups_id())) {
350
			$flag_disabled = ''; //' disabled';
351
			$flag_checked =  ' checked="checked"';
352
			$flag_cursor =   'default';
353
			$flag_color =    '000000';
354
		}
355
356
		// Check if the group is allowed to edit pages
357
		$system_permissions = explode(',', $group['system_permissions']);
358
		if(is_numeric(array_search('pages_modify', $system_permissions))) {
359
			$template->set_var(array(
360
											'ID' => $group['group_id'],
361
											'TOGGLE' => $group['group_id'],
362
											'CHECKED' => $flag_checked,
363
											'DISABLED' => $flag_disabled,
364
											'LINK_COLOR' => $flag_color,
365
											'CURSOR' => $flag_checked,
366
											'NAME' => $group['name'],
367
											)
368
									);
369
			$template->parse('group_list', 'group_list_block', true);
370
		}
371
	}
372
// Group list 2
373
374
	$query = "SELECT * FROM ".TABLE_PREFIX."groups";
375
376
	$get_groups = $database->query($query);
377
	$template->set_block('main_block', 'group_list_block2', 'group_list2');
378
	// Insert admin group and current group first
379
	$admin_group_name = $get_groups->fetchRow();
380
	$template->set_var(array(
381
									'ID' => 1,
382
									'TOGGLE' => '',
383
									'DISABLED' => ' disabled="disabled"',
384
									'LINK_COLOR' => '000000',
385
									'CURSOR' => 'default',
386
									'NAME' => $admin_group_name['name'],
387 1069 Ruebenwurz
									'CHECKED' => ' checked="checked"'
388 1009 Ruebenwurz
									)
389
							);
390
	$template->parse('group_list2', 'group_list_block2', true);
391
392
	while($group = $get_groups->fetchRow()) {
393
		// check if the user is a member of this group
394
		$flag_disabled = '';
395
		$flag_checked =  '';
396
		$flag_cursor =   'pointer';
397
		$flag_color =    '';
398
		if (in_array($group["group_id"], $admin->get_groups_id())) {
399
			$flag_disabled = ''; //' disabled';
400
			$flag_checked =  ' checked="checked"';
401
			$flag_cursor =   'default';
402
			$flag_color =    '000000';
403
		}
404
405
		$template->set_var(array(
406
										'ID' => $group['group_id'],
407
										'TOGGLE' => $group['group_id'],
408
										'CHECKED' => $flag_checked,
409
										'DISABLED' => $flag_disabled,
410
										'LINK_COLOR' => $flag_color,
411
										'CURSOR' => $flag_cursor,
412
										'NAME' => $group['name'],
413
										)
414
								);
415
		$template->parse('group_list2', 'group_list_block2', true);
416
	}
417
418
// Parent page list
419
$database = new database();
420
function parent_list($parent) {
421
	global $admin, $database, $template;
422
	$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' AND visibility!='deleted' ORDER BY position ASC";
423
	$get_pages = $database->query($query);
424
	while($page = $get_pages->fetchRow()) {
425
		if($admin->page_is_visible($page)==false)
426
			continue;
427
		// if parent = 0 set flag_icon
428
		$template->set_var('FLAG_ROOT_ICON',' none ');
429
		if( $page['parent'] == 0 ) {
430
			$template->set_var('FLAG_ROOT_ICON','url('.THEME_URL.'/images/flags/'.strtolower($page['language']).'.png)');
431
		}
432
		// Stop users from adding pages with a level of more than the set page level limit
433
		if($page['level']+1 < PAGE_LEVEL_LIMIT) {
434
			// Get user perms
435
			$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
436
			$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
437
438
			$in_group = FALSE;
439
			foreach($admin->get_groups_id() as $cur_gid) {
440
				if (in_array($cur_gid, $admin_groups)) {
441
					$in_group = TRUE;
442
				}
443
			}
444
			if(($in_group) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) {
445
				$can_modify = true;
446
			} else {
447
				$can_modify = false;
448
			}
449
			// Title -'s prefix
450
			$title_prefix = '';
451
			for($i = 1; $i <= $page['level']; $i++) { $title_prefix .= ' - '; }
452
				$template->set_var(array(
453
												'ID' => $page['page_id'],
454
												'TITLE' => ($title_prefix.$page['page_title'])
455
												)
456
										);
457
				if($can_modify == true) {
458
					$template->set_var('DISABLED', '');
459
				} else {
460
					$template->set_var('DISABLED', ' disabled="disabled" class="disabled"');
461
				}
462
				$template->parse('page_list2', 'page_list_block2', true);
463
		}
464
		parent_list($page['page_id']);
465
	}
466
}
467
$template->set_block('main_block', 'page_list_block2', 'page_list2');
468
if($admin->get_permission('pages_add_l0') == true) {
469
	$template->set_var(array(
470
									'ID' => '0',
471
									'TITLE' => $TEXT['NONE'],
472
									'SELECTED' => ' selected="selected"',
473
									'DISABLED' => ''
474
									)
475
							);
476
	$template->parse('page_list2', 'page_list_block2', true);
477
}
478
parent_list(0);
479
480
// Explode module permissions
481
$module_permissions = $_SESSION['MODULE_PERMISSIONS'];
482
// Modules list
483
$template->set_block('main_block', 'module_list_block', 'module_list');
484
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'page' order by name");
485
if($result->numRows() > 0) {
486
	while ($module = $result->fetchRow()) {
487
		// Check if user is allowed to use this module
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="selected"');
493
			} else {
494
				$template->set_var('SELECTED', '');
495
			}
496
			$template->parse('module_list', 'module_list_block', true);
497
		}
498
	}
499
}
500
501
// Insert urls
502
$template->set_var(array(
503
								'THEME_URL' => THEME_URL,
504
								'WB_URL' => WB_URL,
505
								'WB_PATH' => WB_PATH,
506
								'ADMIN_URL' => ADMIN_URL,
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
?>