Test Setup Failed
Push — master ( 382c09...be5cf0 )
by Maja
08:55
created
utils/UpdateFromMonitor.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  * update the local copy
25 25
  */
26 26
 namespace utils;
27
-require_once dirname(dirname(__FILE__)) . "/config/_config.php";
27
+require_once dirname(dirname(__FILE__))."/config/_config.php";
28 28
 
29 29
 setlocale(LC_CTYPE, "en_US.UTF-8");
30 30
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         $this->db_ext->query("SET NAMES 'utf8'");
99 99
         $this->db_local->query("SET NAMES 'utf8mb4'");
100 100
         $result = $this->db_ext->query("SELECT * FROM $table");
101
-        $queryFields = implode(',', array_column($this->fields[$db][$table_name],0));
101
+        $queryFields = implode(',', array_column($this->fields[$db][$table_name], 0));
102 102
         while ($row = $result->fetch_assoc()) {
103 103
             $v = [];
104 104
             foreach ($this->fields[$db][$table_name] as $field) {
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
                     }
117 117
                 }
118 118
             }
119
-            $queryValues = implode(',',$v);
119
+            $queryValues = implode(',', $v);
120 120
             $query = "INSERT INTO $tmpTable (".$queryFields.") VALUES (".$queryValues.")";
121 121
             $this->db_local->query($query);
122 122
         }
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
             $realms = explode(',', $row[1]);
