Completed
Branch master (03ec64)
by Brook
14:43
created
web/admin/logout_check.php 1 patch
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,10 +18,11 @@
 block discarded – undo
18 18
 if ($ls['Code'] === 'urn:oasis:names:tc:SAML:2.0:status:Success' && !isset($ls['SubCode'])) {
19 19
     /* Successful logout. */
20 20
     $url = htmlspecialchars($_SERVER['HTTP_HOST']) . substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], "/admin/logout_check.php"));
21
-    if ($_SERVER['HTTPS'] == "on")
22
-        $url = "https://" . $url;
23
-    else
24
-        $url = "http://" . $url;
21
+    if ($_SERVER['HTTPS'] == "on") {
22
+            $url = "https://" . $url;
23
+    } else {
24
+            $url = "http://" . $url;
25
+    }
25 26
 
26 27
     header("Location: $url");
27 28
 } else {
Please login to merge, or discard this patch.
web/admin/edit_user_result.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,10 +31,11 @@
 block discarded – undo
31 31
 <?php
32 32
 $remaining_attribs = $user->beginflushAttributes();
33 33
 
34
-if (isset($_POST['option']))
34
+if (isset($_POST['option'])) {
35 35
     foreach ($_POST['option'] as $opt_id => $optname)
36 36
         if ($optname == "user:fedadmin") {
37 37
             echo "Security violation: user tried to make himself federation administrator!";
38
+}
38 39
             exit(1);
39 40
         }
40 41
 ?>
Please login to merge, or discard this patch.
web/admin/overview_federation.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         echo "</table></div>";
139 139
     }
140 140
     if (Config::$CONSORTIUM['name'] == 'eduroam')
141
-        $helptext = "<h3>" . sprintf(_("Need help? Refer to the <a href='%s'>Federation Operator manual</a>"),"https://wiki.geant.org/x/KQB_AQ")."</h3>";
141
+        $helptext = "<h3>" . sprintf(_("Need help? Refer to the <a href='%s'>Federation Operator manual</a>"), "https://wiki.geant.org/x/KQB_AQ") . "</h3>";
142 142
     else
143 143
         $helptext = "";
144 144
     echo $helptext;
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
                 // deployment status; need to dive into profiles for this
187 187
                 // show happy eyeballs if at least one profile is configured/showtime                    
188 188
                 echo "<td>";
189
-                echo ($idp_instance->isOneProfileConfigured() ? "C" : "" ) . " " . ($idp_instance->isOneProfileShowtime() ? "V" : "" );
189
+                echo ($idp_instance->isOneProfileConfigured() ? "C" : "") . " " . ($idp_instance->isOneProfileShowtime() ? "V" : "");
190 190
                 echo "</td>";
191 191
                 // get the coarse status overview
192 192
                 $status = $idp_instance->getAllProfileStatusOverview();
Please login to merge, or discard this patch.
Braces   +21 added lines, -16 removed lines patch added patch discarded remove patch
@@ -128,19 +128,21 @@  discard block
 block discarded – undo
128 128
     if (isset($_GET['invitation'])) {
129 129
         echo "<div class='ca-summary' style='position:relative;'><table>";
130 130
 
131
-        if ($_GET['invitation'] == "SUCCESS")
132
-            echo UI_remark(_("The invitation email was sent successfully."), _("The invitation email was sent."));
133
-        else if ($_GET['invitation'] == "FAILURE")
134
-            echo UI_error(_("The invitation email could not be sent!"), _("The invitation email could not be sent!"));
135
-        else
136
-            echo UI_error(_("Error: unknown result code of invitation!?!"), _("Unknown result!"));
131
+        if ($_GET['invitation'] == "SUCCESS") {
132
+                    echo UI_remark(_("The invitation email was sent successfully."), _("The invitation email was sent."));
133
+        } else if ($_GET['invitation'] == "FAILURE") {
134
+                    echo UI_error(_("The invitation email could not be sent!"), _("The invitation email could not be sent!"));
135
+        } else {
136
+                    echo UI_error(_("Error: unknown result code of invitation!?!"), _("Unknown result!"));
137
+        }
137 138
 
138 139
         echo "</table></div>";
139 140
     }
140
-    if (Config::$CONSORTIUM['name'] == 'eduroam')
141
-        $helptext = "<h3>" . sprintf(_("Need help? Refer to the <a href='%s'>Federation Operator manual</a>"),"https://wiki.geant.org/x/KQB_AQ")."</h3>";
142
-    else
143
-        $helptext = "";
141
+    if (Config::$CONSORTIUM['name'] == 'eduroam') {
142
+            $helptext = "<h3>" . sprintf(_("Need help? Refer to the <a href='%s'>Federation Operator manual</a>"),"https://wiki.geant.org/x/KQB_AQ")."</h3>";
143
+    } else {
144
+            $helptext = "";
145
+    }
144 146
     echo $helptext;
145 147
 
146 148
     ?>
@@ -153,8 +155,9 @@  discard block
 block discarded – undo
153 155
             $feds = $user->getAttributes("user:fedadmin");
154 156
             $pending_invites = $mgmt->listPendingInvitations();
155 157
 
156
-            if (Config::$DB['enforce-external-sync'])
157
-                echo "<th>" . sprintf(_("%s Database Sync Status"), Config::$CONSORTIUM['name']) . "</th>";
158
+            if (Config::$DB['enforce-external-sync']) {
159
+                            echo "<th>" . sprintf(_("%s Database Sync Status"), Config::$CONSORTIUM['name']) . "</th>";
160
+            }
158 161
             ?>
159 162
             <th><?php echo _("Administrator Management"); ?></th>
160 163
         </tr>
@@ -165,10 +168,11 @@  discard block
 block discarded – undo
165 168
 
166 169
             // extract only pending invitations for *this* fed
167 170
             $display_pendings = FALSE;
