Project

General

Profile

« Previous | Next » 

Revision 1664

Added by darkviper over 12 years ago

added additional rights for AdminUsers/ViewerUsers in /pages/page_settings
/pages/settings2.php renamed into /pages/settings_save.php

View differences:

settings.php
23 23
require_once(WB_PATH.'/framework/class.admin.php');
24 24
$admin = new admin('Pages', 'pages_settings');
25 25
// Include the WB functions file
26
require_once(WB_PATH.'/framework/functions-utf8.php');
26
//require_once(WB_PATH.'/framework/functions-utf8.php');
27 27

  
28
/*-- Parent page list ------------------------------------------------------------------*/
29
	function parent_list($parent)
30
	{
31
		global $admin, $database, $oTpl, $aCurrentPage, $field_set;
32
		$sDisabled = ' disabled="disabled"';
33
		$sSelected  = ' selected="selected"';
34

  
35
		$sql = 'SELECT `page_id`, `level`, `parent`, `menu_title`, `page_title`, '
36
		     .        '`language`, `admin_groups`, `admin_users`, `visibility`, '
37
		     .        '`viewing_groups`, `viewing_users` '
38
		     . 'FROM `'.TABLE_PREFIX.'pages` '
39
			 . 'WHERE `parent`='.$parent.' '
40
			 . 'ORDER BY `position` ASC';
41
		$get_pages = $database->query($sql);
42

  
43
		while($page = $get_pages->fetchRow(MYSQL_ASSOC))
44
		{
45
			if(!$admin->page_is_visible($page)) { continue; }
46
			// if parent = 0 set flag_icon
47
			$oTpl->set_var('FLAG_ROOT_ICON',' none ');
48
			if( $page['parent'] == 0  && $field_set) {
49
				$oTpl->set_var('FLAG_ROOT_ICON','url('.THEME_URL.'/images/flags/'.strtolower($page['language']).'.png)');
50
			}
51
			// If the current page cannot be parent, then its children neither
52
			$list_next_level = true;
53
			// Stop users from adding pages with a level of more than the set page level limit
54
			if($page['level']+1 < PAGE_LEVEL_LIMIT)
55
			{
56
			// Get user permisions
57
				$can_modify = ($admin->ami_group_member($page['admin_groups']) ||
58
				               $admin->is_group_match($admin->get_user_id(), $page['admin_users']));
59
				// Title -'s prefix
60
				$title_prefix = '';
61
				for($i = 1; $i <= $page['level']; $i++) { $title_prefix .= ' - - &nbsp;'; }
62
				$oTpl->set_var(array(
63
							'ID' => $page['page_id'],
64
							'TITLE' => ($title_prefix.$page['menu_title']),
65
							'MENU-TITLE' => ($title_prefix.$page['menu_title']),
66
							'PAGE-TITLE' => ($title_prefix.$page['page_title']),
67
							'FLAG_ICON' => ' none ',
68
							));
69
				if($aCurrentPage['parent'] == $page['page_id']) {
70
					$oTpl->set_var('SELECTED', $sSelected);
71
				} elseif($aCurrentPage['page_id'] == $page['page_id']) {
72
					$oTpl->set_var('SELECTED', $sDisabled.' class="disabled"');
73
					$list_next_level=false;
74
				} elseif($can_modify != true) {
75
					$oTpl->set_var('SELECTED', $sDisabled.' class="disabled"');
76
				} else {
77
					$oTpl->set_var('SELECTED', '');
78
				}
79
				$oTpl->parse('parent_page_list', 'parent_page_list_block', true);
80
			}
81
			if ($list_next_level) {
82
			  parent_list($page['page_id']);
83
			}
84
		}
85
	} // end of function parent_list
86
/* -------------------------------------------------------------------------------------*/
87
	$sDisabled = ' disabled="disabled"';
88
	$sSelected  = ' selected="selected"';
89
	$sChecked   = ' checked="checked"';
90

  
28 91
// Get page id
29
if(!isset($_GET['page_id']) || !is_numeric($_GET['page_id']))
30
{
31
	header("Location: index.php");
32
	exit(0);
33
} else {
34
	$page_id = $_GET['page_id'];
35
}
36

  
92
	$page_id = $_GET['page_id'] ? intval($_GET['page_id']) : 0;
93
	if(!$page_id) {
94
		header("Location: index.php");
95
		exit(0);
96
	}
