-
Notifications
You must be signed in to change notification settings - Fork 70
/
login-app.php
154 lines (133 loc) · 5.25 KB
/
login-app.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
<?php
require_once 'includes/translate.php';
require_once 'includes/classes/WebCalendar.php';
$WebCalendar = new WebCalendar( __FILE__ );
require_once 'includes/config.php';
require_once 'includes/dbi4php.php';
require_once 'includes/formvars.php';
require_once 'includes/functions.php';
$WebCalendar->initializeFirstPhase();
require_once "includes/$user_inc";
require_once 'includes/access.php';
require_once 'includes/gradient.php';
$WebCalendar->initializeSecondPhase();
load_global_settings();
load_user_preferences ( 'guest' );
$WebCalendar->setLanguage();
// Look for action=logout.
$action = getGetValue ( 'action' );
$logout = false;
if ( ! empty ( $action ) && $action == 'logout' ) {
$logout = true;
$return_path = '';
sendCookie ( 'webcalendar_last_view', '', 0 );
sendCookie ( 'webcalendar_login', '', 0 );
} else
if ( empty ( $return_path ) ) {
// See if a return path was set.
$return_path = get_last_view();
if ( ! empty ( $return_path ) )
sendCookie ( 'webcalendar_last_view', '', 0 );
}
$appStr = generate_application_name();
// Set return page.
$login_return_path = $SERVER_URL . $return_path;
echo send_doctype ( $appStr ) . ( ! $logout ? '
<script>
// Error check login/password.
function valid_form ( form ) {
if ( form.login.value.length == 0 || form.password.value.length == 0 ) {
alert ( \''
. translate ( 'You must enter a login and password.', true ) . '\' );
return false;
}
return true;
}
function myOnLoad() {
document.login_form.login.focus();' . ( empty ( $login ) ? '' : '
document.login_form.login.select();' ) . ( empty ( $error ) ? '' : '
alert ( \'' . $error . '\' );' ) . '
}
</script>' : '' ) . '
<link href="css_cacher.php?login=__public__" rel="stylesheet">
<link href="includes/css/styles.css" rel="stylesheet">'
// Print custom header (since we do not call print_header function).
. ( ! empty ( $CUSTOM_SCRIPT ) && $CUSTOM_SCRIPT == 'Y'
? load_template ( $login, 'S' ) : '' ) . '
</head>
<body onload="myOnLoad();">'
// Print custom header (since we do not call print_header function).
. ( ! empty ( $CUSTOM_HEADER ) && $CUSTOM_HEADER == 'Y'
? load_template ( $login, 'H' ) : '' ) . '
<h2>' . $appStr . '</h2>' . ( empty ( $error ) ? '' : '
<span style="color:#F00;" class="bold">' . translate ( 'Error' )
. ": $error" . '</span>' ) . '<br>
<form name="login_form" id="login" action="' . $app_login_page['action']
. '" method="post" onsubmit="return valid_form( this )">
<input type="hidden" name="' . $app_login_page['return'] . '" value="'
. $login_return_path . '">
<table cellpadding="10" class="aligncenter">
<tr>
<td rowspan="2"><img src="images/bootstrap-icons/key-fill.svg" alt="Login"></td>
<td class="alignright"><label for="user">' . translate ( 'Username' )
. ':</label></td>
<td><input name="' . $app_login_page['username']
. '" id="user" size="15" maxlength="25" tabindex="1"></td>
</tr>
<tr>
<td class"alignright"><label for="password">'
. translate ( 'Password' ) . ':</label></td>
<td><input name="' . $app_login_page['password']
. '" id="password" type="password" size="15" maxlength="30" tabindex="2"></td>
</tr>' . ( ! empty ( $app_login_page['remember'] ) ? '
<tr>
<td colspan="3" style="font-size: 10px;">
<input type="checkbox" name="' . $app_login_page['remember']
. '" id="remember" tabindex="3" value="yes" '
. ( ! empty ( $remember ) && $remember == 'yes' ? 'checked' : '' )
. '>
<label for="remember"> '
. translate ( 'Save login via cookies so I dont have to login next time.' )
. '</label>
</td>
</tr>' : '' ) . '
<tr>
<td colspan="4" class="aligncenter">';
if ( ! empty ( $app_login_page['hidden'] ) ) {
foreach ( $app_login_page['hidden'] as $key => $val ) {
echo '
<input type="hidden" name="' . $key . '" value="' . $val . '">';
}
}
echo '
<button name="' . $app_login_page['submit']
. '" tabindex="4" type="submit">' . translate ( 'Login' ) . '</button>
</td>
</tr>
</table>
</form>' . ( ! empty ( $PUBLIC_ACCESS ) && $PUBLIC_ACCESS == 'Y'
? '<br><br>
<a class="nav" href="index.php">' . str_replace ( 'XXX',
translate ( 'public' ), translate ( 'Access XXX calendar' ) )
. '</a><br>' : '' );
$nulist = get_nonuser_cals();
for ( $i = 0, $cnt = count ( $nulist ); $i < $cnt; $i++ ) {
if ( $nulist[$i]['cal_is_public'] == 'Y' )
echo '
<a class="nav" href="nulogin.php?login=' . $nulist[$i]['cal_login'] . '">'
. str_replace ( 'XXX', $nulist[$i]['cal_fullname'],
translate ( 'Access XXX calendar' ) ) . '</a><br>';
}
echo ( $DEMO_MODE == 'Y'
// This is used on the SourceForge demo page.
? 'Demo login: user = "demo", password = "demo"<br>' : '' ) . '<br><br>
<span class="cookies">' . translate ( 'cookies-note' ) . '</span><br>
<hr>
<br><br>
<a href="' . $PROGRAM_URL . '" id="programname">' . $PROGRAM_NAME . '</a>'
// Print custom trailer (since we do not call print_trailer function).
. ( ! empty ( $CUSTOM_TRAILER ) && $CUSTOM_TRAILER == 'Y'
? load_template ( $login, 'T' ) : '' );
?>
</body>
</html>