Revision 552
Added by thorn almost 17 years ago
class.frontend.php | ||
---|---|---|
52 | 52 |
var $page_trail=array(); |
53 | 53 |
|
54 | 54 |
var $page_access_denied; |
55 |
var $page_no_active_sections; |
|
55 | 56 |
|
56 | 57 |
// website settings |
57 | 58 |
var $website_title,$website_description,$website_keywords,$website_header,$website_footer; |
... | ... | |
197 | 198 |
define('TEMPLATE_DIR', WB_URL.'/templates/'.TEMPLATE); |
198 | 199 |
|
199 | 200 |
// Check if user is allowed to view this page |
200 |
if(VISIBILITY == 'private' OR VISIBILITY == 'registered') { |
|
201 |
// Check if the user is authenticated |
|
202 |
if($this->is_authenticated() == false) { |
|
203 |
// User needs to login first |
|
204 |
header("Location: ".WB_URL."/account/login.php?redirect=".$this->link); |
|
205 |
exit(0); |
|
206 |
} |
|
207 |
// Check if we should show this page |
|
208 |
if($this->show_page($this->page) == false) { |
|
201 |
if($this->page && $this->page_is_visible($this->page) == false) { |
|
202 |
if(VISIBILITY == 'deleted' OR VISIBILITY == 'none') { |
|
203 |
// User isnt allowed on this page so tell them |
|
209 | 204 |
$this->page_access_denied=true; |
205 |
} elseif(VISIBILITY == 'private' OR VISIBILITY == 'registered') { |
|
206 |
// Check if the user is authenticated |
|
207 |
if($this->is_authenticated() == false) { |
|
208 |
// User needs to login first |
|
209 |
header("Location: ".WB_URL."/account/login".PAGE_EXTENSION.'?redirect='.$this->link); |
|
210 |
exit(0); |
|
211 |
} else { |
|
212 |
// User isnt allowed on this page so tell them |
|
213 |
$this->page_access_denied=true; |
|
214 |
} |
|
215 |
|
|
210 | 216 |
} |
211 |
} elseif(VISIBILITY == 'deleted' OR VISIBILITY == 'none') { |
|
212 |
// User isnt allowed on this page so tell them |
|
213 |
$this->page_access_denied=true; |
|
214 | 217 |
} |
218 |
// check if there is at least one active section |
|
219 |
if($this->page && $this->page_is_active($this->page) == false) { |
|
220 |
$this->page_no_active_sections=true; |
|
221 |
} |
|
215 | 222 |
} |
216 | 223 |
|
217 | 224 |
function get_website_settings() { |
... | ... | |
339 | 346 |
echo "\n".$this->menu_header; |
340 | 347 |
// Loop through pages |
341 | 348 |
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 |
|
|
349 |
$is_viewing_user = in_array($this->get_user_id(), $viewing_users); |
|
350 |
|
|
351 |
$access_granted = FALSE; |
|
352 |
foreach ($this->get_groups_id() as $group_id) { |
|
353 |
|
|
354 |
if(in_array($group_id, $viewing_groups) || ($is_viewing_user)) { |
|
355 |
$access_granted = TRUE; |
|
356 |
} |
|
357 |
} |
|
358 |
if (!$access_granted) { |
|
359 |
continue; |
|
360 |
} |
|
349 |
// check whether to show this menu-link |
|
350 |
if($this->page_is_active($page)==false && $page['link']!=$this->default_link && !INTRO_PAGE) { |
|
351 |
continue; // no active sections |
|
361 | 352 |
} |
353 |
if($this->page_is_visible($page)==false) |
|
354 |
continue; |
|
362 | 355 |
// Create vars |
363 | 356 |
$vars = array('[class]','[a]', '[/a]', '[menu_title]', '[page_title]'); |
364 | 357 |
// Work-out class |
... | ... | |
405 | 398 |
} |
406 | 399 |
} |
407 | 400 |
|
408 |
?> |
|
401 |
?> |
Also available in: Unified diff
added new module-based search-function and publish-by-date code