Passed
Push — release_2_1 ( 8e2e74...55cceb )
by Tomasz
10:20
created
web/admin/edit_silverbullet.php 1 patch
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 /*
21 21
  * Class autoloader invocation, should be included prior to any other code at the entry points to the application
22 22
  */
23
-require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php";
23
+require_once dirname(dirname(dirname(__FILE__)))."/config/_config.php";
24 24
 
25 25
 $auth = new \web\lib\admin\Authentication();
26 26
 $auth->authenticate();
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     $fed = new \core\Federation($inst->federation);
54 54
     $allowSb = $fed->getAttributes("fed:silverbullet");
55 55
     if (count($allowSb) == 0) {
56
-        throw new Exception("We were told to create a new SB profile, but this " . \config\ConfAssistant::CONSORTIUM['nomenclature_federation'] . " does not allow SB at all!");
56
+        throw new Exception("We were told to create a new SB profile, but this ".\config\ConfAssistant::CONSORTIUM['nomenclature_federation']." does not allow SB at all!");
57 57
     }
58 58
     // okay, new SB profiles are allowed. 
59 59
     // but is there a support:email attribute on inst level?
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     // Create one.
65 65
     $newProfile = $inst->newProfile(core\AbstractProfile::PROFILETYPE_SILVERBULLET);
66 66
     // and modify the REQUEST_URI to add the new profile ID
67
-    $_SERVER['REQUEST_URI'] = $_SERVER['REQUEST_URI'] . "&profile_id=" . $newProfile->identifier;
67
+    $_SERVER['REQUEST_URI'] = $_SERVER['REQUEST_URI']."&profile_id=".$newProfile->identifier;
68 68
     $_GET['profile_id'] = $newProfile->identifier;
69 69
     $profile = $newProfile;
