Completed
Branch master (03ec64)
by Brook
14:43
created
web/admin/edit_user.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 <script src="js/option_expand.js" type="text/javascript"></script>
24 24
 </head>
25 25
 <body>
26
-    <?php productheader("USERMGMT",CAT::get_lang()); ?>
26
+    <?php productheader("USERMGMT", CAT::get_lang()); ?>
27 27
     <h1>
28 28
         <?php _("Editing User Attributes"); ?>
29 29
     </h1>
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
             </button>
49 49
         </fieldset>
50 50
         <div>
51
-            <button type='submit' name='submitbutton' value='<?php echo BUTTON_SAVE;?>'>
51
+            <button type='submit' name='submitbutton' value='<?php echo BUTTON_SAVE; ?>'>
52 52
                 <?php echo _("Save data"); ?>
53 53
             </button>
54 54
             <button type='button' class='delete' name='abortbutton' value='abort' onclick='javascript:window.location="overview_user.php"'>
Please login to merge, or discard this patch.
web/admin/overview_user.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
     $has_inst = $inst_mgmt->listInstitutionsByAdmin($_SESSION['user']);
68 68
 
69 69
     if (Config::$CONSORTIUM['name'] == 'eduroam')
70
-        $helptext = "&nbsp;<h3 style='display:inline;'>" . sprintf(_("(Need help? Refer to the <a href='%s'>IdP administrator manual</a>)"),"https://wiki.geant.org/x/SwB_AQ")."</h3>";
70
+        $helptext = "&nbsp;<h3 style='display:inline;'>" . sprintf(_("(Need help? Refer to the <a href='%s'>IdP administrator manual</a>)"), "https://wiki.geant.org/x/SwB_AQ") . "</h3>";
71 71
     else
72 72
         $helptext = "";
73 73
 
Please login to merge, or discard this patch.
Braces   +24 added lines, -18 removed lines patch added patch discarded remove patch
@@ -54,22 +54,26 @@  discard block
 block discarded – undo
54 54
     </div>
55 55
     <div>
56 56
         <?php
57
-        if (!Config::$DB['userdb-readonly'])
58
-            echo "<a href='edit_user.php'><button>" . _("Edit User Details") . "</button></a>";
57
+        if (!Config::$DB['userdb-readonly']) {
58
+                    echo "<a href='edit_user.php'><button>" . _("Edit User Details") . "</button></a>";
59
+        }
59 60
 
60
-        if ($user->isFederationAdmin())
61
-            echo "<form action='overview_federation.php' method='GET' accept-charset='UTF-8'><button type='submit'>" . _('Click here to manage your federations') . "</button></form>";
62
-        if ($user->isSuperadmin())
63
-            echo "<form action='112365365321.php' method='GET' accept-charset='UTF-8'><button type='submit'>" . _('Click here to access the superadmin page') . "</button></form>";
61
+        if ($user->isFederationAdmin()) {
62
+                    echo "<form action='overview_federation.php' method='GET' accept-charset='UTF-8'><button type='submit'>" . _('Click here to manage your federations') . "</button></form>";
63
+        }
64
+        if ($user->isSuperadmin()) {
65
+                    echo "<form action='112365365321.php' method='GET' accept-charset='UTF-8'><button type='submit'>" . _('Click here to access the superadmin page') . "</button></form>";
66
+        }
64 67
         ?>
65 68
     </div>
66 69
     <?php
67 70
     $has_inst = $inst_mgmt->listInstitutionsByAdmin($_SESSION['user']);
68 71
 
69
-    if (Config::$CONSORTIUM['name'] == 'eduroam')
70
-        $helptext = "&nbsp;<h3 style='display:inline;'>" . sprintf(_("(Need help? Refer to the <a href='%s'>IdP administrator manual</a>)"),"https://wiki.geant.org/x/SwB_AQ")."</h3>";
71
-    else
72
-        $helptext = "";
72
+    if (Config::$CONSORTIUM['name'] == 'eduroam') {
73
+            $helptext = "&nbsp;<h3 style='display:inline;'>" . sprintf(_("(Need help? Refer to the <a href='%s'>IdP administrator manual</a>)"),"https://wiki.geant.org/x/SwB_AQ")."</h3>";
74
+    } else {
75
+            $helptext = "";
76
+    }
73 77
 
74 78
     if (sizeof($has_inst) > 0) {
75 79
         // we need to run the Federation constructor
@@ -121,25 +125,27 @@  discard block
 block discarded – undo
121 125
                         }
122 126
                     } else { // don't list self
123 127
                         unset($admins[$number]);
124
-                        if ($username['LEVEL'] == "FED")
125
-                            $i_am_blessed = TRUE;
128
+                        if ($username['LEVEL'] == "FED") {
129
+                                                    $i_am_blessed = TRUE;
130
+                        }
126 131
                     }
127 132
                 }
128 133
                 $number_of_other_admins = count($admins); // only the unnamed remain
129
-                if ($number_of_other_admins > 0)
130
-                    echo ngettext("other user", "other users", $number_of_other_admins);
134
+                if ($number_of_other_admins > 0) {
135
+                                    echo ngettext("other user", "other users", $number_of_other_admins);
136
+                }
131 137
                 // foreach ($the_inst->owner() as $admin)
132 138
                 // if ($admin != $_SESSION['user'])
133 139
                 // echo $admin . "<br/>";
134 140
                 echo "</td><td>";
135
-                if ($i_am_blessed)
136
-                    echo "<div style='white-space: nowrap;'><form method='post' action='inc/manageAdmins.inc.php?inst_id=" . $the_inst->identifier . "' onsubmit='popupRedirectWindow(this); return false;' accept-charset='UTF-8'><button type='submit'>" . _("Add/Remove Administrators") . "</button></form></div>";
141
+                if ($i_am_blessed) {
142
+                                    echo "<div style='white-space: nowrap;'><form method='post' action='inc/manageAdmins.inc.php?inst_id=" . $the_inst->identifier . "' onsubmit='popupRedirectWindow(this); return false;' accept-charset='UTF-8'><button type='submit'>" . _("Add/Remove Administrators") . "</button></form></div>";
143
+                }
137 144
                 echo "</td></tr>";
138 145
             }
139 146
         }
140 147
         echo "</table>";
141
-    }
142
-    else {
148
+    } else {
143 149
         echo "<h2>" . _("You are not managing any institutions.") . "</h2>";
144 150
     };