135 135
             foreach ($contacts as $contact) {
136 136
                 foreach ($realms as $realm) {
137
-                    $email = empty($contact['mail']) ? 'NULL' :'"'.$contact['mail'].'"';
138
-                    $name = empty($contact['name']) ? 'NULL' :'"'.$contact['name'].'"';
139
-                    $phone = empty($contact['phone']) ? 'NULL' :'"'.$contact['phone'].'"';
137
+                    $email = empty($contact['mail']) ? 'NULL' : '"'.$contact['mail'].'"';
138
+                    $name = empty($contact['name']) ? 'NULL' : '"'.$contact['name'].'"';
139
+                    $phone = empty($contact['phone']) ? 'NULL' : '"'.$contact['phone'].'"';
140 140
                     $id = '"'.$row[2].'"';
141 141
                     $ROid = '"'.$row[3].'"';
142 142
                     $query = "INSERT INTO tmp_institution_admins (name, email, phone, inst_realm, instid, ROid)"
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
     }
162 162
 
163 163
     private function escape($inp) {
164
-        $out=str_replace('\\','\\\\',$inp);
165
-        $out=str_replace('"','\"',$out);
166
-        $out=str_replace('?','\?',$out);
164
+        $out = str_replace('\\', '\\\\', $inp);
165
+        $out = str_replace('"', '\"', $out);
166
+        $out = str_replace('?', '\?', $out);
167 167
         $out = 'convert(cast(convert("'.$out.'" using latin1) as binary) using utf8)';
168 168
         return($out);
169 169
     }
Please login to merge, or discard this patch.
config/autoloader.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  *          <base_url>/copyright.php after deploying the software
20 20
  */
21 21
 
22
-require_once __DIR__ . "/../core/Psr4Autoloader.php";
22
+require_once __DIR__."/../core/Psr4Autoloader.php";
23 23
 use core\autoloader\Psr4Autoloader;
24 24
 
25 25
 // instantiate the loader
@@ -30,12 +30,12 @@  discard block
 block discarded – undo
30 30
 
31 31
 // register the base directories for the namespace prefix
32 32
 // include configuration
33
-$loader->addNamespace('config', __DIR__ );
33
+$loader->addNamespace('config', __DIR__);
34 34
 // include CAT/core library
35
-$loader->addNamespace('core', __DIR__ . "/../core");
35
+$loader->addNamespace('core', __DIR__."/../core");
36 36
 // include CAT/devices library
37
-$loader->addNamespace('devices', __DIR__ . "/../devices");
37
+$loader->addNamespace('devices', __DIR__."/../devices");
38 38
 // include CAT/web library
39
-$loader->addNamespace('web', __DIR__ . "/../web");
39
+$loader->addNamespace('web', __DIR__."/../web");
40 40
 // include CAT/utils
41
-$loader->addNamespace('utils', __DIR__ . "/../utils");
41
+$loader->addNamespace('utils', __DIR__."/../utils");
Please login to merge, or discard this patch.
docker/MSP/web/html/lib.inc 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -2,12 +2,12 @@
 block discarded – undo
2 2
 define('SOCKET', '/opt/Socket/CAT_requests/queue');
3 3
 
4 4
 function cat_socket($obj) {
5
-   $sock = socket_create(AF_UNIX, SOCK_STREAM, 0);
6
-   $conn = socket_connect($sock, SOCKET);
7
-   if ( $conn ) {
8
-     socket_write ($sock, $obj, strlen($obj));
9
-     $out = socket_read ($sock, 2048);
10
-     return $out;
11
-   }
12
-   return 'FAILURE';
5
+    $sock = socket_create(AF_UNIX, SOCK_STREAM, 0);
6
+    $conn = socket_connect($sock, SOCKET);
7
+    if ( $conn ) {
8
+        socket_write ($sock, $obj, strlen($obj));
9
+        $out = socket_read ($sock, 2048);
10
+        return $out;
11
+    }
12
+    return 'FAILURE';
13 13
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,9 +6,9 @@
 block discarded – undo
6 6
 function cat_socket($obj) {
7 7
    $sock = socket_create(AF_UNIX, SOCK_STREAM, 0);
8 8
    $conn = socket_connect($sock, SOCKET);
9
-   if ( $conn ) {
10
-     socket_write ($sock, $obj, strlen($obj));
11
-     $out = socket_read ($sock, 2048);
9
+   if ($conn) {
10
+     socket_write($sock, $obj, strlen($obj));
11
+     $out = socket_read($sock, 2048);
12 12
      return $out;
13 13
    }
14 14
    return 'FAILURE';
Please login to merge, or discard this patch.
core/CertificationAuthorityEduPkiServer.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
     public function __construct()
36 36
     {
37 37
             
38
-        if ( \config\ConfAssistant::eduPKI['testing'] === true ) {
39
-            $this->locationRaCert = ROOT . "/config/SilverbulletClientCerts/edupki-test-ra.pem";
40
-            $this->locationRaKey = ROOT . "/config/SilverbulletClientCerts/edupki-test-ra.clearkey";
41
-            $this->locationWebRoot = ROOT . "/config/SilverbulletClientCerts/eduPKI-webserver-root.pem";
38
+        if (\config\ConfAssistant::eduPKI['testing'] === true) {
39
+            $this->locationRaCert = ROOT."/config/SilverbulletClientCerts/edupki-test-ra.pem";
40
+            $this->locationRaKey = ROOT."/config/SilverbulletClientCerts/edupki-test-ra.clearkey";
41
+            $this->locationWebRoot = ROOT."/config/SilverbulletClientCerts/eduPKI-webserver-root.pem";
42 42
             $this->eduPkiRaId = 700;
43 43
             $this->eduPkiCertProfileBoth = "Radius Server SOAP";
44 44
             $this->eduPkiCertProfileIdp = "Radius Server SOAP";
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
             $this->eduPkiEndpointPublic = "https://pki.edupki.org/edupki-test-ca/cgi-bin/pub/soap?wsdl=1";
48 48
             $this->eduPkiEndpointRa = "https://ra.edupki.org/edupki-test-ca/cgi-bin/ra/soap?wsdl=1";
49 49
         } else {
50
-            $this->locationRaCert = ROOT . "/config/SilverbulletClientCerts/edupki-prod-ra.pem";
51
-            $this->locationRaKey = ROOT . "/config/SilverbulletClientCerts/edupki-prod-ra.clearkey";
52
-            $this->locationWebRoot = ROOT . "/config/SilverbulletClientCerts/eduPKI-webserver-root.pem";
50
+            $this->locationRaCert = ROOT."/config/SilverbulletClientCerts/edupki-prod-ra.pem";
51
+            $this->locationRaKey = ROOT."/config/SilverbulletClientCerts/edupki-prod-ra.clearkey";
52
+            $this->locationWebRoot = ROOT."/config/SilverbulletClientCerts/eduPKI-webserver-root.pem";
53 53
             $this->eduPkiRaId = 100;
54 54
             $this->eduPkiCertProfileBoth = "eduroam IdP and SP";
55 55
             $this->eduPkiCertProfileIdp = "eduroam IdP";
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
         parent::__construct();
64 64
 
65 65
         if (stat($this->locationRaCert) === FALSE) {
66
-            throw new Exception("RA operator PEM file not found: " . $this->locationRaCert);
66
+            throw new Exception("RA operator PEM file not found: ".$this->locationRaCert);
67 67
         }
68 68
         if (stat($this->locationRaKey) === FALSE) {
69
-            throw new Exception("RA operator private key file not found: " . $this->locationRaKey);
69
+            throw new Exception("RA operator private key file not found: ".$this->locationRaKey);
70 70
         }
71 71
         if (stat($this->locationWebRoot) === FALSE) {
72
-            throw new Exception("CA website root CA file not found: " . $this->locationWebRoot);
72
+            throw new Exception("CA website root CA file not found: ".$this->locationWebRoot);
73 73
         }
74 74
     }
75 75
 
@@ -136,26 +136,26 @@  discard block
 block discarded – undo
136 136
                 throw new Exception("Unexpected policies requested.");
137 137
             }
138 138
             $altArray = [# Array mit den Subject Alternative Names
139
-                "email:" . $csr["USERMAIL"]
139
+                "email:".$csr["USERMAIL"]
140 140
             ];
141 141
             foreach ($csr["ALTNAMES"] as $oneAltName) {
142 142
                 if (!empty($oneAltName) && preg_match('/(?=^.{1,254}$)(^(?:(?!\d|-)[a-z0-9\-]{1,63}(?<!-)\.)+(?:[a-z]{2,})$)/i', $oneAltName) > 0) {
143
-                    $altArray[] = "DNS:" . $oneAltName;
143
+                    $altArray[] = "DNS:".$oneAltName;
144 144
                 } else {
145
-                    $altArray[] = "IP:" . $oneAltName;
145
+                    $altArray[] = "IP:".$oneAltName;
146 146
                 }
147 147
             }
148 148
             $soapPub = $this->initEduPKISoapSession("PUBLIC");
149 149
             $this->loggerInstance->debug(5, "FIRST ACTUAL SOAP REQUEST (Public, newRequest)!\n");
150
-            $this->loggerInstance->debug(5, "PARAM_1: " . $this->eduPkiRaId . "\n");
151
-            $this->loggerInstance->debug(5, "PARAM_2: " . $csr["CSR_STRING"] . "\n");
150
+            $this->loggerInstance->debug(5, "PARAM_1: ".$this->eduPkiRaId."\n");
151
+            $this->loggerInstance->debug(5, "PARAM_2: ".$csr["CSR_STRING"]."\n");
152 152
             $this->loggerInstance->debug(5, "PARAM_3: ");
153 153
             $this->loggerInstance->debug(5, $altArray);
154
-            $this->loggerInstance->debug(5, "PARAM_4: " . $profile . "\n");
155
-            $this->loggerInstance->debug(5, "PARAM_5: " . sha1("notused") . "\n");
156
-            $this->loggerInstance->debug(5, "PARAM_6: " . $csr["USERNAME"] . "\n");
157
-            $this->loggerInstance->debug(5, "PARAM_7: " . $csr["USERMAIL"] . "\n");
158
-            $this->loggerInstance->debug(5, "PARAM_8: " . ProfileSilverbullet::PRODUCTNAME . "\n");
154
+            $this->loggerInstance->debug(5, "PARAM_4: ".$profile."\n");
155
+            $this->loggerInstance->debug(5, "PARAM_5: ".sha1("notused")."\n");
156
+            $this->loggerInstance->debug(5, "PARAM_6: ".$csr["USERNAME"]."\n");
157
+            $this->loggerInstance->debug(5, "PARAM_7: ".$csr["USERMAIL"]."\n");
158
+            $this->loggerInstance->debug(5, "PARAM_8: ".ProfileSilverbullet::PRODUCTNAME."\n");
159 159
             $this->loggerInstance->debug(5, "PARAM_9: false\n");
160 160
             
161 161
             $soapNewRequest = $soapPub->newRequest(
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
                 #}\n");
186 186
                 return 0;
187 187
             }
188
-            throw new Exception("Something odd happened while doing the SOAP request:" . $e->getMessage());
188
+            throw new Exception("Something odd happened while doing the SOAP request:".$e->getMessage());
189 189
         }
190 190
         try {
191 191
             $soap = $this->initEduPKISoapSession("RA");
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
             // for obnoxious reasons, we have to dump the request into a file and let pkcs7_sign read from the file
218 218
             // rather than just using the string. Grr.
219 219
             $tempdir = \core\common\Entity::createTemporaryDirectory("test");
220
-            file_put_contents($tempdir['dir'] . "/content.txt", $soapCleartext);
220
+            file_put_contents($tempdir['dir']."/content.txt", $soapCleartext);
221 221
             // retrieve our RA cert from filesystem                    
222 222
             // the RA certificates are not needed right now because we
223 223
             // have resorted to S/MIME signatures with openssl command-line
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
             // sign the data, using cmdline because openssl_pkcs7_sign produces strange results
230 230
             // -binary didn't help, nor switch -md to sha1 sha256 or sha512
231 231
             $this->loggerInstance->debug(2, "Actual content to be signed is this:\n  $soapCleartext\n");
232
-            $execCmd = \config\Master::PATHS['openssl'] . " smime -sign -binary -in " . $tempdir['dir'] . "/content.txt -out " . $tempdir['dir'] . "/signature.txt -outform pem -inkey " . $this->locationRaKey . " -signer " . $this->locationRaCert;
232
+            $execCmd = \config\Master::PATHS['openssl']." smime -sign -binary -in ".$tempdir['dir']."/content.txt -out ".$tempdir['dir']."/signature.txt -outform pem -inkey ".$this->locationRaKey." -signer ".$this->locationRaCert;
233 233
             $this->loggerInstance->debug(2, "Calling openssl smime with following cmdline:   $execCmd\n");
234 234
             $output = [];
235 235
             $return = 999;
@@ -238,21 +238,21 @@  discard block
 block discarded – undo
238 238
                 throw new Exception("Non-zero return value from openssl smime!");
239 239
             }
240 240
             // and get the signature blob back from the filesystem
241
-            $detachedSig = trim(file_get_contents($tempdir['dir'] . "/signature.txt"));
241
+            $detachedSig = trim(file_get_contents($tempdir['dir']."/signature.txt"));
242 242
             $this->loggerInstance->debug(5, "Request for server approveRequest has parameters:\n");
243
-            $this->loggerInstance->debug(5, $soapReqnum . "\n");
244
-            $this->loggerInstance->debug(5, $soapCleartext . "\n"); // PHP magically encodes this as base64 while sending!
245
-            $this->loggerInstance->debug(5, $detachedSig . "\n");
243
+            $this->loggerInstance->debug(5, $soapReqnum."\n");
244
+            $this->loggerInstance->debug(5, $soapCleartext."\n"); // PHP magically encodes this as base64 while sending!
245
+            $this->loggerInstance->debug(5, $detachedSig."\n");
246 246
             $soapIssueCert = $soap->approveRequest($soapReqnum, $soapCleartext, $detachedSig);
247
-            $this->loggerInstance->debug(5, "approveRequest Request was: \n" . $soap->__getLastRequest());
248
-            $this->loggerInstance->debug(5, "approveRequest Response was: \n" . $soap->__getLastResponse());
247
+            $this->loggerInstance->debug(5, "approveRequest Request was: \n".$soap->__getLastRequest());
248
+            $this->loggerInstance->debug(5, "approveRequest Response was: \n".$soap->__getLastResponse());
249 249
             if ($soapIssueCert === FALSE) {
250 250
                 throw new Exception("The locally approved request was NOT processed by the CA.");
251 251
             }
252 252
         } catch (SoapFault $e) {
253
-            throw new Exception("SoapFault: Error when sending or receiving SOAP message: " . "{$e->faultcode}: {$e->faultname}: {$e->faultstring}: {$e->faultactor}: {$e->detail}: {$e->headerfault}\n");
253
+            throw new Exception("SoapFault: Error when sending or receiving SOAP message: "."{$e->faultcode}: {$e->faultname}: {$e->faultstring}: {$e->faultactor}: {$e->detail}: {$e->headerfault}\n");
254 254
         } catch (Exception $e) {
255
-            throw new Exception("Exception: Something odd happened between the SOAP requests:" . $e->getMessage());
255
+            throw new Exception("Exception: Something odd happened between the SOAP requests:".$e->getMessage());
256 256
         }
257 257
         return $soapReqnum;
258 258
     }
@@ -304,9 +304,9 @@  discard block
 block discarded – undo
304 304
                 throw new Exception("CAInfo has no root certificate for us!");
305 305
             }
306 306
         } catch (SoapFault $e) {
307
-            throw new Exception("SoapFault: Error when sending or receiving SOAP message: " . "{$e->faultcode}: {$e->faultname}: {$e->faultstring}: {$e->faultactor}: {$e->detail}: {$e->headerfault}\n");
307
+            throw new Exception("SoapFault: Error when sending or receiving SOAP message: "."{$e->faultcode}: {$e->faultname}: {$e->faultstring}: {$e->faultactor}: {$e->detail}: {$e->headerfault}\n");
308 308
         } catch (Exception $e) {
309
-            throw new Exception("Exception: Something odd happened between the SOAP requests:" . $e->getMessage());
309
+            throw new Exception("Exception: Something odd happened between the SOAP requests:".$e->getMessage());
310 310
         }
