forked from craigk5n/webcalendar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
adminhome.php
179 lines (153 loc) · 5.07 KB
/
adminhome.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<?php
/**
* Page Description:
* Serves as the home page for administrative functions. It's useful when the
* top menu has been disabled in the System Settings.
* Input Parameters:
* None
* Security:
* Users will see different options available on this page.
*/
require_once 'includes/init.php';
define ( 'COLUMNS', 3 );
$accessEnabled = access_is_enabled();
$assistStr = translate ( 'Assistants' );
$prefStr = translate ( 'Preferences' );
$links = $names = [];
/* Disabled for now...will move to menu when working properly
if ( $is_admin && ! empty ( $SERVER_URL ) &&
access_can_access_function ( ACCESS_SYSTEM_SETTINGS ) ) {
$names[] = translate ( 'Control Panel' );
$links[] = 'controlpanel.php';
}
*/
if ( $is_nonuser_admin ) {
if ( ! $accessEnabled || access_can_access_function( ACCESS_PREFERENCES ) ) {
$names[] = $prefStr;
$links[] = 'pref.php?user=' . $user;
}
if ( $single_user != 'Y' ) {
if ( ! $accessEnabled || access_can_access_function( ACCESS_ASSISTANTS ) ) {
$names[] = $assistStr;
$links[] = 'assistant_edit.php?user=' . $user;
}
}
} else {
if ( ( $is_admin && ! $accessEnabled )
|| ( $accessEnabled
&& access_can_access_function( ACCESS_SYSTEM_SETTINGS ) ) ) {
$names[] = translate ( 'System Settings' );
$links[] = 'admin.php';
}
if ( ! $accessEnabled || access_can_access_function( ACCESS_PREFERENCES ) ) {
$names[] = $prefStr;
$links[] = 'pref.php';
}
$names[] = ( $is_admin ? translate ( 'Users' ) : translate ( 'Account' ) );
$links[] = 'user_mgmt.php';
if ($GROUPS_ENABLED == 'Y' && $is_admin) {
$names[] = translate ( 'Groups' );
$links[] = 'groups.php';
}
if ( $REMOTES_ENABLED == 'Y' && (( $is_admin && ! $accessEnabled )
|| ( $accessEnabled
&& access_can_access_function(ACCESS_IMPORT)))) {
$names[] = translate ( 'Remote Calendars' );
$links[] = 'remotecal_mgmt.php';
}
if ( $NONUSER_ENABLED == 'Y' && (( $is_admin && ! $accessEnabled )
|| ( $accessEnabled
&& access_can_access_function(ACCESS_USER_MANAGEMENT)))) {
$names[] = translate ( 'Resource Calendars' );
$links[] = 'resourcecal_mgmt.php';
}
if ( $accessEnabled
&& access_can_access_function( ACCESS_ACCESS_MANAGEMENT ) ) {
$names[] = translate ( 'User Access Control' );
$links[] = 'access.php';
}
if ( $single_user != 'Y' ) {
if ( ! $accessEnabled || access_can_access_function( ACCESS_ASSISTANTS ) ) {
$names[] = $assistStr;
$links[] = 'assistant_edit.php';
}
}
if ( $CATEGORIES_ENABLED == 'Y' ) {
if ( ! $accessEnabled
|| access_can_access_function( ACCESS_CATEGORY_MANAGEMENT ) ) {
$names[] = translate ( 'Categories' );
$links[] = 'category.php';
}
}
if ( ! $accessEnabled
|| access_can_access_function( ACCESS_VIEW_MANAGEMENT ) ) {
$names[] = translate ( 'Views' );
$links[] = 'views.php';
}
if ( ! $accessEnabled || access_can_access_function( ACCESS_LAYERS ) ) {
$names[] = translate ( 'Layers' );
$links[] = 'layers.php';
}
if ( $REPORTS_ENABLED == 'Y'
&& ( ! $accessEnabled || access_can_access_function( ACCESS_REPORT ) ) ) {
$names[] = translate ( 'Reports' );
$links[] = 'report.php';
}
if ( $is_admin ) {
$names[] = translate ( 'Delete Events' );
$links[] = 'purge.php';
}
/*
This Activity Log link shows ALL activity for ALL events, so you really need
to be an admin user for this. Enabling "Activity Log" in UAC just gives you
access to the log for your _own_ events or other events you have access to.
*/
if ( $is_admin
&& ( ! $accessEnabled
|| access_can_access_function( ACCESS_ACTIVITY_LOG ) ) ) {
$names[] = translate ( 'Activity Log' );
$links[] = 'activity_log.php';
$names[] = translate ( 'System Log' );
$links[] = 'activity_log.php?system=1';
}
if ( ( $is_admin || ! $accessEnabled )
|| ( $accessEnabled
&& access_can_access_function( ACCESS_SECURITY_AUDIT ) ) ) {
$names[] = translate ( 'Security Audit' );
$links[] = 'security_audit.php';
}
if ( $is_admin && ! empty ( $PUBLIC_ACCESS ) && $PUBLIC_ACCESS == 'Y' ) {
$names[] = translate ( 'Public Preferences' );
$links[] = 'pref.php?public=1';
}
if ( $is_admin && ! empty( $PUBLIC_ACCESS ) && $PUBLIC_ACCESS == 'Y'
&& $PUBLIC_ACCESS_CAN_ADD == 'Y'
&& $PUBLIC_ACCESS_ADD_NEEDS_APPROVAL == 'Y' ) {
$names[] = translate ( 'Unapproved Public Events' );
$links[] = 'list_unapproved.php?user=__public__';
}
}
$_SESSION['webcal_tmp_login'] = 'SheIsA1Fine!';
print_header();
echo '
<h2>' . translate( 'Administrative Tools' ) . '</h2>
<table>';
for ( $i = 0, $cnt = count( $names ); $i < $cnt; $i++ ) {
$empLink = empty( $links[$i] );
echo ( $i % COLUMNS == 0 ? '
<tr>' : '' ) . '
<td>' . ( $empLink ? '' : '<a href="' . $links[$i] . '">' )
. $names[$i] . ( $empLink ? '' : '</a>' ) . '</td>'
. ( $i % COLUMNS == COLUMNS - 1 ? '
</tr>' : '' );
}
while ( $i % COLUMNS != 0 ) {
echo '
<td> </td>';
$i++;
}
echo '
</tr>
</table>
' . print_trailer();
?>