@@ -91,7 +91,7 @@ discard block |
||
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 extracts the public key from CSR') |
96 | 96 | ]; |
97 | 97 | $settings = array(); |
@@ -168,16 +168,16 @@ discard block |
||
168 | 168 | $ou = $serverInfo["names"][$langInstance->getLang()]; |
169 | 169 | } |
170 | 170 | print($ou); |
171 | - $modou = 0; |
|
172 | - if (str_contains($ou, ',')) { |
|
173 | - $modou = 1; |
|
174 | - $ou = str_replace(",", "/,", $ou); |
|
175 | - } |
|
176 | - $ou = preg_replace('/\s+/', ' ', $ou); |
|
177 | - if (strlen($ou) >= 64) { |
|
178 | - $ou = substr($ou, 0, 64); |
|
179 | - $modou += 2; |
|
180 | - } |
|
171 | + $modou = 0; |
|
172 | + if (str_contains($ou, ',')) { |
|
173 | + $modou = 1; |
|
174 | + $ou = str_replace(",", "/,", $ou); |
|
175 | + } |
|
176 | + $ou = preg_replace('/\s+/', ' ', $ou); |
|
177 | + if (strlen($ou) >= 64) { |
|
178 | + $ou = substr($ou, 0, 64); |
|
179 | + $modou += 2; |
|
180 | + } |
|
181 | 181 | $DN[] = "O=".iconv('UTF-8', 'ASCII//TRANSLIT', $ou); |
182 | 182 | $serverList = explode(",", $serverInfo["servers"]); |
183 | 183 | $DN[] = "CN=" . $serverList[0]; |
@@ -202,20 +202,20 @@ discard block |
||
202 | 202 | echo "<p style='font-size: large'>" . _("Requesting a certificate with the following properties"); |
203 | 203 | echo "<ul>"; |
204 | 204 | echo "<li>" . _("Policy OIDs: ") . implode(", ", $policies) . "</li>"; |
205 | - echo "<li>" . _("Distinguished Name: ") . implode(", ", $DN); |
|
206 | - if ($modou > 0) { |
|
207 | - echo " ("; |
|
205 | + echo "<li>" . _("Distinguished Name: ") . implode(", ", $DN); |
|
206 | + if ($modou > 0) { |
|
207 | + echo " ("; |
|
208 | 208 | echo _("Organization field adjusted"). ': '; |
209 | - $desc = array(); |
|
210 | - if ($modou >= 2) { |
|
211 | - $desc[] = _("truncated to 64 chars"); |
|
212 | - } |
|
213 | - if ($modou == 1 || $modou == 3) { |
|
214 | - $desc[] = _("commas escaped"); |
|
209 | + $desc = array(); |
|
210 | + if ($modou >= 2) { |
|
211 | + $desc[] = _("truncated to 64 chars"); |
|
212 | + } |
|
213 | + if ($modou == 1 || $modou == 3) { |
|
214 | + $desc[] = _("commas escaped"); |
|
215 | 215 | } |
216 | - echo implode(', ', $desc); |
|
217 | - echo ")"; |
|
218 | - } |
|
216 | + echo implode(', ', $desc); |
|
217 | + echo ")"; |
|
218 | + } |
|
219 | 219 | echo "</li>"; |
220 | 220 | echo "<li>" . _("subjectAltName:DNS : ") . implode(", ", $serverList) . "</li>"; |
221 | 221 | echo "<li>" . _("Requester Contact Details: ") . $firstName . " <" . $firstMail . ">" . "</li>"; |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | <?php if (empty($policies)) {?> |
358 | 358 | eduroam IdP/SP |
359 | 359 | <?php } else { |
360 | - echo implode(', ', $policies); |
|
360 | + echo implode(', ', $policies); |
|
361 | 361 | }?> |
362 | 362 | </span> |
363 | 363 | </h3> |
@@ -27,7 +27,7 @@ discard block |
||
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 |
||
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 extracts 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 |
||
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(); |
@@ -142,10 +142,10 @@ discard block |
||
142 | 142 | $fed = $validator->existingFederation($_POST['NRO-list']); |
143 | 143 | $country = strtoupper($fed->tld); |
144 | 144 | $DN[] = "C=$country"; |
145 | - $DN[] = "O=NRO of " . iconv('UTF-8', 'ASCII//TRANSLIT', $cat->knownFederations[strtoupper($fed->tld)]); |
|
145 | + $DN[] = "O=NRO of ".iconv('UTF-8', 'ASCII//TRANSLIT', $cat->knownFederations[strtoupper($fed->tld)]); |
|
146 | 146 | $serverInfo = $externalDb->listExternalTlsServersFederation($fed->tld); |
147 | 147 | $serverList = explode(",", array_key_first($serverInfo)); |
148 | - $DN[] = "CN=" . $serverList[0]; |
|
148 | + $DN[] = "CN=".$serverList[0]; |
|
149 | 149 | $policies[] = "eduroam IdP"; |
150 | 150 | $policies[] = "eduroam SP"; |
151 | 151 | $firstName = $serverInfo[array_key_first($serverInfo)][0]["name"]; |
@@ -173,14 +173,14 @@ discard block |
||
173 | 173 | $modou = 1; |
174 | 174 | $ou = str_replace(",", "/,", $ou); |
175 | 175 | } |
176 | - $ou = preg_replace('/\s+/', ' ', $ou); |
|
176 | + $ou = preg_replace('/\s+/', ' ', $ou); |
|
177 | 177 | if (strlen($ou) >= 64) { |
178 | 178 | $ou = substr($ou, 0, 64); |
179 | 179 | $modou += 2; |
180 | 180 | } |
181 | 181 | $DN[] = "O=".iconv('UTF-8', 'ASCII//TRANSLIT', $ou); |
182 | 182 | $serverList = explode(",", $serverInfo["servers"]); |
183 | - $DN[] = "CN=" . $serverList[0]; |
|
183 | + $DN[] = "CN=".$serverList[0]; |
|
184 | 184 | switch ($serverInfo["type"]) { |
185 | 185 | case core\IdP::TYPE_IDPSP: |
186 | 186 | $policies[] = "eduroam IdP"; |
@@ -199,13 +199,13 @@ discard block |
||
199 | 199 | default: |
200 | 200 | throw new Exception("Sorry: Unknown level of issuance requested."); |
201 | 201 | } |
202 | - echo "<p style='font-size: large'>" . _("Requesting a certificate with the following properties"); |
|
202 | + echo "<p style='font-size: large'>"._("Requesting a certificate with the following properties"); |
|
203 | 203 | echo "<ul>"; |
204 | - echo "<li>" . _("Policy OIDs: ") . implode(", ", $policies) . "</li>"; |
|
205 | - echo "<li>" . _("Distinguished Name: ") . implode(", ", $DN); |
|
204 | + echo "<li>"._("Policy OIDs: ").implode(", ", $policies)."</li>"; |
|
205 | + echo "<li>"._("Distinguished Name: ").implode(", ", $DN); |
|
206 | 206 | if ($modou > 0) { |
207 | 207 | echo " ("; |
208 | - echo _("Organization field adjusted"). ': '; |
|
208 | + echo _("Organization field adjusted").': '; |
|
209 | 209 | $desc = array(); |
210 | 210 | if ($modou >= 2) { |
211 | 211 | $desc[] = _("truncated to 64 chars"); |
@@ -217,8 +217,8 @@ discard block |
||
217 | 217 | echo ")"; |
218 | 218 | } |
219 | 219 | echo "</li>"; |
220 | - echo "<li>" . _("subjectAltName:DNS : ") . implode(", ", $serverList) . "</li>"; |
|
221 | - echo "<li>" . _("Requester Contact Details: ") . $firstName . " <" . $firstMail . ">" . "</li>"; |
|
220 | + echo "<li>"._("subjectAltName:DNS : ").implode(", ", $serverList)."</li>"; |
|
221 | + echo "<li>"._("Requester Contact Details: ").$firstName." <".$firstMail.">"."</li>"; |
|
222 | 222 | echo "</ul></p>"; |
223 | 223 | |
224 | 224 | $vettedCsr = $validator->string($_POST['CSR'], true); |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | $loggerInstance->debug(2, $DN, "CERT DN: ", "\n"); |
235 | 235 | // our certs can be good for max 5 years |
236 | 236 | $fed->requestCertificate($user->identifier, $newCsrWithMeta, $expiryDays); |
237 | - echo "<p>" . _("The certificate was requested.") . "</p>"; |
|
237 | + echo "<p>"._("The certificate was requested.")."</p>"; |
|
238 | 238 | ?> |
239 | 239 | <form action="overview_certificates.php" method="GET"> |
240 | 240 | <button type="submit"><?php echo _("Back to Certificate Overview"); ?></button> |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | switch (count($feds)) { |
253 | 253 | case 0: |
254 | 254 | echo "<div>"; |
255 | - 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.")); |
|
255 | + 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.")); |
|
256 | 256 | echo "</div>"; |
257 | 257 | break; |
258 | 258 | case 1: |
@@ -260,22 +260,22 @@ discard block |
||
260 | 260 | if (empty($settings) || (isset($settings['LEVEL']) && $settings['LEVEL'] == 'NRO')) { |
261 | 261 | echo ' checked'; |
262 | 262 | } |
263 | - echo '>' . sprintf(_("Certificate for %s") ." ", $uiElements->nomenclatureFed) . '</input>'; |
|
264 | - echo " <strong>" . $cat->knownFederations[$feds[0]->tld] . "</strong>"; |
|
265 | - echo '<input type="hidden" name="NRO-list" id="NRO-list" value="' . $feds[0]->tld . '"/>'; |
|
263 | + echo '>'.sprintf(_("Certificate for %s")." ", $uiElements->nomenclatureFed).'</input>'; |
|
264 | + echo " <strong>".$cat->knownFederations[$feds[0]->tld]."</strong>"; |
|
265 | + echo '<input type="hidden" name="NRO-list" id="NRO-list" value="'.$feds[0]->tld.'"/>'; |
|
266 | 266 | break; |
267 | 267 | default: |
268 | 268 | echo '<input type="radio" name="LEVEL" id="NRO" value="NRO"'; |
269 | 269 | if (empty($settings) || isset($settings['LEVEL']) && $settings['LEVEL'] == 'NRO') { |
270 | 270 | echo ' checked'; |
271 | 271 | } |
272 | - echo '>' . sprintf(_("Certificate for %s") ." ", $uiElements->nomenclatureFed) . '</input>'; |
|
272 | + echo '>'.sprintf(_("Certificate for %s")." ", $uiElements->nomenclatureFed).'</input>'; |
|
273 | 273 | ?> |
274 | 274 | <select name="NRO-list" id="NRO-list"> |
275 | 275 | <option value="notset"><?php echo _("---PLEASE CHOOSE---"); ?></option> |
276 | 276 | <?php |
277 | 277 | foreach ($feds as $oneFed) { |
278 | - echo '<option value="' . strtoupper($oneFed->tld) . '">' . $cat->knownFederations[$oneFed->tld] . "</option>"; |
|
278 | + echo '<option value="'.strtoupper($oneFed->tld).'">'.$cat->knownFederations[$oneFed->tld]."</option>"; |
|
279 | 279 | #echo '<option value="AAA' . strtoupper($oneFed->tld) . '">' . $oneIdP["names"][$langObject->getLang()] . "</option>"; |
280 | 280 | |
281 | 281 | } |
@@ -288,18 +288,18 @@ discard block |
||
288 | 288 | <script> |
289 | 289 | var instservers = []; |
290 | 290 | var instpolicies = []; |
291 | - var nroservers = '<?php echo str_replace(",", ", ", array_key_first($serverInfo));?>'; |
|
291 | + var nroservers = '<?php echo str_replace(",", ", ", array_key_first($serverInfo)); ?>'; |
|
292 | 292 | <?php |
293 | 293 | $allIdPs = []; |
294 | 294 | foreach ($allAuthorizedFeds as $oneFed) { |
295 | 295 | foreach ($externalDb->listExternalTlsServersInstitution($oneFed['value']) as $id => $oneIdP) { |
296 | - $allIdPs[$id] = '[' . substr($id, 0, 2) . '] ' . $oneIdP["names"][$langObject->getLang()]; |
|
297 | - echo "instservers['" . $id . "']='" . str_replace(",", ", ", $oneIdP["servers"]) . "';\n"; |
|
298 | - echo "instpolicies['" . $id . "']='"; |
|
296 | + $allIdPs[$id] = '['.substr($id, 0, 2).'] '.$oneIdP["names"][$langObject->getLang()]; |
|
297 | + echo "instservers['".$id."']='".str_replace(",", ", ", $oneIdP["servers"])."';\n"; |
|
298 | + echo "instpolicies['".$id."']='"; |
|
299 | 299 | if ($oneIdP["type"] == 'IdPSP') { |
300 | 300 | echo "eduroam IdP/SP"; |
301 | 301 | } else { |
302 | - echo "eduroam " . $oneIdP["type"]; |
|
302 | + echo "eduroam ".$oneIdP["type"]; |
|
303 | 303 | } |
304 | 304 | echo "';\n"; |
305 | 305 | } |
@@ -337,9 +337,9 @@ discard block |
||
337 | 337 | <option value="notset"><?php echo _("---PLEASE CHOOSE---"); ?></option> |
338 | 338 | <?php |
339 | 339 | foreach ($allIdPs as $id => $name) { |
340 | - echo '<option value="' . $id . '"'; |
|
340 | + echo '<option value="'.$id.'"'; |
|
341 | 341 | if (isset($settings['INST-list']) && $settings['INST-list'] == $id) { echo ' selected'; } |
342 | - echo '>' . $name . "</option>"; |
|
342 | + echo '>'.$name."</option>"; |
|
343 | 343 | } |
344 | 344 | ?> |
345 | 345 | </select> |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | <?php |
349 | 349 | echo _('According to the above settings you will receive') |
350 | 350 | ?> |
351 | - <span id='certlevel'><?php echo _('NRO level certificate');?></span> |
|
351 | + <span id='certlevel'><?php echo _('NRO level certificate'); ?></span> |
|
352 | 352 | |
353 | 353 | for server names: |
354 | 354 | <span id='serversinfo'><?php echo str_replace(",", ", ", array_key_first($serverInfo)); ?></span> |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | <?php |
365 | 365 | } else { |
366 | 366 | echo "<div>"; |
367 | - 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); |
|
367 | + 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); |
|
368 | 368 | echo "</div>"; |
369 | 369 | } |
370 | 370 | ?> |
@@ -374,10 +374,10 @@ discard block |
||
374 | 374 | <h2><?php echo _("2. CSR generation"); ?></h2> |
375 | 375 | <p> |
376 | 376 | <?php |
377 | - echo _("The CSR subject field has to start with ") .'<b>' . $subject_prefix . '</b><br>'; |
|
377 | + echo _("The CSR subject field has to start with ").'<b>'.$subject_prefix.'</b><br>'; |
|
378 | 378 | echo _("One way to generate an acceptable certificate request is via this openssl one-liner:"); ?></p> |
379 | 379 | <?php |
380 | - 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>"; |
|
380 | + 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>"; |
|
381 | 381 | ?> |
382 | 382 | <h2><?php echo _("3. Submission"); ?></h2> |
383 | 383 | <?php echo _("Please paste your CSR here:"); ?><br/><textarea name="CSR" id="CSR" rows="20" cols="85"/></textarea><br/> |