Passed
Push — master ( 657d73...8a66a0 )
by Tomasz
03:36
created
web/admin/inc/toggleRedirect.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
         throw new Exception("POSTed EAP type value is not an integer!");
52 52
     }
53 53
     // conversion routine throws an exception if the EAP type id is not known
54
-    $eaptype = new \core\common\EAP((int)$posted_eaptype);
54
+    $eaptype = new \core\common\EAP((int) $posted_eaptype);
55 55
 }
56 56
 
57 57
 // there is either one or the other. If both are set, something's fishy.
Please login to merge, or discard this patch.
web/skins/classic/user/cat_info.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
         }
44 44
         break;
45 45
     case 'about':
46
-        $out = sprintf(_("<span class='edu_cat'>%s</span> is built as a cooperation platform.<p>Local %s administrators enter their %s configuration details and based on them, <span class='edu_cat'>%s</span> builds customised installers for a number of popular platforms. An installer prepared for one %s will not work for users of another one, therefore if your %s is not on the list, you cannot use this system. Please contact your local administrators and try to influence them to add your %s configuration to <span class='edu_cat'>%s</span>."), CONFIG['APPEARANCE']['productname'], CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], CONFIG['APPEARANCE']['productname'],$skinObject->nomenclature_inst, $skinObject->nomenclature_inst, $skinObject->nomenclature_inst, CONFIG['APPEARANCE']['productname']);
46
+        $out = sprintf(_("<span class='edu_cat'>%s</span> is built as a cooperation platform.<p>Local %s administrators enter their %s configuration details and based on them, <span class='edu_cat'>%s</span> builds customised installers for a number of popular platforms. An installer prepared for one %s will not work for users of another one, therefore if your %s is not on the list, you cannot use this system. Please contact your local administrators and try to influence them to add your %s configuration to <span class='edu_cat'>%s</span>."), CONFIG['APPEARANCE']['productname'], CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], CONFIG['APPEARANCE']['productname'], $skinObject->nomenclature_inst, $skinObject->nomenclature_inst, $skinObject->nomenclature_inst, CONFIG['APPEARANCE']['productname']);
47 47
         $out .= "<p>" . sprintf(_("<span class='edu_cat'>%s</span> currently supports the following devices and EAP type combinations:"), CONFIG['APPEARANCE']['productname']) . "</p>";
48 48
         $out .= "<table><tr><th>" . _("Device Group") . "</th><th>" . _("Device") . "</th>";
