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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
|
<?php /** * login.php * * Displays and runs the login dialog * * @package TeamCalPro * @version 3.3.001 * @author George Lewe * @copyright Copyright (c) 2004-2010 by George Lewe * @link http://www.lewe.com * @license http://www.lewe.com/tcpro/doc/license.txt Extended GNU Public License */
//echo "<script type=\"text/javascript\">alert(\"Debug: \");</script>";
/** * Set parent flag to control access to child scripts */ define( '_VALID_TCPRO', 1 );
/** * Includes */ require ("config.tcpro.php"); require_once ("includes/functions.tcpro.php"); getOptions(); if (strlen($CONF['options']['lang'])) require ("includes/lang/" . $CONF['options']['lang'] . ".tcpro.php"); else require ("includes/lang/english.tcpro.php");
require_once ("includes/tcannouncement.class.php"); require_once ("includes/tcconfig.class.php"); require_once ("includes/tclogin.class.php"); require_once ("includes/tclog.class.php"); require_once ("includes/tcuser.class.php"); require_once ("includes/tcuseroption.class.php");
$AN = new tcAnnouncement; $C = new tcConfig; $L = new tcLogin; $LOG = new tcLog; $U = new tcUser; $UB = new tcUser; $UO = new tcUserOption; $errors = "";
if (isset ($_POST['btn_login'])) { $uname = $_POST['uname']; switch ($L->login()) { case 0 : /** * Successful login */ $errors = $LANG['login_error_0']; $LOG->log("logLogin", $uname, "Login successful"); if ($UO->true($uname,"notifybirthday")) { $bdayalarm = ''; $query = "SELECT * FROM `".$UB->table."` ORDER BY `lastname`,`firstname`;"; $result = $UB->db->db_query($query); while ( $row = $UB->db->db_fetch_array($result,MYSQL_ASSOC) ){ if ( $UO->true($row['username'],"showbirthday") ) { if($UO->true($row['username'],"ignoreage")) { $birthdate=date("d M",strtotime($row['birthday'])); if ($birthdate==date("d M")) { $bdayalarm.= $row['firstname']." ".$row['lastname'].": ".$birthdate ."<br>"; } } else { $birthdate=date("d M Y",strtotime($row['birthday'])); $dayofbirth=date("d M",strtotime($row['birthday'])); $age=intval(date("Y"))-intval(substr($row['birthday'],0,4)); if ($dayofbirth==date("d M")) { $bdayalarm.= $row['firstname']." ".$row['lastname'].": ".$birthdate ." (".$LANG['cal_age'].": ".$age.")<br>"; } } } } if (strlen($bdayalarm)) { $bdayalarm = "<strong>".$LANG['ann_bday_title'].date("d. F")."</strong><br><br>".$bdayalarm."<br> "; $tstamp = date("Ymd")."000000"; if ($AN->read($tstamp)) { $AN->unassign($tstamp,$uname); $AN->delete($tstamp); } $AN->save($tstamp,$bdayalarm,1,0); $AN->assign($tstamp,$uname); } if ( file_exists("installation.php") && $uname=="admin" ) { $tstamp = date("YmdHis"); $message = "<span style=\"background-color: #AA0000; color: #FFFFFF; font-weight: bold; padding: 4px;\">".$LANG['err_instfile_title']."</span><br><br>" . "<span style=\"color: #0000AA;\">".$LANG['err_instfile']."<br><br>". "[TeamCal Pro Installation]</span>"; $popup=1; $silent=0; $AN->save($tstamp,$message,$popup,$silent); $AN->assign($tstamp,$uname); } } jsCloseAndReload("index.php"); break; case 1 : /** * Username or password missing */ $errors = $LANG['login_error_1']; $LOG->log("logLogin", $uname, "Login: Username or password missing"); break; case 2 : /** * Username unknown */ $errors = $LANG['login_error_2']; $LOG->log("logLogin", $uname, "Login: Username unknown"); break; case 3 : /** * Account is locked */ $errors = $LANG['login_error_3']; $LOG->log("logLogin", $uname, "Login: Account locked"); break; case 4 : case 5 : /** * 4: Password incorrect 1st time * 5: Password incorrect 2nd or higher time */ $U->findByName($uname); $errors = $LANG['login_error_4a']; $errors .= strval($U->bad_logins); $errors .= $LANG['login_error_4b']; $errors .= $C->readConfig("badLogins"); $errors .= $LANG['login_error_4c']; $errors .= $C->readConfig("gracePeriod"); $errors .= $LANG['login_error_4d']; $LOG->log("logLogin", $uname, "Login: Password incorrect"); break; case 6 : /** * Login is locked due to too many bad login attempts */ $now = date("U"); $U->findByName($uname); $errors = $LANG['login_error_6a']; $errors .= strval(intval($C->readConfig("gracePeriod")) - ($now - $U->bad_logins_start)); $errors .= $LANG['login_error_6b']; $LOG->log("logLogin", $uname, "Login: Too many bad login attempts"); break; case 7 : /** * Password incorrect (no bad login count) */ $errors = $LANG['login_error_7']; $LOG->log("logLogin", $uname, "Login: Password incorrect"); break; case 8 : /** * Account not verified */ $errors = $LANG['login_error_8']; $LOG->log("logLogin", $uname, "Login: Account not verified"); break; case 91 : /** * LDAP error: password missing */ $errors = $LANG['login_error_91']; $LOG->log("logLogin", $uname, "Login: LDAP password missing"); break; case 92 : /** * LDAP error: bind failed */ $errors = $LANG['login_error_92']; $LOG->log("logLogin", $uname, "Login: LDAP bind failed"); break; case 93 : /** * LDAP error: Unable to connect */ $errors = $LANG['login_error_93']; $LOG->log("logLogin", $uname, "Login: LDAP unable to connect to server"); break; case 94 : /** * LDAP error: Start of TLS encryption failed */ $errors = $LANG['login_error_94']; $LOG->log("logLogin", $uname, "Login: LDAP start TLS failed"); break; case 95 : /** * LDAP error: Username not found */ $errors = $LANG['login_error_95']; $LOG->log("logLogin", $uname, "Login: LDAP username not found"); break; case 96 : /** * LDAP error: LDAP search bind failed */ $errors = $LANG['login_error_96']; $LOG->log("logLogin", $uname, "Login: LDAP search bind failed"); break; } }
require("includes/header.html.inc.php"); ?> <body> <form name="login" method="POST" action="<?=$_SERVER['PHP_SELF']."?lang=".$CONF['options']['lang']?>"> <table class="dlg"> <tr> <td class="dlg-header" colspan="3"> <?php printDialogTop($LANG['login_login'],"login.html","ico_login.png"); ?> </td> </tr> </table> <table class="dlg"> <tr> <td class="dlg-body"> <table class="dlg-frame"> <tr> <td class="dlg-body" rowspan="<?php if (strlen($errors)) echo "3"; else echo "2"; ?>"><img src="themes/<?=$theme?>/img/login.png" alt="Login" title="Login" border="0"></td> <td class="dlg-body" width="80"><strong><?=$LANG['login_username']?></strong></td> <td class="dlg-body"> <input name="uname" id="uname" size="30" type="text" class="text" value=""> </td> </tr> <tr> <td class="dlg-body" width="80"><strong><?=$LANG['login_password']?></strong></td> <td class="dlg-body"> <input name="pword" id="pword" size="30" type="password" class="text" value=""> </td> </tr> <?php if ( strlen($errors) ) { ?> <tr> <td class="dlg-body" colspan="3"> <div class="erraction"> <?php echo $errors; ?> </div> </td> </tr> <?php } ?> </table> </td> </tr> <tr> <td class="dlg-menu"> <input name="btn_login" type="submit" class="button" value="<?=$LANG['btn_login']?>" onmouseover="this.className='button-over';" onmouseout="this.className='button';"> <input name="btn_help" type="button" class="button" onclick="javascript:this.blur(); openPopup('help/<?=$CONF['options']['helplang']?>/html/index.html?login.html','help','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,titlebar=0,resizable=0,dependent=1,width=750,height=500');" value="<?=$LANG['btn_help']?>" onmouseover="this.className='button-over';" onmouseout="this.className='button';"> <input name="btn_close" type="button" class="button" onclick="javascript:window.close();" value="<?=$LANG['btn_close']?>" onmouseover="this.className='button-over';" onmouseout="this.className='button';"> </td> </tr> </table> </form> <br /> <?php require("includes/footer.html.inc.php"); ?>
|