@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | $this->possibleFailureReasons = $_SESSION["SUSPECTS"] ?? []; // if we know nothing, don't talk to anyone |
43 | 43 | $this->additionalFindings = $_SESSION["EVIDENCE"] ?? []; |
44 | 44 | |
45 | - $this->subjectPrefix = _("[eduroam Diagnostics]")." "; |
|
45 | + $this->subjectPrefix = _("[eduroam Diagnostics]") . " "; |
|
46 | 46 | $this->finalGreeting = "\n" |
47 | 47 | . _("(This service is in an early stage. We apologise if this is a false alert. If this is the case, please send an email report to [email protected], forwarding the entire message (including the 'SUSPECTS' and 'EVIDENCE' data at the end), and explain why this is a false positive.)") |
48 | 48 | . "\n" |
49 | - . _("Yours sincerely,"). "\n" |
|
49 | + . _("Yours sincerely,") . "\n" |
|
50 | 50 | . "\n" |
51 | 51 | . _("The eduroam diagnostics algorithms"); |
52 | 52 | |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | "bcc" => [], |
58 | 58 | "reply-to" => [Logopath::EDUROAM_OT], |
59 | 59 | "subject" => _("[POLICYVIOLATION NATIONAL] IdP with no entry in eduroam database"), |
60 | - "body" => _("Dear NRO administrator,")."\n" |
|
60 | + "body" => _("Dear NRO administrator,") . "\n" |
|
61 | 61 | . "\n" |
62 | - . wordwrap(sprintf(_("an end-user requested diagnostics for realm %s. Real-time connectivity checks determined that the realm exists, but we were unable to find an IdP with that realm in the eduroam database."), "foo.bar")) ."\n" |
|
62 | + . wordwrap(sprintf(_("an end-user requested diagnostics for realm %s. Real-time connectivity checks determined that the realm exists, but we were unable to find an IdP with that realm in the eduroam database."), "foo.bar")) . "\n" |
|
63 | 63 | . "\n" |
64 | - . _("By not listing IdPs in the eduroam database, you are violating the eduroam policy.")."\n" |
|
64 | + . _("By not listing IdPs in the eduroam database, you are violating the eduroam policy.") . "\n" |
|
65 | 65 | . "\n" |
66 | - . _("Additionally, this creates operational issues. In particular, we are unable to direct end users to their IdP for further diagnosis/instructions because there are no contact points for that IdP in the database."). "\n" |
|
66 | + . _("Additionally, this creates operational issues. In particular, we are unable to direct end users to their IdP for further diagnosis/instructions because there are no contact points for that IdP in the database.") . "\n" |
|
67 | 67 | . "\n" |
68 | 68 | . "Please stop the policy violation ASAP by listing the IdP which is associated to this realm.", |
69 | 69 | ], |
@@ -10,7 +10,7 @@ |
||
10 | 10 | */ |
11 | 11 | require_once(dirname(dirname(__DIR__)) . "/config/_config.php"); |
12 | 12 | $realm = filter_input(INPUT_GET, 'realm', FILTER_SANITIZE_STRING); |
13 | -$visited = filter_input(INPUT_GET,'visited', FILTER_SANITIZE_STRING); |
|
13 | +$visited = filter_input(INPUT_GET, 'visited', FILTER_SANITIZE_STRING); |
|
14 | 14 | if (session_status != PHP_SESSION_ACTIVE) { |
15 | 15 | session_start(); |
16 | 16 | } |
@@ -16,11 +16,11 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @package Developer |
18 | 18 | */ |
19 | -function check_my_nonce($nonce, $optSalt='') { |
|
19 | +function check_my_nonce($nonce, $optSalt = '') { |
|
20 | 20 | $remote = filter_input(INPUT_SERVER, 'REMOTE_ADDR'); |
21 | - $lasthour = date("G")-1<0 ? date('Ymd').'23' : date("YmdG")-1; |
|
22 | - if (hash_hmac('sha256', session_id().$optSalt, date("YmdG").'1qaz2wsx3edc!QAZ@WSX#EDC'.$remote) == $nonce || |
|
23 | - hash_hmac('sha256', session_id().$optSalt, $lasthour.'1qaz2wsx3edc!QAZ@WSX#EDC'.$remote) == $nonce) { |
|
21 | + $lasthour = date("G") - 1 < 0 ? date('Ymd') . '23' : date("YmdG") - 1; |
|
22 | + if (hash_hmac('sha256', session_id() . $optSalt, date("YmdG") . '1qaz2wsx3edc!QAZ@WSX#EDC' . $remote) == $nonce || |
|
23 | + hash_hmac('sha256', session_id() . $optSalt, $lasthour . '1qaz2wsx3edc!QAZ@WSX#EDC' . $remote) == $nonce) { |
|
24 | 24 | return true; |
25 | 25 | } else { |
26 | 26 | return false; |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | foreach ($details['admins'] as $admin) { |
53 | 53 | $admins[] = $admin['email']; |
54 | 54 | } |
55 | - $details['admins'] = base64_encode(join(',',$admins)); |
|
55 | + $details['admins'] = base64_encode(join(',', $admins)); |
|
56 | 56 | } else { |
57 | 57 | $details['admins'] = ''; |
58 | 58 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $details = $cat->getExternalDBEntityDetails($realmOu); |
87 | 87 | if (!empty($details)) { |
88 | 88 | $returnArray['status'] = 1; |
89 | - $returnArray['realms'] = explode(',',$details['realmlist']); |
|
89 | + $returnArray['realms'] = explode(',', $details['realmlist']); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | } |
@@ -56,34 +56,34 @@ |
||
56 | 56 | // let's start the numbering at 1 |
57 | 57 | $this->qaArray = [ |
58 | 58 | 1 => ["AREA" => AbstractTest::INFRA_DEVICE, |
59 | - "TXT" => _("Have you ever used the network succesfully, e.g. at your home institution without roaming?"), |
|
60 | - "FACTOR" => 0.5, |
|
61 | - "VERDICTLECTURE" => sprintf(_("If your device has never worked before with this setup, then very likely your device configuation is wrong. %s"), $confAssistantText)], |
|
59 | + "TXT" => _("Have you ever used the network succesfully, e.g. at your home institution without roaming?"), |
|
60 | + "FACTOR" => 0.5, |
|
61 | + "VERDICTLECTURE" => sprintf(_("If your device has never worked before with this setup, then very likely your device configuation is wrong. %s"), $confAssistantText)], |
|
62 | 62 | 2 => ["AREA" => AbstractTest::INFRA_DEVICE, |
63 | - "TXT" => _("Did the device previously work when roaming, i.e. at other hotspots away from your home institution?"), |
|
64 | - "FACTOR" => 0.33, |
|
65 | - "VERDICTLECTURE" => sprintf(_("If roaming consistently does not work, then very likely your device configuration is wrong. Typical errors causing this symptom include: using a routing ('outer') username without the @realm.tld suffix - those potentially work at home, but can not be used when roaming. %s"),$confAssistantText)], |
|
63 | + "TXT" => _("Did the device previously work when roaming, i.e. at other hotspots away from your home institution?"), |
|
64 | + "FACTOR" => 0.33, |
|
65 | + "VERDICTLECTURE" => sprintf(_("If roaming consistently does not work, then very likely your device configuration is wrong. Typical errors causing this symptom include: using a routing ('outer') username without the @realm.tld suffix - those potentially work at home, but can not be used when roaming. %s"),$confAssistantText)], |
|
66 | 66 | 3 => ["AREA" => AbstractTest::INFRA_DEVICE, |
67 | - "TXT" => _("Did you recently change the configuration on your device?"), |
|
68 | - "FACTOR" => 3, |
|
69 | - "VERDICTLECTURE" => _("Accounts only need to be configured once, and can then be used anywhere on the planet without any changes. If you recently changed the configuration, that change may very well be at fault. You should never change your network configuration unless explicitly instructed so by your Identity Provider; even in the case of temporary login issues.")], |
|
67 | + "TXT" => _("Did you recently change the configuration on your device?"), |
|
68 | + "FACTOR" => 3, |
|
69 | + "VERDICTLECTURE" => _("Accounts only need to be configured once, and can then be used anywhere on the planet without any changes. If you recently changed the configuration, that change may very well be at fault. You should never change your network configuration unless explicitly instructed so by your Identity Provider; even in the case of temporary login issues.")], |
|
70 | 70 | 4 => ["AREA" => AbstractTest::INFRA_DEVICE, |
71 | - "TXT" => _("Do your other devices still work?"), |
|
72 | - "VERDICTLECTURE" => _("If all devices stopped working simultaneously, there may be a problem with your account as such. Maybe your account expired, or you were forced to change the password? These questions are best answered by your Identity Provider [MGW: display contact info]"), |
|
73 | - "FACTOR" => 0.33], |
|
71 | + "TXT" => _("Do your other devices still work?"), |
|
72 | + "VERDICTLECTURE" => _("If all devices stopped working simultaneously, there may be a problem with your account as such. Maybe your account expired, or you were forced to change the password? These questions are best answered by your Identity Provider [MGW: display contact info]"), |
|
73 | + "FACTOR" => 0.33], |
|
74 | 74 | 5 => ["AREA" => AbstractTest::INFRA_SP_80211, |
75 | - "TXT" => _("Is the place you are currently at heavily crowded, or is a network-intensive workload going on?"), |
|
76 | - "FACTOR" => 3, |
|
77 | - "VERDICTLECTURE" => _("The network is likely overloaded at this location and point in time. You may have to wait until later before you get a better connectivity. If you think the network should be reinforced for more capacity at this place, you should inform the hotspot provider. [MGW: add contact info]")], |
|
75 | + "TXT" => _("Is the place you are currently at heavily crowded, or is a network-intensive workload going on?"), |
|
76 | + "FACTOR" => 3, |
|
77 | + "VERDICTLECTURE" => _("The network is likely overloaded at this location and point in time. You may have to wait until later before you get a better connectivity. If you think the network should be reinforced for more capacity at this place, you should inform the hotspot provider. [MGW: add contact info]")], |
|
78 | 78 | 6 => ["AREA" => AbstractTest::INFRA_SP_80211, |
79 | - "TXT" => _("Does the connection get better when you move around?"), |
|
80 | - "FACTOR" => 3, |
|
81 | - "VERDICTLECTURE" => _("You should move to a different location to achieve better network coverage and service. If you think the exact spot you are at deserves better coverage, you should inform the hotspot provider. [MGW: add contact info]")], |
|
79 | + "TXT" => _("Does the connection get better when you move around?"), |
|
80 | + "FACTOR" => 3, |
|
81 | + "VERDICTLECTURE" => _("You should move to a different location to achieve better network coverage and service. If you think the exact spot you are at deserves better coverage, you should inform the hotspot provider. [MGW: add contact info]")], |
|
82 | 82 | |
83 | 83 | 7 => ["AREA" => AbstractTest::INFRA_SP_LAN, |
84 | - "TXT" => _("Do you see errors stating something similar to 'Unable to get IP address'?"), |
|
85 | - "FACTOR" => 3, |
|
86 | - "VERDICTLECTURE" => _("The evidence at hand suggests that there may be an infrastructure problem at this particular hotspot provider. There is nothing you can do to solve this problem locally. Please be patient and try again at a later time.")], |
|
84 | + "TXT" => _("Do you see errors stating something similar to 'Unable to get IP address'?"), |
|
85 | + "FACTOR" => 3, |
|
86 | + "VERDICTLECTURE" => _("The evidence at hand suggests that there may be an infrastructure problem at this particular hotspot provider. There is nothing you can do to solve this problem locally. Please be patient and try again at a later time.")], |
|
87 | 87 | ]; |
88 | 88 | } |
89 | 89 |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | 2 => ["AREA" => AbstractTest::INFRA_DEVICE, |
63 | 63 | "TXT" => _("Did the device previously work when roaming, i.e. at other hotspots away from your home institution?"), |
64 | 64 | "FACTOR" => 0.33, |
65 | - "VERDICTLECTURE" => sprintf(_("If roaming consistently does not work, then very likely your device configuration is wrong. Typical errors causing this symptom include: using a routing ('outer') username without the @realm.tld suffix - those potentially work at home, but can not be used when roaming. %s"),$confAssistantText)], |
|
65 | + "VERDICTLECTURE" => sprintf(_("If roaming consistently does not work, then very likely your device configuration is wrong. Typical errors causing this symptom include: using a routing ('outer') username without the @realm.tld suffix - those potentially work at home, but can not be used when roaming. %s"), $confAssistantText)], |
|
66 | 66 | 3 => ["AREA" => AbstractTest::INFRA_DEVICE, |
67 | 67 | "TXT" => _("Did you recently change the configuration on your device?"), |
68 | 68 | "FACTOR" => 3, |
@@ -99,12 +99,12 @@ discard block |
||
99 | 99 | $questionDetails = $this->qaArray[$questionNumber]; |
100 | 100 | if ($answer === TRUE) { |
101 | 101 | $this->possibleFailureReasons[$questionDetails['AREA']] = $this->possibleFailureReasons[$questionDetails['AREA']] * $questionDetails["FACTOR"]; |
102 | - $this->loggerInstance->debug(3,"Adjusting ".$questionDetails['AREA']." by ".$questionDetails["FACTOR"]."\n"); |
|
102 | + $this->loggerInstance->debug(3, "Adjusting " . $questionDetails['AREA'] . " by " . $questionDetails["FACTOR"] . "\n"); |
|
103 | 103 | $factor = $questionDetails["FACTOR"]; |
104 | 104 | } elseif ($answer === FALSE) { |
105 | 105 | $this->possibleFailureReasons[$questionDetails['AREA']] = $this->possibleFailureReasons[$questionDetails['AREA']] / $questionDetails["FACTOR"]; |
106 | - $this->loggerInstance->debug(3,"Adjusting ".$questionDetails['AREA']." by 1/".$questionDetails["FACTOR"]."\n"); |
|
107 | - $factor = 1/$questionDetails["FACTOR"]; |
|
106 | + $this->loggerInstance->debug(3, "Adjusting " . $questionDetails['AREA'] . " by 1/" . $questionDetails["FACTOR"] . "\n"); |
|
107 | + $factor = 1 / $questionDetails["FACTOR"]; |
|
108 | 108 | } else { |
109 | 109 | $factor = 1; |
110 | 110 | } |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | $this->additionalFindings["QUESTIONSASKED"] = $this->previousQuestions; |
114 | 114 | $_SESSION["SUSPECTS"] = $this->possibleFailureReasons; |
115 | 115 | $_SESSION["EVIDENCE"] = $this->additionalFindings; |
116 | - $this->loggerInstance->debug(3,$_SESSION['SUSPECTS']); |
|
117 | - $this->loggerInstance->debug(3,$_SESSION['EVIDENCE']); |
|
116 | + $this->loggerInstance->debug(3, $_SESSION['SUSPECTS']); |
|
117 | + $this->loggerInstance->debug(3, $_SESSION['EVIDENCE']); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | public function questionOracle() { |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | // if both are identical, take any of the questions in the pool of both |
129 | 129 | foreach ($this->qaArray as $questionNumber => $questionDetails) { |
130 | 130 | // if we find a question we didn't ask before AND it is related to our currently high-scoring problem area, ask it |
131 | - if (!array_key_exists($questionNumber, $this->previousQuestions) && ( $questionDetails["AREA"] == $highestCategory || $questionDetails["AREA"] == $nextCategory) ) { |
|
131 | + if (!array_key_exists($questionNumber, $this->previousQuestions) && ($questionDetails["AREA"] == $highestCategory || $questionDetails["AREA"] == $nextCategory)) { |
|
132 | 132 | return json_encode(["NEXTEXISTS" => TRUE, "NUMBER" => $questionNumber, "TEXT" => $questionDetails["TXT"]]); |
133 | 133 | } |
134 | 134 | } |
@@ -137,14 +137,14 @@ discard block |
||
137 | 137 | } |
138 | 138 | |
139 | 139 | public function getCurrentGuessState() { |
140 | - return json_encode([ "SUSPECTS" => $this->possibleFailureReasons, "EVIDENCE" => $this->additionalFindings ]); |
|
140 | + return json_encode(["SUSPECTS" => $this->possibleFailureReasons, "EVIDENCE" => $this->additionalFindings]); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | public function verdictText($area) { |
144 | 144 | $text = $this->genericVerdictTexts[$area]; |
145 | 145 | foreach ($this->previousQuestions as $number => $factor) { |
146 | 146 | if ($this->qaArray[$number]["AREA"] == $area && $factor > 1) { |
147 | - $text .= "\n\n".$this->qaArray[$number]["VERDICTLECTURE"]; |
|
147 | + $text .= "\n\n" . $this->qaArray[$number]["VERDICTLECTURE"]; |
|
148 | 148 | } |
149 | 149 | } |
150 | 150 | return $text; |