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