311 311
         return [
312 312
             "CERT" => openssl_x509_read($parsedCert['pem']),
@@ -339,12 +339,12 @@  discard block
 block discarded – undo
339 339
             // for obnoxious reasons, we have to dump the request into a file and let pkcs7_sign read from the file
340 340
             // rather than just using the string. Grr.
341 341
             $tempdir = \core\common\Entity::createTemporaryDirectory("test");
342
-            file_put_contents($tempdir['dir'] . "/content.txt", $soapRawRevRequest);
342
+            file_put_contents($tempdir['dir']."/content.txt", $soapRawRevRequest);
343 343
             // retrieve our RA cert from filesystem
344 344
             // sign the data, using cmdline because openssl_pkcs7_sign produces strange results
345 345
             // -binary didn't help, nor switch -md to sha1 sha256 or sha512
346 346
             $this->loggerInstance->debug(5, "Actual content to be signed is this:\n$soapRawRevRequest\n");
347
-        $execCmd = \config\Master::PATHS['openssl'] . " smime -sign -binary -in " . $tempdir['dir'] . "/content.txt -out " . $tempdir['dir'] . "/signature.txt -outform pem -inkey " . $this->locationRaKey . " -signer " . $this->locationRaCert;
347
+        $execCmd = \config\Master::PATHS['openssl']." smime -sign -binary -in ".$tempdir['dir']."/content.txt -out ".$tempdir['dir']."/signature.txt -outform pem -inkey ".$this->locationRaKey." -signer ".$this->locationRaCert;
348 348
             $this->loggerInstance->debug(2, "Calling openssl smime with following cmdline: $execCmd\n");
349 349
             $output = [];
350 350
             $return = 999;
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
                 throw new Exception("Non-zero return value from openssl smime!");
354 354
             }
