Passed
Push — release_2_1 ( 1b6202...782783 )
by Maja
09:49 queued 13s
created
web/admin/action_req_certificate.php 2 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -130,16 +130,16 @@  discard block
 block discarded – undo
130 130
                 } else {
131 131
                     $ou = $serverInfo["names"][$langInstance->getLang()];
132 132
                 }
133
-		$modou = 0;
134
-		if (str_contains($ou, ',')) {
135
-		    $modou = 1;
136
-		    $ou = str_replace(",", "/,", $ou);
137
-		}
138
-		$ou = preg_replace('/\s+/', ' ',  $ou);
139
-		if (strlen($ou) >= 64) {
140
-			$ou = substr($ou, 0, 64);
141
-			$modou += 2;
142
-		}
133
+        $modou = 0;
134
+        if (str_contains($ou, ',')) {
135
+            $modou = 1;
136
+            $ou = str_replace(",", "/,", $ou);
137
+        }
138
+        $ou = preg_replace('/\s+/', ' ',  $ou);
139
+        if (strlen($ou) >= 64) {
140
+            $ou = substr($ou, 0, 64);
141
+            $modou += 2;
142
+        }
143 143
                 $DN[] = "O=".iconv('UTF-8', 'ASCII//TRANSLIT', $ou);
144 144
                 $serverList = explode(",", $serverInfo["servers"]);
145 145
                 $DN[] = "CN=" . $serverList[0];
@@ -164,20 +164,20 @@  discard block
 block discarded – undo
164 164
         echo "<p style='font-size: large'>" . _("Requesting a certificate with the following properties");
165 165
         echo "<ul>";
166 166
         echo "<li>" . _("Policy OIDs: ") . implode(", ", $policies) . "</li>";
167
-	echo "<li>" . _("Distinguished Name: ") . implode(", ", $DN);
168
-	if ($modou > 0) {
169
-	    echo " (";
167
+    echo "<li>" . _("Distinguished Name: ") . implode(", ", $DN);
168
+    if ($modou > 0) {
169
+        echo " (";
170 170
             echo _("Organization field adjusted"). ': ';
171
-	    $desc = array();
172
-	    if ($modou >= 2) {
173
-		$desc[] = _("truncated to 64 chars");
174
-	    }
175
-	    if ($modou == 1 || $modou == 3) {
176
-		$desc[] = _("commas escaped");
171
+        $desc = array();
172
+        if ($modou >= 2) {
173
+        $desc[] = _("truncated to 64 chars");
174
+        }
175
+        if ($modou == 1 || $modou == 3) {
176
+        $desc[] = _("commas escaped");
177 177
             }
178
-	    echo implode(', ', $desc);
179
-	    echo ")";
180
-	}
178
+        echo implode(', ', $desc);
179
+        echo ")";
180
+    }
181 181
         echo "</li>";
182 182
         echo "<li>" . _("subjectAltName:DNS : ") . implode(", ", $serverList) . "</li>";
183 183
         echo "<li>" . _("Requester Contact Details: ") . $firstName . " &lt;" . $firstMail . "&gt;" . "</li>";
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 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();
@@ -105,10 +105,10 @@  discard block
 block discarded – undo
105 105
                 $fed = $validator->existingFederation($_POST['NRO-list']);
106 106
                 $country = strtoupper($fed->tld);
107 107
                 $DN[] = "C=$country";
108
-                $DN[] = "O=NRO of " . iconv('UTF-8', 'ASCII//TRANSLIT', $cat->knownFederations[strtoupper($fed->tld)]);
108
+                $DN[] = "O=NRO of ".iconv('UTF-8', 'ASCII//TRANSLIT', $cat->knownFederations[strtoupper($fed->tld)]);
109 109
                 $serverInfo = $externalDb->listExternalTlsServersFederation($fed->tld);
110 110
                 $serverList = explode(",", array_key_first($serverInfo));
111
-                $DN[] = "CN=" . $serverList[0];
111
+                $DN[] = "CN=".$serverList[0];
112 112
                 $policies[] = "eduroam IdP";
113 113
                 $policies[] = "eduroam SP";
114 114
                 $firstName = $serverInfo[array_key_first($serverInfo)][0]["name"];
@@ -135,14 +135,14 @@  discard block
 block discarded – undo
135 135
 		    $modou = 1;
136 136
 		    $ou = str_replace(",", "/,", $ou);
137 137
 		}
