1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
// error_reporting(E_ALL); ini_set('display_errors',1); |
4
|
|
|
|
5
|
|
|
require_once __DIR__ . '/vendor/autoload.php'; |
6
|
|
|
|
7
|
|
|
use CILogon\Service\Util; |
8
|
|
|
use CILogon\Service\Content; |
9
|
|
|
use CILogon\Service\ShibError; |
10
|
|
|
use CILogon\Service\Loggit; |
11
|
|
|
|
12
|
|
|
Util::startPHPSession(); |
13
|
|
|
|
14
|
|
|
// Util::startTiming(); |
15
|
|
|
// Util::$timeit->printTime('MAIN Program START...'); |
16
|
|
|
|
17
|
|
|
// Check for a Shibboleth error and handle it |
18
|
|
|
$shiberror = new ShibError(); |
19
|
|
|
|
20
|
|
|
// Check the csrf cookie against either a hidden <form> element or a |
21
|
|
|
// PHP session variable, and get the value of the 'submit' element. |
22
|
|
|
// Note: replace CR/LF with space for 'Show/Hide Help' buttons. |
23
|
|
|
$retchars = array("\r\n","\n","\r"); |
24
|
|
|
$submit = str_replace( |
25
|
|
|
$retchars, |
26
|
|
|
" ", |
27
|
|
|
Util::getCsrf()->verifyCookieAndGetSubmit() |
28
|
|
|
); |
29
|
|
|
Util::unsetSessionVar('submit'); |
30
|
|
|
|
31
|
|
|
$log = new Loggit(); |
32
|
|
|
$log->info('submit="' . $submit . '"'); |
33
|
|
|
|
34
|
|
|
// Depending on the value of the clicked 'submit' button or the |
35
|
|
|
// equivalent PHP session variable, take action or print out HTML. |
36
|
|
|
switch ($submit) { |
37
|
|
|
case 'Log On': // Check for OpenID or InCommon usage. |
38
|
|
|
case 'Continue': // For OOI |
39
|
|
|
Content::handleLogOnButtonClicked(); |
40
|
|
|
break; // End case 'Log On' |
41
|
|
|
|
42
|
|
|
case 'Log Off': // Click the 'Log Off' button |
43
|
|
|
printLogonPage(true); |
|
|
|
|
44
|
|
|
break; // End case 'Log Off' |
45
|
|
|
|
46
|
|
|
case 'gotuser': // Return from the getuser script |
47
|
|
|
Content::handleGotUser(); |
48
|
|
|
break; // End case 'gotuser' |
49
|
|
|
|
50
|
|
|
case 'Go Back': // Return to the Main page |
51
|
|
|
case 'Proceed': // Proceed after 'User Changed' or Error page |
52
|
|
|
case 'Done with Two-Factor': |
53
|
|
|
Util::verifySessionAndCall('printMainPage'); |
|
|
|
|
54
|
|
|
break; // End case 'Go Back' / 'Proceed' |
55
|
|
|
|
56
|
|
|
case 'Cancel': // Cancel button on WAYF page - go to Google |
57
|
|
|
header('Location: https://www.google.com/'); |
58
|
|
|
exit; // No further processing necessary |
59
|
|
|
break; |
60
|
|
|
|
61
|
|
|
case 'Get New Certificate': |
62
|
|
|
if (Util::verifySessionAndCall( |
63
|
|
|
'CILogon\\Service\\Content::generateP12' |
|
|
|
|
64
|
|
|
)) { |
65
|
|
|
printMainPage(); |
66
|
|
|
} |
67
|
|
|
break; // End case 'Get New Certificate' |
68
|
|
|
|
69
|
|
|
case 'Manage Two-Factor': |
70
|
|
|
Util::verifySessionAndCall( |
71
|
|
|
'CILogon\\Service\\Content::printTwoFactorPage' |
|
|
|
|
72
|
|
|
); |
73
|
|
|
break; // End case 'Manage Two-Factor' |
74
|
|
|
|
75
|
|
|
case 'Enable': // Enable / Disable two-factor authentication |
76
|
|
|
case 'Disable': |
77
|
|
|
case 'Verify': // Log in with Google Authenticator |
78
|
|
|
case 'Disable Two-Factor': |
79
|
|
|
$enable = !preg_match('/^Disable/', $submit); |
80
|
|
|
Util::verifySessionAndCall( |
81
|
|
|
'CILogon\\Service\\Content::handleEnableDisableTwoFactor', |
|
|
|
|
82
|
|
|
array($enable) |
83
|
|
|
); |
84
|
|
|
break; // End case 'Enable' / 'Disable' |
85
|
|
|
|
86
|
|
|
case 'I Lost My Phone': |
87
|
|
|
Util::verifySessionAndCall( |
88
|
|
|
'CILogon\\Service\\Content::handleILostMyPhone' |
|
|
|
|
89
|
|
|
); |
90
|
|
|
break; // End case 'I Lost My Phone' |
91
|
|
|
|
92
|
|
|
case 'Enter': // Verify Google Authenticator one time password |
93
|
|
|
Util::verifySessionAndCall( |
94
|
|
|
'CILogon\\Service\\Content::handleGoogleAuthenticatorLogin' |
|
|
|
|
95
|
|
|
); |
96
|
|
|
break; // End case 'Enter' |
97
|
|
|
|
98
|
|
|
case 'EnterDuo': // Verify Duo Security login |
99
|
|
|
Util::verifySessionAndCall( |
100
|
|
|
'CILogon\\Service\\Content::handleDuoSecurityLogin' |
|
|
|
|
101
|
|
|
); |
102
|
|
|
break; // End case 'EnterDuo' |
103
|
|
|
|
104
|
|
|
case 'Show Help ': // Toggle showing of help text on and off |
105
|
|
|
case 'Hide Help ': |
106
|
|
|
Content::handleHelpButtonClicked(); |
107
|
|
|
break; // End case 'Show Help' / 'Hide Help' |
108
|
|
|
|
109
|
|
|
default: // No submit button clicked nor PHP session submit variable set |
110
|
|
|
Content::handleNoSubmitButtonClicked(); |
111
|
|
|
break; // End default case |
112
|
|
|
} // End switch($submit) |
113
|
|
|
|
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* printLogonPage |
117
|
|
|
* |
118
|
|
|
* This function prints out the HTML for the main cilogon.org page. |
119
|
|
|
* Explanatory text is shown as well as a button to log in to an IdP |
120
|
|
|
* and get rerouted to the Shibboleth protected service script, or the |
121
|
|
|
* OpenID script. |
122
|
|
|
* |
123
|
|
|
* @param bool $clearcookies True if the Shibboleth cookies and session |
124
|
|
|
* variables should be cleared out before displaying the page. |
125
|
|
|
* Defaults to false. |
126
|
|
|
*/ |
127
|
|
|
function printLogonPage($clearcookies = false) |
|
|
|
|
128
|
|
|
{ |
129
|
|
|
if ($clearcookies) { |
130
|
|
|
Util::removeShibCookies(); |
131
|
|
|
Util::unsetAllUserSessionVars(); |
132
|
|
|
Util::getSkin()->init(true); // Clear cilogon_skin var; check for forced skin |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
$log = new Loggit(); |
136
|
|
|
$log->info('Welcome page hit.'); |
137
|
|
|
|
138
|
|
|
Util::setSessionVar('stage', 'logon'); // For Show/Hide Help button clicks |
139
|
|
|
|
140
|
|
|
Content::printHeader('Welcome To The CILogon Service'); |
141
|
|
|
|
142
|
|
|
echo ' |
143
|
|
|
<div class="boxed"> |
144
|
|
|
'; |
145
|
|
|
|
146
|
|
|
Content::printHelpButton(); |
147
|
|
|
Content::printWAYF(); |
148
|
|
|
|
149
|
|
|
echo ' |
150
|
|
|
</div> <!-- End boxed --> |
151
|
|
|
'; |
152
|
|
|
Content::printFooter(); |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* printMainPage |
157
|
|
|
* |
158
|
|
|
* This function prints out the HTML for the main page where the user |
159
|
|
|
* can download a certificate. |
160
|
|
|
*/ |
161
|
|
|
function printMainPage() |
|
|
|
|
162
|
|
|
{ |
163
|
|
|
$log = new Loggit(); |
164
|
|
|
$log->info('Get And Use Certificate page hit.'); |
165
|
|
|
|
166
|
|
|
Util::setSessionVar('stage', 'main'); // For Show/Hide Help button clicks |
167
|
|
|
|
168
|
|
|
Content::printHeader('Get Your Certificate'); |
169
|
|
|
|
170
|
|
|
echo ' |
171
|
|
|
<div class="boxed"> |
172
|
|
|
'; |
173
|
|
|
|
174
|
|
|
Content::printHelpButton(); |
175
|
|
|
printCertInfo(); |
176
|
|
|
printGetCertificate(); |
177
|
|
|
Content::printTwoFactorBox(); |
178
|
|
|
printLogOff(); |
179
|
|
|
|
180
|
|
|
echo ' |
181
|
|
|
</div> <!-- boxed --> |
182
|
|
|
'; |
183
|
|
|
Content::printFooter(); |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
/** |
187
|
|
|
* printCertInfo |
188
|
|
|
* |
189
|
|
|
* This function prints the certificate information table at the top |
190
|
|
|
* of the main page. |
191
|
|
|
*/ |
192
|
|
|
function printCertInfo() |
193
|
|
|
{ |
194
|
|
|
$dn = Util::getSessionVar('dn'); |
195
|
|
|
$dn = Content::reformatDN(preg_replace('/\s+email=.+$/', '', $dn)); |
196
|
|
|
|
197
|
|
|
echo ' |
198
|
|
|
<table class="certinfo"> |
199
|
|
|
<tr> |
200
|
|
|
<th>Certificate Subject:</th> |
201
|
|
|
<td>' , Util::htmlent($dn) , '</td> |
202
|
|
|
</tr> |
203
|
|
|
<tr> |
204
|
|
|
<th>Identity Provider:</th> |
205
|
|
|
<td>' , Util::getSessionVar('idpname') , '</td> |
206
|
|
|
</tr> |
207
|
|
|
<tr> |
208
|
|
|
<th><a target="_blank" |
209
|
|
|
href="http://ca.cilogon.org/loa">Level of Assurance:</a></th> |
210
|
|
|
<td> |
211
|
|
|
'; |
212
|
|
|
|
213
|
|
|
$loa = Util::getSessionVar('loa'); |
214
|
|
|
if ($loa == 'openid') { |
215
|
|
|
echo '<a href="http://ca.cilogon.org/policy/openid" |
216
|
|
|
target="_blank">OpenID</a>'; |
217
|
|
|
} elseif ($loa == 'http://incommonfederation.org/assurance/silver') { |
218
|
|
|
echo '<a href="http://ca.cilogon.org/policy/silver" |
219
|
|
|
target="_blank">Silver</a>'; |
220
|
|
|
} else { |
221
|
|
|
echo '<a href="http://ca.cilogon.org/policy/basic" |
222
|
|
|
target="_blank">Basic</a>'; |
223
|
|
|
} |
224
|
|
|
echo ' |
225
|
|
|
</td> |
226
|
|
|
</tr> |
227
|
|
|
</table> |
228
|
|
|
'; |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
/** |
232
|
|
|
* printGetCertificate |
233
|
|
|
* |
234
|
|
|
* This function prints the 'Get New Certificate' box on the main page. |
235
|
|
|
* If the 'p12' PHP session variable is valid, it is read and a link for the |
236
|
|
|
* usercred.p12 file is presented to the user. |
237
|
|
|
*/ |
238
|
|
|
function printGetCertificate() |
239
|
|
|
{ |
240
|
|
|
// Check if PKCS12 downloading is disabled. If so, print out message. |
241
|
|
|
$skin = Util::getSkin(); |
242
|
|
|
$disabled = $skin->getConfigOption('pkcs12', 'disabled'); |
243
|
|
|
if ((!is_null($disabled)) && ((int)$disabled == 1)) { |
244
|
|
|
$disabledmsg = $skin->getConfigOption( |
245
|
|
|
'pkcs12', |
246
|
|
|
'disabledmessage' |
247
|
|
|
); |
248
|
|
|
if (!is_null($disabledmsg)) { |
249
|
|
|
$disabledmsg = trim(html_entity_decode($disabledmsg)); |
250
|
|
|
} |
251
|
|
|
if (strlen($disabledmsg) == 0) { |
252
|
|
|
$disabledmsg = "Downloading PKCS12 certificates is " . |
253
|
|
|
"restricted. Please try another method or log on " . |
254
|
|
|
"with a different Identity Provider."; |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
echo '<div class="p12actionbox"><p> |
258
|
|
|
', $disabledmsg , ' |
259
|
|
|
</p></div> <!-- p12actionbox -->'; |
260
|
|
|
} else { // PKCS12 downloading is okay |
261
|
|
|
$downloadcerttext = "Clicking this button will generate a link " . |
262
|
|
|
"to a new certificate, which you can download to your local " . |
263
|
|
|
"computer. The certificate is valid for up to 13 months."; |
264
|
|
|
$p12linktext = "Left-click this link to import the certificate " . |
265
|
|
|
"into your broswer / operating system. (Firefox users see " . |
266
|
|
|
"the FAQ.) Right-click this link and select 'Save As...' to " . |
267
|
|
|
"save the certificate to your desktop."; |
268
|
|
|
$passwordtext1 = 'Enter a password of at least 12 characters to " . |
269
|
|
|
"protect your certificate.'; |
270
|
|
|
$passwordtext2 = 'Re-enter your password to verify.'; |
271
|
|
|
|
272
|
|
|
validateP12(); |
273
|
|
|
$p12expire = ''; |
274
|
|
|
$p12link = ''; |
275
|
|
|
$p12 = Util::getSessionVar('p12'); |
276
|
|
|
if (preg_match('/([^\s]*)\s(.*)/', $p12, $match)) { |
277
|
|
|
$p12expire = $match[1]; |
278
|
|
|
$p12link = $match[2]; |
279
|
|
|
} |
280
|
|
|
|
281
|
|
|
if ((strlen($p12link) > 0) && (strlen($p12expire) > 0)) { |
282
|
|
|
$p12link = '<a href="' . $p12link . |
283
|
|
|
'">» Click Here To Download Your Certificate «</a>'; |
284
|
|
|
} |
285
|
|
|
if ((strlen($p12expire) > 0) && ($p12expire > 0)) { |
286
|
|
|
$expire = $p12expire - time(); |
287
|
|
|
$minutes = floor($expire % 3600 / 60); |
288
|
|
|
$seconds = $expire % 60; |
289
|
|
|
$p12expire = 'Link Expires: ' . |
290
|
|
|
sprintf("%02dm:%02ds", $minutes, $seconds); |
291
|
|
|
} else { |
292
|
|
|
$p12expire = ''; |
293
|
|
|
} |
294
|
|
|
|
295
|
|
|
$p12lifetime = Util::getSessionVar('p12lifetime'); |
296
|
|
|
if ((strlen($p12lifetime) == 0) || ($p12lifetime == 0)) { |
297
|
|
|
$p12lifetime = Util::getCookieVar('p12lifetime'); |
298
|
|
|
} |
299
|
|
|
$p12multiplier = Util::getSessionVar('p12multiplier'); |
300
|
|
|
if ((strlen($p12multiplier) == 0) || ($p12multiplier == 0)) { |
301
|
|
|
$p12multiplier = Util::getCookieVar('p12multiplier'); |
302
|
|
|
} |
303
|
|
|
|
304
|
|
|
// Try to read the skin's intiallifetime if not yet set |
305
|
|
|
if ((strlen($p12lifetime) == 0) || ($p12lifetime <= 0)) { |
306
|
|
|
// See if the skin specified an initial value |
307
|
|
|
$skinlife = $skin->getConfigOption('pkcs12', 'initiallifetime', 'number'); |
308
|
|
|
$skinmult = $skin->getConfigOption('pkcs12', 'initiallifetime', 'multiplier'); |
309
|
|
|
if ((!is_null($skinlife)) && (!is_null($skinmult)) && |
310
|
|
|
((int)$skinlife > 0) && ((int)$skinmult > 0)) { |
311
|
|
|
$p12lifetime = (int)$skinlife; |
312
|
|
|
$p12multiplier = (int)$skinmult; |
313
|
|
|
} else { |
314
|
|
|
$p12lifetime = 13; // Default to 13 months |
315
|
|
|
$p12multiplier = 732; |
316
|
|
|
} |
317
|
|
|
} |
318
|
|
|
if ((strlen($p12multiplier) == 0) || ($p12multiplier <= 0)) { |
319
|
|
|
$p12multiplier = 732; // Default to months |
320
|
|
|
if ($p12lifetime > 13) { |
321
|
|
|
$p12lifetime = 13; |
322
|
|
|
} |
323
|
|
|
} |
324
|
|
|
|
325
|
|
|
// Make sure lifetime is within [minlifetime,maxlifetime] |
326
|
|
|
list($minlifetime, $maxlifetime) = |
327
|
|
|
Content::getMinMaxLifetimes('pkcs12', 9516); |
328
|
|
|
if (($p12lifetime * $p12multiplier) < $minlifetime) { |
329
|
|
|
$p12lifetime = $minlifetime; |
330
|
|
|
$p12multiplier = 1; // In hours |
331
|
|
|
} elseif (($p12lifetime * $p12multiplier) > $maxlifetime) { |
332
|
|
|
$p12lifetime = $maxlifetime; |
333
|
|
|
$p12multiplier = 1; // In hours |
334
|
|
|
} |
335
|
|
|
|
336
|
|
|
$lifetimetext = "Specify the certificate lifetime. Acceptable range " . |
337
|
|
|
"is between $minlifetime and $maxlifetime hours" . |
338
|
|
|
(($maxlifetime > 732) ? |
339
|
|
|
" ( = " . round(($maxlifetime / 732), 2) . " months)." : |
340
|
|
|
"." |
341
|
|
|
); |
342
|
|
|
|
343
|
|
|
echo ' |
344
|
|
|
<div class="p12actionbox"'; |
345
|
|
|
|
346
|
|
|
if (Util::getSessionVar('showhelp') == 'on') { |
347
|
|
|
echo ' style="width:92%;"'; |
348
|
|
|
} |
349
|
|
|
|
350
|
|
|
echo '> |
351
|
|
|
<table class="helptable"> |
352
|
|
|
<tr> |
353
|
|
|
<td class="actioncell"> |
354
|
|
|
'; |
355
|
|
|
|
356
|
|
|
Content::printFormHead(); |
357
|
|
|
|
358
|
|
|
echo ' |
359
|
|
|
<fieldset> |
360
|
|
|
'; |
361
|
|
|
|
362
|
|
|
$p12error = Util::getSessionVar('p12error'); |
363
|
|
|
if (strlen($p12error) > 0) { |
364
|
|
|
echo "<p class=\"logonerror\">$p12error</p>"; |
365
|
|
|
Util::unsetSessionVar('p12error'); |
366
|
|
|
} |
367
|
|
|
|
368
|
|
|
echo ' |
369
|
|
|
<p> |
370
|
|
|
Password Protect Your New Certificate: |
371
|
|
|
</p> |
372
|
|
|
|
373
|
|
|
<p> |
374
|
|
|
<label for="password1" class="helpcursor" title="' , |
375
|
|
|
$passwordtext1 , '">Enter A Password:</label> |
376
|
|
|
<input type="password" name="password1" id="password1" |
377
|
|
|
size="22" title="' , $passwordtext1 , '" onkeyup="checkPassword()"/> |
378
|
|
|
<img src="/images/blankIcon.png" width="14" height="14" alt="" |
379
|
|
|
id="pw1icon"/> |
380
|
|
|
</p> |
381
|
|
|
|
382
|
|
|
<p> |
383
|
|
|
<label for="password2" class="helpcursor" title="' , |
384
|
|
|
$passwordtext2 , '">Confirm Password:</label> |
385
|
|
|
<input type="password" name="password2" id="password2" |
386
|
|
|
size="22" title="' , $passwordtext2 , '" onkeyup="checkPassword()"/> |
387
|
|
|
<img src="/images/blankIcon.png" width="14" height="14" alt="" |
388
|
|
|
id="pw2icon"/> |
389
|
|
|
</p> |
390
|
|
|
|
391
|
|
|
<p class="p12certificatelifetime"> |
392
|
|
|
<label for="p12lifetime" title="' , $lifetimetext , |
393
|
|
|
'" class="helpcursor">Certificate Lifetime:</label> |
394
|
|
|
<input type="text" name="p12lifetime" id="p12lifetime" |
395
|
|
|
title="', $lifetimetext , |
396
|
|
|
'" class="helpcursor" value="' , $p12lifetime , |
397
|
|
|
'" size="8" maxlength="8"/> |
398
|
|
|
<select title="' , $lifetimetext , |
399
|
|
|
'" class="helpcursor" id="p12multiplier" name="p12multiplier"> |
400
|
|
|
<option value="1"' , |
401
|
|
|
(($p12multiplier == 1) ? ' selected="selected"' : '') , |
402
|
|
|
'>hours</option> |
403
|
|
|
<option value="24"' , |
404
|
|
|
(($p12multiplier == 24) ? ' selected="selected"' : '') , |
405
|
|
|
'>days</option> |
406
|
|
|
<option value="732"' , |
407
|
|
|
(($p12multiplier == 732) ? ' selected="selected"' : '') , |
408
|
|
|
'>months</option> |
409
|
|
|
</select> |
410
|
|
|
<img src="/images/blankIcon.png" width="14" height="14" alt=""/> |
411
|
|
|
</p> |
412
|
|
|
|
413
|
|
|
<p> |
414
|
|
|
<input type="submit" name="submit" class="submit helpcursor" |
415
|
|
|
title="' , $downloadcerttext , '" value="Get New Certificate" |
416
|
|
|
onclick="showHourglass(\'p12\')"/> |
417
|
|
|
<img src="/images/hourglass.gif" width="32" height="32" alt="" |
418
|
|
|
class="hourglass" id="p12hourglass"/> |
419
|
|
|
</p> |
420
|
|
|
|
421
|
|
|
<p id="p12value" class="helpcursor" title="' , |
422
|
|
|
$p12linktext , '">' , $p12link , '</p> |
423
|
|
|
<p id="p12expire">' , $p12expire , '</p> |
424
|
|
|
|
425
|
|
|
</fieldset> |
426
|
|
|
</form> |
427
|
|
|
</td> |
428
|
|
|
'; |
429
|
|
|
|
430
|
|
|
if (Util::getSessionVar('showhelp') == 'on') { |
431
|
|
|
echo ' |
432
|
|
|
<td class="helpcell"> |
433
|
|
|
<div> |
434
|
|
|
<p> |
435
|
|
|
In order to get a new certificate, please enter a password of at |
436
|
|
|
least 12 characters in length. This password protects the private |
437
|
|
|
key of the certificate and is different from your identity provider |
438
|
|
|
password. You must enter the password twice for verification. |
439
|
|
|
</p> |
440
|
|
|
<p> |
441
|
|
|
After entering a password, click the "Get New Certificate" button to |
442
|
|
|
generate a new link. Right-click on this link to download the |
443
|
|
|
certificate to your computer. The certificate is valid for up to 13 |
444
|
|
|
months. |
445
|
|
|
</p> |
446
|
|
|
</div> |
447
|
|
|
</td> |
448
|
|
|
'; |
449
|
|
|
} |
450
|
|
|
|
451
|
|
|
echo ' |
452
|
|
|
</tr> |
453
|
|
|
</table> |
454
|
|
|
</div> <!-- p12actionbox --> |
455
|
|
|
'; |
456
|
|
|
} |
457
|
|
|
} |
458
|
|
|
|
459
|
|
|
/** |
460
|
|
|
* printLogOff |
461
|
|
|
* |
462
|
|
|
* This function prints the Log Off boxes at the bottom of the main page. |
463
|
|
|
*/ |
464
|
|
|
function printLogOff() |
465
|
|
|
{ |
466
|
|
|
$logofftext = 'End your CILogon session and return to the welcome page. ' . |
467
|
|
|
'Note that this will not log you out at ' . |
468
|
|
|
Util::getSessionVar('idpname') . '.'; |
469
|
|
|
|
470
|
|
|
$showhelp = Util::getSessionVar('showhelp'); |
471
|
|
|
|
472
|
|
|
echo ' |
473
|
|
|
<div class="logoffactionbox"'; |
474
|
|
|
|
475
|
|
|
if ($showhelp == 'on') { |
476
|
|
|
echo ' style="width:92%;"'; |
477
|
|
|
} |
478
|
|
|
|
479
|
|
|
echo '> |
480
|
|
|
<table class="helptable"> |
481
|
|
|
<tr> |
482
|
|
|
<td class="actioncell"> |
483
|
|
|
'; |
484
|
|
|
|
485
|
|
|
Content::printFormHead(); |
486
|
|
|
|
487
|
|
|
echo ' |
488
|
|
|
<p> |
489
|
|
|
<input type="submit" name="submit" class="submit helpcursor" |
490
|
|
|
title="' , $logofftext , '" value="Log Off" /> |
491
|
|
|
</p> |
492
|
|
|
</form> |
493
|
|
|
</td> |
494
|
|
|
'; |
495
|
|
|
|
496
|
|
|
if ($showhelp == 'on') { |
497
|
|
|
echo ' |
498
|
|
|
<td class="helpcell"> |
499
|
|
|
<div> |
500
|
|
|
<p> |
501
|
|
|
This button will log you off of the CILogon Service. In order to log |
502
|
|
|
out from your identity provider, you must either quit your browser |
503
|
|
|
or manually clear your browser\'s cookies. |
504
|
|
|
</p> |
505
|
|
|
</div> |
506
|
|
|
</td> |
507
|
|
|
'; |
508
|
|
|
} |
509
|
|
|
|
510
|
|
|
echo ' |
511
|
|
|
</tr> |
512
|
|
|
</table> |
513
|
|
|
</div> <!-- logoffactionbox --> |
514
|
|
|
|
515
|
|
|
<div class="logofftextbox"'; |
516
|
|
|
|
517
|
|
|
if ($showhelp == 'on') { |
518
|
|
|
echo ' style="width:92%;"'; |
519
|
|
|
} |
520
|
|
|
|
521
|
|
|
echo '> |
522
|
|
|
<table class="helptable"> |
523
|
|
|
<tr> |
524
|
|
|
<td class="actioncell"> |
525
|
|
|
<p>To log off, please quit your browser.<p> |
526
|
|
|
</td> |
527
|
|
|
'; |
528
|
|
|
|
529
|
|
|
if ($showhelp == 'on') { |
530
|
|
|
echo ' |
531
|
|
|
<td class="helpcell"> |
532
|
|
|
<div> |
533
|
|
|
<p> |
534
|
|
|
Quitting your browser clears all session cookies which logs you out |
535
|
|
|
from your identity provider. Alternatively, you can manually clear |
536
|
|
|
your browser\'s cookies. |
537
|
|
|
</p> |
538
|
|
|
</div> |
539
|
|
|
</td> |
540
|
|
|
'; |
541
|
|
|
} |
542
|
|
|
|
543
|
|
|
echo ' |
544
|
|
|
</tr> |
545
|
|
|
</table> |
546
|
|
|
</div> <!-- logofftextbox --> |
547
|
|
|
'; |
548
|
|
|
} |
549
|
|
|
|
550
|
|
|
/** |
551
|
|
|
* validateP12 |
552
|
|
|
* |
553
|
|
|
* This function is called just before the 'Download your certificate' |
554
|
|
|
* link is printed out to HTML. It checks to see if the p12 is still |
555
|
|
|
* valid time-wise. If not, then it unsets the PHP session variable |
556
|
|
|
* 'p12'. |
557
|
|
|
*/ |
558
|
|
|
function validateP12() |
559
|
|
|
{ |
560
|
|
|
$p12link = ''; |
561
|
|
|
$p12expire = ''; |
562
|
|
|
$p12 = Util::getSessionVar('p12'); |
563
|
|
|
if (preg_match('/([^\s]*)\s(.*)/', $p12, $match)) { |
564
|
|
|
$p12expire = $match[1]; |
565
|
|
|
$p12link = $match[2]; |
566
|
|
|
} |
567
|
|
|
|
568
|
|
|
// Verify that the p12expire and p12link values are valid. |
569
|
|
|
if ((strlen($p12expire) == 0) || |
570
|
|
|
($p12expire == 0) || |
571
|
|
|
(time() > $p12expire) || |
572
|
|
|
(strlen($p12link) == 0)) { |
573
|
|
|
Util::unsetSessionVar('p12'); |
574
|
|
|
} |
575
|
|
|
} |
576
|
|
|
|
577
|
|
|
// Util::$timeit->printTime('MAIN Program END... '); |
578
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.