Revision 473
Added by Matthias over 17 years ago
class.frontend.php | ||
---|---|---|
239 | 239 |
} elseif(SEARCH == 'private' AND $this->is_authenticated() == true) { |
240 | 240 |
define('SHOW_SEARCH', true); |
241 | 241 |
} elseif(SEARCH == 'registered' AND $this->is_authenticated() == true) { |
242 |
define('SHOW_SEARCH', true);
|
|
242 |
define('SHOW_SEARCH', true); |
|
243 | 243 |
} else { |
244 | 244 |
define('SHOW_SEARCH', false); |
245 | 245 |
} |
... | ... | |
323 | 323 |
return; |
324 | 324 |
} |
325 | 325 |
} |
326 |
if ($this->menu_recurse==0)
|
|
326 |
if ($this->menu_recurse==0)
|
|
327 | 327 |
return; |
328 |
// Check if we should add menu number check to query |
|
329 |
if($this->menu_parent == 0) { |
|
330 |
$menu_number = "menu = '$this->menu_number'"; |
|
331 |
} else { |
|
332 |
$menu_number = '1'; |
|
333 |
} |
|
334 |
// Query pages |
|
335 |
$query_menu = $database->query("SELECT page_id,menu_title,page_title,link,target,level,visibility FROM ". |
|
336 |
TABLE_PREFIX."pages WHERE parent = '$this->menu_parent' AND $menu_number AND $this->extra_where_sql ORDER BY position ASC"); |
|
337 |
// Check if there are any pages to show |
|
338 |
if($query_menu->numRows() > 0) { |
|
339 |
// Print menu header |
|
340 |
echo "\n".$this->menu_header; |
|
341 |
// Loop through pages |
|
342 |
while($page = $query_menu->fetchRow()) { |
|
343 |
// Check if this page should be shown |
|
344 |
// Create vars |
|
345 |
$vars = array('[class]','[a]', '[/a]', '[menu_title]', '[page_title]'); |
|
346 |
// Work-out class |
|
347 |
if($page['page_id'] == PAGE_ID) { |
|
348 |
$class = $this->menu_current_class; |
|
349 |
} else { |
|
350 |
$class = $this->menu_default_class; |
|
351 |
} |
|
352 |
// Check if link is same as first page link, and if so change to WB URL |
|
353 |
if($page['link'] == $this->default_link AND !INTRO_PAGE) { |
|
354 |
$link = WB_URL; |
|
355 |
} else { |
|
356 |
$link = $this->page_link($page['link']); |
|
357 |
} |
|
358 |
// Create values |
|
359 |
$values = array($class,'<a href="'.$link.'" target="'.$page['target'].'" '.$class.'>', '</a>', $page['menu_title'], $page['page_title']); |
|
360 |
// Replace vars with value and print |
|
361 |
echo "\n".str_replace($vars, $values, $this->menu_item_template); |
|
362 |
// Generate sub-menu |
|
363 |
if($this->menu_collapse==false OR ($this->menu_collapse==true AND isset($this->page_trail[$page['page_id']]))) { |
|
364 |
$this->menu_recurse--; |
|
365 |
$this->menu_parent=$page['page_id']; |
|
366 |
$this->show_menu(); |
|
367 |
} |
|
368 |
echo "\n".$this->menu_item_footer; |
|
369 |
} |
|
370 |
// Print menu footer |
|
371 |
echo "\n".$this->menu_footer; |
|
372 |
} |
|
328 |
// Check if we should add menu number check to query |
|
329 |
if($this->menu_parent == 0) { |
|
330 |
$menu_number = "menu = '$this->menu_number'"; |
|
331 |
} else { |
|
332 |
$menu_number = '1'; |
|
333 |
} |
|
334 |
// Query pages |
|
335 |
$query_menu = $database->query("SELECT page_id,menu_title,page_title,link,target,level,visibility,viewing_groups,viewing_users FROM ".TABLE_PREFIX."pages WHERE parent = '$this->menu_parent' AND $menu_number AND $this->extra_where_sql ORDER BY position ASC"); |
|
336 |
// Check if there are any pages to show |
|
337 |
if($query_menu->numRows() > 0) { |
|
338 |
// Print menu header |
|
339 |
echo "\n".$this->menu_header; |
|
340 |
// Loop through pages |
|
341 |
while($page = $query_menu->fetchRow()) { |
|
342 |
// Check if this page should be shown |
|
343 |
// $this->extra_where_sql will show menu-title from private pages only if user is authenticated, |
|
344 |
// but we have to check if user is in viewing_groups or viewing_users for this page |
|
345 |
if($page['visibility'] == 'private') { |
|
346 |
$viewing_groups = explode(',', $page['viewing_groups']); |
|
347 |
$viewing_users = explode(',', $page['viewing_users']); |
|
348 |
if(!in_array($this->get_group_id(), $viewing_groups) && (!in_array($this->get_user_id(), $viewing_users))) { |
|
349 |
continue; |
|
350 |
} |
|
351 |
} |
|
352 |
// Create vars |
|
353 |
$vars = array('[class]','[a]', '[/a]', '[menu_title]', '[page_title]'); |
|
354 |
// Work-out class |
|
355 |
if($page['page_id'] == PAGE_ID) { |
|
356 |
$class = $this->menu_current_class; |
|
357 |
} else { |
|
358 |
$class = $this->menu_default_class; |
|
359 |
} |
|
360 |
// Check if link is same as first page link, and if so change to WB URL |
|
361 |
if($page['link'] == $this->default_link AND !INTRO_PAGE) { |
|
362 |
$link = WB_URL; |
|
363 |
} else { |
|
364 |
$link = $this->page_link($page['link']); |
|
365 |
} |
|
366 |
// Create values |
|
367 |
$values = array($class,'<a href="'.$link.'" target="'.$page['target'].'" '.$class.'>', '</a>', $page['menu_title'], $page['page_title']); |
|
368 |
// Replace vars with value and print |
|
369 |
echo "\n".str_replace($vars, $values, $this->menu_item_template); |
|
370 |
// Generate sub-menu |
|
371 |
if($this->menu_collapse==false OR ($this->menu_collapse==true AND isset($this->page_trail[$page['page_id']]))) { |
|
372 |
$this->menu_recurse--; |
|
373 |
$this->menu_parent=$page['page_id']; |
|
374 |
$this->show_menu(); |
|
375 |
} |
|
376 |
echo "\n".$this->menu_item_footer; |
|
377 |
} |
|
378 |
// Print menu footer |
|
379 |
echo "\n".$this->menu_footer; |
|
380 |
} |
|
373 | 381 |
} |
374 | 382 |
|
375 | 383 |
|
Also available in: Unified diff
Added changeset [472] also to the branches