Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        admin
5
 * @package         pages
6
 * @author          Ryan Djurovich, WebsiteBaker Project
7
 * @copyright       2009-2012, Website Baker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.x
11
 * @requirements    PHP 5.2.2 and higher and higher
12
 * @version         $Id: index.php 1837 2012-12-13 03:10:08Z Luisehahne $
13
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/pages/index.php $
14
 * @lastmodified    $Date: 2012-12-13 04:10:08 +0100 (Thu, 13 Dec 2012) $
15
 *
16
 */
17

    
18
require('../../config.php');
19
require_once(WB_PATH.'/framework/class.admin.php');
20
$admin = new admin('Pages', 'pages');
21
$admin->clearIDKEY();
22
// Include the WB functions file
23
require_once(WB_PATH.'/framework/functions.php');
24
// eggsurplus: add child pages for a specific page
25
/**/
26

    
27
echo '<script type="text/javascript" src="'.ADMIN_URL.'/pages/eggsurplus.js"></script>'.PHP_EOL;
28
// fixes A URI contains impermissible characters or quotes around the URI are not closed.
29
$MESSAGE['PAGES_DELETE_CONFIRM'] = url_encode(  $MESSAGE['PAGES_DELETE_CONFIRM'] );
30

    
31
function set_node ($parent,& $par)
32
{
33
    $retval = '';
34
	if ($par['num_subs']) {
35
		$retval .= "\n".'<ul id="p'.$parent.'"';
36
		if ($parent != 0) {
37
			$retval .= ' class="page_list"';
38
			if (isset ($_COOKIE['p'.$parent]) && $_COOKIE['p'.$parent] == '1') {
39
				 $retval .= ' style="display:block"';
40
			}
41
		}
42
		$retval .= ">\n";
43
 	}
44
	return $retval;
45
}
46

    
47
function make_list($parent = 0, $editable_pages = 0) {
48
	// Get objects and vars from outside this function
49
	global $admin, $template, $TEXT, $MESSAGE, $HEADING, $par;
50
	$database = WbDatabase::getInstance();
51
	static $row = 0;
52
//	static $iLevel = 0;
53
//	static $iOldLevel = 0;
54
//	static $aRowLevel = array();
55
	
56
    print set_node ($parent, $par);
57
	// Get page list from database
58
 $sql = 'SELECT `module`, MAX(s.`publ_start` + s.`publ_end`) published, p.* '
59
      . 'FROM `'.TABLE_PREFIX.'pages` p '
60
      .     'INNER JOIN `'.TABLE_PREFIX.'sections` s ON p.`page_id` = s.`page_id` '
61
      . 'WHERE `parent`='.$parent.((PAGE_TRASH != 'inline') ?  ' AND `visibility`!=\'deleted\' ' : ' ')
62
      . 'GROUP BY p.`page_id` '
63
      . 'ORDER BY p.`position` ASC';
64

    
65
    if($get_pages = $database->query($sql)) {
66
    	// Work out how many pages there are for this parent
67
    	$num_pages = $get_pages->numRows();
68
    	// Insert values into main page list
69
    	if($num_pages > 0)
70
    	{
71
    		while($page = $get_pages->fetchRow(MYSQL_ASSOC))
72
    		{
73
//echo implode('-',$page);
74
    			$sLineOut = '';
75
    			$row = $row++ % 2; // toggle row colors between 0<->1
76
    			// Get user permissions
77
    			$can_modify = false;
78
    			if( $admin->ami_group_member($page['admin_users']) ||
79
    			    $admin->is_group_match($admin->get_groups_id(), $page['admin_groups']))
80
    			{
81
    				if(($page['visibility'] == 'deleted' && PAGE_TRASH == 'inline') ||
82
    				   ($page['visibility'] != 'deleted'))
83
    				{
84
    					$can_modify = true;
85
    					$editable_pages++;
86
    				}
87
    			} else {
88
    				if($page['visibility'] == 'private') { continue; }
89
    			}
90
    			// check if the page has children
91
//                $sql  = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'pages` ';
92
//    			$sql .= 'WHERE `parent`='.$page['page_id'];
93
//                $sql .= (PAGE_TRASH != 'inline') ? ' AND `visibility`!=\'deleted\'' : '';
94
                $sql = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'pages` '
95
    			     . 'WHERE `parent`='.$page['page_id'].((PAGE_TRASH != 'inline') ? ' AND `visibility`!=\'deleted\'' : '');
96
    			$par['num_subs'] = intval($database->get_one($sql));
97
    			$display_plus = (bool)$par['num_subs'];
98
    			$sLineOut .= '<li class="p'.$page['parent'].'">';
99
    // ---------------------------------------------------------------------------------------
100
    			$sLineOut .= '<table class="pages_view">';
101
    			$sLineOut .= "\t".'<tbody>';
102
    			$sLineOut .= "\t\t".'<tr class="row_'.$row.'">';
103
    // --- Tab 1 ---
104
    			$sLineOut .= "\t\t\t".'<td valign="middle" width="20" style="padding-left: '.
105
    				 (($page['level'] == 0) ? 0 : ($page['level']*25)-pow($page['level'],2)).'px;">';
106
    			if($display_plus == true) {
107
    				$sLineOut .= '<a href="javascript:toggle_visibility(\'p'.$page['page_id'].'\');" '.
108
    					 'title="'.$TEXT['EXPAND'].'/'.$TEXT['COLLAPSE'].'">';
109
    				$sLineOut .= '<span>';
110
    				$sLineOut .= '<img src="'.THEME_URL.'/images/'.
111
    					 ( ((isset($_COOKIE['p'.$page['page_id']]) && $_COOKIE['p'.$page['page_id']] == '1') ? 'minus' : 'plus').
112
    					 '_16.png" onclick="toggle_plus_minus(\''.$page['page_id'].'\');" '.
113
    					 'name="plus_minus_'.$page['page_id'] ).'" alt="+" />';
114
    				$sLineOut .= '</span>';
115
    				$sLineOut .= '</a>';
116
    			}
117
    			$sLineOut .= '</td>'.PHP_EOL;
118
    // --- Tab 2 ---
119
    			$sLineOut .= "\t\t\t".'<td class="list_menu_title">';
120
                $sClassMenutitle = '';
121
    			if($admin->get_permission('pages_modify') && $can_modify) {
122
    				$sLineOut .= '<a href="'.ADMIN_URL.'/pages/modify.php?page_id='.$page['page_id'].'" title="'.$TEXT['MODIFY'].'">';
123
                    $sClassMenutitle = 'bold grey';
124
    			}
125
    			$sLineOut .= '<span>';
126
    			switch($page['visibility']):
127
    				case 'private':
128
    					$sIcon = 'private_16.png';
129
    					$sText = $TEXT['PRIVATE'];
130
    					break;
131
    				case 'registered':
132
    					$sIcon = 'keys_16.png';
133
    					$sText = $TEXT['REGISTERED'];
134
    					break;
135
    				case 'hidden':
136
    					$sIcon = 'hidden_16.png';
137
    					$sText = $TEXT['HIDDEN'];
138
    					break;
139
    				case 'none':
140
    					$sIcon = 'none_16.png';
141
    					$sText = $TEXT['NONE'];
142
    					break;
143
    				case 'deleted':
144
    					$sIcon = 'deleted_16.png';
145
    					$sText = $TEXT['DELETED'];
146
    					break;
147
    				default: // public
148
    					$sIcon = 'visible_16.png';
149
    					$sText = $TEXT['PUBLIC'];
150
    					break;
151
                     endswitch;
152
                     $sLineOut .= '<img src="'.THEME_URL.'/images/'.$sIcon.'" ';
153
                     $sLineOut .= 'alt="'.$TEXT['VISIBILITY'].': '.$sText.'" class="page_list_rights" />';
154
                     if($admin->get_permission('pages_modify') && $can_modify) {
155
                      $sLineOut .= '<span class="modify_link">'.$page['menu_title'].'</span></a>';
156
                     }else {
157
                      $sLineOut .=  '<span class="bold grey">'.$page['menu_title'].'</span>';
158
                     }
159
                     $sLineOut .= '</td>'.PHP_EOL;
160
    // --- Tab 3 ---
161
    			$sLineOut .= "\t\t\t".'<td class="list_page_title">'.$page['page_title'].'</td>'.PHP_EOL;
162
    // --- Tab 4 ---
163
    			$sLineOut .= "\t\t\t".'<td class="list_page_id right">'.$page['page_id'].'</td>'.PHP_EOL;
164
    // --- Tab 5 ---
165
    			$sLineOut .= "\t\t\t".'<td class="list_actions">';
166
    			if($page['visibility'] != 'deleted' && $page['visibility'] != 'none') {
167
    				$sLineOut .= '<a href="'.$admin->page_link($page['link']).'" target="_blank" '.
168
    					 'title="'.$TEXT['VIEW'].'">';
169
    				$sLineOut .= '<img src="'.THEME_URL.'/images/view_16.png" alt="'.$TEXT['VIEW'].'" />';
170
    				$sLineOut .= '</a>';
171
    			}
172
    			$sLineOut .= '</td>'.PHP_EOL;
173
    // --- Tab 6 ---		
174
    			$sLineOut .= "\t\t\t".'<td class="list_actions">';
175
    			if($page['visibility'] != 'deleted') { 
176
    				if($admin->get_permission('pages_settings') && $can_modify) {
177
    					$sLineOut .= '<a href="'.ADMIN_URL.'/pages/settings.php?page_id='.$page['page_id'].'" '.
178
    						 'title="'.$TEXT['SETTINGS'].'">';
179
    					$sLineOut .= '<img src="'.THEME_URL.'/images/modify_16.png" alt="'.$TEXT['SETTINGS'].'" />';
180
    					$sLineOut .= '</a>';
181
    				}
182
    			}else {
183
    				$sLineOut .= '<a href="'.ADMIN_URL.'/pages/restore.php?page_id='.$page['page_id'].'" '.
184
    					 'title="'.$TEXT['RESTORE'].'">';
185
    				$sLineOut .= '<img src="'.THEME_URL.'/images/restore_16.png" alt="'.$TEXT['RESTORE'].'" />';
186
    				$sLineOut .= '</a>';
187
    			}
188
    			$sLineOut .= '</td>'.PHP_EOL;
189
    // --- Tab 7 --- MANAGE SECTIONS AND DATES BUTTONS ---
190
    			$sLineOut .= "\t\t\t".'<td class="list_actions">';
191
    			// Work-out if we should show the "manage dates" link
192
    			if( MANAGE_SECTIONS && $admin->get_permission('pages_add') && $can_modify ) {
193
    				$sLineOut .= '<a href="'.ADMIN_URL.'/pages/sections.php?page_id='.$page['page_id'].'"'.
194
    					 ' title="'.$HEADING['MANAGE_SECTIONS'].'">';
195
                     $file = $admin->page_is_active($page) ? "clock_16.png" : "clock_red_16.png";
196
                     $file = ($page['published'] && $page['module'] != 'menu_link') ? $file : 'noclock_16.png';
197
     				$sLineOut .= '<img src="'.THEME_URL.'/images/'.$file.'" alt="'.$HEADING['MANAGE_SECTIONS'].'" />';
198
    				$sLineOut .= '</a>';
199
    			}
200
    			$sLineOut .= '</td>'.PHP_EOL;
201
    // --- Tab 8 ---
202
    			$sLineOut .= "\t\t\t".'<td class="list_actions">';
203
    			if($page['position'] != 1) {
204
    				if($page['visibility'] != 'deleted') {
205
    					if($admin->get_permission('pages_settings') && $can_modify) {
206
    						$sLineOut .= '<a href="'.ADMIN_URL.'/pages/move_up.php?page_id='.$page['page_id'].'" '.
207
    							 'title="'.$TEXT['MOVE_UP'].'"><img src="'.THEME_URL.
208
    							 '/images/up_16.png" alt="'.$TEXT['MOVE_UP'].'" /></a>';
209
    					}
210
    				}
211
    			}
212
    			$sLineOut .= '</td>'.PHP_EOL;
213
    // --- Tab 9 ---
214
    			$sLineOut .= "\t\t\t".'<td class="list_actions">';
215
    			if($page['position'] != $num_pages) {
216
    				if($page['visibility'] != 'deleted') {
217
    					if($admin->get_permission('pages_settings') && $can_modify) {
218
    						$sLineOut .= '<a href="'.ADMIN_URL.'/pages/move_down.php?page_id='.$page['page_id'].'" '.
219
    							 'title="'.$TEXT['MOVE_DOWN'].'"><img src="'.THEME_URL.
220
    							 '/images/down_16.png" alt="'.$TEXT['MOVE_DOWN'].'" /></a>';
221
    					}
222
    				}
223
    			}else { $sLineOut .= '&nbsp;'; }
224
    			$sLineOut .= '</td>'.PHP_EOL;
225
    // --- Tab 10 ---
226
    			$sLineOut .= "\t\t\t".'<td class="list_actions">';
227
    			if($admin->get_permission('pages_delete') && $can_modify) {
228
    				$sLineOut .= '<a href="javascript:confirm_link(\''.$MESSAGE['PAGES_DELETE_CONFIRM'].
229
    					 '?,'.ADMIN_URL.'/pages/delete.php?page_id='.$admin->getIDKEY($page['page_id']).'\');" '.
230
    					 'title="'.$TEXT['DELETE'].'">';
231
    				$sLineOut .= '<img src="'.THEME_URL.'/images/delete_16.png" alt="'.$TEXT['DELETE'].'" />';
232
    				$sLineOut .= '</a>';
233
    			}else { $sLineOut .= '&nbsp;'; }
234
    			$sLineOut .= '</td>'.PHP_EOL;
235
    // --- Tab 11 --- Add action to add a page as a child ---
236
    			$sLineOut .= "\t\t\t".'<td class="list_actions">';
237
    			if($admin->get_permission('pages_add') && $can_modify && ($page['visibility'] != 'deleted')) {
238
    				$sLineOut .= '<a href="javascript:add_child_page(\''.$page['page_id'].'\');" '
239
    					.'title="'.$HEADING['ADD_CHILD_PAGE'].'">';
240
    				$sLineOut .= '<img src="'.THEME_URL.'/images/siteadd.png" name="addpage_'.$page['page_id'].'" '
241
    					.'alt="Add Child Page" />';
242
    				$sLineOut .= '</a>';
243
    			}else { $sLineOut .= '&nbsp;'; }
244
    			$sLineOut .= '</td>'.PHP_EOL;
245
    // --- Tab 12 ---
246
    			$sLineOut .= "\t\t\t".'<td class="list_page_id center">'.$page['language'].'</td>'.PHP_EOL;
247
    // --- End TR / TBODY / TABLE		
248
    			$sLineOut .= "\t\t".'</tr>'.PHP_EOL;
249
    			$sLineOut .= "\t".'</tbody>'.PHP_EOL;
250
    			$sLineOut .= '</table>'.PHP_EOL;
251
    // ---------------------------------------------------------------------------------------
252
           echo $sLineOut;
253
           if ( $page['parent'] == 0) {
254
            $page_tmp_id = $page['page_id'];
255
           }
256
           // Get subs
257
           $editable_pages = make_list($page['page_id'], $editable_pages);
258
                    echo '</li>'.PHP_EOL;
259
          } // end of WHILE
260
    	} // end of $num_pages > 0
261
    }  // end of $get_pages = $database->query($sql)
262

    
263
	$output = ($par['num_subs'] )? '</ul>'.PHP_EOL : '';
264
    $par['num_subs'] = (empty($output) ) ?  1 : $par['num_subs'];
265
    echo $output;
266
	return $editable_pages;
267
}
268
// Generate pages list
269
if($admin->get_permission('pages_view') == true) 
270
{
271
	$sListHeader = <<<LHEAD
272
	<div class="jsadmin hide"></div>
273
		<table>
274
			<tbody>
275
				<tr>
276
					<td><h2 class="left">{$HEADING['MODIFY_DELETE_PAGE']}</h2></td>
277
					<td align="right"></td>
278
				</tr>
279
			</tbody>
280
		</table>
281
		<div class="pages_list">
282
			<table>
283
				<tbody>
284
					<tr class="pages_list_header">
285
						<td class="header_list_menu_title">{$TEXT['VISIBILITY']} / {$TEXT['MENU_TITLE']}:</td>
286
						<td class="header_list_page_title">{$TEXT['PAGE_TITLE']}:</td>
287
						<td class="header_list_page_id">PID</td>
288
						<td class="header_list_actions">{$TEXT['ACTIONS']}:</td>
289
						<td class="list_page_id">&nbsp;</td>
290
					</tr>
291
				</tbody>
292
			</table>
293
LHEAD;
294
	echo $sListHeader;
295
	// Work-out if we should check for existing page_code
296
	$field_set = $database->field_exists(TABLE_PREFIX.'pages', 'page_code');
297
    $par = array();
298
	$par['num_subs'] = 1;
299
	$editable_pages = make_list(0, 0);
300
}else {
301
	$editable_pages = 0;
302
}
303
echo "\t\t".'</div>'.PHP_EOL;
304
if(!intval($editable_pages)) {
305
	echo "\t\t".'<div class="empty_list">'.$TEXT['NONE_FOUND'].'</div>'.PHP_EOL;
306
}
307
// Setup template object, parse vars to it, then parse it
308
// Create new template object
309
$template = new Template(dirname($admin->correct_theme_source('pages.htt')),'keep');
310
// $template->debug = true;
311
$template->set_file('page', 'pages.htt');
312
$template->set_block('page', 'main_block', 'main');
313
// Insert values into the add page form
314
$template->set_var('FTAN', $admin->getFTAN());
315
// Group list 1
316
$query = "SELECT * FROM ".TABLE_PREFIX."groups";
317
$get_groups = $database->query($query);
318

    
319
$template->set_block('main_block', 'group_list_block', 'group_list');
320
// Insert admin group and current group first
321
$admin_group_name = $get_groups->fetchRow(MYSQL_ASSOC);
322
$template->set_var(array(
323
						'ID' => 1,
324
						'TOGGLE' => '1',
325
						'DISABLED' => ' disabled="disabled"',
326
						'LINK_COLOR' => '000000',
327
						'CURSOR' => 'default',
328
						'NAME' => $admin_group_name['name'],
329
						'CHECKED' => ' checked="checked"'
330
						)
331
					);