138
-		$ou = preg_replace('/\s+/', ' ',  $ou);
138
+		$ou = preg_replace('/\s+/', ' ', $ou);
139 139
 		if (strlen($ou) >= 64) {
140 140
 			$ou = substr($ou, 0, 64);
141 141
 			$modou += 2;
142 142
 		}
143 143
                 $DN[] = "O=".iconv('UTF-8', 'ASCII//TRANSLIT', $ou);
144 144
                 $serverList = explode(",", $serverInfo["servers"]);
145
-                $DN[] = "CN=" . $serverList[0];
145
+                $DN[] = "CN=".$serverList[0];
146 146
                 switch ($serverInfo["type"]) {
147 147
                     case core\IdP::TYPE_IDPSP:
148 148
                         $policies[] = "eduroam IdP";
@@ -161,13 +161,13 @@  discard block
 block discarded – undo
161 161
             default:
162 162
                 throw new Exception("Sorry: Unknown level of issuance requested.");
163 163
         }
164
-        echo "<p style='font-size: large'>" . _("Requesting a certificate with the following properties");
164
+        echo "<p style='font-size: large'>"._("Requesting a certificate with the following properties");
165 165
         echo "<ul>";
166
-        echo "<li>" . _("Policy OIDs: ") . implode(", ", $policies) . "</li>";
167
-	echo "<li>" . _("Distinguished Name: ") . implode(", ", $DN);
166
+        echo "<li>"._("Policy OIDs: ").implode(", ", $policies)."</li>";
167
+	echo "<li>"._("Distinguished Name: ").implode(", ", $DN);
168 168
 	if ($modou > 0) {
169 169
 	    echo " (";
170
-            echo _("Organization field adjusted"). ': ';
170
+            echo _("Organization field adjusted").': ';
171 171
 	    $desc = array();
172 172
 	    if ($modou >= 2) {
173 173
 		$desc[] = _("truncated to 64 chars");
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
 	    echo ")";
180 180
 	}
181 181
         echo "</li>";
182
-        echo "<li>" . _("subjectAltName:DNS : ") . implode(", ", $serverList) . "</li>";
183
-        echo "<li>" . _("Requester Contact Details: ") . $firstName . " &lt;" . $firstMail . "&gt;" . "</li>";
182
+        echo "<li>"._("subjectAltName:DNS : ").implode(", ", $serverList)."</li>";
183
+        echo "<li>"._("Requester Contact Details: ").$firstName." &lt;".$firstMail."&gt;"."</li>";
184 184
         echo "</ul></p>";
185 185
 
186 186
         $vettedCsr = $validator->string($_POST['CSR'], true);
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         $loggerInstance->debug(2, $DN, "CERT DN: ", "\n");
197 197
         // our certs can be good for max 5 years
198 198
         $fed->requestCertificate($user->identifier, $newCsrWithMeta, $expiryDays);
199
-        echo "<p>" . _("The certificate was requested.") . "</p>";
199
+        echo "<p>"._("The certificate was requested.")."</p>";
200 200
         ?>
201 201
         <form action="overview_certificates.php" method="GET">
202 202
             <button type="submit"><?php echo _("Back to Certificate Overview"); ?></button>
@@ -214,23 +214,23 @@  discard block
 block discarded – undo
214 214
         switch (count($feds)) {
215 215
             case 0:
216 216
                 echo "<div>";
217
-                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."));
217
+                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."));
218 218
                 echo "</div>";
219 219
                 break;
220 220
             case 1:
221
-                echo '<input type="radio" name="LEVEL" id="NRO" value="NRO" checked>' . sprintf(_("Certificate for %s") ." ", $uiElements->nomenclatureFed) . '</input>';
222
-                echo " <strong>" . $cat->knownFederations[$feds[0]->tld] . "</strong>";
223
-                echo '<input type="hidden" name="NRO-list" id="NRO-list" value="' . $feds[0]->tld . '"/>';
221
+                echo '<input type="radio" name="LEVEL" id="NRO" value="NRO" checked>'.sprintf(_("Certificate for %s")." ", $uiElements->nomenclatureFed).'</input>';
222
+                echo " <strong>".$cat->knownFederations[$feds[0]->tld]."</strong>";
223
+                echo '<input type="hidden" name="NRO-list" id="NRO-list" value="'.$feds[0]->tld.'"/>';
224 224
                 break;
225 225
             default:
226
-                echo '<input type="radio" name="LEVEL" id="NRO" value="NRO" checked>' . sprintf(_("Certificate for %s") ." ", $uiElements->nomenclatureFed) . '</input>';
226
+                echo '<input type="radio" name="LEVEL" id="NRO" value="NRO" checked>'.sprintf(_("Certificate for %s")." ", $uiElements->nomenclatureFed).'</input>';
227 227
                 ?>
228 228
                 <select name="NRO-list" id="NRO-list">
229 229
                     <option value="notset"><?php echo _("---PLEASE CHOOSE---"); ?></option>
230 230
                     <?php
231 231
                     foreach ($feds as $oneFed) {
232 232
                         #echo '<option value="' . strtoupper($oneFed->tld) . '">' . $cat->knownFederations[$oneFed->tld] . "</option>";
233
-                        echo '<option value="AAA' . strtoupper($oneFed->tld) . '">' . $oneIdP["names"][$langObject->getLang()] . "</option>";
233
+                        echo '<option value="AAA'.strtoupper($oneFed->tld).'">'.$oneIdP["names"][$langObject->getLang()]."</option>";
234 234
                         
235 235
                     }
236 236
                     ?>
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
         ?>
242 242
         <script>
243 243
             var instservers = [];
244
-            var nroservers = '<?php echo str_replace(",", ", ", array_key_first($serverInfo));?>';
244
+            var nroservers = '<?php echo str_replace(",", ", ", array_key_first($serverInfo)); ?>';
245 245
         <?php   
246 246
         $allIdPs = [];
247 247
         foreach ($allAuthorizedFeds as $oneFed) {
248 248
             foreach ($externalDb->listExternalTlsServersInstitution($oneFed['value']) as $id => $oneIdP) {
249
-                $allIdPs[$id] = '[' . substr($id, 0, 2) . '] ' . $oneIdP["names"][$langObject->getLang()];
250
-                echo "instservers['" . $id . "']='" . str_replace(",", ", ", $oneIdP["servers"]) . "';\n";
249
+                $allIdPs[$id] = '['.substr($id, 0, 2).'] '.$oneIdP["names"][$langObject->getLang()];
250
+                echo "instservers['".$id."']='".str_replace(",", ", ", $oneIdP["servers"])."';\n";
251 251
             }
252 252
         }
253 253
         ?>
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
             <option value="notset"><?php echo _("---PLEASE CHOOSE---"); ?></option>
276 276
 <?php
277 277
 foreach ($allIdPs as $id => $name) {
278
-    echo '<option value="' . $id . '">' . $name . "</option>";
278
+    echo '<option value="'.$id.'">'.$name."</option>";
279 279
 }
280 280
 ?>
281 281
         </select>
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
             <?php 
285 285
             echo _('According to the above settings you will receive')
286 286
             ?>
287
-            <span id='certlevel'><?php echo _('NRO level certificate');?></span>
287
+            <span id='certlevel'><?php echo _('NRO level certificate'); ?></span>
288 288
             
289 289
         </span>for server names:
290 290
         <span id='serversinfo'><?php echo str_replace(",", ", ", array_key_first($serverInfo)); ?></span>
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
         <?php
293 293
         } else {
294 294
             echo "<div>";
295
-            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);
295
+            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);
296 296
             echo "</div>";
297 297
         }
298 298
         ?>
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
         <h2><?php echo _("2. CSR generation"); ?></h2>
303 303
         <p><?php echo _("One way to generate an acceptable certificate request is via this openssl one-liner:"); ?></p>
304 304
         <?php 
305
-        echo "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";
305
+        echo "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";
306 306
         ?>
307 307
         <h2><?php echo _("3. Submission"); ?></h2>
308 308
 <?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.