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