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