Passed
Push — master ( 56c883...f703ed )
by Maja
04:39
created
core/ProfileSilverbullet.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 // realm is automatically calculated, then stored in DB
101 101
 
102 102
         $this->realm = "opaquehash@$myInst->identifier-$this->identifier." . strtolower($myInst->federation) . CONFIG_CONFASSISTANT['SILVERBULLET']['realm_suffix'];
103
-        $this->setRealm($myInst->identifier."-".$this->identifier."." . strtolower($myInst->federation) . strtolower(CONFIG_CONFASSISTANT['SILVERBULLET']['realm_suffix']));
103
+        $this->setRealm($myInst->identifier . "-" . $this->identifier . "." . strtolower($myInst->federation) . strtolower(CONFIG_CONFASSISTANT['SILVERBULLET']['realm_suffix']));
104 104
         $localValueIfAny = "";
105 105
 
106 106
 // but there's some common internal attributes populated directly
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
     public function invitationMailBody($invitationLink) {
177 177
         $text = _("Hello!");
178 178
         $text .= "\n\n";
179
-        $text .= sprintf(_("A new %s access credential has been created for you by your network administrator."),CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']);
179
+        $text .= sprintf(_("A new %s access credential has been created for you by your network administrator."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']);
180 180
         $text .= " ";
181 181
         $text .= sprintf(_("Please follow the following link with the device you want to enable for %s to get a custom %s installation program just for you. You can click on the link, copy and paste it into a browser or scan the attached QR code."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']);
182 182
         $text .= "\n\n$invitationLink\n\n"; // gets replaced with the token value by getBody()
183
-        $text .= sprintf(_("Please keep this email or bookmark this link for future use. After picking up your %s installation program, you can use the same link to get status information about your %s account."),CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']);
183
+        $text .= sprintf(_("Please keep this email or bookmark this link for future use. After picking up your %s installation program, you can use the same link to get status information about your %s account."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']);
184 184
         $text .= "\n\n";
185 185
         $text .= _("Regards,");
186 186
         $text .= "\n\n";
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
                 $indexStatement = "$certstatus\t$expiryIndexTxt\t" . ($certstatus == "R" ? "$nowIndexTxt,unspecified" : "") . "\t$serialHex\tunknown\t/O=" . CONFIG_CONFASSISTANT['CONSORTIUM']['name'] . "/OU=$federation/CN=$cn/emailAddress=$cn\n";
465 465
                 $logHandle->debug(4, "index.txt contents-to-be: $indexStatement");
466 466
                 if (!file_put_contents($tempdir . "/index.txt", $indexStatement)) {
467
-                $logHandle->debug(1,"Unable to write openssl index.txt file for revocation handling!");
467
+                $logHandle->debug(1, "Unable to write openssl index.txt file for revocation handling!");
468 468
                 }
469 469
                 // index.txt.attr is dull but needs to exist
470 470
                 file_put_contents($tempdir . "/index.txt.attr", "unique_subject = yes\n");
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
         if ($invitationsResult->num_rows == 0) {
575 575
             $loggerInstance->debug(2, "Token  $tokenvalue not found in database or database query error!\n");
576 576
             return ["status" => self::SB_TOKENSTATUS_INVALID,
577
-                "cert_status" => [],];
577
+                "cert_status" => [], ];
578 578
         }
579 579
         // if not returned, we found the token in the DB
580 580
         $invitationRow = mysqli_fetch_object(/** @scrutinizer ignore-type */ $invitationsResult);
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
                 throw new Exception("Impossible: the string ends with '/admin' but it's not possible to cut six characters from the end?!");
745 745
             }
746 746
         }
747
-        $link .= '/accountstatus/accountstatus.php?token='.$token;
747
+        $link .= '/accountstatus/accountstatus.php?token=' . $token;
748 748
         return $link;
749 749
     }
750 750
 
Please login to merge, or discard this patch.
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -56,6 +56,9 @@  discard block
 block discarded – undo
56 56
 
57 57
     const PRODUCTNAME = "Managed IdP";
58 58
 
59
+    /**
60
+     * @param integer $length
61
+     */
59 62
     public static function randomString(
60 63
     $length, $keyspace = '23456789abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
61 64
     ) {
@@ -238,6 +241,7 @@  discard block
 block discarded – undo
238 241
     /**
239 242
      * create a CSR
240 243
      * 
244
+     * @param resource $privateKey
241 245
      * @return 
242 246
      */
243 247
     private function generateCsr($privateKey) {
@@ -277,6 +281,7 @@  discard block
 block discarded – undo
277 281
      * take a CSR and sign it with our issuing CA's certificate
278 282
      * 
279 283
      * @param mixed $csr the CSR
284
+     * @param integer $expiryDays
280 285
      */
281 286
     private function signCsr($csr, $expiryDays) {
282 287
         switch (CONFIG_CONFASSISTANT['SILVERBULLET']['CA']['type']) {
Please login to merge, or discard this patch.
core/UserManagement.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -276,9 +276,9 @@
 block discarded – undo
276 276
         $retval = [];
277 277
         $invitations = $this->databaseHandle->exec("SELECT cat_institution_id, country, name, invite_issuer_level, invite_dest_mail, invite_token 
278 278
                                         FROM invitations 
279
-                                        WHERE cat_institution_id " . ( $idpIdentifier != 0 ? "= $idpIdentifier" : "IS NULL") . " AND invite_created >= TIMESTAMPADD(DAY, -1, NOW()) AND used = 0");
279
+                                        WHERE cat_institution_id " . ($idpIdentifier != 0 ? "= $idpIdentifier" : "IS NULL") . " AND invite_created >= TIMESTAMPADD(DAY, -1, NOW()) AND used = 0");
280 280
         // SELECT -> resource, not boolean
281
-        $this->loggerInstance->debug(4, "Retrieving pending invitations for " . ($idpIdentifier != 0 ? "IdP $idpIdentifier" : "IdPs awaiting initial creation" ) . ".\n");
281
+        $this->loggerInstance->debug(4, "Retrieving pending invitations for " . ($idpIdentifier != 0 ? "IdP $idpIdentifier" : "IdPs awaiting initial creation") . ".\n");
282 282
         while ($invitationQuery = mysqli_fetch_object(/** @scrutinizer ignore-type */ $invitations)) {
283 283
             $retval[] = ["country" => $invitationQuery->country, "name" => $invitationQuery->name, "mail" => $invitationQuery->invite_dest_mail, "token" => $invitationQuery->invite_token];
284 284
         }
Please login to merge, or discard this patch.
devices/ms/WindowsCommon.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -188,11 +188,11 @@  discard block
 block discarded – undo
188 188
         $logoCount = count($logosToPlace);
189 189
         if ($logoCount > 0) {
190 190
             $voffset = $freeTop;
191
-            $freeSpace = (int)round($this->background['freeHeight'] / ($logoCount + 1));
191
+            $freeSpace = (int) round($this->background['freeHeight'] / ($logoCount + 1));
192 192
             foreach ($logosToPlace as $logo) {
193 193
                 $voffset += $freeSpace;
194 194
                 $logoSize = $logo->getImageGeometry();
195
-                $hoffset = (int)round(($bgImageSize['width'] - $logoSize['width']) / 2);
195
+                $hoffset = (int) round(($bgImageSize['width'] - $logoSize['width']) / 2);
196 196
                 $bgImage->compositeImage($logo, $logo->getImageCompose(), $hoffset, $voffset);
197 197
                 $voffset += $logoSize['height'];
198 198
                 }
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
             $fcontents .= "\n" . '!define USER_GROUP "' . $this->translateString(str_replace('"', '$\\"', $attr['profile:name'][0]), $this->codePage) . '"
233 233
 ';
234 234
         }
235
-        $fcontents .=  '
235
+        $fcontents .= '
236 236
 Caption "' . $this->translateString(sprintf(WindowsCommon::sprint_nsi(_("%s installer for %s")), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $attr['general:instname'][0]), $this->codePage) . '"
237 237
 !define APPLICATION "' . $this->translateString(sprintf(WindowsCommon::sprint_nsi(_("%s installer for %s")), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $attr['general:instname'][0]), $this->codePage) . '"
238 238
 !define VERSION "' . \core\CAT::VERSION_MAJOR . '.' . \core\CAT::VERSION_MINOR . '"
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
 !define LOCALE "' . preg_replace('/\..*$/', '', CONFIG['LANGUAGES'][$this->languageInstance->getLang()]['locale']) . '"
242 242
 ;--------------------------------
243 243
 !define ORGANISATION "' . $this->translateString($attr['general:instname'][0], $this->codePage) . '"
244
-!define SUPPORT "' . ((isset($attr['support:email'][0]) && $attr['support:email'][0] ) ? $attr['support:email'][0] : $this->translateString($this->support_email_substitute, $this->codePage)) . '"
245
-!define URL "' . ((isset($attr['support:url'][0]) && $attr['support:url'][0] ) ? $attr['support:url'][0] : $this->translateString($this->support_url_substitute, $this->codePage)) . '"
244
+!define SUPPORT "' . ((isset($attr['support:email'][0]) && $attr['support:email'][0]) ? $attr['support:email'][0] : $this->translateString($this->support_email_substitute, $this->codePage)) . '"
245
+!define URL "' . ((isset($attr['support:url'][0]) && $attr['support:url'][0]) ? $attr['support:url'][0] : $this->translateString($this->support_url_substitute, $this->codePage)) . '"
246 246
     ';
247 247
 
248 248
 
@@ -256,11 +256,11 @@  discard block
 block discarded – undo
256 256
             $fcontents .= '!define REALM "' . $attr['internal:realm'][0] . '"
257 257
 ';
258 258
         }
259
-        if(!empty($attr['internal:hint_userinput_suffix'][0]) && $attr['internal:hint_userinput_suffix'][0] == 1) {
259
+        if (!empty($attr['internal:hint_userinput_suffix'][0]) && $attr['internal:hint_userinput_suffix'][0] == 1) {
260 260
             $fcontents .= '!define HINT_USER_INPUT "' . $attr['internal:hint_userinput_suffix'][0] . '"
261 261
 ';
262 262
         }
263
-        if(!empty($attr['internal:verify_userinput_suffix'][0]) && $attr['internal:verify_userinput_suffix'][0] == 1) {
263
+        if (!empty($attr['internal:verify_userinput_suffix'][0]) && $attr['internal:verify_userinput_suffix'][0] == 1) {
264 264
             $fcontents .= '!define VERIFY_USER_REALM_INPUT "' . $attr['internal:verify_userinput_suffix'][0] . '"
265 265
 ';
266 266
         }
Please login to merge, or discard this patch.
schema/1_1-2_0-script.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@
 block discarded – undo
95 95
 
96 96
 while ($oneAttrib = mysqli_fetch_object(/** @scrutinizer ignore-type */ $idpWideOptionsQuery)) {
97 97
     if (!isset($profiles[$oneAttrib->institution_id])) {
98
-        $idp = new \core\IdP((int)$oneAttrib->institution_id);
98
+        $idp = new \core\IdP((int) $oneAttrib->institution_id);
99 99
         $profiles[$oneAttrib->institution_id] = ['IdP' => $idp, 'Profiles' => $idp->listProfiles()];
100 100
         echo "Debug: IdP " . $idp->identifier . " has profiles ";
101 101
         foreach ($profiles[$oneAttrib->institution_id]['Profiles'] as $oneProfileObject) {
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 = \core\common\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/lib/admin/UIElements.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
                         }
185 185
                         break;
186 186
                     case "boolean":
187
-                        $retval .= "<tr><td>" . $this->displayName($option['name']) . "</td><td>$language</td><td><strong>" . ($content == "on" ? _("on") : _("off") ) . "</strong></td></tr>";
187
+                        $retval .= "<tr><td>" . $this->displayName($option['name']) . "</td><td>$language</td><td><strong>" . ($content == "on" ? _("on") : _("off")) . "</strong></td></tr>";
188 188
                         break;
189 189
                     default:
190 190
                         $retval .= "<tr><td>" . $this->displayName($option['name']) . "</td><td>$language</td><td><strong>$content</strong></td></tr>";
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
     
310 310
     private function checkROWIDpresence($reference) {
311 311
         $found = preg_match("/^ROWID-.*/", $reference);
312
-        if ($found  != 1) { // get excited on not-found AND on execution error
312
+        if ($found != 1) { // get excited on not-found AND on execution error
313 313
             throw new Exception("Error, ROWID expected.");
314 314
         }
315 315
     }
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 
333 333
         $details['name'] = preg_replace('/(.)\/(.)/', "$1<br/>$2", $details['name']);
334 334
         $details['name'] = preg_replace('/\//', "", $details['name']);
335
-        $certstatus = ( $details['root'] == 1 ? "R" : "I");
335
+        $certstatus = ($details['root'] == 1 ? "R" : "I");
336 336
         if ($details['ca'] == 0 && $details['root'] != 1) {
337 337
             return "<div class='ca-summary' style='background-color:red'><div style='position:absolute; right: 0px; width:20px; height:20px; background-color:maroon;  border-radius:10px; text-align: center;'><div style='padding-top:3px; font-weight:bold; color:#ffffff;'>S</div></div>" . _("This is a <strong>SERVER</strong> certificate!") . "<br/>" . $details['name'] . "</div>";
338 338
         }
Please login to merge, or discard this patch.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -123,6 +123,9 @@
 block discarded – undo
123 123
         return $find[0];
124 124
     }
125 125
 
126
+    /**
127
+     * @param string $input
128
+     */
126 129
     public function tooltip($input) {
127 130
         $descriptions = [];
128 131
         if (count(CONFIG_CONFASSISTANT['CONSORTIUM']['ssid']) > 0) {
Please login to merge, or discard this patch.
web/lib/user/TextTemplates.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 namespace web\lib\user;
12 12
 
13
-require_once(ROOT."/config/_config.php");
13
+require_once(ROOT . "/config/_config.php");
14 14
 /**
15 15
  * these constants live in the global space just to ease their use - with class
16 16
  * prefix, the names simply get too long for comfort
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
         $this->templates[WELCOME_ABOARD_BACKTODOWNLOADS] = _("Back to downloads");
73 73
         $this->templates[EDUROAM_WELCOME_ADVERTISING] = sprintf(_("we would like to warmly welcome you among the several million users of %s! From now on, you will be able to use internet access resources on thousands of universities, research centres and other places all over the globe. All of this completely free of charge!"), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']);
74 74
         $this->templates[HEADING_TOPLEVEL_GREET] = sprintf(_("Welcome to %s"), CONFIG['APPEARANCE']['productname']);
75
-        $this->templates[HEADING_TOPLEVEL_PURPOSE] = sprintf(_("Connect your device to %s"),CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']);
75
+        $this->templates[HEADING_TOPLEVEL_PURPOSE] = sprintf(_("Connect your device to %s"), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']);
76 76
         $this->templates[FRONTPAGE_ROLLER_EASY] = sprintf(_("%s installation made easy:"), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']);
77
-        $this->templates[FRONTPAGE_ROLLER_CUSTOMBUILT] = sprintf(_("Custom built for your %s"),$parent->nomenclature_inst);       
77
+        $this->templates[FRONTPAGE_ROLLER_CUSTOMBUILT] = sprintf(_("Custom built for your %s"), $parent->nomenclature_inst);       
78 78
         $this->templates[FRONTPAGE_BIGDOWNLOADBUTTON] = sprintf(_("Click here to download your %s installer"), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']);
79 79
         $this->templates[PROFILE_SELECTION] = _("Select the user group");
80 80
         $this->templates[INSTITUTION_SELECTION] = _("select another");
Please login to merge, or discard this patch.
devices/ms/Device_Vista7.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@
 block discarded – undo
162 162
             $profileFileCont .= '
163 163
 </ServerSideCredential>
164 164
 <InnerAuthenticationMethod>
165
-<NonEAPAuthMethod>' .$innerMethod. '</NonEAPAuthMethod>
165
+<NonEAPAuthMethod>' .$innerMethod . '</NonEAPAuthMethod>
166 166
 </InnerAuthenticationMethod>
167 167
 <VendorSpecific>
168 168
 <SessionResumption>false</SessionResumption>
Please login to merge, or discard this patch.
core/EntityWithDBProperties.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -225,7 +225,7 @@
 block discarded – undo
225 225
         $handle = DBConnection::handle("INST");
226 226
         $blobQuery = $handle->exec("SELECT option_value from $table WHERE row = $row");
227 227
         // SELECT -> returns resource, not boolean
228
-        while ($returnedData =  /** @scrutinizer ignore-type */ mysqli_fetch_object($blobQuery)) {
228
+        while ($returnedData = /** @scrutinizer ignore-type */ mysqli_fetch_object($blobQuery)) {
229 229
             $blob = $returnedData->option_value;
230 230
         }
231 231
         if (!isset($blob)) {
Please login to merge, or discard this patch.