forked from craigk5n/webcalendar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
36 lines (33 loc) · 1.37 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
require_once 'includes/init.php';
// If not yet logged in, you will be redirected to login.php before
// we get to this point (by init.php included above).
if ( ! empty ( $STARTVIEW ) ) {
$page = get_preferred_view();
if ( access_can_view_page ( $page ) )
send_to_preferred_view();
else {
// User's preferences need to be updated to their preferred view.
if ( access_can_access_function ( ACCESS_PREFERENCES ) )
do_redirect ( 'pref.php' );
// User does not have access to preferences...
// So, we need to pick another page.
if ( access_can_access_function ( ACCESS_WEEK ) )
do_redirect ( 'week.php' );
elseif ( access_can_access_function ( ACCESS_MONTH ) )
do_redirect ( 'month.php' );
elseif ( access_can_access_function ( ACCESS_DAY ) )
do_redirect ( 'day.php' );
elseif ( access_can_access_function ( ACCESS_YEAR ) )
do_redirect ( 'year.php' );
// At this point, this user cannot view the preferred view in their
// preferences (and they cannot update their preferences), and they cannot
// view any of the standard day/week/month/year pages. All that's left is a
// custom view that is either created by them or a global view.
if ( count ( $views ) > 0 )
do_redirect ( $views[0]['url'] );
// No views either? You gotta be kidding me! ;-)
}
} else
do_redirect ( 'month.php' );
?>