Test Failed
Push — release_2_1 ( bc6859...1471d5 )
by Tomasz
20:33 queued 11:05
created
web/admin/action_req_certificate.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     /* Messages */
92 92
     $messages = [
93 93
     'WRONG_SUBJECT' => _('Submitted Certificate Signing Request contains subject field that does not start with ') . 
94
-                       $subject_prefix  . '<br>' . _("See CSR generation rules below."),
94
+                        $subject_prefix  . '<br>' . _("See CSR generation rules below."),
95 95
     'WRONG_CRL' => _('Submitted Certificate Signing Request is broken - unable to extract the public key from CSR')
96 96
     ];
97 97
     $settings = array();
@@ -171,16 +171,16 @@  discard block
 block discarded – undo
171 171
                     $ou = $serverInfo["names"][$langInstance->getLang()];
172 172
                 }
173 173
                 print($ou);
174
-		$modou = 0;
175
-		if (str_contains($ou, ',')) {
176
-		    $modou = 1;
177
-		    $ou = str_replace(",", "/,", $ou);
178
-		}
179
-		$ou = preg_replace('/\s+/', ' ',  $ou);
180
-		if (strlen($ou) >= 64) {
181
-			$ou = substr($ou, 0, 64);
182
-			$modou += 2;
183
-		}
174
+        $modou = 0;
175
+        if (str_contains($ou, ',')) {
176
+            $modou = 1;
177
+            $ou = str_replace(",", "/,", $ou);
178
+        }
179
+        $ou = preg_replace('/\s+/', ' ',  $ou);
180
+        if (strlen($ou) >= 64) {
181
+            $ou = substr($ou, 0, 64);
182
+            $modou += 2;
183
+        }
184 184
                 $DN[] = "O=".iconv('UTF-8', 'ASCII//TRANSLIT', $ou);
185 185
                 $serverList = explode(",", $serverInfo["servers"]);
186 186
                 $DN[] = "CN=" . $serverList[0];
@@ -205,20 +205,20 @@  discard block
 block discarded – undo
205 205
         echo "<p style='font-size: large'>" . _("Requesting a certificate with the following properties");
206 206
         echo "<ul>";
207 207
         echo "<li>" . _("Policy OIDs: ") . implode(", ", $policies) . "</li>";
