Passed
Push — release_2_1 ( 584353...81e271 )
by Tomasz
27:15
created
web/admin/API.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  *          <base_url>/copyright.php after deploying the software
21 21
  */
22 22
 
23
-require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php";
23
+require_once dirname(dirname(dirname(__FILE__)))."/config/_config.php";
24 24
 
25 25
 // no SAML auth on this page. The API key authenticates the entity
26 26
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
 $inputDecoded = json_decode($inputRaw, TRUE);
40 40
 if (!is_array($inputDecoded)) {
41
-    $adminApi->returnError(web\lib\admin\API::ERROR_MALFORMED_REQUEST, "Unable to decode JSON POST data." . json_last_error_msg() . $inputRaw);
41
+    $adminApi->returnError(web\lib\admin\API::ERROR_MALFORMED_REQUEST, "Unable to decode JSON POST data.".json_last_error_msg().$inputRaw);
42 42
     exit(1);
43 43
 }
44 44
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
             throw new Exception("A required parameter is missing, and this wasn't caught earlier?!");
133 133
         }
134 134
         $newtokens = $mgmt->createTokens(true, [$admin], $idp);
135
-        $URL = "https://" . $_SERVER['SERVER_NAME'] . dirname($_SERVER['SCRIPT_NAME']) . "/action_enrollment.php?token=" . array_keys($newtokens)[0];
135
+        $URL = "https://".$_SERVER['SERVER_NAME'].dirname($_SERVER['SCRIPT_NAME'])."/action_enrollment.php?token=".array_keys($newtokens)[0];
136 136
         $success = ["TOKEN URL" => $URL, "TOKEN" => array_keys($newtokens)[0]];
137 137
         // done with the essentials - display in response. But if we also have an email address, send it there
138 138
         $email = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_TARGETMAIL);
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
         if ($found) {
170 170
             $adminApi->returnSuccess([]);
171 171
         }
172
-        $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "The admin with ID $toBeDeleted is not associated to IdP " . $idp->identifier);
172
+        $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "The admin with ID $toBeDeleted is not associated to IdP ".$idp->identifier);
173 173
         break;
174 174
     case web\lib\admin\API::ACTION_STATISTICS_FED:
175 175
         $detail = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_DETAIL);
@@ -281,10 +281,10 @@  discard block
 block discarded – undo
281 281
                 $outer = "";
282 282
                 $profile->setAnonymousIDSupport(FALSE);
283 283
             } else {
284
-                $outer = $outer . "@";
284
+                $outer = $outer."@";
285 285
                 $profile->setAnonymousIDSupport(TRUE);
286 286
             }
287
-            $profile->setRealm($outer . $realm);
287
+            $profile->setRealm($outer.$realm);
288 288
         }
289 289
         /* const AUXATTRIB_PROFILE_TESTUSER = 'ATTRIB-PROFILE-TESTUSER'; */
290 290
         $testuser = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_TESTUSER);
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
         // extract relevant subset of information from cert objects
532 532
         $certDetails = [];
533 533
         foreach ($certs as $cert) {
534
-            $certDetails[$cert->ca_type . ":" . $cert->serial] = ["ISSUED" => $cert->issued, "EXPIRY" => $cert->expiry, "STATUS" => $cert->status, "DEVICE" => $cert->device, "CN" => $cert->username, "ANNOTATION" => $cert->annotation];
534
+            $certDetails[$cert->ca_type.":".$cert->serial] = ["ISSUED" => $cert->issued, "EXPIRY" => $cert->expiry, "STATUS" => $cert->status, "DEVICE" => $cert->device, "CN" => $cert->username, "ANNOTATION" => $cert->annotation];
535 535
         }
536 536
         $adminApi->returnSuccess($certDetails);
537 537
         break;
