Passed
Push — release_2_1 ( 0530b6...7784c3 )
by Stefan
12:22 queued 02:15
created
web/admin/sanity_tests.php 1 patch
Spacing   +2 added lines, -2 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 dirname(dirname(dirname(__FILE__))) . "/config/_config.php";
22
+require_once dirname(dirname(dirname(__FILE__)))."/config/_config.php";
23 23
 
24 24
 $Tests = [
25 25
     'Directories',
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
 $uiElements = new \web\lib\admin\UIElements();
45 45
 
46
-if (\config\Master::FUNCTIONALITY_LOCATIONS['CONFASSISTANT_SILVERBULLET'] == "LOCAL" || \config\Master::FUNCTIONALITY_LOCATIONS['CONFASSISTANT_RADIUS'] == "LOCAL" ) {
46
+if (\config\Master::FUNCTIONALITY_LOCATIONS['CONFASSISTANT_SILVERBULLET'] == "LOCAL" || \config\Master::FUNCTIONALITY_LOCATIONS['CONFASSISTANT_RADIUS'] == "LOCAL") {
47 47
     $Tests[] = 'Makensis';
48 48
     $Tests[] = 'Makensis=>NSISmodules';
49 49
 }
Please login to merge, or discard this patch.
config/Diagnostics-template.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -34,13 +34,13 @@
 block discarded – undo
34 34
  */
35 35
 class Diagnostics
36 36
 {
37
-         /**
38
-         * Various paths.
39
-         * eapol_test: absolute path to the eapol_test executable. If you just fill in "eapol_test" the one from the system $PATH will be taken.
40
-         * c_rehash: absolute path to the c_rehash executable. If you just fill in "c_rehash" the one from the system $PATH will be taken.
41
-         *   See also NSIS_VERSION further down
42
-         * @var array
43
-         */
37
+            /**
38
+             * Various paths.
39
+             * eapol_test: absolute path to the eapol_test executable. If you just fill in "eapol_test" the one from the system $PATH will be taken.
40
+             * c_rehash: absolute path to the c_rehash executable. If you just fill in "c_rehash" the one from the system $PATH will be taken.
41
+             *   See also NSIS_VERSION further down
42
+             * @var array
43
+             */
44 44
         const PATHS = [
45 45
             'c_rehash' => 'c_rehash',
46 46
             'eapol_test' => 'eapol_test',
Please login to merge, or discard this patch.
core/ProfileRADIUS.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 
106 106
         $attributesLowLevel = array_merge($this->deviceLevelAttributes, $this->eapLevelAttributes);
107 107
 
108
-        $this->loggerInstance->debug(5, "Device-Level Attributes: " . /** @scrutinizer ignore-type */ print_r($this->deviceLevelAttributes, true));
109
-        $this->loggerInstance->debug(5, "EAP-Level Attributes: " . /** @scrutinizer ignore-type */ print_r($this->eapLevelAttributes, true));
110
-        $this->loggerInstance->debug(5, "All low-Level Attributes: " . /** @scrutinizer ignore-type */ print_r($attributesLowLevel, true));
108
+        $this->loggerInstance->debug(5, "Device-Level Attributes: "./** @scrutinizer ignore-type */ print_r($this->deviceLevelAttributes, true));
109
+        $this->loggerInstance->debug(5, "EAP-Level Attributes: "./** @scrutinizer ignore-type */ print_r($this->eapLevelAttributes, true));
110
+        $this->loggerInstance->debug(5, "All low-Level Attributes: "./** @scrutinizer ignore-type */ print_r($attributesLowLevel, true));
111 111
 
112 112
         // now fetch and merge profile-level attributes if not already set on deeper level
113 113
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
             }
138 138
         }
139 139
 
140
-        $this->loggerInstance->debug(5, "Merged Attributes: " . /** @scrutinizer ignore-type */ print_r($attributesLowLevel, true));
140
+        $this->loggerInstance->debug(5, "Merged Attributes: "./** @scrutinizer ignore-type */ print_r($attributesLowLevel, true));
141 141
 
142 142
         // now, fetch and merge IdP-wide attributes
143 143
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
         // add the internal attribute to that effect
153 153
         
154 154
         if (isset($this->attributes['media:openroaming_always'])) {
155
-            $this->attributes = array_merge($this->attributes, $this->addInternalAttributes([ "internal:openroaming" => TRUE ] ));
155
+            $this->attributes = array_merge($this->attributes, $this->addInternalAttributes(["internal:openroaming" => TRUE]));
156 156
         }
157 157
         
158 158
         $this->loggerInstance->debug(3, "--- END Constructing new Profile object ... ---\n");
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
                 "row" => $attributeQuery->row,
201 201
                 "flag" => $optinfo['flag'],
202 202
                 "device" => ($devicesOrEAPMethods == "DEVICES" ? $attributeQuery->deviceormethod : NULL),
203
-                "eapmethod" => ($devicesOrEAPMethods == "DEVICES" ? 0 : (new \core\common\EAP($attributeQuery->deviceormethod))->getArrayRep() )];
203
+                "eapmethod" => ($devicesOrEAPMethods == "DEVICES" ? 0 : (new \core\common\EAP($attributeQuery->deviceormethod))->getArrayRep())];
204 204
         }
205 205
         return $temparray;
206 206
     }
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
      */
310 310
     public function setAnonymousIDSupport($shallwe)
311 311
     {
312
-        $this->databaseHandle->exec("UPDATE profile SET use_anon_outer = " . ($shallwe === true ? "1" : "0") . " WHERE profile_id = $this->identifier");
312
+        $this->databaseHandle->exec("UPDATE profile SET use_anon_outer = ".($shallwe === true ? "1" : "0")." WHERE profile_id = $this->identifier");
313 313
     }