332
$template->parse('group_list', 'group_list_block', true);
333
while($group = $get_groups->fetchRow(MYSQL_ASSOC)) {
334
	// check if the user is a member of this group
335
	$flag_disabled = '';
336
	$flag_checked =  '';
337
	$flag_cursor =   'pointer';
338
	$flag_color =    '';
339
	if (in_array($group["group_id"], $admin->get_groups_id())) {
340
		$flag_disabled = ''; //' disabled';
341
		$flag_checked =  ' checked="checked"';
342
		$flag_cursor =   'default';
343
		$flag_color =    '000000';
344
	}
345
	// Check if the group is allowed to edit pages
346
	$system_permissions = explode(',', $group['system_permissions']);
347
	if(is_numeric(array_search('pages_modify', $system_permissions))) {
348
		$template->set_var(array(
349
								'ID' => $group['group_id'],
350
								'TOGGLE' => $group['group_id'],
351
								'CHECKED' => $flag_checked,
352
								'DISABLED' => $flag_disabled,
353
								'LINK_COLOR' => $flag_color,
354
								'CURSOR' => $flag_checked,
355
								'NAME' => $group['name'],
356
								)
357
							);
358
		$template->parse('group_list', 'group_list_block', true);
359
	}
360
}
361
// Group list 2
362
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'groups`';
363
$get_groups = $database->query($sql);
364
$template->set_block('main_block', 'group_list_block2', 'group_list2');
365
// Insert admin group and current group first
366
$admin_group_name = $get_groups->fetchRow(MYSQL_ASSOC);
367
$template->set_var(array(
368
						'ID' => 1,
369
						'TOGGLE' => '1',
370
						'DISABLED' => ' disabled="disabled"',
371
						'LINK_COLOR' => '000000',
372
						'CURSOR' => 'default',
373
						'NAME' => $admin_group_name['name'],
374
						'CHECKED' => ' checked="checked"'
375
						)
376
					);
