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