208
-	echo "<li>" . _("Distinguished Name: ") . implode(", ", $DN);
209
-	if ($modou > 0) {
210
-	    echo " (";
208
+    echo "<li>" . _("Distinguished Name: ") . implode(", ", $DN);
209
+    if ($modou > 0) {
210
+        echo " (";
211 211
             echo _("Organization field adjusted"). ': ';
212
-	    $desc = array();
213
-	    if ($modou >= 2) {
214
-		$desc[] = _("truncated to 64 chars");
215
-	    }
216
-	    if ($modou == 1 || $modou == 3) {
217
-		$desc[] = _("commas escaped");
212
+        $desc = array();
213
+        if ($modou >= 2) {
214
+        $desc[] = _("truncated to 64 chars");
215
+        }
216
+        if ($modou == 1 || $modou == 3) {
217
+        $desc[] = _("commas escaped");
218 218
             }
219
-	    echo implode(', ', $desc);
220
-	    echo ")";
221
-	}
219
+        echo implode(', ', $desc);
220
+        echo ")";
221
+    }
222 222
         echo "</li>";
223 223
         echo "<li>" . _("subjectAltName:DNS : ") . implode(", ", $serverList) . "</li>";
224 224
         echo "<li>" . _("Requester Contact Details: ") . $firstName . " &lt;" . $firstMail . "&gt;" . "</li>";
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
         <?php if (empty($policies)) {?>
361 361
         eduroam IdP/SP
362 362
         <?php } else {
363
-           echo implode(', ', $policies); 
363
+            echo implode(', ', $policies); 
364 364
         }?>
365 365
         </span>
366 366
         </h3>
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
  */
28 28
 ?>
29 29
 <?php
30
-require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php";
30
+require_once dirname(dirname(dirname(__FILE__)))."/config/_config.php";
31 31
 $auth = new \web\lib\admin\Authentication();
32 32
 $deco = new \web\lib\admin\PageDecoration();
33 33
 $validator = new \web\lib\common\InputValidation();
@@ -90,23 +90,23 @@  discard block
 block discarded – undo
90 90
     $subject_prefix = implode(', ', array_reverse($DN));
91 91
     /* Messages */
92 92
     $messages = [
93
-    'WRONG_SUBJECT' => _('Submitted Certificate Signing Request contains subject field that does not start with ') . 
94
-                       $subject_prefix  . '<br>' . _("See CSR generation rules below."),
93
+    'WRONG_SUBJECT' => _('Submitted Certificate Signing Request contains subject field that does not start with '). 
94
+                       $subject_prefix.'<br>'._("See CSR generation rules below."),
95 95
     'WRONG_CRL' => _('Submitted Certificate Signing Request is broken - unable to extract the public key from CSR')
96 96
     ];
97 97
     $settings = array();
98
-    if  (isset($_SESSION['CSR_ERRORS']) && $_SESSION['CSR_ERRORS'] != '') {
99
-        print '<h3 id="errorbox"><font color="red">'. $messages[$_SESSION['CSR_ERRORS']].'</font></h3>';
98
+    if (isset($_SESSION['CSR_ERRORS']) && $_SESSION['CSR_ERRORS'] != '') {
99
+        print '<h3 id="errorbox"><font color="red">'.$messages[$_SESSION['CSR_ERRORS']].'</font></h3>';
100 100
         unset($_SESSION['CSR_ERRORS']);
101 101
     }
102
-    if  (isset($_SESSION['FORM_SETTINGS']) && $_SESSION['FORM_SETTINGS'] != '') {
102
+    if (isset($_SESSION['FORM_SETTINGS']) && $_SESSION['FORM_SETTINGS'] != '') {
103 103
         $settings = $_SESSION['FORM_SETTINGS'];
104 104
         unset($_SESSION['FORM_SETTINGS']);
105 105
     }
106 106
     if (empty($settings) && isset($_POST['LEVEL'])) {
107 107
         $settings = array('LEVEL' => $_POST['LEVEL'], 'NRO-list' => $_POST['NRO-list'], 'INST-list' => $_POST['INST-list']);
108 108
     }
109
-    if  ( isset($_POST['requestcert']) && $_POST['requestcert'] == \web\lib\common\FormElements::BUTTON_SAVE) {
109
+    if (isset($_POST['requestcert']) && $_POST['requestcert'] == \web\lib\common\FormElements::BUTTON_SAVE) {
110 110
         // basic sanity checks before we hand this over to openssl
111 111
         $sanitisedCsr = $validator->string($_POST['CSR'] ?? "", TRUE);
112 112
         //print $sanitisedCsr; 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         $dc = array();
122 122
         if (!empty($subject_keys) && $subject_keys[0] == 'DC' && $subject['DC']) {
123 123
             foreach ($subject['DC'] as $v) {
124
-                $dc[] = 'DC=' . $v;
124
+                $dc[] = 'DC='.$v;
125 125
             }
126 126
             if ($DN !== array_reverse($dc)) {
127 127
                 $dc = array();
@@ -141,12 +141,12 @@  discard block
 block discarded – undo
141 141
                 }
142 142
                 $fed = $validator->existingFederation($_POST['NRO-list']);
143 143
                 $country = strtoupper($fed->tld);
144
-                $code = isset($cat->knownFederations[$country]['code']) ? $cat->knownFederations[$country]['code'] : $country ;
144
+                $code = isset($cat->knownFederations[$country]['code']) ? $cat->knownFederations[$country]['code'] : $country;
145 145
                 $DN[] = "C=$code";
146
-                $DN[] = "O=NRO of " . iconv('UTF-8', 'ASCII//TRANSLIT', $cat->knownFederations[$country]['name']);
146
+                $DN[] = "O=NRO of ".iconv('UTF-8', 'ASCII//TRANSLIT', $cat->knownFederations[$country]['name']);
147 147
                 $serverInfo = $externalDb->listExternalTlsServersFederation($fed->tld);
148 148
                 $serverList = explode(",", array_key_first($serverInfo));
149
-                $DN[] = "CN=" . $serverList[0];
149
+                $DN[] = "CN=".$serverList[0];
150 150
                 $policies[] = "eduroam IdP";
151 151
                 $policies[] = "eduroam SP";
152 152
                 $firstName = $serverInfo[array_key_first($serverInfo)][0]["name"];
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
                     throw new Exception(sprintf("Sorry: you are not %s admin for the %s requested in the form.", $uiElements->nomenclatureFed, $uiElements->nomenclatureFed));
163 163
                 }
164 164
                 $country = strtoupper($matches[1]);
165
-                $code = isset($cat->knownFederations[$country]['code']) ? $cat->knownFederations[$country]['code'] : $country ;
165
+                $code = isset($cat->knownFederations[$country]['code']) ? $cat->knownFederations[$country]['code'] : $country;
166 166
                 $DN[] = "C=$code";
167 167
                 $serverInfo = $extInsts[$_POST['INST-list']];
168 168
                 if (isset($serverInfo["names"]["en"])) {
@@ -176,14 +176,14 @@  discard block
 block discarded – undo
176 176
 		    $modou = 1;
177 177
 		    $ou = str_replace(",", "/,", $ou);
178 178
 		}
179
-		$ou = preg_replace('/\s+/', ' ',  $ou);
179
+		$ou = preg_replace('/\s+/', ' ', $ou);
180 180
 		if (strlen($ou) >= 64) {
181 181
 			$ou = substr($ou, 0, 64);
182 182
 			$modou += 2;
183 183
 		}
184 184
                 $DN[] = "O=".iconv('UTF-8', 'ASCII//TRANSLIT', $ou);
185 185
                 $serverList = explode(",", $serverInfo["servers"]);
186
-                $DN[] = "CN=" . $serverList[0];
186
+                $DN[] = "CN=".$serverList[0];
187 187
                 switch ($serverInfo["type"]) {
188 188
                     case core\IdP::TYPE_IDPSP:
189 189
                         $policies[] = "eduroam IdP";
@@ -202,13 +202,13 @@  discard block
 block discarded – undo
202 202
             default:
203 203
                 throw new Exception("Sorry: Unknown level of issuance requested.");
204 204
         }
205
-        echo "<p style='font-size: large'>" . _("Requesting a certificate with the following properties");
205
+        echo "<p style='font-size: large'>"._("Requesting a certificate with the following properties");
206 206
         echo "<ul>";
207
-        echo "<li>" . _("Policy OIDs: ") . implode(", ", $policies) . "</li>";
208
-	echo "<li>" . _("Distinguished Name: ") . implode(", ", $DN);
207
+        echo "<li>"._("Policy OIDs: ").implode(", ", $policies)."</li>";
208
+	echo "<li>"._("Distinguished Name: ").implode(", ", $DN);
209 209
 	if ($modou > 0) {
210 210
 	    echo " (";
211
-            echo _("Organization field adjusted"). ': ';
211
+            echo _("Organization field adjusted").': ';
212 212
 	    $desc = array();
213 213
 	    if ($modou >= 2) {
214 214
 		$desc[] = _("truncated to 64 chars");
@@ -220,8 +220,8 @@  discard block
 block discarded – undo
220 220
 	    echo ")";
221 221
 	}
222 222
         echo "</li>";
223
-        echo "<li>" . _("subjectAltName:DNS : ") . implode(", ", $serverList) . "</li>";
224
-        echo "<li>" . _("Requester Contact Details: ") . $firstName . " &lt;" . $firstMail . "&gt;" . "</li>";
223
+        echo "<li>"._("subjectAltName:DNS : ").implode(", ", $serverList)."</li>";
224
+        echo "<li>"._("Requester Contact Details: ").$firstName." &lt;".$firstMail."&gt;"."</li>";
225 225
         echo "</ul></p>";
226 226
 
227 227
         $vettedCsr = $validator->string($_POST['CSR'], true);
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
         $loggerInstance->debug(2, $DN, "CERT DN: ", "\n");
238 238
         // our certs can be good for max 5 years
239 239
         $fed->requestCertificate($user->identifier, $newCsrWithMeta, $expiryDays);
240
-        echo "<p>" . _("The certificate was requested.") . "</p>";
240
+        echo "<p>"._("The certificate was requested.")."</p>";
241 241
         ?>
242 242
         <form action="overview_certificates.php" method="GET">
243 243
             <button type="submit"><?php echo _("Back to Certificate Overview"); ?></button>
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
         switch (count($feds)) {
256 256
             case 0:
257 257
                 echo "<div>";
258
-                echo $uiElements->boxRemark("<strong>" . sprintf(_("None of your %s servers has complete information in the database."),$uiElements->nomenclatureFed)."</strong>" . _("At least the DNS names of TLS servers and a role-based contact mail address are required."));
258
+                echo $uiElements->boxRemark("<strong>".sprintf(_("None of your %s servers has complete information in the database."), $uiElements->nomenclatureFed)."</strong>"._("At least the DNS names of TLS servers and a role-based contact mail address are required."));
259 259
                 echo "</div>";
260 260
                 break;
261 261
             case 1:
@@ -263,22 +263,22 @@  discard block
 block discarded – undo
263 263
                 if (empty($settings) || (isset($settings['LEVEL']) && $settings['LEVEL'] == 'NRO')) {
264 264
                     echo ' checked';
265 265
                 }
266
-                echo '>' . sprintf(_("Certificate for %s") ." ", $uiElements->nomenclatureFed) . '</input>';
267
-                echo " <strong>" . $cat->knownFederations[$feds[0]->tld]['name'] . "</strong>";
268
-                echo '<input type="hidden" name="NRO-list" id="NRO-list" value="' . $feds[0]->tld . '"/>';
266
+                echo '>'.sprintf(_("Certificate for %s")." ", $uiElements->nomenclatureFed).'</input>';
267
+                echo " <strong>".$cat->knownFederations[$feds[0]->tld]['name']."</strong>";
268
+                echo '<input type="hidden" name="NRO-list" id="NRO-list" value="'.$feds[0]->tld.'"/>';
269 269
                 break;
270 270
             default:
271 271
                 echo '<input type="radio" name="LEVEL" id="NRO" value="NRO"';
272 272
                 if (empty($settings) || isset($settings['LEVEL']) && $settings['LEVEL'] == 'NRO') {
273 273
                     echo ' checked';
274 274
                 }
275
-                echo '>' . sprintf(_("Certificate for %s") ." ", $uiElements->nomenclatureFed) . '</input>';
275
+                echo '>'.sprintf(_("Certificate for %s")." ", $uiElements->nomenclatureFed).'</input>';
276 276
                 ?>
277 277
                 <select name="NRO-list" id="NRO-list">
278 278
                     <option value="notset"><?php echo _("---PLEASE CHOOSE---"); ?></option>
279 279
                     <?php
280 280
                     foreach ($feds as $oneFed) {
281
-                        echo '<option value="' . strtoupper($oneFed->tld) . '">' . $cat->knownFederations[$oneFed->tld]['name'] . "</option>";
281
+                        echo '<option value="'.strtoupper($oneFed->tld).'">'.$cat->knownFederations[$oneFed->tld]['name']."</option>";
282 282
                         #echo '<option value="AAA' . strtoupper($oneFed->tld) . '">' . $oneIdP["names"][$langObject->getLang()] . "</option>";
283 283
                         
284 284
                     }
@@ -291,18 +291,18 @@  discard block
 block discarded – undo
291 291
         <script>
292 292
             var instservers = [];
293 293
             var instpolicies = [];
294
-            var nroservers = '<?php echo str_replace(",", ", ", array_key_first($serverInfo));?>';
294
+            var nroservers = '<?php echo str_replace(",", ", ", array_key_first($serverInfo)); ?>';
295 295
         <?php 
296 296
         $allIdPs = [];
297 297
         foreach ($allAuthorizedFeds as $oneFed) {
298 298
             foreach ($externalDb->listExternalTlsServersInstitution($oneFed['value']) as $id => $oneIdP) {
299
-                $allIdPs[$id] = '[' . substr($id, 0, 2) . '] ' . $oneIdP["name"];            
300
-                echo "instservers['" . $id . "']='" . str_replace(",", ", ", $oneIdP["servers"]) . "';\n";
301
-                echo "instpolicies['" . $id . "']='";
299
+                $allIdPs[$id] = '['.substr($id, 0, 2).'] '.$oneIdP["name"];            
300
+                echo "instservers['".$id."']='".str_replace(",", ", ", $oneIdP["servers"])."';\n";
301
+                echo "instpolicies['".$id."']='";
302 302
                 if ($oneIdP["type"] == 'IdPSP') {
303 303
                     echo "eduroam IdP/SP";
304 304
                 } else {
305
-                    echo "eduroam " . $oneIdP["type"];
305
+                    echo "eduroam ".$oneIdP["type"];
306 306
                 }
307 307
                 echo "';\n";
308 308
             }
@@ -340,9 +340,9 @@  discard block
 block discarded – undo
340 340
             <option value="notset"><?php echo _("---PLEASE CHOOSE---"); ?></option>
341 341
 <?php
342 342
 foreach ($allIdPs as $id => $name) {
343
-    echo '<option value="' . $id . '"';
343
+    echo '<option value="'.$id.'"';
344 344
     if (isset($settings['INST-list']) && $settings['INST-list'] == $id) { echo ' selected'; }
345
-    echo '>' . $name . "</option>";
345
+    echo '>'.$name."</option>";
346 346
 }
347 347
 ?>
348 348
         </select>
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
             <?php 
352 352
             echo _('According to the above settings you will receive')
353 353
             ?>
354
-            <span id='certlevel'><?php echo _('NRO level certificate');?></span>
354
+            <span id='certlevel'><?php echo _('NRO level certificate'); ?></span>
355 355
             
356 356
         for server names:
357 357
         <span id='serversinfo'><?php echo str_replace(",", ", ", array_key_first($serverInfo)); ?></span>
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
         <?php
368 368
         } else {
369 369
             echo "<div>";
370
-            echo $uiElements->boxRemark(sprintf(_("<strong>No organisation inside your %s has complete information in the database</strong>."." "._("At least the DNS names of TLS servers and a role-based contact mail address are required.")),$uiElements->nomenclatureFed), "No TLS capable org!", true);
370
+            echo $uiElements->boxRemark(sprintf(_("<strong>No organisation inside your %s has complete information in the database</strong>."." "._("At least the DNS names of TLS servers and a role-based contact mail address are required.")), $uiElements->nomenclatureFed), "No TLS capable org!", true);
371 371
             echo "</div>";
372 372
         }
373 373
         ?>
@@ -377,10 +377,10 @@  discard block
 block discarded – undo
377 377
         <h2><?php echo _("2. CSR generation"); ?></h2>
378 378
         <p>
379 379
         <?php 
380
-        echo _("The CSR subject field has to start with ") .'<b>' . $subject_prefix . '</b><br>';
380
+        echo _("The CSR subject field has to start with ").'<b>'.$subject_prefix.'</b><br>';
381 381
         echo _("One way to generate an acceptable certificate request is via this openssl one-liner:"); ?></p>
382 382
         <?php 
383
-        echo "<b>openssl req -new -newkey rsa:4096 -out test.csr -keyout test.key -subj /". implode('/', array_reverse($DN)) ."/C=XY/O=WillBeReplaced/CN=will.be.replaced</b>";
383
+        echo "<b>openssl req -new -newkey rsa:4096 -out test.csr -keyout test.key -subj /".implode('/', array_reverse($DN))."/C=XY/O=WillBeReplaced/CN=will.be.replaced</b>";
384 384
         ?>
385 385
         <h2><?php echo _("3. Submission"); ?></h2>
386 386
 <?php echo _("Please paste your CSR here:"); ?><br/><textarea name="CSR" id="CSR" rows="20" cols="85"/></textarea><br/>
Please login to merge, or discard this patch.