314 314
 
315 315
     /** Toggle special username for realm checks
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
      * @return void
320 320
      */
321 321
     public function setRealmCheckUser($shallwe, $localpart = NULL) {
322
-        $this->databaseHandle->exec("UPDATE profile SET checkuser_outer = " . ($shallwe === true ? "1" : "0") . " WHERE profile_id = $this->identifier");
322
+        $this->databaseHandle->exec("UPDATE profile SET checkuser_outer = ".($shallwe === true ? "1" : "0")." WHERE profile_id = $this->identifier");
323 323
         if ($localpart !== NULL) {
324 324
             $this->databaseHandle->exec("UPDATE profile SET checkuser_value = ? WHERE profile_id = $this->identifier", "s", $localpart);
325 325
         }
@@ -334,8 +334,8 @@  discard block
 block discarded – undo
334 334
      */
335 335
     public function setInputVerificationPreference($verify, $hint)
336 336
     {
337
-        $this->databaseHandle->exec("UPDATE profile SET verify_userinput_suffix = " . ($verify === true ? "1" : "0") .
338
-                ", hint_userinput_suffix = " . ($hint === true ? "1" : "0") .
337
+        $this->databaseHandle->exec("UPDATE profile SET verify_userinput_suffix = ".($verify === true ? "1" : "0").
338
+                ", hint_userinput_suffix = ".($hint === true ? "1" : "0").
339 339
                 " WHERE profile_id = $this->identifier");
340 340
     }
341 341
 
Please login to merge, or discard this patch.
core/DBConnection.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -62,24 +62,24 @@  discard block
 block discarded – undo
62 62
             case "EXTERNAL":
63 63
             case "FRONTEND":
64 64
             case "DIAGNOSTICS":
65
-                if (!isset(self::${"instance" . $theDb})) {
65
+                if (!isset(self::${"instance".$theDb})) {
66 66
                     $class = __CLASS__;
67
-                    self::${"instance" . $theDb} = new $class($database);
68
-                    DBConnection::${"instance" . $theDb}->databaseInstance = $theDb;
67
+                    self::${"instance".$theDb} = new $class($database);
68
+                    DBConnection::${"instance".$theDb}->databaseInstance = $theDb;
69 69
                 }
70
-                return self::${"instance" . $theDb};
70
+                return self::${"instance".$theDb};
71 71
             case "RADIUS":
72
-                if (!isset(self::${"instance" . $theDb})) {
72
+                if (!isset(self::${"instance".$theDb})) {
73 73
                     $class = __CLASS__;
74 74
                     foreach (\config\ConfAssistant::DB as $name => $oneRadiusAuthDb) {
75 75
                         $theInstance = new $class($name);
76
-                        self::${"instance" . $theDb}[] = $theInstance;
76
+                        self::${"instance".$theDb}[] = $theInstance;
77 77
                         $theInstance->databaseInstance = $theDb;
78 78
                     }
79 79
                 }
80
-                return self::${"instance" . $theDb};
80
+                return self::${"instance".$theDb};
81 81
             default:
82
-                throw new Exception("This type of database (" . strtoupper($database) . ") is not known!");
82
+                throw new Exception("This type of database (".strtoupper($database).") is not known!");
83 83
         }
84 84
     }
85 85
 
@@ -121,18 +121,18 @@  discard block
 block discarded – undo
121 121
             }
122 122
         }
123 123
         // log exact query to debug log, if log level is at 5
124
-        $this->loggerInstance->debug(5, "DB ATTEMPT: " . $querystring . "\n");
124
+        $this->loggerInstance->debug(5, "DB ATTEMPT: ".$querystring."\n");
125 125
         if ($types !== NULL) {
126
-            $this->loggerInstance->debug(5, "Argument type sequence: $types, parameters are: " . /** @scrutinizer ignore-type */ print_r($arguments, true));
126
+            $this->loggerInstance->debug(5, "Argument type sequence: $types, parameters are: "./** @scrutinizer ignore-type */ print_r($arguments, true));
127 127
         }
128 128
 
129 129
         if ($this->connection->connect_error) {
130
-            throw new Exception("ERROR: Cannot send query to $this->databaseInstance database (no connection, error number" . $this->connection->connect_error . ")!");
130
+            throw new Exception("ERROR: Cannot send query to $this->databaseInstance database (no connection, error number".$this->connection->connect_error.")!");
131 131
         }
132 132
         if ($types === NULL) {
133 133
             $result = $this->connection->query($querystring);
134 134
             if ($result === FALSE) {
135
-                throw new Exception("DB: Unable to execute simple statement! Error was --> " . $this->connection->error . " <--");
135
+                throw new Exception("DB: Unable to execute simple statement! Error was --> ".$this->connection->error." <--");
136 136
             }
137 137
         } else {
138 138
             // fancy! prepared statement with dedicated argument list
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
                 }
149 149
                 $prepResult = $statementObject->prepare($querystring);
150 150
                 if ($prepResult === FALSE) {
151
-                    throw new Exception("DB: Unable to prepare statement! Statement was --> $querystring <--, error was --> " . $statementObject->error . " <--.");
151
+                    throw new Exception("DB: Unable to prepare statement! Statement was --> $querystring <--, error was --> ".$statementObject->error." <--.");
152 152
                 }
153 153
                 $this->preparedStatements[$querystring] = $statementObject;
154 154
             }
@@ -161,11 +161,11 @@  discard block
 block discarded – undo
161 161
             array_unshift($localArray, $types);