377
$template->parse('group_list2', 'group_list_block2', true);
378
while($group = $get_groups->fetchRow(MYSQL_ASSOC)) {
379
	// check if the user is a member of this group
380
	$flag_disabled = '';
381
	$flag_checked =  '';
382
	$flag_cursor =   'pointer';
383
	$flag_color =    '';
384
	if (in_array($group["group_id"], $admin->get_groups_id())) {
385
		$flag_disabled = ''; //' disabled';
386
		$flag_checked =  ' checked="checked"';
387
		$flag_cursor =   'default';
388
		$flag_color =    '000000';
389
	}
390
	$template->set_var(array(
391
							'ID' => $group['group_id'],
392
							'TOGGLE' => $group['group_id'],
393
							'CHECKED' => $flag_checked,
394
							'DISABLED' => $flag_disabled,
395
							'LINK_COLOR' => $flag_color,
396
							'CURSOR' => $flag_cursor,
397
							'NAME' => $group['name'],
398
							)
399
						);
400
	$template->parse('group_list2', 'group_list_block2', true);
401
}
402
// Parent page list
403
// $database = new database();
404
function parent_list($parent)
405
{
406
	global $admin, $template, $field_set;
407
	$database = WbDatabase::getInstance();
408
	$sql = 'SELECT * FROM `'.TABLE_PREFIX.'pages` '.
409
	       'WHERE `parent`='.$parent.' AND `visibility`!=\'deleted\' '.
410
	       'ORDER BY `position` ASC';
411
	$get_pages = $database->query($sql);
412

    
413
	while($page = $get_pages->fetchRow(MYSQL_ASSOC)) {
414
		if(!$admin->page_is_visible($page)) { continue; }
415
		// if parent = 0 set flag_icon
416
		$template->set_var('FLAG_ROOT_ICON', ' none ');
417
		if( $page['parent'] == 0 && $field_set) {
418
			$template->set_var('FLAG_ROOT_ICON','url('.THEME_URL.'/images/flags/'.strtolower($page['language']).'.png)');
419
		}
420
		// Stop users from adding pages with a level of more than the set page level limit
421
		if($page['level']+1 < PAGE_LEVEL_LIMIT) {
422
			// Get user permissions
423
			$can_modify = ($admin->ami_group_member($page['admin_groups']) ||
424
					       $admin->is_group_match($admin->get_groups_id(), $page['admin_users']));
425
			// Title -'s prefix
426
			$title_prefix = '';
427
			for($i = 1; $i <= $page['level']; $i++) { $title_prefix .= ' - - &nbsp;'; }
428
				$template->set_var(array(
429
										'ID' => $page['page_id'],
430
										'TITLE' => ($title_prefix.$page['menu_title']),
431
										'MENU-TITLE' => ($title_prefix.$page['menu_title']),
432
										'PAGE-TITLE' => ($title_prefix.$page['page_title'])
433
										));
434
				if($can_modify == true) {
435
					$template->set_var('DISABLED', '');
436
				} else {
437
					$template->set_var('DISABLED', ' disabled="disabled" class="disabled"');
438
				}
439
				$template->parse('page_list2', 'page_list_block2', true);
440
		}
441
		parent_list($page['page_id']);
442
	}
443
}
444
$template->set_block('main_block', 'page_list_block2', 'page_list2');
445
if($admin->get_permission('pages_add_l0') == true) {
446
	$template->set_var(array(
447
						'ID' => '0',
448
						'TITLE' => $TEXT['NONE'],
449
						'SELECTED' => ' selected="selected"',
450
						'DISABLED' => ''
451
					)
452
				);
453
	$template->parse('page_list2', 'page_list_block2', true);
454
}
455
parent_list(0);
456
// Explode module permissions
457
$module_permissions = $_SESSION['MODULE_PERMISSIONS'];
458
// Modules list
459
$template->set_block('main_block', 'module_list_block', 'module_list');
460
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'page' order by name");
461
if($result->numRows() > 0) {
462
	while ($module = $result->fetchRow(MYSQL_ASSOC)) {
463
		// Check if user is allowed to use this module
464
		if(!is_numeric(array_search($module['directory'], $module_permissions))) {
465
			$template->set_var('VALUE', $module['directory']);
466
			$template->set_var('NAME', $module['name']);
467
			if($module['directory'] == 'wysiwyg') {
468
				$template->set_var('SELECTED', ' selected="selected"');
469
			} else {
470
				$template->set_var('SELECTED', '');
471
			}
472
			$template->parse('module_list', 'module_list_block', true);
473
		}
474
	}
475
}
476
// Insert urls
477
$template->set_var(array(
478
								'THEME_URL' => THEME_URL,
479
								'WB_URL' => WB_URL,
480
								'ADMIN_URL' => ADMIN_URL,
481
								)
482
						);