70 70
 } else {
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 if (isset($_POST['command'])) {
90 90
     switch ($_POST['command']) {
91 91
         case \web\lib\common\FormElements::BUTTON_CLOSE:
92
-            header("Location: overview_org.php?inst_id=" . $inst->identifier);
92
+            header("Location: overview_org.php?inst_id=".$inst->identifier);
93 93
             break;
94 94
         case \web\lib\common\FormElements::BUTTON_TERMSOFUSE_ACCEPTED:
95 95
             if (isset($_POST['agreement']) && $_POST['agreement'] == 'true') {
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
                         break;
133 133
                     }
134 134
                     $properName = $validator->syntaxConformUser($elements[0]);
135
-                    $properDate = new DateTime($elements[1] . " 00:00:00");
135
+                    $properDate = new DateTime($elements[1]." 00:00:00");
136 136
                     $numberOfActivations = $elements[2] ?? 5;
137 137
                     $number = $validator->integer($numberOfActivations);
138 138
                     if ($number === FALSE) { // invalid input received, default to sane
@@ -235,18 +235,18 @@  discard block
 block discarded – undo
235 235
                     // warn and ask for confirmation unless already confirmed
236 236
                     if (!isset($_POST['insecureconfirm']) || $_POST['insecureconfirm'] != "CONFIRM") {
237 237
                         echo $deco->pageheader(_("Insecure mail domain!"), "ADMIN-IDP-USERS");
238
-                        echo "<p>" . sprintf(_("The mail domain of the mail address <strong>%s</strong> is not secure: some or all of the mail servers are not accepting encrypted connections (no consistent support for STARTTLS)."), $properEmail) . "</p>";
239
-                        echo "<p>" . _("The invitation would need to be sent in cleartext across the internet, and can possibly be read and abused by anyone in transit.") . "</p>";
240
-                        echo "<p>" . _("Do you want the system to send this mail anyway?") . "</p>";
238
+                        echo "<p>".sprintf(_("The mail domain of the mail address <strong>%s</strong> is not secure: some or all of the mail servers are not accepting encrypted connections (no consistent support for STARTTLS)."), $properEmail)."</p>";
239
+                        echo "<p>"._("The invitation would need to be sent in cleartext across the internet, and can possibly be read and abused by anyone in transit.")."</p>";
240
+                        echo "<p>"._("Do you want the system to send this mail anyway?")."</p>";
241 241
                         echo $formtext;
242
-                        echo "<button type='submit' class='delete'>" . _("DO NOT SEND") . "</button>";
242
+                        echo "<button type='submit' class='delete'>"._("DO NOT SEND")."</button>";
243 243
                         echo "</form>";
244 244
                         echo $formtext;
245
-                        echo "<input type='hidden' name='command' value='" . \web\lib\common\FormElements::BUTTON_SENDINVITATIONMAILBYCAT . "'</>";
245
+                        echo "<input type='hidden' name='command' value='".\web\lib\common\FormElements::BUTTON_SENDINVITATIONMAILBYCAT."'</>";
246 246
                         echo "<input type='hidden' name='address' value='$properEmail'</>";
247
-                        echo "<input type='hidden' name='token' value='" . $invitationObject->invitationTokenString . "'</>";
247
+                        echo "<input type='hidden' name='token' value='".$invitationObject->invitationTokenString."'</>";
248 248
                         echo "<input type='hidden' name='insecureconfirm' value='CONFIRM'/>";
249
-                        echo "<button type='submit'>" . _("Send anyway.") . "</button>";
249
+                        echo "<button type='submit'>"._("Send anyway.")."</button>";
250 250
                         echo "</form>";
251 251
                         echo $deco->footer();
252 252
                         exit;
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 $activeUsers = $profile->listActiveUsers();
298 298
 
299 299
 
300
-echo $deco->defaultPagePrelude(sprintf(_('Managing %s users'), \core\ProfileSilverbullet::PRODUCTNAME ));
300
+echo $deco->defaultPagePrelude(sprintf(_('Managing %s users'), \core\ProfileSilverbullet::PRODUCTNAME));
301 301
 
302 302
 ?>
303 303
 <script src='js/option_expand.js' type='text/javascript'></script>
@@ -337,12 +337,12 @@  discard block
 block discarded – undo
337 337
     <img src='../resources/images/icons/loading51.gif' id='spin' alt='loading...' style='position:absolute;left: 50%; top: 50%; transform: translate(-100px, -50px); display:none; z-index: 100;'>
338 338
     <?php echo $uiElements->instLevelInfoBoxes($inst); ?>
339 339
     <div class='infobox'>
340
-        <h2><?php $tablecaption = sprintf(_('Current %s users'), \core\ProfileSilverbullet::PRODUCTNAME); echo $tablecaption;?></h2>
340
+        <h2><?php $tablecaption = sprintf(_('Current %s users'), \core\ProfileSilverbullet::PRODUCTNAME); echo $tablecaption; ?></h2>
341 341
         <table>
342
-            <caption><?php echo $tablecaption;?></caption>
342
+            <caption><?php echo $tablecaption; ?></caption>
343 343
             <tr>
344
-                <th class="wai-invisible" scope="col"><?php echo _("Property Type");?></th>
345
-                <th class="wai-invisible" scope="col"><?php echo _("Property Value");?></th>
344
+                <th class="wai-invisible" scope="col"><?php echo _("Property Type"); ?></th>
345
+                <th class="wai-invisible" scope="col"><?php echo _("Property Value"); ?></th>
346 346
             </tr>
347 347
 
348 348
             <tr>
@@ -366,19 +366,19 @@  discard block
 block discarded – undo
366 366
         case "NOSTIPULATION":
367 367
             break;
368 368
         case "EMAIL-SENT":
369
-            echo $boundaryPre . $uiElements->boxOkay(_("The e-mail was sent successfully."), _("E-mail OK."), FALSE) . $boundaryPost;
369
+            echo $boundaryPre.$uiElements->boxOkay(_("The e-mail was sent successfully."), _("E-mail OK."), FALSE).$boundaryPost;
370 370
             break;
371 371
         case "EMAIL-NOTSENT":
372
-            echo $boundaryPre . $uiElements->boxError(_("The e-mail was NOT sent."), _("E-mail not OK."), FALSE) . $boundaryPost;
372
+            echo $boundaryPre.$uiElements->boxError(_("The e-mail was NOT sent."), _("E-mail not OK."), FALSE).$boundaryPost;
373 373
             break;
374 374
         case "SMS-SENT":
375
-            echo $boundaryPre . $uiElements->boxOkay(_("The SMS was sent successfully."), _("SMS OK."), FALSE) . $boundaryPost;
375
+            echo $boundaryPre.$uiElements->boxOkay(_("The SMS was sent successfully."), _("SMS OK."), FALSE).$boundaryPost;
376 376
             break;
377 377
         case "SMS-NOTSENT":
378
-            echo $boundaryPre . $uiElements->boxOkay(_("The SMS was NOT sent."), _("SMS not OK."), FALSE) . $boundaryPost;
378
+            echo $boundaryPre.$uiElements->boxOkay(_("The SMS was NOT sent."), _("SMS not OK."), FALSE).$boundaryPost;
379 379
             break;
380 380
         case "SMS-FRAGMENT":
381
-            echo $boundaryPre . $uiElements->boxWarning(_("Only a fragment of the SMS was sent. You should re-send it."), _("SMS Fragment."), FALSE) . $boundaryPost;
381
+            echo $boundaryPre.$uiElements->boxWarning(_("Only a fragment of the SMS was sent. You should re-send it."), _("SMS Fragment."), FALSE).$boundaryPost;
382 382
             break;
383 383
     }
384 384
     ?>
@@ -391,17 +391,17 @@  discard block
 block discarded – undo
391 391
             <?php
392 392
             $bufferCurrentUsers = "<table class='sb-user-table' style='max-width:1920px;'>
393 393
                 <tr class='sb-title-row_id'>
394
-                    <td>" . _("User") . "</td>
395
-                    <td>" . _("Token/Certificate details") . "</td>
396
-                    <td>" . _("User/Token Expiry") . "</td>
397
-                    <td>" . _("Actions") . "</td>
394
+                    <td>" . _("User")."</td>
395
+                    <td>" . _("Token/Certificate details")."</td>
396
+                    <td>" . _("User/Token Expiry")."</td>
397
+                    <td>" . _("Actions")."</td>
398 398
                 </tr>";
399 399
             $bufferPreviousUsers = "<table class='sb-user-table' style='max-width:1920px;'>
400 400
                 <tr class='sb-title-row_id'>
401
-                    <td>" . _("User") . "</td>
402
-                    <td>" . _("Certificate details") . "</td>
403
-                    <td>" . _("User Expiry") . "</td>
404
-                    <td>" . _("Actions") . "</td>
401
+                    <td>" . _("User")."</td>
402
+                    <td>" . _("Certificate details")."</td>
403
+                    <td>" . _("User Expiry")."</td>
404
+                    <td>" . _("Actions")."</td>
405 405
                 </tr>";
406 406
 
407 407
             natsort($allUsers);
@@ -458,23 +458,23 @@  discard block
 block discarded – undo
458 458
                     $display = empty(devices\Devices::listDevices()[$oneCert->device]['display']) ? $oneCert->device : devices\Devices::listDevices()[$oneCert->device]['display'];
459 459
 
460 460
                     $bufferText = "<div class='sb-certificate-summary ca-summary' $style>
461
-                                    <div class='sb-certificate-details'>" . _("Device:") . " " . $display .
462
-                            "<br>" . _("Serial Number:") . "&nbsp;" . dechex($oneCert->serial) .
463
-                            "<br>" . _("CN:") . "&nbsp;" . explode('@', $oneCert->username)[0] . "@…" .
464
-                            "<br>" . _("Expiry:") . "&nbsp;" . $oneCert->expiry .
465
-                            "<br>" . _("Issued:") . "&nbsp;" . $oneCert->issued .
466
-                            "</div>" .
461
+                                    <div class='sb-certificate-details'>"._("Device:")." ".$display.
462
+                            "<br>"._("Serial Number:")."&nbsp;".dechex($oneCert->serial).
463
+                            "<br>"._("CN:")."&nbsp;".explode('@', $oneCert->username)[0]."@…".
464
+                            "<br>"._("Expiry:")."&nbsp;".$oneCert->expiry.
465
+                            "<br>"._("Issued:")."&nbsp;".$oneCert->issued.
466
+                            "</div>".
467 467
                             "<div style='text-align:right;padding-top: 5px; $buttonStyle'>";
468 468
 
469 469
                     if ($buttonText == "") {
470 470
                         $bufferText .= $formtext
471
-                                . "<input type='hidden' name='certSerial' value='" . $oneCert->serial . "'/>"
472
-                                . "<input type='hidden' name='certAlgo' value='" . $oneCert->ca_type . "'/>"
471
+                                . "<input type='hidden' name='certSerial' value='".$oneCert->serial."'/>"
472
+                                . "<input type='hidden' name='certAlgo' value='".$oneCert->ca_type."'/>"
473 473
                                 . "<button type='submit' "
474 474
                                 . "name='command' "
475
-                                . "value='" . \web\lib\common\FormElements::BUTTON_REVOKECREDENTIAL . "' "
475
+                                . "value='".\web\lib\common\FormElements::BUTTON_REVOKECREDENTIAL."' "
476 476
                                 . "class='delete' "
477
-                                . "onclick='return confirm(\"" . sprintf(_("The device in question will stop functioning with %s. The revocation cannot be undone. Are you sure you want to do this?"), \config\ConfAssistant::CONSORTIUM['display_name']) . "\")'>"
477
+                                . "onclick='return confirm(\"".sprintf(_("The device in question will stop functioning with %s. The revocation cannot be undone. Are you sure you want to do this?"), \config\ConfAssistant::CONSORTIUM['display_name'])."\")'>"
478 478
                                 . _("Revoke")
479 479
                                 . "</button>"
480 480
                                 . "</form>";
@@ -499,13 +499,13 @@  discard block
 block discarded – undo
499 499
                 }
500 500
                 // wrap the revoked and expired certs in a div that is hidden by default
501 501
                 if ($textRevokedCerts !== "") {
502
-                    $textRevokedCerts = "<span style='text-decoration: underline;' id='$oneUserId-revoked-heading' onclick='document.getElementById(\"$oneUserId-revoked-certs\").style.display = \"block\"; document.getElementById(\"$oneUserId-revoked-heading\").style.display = \"none\";'>" . sprintf(ngettext("(show %d revoked certificate)", "(show %d revoked certificates)", $countRevoked), $countRevoked) . "</span><div id='$oneUserId-revoked-certs' style='display:none;'>" . $textRevokedCerts . "</div>";
502
+                    $textRevokedCerts = "<span style='text-decoration: underline;' id='$oneUserId-revoked-heading' onclick='document.getElementById(\"$oneUserId-revoked-certs\").style.display = \"block\"; document.getElementById(\"$oneUserId-revoked-heading\").style.display = \"none\";'>".sprintf(ngettext("(show %d revoked certificate)", "(show %d revoked certificates)", $countRevoked), $countRevoked)."</span><div id='$oneUserId-revoked-certs' style='display:none;'>".$textRevokedCerts."</div>";
503 503
                 }
504 504
                 if ($textExpiredCerts !== "") {
505
-                    $textExpiredCerts = "<span style='text-decoration: underline;' id='$oneUserId-expired-heading' onclick='document.getElementById(\"$oneUserId-expired-certs\").style.display = \"block\"; document.getElementById(\"$oneUserId-expired-heading\").style.display = \"none\";'>" . sprintf(ngettext("(show %d expired certificate)", "(show %d expired certificates)", $countExpired), $countExpired) . "</span><div id='$oneUserId-expired-certs' style='display:none;'>" . $textExpiredCerts . "</div>";
505
+                    $textExpiredCerts = "<span style='text-decoration: underline;' id='$oneUserId-expired-heading' onclick='document.getElementById(\"$oneUserId-expired-certs\").style.display = \"block\"; document.getElementById(\"$oneUserId-expired-heading\").style.display = \"none\";'>".sprintf(ngettext("(show %d expired certificate)", "(show %d expired certificates)", $countExpired), $countExpired)."</span><div id='$oneUserId-expired-certs' style='display:none;'>".$textExpiredCerts."</div>";
506 506
                 }
507 507
                 // and push out the HTML
508
-                ${$outputBuffer} .= $textActiveCerts . "<br/>" . $textExpiredCerts . " " . $textRevokedCerts . "</td>";
508
+                ${$outputBuffer} .= $textActiveCerts."<br/>".$textExpiredCerts." ".$textRevokedCerts."</td>";
509 509
                 $tokenHtmlBuffer = "";
510 510
                 $hasOnePendingInvite = FALSE;
511 511
                 foreach ($tokensWithoutCerts as $invitationObject) {
@@ -516,38 +516,38 @@  discard block
 block discarded – undo
516 516
                             $tokenHtmlBuffer .= "<tr class='sb-certificate-row_id'><td></td>";
517 517
                             $jsEncodedBody = str_replace('\n', '%0D%0A', str_replace('"', '', json_encode($invitationObject->invitationMailBody())));
518 518
                             $tokenHtmlBuffer .= "<td>";
519
-                            $tokenHtmlBuffer .= sprintf(_("The invitation token %s is ready for sending! Choose how to send it:"), "<input type='text' readonly='readonly' style='background-color:lightgrey;' size='60' value='" . $invitationObject->link() . "' name='token' class='identifiedtokenarea-" . $invitationObject->identifier . "'>(…)<br/>");
519
+                            $tokenHtmlBuffer .= sprintf(_("The invitation token %s is ready for sending! Choose how to send it:"), "<input type='text' readonly='readonly' style='background-color:lightgrey;' size='60' value='".$invitationObject->link()."' name='token' class='identifiedtokenarea-".$invitationObject->identifier."'>(…)<br/>");
520 520
                             $tokenHtmlBuffer .= "<table>
521
-                                    <tr><td style='vertical-align:bottom;'>" . _("E-Mail:") . "</td><td>
521
+                                    <tr><td style='vertical-align:bottom;'>" . _("E-Mail:")."</td><td>
522 522
                                     $formtext
523
-                                <input type='hidden' value='" . $invitationObject->invitationTokenString . "' name='token'><br/>
523
+                                <input type='hidden' value='".$invitationObject->invitationTokenString."' name='token'><br/>
524 524
                                 <input type='text' name='address' id='address-$invitationObject->identifier'/>
525
-                                <button type='button' onclick='window.location=\"mailto:\"+document.getElementById(\"address-$invitationObject->identifier\").value+\"?subject=" . $invitationObject->invitationMailSubject() . "&amp;body=$jsEncodedBody\"; return false;'>" . _("Local mail client") . "</button>
526
-                                <button type='submit' name='command' onclick='document.getElementById(\"spin\").style.display =\"block\"' value='" . \web\lib\common\FormElements::BUTTON_SENDINVITATIONMAILBYCAT . "'>" . _("Send with CAT") . "</button>
525
+                                <button type='button' onclick='window.location=\"mailto:\"+document.getElementById(\"address-$invitationObject->identifier\").value+\"?subject=".$invitationObject->invitationMailSubject()."&amp;body=$jsEncodedBody\"; return false;'>"._("Local mail client")."</button>
526
+                                <button type='submit' name='command' onclick='document.getElementById(\"spin\").style.display =\"block\"' value='" . \web\lib\common\FormElements::BUTTON_SENDINVITATIONMAILBYCAT."'>"._("Send with CAT")."</button>
527 527
                                     </form>
528 528
                                     </td></tr>
529
-                                    <tr><td style='vertical-align:bottom;'>" . _("SMS:") . "</td><td>
529
+                                    <tr><td style='vertical-align:bottom;'>" . _("SMS:")."</td><td>
530 530
                                     $formtext
531
-                                    <input type='hidden' value='" . $invitationObject->invitationTokenString . "' name='token'><br/>
531
+                                    <input type='hidden' value='".$invitationObject->invitationTokenString."' name='token'><br/>
532 532
                                     <input type='text' name='smsnumber' />
533
-				<button type='submit' name='command' value='" . \web\lib\common\FormElements::BUTTON_SENDINVITATIONSMS . "'>" . _("Send in SMS...") . "</button>
533
+				<button type='submit' name='command' value='" . \web\lib\common\FormElements::BUTTON_SENDINVITATIONSMS."'>"._("Send in SMS...")."</button>
534 534
                                     </form>
535 535
 				</td></tr>
536
-                                    <tr><td style='vertical-align:bottom;'>" . _("Manual:") . "</td><td>
537
-				<button type='button' class='clipboardButton' onclick='clipboardCopy(" . $invitationObject->identifier . ");'>" . _("Copy to Clipboard") . "</button>
536
+                                    <tr><td style='vertical-align:bottom;'>" . _("Manual:")."</td><td>
537
+				<button type='button' class='clipboardButton' onclick='clipboardCopy(" . $invitationObject->identifier.");'>"._("Copy to Clipboard")."</button>
538 538
                                     <form style='display:inline-block;' method='post' action='inc/displayQRcode.inc.php' onsubmit='popupQRWindow(this); return false;' accept-charset='UTF-8'>
539
-                                    <input type='hidden' value='" . $invitationObject->invitationTokenString . "' name='token'><br/>
540
-                                      <button type='submit'>" . _("Display QR code") . "</button>
539
+                                    <input type='hidden' value='" . $invitationObject->invitationTokenString."' name='token'><br/>
540
+                                      <button type='submit'>" . _("Display QR code")."</button>
541 541
                                   </form>
542 542
                                         </td></tr>
543 543
                                         
544 544
                                 </table>
545 545
                                 </td>";
546
-                            $tokenHtmlBuffer .= "<td>" . _("Expiry Date:") . " " . $invitationObject->expiry . " UTC<br>" . _("Activations remaining:") . " " . sprintf(_("%d of %d"), $invitationObject->activationsRemaining, $invitationObject->activationsTotal) . "</td>";
546
+                            $tokenHtmlBuffer .= "<td>"._("Expiry Date:")." ".$invitationObject->expiry." UTC<br>"._("Activations remaining:")." ".sprintf(_("%d of %d"), $invitationObject->activationsRemaining, $invitationObject->activationsTotal)."</td>";
547 547
                             $tokenHtmlBuffer .= "<td>"
548 548
                                     . $formtext
549
-                                    . "<input type='hidden' name='invitationtoken' value='" . $invitationObject->invitationTokenString . "'/>"
550
-                                    . "<button type='submit' name='command' value='" . \web\lib\common\FormElements::BUTTON_REVOKEINVITATION . "' class='delete'>" . _("Revoke") . "</button></form>"
549
+                                    . "<input type='hidden' name='invitationtoken' value='".$invitationObject->invitationTokenString."'/>"
550
+                                    . "<button type='submit' name='command' value='".\web\lib\common\FormElements::BUTTON_REVOKEINVITATION."' class='delete'>"._("Revoke")."</button></form>"
551 551
                                     . "</td></tr>";
552 552
                             break;
553 553
                         case core\SilverbulletInvitation::SB_TOKENSTATUS_EXPIRED:
@@ -563,10 +563,10 @@  discard block
 block discarded – undo
563 563
                 }
564 564
                 ${$outputBuffer} .= "<td>$formtext
565 565
                     <div class='sb-date-container' style='min-width: 200px;'>
566
-                        <span><input type='text' maxlength='19' class='sb-date-picker' name='userexpiry' value='" . $profile->getUserExpiryDate($oneUserId) . "'>&nbsp;(UTC)</span>
566
+                        <span><input type='text' maxlength='19' class='sb-date-picker' name='userexpiry' value='".$profile->getUserExpiryDate($oneUserId)."'>&nbsp;(UTC)</span>
567 567
                     </div>
568 568
                     <input type='hidden' name='userid' value='$oneUserId'/>
569
-                    <button type='submit' name='command' value='" . \web\lib\common\FormElements::BUTTON_CHANGEUSEREXPIRY . "'>" . _("Update") . "</button>
569
+                    <button type='submit' name='command' value='".\web\lib\common\FormElements::BUTTON_CHANGEUSEREXPIRY."'>"._("Update")."</button>
570 570
                     </form>
571 571
                 </td>
572 572
                 <td>
@@ -574,33 +574,33 @@  discard block
 block discarded – undo
574 574
 
575 575
                 if ($hasOnePendingInvite || count($validCerts) > 0) {
576 576
                     $deletionText = sprintf(_("All of the currently active devices will stop functioning with %s. This cannot be undone. While the user can be re-activated later, they will then need to be re-provisioned with new invitation tokens. Are you sure you want to do this?"), \config\ConfAssistant::CONSORTIUM['display_name']);
577
-                    ${$outputBuffer} .= $formtext . "
577
+                    ${$outputBuffer} .= $formtext."
578 578
                                     <input type='hidden' name='userid' value='$oneUserId'/>
579 579
                                     <button type='submit' "
580 580
                             . "name='command' "
581
-                            . "value='" . \web\lib\common\FormElements::BUTTON_DEACTIVATEUSER . "' "
581
+                            . "value='".\web\lib\common\FormElements::BUTTON_DEACTIVATEUSER."' "
582 582
                             . "class='delete' "
583
-                            . ( count($validCerts) > 0 ? "onclick='return confirm(\"" . $deletionText . "\")' " : "" )
583
+                            . (count($validCerts) > 0 ? "onclick='return confirm(\"".$deletionText."\")' " : "")
584 584
                             . ">"
585 585
                             . _("Deactivate User")
586 586
                             . "</button>
587 587
                                 </form>";
588 588
                 }
589
-                ${$outputBuffer} .= "<form method='post' action='inc/userStats.inc.php?inst_id=" . $profile->institution . "&amp;profile_id=" . $profile->identifier . "&amp;user_id=$oneUserId' onsubmit='popupStatsWindow(this); return false;' accept-charset='UTF-8'>
590
-                    <button type='submit'>" . _("Show Authentication Records") . "</button>
589
+                ${$outputBuffer} .= "<form method='post' action='inc/userStats.inc.php?inst_id=".$profile->institution."&amp;profile_id=".$profile->identifier."&amp;user_id=$oneUserId' onsubmit='popupStatsWindow(this); return false;' accept-charset='UTF-8'>
590
+                    <button type='submit'>"._("Show Authentication Records")."</button>
591 591
                 </form>";
592 592
                 if (new DateTime() < new DateTime($expiryDate)) { // current user, allow sending new token
593
-                    ${$outputBuffer} .= $formtext . "
593
+                    ${$outputBuffer} .= $formtext."
594 594
                     <input type='hidden' name='userid' value='$oneUserId'/>
595
-                    <button type='submit' name='command' value='" . \web\lib\common\FormElements::BUTTON_NEWINVITATION . "'>" . _("New Invitation") . "</button>
596
-                    <label>" . _("Activations:") . "
595
+                    <button type='submit' name='command' value='".\web\lib\common\FormElements::BUTTON_NEWINVITATION."'>"._("New Invitation")."</button>
596
+                    <label>" . _("Activations:")."
597 597
                         <input type='text' name='invitationsquantity' value='5' maxlength='3' style='width: 30px;'/>
598 598
                     </label>
599 599
                     </form>";
600 600
                 } elseif (count($profile->getUserAuthRecords($oneUserId, true)) == 0) { // previous user; if there are NO authentication records, allow full deletion - otherwise, need to keep user trace for abuse handling
601
-                    ${$outputBuffer} .= $formtext . "
601
+                    ${$outputBuffer} .= $formtext."
602 602
                     <input type='hidden' name='userid' value='$oneUserId'/>
603
-                    <button type='submit' class='delete' name='command' value='" . \web\lib\common\FormElements::BUTTON_DELETE . "'>" . _("Delete User") . "</button>
603
+                    <button type='submit' class='delete' name='command' value='".\web\lib\common\FormElements::BUTTON_DELETE."'>"._("Delete User")."</button>
604 604
                     </form>";
605 605
                 }
606 606
                 ${$outputBuffer} .= "</div>
@@ -632,13 +632,13 @@  discard block
 block discarded – undo
632 632
                                     . ' If all accounts shown as active above are indeed still valid, please check the box below and push "Save".'
633 633
                                     . ' If any of the accounts are stale, please deactivate them by pushing the corresponding button before doing this.'), \config\ConfAssistant::SILVERBULLET['gracetime'] ?? core\ProfileSilverbullet::SB_ACKNOWLEDGEMENT_REQUIRED_DAYS);
634 634
 
635
-                    echo $formtext . "<div style='padding-bottom: 20px;'>"
635
+                    echo $formtext."<div style='padding-bottom: 20px;'>"
636 636
                     . "
637 637
                     <p>$acknowledgeText</p>
638 638
                     <input type='checkbox' name='acknowledge' value='true'>
639
-                    <label>" . sprintf(_("I have verified that all configured users are still eligible for %s."),\config\ConfAssistant::CONSORTIUM['display_name']) . "</label>
639
+                    <label>".sprintf(_("I have verified that all configured users are still eligible for %s."), \config\ConfAssistant::CONSORTIUM['display_name'])."</label>
640 640
                 </div>
641
-                <button type='submit' name='command' value='" . \web\lib\common\FormElements::BUTTON_ACKUSERELIGIBILITY . "'>" . _("Save") . "</button></form>";
641
+                <button type='submit' name='command' value='" . \web\lib\common\FormElements::BUTTON_ACKUSERELIGIBILITY."'>"._("Save")."</button></form>";
642 642
                 }
643 643
                 ?>
644 644
             </div>
Please login to merge, or discard this patch.
core/ProfileSilverbullet.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -361,7 +361,7 @@
 block discarded – undo
361 361
                 . "     OR"
362 362
                 . "  ( u.id = c.silverbullet_user_id AND c.expiry >= NOW() AND c.revocation_status != 'REVOKED' ) "
363 363
                 . ")", "i", $this->identifier);