355 355
             // and get the signature blob back from the filesystem
356
-            $detachedSig = trim(file_get_contents($tempdir['dir'] . "/signature.txt"));
356
+            $detachedSig = trim(file_get_contents($tempdir['dir']."/signature.txt"));
357 357
             $soapIssueRev = $soap->approveRevocationRequest($soapRevocationSerial, $soapRawRevRequest, $detachedSig);
358 358
             if ($soapIssueRev === FALSE) {
359 359
                 throw new Exception("The locally approved revocation request was NOT processed by the CA.");
@@ -361,9 +361,9 @@  discard block
 block discarded – undo
361 361
         } catch (Exception $e) {
362 362
             // PHP 7.1 can do this much better
363 363
             if (is_soap_fault($e)) {
364
-                throw new Exception("Error when sending SOAP request: " . "{$e->faultcode}: {$e->faultstring}\n");
364
+                throw new Exception("Error when sending SOAP request: "."{$e->faultcode}: {$e->faultstring}\n");
365 365
             }
366
-            throw new Exception("Something odd happened while doing the SOAP request:" . $e->getMessage());
366
+            throw new Exception("Something odd happened while doing the SOAP request:".$e->getMessage());
367 367
         }
368 368
     }
369 369
 
@@ -465,9 +465,9 @@  discard block
 block discarded – undo
465 465
      */
466 466
     public function soapToXmlInteger($x)
467 467
     {
468
-        return '<' . $x[0] . '>'
468
+        return '<'.$x[0].'>'
469 469
                 . htmlentities($x[1], ENT_NOQUOTES | ENT_XML1)
470
-                . '</' . $x[0] . '>';
470
+                . '</'.$x[0].'>';
471 471
     }
472 472
 