162 162
             $retval = call_user_func_array([$statementObject, "bind_param"], $localArray);
163 163
             if ($retval === FALSE) {
164
-                throw new Exception("DB: Unable to bind parameters to prepared statement! Argument array was --> " . var_export($localArray, TRUE) . " <--. Error was --> " . $statementObject->error . " <--");
164
+                throw new Exception("DB: Unable to bind parameters to prepared statement! Argument array was --> ".var_export($localArray, TRUE)." <--. Error was --> ".$statementObject->error." <--");
165 165
             }
166 166
             $result = $statementObject->execute();
167 167
             if ($result === FALSE) {
168
-                throw new Exception("DB: Unable to execute prepared statement! Error was --> " . $statementObject->error . " <--");
168
+                throw new Exception("DB: Unable to execute prepared statement! Error was --> ".$statementObject->error." <--");
169 169
             }
170 170
             $selectResult = $statementObject->get_result();
171 171
             if ($selectResult !== FALSE) {
@@ -175,14 +175,14 @@  discard block
 block discarded – undo
175 175
 
176 176
         // all cases where $result could be FALSE have been caught earlier
177 177
         if ($this->connection->errno) {
178
-            throw new Exception("ERROR: Cannot execute query in $this->databaseInstance database - (hopefully escaped) query was '$querystring', errno was " . $this->connection->errno . "!");
178
+            throw new Exception("ERROR: Cannot execute query in $this->databaseInstance database - (hopefully escaped) query was '$querystring', errno was ".$this->connection->errno."!");
179 179
         }
180 180
 
181 181
 
182 182
         if ($isMoreThanSelect) {
183
-            $this->loggerInstance->writeSQLAudit("[DB: " . strtoupper($this->databaseInstance) . "] " . $querystring);
183
+            $this->loggerInstance->writeSQLAudit("[DB: ".strtoupper($this->databaseInstance)."] ".$querystring);
184 184
             if ($types !== NULL) {
185
-                $this->loggerInstance->writeSQLAudit("Argument type sequence: $types, parameters are: " . /** @scrutinizer ignore-type */ print_r($arguments, true));
185
+                $this->loggerInstance->writeSQLAudit("Argument type sequence: $types, parameters are: "./** @scrutinizer ignore-type */ print_r($arguments, true));
186 186
             }
187 187
         }
188 188
         return $result;
@@ -277,13 +277,13 @@  discard block
 block discarded – undo
277 277
         if (isset(\config\Master::DB[$databaseCapitalised])) {
278 278
             $this->connection = new \mysqli(\config\Master::DB[$databaseCapitalised]['host'], \config\Master::DB[$databaseCapitalised]['user'], \config\Master::DB[$databaseCapitalised]['pass'], \config\Master::DB[$databaseCapitalised]['db']);
279 279
             if ($this->connection->connect_error) {
280
-                throw new Exception("ERROR: Unable to connect to $database database! This is a fatal error, giving up (error number " . $this->connection->connect_errno . ").");
280
+                throw new Exception("ERROR: Unable to connect to $database database! This is a fatal error, giving up (error number ".$this->connection->connect_errno.").");
281 281
             }
282 282
             $this->readOnly = \config\Master::DB[$databaseCapitalised]['readonly'];
283 283
         } else { // one of the RADIUS DBs
284 284
             $this->connection = new \mysqli(\config\ConfAssistant::DB[$databaseCapitalised]['host'], \config\ConfAssistant::DB[$databaseCapitalised]['user'], \config\ConfAssistant::DB[$databaseCapitalised]['pass'], \config\ConfAssistant::DB[$databaseCapitalised]['db']);
285 285
             if ($this->connection->connect_error) {
286
-                throw new Exception("ERROR: Unable to connect to $database database! This is a fatal error, giving up (error number " . $this->connection->connect_errno . ").");
286
+                throw new Exception("ERROR: Unable to connect to $database database! This is a fatal error, giving up (error number ".$this->connection->connect_errno.").");
287 287
             }
288 288
             $this->readOnly = \config\ConfAssistant::DB[$databaseCapitalised]['readonly'];
289 289
         }
Please login to merge, or discard this patch.
core/CertificationAuthorityEmbeddedRSA.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
 class CertificationAuthorityEmbeddedRSA extends EntityWithDBProperties implements CertificationAuthorityInterface
17 17
 {
18 18
 
19
-    private const LOCATION_ROOT_CA = ROOT . "/config/SilverbulletClientCerts/rootca-RSA.pem";
20
-    private const LOCATION_ISSUING_CA = ROOT . "/config/SilverbulletClientCerts/real-RSA.pem";
21
-    private const LOCATION_ISSUING_KEY = ROOT . "/config/SilverbulletClientCerts/real-RSA.key";
22
-    private const LOCATION_CONFIG = ROOT . "/config/SilverbulletClientCerts/openssl-RSA.cnf";
19
+    private const LOCATION_ROOT_CA = ROOT."/config/SilverbulletClientCerts/rootca-RSA.pem";
20
+    private const LOCATION_ISSUING_CA = ROOT."/config/SilverbulletClientCerts/real-RSA.pem";
21
+    private const LOCATION_ISSUING_KEY = ROOT."/config/SilverbulletClientCerts/real-RSA.key";
22
+    private const LOCATION_CONFIG = ROOT."/config/SilverbulletClientCerts/openssl-RSA.cnf";
23 23
 
24 24
     /**
25 25
      * string with the PEM variant of the root CA
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
         parent::__construct();
67 67
         $this->rootPem = file_get_contents(CertificationAuthorityEmbeddedRSA::LOCATION_ROOT_CA);
68 68
         if ($this->rootPem === FALSE) {
69
-            throw new Exception("Root CA PEM file not found: " . CertificationAuthorityEmbeddedRSA::LOCATION_ROOT_CA);
69
+            throw new Exception("Root CA PEM file not found: ".CertificationAuthorityEmbeddedRSA::LOCATION_ROOT_CA);
70 70
         }
71 71
         $this->issuingCertRaw = file_get_contents(CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_CA);
72 72
         if ($this->issuingCertRaw === FALSE) {
73
-            throw new Exception("Issuing CA PEM file not found: " . CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_CA);
73
+            throw new Exception("Issuing CA PEM file not found: ".CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_CA);
74 74
         }
75 75
         $rootParsed = openssl_x509_read($this->rootPem);
76 76
         $issuingCertCandidate = openssl_x509_read($this->issuingCertRaw);
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
         }
81 81
         $this->issuingCert = $issuingCertCandidate;
82 82
         if (stat(CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_KEY) === FALSE) {
83
-            throw new Exception("Private key not found: " . CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_KEY);
83
+            throw new Exception("Private key not found: ".CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_KEY);
84 84
         }
85
-        $issuingKeyTemp = openssl_pkey_get_private("file://" . CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_KEY);
85
+        $issuingKeyTemp = openssl_pkey_get_private("file://".CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_KEY);
86 86
         if ($issuingKeyTemp === FALSE || is_resource($issuingKeyTemp)) {
87 87
             throw new Exception("The private key did not parse correctly (or is not a PHP8 object)!");
88 88
         }
89 89
         $this->issuingKey = $issuingKeyTemp;
90 90
         if (stat(CertificationAuthorityEmbeddedRSA::LOCATION_CONFIG) === FALSE) {
91
-            throw new Exception("openssl configuration not found: " . CertificationAuthorityEmbeddedRSA::LOCATION_CONFIG);
91
+            throw new Exception("openssl configuration not found: ".CertificationAuthorityEmbeddedRSA::LOCATION_CONFIG);
92 92
         }
93 93
         $this->conffile = CertificationAuthorityEmbeddedRSA::LOCATION_CONFIG;
94 94
     }
@@ -131,27 +131,27 @@  discard block
 block discarded – undo
131 131
         // generate stub index.txt file
132 132
         $tempdirArray = \core\common\Entity::createTemporaryDirectory("test");
133 133
         $tempdir = $tempdirArray['dir'];
134
-        $nowIndexTxt = (new \DateTime())->format("ymdHis") . "Z";
135
-        $expiryIndexTxt = $originalExpiry->format("ymdHis") . "Z";
134
+        $nowIndexTxt = (new \DateTime())->format("ymdHis")."Z";
135
+        $expiryIndexTxt = $originalExpiry->format("ymdHis")."Z";
136 136
         // serials for our CA are always integers
137 137
         $serialHex = strtoupper(dechex((int) $cert->serial));
138 138
         if (strlen($serialHex) % 2 == 1) {
139
-            $serialHex = "0" . $serialHex;
139
+            $serialHex = "0".$serialHex;
140 140
         }
141 141
 
142
-        $indexStatement = "$certstatus\t$expiryIndexTxt\t" . ($certstatus == "R" ? "$nowIndexTxt,unspecified" : "") . "\t$serialHex\tunknown\t/O=" . \config\ConfAssistant::CONSORTIUM['name'] . "/OU=$federation/CN=$cert->username\n";
142
+        $indexStatement = "$certstatus\t$expiryIndexTxt\t".($certstatus == "R" ? "$nowIndexTxt,unspecified" : "")."\t$serialHex\tunknown\t/O=".\config\ConfAssistant::CONSORTIUM['name']."/OU=$federation/CN=$cert->username\n";
143 143
         $this->loggerInstance->debug(4, "index.txt contents-to-be: $indexStatement");
144
-        if (!file_put_contents($tempdir . "/index.txt", $indexStatement)) {
144
+        if (!file_put_contents($tempdir."/index.txt", $indexStatement)) {
145 145
             $this->loggerInstance->debug(1, "Unable to write openssl index.txt file for revocation handling!");
146 146
         }
147 147
         // index.txt.attr is dull but needs to exist
148
-        file_put_contents($tempdir . "/index.txt.attr", "unique_subject = yes\n");
148
+        file_put_contents($tempdir."/index.txt.attr", "unique_subject = yes\n");
149 149
         // call "openssl ocsp" to manufacture our own OCSP statement
150 150
         // adding "-rmd sha1" to the following command-line makes the
151 151
         // choice of signature algorithm for the response explicit
152 152
         // but it's only available from openssl-1.1.0 (which we do not
153 153
         // want to require just for that one thing).
154
-        $execCmd = \config\Master::PATHS['openssl'] . " ocsp -issuer " . CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_CA . " -sha1 -ndays 10 -no_nonce -serial 0x$serialHex -CA " . CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_CA . " -rsigner " . CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_CA . " -rkey " . CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_KEY . " -index $tempdir/index.txt -no_cert_verify -respout $tempdir/$serialHex.response.der";
154
+        $execCmd = \config\Master::PATHS['openssl']." ocsp -issuer ".CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_CA." -sha1 -ndays 10 -no_nonce -serial 0x$serialHex -CA ".CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_CA." -rsigner ".CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_CA." -rkey ".CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_KEY." -index $tempdir/index.txt -no_cert_verify -respout $tempdir/$serialHex.response.der";
155 155
         $this->loggerInstance->debug(2, "Calling openssl ocsp with following cmdline: $execCmd\n");
156 156
         $output = [];
157 157
         $return = 999;
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
         if ($return !== 0) {
160 160
             throw new Exception("Non-zero return value from openssl ocsp!");
161 161
         }
162
-        $ocsp = file_get_contents($tempdir . "/$serialHex.response.der");
162
+        $ocsp = file_get_contents($tempdir."/$serialHex.response.der");
163 163
         // remove the temp dir!
164
-        unlink($tempdir . "/$serialHex.response.der");
165
-        unlink($tempdir . "/index.txt.attr");
166
-        unlink($tempdir . "/index.txt");
164
+        unlink($tempdir."/$serialHex.response.der");
165
+        unlink($tempdir."/index.txt.attr");
166
+        unlink($tempdir."/index.txt");
167 167
         rmdir($tempdir);
168 168
         $this->databaseHandle->exec("UPDATE silverbullet_certificate SET OCSP = ?, OCSP_timestamp = NOW() WHERE serial_number = ?", "si", $ocsp, $cert->serial);
169 169
         return $ocsp;
Please login to merge, or discard this patch.
web/admin/inc/filepreview.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 ?>
23 23
 <?php
24 24
 
25
-require_once dirname(dirname(dirname(dirname(__FILE__)))) . "/config/_config.php";
25
+require_once dirname(dirname(dirname(dirname(__FILE__))))."/config/_config.php";
26 26
 
27 27
 $validator = new \web\lib\common\InputValidation();
28 28
 $idRaw = $_GET["id"] ?? "";
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         // Set data type and caching for 30 days
38 38
         $info = new finfo();
39 39
         $filetype = $info->buffer($finalBlob, FILEINFO_MIME_TYPE);
40
-        header("Content-type: " . $filetype);
40
+        header("Content-type: ".$filetype);
41 41
 
42 42
         switch ($filetype) {
43 43
             case "text/rtf": // fall-through, same treatment
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         header("Cache-Control: must-revalidate");
55 55
         $offset = 60 * 60 * 24 * 30;
56 56
         // gmdate can't possibly fail, because it operates on time() and an integer offset
57
-        $ExpStr = "Expires: " . /** @scrutinizer ignore-type */ gmdate("D, d M Y H:i:s", time() + $offset) . " GMT";
57
+        $ExpStr = "Expires: "./** @scrutinizer ignore-type */ gmdate("D, d M Y H:i:s", time() + $offset)." GMT";
58 58
         header($ExpStr);
59 59
         //  Print out the image
60 60
         echo $finalBlob;
Please login to merge, or discard this patch.
web/admin/inc/userStats.inc.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * ******************************************************************************
10 10
  */
11 11
 
12
-require_once dirname(dirname(dirname(dirname(__FILE__)))) . "/config/_config.php";
12
+require_once dirname(dirname(dirname(dirname(__FILE__))))."/config/_config.php";
13 13
 
14 14
 $auth = new \web\lib\admin\Authentication();
15 15
 $auth->authenticate();
@@ -29,31 +29,31 @@  discard block
 block discarded – undo
29 29
 ?>
30 30
 
31 31
 <h1><?php $tablecaption = _("User Authentication Records"); echo $tablecaption; ?></h1>
32
-<p><?php echo _("Note that:");?></p>
32
+<p><?php echo _("Note that:"); ?></p>
33 33
 <ul>
34
-    <li><?php echo _("Authentication records are deleted after six months retention time");?></li>
35
-    <li><?php echo _("Operator Domain is based on the RADIUS attribute 'Operator-Name' and not sent by all hotspots");?></li>
36
-    <li><?php echo _("Different MAC addresses per credential may be due to MAC Address randomisation in recent operating systems");?></li>
34
+    <li><?php echo _("Authentication records are deleted after six months retention time"); ?></li>
35
+    <li><?php echo _("Operator Domain is based on the RADIUS attribute 'Operator-Name' and not sent by all hotspots"); ?></li>
36
+    <li><?php echo _("Different MAC addresses per credential may be due to MAC Address randomisation in recent operating systems"); ?></li>
37 37
 </ul>
38 38
 <table class='authrecord'>
39
-    <caption><?php echo $tablecaption;?></caption>
39
+    <caption><?php echo $tablecaption; ?></caption>
40 40
     <tr>
41
-        <th scope="col"><strong><?php echo _("Timestamp");?></strong></th>
42
-        <th scope="col"><strong><?php echo _("Credential");?></strong></th>
43
-        <th scope="col"><strong><?php echo _("MAC Address");?></strong></th>
44
-        <th scope="col"><strong><?php echo _("Result");?></strong></th>
45
-        <th scope="col"><strong><?php echo _("Operator Domain");?></strong></th>
41
+        <th scope="col"><strong><?php echo _("Timestamp"); ?></strong></th>
42
+        <th scope="col"><strong><?php echo _("Credential"); ?></strong></th>
43
+        <th scope="col"><strong><?php echo _("MAC Address"); ?></strong></th>
44
+        <th scope="col"><strong><?php echo _("Result"); ?></strong></th>
45
+        <th scope="col"><strong><?php echo _("Operator Domain"); ?></strong></th>
46 46
     </tr>
47 47
     <?php
48 48
     $userAuthData = $profile->getUserAuthRecords($userInt);
49 49
     foreach ($userAuthData as $oneRecord) {
50
-        echo "<tr class='".($oneRecord['RESULT'] == "Access-Accept" ? "auth-success" : "auth-fail" )."'>"
50
+        echo "<tr class='".($oneRecord['RESULT'] == "Access-Accept" ? "auth-success" : "auth-fail")."'>"
51 51
                 . "<td>".$oneRecord['TIMESTAMP']."</td>"
52 52
                 // $oneRecord['CN'] is a simple string, not an array, so disable Scrutinizer type check here
53
-                . "<td>"./** @scrutinizer ignore-type */ substr_replace($oneRecord['CN'], "@…", strpos($oneRecord['CN'],"@"))."</td>"
53
+                . "<td>"./** @scrutinizer ignore-type */ substr_replace($oneRecord['CN'], "@…", strpos($oneRecord['CN'], "@"))."</td>"
54 54
                 . "<td>".$oneRecord['MAC']."</td>"
55 55
                 . "<td>".($oneRecord['RESULT'] == "Access-Accept" ? _("Success") : _("Failure"))."</td>"
56
-                . "<td>".substr($oneRecord['OPERATOR'] ?? "1(unknown)",1)."</td>"
56
+                . "<td>".substr($oneRecord['OPERATOR'] ?? "1(unknown)", 1)."</td>"
57 57
                 . "</tr>";
58 58
     }
59 59
     ?>
Please login to merge, or discard this patch.
core/CertificationAuthorityEmbeddedECDSA.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
 class CertificationAuthorityEmbeddedECDSA extends EntityWithDBProperties implements CertificationAuthorityInterface
17 17
 {
18 18
 
19
-    private const LOCATION_ROOT_CA = ROOT . "/config/SilverbulletClientCerts/rootca-ECDSA.pem";
20
-    private const LOCATION_ISSUING_CA = ROOT . "/config/SilverbulletClientCerts/real-ECDSA.pem";
21
-    private const LOCATION_ISSUING_KEY = ROOT . "/config/SilverbulletClientCerts/real-ECDSA.key";
22
-    private const LOCATION_CONFIG = ROOT . "/config/SilverbulletClientCerts/openssl-ECDSA.cnf";
19
+    private const LOCATION_ROOT_CA = ROOT."/config/SilverbulletClientCerts/rootca-ECDSA.pem";
20
+    private const LOCATION_ISSUING_CA = ROOT."/config/SilverbulletClientCerts/real-ECDSA.pem";
21
+    private const LOCATION_ISSUING_KEY = ROOT."/config/SilverbulletClientCerts/real-ECDSA.key";
22
+    private const LOCATION_CONFIG = ROOT."/config/SilverbulletClientCerts/openssl-ECDSA.cnf";
23 23
 
24 24
     /**
25 25
      * string with the PEM variant of the root CA
@@ -66,29 +66,29 @@  discard block
 block discarded – undo
66 66
         parent::__construct();
67 67
         $this->rootPem = file_get_contents(CertificationAuthorityEmbeddedECDSA::LOCATION_ROOT_CA);
68 68
         if ($this->rootPem === FALSE) {
69
-            throw new Exception("Root CA PEM file not found: " . CertificationAuthorityEmbeddedECDSA::LOCATION_ROOT_CA);
69
+            throw new Exception("Root CA PEM file not found: ".CertificationAuthorityEmbeddedECDSA::LOCATION_ROOT_CA);
70 70
         }
71 71
         $this->issuingCertRaw = file_get_contents(CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_CA);
72 72
         if ($this->issuingCertRaw === FALSE) {
73
-            throw new Exception("Issuing CA PEM file not found: " . CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_CA);
73
+            throw new Exception("Issuing CA PEM file not found: ".CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_CA);
74 74
         }
75 75
         $rootParsed = openssl_x509_read($this->rootPem);
76 76
         $issuingCertCandidate = openssl_x509_read($this->issuingCertRaw);
77
-        if ($issuingCertCandidate === FALSE || is_resource($issuingCertCandidate)|| $rootParsed === FALSE) {
77
+        if ($issuingCertCandidate === FALSE || is_resource($issuingCertCandidate) || $rootParsed === FALSE) {
78 78
             throw new Exception("At least one CA PEM file did not parse correctly (or not a PHP8 resource)!");
79 79
         }
80 80
         $this->issuingCert = $issuingCertCandidate;
81 81
         
82 82
         if (stat(CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_KEY) === FALSE) {
83
-            throw new Exception("Private key not found: " . CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_KEY);
83
+            throw new Exception("Private key not found: ".CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_KEY);
84 84
         }
85
-        $issuingKeyTemp = openssl_pkey_get_private("file://" . CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_KEY);
85
+        $issuingKeyTemp = openssl_pkey_get_private("file://".CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_KEY);
86 86
         if ($issuingKeyTemp === FALSE || is_resource($issuingKeyTemp)) {
87 87
             throw new Exception("The private key did not parse correctly (or not a PHP8 resource)!");
88 88
         }
89 89
         $this->issuingKey = $issuingKeyTemp;
90 90
         if (stat(CertificationAuthorityEmbeddedECDSA::LOCATION_CONFIG) === FALSE) {
91
-            throw new Exception("openssl configuration not found: " . CertificationAuthorityEmbeddedECDSA::LOCATION_CONFIG);
91
+            throw new Exception("openssl configuration not found: ".CertificationAuthorityEmbeddedECDSA::LOCATION_CONFIG);
92 92
         }
93 93
         $this->conffile = CertificationAuthorityEmbeddedECDSA::LOCATION_CONFIG;
94 94
     }
@@ -131,27 +131,27 @@  discard block
 block discarded – undo
131 131
         // generate stub index.txt file
132 132
         $tempdirArray = \core\common\Entity::createTemporaryDirectory("test");
133 133
         $tempdir = $tempdirArray['dir'];
134
-        $nowIndexTxt = (new \DateTime())->format("ymdHis") . "Z";
135
-        $expiryIndexTxt = $originalExpiry->format("ymdHis") . "Z";
134
+        $nowIndexTxt = (new \DateTime())->format("ymdHis")."Z";
135
+        $expiryIndexTxt = $originalExpiry->format("ymdHis")."Z";
136 136
         // serials for our CA are always integers
137 137
         $serialHex = strtoupper(dechex((int) $cert->serial));
138 138
         if (strlen($serialHex) % 2 == 1) {
139
-            $serialHex = "0" . $serialHex;
139
+            $serialHex = "0".$serialHex;
140 140
         }
141 141
 
142
-        $indexStatement = "$certstatus\t$expiryIndexTxt\t" . ($certstatus == "R" ? "$nowIndexTxt,unspecified" : "") . "\t$serialHex\tunknown\t/O=" . \config\ConfAssistant::CONSORTIUM['name'] . "/OU=$federation/CN=$cert->username\n";
142
+        $indexStatement = "$certstatus\t$expiryIndexTxt\t".($certstatus == "R" ? "$nowIndexTxt,unspecified" : "")."\t$serialHex\tunknown\t/O=".\config\ConfAssistant::CONSORTIUM['name']."/OU=$federation/CN=$cert->username\n";
143 143
         $this->loggerInstance->debug(4, "index.txt contents-to-be: $indexStatement");
144
-        if (!file_put_contents($tempdir . "/index.txt", $indexStatement)) {
144
+        if (!file_put_contents($tempdir."/index.txt", $indexStatement)) {
145 145
             $this->loggerInstance->debug(1, "Unable to write openssl index.txt file for revocation handling!");
146 146
         }
147 147
         // index.txt.attr is dull but needs to exist
148
-        file_put_contents($tempdir . "/index.txt.attr", "unique_subject = yes\n");
148
+        file_put_contents($tempdir."/index.txt.attr", "unique_subject = yes\n");
149 149
         // call "openssl ocsp" to manufacture our own OCSP statement
150 150
         // adding "-rmd sha1" to the following command-line makes the
151 151
         // choice of signature algorithm for the response explicit
152 152
         // but it's only available from openssl-1.1.0 (which we do not
153 153
         // want to require just for that one thing).
154
-        $execCmd = \config\Master::PATHS['openssl'] . " ocsp -issuer " . CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_CA . " -sha1 -ndays 10 -no_nonce -serial 0x$serialHex -CA " . CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_CA . " -rsigner " . CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_CA . " -rkey " . CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_KEY . " -index $tempdir/index.txt -no_cert_verify -respout $tempdir/$serialHex.response.der";
154
+        $execCmd = \config\Master::PATHS['openssl']." ocsp -issuer ".CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_CA." -sha1 -ndays 10 -no_nonce -serial 0x$serialHex -CA ".CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_CA." -rsigner ".CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_CA." -rkey ".CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_KEY." -index $tempdir/index.txt -no_cert_verify -respout $tempdir/$serialHex.response.der";
155 155
         $this->loggerInstance->debug(2, "Calling openssl ocsp with following cmdline: $execCmd\n");
156 156
         $output = [];
157 157
         $return = 999;
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
         if ($return !== 0) {
160 160
             throw new Exception("Non-zero return value from openssl ocsp!");
161 161
         }
162
-        $ocsp = file_get_contents($tempdir . "/$serialHex.response.der");
162
+        $ocsp = file_get_contents($tempdir."/$serialHex.response.der");
163 163
         // remove the temp dir!
164
-        unlink($tempdir . "/$serialHex.response.der");
165
-        unlink($tempdir . "/index.txt.attr");
166
-        unlink($tempdir . "/index.txt");
164
+        unlink($tempdir."/$serialHex.response.der");
165
+        unlink($tempdir."/index.txt.attr");
166
+        unlink($tempdir."/index.txt");
167 167
         rmdir($tempdir);
168 168
         $this->databaseHandle->exec("UPDATE silverbullet_certificate SET OCSP = ?, OCSP_timestamp = NOW() WHERE serial_number = ?", "si", $ocsp, $cert->serial);
169 169
         return $ocsp;
Please login to merge, or discard this patch.
core/diag/Logopath.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
         $this->possibleFailureReasons = $_SESSION["SUSPECTS"] ?? []; // if we know nothing, don't talk to anyone
118 118
         $this->additionalFindings = $_SESSION["EVIDENCE"] ?? [];
119 119
 
120
-        $this->subjectPrefix = _("[eduroam Diagnostics]") . " ";
120
+        $this->subjectPrefix = _("[eduroam Diagnostics]")." ";
121 121
         $this->finalGreeting = "\n"
122 122
                 . _("(This service is in an early stage. We apologise if this is a false alert. If this is the case, please send an email report to [email protected], forwarding the entire message (including the 'SUSPECTS' and 'EVIDENCE' data at the end), and explain why this is a false positive.)")
123 123
                 . "\n"
124
-                . _("Yours sincerely,") . "\n"
124
+                . _("Yours sincerely,")."\n"
125 125
                 . "\n"
126 126
                 . _("Ed U. Roam, the eduroam diagnostics algorithm");
127 127
 
@@ -132,13 +132,13 @@  discard block
 block discarded – undo
132 132
                 "bcc" => [],
133 133
                 "reply-to" => [Logopath::TARGET_EDUROAM_OT],
134 134
                 "subject" => _("[POLICYVIOLATION NATIONAL] IdP with no entry in eduroam database"),
135
-                "body" => _("Dear NRO administrator,") . "\n"
135
+                "body" => _("Dear NRO administrator,")."\n"
136 136
                 . "\n"
137
-                . wordwrap(sprintf(_("an end-user requested diagnostics for realm %s. Real-time connectivity checks determined that the realm exists, but we were unable to find an IdP with that realm in the eduroam database."), $this->additionalFindings['REALM'])) . "\n"
137
+                . wordwrap(sprintf(_("an end-user requested diagnostics for realm %s. Real-time connectivity checks determined that the realm exists, but we were unable to find an IdP with that realm in the eduroam database."), $this->additionalFindings['REALM']))."\n"
138 138
                 . "\n"
139
-                . _("By not listing IdPs in the eduroam database, you are violating the eduroam policy.") . "\n"
139
+                . _("By not listing IdPs in the eduroam database, you are violating the eduroam policy.")."\n"
140 140
                 . "\n"
141
-                . _("Additionally, this creates operational issues. In particular, we are unable to direct end users to their IdP for further diagnosis/instructions because there are no contact points for that IdP in the database.") . "\n"
141
+                . _("Additionally, this creates operational issues. In particular, we are unable to direct end users to their IdP for further diagnosis/instructions because there are no contact points for that IdP in the database.")."\n"
142 142
                 . "\n"
143 143
                 . _("Please stop the policy violation ASAP by listing the IdP which is associated to this realm.")
144 144
                 . "\n",
@@ -149,11 +149,11 @@  discard block
 block discarded – undo
149 149
                 "bcc" => [],
150 150
                 "reply-to" => [Logopath::TARGET_ENDUSER],
151 151
                 "subject" => _("[TECHNICAL PROBLEM] Administrator suspects technical problem with your IdP"),
152
-                "body" => _("Dear IdP administrator,") . "\n"
152
+                "body" => _("Dear IdP administrator,")."\n"
153 153
                 . "\n"
154 154
                 . sprintf(_("an organisation administrator requested diagnostics for realm %s. "), $this->additionalFindings['REALM'])
155 155
                 . "\n"
156
-                . _("Real-time connectivity checks determined that the realm appears to be working in acceptable parameters, but the administrator insisted to contact you with the supplemental information below.") . "\n"
156
+                . _("Real-time connectivity checks determined that the realm appears to be working in acceptable parameters, but the administrator insisted to contact you with the supplemental information below.")."\n"
157 157
                 . "\n",
158 158
             ],
159 159
             Logopath::IDP_SUSPECTED_PROBLEM_INTERACTIVE_EVIDENCED => [
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
                 "bcc" => [],
163 163
                 "reply-to" => [Logopath::TARGET_ENDUSER],
164 164
                 "subject" => _("[TECHNICAL PROBLEM] Administrator suspects technical problem with your IdP"),
165
-                "body" => _("Dear IdP administrator,") . "\n"
165
+                "body" => _("Dear IdP administrator,")."\n"
166 166
                 . "\n"
167 167
                 . sprintf(_("an organisation administrator requested diagnostics for realm %s. "), $this->additionalFindings['REALM'])
168 168
                 . "\n"
169
-                . _("Real-time connectivity checks determined that the realm indeed has an operational problem at this point in time. Please see the supplemental information below.") . "\n"
169
+                . _("Real-time connectivity checks determined that the realm indeed has an operational problem at this point in time. Please see the supplemental information below.")."\n"
170 170
                 . "\n",
171 171
             ],
172 172
         ];
@@ -174,13 +174,13 @@  discard block
 block discarded – undo
174 174
         // add exalted human-readable information to main mail body
175 175
         foreach ($this->mailStack as $oneEntry) {
176 176
             if (isset($this->additionalFindings['INTERACTIVE_ENDUSER_AUTH_TIMESTAMP'])) {
177
-                $oneEntry["body"] .= _("Authentication/Attempt Timestamp of user session:") . " " . $this->additionalFindings['INTERACTIVE_ENDUSER_AUTH_TIMESTAMP'] . "\n";
177
+                $oneEntry["body"] .= _("Authentication/Attempt Timestamp of user session:")." ".$this->additionalFindings['INTERACTIVE_ENDUSER_AUTH_TIMESTAMP']."\n";
178 178
             }
179 179
             if (isset($this->additionalFindings['INTERACTIVE_ENDUSER_MAC'])) {
180
-                $oneEntry["body"] .= _("MAC address of end user in question:") . " " . $this->additionalFindings['INTERACTIVE_ENDUSER_MAC'] . "\n";
180
+                $oneEntry["body"] .= _("MAC address of end user in question:")." ".$this->additionalFindings['INTERACTIVE_ENDUSER_MAC']."\n";
181 181
             }
182 182
             if (isset($this->additionalFindings['INTERACTIVE_ADDITIONAL_COMMENTS'])) {
183
-                $oneEntry["body"] .= _("Additional Comments:") . " " . $this->additionalFindings['INTERACTIVE_ADDITIONAL_COMMENTS'] . "\n";
183
+                $oneEntry["body"] .= _("Additional Comments:")." ".$this->additionalFindings['INTERACTIVE_ADDITIONAL_COMMENTS']."\n";
184 184
             }
185 185
         }
186 186
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 
341 341
             $handle = \core\common\OutsideComm::mailHandle();
342 342
             // let's identify outselves
343
-            $handle->FromName = \config\Master::APPEARANCE['productname'] . " Real-Time Diagnostics System";
343
+            $handle->FromName = \config\Master::APPEARANCE['productname']." Real-Time Diagnostics System";
344 344
             // add recipients
345 345
             foreach (Logopath::CATEGORYBINDING as $arrayName => $functionName) {
346 346
                 foreach ($theMail[$arrayName] as $onePrincipal) {
Please login to merge, or discard this patch.