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 |
1200
|
Luisehahne
|
$TEXT['PAGE_CODE'] = empty($TEXT['PAGE_CODE']) ? '' : $TEXT['PAGE_CODE'];
|
262 |
1187
|
Luisehahne
|
$template->set_var('DISPLAY_CODE_PAGE_LIST', ' id="multi_lingual" style="display:none;"');
|
263 |
|
|
// Work-out if page languages feature is enabled
|
264 |
|
|
if((defined('PAGE_LANGUAGES') && PAGE_LANGUAGES) && $field_set)
|
265 |
|
|
{
|
266 |
|
|
$template->set_var( array(
|
267 |
|
|
'DISPLAY_CODE_PAGE_LIST' => ' id="multi_lingual"',
|
268 |
|
|
'TEXT_PAGE_CODE' => '<a href="'.WB_URL.'/modules/mod_multilingual/update_keys.php?page_id='.$page_id.'">'.$TEXT['PAGE_CODE'].'</a>'
|
269 |
|
|
|
270 |
|
|
)
|
271 |
|
|
);
|
272 |
|
|
|
273 |
|
|
|
274 |
|
|
// Page_code list
|
275 |
|
|
$database = new database();
|
276 |
|
|
function page_code_list($parent) {
|
277 |
|
|
global $admin, $database, $template, $results_array, $pageCode;
|
278 |
|
|
$default_language = DEFAULT_LANGUAGE;
|
279 |
|
|
$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' AND language = '$default_language' ORDER BY position ASC";
|
280 |
|
|
$get_pages = $database->query($query);
|
281 |
|
|
while($page = $get_pages->fetchRow()) {
|
282 |
|
|
if($admin->page_is_visible($page)==false)
|
283 |
|
|
continue;
|
284 |
|
|
$template->set_var('FLAG_CODE_ICON',' none ');
|
285 |
|
|
if( $page['parent'] == 0 ) {
|
286 |
|
|
$template->set_var('FLAG_CODE_ICON','url('.THEME_URL.'/images/flags/'.strtolower($page['language']).'.png)');
|
287 |
|
|
}
|
288 |
|
|
// If the current page cannot be parent, then its children neither
|
289 |
|
|
$list_next_level = true;
|
290 |
|
|
// Stop users from adding pages with a level of more than the set page level limit
|
291 |
|
|
if($page['level']+1 < PAGE_LEVEL_LIMIT) {
|
292 |
|
|
// Get user perms
|
293 |
|
|
$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
|
294 |
|
|
$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
|
295 |
|
|
|
296 |
|
|
$in_group = FALSE;
|
297 |
|
|
foreach($admin->get_groups_id() as $cur_gid){
|
298 |
|
|
if (in_array($cur_gid, $admin_groups))
|
299 |
|
|
{
|
300 |
|
|
$in_group = TRUE;
|
301 |
|
|
}
|
302 |
|
|
}
|
303 |
|
|
|
304 |
|
|
if(($in_group) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) {
|
305 |
|
|
$can_modify = true;
|
306 |
|
|
} else {
|
307 |
|
|
$can_modify = false;
|
308 |
|
|
}
|
309 |
|
|
// Title -'s prefix
|
310 |
|
|
$title_prefix = '';
|
311 |
|
|
for($i = 1; $i <= $page['level']; $i++) { $title_prefix .= ' - - '; }
|
312 |
|
|
$template->set_var(array(
|
313 |
|
|
'VALUE' => $page['page_code'],
|
314 |
|
|
'PAGE_CODE' => ($title_prefix.$page['menu_title'])
|
315 |
|
|
)
|
316 |
|
|
);
|
317 |
|
|
if($results_array['page_code'] == $page['page_code']) {
|
318 |
|
|
$template->set_var('SELECTED', ' selected="selected"');
|
319 |
|
|
} elseif($results_array['page_code'] == $page['page_code']) {
|
320 |
|
|
$template->set_var('SELECTED', ' disabled="disabled" class="disabled"');
|
321 |
|
|
$list_next_level=false;
|
322 |
|
|
} elseif($can_modify != true) {
|
323 |
|
|
$template->set_var('SELECTED', ' disabled="disabled" class="disabled"');
|
324 |
|
|
} else {
|
325 |
|
|
$template->set_var('SELECTED', '');
|
326 |
|
|
}
|
327 |
|
|
$template->parse('page_code_list', 'page_code_list_block', true);
|
328 |
|
|
}
|
329 |
|
|
if ($list_next_level)
|
330 |
|
|
page_code_list($page['page_id']);
|
331 |
|
|
}
|
332 |
|
|
}
|
333 |
|
|
// Insert code_page values from page to modify
|
334 |
|
|
$template->set_block('main_block', 'page_code_list_block', 'page_code_list');
|
335 |
|
|
if($admin->get_permission('pages_add_l0') == true OR $results_array['level'] == 0) {
|
336 |
|
|
if($results_array['parent'] == 0) { $selected = ' selected'; } else { $selected = ''; }
|
337 |
|
|
$template->set_var(array(
|
338 |
|
|
'VALUE' => '',
|
339 |
|
|
'PAGE_CODE' => $TEXT['NONE'],
|
340 |
|
|
'SELECTED' => $selected
|
341 |
|
|
)
|
342 |
|
|
);
|
343 |
|
|
$template->parse('page_code_list', 'page_code_list_block', true);
|
344 |
|
|
}
|
345 |
|
|
// get pagecode form this page_id
|
346 |
|
|
page_code_list(0);
|
347 |
|
|
}
|
348 |
|
|
//-- page code -->
|
349 |
|
|
|
350 |
1009
|
Ruebenwurz
|
// Parent page list
|
351 |
|
|
$database = new database();
|
352 |
|
|
function parent_list($parent) {
|
353 |
1187
|
Luisehahne
|
global $admin, $database, $template, $results_array,$field_set;
|
354 |
1009
|
Ruebenwurz
|
$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' ORDER BY position ASC";
|
355 |
|
|
$get_pages = $database->query($query);
|
356 |
|
|
while($page = $get_pages->fetchRow()) {
|
357 |
|
|
if($admin->page_is_visible($page)==false)
|
358 |
|
|
continue;
|
359 |
1187
|
Luisehahne
|
// if parent = 0 set flag_icon
|
360 |
1009
|
Ruebenwurz
|
$template->set_var('FLAG_ROOT_ICON',' none ');
|
361 |
1187
|
Luisehahne
|
if( $page['parent'] == 0 && $field_set) {
|
362 |
1009
|
Ruebenwurz
|
$template->set_var('FLAG_ROOT_ICON','url('.THEME_URL.'/images/flags/'.strtolower($page['language']).'.png)');
|
363 |
|
|
}
|
364 |
|
|
// If the current page cannot be parent, then its children neither
|
365 |
|
|
$list_next_level = true;
|
366 |
|
|
// Stop users from adding pages with a level of more than the set page level limit
|
367 |
|
|
if($page['level']+1 < PAGE_LEVEL_LIMIT) {
|
368 |
|
|
// Get user perms
|
369 |
|
|
$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
|
370 |
|
|
$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
|
371 |
|
|
$in_group = FALSE;
|
372 |
|
|
foreach($admin->get_groups_id() as $cur_gid){
|
373 |
|
|
if (in_array($cur_gid, $admin_groups)) {
|
374 |
|
|
$in_group = TRUE;
|
375 |
|
|
}
|
376 |
|
|
}
|
377 |
|
|
if(($in_group) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) {
|
378 |
|
|
$can_modify = true;
|
379 |
|
|
} else {
|
380 |
|
|
$can_modify = false;
|
381 |
|
|
}
|
382 |
|
|
// Title -'s prefix
|
383 |
|
|
$title_prefix = '';
|
384 |
|
|
for($i = 1; $i <= $page['level']; $i++) { $title_prefix .= ' - '; }
|
385 |
|
|
$template->set_var(array(
|
386 |
|
|
'ID' => $page['page_id'],
|
387 |
1187
|
Luisehahne
|
'TITLE' => ($title_prefix.$page['menu_title']),
|
388 |
|
|
'MENU-TITLE' => ($title_prefix.$page['menu_title']),
|
389 |
|
|
'PAGE-TITLE' => ($title_prefix.$page['page_title']),
|
390 |
1009
|
Ruebenwurz
|
'FLAG_ICON' => 'none',
|
391 |
|
|
));
|
392 |
|
|
|
393 |
|
|
if($results_array['parent'] == $page['page_id']) {
|
394 |
|
|
$template->set_var('SELECTED', ' selected="selected"');
|
395 |
|
|
} elseif($results_array['page_id'] == $page['page_id']) {
|
396 |
|
|
$template->set_var('SELECTED', ' disabled="disabled" class="disabled"');
|
397 |
|
|
$list_next_level=false;
|
398 |
|
|
} elseif($can_modify != true) {
|
399 |
|
|
$template->set_var('SELECTED', ' disabled="disabled" class="disabled"');
|
400 |
|
|
} else {
|
401 |
|
|
$template->set_var('SELECTED', '');
|
402 |
|
|
}
|
403 |
|
|
$template->parse('page_list2', 'page_list_block2', true);
|
404 |
|
|
}
|
405 |
|
|
if ($list_next_level)
|
406 |
|
|
parent_list($page['page_id']);
|
407 |
|
|
}
|
408 |
|
|
}
|
409 |
|
|
|
410 |
|
|
$template->set_block('main_block', 'page_list_block2', 'page_list2');
|
411 |
|
|
if($admin->get_permission('pages_add_l0') == true OR $results_array['level'] == 0) {
|
412 |
|
|
if($results_array['parent'] == 0) {
|
413 |
1012
|
Ruebenwurz
|
$selected = ' selected="selected"';
|
414 |
1009
|
Ruebenwurz
|
} else {
|
415 |
|
|
$selected = '';
|
416 |
|
|
}
|
417 |
|
|
$template->set_var(array(
|
418 |
|
|
'ID' => '0',
|
419 |
|
|
'TITLE' => $TEXT['NONE'],
|
420 |
|
|
'SELECTED' => $selected
|
421 |
|
|
)
|
422 |
|
|
);
|
423 |
|
|
$template->parse('page_list2', 'page_list_block2', true);
|
424 |
|
|
}
|
425 |
|
|
parent_list(0);
|
426 |
|
|
|
427 |
|
|
if($modified_ts == 'Unknown') {
|
428 |
|
|
$template->set_var('DISPLAY_MODIFIED', 'hide');
|
429 |
|
|
} else {
|
430 |
|
|
$template->set_var('DISPLAY_MODIFIED', '');
|
431 |
|
|
}
|
432 |
|
|
// Templates list
|
433 |
|
|
$template->set_block('main_block', 'template_list_block', 'template_list');
|
434 |
|
|
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' and function = 'template' order by name");
|
435 |
|
|
if($result->numRows() > 0) {
|
436 |
|
|
while($addon = $result->fetchRow()) {
|
437 |
|
|
// Check if the user has perms to use this template
|
438 |
|
|
if($addon['directory'] == $results_array['template'] OR $admin->get_permission($addon['directory'], 'template') == true) {
|
439 |
|
|
$template->set_var('VALUE', $addon['directory']);
|
440 |
|
|
$template->set_var('NAME', $addon['name']);
|
441 |
|
|
if($addon['directory'] == $results_array['template']) {
|
442 |
|
|
$template->set_var('SELECTED', ' selected="selected"');
|
443 |
|
|
} else {
|
444 |
|
|
$template->set_var('SELECTED', '');
|
445 |
|
|
}
|
446 |
|
|
$template->parse('template_list', 'template_list_block', true);
|
447 |
|
|
}
|
448 |
|
|
}
|
449 |
|
|
}
|
450 |
|
|
|
451 |
|
|
// Menu list
|
452 |
|
|
if(MULTIPLE_MENUS == false) {
|
453 |
|
|
$template->set_var('DISPLAY_MENU_LIST', 'none');
|
454 |
|
|
}
|
455 |
|
|
// Include template info file (if it exists)
|
456 |
|
|
if($results_array['template'] != '') {
|
457 |
|
|
$template_location = WB_PATH.'/templates/'.$results_array['template'].'/info.php';
|
458 |
|
|
} else {
|
459 |
|
|
$template_location = WB_PATH.'/templates/'.DEFAULT_TEMPLATE.'/info.php';
|
460 |
|
|
}
|
461 |
|
|
if(file_exists($template_location)) {
|
462 |
|
|
require($template_location);
|
463 |
|
|
}
|
464 |
|
|
// Check if $menu is set
|
465 |
|
|
if(!isset($menu[1]) OR $menu[1] == '') {
|
466 |
|
|
// Make our own menu list
|
467 |
|
|
$menu[1] = $TEXT['MAIN'];
|
468 |
|
|
}
|
469 |
|
|
// Add menu options to the list
|
470 |
|
|
$template->set_block('main_block', 'menu_list_block', 'menu_list');
|
471 |
|
|
foreach($menu AS $number => $name) {
|
472 |
|
|
$template->set_var('NAME', $name);
|
473 |
|
|
$template->set_var('VALUE', $number);
|
474 |
|
|
if($results_array['menu'] == $number) {
|
475 |
|
|
$template->set_var('SELECTED', ' selected="selected"');
|
476 |
|
|
} else {
|
477 |
|
|
$template->set_var('SELECTED', '');
|
478 |
|
|
}
|
479 |
|
|
$template->parse('menu_list', 'menu_list_block', true);
|
480 |
|
|
}
|
481 |
|
|
|
482 |
|
|
// Insert language values
|
483 |
|
|
$template->set_block('main_block', 'language_list_block', 'language_list');
|
484 |
|
|
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'language' order by name");
|
485 |
|
|
if($result->numRows() > 0) {
|
486 |
|
|
while($addon = $result->fetchRow()) {
|
487 |
|
|
$l_codes[$addon['name']] = $addon['directory'];
|
488 |
|
|
$l_names[$addon['name']] = entities_to_7bit($addon['name']); // sorting-problem workaround
|
489 |
|
|
}
|
490 |
|
|
asort($l_names);
|
491 |
|
|
foreach($l_names as $l_name=>$v) {
|
492 |
|
|
// Insert code and name
|
493 |
|
|
$template->set_var(array(
|
494 |
|
|
'VALUE' => $l_codes[$l_name],
|
495 |
|
|
'NAME' => $l_name,
|
496 |
|
|
'FLAG_LANG_ICONS' => 'url('.THEME_URL.'/images/flags/'.strtolower($l_codes[$l_name]).'.png)',
|
497 |
|
|
));
|
498 |
|
|
// Check if it is selected
|
499 |
|
|
if($results_array['language'] == $l_codes[$l_name]) {
|
500 |
|
|
$template->set_var('SELECTED', ' selected="selected"');
|
501 |
|
|
} else {
|
502 |
|
|
$template->set_var('SELECTED', '');
|
503 |
|
|
}
|
504 |
|
|
$template->parse('language_list', 'language_list_block', true);
|
505 |
|
|
}
|
506 |
|
|
}
|
507 |
|
|
|
508 |
|
|
// Select disabled if searching is disabled
|
509 |
|
|
if($results_array['searching'] == 0) {
|
510 |
|
|
$template->set_var('SEARCHING_DISABLED', ' selected="selected"');
|
511 |
|
|
}
|
512 |
|
|
// Select what the page target is
|
513 |
|
|
switch ($results_array['target']) {
|
514 |
|
|
case '_top':
|
515 |
|
|
$template->set_var('TOP_SELECTED', ' selected="selected"');
|
516 |
|
|
break;
|
517 |
|
|
case '_self':
|
518 |
|
|
$template->set_var('SELF_SELECTED', ' selected="selected"');
|
519 |
|
|
break;
|
520 |
|
|
case '_blank':
|
521 |
|
|
$template->set_var('BLANK_SELECTED', ' selected="selected"');
|
522 |
|
|
break;
|
523 |
|
|
}
|
524 |
|
|
|
525 |
|
|
|
526 |
|
|
// Insert language text
|
527 |
|
|
$template->set_var(array(
|
528 |
|
|
'HEADING_MODIFY_PAGE_SETTINGS' => $HEADING['MODIFY_PAGE_SETTINGS'],
|
529 |
|
|
'TEXT_CURRENT_PAGE' => $TEXT['CURRENT_PAGE'],
|
530 |
|
|
'TEXT_MODIFY' => $TEXT['MODIFY'],
|
531 |
|
|
'TEXT_MODIFY_PAGE' => $HEADING['MODIFY_PAGE'],
|
532 |
|
|
'LAST_MODIFIED' => $MESSAGE['PAGES']['LAST_MODIFIED'],
|
533 |
|
|
'TEXT_PAGE_TITLE' => $TEXT['PAGE_TITLE'],
|
534 |
|
|
'TEXT_MENU_TITLE' => $TEXT['MENU_TITLE'],
|
535 |
|
|
'TEXT_TYPE' => $TEXT['TYPE'],
|
536 |
|
|
'TEXT_MENU' => $TEXT['MENU'],
|
537 |
|
|
'TEXT_PARENT' => $TEXT['PARENT'],
|
538 |
|
|
'TEXT_VISIBILITY' => $TEXT['VISIBILITY'],
|
539 |
|
|
'TEXT_PUBLIC' => $TEXT['PUBLIC'],
|
540 |
|
|
'TEXT_PRIVATE' => $TEXT['PRIVATE'],
|
541 |
|
|
'TEXT_REGISTERED' => $TEXT['REGISTERED'],
|
542 |
|
|
'TEXT_NONE' => $TEXT['NONE'],
|
543 |
|
|
'TEXT_HIDDEN' => $TEXT['HIDDEN'],
|
544 |
|
|
'TEXT_TEMPLATE' => $TEXT['TEMPLATE'],
|
545 |
|
|
'TEXT_TARGET' => $TEXT['TARGET'],
|
546 |
|
|
'TEXT_SYSTEM_DEFAULT' => $TEXT['SYSTEM_DEFAULT'],
|
547 |
|
|
'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
|
548 |
|
|
'TEXT_NEW_WINDOW' => $TEXT['NEW_WINDOW'],
|
549 |
|
|
'TEXT_SAME_WINDOW' => $TEXT['SAME_WINDOW'],
|
550 |
|
|
'TEXT_TOP_FRAME' => $TEXT['TOP_FRAME'],
|
551 |
|
|
'TEXT_ADMINISTRATORS' => $TEXT['ADMINISTRATORS'],
|
552 |
|
|
'TEXT_ALLOWED_VIEWERS' => $TEXT['ALLOWED_VIEWERS'],
|
553 |
|
|
'TEXT_DESCRIPTION' => $TEXT['DESCRIPTION'],
|
554 |
|
|
'TEXT_KEYWORDS' => $TEXT['KEYWORDS'],
|
555 |
|
|
'TEXT_SEARCHING' => $TEXT['SEARCHING'],
|
556 |
|
|
'TEXT_LANGUAGE' => $TEXT['LANGUAGE'],
|
557 |
|
|
'TEXT_ENABLED' => $TEXT['ENABLED'],
|
558 |
|
|
'TEXT_DISABLED' => $TEXT['DISABLED'],
|
559 |
|
|
'TEXT_SAVE' => $TEXT['SAVE'],
|
560 |
|
|
'TEXT_RESET' => $TEXT['RESET'],
|
561 |
|
|
'LAST_MODIFIED' => $MESSAGE['PAGES']['LAST_MODIFIED'],
|
562 |
|
|
'HEADING_MODIFY_PAGE' => $HEADING['MODIFY_PAGE']
|
563 |
|
|
) );
|
564 |
|
|
|
565 |
|
|
$template->parse('main', 'main_block', false);
|
566 |
|
|
$template->pparse('output', 'page');
|
567 |
|
|
|
568 |
|
|
// Print admin footer
|
569 |
|
|
$admin->print_footer();
|
570 |
|
|
|
571 |
|
|
?>
|