1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
// error_reporting(E_ALL); ini_set('display_errors',1); |
4
|
|
|
|
5
|
|
|
require_once __DIR__ . '/vendor/autoload.php'; |
6
|
|
|
require_once __DIR__ . '/config.php'; |
7
|
|
|
include_once __DIR__ . '/config.secrets.php'; |
8
|
|
|
require_once __DIR__ . '/index-functions.php'; |
9
|
|
|
|
10
|
|
|
use CILogon\Service\Util; |
11
|
|
|
use CILogon\Service\Content; |
12
|
|
|
use CILogon\Service\ShibError; |
13
|
|
|
use CILogon\Service\Loggit; |
14
|
|
|
|
15
|
|
|
Util::startPHPSession(); |
16
|
|
|
|
17
|
|
|
// Util::startTiming(); |
18
|
|
|
// Util::$timeit->printTime('MAIN Program START...'); |
19
|
|
|
|
20
|
|
|
// Check for a Shibboleth error and handle it |
21
|
|
|
$shiberror = new ShibError(); |
22
|
|
|
|
23
|
|
|
// Check the csrf cookie against either a hidden <form> element or a |
24
|
|
|
// PHP session variable, and get the value of the 'submit' element. |
25
|
|
|
// Note: replace CR/LF with space for 'Show/Hide Help' buttons. |
26
|
|
|
$retchars = array("\r\n","\n","\r"); |
27
|
|
|
$submit = str_replace( |
28
|
|
|
$retchars, |
29
|
|
|
" ", |
30
|
|
|
Util::getCsrf()->verifyCookieAndGetSubmit() |
31
|
|
|
); |
32
|
|
|
Util::unsetSessionVar('submit'); |
33
|
|
|
Util::unsetSessionVar('storeattributes'); // Used only by /testidp/ |
34
|
|
|
|
35
|
|
|
$log = new Loggit(); |
36
|
|
|
$log->info('submit="' . $submit . '"'); |
37
|
|
|
|
38
|
|
|
// Depending on the value of the clicked 'submit' button or the |
39
|
|
|
// equivalent PHP session variable, take action or print out HTML. |
40
|
|
|
switch ($submit) { |
41
|
|
|
case 'Log On': // Check for OpenID or InCommon usage. |
42
|
|
|
case 'Continue': // For OOI |
43
|
|
|
Content::handleLogOnButtonClicked(); |
44
|
|
|
break; // End case 'Log On' |
45
|
|
|
|
46
|
|
|
case 'Log Off': // Click the 'Log Off' button |
47
|
|
|
printLogonPage(true); |
|
|
|
|
48
|
|
|
break; // End case 'Log Off' |
49
|
|
|
|
50
|
|
|
case 'gotuser': // Return from the getuser script |
51
|
|
|
Content::handleGotUser(); |
52
|
|
|
break; // End case 'gotuser' |
53
|
|
|
|
54
|
|
|
case 'Go Back': // Return to the Main page |
55
|
|
|
case 'Proceed': // Proceed after Error page |
56
|
|
|
Util::verifySessionAndCall('printMainPage'); |
57
|
|
|
break; // End case 'Go Back' / 'Proceed' |
58
|
|
|
|
59
|
|
|
case 'Cancel': // Cancel button on WAYF page - go to CILogon Info Page |
60
|
|
|
header('Location: https://www.cilogon.org'); |
61
|
|
|
exit; // No further processing necessary |
62
|
|
|
break; |
63
|
|
|
|
64
|
|
|
case 'Get New Certificate': |
65
|
|
|
if (Util::verifySessionAndCall('CILogon\\Service\\Content::generateP12')) { |
66
|
|
|
printMainPage(); |
67
|
|
|
} |
68
|
|
|
break; // End case 'Get New Certificate' |
69
|
|
|
|
70
|
|
|
default: // No submit button clicked nor PHP session submit variable set |
71
|
|
|
Content::handleNoSubmitButtonClicked(); |
72
|
|
|
break; // End default case |
73
|
|
|
} // End switch($submit) |
74
|
|
|
|
75
|
|
|
// Util::$timeit->printTime('MAIN Program END... '); |
76
|
|
|
|
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.