1
|
<?php
|
2
|
/**
|
3
|
*
|
4
|
* @category admin
|
5
|
* @package pages
|
6
|
* @author WebsiteBaker Project
|
7
|
* @copyright Ryan Djurovich
|
8
|
* @copyright WebsiteBaker Org. e.V.
|
9
|
* @link http://websitebaker.org/
|
10
|
* @license http://www.gnu.org/licenses/gpl.html
|
11
|
* @platform WebsiteBaker 2.8.3
|
12
|
* @requirements PHP 5.3.6 and higher
|
13
|
* @version $Id: settings.php 2 2017-07-02 15:14:29Z Manuela $
|
14
|
* @filesource $HeadURL: svn://isteam.dynxs.de/wb/2.10.x/trunk/admin/pages/settings.php $
|
15
|
* @lastmodified $Date: 2017-07-02 17:14:29 +0200 (Sun, 02 Jul 2017) $
|
16
|
*
|
17
|
*/
|
18
|
|
19
|
// Create new admin object
|
20
|
if ( !defined( 'WB_PATH' ) ){ require( dirname(dirname((__DIR__))).'/config.php' ); }
|
21
|
if ( !class_exists('admin', false) ) { require(WB_PATH.'/framework/class.admin.php'); }
|
22
|
$admin = new admin('Pages', 'pages_settings');
|
23
|
// Include the WB functions file
|
24
|
|
25
|
// Get page id
|
26
|
if(!isset($_GET['page_id']) || !is_numeric($_GET['page_id']))
|
27
|
{
|
28
|
$admin->print_header();
|
29
|
$admin->print_error($MESSAGE['PAGES_NOT_FOUND']);
|
30
|
} else {
|
31
|
$page_id = intval($_GET['page_id']);
|
32
|
}
|
33
|
|
34
|
//if ( !function_exists( 'create_access_file' ) ) { require(WB_PATH.'/framework/functions.php'); }
|
35
|
if ( !function_exists( 'entities_to_7bit' ) ) { require(WB_PATH.'/framework/functions-utf8.php'); }
|
36
|
/*
|
37
|
if( (!($page_id = $admin->checkIDKEY('page_id', 0, $_SERVER['REQUEST_METHOD']))) )
|
38
|
{
|
39
|
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
|
40
|
exit();
|
41
|
}
|
42
|
*/
|
43
|
$field_set = $database->field_add(TABLE_PREFIX.'pages', 'page_code', 'INT(11) NOT NULL AFTER `modified_by`');
|
44
|
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'pages` WHERE `page_id` = '.$page_id;
|
45
|
$results = $database->query($sql);
|
46
|
$results_array = $results->fetchRow(MYSQLI_ASSOC);
|
47
|
$old_admin_groups = explode(',', $results_array['admin_groups']);
|
48
|
$old_admin_users = explode(',', $results_array['admin_users']);
|
49
|
// Work-out if we should check for existing page_code
|
50
|
$field_set = $database->field_exists(TABLE_PREFIX.'pages', 'page_code');
|
51
|
|
52
|
$in_old_group = FALSE;
|
53
|
foreach($admin->get_groups_id() as $cur_gid)
|
54
|
{
|
55
|
if (in_array($cur_gid, $old_admin_groups))
|
56
|
{
|
57
|
$in_old_group = TRUE;
|
58
|
}
|
59
|
}
|
60
|
if((!$in_old_group) && !is_numeric(array_search($admin->get_user_id(), $old_admin_users)))
|
61
|
{
|
62
|
$admin->print_error($MESSAGE['PAGES_INSUFFICIENT_PERMISSIONS']);
|
63
|
}
|
64
|
// Get page details
|
65
|
/* $database = new database(); */
|
66
|
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'pages` WHERE `page_id`='.$page_id;
|
67
|
$results = $database->query($sql);
|
68
|
if($database->is_error()) {
|
69
|
$admin->print_header();
|
70
|
$admin->print_error($database->get_error());
|
71
|
}
|
72
|
if($results->numRows() == 0) {
|
73
|
$admin->print_header();
|
74
|
$admin->print_error($MESSAGE['PAGES_NOT_FOUND']);
|
75
|
}
|
76
|
$results_array = $results->fetchRow(MYSQLI_ASSOC);
|
77
|
$aCurrentPage['seo_title'] = basename($results_array['link']);
|
78
|
// Get display name of person who last modified the page
|
79
|
$user=$admin->get_user_details($results_array['modified_by']);
|
80
|
// Convert the unix ts for modified_when to human a readable form
|
81
|
if($results_array['modified_when'] != 0)
|
82
|
{
|
83
|
$modified_ts = gmdate(TIME_FORMAT.', '.DATE_FORMAT, $results_array['modified_when']+TIMEZONE);
|
84
|
} else {
|
85
|
$modified_ts = 'Unknown';
|
86
|
}
|
87
|
// Setup template object, parse vars to it, then parse it
|
88
|
// Create new template object
|
89
|
$template = new Template(dirname($admin->correct_theme_source('pages_settings.htt')));
|
90
|
// $template->debug = true;
|
91
|
$template->set_file('page', 'pages_settings.htt');
|
92
|
$template->set_block('page', 'main_block', 'main');
|
93
|
$template->set_var('FTAN', $admin->getFTAN());
|
94
|
$template->set_var(array(
|
95
|
'PAGE_ID' => $results_array['page_id'],
|
96
|
// 'PAGE_IDKEY' => $admin->getIDKEY($aCurrentPage['page_id']),
|
97
|
'PAGE_IDKEY' => $results_array['page_id'],
|
98
|
'PAGE_TITLE' => ($results_array['page_title']),
|
99
|
'MENU_TITLE' => ($results_array['menu_title']),
|
100
|
'SEO_TITLE' => ($aCurrentPage['seo_title']=='') ? $results_array['menu_title'] : $aCurrentPage['seo_title'],
|
101
|
'DESCRIPTION' => ($results_array['description']),
|
102
|
'KEYWORDS' => ($results_array['keywords']),
|
103
|
'MODIFIED_BY' => $user['display_name'],
|
104
|
'MODIFIED_BY_USERNAME' => $user['username'],
|
105
|
'MODIFIED_WHEN' => $modified_ts,
|
106
|
'ADMIN_URL' => ADMIN_URL,
|
107
|
'WB_URL' => WB_URL,
|
108
|
'THEME_URL' => THEME_URL
|
109
|
)
|
110
|
);
|
111
|
$template->set_block('main_block', 'show_section_block', 'show_section');
|
112
|
// Work-out if we should show the "manage sections" link
|
113
|
$sql = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'sections` WHERE `page_id`='.$page_id.' AND `module`="menu_link"';
|
114
|
$sections_available = (intval($database->get_one($sql)) != 0);
|
115
|
if ($sections_available)
|
116
|
{
|
117
|
$template->set_var('DISPLAY_MANAGE_SECTIONS', 'display:none;');
|
118
|
$template->parse('show_section', '');
|
119
|
} elseif(MANAGE_SECTIONS == 'enabled')
|
120
|
{
|
121
|
$template->set_var('TEXT_MANAGE_SECTIONS', $HEADING['MANAGE_SECTIONS']);
|
122
|
$template->parse('show_section', 'show_section_block', true);
|
123
|
} else {
|
124
|
$template->set_var('DISPLAY_MANAGE_SECTIONS', 'display:none;');
|
125
|
$template->parse('show_section', '');
|
126
|
}
|
127
|
// Visibility
|
128
|
if($results_array['visibility'] == 'public') {
|
129
|
$template->set_var('PUBLIC_SELECTED', ' selected="selected"');
|
130
|
} elseif($results_array['visibility'] == 'private') {
|
131
|
$template->set_var('PRIVATE_SELECTED', ' selected="selected"');
|
132
|
} elseif($results_array['visibility'] == 'registered') {
|
133
|
$template->set_var('REGISTERED_SELECTED', ' selected="selected"');
|
134
|
} elseif($results_array['visibility'] == 'hidden') {
|
135
|
$template->set_var('HIDDEN_SELECTED', ' selected="selected"');
|
136
|
} elseif($results_array['visibility'] == 'none') {
|
137
|
$template->set_var('NO_VIS_SELECTED', ' selected="selected"');
|
138
|
}
|
139
|
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'groups`';
|
140
|
$get_groups = $database->query($sql);
|
141
|
$template->set_block('main_block', 'group_list_block', 'group_list');
|
142
|
// Insert admin group and current group first
|
143
|
$admin_group_name = $get_groups->fetchRow(MYSQLI_ASSOC);
|
144
|
$template->set_var(array(
|
145
|
'ID' => 1,
|
146
|
'TOGGLE' => '',
|
147
|
'DISABLED' => ' disabled="disabled"',
|
148
|
'LINK_COLOR' => '000000',
|
149
|
'CURSOR' => 'default',
|
150
|
'NAME' => $admin_group_name['name'],
|
151
|
'CHECKED' => ' checked="checked"'
|
152
|
)
|
153
|
);
|
154
|
$template->parse('group_list', 'group_list_block', true);
|
155
|
while($group = $get_groups->fetchRow(MYSQLI_ASSOC)) {
|
156
|
// check if the user is a member of this group
|
157
|
$flag_disabled = '';
|
158
|
$flag_checked = '';
|
159
|
$flag_cursor = 'pointer';
|
160
|
$flag_color = '';
|
161
|
if (in_array($group["group_id"], $admin->get_groups_id())) {
|
162
|
$flag_disabled = ''; //' disabled';
|
163
|
$flag_checked = ''; //' checked';
|
164
|
$flag_cursor = 'default';
|
165
|
$flag_color = '000000';
|
166
|
}
|
167
|
// Group list 1 (admin_groups)
|
168
|
// $admin_groups = explode(',', str_replace('_', '', $results_array['admin_groups']));
|
169
|
// Check if the group is allowed to edit pages
|
170
|
// $system_permissions = explode(',', $group['system_permissions']);
|
171
|
// if(is_numeric(array_search('pages_modify', $system_permissions))) {
|
172
|
if ($admin->get_permission('pages_modify')) {
|
173
|
$template->set_var(array(
|
174
|
'ID' => $group['group_id'],
|
175
|
'TOGGLE' => $group['group_id'],
|
176
|
'DISABLED' => $flag_disabled,
|
177
|
'LINK_COLOR' => $flag_color,
|
178
|
'CURSOR' => $flag_cursor,
|
179
|
'NAME' => $group['name'],
|
180
|
'CHECKED' => $flag_checked
|
181
|
)
|
182
|
);
|
183
|
// if(is_numeric(array_search($group['group_id'], $admin_groups))) {
|
184
|
if ($admin->is_group_match($group['group_id'], $results_array['admin_groups'])) {
|
185
|
$template->set_var('CHECKED', ' checked="checked"');
|
186
|
} else {
|
187
|
if (!$flag_checked) $template->set_var('CHECKED', '');
|
188
|
}
|
189
|
$template->parse('group_list', 'group_list_block', true);
|
190
|
}
|
191
|
}
|
192
|
// Group list 2 (viewing_groups)
|
193
|
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'groups`';
|
194
|
$get_groups = $database->query($sql);
|
195
|
$template->set_block('main_block', 'group_list_block2', 'group_list2');
|
196
|
// Insert admin group and current group first
|
197
|
$admin_group_name = $get_groups->fetchRow(MYSQLI_ASSOC);
|
198
|
$template->set_var(array(
|
199
|
'ID' => 1,
|
200
|
'TOGGLE' => '',
|
201
|
'DISABLED' => ' disabled="disabled"',
|
202
|
'LINK_COLOR' => '000000',
|
203
|
'CURSOR' => 'default',
|
204
|
'NAME' => $admin_group_name['name'],
|
205
|
'CHECKED' => ' checked="checked"'
|
206
|
)
|
207
|
);
|
208
|
$template->parse('group_list2', 'group_list_block2', true);
|
209
|
while($group = $get_groups->fetchRow(MYSQLI_ASSOC))
|
210
|
{
|
211
|
// check if the user is a member of this group
|
212
|
$flag_disabled = '';
|
213
|
$flag_checked = '';
|
214
|
$flag_cursor = 'pointer';
|
215
|
$flag_color = '';
|
216
|
if (in_array($group["group_id"], $admin->get_groups_id()))
|
217
|
{
|
218
|
$flag_disabled = ''; //' disabled';
|
219
|
$flag_checked = ''; //' checked';
|
220
|
$flag_cursor = 'default';
|
221
|
$flag_color = '000000';
|
222
|
}
|
223
|
$template->set_var(array(
|
224
|
'ID' => $group['group_id'],
|
225
|
'TOGGLE' => $group['group_id'],
|
226
|
'DISABLED' => $flag_disabled,
|
227
|
'LINK_COLOR' => $flag_color,
|
228
|
'CURSOR' => $flag_cursor,
|
229
|
'NAME' => $group['name'],
|
230
|
'CHECKED' => $flag_checked
|
231
|
)
|
232
|
);
|
233
|
// $viewing_groups = explode(',', str_replace('_', '', $results_array['viewing_groups']));
|
234
|
// if(is_numeric(array_search($group['group_id'], $viewing_groups)))
|
235
|
if ($admin->is_group_match($group['group_id'], $results_array['viewing_groups']))
|
236
|
{
|
237
|
$template->set_var('CHECKED', 'checked="checked"');
|
238
|
} else {
|
239
|
if (!$flag_checked) {$template->set_var('CHECKED', '');}
|
240
|
}
|
241
|
$template->parse('group_list2', 'group_list_block2', true);
|
242
|
}
|
243
|
// Show private viewers
|
244
|
if($results_array['visibility'] == 'private' OR $results_array['visibility'] == 'registered')
|
245
|
{
|
246
|
$template->set_var('DISPLAY_VIEWERS', '');
|
247
|
} else {
|
248
|
$template->set_var('DISPLAY_VIEWERS', 'display:none;');
|
249
|
}
|
250
|
//-- insert page_code 20090904-->
|
251
|
$template->set_var('DISPLAY_CODE_PAGE_LIST', ' id="multi_lingual" style="display:none;"');
|
252
|
// Work-out if page languages feature is enabled
|
253
|
if (
|
254
|
(defined('PAGE_LANGUAGES') && PAGE_LANGUAGES) &&
|
255
|
$field_set &&
|
256
|
file_exists(WB_PATH.'/modules/mod_multilingual/update_keys.php')
|
257
|
) {
|
258
|
// workout field is set but module missing
|
259
|
$TEXT['PAGE_CODE'] = empty($TEXT['PAGE_CODE']) ? 'Pagecode' : $TEXT['PAGE_CODE'];
|
260
|
$template->set_var( array(
|
261
|
'DISPLAY_CODE_PAGE_LIST' => ' id="multi_lingual"',
|
262
|
'TEXT_PAGE_CODE' => '<a href="'.WB_URL.'/modules/mod_multilingual/update_keys.php?page_id='.$page_id.'">'.$TEXT['PAGE_CODE'].'</a>'
|
263
|
)
|
264
|
);
|
265
|
// Page_code list
|
266
|
/* $database = new database(); */
|
267
|
function page_code_list($parent)
|
268
|
{
|
269
|
global $admin, $database, $template, $results_array, $pageCode;
|
270
|
$default_language = DEFAULT_LANGUAGE;
|
271
|
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'pages` WHERE `parent` = '.$parent.' AND `language` = "'.$default_language.'" ORDER BY `position` ASC';
|
272
|
$get_pages = $database->query($sql);
|
273
|
while($page = $get_pages->fetchRow(MYSQLI_ASSOC))
|
274
|
{
|
275
|
if(($admin->page_is_visible($page)==false) && ($page['visibility'] <> 'none') ) { continue; }
|
276
|
$template->set_var('FLAG_CODE_ICON',' none ');
|
277
|
if( $page['parent'] == 0 )
|
278
|
{
|
279
|
$template->set_var('FLAG_CODE_ICON','url('.THEME_URL.'/images/flags/'.strtolower($page['language']).'.png)');
|
280
|
}
|
281
|
// If the current page cannot be parent, then its children neither
|
282
|
$list_next_level = true;
|
283
|
// Stop users from adding pages with a level of more than the set page level limit
|
284
|
if($page['level']+1 < PAGE_LEVEL_LIMIT)
|
285
|
{
|
286
|
// Get user perms
|
287
|
$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
|
288
|
$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
|
289
|
$in_group = FALSE;
|
290
|
foreach($admin->get_groups_id() as $cur_gid)
|
291
|
{
|
292
|
if (in_array($cur_gid, $admin_groups))
|
293
|
{
|
294
|
$in_group = TRUE;
|
295
|
}
|
296
|
}
|
297
|
if(($in_group) OR is_numeric(array_search($admin->get_user_id(), $admin_users)))
|
298
|
{
|
299
|
$can_modify = true;
|
300
|
} else {
|
301
|
$can_modify = false;
|
302
|
}
|
303
|
$title_prefix = '';
|
304
|
for($i = 1; $i <= $page['level']; $i++) { $title_prefix .= ' - - '; }
|
305
|
// $space = str_repeat(' ', 3); $space.'<'..'>'
|
306
|
$template->set_var(array(
|
307
|
'VALUE' => $page['page_code'],
|
308
|
'PAGE_VALUE' => $title_prefix.$page['menu_title'],
|
309
|
'PAGE_CODE' => $title_prefix.$page['page_id']
|
310
|
)
|
311
|
);
|
312
|
if($results_array['page_code'] == $page['page_code'])
|
313
|
{
|
314
|
$template->set_var('SELECTED', ' selected="selected"');
|
315
|
} elseif($can_modify != true)
|
316
|
{
|
317
|
$template->set_var('SELECTED', ' disabled="disabled" class="disabled"');
|
318
|
} else {
|
319
|
$template->set_var('SELECTED', '');
|
320
|
}
|
321
|
$template->parse('page_code_list', 'page_code_list_block', true);
|
322
|
}
|
323
|
if ($list_next_level)
|
324
|
page_code_list($page['page_id']);
|
325
|
}
|
326
|
} // end page_code_list
|
327
|
// Insert code_page values from page to modify
|
328
|
$template->set_block('main_block', 'page_code_list_block', 'page_code_list');
|
329
|
|
330
|
if($admin->get_permission('pages_add_l0') == true OR $results_array['level'] == 0)
|
331
|
{
|
332
|
if($results_array['parent'] == 0) { $selected = ' selected'; } else { $selected = ''; }
|
333
|
$aPageCodeList = array(
|
334
|
'VALUE' => '',
|
335
|
'PAGE_CODE' => $TEXT['NONE'],
|
336
|
'PAGE_VALUE' => '',
|
337
|
'SELECTED' => $selected
|
338
|
);
|
339
|
$template->set_var($aPageCodeList);
|
340
|
$template->parse('page_code_list', 'page_code_list_block', true);
|
341
|
}
|
342
|
// get pagecode form this page_id
|
343
|
page_code_list(0);
|
344
|
}
|
345
|
//-- page code -->
|
346
|
// Parent page list
|
347
|
/* $database = new database(); */
|
348
|
function parent_list($parent)
|
349
|
{
|
350
|
global $admin, $database, $template, $results_array,$field_set;
|
351
|
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'pages` WHERE `parent` = '.$parent.' ORDER BY `position` ASC';
|
352
|
$get_pages = $database->query($sql);
|
353
|
while($page = $get_pages->fetchRow(MYSQLI_ASSOC))
|
354
|
{
|
355
|
if($admin->page_is_visible($page)==false)
|
356
|
{
|
357
|
continue;
|
358
|
}
|
359
|
// if parent = 0 set flag_icon
|
360
|
$template->set_var('FLAG_ROOT_ICON',' none ');
|
361
|
if( $page['parent'] == 0 && $field_set)
|
362
|
{
|
363
|
$template->set_var('FLAG_ROOT_ICON','url('.THEME_URL.'/images/flags/'.strtolower($page['language']).'.png)');
|
364
|
}
|
365
|
// If the current page cannot be parent, then its children neither
|
366
|
$list_next_level = true;
|
367
|
// Stop users from adding pages with a level of more than the set page level limit
|
368
|
if( $page['level']+1 < PAGE_LEVEL_LIMIT +1 )
|
369
|
{
|
370
|
// Get user perms
|
371
|
$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
|
372
|
$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
|
373
|
$in_group = FALSE;
|
374
|
foreach($admin->get_groups_id() as $cur_gid)
|
375
|
{
|
376
|
if (in_array($cur_gid, $admin_groups))
|
377
|
{
|
378
|
$in_group = TRUE;
|
379
|
}
|
380
|
}
|
381
|
if(($in_group) OR is_numeric(array_search($admin->get_user_id(), $admin_users)))
|
382
|
{
|
383
|
$can_modify = true;
|
384
|
} else {
|
385
|
$can_modify = false;
|
386
|
}
|
387
|
// Title -'s prefix
|
388
|
$title_prefix = '';
|
389
|
for($i = 1; $i <= $page['level']; $i++) { $title_prefix .= ' - - '; }
|
390
|
$template->set_var(array(
|
391
|
'ID' => $page['page_id'],
|
392
|
'TITLE' => ($title_prefix.$page['menu_title']),
|
393
|
'PAGE-TITLE' => ($title_prefix.$page['page_title']),
|
394
|
'MENU-TITLE' => ($title_prefix.$page['menu_title']),
|
395
|
'FLAG_ICON' => ' none ',
|
396
|
));
|
397
|
if($results_array['parent'] == $page['page_id'])
|
398
|
{
|
399
|
$template->set_var('SELECTED', ' selected="selected"');
|
400
|
} elseif($results_array['page_id'] == $page['page_id'])
|
401
|
{
|
402
|
$template->set_var('SELECTED', ' disabled="disabled" class="disabled"');
|
403
|
$list_next_level=false;
|
404
|
} elseif($can_modify != true)
|
405
|
{
|
406
|
$template->set_var('SELECTED', ' disabled="disabled" class="disabled"');
|
407
|
} else {
|
408
|
$template->set_var('SELECTED', '');
|
409
|
}
|
410
|
$template->parse('page_list2', 'page_list_block2', true);
|
411
|
}
|
412
|
if ($list_next_level)
|
413
|
{
|
414
|
parent_list($page['page_id']);
|
415
|
}
|
416
|
}
|
417
|
}
|
418
|
$template->set_block('main_block', 'page_list_block2', 'page_list2');
|
419
|
if($admin->get_permission('pages_add_l0') == true OR $results_array['level'] == 0) {
|
420
|
if($results_array['parent'] == 0)
|
421
|
{
|
422
|
$selected = ' selected="selected"';
|
423
|
} else {
|
424
|
$selected = '';
|
425
|
}
|
426
|
$template->set_var(array(
|
427
|
'ID' => '0',
|
428
|
'TITLE' => $TEXT['NONE'],
|
429
|
'SELECTED' => $selected
|
430
|
) );
|
431
|
$template->parse('page_list2', 'page_list_block2', true);
|
432
|
}
|
433
|
parent_list(0);
|
434
|
if($modified_ts == 'Unknown')
|
435
|
{
|
436
|
$template->set_var('DISPLAY_MODIFIED', 'hide');
|
437
|
} else {
|
438
|
$template->set_var('DISPLAY_MODIFIED', '');
|
439
|
}
|
440
|
// Templates list
|
441
|
$template->set_block('main_block', 'template_list_block', 'template_list');
|
442
|
|
443
|
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'addons` WHERE `type` = "template" AND `function` = "template" order by `name`';
|
444
|
if( ($res_templates = $database->query($sql)) )
|
445
|
{
|
446
|
while($rec_template = $res_templates->fetchRow(MYSQLI_ASSOC))
|
447
|
{
|
448
|
// Check if the user has perms to use this template
|
449
|
if($rec_template['directory'] == $results_array['template'] OR $admin->get_permission($rec_template['directory'], 'template') == true)
|
450
|
{
|
451
|
$template->set_var('VALUE', $rec_template['directory']);
|
452
|
$template->set_var('NAME', $rec_template['name']);
|
453
|
if($rec_template['directory'] == $results_array['template'])
|
454
|
{
|
455
|
$template->set_var('SELECTED', ' selected="selected"');
|
456
|
} else {
|
457
|
$template->set_var('SELECTED', '');
|
458
|
}
|
459
|
$template->parse('template_list', 'template_list_block', true);
|
460
|
}
|
461
|
}
|
462
|
}
|
463
|
// Menu list
|
464
|
if(MULTIPLE_MENUS == false)
|
465
|
{
|
466
|
$template->set_var('DISPLAY_MENU_LIST', 'display:none;');
|
467
|
}
|
468
|
// Include template info file (if it exists)
|
469
|
if($results_array['template'] != '')
|
470
|
{
|
471
|
$template_location = WB_PATH.'/templates/'.$results_array['template'].'/info.php';
|
472
|
} else {
|
473
|
$template_location = WB_PATH.'/templates/'.DEFAULT_TEMPLATE.'/info.php';
|
474
|
}
|
475
|
if(file_exists($template_location))
|
476
|
{
|
477
|
require($template_location);
|
478
|
}
|
479
|
// Check if $menu is set
|
480
|
if(!isset($menu[1]) OR $menu[1] == '')
|
481
|
{
|
482
|
// Make our own menu list
|
483
|
$menu[1] = $TEXT['MAIN'];
|
484
|
}
|
485
|
// Add menu options to the list
|
486
|
$template->set_block('main_block', 'menu_list_block', 'menu_list');
|
487
|
foreach($menu AS $number => $name)
|
488
|
{
|
489
|
$template->set_var('NAME', $name);
|
490
|
$template->set_var('VALUE', $number);
|
491
|
if($results_array['menu'] == $number)
|
492
|
{
|
493
|
$template->set_var('SELECTED', ' selected="selected"');
|
494
|
} else {
|
495
|
$template->set_var('SELECTED', '');
|
496
|
}
|
497
|
$template->parse('menu_list', 'menu_list_block', true);
|
498
|
}
|
499
|
// Insert language values
|
500
|
$template->set_block('main_block', 'language_list_block', 'language_list');
|
501
|
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'addons` WHERE `type` = "language" ORDER BY `name`';
|
502
|
if( ($res_languages = $database->query($sql)) )
|
503
|
{
|
504
|
while($rec_language = $res_languages->fetchRow(MYSQLI_ASSOC))
|
505
|
{
|
506
|
$l_codes[$rec_language['name']] = $rec_language['directory'];
|
507
|
$l_names[$rec_language['name']] = entities_to_7bit($rec_language['name']); // sorting-problem workaround
|
508
|
}
|
509
|
asort($l_names);
|
510
|
foreach($l_names as $l_name=>$v)
|
511
|
{
|
512
|
$langIcons = (empty($l_codes[$l_name])) ? 'none' : strtolower($l_codes[$l_name]);
|
513
|
// Insert code and name
|
514
|
$template->set_var(array(
|
515
|
'VALUE' => $l_codes[$l_name],
|
516
|
'NAME' => $l_name,
|
517
|
'FLAG_LANG_ICONS' => 'url('.THEME_URL.'/images/flags/'.$langIcons.'.png)',
|
518
|
));
|
519
|
// Check if it is selected
|
520
|
if($results_array['language'] == $l_codes[$l_name])
|
521
|
{
|
522
|
$template->set_var('SELECTED', ' selected="selected"');
|
523
|
} else {
|
524
|
$template->set_var('SELECTED', '');
|
525
|
}
|
526
|
$template->parse('language_list', 'language_list_block', true);
|
527
|
}
|
528
|
}
|
529
|
// Select disabled if searching is disabled
|
530
|
if($results_array['searching'] == 0)
|
531
|
{
|
532
|
$template->set_var('SEARCHING_DISABLED', ' selected="selected"');
|
533
|
}
|
534
|
// Select what the page target is
|
535
|
switch ($results_array['target'])
|
536
|
{
|
537
|
case '_top':
|
538
|
$template->set_var('TOP_SELECTED', ' selected="selected"');
|
539
|
break;
|
540
|
case '_self':
|
541
|
$template->set_var('SELF_SELECTED', ' selected="selected"');
|
542
|
break;
|
543
|
case '_blank':
|
544
|
$template->set_var('BLANK_SELECTED', ' selected="selected"');
|
545
|
break;
|
546
|
}
|
547
|
// Insert language text
|
548
|
$template->set_var(array(
|
549
|
'DISPLAY_ADVANCED' => ' disabled="disabled"',
|
550
|
'HEADING_MODIFY_PAGE_SETTINGS' => $HEADING['MODIFY_PAGE_SETTINGS'],
|
551
|
'TEXT_CURRENT_PAGE' => $TEXT['CURRENT_PAGE'],
|
552
|
'TEXT_MODIFY' => $TEXT['MODIFY'],
|
553
|
'TEXT_MODIFY_PAGE' => $HEADING['MODIFY_PAGE'],
|
554
|
'LAST_MODIFIED' => $MESSAGE['PAGES']['LAST_MODIFIED'],
|
555
|
'TEXT_PAGE_TITLE' => $TEXT['PAGE_TITLE'],
|
556
|
'TEXT_MENU_TITLE' => $TEXT['MENU_TITLE'],
|
557
|
'TEXT_SEO_TITLE' => $TEXT['FILE'].'-'.$TEXT['LINK'],
|
558
|
'TEXT_TYPE' => $TEXT['TYPE'],
|
559
|
'TEXT_MENU' => $TEXT['MENU'],
|
560
|
'TEXT_PARENT' => $TEXT['PARENT'],
|
561
|
'TEXT_VISIBILITY' => $TEXT['VISIBILITY'],
|
562
|
'TEXT_PUBLIC' => $TEXT['PUBLIC'],
|
563
|
'TEXT_PRIVATE' => $TEXT['PRIVATE'],
|
564
|
'TEXT_REGISTERED' => $TEXT['REGISTERED'],
|
565
|
'TEXT_NONE' => $TEXT['NONE'],
|
566
|
'TEXT_HIDDEN' => $TEXT['HIDDEN'],
|
567
|
'TEXT_TEMPLATE' => $TEXT['TEMPLATE'],
|
568
|
'TEXT_TARGET' => $TEXT['TARGET'],
|
569
|
'TEXT_SYSTEM_DEFAULT' => $TEXT['SYSTEM_DEFAULT'],
|
570
|
'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
|
571
|
'TEXT_NEW_WINDOW' => $TEXT['NEW_WINDOW'],
|
572
|
'TEXT_SAME_WINDOW' => $TEXT['SAME_WINDOW'],
|
573
|
'TEXT_TOP_FRAME' => $TEXT['TOP_FRAME'],
|
574
|
'TEXT_ADMINISTRATORS' => $TEXT['ADMINISTRATORS'],
|
575
|
'TEXT_ALLOWED_VIEWERS' => $TEXT['ALLOWED_VIEWERS'],
|
576
|
'TEXT_DESCRIPTION' => $TEXT['DESCRIPTION'],
|
577
|
'TEXT_KEYWORDS' => $TEXT['KEYWORDS'],
|
578
|
'TEXT_SEARCHING' => $TEXT['SEARCHING'],
|
579
|
'TEXT_LANGUAGE' => $TEXT['LANGUAGE'],
|
580
|
'TEXT_ENABLED' => $TEXT['ENABLED'],
|
581
|
'TEXT_DISABLED' => $TEXT['DISABLED'],
|
582
|
'TEXT_SAVE' => $TEXT['SAVE'],
|
583
|
'TEXT_BACK' => $TEXT['BACK'],
|
584
|
'TEXT_RESET' => $TEXT['RESET'],
|
585
|
'LAST_MODIFIED' => $MESSAGE['PAGES']['LAST_MODIFIED'],
|
586
|
'HEADING_MODIFY_PAGE' => $HEADING['MODIFY_PAGE'],
|
587
|
'TEXT_PAGE_REORG' => ' Reorgansition'
|
588
|
) );
|
589
|
$template->parse('main', 'main_block', false);
|
590
|
$template->pparse('output', 'page');
|
591
|
// Print admin footer
|
592
|
$admin->print_footer();
|