145 151
     if (Config::$CONSORTIUM['selfservice_registration'] === NULL) {
Please login to merge, or discard this patch.
web/admin/edit_federation_result.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 pageheader(sprintf(_("%s: Federation Customisation (submission completed)"), Config::$APPEARANCE['productname']), "FEDERATION");
26 26
 $my_fed = valid_Fed($_GET['fed_id'], $_SESSION['user']);
27 27
 if (isset($_POST['submitbutton'])) {
28
-    if (( $_POST['submitbutton'] == BUTTON_SAVE) && isset($_POST['option']) && isset($_POST['value'])) { // here we go
28
+    if (($_POST['submitbutton'] == BUTTON_SAVE) && isset($_POST['option']) && isset($_POST['value'])) { // here we go
29 29
         $fed_name = $my_fed->identifier;
30 30
         echo "<h1>" . sprintf(_("Submitted attributes for federation '%s'"), $fed_name) . "</h1>";
31 31
         $remaining_attribs = $my_fed->beginflushAttributes();
Please login to merge, or discard this patch.
web/admin/edit_profile_result.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
         if ($realm == FALSE) {
133 133
             echo UI_error(_("Realm check username cannot be configured: realm is missing!"));
134 134
         } else {
135
-            $profile->setRealmcheckUser(true,$checkuser_name);
136
-            echo UI_okay(sprintf(_("Special username for realm check is <strong>%s</strong>, the value is <strong>%s</strong>"), _("ON"), $checkuser_name."@".$realm));
135
+            $profile->setRealmcheckUser(true, $checkuser_name);
136
+            echo UI_okay(sprintf(_("Special username for realm check is <strong>%s</strong>, the value is <strong>%s</strong>"), _("ON"), $checkuser_name . "@" . $realm));
137 137
         }
138 138
     } else {
139 139
         $profile->setRealmCheckUser(false);
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
         if ($realm == FALSE) {
145 145
             echo UI_error(_("Realm check username cannot be configured: realm is missing!"));
146 146
         } else {
147
-            $profile->setInputVerificationPreference($verify,$hint);
147
+            $profile->setInputVerificationPreference($verify, $hint);
148 148
             if ($hint) {
149
-                $extratext = " ".sprintf(_("and the input field will be prefilled with '<strong>@%s</strong>'."),$realm);
149
+                $extratext = " " . sprintf(_("and the input field will be prefilled with '<strong>@%s</strong>'."), $realm);
150 150
             } else {
151 151
                 $extratext = ".";
152 152
             }
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
             
155 155
         }
156 156
     } else {
157
-        $profile->setInputVerificationPreference(false,false);
157
+        $profile->setInputVerificationPreference(false, false);
158 158
     }
159 159
 
160 160
 
Please login to merge, or discard this patch.
Braces   +24 added lines, -14 removed lines patch added patch discarded remove patch
@@ -48,25 +48,29 @@  discard block
 block discarded – undo
48 48
 // extended input checks
49 49
 
50 50
 $realm = FALSE;
51
-if (isset($_POST['realm']) && $_POST['realm'] != "")
51
+if (isset($_POST['realm']) && $_POST['realm'] != "") {
52 52
     $realm = valid_Realm($_POST['realm']);
53
+}
53 54
 
54 55
 $anon = FALSE;
55
-if (isset($_POST['anon_support']))
56
+if (isset($_POST['anon_support'])) {
56 57
     $anon = valid_boolean($_POST['anon_support']);
58
+}
57 59
 
58 60
 $anon_local = "anonymous";
59 61
 if (isset($_POST['anon_local'])) {
60 62
     $anon_local = valid_string_db($_POST['anon_local']);
61 63
 } else if ($my_profile !== FALSE) { // get the old anon outer id from DB. People don't appreciate "forgetting" it when unchecking anon id
62 64
     $local = $my_profile->getAttributes("internal:anon_local_value");
63
-    if (isset($local[0]))
64
-        $anon_local = $local[0]['value'];
65
-}
65
+    if (isset($local[0])) {
66
+            $anon_local = $local[0]['value'];
67
+    }
68
+    }
66 69
 
67 70
 $checkuser = FALSE;
68
-if (isset($_POST['checkuser_support']))
71
+if (isset($_POST['checkuser_support'])) {
69 72
     $checkuser = valid_boolean($_POST['checkuser_support']);
73
+}
70 74
 
71 75
 $checkuser_name = "anonymous";
72 76
 if (isset($_POST['checkuser_local'])) {
@@ -77,15 +81,18 @@  discard block
 block discarded – undo
77 81
 
78 82
 $verify = FALSE;
79 83
 $hint = FALSE;
80
-if (isset($_POST['verify_support']))
84
+if (isset($_POST['verify_support'])) {
81 85
     $verify = valid_boolean($_POST['checkuser_support']);
82
-if (isset($_POST['hint_support']))
86
+}
87
+if (isset($_POST['hint_support'])) {
83 88
     $hint = valid_boolean($_POST['hint_support']);
89
+}
84 90
 
85 91
 
86 92
 $redirect = FALSE;
87
-if (isset($_POST['redirect']))
93
+if (isset($_POST['redirect'])) {
88 94
     $redirect = valid_boolean($_POST['redirect']);
95
+}
89 96
 
90 97
 // did the user submit info? If so, submit to DB and go on to the 'dashboard' or 'next profile' page.
91 98
 // if not, what is he doing on this page anyway!
@@ -113,8 +120,9 @@  discard block
 block discarded – undo
113 120
     if ($realm != FALSE) {
114 121
         $profile->setRealm($anon_local . "@" . $realm);
115 122
         echo UI_okay(sprintf(_("Realm: <strong>%s</strong>"), $realm));
116
-    } else
117
-        $profile->setRealm("");
123
+    } else {
124
+            $profile->setRealm("");
125
+    }
118 126
     // set anon ID, if submitted
119 127
     if ($anon != FALSE) {
120 128
         if ($realm == FALSE) {
@@ -190,9 +198,10 @@  discard block
 block discarded – undo
190 198
                 echo UI_okay(_("Supported EAP Type: ") . "<strong>" . display_name($a) . "</strong>");
191 199
             } else {
192 200
                 $warntext = "";
193
-                if (is_array($eapcompleteness))
194
-                    foreach ($eapcompleteness as $item)
201
+                if (is_array($eapcompleteness)) {
202
+                                    foreach ($eapcompleteness as $item)
195 203
                         $warntext .= "<strong>" . display_name($item) . "</strong> ";
204
+                }
196 205
                 echo UI_warning(sprintf(_("Supported EAP Type: <strong>%s</strong> is missing required information %s !"), display_name($a), $warntext) . "<br/>" . _("The EAP type was added to the profile, but you need to complete the missing information before we can produce installers for you."));
197 206
             }
198 207
         }
@@ -207,9 +216,10 @@  discard block
 block discarded – undo
207 216
     <button type='submit'><?php echo _("Continue to dashboard"); ?></button>
208 217
 </form>
209 218
 <?php
210
-if (count($profile->getEapMethodsinOrderOfPreference(1)) > 0)
219
+if (count($profile->getEapMethodsinOrderOfPreference(1)) > 0) {
211 220
     echo "<form method='post' action='overview_installers.php?inst_id=$my_inst->identifier&profile_id=$profile->identifier' accept-charset='UTF-8'>
212 221
         <button type='submit'>" . _("Continue to Installer Fine-Tuning and Download") . "</button>
213 222
     </form>";
223
+}
214 224
 footer();
215 225
 ?>
216 226
\ No newline at end of file
Please login to merge, or discard this patch.
web/admin/overview_installers.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
                         // see if we want to add a footnote: anon_id
100 100
                         $anon = $my_profile->getAttributes("internal:use_anon_outer");
101 101
                         $anon = $anon[0]['value'];
102
-                        if ( $anon !== "" && isset($factory->device->specialities['anon_id'])) {
102
+                        if ($anon !== "" && isset($factory->device->specialities['anon_id'])) {
103 103
                             if (isset($factory->device->specialities['anon_id'][serialize($method)])) {
104 104
                                 $footnotetext = $factory->device->specialities['anon_id'][serialize($method)];
105 105
                                 $display_footnote = TRUE;
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     }
151 151
     ?>
152 152
     <form method='post' action='overview_idp.php?inst_id=<?php echo $my_inst->identifier; ?>' accept-charset='UTF-8'>
153
-        <button type='submit' name='submitbutton' value='<?php echo BUTTON_CLOSE;?>'>
153
+        <button type='submit' name='submitbutton' value='<?php echo BUTTON_CLOSE; ?>'>
154 154
             <?php echo _("Return to dashboard"); ?>
155 155
         </button>
156 156
     </form>
Please login to merge, or discard this patch.
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
                     } else {
126 126
                         echo "<td class='compat_secondary'></td>";
127 127
                     }
128
+                } else {
129
+                                    echo "<td class='compat_unsupported'></td>";
128 130
                 }
129
-                else
130
-                    echo "<td class='compat_unsupported'></td>";
131 131
             }
132 132
             echo "</tr>";
133 133
         }
@@ -144,8 +144,9 @@  discard block
 block discarded – undo
144 144
     <?php
145 145
     if (count($footnotes)) {
146 146
         echo "<p><strong>" . _("Footnotes:") . "</strong></p><table>";
147
-        foreach ($footnotes as $number => $text)
148
-            echo "<tr><td>($number) - </td><td>$text</td></tr>";
147
+        foreach ($footnotes as $number => $text) {
148
+                    echo "<tr><td>($number) - </td><td>$text</td></tr>";
149
+        }
149 150
         echo "</table>";
150 151
     }
151 152
     ?>
Please login to merge, or discard this patch.
web/admin/edit_profile.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 
303 303
         <?php
304 304
         if ($wizard_style) {
305
-            echo "<p>" . sprintf(_("Some installers support a feature called 'Anonymous outer identity'. If you don't know what this is, please read <a href='%s'>this article</a>."),"https://confluence.terena.org/display/H2eduroam/eap-types") . "</p>";
305
+            echo "<p>" . sprintf(_("Some installers support a feature called 'Anonymous outer identity'. If you don't know what this is, please read <a href='%s'>this article</a>."), "https://confluence.terena.org/display/H2eduroam/eap-types") . "</p>";
306 306
             echo "<p>" . _("On some platforms, the installers can suggest username endings and/or verify the user input to contain the realm suffix (sub-realms will pass this validation).") . "</p>";
307 307
             echo "<p>" . _("The realm check feature needs to know an outer ID which actually gets a chance to authenticate. If your RADIUS server lets only select usernames pass, it is useful to supply the inforamtion which of those (outer ID) username we can use for testing.") . "</p>";  
308 308
         }