473 473
     /**
@@ -486,9 +486,9 @@  discard block
 block discarded – undo
486 486
         // dump private key into directory
487 487
         $outstring = "";
488 488
         openssl_pkey_export($privateKey, $outstring);
489
-        file_put_contents($tempdir . "/pkey.pem", $outstring);
489
+        file_put_contents($tempdir."/pkey.pem", $outstring);
490 490
         // PHP can only do one DC in the Subject. But we need three.
491
-        $execCmd = \config\Master::PATHS['openssl'] . " req -new -sha256 -key $tempdir/pkey.pem -out $tempdir/request.csr -subj /DC=test/DC=test/DC=eduroam/C=$fed/O=" . \config\ConfAssistant::CONSORTIUM['name'] . "/OU=$fed/CN=$username/emailAddress=$username";
491
+        $execCmd = \config\Master::PATHS['openssl']." req -new -sha256 -key $tempdir/pkey.pem -out $tempdir/request.csr -subj /DC=test/DC=test/DC=eduroam/C=$fed/O=".\config\ConfAssistant::CONSORTIUM['name']."/OU=$fed/CN=$username/emailAddress=$username";
492 492
         $this->loggerInstance->debug(2, "Calling openssl req with following cmdline: $execCmd\n");
493 493
         $output = [];
494 494
         $return = 999;
Please login to merge, or discard this patch.
core/ExternalEduroamDBData.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
             return $this->counter;
143 143
         }
144 144
 
145
-        $cachedNumber = @file_get_contents(ROOT . "/var/tmp/cachedSPNumber.serialised");
145
+        $cachedNumber = @file_get_contents(ROOT."/var/tmp/cachedSPNumber.serialised");
146 146
         if ($cachedNumber !== FALSE) {
147 147
             $numberData = unserialize($cachedNumber);
148 148
             $now = new \DateTime();
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         } else { // data in cache is too old or doesn't exist. We really need to ask the database
156 156
             $list = $this->listAllServiceProviders();
157 157
             $this->counter = count($list);
158
-            file_put_contents(ROOT . "/var/tmp/cachedSPNumber.serialised", serialize(["number" => $this->counter, "timestamp" => new \DateTime()]));
158
+            file_put_contents(ROOT."/var/tmp/cachedSPNumber.serialised", serialize(["number" => $this->counter, "timestamp" => new \DateTime()]));
159 159
             return $this->counter;
160 160
         }
161 161
     }
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
         $returnarray = [];
247 247
         $query = "SELECT instid AS id, country, inst_realm as realmlist, name AS collapsed_name, contact AS collapsed_contact, type FROM view_active_institution WHERE country = ?";
248 248
         if ($eduroamDbType !== NULL) {
249
-            $query .= " AND ( type = '" . ExternalEduroamDBData::TYPE_IDPSP . "' OR type = '" . $eduroamDbType . "')";
249
+            $query .= " AND ( type = '".ExternalEduroamDBData::TYPE_IDPSP."' OR type = '".$eduroamDbType."')";
250 250
         }
251 251
         $externals = $this->db->exec($query, "s", $tld);
252 252
         // was a SELECT query, so a resource and not a boolean
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
      * @return array
306 306
      */
307 307
     
