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