Revision 543
Added by thorn almost 17 years ago
class.wb.php | ||
---|---|---|
45 | 45 |
// performed when frontend or backend is loaded. |
46 | 46 |
function wb() { |
47 | 47 |
} |
48 |
|
|
49 |
// Check whether a page is visible or not. |
|
50 |
// This will check page-visibility and user- and group-rights. |
|
51 |
/* page_is_visible() returns |
|
52 |
false: if page-visibility is 'none' or 'deleted', or page-vis. is 'registered' or 'private' and user isn't allowed to see the page. |
|
53 |
true: if page-visibility is 'public' or 'hidden', or page-vis. is 'registered' or 'private' and user _is_ allowed to see the page. |
|
54 |
*/ |
|
55 |
function page_is_visible($page) { |
|
56 |
$show_it = false; // shall we show the page? |
|
57 |
$page_id = $page['page_id']; |
|
58 |
$visibility = $page['visibility']; |
|
59 |
$viewing_groups = $page['viewing_groups']; |
|
60 |
$viewing_users = $page['viewing_users']; |
|
61 |
// First check if visibility is 'none', 'deleted' |
|
62 |
if($visibility == 'none') { |
|
63 |
return(false); |
|
64 |
} elseif($visibility == 'deleted') { |
|
65 |
return(false); |
|
66 |
} |
|
67 |
// Now check if visibility is 'hidden', 'private' or 'registered' |
|
68 |
if($visibility == 'hidden') { // hidden: hide the menu-link, but show the page |
|
69 |
$show_it = true; |
|
70 |
} elseif($visibility == 'private' || $visibility == 'registered') { |
|
71 |
// Check if the user is logged in |
|
72 |
if($this->is_authenticated() == true) { |
|
73 |
// Now check if the user has perms to view the page |
|
74 |
if(in_array($this->get_group_id(), explode(',', $viewing_groups)) || in_array($this->get_user_id(), explode(',', $viewing_users))) { |
|
75 |
$show_it = true; |
|
76 |
} else { |
|
77 |
$show_it = false; |
|
78 |
} |
|
79 |
} else { |
|
80 |
$show_it = false; |
|
81 |
} |
|
82 |
} elseif($visibility == 'public') { |
|
83 |
$show_it = true; |
|
84 |
} else { |
|
85 |
$show_it = false; |
|
86 |
} |
|
87 |
return($show_it); |
|
88 |
} |
|
48 | 89 |
|
49 | 90 |
// Check whether we should show a page or not (for front-end) |
50 | 91 |
function show_page($page) { |
... | ... | |
276 | 317 |
} |
277 | 318 |
|
278 | 319 |
} |
279 |
?> |
|
320 |
?> |
Also available in: Unified diff
module menu_link: fixed page-deleteing-bug and some odd behavior, added table mod_menu_link