37 97
/*
38 98
if( (!($page_id = $admin->checkIDKEY('page_id', 0, $_SERVER['REQUEST_METHOD']))) )
39 99
{
......
41 101
	exit();
42 102
}
43 103
*/
44
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'pages` WHERE `page_id` = '.$page_id;
45
$results = $database->query($sql);
46
$results_array = $results->fetchRow();
47

  
48
$old_admin_groups = explode(',', $results_array['admin_groups']);
49
$old_admin_users = explode(',', $results_array['admin_users']);
50

  
51
// Work-out if we should check for existing page_code
52
$field_set = $database->field_exists(TABLE_PREFIX.'pages', 'page_code');
53

  
54
$in_old_group = FALSE;
55
foreach($admin->get_groups_id() as $cur_gid)
56
{
57
	if (in_array($cur_gid, $old_admin_groups))
58
    {
59
		$in_old_group = TRUE;
104
/*-- get all details of current page ---------------------------------------------------*/
105
	$sql = 'SELECT * FROM `'.TABLE_PREFIX.'pages` WHERE `page_id` = '.$page_id;
106
	if( ($oPages = $database->query($sql)) ) {
107
		$aCurrentPage = $oPages->fetchRow(MYSQL_ASSOC);
108
		// Work-out if we should check for existing page_code
109
		$field_set = isset($aCurrentPage['page_code']);
110
		if( !$admin->ami_group_member($aCurrentPage['admin_groups']) &&
111
			!$admin->is_group_match($admin->get_user_id(), $aCurrentPage['admin_users']) )
112
		{
113
			$admin->print_error($MESSAGE['PAGES_INSUFFICIENT_PERMISSIONS']);
114
		}
115
	}else {
116
		$admin->print_header();
117
		$admin->print_error($database->get_error());
60 118
	}
61
}
62
if((!$in_old_group) && !is_numeric(array_search($admin->get_user_id(), $old_admin_users)))
63
{
64
	$admin->print_error($MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS']);
65
}
66

  
67
// Get page details
68
/* $database = new database();  */
69
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'pages` WHERE `page_id`='.$page_id;
70
$results = $database->query($sql);
71
if($database->is_error()) {
72
	$admin->print_header();
73
	$admin->print_error($database->get_error());
74
}
75
if($results->numRows() == 0) {
76
	$admin->print_header();
77
	$admin->print_error($MESSAGE['PAGES']['NOT_FOUND']);
78
}
79
$results_array = $results->fetchRow();
80

  
119
	if(!isset($aCurrentPage['page_code'])) {
120
		$database->field_add(TABLE_PREFIX.'pages', 'page_code', 'INT NOT NULL DEFAULT \'0\'');
121
	}
122
	if($oPages->numRows() == 0) {
123
		$admin->print_header();
124
		$admin->print_error($MESSAGE['PAGES_NOT_FOUND']);
125
	}
81 126
// Get display name of person who last modified the page
82
$user=$admin->get_user_details($results_array['modified_by']);
83

  
127
	$user=$admin->get_user_details($aCurrentPage['modified_by']);
84 128
// Convert the unix ts for modified_when to human a readable form
85
if($results_array['modified_when'] != 0)
86
{
87
	$modified_ts = gmdate(TIME_FORMAT.', '.DATE_FORMAT, $results_array['modified_when']+TIMEZONE);
88
} else {
89
	$modified_ts = 'Unknown';
90
}
91

  
129
	if($aCurrentPage['modified_when'] != 0) {
130
		$modified_ts = gmdate(TIME_FORMAT.', '.DATE_FORMAT, $aCurrentPage['modified_when']+TIMEZONE);
131
	}else {
132
		$modified_ts = 'Unknown';
133
	}
92 134
// Setup template object, parse vars to it, then parse it
93 135
// Create new template object
94
$template = new Template(dirname($admin->correct_theme_source('pages_settings.htt')));
95
// $template->debug = true;
96
$template->set_file('page', 'pages_settings.htt');
97
$template->set_block('page', 'main_block', 'main');
98
$template->set_var('FTAN', $admin->getFTAN());
136
	$oTpl = new Template(dirname($admin->correct_theme_source('pages_settings.htt')), 'keep');
137
	$oTpl->set_file('page', 'pages_settings.htt');
138
	$oTpl->set_block('page', 'main_block', 'main');
139
	$oTpl->set_var('FTAN', $admin->getFTAN());
140
	$oTpl->set_var(array(
141
			'PAGE_ID'              => $aCurrentPage['page_id'],
142
			'PAGE_IDKEY'           => $admin->getIDKEY($aCurrentPage['page_id']),
143
			'PAGE_TITLE'           => ($aCurrentPage['page_title']),
144
			'MENU_TITLE'           => ($aCurrentPage['menu_title']),
145
			'DESCRIPTION'          => ($aCurrentPage['description']),
146
			'KEYWORDS'             => ($aCurrentPage['keywords']),
147
			'MODIFIED_BY'          => $user['display_name'],
148
			'MODIFIED_BY_USERNAME' => $user['username'],
149
			'MODIFIED_WHEN'        => $modified_ts,
150
			'ADMIN_URL'            => ADMIN_URL,
151
			'WB_URL'               => WB_URL,
152
			'THEME_URL'            => THEME_URL
153
			));
154
/*-- workout if we should show the "manage sections" link ------------------------------*/
155
	$sql = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'sections` '
156
	     . 'WHERE `page_id`='.$page_id.' AND `module`=\'menu_link\'';
157
	$sections_available = (intval($database->get_one($sql)) != 0);
158
	if ($sections_available) {
159
		$oTpl->set_var('DISPLAY_MANAGE_SECTIONS', 'display:none;');
160
	} elseif(MANAGE_SECTIONS == 'enabled') {
161
		$oTpl->set_var('TEXT_MANAGE_SECTIONS', $HEADING['MANAGE_SECTIONS']);
162
	} else {
163
		$oTpl->set_var('DISPLAY_MANAGE_SECTIONS', 'display:none;');
164
	}
99 165

  
100
$template->set_var(array(
101
				'PAGE_ID' => $results_array['page_id'],
102
				// 'PAGE_IDKEY' => $admin->getIDKEY($results_array['page_id']),
103
				'PAGE_IDKEY' => $results_array['page_id'],
104
				'PAGE_TITLE' => ($results_array['page_title']),
105
				'MENU_TITLE' => ($results_array['menu_title']),
106
				'DESCRIPTION' => ($results_array['description']),
107
				'KEYWORDS' => ($results_array['keywords']),
108
				'MODIFIED_BY' => $user['display_name'],
109
				'MODIFIED_BY_USERNAME' => $user['username'],
110
				'MODIFIED_WHEN' => $modified_ts,
111
				'ADMIN_URL' => ADMIN_URL,
112
				'WB_URL' => WB_URL,
113
				'THEME_URL' => THEME_URL
114
				)
115
		);
166
/*-- show visibility select box --------------------------------------------------------*/
167
	$aVisibility = array();
168
	$aVisibility['PUBLIC_SELECTED']     = ($aCurrentPage['visibility'] == 'public' ? $sSelected : '');
169
	$aVisibility['PRIVATE_SELECTED']    = ($aCurrentPage['visibility'] == 'private' ? $sSelected : '');
170
	$aVisibility['REGISTERED_SELECTED'] = ($aCurrentPage['visibility'] == 'registered' ? $sSelected : '');
171
	$aVisibility['HIDDEN_SELECTED']     = ($aCurrentPage['visibility'] == 'hidden' ? $sSelected : '');
172
	$aVisibility['NO_VIS_SELECTED']     = ($aCurrentPage['visibility'] == 'none' ? $sSelected : '');
173
	$oTpl->set_var($aVisibility);
116 174

  
117
// Work-out if we should show the "manage sections" link
118
$sql = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'sections` WHERE `page_id`='.$page_id.' AND `module`="menu_link"';
119
$sections_available = (intval($database->get_one($sql)) != 0);
120
if ($sections_available)
121
{
122
    $template->set_var('DISPLAY_MANAGE_SECTIONS', 'display:none;');
123
} elseif(MANAGE_SECTIONS == 'enabled')
124
{
125
	$template->set_var('TEXT_MANAGE_SECTIONS', $HEADING['MANAGE_SECTIONS']);
126
} else {
127
	$template->set_var('DISPLAY_MANAGE_SECTIONS', 'display:none;');
128
}
129

  
130
// Visibility
131
if($results_array['visibility'] == 'public') {
132
	$template->set_var('PUBLIC_SELECTED', ' selected="selected"');
133
} elseif($results_array['visibility'] == 'private') {
134
	$template->set_var('PRIVATE_SELECTED', ' selected="selected"');
135
} elseif($results_array['visibility'] == 'registered') {
136
	$template->set_var('REGISTERED_SELECTED', ' selected="selected"');
137
} elseif($results_array['visibility'] == 'hidden') {
138
	$template->set_var('HIDDEN_SELECTED', ' selected="selected"');
139
} elseif($results_array['visibility'] == 'none') {
140
	$template->set_var('NO_VIS_SELECTED', ' selected="selected"');
141
}
142
// Group list 1 (admin_groups)
143
	$admin_groups = explode(',', str_replace('_', '', $results_array['admin_groups']));
144

  
145
	$sql = 'SELECT * FROM `'.TABLE_PREFIX.'groups`';
146
    $get_groups = $database->query($sql);
147

  
148
	$template->set_block('main_block', 'group_list_block', 'group_list');
149
	// Insert admin group and current group first
150
	$admin_group_name = $get_groups->fetchRow();
151
	$template->set_var(array(
152
									'ID' => 1,
153
									'TOGGLE' => '',
154
									'DISABLED' => ' disabled="disabled"',
155
									'LINK_COLOR' => '000000',
156
									'CURSOR' => 'default',
157
									'NAME' => $admin_group_name['name'],
158
									'CHECKED' => ' checked="checked"'
159
									)
160
							);
161
	$template->parse('group_list', 'group_list_block', true);
162
	while($group = $get_groups->fetchRow()) {
163
		// check if the user is a member of this group
164
		$flag_disabled = '';
165
		$flag_checked =  '';
166
		$flag_cursor =   'pointer';
167
		$flag_color =    '';
168
		if (in_array($group["group_id"], $admin->get_groups_id())) {
169
			$flag_disabled = ''; //' disabled';
170
			$flag_checked =  ''; //' checked';
171
			$flag_cursor =   'default';
172
			$flag_color =    '000000';
175
/*-- admin group list block ------------------------------------------------------------*/
176
	$aAdminGroups = explode(',', '1,'.$aCurrentPage['admin_groups']);
177
	$sAdminGroups = implode(',', array_unique($aAdminGroups));
178
	$sql = 'SELECT `group_id` `ID`, `name` `NAME`, `system_permissions` `permissions` '
179
	     . 'FROM `'.TABLE_PREFIX.'groups` '
180
	     . 'ORDER BY (`ID` NOT IN('.$sAdminGroups.')), `NAME`';
181
	if( ($oGroups = $database->query($sql)))
182
	{
183
		$oTpl->set_block('main_block', 'admin_group_list_block', 'admin_group_list');
184
		while( $aGroup = $oGroups->fetchRow(MYSQL_ASSOC))
185
		{
186
			if($aGroup['ID'] == 1) {
187
			// never uncheck admin group
188
				$aGroup['CHECKED'] = $sChecked;
189
				$aGroup['DISABLED'] = $sDisabled;
190
			}else {
191
			// skip groups without system_permissions
192
				if(!$admin->is_group_match('pages_modify', $aGroup['permissions'])) { continue; }
193
			// check already selected groups
194
				$bChecked = $admin->is_group_match($aGroup['ID'], $aCurrentPage['admin_groups']);
195
			// disable selected groups where current user is not member of
196
				$bDisabled = !$admin->ami_group_member($aGroup['ID']);
197
				$aGroup['CHECKED']  = $bChecked ? $sChecked : '';
198
				$aGroup['DISABLED'] = ($bChecked && $bDisabled) ? $sDisabled : '';
199
			}
200
			unset($aGroup['permissions']);
201
			$oTpl->set_var($aGroup);
202
			$oTpl->parse('admin_group_list', 'admin_group_list_block', true);
173 203
		}
204
	}
174 205

  
175
		// Check if the group is allowed to edit pages
176
		$system_permissions = explode(',', $group['system_permissions']);
177
		if(is_numeric(array_search('pages_modify', $system_permissions))) {
178
			$template->set_var(array(
179
											'ID' => $group['group_id'],
180
											'TOGGLE' => $group['group_id'],
181
											'DISABLED' => $flag_disabled,
182
											'LINK_COLOR' => $flag_color,
183
											'CURSOR' => $flag_cursor,
184
											'NAME' => $group['name'],
185
											'CHECKED' => $flag_checked
186
											)
187
									);
188
			if(is_numeric(array_search($group['group_id'], $admin_groups))) {
189
				$template->set_var('CHECKED', ' checked="checked"');
190
			} else {
191
				if (!$flag_checked) $template->set_var('CHECKED', '');
206
/*-- viewer group list block -----------------------------------------------------------*/
207
	$aViewingGroups = explode(',', '1,'.$aCurrentPage['viewing_groups']);
208
	$sViewingGroups = implode(',', array_unique($aViewingGroups));
209
	$oTpl->set_block('main_block', 'viewer_group_list_block', 'viewer_group_list');
210
	$sql = 'SELECT `group_id` `ID`, `name` `NAME` '
211
		 . 'FROM `'.TABLE_PREFIX.'groups` '
212
	     . 'ORDER BY (`ID` NOT IN('.$sViewingGroups.')), `NAME`';
213
	if(($oGroups = $database->query($sql))) {
214
		while($aGroup = $oGroups->fetchRow(MYSQL_ASSOC)) {
215
			if($aGroup['ID'] == 1) {
216
			// never uncheck admin group
217
				$aGroup['CHECKED'] = $sChecked;
218
				$aGroup['DISABLED'] = $sDisabled;
219
			}else {
220
			// check already selected groups
221
				$bChecked = $admin->is_group_match($aGroup['ID'], $aCurrentPage['viewing_groups']);
222
			// disable selected groups where current user is not member of
223
				$bDisabled = !$admin->ami_group_member($aGroup['ID']);
224
				$aGroup['CHECKED']  = $bChecked ? $sChecked : '';
225
				$aGroup['DISABLED'] = ($bChecked && $bDisabled) ? $sDisabled : '';
192 226
			}
193
			$template->parse('group_list', 'group_list_block', true);
227
			$oTpl->set_var($aGroup);
228
			$oTpl->parse('viewer_group_list', 'viewer_group_list_block', true);
194 229
		}
195 230
	}
196 231

  
197
// Group list 2 (viewing_groups)
198
	$viewing_groups = explode(',', str_replace('_', '', $results_array['viewing_groups']));
232
/*-- admin user list block -------------------------------------------------------------*/
233
	$aAdminUsers = ($aCurrentPage['admin_users'] == ''
234
	                ? array()
235
	                : explode(',', $aCurrentPage['admin_users']));
236
	$aAdminUsers = explode(',', $aCurrentPage['admin_users']);
237
	$oTpl->set_block('main_block', 'admin_user_list_block', 'admin_user_list');
238
	$sAllowedAdminUsers = trim(implode(',',$aAdminUsers));
239
	$sAllowedAdminUsers = $sAllowedAdminUsers ? $sAllowedAdminUsers : '-1';
240
	$sql = 'SELECT `user_id`, `display_name` '
241
		 . 'FROM `'.TABLE_PREFIX.'users` '
242
	     . 'WHERE `active`=1 '
243
	     . 'ORDER BY (`user_id` NOT IN('.$sAllowedAdminUsers.')), `display_name`';
244
	if( ($oUsers = $database->query($sql)) ) {
245
		while($aUser = $oUsers->fetchRow(MYSQL_ASSOC)) {
246
			if($aUser['user_id'] == 1) { continue; }
247
			$oTpl->set_var(array(
248
				'ID'        => $aUser['user_id'],
249
				'NAME'      => $aUser['display_name'],
250
			    'SELECTED'  => (in_array($aUser['user_id'], $aAdminUsers) ? $sSelected : ''),
251
			));
252
			$oTpl->parse('admin_user_list', 'admin_user_list_block', true);
253
		}
254
	}
199 255

  
200
    $sql = 'SELECT * FROM `'.TABLE_PREFIX.'groups`';
201
    $get_groups = $database->query($sql);
202

  
203
	$template->set_block('main_block', 'group_list_block2', 'group_list2');
204
	// Insert admin group and current group first
205
	$admin_group_name = $get_groups->fetchRow();
206
	$template->set_var(array(
207
									'ID' => 1,
208
									'TOGGLE' => '',
209
									'DISABLED' => ' disabled="disabled"',
210
									'LINK_COLOR' => '000000',
211
									'CURSOR' => 'default',
212
									'NAME' => $admin_group_name['name'],
213
									'CHECKED' => ' checked="checked"'
214
									)
215
							);
216
	$template->parse('group_list2', 'group_list_block2', true);
217

  
218
	while($group = $get_groups->fetchRow())
219
    {
220
		// check if the user is a member of this group
221
		$flag_disabled = '';
222
		$flag_checked =  '';
223
		$flag_cursor =   'pointer';
224
		$flag_color =    '';
225
		if (in_array($group["group_id"], $admin->get_groups_id()))
226
        {
227
			$flag_disabled = ''; //' disabled';
228
			$flag_checked =  ''; //' checked';
229
			$flag_cursor =   'default';
230
			$flag_color =    '000000';
256
/*-- viewer users list block -----------------------------------------------------------*/
257
	$aViewingUsers = ($aCurrentPage['viewing_users'] == ''
258
	                  ? array()
259
	                  : explode(',', $aCurrentPage['viewing_users']));
260
	$aViewingUsers = explode(',', $aCurrentPage['viewing_users']);
261
	$oTpl->set_block('main_block', 'viewer_user_list_block', 'viewer_user_list');
262
	$sAllowedViewingUsers = trim(implode(',',$aViewingUsers));
263
	$sAllowedViewingUsers = $sAllowedViewingUsers ? $sAllowedViewingUsers : '-1';
264
	$sql = 'SELECT `user_id`, `display_name` '
265
		 . 'FROM `'.TABLE_PREFIX.'users` '
266
	     . 'WHERE `active`=1 '
267
	     . 'ORDER BY (`user_id` NOT IN('.$sAllowedViewingUsers.')), `display_name`';
268
	if( ($oUsers = $database->query($sql)) ) {
269
		while($aUser = $oUsers->fetchRow(MYSQL_ASSOC)) {
270
			if($aUser['user_id'] == 1) { continue; }
271
			$oTpl->set_var(array(
272
				'ID'        => $aUser['user_id'],
273
				'NAME'      => $aUser['display_name'],
274
			    'SELECTED'  => (in_array($aUser['user_id'], $aViewingUsers) ? $sSelected : ''),
275
			));
276
			$oTpl->parse('viewer_user_list', 'viewer_user_list_block', true);
231 277
		}
278
	}
232 279

  
233
		$template->set_var(array(
234
										'ID' => $group['group_id'],
235
										'TOGGLE' => $group['group_id'],
236
										'DISABLED' => $flag_disabled,
237
										'LINK_COLOR' => $flag_color,
238
										'CURSOR' => $flag_cursor,
239
										'NAME' => $group['name'],
240
										'CHECKED' => $flag_checked
241
										)
242
								);
243
		if(is_numeric(array_search($group['group_id'], $viewing_groups)))
244
        {
245
			$template->set_var('CHECKED', 'checked="checked"');
246
		} else {
247
			if (!$flag_checked) {$template->set_var('CHECKED', '');}
280
/*-- size user lists -------------------------------------------------------------------*/
281
	$aSkaleSizeOfList = array(0 => 5, 12 => 10, 25 => 20, 50 => 30, 75 => 40, 100 => 50);
282
	$iListSize = 6;
283
	if($oUsers) {
284
		$iNumberOfUsers = $oUsers->numRows();
285
		foreach($aSkaleSizeOfList as $key => $val){
286
			if($iNumberOfUsers > $key) {
287
				$iListSize = $val;
288
			}else { break; }
248 289
		}
290
	}
291
	$oTpl->set_var('USER_LIST_SIZE', $iListSize);
249 292

  
250
		$template->parse('group_list2', 'group_list_block2', true);
251

  
293
/*-- show private viewers block --------------------------------------------------------*/
294
	if($aCurrentPage['visibility'] == 'private' OR $aCurrentPage['visibility'] == 'registered')
295
	{
296
		$oTpl->set_var('DISPLAY_VIEWERS', '');
297
	} else {
298
		$oTpl->set_var('DISPLAY_VIEWERS', 'display:none;');
252 299
	}
253

  
254
// Show private viewers
255
if($results_array['visibility'] == 'private' OR $results_array['visibility'] == 'registered')
256
{
257
	$template->set_var('DISPLAY_VIEWERS', '');
258
} else {
259
	$template->set_var('DISPLAY_VIEWERS', 'display:none;');
260
}
261

  
262
//-- insert page_code 20090904-->
263
$template->set_var('DISPLAY_CODE_PAGE_LIST', ' id="multi_lingual" style="display:none;"');
264

  
300
/*-- start multilanguage page_code 20090904 --------------------------------------------*/
265 301
// Work-out if page languages feature is enabled
266
if((defined('PAGE_LANGUAGES') && PAGE_LANGUAGES) && $field_set && file_exists(WB_PATH.'/modules/mod_multilingual/update_keys.php') )
267
{
268
    // workout field is set but module missing
269
    $TEXT['PAGE_CODE'] = empty($TEXT['PAGE_CODE']) ? 'Pagecode' : $TEXT['PAGE_CODE'];
270
	$template->set_var( array(
271
            'DISPLAY_CODE_PAGE_LIST' => ' id="multi_lingual"',
272
            'TEXT_PAGE_CODE' => '<a href="'.WB_URL.'/modules/mod_multilingual/update_keys.php?page_id='.$page_id.'">'.$TEXT['PAGE_CODE'].'</a>'
273
        )
274
    );
302
	$oTpl->set_block('main_block', 'show_page_code_block',  'show_page_code');
303
	if( (defined('PAGE_LANGUAGES') && PAGE_LANGUAGES) &&
304
		 isset($aCurrentPage['page_code']) &&
305
		 file_exists(WB_PATH.'/modules/mod_multilingual/update_keys.php') )
306
	{
307
		// workout field is set but module missing
308
		$TEXT['PAGE_CODE'] = empty($TEXT['PAGE_CODE']) ? 'Pagecode' : $TEXT['PAGE_CODE'];
309
		$oTpl->set_var('TEXT_PAGE_CODE',
310
						   '<a href="'.WB_URL.'/modules/mod_multilingual/update_keys.php?page_id='.
311
						   $page_id.'">'.$TEXT['PAGE_CODE'].'</a>'
312
		);
313
	/*-- begin recursive function page_code list ---------------------------------------*/
314
		function page_code_list($parent)
315
		{
316
			global $admin, $database, $oTpl, $aCurrentPage, $pageCode;
317
			$default_language = DEFAULT_LANGUAGE;
275 318

  
276
	// Page_code list
277
   /* 	$database = new database();  */
278
	function page_code_list($parent)
279
    {
280
		global $admin, $database, $template, $results_array, $pageCode;
281
		$default_language = DEFAULT_LANGUAGE;
319
			$sql = 'SELECT * FROM `'.TABLE_PREFIX.'pages` '
320
				 . 'WHERE `parent`='.$parent.' AND `language`=\''.$default_language.'\' '
321
				 . 'ORDER BY `position` ASC';
322
			$get_pages = $database->query($sql);
282 323

  
283
        $sql = 'SELECT * FROM `'.TABLE_PREFIX.'pages` WHERE `parent` = '.$parent.' AND `language` = "'.$default_language.'" ORDER BY `position` ASC';
284
        $get_pages = $database->query($sql);
324
			while($page = $get_pages->fetchRow(MYSQL_ASSOC))
325
			{
326
				if(($admin->page_is_visible($page)==false) && ($page['visibility'] <> 'none') ) { continue; }
285 327

  
286
		while($page = $get_pages->fetchRow())
287
        {
288
			if(($admin->page_is_visible($page)==false) && ($page['visibility'] <> 'none') ) { continue; }
328
				$oTpl->set_var('FLAG_CODE_ICON',' none ');
329
				if( $page['parent'] == 0 )
330
				{
331
					$oTpl->set_var('FLAG_CODE_ICON','url('.THEME_URL.'/images/flags/'.strtolower($page['language']).'.png)');
332
				}
289 333

  
290
			$template->set_var('FLAG_CODE_ICON',' none ');
291
			if( $page['parent'] == 0 )
292
            {
293
				$template->set_var('FLAG_CODE_ICON','url('.THEME_URL.'/images/flags/'.strtolower($page['language']).'.png)');
294
			}
295

  
296
			// If the current page cannot be parent, then its children neither
297
			$list_next_level = true;
298
			// Stop users from adding pages with a level of more than the set page level limit
299
			if($page['level']+1 < PAGE_LEVEL_LIMIT)
300
            {
301
				// Get user perms
302
				$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
303
				$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
304

  
305
				$in_group = FALSE;
306
				foreach($admin->get_groups_id() as $cur_gid)
307
                {
308
					if (in_array($cur_gid, $admin_groups))
334
				// If the current page cannot be parent, then its children neither
335
				$list_next_level = true;
336
				// Stop users from adding pages with a level of more than the set page level limit
337
				if($page['level']+1 < PAGE_LEVEL_LIMIT)
338
				{
339
					$can_modify = ($admin->ami_group_member($page['admin_groups']) ||
340
								   $admin->is_group_match($admin->get_user_id(), $page['admin_users']));
341
					$title_prefix = '';
342
					for($i = 1; $i <= $page['level']; $i++) { $title_prefix .= ' - - &nbsp;'; }
343
					// $space = str_repeat('&nbsp;', 3);  $space.'&lt;'..'&gt;'
344
					$oTpl->set_var(array(
345
											'VALUE' => intval($page['page_code']),
346
											'PAGE_VALUE' => $title_prefix.$page['menu_title'],
347
											'PAGE_CODE' => $title_prefix.$page['page_id']
348
											)
349
									);
350
					if($aCurrentPage['page_code'] == $page['page_code'])
309 351
					{
310
						$in_group = TRUE;
352
						$oTpl->set_var('SELECTED', ' selected="selected"');
353
					} elseif($aCurrentPage['page_code'] == $page['page_code'])
354
					{
355
						$oTpl->set_var('SELECTED', ' disabled="disabled" class="disabled"');
356
						$list_next_level=false;
357
					} elseif($can_modify != true)
358
					{
359
						$oTpl->set_var('SELECTED', ' disabled="disabled" class="disabled"');
360
					} else {
361
						$oTpl->set_var('SELECTED', '');
311 362
					}
363
					$oTpl->parse('page_code_list', 'page_code_list_block', true);
312 364
				}
313

  
314
				if(($in_group) OR is_numeric(array_search($admin->get_user_id(), $admin_users)))
315
                {
316
					$can_modify = true;
317
				} else {
318
					$can_modify = false;
319
				}
320

  
321
				$title_prefix = '';
322
				for($i = 1; $i <= $page['level']; $i++) { $title_prefix .= ' - - &nbsp;'; }
323
                // $space = str_repeat('&nbsp;', 3);  $space.'&lt;'..'&gt;'
324
				$template->set_var(array(
325
										'VALUE' => $page['page_code'],
326
                                        'PAGE_VALUE' => $title_prefix.$page['menu_title'],
327
										'PAGE_CODE' => $title_prefix.$page['page_id']
328
										)
329
								);
330
				if($results_array['page_code'] == $page['page_code'])
331
                {
332
					$template->set_var('SELECTED', ' selected="selected"');
333
				} elseif($results_array['page_code'] == $page['page_code'])
334
                {
335
					$template->set_var('SELECTED', ' disabled="disabled" class="disabled"');
336
					$list_next_level=false;
337
				} elseif($can_modify != true)
338
                {
339
					$template->set_var('SELECTED', ' disabled="disabled" class="disabled"');
340
				} else {
341
					$template->set_var('SELECTED', '');
342
				}
343
				$template->parse('page_code_list', 'page_code_list_block', true);
365
				if ($list_next_level)
366
					page_code_list($page['page_id']);
344 367
			}
345
			if ($list_next_level)
346
				page_code_list($page['page_id']);
347 368
		}
369
	/*-- end recursive function page_code list -----------------------------------------*/
370
		// Insert code_page values from page to modify
371
		$oTpl->set_block('show_page_code_block', 'page_code_list_block', 'page_code_list');
372
		if($admin->get_permission('pages_add_l0') == true OR $aCurrentPage['level'] == 0) {
373
			$selected = ($aCurrentPage['parent'] == 0 ? $sSelected : '');
374
			$oTpl->set_var(array(
375
					'VALUE' => 0,
376
					'PAGE_CODE' => $TEXT['NONE'],
377
					'PAGE_VALUE' => '',
378
					'SELECTED' => $selected
379
				)
380
			);
381
			$oTpl->parse('page_code_list', 'page_code_list_block', true);
382
		}
383
		// get pagecode form this page_id
384
		page_code_list(0);
385
		$oTpl->parse('show_page_code', 'show_page_code_block', true);
386
	}else {
387
		$oTpl->set_block('show_page_code', '');
348 388
	}
389
/*-- end multilanguage page_code 20090904 ----------------------------------------------*/
349 390

  
350
	// Insert code_page values from page to modify
351
	$template->set_block('main_block', 'page_code_list_block', 'page_code_list');
352
	if($admin->get_permission('pages_add_l0') == true OR $results_array['level'] == 0) {
353
		if($results_array['parent'] == 0) { $selected = ' selected'; } else { $selected = ''; }
354
		$template->set_var(array(
355
									'VALUE' => '',
356
									'PAGE_CODE' => $TEXT['NONE'],
357
                                    'PAGE_VALUE' => '',
358
									'SELECTED' => $selected
359
								)
360
							);
361
		$template->parse('page_code_list', 'page_code_list_block', true);
391
/*-- show list of parent pages ---------------------------------------------------------*/
392
	$oTpl->set_block('main_block', 'parent_page_list_block', 'parent_page_list');
393
	if($admin->get_permission('pages_add_l0') == true OR $aCurrentPage['level'] == 0) {
394
		$oTpl->set_var(array(
395
					'ID' => '0',
396
					'TITLE' => $TEXT['NONE'],
397
					'SELECTED' => ($aCurrentPage['parent'] == 0 ? $sSelected : ''),
398
					) );
399
		$oTpl->parse('parent_page_list', 'parent_page_list_block', true);
362 400
	}
363
	// get pagecode form this page_id
364
   	page_code_list(0);
365
}
366
//-- page code -->
401
	parent_list(0);
402
	$oTpl->set_var('DISPLAY_MODIFIED', ($modified_ts == 'Unknown' ? 'hide' : ''));
367 403

  
368
// Parent page list
369
/* $database = new database();  */
370
function parent_list($parent)
371
{
372
	global $admin, $database, $template, $results_array,$field_set;
373

  
374
    $sql = 'SELECT * FROM `'.TABLE_PREFIX.'pages` WHERE `parent` = '.$parent.' ORDER BY `position` ASC';
375
    $get_pages = $database->query($sql);
376

  
377
	while($page = $get_pages->fetchRow())
378
    {
379
		if($admin->page_is_visible($page)==false)
380
        {
381
          continue;
382
        }
383

  
384
		// if parent = 0 set flag_icon
385
		$template->set_var('FLAG_ROOT_ICON',' none ');
386
		if( $page['parent'] == 0  && $field_set)
387
        {
388
			$template->set_var('FLAG_ROOT_ICON','url('.THEME_URL.'/images/flags/'.strtolower($page['language']).'.png)');
389
		}
390
		// If the current page cannot be parent, then its children neither
391
		$list_next_level = true;
392
		// Stop users from adding pages with a level of more than the set page level limit
393
		if($page['level']+1 < PAGE_LEVEL_LIMIT)
394
        {
395
			// Get user perms
396
			$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
397
			$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
398
			$in_group = FALSE;
399
			foreach($admin->get_groups_id() as $cur_gid)
400
            {
401
				if (in_array($cur_gid, $admin_groups))
402
                {
403
					$in_group = TRUE;
404
/*-- show list of templates ------------------------------------------------------------*/
405
	$oTpl->set_block('main_block', 'template_list_block', 'template_list');
406
	$sql = 'SELECT * FROM `'.TABLE_PREFIX.'addons` '
407
	     . 'WHERE `type`=\'template\' AND `function`=\'template\' '
408
	     . 'ORDER BY `name`';
409
	if(($res_templates = $database->query($sql))) {
410
		while($rec_template = $res_templates->fetchRow(MYSQL_ASSOC)) {
411
			// Check if the user has perms to use this template
412
			if($rec_template['directory'] == $aCurrentPage['template'] OR
413
			   $admin->get_permission($rec_template['directory'], 'template'))
414
			{
415
				$oTpl->set_var('VALUE', $rec_template['directory']);
416
				$oTpl->set_var('NAME', $rec_template['name']);
417
				if($rec_template['directory'] == $aCurrentPage['template']) {
418
					$oTpl->set_var('SELECTED', $sSelected);
419
				} else {
420
					$oTpl->set_var('SELECTED', '');
404 421
				}
422
				$oTpl->parse('template_list', 'template_list_block', true);
405 423
			}
406
			if(($in_group) OR is_numeric(array_search($admin->get_user_id(), $admin_users)))
407
            {
408
				$can_modify = true;
409
			} else {
410
				$can_modify = false;
411
			}
412
			// Title -'s prefix
413
			$title_prefix = '';
414
			for($i = 1; $i <= $page['level']; $i++) { $title_prefix .= ' - - &nbsp;'; }
415
			$template->set_var(array(
416
								'ID' => $page['page_id'],
417
								'TITLE' => ($title_prefix.$page['menu_title']),
418
								'MENU-TITLE' => ($title_prefix.$page['menu_title']),
419
								'PAGE-TITLE' => ($title_prefix.$page['page_title']),
420
								'FLAG_ICON' => ' none ',
421
								));
422

  
423
			if($results_array['parent'] == $page['page_id'])
424
            {
425
				$template->set_var('SELECTED', ' selected="selected"');
426
			} elseif($results_array['page_id'] == $page['page_id'])
427
            {
428
				$template->set_var('SELECTED', ' disabled="disabled" class="disabled"');
429
				$list_next_level=false;
430
			} elseif($can_modify != true)
431
            {
432
				$template->set_var('SELECTED', ' disabled="disabled" class="disabled"');
433
			} else {
434
				$template->set_var('SELECTED', '');
435
			}
436
			$template->parse('page_list2', 'page_list_block2', true);
437 424
		}
438
		if ($list_next_level)
439
        {
440
          parent_list($page['page_id']);
441
        }
442

  
443 425
	}
444
}
445 426

  
446
$template->set_block('main_block', 'page_list_block2', 'page_list2');
447
if($admin->get_permission('pages_add_l0') == true OR $results_array['level'] == 0) {
448
	if($results_array['parent'] == 0)
449
    {
450
		$selected = ' selected="selected"';
451
	} else { 
452
		$selected = '';
427
/*-- show menu select box --------------------------------------------------------------*/
428
	$oTpl->set_block('main_block', 'show_menu_list_block', 'show_menu_list');
429
	if(MULTIPLE_MENUS)
430
	{
431
	/*-- get menusettings from template info file --------------------------------------*/
432
		function getTemplateInfo($sTpl = '') {
433
			if(!$sTpl) { $sTpl = DEFAULT_TEMPLATE; }
434
			$sTplFile = WB_PATH.'/templates/'.$sTpl.'/info.php';
435
			if(is_readable($sTplFile)) { require_once($sTplFile); }
436
			$menu = isset($menu) ? $menu : array();
437
			return $menu;
438
		}
439
		$aMenu = getTemplateInfo($aCurrentPage['template']);
440
		// set menu[1] as default if there's no entry in info.php
441
		$aMenu[1] = (!isset($aMenu[1]) OR ($aMenu[1] == '')) ? $TEXT['MAIN'] : $aMenu[1];
442
		$oTpl->set_block('show_menu_list_block', 'menu_list_block', 'menu_list');
443
		foreach($aMenu as $iIndex => $sMenuName) {
444
			$aVars = array();
445
			$aVars['NAME']  = $sMenuName;
446
			$aVars['VALUE'] = $iIndex;
447
			$aVars['SELECTED'] = ($aCurrentPage['menu'] == $iIndex) ? $sSelected : '';
448
			$oTpl->set_var($aVars);
449
			$oTpl->parse('menu_list', 'menu_list_block', true);
450
		}
451
		$oTpl->parse('show_menu_list', 'show_menu_list_block', true);
452
	}else {
453
		$oTpl->set_block('show_menu_list', '');
453 454
	}
454
	$template->set_var(array(
455
						'ID' => '0',
456
						'TITLE' => $TEXT['NONE'],
457
						'SELECTED' => $selected
458
						) );
459
	$template->parse('page_list2', 'page_list_block2', true);
460
}
461
parent_list(0);
462 455

  
463
if($modified_ts == 'Unknown')
464
{
465
	$template->set_var('DISPLAY_MODIFIED', 'hide');
466
} else {
467
	$template->set_var('DISPLAY_MODIFIED', '');
468
}
469

  
470
// Templates list
471
$template->set_block('main_block', 'template_list_block', 'template_list');
472

  
473
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'addons` WHERE `type` = "template" AND `function` = "template" order by `name`';
474
if( ($res_templates = $database->query($sql)) )
475
{
476
	while($rec_template = $res_templates->fetchRow())
477
    {
478
		// Check if the user has perms to use this template
479
		if($rec_template['directory'] == $results_array['template'] OR $admin->get_permission($rec_template['directory'], 'template') == true)
480
        {
481
			$template->set_var('VALUE', $rec_template['directory']);
482
			$template->set_var('NAME', $rec_template['name']);
483
			if($rec_template['directory'] == $results_array['template'])
484
            {
485
				$template->set_var('SELECTED', ' selected="selected"');
486
			} else {
487
				$template->set_var('SELECTED', '');
488
			}
489
			$template->parse('template_list', 'template_list_block', true);
456
/*-- show language select box ----------------------------------------------------------*/
457
	$sql = 'SELECT `directory`, `name` FROM `'.TABLE_PREFIX.'addons` '
458
		 . 'WHERE `type`=\'language\' ';
459
	if( !defined('PAGE_LANGUAGES') || !PAGE_LANGUAGES) {
460
	// display only default and current language if site is single language only
461
		$sql .= 'AND `directory`=\''.DEFAULT_LANGUAGE.'\' ';
462
		if($aCurrentPage['language'] != DEFAULT_LANGUAGE) {
463
			$sql .= 'AND `directory`=\''.$aCurrentPage['language'].'\' ';
490 464
		}
491 465
	}
492
}
493

  
494
// Menu list
495
if(MULTIPLE_MENUS == false)
496
{
497
	$template->set_var('DISPLAY_MENU_LIST', 'display:none;');
498
}
499
// Include template info file (if it exists)
500
if($results_array['template'] != '')
501
{
502
	$template_location = WB_PATH.'/templates/'.$results_array['template'].'/info.php';
503
} else {
504
	$template_location = WB_PATH.'/templates/'.DEFAULT_TEMPLATE.'/info.php';
505
}
506
if(file_exists($template_location))
507
{
508
	require($template_location);
509
}
510
// Check if $menu is set
511
if(!isset($menu[1]) OR $menu[1] == '')
512
{
513
	// Make our own menu list
514
	$menu[1] = $TEXT['MAIN'];
515
}
516
// Add menu options to the list
517
$template->set_block('main_block', 'menu_list_block', 'menu_list');
518
foreach($menu AS $number => $name)
519
{
520
	$template->set_var('NAME', $name);
521
	$template->set_var('VALUE', $number);
522
	if($results_array['menu'] == $number)
523
    {
524
		$template->set_var('SELECTED', ' selected="selected"');
525
	} else {
526
		$template->set_var('SELECTED', '');
466
	$sql .= 'ORDER BY `name`';
467
	if( ($oLanguages = $database->query($sql)) )
468
	{
469
		$aAvailLanguages = array();
470
		while($aLanguage = $oLanguages->fetchRow(MYSQL_ASSOC)) {
471
			$aAvailLanguages[$aLanguage['directory']] = $aLanguage['name'];
472
		}
473
		natsort($aAvailLanguages);
474
		$oTpl->set_block('main_block', 'language_list_block', 'language_list');
475
		foreach($aAvailLanguages as $key => $val) {
476
			$oTpl->set_var(array(
477
				'VALUE' => $key,
478
				'NAME'  => $val,
479
				'FLAG_LANG_ICONS' => 'url('.THEME_URL.'/images/flags/'.strtolower($key).'.png)',
480
				'SELECTED' => ($aCurrentPage['language'] == $key ? $sSelected : ''),
481
			));
482
			$oTpl->parse('language_list', 'language_list_block', true);
483
		}
527 484
	}
528
	$template->parse('menu_list', 'menu_list_block', true);
529
}
530 485

  
531
// Insert language values
532
$template->set_block('main_block', 'language_list_block', 'language_list');
486
/*-- show search activated box ---------------------------------------------------------*/
487
	$oTpl->set_var('SEARCHING_SELECTED_ON',  ($aCurrentPage['searching'] == 0) ? '' : $sSelected);
488
	$oTpl->set_var('SEARCHING_SELECTED_OFF', ($aCurrentPage['searching'] == 0) ? $sSelected : '');
533 489

  
534
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'addons` WHERE `type` = "language" ORDER BY `name`';
535
if( ($res_languages = $database->query($sql)) )
536
{
537
	while($rec_language = $res_languages->fetchRow())
538
    {
539
		$l_codes[$rec_language['name']] = $rec_language['directory'];
540
		$l_names[$rec_language['name']] = entities_to_7bit($rec_language['name']); // sorting-problem workaround
541
	}
542
	asort($l_names);
490
/*-- show target select box ------------------------------------------------------------*/
491
	$oTpl->set_var('TOP_SELECTED',   ($aCurrentPage['target'] == '_top'   ? $sSelected : ''));
492
	$oTpl->set_var('SELF_SELECTED',  ($aCurrentPage['target'] == '_self'  ? $sSelected : ''));
493
	$oTpl->set_var('BLANK_SELECTED', ($aCurrentPage['target'] == '_blank' ? $sSelected : ''));
543 494

  
544
	foreach($l_names as $l_name=>$v)
545
    {
546
        $langIcons = (empty($l_codes[$l_name])) ? 'none' : strtolower($l_codes[$l_name]);
547
		// Insert code and name
548
		$template->set_var(array(
549
								'VALUE' => $l_codes[$l_name],
550
								'NAME' => $l_name,
551
								'FLAG_LANG_ICONS' => 'url('.THEME_URL.'/images/flags/'.$langIcons.'.png)',
552
								));
553
		// Check if it is selected
554
		if($results_array['language'] == $l_codes[$l_name])
555
        {
556
			$template->set_var('SELECTED', ' selected="selected"');
557
		} else {
558
			$template->set_var('SELECTED', '');
559
		}
560
		$template->parse('language_list', 'language_list_block', true);
561
	}
562
}
495
/*-- insert all needed vars from language files ----------------------------------------*/
496
	$oTpl->set_var(array(
497
		'HEADING_MODIFY_PAGE_SETTINGS' => $HEADING['MODIFY_PAGE_SETTINGS'],
498
		'TEXT_CURRENT_PAGE'            => $TEXT['CURRENT_PAGE'],
499
		'TEXT_MODIFY'                  => $TEXT['MODIFY'],
500
		'TEXT_MODIFY_PAGE'             => $HEADING['MODIFY_PAGE'],
501
		'LAST_MODIFIED'                => $MESSAGE['PAGES_LAST_MODIFIED'],
502
		'TEXT_PAGE_TITLE'              => $TEXT['PAGE_TITLE'],
503
		'TEXT_MENU_TITLE'              => $TEXT['MENU_TITLE'],
504
		'TEXT_TYPE'                    => $TEXT['TYPE'],
505
		'TEXT_MENU'                    => $TEXT['MENU'],
506
		'TEXT_PARENT'                  => $TEXT['PARENT'],
507
		'TEXT_VISIBILITY'              => $TEXT['VISIBILITY'],
508
		'TEXT_PUBLIC'                  => $TEXT['PUBLIC'],
509
		'TEXT_PRIVATE'                 => $TEXT['PRIVATE'],
510
		'TEXT_REGISTERED'              => $TEXT['REGISTERED'],
511
		'TEXT_NONE'                    => $TEXT['NONE'],
512
		'TEXT_HIDDEN'                  => $TEXT['HIDDEN'],
513
		'TEXT_TEMPLATE'                => $TEXT['TEMPLATE'],
514
		'TEXT_TARGET'                  => $TEXT['TARGET'],
515
		'TEXT_SYSTEM_DEFAULT'          => $TEXT['SYSTEM_DEFAULT'],
516
		'TEXT_PLEASE_SELECT'           => $TEXT['PLEASE_SELECT'],
517
		'TEXT_NEW_WINDOW'              => $TEXT['NEW_WINDOW'],
518
		'TEXT_SAME_WINDOW'             => $TEXT['SAME_WINDOW'],
519
		'TEXT_TOP_FRAME'               => $TEXT['TOP_FRAME'],
520
		'TEXT_ADMINISTRATORS'          => $TEXT['ADMINISTRATORS'],
521
		'TEXT_ALLOWED_VIEWERS'         => $TEXT['ALLOWED_VIEWERS'],
522
		'TEXT_USER'                    => $TEXT['USER'],
523
		'TEXT_GROUP'                   => $TEXT['GROUP'],
524
		'TEXT_DESCRIPTION'             => $TEXT['DESCRIPTION'],
525
		'TEXT_KEYWORDS'                => $TEXT['KEYWORDS'],
526
		'TEXT_SEARCHING'               => $TEXT['SEARCHING'],
527
		'TEXT_LANGUAGE'                => $TEXT['LANGUAGE'],
528
		'TEXT_ENABLED'                 => $TEXT['ENABLED'],
529
		'TEXT_DISABLED'                => $TEXT['DISABLED'],
530
		'TEXT_SAVE'                    => $TEXT['SAVE'],
531
		'TEXT_RESET'                   => $TEXT['RESET'],
532
		'LAST_MODIFIED'                => $MESSAGE['PAGES_LAST_MODIFIED'],
533
		'HEADING_MODIFY_PAGE'          => $HEADING['MODIFY_PAGE'],
534
		'TEXT_NO_SELECTION'            => $TEXT['NO_SELECTION'],
535
	) );
563 536

  
564
// Select disabled if searching is disabled
565
if($results_array['searching'] == 0)
566
{
567
	$template->set_var('SEARCHING_DISABLED', ' selected="selected"');
568
}
569
// Select what the page target is
570
switch ($results_array['target'])
571
{
572
	case '_top':
573
		$template->set_var('TOP_SELECTED', ' selected="selected"');
574
		break;
575
	case '_self':
576
		$template->set_var('SELF_SELECTED', ' selected="selected"');
577
		break;
578
	case '_blank':
579
		$template->set_var('BLANK_SELECTED', ' selected="selected"');
580
		break;
581
}
537
	$oTpl->parse('main', 'main_block', false);
538
	$oTpl->pparse('output', 'page');
582 539

  
583
// Insert language text
584
$template->set_var(array(
585
				'HEADING_MODIFY_PAGE_SETTINGS' => $HEADING['MODIFY_PAGE_SETTINGS'],
586
				'TEXT_CURRENT_PAGE' => $TEXT['CURRENT_PAGE'],
587
				'TEXT_MODIFY' => $TEXT['MODIFY'],
588
				'TEXT_MODIFY_PAGE' => $HEADING['MODIFY_PAGE'],
589
				'LAST_MODIFIED' => $MESSAGE['PAGES']['LAST_MODIFIED'],
590
				'TEXT_PAGE_TITLE' => $TEXT['PAGE_TITLE'],
591
				'TEXT_MENU_TITLE' => $TEXT['MENU_TITLE'],
592
				'TEXT_TYPE' => $TEXT['TYPE'],
593
				'TEXT_MENU' => $TEXT['MENU'],
594
				'TEXT_PARENT' => $TEXT['PARENT'],
595
				'TEXT_VISIBILITY' => $TEXT['VISIBILITY'],
596
				'TEXT_PUBLIC' => $TEXT['PUBLIC'],
597
				'TEXT_PRIVATE' => $TEXT['PRIVATE'],
598
				'TEXT_REGISTERED' => $TEXT['REGISTERED'],
599
				'TEXT_NONE' => $TEXT['NONE'],
600
				'TEXT_HIDDEN' => $TEXT['HIDDEN'],
601
				'TEXT_TEMPLATE' => $TEXT['TEMPLATE'],
602
				'TEXT_TARGET' => $TEXT['TARGET'],
603
				'TEXT_SYSTEM_DEFAULT' => $TEXT['SYSTEM_DEFAULT'],
604
				'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
605
				'TEXT_NEW_WINDOW' => $TEXT['NEW_WINDOW'],
606
				'TEXT_SAME_WINDOW' => $TEXT['SAME_WINDOW'],
607
				'TEXT_TOP_FRAME' => $TEXT['TOP_FRAME'],
608
				'TEXT_ADMINISTRATORS' => $TEXT['ADMINISTRATORS'],
609
				'TEXT_ALLOWED_VIEWERS' => $TEXT['ALLOWED_VIEWERS'],
610
				'TEXT_DESCRIPTION' => $TEXT['DESCRIPTION'],
611
				'TEXT_KEYWORDS' => $TEXT['KEYWORDS'],
612
				'TEXT_SEARCHING' => $TEXT['SEARCHING'],
613
				'TEXT_LANGUAGE' => $TEXT['LANGUAGE'],
614
				'TEXT_ENABLED' => $TEXT['ENABLED'],
615
				'TEXT_DISABLED' => $TEXT['DISABLED'],
616
				'TEXT_SAVE' => $TEXT['SAVE'],
617
				'TEXT_RESET' => $TEXT['RESET'],
618
				'LAST_MODIFIED' => $MESSAGE['PAGES']['LAST_MODIFIED'],
619
				'HEADING_MODIFY_PAGE' => $HEADING['MODIFY_PAGE']
620
			) );
621

  
622
$template->parse('main', 'main_block', false);
623
$template->pparse('output', 'page');
624

  
625 540
// Print admin footer
626
$admin->print_footer();
541
	$admin->print_footer();
627 542

  
628 543
?>

Also available in: Unified diff