364
-      // SELECT -> resource, not boolean
364
+        // SELECT -> resource, not boolean
365 365
         while ($res = mysqli_fetch_object(/** @scrutinizer ignore-type */ $users)) {
366 366
             $userCount[$res->usercount] = "ACTIVE";
367 367
         }
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: ".$this->databaseInstance .": " . $querystring . "\n");
124
+        $this->loggerInstance->debug(5, "DB ATTEMPT: ".$this->databaseInstance.": ".$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 || \config\Master::DEBUG_LEVEL == 5) {
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;
@@ -280,13 +280,13 @@  discard block
 block discarded – undo
280 280
         if (isset(\config\Master::DB[$databaseCapitalised])) {
281 281
             $this->connection = new \mysqli(\config\Master::DB[$databaseCapitalised]['host'], \config\Master::DB[$databaseCapitalised]['user'], \config\Master::DB[$databaseCapitalised]['pass'], \config\Master::DB[$databaseCapitalised]['db']);
282 282
             if ($this->connection->connect_error) {
283
-                throw new Exception("ERROR: Unable to connect to $database database! This is a fatal error, giving up (error number " . $this->connection->connect_errno . ").");
283
+                throw new Exception("ERROR: Unable to connect to $database database! This is a fatal error, giving up (error number ".$this->connection->connect_errno.").");
284 284
             }
285 285
             $this->readOnly = \config\Master::DB[$databaseCapitalised]['readonly'];
286 286
         } else { // one of the RADIUS DBs
287 287
             $this->connection = new \mysqli(\config\ConfAssistant::DB[$databaseCapitalised]['host'], \config\ConfAssistant::DB[$databaseCapitalised]['user'], \config\ConfAssistant::DB[$databaseCapitalised]['pass'], \config\ConfAssistant::DB[$databaseCapitalised]['db']);
288 288
             if ($this->connection->connect_error) {
289
-                throw new Exception("ERROR: Unable to connect to $database database! This is a fatal error, giving up (error number " . $this->connection->connect_errno . ").");
289
+                throw new Exception("ERROR: Unable to connect to $database database! This is a fatal error, giving up (error number ".$this->connection->connect_errno.").");
290 290
             }
291 291
             $this->readOnly = \config\ConfAssistant::DB[$databaseCapitalised]['readonly'];
292 292
         }
Please login to merge, or discard this patch.