Passed
Push — master ( 181714...135de8 )
by Tomasz
13:04
created
web/admin/overview_certificates.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  */
27 27
 ?>
28 28
 <?php
29
-require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php";
29
+require_once dirname(dirname(dirname(__FILE__)))."/config/_config.php";
30 30
 
31 31
 $auth = new \web\lib\admin\Authentication();
32 32
 $deco = new \web\lib\admin\PageDecoration();
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     $feds = $user->getAttributes("user:fedadmin");
71 71
     foreach ($feds as $oneFed) {
72 72
         $theFed = new \core\Federation($oneFed['value']);
73
-        printf("<h2>" . _("Certificate Information for %s %s")."</h2>", $uiElements->nomenclatureFed, $theFed->name);
73
+        printf("<h2>"._("Certificate Information for %s %s")."</h2>", $uiElements->nomenclatureFed, $theFed->name);
74 74
         foreach ($theFed->listTlsCertificates() as $oneCert) {
75 75
             if ($oneCert['STATUS'] == "REQUESTED") {
76 76
                 $theFed->updateCertificateStatus($oneCert['REQSERIAL']);
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
81 81
         foreach ($theFed->listTlsCertificates() as $oneCert) { // fetch list a second time, in case we got a cert
82 82
             $status = $oneCert['STATUS'];
83 83
             echo "<tr>";
84
-            echo "<td>" . $oneCert['REQSERIAL'] . "</td><td>" . $oneCert['DN'] . "</td><td>" . $status . "</td><td>" . $oneCert['EXPIRY'] . "</td>";
84
+            echo "<td>".$oneCert['REQSERIAL']."</td><td>".$oneCert['DN']."</td><td>".$status."</td><td>".$oneCert['EXPIRY']."</td>";
85 85
             if ($status == "ISSUED") {
86 86
                 ?>
87 87
             <td>
88 88
                 <form action='inc/showCert.inc.php' onsubmit='popupRedirectWindow(this); return false;' accept-charset='UTF-8' method="POST">
89
-                    <input type="hidden" name="certdata" value="<?php echo $oneCert['CERT'];?>"/>
90
-                <button type="submit"><?php echo _("Display");?></button>
89
+                    <input type="hidden" name="certdata" value="<?php echo $oneCert['CERT']; ?>"/>
90
+                <button type="submit"><?php echo _("Display"); ?></button>
91 91
                 </form>
92 92
             <td>
93 93
                 <?php
Please login to merge, or discard this patch.
web/admin/action_req_certificate.php 1 patch
Spacing   +45 added lines, -45 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();
@@ -96,29 +96,29 @@  discard block
 block discarded – undo
96 96
     'HINT' =>  _("See CSR generation rules below."),
97 97
     ];
98 98
     $settings = array();
99
-    if  (isset($_SESSION['CSR_ERRORS']) && $_SESSION['CSR_ERRORS'] != '') {
100
-        print '<h3 id="errorbox"><font color="red">'. $messages[$_SESSION['CSR_ERRORS']];
99
+    if (isset($_SESSION['CSR_ERRORS']) && $_SESSION['CSR_ERRORS'] != '') {
100
+        print '<h3 id="errorbox"><font color="red">'.$messages[$_SESSION['CSR_ERRORS']];
101 101
         if ($_SESSION['CSR_ERRORS'] == 'SOAP_ERROR' && isset($_SESSION['csr_faultcode'])) {
102
-            print '<br>'. _('Reason') . ': '. $_SESSION['csr_faultcode'];
102
+            print '<br>'._('Reason').': '.$_SESSION['csr_faultcode'];
103 103
             unset($_SESSION['csr_faultcode']);
104 104
         } else {
105 105
             if ($_SESSION['CSR_ERRORS'] == 'WRONG_SUBJECT' && isset($_SESSION['csr_subject'])) {
106
-                print '<br>'. _('Your subject is:') . ' '. $_SESSION['csr_subject'];
106
+                print '<br>'._('Your subject is:').' '.$_SESSION['csr_subject'];
107 107
                 unset($_SESSION['csr_subject']);
108 108
             }
109
-            print '<br>' . $messages['HINT'];
109
+            print '<br>'.$messages['HINT'];
110 110
         }
111 111
         print '</font></h3>';
112 112
         unset($_SESSION['CSR_ERRORS']);
113 113
     }
114
-    if  (isset($_SESSION['FORM_SETTINGS']) && $_SESSION['FORM_SETTINGS'] != '') {
114
+    if (isset($_SESSION['FORM_SETTINGS']) && $_SESSION['FORM_SETTINGS'] != '') {
115 115
         $settings = $_SESSION['FORM_SETTINGS'];
116 116
         unset($_SESSION['FORM_SETTINGS']);
117 117
     }
118 118
     if (empty($settings) && isset($_POST['LEVEL'])) {
119 119
         $settings = array('LEVEL' => $_POST['LEVEL'], 'NRO-list' => $_POST['NRO-list'], 'INST-list' => $_POST['INST-list']);
120 120
     }
121
-    if  ( isset($_POST['requestcert']) && $_POST['requestcert'] == \web\lib\common\FormElements::BUTTON_SAVE) {
121
+    if (isset($_POST['requestcert']) && $_POST['requestcert'] == \web\lib\common\FormElements::BUTTON_SAVE) {
122 122
         // basic sanity checks before we hand this over to openssl
123 123
         $sanitisedCsr = $validator->string($_POST['CSR'] ?? "", TRUE);
124 124
         
@@ -139,14 +139,14 @@  discard block
 block discarded – undo
139 139
                     $dn .= ', ';
140 140
                 }
141 141
                 if (is_array($subject[$sk])) {
142
-                    $dn .= $sk . '=' . implode(', ' . $sk . '=', $subject[$sk]);
142
+                    $dn .= $sk.'='.implode(', '.$sk.'=', $subject[$sk]);
143 143
                 } else {
144
-                    $dn .= $sk . '=' . $subject[$sk];
144
+                    $dn .= $sk.'='.$subject[$sk];
145 145
                 }
146 146
             }
147 147
             if ($subject_keys[0] == 'DC' && $subject['DC']) {
148 148
                 foreach ($subject['DC'] as $v) {
149
-                    $dc[] = 'DC=' . $v;
149
+                    $dc[] = 'DC='.$v;
150 150
                 }
151 151
                 if ($DN !== array_reverse($dc)) {
152 152
                    $dc = array();
@@ -174,11 +174,11 @@  discard block
 block discarded – undo
174 174
                 }
175 175
                 $fed = $validator->existingFederation($_POST['NRO-list']);
176 176
                 $country = strtoupper($fed->tld);
177
-                $code = isset($cat->knownFederations[$country]['code']) ? $cat->knownFederations[$country]['code'] : $country ;
177
+                $code = isset($cat->knownFederations[$country]['code']) ? $cat->knownFederations[$country]['code'] : $country;
178 178
                 $DN[] = "C=$code";
179
-                $DN[] = "O=NRO of " . iconv('UTF-8', 'ASCII//TRANSLIT', $cat->knownFederations[$country]['name']);
179
+                $DN[] = "O=NRO of ".iconv('UTF-8', 'ASCII//TRANSLIT', $cat->knownFederations[$country]['name']);
180 180
                 $serverInfo = $externalDb->listExternalTlsServersFederation($fed->tld);
181
-                $DN[] = "CN=" . $serverList[0];
181
+                $DN[] = "CN=".$serverList[0];
182 182
                 $policies[] = "eduroam IdP";
183 183
                 $policies[] = "eduroam SP";
184 184
                 $firstName = $serverInfo[array_key_first($serverInfo)][0]["name"];
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
                     throw new Exception(sprintf("Sorry: you are not %s admin for the %s requested in the form.", $uiElements->nomenclatureFed, $uiElements->nomenclatureFed));
194 194
                 }
195 195
                 $country = strtoupper($matches[1]);
196
-                $code = isset($cat->knownFederations[$country]['code']) ? $cat->knownFederations[$country]['code'] : $country ;
196
+                $code = isset($cat->knownFederations[$country]['code']) ? $cat->knownFederations[$country]['code'] : $country;
197 197
                 $DN[] = "C=$code";
198 198
                 $serverInfo = $extInsts[$_POST['INST-list']];
199 199
                 if (isset($serverInfo["names"]["en"])) {
@@ -205,14 +205,14 @@  discard block
 block discarded – undo
205 205
 		    $modou = 1;
206 206
 		    $ou = str_replace(",", "/,", $ou);
207 207
 		}
208
-		$ou = preg_replace('/\s+/', ' ',  $ou);
208
+		$ou = preg_replace('/\s+/', ' ', $ou);
209 209
 		if (strlen($ou) >= 64) {
210 210
 			$ou = substr($ou, 0, 64);
211 211
 			$modou += 2;
212 212
 		}
213 213
                 $DN[] = "O=".iconv('UTF-8', 'ASCII//TRANSLIT', $ou);
214 214
                 $serverList = explode(",", $serverInfo["servers"]);
215
-                $DN[] = "CN=" . $serverList[0];
215
+                $DN[] = "CN=".$serverList[0];
216 216
                 switch ($serverInfo["type"]) {
217 217
                     case core\IdP::TYPE_IDPSP:
218 218
                         $policies[] = "eduroam IdP";
@@ -231,13 +231,13 @@  discard block
 block discarded – undo
231 231
             default:
232 232
                 throw new Exception("Sorry: Unknown level of issuance requested.");
233 233
         }
234
-        echo "<p style='font-size: large'>" . _("Requesting a certificate with the following properties");
234
+        echo "<p style='font-size: large'>"._("Requesting a certificate with the following properties");
235 235
         echo "<ul>";
236
-        echo "<li>" . _("Policy OIDs: ") . implode(", ", $policies) . "</li>";
237
-	echo "<li>" . _("Distinguished Name: ") . implode(", ", $DN);
236
+        echo "<li>"._("Policy OIDs: ").implode(", ", $policies)."</li>";
237
+	echo "<li>"._("Distinguished Name: ").implode(", ", $DN);
238 238
 	if ($modou > 0) {
239 239
 	    echo " (";
240
-            echo _("Organization field adjusted"). ': ';
240
+            echo _("Organization field adjusted").': ';
241 241
 	    $desc = array();
242 242
 	    if ($modou >= 2) {
243 243
 		$desc[] = _("truncated to 64 chars");
@@ -249,8 +249,8 @@  discard block
 block discarded – undo
249 249
 	    echo ")";
250 250
 	}
251 251
         echo "</li>";
252
-        echo "<li>" . _("subjectAltName:DNS : ") . implode(", ", $serverList) . "</li>";
253
-        echo "<li>" . _("Requester Contact Details: ") . $firstName . " &lt;" . $firstMail . "&gt;" . "</li>";
252
+        echo "<li>"._("subjectAltName:DNS : ").implode(", ", $serverList)."</li>";
253
+        echo "<li>"._("Requester Contact Details: ").$firstName." &lt;".$firstMail."&gt;"."</li>";
254 254
         echo "</ul></p>";
255 255
         $vettedCsr = $validator->string($_POST['CSR'], true);
256 256
         $newCsrWithMeta = [
@@ -265,11 +265,11 @@  discard block
 block discarded – undo
265 265
         $loggerInstance->debug(2, $DN, "CERT DN: ", "\n");
266 266
         // our certs can be good for max 5 years
267 267
         $fed->requestCertificate($user->identifier, $newCsrWithMeta, $expiryDays);
268
-        echo "<p>" . _("The certificate was requested.") . "</p>";
268
+        echo "<p>"._("The certificate was requested.")."</p>";
269 269
         if (isset($_SESSION['CSR_ERRORS']) && $_SESSION['CSR_ERRORS'] == 'SOAP_ERROR') {
270
-            print '<h3 id="errorbox"><font color="red">'. $messages[$_SESSION['CSR_ERRORS']];
270
+            print '<h3 id="errorbox"><font color="red">'.$messages[$_SESSION['CSR_ERRORS']];
271 271
             if (isset($_SESSION['csr_faultcode'])) {
272
-                print '<br>'. _('Reason') . ': '. $_SESSION['csr_faultcode'];
272
+                print '<br>'._('Reason').': '.$_SESSION['csr_faultcode'];
273 273
                 unset($_SESSION['csr_faultcode']);
274 274
             }
275 275
             unset($_SESSION['CSR_ERRORS']);
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
         switch (count($feds)) {
294 294
             case 0:
295 295
                 echo "<div>";
296
-                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."));
296
+                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."));
297 297
                 echo "</div>";
298 298
                 break;
299 299
             case 1:
@@ -301,22 +301,22 @@  discard block
 block discarded – undo
301 301
                 if (empty($settings) || (isset($settings['LEVEL']) && $settings['LEVEL'] == 'NRO')) {
302 302
                     echo ' checked';
303 303
                 }
304
-                echo '>' . sprintf(_("Certificate for %s") ." ", $uiElements->nomenclatureFed) . '</input>';
305
-                echo " <strong>" . $cat->knownFederations[$feds[0]->tld]['name'] . "</strong>";
306
-                echo '<input type="hidden" name="NRO-list" id="NRO-list" value="' . $feds[0]->tld . '"/>';
304
+                echo '>'.sprintf(_("Certificate for %s")." ", $uiElements->nomenclatureFed).'</input>';
305
+                echo " <strong>".$cat->knownFederations[$feds[0]->tld]['name']."</strong>";
306
+                echo '<input type="hidden" name="NRO-list" id="NRO-list" value="'.$feds[0]->tld.'"/>';
307 307
                 break;
308 308
             default:
309 309
                 echo '<input type="radio" name="LEVEL" id="NRO" value="NRO"';
310 310
                 if (empty($settings) || isset($settings['LEVEL']) && $settings['LEVEL'] == 'NRO') {
311 311
                     echo ' checked';
312 312
                 }
313
-                echo '>' . sprintf(_("Certificate for %s") ." ", $uiElements->nomenclatureFed) . '</input>';
313
+                echo '>'.sprintf(_("Certificate for %s")." ", $uiElements->nomenclatureFed).'</input>';
314 314
                 ?>
315 315
                 <select name="NRO-list" id="NRO-list">
316 316
                     <option value="notset"><?php echo _("---PLEASE CHOOSE---"); ?></option>
317 317
                     <?php
318 318
                     foreach ($feds as $oneFed) {
319
-                        echo '<option value="' . strtoupper($oneFed->tld) . '">' . $cat->knownFederations[$oneFed->tld]['name'] . "</option>";
319
+                        echo '<option value="'.strtoupper($oneFed->tld).'">'.$cat->knownFederations[$oneFed->tld]['name']."</option>";
320 320
                         #echo '<option value="AAA' . strtoupper($oneFed->tld) . '">' . $oneIdP["names"][$langObject->getLang()] . "</option>";
321 321
                         
322 322
                     }
@@ -329,21 +329,21 @@  discard block
 block discarded – undo
329 329
         <script>
330 330
             var instservers = [];
331 331
             var instpolicies = [];
332
-            var nroservers = '<?php echo str_replace(",", ", ", array_key_first($serverInfo));?>';
332
+            var nroservers = '<?php echo str_replace(",", ", ", array_key_first($serverInfo)); ?>';
333 333
         <?php 
334 334
         $allIdPs = [];
335 335
         foreach ($allAuthorizedFeds as $oneFed) {
336 336
             foreach ($externalDb->listExternalTlsServersInstitution($oneFed['value']) as $id => $oneIdP) {
337
-                if (count($oneIdP['contacts']) ==0) {
337
+                if (count($oneIdP['contacts']) == 0) {
338 338
                     continue;
339 339
                 }
340
-                $allIdPs[$id] = '[' . substr($id, 0, 2) . '] ' . $oneIdP["name"];            
341
-                echo "instservers['" . $id . "']='" . str_replace(",", ", ", $oneIdP["servers"]) . "';\n";
342
-                echo "instpolicies['" . $id . "']='";
340
+                $allIdPs[$id] = '['.substr($id, 0, 2).'] '.$oneIdP["name"];            
341
+                echo "instservers['".$id."']='".str_replace(",", ", ", $oneIdP["servers"])."';\n";
342
+                echo "instpolicies['".$id."']='";
343 343
                 if ($oneIdP["type"] == 'IdPSP') {
344 344
                     echo "eduroam IdP/SP";
345 345
                 } else {
346
-                    echo "eduroam " . $oneIdP["type"];
346
+                    echo "eduroam ".$oneIdP["type"];
347 347
                 }
348 348
                 echo "';\n";
349 349
             }
@@ -391,9 +391,9 @@  discard block
 block discarded – undo
391 391
             <option value="notset"><?php echo _("---PLEASE CHOOSE---"); ?></option>
392 392
 <?php
393 393
 foreach ($allIdPs as $id => $name) {
394
-    echo '<option value="' . $id . '"';
394
+    echo '<option value="'.$id.'"';
395 395
     if (isset($settings['INST-list']) && $settings['INST-list'] == $id) { echo ' selected'; }
396
-    echo '>' . $name . "</option>";
396
+    echo '>'.$name."</option>";
397 397
 }
398 398
 ?>
399 399
         </select>
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
             <?php
408 408
             echo _('According to the above settings you will receive')
409 409
             ?>
410
-            <span id='certlevel'><?php echo _('NRO level certificate');?></span>
410
+            <span id='certlevel'><?php echo _('NRO level certificate'); ?></span>
411 411
             
412 412
         for server names:
413 413
         <span id='serversinfo'><?php echo str_replace(",", ", ", array_key_first($serverInfo)); ?></span>
@@ -424,12 +424,12 @@  discard block
 block discarded – undo
424 424
         <?php
425 425
         } else {
426 426
             echo "<div>";
427
-            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);
427
+            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);
428 428
             echo "</div>";
429 429
         }
430 430
         ?>
431 431
         <?php
432
-        echo '<div id="ondb"><h4 style="margin: 0">' . _("Can't you find an institution on the select list above?") . '</h4>';
432
+        echo '<div id="ondb"><h4 style="margin: 0">'._("Can't you find an institution on the select list above?").'</h4>';
433 433
         echo _("Most likely we do not have required data on this institution in the eduroam database.");
434 434
         echo '<br/>';
435 435
         ?>
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
         <?php
438 438
         echo _('On this page');
439 439
         echo '</a> ';
440
-        echo _('you can check what information is in the datatabase') . '.';
440
+        echo _('you can check what information is in the datatabase').'.';
441 441
         echo '</div>';
442 442
         if (count($feds) > 0 || count($allIdPs) > 0) {?>
443 443
         <h2><?php echo _("2. CSR generation"); ?></h2>
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
         echo '<br>';
448 448
         echo _("One way to generate an acceptable certificate request is via this openssl one-liner:"); ?></p>
449 449
         <?php 
450
-        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>";
450
+        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>";
451 451
         ?>
452 452
         <h2><?php echo _("3. Submission"); ?></h2>
453 453
 <?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.