Revision 1187
Added by Dietmar almost 15 years ago
settings.php | ||
---|---|---|
46 | 46 |
$old_admin_groups = explode(',', $results_array['admin_groups']); |
47 | 47 |
$old_admin_users = explode(',', $results_array['admin_users']); |
48 | 48 |
|
49 |
// Work-out if we should check for existing page_code |
|
50 |
$field_sql = $database->query("DESCRIBE ".TABLE_PREFIX."pages page_code"); |
|
51 |
$field_set = $field_sql->numRows(); |
|
49 | 52 |
$in_old_group = FALSE; |
50 | 53 |
foreach($admin->get_groups_id() as $cur_gid){ |
51 | 54 |
if (in_array($cur_gid, $old_admin_groups)) { |
... | ... | |
254 | 257 |
$template->set_var('DISPLAY_VIEWERS', 'none'); |
255 | 258 |
} |
256 | 259 |
|
260 |
//-- insert page_code 20090904--> |
|
261 |
$template->set_var('DISPLAY_CODE_PAGE_LIST', ' id="multi_lingual" style="display:none;"'); |
|
262 |
// Work-out if page languages feature is enabled |
|
263 |
if((defined('PAGE_LANGUAGES') && PAGE_LANGUAGES) && $field_set) |
|
264 |
{ |
|
265 |
$template->set_var( array( |
|
266 |
'DISPLAY_CODE_PAGE_LIST' => ' id="multi_lingual"', |
|
267 |
'TEXT_PAGE_CODE' => '<a href="'.WB_URL.'/modules/mod_multilingual/update_keys.php?page_id='.$page_id.'">'.$TEXT['PAGE_CODE'].'</a>' |
|
268 |
|
|
269 |
) |
|
270 |
); |
|
271 |
|
|
272 |
|
|
273 |
// Page_code list |
|
274 |
$database = new database(); |
|
275 |
function page_code_list($parent) { |
|
276 |
global $admin, $database, $template, $results_array, $pageCode; |
|
277 |
$default_language = DEFAULT_LANGUAGE; |
|
278 |
$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' AND language = '$default_language' ORDER BY position ASC"; |
|
279 |
$get_pages = $database->query($query); |
|
280 |
while($page = $get_pages->fetchRow()) { |
|
281 |
if($admin->page_is_visible($page)==false) |
|
282 |
continue; |
|
283 |
$template->set_var('FLAG_CODE_ICON',' none '); |
|
284 |
if( $page['parent'] == 0 ) { |
|
285 |
$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 |
if($page['level']+1 < PAGE_LEVEL_LIMIT) { |
|
291 |
// Get user perms |
|
292 |
$admin_groups = explode(',', str_replace('_', '', $page['admin_groups'])); |
|
293 |
$admin_users = explode(',', str_replace('_', '', $page['admin_users'])); |
|
294 |
|
|
295 |
$in_group = FALSE; |
|
296 |
foreach($admin->get_groups_id() as $cur_gid){ |
|
297 |
if (in_array($cur_gid, $admin_groups)) |
|
298 |
{ |
|
299 |
$in_group = TRUE; |
|
300 |
} |
|
301 |
} |
|
302 |
|
|
303 |
if(($in_group) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) { |
|
304 |
$can_modify = true; |
|
305 |
} else { |
|
306 |
$can_modify = false; |
|
307 |
} |
|
308 |
// Title -'s prefix |
|
309 |
$title_prefix = ''; |
|
310 |
for($i = 1; $i <= $page['level']; $i++) { $title_prefix .= ' - - '; } |
|
311 |
$template->set_var(array( |
|
312 |
'VALUE' => $page['page_code'], |
|
313 |
'PAGE_CODE' => ($title_prefix.$page['menu_title']) |
|
314 |
) |
|
315 |
); |
|
316 |
if($results_array['page_code'] == $page['page_code']) { |
|
317 |
$template->set_var('SELECTED', ' selected="selected"'); |
|
318 |
} elseif($results_array['page_code'] == $page['page_code']) { |
|
319 |
$template->set_var('SELECTED', ' disabled="disabled" class="disabled"'); |
|
320 |
$list_next_level=false; |
|
321 |
} elseif($can_modify != true) { |
|
322 |
$template->set_var('SELECTED', ' disabled="disabled" class="disabled"'); |
|
323 |
} else { |
|
324 |
$template->set_var('SELECTED', ''); |
|
325 |
} |
|
326 |
$template->parse('page_code_list', 'page_code_list_block', true); |
|
327 |
} |
|
328 |
if ($list_next_level) |
|
329 |
page_code_list($page['page_id']); |
|
330 |
} |
|
331 |
} |
|
332 |
// Insert code_page values from page to modify |
|
333 |
$template->set_block('main_block', 'page_code_list_block', 'page_code_list'); |
|
334 |
if($admin->get_permission('pages_add_l0') == true OR $results_array['level'] == 0) { |
|
335 |
if($results_array['parent'] == 0) { $selected = ' selected'; } else { $selected = ''; } |
|
336 |
$template->set_var(array( |
|
337 |
'VALUE' => '', |
|
338 |
'PAGE_CODE' => $TEXT['NONE'], |
|
339 |
'SELECTED' => $selected |
|
340 |
) |
|
341 |
); |
|
342 |
$template->parse('page_code_list', 'page_code_list_block', true); |
|
343 |
} |
|
344 |
// get pagecode form this page_id |
|
345 |
page_code_list(0); |
|
346 |
} |
|
347 |
//-- page code --> |
|
348 |
|
|
257 | 349 |
// Parent page list |
258 | 350 |
$database = new database(); |
259 | 351 |
function parent_list($parent) { |
260 |
global $admin, $database, $template, $results_array; |
|
352 |
global $admin, $database, $template, $results_array,$field_set;
|
|
261 | 353 |
$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' ORDER BY position ASC"; |
262 | 354 |
$get_pages = $database->query($query); |
263 | 355 |
while($page = $get_pages->fetchRow()) { |
264 | 356 |
if($admin->page_is_visible($page)==false) |
265 | 357 |
continue; |
266 |
// if psrent = 0 set flag_icon
|
|
358 |
// if parent = 0 set flag_icon
|
|
267 | 359 |
$template->set_var('FLAG_ROOT_ICON',' none '); |
268 |
if( $page['parent'] == 0 ) { |
|
360 |
if( $page['parent'] == 0 && $field_set) {
|
|
269 | 361 |
$template->set_var('FLAG_ROOT_ICON','url('.THEME_URL.'/images/flags/'.strtolower($page['language']).'.png)'); |
270 | 362 |
} |
271 | 363 |
// If the current page cannot be parent, then its children neither |
... | ... | |
291 | 383 |
for($i = 1; $i <= $page['level']; $i++) { $title_prefix .= ' - '; } |
292 | 384 |
$template->set_var(array( |
293 | 385 |
'ID' => $page['page_id'], |
294 |
'TITLE' => ($title_prefix.$page['page_title']), |
|
386 |
'TITLE' => ($title_prefix.$page['menu_title']), |
|
387 |
'MENU-TITLE' => ($title_prefix.$page['menu_title']), |
|
388 |
'PAGE-TITLE' => ($title_prefix.$page['page_title']), |
|
295 | 389 |
'FLAG_ICON' => 'none', |
296 | 390 |
)); |
297 | 391 |
|
Also available in: Unified diff
change page_title to menu_title for parent dropdown list in index.php and sections.php