Please login to merge, or discard this patch.
web/lib/admin/API.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
     const ACTIONS = [
255 255
         // Inst-level actions.
256 256
         API::ACTION_NEWINST_BY_REF => [
257
-            "REQ" => [API::AUXATTRIB_EXTERNALID,],
257
+            "REQ" => [API::AUXATTRIB_EXTERNALID, ],
258 258
             "OPT" => [
259 259
                 'general:geo_coordinates',
260 260
                 'general:logo_file',
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
             "FLAG" => [],
272 272
         ],
273 273
         API::ACTION_NEWINST => [
274
-            "REQ" => [API::AUXATTRIB_INSTTYPE,], // "IdP", "SP" or "IdPSP"
274
+            "REQ" => [API::AUXATTRIB_INSTTYPE, ], // "IdP", "SP" or "IdPSP"
275 275
             "OPT" => [
276 276
                 'general:instname',
277 277
                 'general:geo_coordinates',
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
     public function scrub($inputJson, $fedObject) {        
491 491
         $optionInstance = \core\Options::instance();
492 492
         $parameters = [];
493
-        $allPossibleAttribs = array_merge(API::ACTIONS[$inputJson['ACTION']]['REQ'], API::ACTIONS[$inputJson['ACTION']]['OPT'],  API::ACTIONS[$inputJson['ACTION']]['FLAG']);
493
+        $allPossibleAttribs = array_merge(API::ACTIONS[$inputJson['ACTION']]['REQ'], API::ACTIONS[$inputJson['ACTION']]['OPT'], API::ACTIONS[$inputJson['ACTION']]['FLAG']);
494 494
         // some actions don't need parameters. Don't get excited when there aren't any.
495 495
         if (!isset($inputJson['PARAMETERS'])) {
496 496
             $inputJson['PARAMETERS'] = [];
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
                         break;
534 534
                 }   
535 535
             } elseif (preg_match("/^FLAG-/", $oneIncomingParam['NAME'])) {
536
-                if ($oneIncomingParam['VALUE'] != "TRUE" && $oneIncomingParam['VALUE'] != "FALSE" ) {
536
+                if ($oneIncomingParam['VALUE'] != "TRUE" && $oneIncomingParam['VALUE'] != "FALSE") {
537 537
                     continue;
538 538
                 }
539 539
             } else {
@@ -591,8 +591,8 @@  discard block
 block discarded – undo
591 591
 
592 592
                 case \core\Options::TYPECODE_COORDINATES:
593 593
                     $extension = \core\Options::TYPECODE_TEXT;
594
-                    $coercedInline["option"][$basename] = $oneAttrib['NAME'] . "#";
595
-                    $coercedInline["value"][$basename . "-" . $extension] = $oneAttrib['VALUE'];
594
+                    $coercedInline["option"][$basename] = $oneAttrib['NAME']."#";
595
+                    $coercedInline["value"][$basename."-".$extension] = $oneAttrib['VALUE'];
596 596
                     break;
597 597
                 case \core\Options::TYPECODE_TEXT:
598 598
                 // Fall-through: they all get the same treatment.
@@ -602,18 +602,18 @@  discard block
 block discarded – undo
602 602
                 // Fall-through: they all get the same treatment.
603 603
                 case \core\Options::TYPECODE_INTEGER:
604 604
                     $extension = $optionInfo['type'];
605
-                    $coercedInline["option"][$basename] = $oneAttrib['NAME'] . "#";
606
-                    $coercedInline["value"][$basename . "-" . $extension] = $oneAttrib['VALUE'];
605
+                    $coercedInline["option"][$basename] = $oneAttrib['NAME']."#";
606
+                    $coercedInline["value"][$basename."-".$extension] = $oneAttrib['VALUE'];
607 607
                     if ($optionInfo['flag'] == "ML") {
608
-                        $coercedInline["value"][$basename . "-lang"] = $oneAttrib['LANG'];
608
+                        $coercedInline["value"][$basename."-lang"] = $oneAttrib['LANG'];
609 609
                     }
610 610
                     break;
611 611
                 case \core\Options::TYPECODE_FILE:
612 612
                     // Binary data is expected in base64 encoding. This is true also for PEM files!
613 613
                     $extension = $optionInfo['type'];
614
-                    $coercedInline["option"][$basename] = $oneAttrib['NAME'] . "#";
615
-                    file_put_contents($dir['dir'] . "/" . $basename . "-" . $extension, base64_decode($oneAttrib['VALUE']));
616
-                    $coercedFile["value"]['tmp_name'][$basename . "-" . $extension] = $dir['dir'] . "/" . $basename . "-" . $extension;
614
+                    $coercedInline["option"][$basename] = $oneAttrib['NAME']."#";
615
+                    file_put_contents($dir['dir']."/".$basename."-".$extension, base64_decode($oneAttrib['VALUE']));
616
+                    $coercedFile["value"]['tmp_name'][$basename."-".$extension] = $dir['dir']."/".$basename."-".$extension;
617 617
                     break;
618 618
                 default:
619 619
                     throw new Exception("We don't seem to know this type code!");
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
     public function returnSuccess($details) {
643 643
         $output = json_encode(["result" => "SUCCESS", "details" => $details], JSON_PRETTY_PRINT);
644 644
         if ($output === FALSE) {
645
-            $this->returnError(API::ERROR_INTERNAL_ERROR, "Unable to JSON encode return data: ". json_last_error(). " - ". json_last_error_msg());
645
+            $this->returnError(API::ERROR_INTERNAL_ERROR, "Unable to JSON encode return data: ".json_last_error()." - ".json_last_error_msg());
646 646
         }
647 647
         else {
648 648
             echo $output;
Please login to merge, or discard this patch.
core/Federation.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
                 } else { // this device has stats, but doesn't exist in current config. We don't even know its display name, so display its raw representation
104 104
                     $displayName = sprintf(_("(discontinued) %s"), $queryResult->dev_id);
105 105
                 }
106
-                if (! isset($dataArray[$inst_id])) {
106
+                if (!isset($dataArray[$inst_id])) {
107 107
                     $dataArray[$inst_id] = [];
108 108
                 }
109 109
             }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
                 $dataArray[$inst_id][$displayName] = ["ADMIN" => $queryResult->dl_admin, "SILVERBULLET" => $queryResult->dl_sb, "USER" => $queryResult->dl_user];
112 112
             } elseif ($detail === 'PROFILES') {
113 113
                 $profile_id = $queryResult->profile_id;
114
-                if (! isset($dataArray[$inst_id][$profile_id])) {
114
+                if (!isset($dataArray[$inst_id][$profile_id])) {
115 115
                     $dataArray[$inst_id][$profile_id] = [];
116 116
                 }
117 117
                 $dataArray[$inst_id][$profile_id][$displayName] = ["ADMIN" => $queryResult->dl_admin, "SILVERBULLET" => $queryResult->dl_sb, "USER" => $queryResult->dl_user];
@@ -160,20 +160,20 @@  discard block
 block discarded – undo
160 160
                     if ($device == "TOTAL") {
161 161
                         continue;
162 162
                     }
163
-                    $retstring .= "<tr><td>$device</td><td>" . $numbers['ADMIN'] . "</td><td>" . $numbers['SILVERBULLET'] . "</td><td>" . $numbers['USER'] . "</td></tr>";
163
+                    $retstring .= "<tr><td>$device</td><td>".$numbers['ADMIN']."</td><td>".$numbers['SILVERBULLET']."</td><td>".$numbers['USER']."</td></tr>";
164 164
                 }
165
-                $retstring .= "<tr><td><strong>TOTAL</strong></td><td><strong>" . $data['TOTAL']['ADMIN'] . "</strong></td><td><strong>" . $data['TOTAL']['SILVERBULLET'] . "</strong></td><td><strong>" . $data['TOTAL']['USER'] . "</strong></td></tr>";
165
+                $retstring .= "<tr><td><strong>TOTAL</strong></td><td><strong>".$data['TOTAL']['ADMIN']."</strong></td><td><strong>".$data['TOTAL']['SILVERBULLET']."</strong></td><td><strong>".$data['TOTAL']['USER']."</strong></td></tr>";
166 166
                 break;
167 167
             case "XML":
168 168
                 // the calls to date() operate on current date, so there is no chance for a FALSE to be returned. Silencing scrutinizer.
169
-                $retstring .= "<federation id='$this->tld' ts='" . /** @scrutinizer ignore-type */ date("Y-m-d") . "T" . /** @scrutinizer ignore-type */ date("H:i:s") . "'>\n";
169
+                $retstring .= "<federation id='$this->tld' ts='"./** @scrutinizer ignore-type */ date("Y-m-d")."T"./** @scrutinizer ignore-type */ date("H:i:s")."'>\n";
170 170
                 foreach ($data as $device => $numbers) {
171 171
                     if ($device == "TOTAL") {
172 172
                         continue;
173 173
                     }
174
-                    $retstring .= "  <device name='" . $device . "'>\n    <downloads group='admin'>" . $numbers['ADMIN'] . "</downloads>\n    <downloads group='managed_idp'>" . $numbers['SILVERBULLET'] . "</downloads>\n    <downloads group='user'>" . $numbers['USER'] . "</downloads>\n  </device>";
174
+                    $retstring .= "  <device name='".$device."'>\n    <downloads group='admin'>".$numbers['ADMIN']."</downloads>\n    <downloads group='managed_idp'>".$numbers['SILVERBULLET']."</downloads>\n    <downloads group='user'>".$numbers['USER']."</downloads>\n  </device>";
175 175
                 }
176
-                $retstring .= "<total>\n  <downloads group='admin'>" . $data['TOTAL']['ADMIN'] . "</downloads>\n  <downloads group='managed_idp'>" . $data['TOTAL']['SILVERBULLET'] . "</downloads>\n  <downloads group='user'>" . $data['TOTAL']['USER'] . "</downloads>\n</total>\n";
176
+                $retstring .= "<total>\n  <downloads group='admin'>".$data['TOTAL']['ADMIN']."</downloads>\n  <downloads group='managed_idp'>".$data['TOTAL']['SILVERBULLET']."</downloads>\n  <downloads group='user'>".$data['TOTAL']['USER']."</downloads>\n</total>\n";
177 177
                 $retstring .= "</federation>";
178 178
                 break;
179 179
             case "array":
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
         $identifier = $this->databaseHandle->lastID();
274 274
 
275 275
         if ($identifier == 0 || !$this->loggerInstance->writeAudit($ownerId, "NEW", "Organisation $identifier")) {
276
-            $text = "<p>Could not create a new " . common\Entity::$nomenclature_participant . "!</p>";
276
+            $text = "<p>Could not create a new ".common\Entity::$nomenclature_participant."!</p>";
277 277
             echo $text;
278 278
             throw new Exception($text);
279 279
         }
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
             return; // no update to fetch
418 418
         }
419 419
         $certDetails = openssl_x509_parse($entryInQuestion['CERT']);
420
-        $expiry = "20" . $certDetails['validTo'][0] . $certDetails['validTo'][1] . "-" . $certDetails['validTo'][2] . $certDetails['validTo'][3] . "-" . $certDetails['validTo'][4] . $certDetails['validTo'][5];
420
+        $expiry = "20".$certDetails['validTo'][0].$certDetails['validTo'][1]."-".$certDetails['validTo'][2].$certDetails['validTo'][3]."-".$certDetails['validTo'][4].$certDetails['validTo'][5];
421 421
         openssl_x509_export($entryInQuestion['CERT'], $pem);
422 422
         $updateQuery = "UPDATE federation_servercerts SET status = 'ISSUED', certificate = ?, expiry = ? WHERE ca_name = 'eduPKI' AND request_serial = ?";
423 423
         $this->databaseHandle->exec($updateQuery, "ssi", $pem, $expiry, $reqSerial);
Please login to merge, or discard this patch.