Passed
Push — release_2_1 ( ff920e...7c9b43 )
by Maja
10:20
created
web/diag/findRealm.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -206,7 +206,7 @@
 block discarded – undo
206 206
 $json_data = json_encode($returnArray);
207 207
 
208 208
 if ($token) {
209
-    $loggerInstance->debug(4, 'JSON data written to ' .$jsonDir.'/'.$token);
209
+    $loggerInstance->debug(4, 'JSON data written to '.$jsonDir.'/'.$token);
210 210
     file_put_contents($jsonDir.'/'.$token.'/realm', $json_data);
211 211
 }
212 212
 header("Content-type: application/json; utf-8");
Please login to merge, or discard this patch.
web/diag/action_realmcheck.php 1 patch
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  *          <base_url>/copyright.php after deploying the software
20 20
  */
21 21
 
22
-require_once dirname(dirname(__DIR__)) . "/config/_config.php";
22
+require_once dirname(dirname(__DIR__))."/config/_config.php";
23 23
 
24 24
 $loggerInstance = new \core\common\Logging();
25 25
 
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
             $dnsChecksOR = new \core\diag\RFC7585Tests($check_realm, "aaa+auth:radius.tls.tcp");
70 70
         }
71 71
     } else {
72
-        $error_message = _("You asked for a realm check, but we don't know the realm for this profile!") . "</p>";
72
+        $error_message = _("You asked for a realm check, but we don't know the realm for this profile!")."</p>";
73 73
     }
74 74
 } else { // someone else's realm, and we don't know anything about it... only shallow checks
75 75
     $check_realm = $validator->realm($realm ?? $_SESSION['check_realm'] ?? "");
76 76
     if ($check_realm !== FALSE) {
77 77
         $_SESSION['check_realm'] = $check_realm;
78
-        $testsuite = new \core\diag\RADIUSTests($check_realm, "@" . $check_realm);
78
+        $testsuite = new \core\diag\RADIUSTests($check_realm, "@".$check_realm);
79 79
         $dnsChecks = new \core\diag\RFC7585Tests($check_realm);
80 80
     } else {
81 81
         $error_message = _("No valid realm name given, cannot execute any checks!");
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     var listofcas = "<?php echo _("You should update your list of accredited CAs") ?>";
122 122
     var getitfrom = "<?php echo _("Get it from here.") ?>";
123 123
     var listsource = "<?php echo \config\Diagnostics::RADIUSTESTS['accreditedCAsURL'] ?>";
124
-    var moretext = "<?php echo _("more") . "&raquo;" ?>";
124
+    var moretext = "<?php echo _("more")."&raquo;" ?>";
125 125
     var lesstext = "<?php echo "&laquo" ?>";
126 126
     var morealltext = "<?php echo _("Show detailed information for all tests") ?>";
127 127
     var unknownca_code = "<?php echo \core\diag\RADIUSTests::CERTPROB_UNKNOWN_CA ?>";
@@ -269,10 +269,10 @@  discard block
 block discarded – undo
269 269
                     
270 270
                     cliinfo = cliinfo + '<li>';
271 271
                     if (data.ca[key].certificate[c].finalerror && data.ca[key].certificate[c].finalerror==2) {
272
-                        cliinfo = cliinfo + ' <?php echo _("this test was skipped - no appropriate client certificate");?>' + '</ul></li>';
272
+                        cliinfo = cliinfo + ' <?php echo _("this test was skipped - no appropriate client certificate"); ?>' + '</ul></li>';
273 273
                     } else {
274 274
                         cliinfo = cliinfo + '<table><tbody><tr><td class="icon_td"><img class="icon" src="' + icons[level] + '" style="width: 24px;"></td><td>' + state;
275
-                        cliinfo = cliinfo + ' <?php echo "(" . sprintf(_("elapsed time: %sms."), "'+data.ca[key].certificate[c].time_millisec+'&nbsp;") . ")"; ?>' + add + '</td></tr>';
275
+                        cliinfo = cliinfo + ' <?php echo "(".sprintf(_("elapsed time: %sms."), "'+data.ca[key].certificate[c].time_millisec+'&nbsp;").")"; ?>' + add + '</td></tr>';
276 276
                         cliinfo = cliinfo + '</tbody></table></ul></li>';
277 277
                     }
278 278
                    
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
                 });
472 472
             }
473 473
             o = o + cert_data + '</table>';
474
-            $("#eap_test" + data.hostindex).append('<strong><img style="position: relative; top: 2px;" src="' + icons[v.level] + '"><span style="position: relative; top: -5px; <?php echo $start;?>: 1em">' + v.eap + ' &ndash; <?php printf(_("elapsed time: %sms."), "'+v.time_millisec+'&nbsp;") ?></span></strong><div class="more" style="padding-<?php echo $start;?>: 40px"><div class="morecontent"><div style="display:none; background: #eee;">' + o + '</div><a href="" class="morelink">' + moretext + '</a></div></div>');
474
+            $("#eap_test" + data.hostindex).append('<strong><img style="position: relative; top: 2px;" src="' + icons[v.level] + '"><span style="position: relative; top: -5px; <?php echo $start; ?>: 1em">' + v.eap + ' &ndash; <?php printf(_("elapsed time: %sms."), "'+v.time_millisec+'&nbsp;") ?></span></strong><div class="more" style="padding-<?php echo $start; ?>: 40px"><div class="morecontent"><div style="display:none; background: #eee;">' + o + '</div><a href="" class="morelink">' + moretext + '</a></div></div>');
475 475
         });
