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
|
|
45 |
|
|
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'pages` WHERE `page_id` = '.$page_id;
|
46 |
|
|
$results = $database->query($sql);
|
47 |
|
|
$results_array = $results->fetchRow();
|
48 |
|
|
|
49 |
|
|
$old_admin_groups = explode(',', $results_array['admin_groups']);
|
50 |
|
|
$old_admin_users = explode(',', $results_array['admin_users']);
|
51 |
|
|
|
52 |
|
|
// Work-out if we should check for existing page_code
|
53 |
|
|
$sql = 'DESCRIBE `'.TABLE_PREFIX.'pages` `page_code`';
|
54 |
|
|
$field_sql = $database->query($sql);
|
55 |
|
|
$field_set = $field_sql->numRows();
|
56 |
|
|
|
57 |
|
|
$in_old_group = FALSE;
|
58 |
|
|
foreach($admin->get_groups_id() as $cur_gid)
|
59 |
|
|
{
|
60 |
|
|
if (in_array($cur_gid, $old_admin_groups))
|
61 |
|
|
{
|
62 |
|
|
$in_old_group = TRUE;
|
63 |
|
|
}
|
64 |
|
|
}
|
65 |
1384
|
Luisehahne
|
if((!$in_old_group) && !is_numeric(array_search($admin->get_user_id(), $old_admin_users)))
|
66 |
1358
|
Luisehahne
|
{
|
67 |
|
|
$admin->print_error($MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS']);
|
68 |
|
|
}
|
69 |
|
|
|
70 |
|
|
// Get page details
|
71 |
|
|
/* $database = new database(); */
|
72 |
|
|
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'pages` WHERE `page_id`='.$page_id;
|
73 |
|
|
$results = $database->query($sql);
|
74 |
|
|
if($database->is_error()) {
|
75 |
|
|
$admin->print_header();
|
76 |
|
|
$admin->print_error($database->get_error());
|
77 |
|
|
}
|
78 |
|
|
if($results->numRows() == 0) {
|
79 |
|
|
$admin->print_header();
|
80 |
|
|
$admin->print_error($MESSAGE['PAGES']['NOT_FOUND']);
|
81 |
|
|
}
|
82 |
|
|
$results_array = $results->fetchRow();
|
83 |
|
|
|
84 |
|
|
// Get display name of person who last modified the page
|
85 |
|
|
$user=$admin->get_user_details($results_array['modified_by']);
|
86 |
|
|
|
87 |
|
|
// Convert the unix ts for modified_when to human a readable form
|
88 |
|
|
if($results_array['modified_when'] != 0)
|
89 |
|
|
{
|
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 |
|
|
$template->set_var('FTAN', $admin->getFTAN());
|
100 |
|
|
|
101 |
|
|
$template->set_var(array(
|
102 |
|
|
'PAGE_ID' => $results_array['page_id'],
|
103 |
1402
|
Luisehahne
|
// 'PAGE_IDKEY' => $admin->getIDKEY($results_array['page_id']),
|
104 |
|
|
'PAGE_IDKEY' => $results_array['page_id'],
|
105 |
1358
|
Luisehahne
|
'PAGE_TITLE' => ($results_array['page_title']),
|
106 |
|
|
'MENU_TITLE' => ($results_array['menu_title']),
|
107 |
|
|
'DESCRIPTION' => ($results_array['description']),
|
108 |
|
|
'KEYWORDS' => ($results_array['keywords']),
|
109 |
|
|
'MODIFIED_BY' => $user['display_name'],
|
110 |
|
|
'MODIFIED_BY_USERNAME' => $user['username'],
|
111 |
|
|
'MODIFIED_WHEN' => $modified_ts,
|
112 |
|
|
'ADMIN_URL' => ADMIN_URL,
|
113 |
|
|
'WB_URL' => WB_URL,
|
114 |
|
|
'THEME_URL' => THEME_URL
|
115 |
|
|
)
|
116 |
|
|
);
|
117 |
|
|
|
118 |
|
|
// Work-out if we should show the "manage sections" link
|
119 |
|
|
$sql = 'SELECT `section_id` FROM `'.TABLE_PREFIX.'sections` WHERE `page_id`='.$page_id.' AND `module`="menu_link"';
|
120 |
|
|
$query_sections = $database->query($sql);
|
121 |
|
|
if($query_sections->numRows() > 0)
|
122 |
|
|
{
|
123 |
|
|
$template->set_var('DISPLAY_MANAGE_SECTIONS', 'display:none;');
|
124 |
|
|
} elseif(MANAGE_SECTIONS == 'enabled')
|
125 |
|
|
{
|
126 |
|
|
$template->set_var('TEXT_MANAGE_SECTIONS', $HEADING['MANAGE_SECTIONS']);
|
127 |
|
|
} else {
|
128 |
|
|
$template->set_var('DISPLAY_MANAGE_SECTIONS', 'display:none;');
|
129 |
|
|
}
|
130 |
|
|
|
131 |
|
|
// Visibility
|
132 |
|
|
if($results_array['visibility'] == 'public') {
|
133 |
|
|
$template->set_var('PUBLIC_SELECTED', ' selected="selected"');
|
134 |
|
|
} elseif($results_array['visibility'] == 'private') {
|
135 |
|
|
$template->set_var('PRIVATE_SELECTED', ' selected="selected"');
|
136 |
|
|
} elseif($results_array['visibility'] == 'registered') {
|
137 |
|
|
$template->set_var('REGISTERED_SELECTED', ' selected="selected"');
|
138 |
|
|
} elseif($results_array['visibility'] == 'hidden') {
|
139 |
|
|
$template->set_var('HIDDEN_SELECTED', ' selected="selected"');
|
140 |
|
|
} elseif($results_array['visibility'] == 'none') {
|
141 |
|
|
$template->set_var('NO_VIS_SELECTED', ' selected="selected"');
|
142 |
|
|
}
|
143 |
|
|
// Group list 1 (admin_groups)
|
144 |
|
|
$admin_groups = explode(',', str_replace('_', '', $results_array['admin_groups']));
|
145 |
|
|
|
146 |
|
|
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'groups`';
|
147 |
|
|
$get_groups = $database->query($sql);
|
148 |
|
|
|
149 |
|
|
$template->set_block('main_block', 'group_list_block', 'group_list');
|
150 |
|
|
// Insert admin group and current group first
|
151 |
|
|
$admin_group_name = $get_groups->fetchRow();
|
152 |
|
|
$template->set_var(array(
|
153 |
|
|
'ID' => 1,
|
154 |
|
|
'TOGGLE' => '',
|
155 |
|
|
'DISABLED' => ' disabled="disabled"',
|
156 |
|
|
'LINK_COLOR' => '000000',
|
157 |
|
|
'CURSOR' => 'default',
|
158 |
|
|
'NAME' => $admin_group_name['name'],
|
159 |
|
|
'CHECKED' => ' checked="checked"'
|
160 |
|
|
)
|
161 |
|
|
);
|
162 |
|
|
$template->parse('group_list', 'group_list_block', true);
|
163 |
|
|
while($group = $get_groups->fetchRow()) {
|
164 |
|
|
// check if the user is a member of this group
|
165 |
|
|
$flag_disabled = '';
|
166 |
|
|
$flag_checked = '';
|
167 |
|
|
$flag_cursor = 'pointer';
|
168 |
|
|
$flag_color = '';
|
169 |
|
|
if (in_array($group["group_id"], $admin->get_groups_id())) {
|
170 |
|
|
$flag_disabled = ''; //' disabled';
|
171 |
|
|
$flag_checked = ''; //' checked';
|
172 |
|
|
$flag_cursor = 'default';
|
173 |
|
|
$flag_color = '000000';
|
174 |
|
|
}
|
175 |
|
|
|
176 |
|
|
// Check if the group is allowed to edit pages
|
177 |
|
|
$system_permissions = explode(',', $group['system_permissions']);
|
178 |
|
|
if(is_numeric(array_search('pages_modify', $system_permissions))) {
|
179 |
|
|
$template->set_var(array(
|
180 |
|
|
'ID' => $group['group_id'],
|
181 |
|
|
'TOGGLE' => $group['group_id'],
|
182 |
|
|
'DISABLED' => $flag_disabled,
|
183 |
|
|
'LINK_COLOR' => $flag_color,
|
184 |
|
|
'CURSOR' => $flag_cursor,
|
185 |
|
|
'NAME' => $group['name'],
|
186 |
|
|
'CHECKED' => $flag_checked
|
187 |
|
|
)
|
188 |
|
|
);
|
189 |
|
|
if(is_numeric(array_search($group['group_id'], $admin_groups))) {
|
190 |
|
|
$template->set_var('CHECKED', ' checked="checked"');
|
191 |
|
|
} else {
|
192 |
|
|
if (!$flag_checked) $template->set_var('CHECKED', '');
|
193 |
|
|
}
|
194 |
|
|
$template->parse('group_list', 'group_list_block', true);
|
195 |
|
|
}
|
196 |
|
|
}
|
197 |
|
|
// 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 |
|
|
$result = $database->query($sql);
|
475 |
|
|
|
476 |
|
|
if($result->numRows() > 0)
|
477 |
|
|
{
|
478 |
|
|
while($addon = $result->fetchRow())
|
479 |
|
|
{
|
480 |
|
|
// Check if the user has perms to use this template
|
481 |
|
|
if($addon['directory'] == $results_array['template'] OR $admin->get_permission($addon['directory'], 'template') == true)
|
482 |
|
|
{
|
483 |
|
|
$template->set_var('VALUE', $addon['directory']);
|
484 |
|
|
$template->set_var('NAME', $addon['name']);
|
485 |
|
|
if($addon['directory'] == $results_array['template'])
|
486 |
|
|
{
|
487 |
|
|
$template->set_var('SELECTED', ' selected="selected"');
|
488 |
|
|
} else {
|
489 |
|
|
$template->set_var('SELECTED', '');
|
490 |
|
|
}
|
491 |
|
|
$template->parse('template_list', 'template_list_block', true);
|
492 |
|
|
}
|
493 |
|
|
}
|
494 |
|
|
}
|
495 |
|
|
|
496 |
|
|
// Menu list
|
497 |
|
|
if(MULTIPLE_MENUS == false)
|
498 |
|
|
{
|
499 |
|
|
$template->set_var('DISPLAY_MENU_LIST', 'display:none;');
|
500 |
|
|
}
|
501 |
|
|
// Include template info file (if it exists)
|
502 |
|
|
if($results_array['template'] != '')
|
503 |
|
|
{
|
504 |
|
|
$template_location = WB_PATH.'/templates/'.$results_array['template'].'/info.php';
|
505 |
|
|
} else {
|
506 |
|
|
$template_location = WB_PATH.'/templates/'.DEFAULT_TEMPLATE.'/info.php';
|
507 |
|
|
}
|
508 |
|
|
if(file_exists($template_location))
|
509 |
|
|
{
|
510 |
|
|
require($template_location);
|
511 |
|
|
}
|
512 |
|
|
// Check if $menu is set
|
513 |
|
|
if(!isset($menu[1]) OR $menu[1] == '')
|
514 |
|
|
{
|
515 |
|
|
// Make our own menu list
|
516 |
|
|
$menu[1] = $TEXT['MAIN'];
|
517 |
|
|
}
|
518 |
|
|
// Add menu options to the list
|
519 |
|
|
$template->set_block('main_block', 'menu_list_block', 'menu_list');
|
520 |
|
|
foreach($menu AS $number => $name)
|
521 |
|
|
{
|
522 |
|
|
$template->set_var('NAME', $name);
|
523 |
|
|
$template->set_var('VALUE', $number);
|
524 |
|
|
if($results_array['menu'] == $number)
|
525 |
|
|
{
|
526 |
|
|
$template->set_var('SELECTED', ' selected="selected"');
|
527 |
|
|
} else {
|
528 |
|
|
$template->set_var('SELECTED', '');
|
529 |
|
|
}
|
530 |
|
|
$template->parse('menu_list', 'menu_list_block', true);
|
531 |
|
|
}
|
532 |
|
|
|
533 |
|
|
// Insert language values
|
534 |
|
|
$template->set_block('main_block', 'language_list_block', 'language_list');
|
535 |
|
|
|
536 |
|
|
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'addons` WHERE `type` = "language" ORDER BY `name`';
|
537 |
|
|
$result = $database->query($sql);
|
538 |
|
|
|
539 |
|
|
if($result->numRows() > 0)
|
540 |
|
|
{
|
541 |
|
|
while($addon = $result->fetchRow())
|
542 |
|
|
{
|
543 |
|
|
$l_codes[$addon['name']] = $addon['directory'];
|
544 |
|
|
$l_names[$addon['name']] = entities_to_7bit($addon['name']); // sorting-problem workaround
|
545 |
|
|
}
|
546 |
|
|
asort($l_names);
|
547 |
|
|
foreach($l_names as $l_name=>$v)
|
548 |
|
|
{
|
549 |
|
|
// Insert code and name
|
550 |
|
|
$template->set_var(array(
|
551 |
|
|
'VALUE' => $l_codes[$l_name],
|
552 |
|
|
'NAME' => $l_name,
|
553 |
|
|
'FLAG_LANG_ICONS' => 'url('.THEME_URL.'/images/flags/'.strtolower($l_codes[$l_name]).'.png)',
|
554 |
|
|
));
|
555 |
|
|
// Check if it is selected
|
556 |
|
|
if($results_array['language'] == $l_codes[$l_name])
|
557 |
|
|
{
|
558 |
|
|
$template->set_var('SELECTED', ' selected="selected"');
|
559 |
|
|
} else {
|
560 |
|
|
$template->set_var('SELECTED', '');
|
561 |
|
|
}
|
562 |
|
|
$template->parse('language_list', 'language_list_block', true);
|
563 |
|
|
}
|
564 |
|
|
}
|
565 |
|
|
|
566 |
|
|
// Select disabled if searching is disabled
|
567 |
|
|
if($results_array['searching'] == 0)
|
568 |
|
|
{
|
569 |
|
|
$template->set_var('SEARCHING_DISABLED', ' selected="selected"');
|
570 |
|
|
}
|
571 |
|
|
// Select what the page target is
|
572 |
|
|
switch ($results_array['target'])
|
573 |
|
|
{
|
574 |
|
|
case '_top':
|
575 |
|
|
$template->set_var('TOP_SELECTED', ' selected="selected"');
|
576 |
|
|
break;
|
577 |
|
|
case '_self':
|
578 |
|
|
$template->set_var('SELF_SELECTED', ' selected="selected"');
|
579 |
|
|
break;
|
580 |
|
|
case '_blank':
|
581 |
|
|
$template->set_var('BLANK_SELECTED', ' selected="selected"');
|
582 |
|
|
break;
|
583 |
|
|
}
|
584 |
|
|
|
585 |
|
|
// Insert language text
|
586 |
|
|
$template->set_var(array(
|
587 |
|
|
'HEADING_MODIFY_PAGE_SETTINGS' => $HEADING['MODIFY_PAGE_SETTINGS'],
|
588 |
|
|
'TEXT_CURRENT_PAGE' => $TEXT['CURRENT_PAGE'],
|
589 |
|
|
'TEXT_MODIFY' => $TEXT['MODIFY'],
|
590 |
|
|
'TEXT_MODIFY_PAGE' => $HEADING['MODIFY_PAGE'],
|
591 |
|
|
'LAST_MODIFIED' => $MESSAGE['PAGES']['LAST_MODIFIED'],
|
592 |
|
|
'TEXT_PAGE_TITLE' => $TEXT['PAGE_TITLE'],
|
593 |
|
|
'TEXT_MENU_TITLE' => $TEXT['MENU_TITLE'],
|
594 |
|
|
'TEXT_TYPE' => $TEXT['TYPE'],
|
595 |
|
|
'TEXT_MENU' => $TEXT['MENU'],
|
596 |
|
|
'TEXT_PARENT' => $TEXT['PARENT'],
|
597 |
|
|
'TEXT_VISIBILITY' => $TEXT['VISIBILITY'],
|
598 |
|
|
'TEXT_PUBLIC' => $TEXT['PUBLIC'],
|
599 |
|
|
'TEXT_PRIVATE' => $TEXT['PRIVATE'],
|
600 |
|
|
'TEXT_REGISTERED' => $TEXT['REGISTERED'],
|
601 |
|
|
'TEXT_NONE' => $TEXT['NONE'],
|
602 |
|
|
'TEXT_HIDDEN' => $TEXT['HIDDEN'],
|
603 |
|
|
'TEXT_TEMPLATE' => $TEXT['TEMPLATE'],
|
604 |
|
|
'TEXT_TARGET' => $TEXT['TARGET'],
|
605 |
|
|
'TEXT_SYSTEM_DEFAULT' => $TEXT['SYSTEM_DEFAULT'],
|
606 |
|
|
'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
|
607 |
|
|
'TEXT_NEW_WINDOW' => $TEXT['NEW_WINDOW'],
|
608 |
|
|
'TEXT_SAME_WINDOW' => $TEXT['SAME_WINDOW'],
|
609 |
|
|
'TEXT_TOP_FRAME' => $TEXT['TOP_FRAME'],
|
610 |
|
|
'TEXT_ADMINISTRATORS' => $TEXT['ADMINISTRATORS'],
|
611 |
|
|
'TEXT_ALLOWED_VIEWERS' => $TEXT['ALLOWED_VIEWERS'],
|
612 |
|
|
'TEXT_DESCRIPTION' => $TEXT['DESCRIPTION'],
|
613 |
|
|
'TEXT_KEYWORDS' => $TEXT['KEYWORDS'],
|
614 |
|
|
'TEXT_SEARCHING' => $TEXT['SEARCHING'],
|
615 |
|
|
'TEXT_LANGUAGE' => $TEXT['LANGUAGE'],
|
616 |
|
|
'TEXT_ENABLED' => $TEXT['ENABLED'],
|
617 |
|
|
'TEXT_DISABLED' => $TEXT['DISABLED'],
|
618 |
|
|
'TEXT_SAVE' => $TEXT['SAVE'],
|
619 |
|
|
'TEXT_RESET' => $TEXT['RESET'],
|
620 |
|
|
'LAST_MODIFIED' => $MESSAGE['PAGES']['LAST_MODIFIED'],
|
621 |
|
|
'HEADING_MODIFY_PAGE' => $HEADING['MODIFY_PAGE']
|
622 |
|
|
) );
|
623 |
|
|
|
624 |
|
|
$template->parse('main', 'main_block', false);
|
625 |
|
|
$template->pparse('output', 'page');
|
626 |
|
|
|
627 |
|
|
// Print admin footer
|
628 |
|
|
$admin->print_footer();
|
629 |
|
|
|
630 |
1009
|
Ruebenwurz
|
?>
|