308
-    public function listExternalEntitiesByUserEmail($userEmail){
308
+    public function listExternalEntitiesByUserEmail($userEmail) {
309 309
         $out = [];
310 310
         $cat = $this->localDb->dbName;
311 311
         $query = "SELECT DISTINCT view_institution_admins.instid, $cat.institution.inst_id,
@@ -320,10 +320,10 @@  discard block
 block discarded – undo
320 320
             WHERE view_active_institution.type != 2 AND view_institution_admins.email= ?";
321 321
         $externals = $this->db->exec($query, 's', $userEmail);
322 322
         while ($row = $externals->fetch_array()) {
323
-            $external_db_id =  $row[0]; // identifier in eduroam DB
323
+            $external_db_id = $row[0]; // identifier in eduroam DB
324 324
             $inst_id = $row[1]; // identifier in CAT - possibly NULL
325 325
             $country = $row[2]; // country
326
-            $name = $row[3];  // institution name from eduroam DB
326
+            $name = $row[3]; // institution name from eduroam DB
327 327
             $realm = $row[4]; // realms from eduroam DB
328 328
             $type = $row[5]; // institution type from eduroam DB
329 329
             if (!isset($out[$country])) {
@@ -404,19 +404,19 @@  discard block
 block discarded – undo
404 404
      * 
405 405
      * @return array
406 406
      */
407
-    public function listExternalTlsServersInstitution($tld, $include_not_ready=FALSE) {
407
+    public function listExternalTlsServersInstitution($tld, $include_not_ready = FALSE) {
408 408
         $retval = [];
409 409
         // this includes servers of type "staging", which is fine
410 410
         $query = "SELECT ROid, instid, type, inst_name, servers, contacts, ts FROM view_tls_inst WHERE country = ?";
411 411
         if (!$include_not_ready) {
412
-            $query = $query . " AND servers IS NOT NULL AND contacts IS NOT NULL";
412
+            $query = $query." AND servers IS NOT NULL AND contacts IS NOT NULL";
413 413
         }
414 414
         $instServerTransaction = $this->db->exec($query, "s", $tld);
415 415
         while ($instServerResponses = mysqli_fetch_object(/** @scrutinizer ignore-type */ $instServerTransaction)) {
416 416
             $contactList = $this::dissectCollapsedContacts($instServerResponses->contacts);
417 417
             $names = $this->splitNames($instServerResponses->inst_name);
418 418
             $thelanguage = $names[$this->languageInstance->getLang()] ?? $names["en"] ?? array_shift($names);
419
-            $retval[$instServerResponses->ROid . "-". $instServerResponses->instid] = [
419
+            $retval[$instServerResponses->ROid."-".$instServerResponses->instid] = [
420 420
                 "names" => $names,
421 421
                 "name" => $thelanguage,
422 422
                 "type" => array_search($instServerResponses->type, self::TYPE_MAPPING),
Please login to merge, or discard this patch.
core/UserManagement.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
                 } else {
161 161
                     $this->databaseHandle->exec("INSERT INTO ownership (user_id, institution_id, blesslevel, orig_mail) VALUES(?, ?, ?, ?)", "siss", $owner, $catId, $level, $destMail);
162 162
                 }
163
-                common\Logging::writeAudit_s((string) $owner, "OWN", "IdP " . $invitationDetails['cat_institution_id'] . " - added user as owner");
163
+                common\Logging::writeAudit_s((string) $owner, "OWN", "IdP ".$invitationDetails['cat_institution_id']." - added user as owner");
164 164
                 common\Entity::outOfThePotatoes();
165 165
                 return new IdP($invitationDetails['cat_institution_id']);
166 166
             }
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
                 $idp = new IdP($fed->newIdP('TOKEN', $invitationDetails['invite_fortype'], $owner, $invitationDetails['invite_issuer_level'], $invitationDetails['invite_dest_mail'], $bestnameguess));
175 175
                 $idp->addAttribute("general:instname", 'C', $bestnameguess);
176 176
             }
177
-            common\Logging::writeAudit_s($owner, "NEW", "IdP " . $idp->identifier . " - created from invitation");
177
+            common\Logging::writeAudit_s($owner, "NEW", "IdP ".$idp->identifier." - created from invitation");
178 178
 
179 179
             // in case we have more admins in the queue which were invited to 
180 180
             // administer the same inst but haven't redeemed their invitations 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                              WHERE invite_created >= TIMESTAMPADD(DAY, -1, NOW()) AND used = 0 AND name = ? AND country = ? AND ( cat_institution_id IS NULL OR external_db_uniquehandle IS NULL ) ", "ss", $invitationDetails['name'], $invitationDetails['country']);
189 189
             // SELECT -> resource, no boolean
190 190
             while ($pendingDetail = mysqli_fetch_object(/** @scrutinizer ignore-type */ $otherPending)) {
191
-                $this->databaseHandle->exec("UPDATE invitations SET cat_institution_id = " . $idp->identifier . " WHERE id = " . $pendingDetail->id);
191
+                $this->databaseHandle->exec("UPDATE invitations SET cat_institution_id = ".$idp->identifier." WHERE id = ".$pendingDetail->id);
192 192
             }
193 193
             common\Entity::outOfThePotatoes();
194 194
             return $idp;
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
             'invite_dest_mail' => $_SESSION['auth_email'],
214 214
         ];
215 215
         $idp = $this->newIdPFromExternal($extId, $fed, $invitationDetails, $owner, $externalinfo);
216
-        common\Logging::writeAudit_s($owner, "NEW", "IdP " . $idp->identifier . " - created from auto-registration of $extId");
216
+        common\Logging::writeAudit_s($owner, "NEW", "IdP ".$idp->identifier." - created from auto-registration of $extId");
217 217
         return $idp;
218 218
     }
219 219
     
@@ -335,9 +335,9 @@  discard block
 block discarded – undo
335 335
         $retval = [];
336 336
         $invitations = $this->databaseHandle->exec("SELECT cat_institution_id, country, name, invite_issuer_level, invite_dest_mail, invite_token , TIMESTAMPADD(DAY, 1, invite_created) as expiry
337 337
                                         FROM invitations 
338
-                                        WHERE cat_institution_id " . ( $idpIdentifier != 0 ? "= $idpIdentifier" : "IS NULL") . " AND invite_created >= TIMESTAMPADD(DAY, -1, NOW()) AND used = 0");
338
+                                        WHERE cat_institution_id " . ($idpIdentifier != 0 ? "= $idpIdentifier" : "IS NULL")." AND invite_created >= TIMESTAMPADD(DAY, -1, NOW()) AND used = 0");
339 339
         // SELECT -> resource, not boolean
340
-        common\Logging::debug_s(4, "Retrieving pending invitations for " . ($idpIdentifier != 0 ? "IdP $idpIdentifier" : "IdPs awaiting initial creation" ) . ".\n");
340
+        common\Logging::debug_s(4, "Retrieving pending invitations for ".($idpIdentifier != 0 ? "IdP $idpIdentifier" : "IdPs awaiting initial creation").".\n");
341 341
         while ($invitationQuery = mysqli_fetch_object(/** @scrutinizer ignore-type */ $invitations)) {
342 342
             $retval[] = ["country" => $invitationQuery->country, "name" => $invitationQuery->name, "mail" => $invitationQuery->invite_dest_mail, "token" => $invitationQuery->invite_token, "expiry" => $invitationQuery->expiry];
343 343
         }
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
         // these require no further checking
410 410
         foreach ($extInstListTmp as $country => $extInstCountryList) {
411 411
             $len = count($extInstCountryList);
412
-            for($i = 0; $i < $len; ++$i) {
412
+            for ($i = 0; $i < $len; ++$i) {
413 413
                 $extInst = $extInstCountryList[$i];
414 414
                 if ($extInst['inst_id'] != NULL && in_array($extInst['inst_id'], $this->currentInstitutions['existing'])) {
415 415
                     unset($extInstList[$country][$i]);
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
             $names = $disectedNames['joint'];
501 501
             $realms = ExternalEduroamDBData::dissectCollapsedInstitutionRealms($extInst['realm']);
502 502
             $foundMatch = $this->checkForSimilarInstitutions($names, $realms);
503
-            common\Logging::debug_s(4, $foundMatch, "checkForSimilarInstitutions returned: ","\n");
503
+            common\Logging::debug_s(4, $foundMatch, "checkForSimilarInstitutions returned: ", "\n");
504 504
             if ($foundMatch == 0) {
505 505
                 $this->currentInstitutions['new'][] = [$extInst['external_db_id'], $disectedNames['perlang'], $country];
506 506
             }
Please login to merge, or discard this patch.
core/Federation.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
         if (\config\Master::MAILSETTINGS['notify_nro']) {
368 368
             foreach ($admins as $id) {
369 369
                 $user = new User($id);
370
-                 /// organisation
370
+                    /// organisation
371 371
                 $retval = $user->sendMailToUser(sprintf(_("%s in your federation was created"), common\Entity::$nomenclature_participant), $message);
372 372
                 if ($retval === FALSE) {
373 373
                     $this->loggerInstance->debug(2, "Mail to federation admin was NOT sent!\n");
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
         $newReq = new CertificationAuthorityEduPkiServer();
435 435
         $reqserial = $newReq->sendRequestToCa($csr, $revocationPin, $expiryDays);
436 436
         if ($reqserial > 0) {
437
-             $this->loggerInstance->writeAudit($user, "NEW", "Certificate request - NRO: ".$this->tld." - serial: ".$reqserial." - subject: ".$csr['SUBJECT']);
437
+                $this->loggerInstance->writeAudit($user, "NEW", "Certificate request - NRO: ".$this->tld." - serial: ".$reqserial." - subject: ".$csr['SUBJECT']);
438 438
             $reqQuery = "INSERT INTO federation_servercerts "
439 439
                 ."(federation_id, ca_name, request_serial, distinguished_name, status, revocation_pin) "
440 440
                 ."VALUES (?, 'eduPKI', ?, ?, 'REQUESTED', ?)";
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
         $result = $this->databaseHandle->exec($query);
495 495
         $rows = $result->fetch_all();
496 496
         foreach ($rows as $row) {
497
-           $activeProfiles[] = $row[0];
497
+            $activeProfiles[] = $row[0];
498 498
         }
499 499
         $query = "SELECT institution.inst_id AS inst_id, profile.profile_id AS profile_id, profile_option.option_value AS cert FROM profile_option JOIN profile ON profile_option.profile_id=profile.profile_id JOIN institution ON profile.inst_id=institution.inst_id WHERE profile_option.option_name='eap:ca_file' and institution.country='".$this->tld."'";        
500 500
         $result = $this->databaseHandle->exec($query);
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
                 'country' => strtoupper($idp->federation),
580 580
                 'instance' => $idp,
581 581
                 'realms' => $idpQuery->realms]
582
-                 ;
582
+                    ;
583 583
             $returnarray[$idp->identifier] = $idpInfo;
584 584
         }
585 585
         if ($activeOnly != 0) { // we're only doing this once.
Please login to merge, or discard this patch.
core/common/Logging.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -159,17 +159,17 @@
 block discarded – undo
159 159
         }
160 160
     }
161 161
     
162
-     /**
163
-     * Writes an audit log entry to the audit log file - static version. These audits are semantic logs; they don't record every single modification
164
-     * in the database, but provide a logical "who did what" overview. The exact modification SQL statements are logged
165
-     * automatically with writeSQLAudit() instead. The log file path is configurable in _config.php.
166
-     * 
167
-     * @param string $user     persistent identifier of the user who triggered the action
168
-     * @param string $category type of modification, from the fixed vocabulary: "NEW", "OWN", "MOD", "DEL"
169
-     * @param string $message  message to log into the audit log
170
-     * @return boolean TRUE if successful. Will terminate script execution on failure. 
171
-     * @throws Exception
172
-     */
162
+        /**
163
+         * Writes an audit log entry to the audit log file - static version. These audits are semantic logs; they don't record every single modification
164
+         * in the database, but provide a logical "who did what" overview. The exact modification SQL statements are logged
165
+         * automatically with writeSQLAudit() instead. The log file path is configurable in _config.php.
166
+         * 
167
+         * @param string $user     persistent identifier of the user who triggered the action
168
+         * @param string $category type of modification, from the fixed vocabulary: "NEW", "OWN", "MOD", "DEL"
169
+         * @param string $message  message to log into the audit log
170
+         * @return boolean TRUE if successful. Will terminate script execution on failure. 
171
+         * @throws Exception
172
+         */
173 173
     public static function writeAudit_s($user, $category, $message)
174 174
     {
175 175
         switch ($category) {
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      */
50 50
     private function writeToFile($filename, $message)
51 51
     {
52
-        file_put_contents(\config\Master::PATHS['logdir'] . "/$filename", sprintf("%-015s", microtime(TRUE)) . $message, FILE_APPEND);
52
+        file_put_contents(\config\Master::PATHS['logdir']."/$filename", sprintf("%-015s", microtime(TRUE)).$message, FILE_APPEND);
53 53
     }
54 54
 
55 55
     /**
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      */
62 62
     private static function writeToFile_s($filename, $message)
63 63
     {
64
-        file_put_contents(\config\Master::PATHS['logdir'] . "/$filename", sprintf("%-015s", microtime(TRUE)) . $message, FILE_APPEND);
64
+        file_put_contents(\config\Master::PATHS['logdir']."/$filename", sprintf("%-015s", microtime(TRUE)).$message, FILE_APPEND);
65 65
     }
66 66
     
67 67
     /**
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
             $output .= " [$file / $function / $line] ";
90 90
         }
91 91
         if (is_string($stuff)) {
92
-            $output .= $prefix . $stuff . $suffix;
92
+            $output .= $prefix.$stuff.$suffix;
93 93
         } else {
94
-            $output .= $prefix . var_export($stuff, TRUE) . $suffix;
94
+            $output .= $prefix.var_export($stuff, TRUE).$suffix;
95 95
         }
96 96
         $this->writeToFile("debug.log", $output);
97 97
 
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
             $output .= " [$file / $function / $line] ";
124 124
         }
125 125
         if (is_string($stuff)) {
126
-            $output .= $prefix . $stuff . $suffix;
126
+            $output .= $prefix.$stuff.$suffix;
127 127
         } else {
128
-            $output .= $prefix . var_export($stuff, TRUE) . $suffix;
128
+            $output .= $prefix.var_export($stuff, TRUE).$suffix;
129 129
         }
130 130
         self::writeToFile_s("debug.log", $output);
131 131
         return;
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
         $logTextStep1 = preg_replace("/[\n\r]/", "", $query);
202 202
         $logTextStep2 = preg_replace("/ +/", " ", $logTextStep1);
203 203
         $logTextStep3 = iconv("UTF-8", "UTF-8//IGNORE", $logTextStep2);
204
-        $this->writeToFile("audit-SQL.log", " " . $logTextStep3 . "\n");
204
+        $this->writeToFile("audit-SQL.log", " ".$logTextStep3."\n");
205 205
     }
206 206
     
207 207
     
@@ -219,6 +219,6 @@  discard block
 block discarded – undo
219 219
         $logTextStep1 = preg_replace("/[\n\r]/", "", $query);
220 220
         $logTextStep2 = preg_replace("/ +/", " ", $logTextStep1);
221 221
         $logTextStep3 = iconv("UTF-8", "UTF-8//IGNORE", $logTextStep2);
222
-        self::writeToFile_s("audit-SQL.log", " " . $logTextStep3 . "\n");
222
+        self::writeToFile_s("audit-SQL.log", " ".$logTextStep3."\n");
223 223
     }
224 224
 }
225 225
\ No newline at end of file
Please login to merge, or discard this patch.
core/User.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
             return false;
174 174
         }
175 175
         $entityId = $matches[1];
176
-        $url = \config\Diagnostics::EDUGAINRESOLVER['url'] . "?action=get_entity_name&type=idp&opt=2&e_id=$entityId";
177
-        \core\common\Logging::debug_s(4, $url, "URL: ","\n");
176
+        $url = \config\Diagnostics::EDUGAINRESOLVER['url']."?action=get_entity_name&type=idp&opt=2&e_id=$entityId";
177
+        \core\common\Logging::debug_s(4, $url, "URL: ", "\n");
178 178
         $ch = curl_init($url);
179 179
         if ($ch === false) {
180 180
             $loggerInstance->debug(2, "Unable ask eduGAIN about IdP - CURL init failed!");
@@ -200,10 +200,10 @@  discard block
 block discarded – undo
200 200
             return false;            
201 201
         }
202 202
         if ($responseDetails['name'] === null) {
203
-            \core\common\Logging::debug_s(4,"User not in eduGAIN\n");
203
+            \core\common\Logging::debug_s(4, "User not in eduGAIN\n");
204 204
             return false;            
205 205
         }
206
-        \core\common\Logging::debug_s(4,"User in eduGAIN\n");
206
+        \core\common\Logging::debug_s(4, "User in eduGAIN\n");
207 207
         $_SESSION['eduGAIN'] = $responseDetails['regauth'];
208 208
         return true;
209 209
     }
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
      * @return boolean did it work?
244 244
      */
245 245
     public static function sendMailToCATadmins($subject, $content) {
246
-        if (!isset(\config\Master::APPEARANCE['cat-admin-mail']) ||  \config\Master::APPEARANCE['cat-admin-mail'] === []) {
246
+        if (!isset(\config\Master::APPEARANCE['cat-admin-mail']) || \config\Master::APPEARANCE['cat-admin-mail'] === []) {
247 247
             return;
248 248
         }
249 249
         foreach (\config\Master::APPEARANCE['cat-admin-mail'] as $mailaddr) {
@@ -266,8 +266,8 @@  discard block
 block discarded – undo
266 266
         common\Entity::intoThePotatoes();
267 267
         $mail = \core\common\OutsideComm::mailHandle();
268 268
 // who to whom?
269
-        $mail->FromName = \config\Master::APPEARANCE['productname'] . " Notification System";
270
-        $mail->addReplyTo(\config\Master::APPEARANCE['support-contact']['developer-mail'], \config\Master::APPEARANCE['productname'] . " " . _("Feedback"));
269
+        $mail->FromName = \config\Master::APPEARANCE['productname']." Notification System";
270
+        $mail->addReplyTo(\config\Master::APPEARANCE['support-contact']['developer-mail'], \config\Master::APPEARANCE['productname']." "._("Feedback"));
271 271
         $mail->addAddress($mailaddr);
272 272
 // what do we want to say?
273 273
         $mail->Subject = $subject;
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
                 }
334 334
                 $lookFor .= "$name";
335 335
             }
336
-            $finding = preg_match("/^(" . $lookFor . "):(.*)/", $oneRow->user_id, $matches);
336
+            $finding = preg_match("/^(".$lookFor."):(.*)/", $oneRow->user_id, $matches);
337 337
             if ($finding === 0 || $finding === false) {
338 338
                 return false;
339 339
             }
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
                         $matchedProviders[] = $idp;
353 353
                         $name = $idp;
354 354
                         if ($skipCurl == 0) {
355
-                            $url = \config\Diagnostics::EDUGAINRESOLVER['url'] . "?action=get_entity_name&type=idp&e_id=$idp&lang=$lang";
355
+                            $url = \config\Diagnostics::EDUGAINRESOLVER['url']."?action=get_entity_name&type=idp&e_id=$idp&lang=$lang";
356 356
                             $ch = curl_init($url);
357 357
                             if ($ch === false) {
358 358
                                 $loggerInstance->debug(2, "Unable ask eduGAIN about IdP - CURL init failed!");
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
                             }
378 378
                             curl_close($ch);
379 379
                         }
380
-                        $listOfProviders[] = User::PROVIDER_STRINGS[$providerStrings[0]] . " - IdP: " . $name;
380
+                        $listOfProviders[] = User::PROVIDER_STRINGS[$providerStrings[0]]." - IdP: ".$name;
381 381
                     }
382 382
                     break;
383 383
                 case $providerStrings[2]:
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
                     return false;
394 394
             }
395 395
         }
396
-        \core\common\Logging::debug_s(4,$listOfProviders, "PROVIDERS:\n", "\n");
396
+        \core\common\Logging::debug_s(4, $listOfProviders, "PROVIDERS:\n", "\n");
397 397
         return $listOfProviders;
398 398
     }
399 399
 }
400 400
\ No newline at end of file
Please login to merge, or discard this patch.