49 49
 foreach (\core\common\EAP::listKnownEAPTypes() as $oneeap) {
Please login to merge, or discard this patch.
core/AbstractProfile.php 1 patch
Doc Comments   +10 added lines, -1 removed lines patch added patch discarded remove patch
@@ -96,6 +96,12 @@  discard block
 block discarded – undo
96 96
      */
97 97
     protected $frontendHandle;
98 98
 
99
+    /**
100
+     * @param integer $idpIdentifier
101
+     * @param string $deviceId
102
+     * @param string $area
103
+     * @param string $lang
104
+     */
99 105
     protected function saveDownloadDetails($idpIdentifier, $profileId, $deviceId, $area, $lang, $eapType) {
100 106
         if (CONFIG['PATHS']['logdir']) {
101 107
             $f = fopen(CONFIG['PATHS']['logdir'] . "/download_details.log", "a");
@@ -285,6 +291,9 @@  discard block
 block discarded – undo
285 291
      * 
286 292
      * @param string device the device identifier string
287 293
      * @param string path the path where the new installer can be found
294
+     * @param string $device
295
+     * @param string $path
296
+     * @param integer $integerEapType
288 297
      */
289 298
     abstract public function updateCache($device, $path, $mime, $integerEapType);
290 299
 
@@ -600,7 +609,7 @@  discard block
 block discarded – undo
600 609
      * it? Silverbullet will always return TRUE; RADIUS profiles need to do some
601 610
      * heavy lifting here.
602 611
      * 
603
-     * * @return boolean TRUE if enough info is set to enable installers
612
+     * * @return integer TRUE if enough info is set to enable installers
604 613
      */
605 614
     public function readinessLevel() {
606 615
         $result = $this->databaseHandle->exec("SELECT sufficient_config, showtime FROM profile WHERE profile_id = ?", "i", $this->identifier);
Please login to merge, or discard this patch.
core/ProfileRADIUS.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
         $this->realm = $profileQuery->realm;
72 72
 
73
-        $localValueIfAny = (preg_match('/@/', $this->realm) ? substr($this->realm, 0, strpos($this->realm, '@')) : "anonymous" );
73
+        $localValueIfAny = (preg_match('/@/', $this->realm) ? substr($this->realm, 0, strpos($this->realm, '@')) : "anonymous");
74 74
 
75 75
         $internalAttributes = [
76 76
             "internal:profile_count" => $this->idpNumberOfProfiles,
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
                 "row" => $attributeQuery->row,
168 168
                 "flag" => $optinfo['flag'],
169 169
                 "device" => ($devicesOrEAPMethods == "DEVICES" ? $attributeQuery->deviceormethod : NULL),
170
-                "eapmethod" => ($devicesOrEAPMethods == "DEVICES" ? 0 : (new \core\common\EAP($attributeQuery->deviceormethod))->getArrayRep() )];
170
+                "eapmethod" => ($devicesOrEAPMethods == "DEVICES" ? 0 : (new \core\common\EAP($attributeQuery->deviceormethod))->getArrayRep())];
171 171
         }
172 172
         return $temparray;
173 173
     }
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
      */
268 268
     public function setRealmCheckUser($shallwe, $localpart = NULL) {
269 269
         $this->databaseHandle->exec("UPDATE profile SET checkuser_outer = " . ($shallwe === true ? "1" : "0") .
270
-                ( $localpart !== NULL ? ", checkuser_value = '$localpart' " : "") .
270
+                ($localpart !== NULL ? ", checkuser_value = '$localpart' " : "") .
271 271
                 " WHERE profile_id = $this->identifier");
272 272
     }
273 273
 
Please login to merge, or discard this patch.
web/diag/action_userdiag.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -167,10 +167,10 @@
 block discarded – undo
167 167
             $checks[] = ["realm" => $sanitised_realm, "instance" => new \core\diag\RADIUSTests($sanitised_realm, $profile->getRealmCheckOuterUsername(), $profile->getEapMethodsinOrderOfPreference(1), $profile->getCollapsedAttributes()['eap:server_name'], $profile->getCollapsedAttributes()['eap:ca_file']), "class" => "CAT", "profile" => $profile];
168 168
             echo "Debugging CAT Profile $profile_id for $sanitised_realm<br/>";
169 169
         } else if (!empty($cat->getExternalDBEntityDetails(0, $realm))) {
170
-            $checks[] = ["realm" => $sanitised_realm, "instance" => new \core\diag\RADIUSTests($sanitised_realm, "@".$sanitised_realm), "class" => "EXT_DB"];
170
+            $checks[] = ["realm" => $sanitised_realm, "instance" => new \core\diag\RADIUSTests($sanitised_realm, "@" . $sanitised_realm), "class" => "EXT_DB"];
171 171
             echo "Debugging non-CAT but existing realm $sanitised_realm<br/>";
172 172
         } else {
173
-            $checks[] = ["realm" => $sanitised_realm, "instance" => new \core\diag\RADIUSTests($sanitised_realm, "@".$sanitised_realm), "class" => "ALIEN"];
173
+            $checks[] = ["realm" => $sanitised_realm, "instance" => new \core\diag\RADIUSTests($sanitised_realm, "@" . $sanitised_realm), "class" => "ALIEN"];
174 174
             echo "Debugging non-existing realm $sanitised_realm<br/>";
175 175
         }
176 176
     }
Please login to merge, or discard this patch.
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -134,8 +134,9 @@  discard block
 block discarded – undo
134 134
                     array_multisort($name, SORT_ASC, SORT_LOCALE_STRING, $displaylist);
135 135
                     setlocale(LC_ALL, $current_locale);
136 136
 
137
-                    foreach ($displaylist as $id => $oneinst)
138
-                        echo "<option id='" . $id . "' value='" . $oneinst['realmlist'] . "'>" . $oneinst['name'] . "</option>";
137
+                    foreach ($displaylist as $id => $oneinst) {
138
+                                            echo "<option id='" . $id . "' value='" . $oneinst['realmlist'] . "'>" . $oneinst['name'] . "</option>";
139
+                    }
139 140
                     ?>
140 141
                 </select>