168
-            foreach ($pending_invites as $oneinvite)
169
-                if (strtoupper($oneinvite['country']) == strtoupper($thefed->identifier)) {
171
+            foreach ($pending_invites as $oneinvite) {
172
+                            if (strtoupper($oneinvite['country']) == strtoupper($thefed->identifier)) {
170 173
                     // echo "PENDINGS!";
171 174
                     $display_pendings = TRUE;
175
+            }
172 176
                 }
173 177
 
174 178
             $idps = $thefed->listIdentityProviders();
@@ -253,8 +257,8 @@  discard block
 block discarded – undo
253 257
                                </strong>
254 258
                             </td>
255 259
                          </tr>";
256
-                foreach ($pending_invites as $oneinvite)
257
-                    if (strtoupper($oneinvite['country']) == strtoupper($thefed->identifier)) {
260
+                foreach ($pending_invites as $oneinvite) {
261
+                                    if (strtoupper($oneinvite['country']) == strtoupper($thefed->identifier)) {
258 262
                         echo "<tr>
259 263
                                     <td>" .
260 264
                         $oneinvite['name'] . "
@@ -263,6 +267,7 @@  discard block
 block discarded – undo
263 267
                         $oneinvite['mail'] . "
264 268
                                     </td>
265 269
                                     <td colspan=2>";
270
+                }
266 271
                         echo "<form method='post' action='overview_federation.php' accept-charset='UTF-8'>
267 272
                                 <input type='hidden' name='invitation_id' value='" . $oneinvite['token'] . "'/>
268 273
                                 <button class='delete' type='submit' name='submitbutton' value='" . BUTTON_DELETE . "'>" . _("Revoke Invitation") . "</button>
Please login to merge, or discard this patch.
web/admin/radius_tests.php 3 patches
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
 $Cat->set_locale("web_admin");
20 20
 
21 21
 $additional_message =  [
22
-   L_OK => '',
23
-   L_REMARK => _("Some properties of the connection attempt were sub-optimal; the list is below."),
24
-   L_WARN => _("Some properties of the connection attempt were sub-optimal; the list is below."),
25
-   L_ERROR => _("Some configuration errors were observed; the list is below."),
22
+    L_OK => '',
23
+    L_REMARK => _("Some properties of the connection attempt were sub-optimal; the list is below."),
24
+    L_WARN => _("Some properties of the connection attempt were sub-optimal; the list is below."),
25
+    L_ERROR => _("Some configuration errors were observed; the list is below."),
26 26
  
27 27
 ];
28 28
 
@@ -32,25 +32,25 @@  discard block
 block discarded – undo
32 32
 }
33 33
 
34 34
 function printDN($dn) {
35
-  $out = '';
36
-  foreach (array_reverse($dn) as $k => $v) {
37
-      if(is_array ($v)) {
38
-         foreach ($v as $V) {
35
+    $out = '';
36
+    foreach (array_reverse($dn) as $k => $v) {
37
+        if(is_array ($v)) {
38
+            foreach ($v as $V) {
39 39
             if($out) 
40
-               $out .= ',';
40
+                $out .= ',';
41 41
             $out .= "$k=$V";
42
-         }
43
-      } else {
44
-         if($out) 
42
+            }
43
+        } else {
44
+            if($out) 
45 45
             $out .= ',';
46
-         $out .= "$k=$v";
47
-      }
48
-  }
49
-  return($out);
46
+            $out .= "$k=$v";
47
+        }
48
+    }
49
+    return($out);
50 50
 }
51 51
 
52 52
 function printTm($tm) {
53
-  return(gmdate(DateTime::COOKIE,$tm));
53
+    return(gmdate(DateTime::COOKIE,$tm));
54 54
 }
55 55
 
56 56
 
@@ -60,19 +60,19 @@  discard block
 block discarded – undo
60 60
     $server_info = [];
61 61
     $udp_result = $testsuite->UDP_reachability_result[$host];
62 62
     if(isset($udp_result['certdata']) && count($udp_result['certdata'])) {
63
-       foreach ($udp_result['certdata'] as $certdata) {
64
-          if($certdata['type'] != 'server' && $certdata['type'] != 'totally_selfsigned' )
65
-             continue;
66
-          $server_cert =  [
67
-             'subject' => printDN($certdata['subject']),
68
-             'issuer' => printDN($certdata['issuer']),
69
-             'validFrom' => printTm($certdata['validFrom_time_t']),
70
-             'validTo' => printTm($certdata['validTo_time_t']),
71
-             'serialNumber' => $certdata['serialNumber'].sprintf(" (0x%X)",$certdata['serialNumber']),
72
-             'sha1' => $certdata['sha1'],
73
-             'extensions' => $certdata['extensions']
74
-          ];
75
-       }
63
+        foreach ($udp_result['certdata'] as $certdata) {
64
+            if($certdata['type'] != 'server' && $certdata['type'] != 'totally_selfsigned' )
65
+                continue;
66
+            $server_cert =  [
67
+                'subject' => printDN($certdata['subject']),
68
+                'issuer' => printDN($certdata['issuer']),
69
+                'validFrom' => printTm($certdata['validFrom_time_t']),
70
+                'validTo' => printTm($certdata['validTo_time_t']),
71
+                'serialNumber' => $certdata['serialNumber'].sprintf(" (0x%X)",$certdata['serialNumber']),
72
+                'sha1' => $certdata['sha1'],
73
+                'extensions' => $certdata['extensions']
74
+            ];
75
+        }
76 76
     }
77 77
     $ret['server_cert'] = $server_cert;
78 78
     if(isset($udp_result['incoming_server_names'][0]) ) {
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 */
121 121
 $hostindex = $_REQUEST['hostindex']; 
122 122
 if(!is_numeric($hostindex))
123
-  exit;
123
+    exit;
124 124
 
125 125
 
126 126
 $returnarray = [];
@@ -177,16 +177,16 @@  discard block
 block discarded – undo
177 177
                 case RETVAL_OK :
178 178
                     $level = $returnarray['result'][$i]['level'];
179 179
                     switch($level) {
180
-                         case L_OK :
180
+                            case L_OK :
181 181
                              $message = _("<strong>Test successful.</strong>");
182
-                             break;
183
-                         case L_REMARK :
182
+                                break;
183
+                            case L_REMARK :
184 184
                          case L_WARN :
185 185
                              $message = _("<strong>Test partially successful</strong>: authentication succeded.") . ' ' . $additional_message[$level];
186
-                             break;
187
-                         case L_ERROR :
186
+                                break;
187
+                            case L_ERROR :
188 188
                              $message = _("<strong>Test FAILED</strong>: authentication succeded.") . ' ' . $additional_message[$level];
189
-                             break;
189
+                                break;
190 190
                     }
191 191
                     break;
192 192
                 case RETVAL_CONVERSATION_REJECT:
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 $Cat = new CAT();
19 19
 $Cat->set_locale("web_admin");
20 20
 
21
-$additional_message =  [
21
+$additional_message = [
22 22
    L_OK => '',
23 23
    L_REMARK => _("Some properties of the connection attempt were sub-optimal; the list is below."),
24 24
    L_WARN => _("Some properties of the connection attempt were sub-optimal; the list is below."),
@@ -28,20 +28,20 @@  discard block
 block discarded – undo
28 28
 
29 29
 function disp_name($eap) {
30 30
     $D = EAP::eapDisplayName($eap);
31
-    return $D['OUTER'] . ( $D['INNER'] != '' ? '-' . $D['INNER'] : '');
31
+    return $D['OUTER'] . ($D['INNER'] != '' ? '-' . $D['INNER'] : '');
32 32
 }
33 33
 
34 34
 function printDN($dn) {
35 35
   $out = '';
36 36
   foreach (array_reverse($dn) as $k => $v) {
37
-      if(is_array ($v)) {
37
+      if (is_array($v)) {
38 38
          foreach ($v as $V) {
39
-            if($out) 
39
+            if ($out) 
40 40
                $out .= ',';
41 41
             $out .= "$k=$V";
42 42
          }
43 43
       } else {
44
-         if($out) 
44
+         if ($out) 
45 45
             $out .= ',';
46 46
          $out .= "$k=$v";
47 47
       }
@@ -50,32 +50,32 @@  discard block
 block discarded – undo
50 50
 }
51 51
 
52 52
 function printTm($tm) {
53
-  return(gmdate(DateTime::COOKIE,$tm));
53
+  return(gmdate(DateTime::COOKIE, $tm));
54 54
 }
55 55
 
56 56
 
57 57
 
58
-function process_result($testsuite,$host) {
58
+function process_result($testsuite, $host) {
59 59
     $ret = [];
60 60
     $server_info = [];
61 61
     $udp_result = $testsuite->UDP_reachability_result[$host];
62
-    if(isset($udp_result['certdata']) && count($udp_result['certdata'])) {
62
+    if (isset($udp_result['certdata']) && count($udp_result['certdata'])) {
63 63
        foreach ($udp_result['certdata'] as $certdata) {
64
-          if($certdata['type'] != 'server' && $certdata['type'] != 'totally_selfsigned' )
64
+          if ($certdata['type'] != 'server' && $certdata['type'] != 'totally_selfsigned')
65 65
              continue;
66
-          $server_cert =  [
66
+          $server_cert = [
67 67
              'subject' => printDN($certdata['subject']),
68 68
              'issuer' => printDN($certdata['issuer']),
69 69
              'validFrom' => printTm($certdata['validFrom_time_t']),
70 70
              'validTo' => printTm($certdata['validTo_time_t']),
71
-             'serialNumber' => $certdata['serialNumber'].sprintf(" (0x%X)",$certdata['serialNumber']),
71
+             'serialNumber' => $certdata['serialNumber'] . sprintf(" (0x%X)", $certdata['serialNumber']),
72 72
              'sha1' => $certdata['sha1'],
73 73
              'extensions' => $certdata['extensions']
74 74
           ];
75 75
        }
76 76
     }
77 77
     $ret['server_cert'] = $server_cert;
78
-    if(isset($udp_result['incoming_server_names'][0]) ) {
78
+    if (isset($udp_result['incoming_server_names'][0])) {
79 79
         $ret['server'] = sprintf(_("Connected to %s."), $udp_result['incoming_server_names'][0]);
80 80
     }
81 81
     else
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
    exit;
120 120
 */
121 121
 $hostindex = $_REQUEST['hostindex']; 
122
-if(!is_numeric($hostindex))
122
+if (!is_numeric($hostindex))
123 123
   exit;
124 124
 
125 125
 
@@ -140,14 +140,14 @@  discard block
 block discarded – undo
140 140
                 if ($_FILES['cert']['error'] == UPLOAD_ERR_OK) {
141 141
                     $clientcertdata = file_get_contents($_FILES['cert']['tmp_name']);
142 142
                     $privkey_pass = isset($_REQUEST['privkey_pass']) && $_REQUEST['privkey_pass'] ? $_REQUEST['privkey_pass'] : ""; //!!
143
-                    if(isset($_REQUEST['tls_username']) && $_REQUEST['tls_username']) {
143
+                    if (isset($_REQUEST['tls_username']) && $_REQUEST['tls_username']) {
144 144
                         $tls_username = valid_user($_REQUEST['tls_username']);
145 145
                     } else {
146
-                        if(openssl_pkcs12_read($clientcertdata,$certs,$privkey_pass)) {
146
+                        if (openssl_pkcs12_read($clientcertdata, $certs, $privkey_pass)) {
147 147
                             $mydetails = openssl_x509_parse($certs['cert']);
148
-                            if(isset($mydetails['subject']['CN']) && $mydetails['subject']['CN']) {
149
-                                $tls_username=$mydetails['subject']['CN'];
150
-                                debug(4,"PKCS12-CN=$tls_username\n");
148
+                            if (isset($mydetails['subject']['CN']) && $mydetails['subject']['CN']) {
149
+                                $tls_username = $mydetails['subject']['CN'];
150
+                                debug(4, "PKCS12-CN=$tls_username\n");
151 151
                             } else {
152 152
                                 $testresult = RETVAL_INCOMPLETE_DATA;
153 153
                                 $run_test = FALSE;
@@ -161,14 +161,14 @@  discard block
 block discarded – undo
161 161
                     $testresult = RETVAL_INCOMPLETE_DATA;
162 162
                     $run_test = FALSE;
163 163
                 }
164
-                    if($run_test) {
165
-                        debug(4,"TLS-USERNAME=$tls_username\n");
166
-                        $testresult = $testsuite->UDP_login($hostindex, $eap, $tls_username, $privkey_pass,'', TRUE, TRUE, $clientcertdata);
164
+                    if ($run_test) {
165
+                        debug(4, "TLS-USERNAME=$tls_username\n");
166
+                        $testresult = $testsuite->UDP_login($hostindex, $eap, $tls_username, $privkey_pass, '', TRUE, TRUE, $clientcertdata);
167 167
                     }
168 168
             } else {
169
-                $testresult = $testsuite->UDP_login($hostindex, $eap, $user_name, $user_password,$outer_user_name);
169
+                $testresult = $testsuite->UDP_login($hostindex, $eap, $user_name, $user_password, $outer_user_name);
170 170
             }
171
-        $returnarray['result'][$i] = process_result($testsuite,$hostindex);
171
+        $returnarray['result'][$i] = process_result($testsuite, $hostindex);
172 172
         $returnarray['result'][$i]['eap'] = display_name($eap);
173 173
         $returnarray['returncode'][$i] = $testresult;
174 174
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
             switch ($testresult) {
177 177
                 case RETVAL_OK :
178 178
                     $level = $returnarray['result'][$i]['level'];
179
-                    switch($level) {
179
+                    switch ($level) {
180 180
                          case L_OK :
181 181
                              $message = _("<strong>Test successful.</strong>");
182 182
                              break;
@@ -228,21 +228,21 @@  discard block
 block discarded – undo
228 228
         $i = 0;
229 229
         $returnarray['hostindex'] = $hostindex;
230 230
         $testresult = $testsuite->UDP_reachability($hostindex);
231
-        $returnarray['result'][$i] = process_result($testsuite,$hostindex);
231
+        $returnarray['result'][$i] = process_result($testsuite, $hostindex);
232 232
         $returnarray['result'][$i]['eap'] = 'ALL';
233 233
         $returnarray['returncode'][$i] = $testresult;
234 234
         // a failed check may not have gotten any certificate, be prepared for that
235 235
         switch ($testresult) {
236 236
             case RETVAL_CONVERSATION_REJECT:
237 237
                 $level = $returnarray['result'][$i]['level'];
238
-                if($level > L_OK)
238
+                if ($level > L_OK)
239 239
                     $message = _("<strong>Test partially successful</strong>: a bidirectional RADIUS conversation with multiple round-trips was carried out, and ended in an Access-Reject as planned.") . ' ' . $additional_message[$level];
240 240
                 else
241 241
                     $message = _("<strong>Test successful</strong>: a bidirectional RADIUS conversation with multiple round-trips was carried out, and ended in an Access-Reject as planned.");
242 242
                 break;
243 243
             case RETVAL_IMMEDIATE_REJECT:
244 244
                 $message = _("<strong>Test FAILED</strong>: the request was rejected immediately, without EAP conversation. This is not necessarily an error: if the RADIUS server enforces that outer identities correspond to an existing username, then this result is expected (Note: you could configure a valid outer identity in your profile settings to get past this hurdle). In all other cases, the server appears misconfigured or it is unreachable.");
245
-                $level= L_WARN;
245
+                $level = L_WARN;
246 246
                 break;
247 247
             case RETVAL_NO_RESPONSE:
248 248
                     $returnarray['result'][$i]['server'] = 0;
@@ -255,10 +255,10 @@  discard block
 block discarded – undo
255 255
                 break;
256 256
             default:
257 257
                 $message = _("unhandled error");
258
-                $level= L_ERROR;
258
+                $level = L_ERROR;
259 259
                 break;
260 260
         }
261
-debug(4,"SERVER=".$returnarray['result'][$i]['server']."\n");
261
+debug(4, "SERVER=" . $returnarray['result'][$i]['server'] . "\n");
262 262
         $returnarray['result'][$i]['level'] = $level;
263 263
         $returnarray['result'][$i]['message'] = $message;
264 264
         break;
Please login to merge, or discard this patch.
Braces   +43 added lines, -30 removed lines patch added patch discarded remove patch
@@ -36,13 +36,15 @@  discard block
 block discarded – undo
36 36
   foreach (array_reverse($dn) as $k => $v) {
37 37
       if(is_array ($v)) {
38 38
          foreach ($v as $V) {
39
-            if($out) 
40
-               $out .= ',';
39
+            if($out) {
40
+                           $out .= ',';
41
+            }
41 42
             $out .= "$k=$V";
42 43
          }
43 44
       } else {
44
-         if($out) 
45
-            $out .= ',';
45
+         if($out) {
46
+                     $out .= ',';
47
+         }
46 48
          $out .= "$k=$v";
47 49
       }
48 50
   }
@@ -61,8 +63,9 @@  discard block
 block discarded – undo
61 63
     $udp_result = $testsuite->UDP_reachability_result[$host];
62 64
     if(isset($udp_result['certdata']) && count($udp_result['certdata'])) {
63 65
        foreach ($udp_result['certdata'] as $certdata) {
64
-          if($certdata['type'] != 'server' && $certdata['type'] != 'totally_selfsigned' )
65
-             continue;
66
+          if($certdata['type'] != 'server' && $certdata['type'] != 'totally_selfsigned' ) {
67
+                       continue;
68
+          }
66 69
           $server_cert =  [
67 70
              'subject' => printDN($certdata['subject']),
68 71
              'issuer' => printDN($certdata['issuer']),
@@ -77,9 +80,9 @@  discard block
 block discarded – undo
77 80
     $ret['server_cert'] = $server_cert;
78 81
     if(isset($udp_result['incoming_server_names'][0]) ) {
79 82
         $ret['server'] = sprintf(_("Connected to %s."), $udp_result['incoming_server_names'][0]);
83
+    } else {
84
+            $ret['server'] = 0;
80 85
     }
81
-    else
82
-        $ret['server'] = 0;
83 86
     $ret['level'] = L_OK;
84 87
     $ret['time_millisec'] = sprintf("%d", $udp_result['time_millisec']);
85 88
     if (isset($udp_result['cert_oddities']) && count($udp_result['cert_oddities']) > 0) {
@@ -100,8 +103,9 @@  discard block
 block discarded – undo
100 103
     return $ret;
101 104
 }
102 105
 
103
-if (!isset($_REQUEST['test_type']) || !$_REQUEST['test_type'])
106
+if (!isset($_REQUEST['test_type']) || !$_REQUEST['test_type']) {
104 107
     exit;
108
+}
105 109
 
106 110
 $test_type = $_REQUEST['test_type']; 
107 111
 $check_realm = valid_Realm($_REQUEST['realm']); 
@@ -119,8 +123,9 @@  discard block
 block discarded – undo
119 123
    exit;
120 124
 */
121 125
 $hostindex = $_REQUEST['hostindex']; 
122
-if(!is_numeric($hostindex))
126
+if(!is_numeric($hostindex)) {
123 127
   exit;
128
+}
124 129
 
125 130
 
126 131
 $returnarray = [];
@@ -235,10 +240,11 @@  discard block
 block discarded – undo
235 240
         switch ($testresult) {
236 241
             case RETVAL_CONVERSATION_REJECT:
237 242
                 $level = $returnarray['result'][$i]['level'];
238
-                if($level > L_OK)
239
-                    $message = _("<strong>Test partially successful</strong>: a bidirectional RADIUS conversation with multiple round-trips was carried out, and ended in an Access-Reject as planned.") . ' ' . $additional_message[$level];
240
-                else
241
-                    $message = _("<strong>Test successful</strong>: a bidirectional RADIUS conversation with multiple round-trips was carried out, and ended in an Access-Reject as planned.");
243
+                if($level > L_OK) {
244
+                                    $message = _("<strong>Test partially successful</strong>: a bidirectional RADIUS conversation with multiple round-trips was carried out, and ended in an Access-Reject as planned.") . ' ' . $additional_message[$level];
245
+                } else {
246
+                                    $message = _("<strong>Test successful</strong>: a bidirectional RADIUS conversation with multiple round-trips was carried out, and ended in an Access-Reject as planned.");
247
+                }
242 248
                 break;
243 249
             case RETVAL_IMMEDIATE_REJECT:
244 250
                 $message = _("<strong>Test FAILED</strong>: the request was rejected immediately, without EAP conversation. This is not necessarily an error: if the RADIUS server enforces that outer identities correspond to an existing username, then this result is expected (Note: you could configure a valid outer identity in your profile settings to get past this hurdle). In all other cases, the server appears misconfigured or it is unreachable.");
@@ -276,23 +282,28 @@  discard block
 block discarded – undo
276 282
             } else {
277 283
                 $returnarray['message'] = $testsuite->return_codes[$testsuite->TLS_CA_checks_result[$host]['status']]["message"];
278 284
                 $returnarray['level'] = L_OK;
279
-                if ($testsuite->TLS_CA_checks_result[$host]['status'] != RETVAL_CONNECTION_REFUSED)
280
-                    $returnarray['message'] .= ' (' . sprintf(_("elapsed time: %d"), $testsuite->TLS_CA_checks_result[$host]['time_millisec']) . '&nbsp;ms)';
281
-                else
282
-                    $returnarray['level'] = L_ERROR;
285
+                if ($testsuite->TLS_CA_checks_result[$host]['status'] != RETVAL_CONNECTION_REFUSED) {
286
+                                    $returnarray['message'] .= ' (' . sprintf(_("elapsed time: %d"), $testsuite->TLS_CA_checks_result[$host]['time_millisec']) . '&nbsp;ms)';
287
+                } else {
288
+                                    $returnarray['level'] = L_ERROR;
289
+                }
283 290
                 if ($testsuite->TLS_CA_checks_result[$host]['status'] == RETVAL_OK) {
284 291
                     $returnarray['certdata'] = [];
285 292
                     $returnarray['certdata']['subject'] = $testsuite->TLS_CA_checks_result[$host]['certdata']['subject'];
286 293
                     $returnarray['certdata']['issuer'] = $testsuite->TLS_CA_checks_result[$host]['certdata']['issuer'];
287 294
                     $returnarray['certdata']['extensions'] = [];
288
-                    if (isset($testsuite->TLS_CA_checks_result[$host]['certdata']['extensions']['subjectaltname']))
289
-                        $returnarray['certdata']['extensions']['subjectaltname'] = $testsuite->TLS_CA_checks_result[$host]['certdata']['extensions']['subjectaltname'];
290
-                    if (isset($testsuite->TLS_CA_checks_result[$host]['certdata']['extensions']['policyoid']))
291
-                        $returnarray['certdata']['extensions']['policies'] = join(' ', $testsuite->TLS_CA_checks_result[$host]['certdata']['extensions']['policyoid']);
292
-                    if (isset($testsuite->TLS_CA_checks_result[$host]['certdata']['extensions']['crlDistributionPoint']))
293
-                        $returnarray['certdata']['extensions']['crldistributionpoints'] = $testsuite->TLS_CA_checks_result[$host]['certdata']['extensions']['crlDistributionPoint'];
294
-                    if (isset($testsuite->TLS_CA_checks_result[$host]['certdata']['extensions']['authorityInfoAccess']))
295
-                        $returnarray['certdata']['extensions']['authorityinfoaccess'] = $testsuite->TLS_CA_checks_result[$host]['certdata']['extensions']['authorityInfoAccess'];
295
+                    if (isset($testsuite->TLS_CA_checks_result[$host]['certdata']['extensions']['subjectaltname'])) {
296
+                                            $returnarray['certdata']['extensions']['subjectaltname'] = $testsuite->TLS_CA_checks_result[$host]['certdata']['extensions']['subjectaltname'];
297
+                    }
298
+                    if (isset($testsuite->TLS_CA_checks_result[$host]['certdata']['extensions']['policyoid'])) {
299
+                                            $returnarray['certdata']['extensions']['policies'] = join(' ', $testsuite->TLS_CA_checks_result[$host]['certdata']['extensions']['policyoid']);
300
+                    }
301
+                    if (isset($testsuite->TLS_CA_checks_result[$host]['certdata']['extensions']['crlDistributionPoint'])) {
302
+                                            $returnarray['certdata']['extensions']['crldistributionpoints'] = $testsuite->TLS_CA_checks_result[$host]['certdata']['extensions']['crlDistributionPoint'];
303
+                    }
304
+                    if (isset($testsuite->TLS_CA_checks_result[$host]['certdata']['extensions']['authorityInfoAccess'])) {
305
+                                            $returnarray['certdata']['extensions']['authorityinfoaccess'] = $testsuite->TLS_CA_checks_result[$host]['certdata']['extensions']['authorityInfoAccess'];
306
+                    }
296 307
                 }
297 308
                 $returnarray['cert_oddities'] = [];
298 309
             }
@@ -306,10 +317,11 @@  discard block
 block discarded – undo
306 317
         $k = 0;
307 318
         // the host member of the array may not exist if RETVAL_SKIPPED came out
308 319
         // (e.g. no client cert to test with). Be prepared for that
309
-        if (isset($testsuite->TLS_clients_checks_result[$host]))
310
-            foreach ($testsuite->TLS_clients_checks_result[$host]['ca'] as $type => $cli) {
320
+        if (isset($testsuite->TLS_clients_checks_result[$host])) {
321
+                    foreach ($testsuite->TLS_clients_checks_result[$host]['ca'] as $type => $cli) {
311 322
                 foreach ($cli as $key => $val) {
312 323
                     $returnarray['ca'][$k][$key] = $val;
324
+        }
313 325
                 }
314 326
                 $k++;
315 327
             }
@@ -347,8 +359,9 @@  discard block
 block discarded – undo
347 359
             $oids = check_policy($data);
348 360
             if (!empty($oids)) {
349 361
                 $printedres .= '<li>' . _("Certificate policies") . ':';
350
-                foreach ($oids as $k => $o)
351
-                    $printedres .= " $o ($k)";
362
+                foreach ($oids as $k => $o) {
363
+                                    $printedres .= " $o ($k)";
364
+                }
352 365
             }
353 366
             if (($crl = certificate_get_field($data, 'crlDistributionPoints'))) {
354 367
                 $printedres .= '<li>' . _("crlDistributionPoints") . ': ' . $crl;
Please login to merge, or discard this patch.
web/admin/sanity_tests.php 2 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -36,53 +36,53 @@  discard block
 block discarded – undo
36 36
 require_once("SanityTests.php");
37 37
 
38 38
 function print_test_results($t) {
39
-   $out = '';
40
-   switch($t->test_result['global']) {
41
-       case L_OK:
39
+    $out = '';
40
+    switch($t->test_result['global']) {
41
+        case L_OK:
42 42
          $message = "Your configuration appears to be fine.";
43
-         break;
44
-       case L_WARN:
43
+            break;
44
+        case L_WARN:
45 45
          $message = "There were some warnings, but your configuration should work.";
46
-         break;
47
-       case L_ERROR:
46
+            break;
47
+        case L_ERROR:
48 48
          $message = "Your configuration appears to be broken, please fix the errors.";
49
-         break;
50
-       case L_NOTICE:
49
+            break;
50
+        case L_NOTICE:
51 51
          $message = "Your configuration appears to be fine.";
52
-         break;
53
-   }
54
-   $out .= UI_message($t->test_result['global'],"<br><strong>Test Summary</strong><br>".$message."<br>See below for details<br><hr>");
55
-   foreach ($t->out as $test => $test_val)  {
56
-   foreach ($test_val as $o)  {
57
-       $out .= UI_message($o['level'],$o['message']);
58
-   }
59
-   }
60
-   return($out);
52
+            break;
53
+    }
54
+    $out .= UI_message($t->test_result['global'],"<br><strong>Test Summary</strong><br>".$message."<br>See below for details<br><hr>");
55
+    foreach ($t->out as $test => $test_val)  {
56
+    foreach ($test_val as $o)  {
57
+        $out .= UI_message($o['level'],$o['message']);
58
+    }
59
+    }
60
+    return($out);
61 61
 }
62 62
 
63 63
 function return_test_results($t) {
64
-   $out = '';
65
-   switch($t->test_result['global']) {
66
-       case L_OK:
64
+    $out = '';
65
+    switch($t->test_result['global']) {
66
+        case L_OK:
67 67
          $message = "Your configuration appears to be fine.";
68
-         break;
69
-       case L_WARN:
68
+            break;
69
+        case L_WARN:
70 70
          $message = "There were some warnings, but your configuration should work.";
71
-         break;
72
-       case L_ERROR:
71
+            break;
72
+        case L_ERROR:
73 73
          $message = "Your configuration appears to be broken, please fix the errors.";
74
-         break;
75
-       case L_NOTICE:
74
+            break;
75
+        case L_NOTICE:
76 76
          $message = "Your configuration appears to be fine.";
77
-         break;
78
-   }
79
-   $out .= UI_message($t->test_result['global'],"<br><strong>Test Summary</strong><br>".$message."<br>See below for details<br><hr>");
80
-   foreach ($t->out as $test => $test_val)  {
81
-   foreach ($test_val as $o)  {
82
-       $out .= UI_message($o['level'],$o['message']);
83
-   }
84
-   }
85
-   return($out);
77
+            break;
78
+    }
79
+    $out .= UI_message($t->test_result['global'],"<br><strong>Test Summary</strong><br>".$message."<br>See below for details<br><hr>");
80
+    foreach ($t->out as $test => $test_val)  {
81
+    foreach ($test_val as $o)  {
82
+        $out .= UI_message($o['level'],$o['message']);
83
+    }
84
+    }
85
+    return($out);
86 86
 }
87 87
 
88 88
 
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
     authenticate();
94 94
     $user = new User($_SESSION['user']);
95 95
     if (!$user->isSuperadmin()) {
96
-         print "Not Superadmin";
97
-         exit;
96
+            print "Not Superadmin";
97
+            exit;
98 98
     }
99 99
     
100 100
 }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         break;
109 109
     case 'html':
110 110
     header("Content-Type:text/html;charset=utf-8");
111
-      echo "<!DOCTYPE html>
111
+        echo "<!DOCTYPE html>
112 112
           <html xmlns='http://www.w3.org/1999/xhtml' lang='$ourlocale'>
113 113
           <head lang='$ourlocale'>
114 114
           <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'></head>";
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
 function print_test_results($t) {
39 39
    $out = '';
40
-   switch($t->test_result['global']) {
40
+   switch ($t->test_result['global']) {
41 41
        case L_OK:
42 42
          $message = "Your configuration appears to be fine.";
43 43
          break;
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
          $message = "Your configuration appears to be fine.";
52 52
          break;
53 53
    }
54
-   $out .= UI_message($t->test_result['global'],"<br><strong>Test Summary</strong><br>".$message."<br>See below for details<br><hr>");
55
-   foreach ($t->out as $test => $test_val)  {
56
-   foreach ($test_val as $o)  {
57
-       $out .= UI_message($o['level'],$o['message']);
54
+   $out .= UI_message($t->test_result['global'], "<br><strong>Test Summary</strong><br>" . $message . "<br>See below for details<br><hr>");
55
+   foreach ($t->out as $test => $test_val) {
56
+   foreach ($test_val as $o) {
57
+       $out .= UI_message($o['level'], $o['message']);
58 58
    }
59 59
    }
60 60
    return($out);
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
 function return_test_results($t) {
64 64
    $out = '';
65
-   switch($t->test_result['global']) {
65
+   switch ($t->test_result['global']) {
66 66
        case L_OK:
67 67
          $message = "Your configuration appears to be fine.";
68 68
          break;
@@ -76,10 +76,10 @@  discard block
 block discarded – undo
76 76
          $message = "Your configuration appears to be fine.";
77 77
          break;
78 78
    }
79
-   $out .= UI_message($t->test_result['global'],"<br><strong>Test Summary</strong><br>".$message."<br>See below for details<br><hr>");
80
-   foreach ($t->out as $test => $test_val)  {
81
-   foreach ($test_val as $o)  {
82
-       $out .= UI_message($o['level'],$o['message']);
79
+   $out .= UI_message($t->test_result['global'], "<br><strong>Test Summary</strong><br>" . $message . "<br>See below for details<br><hr>");
80
+   foreach ($t->out as $test => $test_val) {
81
+   foreach ($test_val as $o) {
82
+       $out .= UI_message($o['level'], $o['message']);
83 83
    }
84 84
    }
85 85
    return($out);
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 }
101 101
 $test = new SanityTest();
102 102
 $test->run_tests($Tests);
103
-$format =  empty($_REQUEST['format']) ? 'include' : $_REQUEST['format'];
103
+$format = empty($_REQUEST['format']) ? 'include' : $_REQUEST['format'];
104 104
 switch ($format) {
105 105
     case 'include':
106 106
         $o = print_test_results($test);
Please login to merge, or discard this patch.
web/admin/overview_idp.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         <div class='infobox' style='text-align:center;'>
86 86
             <h2><?php echo _("Institution Download Area QR Code"); ?></h2>
87 87
             <?php
88
-            $displayurl = ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on" ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] . dirname(dirname($_SERVER['SCRIPT_NAME'])) . "?idp=" . $my_inst->identifier;
88
+            $displayurl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on" ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] . dirname(dirname($_SERVER['SCRIPT_NAME'])) . "?idp=" . $my_inst->identifier;
89 89
             $uri = "data:image/png;base64," . base64_encode(png_inject_consortium_logo(QRcode::png($displayurl, FALSE, QR_ECLEVEL_Q, 12)));
90 90
             $size = getimagesize($uri);
91 91
             echo "<img width='" . ($size[0] / 4) . "' height='" . ($size[1] / 4) . "' src='$uri' alt='QR-code'/>";
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
             </td>
116 116
             <td>
117 117
                 <form action='edit_idp_result.php?inst_id=<?php echo $my_inst->identifier; ?>' method='post' accept-charset='UTF-8'>
118
-                    <button class='delete' type='submit' name='submitbutton' value='<?php echo BUTTON_DELETE; ?>' onclick="return confirm('<?php echo ( Config::$CONSORTIUM['selfservice_registration'] === NULL ? _("After deleting the IdP, you can not recreate it yourself - you need a new invitation token from the federation administrator!") . " " : "" ) . sprintf(_("Do you really want to delete your IdP %s?"), $my_inst->name); ?>')"><?php echo _("Delete IdP"); ?></button>
118
+                    <button class='delete' type='submit' name='submitbutton' value='<?php echo BUTTON_DELETE; ?>' onclick="return confirm('<?php echo (Config::$CONSORTIUM['selfservice_registration'] === NULL ? _("After deleting the IdP, you can not recreate it yourself - you need a new invitation token from the federation administrator!") . " " : "") . sprintf(_("Do you really want to delete your IdP %s?"), $my_inst->name); ?>')"><?php echo _("Delete IdP"); ?></button>
119 119
                 </form>
120 120
 
121 121
             </td>
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
         $has_realm = $profile_list->getAttributes("internal:realm");
231 231
         $has_realm = $has_realm[0]['value'];
232 232
         echo "<div class='profilemodulebuttons' style='float:right;'>";
233
-        if (count(Config::$RADIUSTESTS['UDP-hosts']) > 0 || ( count(Config::$RADIUSTESTS['TLS-clientcerts']) > 0 && Config::$RADIUSTESTS['TLS-discoverytag'] != ""))
233
+        if (count(Config::$RADIUSTESTS['UDP-hosts']) > 0 || (count(Config::$RADIUSTESTS['TLS-clientcerts']) > 0 && Config::$RADIUSTESTS['TLS-discoverytag'] != ""))
234 234
             echo "<form action='action_realmcheck.php?inst_id=$my_inst->identifier&amp;profile_id=$profile_list->identifier' method='post' accept-charset='UTF-8'>
235 235
                               <button type='submit' name='profile_action' value='check' " . ($has_realm ? "" : "disabled='disabled' title='" . _("The realm can only be checked if you configure the realm!") . "'") . ">
236 236
                                   " . _("Check realm reachability") . "
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
             if (isset($URL['device-specific:redirect']))
265 265
                 $displayurl = $URL['device-specific:redirect'][0];
266 266
             else
267
-                $displayurl = ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on" ? 'https://' : 'http://' ) . $_SERVER['SERVER_NAME'] . dirname(dirname($_SERVER['SCRIPT_NAME'])) . "?idp=" . $my_inst->identifier . "&amp;profile=" . $profile_list->identifier;
267
+                $displayurl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on" ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] . dirname(dirname($_SERVER['SCRIPT_NAME'])) . "?idp=" . $my_inst->identifier . "&amp;profile=" . $profile_list->identifier;
268 268
             echo "<a href='$displayurl' style='white-space: nowrap; text-align: center;'>";
269 269
             $uri = "data:image/png;base64," . base64_encode(png_inject_consortium_logo(QRcode::png($displayurl, FALSE, QR_ECLEVEL_Q, 12)));
270 270
             $size = getimagesize($uri);
Please login to merge, or discard this patch.
Braces   +48 added lines, -31 removed lines patch added patch discarded remove patch
@@ -28,8 +28,9 @@  discard block
 block discarded – undo
28 28
 
29 29
 // delete stored realm
30 30
 
31
-if (isset($_SESSION['check_realm']))
31
+if (isset($_SESSION['check_realm'])) {
32 32
     unset($_SESSION['check_realm']);
33
+}
33 34
 
34 35
 
35 36
 geo_widget_head($my_inst->federation, $my_inst->name);
@@ -95,15 +96,17 @@  discard block
 block discarded – undo
95 96
         </div>
96 97
         <?php
97 98
         $loadmap = FALSE;
98
-        foreach ($idpoptions as $optionname => $optionvalue)
99
-            if ($optionvalue['name'] == "general:geo_coordinates")
99
+        foreach ($idpoptions as $optionname => $optionvalue) {
100
+                    if ($optionvalue['name'] == "general:geo_coordinates")
100 101
                 $loadmap = TRUE;
101
-        if ($loadmap)
102
-            echo '
102
+        }
103
+        if ($loadmap) {
104
+                    echo '
103 105
 <div class="infobox"  style="width:270px;">
104 106
 <div id="map" style="width:100%; height:150px"></div>
105 107
 </div>
106 108
 ';
109
+        }
107 110
         ?>
108 111
     </div>
109 112
     <table>
@@ -131,8 +134,8 @@  discard block
 block discarded – undo
131 134
     <h2><?php _("Available Support actions"); ?></h2>
132 135
     <table>
133 136
         <?php
134
-        if (count(Config::$RADIUSTESTS['UDP-hosts']) > 0 || Config::$RADIUSTESTS['TLS-discoverytag'] != "")
135
-            echo "<tr>
137
+        if (count(Config::$RADIUSTESTS['UDP-hosts']) > 0 || Config::$RADIUSTESTS['TLS-discoverytag'] != "") {
138
+                    echo "<tr>
136 139
                         <td>" . _("Check another realm's reachability") . "</td>
137 140
                         <td><form method='post' action='action_realmcheck.php?inst_id=$my_inst->identifier' accept-charset='UTF-8'>
138 141
                               <input type='text' name='realm' id='realm'>
@@ -140,7 +143,9 @@  discard block
 block discarded – undo
140 143
                             </form>
141 144
                         </td>
142 145
                     </tr>";
143
-        if (Config::$CONSORTIUM['name'] == "eduroam") // SW: APPROVED
146
+        }
147
+        if (Config::$CONSORTIUM['name'] == "eduroam") {
148
+            // SW: APPROVED
144 149
             echo "<tr>
145 150
                         <td>" . _("Check server status of European federations") . "</td>
146 151
                         <td>
@@ -149,14 +154,17 @@  discard block
 block discarded – undo
149 154
                            </form>
150 155
                         </td>
151 156
                     </tr>";
157
+        }
152 158
         ?>
153 159
     </table>
154 160
     <hr/>
155 161
     <h2><?php echo _("Profiles for this institution"); ?></h2>
156 162
     <?php
157 163
     $profiles_for_this_idp = $my_inst->listProfiles();
158
-    if (count($profiles_for_this_idp) == 0) // no profiles yet.
164
+    if (count($profiles_for_this_idp) == 0) {
165
+        // no profiles yet.
159 166
         echo _("There are not yet any profiles for your institution.");
167
+    }
160 168
 
161 169
     foreach ($profiles_for_this_idp as $profile_list) {
162 170
         echo "<div style='display: table-row; margin-bottom: 20px;'>";
@@ -170,9 +178,10 @@  discard block
 block discarded – undo
170 178
         // readiness - but want to display it before!
171 179
 
172 180
         $has_overrides = FALSE;
173
-        foreach ($attribs as $attrib)
174
-            if ($attrib['level'] == "Profile" && !preg_match("/^(internal:|profile:name|profile:description)/", $attrib['name']))
181
+        foreach ($attribs as $attrib) {
182
+                    if ($attrib['level'] == "Profile" && !preg_match("/^(internal:|profile:name|profile:description)/", $attrib['name']))
175 183
                 $has_overrides = TRUE;
184
+        }
176 185
 
177 186
         $buffer_eaptypediv = "<div style='margin-bottom:40px; float:left;'>" . _("<strong>EAP Types</strong> (in order of preference):") . "<br/>";
178 187
         $typelist = $profile_list->getEapMethodsinOrderOfPreference();
@@ -196,9 +205,10 @@  discard block
 block discarded – undo
196 205
                 $allcomplete = FALSE;
197 206
             };
198 207
             $eapattribs = $profile_list->getAttributes(0, $eaptype);
199
-            foreach ($attribs as $attrib)
200
-                if ($attrib['level'] == "Method" && !preg_match("/^internal:/", $attrib['name']))
208
+            foreach ($attribs as $attrib) {
209
+                            if ($attrib['level'] == "Method" && !preg_match("/^internal:/", $attrib['name']))
201 210
                     $buffer_eaptypediv .= "<img src='../resources/images/icons/Letter-E-blue-icon.png' alt='" . _("Option override on EAP Method level is in effect.") . "'>";
211
+            }
202 212
             $buffer_eaptypediv .= "<br/>";
203 213
         }
204 214
         $buffer_headline = "<h2 style='overflow:auto;'>";
@@ -206,23 +216,27 @@  discard block
 block discarded – undo
206 216
         $buffer_headline .= "<div style='float:right;'>";
207 217
         $sufficient_config = $profile_list->getSufficientConfig();
208 218
         $showtime = $profile_list->getShowtime();
209
-        if ($has_overrides)
210
-            $buffer_headline .= UI_remark("", _("Option override on profile level is in effect."), TRUE);
211
-        if (!$allcomplete)
212
-            $buffer_headline .= UI_error("", _("The information in this profile is incomplete."), TRUE);
213
-        if ($showtime)
214
-            $buffer_headline .= UI_okay("", _("This profile is shown on the user download interface."), TRUE);
215
-        else if ($sufficient_config)
216
-            $buffer_headline .= UI_warning("", sprintf(_("This profile is NOT shown on the user download interface, even though we have enough information to show. To enable the profile, add the attribute \"%s\" and tick the corresponding box."), display_name("profile:production")), TRUE);
219
+        if ($has_overrides) {
220
+                    $buffer_headline .= UI_remark("", _("Option override on profile level is in effect."), TRUE);
221
+        }
222
+        if (!$allcomplete) {
223
+                    $buffer_headline .= UI_error("", _("The information in this profile is incomplete."), TRUE);
224
+        }
225
+        if ($showtime) {
226
+                    $buffer_headline .= UI_okay("", _("This profile is shown on the user download interface."), TRUE);
227
+        } else if ($sufficient_config) {
228
+                    $buffer_headline .= UI_warning("", sprintf(_("This profile is NOT shown on the user download interface, even though we have enough information to show. To enable the profile, add the attribute \"%s\" and tick the corresponding box."), display_name("profile:production")), TRUE);
229
+        }
217 230
         $buffer_headline .= "</div>";
218 231
 
219 232
         $buffer_headline .= sprintf(_("Profile: %s"), $profile_name) . "</h2>";
220 233
 
221 234
         echo $buffer_headline;
222 235
 
223
-        if (array_search(EAP::$TTLS_PAP, $typelist) !== FALSE && array_search(EAP::$TTLS_GTC, $typelist) === FALSE && array_search(EAP::$PEAP_MSCHAP2, $typelist) === FALSE && array_search(EAP::$TTLS_MSCHAP2, $typelist) === FALSE)
224
-        /// Hmmm... IdP Supports TTLS-PAP, but not TTLS-GTC nor anything based on MSCHAPv2. That locks out Symbian users; and is easy to circumvent. Tell the admin...
236
+        if (array_search(EAP::$TTLS_PAP, $typelist) !== FALSE && array_search(EAP::$TTLS_GTC, $typelist) === FALSE && array_search(EAP::$PEAP_MSCHAP2, $typelist) === FALSE && array_search(EAP::$TTLS_MSCHAP2, $typelist) === FALSE) {
237
+                /// Hmmm... IdP Supports TTLS-PAP, but not TTLS-GTC nor anything based on MSCHAPv2. That locks out Symbian users; and is easy to circumvent. Tell the admin...
225 238
             $buffer_eaptypediv .= "<p>" . sprintf(_("Read this <a href='%s'>tip</a>."), "https://confluence.terena.org/display/H2eduroam/eap-types#eap-types-choices") . "</p>";
239
+        }
226 240
 
227 241
         $buffer_eaptypediv .= "</div>";
228 242
         echo $buffer_eaptypediv;
@@ -230,12 +244,13 @@  discard block
 block discarded – undo
230 244
         $has_realm = $profile_list->getAttributes("internal:realm");
231 245
         $has_realm = $has_realm[0]['value'];
232 246
         echo "<div class='profilemodulebuttons' style='float:right;'>";
233
-        if (count(Config::$RADIUSTESTS['UDP-hosts']) > 0 || ( count(Config::$RADIUSTESTS['TLS-clientcerts']) > 0 && Config::$RADIUSTESTS['TLS-discoverytag'] != ""))
234
-            echo "<form action='action_realmcheck.php?inst_id=$my_inst->identifier&amp;profile_id=$profile_list->identifier' method='post' accept-charset='UTF-8'>
247
+        if (count(Config::$RADIUSTESTS['UDP-hosts']) > 0 || ( count(Config::$RADIUSTESTS['TLS-clientcerts']) > 0 && Config::$RADIUSTESTS['TLS-discoverytag'] != "")) {
248
+                    echo "<form action='action_realmcheck.php?inst_id=$my_inst->identifier&amp;profile_id=$profile_list->identifier' method='post' accept-charset='UTF-8'>
235 249
                               <button type='submit' name='profile_action' value='check' " . ($has_realm ? "" : "disabled='disabled' title='" . _("The realm can only be checked if you configure the realm!") . "'") . ">
236 250
                                   " . _("Check realm reachability") . "
237 251
                               </button>
238 252
                           </form>";
253
+        }
239 254
         echo "<form action='overview_installers.php?inst_id=$my_inst->identifier&amp;profile_id=$profile_list->identifier' method='post' accept-charset='UTF-8'>
240 255
                               <button type='submit' name='profile_action' value='check' " . ($has_eaptypes ? "" : "disabled='disabled'  title='" . _("You have not fully configured any supported EAP types!") . "'") . ">
241 256
                                   " . _("Installer Fine-Tuning and Download") . "
@@ -261,10 +276,11 @@  discard block
 block discarded – undo
261 276
         if ($profile_list->getShowtime()) {
262 277
             echo "<div style='display: table-cell; text-align:center;'><p><strong>" . _("User Download Link") . "</strong></p>";
263 278
             $URL = $profile_list->getCollapsedAttributes();
264
-            if (isset($URL['device-specific:redirect']))
265
-                $displayurl = $URL['device-specific:redirect'][0];
266
-            else
267
-                $displayurl = ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on" ? 'https://' : 'http://' ) . $_SERVER['SERVER_NAME'] . dirname(dirname($_SERVER['SCRIPT_NAME'])) . "?idp=" . $my_inst->identifier . "&amp;profile=" . $profile_list->identifier;
279
+            if (isset($URL['device-specific:redirect'])) {
280
+                            $displayurl = $URL['device-specific:redirect'][0];
281
+            } else {
282
+                            $displayurl = ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on" ? 'https://' : 'http://' ) . $_SERVER['SERVER_NAME'] . dirname(dirname($_SERVER['SCRIPT_NAME'])) . "?idp=" . $my_inst->identifier . "&amp;profile=" . $profile_list->identifier;
283
+            }
268 284
             echo "<a href='$displayurl' style='white-space: nowrap; text-align: center;'>";
269 285
             $uri = "data:image/png;base64," . base64_encode(png_inject_consortium_logo(QRcode::png($displayurl, FALSE, QR_ECLEVEL_Q, 12)));
270 286
             $size = getimagesize($uri);
@@ -277,8 +293,9 @@  discard block
 block discarded – undo
277 293
             echo "<div style='width:20px;'></div>";
278 294
             echo "<div style='display: table-cell; min-width:200px;'><p><strong>" . _("User Downloads") . "</strong></p><table>";
279 295
             $stats = $profile_list->getUserDownloadStats();
280
-            foreach ($stats as $dev => $count)
281
-                echo "<tr><td><strong>$dev</strong></td><td>$count</td></tr>";
296
+            foreach ($stats as $dev => $count) {
297
+                            echo "<tr><td><strong>$dev</strong></td><td>$count</td></tr>";
298
+            }
282 299
             echo "</table></div>";
283 300
         }
284 301
         echo "</div>";
Please login to merge, or discard this patch.
web/admin/action_realmcheck.php 3 patches
Indentation   +154 added lines, -154 removed lines patch added patch discarded remove patch
@@ -28,30 +28,30 @@  discard block
 block discarded – undo
28 28
 else
29 29
     $my_profile = NULL;
30 30
 if ($my_profile != NULL) {
31
-   $cr = $my_profile->getAttributes("internal:realm");
32
-   if ($cr) {
33
-      // checking our own stuff. Enable thorough checks
34
-      $check_thorough = TRUE;
35
-      $check_realm = $cr[0]['value'];
36
-      $testsuite = new RADIUSTests($check_realm, $my_profile->identifier);
37
-   } else {
38
-      $error_message = _("You asked for a realm check, but we don't know the realm for this profile!") . "</p>";
39
-   }
31
+    $cr = $my_profile->getAttributes("internal:realm");
32
+    if ($cr) {
33
+        // checking our own stuff. Enable thorough checks
34
+        $check_thorough = TRUE;
35
+        $check_realm = $cr[0]['value'];
36
+        $testsuite = new RADIUSTests($check_realm, $my_profile->identifier);
37
+    } else {
38
+        $error_message = _("You asked for a realm check, but we don't know the realm for this profile!") . "</p>";
39
+    }
40 40
 } else { // someone else's realm... only shallow checks
41
-   if(!empty($_REQUEST['realm'])) {
42
-      if($check_realm = valid_Realm($_REQUEST['realm'])) {
43
-         $_SESSION['check_realm'] = $check_realm;
44
-      }
45
-   } else {
46
-      if(!empty($_SESSION['check_realm']))
47
-         $check_realm = $_SESSION['check_realm'];
48
-      else
49
-         $check_realm = FALSE;
50
-   }
51
-   if($check_realm)
52
-      $testsuite = new RADIUSTests($check_realm);
53
-   else
54
-      $error_message = _("No valid realm name given, cannot execute any checks!");
41
+    if(!empty($_REQUEST['realm'])) {
42
+        if($check_realm = valid_Realm($_REQUEST['realm'])) {
43
+            $_SESSION['check_realm'] = $check_realm;
44
+        }
45
+    } else {
46
+        if(!empty($_SESSION['check_realm']))
47
+            $check_realm = $_SESSION['check_realm'];
48
+        else
49
+            $check_realm = FALSE;
50
+    }
51
+    if($check_realm)
52
+        $testsuite = new RADIUSTests($check_realm);
53
+    else
54
+        $error_message = _("No valid realm name given, cannot execute any checks!");
55 55
 }
56 56
 
57 57
 $translate = _("STATIC");
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
    var formData = new FormData($('#live_form')[0]);
402 402
 <?php
403 403
 foreach (Config::$RADIUSTESTS['UDP-hosts'] as $hostindex => $host) {
404
-   print "
404
+    print "
405 405
 $(\"#live_src".$hostindex."_img\").attr('src',icon_loading);
406 406
 $(\"#live_src".$hostindex."_img\").show();
407 407
     $.ajax({
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
     else
439 439
         $extraarg = "";
440 440
     
441
-   print "
441
+    print "
442 442
 $(\"#src".$hostindex."_img\").attr('src',icon_loading);
443 443
 $(\"#src$hostindex\").html('');
444 444
 running_ajax_stat++;
@@ -480,89 +480,89 @@  discard block
 block discarded – undo
480 480
    <strong><?php echo _("Overview") ?></strong>
481 481
    </legend>
482 482
       <?php
483
-      // NAPTR existence check
484
-      echo "<strong>"._("DNS chekcs")."</strong><div>";
485
-      $naptr = $testsuite->NAPTR();
486
-      if ($naptr != RETVAL_NOTCONFIGURED) {
487
-           echo "<table>";
488
-                  // output in friendly words
489
-          echo "<tr><td>" . _("Checking NAPTR existence:") . "</td><td>";
490
-          switch ($naptr) {
491
-             case RETVAL_NONAPTR:
483
+        // NAPTR existence check
484
+        echo "<strong>"._("DNS chekcs")."</strong><div>";
485
+        $naptr = $testsuite->NAPTR();
486
+        if ($naptr != RETVAL_NOTCONFIGURED) {
487
+            echo "<table>";
488
+                    // output in friendly words
489
+            echo "<tr><td>" . _("Checking NAPTR existence:") . "</td><td>";
490
+            switch ($naptr) {
491
+                case RETVAL_NONAPTR:
492 492
                 echo _("This realm has no NAPTR records.");
493 493
                 break;
494
-             case RETVAL_ONLYUNRELATEDNAPTR:
494
+                case RETVAL_ONLYUNRELATEDNAPTR:
495 495
                 printf(_("This realm has NAPTR records, but none are associated with %s."), Config::$CONSORTIUM['name']);
496 496
                 break;
497
-             default: // if none of the possible negative retvals, then we have matching NAPTRs
497
+                default: // if none of the possible negative retvals, then we have matching NAPTRs
498 498
                 printf(_("This realm has %d %s NAPTR records."), $naptr, Config::$CONSORTIUM['name']);
499
-           }
500
-           echo "</td></tr>";
499
+            }
500
+            echo "</td></tr>";
501 501
 
502
-           // compliance checks for NAPTRs
502
+            // compliance checks for NAPTRs
503 503
 
504
-           if ($naptr > 0) {
505
-              echo "<tr><td>" . _("Checking NAPTR compliance (flag = S and regex = {empty}):") . "</td><td>";
506
-              $naptr_valid = $testsuite->NAPTR_compliance();
507
-              switch ($naptr_valid) {
508
-                 case RETVAL_OK:
504
+            if ($naptr > 0) {
505
+                echo "<tr><td>" . _("Checking NAPTR compliance (flag = S and regex = {empty}):") . "</td><td>";
506
+                $naptr_valid = $testsuite->NAPTR_compliance();
507
+                switch ($naptr_valid) {
508
+                    case RETVAL_OK:
509 509
                     echo _("No issues found.");
510 510
                     break;
511
-                 case RETVAL_INVALID:
511
+                    case RETVAL_INVALID:
512 512
                     printf(_("At least one NAPTR with invalid content found!"));
513 513
                     break;
514
-              }
515
-              echo "</td></tr>";
514
+                }
515
+                echo "</td></tr>";
516 516
             }
517 517
 
518 518
             // SRV resolution
519 519
 
520 520
             if ($naptr > 0 && $naptr_valid == RETVAL_OK) {
521
-              $srv = $testsuite->NAPTR_SRV();
522
-               echo "<tr><td>" . _("Checking SRVs:") . "</td><td>";
523
-               switch ($srv) {
524
-                  case RETVAL_SKIPPED:
521
+                $srv = $testsuite->NAPTR_SRV();
522
+                echo "<tr><td>" . _("Checking SRVs:") . "</td><td>";
523
+                switch ($srv) {
524
+                    case RETVAL_SKIPPED:
525 525
                      echo _("This check was skipped.");
526
-                     break;
527
-                  case RETVAL_INVALID:
526
+                        break;
527
+                    case RETVAL_INVALID:
528 528
                      printf(_("At least one NAPTR with invalid content found!"));
529
-                     break;
530
-                  default: // print number of successfully retrieved SRV targets
529
+                        break;
530
+                    default: // print number of successfully retrieved SRV targets
531 531
                      printf(_("%d host names discovered."), $srv);
532
-               }
533
-               echo "</td></tr>";
532
+                }
533
+                echo "</td></tr>";
534 534
             }
535 535
             // IP addresses for the hosts
536 536
             if ($naptr > 0 && $naptr_valid == RETVAL_OK && $srv > 0) {
537
-               $hosts = $testsuite->NAPTR_hostnames();
538
-               echo "<tr><td>" . _("Checking IP address resolution:") . "</td><td>";
539
-               switch ($srv) {
540
-                  case RETVAL_SKIPPED:
537
+                $hosts = $testsuite->NAPTR_hostnames();
538
+                echo "<tr><td>" . _("Checking IP address resolution:") . "</td><td>";
539
+                switch ($srv) {
540
+                    case RETVAL_SKIPPED:
541 541
                      echo _("This check was skipped.");
542
-                     break;
543
-                  case RETVAL_INVALID:
542
+                        break;
543
+                    case RETVAL_INVALID:
544 544
                      printf(_("At least one hostname could not be resolved!"));
545
-                     break;
546
-                  default: // print number of successfully retrieved SRV targets
545
+                        break;
546
+                    default: // print number of successfully retrieved SRV targets
547 547
                      printf(_("%d IP addresses resolved."), $hosts);
548
-               }
549
-               echo "</td></tr>";
548
+                }
549
+                echo "</td></tr>";
550 550
             }
551 551
 
552 552
             echo "</table><table>";
553
-              if (count($testsuite->listerrors()) == 0) {
553
+                if (count($testsuite->listerrors()) == 0) {
554 554
                 echo UI_message(L_OK,sprintf(_("Realm is <strong>%s</strong> "), _(($naptr > 0 ? "DYNAMIC" : "STATIC"))) . _("with no DNS errors encountered. Congratulations!"));
555 555
                 echo "</table>";
556
-              } else {
556
+                } else {
557 557
                 echo UI_message(L_ERROR,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."));
558 558
                 echo "</table><div class='notacceptable'><table>";
559 559
                 foreach ($testsuite->listerrors() as $details)
560
-                   echo "<tr><td>" . $details['TYPE'] . "</td><td>" . $details['TARGET'] . "</td></tr>";
560
+                    echo "<tr><td>" . $details['TYPE'] . "</td><td>" . $details['TARGET'] . "</td></tr>";
561 561
                 echo "</table></div>";
562
-              }
563
-              echo '</div>';
562
+                }
563
+                echo '</div>';
564 564
 
565
-              echo '<script type="text/javascript">
565
+                echo '<script type="text/javascript">
566 566
               function run_dynamic() {
567 567
                  running_ajax_dyn = 0;
568 568
                  $("#main_dynamic_ico").attr("src",icon_loading);
@@ -571,37 +571,37 @@  discard block
 block discarded – undo
571 571
                  global_level_dyn = L_OK;
572 572
                  $("#dynamic_tests").show();
573 573
               ';
574
-                  foreach ($testsuite->NAPTR_hostname_records as $hostindex => $addr) {
575
-                      $host = '';
576
-                      if ($addr['family'] == "IPv6") $host .= '[';
577
-                      $host .= $addr['IP'];
578
-                      if ($addr['family'] == "IPv6") $host .= ']';
579
-                      $host .= ':' . $addr['port'];
574
+                    foreach ($testsuite->NAPTR_hostname_records as $hostindex => $addr) {
575
+                        $host = '';
576
+                        if ($addr['family'] == "IPv6") $host .= '[';
577
+                        $host .= $addr['IP'];
578
+                        if ($addr['family'] == "IPv6") $host .= ']';
579
+                        $host .= ':' . $addr['port'];
580 580
 /*if($addr['family'] == "IPv6")
581 581
    continue;*/
582
-                      print "
582
+                        print "
583 583
                             running_ajax_dyn++;
584 584
                             $.ajax({url:'radius_tests.php', data:{test_type: 'capath', realm: realm, src: '$host', lang: '".CAT::get_lang()."', hostindex: '$hostindex' }, error: eee, success: capath, dataType: 'json'}); 
585 585
                             running_ajax_dyn++;
586 586
                             $.ajax({url:'radius_tests.php', data:{test_type: 'clients', realm: realm, src: '$host', lang: '".CAT::get_lang()."', hostindex: '$hostindex' }, error: eee, success: clients, dataType: 'json'}); 
587 587
                        ";
588
-                   }
589
-              echo "}
588
+                    }
589
+                echo "}
590 590
               </script><hr>";
591 591
        
592
-         } else {
593
-          echo "<tr><td>" . _("Dynamic discovery test is not configured") . "</td><td>";
594
-         }
595
-         echo "<strong>"._("Static connectivity tests")."</strong>
592
+            } else {
593
+            echo "<tr><td>" . _("Dynamic discovery test is not configured") . "</td><td>";
594
+            }
595
+            echo "<strong>"._("Static connectivity tests")."</strong>
596 596
          <table><tr>
597 597
          <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>
598 598
          </tr></table>";
599
-         if($naptr > 0) {
600
-             echo "<hr><strong>"._("Dynamic connectivity tests")."</strong>
599
+            if($naptr > 0) {
600
+                echo "<hr><strong>"._("Dynamic connectivity tests")."</strong>
601 601
          <table><tr>
602 602
          <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>
603 603
          </tr></table>";
604
-         }
604
+            }
605 605
 ?>
606 606
 
607 607
 </fieldset>
@@ -613,11 +613,11 @@  discard block
 block discarded – undo
613 613
      <fieldset class="option_container" id="static_tests">
614 614
      <legend><strong> <?php echo _("STATIC connectivity tests");?> </strong> </legend>
615 615
 <?php
616
-     echo sprintf(_("This check sends a request for the realm through various entry points of the %s infrastructure. The request will contain the 'Operator-Name' attribute, and will be larger than 1500 Bytes to catch two common configuration problems.<br/>Since we don't have actual credentials for the realm, we can't authenticate successfully - so the expected outcome is to get an Access-Reject after having gone through an EAP conversation."), Config::$CONSORTIUM['name']);
616
+        echo sprintf(_("This check sends a request for the realm through various entry points of the %s infrastructure. The request will contain the 'Operator-Name' attribute, and will be larger than 1500 Bytes to catch two common configuration problems.<br/>Since we don't have actual credentials for the realm, we can't authenticate successfully - so the expected outcome is to get an Access-Reject after having gone through an EAP conversation."), Config::$CONSORTIUM['name']);
617 617
 print "<p>";
618 618
 
619 619
 foreach (Config::$RADIUSTESTS['UDP-hosts'] as $hostindex => $host) {
620
-  print "<hr>";
620
+    print "<hr>";
621 621
 printf(_("Testing from: %s"), "<strong>".Config::$RADIUSTESTS['UDP-hosts'][$hostindex]['display_name']."</strong>");
622 622
 print "<table id='results$hostindex'  style='width:100%' class='udp_results'>
623 623
 <tr>
@@ -637,28 +637,28 @@  discard block
 block discarded – undo
637 637
   </div>
638 638
 
639 639
 <?php
640
-              if ($naptr > 0) {
640
+                if ($naptr > 0) {
641 641
 ?>
642 642
   <div id="tabs-3">
643 643
 <button id="run_d_tests" onclick="run_dynamic()"><?php echo _("Repeat dynamic connectivity tests") ?></button>
644 644
 
645 645
 <?php
646
-                  echo "<div id='dynamic_tests'><fieldset class='option_container'>
646
+                    echo "<div id='dynamic_tests'><fieldset class='option_container'>
647 647
                 <legend><strong>" . _("DYNAMIC connectivity tests") . "</strong></legend>";
648 648
 
649
-                  $resultstoprint = [];
650
-                  if (count($testsuite->NAPTR_hostname_records)>0) {
651
-                      $resultstoprint[] = '<table style="align:right; display: none;" id="dynamic_result_fail">' .  UI_message(L_ERROR,_("Some errors were found during the tests, see below")) . '</table><table style="align:right; display: none;" id="dynamic_result_pass">' . UI_message(L_OK,_("All tests passed, congratulations!")) . '</table>';
652
-                      $resultstoprint[] = '<div style="align:right;"><a href="" class="moreall">' . _('Show detailed information for all tests') . '</a></div>' . '<p><strong>' . _("Checking server handshake...") . "</strong><p>";
653
-                      foreach ($testsuite->NAPTR_hostname_records as $hostindex => $addr) {
649
+                    $resultstoprint = [];
650
+                    if (count($testsuite->NAPTR_hostname_records)>0) {
651
+                        $resultstoprint[] = '<table style="align:right; display: none;" id="dynamic_result_fail">' .  UI_message(L_ERROR,_("Some errors were found during the tests, see below")) . '</table><table style="align:right; display: none;" id="dynamic_result_pass">' . UI_message(L_OK,_("All tests passed, congratulations!")) . '</table>';
652
+                        $resultstoprint[] = '<div style="align:right;"><a href="" class="moreall">' . _('Show detailed information for all tests') . '</a></div>' . '<p><strong>' . _("Checking server handshake...") . "</strong><p>";
653
+                        foreach ($testsuite->NAPTR_hostname_records as $hostindex => $addr) {
654 654
 /*                          if ($addr['family'] == "IPv6") {
655 655
                               $resultstoprint[] = '<strong>' . $addr['IP'] . ' TCP/' . $addr['port'] . "</strong><ul style='list-style-type: none;'><li>" . _('Due to OpenSSL limitations, it is not possible to check IPv6 addresses at this time.') . '</li></ul>';
656 656
                               continue;
657 657
                           }*/
658
-                          $bracketaddr = ($addr["family"] == "IPv6" ? "[" . $addr["IP"] . "]" : $addr["IP"]);
659
-                          $resultstoprint[] = '<p><strong>' . $bracketaddr . ' TCP/' . $addr['port'] . '</strong>';
660
-                          $resultstoprint[] = '<ul style="list-style-type: none;" class="caresult"><li>';
661
-                          $resultstoprint[] = "<table id='caresults$hostindex'  style='width:100%'>
658
+                            $bracketaddr = ($addr["family"] == "IPv6" ? "[" . $addr["IP"] . "]" : $addr["IP"]);
659
+                            $resultstoprint[] = '<p><strong>' . $bracketaddr . ' TCP/' . $addr['port'] . '</strong>';
660
+                            $resultstoprint[] = '<ul style="list-style-type: none;" class="caresult"><li>';
661
+                            $resultstoprint[] = "<table id='caresults$hostindex'  style='width:100%'>
662 662
 <tr>
663 663
 <td class='icon_td'><img src='../resources/images/icons/loading51.gif' id='srcca".$hostindex."_img'></td>
664 664
 <td id='srcca$hostindex'>
@@ -666,17 +666,17 @@  discard block
 block discarded – undo
666 666
 </td>
667 667
 </tr>
668 668
 </table>";
669
-                          $resultstoprint[] = '</li></ul>';
670
-                     }    
671
-                     $clientstest = [];
672
-                     foreach ($testsuite->NAPTR_hostname_records as $hostindex => $addr) {
673
-                          //$clientsres = $testsuite->TLS_client_side_tests();
669
+                            $resultstoprint[] = '</li></ul>';
670
+                        }    
671
+                        $clientstest = [];
672
+                        foreach ($testsuite->NAPTR_hostname_records as $hostindex => $addr) {
673
+                            //$clientsres = $testsuite->TLS_client_side_tests();
674 674
 /*                          if ($addr['family'] == 'IPv6') {
675 675
                                   $clientstest[] = '<p><strong>' . $addr['IP'] . ' TCP/' . $addr['port'] . '</strong></p>' .  "<ul style='list-style-type: none;'><li>" . _('Due to OpenSSL limitations, it is not possible to check IPv6 addresses at this time.') . '</li></ul>';
676 676
                                   continue;
677 677
                           }*/
678
-                          $clientstest[] = '<p><strong>' . $addr['IP'] . ' TCP/' . $addr['port'] . '</strong></p><ol>';
679
-                          $clientstest[] = "<span id='clientresults$hostindex$clinx'><table style='width:100%'>
678
+                            $clientstest[] = '<p><strong>' . $addr['IP'] . ' TCP/' . $addr['port'] . '</strong></p><ol>';
679
+                            $clientstest[] = "<span id='clientresults$hostindex$clinx'><table style='width:100%'>
680 680
 <tr>
681 681
 <td class='icon_td'><img src='../resources/images/icons/loading51.gif' id='srcclient".$hostindex."_img'></td>
682 682
 <td id='srcclient$hostindex'>
@@ -684,29 +684,29 @@  discard block
 block discarded – undo
684 684
 </td>
685 685
 </tr>
686 686
 </table></span>";
687
-                          $clientstest[] = '</ol>';
688
-                      }
689
-                      echo '<div style="align:right;">';
690
-                      echo join('',$resultstoprint);
691
-                      echo '<span id="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>';
692
-                      print join('',$clientstest);
693
-                      echo '</span>';
694
-                      echo '</div>';
695
-                  }
696
-                  echo "</fieldset></div></div>";
697
-              }
698
-              // further checks TBD:
699
-              //     check if accepts certificates from all accredited CAs
700
-              //     check if doesn't accept revoked certificates
701
-              //     check if RADIUS request gets rejected timely
702
-              //     check if truncates/dies on Operator-Name
703
-              if ($check_thorough) {
704
-                  echo "<div id='tabs-4'><fieldset class='option_container'>
687
+                            $clientstest[] = '</ol>';
688
+                        }
689
+                        echo '<div style="align:right;">';
690
+                        echo join('',$resultstoprint);
691
+                        echo '<span id="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>';
692
+                        print join('',$clientstest);
693
+                        echo '</span>';
694
+                        echo '</div>';
695
+                    }
696
+                    echo "</fieldset></div></div>";
697
+                }
698
+                // further checks TBD:
699
+                //     check if accepts certificates from all accredited CAs
700
+                //     check if doesn't accept revoked certificates
701
+                //     check if RADIUS request gets rejected timely
702
+                //     check if truncates/dies on Operator-Name
703
+                if ($check_thorough) {
704
+                    echo "<div id='tabs-4'><fieldset class='option_container'>
705 705
                 <legend><strong>" . _("Live login test") . "</strong></legend>";
706
-                  $prof_compl = $my_profile->getEapMethodsinOrderOfPreference(1);
707
-                  if (count($prof_compl) > 0) {
706
+                    $prof_compl = $my_profile->getEapMethodsinOrderOfPreference(1);
707
+                    if (count($prof_compl) > 0) {
708 708
 
709
-                      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>
709
+                        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>
710 710
                     <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>
711 711
                     <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>
712 712
                     <form enctype='multipart/form-data' id='live_form' accept-charset='UTF-8'>
@@ -715,44 +715,44 @@  discard block
 block discarded – undo
715 715
                     <input type='hidden' name='profile_id' value='".$my_profile->identifier."'>
716 716
                     <table id='live_tests'>";
717 717
 // if any password based EAP methods are available enable this section
718
-              if (in_array(EAP::$PEAP_MSCHAP2, $prof_compl) ||
718
+                if (in_array(EAP::$PEAP_MSCHAP2, $prof_compl) ||
719 719
                               in_array(EAP::$TTLS_MSCHAP2, $prof_compl) ||
720 720
                               in_array(EAP::$TTLS_GTC, $prof_compl) ||
721 721
                               in_array(EAP::$FAST_GTC, $prof_compl) ||
722 722
                               in_array(EAP::$PWD, $prof_compl) ||
723 723
                               in_array(EAP::$TTLS_PAP, $prof_compl)
724
-                      ) { 
725
-                          echo  "<tr><td colspan='2'><strong>" . _("Password-based EAP types") . "</strong></td></tr>
724
+                        ) { 
725
+                            echo  "<tr><td colspan='2'><strong>" . _("Password-based EAP types") . "</strong></td></tr>
726 726
                         <tr><td>" . _("Real (inner) username:") . "</td><td><input type='text' id='username' class='mandatory' name='username'/></td></tr>";
727
-                           echo "<tr><td>" . _("Anonymous outer ID (optional):") . "</td><td><input type='text' id='outer_username' name='outer_username'/></td></tr>";
728
-                          echo "<tr><td>" . _("Password:") . "</td><td><input type='text' id='password' class='mandatory' name='password'/></td></tr>";
729
-               }
730
-                      // ask for cert + privkey if TLS-based method is active
731
-                      if (in_array(EAP::$TLS, $prof_compl))
732
-                          echo "<tr><td colspan='2'><strong>" . _("Certificate-based EAP types") . "</strong></td></tr>
727
+                            echo "<tr><td>" . _("Anonymous outer ID (optional):") . "</td><td><input type='text' id='outer_username' name='outer_username'/></td></tr>";
728
+                            echo "<tr><td>" . _("Password:") . "</td><td><input type='text' id='password' class='mandatory' name='password'/></td></tr>";
729
+                }
730
+                        // ask for cert + privkey if TLS-based method is active
731
+                        if (in_array(EAP::$TLS, $prof_compl))
732
+                            echo "<tr><td colspan='2'><strong>" . _("Certificate-based EAP types") . "</strong></td></tr>
733 733
                         <tr><td>" . _("Certificate file (.p12 or .pfx):") . "</td><td><input type='file' id='cert' accept='application/x-pkcs12' name='cert'/></td></tr>
734 734
                         <tr><td>" . _("Certificate password, if any:") . "</td><td><input type='text' id='privkey' name='privkey_pass'/></td></tr>
735 735
                         <tr><td>" . _("Username, if different from certificate Subject:") . "</td><td><input type='text' id='tls_username' name='tls_username'/></td></tr>";
736
-                      echo "<tr><td colspan='2'><button id='submit_credentials'>" . _("Submit credentials") . "</button></td></tr></table></form>";
737
-                      echo "<div id='live_login_results' style='display:none'>";
738
-                      foreach (Config::$RADIUSTESTS['UDP-hosts'] as $hostindex => $host) {
736
+                        echo "<tr><td colspan='2'><button id='submit_credentials'>" . _("Submit credentials") . "</button></td></tr></table></form>";
737
+                        echo "<div id='live_login_results' style='display:none'>";
738
+                        foreach (Config::$RADIUSTESTS['UDP-hosts'] as $hostindex => $host) {
739 739
                         print "<hr>";
740
-                      printf(_("Testing from: %s"), "<strong>".Config::$RADIUSTESTS['UDP-hosts'][$hostindex]['display_name']."</strong>");
741
-                      print "<span style='position:relative'><img src='../resources/images/icons/loading51.gif' id='live_src".$hostindex."_img' style='width:24px; position: absolute; left: 20px; bottom: 0px; '></span>";
740
+                        printf(_("Testing from: %s"), "<strong>".Config::$RADIUSTESTS['UDP-hosts'][$hostindex]['display_name']."</strong>");
741
+                        print "<span style='position:relative'><img src='../resources/images/icons/loading51.gif' id='live_src".$hostindex."_img' style='width:24px; position: absolute; left: 20px; bottom: 0px; '></span>";
742 742
 print "<div id='eap_test$hostindex' class='eap_test_results'></div>";
743 743
 }
744
-                      echo "</div>";
744
+                        echo "</div>";
745 745
 
746
-                  } else {// no EAP methods fully defined
747
-                      echo "Live Login Checks require at least one fully configured EAP type.";
748
-                  }
749
-                  echo "</fieldset></div>";
750
-              }
746
+                    } else {// no EAP methods fully defined
747
+                        echo "Live Login Checks require at least one fully configured EAP type.";
748
+                    }
749
+                    echo "</fieldset></div>";
750
+                }
751 751
 echo "
752 752
 </div>
753 753
 ";
754 754
 }
755
-              ?>
755
+                ?>
756 756
     <form method='post' action='overview_idp.php?inst_id=<?php echo $my_inst->identifier; ?>' accept-charset='UTF-8'>
757 757
         <button type='submit' name='submitbutton' value='<?php echo BUTTON_CLOSE; ?>'><?php echo _("Return to dashboard"); ?></button>
758 758
     </form>
@@ -763,11 +763,11 @@  discard block
 block discarded – undo
763 763
     run_udp();
764 764
 <?php
765 765
     if ($naptr > 0) 
766
-       echo "run_dynamic();";
766
+        echo "run_dynamic();";
767 767
     else
768
-       echo '$("#tabs-d-li").hide();';
768
+        echo '$("#tabs-d-li").hide();';
769 769
     if (!$check_thorough) 
770
-       echo '$("#tabs-through").hide();';
770
+        echo '$("#tabs-through").hide();';
771 771
 ?>
772 772
 </script>
773 773
     <?php footer() ?>
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
 $cat = defaultPagePrelude(_("Sanity check for dynamic discovery of realms"));
22 22
 $check_thorough = FALSE;
23
-$error_message ='';
23
+$error_message = '';
24 24
 $my_inst = valid_IdP($_REQUEST['inst_id'], $_SESSION['user']);
25 25
 
26 26
 if (isset($_GET['profile_id']))
@@ -38,17 +38,17 @@  discard block
 block discarded – undo
38 38
       $error_message = _("You asked for a realm check, but we don't know the realm for this profile!") . "</p>";
39 39
    }
40 40
 } else { // someone else's realm... only shallow checks
41
-   if(!empty($_REQUEST['realm'])) {
42
-      if($check_realm = valid_Realm($_REQUEST['realm'])) {
41
+   if (!empty($_REQUEST['realm'])) {
42
+      if ($check_realm = valid_Realm($_REQUEST['realm'])) {
43 43
          $_SESSION['check_realm'] = $check_realm;
44 44
       }
45 45
    } else {
46
-      if(!empty($_SESSION['check_realm']))
46
+      if (!empty($_SESSION['check_realm']))
47 47
          $check_realm = $_SESSION['check_realm'];
48 48
       else
49 49
          $check_realm = FALSE;
50 50
    }
51
-   if($check_realm)
51
+   if ($check_realm)
52 52
       $testsuite = new RADIUSTests($check_realm);
53 53
    else
54 54
       $error_message = _("No valid realm name given, cannot execute any checks!");
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
      }
227 227
  }
228 228
  cliinfo = cliinfo + '<li><table><tbody><tr><td class="icon_td"><img class="icon" src="' + icons[level] +'" style="width: 24px;"></td><td>' + state;
229
- cliinfo = cliinfo + ' <?php echo "(".sprintf(_("elapsed time: %sms."),"'+data.ca[key].certificate[c].time_millisec+'&nbsp;").")"; ?>' + add + '</td></tr>';
229
+ cliinfo = cliinfo + ' <?php echo "(" . sprintf(_("elapsed time: %sms."), "'+data.ca[key].certificate[c].time_millisec+'&nbsp;") . ")"; ?>' + add + '</td></tr>';
230 230
  cliinfo = cliinfo + '</tbody></table></ul></li>';
231 231
  if (data.ca[key].certificate[c].finalerror==1) {
232 232
      cliinfo = cliinfo + '<li>' + restskipped + '</li>';
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
    var v = data.result[0];
317 317
    $("#src"+data.hostindex+"_img").attr('src',icons[v.level]);
318 318
    if(v.server != 0 ) {
319
-      $("#src"+data.hostindex).html('<strong>'+v.server+'</strong><br/><?php printf(_("elapsed time: %sms."),"'+v.time_millisec+'&nbsp;") ?><p>'+v.message+'</p>');
319
+      $("#src"+data.hostindex).html('<strong>'+v.server+'</strong><br/><?php printf(_("elapsed time: %sms."), "'+v.time_millisec+'&nbsp;") ?><p>'+v.message+'</p>');
320 320
       var cert_data = "<tr class='server_cert'><td>&nbsp;</td><td colspan=2><div><dl class='server_cert_list'>";
321 321
       $.each(server_cert, function(l,s) {
322 322
          cert_data = cert_data + "<dt>" + s + "</dt><dd>"+ v.server_cert[l] + "</dd>";
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
       }
340 340
       $("#src"+data.hostindex).append(cert_data);
341 341
    } else {
342
-       $("#src"+data.hostindex).html('<br/><?php printf(_("elapsed time: %sms."),"'+v.time_millisec+'&nbsp;") ?><p>'+v.message+'</p>');
342
+       $("#src"+data.hostindex).html('<br/><?php printf(_("elapsed time: %sms."), "'+v.time_millisec+'&nbsp;") ?><p>'+v.message+'</p>');
343 343
    }
344 344
       global_level_udp = Math.max(global_level_udp,v.level);  
345 345
       $(".server_cert").show();
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
          });
392 392
       }
393 393
       o = o +  cert_data+'</table>';
394
-      $("#eap_test"+data.hostindex).append('<strong><img style="position: relative; top: 2px;" src="'+icons[v.level]+'"><span style="position: relative; top: -5px; left: 1em">'+v.eap+' &ndash; <?php printf(_("elapsed time: %sms."),"'+v.time_millisec+'&nbsp;") ?></span></strong><div class="more" style="padding-left: 40px"><div class="morecontent"><div style="display:none; background: #eee;">'+o+'</div><a href="" class="morelink">' + moretext + '</a></div></div>');
394
+      $("#eap_test"+data.hostindex).append('<strong><img style="position: relative; top: 2px;" src="'+icons[v.level]+'"><span style="position: relative; top: -5px; left: 1em">'+v.eap+' &ndash; <?php printf(_("elapsed time: %sms."), "'+v.time_millisec+'&nbsp;") ?></span></strong><div class="more" style="padding-left: 40px"><div class="morecontent"><div style="display:none; background: #eee;">'+o+'</div><a href="" class="morelink">' + moretext + '</a></div></div>');
395 395
    });
396 396
 }
397 397
 
@@ -402,8 +402,8 @@  discard block
 block discarded – undo
402 402
 <?php
403 403
 foreach (Config::$RADIUSTESTS['UDP-hosts'] as $hostindex => $host) {
404 404
    print "
405
-$(\"#live_src".$hostindex."_img\").attr('src',icon_loading);
406
-$(\"#live_src".$hostindex."_img\").show();
405
+$(\"#live_src".$hostindex . "_img\").attr('src',icon_loading);
406
+$(\"#live_src".$hostindex . "_img\").show();
407 407
     $.ajax({
408 408
         url: 'radius_tests.php?src=0&hostindex=$hostindex&realm='+realm,
409 409
         type: 'POST',
@@ -434,15 +434,15 @@  discard block
 block discarded – undo
434 434
 <?php
435 435
 foreach (Config::$RADIUSTESTS['UDP-hosts'] as $hostindex => $host) {
436 436
     if ($check_thorough)
437
-        $extraarg = "profile_id: ".$my_profile->identifier.", ";
437
+        $extraarg = "profile_id: " . $my_profile->identifier . ", ";
438 438
     else
439 439
         $extraarg = "";
440 440
     
441 441
    print "
442
-$(\"#src".$hostindex."_img\").attr('src',icon_loading);
442
+$(\"#src".$hostindex . "_img\").attr('src',icon_loading);
443 443
 $(\"#src$hostindex\").html('');
444 444
 running_ajax_stat++;
445
-$.get('radius_tests.php',{test_type: 'udp', $extraarg realm: realm, src: $hostindex, lang: '".CAT::get_lang()."', hostindex: '$hostindex'  }, udp, 'json');
445
+$.get('radius_tests.php',{test_type: 'udp', $extraarg realm: realm, src: $hostindex, lang: '" . CAT::get_lang() . "', hostindex: '$hostindex'  }, udp, 'json');
446 446
 
447 447
 ";
448 448
 }
@@ -461,8 +461,8 @@  discard block
 block discarded – undo
461 461
 </script>
462 462
    <?php
463 463
     productheader("ADMIN", CAT::get_lang());
464
-    print "<h1>".sprintf(_("Realm testing for: %s"),$check_realm)."</h1>\n";
465
-    if($error_message) {
464
+    print "<h1>" . sprintf(_("Realm testing for: %s"), $check_realm) . "</h1>\n";
465
+    if ($error_message) {
466 466
         print "<p>$error_message</p>";
467 467
     } else {
468 468
 ?>
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
    </legend>
482 482
       <?php
483 483
       // NAPTR existence check
484
-      echo "<strong>"._("DNS chekcs")."</strong><div>";
484
+      echo "<strong>" . _("DNS chekcs") . "</strong><div>";
485 485
       $naptr = $testsuite->NAPTR();
486 486
       if ($naptr != RETVAL_NOTCONFIGURED) {
487 487
            echo "<table>";
@@ -551,10 +551,10 @@  discard block
 block discarded – undo
551 551
 
552 552
             echo "</table><table>";
553 553
               if (count($testsuite->listerrors()) == 0) {
554
-                echo UI_message(L_OK,sprintf(_("Realm is <strong>%s</strong> "), _(($naptr > 0 ? "DYNAMIC" : "STATIC"))) . _("with no DNS errors encountered. Congratulations!"));
554
+                echo UI_message(L_OK, sprintf(_("Realm is <strong>%s</strong> "), _(($naptr > 0 ? "DYNAMIC" : "STATIC"))) . _("with no DNS errors encountered. Congratulations!"));
555 555
                 echo "</table>";
556 556
               } else {
557
-                echo UI_message(L_ERROR,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."));
557
+                echo UI_message(L_ERROR, 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."));
558 558
                 echo "</table><div class='notacceptable'><table>";
559 559
                 foreach ($testsuite->listerrors() as $details)
560 560
                    echo "<tr><td>" . $details['TYPE'] . "</td><td>" . $details['TARGET'] . "</td></tr>";
@@ -581,9 +581,9 @@  discard block
 block discarded – undo
581 581
    continue;*/
582 582
                       print "
583 583
                             running_ajax_dyn++;
584
-                            $.ajax({url:'radius_tests.php', data:{test_type: 'capath', realm: realm, src: '$host', lang: '".CAT::get_lang()."', hostindex: '$hostindex' }, error: eee, success: capath, dataType: 'json'}); 
584
+                            $.ajax({url:'radius_tests.php', data:{test_type: 'capath', realm: realm, src: '$host', lang: '" . CAT::get_lang() . "', hostindex: '$hostindex' }, error: eee, success: capath, dataType: 'json'}); 
585 585
                             running_ajax_dyn++;
586
-                            $.ajax({url:'radius_tests.php', data:{test_type: 'clients', realm: realm, src: '$host', lang: '".CAT::get_lang()."', hostindex: '$hostindex' }, error: eee, success: clients, dataType: 'json'}); 
586
+                            $.ajax({url:'radius_tests.php', data:{test_type: 'clients', realm: realm, src: '$host', lang: '" . CAT::get_lang() . "', hostindex: '$hostindex' }, error: eee, success: clients, dataType: 'json'}); 
587 587
                        ";
588 588
                    }
589 589
               echo "}
@@ -592,12 +592,12 @@  discard block
 block discarded – undo
592 592
          } else {
593 593
           echo "<tr><td>" . _("Dynamic discovery test is not configured") . "</td><td>";
594 594
          }
595
-         echo "<strong>"._("Static connectivity tests")."</strong>
595
+         echo "<strong>" . _("Static connectivity tests") . "</strong>
596 596
          <table><tr>
597 597
          <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>
598 598
          </tr></table>";
599
-         if($naptr > 0) {
600
-             echo "<hr><strong>"._("Dynamic connectivity tests")."</strong>
599
+         if ($naptr > 0) {
600
+             echo "<hr><strong>" . _("Dynamic connectivity tests") . "</strong>
601 601
          <table><tr>
602 602
          <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>
603 603
          </tr></table>";
@@ -611,19 +611,19 @@  discard block
 block discarded – undo
611 611
      <button id="run_s_tests" onclick="run_udp()"><?php echo _("Repeat static connectivity tests") ?></button>
612 612
      <p>
613 613
      <fieldset class="option_container" id="static_tests">
614
-     <legend><strong> <?php echo _("STATIC connectivity tests");?> </strong> </legend>
614
+     <legend><strong> <?php echo _("STATIC connectivity tests"); ?> </strong> </legend>
615 615
 <?php
616 616
      echo sprintf(_("This check sends a request for the realm through various entry points of the %s infrastructure. The request will contain the 'Operator-Name' attribute, and will be larger than 1500 Bytes to catch two common configuration problems.<br/>Since we don't have actual credentials for the realm, we can't authenticate successfully - so the expected outcome is to get an Access-Reject after having gone through an EAP conversation."), Config::$CONSORTIUM['name']);
617 617
 print "<p>";
618 618
 
619 619
 foreach (Config::$RADIUSTESTS['UDP-hosts'] as $hostindex => $host) {
620 620
   print "<hr>";
621
-printf(_("Testing from: %s"), "<strong>".Config::$RADIUSTESTS['UDP-hosts'][$hostindex]['display_name']."</strong>");
621
+printf(_("Testing from: %s"), "<strong>" . Config::$RADIUSTESTS['UDP-hosts'][$hostindex]['display_name'] . "</strong>");
622 622
 print "<table id='results$hostindex'  style='width:100%' class='udp_results'>
623 623
 <tr>
624
-<td class='icon_td'><img src='../resources/images/icons/loading51.gif' id='src".$hostindex."_img'></td>
624
+<td class='icon_td'><img src='../resources/images/icons/loading51.gif' id='src" . $hostindex . "_img'></td>
625 625
 <td id='src$hostindex' colspan=2>
626
-"._("testing...")."
626
+" . _("testing...") . "
627 627
 </td>
628 628
 </tr>" .
629 629
 //server_cert('udp-'.$hostindex) .
@@ -647,8 +647,8 @@  discard block
 block discarded – undo
647 647
                 <legend><strong>" . _("DYNAMIC connectivity tests") . "</strong></legend>";
648 648
 
649 649
                   $resultstoprint = [];
650
-                  if (count($testsuite->NAPTR_hostname_records)>0) {
651
-                      $resultstoprint[] = '<table style="align:right; display: none;" id="dynamic_result_fail">' .  UI_message(L_ERROR,_("Some errors were found during the tests, see below")) . '</table><table style="align:right; display: none;" id="dynamic_result_pass">' . UI_message(L_OK,_("All tests passed, congratulations!")) . '</table>';
650
+                  if (count($testsuite->NAPTR_hostname_records) > 0) {
651
+                      $resultstoprint[] = '<table style="align:right; display: none;" id="dynamic_result_fail">' . UI_message(L_ERROR, _("Some errors were found during the tests, see below")) . '</table><table style="align:right; display: none;" id="dynamic_result_pass">' . UI_message(L_OK, _("All tests passed, congratulations!")) . '</table>';
652 652
                       $resultstoprint[] = '<div style="align:right;"><a href="" class="moreall">' . _('Show detailed information for all tests') . '</a></div>' . '<p><strong>' . _("Checking server handshake...") . "</strong><p>";
653 653
                       foreach ($testsuite->NAPTR_hostname_records as $hostindex => $addr) {
654 654
 /*                          if ($addr['family'] == "IPv6") {
@@ -660,9 +660,9 @@  discard block
 block discarded – undo
660 660
                           $resultstoprint[] = '<ul style="list-style-type: none;" class="caresult"><li>';
661 661
                           $resultstoprint[] = "<table id='caresults$hostindex'  style='width:100%'>
662 662
 <tr>
663
-<td class='icon_td'><img src='../resources/images/icons/loading51.gif' id='srcca".$hostindex."_img'></td>
663
+<td class='icon_td'><img src='../resources/images/icons/loading51.gif' id='srcca" . $hostindex . "_img'></td>
664 664
 <td id='srcca$hostindex'>
665
-"._("testing...")."
665
+" . _("testing...") . "
666 666
 </td>
667 667
 </tr>
668 668
 </table>";
@@ -678,18 +678,18 @@  discard block
 block discarded – undo
678 678
                           $clientstest[] = '<p><strong>' . $addr['IP'] . ' TCP/' . $addr['port'] . '</strong></p><ol>';
679 679
                           $clientstest[] = "<span id='clientresults$hostindex$clinx'><table style='width:100%'>
680 680
 <tr>
681
-<td class='icon_td'><img src='../resources/images/icons/loading51.gif' id='srcclient".$hostindex."_img'></td>
681
+<td class='icon_td'><img src='../resources/images/icons/loading51.gif' id='srcclient" . $hostindex . "_img'></td>
682 682
 <td id='srcclient$hostindex'>
683
-"._("testing...")."
683
+" . _("testing...") . "
684 684
 </td>
685 685
 </tr>
686 686
 </table></span>";
687 687
                           $clientstest[] = '</ol>';
688 688
                       }
689 689
                       echo '<div style="align:right;">';
690
-                      echo join('',$resultstoprint);
691
-                      echo '<span id="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>';
692
-                      print join('',$clientstest);
690
+                      echo join('', $resultstoprint);
691
+                      echo '<span id="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>';
692
+                      print join('', $clientstest);
693 693
                       echo '</span>';
694 694
                       echo '</div>';
695 695
                   }
@@ -711,8 +711,8 @@  discard block
 block discarded – undo
711 711
                     <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>
712 712
                     <form enctype='multipart/form-data' id='live_form' accept-charset='UTF-8'>
713 713
                     <input type='hidden' name='test_type' value='udp_login'>
714
-                    <input type='hidden' name='lang' value='".CAT::get_lang()."'>
715
-                    <input type='hidden' name='profile_id' value='".$my_profile->identifier."'>
714
+                    <input type='hidden' name='lang' value='".CAT::get_lang() . "'>
715
+                    <input type='hidden' name='profile_id' value='".$my_profile->identifier . "'>
716 716
                     <table id='live_tests'>";
717 717
 // if any password based EAP methods are available enable this section
718 718
               if (in_array(EAP::$PEAP_MSCHAP2, $prof_compl) ||
@@ -737,8 +737,8 @@  discard block
 block discarded – undo
737 737
                       echo "<div id='live_login_results' style='display:none'>";
738 738
                       foreach (Config::$RADIUSTESTS['UDP-hosts'] as $hostindex => $host) {
739 739
                         print "<hr>";
740
-                      printf(_("Testing from: %s"), "<strong>".Config::$RADIUSTESTS['UDP-hosts'][$hostindex]['display_name']."</strong>");
741
-                      print "<span style='position:relative'><img src='../resources/images/icons/loading51.gif' id='live_src".$hostindex."_img' style='width:24px; position: absolute; left: 20px; bottom: 0px; '></span>";
740
+                      printf(_("Testing from: %s"), "<strong>" . Config::$RADIUSTESTS['UDP-hosts'][$hostindex]['display_name'] . "</strong>");
741
+                      print "<span style='position:relative'><img src='../resources/images/icons/loading51.gif' id='live_src" . $hostindex . "_img' style='width:24px; position: absolute; left: 20px; bottom: 0px; '></span>";
742 742
 print "<div id='eap_test$hostindex' class='eap_test_results'></div>";
743 743
 }
744 744
                       echo "</div>";
Please login to merge, or discard this patch.
Braces   +40 added lines, -28 removed lines patch added patch discarded remove patch
@@ -23,10 +23,11 @@  discard block
 block discarded – undo
23 23
 $error_message ='';
24 24
 $my_inst = valid_IdP($_REQUEST['inst_id'], $_SESSION['user']);
25 25
 
26
-if (isset($_GET['profile_id']))
26
+if (isset($_GET['profile_id'])) {
27 27
     $my_profile = valid_Profile($_GET['profile_id'], $my_inst->identifier);
28
-else
28
+} else {
29 29
     $my_profile = NULL;
30
+}
30 31
 if ($my_profile != NULL) {
31 32
    $cr = $my_profile->getAttributes("internal:realm");
32 33
    if ($cr) {
@@ -43,16 +44,18 @@  discard block
 block discarded – undo
43 44
          $_SESSION['check_realm'] = $check_realm;
44 45
       }
45 46
    } else {
46
-      if(!empty($_SESSION['check_realm']))
47
-         $check_realm = $_SESSION['check_realm'];
48
-      else
49
-         $check_realm = FALSE;
47
+      if(!empty($_SESSION['check_realm'])) {
48
+               $check_realm = $_SESSION['check_realm'];
49
+      } else {
50
+               $check_realm = FALSE;
51
+      }
52
+   }
53
+   if($check_realm) {
54
+         $testsuite = new RADIUSTests($check_realm);
55
+   } else {
56
+         $error_message = _("No valid realm name given, cannot execute any checks!");
57
+   }
50 58
    }
51
-   if($check_realm)
52
-      $testsuite = new RADIUSTests($check_realm);
53
-   else
54
-      $error_message = _("No valid realm name given, cannot execute any checks!");
55
-}
56 59
 
57 60
 $translate = _("STATIC");
58 61
 $translate = _("DYNAMIC");
@@ -433,10 +436,11 @@  discard block
 block discarded – undo
433 436
    $(".server_cert").hide();
434 437
 <?php
435 438
 foreach (Config::$RADIUSTESTS['UDP-hosts'] as $hostindex => $host) {
436
-    if ($check_thorough)
437
-        $extraarg = "profile_id: ".$my_profile->identifier.", ";
438
-    else
439
-        $extraarg = "";
439
+    if ($check_thorough) {
440
+            $extraarg = "profile_id: ".$my_profile->identifier.", ";
441
+    } else {
442
+            $extraarg = "";
443
+    }
440 444
     
441 445
    print "
442 446
 $(\"#src".$hostindex."_img\").attr('src',icon_loading);
@@ -556,8 +560,9 @@  discard block
 block discarded – undo
556 560
               } else {
557 561
                 echo UI_message(L_ERROR,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."));
558 562
                 echo "</table><div class='notacceptable'><table>";
559
-                foreach ($testsuite->listerrors() as $details)
560
-                   echo "<tr><td>" . $details['TYPE'] . "</td><td>" . $details['TARGET'] . "</td></tr>";
563
+                foreach ($testsuite->listerrors() as $details) {
564
+                                   echo "<tr><td>" . $details['TYPE'] . "</td><td>" . $details['TARGET'] . "</td></tr>";
565
+                }
561 566
                 echo "</table></div>";
562 567
               }
563 568
               echo '</div>';
@@ -573,9 +578,13 @@  discard block
 block discarded – undo
573 578
               ';
574 579
                   foreach ($testsuite->NAPTR_hostname_records as $hostindex => $addr) {
575 580
                       $host = '';
576
-                      if ($addr['family'] == "IPv6") $host .= '[';
581
+                      if ($addr['family'] == "IPv6") {
582
+                          $host .= '[';
583
+                      }
577 584
                       $host .= $addr['IP'];
578
-                      if ($addr['family'] == "IPv6") $host .= ']';
585
+                      if ($addr['family'] == "IPv6") {
586
+                          $host .= ']';
587
+                      }
579 588
                       $host .= ':' . $addr['port'];
580 589
 /*if($addr['family'] == "IPv6")
581 590
    continue;*/
@@ -728,11 +737,12 @@  discard block
 block discarded – undo
728 737
                           echo "<tr><td>" . _("Password:") . "</td><td><input type='text' id='password' class='mandatory' name='password'/></td></tr>";
729 738
                }
730 739
                       // ask for cert + privkey if TLS-based method is active
731
-                      if (in_array(EAP::$TLS, $prof_compl))
732
-                          echo "<tr><td colspan='2'><strong>" . _("Certificate-based EAP types") . "</strong></td></tr>
740
+                      if (in_array(EAP::$TLS, $prof_compl)) {
741
+                                                echo "<tr><td colspan='2'><strong>" . _("Certificate-based EAP types") . "</strong></td></tr>
733 742
                         <tr><td>" . _("Certificate file (.p12 or .pfx):") . "</td><td><input type='file' id='cert' accept='application/x-pkcs12' name='cert'/></td></tr>
734 743
                         <tr><td>" . _("Certificate password, if any:") . "</td><td><input type='text' id='privkey' name='privkey_pass'/></td></tr>
735 744
                         <tr><td>" . _("Username, if different from certificate Subject:") . "</td><td><input type='text' id='tls_username' name='tls_username'/></td></tr>";
745
+                      }
736 746
                       echo "<tr><td colspan='2'><button id='submit_credentials'>" . _("Submit credentials") . "</button></td></tr></table></form>";
737 747
                       echo "<div id='live_login_results' style='display:none'>";
738 748
                       foreach (Config::$RADIUSTESTS['UDP-hosts'] as $hostindex => $host) {
@@ -762,13 +772,15 @@  discard block
 block discarded – undo
762 772
     var realm = '<?php echo $check_realm; ?>';
763 773
     run_udp();
764 774
 <?php
765
-    if ($naptr > 0) 
766
-       echo "run_dynamic();";
767
-    else
768
-       echo '$("#tabs-d-li").hide();';
769
-    if (!$check_thorough) 
770
-       echo '$("#tabs-through").hide();';
771
-?>
775
+    if ($naptr > 0) {
776
+           echo "run_dynamic();";
777
+    } else {
778
+           echo '$("#tabs-d-li").hide();';
779
+    }
780
+    if (!$check_thorough) {
781
+           echo '$("#tabs-through").hide();';
782
+    }
783
+    ?>
772 784
 </script>
773 785
     <?php footer() ?>
774 786
 
Please login to merge, or discard this patch.
web/admin/action_fedcheck.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 require_once("../resources/inc/header.php");
19 19
 require_once("../resources/inc/footer.php");
20 20
 
21
-function profilechecks(IdP $idpinfo,Profile $profile) {
21
+function profilechecks(IdP $idpinfo, Profile $profile) {
22 22
 
23 23
     $tabletext = "<tr><td>" . $idpinfo->name . "</td><td>" . $profile->name . "</td>";
24 24
     
@@ -30,12 +30,12 @@  discard block
 block discarded – undo
30 30
         // update database with the findings
31 31
         
32 32
         DBConnection::exec("INST", "UPDATE profile SET "
33
-                . "status_dns = ".RETVAL_SKIPPED.", "
34
-                . "status_cert = ".RETVAL_SKIPPED.", "
35
-                . "status_reachability = ". RETVAL_SKIPPED.", "
36
-                . "status_TLS = ".RETVAL_SKIPPED.", "
33
+                . "status_dns = " . RETVAL_SKIPPED . ", "
34
+                . "status_cert = " . RETVAL_SKIPPED . ", "
35
+                . "status_reachability = " . RETVAL_SKIPPED . ", "
36
+                . "status_TLS = " . RETVAL_SKIPPED . ", "
37 37
                 . "last_status_check = NOW() "
38
-                . "WHERE profile_id = ".$profile->identifier);
38
+                . "WHERE profile_id = " . $profile->identifier);
39 39
         
40 40
         return $tabletext;
41 41
     }
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
     }
83 83
 
84 84
     if ($NAPTR_issues) {
85
-        $tabletext .= UI_error(0,0,true);
85
+        $tabletext .= UI_error(0, 0, true);
86 86
     } else {
87
-        $tabletext .= UI_okay(0,0,true);
87
+        $tabletext .= UI_okay(0, 0, true);
88 88
     }
89 89
     
90 90
     $UDP_errors = false;
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
     }
107 107
     
108 108
     $tabletext .= "</td><td>";
109
-    $tabletext .= UI_message($cert_biggest_oddity,0,0,true);
109
+    $tabletext .= UI_message($cert_biggest_oddity, 0, 0, true);
110 110
         
111 111
     $tabletext .= "</td><td>";
112 112
     if (!$UDP_errors) {
113
-        $tabletext .= UI_okay(0,0,true);
113
+        $tabletext .= UI_okay(0, 0, true);
114 114
     } else {
115
-        $tabletext .= UI_error(0,0,true);
115
+        $tabletext .= UI_error(0, 0, true);
116 116
     }
117 117
     
118 118
     $tabletext .= "</td><td>";
@@ -127,19 +127,19 @@  discard block
 block discarded – undo
127 127
         }
128 128
     }
129 129
     if (!$dynamic_errors) {
130
-        $tabletext .= UI_okay(0,0,true);
130
+        $tabletext .= UI_okay(0, 0, true);
131 131
     } else {
132
-        $tabletext .= UI_error(0,0,true);
132
+        $tabletext .= UI_error(0, 0, true);
133 133
     }
134 134
     $tabletext .= "</td></tr>";
135 135
 
136 136
     DBConnection::exec("INST", "UPDATE profile SET "
137
-                . "status_dns = ".($NAPTR_issues ? RETVAL_INVALID : RETVAL_OK) . ", "
138
-                . "status_cert = ".($cert_biggest_oddity) . ", "
139
-                . "status_reachability = ".($UDP_errors ? RETVAL_INVALID : RETVAL_OK) . ", "
140
-                . "status_TLS = ".($dynamic_errors ? RETVAL_INVALID : RETVAL_OK) . ", "
137
+                . "status_dns = " . ($NAPTR_issues ? RETVAL_INVALID : RETVAL_OK) . ", "
138
+                . "status_cert = " . ($cert_biggest_oddity) . ", "
139
+                . "status_reachability = " . ($UDP_errors ? RETVAL_INVALID : RETVAL_OK) . ", "
140
+                . "status_TLS = " . ($dynamic_errors ? RETVAL_INVALID : RETVAL_OK) . ", "
141 141
                 . "last_status_check = NOW() "
142
-                . "WHERE profile_id = ".$profile->identifier);    
142
+                . "WHERE profile_id = " . $profile->identifier);    
143 143
         
144 144
     return $tabletext;
145 145
 }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
     echo "<h2>" . _("Profiles marked as visible (V)") . "</h2>" . "<table>";
178 178
     echo rowdescription();
179 179
     foreach ($profiles_showtime as $oneprofile)
180
-        echo profilechecks($oneprofile['idp'],$oneprofile['profile']);
180
+        echo profilechecks($oneprofile['idp'], $oneprofile['profile']);
181 181
     echo "</table>";
182 182
 }
183 183
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
     echo "<h2>" . _("Profiles with sufficient configuration, not marked as visible (C)") . "</h2>" . "<table>";
186 186
     echo rowdescription();
187 187
     foreach ($profiles_confready as $oneprofile)
188
-        echo profilechecks($oneprofile['idp'],$oneprofile['profile']);
188
+        echo profilechecks($oneprofile['idp'], $oneprofile['profile']);
189 189
     echo "</table>";
190 190
 }
191 191
 ?>
Please login to merge, or discard this patch.
Braces   +32 added lines, -21 removed lines patch added patch discarded remove patch
@@ -44,10 +44,11 @@  discard block
 block discarded – undo
44 44
     // NAPTR existence check
45 45
     $tabletext .= "<td>";
46 46
     $naptr = $testsuite->NAPTR();
47
-    if ($naptr != RETVAL_NOTCONFIGURED)
48
-        switch ($naptr) {
47
+    if ($naptr != RETVAL_NOTCONFIGURED) {
48
+            switch ($naptr) {
49 49
             case RETVAL_NONAPTR:
50 50
                 $tabletext .= _("No NAPTR records");
51
+    }
51 52
                 break;
52 53
             case RETVAL_ONLYUNRELATEDNAPTR:
53 54
                 $tabletext .= sprintf(_("No associated NAPTR records"));
@@ -62,23 +63,26 @@  discard block
 block discarded – undo
62 63
 
63 64
     if ($naptr > 0) {
64 65
         $naptr_valid = $testsuite->NAPTR_compliance();
65
-        if ($naptr_valid == RETVAL_INVALID)
66
-            $NAPTR_issues = true;
66
+        if ($naptr_valid == RETVAL_INVALID) {
67
+                    $NAPTR_issues = true;
68
+        }
67 69
     }
68 70
 
69 71
     // SRV resolution
70 72
 
71 73
     if ($naptr > 0 && $naptr_valid == RETVAL_OK) {
72 74
         $srv = $testsuite->NAPTR_SRV();
73
-        if ($srv == RETVAL_INVALID)
74
-            $NAPTR_issues = true;
75
+        if ($srv == RETVAL_INVALID) {
76
+                    $NAPTR_issues = true;
77
+        }
75 78
     }
76 79
 
77 80
     // IP addresses for the hosts
78 81
     if ($naptr > 0 && $naptr_valid == RETVAL_OK && $srv > 0) {
79 82
         $hosts = $testsuite->NAPTR_hostnames();
80
-        if ($hosts == RETVAL_INVALID)
81
-            $NAPTR_issues = true;
83
+        if ($hosts == RETVAL_INVALID) {
84
+                    $NAPTR_issues = true;
85
+        }
82 86
     }
83 87
 
84 88
     if ($NAPTR_issues) {
@@ -94,14 +98,17 @@  discard block
 block discarded – undo
94 98
         $testsuite->UDP_reachability($hostindex, true, true);
95 99
         $results = $testsuite->UDP_reachability_result[$hostindex];
96 100
         //echo "<pre>".print_r($results,true)."</pre>";
97
-        if ($results['packetflow_sane'] != TRUE)
98
-            $UDP_errors = true;
99
-        if (empty($results['packetflow'][11]))
100
-            $UDP_errors = true;
101
+        if ($results['packetflow_sane'] != TRUE) {
102
+                    $UDP_errors = true;
103
+        }
104
+        if (empty($results['packetflow'][11])) {
105
+                    $UDP_errors = true;
106
+        }
101 107
         if (count($results['cert_oddities']) > 0) {
102
-            foreach ($results['cert_oddities'] as $oddity)
103
-                if ($oddity['level'] > $cert_biggest_oddity)
108
+            foreach ($results['cert_oddities'] as $oddity) {
109
+                            if ($oddity['level'] > $cert_biggest_oddity)
104 110
                     $cert_biggest_oddity = $oddity['level'];
111
+            }
105 112
         }
106 113
     }
107 114
     
@@ -122,8 +129,9 @@  discard block
 block discarded – undo
122 129
     if ($naptr > 0 && count($testsuite->NAPTR_hostname_records) > 0) {
123 130
         foreach ($testsuite->NAPTR_hostname_records as $hostindex => $addr) {
124 131
             $retval = $testsuite->TLS_clients_side_check($addr);
125
-            if ($retval != RETVAL_OK && $retval != RETVAL_SKIPPED)
126
-                $dynamic_errors = true;
132
+            if ($retval != RETVAL_OK && $retval != RETVAL_SKIPPED) {
133
+                            $dynamic_errors = true;
134
+            }
127 135
         }
128 136
     }
129 137
     if (!$dynamic_errors) {
@@ -165,10 +173,11 @@  discard block
 block discarded – undo
165 173
 $profiles_showtime = [];
166 174
 $profiles_readyconf = [];
167 175
 
168
-foreach ($allIDPs as $index => $oneidp)
176
+foreach ($allIDPs as $index => $oneidp) {
169 177
     foreach ($oneidp['instance']->listProfiles() as $profile)
170 178
         if ($profile->getShowtime()) {
171 179
             $profiles_showtime[] = ['idp' => $oneidp['instance'], 'profile' => $profile];
180
+}
172 181
         } else if ($profile->readyForShowtime()) {
173 182
             $profiles_confready[] = ['idp' => $oneidp['instance'], 'profile' => $profile];
174 183
         }
@@ -176,16 +185,18 @@  discard block
 block discarded – undo
176 185
 if (count($profiles_showtime) > 0) {
177 186
     echo "<h2>" . _("Profiles marked as visible (V)") . "</h2>" . "<table>";
178 187
     echo rowdescription();
179
-    foreach ($profiles_showtime as $oneprofile)
180
-        echo profilechecks($oneprofile['idp'],$oneprofile['profile']);
188
+    foreach ($profiles_showtime as $oneprofile) {
189
+            echo profilechecks($oneprofile['idp'],$oneprofile['profile']);
190
+    }
181 191
     echo "</table>";
182 192
 }
183 193
 
184 194
 if (count($profiles_confready) > 0) {
185 195
     echo "<h2>" . _("Profiles with sufficient configuration, not marked as visible (C)") . "</h2>" . "<table>";
186 196
     echo rowdescription();
187
-    foreach ($profiles_confready as $oneprofile)
188
-        echo profilechecks($oneprofile['idp'],$oneprofile['profile']);
197
+    foreach ($profiles_confready as $oneprofile) {
198
+            echo profilechecks($oneprofile['idp'],$oneprofile['profile']);
199
+    }
189 200
     echo "</table>";
190 201
 }
191 202
 ?>
Please login to merge, or discard this patch.
web/admin/edit_idp_result.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@
 block discarded – undo
89 89
 
90 90
 if (isset(Config::$CONSORTIUM['ssid']) && count(Config::$CONSORTIUM['ssid']) > 0)
91 91
     foreach (Config::$CONSORTIUM['ssid'] as $ssidname)
92
-        $ssids[] = $ssidname . " " . (isset(Config::$CONSORTIUM['tkipsupport']) && Config::$CONSORTIUM['tkipsupport'] === TRUE ? _("(WPA2/AES and WPA/TKIP)") : _("(WPA2/AES)") );
92
+        $ssids[] = $ssidname . " " . (isset(Config::$CONSORTIUM['tkipsupport']) && Config::$CONSORTIUM['tkipsupport'] === TRUE ? _("(WPA2/AES and WPA/TKIP)") : _("(WPA2/AES)"));
93 93
 
94 94
 $custom_ssids_wpa2 = $my_inst->getAttributes("media:SSID");
95 95
 $custom_ssids_wpa = $my_inst->getAttributes("media:SSID_with_legacy");
Please login to merge, or discard this patch.
Braces   +11 added lines, -6 removed lines patch added patch discarded remove patch
@@ -74,8 +74,9 @@  discard block
 block discarded – undo
74 74
 $my_inst->commitFlushAttributes($killlist);
75 75
 // delete cached logo, if present
76 76
 $logofile = dirname(dirname(__FILE__)) . "/downloads/logos/" . $my_inst->identifier . ".png";
77
-if (is_file($logofile))
77
+if (is_file($logofile)) {
78 78
     unlink($logofile);
79
+}
79 80
 
80 81
 CAT::writeAudit($_SESSION['user'], "MOD", "IdP " . $my_inst->identifier . " - attributes changed");
81 82
 
@@ -87,27 +88,31 @@  discard block
 block discarded – undo
87 88
 
88 89
 $ssids = [];
89 90
 
90
-if (isset(Config::$CONSORTIUM['ssid']) && count(Config::$CONSORTIUM['ssid']) > 0)
91
+if (isset(Config::$CONSORTIUM['ssid']) && count(Config::$CONSORTIUM['ssid']) > 0) {
91 92
     foreach (Config::$CONSORTIUM['ssid'] as $ssidname)
92 93
         $ssids[] = $ssidname . " " . (isset(Config::$CONSORTIUM['tkipsupport']) && Config::$CONSORTIUM['tkipsupport'] === TRUE ? _("(WPA2/AES and WPA/TKIP)") : _("(WPA2/AES)") );
94
+}
93 95
 
94 96
 $custom_ssids_wpa2 = $my_inst->getAttributes("media:SSID");
95 97
 $custom_ssids_wpa = $my_inst->getAttributes("media:SSID_with_legacy");
96 98
 $wired_support = $my_inst->getAttributes("media:wired");
97 99
 
98
-if (count($custom_ssids_wpa) > 0)
100
+if (count($custom_ssids_wpa) > 0) {
99 101
     foreach ($custom_ssids_wpa as $ssidname)
100 102
         $ssids[] = $ssidname['value'] . " " . _("(WPA2/AES and WPA/TKIP)");
103
+}
101 104
 
102
-if (count($custom_ssids_wpa2) > 0)
105
+if (count($custom_ssids_wpa2) > 0) {
103 106
     foreach ($custom_ssids_wpa2 as $ssidname)
104 107
         $ssids[] = $ssidname['value'] . " " . _("(WPA2/AES)");
108
+}
105 109
 
106 110
 echo "<table>";
107 111
 if (count($ssids) > 0) {
108 112
     $printedlist = "";
109
-    foreach ($ssids as $names)
110
-        $printedlist = $printedlist . "$names ";
113
+    foreach ($ssids as $names) {
114
+            $printedlist = $printedlist . "$names ";
115
+    }
111 116
     echo UI_okay(sprintf(_("Your installers will configure the following SSIDs: <strong>%s</strong>"), $printedlist), _("SSIDs configured"));
112 117
 };
113 118
 if (count($wired_support) > 0) {
Please login to merge, or discard this patch.