@@ -313,35 +313,35 @@  discard block
 block discarded – undo
313 313
             // UI table to align elements
314 314
             echo "<table><tr>";
315 315
             // checkbox for "verify
316
-            echo "<td><span id='verify_label' style='" . ($realm == "" ? "color:#999999" : "" ) . "'>" . _("Verify user input to contain realm suffix:") . "</span></td>
317
-                  <td><input type='checkbox' " . ($verify != FALSE ? "checked" : "" ) . ($realm == "" ? "disabled" : "" ) . " name='verify_support' onclick='
316
+            echo "<td><span id='verify_label' style='" . ($realm == "" ? "color:#999999" : "") . "'>" . _("Verify user input to contain realm suffix:") . "</span></td>
317
+                  <td><input type='checkbox' " . ($verify != FALSE ? "checked" : "") . ($realm == "" ? "disabled" : "") . " name='verify_support' onclick='
318 318
                               if (this.form.elements[\"verify_support\"].checked != true) {
319 319
                                 this.form.elements[\"hint_support\"].setAttribute(\"disabled\", \"disabled\");
320 320
                               } else {
321 321
                                 this.form.elements[\"hint_support\"].removeAttribute(\"disabled\");
322 322
                               };'/>
323
-                              <span id='hint_label' style='" . ($realm == "" ? "color:#999999" : "" ) . "'>" . _("Prefill user input with realm suffix:") . "</span>
324
-                             <input type='checkbox' " . ($verify == FALSE ? "disabled" : "" ) . " name='hint_support' " . ( $hint != FALSE ? "checked" : "" ) . " /></td>";
323
+                              <span id='hint_label' style='" . ($realm == "" ? "color:#999999" : "") . "'>" . _("Prefill user input with realm suffix:") . "</span>
324
+                             <input type='checkbox' " . ($verify == FALSE ? "disabled" : "") . " name='hint_support' " . ($hint != FALSE ? "checked" : "") . " /></td>";
325 325
             echo "</tr><tr>";
326 326
             // checkbox and input field for anonymity support, available only when realm is known
327
-            echo "<td><span id='anon_support_label' style='" . ($realm == "" ? "color:#999999" : "" ) . "'>" . _("Enable Anonymous Outer Identity:") . "</span></td>
328
-                  <td><input type='checkbox' " . ($use_anon != FALSE ? "checked" : "" ) . ($realm == "" ? "disabled" : "" ) . " name='anon_support' onclick='
327
+            echo "<td><span id='anon_support_label' style='" . ($realm == "" ? "color:#999999" : "") . "'>" . _("Enable Anonymous Outer Identity:") . "</span></td>
328
+                  <td><input type='checkbox' " . ($use_anon != FALSE ? "checked" : "") . ($realm == "" ? "disabled" : "") . " name='anon_support' onclick='
329 329
                               if (this.form.elements[\"anon_support\"].checked != true) {
330 330
                                 this.form.elements[\"anon_local\"].setAttribute(\"disabled\", \"disabled\");
331 331
                               } else {
332 332
                                 this.form.elements[\"anon_local\"].removeAttribute(\"disabled\");
333 333
                               };'/>
334
-                             <input type='text' " . ($checkuser_outer == FALSE ? "disabled" : "" ) . " name='anon_local' value='$anon_local'/></td>";
334
+                             <input type='text' " . ($checkuser_outer == FALSE ? "disabled" : "") . " name='anon_local' value='$anon_local'/></td>";
335 335
             echo "</tr><tr>";
336 336
             // checkbox and input field for check realm outer id, available only when realm is known
337
-            echo "<td><span id='checkuser_label' style='" . ($realm == "" ? "color:#999999" : "" ) . "'>" . _("Use special Outer Identity for realm checks:") . "</span></td>
338
-                  <td><input type='checkbox' " . ($checkuser_outer != FALSE ? "checked" : "" ) . ($realm == "" ? "disabled" : "" ) . " name='checkuser_support' onclick='
337
+            echo "<td><span id='checkuser_label' style='" . ($realm == "" ? "color:#999999" : "") . "'>" . _("Use special Outer Identity for realm checks:") . "</span></td>
338
+                  <td><input type='checkbox' " . ($checkuser_outer != FALSE ? "checked" : "") . ($realm == "" ? "disabled" : "") . " name='checkuser_support' onclick='
339 339
                               if (this.form.elements[\"checkuser_support\"].checked != true) {
340 340
                                 this.form.elements[\"checkuser_local\"].setAttribute(\"disabled\", \"disabled\");
341 341
                               } else {
342 342
                                 this.form.elements[\"checkuser_local\"].removeAttribute(\"disabled\");
343 343
                               };'/>
344
-                             <input type='text' " . ($checkuser_outer == FALSE ? "disabled" : "" ) . " name='checkuser_local' value='$checkuser_value'/></td>";
344
+                             <input type='text' " . ($checkuser_outer == FALSE ? "disabled" : "") . " name='checkuser_local' value='$checkuser_value'/></td>";
345 345
             echo "</tr></table>";
346 346
             ?>
347 347
         </p>
@@ -355,14 +355,14 @@  discard block
 block discarded – undo
355 355
         <p>
356 356
 
357 357
             <?php
358
-            echo "<span id='redirect_label' style='" . ($realm == "" ? "color:#999999" : "" ) . "'><label for='redirect'>" . _("Redirect end users to own web page:") . "</label></span>
359
-                          <input type='checkbox'  name='redirect' id='redirect' " . ($blacklisted === FALSE ? "" : "checked " ) . "onclick='
358
+            echo "<span id='redirect_label' style='" . ($realm == "" ? "color:#999999" : "") . "'><label for='redirect'>" . _("Redirect end users to own web page:") . "</label></span>
359
+                          <input type='checkbox'  name='redirect' id='redirect' " . ($blacklisted === FALSE ? "" : "checked ") . "onclick='
360 360
                               if (this.form.elements[\"redirect\"].checked != true) {
361 361
                                 this.form.elements[\"redirect_target\"].setAttribute(\"disabled\", \"disabled\");
362 362
                               } else {
363 363
                                 this.form.elements[\"redirect_target\"].removeAttribute(\"disabled\");
364 364
                               };'/>
365
-                          <input type='text' name='redirect_target' " . ($blacklisted !== FALSE ? "value='$blacklisted'" : "disabled" ) . "/>";
365
+                          <input type='text' name='redirect_target' " . ($blacklisted !== FALSE ? "value='$blacklisted'" : "disabled") . "/>";
366 366
             ?>
367 367
         </p>
368 368
 
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
         function priority($eap_type, $isenabled, $priority) {
379 379
             echo "<td><select id='$eap_type-priority' name='$eap_type-priority' " . (!$isenabled ? "disabled='disabled'" : "") . ">";
380 380
             for ($a = 1; $a < 7; $a = $a + 1)
381
-                echo "<option id='$eap_type-$a' value='$a' " . ( $isenabled && $a == $priority ? "selected" : "" ) . ">$a</option>";
381
+                echo "<option id='$eap_type-$a' value='$a' " . ($isenabled && $a == $priority ? "selected" : "") . ">$a</option>";
382 382
             echo "</select></td>";
383 383
         }
384 384
 
Please login to merge, or discard this patch.
Braces   +69 added lines, -47 removed lines patch added patch discarded remove patch
@@ -157,9 +157,10 @@  discard block
 block discarded – undo
157 157
     if (count($blacklisted) > 0) {
158 158
         $blacklisted = unserialize($blacklisted[0]['value']);
159 159
         $blacklisted = $blacklisted['content'];
160
-    } else
161
-        $blacklisted = FALSE;
162
-} else {
160
+    } else {
161
+            $blacklisted = FALSE;
162
+    }
163
+    } else {
163 164
     $wizard_style = TRUE;
164 165
     $edit_mode = FALSE;
165 166
 }
@@ -173,10 +174,11 @@  discard block
 block discarded – undo
173 174
     ?>
174 175
     <h1>
175 176
         <?php
176
-        if ($wizard_style)
177
-            echo _("Step 3: Defining a user group profile");
178
-        else
179
-            printf(_("Edit profile '%s' ..."), $prefill_name);
177
+        if ($wizard_style) {
178
+                    echo _("Step 3: Defining a user group profile");
179
+        } else {
180
+                    printf(_("Edit profile '%s' ..."), $prefill_name);
181
+        }
180 182
         ?>
181 183
     </h1>
182 184
     <div class='infobox'>
@@ -219,8 +221,9 @@  discard block
 block discarded – undo
219 221
             <strong><?php echo _("General Profile properties"); ?></strong>
220 222
         </legend>
221 223
         <?php
222
-        if ($wizard_style)
223
-            echo "<p>" . _("We will now define a profile for your user group(s).  You can add as many profiles as you like by choosing the appropriate button on the end of the page. After we are done, the wizard is finished and you will be taken to the main IdP administration page.") . "</p>";
224
+        if ($wizard_style) {
225
+                    echo "<p>" . _("We will now define a profile for your user group(s).  You can add as many profiles as you like by choosing the appropriate button on the end of the page. After we are done, the wizard is finished and you will be taken to the main IdP administration page.") . "</p>";
226
+        }
224 227
         ?>
225 228
         <h3><?php echo _("Profile Name and RADIUS realm"); ?></h3>
226 229
         <?php
@@ -228,8 +231,9 @@  discard block
 block discarded – undo
228 231
             echo "<p>" . _("First of all we need a name for the profile. This will be displayed to end users, so you may want to choose a descriptive name like 'Professors', 'Students of the Faculty of Bioscience', etc.") . "</p>";
229 232
             echo "<p>" . _("Optionally, you can provide a longer descriptive text about who this profile is for. If you specify it, it will be displayed on the download page after the user has selected the profile name in the list.") . "</p>";
230 233
             echo "<p>" . _("You can also tell us your RADIUS realm. ");
231
-            if (count(Config::$RADIUSTESTS['UDP-hosts']) > 0 || Config::$RADIUSTESTS['TLS-discoverytag'] != "")
232
-                printf(_("This is useful if you want to use the sanity check module later, which tests reachability of your realm in the %s infrastructure. "), CONFIG::$CONSORTIUM['name']);
234
+            if (count(Config::$RADIUSTESTS['UDP-hosts']) > 0 || Config::$RADIUSTESTS['TLS-discoverytag'] != "") {
235
+                            printf(_("This is useful if you want to use the sanity check module later, which tests reachability of your realm in the %s infrastructure. "), CONFIG::$CONSORTIUM['name']);
236
+            }
233 237
             echo _("It is required to enter the realm name if you want to support anonymous outer identities (see below).") . "</p>";
234 238
         }
235 239
         ?>
@@ -240,9 +244,10 @@  discard block
 block discarded – undo
240 244
             if ($edit_mode) {
241 245
                 $existing_attribs = $my_profile->getAttributes();
242 246
 
243
-                foreach ($existing_attribs as $existing_attribute)
244
-                    if ($existing_attribute['level'] == "Profile")
247
+                foreach ($existing_attribs as $existing_attribute) {
248
+                                    if ($existing_attribute['level'] == "Profile")
245 249
                         $prepopulate[] = $existing_attribute;
250
+                }
246 251
             }
247 252
             add_option("profile", $prepopulate);
248 253
             ?>
@@ -349,8 +354,9 @@  discard block
 block discarded – undo
349 354
         <h3><?php echo _("Installer Download Location"); ?></h3>
350 355
 
351 356
         <?php
352
-        if ($wizard_style)
353
-            echo "<p>" . _("The CAT has a download area for end users. There, they will, for example, learn about the support pointers you entered earlier. The CAT can also immediately offer the installers for the profile for download. If you don't want that, you can instead enter a web site location where you want your users to be redirected to. You, as the administrator, can still download the profiles to place them on that page (see the 'Compatibility Matrix' button on the dashboard).") . "</p>";
357
+        if ($wizard_style) {
358
+                    echo "<p>" . _("The CAT has a download area for end users. There, they will, for example, learn about the support pointers you entered earlier. The CAT can also immediately offer the installers for the profile for download. If you don't want that, you can instead enter a web site location where you want your users to be redirected to. You, as the administrator, can still download the profiles to place them on that page (see the 'Compatibility Matrix' button on the dashboard).") . "</p>";
359
+        }
354 360
         ?>
355 361
         <p>
356 362
 
@@ -370,15 +376,17 @@  discard block
 block discarded – undo
370 376
     <fieldset class="option_container">
371 377
         <legend><strong><?php echo _("Supported EAP types"); ?></strong></legend>
372 378
         <?php
373
-        if ($wizard_style)
374
-            echo "<p>" . _("Now, we need to know which EAP types your IdP supports. If you support multiple EAP types, you can assign every type a priority (1=highest). This tool will always generate an automatic installer for the EAP type with the highest priority; only if the user's device can't use that EAP type, we will use an EAP type further down in the list.") . "</p>";
379
+        if ($wizard_style) {
380
+                    echo "<p>" . _("Now, we need to know which EAP types your IdP supports. If you support multiple EAP types, you can assign every type a priority (1=highest). This tool will always generate an automatic installer for the EAP type with the highest priority; only if the user's device can't use that EAP type, we will use an EAP type further down in the list.") . "</p>";
381
+        }
375 382
         ?>
376 383
         <?php
377 384
 
378 385
         function priority($eap_type, $isenabled, $priority) {
379 386
             echo "<td><select id='$eap_type-priority' name='$eap_type-priority' " . (!$isenabled ? "disabled='disabled'" : "") . ">";
380
-            for ($a = 1; $a < 7; $a = $a + 1)
381
-                echo "<option id='$eap_type-$a' value='$a' " . ( $isenabled && $a == $priority ? "selected" : "" ) . ">$a</option>";
387
+            for ($a = 1; $a < 7; $a = $a + 1) {
388
+                            echo "<option id='$eap_type-$a' value='$a' " . ( $isenabled && $a == $priority ? "selected" : "" ) . ">$a</option>";
389
+            }
382 390
             echo "</select></td>";
383 391
         }
384 392
 
@@ -387,18 +395,20 @@  discard block
 block discarded – undo
387 395
 
388 396
             $eapoptions = [];
389 397
 
390
-            foreach ($idpwideoptions as $option)
391
-                if ($option['level'] == "IdP" && preg_match('/^eap/', $option['name']))
398
+            foreach ($idpwideoptions as $option) {
399
+                            if ($option['level'] == "IdP" && preg_match('/^eap/', $option['name']))
392 400
                     $eapoptions[] = $option['name'];
401
+            }
393 402
 
394 403
             $eapoptions = array_count_values($eapoptions);
395 404
 
396 405
             if (count($eapoptions) > 0) {
397 406
                 echo "<strong>" . _("EAP options inherited from Global level:") . "</strong><br />";
398
-                foreach ($eapoptions as $optionname => $count)
399
-                /// option count and enumeration
407
+                foreach ($eapoptions as $optionname => $count) {
408
+                                /// option count and enumeration
400 409
                 /// Example: "(3x) Server Name"
401 410
                     printf(_("(%dx) %s") . "<br />", $count, display_name($optionname));
411
+                }
402 412
             }
403 413
 
404 414
             echo "</div></td>";
@@ -413,10 +423,11 @@  discard block
 block discarded – undo
413 423
         foreach ($methods as $a) {
414 424
             $display = display_name($a);
415 425
             $enabled = FALSE;
416
-            if ($edit_mode)
417
-                foreach ($prefill_methods as $prio => $value) {
426
+            if ($edit_mode) {
427
+                            foreach ($prefill_methods as $prio => $value) {
418 428
                     if (display_name($a) == display_name($value)) {
419 429
                         $enabled = TRUE;
430
+            }
420 431
                         $countactive = $prio + 1;
421 432
                     }
422 433
                 }
@@ -455,8 +466,9 @@  discard block
 block discarded – undo
455 466
                             <?php
456 467
                             foreach ($methods as $a) {
457 468
                                 $display = display_name($a);
458
-                                if (!isset($D[display_name($a)]))
459
-                                    print '<li class="eap1">' . display_name($a) . "</li>\n";
469
+                                if (!isset($D[display_name($a)])) {
470
+                                                                    print '<li class="eap1">' . display_name($a) . "</li>\n";
471
+                                }
460 472
                             }
461 473
                             ?>
462 474
                         </ol>
@@ -480,13 +492,15 @@  discard block
 block discarded – undo
480 492
             <?php
481 493
             $idp_options = $my_inst->getAttributes();
482 494
             $has_support_options = [];
483
-            foreach ($idp_options as $idp_option)
484
-                if (preg_match("/^support:/", $idp_option['name']))
495
+            foreach ($idp_options as $idp_option) {
496
+                            if (preg_match("/^support:/", $idp_option['name']))
485 497
                     $has_support_options[$idp_option['name']] = "SET";
498
+            }
486 499
             if (count($has_support_options) > 0) {
487 500
                 $text = "<ul>";
488
-                foreach ($has_support_options as $key => $value)
489
-                    $text .= "<li><strong>" . display_name($key) . "</strong></li>";
501
+                foreach ($has_support_options as $key => $value) {
502
+                                    $text .= "<li><strong>" . display_name($key) . "</strong></li>";
503
+                }
490 504
                 $text .= "</ul>";
491 505
                 printf(ngettext("The option %s is already defined IdP-wide. If you set it here on profile level, this setting will override the IdP-wide one.", "The options %s are already defined IdP-wide. If you set them here on profile level, these settings will override the IdP-wide ones.", count($has_support_options)), $text);
492 506
             }
@@ -497,9 +511,10 @@  discard block
 block discarded – undo
497 511
             $prepopulate = [];
498 512
             if ($edit_mode) {
499 513
                 $existing_attribs = $my_profile->getAttributes();
500
-                foreach ($existing_attribs as $existing_attribute)
501
-                    if ($existing_attribute['level'] == "Profile")
514
+                foreach ($existing_attribs as $existing_attribute) {
515
+                                    if ($existing_attribute['level'] == "Profile")
502 516
                         $prepopulate[] = $existing_attribute;
517
+                }
503 518
             }
504 519
             add_option("support", $prepopulate);
505 520
             ?>
@@ -511,13 +526,15 @@  discard block
 block discarded – undo
511 526
         <p>
512 527
             <?php
513 528
             $has_eap_options = [];
514
-            foreach ($idp_options as $idp_option)
515
-                if (preg_match("/^eap:/", $idp_option['name']))
529
+            foreach ($idp_options as $idp_option) {
530
+                            if (preg_match("/^eap:/", $idp_option['name']))
516 531
                     $has_eap_options[$idp_option['name']] = "SET";
532
+            }
517 533
             if (count($has_eap_options) > 0) {
518 534
                 $text = "<ul>";
519
-                foreach ($has_eap_options as $key => $value)
520
-                    $text .= "<li><strong>" . display_name($key) . "</strong></li>";
535
+                foreach ($has_eap_options as $key => $value) {
536
+                                    $text .= "<li><strong>" . display_name($key) . "</strong></li>";
537
+                }
521 538
                 $text .= "</ul>";
522 539
                 printf(ngettext("The option %s is already defined IdP-wide. If you set it here on profile level, this setting will override the IdP-wide one.", "The options %s are already defined IdP-wide. If you set them here on profile level, these settings will override the IdP-wide ones.", count($has_eap_options)), $text);
523 540
             }
@@ -528,9 +545,10 @@  discard block
 block discarded – undo
528 545
             $prepopulate = [];
529 546
             if ($edit_mode) {
530 547
                 $existing_attribs = $my_profile->getAttributes();
531
-                foreach ($existing_attribs as $existing_attribute)
532
-                    if ($existing_attribute['level'] == "Profile")
548
+                foreach ($existing_attribs as $existing_attribute) {
549
+                                    if ($existing_attribute['level'] == "Profile")
533 550
                         $prepopulate[] = $existing_attribute;
551
+                }
534 552
             }
535 553
             add_option("eap", $prepopulate);
536 554
             ?>
@@ -543,13 +561,15 @@  discard block
 block discarded – undo
543 561
             <?php
544 562
             $idp_options = $my_inst->getAttributes();
545 563
             $has_support_options = array();
546
-            foreach ($idp_options as $idp_option)
547
-                if (preg_match("/^media:/", $idp_option['name']))
564
+            foreach ($idp_options as $idp_option) {
565
+                            if (preg_match("/^media:/", $idp_option['name']))
548 566
                     $has_support_options[$idp_option['name']] = "SET";
567
+            }
549 568
             if (count($has_support_options) > 0) {
550 569
                 $text = "<ul>";
551
-                foreach ($has_support_options as $key => $value)
552
-                    $text .= "<li><strong>" . display_name($key) . "</strong></li>";
570
+                foreach ($has_support_options as $key => $value) {
571
+                                    $text .= "<li><strong>" . display_name($key) . "</strong></li>";
572
+                }
553 573
                 $text .= "</ul>";
554 574
                 printf(ngettext("The option %s is already defined IdP-wide. If you set it here on profile level, this setting will override the IdP-wide one.", "The options %s are already defined IdP-wide. If you set them here on profile level, these settings will override the IdP-wide ones.", count($has_support_options)), $text);
555 575
             }
@@ -560,17 +580,19 @@  discard block
 block discarded – undo
560 580
             $prepopulate = array();
561 581
             if ($edit_mode) {
562 582
                 $existing_attribs = $my_profile->getAttributes();
563
-                foreach ($existing_attribs as $existing_attribute)
564
-                    if ($existing_attribute['level'] == "Profile")
583
+                foreach ($existing_attribs as $existing_attribute) {
584
+                                    if ($existing_attribute['level'] == "Profile")
565 585
                         $prepopulate[] = $existing_attribute;
586
+                }
566 587
             }
567 588
             add_option("media", $prepopulate);
568 589
             ?>
569 590
         </table>
570 591
         <button type='button' class='newoption' onclick='addDefaultMediaOptions()'><?php echo _("Add new option"); ?></button></fieldset>
571 592
     <?php
572
-    if ($wizard_style)
573
-        echo "<p>" . _("When you are sure that everything is correct, please click on 'Save data' and you will be taken to your IdP Dashboard page.") . "</p>";
593
+    if ($wizard_style) {
594
+            echo "<p>" . _("When you are sure that everything is correct, please click on 'Save data' and you will be taken to your IdP Dashboard page.") . "</p>";
595
+    }
574 596
     echo "<p><button type='submit' name='submitbutton' value='" . BUTTON_SAVE . "'>" . _("Save data") . "</button><button type='button' class='delete' name='abortbutton' value='abort' onclick='javascript:window.location = \"overview_idp.php?inst_id=$my_inst->identifier\"'>" . _("Discard changes") . "</button></p></form>";
575 597
     footer();
576 598
     ?>
Please login to merge, or discard this patch.
web/admin/API.php 2 patches
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 function return_error($code, $description) {
32 32
     echo "<CAT-API-Response>\n";
33
-    echo "  <error>\n    <code>".$code."</code>\n    <description>$description</description>\n  </error>\n";
33
+    echo "  <error>\n    <code>" . $code . "</code>\n    <description>$description</description>\n  </error>\n";
34 34
     echo "</CAT-API-Response>\n";
35 35
 }
36 36
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 }
43 43
 
44 44
 if (!isset($_POST['APIKEY'])) {
45
-    return_error(ERROR_NO_APIKEY,"POST did not contain an APIKEY");
45
+    return_error(ERROR_NO_APIKEY, "POST did not contain an APIKEY");
46 46
     exit(1);
47 47
 }
48 48
 
@@ -54,25 +54,25 @@  discard block
 block discarded – undo
54 54
     }
55 55
 
56 56
 if ($checkval == "FAIL") {
57
-    return_error(ERROR_INVALID_APIKEY,"APIKEY is invalid");
57
+    return_error(ERROR_INVALID_APIKEY, "APIKEY is invalid");
58 58
     exit(1);
59 59
 }
60 60
     
61 61
 // it's a valid admin; what does he want to do?
62 62
 
63 63
 if (!isset($_POST['ACTION'])) {
64
-    return_error(ERROR_NO_ACTION,"POST did not contain the desired ACTION");
64
+    return_error(ERROR_NO_ACTION, "POST did not contain the desired ACTION");
65 65
     exit(1);
66 66
 }
67 67
 
68 68
 $sanitised_action = valid_string_db($_POST['ACTION']);
69 69
 
70
-switch($sanitised_action) {
70
+switch ($sanitised_action) {
71 71
     case 'NEWINST':
72 72
         // fine... we need two parameters for that:
73 73
         // mail address, inst name
74 74
         if (!isset($_POST['NEWINST_PRIMARYADMIN'])) {
75
-            return_error(ERROR_MISSING_PARAMETER,"POST missed at least one required parameter (NEWINST_PRIMARYADMIN)");
75
+            return_error(ERROR_MISSING_PARAMETER, "POST missed at least one required parameter (NEWINST_PRIMARYADMIN)");
76 76
             exit(1);
77 77
         }
78 78
         // alright: create the IdP, fill in attributes
@@ -85,14 +85,14 @@  discard block
 block discarded – undo
85 85
         // TODO For 1.1, make sure that pSF gets is field as a parameter, not implicitly via POST
86 86
         $original_post = $_POST;
87 87
         foreach ($_POST['option'] as $optindex => $optname)
88
-            if (!preg_match("/^general:/",$optname) && !preg_match("/^support:/",$optname) && !preg_match("/^eap:/",$optname))
88
+            if (!preg_match("/^general:/", $optname) && !preg_match("/^support:/", $optname) && !preg_match("/^eap:/", $optname))
89 89
                 unset($_POST['option'][$optindex]);
90 90
         // now process all inst-wide options    
91
-        processSubmittedFields($idp, [],0,0,TRUE);
91
+        processSubmittedFields($idp, [], 0, 0, TRUE);
92 92
         $_POST = $original_post;
93 93
         // same thing for profile options
94 94
         foreach ($_POST['option'] as $optindex => $optname)
95
-            if (!preg_match("/^profile:/",$optname) || $optname == "profile:QR-user")
95
+            if (!preg_match("/^profile:/", $optname) || $optname == "profile:QR-user")
96 96
                 unset($_POST['option'][$optindex]);
97 97
         // if we do have profile-level options - create a profile and fill in the values!
98 98
         if (count($_POST['option']) > 0) {
@@ -106,44 +106,44 @@  discard block
 block discarded – undo
106 106
             foreach ($_POST['option'] as $optindex => $optname) {
107 107
                 switch ($optname) {
108 108
                     case "profile-api:anon":
109
-                        if (isset($_POST['value'][$optindex."-0"]))
110
-                                $theanonid = valid_string_db($_POST['value'][$optindex."-0"]);
109
+                        if (isset($_POST['value'][$optindex . "-0"]))
110
+                                $theanonid = valid_string_db($_POST['value'][$optindex . "-0"]);
111 111
                         break;
112 112
                     case "profile-api:realm":
113
-                        if (isset($_POST['value'][$optindex."-0"]) && valid_Realm($_POST['value'][$optindex."-0"]))
114
-                                $therealm = $_POST['value'][$optindex."-0"];
113
+                        if (isset($_POST['value'][$optindex . "-0"]) && valid_Realm($_POST['value'][$optindex . "-0"]))
114
+                                $therealm = $_POST['value'][$optindex . "-0"];
115 115
                         break;
116 116
                     case "profile-api:useanon":
117
-                        if (isset($_POST['value'][$optindex."-3"]) && valid_boolean($_POST['value'][$optindex."-3"]) == "on")
117
+                        if (isset($_POST['value'][$optindex . "-3"]) && valid_boolean($_POST['value'][$optindex . "-3"]) == "on")
118 118
                                 $use_anon = TRUE;
119 119
                         break;
120 120
                     case "profile-api:eaptype":
121 121
                         $pref = 0;
122
-                        if (isset($_POST['value'][$optindex."-0"]) && 
123
-                            is_numeric($_POST['value'][$optindex."-0"]) && 
124
-                            $_POST['value'][$optindex."-0"] >= 1 &&
125
-                            $_POST['value'][$optindex."-0"] <= 7 ) {
126
-                                switch ($_POST['value'][$optindex."-0"]) {
122
+                        if (isset($_POST['value'][$optindex . "-0"]) && 
123
+                            is_numeric($_POST['value'][$optindex . "-0"]) && 
124
+                            $_POST['value'][$optindex . "-0"] >= 1 &&
125
+                            $_POST['value'][$optindex . "-0"] <= 7) {
126
+                                switch ($_POST['value'][$optindex . "-0"]) {
127 127
                                     case 1:
128
-                                        $newprofile->addSupportedEapMethod (EAP::$TTLS_PAP, $pref);
128
+                                        $newprofile->addSupportedEapMethod(EAP::$TTLS_PAP, $pref);
129 129
                                         break;
130 130
                                     case 2:
131
-                                        $newprofile->addSupportedEapMethod (EAP::$PEAP_MSCHAP2, $pref);
131
+                                        $newprofile->addSupportedEapMethod(EAP::$PEAP_MSCHAP2, $pref);
132 132
                                         break;
133 133
                                     case 3:
134
-                                        $newprofile->addSupportedEapMethod (EAP::$TLS, $pref);
134
+                                        $newprofile->addSupportedEapMethod(EAP::$TLS, $pref);
135 135
                                         break;
136 136
                                     case 4:
137
-                                        $newprofile->addSupportedEapMethod (EAP::$FAST_GTC, $pref);
137
+                                        $newprofile->addSupportedEapMethod(EAP::$FAST_GTC, $pref);
138 138
                                         break;
139 139
                                     case 5:
140
-                                        $newprofile->addSupportedEapMethod (EAP::$TTLS_GTC, $pref);
140
+                                        $newprofile->addSupportedEapMethod(EAP::$TTLS_GTC, $pref);
141 141
                                         break;
142 142
                                     case 6:
143
-                                        $newprofile->addSupportedEapMethod (EAP::$TTLS_MSCHAP2, $pref);
143
+                                        $newprofile->addSupportedEapMethod(EAP::$TTLS_MSCHAP2, $pref);
144 144
                                         break;
145 145
                                     case 7:
146
-                                        $newprofile->addSupportedEapMethod (EAP::$PWD, $pref);
146
+                                        $newprofile->addSupportedEapMethod(EAP::$PWD, $pref);
147 147
                                         break;
148 148
                                 }
149 149
                                 $pref = $pref + 1;
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
                 }
155 155
             }
156 156
             if ($therealm != "") {
157
-                $newprofile->setRealm ($theanonid."@".$therealm);
157
+                $newprofile->setRealm($theanonid . "@" . $therealm);
158 158
                 if ($use_anon) {
159
-                    $newprofile->setAnonymousIDSupport (true);
159
+                    $newprofile->setAnonymousIDSupport(true);
160 160
                 }
161 161
             }
162 162
             // re-instantiate $profile, we need to do completion checks and need fresh data for isEapTypeDefinitionComplete()
@@ -169,30 +169,30 @@  discard block
 block discarded – undo
169 169
         // and send it back to the caller
170 170
         $URL = "https://" . $_SERVER['SERVER_NAME'] . dirname($_SERVER['SCRIPT_NAME']) . "/action_enrollment.php?token=$newtoken";
171 171
         echo "<CAT-API-Response>\n";
172
-        echo "  <success action='NEWINST'>\n    <enrollment_URL>$URL</enrollment_URL>\n    <inst_unique_id>".$idp->identifier."</inst_unique_id>\n  </success>\n";
172
+        echo "  <success action='NEWINST'>\n    <enrollment_URL>$URL</enrollment_URL>\n    <inst_unique_id>" . $idp->identifier . "</inst_unique_id>\n  </success>\n";
173 173
         echo "</CAT-API-Response>\n";
174 174
             exit(0);
175 175
         break;
176 176
     case 'ADMINCOUNT':
177 177
         if (!isset($_POST['INST_IDENTIFIER'])) {
178
-            return_error(ERROR_MISSING_PARAMETER,"Parameter missing (INST_IDENTIFIER)");
178
+            return_error(ERROR_MISSING_PARAMETER, "Parameter missing (INST_IDENTIFIER)");
179 179
             exit(1);
180 180
         }
181 181
         $wannabeidp = valid_IdP($_POST['INST_IDENTIFIER']);
182
-        if (! $wannabeidp instanceof IdP) {
183
-            return_error(ERROR_INVALID_PARAMETER,"Parameter invalid (INST_IDENTIFIER)");
182
+        if (!$wannabeidp instanceof IdP) {
183
+            return_error(ERROR_INVALID_PARAMETER, "Parameter invalid (INST_IDENTIFIER)");
184 184
             exit(1);
185 185
         }
186 186
         if (strtoupper($wannabeidp->federation) != strtoupper($federation)) {
187
-            return_error(ERROR_INVALID_PARAMETER,"Parameter invalid (INST_IDENTIFIER)");
187
+            return_error(ERROR_INVALID_PARAMETER, "Parameter invalid (INST_IDENTIFIER)");
188 188
             exit(1);
189 189
         }
190 190
         echo "<CAT-API-Response>\n";
191
-        echo "  <success action='ADMINCOUNT'>\n    <number_of_admins>".count($wannabeidp->owner())."</number_of_admins>\n  </success>\n";        
191
+        echo "  <success action='ADMINCOUNT'>\n    <number_of_admins>" . count($wannabeidp->owner()) . "</number_of_admins>\n  </success>\n";        
192 192
         echo "</CAT-API-Response>\n";
193 193
             exit(0);
194 194
         break;
195 195
     default:
196
-        return_error(ERROR_INVALID_ACTION,"POST contained an unknown ACTION");
196
+        return_error(ERROR_INVALID_ACTION, "POST contained an unknown ACTION");
197 197
         exit(1);
198 198
 }
199 199
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +17 added lines, -11 removed lines patch added patch discarded remove patch
@@ -46,9 +46,10 @@  discard block
 block discarded – undo
46 46
     exit(1);
47 47
 }
48 48
 
49
-foreach (Config::$CONSORTIUM['registration_API_keys'] as $key => $fed_name)
49
+foreach (Config::$CONSORTIUM['registration_API_keys'] as $key => $fed_name) {
50 50
     if ($_POST['APIKEY'] == $key) {
51 51
         $mode = "API";
52
+}
52 53
         $federation = $fed_name;
53 54
         $checkval = "OK-NEW";
54 55
     }
@@ -84,16 +85,18 @@  discard block
 block discarded – undo
84 85
         // POST, but I need to do some sanitising first.
85 86
         // TODO For 1.1, make sure that pSF gets is field as a parameter, not implicitly via POST
86 87
         $original_post = $_POST;
87
-        foreach ($_POST['option'] as $optindex => $optname)
88
-            if (!preg_match("/^general:/",$optname) && !preg_match("/^support:/",$optname) && !preg_match("/^eap:/",$optname))
88
+        foreach ($_POST['option'] as $optindex => $optname) {
89
+                    if (!preg_match("/^general:/",$optname) && !preg_match("/^support:/",$optname) && !preg_match("/^eap:/",$optname))
89 90
                 unset($_POST['option'][$optindex]);
91
+        }
90 92
         // now process all inst-wide options    
91 93
         processSubmittedFields($idp, [],0,0,TRUE);
92 94
         $_POST = $original_post;
93 95
         // same thing for profile options
94
-        foreach ($_POST['option'] as $optindex => $optname)
95
-            if (!preg_match("/^profile:/",$optname) || $optname == "profile:QR-user")
96
+        foreach ($_POST['option'] as $optindex => $optname) {
97
+                    if (!preg_match("/^profile:/",$optname) || $optname == "profile:QR-user")
96 98
                 unset($_POST['option'][$optindex]);
99
+        }
97 100
         // if we do have profile-level options - create a profile and fill in the values!
98 101
         if (count($_POST['option']) > 0) {
99 102
             $newprofile = $idp->newProfile();
@@ -106,16 +109,19 @@  discard block
 block discarded – undo
106 109
             foreach ($_POST['option'] as $optindex => $optname) {
107 110
                 switch ($optname) {
108 111
                     case "profile-api:anon":
109
-                        if (isset($_POST['value'][$optindex."-0"]))
110
-                                $theanonid = valid_string_db($_POST['value'][$optindex."-0"]);
112
+                        if (isset($_POST['value'][$optindex."-0"])) {
113
+                                                        $theanonid = valid_string_db($_POST['value'][$optindex."-0"]);
114
+                        }
111 115
                         break;
112 116
                     case "profile-api:realm":
113
-                        if (isset($_POST['value'][$optindex."-0"]) && valid_Realm($_POST['value'][$optindex."-0"]))
114
-                                $therealm = $_POST['value'][$optindex."-0"];
117
+                        if (isset($_POST['value'][$optindex."-0"]) && valid_Realm($_POST['value'][$optindex."-0"])) {
118
+                                                        $therealm = $_POST['value'][$optindex."-0"];
119
+                        }
115 120
                         break;
116 121
                     case "profile-api:useanon":
117
-                        if (isset($_POST['value'][$optindex."-3"]) && valid_boolean($_POST['value'][$optindex."-3"]) == "on")
118
-                                $use_anon = TRUE;
122
+                        if (isset($_POST['value'][$optindex."-3"]) && valid_boolean($_POST['value'][$optindex."-3"]) == "on") {
123
+                                                        $use_anon = TRUE;
124
+                        }
119 125
                         break;
120 126
                     case "profile-api:eaptype":
121 127
                         $pref = 0;
Please login to merge, or discard this patch.
web/admin/112365365321.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     authenticate();
44 44
     $no_security = 0;
45 45
 } else {
46
-   $no_security = 1;
46
+    $no_security = 1;
47 47
 }
48 48
 $user = new User((!in_array("I do not care about security!", Config::$SUPERADMINS) ? $_SESSION['user'] : "UNIDENTIFIED"));
49 49
 
@@ -61,16 +61,16 @@  discard block
 block discarded – undo
61 61
             </legend>
62 62
 <?php
63 63
             if (isset($_POST['admin_action'])) {
64
-               if($_POST['admin_action'] == BUTTON_SANITY_TESTS)
64
+                if($_POST['admin_action'] == BUTTON_SANITY_TESTS)
65 65
                         include("sanity_tests.php");
66 66
             }
67 67
 ?>
68 68
 <button type="submit" name="admin_action" value="<?php echo BUTTON_SANITY_TESTS; ?>">Run configuration check</button>
69 69
 </fieldset>
70 70
 <?php if($no_security) {
71
-     print "<h2 style='color: red'>In order to do more you need to configure the SUPERADMIN section  in config/config.php and login as one.</h2>";
71
+        print "<h2 style='color: red'>In order to do more you need to configure the SUPERADMIN section  in config/config.php and login as one.</h2>";
72 72
 
73
-   } else {
73
+    } else {
74 74
 ?>
75 75
         <fieldset class="option_container">
76 76
             <legend>
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 if (!in_array($user->identifier, Config::$SUPERADMINS) && !in_array("I do not care about security!", Config::$SUPERADMINS))
51 51
     header("Location: overview_user.php");
52 52
 
53
-$cat = pageheader("By. Your. Command.","SUPERADMIN", FALSE); // no auth in pageheader; we did our own before
53
+$cat = pageheader("By. Your. Command.", "SUPERADMIN", FALSE); // no auth in pageheader; we did our own before
54 54
 
55 55
 ?>
56 56
     <h1>By. Your. Command.</h1>
@@ -61,13 +61,13 @@  discard block
 block discarded – undo
61 61
             </legend>
62 62
 <?php
63 63
             if (isset($_POST['admin_action'])) {
64
-               if($_POST['admin_action'] == BUTTON_SANITY_TESTS)
64
+               if ($_POST['admin_action'] == BUTTON_SANITY_TESTS)
65 65
                         include("sanity_tests.php");
66 66
             }
67 67
 ?>
68 68
 <button type="submit" name="admin_action" value="<?php echo BUTTON_SANITY_TESTS; ?>">Run configuration check</button>
69 69
 </fieldset>
70
-<?php if($no_security) {
70
+<?php if ($no_security) {
71 71
      print "<h2 style='color: red'>In order to do more you need to configure the SUPERADMIN section  in config/config.php and login as one.</h2>";
72 72
 
73 73
    } else {
Please login to merge, or discard this patch.
Braces   +14 added lines, -9 removed lines patch added patch discarded remove patch
@@ -47,8 +47,9 @@  discard block
 block discarded – undo
47 47
 }
48 48
 $user = new User((!in_array("I do not care about security!", Config::$SUPERADMINS) ? $_SESSION['user'] : "UNIDENTIFIED"));
49 49
 
50
-if (!in_array($user->identifier, Config::$SUPERADMINS) && !in_array("I do not care about security!", Config::$SUPERADMINS))
50
+if (!in_array($user->identifier, Config::$SUPERADMINS) && !in_array("I do not care about security!", Config::$SUPERADMINS)) {
51 51
     header("Location: overview_user.php");
52
+}
52 53
 
53 54
 $cat = pageheader("By. Your. Command.","SUPERADMIN", FALSE); // no auth in pageheader; we did our own before
54 55
 
@@ -61,8 +62,9 @@  discard block
 block discarded – undo
61 62
             </legend>
62 63
 <?php
63 64
             if (isset($_POST['admin_action'])) {
64
-               if($_POST['admin_action'] == BUTTON_SANITY_TESTS)
65
-                        include("sanity_tests.php");
65
+               if($_POST['admin_action'] == BUTTON_SANITY_TESTS) {
66
+                                       include("sanity_tests.php");
67
+               }
66 68
             }
67 69
 ?>
68 70
 <button type="submit" name="admin_action" value="<?php echo BUTTON_SANITY_TESTS; ?>">Run configuration check</button>
@@ -77,10 +79,11 @@  discard block
 block discarded – undo
77 79
                 <strong>Administrative actions</strong>
78 80
             </legend>
79 81
             <?php
80
-            if (isset($_POST['admin_action']))
81
-                switch ($_POST['admin_action']) {
82
+            if (isset($_POST['admin_action'])) {
83
+                            switch ($_POST['admin_action']) {
82 84
                     case BUTTON_PURGECACHE:
83 85
                         $result = DBConnection::exec("INST", "UPDATE downloads SET download_path = NULL");
86
+            }
84 87
                     // we do NOT break here - after the DB deletion comes the normal
85 88
                     // filesystem cleanup
86 89
                     case BUTTON_DELETE:
@@ -99,11 +102,13 @@  discard block
 block discarded – undo
99 102
 
100 103
                             /* This is the correct way to loop over the directory. */
101 104
                             while (false !== ($entry = readdir($handle))) {
102
-                                if ($entry === '.' || $entry === '..')
103
-                                    continue;
105
+                                if ($entry === '.' || $entry === '..') {
106
+                                                                    continue;
107
+                                }
104 108
                                 $ftime = $tm - filemtime($downloads . '/' . $entry);
105
-                                if ($ftime < 3600)
106
-                                    continue;
109
+                                if ($ftime < 3600) {
110
+                                                                    continue;
111
+                                }
107 112
                                 if (isset($Cache[$entry])) {
108 113
 //          print "Keep: $entry\n";
109 114
                                     continue;
Please login to merge, or discard this patch.
web/admin/inc/geo_widget.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -283,7 +283,7 @@
 block discarded – undo
283 283
     if ($wizard)
284 284
             echo "<p>".
285 285
             _("The user download interface (see <a href='../'>here</a>), uses geolocation to suggest possibly matching IdPs to the user. The more precise you define the location here, the easier your users will find you.").
286
-                 "</p>
286
+                    "</p>
287 287
                      <ul>".
288 288
                         _("<li>Drag the marker in the map to your place, or</li>
289 289
 <li>enter your street address in the field below for lookup, or</li>
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -71,19 +71,19 @@  discard block
 block discarded – undo
71 71
          *
72 72
          */
73 73
         function locator_magic() {
74
-            geocoder.geocode({'address':\"$inst_name\", 'region':\"".strtolower($inst_country)."\"},
74
+            geocoder.geocode({'address':\"$inst_name\", 'region':\"" . strtolower($inst_country) . "\"},
75 75
             function(r,status) {
76 76
                 if(status != google.maps.GeocoderStatus.OK) {
77
-                    locate_country(\"".Federation::$FederationList[strtoupper($inst_country)]."\");
77
+                    locate_country(\"".Federation::$FederationList[strtoupper($inst_country)] . "\");
78 78
                 } else {
79 79
                     var i;
80 80
                     for(i = 0; i < r.length; i++) {
81 81
                         Addr = getAddressElements(r[i].address_components);
82
-                        if(Addr.country == \"". strtoupper($inst_country)."\")
82
+                        if(Addr.country == \"". strtoupper($inst_country) . "\")
83 83
                         break;
84 84
                     }
85
-                    if(Addr.country != \"". strtoupper($inst_country)."\")
86
-                    locate_country(\"". Federation::$FederationList[strtoupper($inst_country)]."\");
85
+                    if(Addr.country != \"". strtoupper($inst_country) . "\")
86
+                    locate_country(\"". Federation::$FederationList[strtoupper($inst_country)] . "\");
87 87
                     else {
88 88
                         addMarker(r[i].geometry.location,15,null);
89 89
                     }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
          */
97 97
         function markerClicked(m) {
98 98
             info_window.close();
99
-            var t = \"". _("This is location ")."\"+m.info;
99
+            var t = \"". _("This is location ") . "\"+m.info;
100 100
             info_window.setContent(t);
101 101
             info_window.setPosition(m.getPosition());
102 102
             info_window.open(map,m);
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
         function getAddressLocation() {
176 176
             var city = $('#address').val();
177 177
             if(city == '') {
178
-                alert(\""._("nothing entered in the address field")."\");
178
+                alert(\""._("nothing entered in the address field") . "\");
179 179
                 return false;
180 180
             }
181 181
             geocoder.geocode( { 'address': city}, function(results, status) {
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
          * trigger geolocation
196 196
          */
197 197
         function locateMe() {
198
-            $('#address').val(\"". _("locating")."\");
198
+            $('#address').val(\"". _("locating") . "\");
199 199
             navigator.geolocation.getCurrentPosition(locate_succes,locate_fail,{maximumAge:3600000, timeout:5000});
200 200
         }
201 201
 
@@ -278,19 +278,19 @@  discard block
 block discarded – undo
278 278
 
279 279
 function geo_widget_body($wizard, $additional) {
280 280
     echo "<fieldset class='option_container'>
281
-        <legend><strong>". _("Location")."</strong></legend>";
281
+        <legend><strong>". _("Location") . "</strong></legend>";
282 282
 
283 283
     if ($wizard)
284
-            echo "<p>".
285
-            _("The user download interface (see <a href='../'>here</a>), uses geolocation to suggest possibly matching IdPs to the user. The more precise you define the location here, the easier your users will find you.").
284
+            echo "<p>" .
285
+            _("The user download interface (see <a href='../'>here</a>), uses geolocation to suggest possibly matching IdPs to the user. The more precise you define the location here, the easier your users will find you.") .
286 286
                  "</p>
287 287
                      <ul>".
288 288
                         _("<li>Drag the marker in the map to your place, or</li>
289 289
 <li>enter your street address in the field below for lookup, or</li>
290
-<li>use the 'Locate Me!' button</li>").
290
+<li>use the 'Locate Me!' button</li>") .
291 291
                     "</ul>
292 292
                      <strong>".
293
-                    _("We will use the coordinates as indicated by the marker for geolocation.").
293
+                    _("We will use the coordinates as indicated by the marker for geolocation.") .
294 294
                     "</strong>";
295 295
         if ($additional) {
296 296
             echo _("You can enter an <strong>additional</strong> location here. You can see the already defined locations in the 'General Information' field.");
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -280,8 +280,8 @@  discard block
 block discarded – undo
280 280
     echo "<fieldset class='option_container'>
281 281
         <legend><strong>". _("Location")."</strong></legend>";
282 282
 
283
-    if ($wizard)
284
-            echo "<p>".
283
+    if ($wizard) {
284
+                echo "<p>".
285 285
             _("The user download interface (see <a href='../'>here</a>), uses geolocation to suggest possibly matching IdPs to the user. The more precise you define the location here, the easier your users will find you.").
286 286
                  "</p>
287 287
                      <ul>".
@@ -292,6 +292,7 @@  discard block
 block discarded – undo
292 292
                      <strong>".
293 293
                     _("We will use the coordinates as indicated by the marker for geolocation.").
294 294
                     "</strong>";
295
+    }
295 296
         if ($additional) {
296 297
             echo _("You can enter an <strong>additional</strong> location here. You can see the already defined locations in the 'General Information' field.");
297 298
         }
Please login to merge, or discard this patch.