141 142
                 <button type='submit' class='submit'><?php echo _("Submit Information"); ?></button>
@@ -198,10 +199,12 @@  discard block
 block discarded – undo
198 199
                 $checkresult[$number] = $check['instance']->udpReachability($number, FALSE, FALSE);
199 200
                 if ($checkresult[$number] == \core\diag\RADIUSTests::RETVAL_CONVERSATION_REJECT) { // so now things work?!
200 201
                     // either a packet size or Operator-Name problem!
201
-                    if ($check['instance']->udpReachability($number, TRUE, FALSE) != \core\diag\RADIUSTests::RETVAL_CONVERSATION_REJECT)
202
-                        $realmproblems[] = ["REALM" => $check['realm'], "STATUS" => "OPERATOR-NAME", "FROM" => $probe['display_name'], "DETAIL" => ""];
203
-                    if ($check['instance']->udpReachability($number, FALSE, TRUE) != \core\diag\RADIUSTests::RETVAL_CONVERSATION_REJECT)
204
-                        $realmproblems[] = ["REALM" => $check['realm'], "STATUS" => "PACKETSIZE", "FROM" => $probe['display_name'], "DETAIL" => ""];
202
+                    if ($check['instance']->udpReachability($number, TRUE, FALSE) != \core\diag\RADIUSTests::RETVAL_CONVERSATION_REJECT) {
203
+                                            $realmproblems[] = ["REALM" => $check['realm'], "STATUS" => "OPERATOR-NAME", "FROM" => $probe['display_name'], "DETAIL" => ""];
204
+                    }
205
+                    if ($check['instance']->udpReachability($number, FALSE, TRUE) != \core\diag\RADIUSTests::RETVAL_CONVERSATION_REJECT) {
206
+                                            $realmproblems[] = ["REALM" => $check['realm'], "STATUS" => "PACKETSIZE", "FROM" => $probe['display_name'], "DETAIL" => ""];
207
+                    }
205 208
                 } else { // still no response or immediate reject
206 209
                     // if this is a CAT realm with anon ID set, we can't be seeing an NPS ignorance problem
207 210
                     // and consequently, the realm has actual issues
@@ -235,12 +238,13 @@  discard block
 block discarded – undo
235 238
 // re-write check history with that extra knowledge
236 239
     $copycat = $realmproblems;
237 240
 
238
-    foreach ($realmproblems as &$problem)
239
-        if ($problem['STATUS'] == "REALM_POSSIBLY_NPS")
241
+    foreach ($realmproblems as &$problem) {
242
+            if ($problem['STATUS'] == "REALM_POSSIBLY_NPS")
240 243
             foreach ($copycat as $otherproblem)
241 244
                 if ($problem['REALM'] == $otherproblem['REALM'] && $problem['FROM'] != $otherproblem['FROM'] && $otherproblem['STATUS'] != "REALM_POSSIBLY_NPS")
242 245
                     if ($otherproblem['STATUS'] == "REACHABLE") { // worked elsewhere, but not on this probe:
243 246
                         $problem['STATUS'] = "REALM_DOWN";
247
+    }
244 248
                     } else { // inherit other problem; in any case not an NPS problem
245 249
                         $problem['STATUS'] = $otherproblem['STATUS'];
246 250
                     }
@@ -250,11 +254,12 @@  discard block
 block discarded – undo
250 254
 
251 255
     $copycat = $realmproblems;
252 256
 
253
-    foreach ($realmproblems as &$problem)
254
-        if ($problem['STATUS'] == "REALM_DOWN")
257
+    foreach ($realmproblems as &$problem) {
258
+            if ($problem['STATUS'] == "REALM_DOWN")
255 259
             foreach ($copycat as $otherproblem)
256 260
                 if ($problem['REALM'] == $otherproblem['REALM'] && $problem['FROM'] != $otherproblem['FROM'] && $otherproblem['STATUS'] == "REACHABLE")
257 261
                     $problem['STATUS'] = "INFRASTRUCTURE";
262
+    }
258 263
     unset($problem);
259 264
 
260 265
 // finally, extract all certprobs we got from the reachability checks; merge from all
@@ -265,8 +270,9 @@  discard block
 block discarded – undo
265 270
     foreach ($checks as $check) {
266 271
         $instance = $check['instance'];
267 272
         $resultset = $instance->UDP_reachability_result;
268
-        foreach ($resultset as $result)
269
-            $all_certprobs = array_merge($all_certprobs, $result['cert_oddities']);
273
+        foreach ($resultset as $result) {
274
+                    $all_certprobs = array_merge($all_certprobs, $result['cert_oddities']);
275
+        }
270 276
     }
271 277
 
272 278
 // now we have something to say...
Please login to merge, or discard this patch.
web/diag/radius_tests.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
 function disp_name($eap) {
29 29
     $displayName = EAP::eapDisplayName($eap);
30
-    return $displayName['OUTER'] . ( $displayName['INNER'] != '' ? '-' . $displayName['INNER'] : '');
30
+    return $displayName['OUTER'] . ($displayName['INNER'] != '' ? '-' . $displayName['INNER'] : '');
31 31
 }
32 32
 
33 33
 if (!isset($_REQUEST['test_type']) || !$_REQUEST['test_type']) {
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     $testsuite = new \core\diag\RADIUSTests($check_realm, $my_profile->getRealmCheckOuterUsername(), $my_profile->getEapMethodsinOrderOfPreference(1), $my_profile->getCollapsedAttributes()['eap:server_name'], $my_profile->getCollapsedAttributes()['eap:ca_file']);
51 51
 } else {
52 52
     $my_profile = NULL;
53
-    $testsuite = new \core\diag\RADIUSTests($check_realm, "@".$check_realm);
53
+    $testsuite = new \core\diag\RADIUSTests($check_realm, "@" . $check_realm);
54 54
 }
55 55
 
56 56
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     // contains port number; needs to be redacted for filter_var to work
67 67
     // in any case, it's a printable string, so filter it initially
68 68
     
69
-    $filteredHost = filter_input(INPUT_GET,'src', FILTER_SANITIZE_STRING) ?? filter_input(INPUT_POST,'src', FILTER_SANITIZE_STRING);
69
+    $filteredHost = filter_input(INPUT_GET, 'src', FILTER_SANITIZE_STRING) ?? filter_input(INPUT_POST, 'src', FILTER_SANITIZE_STRING);
70 70
     $hostonly1 = preg_replace('/:[0-9]*$/', "", $filteredHost);
71 71
     $hostonly2 = preg_replace('/^\[/', "", $hostonly1);
72 72
     $hostonly3 = preg_replace('/\]$/', "", $hostonly2);
@@ -295,12 +295,12 @@  discard block
 block discarded – undo
295 295
         $returnarray['time_millisec'] = sprintf("%d", $testsuite->UDP_reachability_result[$host]['time_millisec']);
296 296
 
297 297
         if (preg_match('/verify error:num=19/', implode($opensslbabble))) {
298
-            $printedres .= "<tr><td>"._("<strong>ERROR</strong>: the server presented a certificate which is from an unknown authority!") . $measure ."</td></tr>";
298
+            $printedres .= "<tr><td>" . _("<strong>ERROR</strong>: the server presented a certificate which is from an unknown authority!") . $measure . "</td></tr>";
299 299
             $my_ip_addrs[$key]["status"] = "FAILED";
300 300
             $goterror = 1;
301 301
         }
302 302
         if (preg_match('/verify return:1/', implode($opensslbabble))) {
303
-            $printedres .= "<tr><td>"._("Completed.") . $measure . "</td></tr>";
303
+            $printedres .= "<tr><td>" . _("Completed.") . $measure . "</td></tr>";
304 304
             $printedres .= "<tr><td></td><td><div class=\"more\">";
305 305
             $my_ip_addrs[$key]["status"] = "OK";
306 306
             $servercertRaw = implode("\n", $opensslbabble);
Please login to merge, or discard this patch.
web/admin/API.php 1 patch
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -40,8 +40,7 @@  discard block
 block discarded – undo
40 40
         $leftNum = (int) preg_replace($pat, $rep, $left);
41 41
         $rightNum = (int) preg_replace($pat, $rep, $right);
42 42
         return ($left != $leftNum && $right != $rightNum) ?
43
-                $leftNum - $rightNum :
44
-                strcmp($left, $right);
43
+                $leftNum - $rightNum : strcmp($left, $right);
45 44
     }
46 45
 
47 46
     
@@ -118,8 +117,8 @@  discard block
 block discarded – undo
118 117
             $therealm = "";
119 118
             $theanonid = "anonymous";
120 119
             $useAnon = FALSE;
121
-            $stringValuesFiltered = filter_input(INPUT_POST,'value', FILTER_SANITIZE_STRING, FILTER_REQUIRE_ARRAY);
122
-            $intValuesFiltered = filter_input(INPUT_POST,'value', FILTER_SANITIZE_NUMBER_INT, FILTER_REQUIRE_ARRAY);
120
+            $stringValuesFiltered = filter_input(INPUT_POST, 'value', FILTER_SANITIZE_STRING, FILTER_REQUIRE_ARRAY);
121
+            $intValuesFiltered = filter_input(INPUT_POST, 'value', FILTER_SANITIZE_NUMBER_INT, FILTER_REQUIRE_ARRAY);
123 122
             $pref = 0;
124 123
             foreach ($_POST['option'] as $optindex => $optname) {
125 124
                 switch ($optname) {
@@ -145,7 +144,7 @@  discard block
 block discarded – undo
145 144
                         
146 145
                         if (isset($intValuesFiltered[$optindex . "-0"])) {
147 146
                             $filteredType = $intValuesFiltered[$optindex . "-0"];
148
-                            if ($filteredType <0 || $filteredType >8) {
147
+                            if ($filteredType < 0 || $filteredType > 8) {
149 148
                                 break;
150 149
                             }
151 150
                             $newprofile->addSupportedEapMethod(new \core\common\EAP($filteredType), $pref);
Please login to merge, or discard this patch.
web/lib/admin/OptionDisplay.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -205,7 +205,7 @@
 block discarded – undo
205 205
      * @param int $rowid the HTML field base name of the option to be displayed
206 206
      * @param string $optionName the name of the option to display
207 207
      * @param string $optionValue the value of the option to display
208
-     * @param mixed $optionLang the language of the option to display
208
+     * @param null|string $optionLang the language of the option to display
209 209
      * @return string HTML code
210 210
      * @throws Exception
211 211
      */
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
         $optioninfo = \core\Options::instance();
104 104
 
105
-        if (is_array($prepopulate) && ( count($prepopulate) > 1 || $class == "device-specific" || $class == "eap-specific")) { // editing... fill with values
105
+        if (is_array($prepopulate) && (count($prepopulate) > 1 || $class == "device-specific" || $class == "eap-specific")) { // editing... fill with values
106 106
             foreach ($prepopulate as $option) {
107 107
                 if (preg_match("/$class:/", $option['name']) && !preg_match("/(user:fedadmin)/", $option['name'])) {
108 108
                     $optiontypearray = $optioninfo->optionType($option['name']);
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
         $retval .= "
340 340
 
341 341
        <td>
342
-          <button type='button' class='delete' onclick='deleteOption(" . ( $prefillValue !== NULL && $item == "general:geo_coordinates" ? $this->allLocationCount : 0 ) . ",\"option-S" . $rowid . "\")'>-</button>
342
+          <button type='button' class='delete' onclick='deleteOption(" . ($prefillValue !== NULL && $item == "general:geo_coordinates" ? $this->allLocationCount : 0) . ",\"option-S" . $rowid . "\")'>-</button>
343 343
        </td>
344 344
     </tr>";
345 345
         return $retval;
Please login to merge, or discard this patch.
web/admin/edit_federation_result.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 echo $deco->pageheader(sprintf(_("%s: %s Customisation (submission completed)"), CONFIG['APPEARANCE']['productname'], $uiElements->nomenclature_fed), "FEDERATION");
29 29
 $my_fed = $validator->Federation($_GET['fed_id'], $_SESSION['user']);
30 30
 if (isset($_POST['submitbutton'])) {
31
-    if (( $_POST['submitbutton'] == web\lib\common\FormElements::BUTTON_SAVE) && isset($_POST['option']) && isset($_POST['value'])) { // here we go
31
+    if (($_POST['submitbutton'] == web\lib\common\FormElements::BUTTON_SAVE) && isset($_POST['option']) && isset($_POST['value'])) { // here we go
32 32
         $fed_name = $my_fed->name;
33 33
         echo "<h1>" . sprintf(_("Submitted attributes for %s '%s'"), $uiElements->nomenclature_fed, $fed_name) . "</h1>";
34 34
         echo "<table>";
Please login to merge, or discard this patch.