483
// Insert language headings
484
$template->set_var(array(
485
								'HEADING_ADD_PAGE' => $HEADING['ADD_PAGE'],
486
								'HEADING_MODIFY_INTRO_PAGE' => $HEADING['MODIFY_INTRO_PAGE']
487
								)
488
						);
489
// Insert language text and messages
490
$template->set_var(array(
491
								'TEXT_TITLE' => $TEXT['TITLE'],
492
								'TEXT_TYPE' => $TEXT['TYPE'],
493
								'TEXT_PARENT' => $TEXT['PARENT'],
494
								'TEXT_VISIBILITY' => $TEXT['VISIBILITY'],
495
								'TEXT_PUBLIC' => $TEXT['PUBLIC'],
496
								'TEXT_PRIVATE' => $TEXT['PRIVATE'],
497
								'TEXT_REGISTERED' => $TEXT['REGISTERED'],
498
								'TEXT_HIDDEN' => $TEXT['HIDDEN'],
499
								'TEXT_NONE' => $TEXT['NONE'],
500
								'TEXT_NONE_FOUND' => $TEXT['NONE_FOUND'],
501
								'TEXT_ADD' => $TEXT['ADD'],
502
								'TEXT_RESET' => $TEXT['RESET'],
503
								'TEXT_ADMINISTRATORS' => $TEXT['ADMINISTRATORS'],
504
								'TEXT_PRIVATE_VIEWERS' => $TEXT['PRIVATE_VIEWERS'],
505
								'TEXT_REGISTERED_VIEWERS' => $TEXT['REGISTERED_VIEWERS'],
506
								'INTRO_LINK' => $MESSAGE['PAGES_INTRO_LINK'],
507
								)
508
						);
509
// Insert permissions values
510
if($admin->get_permission('pages_add') != true) {
511
	$template->set_var('DISPLAY_ADD', 'hide');
512
} elseif($admin->get_permission('pages_add_l0') != true && $editable_pages == 0) {
513
	$template->set_var('DISPLAY_ADD', 'hide');
514
}
515
if($admin->get_permission('pages_intro') != true || INTRO_PAGE != 'enabled') {
516
	$template->set_var('DISPLAY_INTRO', 'hide');
517
}
518
// Parse template object
519
$template->parse('main', 'main_block', false);
520
$template->pparse('output', 'page');
521
// include the required file for Javascript admin
522
if(file_exists(WB_PATH.'/modules/jsadmin/jsadmin_backend_include.php')) {
523
	include(WB_PATH.'/modules/jsadmin/jsadmin_backend_include.php');
524
}
525
// Print admin
526
$admin->print_footer();
(6-6/22)