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