476 476
     }
477 477
 
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
 <?php
483 483
 foreach (\config\Diagnostics::RADIUSTESTS['UDP-hosts'] as $hostindex => $host) {
484 484
     print "
485
-$(\"#live_src" . $hostindex . "_img\").attr('src',icon_loading);
486
-$(\"#live_src" . $hostindex . "_img\").show();
485
+$(\"#live_src" . $hostindex."_img\").attr('src',icon_loading);
486
+$(\"#live_src" . $hostindex."_img\").show();
487 487
 $.ajax({
488 488
     url: 'radius_tests.php?src=0&hostindex=$hostindex&realm='+realm,
489 489
     type: 'POST',
@@ -516,15 +516,15 @@  discard block
 block discarded – undo
516 516
 <?php
517 517
 foreach (\config\Diagnostics::RADIUSTESTS['UDP-hosts'] as $hostindex => $host) {
518 518
     if ($testedProfile !== NULL) {
519
-        $extraarg = "profile_id: " . $testedProfile->identifier . ", ";
519
+        $extraarg = "profile_id: ".$testedProfile->identifier.", ";
520 520
     } else {
521 521
         $extraarg = "";
522 522
     }
523 523
     print "
524
-$(\"#src" . $hostindex . "_img\").attr('src',icon_loading);
524
+$(\"#src" . $hostindex."_img\").attr('src',icon_loading);
525 525
 $(\"#src$hostindex\").html('');
526 526
 running_ajax_stat++;
527
-$.ajax({url:'radius_tests.php', timeout: ajax_timeout,  data:{test_type: 'udp', $extraarg realm: realm, src: $hostindex, lang: '" . $gui->languageInstance->getLang() . "', hostindex: '$hostindex'}, hostindex: '$hostindex', error: error_handler, success: udp, dataType: 'json'}); 
527
+$.ajax({url:'radius_tests.php', timeout: ajax_timeout,  data:{test_type: 'udp', $extraarg realm: realm, src: $hostindex, lang: '".$gui->languageInstance->getLang()."', hostindex: '$hostindex'}, hostindex: '$hostindex', error: error_handler, success: udp, dataType: 'json'}); 
528 528
 ";
529 529
 }
530 530
 
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
     if ($check_realm === FALSE) {
579 579
         print "<p>$error_message</p>";
580 580
     } else {
581
-        print "<h1>" . sprintf(_("Realm testing for: %s"), $check_realm) . "</h1>\n";
581
+        print "<h1>".sprintf(_("Realm testing for: %s"), $check_realm)."</h1>\n";
582 582
         ?>
583 583
         <div id="debug_out" style="display: none"></div>
584 584
         <div id="tabs" style="min-width: 600px; max-width:1000px">
@@ -600,25 +600,25 @@  discard block
 block discarded – undo
600 600
                     // NAPTR existence check
601 601
                     if ($dynType == "") {
602 602
                         $rfc7585suite = $dnsChecks;
603
-                        echo "<strong>" . _("DNS checks") . "</strong><div>";
603
+                        echo "<strong>"._("DNS checks")."</strong><div>";
604 604
                     } else {
605 605
                         if (count($orrealm) == 0) {
606 606
                             continue;
607 607
                         }
608 608
                         $rfc7585suite = $dnsChecksOR;
609
-                        echo "<strong>" . _("OpenRoaming DNS checks") . "</strong><div>";
609
+                        echo "<strong>"._("OpenRoaming DNS checks")."</strong><div>";
610 610
                     }
611 611
                     $naptr = $rfc7585suite->relevantNAPTR();
612 612
                     if ($naptr == \core\diag\RADIUSTests::RETVAL_NOTCONFIGURED) {
613 613
                         if ($dynType == "") {
614
-                        	echo "<tr><td>" . _("Dynamic discovery test is not configured") . "</td><td>";
614
+                        	echo "<tr><td>"._("Dynamic discovery test is not configured")."</td><td>";
615 615
                         } else {
616
-                        	echo "<tr><td>" . _("OpenRoaming connectivity test is not configured") . "</td><td>";
616
+                        	echo "<tr><td>"._("OpenRoaming connectivity test is not configured")."</td><td>";
617 617
                         }
618 618
                     } else {
619 619
                         echo "<table>";
620 620
                         // output in friendly words
621
-                        echo "<tr><td>" . _("Checking NAPTR existence:") . "</td><td>";
621
+                        echo "<tr><td>"._("Checking NAPTR existence:")."</td><td>";
622 622
                         switch ($naptr) {
623 623
                             case \core\diag\RFC7585Tests::RETVAL_NONAPTR:
624 624
                                 echo _("This realm has no NAPTR records.");
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 
634 634
                         // compliance checks for NAPTRs
635 635
                         if ($naptr > 0) {
636
-                            echo "<tr><td>" . _("Checking NAPTR compliance (flag = S and regex = {empty}):") . "</td><td>";
636
+                            echo "<tr><td>"._("Checking NAPTR compliance (flag = S and regex = {empty}):")."</td><td>";
637 637
                             $naptr_valid = $rfc7585suite->relevantNAPTRcompliance();
638 638
                             switch ($naptr_valid) {
639 639
                                 case \core\diag\RADIUSTests::RETVAL_OK:
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
                         // SRV resolution
649 649
                         if ($naptr > 0 && $naptr_valid == \core\diag\RADIUSTests::RETVAL_OK) {
650 650
                             $srv = $rfc7585suite->relevantNAPTRsrvResolution();
651
-                            echo "<tr><td>" . _("Checking SRVs:") . "</td><td>";
651
+                            echo "<tr><td>"._("Checking SRVs:")."</td><td>";
652 652
                             switch ($srv) {
653 653
                                 case \core\diag\RADIUSTests::RETVAL_SKIPPED:
654 654
                                     echo _("This check was skipped.");
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
                         // IP addresses for the hosts
665 665
                         if ($naptr > 0 && $naptr_valid == \core\diag\RADIUSTests::RETVAL_OK && $srv > 0) {
666 666
                             $hosts = $rfc7585suite->relevantNAPTRhostnameResolution();
667
-                            echo "<tr><td>" . _("Checking IP address resolution:") . "</td><td>";
667
+                            echo "<tr><td>"._("Checking IP address resolution:")."</td><td>";
668 668
                             switch ($srv) {
669 669
                                 case \core\diag\RADIUSTests::RETVAL_SKIPPED:
670 670
                                     echo _("This check was skipped.");
@@ -681,12 +681,12 @@  discard block
 block discarded – undo
681 681
                         echo "</table><br/>";
682 682
                         if ($dynType == "") {
683 683
                             if (count($testsuite->listerrors()) == 0) {
684
-                                echo sprintf(_("Realm is <strong>%s</strong> "), _(($naptr > 0 ? "DYNAMIC" : "STATIC"))) . _("with no DNS errors encountered. Congratulations!");
684
+                                echo sprintf(_("Realm is <strong>%s</strong> "), _(($naptr > 0 ? "DYNAMIC" : "STATIC")))._("with no DNS errors encountered. Congratulations!");
685 685
                             } else {
686
-                                echo sprintf(_("Realm is <strong>%s</strong> "), _(($naptr > 0 ? "DYNAMIC" : "STATIC"))) . _("but there were DNS errors! Check them!") . " " . _("You should re-run the tests after fixing the errors; more errors might be uncovered at that point. The exact error causes are listed below.");
686
+                                echo sprintf(_("Realm is <strong>%s</strong> "), _(($naptr > 0 ? "DYNAMIC" : "STATIC")))._("but there were DNS errors! Check them!")." "._("You should re-run the tests after fixing the errors; more errors might be uncovered at that point. The exact error causes are listed below.");
687 687
                                 echo "<div class='notacceptable'><table>";
688 688
                                 foreach ($testsuite->listerrors() as $details) {
689
-                                    echo "<tr><td>" . $details['TYPE'] . "</td><td>" . $details['TARGET'] . "</td></tr>";
689
+                                    echo "<tr><td>".$details['TYPE']."</td><td>".$details['TARGET']."</td></tr>";
690 690
                                 }
691 691
                                 echo "</table></div>";
692 692
                             }
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
                  $("#dynamic_tests").show();
706 706
               ';             
707 707
                         foreach ($rfc7585suite->NAPTR_hostname_records as $hostindex => $addr) {
708
-                            $host = ($addr['family'] == "IPv6" ? "[" : "") . $addr['IP'] . ($addr['family'] == "IPv6" ? "]" : "") . ":" . $addr['port'];
708
+                            $host = ($addr['family'] == "IPv6" ? "[" : "").$addr['IP'].($addr['family'] == "IPv6" ? "]" : "").":".$addr['port'];
709 709
                             $expectedName = $addr['hostname'];
710 710
                             $ssltest = 1;
711 711
                             if (isset($addr['unavailable']) && $addr['unavailable']) {
@@ -714,9 +714,9 @@  discard block
 block discarded – undo
714 714
                             //$rfc6614suite = new \core\diag\RFC6614Tests([$host], $expectedName, $consortiumName);
715 715
                             print "
716 716
                             running_ajax_dyn++;
717
-                            $.ajax({url:'radius_tests.php', timeout: ajax_timeout,  data:{test_type: 'capath', realm: realm, src: '$host', lang: '" . $gui->languageInstance->getLang() . "', hostindex: '$hostindex', expectedname: '$expectedName', ssltest: $ssltest }, hostindex: '$hostindex', error: error_handler, success: capath, dataType: 'json'});
717
+                            $.ajax({url:'radius_tests.php', timeout: ajax_timeout,  data:{test_type: 'capath', realm: realm, src: '$host', lang: '".$gui->languageInstance->getLang()."', hostindex: '$hostindex', expectedname: '$expectedName', ssltest: $ssltest }, hostindex: '$hostindex', error: error_handler, success: capath, dataType: 'json'});
718 718
                             running_ajax_dyn++;
719
-                            $.ajax({url:'radius_tests.php', timeout: ajax_timeout, data:{test_type: 'clients', realm: realm, src: '$host', lang: '" . $gui->languageInstance->getLang() . "', hostindex: '$hostindex', ssltest: $ssltest }, hostindex: '$hostindex', error: error_handler, success: clients, dataType: 'json'});
719
+                            $.ajax({url:'radius_tests.php', timeout: ajax_timeout, data:{test_type: 'clients', realm: realm, src: '$host', lang: '".$gui->languageInstance->getLang()."', hostindex: '$hostindex', ssltest: $ssltest }, hostindex: '$hostindex', error: error_handler, success: clients, dataType: 'json'});
720 720
                        ";
721 721
                         }
722 722
                         echo "}
@@ -732,11 +732,11 @@  discard block
 block discarded – undo
732 732
                  $("#openroaming_tests").show();
733 733
               ';
734 734
                         foreach ($rfc7585suite->NAPTR_hostname_records as $hostindex => $addr) {
735
-                            $host = ($addr['family'] == "IPv6" ? "[" : "") . $addr['IP'] . ($addr['family'] == "IPv6" ? "]" : "") . ":" . $addr['port'];
735
+                            $host = ($addr['family'] == "IPv6" ? "[" : "").$addr['IP'].($addr['family'] == "IPv6" ? "]" : "").":".$addr['port'];
736 736
                             $expectedName = $addr['hostname'];
737 737
                             print "
738 738
                             running_ajax_openroaming++;
739
-                            $.ajax({url:'radius_tests.php', timeout: ajax_timeout, data:{test_type: 'openroamingcapath', realm: realm, src: '$host', lang: '" . $gui->languageInstance->getLang() . "', hostindex: '$hostindex', expectedname: '$expectedName', ssltest: $ssltest, protocols: '$protstr' }, hostindex: '$hostindex', openroaming: true, error: error_handler, success: capath, dataType: 'json'});
739
+                            $.ajax({url:'radius_tests.php', timeout: ajax_timeout, data:{test_type: 'openroamingcapath', realm: realm, src: '$host', lang: '".$gui->languageInstance->getLang()."', hostindex: '$hostindex', expectedname: '$expectedName', ssltest: $ssltest, protocols: '$protstr' }, hostindex: '$hostindex', openroaming: true, error: error_handler, success: capath, dataType: 'json'});
740 740
                        ";
741 741
                         }
742 742
                         echo "}
@@ -749,18 +749,18 @@  discard block
 block discarded – undo
749 749
                          $naptrs[1] = $naptr;
750 750
                      }
751 751
                 }
752
-                    echo "<strong>" . _("Static connectivity tests") . "</strong>
752
+                    echo "<strong>"._("Static connectivity tests")."</strong>
753 753
          <table><tr>
754 754
          <td class='icon_td'><img src='../resources/images/icons/loading51.gif' id='main_static_ico' class='icon'></td><td id='main_static_result' style='display:none'>&nbsp;</td>
755 755
          </tr></table>";
756 756
                     if ($naptrs[0] > 0) {
757
-                        echo "<hr><strong>" . _("Dynamic connectivity tests") . "</strong>
757
+                        echo "<hr><strong>"._("Dynamic connectivity tests")."</strong>
758 758
          <table><tr>
759 759
          <td class='icon_td'><img src='../resources/images/icons/loading51.gif' id='main_dynamic_ico' class='icon'></td><td id='main_dynamic_result' style='display:none'>&nbsp;</td>
760 760
          </tr></table>";
761 761
                     }
762 762
                     if (isset($orrealm) && count($orrealm) && ($naptrs[1] > 0)) {
763
-                      echo "<hr><strong>" . _("OpenRoaming connectivity tests") . "</strong>
763
+                      echo "<hr><strong>"._("OpenRoaming connectivity tests")."</strong>
764 764
          <table><tr>
765 765
          <td class='icon_td'><img src='../resources/images/icons/loading51.gif' id='main_openroaming_ico' class='icon'></td><td id='main_openroaming_result' style='display:none'>&nbsp;</td>
766 766
          </tr></table>";
@@ -780,12 +780,12 @@  discard block
 block discarded – undo
780 780
                     print "<p>";
781 781
                     foreach (\config\Diagnostics::RADIUSTESTS['UDP-hosts'] as $hostindex => $host) {
782 782
                         print "<hr>";
783
-                        printf(_("Testing from: %s"), "<strong>" . \config\Diagnostics::RADIUSTESTS['UDP-hosts'][$hostindex]['display_name'] . "</strong>");
783
+                        printf(_("Testing from: %s"), "<strong>".\config\Diagnostics::RADIUSTESTS['UDP-hosts'][$hostindex]['display_name']."</strong>");
784 784
                         print "<table id='results$hostindex'  style='width:100%' class='udp_results'>
785 785
 <tr>
786
-<td class='icon_td'><img src='../resources/images/icons/loading51.gif' id='src" . $hostindex . "_img'></td>
786
+<td class='icon_td'><img src='../resources/images/icons/loading51.gif' id='src".$hostindex."_img'></td>
787 787
 <td id='src$hostindex' colspan=2>
788
-" . _("testing...") . "
788
+"._("testing...")."
789 789
 </td>
790 790
 </tr>
791 791
 </table>";
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
 
797 797
             </div>
798 798
             <?php
799
-            for ($i=3; $i<5; $i++) {
799
+            for ($i = 3; $i < 5; $i++) {
800 800
                 if ($i == 3 && $naptrs[0] <= 0) {
801 801
                    continue;
802 802
                 }
@@ -811,15 +811,15 @@  discard block
 block discarded – undo
811 811
                     $rfc7585suite = $dnsChecksOR;
812 812
                 }
813 813
             ?>
814
-                <div id="tabs-<?php echo $i;?>">
815
-                    <button id="run_<?php if ($i==3) echo 'd'; else echo 'o';?>_tests"; onclick="run_<?php if ($i==3) echo 'dynamic'; else echo 'openroaming';?>()"><?php if ($i==3) echo _("Repeat dynamic connectivity tests"); else echo _("Repeat OpenRoaming connectivity tests");?></button>
814
+                <div id="tabs-<?php echo $i; ?>">
815
+                    <button id="run_<?php if ($i == 3) echo 'd'; else echo 'o'; ?>_tests"; onclick="run_<?php if ($i == 3) echo 'dynamic'; else echo 'openroaming'; ?>()"><?php if ($i == 3) echo _("Repeat dynamic connectivity tests"); else echo _("Repeat OpenRoaming connectivity tests"); ?></button>
816 816
 
817 817
                 <?php
818 818
                     echo "<div id='";
819
-                    if ($i==3) { echo 'dynamic'; } else { echo 'openroaming'; }
819
+                    if ($i == 3) { echo 'dynamic'; } else { echo 'openroaming'; }
820 820
                     echo "_tests'><fieldset class='option_container'>
821 821
                 <legend><strong>";
822
-                    if ($i==3) {
822
+                    if ($i == 3) {
823 823
                      echo _("DYNAMIC connectivity tests");
824 824
                     } else {
825 825
                      echo _("OpenRoaming connectivity tests");
@@ -833,11 +833,11 @@  discard block
 block discarded – undo
833 833
                     }
834 834
                     $resultstoprint = [];
835 835
                     if (count($rfc7585suite->NAPTR_hostname_records) > 0) {
836
-                        $resultstoprint[] = '<div style="align:'.$end.'; display: none;" id="' . $prefix1 . '_result_fail">' . _("Some errors were found during the tests, see below") . '</div><div style="align:'.$end.'; display: none;" id="' . $prefix1 . '_result_pass">' . _("All tests passed, congratulations!") . '</div>';
837
-                        $resultstoprint[] = '<div style="align:'.$end.';"><a href="" class="moreall">' . _('Show detailed information for all tests') . '</a></div>' . '<p><strong>' . _("Checking server handshake...") . "</strong><p>";
836
+                        $resultstoprint[] = '<div style="align:'.$end.'; display: none;" id="'.$prefix1.'_result_fail">'._("Some errors were found during the tests, see below").'</div><div style="align:'.$end.'; display: none;" id="'.$prefix1.'_result_pass">'._("All tests passed, congratulations!").'</div>';
837
+                        $resultstoprint[] = '<div style="align:'.$end.';"><a href="" class="moreall">'._('Show detailed information for all tests').'</a></div>'.'<p><strong>'._("Checking server handshake...")."</strong><p>";
838 838
                         foreach ($rfc7585suite->NAPTR_hostname_records as $hostindex => $addr) {
839
-                            $bracketaddr = ($addr["family"] == "IPv6" ? "[" . $addr["IP"] . "]" : $addr["IP"]);
840
-                            $resultstoprint[] = '<p><strong>' . $bracketaddr . ' TCP/' . $addr['port'] . '</strong> (' . $addr['hostname'] . ')';
839
+                            $bracketaddr = ($addr["family"] == "IPv6" ? "[".$addr["IP"]."]" : $addr["IP"]);
840
+                            $resultstoprint[] = '<p><strong>'.$bracketaddr.' TCP/'.$addr['port'].'</strong> ('.$addr['hostname'].')';
841 841
                             $prots = [];
842 842
                             if (isset($addr['protocols'])) {
843 843
                                 foreach ($addr['protocols'] as $protocol) {
@@ -847,18 +847,18 @@  discard block
 block discarded – undo
847 847
                                 }
848 848
                             }
849 849
                             if (!empty($prots)) {
850
-                                $resultstoprint[] = ' ' . _("supported TLS protocols: ");
850
+                                $resultstoprint[] = ' '._("supported TLS protocols: ");
851 851
                                 $resultstoprint[] = implode(', ', $prots);
852 852
                                 if (!isset($addr['istls13']) || !$addr['istls13']) {
853
-                                    $resultstoprint[] = ' ' . '<font color="red">' . _("not supported: ") . 'TLS1.3</font>';
853
+                                    $resultstoprint[] = ' '.'<font color="red">'._("not supported: ").'TLS1.3</font>';
854 854
                                 }
855 855
                             }
856 856
                             $resultstoprint[] = '<ul style="list-style-type: none;" class="caresult"><li>';
857
-                            $resultstoprint[] = "<table id='" . $prefix2 . "caresults$hostindex'  style='width:100%'>
857
+                            $resultstoprint[] = "<table id='".$prefix2."caresults$hostindex'  style='width:100%'>
858 858
 <tr>
859
-<td class='icon_td'><img src='../resources/images/icons/loading51.gif' id='" . $prefix2 . "srcca$hostindex" . "_img'></td>
860
-<td id='" . $prefix2 . "srcca$hostindex'>
861
-" . _("testing...") . "
859
+<td class='icon_td'><img src='../resources/images/icons/loading51.gif' id='".$prefix2."srcca$hostindex"."_img'></td>
860
+<td id='" . $prefix2."srcca$hostindex'>
861
+"._("testing...")."
862 862
 </td>
863 863
 </tr>
864 864
 </table>";
@@ -866,26 +866,26 @@  discard block
 block discarded – undo
866 866
                         }
867 867
                         $clientstest = [];
868 868
                         foreach ($rfc7585suite->NAPTR_hostname_records as $hostindex => $addr) {
869
-                            $clientstest[] = '<p><strong>' . $addr['IP'] . ' TCP/' . $addr['port'] . '</strong></p><ol>';
870
-                            $clientstest[] = "<span id='" . $prefix2 . "clientresults$hostindex'><table style='width:100%'>
869
+                            $clientstest[] = '<p><strong>'.$addr['IP'].' TCP/'.$addr['port'].'</strong></p><ol>';
870
+                            $clientstest[] = "<span id='".$prefix2."clientresults$hostindex'><table style='width:100%'>
871 871
 <tr>
872 872
 <td class='icon_td'>";
873
-                            if ($i == 4 ) {
873
+                            if ($i == 4) {
874 874
                                 $clientstest[] = "<!--";
875 875
                             }
876
-                            $clientstest[] = "<img src='../resources/images/icons/loading51.gif' id='" . $prefix2 . "srcclient$hostindex" . "_img'></td>
877
-<td id='" . $prefix2 . "srcclient$hostindex'>
878
-" . _("testing...");
876
+                            $clientstest[] = "<img src='../resources/images/icons/loading51.gif' id='".$prefix2."srcclient$hostindex"."_img'></td>
877
+<td id='" . $prefix2."srcclient$hostindex'>
878
+"._("testing...");
879 879
 
880
-                            if ($i == 4 ) {
881
-                                $clientstest[] = "-->" . _("not implemented yet");
880
+                            if ($i == 4) {
881
+                                $clientstest[] = "-->"._("not implemented yet");
882 882
                             }
883 883
                             $clientstest[] = "</td></tr></table></span>";
884 884
                             $clientstest[] = '</ol>';
885 885
                         }
886 886
                         echo '<div style="align:'.$end.';">';
887 887
                         echo join('', $resultstoprint);
888
-                        echo '<span id="' . $prefix2 . 'clientstest" style="display: none;"><p><hr><b>' . _('Checking if certificates from  CAs are accepted...') . '</b><p>' . _('A few client certificates will be tested to check if servers are resistant to some certificate problems.') . '<p>';
888
+                        echo '<span id="'.$prefix2.'clientstest" style="display: none;"><p><hr><b>'._('Checking if certificates from  CAs are accepted...').'</b><p>'._('A few client certificates will be tested to check if servers are resistant to some certificate problems.').'<p>';
889 889
                         print join('', $clientstest);
890 890
                         echo '</span>';
891 891
                         echo '</div>';
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
                 //     check if truncates/dies on Operator-Name
900 900
                 if ($my_profile !== NULL) {
901 901
                     echo "<div id='tabs-n'><fieldset class='option_container'>
902
-                <legend><strong>" . _("Live login test") . "</strong></legend>";
902
+                <legend><strong>" . _("Live login test")."</strong></legend>";
903 903
                     $prof_compl = $my_profile->getEapMethodsinOrderOfPreference(1);
904 904
                     if (count($prof_compl) > 0) {
905 905
                         $passwordReqired = FALSE;
@@ -912,34 +912,34 @@  discard block
 block discarded – undo
912 912
                                 $clientCertRequired = TRUE;
913 913
                             }
914 914
                         }
915
-                        echo "<div id='disposable_credential_container'><p>" . _("If you enter an existing login credential here, you can test the actual authentication from various checkpoints all over the world.") . "</p>
916
-                    <p>" . _("The test will use all EAP types you have set in your profile information to check whether the right CAs and server names are used, and of course whether the login with these credentials and the given EAP type actually worked. If you have set anonymous outer ID, the test will use that.") . "</p>
917
-                    <p>" . _("Note: the tool purposefully does not offer you to save these credentials, and they will never be saved in any way on the server side. Please use only <strong>temporary test accounts</strong> here; permanently valid test accounts in the wild are considered harmful!") . "</p></div>
915
+                        echo "<div id='disposable_credential_container'><p>"._("If you enter an existing login credential here, you can test the actual authentication from various checkpoints all over the world.")."</p>
916
+                    <p>" . _("The test will use all EAP types you have set in your profile information to check whether the right CAs and server names are used, and of course whether the login with these credentials and the given EAP type actually worked. If you have set anonymous outer ID, the test will use that.")."</p>
917
+                    <p>" . _("Note: the tool purposefully does not offer you to save these credentials, and they will never be saved in any way on the server side. Please use only <strong>temporary test accounts</strong> here; permanently valid test accounts in the wild are considered harmful!")."</p></div>
918 918
                     <form enctype='multipart/form-data' id='live_form' accept-charset='UTF-8'>
919 919
                     <input type='hidden' name='test_type' value='udp_login'>
920
-                    <input type='hidden' name='lang' value='" . $gui->languageInstance->getLang() . "'>
921
-                    <input type='hidden' name='profile_id' value='" . $my_profile->identifier . "'>
920
+                    <input type='hidden' name='lang' value='" . $gui->languageInstance->getLang()."'>
921
+                    <input type='hidden' name='profile_id' value='" . $my_profile->identifier."'>
922 922
                     <table id='live_tests'>";
923 923
 // if any password based EAP methods are available enable this section
924 924
                         if ($passwordReqired) {
925
-                            echo "<tr><td colspan='2'><strong>" . _("Password-based EAP types") . "</strong></td></tr>
926
-                        <tr><td>" . _("Real (inner) username:") . "</td><td><input type='text' id='username' class='mandatory' name='username'/></td></tr>";
927
-                            echo "<tr><td>" . _("Anonymous outer ID (optional):") . "</td><td><input type='text' id='outer_username' name='outer_username'/></td></tr>";
928
-                            echo "<tr><td>" . _("Password:") . "</td><td><input type='text' id='password' class='mandatory' name='password'/></td></tr>";
925
+                            echo "<tr><td colspan='2'><strong>"._("Password-based EAP types")."</strong></td></tr>
926
+                        <tr><td>" . _("Real (inner) username:")."</td><td><input type='text' id='username' class='mandatory' name='username'/></td></tr>";
927
+                            echo "<tr><td>"._("Anonymous outer ID (optional):")."</td><td><input type='text' id='outer_username' name='outer_username'/></td></tr>";
928
+                            echo "<tr><td>"._("Password:")."</td><td><input type='text' id='password' class='mandatory' name='password'/></td></tr>";
929 929
                         }
930 930
                         // ask for cert + privkey if TLS-based method is active
931 931
                         if ($clientCertRequired) {
932
-                            echo "<tr><td colspan='2'><strong>" . _("Certificate-based EAP types") . "</strong></td></tr>
933
-                        <tr><td>" . _("Certificate file (.p12 or .pfx):") . "</td><td><input type='file' id='cert' accept='application/x-pkcs12' name='cert'/></td></tr>
934
-                        <tr><td>" . _("Certificate password, if any:") . "</td><td><input type='text' id='privkey' name='privkey_pass'/></td></tr>
935
-                        <tr><td>" . _("Username, if different from certificate Subject:") . "</td><td><input type='text' id='tls_username' name='tls_username'/></td></tr>";
932
+                            echo "<tr><td colspan='2'><strong>"._("Certificate-based EAP types")."</strong></td></tr>
933
+                        <tr><td>" . _("Certificate file (.p12 or .pfx):")."</td><td><input type='file' id='cert' accept='application/x-pkcs12' name='cert'/></td></tr>
934
+                        <tr><td>" . _("Certificate password, if any:")."</td><td><input type='text' id='privkey' name='privkey_pass'/></td></tr>
935
+                        <tr><td>" . _("Username, if different from certificate Subject:")."</td><td><input type='text' id='tls_username' name='tls_username'/></td></tr>";
936 936
                         }
937
-                        echo "<tr><td colspan='2'><button id='submit_credentials'>" . _("Submit credentials") . "</button></td></tr></table></form>";
937
+                        echo "<tr><td colspan='2'><button id='submit_credentials'>"._("Submit credentials")."</button></td></tr></table></form>";
938 938
                         echo "<div id='live_login_results' style='display:none'>";
939 939
                         foreach (\config\Diagnostics::RADIUSTESTS['UDP-hosts'] as $hostindex => $host) {
940 940
                             print "<hr>";
941
-                            printf(_("Testing from: %s"), "<strong>" . \config\Diagnostics::RADIUSTESTS['UDP-hosts'][$hostindex]['display_name'] . "</strong>");
942
-                            print "<span style='position:relative'><img src='../resources/images/icons/loading51.gif' id='live_src" . $hostindex . "_img' style='width:24px; position: absolute; $start: 20px; bottom: 0px; '></span>";
941
+                            printf(_("Testing from: %s"), "<strong>".\config\Diagnostics::RADIUSTESTS['UDP-hosts'][$hostindex]['display_name']."</strong>");
942
+                            print "<span style='position:relative'><img src='../resources/images/icons/loading51.gif' id='live_src".$hostindex."_img' style='width:24px; position: absolute; $start: 20px; bottom: 0px; '></span>";
943 943
                             print "<div id='eap_test$hostindex' class='eap_test_results'></div>";
944 944
                         }
945 945
                         echo "</div>";
@@ -954,9 +954,9 @@  discard block
 block discarded – undo
954 954
             }
955 955
 
956 956
             if (isset($_POST['comefrom'])) {
957
-                $return = htmlspecialchars_decode($_POST['comefrom']) . ( $inst_id ? "?inst_id=" . $inst_id : "" );
957
+                $return = htmlspecialchars_decode($_POST['comefrom']).($inst_id ? "?inst_id=".$inst_id : "");
958 958
                 echo "<form method='post' action='$return' accept-charset='UTF-8'>
959
-                    <button type='submit' name='submitbutton' value='" . web\lib\common\FormElements::BUTTON_CLOSE . "'>" . sprintf(_("Return to %s administrator area"), core\common\Entity::$nomenclature_idp) . "</button>"
959
+                    <button type='submit' name='submitbutton' value='".web\lib\common\FormElements::BUTTON_CLOSE."'>".sprintf(_("Return to %s administrator area"), core\common\Entity::$nomenclature_idp)."</button>"
960 960
                 . "</form>";
961 961
             }
962 962
             if ($check_realm !== FALSE) {
Please login to merge, or discard this patch.
core/diag/RFC6614Tests.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -168,27 +168,27 @@  discard block
 block discarded – undo
168 168
     {
169 169
         // it could match CN or sAN:DNS, we don't care which
170 170
         if (isset($this->TLS_CA_checks_result[$host]['certdata']['subject'])) {
171
-            $this->loggerInstance->debug(4, "Checking expected server name " . $this->expectedName . 
172
-                    " against Subject: " . $this->TLS_CA_checks_result[$host]['certdata']['subject']);
171
+            $this->loggerInstance->debug(4, "Checking expected server name ".$this->expectedName. 
172
+                    " against Subject: ".$this->TLS_CA_checks_result[$host]['certdata']['subject']);
173 173
             // we are checking against accidental misconfig, not attacks, so loosely checking against end of string is appropriate
174
-            if (preg_match("/CN=" . $this->expectedName . "/", $this->TLS_CA_checks_result[$host]['certdata']['subject']) === 1) {
174
+            if (preg_match("/CN=".$this->expectedName."/", $this->TLS_CA_checks_result[$host]['certdata']['subject']) === 1) {
175 175
                 return TRUE;
176 176
             }
177 177
         }
178 178
         if (isset($this->TLS_CA_checks_result[$host]['certdata']['extensions']['subjectaltname'])) {
179
-            $this->loggerInstance->debug(4, "Checking expected server name " . $this->expectedName . " against sANs: ");
179
+            $this->loggerInstance->debug(4, "Checking expected server name ".$this->expectedName." against sANs: ");
180 180
             $this->loggerInstance->debug(4, $this->TLS_CA_checks_result[$host]['certdata']['extensions']['subjectaltname']);
181 181
             $testNames = $this->TLS_CA_checks_result[$host]['certdata']['extensions']['subjectaltname'];
182 182
             if (!is_array($testNames)) {
183 183
                 $testNames = [$testNames];
184 184
             }
185 185
             foreach ($testNames as $oneName) {
186
-                if (preg_match("/" . $this->expectedName . "/", $oneName) === 1) {
186
+                if (preg_match("/".$this->expectedName."/", $oneName) === 1) {
187 187
                     return TRUE;
188 188
                 }
189 189
             }
190 190
         }
191
-        $this->loggerInstance->debug(3, "Tried to check expected server name " . $this->expectedName . " but neither CN nor sANs matched.");
191
+        $this->loggerInstance->debug(3, "Tried to check expected server name ".$this->expectedName." but neither CN nor sANs matched.");
192 192
 
193 193
         $this->TLS_CA_checks_result[$host]['cert_oddity'] = RADIUSTests::CERTPROB_DYN_SERVER_NAME_MISMATCH;
194 194
         return FALSE;
@@ -218,9 +218,9 @@  discard block
 block discarded – undo
218 218
                 $this->TLS_clients_checks_result[$host]['ca'][$type]['certificate'][$k]['status'] = $cert['status'];
219 219
                 $this->TLS_clients_checks_result[$host]['ca'][$type]['certificate'][$k]['message'] = $this->TLS_certkeys[$cert['status']];
220 220
                 $this->TLS_clients_checks_result[$host]['ca'][$type]['certificate'][$k]['expected'] = $cert['expected'];
221
-                $add = ' -cert ' . ROOT . '/config/cli-certs/' . $cert['public'] . ' -key ' . ROOT . '/config/cli-certs/' . $cert['private'];
222
-                if (!file_exists(ROOT . '/config/cli-certs/' . $cert['public']) ||!file_exists(ROOT . 
223
-                        '/config/cli-certs/' . $cert['private'])) {
221
+                $add = ' -cert '.ROOT.'/config/cli-certs/'.$cert['public'].' -key '.ROOT.'/config/cli-certs/'.$cert['private'];
222
+                if (!file_exists(ROOT.'/config/cli-certs/'.$cert['public']) || !file_exists(ROOT. 
223
+                        '/config/cli-certs/'.$cert['private'])) {
224 224
                     $this->TLS_clients_checks_result[$host]['ca'][$type]['certificate'][$k]['finalerror'] = 2;
225 225
                     continue;
226 226
                 }
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
                     $this->TLS_clients_checks_result[$host]['ca'][$type]['certificate'][$k] = [];
229 229
                 }
230 230
                 // tls1_3 connections have a problem in strdout/stderr buffering 
231
-                $add .= ' ' . "-no_ssl3 -no_tls1_3";
231
+                $add .= ' '."-no_ssl3 -no_tls1_3";
232 232
                 $opensslbabble = $this->execOpensslClient($host, $add, $this->TLS_clients_checks_result[$host]['ca'][$type]['certificate'][$k]);
233 233
                 $res = $this->opensslClientsResult($host, $opensslbabble, $this->TLS_clients_checks_result, $type, $k);
234 234
                 if ($cert['expected'] == 'PASS') {
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
 // but code analysers want this more explicit, so here is this extra
271 271
 // call to escapeshellarg()
272 272
         $escapedHost = escapeshellarg($host);
273
-        $this->loggerInstance->debug(4, \config\Master::PATHS['openssl'] . " s_client -connect " . $escapedHost . " -CApath " . ROOT . "/config/ca-certs/$this->consortium/ $arg 2>&1\n");
273
+        $this->loggerInstance->debug(4, \config\Master::PATHS['openssl']." s_client -connect ".$escapedHost." -CApath ".ROOT."/config/ca-certs/$this->consortium/ $arg 2>&1\n");
274 274
         $time_start = microtime(true);
275 275
         $opensslbabble = [];
276 276
         $result = 999; // likely to become zero by openssl; don't want to initialise to zero, could cover up exec failures
277
-        exec(\config\Master::PATHS['openssl'] . " s_client -connect " . $escapedHost . " -CApath " . ROOT . "/config/ca-certs/$this->consortium/ $arg 2>&1", $opensslbabble, $result);
277
+        exec(\config\Master::PATHS['openssl']." s_client -connect ".$escapedHost." -CApath ".ROOT."/config/ca-certs/$this->consortium/ $arg 2>&1", $opensslbabble, $result);
278 278
         $time_stop = microtime(true);
279 279
         $testresults['time_millisec'] = floor(($time_stop - $time_start) * 1000);
280 280
         $testresults['returncode'] = $result;
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
     private function propertyCheckPolicy($cert)
397 397
     {
398 398
         $oids = [];
399
-        if (isset($cert['extensions']['certificatePolicies']) &&  $cert['extensions']['certificatePolicies']) {
399
+        if (isset($cert['extensions']['certificatePolicies']) && $cert['extensions']['certificatePolicies']) {
400 400
             foreach (\config\Diagnostics::RADIUSTESTS['TLS-acceptableOIDs'] as $key => $oid) {
401 401
                 if (preg_match("/Policy: $oid/", $cert['extensions']['certificatePolicies'])) {
402 402
                     $oids[$key] = $oid;
Please login to merge, or discard this patch.