Completed
Branch master (03ec64)
by Brook
14:43
created
web/admin/inc/option_parse.inc.php 1 patch
Braces   +76 added lines, -58 removed lines patch added patch discarded remove patch
@@ -29,16 +29,19 @@  discard block
 block discarded – undo
29 29
 // Step 1a: parse the arrays for text-based input
30 30
 
31 31
     if (isset($_POST)) {
32
-        if (isset($_POST['option']))
33
-            foreach ($_POST['option'] as $opt_id => $optname)
32
+        if (isset($_POST['option'])) {
33
+                    foreach ($_POST['option'] as $opt_id => $optname)
34 34
                 $a[$opt_id] = $optname;
35
-        if (isset($_POST['value']))
36
-            foreach ($_POST['value'] as $opt_id => $optvalue)
35
+        }
36
+        if (isset($_POST['value'])) {
37
+                    foreach ($_POST['value'] as $opt_id => $optvalue)
37 38
                 $a[$opt_id] = $optvalue;
39
+        }
38 40
     }
39
-    if (isset($_FILES) && isset($_FILES['value']) && isset($_FILES['value']['tmp_name']))
40
-        foreach ($_FILES['value']['tmp_name'] as $opt_id => $optfileref)
41
+    if (isset($_FILES) && isset($_FILES['value']) && isset($_FILES['value']['tmp_name'])) {
42
+            foreach ($_FILES['value']['tmp_name'] as $opt_id => $optfileref)
41 43
             $a[$opt_id] = $optfileref;
44
+    }
42 45
 
43 46
     /*    ksort($a);
44 47
       echo "<pre>This is what we got:";
@@ -61,29 +64,33 @@  discard block
 block discarded – undo
61 64
             if ($optioninfo["flag"] == "ML") {
62 65
                 if (isset($a["$obj_id-lang"])) {
63 66
                     $raw_lang = $a["$obj_id-lang"];
64
-                    if ($raw_lang == "") // user forgot to select a language
67
+                    if ($raw_lang == "") {
68
+                        // user forgot to select a language
65 69
                         $lang = "C";
66
-                    else
67
-                        $lang = $raw_lang;
68
-                }
69
-                else {
70
+                    } else {
71
+                                            $lang = $raw_lang;
72
+                    }
73
+                } else {
70 74
                     $bad[] = $obj_value;
71 75
                     continue;
72 76
                 }
73 77
                 // did we get a C language? set corresponding value to TRUE
74
-                if ($lang == "C")
75
-                    $multilang_attribs_with_C[$obj_value] = TRUE;
76
-                else // did we get a C earlier - fine, don't touch the array. Otherwise, set FALSE
77
-                if (!isset($multilang_attribs_with_C[$obj_value]) || $multilang_attribs_with_C[$obj_value] != TRUE)
78
-                    $multilang_attribs_with_C[$obj_value] = FALSE;
79
-            } else
80
-                $lang = "";
78
+                if ($lang == "C") {
79
+                                    $multilang_attribs_with_C[$obj_value] = TRUE;
80
+                } else // did we get a C earlier - fine, don't touch the array. Otherwise, set FALSE
81
+                if (!isset($multilang_attribs_with_C[$obj_value]) || $multilang_attribs_with_C[$obj_value] != TRUE) {
82
+                                    $multilang_attribs_with_C[$obj_value] = FALSE;
83
+                }
84
+            } else {
85
+                            $lang = "";
86
+            }
81 87
             $content = "";
82 88
             switch ($optioninfo["type"]) {
83 89
                 case "string":
84
-                    if (isset($a["$obj_id-0"]) && $a["$obj_id-0"] != "")
85
-                        if ($obj_value == "media:consortium_OI") {
90
+                    if (isset($a["$obj_id-0"]) && $a["$obj_id-0"] != "") {
91
+                                            if ($obj_value == "media:consortium_OI") {
86 92
                             $content = valid_consortium_oi($a["$obj_id-0"]);
93
+                    }
87 94
                             if ($content === FALSE) {
88 95
                                 $bad[] = $obj_value;
89 96
                                 continue 2;
@@ -94,25 +101,23 @@  discard block
 block discarded – undo
94 101
                                 $bad[] = $obj_value;
95 102
                                 continue 2;
96 103
                             }
97
-                        }
98
-                            else {
104
+                        } else {
99 105
                             $content = valid_string_db($a["$obj_id-0"]);
100
-                        }
101
-                    else {
106
+                        } else {
102 107
                         continue 2;
103 108
                     }
104 109
                     break;
105 110
                 case "text":
106
-                    if (isset($a["$obj_id-1"]) && $a["$obj_id-1"] != "")
107
-                        $content = valid_string_db($a["$obj_id-1"], 1);
108
-                    else {
111
+                    if (isset($a["$obj_id-1"]) && $a["$obj_id-1"] != "") {
112
+                                            $content = valid_string_db($a["$obj_id-1"], 1);
113
+                    } else {
109 114
                         continue 2;
110 115
                     }
111 116
                     break;
112 117
                 case "coordinates":
113
-                    if (isset($a["$obj_id-1"]) && $a["$obj_id-1"] != "")
114
-                        $content = valid_coord_serialized($a["$obj_id-1"]);
115
-                    else {
118
+                    if (isset($a["$obj_id-1"]) && $a["$obj_id-1"] != "") {
119
+                                            $content = valid_coord_serialized($a["$obj_id-1"]);
120
+                    } else {
116 121
                         continue 2;
117 122
                     }
118 123
                     break;
@@ -129,13 +134,14 @@  discard block
 block discarded – undo
129 134
                             continue 2;
130 135
                         }
131 136
                         $content = base64_encode($content);
132
-                    } else
133
-                        continue 2;
137
+                    } else {
138
+                                            continue 2;
139
+                    }
134 140
                     break;
135 141
                 case "boolean":
136
-                    if (isset($a["$obj_id-3"]) && $a["$obj_id-3"] != "")
137
-                        $content = valid_boolean($a["$obj_id-3"]);
138
-                    else {
142
+                    if (isset($a["$obj_id-3"]) && $a["$obj_id-3"] != "") {
143
+                                            $content = valid_boolean($a["$obj_id-3"]);
144
+                    } else {
139 145
                         continue 2;
140 146
                     }
141 147
                     break;
@@ -146,15 +152,18 @@  discard block
 block discarded – undo
146 152
             if ($lang != "" && preg_match("/^ROWID-.*-([0-9]+)/", $content) == 0) { // new value, encode as language array
147 153
                 // add the new option with lang 
148 154
                 $options[] = ["$obj_value" => serialize(["lang" => $lang, "content" => $content])];
149
-            } else // just store it (could be a literal value or a ROWID reference)
155
+            } else {
156
+                // just store it (could be a literal value or a ROWID reference)
150 157
                 $options[] = ["$obj_value" => $content];
158
+            }
151 159
         }
152 160
     }
153 161
 
154
-    foreach ($options as $option)
155
-        foreach ($option as $optname => $optvalue)
162
+    foreach ($options as $option) {
163
+            foreach ($option as $optname => $optvalue)
156 164
             if ($optname != "eap:ca_url" && $optname != "general:logo_url")
157 165
                 $good[] = $optname;
166
+    }
158 167
 
159 168
     /*
160 169
       echo "<pre>";
@@ -165,10 +174,11 @@  discard block
 block discarded – undo
165 174
 // Step 2: now we have clean input data. Some attributes need special care
166 175
 //         2a: if we got eap:ca_url, convert it to eap:ca_file
167 176
 
168
-    foreach ($options as $k => $iterate_option)
169
-        foreach ($iterate_option as $name => $value) {
177
+    foreach ($options as $k => $iterate_option) {
178
+            foreach ($iterate_option as $name => $value) {
170 179
             if ($name == "eap:ca_url" && $value != "") {
171 180
                 $content = downloadFile($value);
181
+    }
172 182
                 unset($options[$k]);
173 183
                 if (check_upload_sanity("eap:ca_file", $content)) {
174 184
                     $content = base64_encode($content);
@@ -181,10 +191,11 @@  discard block
 block discarded – undo
181 191
         }
182 192
 
183 193
 //       2aa: spliteap:ca_file into components
184
-    foreach ($options as $k => $iterate_option)
185
-        foreach ($iterate_option as $name => $value) {
194
+    foreach ($options as $k => $iterate_option) {
195
+            foreach ($iterate_option as $name => $value) {
186 196
             if ($name == "eap:ca_file" && $value != "" && !preg_match('/^ROWID-/', $value)) {
187 197
                 $content = base64_decode($value);
198
+    }
188 199
                 unset($options[$k]);
189 200
                 $ca_files = X509::splitCertificate($content);
190 201
                 foreach ($ca_files as $ca_file) {
@@ -194,17 +205,19 @@  discard block
 block discarded – undo
194 205
         }
195 206
 
196 207
 //          2b:if we got general:logo_url, convert it to general:logo_file
197
-    foreach ($options as $k => $iterate_option)
198
-        foreach ($iterate_option as $name => $value) {
208
+    foreach ($options as $k => $iterate_option) {
209
+            foreach ($iterate_option as $name => $value) {
199 210
             if ($name == "general:logo_url" && $value != "") {
200 211
                 $bindata = downloadFile($value);
212
+    }
201 213
                 unset($options[$k]);
202 214
                 if (check_upload_sanity("general:logo_file", $bindata)) {
203 215
                     $good[] = "general:logo_url";
204 216
 
205 217
                     $options[] = ["general:logo_file" => base64_encode($bindata)];
206
-                } else
207
-                    $bad[] = "general:logo_url";
218
+                } else {
219
+                                    $bad[] = "general:logo_url";
220
+                }
208 221
             }
209 222
         }
210 223
 
@@ -227,9 +240,10 @@  discard block
 block discarded – undo
227 240
 // finally, some attributes are in the DB and were only called by reference
228 241
 // keep those which are still referenced, throw the rest away
229 242
 
230
-    foreach ($options as $iterate_option)
231
-        foreach ($iterate_option as $name => $value) {
243
+    foreach ($options as $iterate_option) {
244
+            foreach ($iterate_option as $name => $value) {
232 245
             $optiontype = $optioninfo_object->optionType($name);
246
+    }
233 247
             if ($optiontype["type"] == "file" && preg_match("/^ROWID-.*-([0-9]+)/", $value, $retval)) {
234 248
                 unset($killlist[$retval[1]]);
235 249
                 continue;
@@ -237,10 +251,11 @@  discard block
 block discarded – undo
237 251
             if ($object instanceof IdP || $object instanceof User || $object instanceof Federation) {
238 252
                 $object->addAttribute($name, $value);
239 253
             } elseif ($object instanceof Profile) {
240
-                if ($device === 0)
241
-                    $object->addAttribute($name, $value, $eaptype);
242
-                else
243
-                    $object->addAttribute($name, $value, $eaptype, $device);
254
+                if ($device === 0) {
255
+                                    $object->addAttribute($name, $value, $eaptype);
256
+                } else {
257
+                                    $object->addAttribute($name, $value, $eaptype, $device);
258
+                }
244 259
             }
245 260
         }
246 261
 
@@ -248,18 +263,21 @@  discard block
 block discarded – undo
248 263
         // don't do your own table - only the <tr>s here
249 264
         // list all attributes that were set correctly
250 265
         $list = array_count_values($good);
251
-        foreach ($list as $name => $count)
252
-        /// number of times attribute is present, and its name
266
+        foreach ($list as $name => $count) {
267
+                /// number of times attribute is present, and its name
253 268
         /// Example: "5x Support E-Mail"
254 269
             echo UI_okay(sprintf(_("%dx %s"), $count, display_name($name)));
270
+        }
255 271
         // list all atributes that had errors
256 272
         $list = array_count_values($bad);
257
-        foreach ($list as $name => $count)
258
-            echo UI_error(sprintf(_("%dx %s"), $count, display_name($name)));
273
+        foreach ($list as $name => $count) {
274
+                    echo UI_error(sprintf(_("%dx %s"), $count, display_name($name)));
275
+        }
259 276
         // list multilang without default
260
-        foreach ($multilang_attribs_with_C as $attrib_name => $isitsetornot)
261
-            if ($isitsetornot == FALSE)
277
+        foreach ($multilang_attribs_with_C as $attrib_name => $isitsetornot) {
278
+                    if ($isitsetornot == FALSE)
262 279
                 echo UI_warning(sprintf(_("You did not set a 'default language' value for %s. This means we can only display this string for installers which are <strong>exactly</strong> in the language you configured. For the sake of all other languages, you may want to edit the profile again and populate the 'default/other' language field."), display_name($attrib_name)));
280
+        }
263 281
     }
264 282
     return $killlist;
265 283
 }
Please login to merge, or discard this patch.
web/admin/inc/manageDBLink.inc.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 
26 26
 // if we have a pushed close button, submit attributes and send user back to the overview page
27 27
 // if external DB sync is disabled globally, the user never gets to this page. If he came here *anyway* -> send him back immediately.
28
-if ((isset($_POST['submitbutton']) && $_POST['submitbutton'] == BUTTON_CLOSE ) || Config::$DB['enforce-external-sync'] == FALSE)
28
+if ((isset($_POST['submitbutton']) && $_POST['submitbutton'] == BUTTON_CLOSE) || Config::$DB['enforce-external-sync'] == FALSE)
29 29
     header("Location: ../overview_federation.php");
30 30
 
31 31
 // if not, must operate on a proper IdP
Please login to merge, or discard this patch.
Braces   +34 added lines, -23 removed lines patch added patch discarded remove patch
@@ -25,8 +25,9 @@  discard block
 block discarded – undo
25 25
 
26 26
 // if we have a pushed close button, submit attributes and send user back to the overview page
27 27
 // if external DB sync is disabled globally, the user never gets to this page. If he came here *anyway* -> send him back immediately.
28
-if ((isset($_POST['submitbutton']) && $_POST['submitbutton'] == BUTTON_CLOSE ) || Config::$DB['enforce-external-sync'] == FALSE)
28
+if ((isset($_POST['submitbutton']) && $_POST['submitbutton'] == BUTTON_CLOSE ) || Config::$DB['enforce-external-sync'] == FALSE) {
29 29
     header("Location: ../overview_federation.php");
30
+}
30 31
 
31 32
 // if not, must operate on a proper IdP
32 33
 $my_inst = valid_IdP($_GET['inst_id']);
@@ -48,8 +49,9 @@  discard block
 block discarded – undo
48 49
 
49 50
 if (isset($_POST['submitbutton']) && $_POST['submitbutton'] == BUTTON_SAVE) {
50 51
     // someone clever pushed the button without selecting an inst?
51
-    if (!isset($_POST['inst_link']))
52
-        header("Location: ../overview_federation.php");
52
+    if (!isset($_POST['inst_link'])) {
53
+            header("Location: ../overview_federation.php");
54
+    }
53 55
     // okay, he did sumbit an inst. It's either a (string) handle from a promising 
54 56
     // candidate, or "other" as selected from the drop-down list
55 57
     if ($_POST['inst_link'] != "other") {
@@ -78,10 +80,11 @@  discard block
 block discarded – undo
78 80
 
79 81
         foreach ($names as $name) {
80 82
             $thename = unserialize($name['value']);
81
-            if ($thename['lang'] == "C")
82
-                $language = "default/other";
83
-            else
84
-                $language = Config::$LANGUAGES[$thename['lang']]['display'];
83
+            if ($thename['lang'] == "C") {
84
+                            $language = "default/other";
85
+            } else {
86
+                            $language = Config::$LANGUAGES[$thename['lang']]['display'];
87
+            }
85 88
 
86 89
             echo "<tr><td>" . sprintf(_("Institution Name (%s)"), $language) . "</td><td>" . $thename['content'] . "</td></tr>";
87 90
         }
@@ -91,8 +94,9 @@  discard block
 block discarded – undo
91 94
         foreach ($admins as $admin) {
92 95
             $user = new User($admin['ID']);
93 96
             $username = $user->getAttributes("user:realname");
94
-            if (count($username) == 0)
95
-                $username[0]['value'] = _("Unnamed User");
97
+            if (count($username) == 0) {
98
+                            $username[0]['value'] = _("Unnamed User");
99
+            }
96 100
             echo "<tr><td>" . _("Administrator [invited as]") . "</td><td>" . $username[0]['value'] . " [" . $admin['MAIL'] . "]</td></tr>";
97 101
         }
98 102
         echo "</table>";
@@ -101,10 +105,12 @@  discard block
 block discarded – undo
101 105
         // right-hand side: external DB
102 106
         $extinfo = $my_inst->getExternalDBEntityDetails();
103 107
         echo "<table>";
104
-        foreach ($extinfo['names'] as $lang => $name)
105
-            echo "<tr><td>" . sprintf(_("Institution Name (%s)"), $lang) . "</td><td>$name</td>";
106
-        foreach ($extinfo['admins'] as $number => $admin_details)
107
-            echo "<tr><td>" . _("Administrator email") . "</td><td>" . $admin_details['email'] . "</td></tr>";
108
+        foreach ($extinfo['names'] as $lang => $name) {
109
+                    echo "<tr><td>" . sprintf(_("Institution Name (%s)"), $lang) . "</td><td>$name</td>";
110
+        }
111
+        foreach ($extinfo['admins'] as $number => $admin_details) {
112
+                    echo "<tr><td>" . _("Administrator email") . "</td><td>" . $admin_details['email'] . "</td></tr>";
113
+        }
108 114
         echo "</table>";
109 115
         // end of right-hand side
110 116
         echo "</td></tr></table>";
@@ -116,17 +122,20 @@  discard block
 block discarded – undo
116 122
         $candidates = $my_inst->getExternalDBSyncCandidates();
117 123
         echo "<br/><form name='form-link-inst' action='inc/manageDBLink.inc.php?inst_id=$my_inst->identifier' method='post' accept-charset='UTF-8'>";
118 124
         printf(_("Please select an entity from the %s DB which corresponds to this CAT institution."), Config::$CONSORTIUM['name']) . " ";
119
-        if (count($candidates) > 0)
120
-            printf(_("Particularly promising entries (names in CAT and %s DB are a 100%% match) are on top of the list."), Config::$CONSORTIUM['name']);
125
+        if (count($candidates) > 0) {
126
+                    printf(_("Particularly promising entries (names in CAT and %s DB are a 100%% match) are on top of the list."), Config::$CONSORTIUM['name']);
127
+        }
121 128
         echo "<table><tr><th>" . _("Link to this entity?") . "</th><th>" . _("Name of the institution") . "</th><th>" . _("Administrators") . "</th></tr>";
122 129
         foreach ($candidates as $candidate) {
123 130
             $info = Federation::getExternalDBEntityDetails($candidate);
124 131
             echo "<tr><td><input type='radio' name='inst_link' value='$candidate' onclick='document.getElementById(\"submit\").disabled = false;'>$candidate</input></td><td>";
125
-            foreach ($info['names'] as $lang => $name)
126
-                echo "[$lang] $name<br/>";
132
+            foreach ($info['names'] as $lang => $name) {
133
+                            echo "[$lang] $name<br/>";
134
+            }
127 135
             echo "</td><td>";
128
-            foreach ($info['admins'] as $number => $admin_details)
129
-                echo "[E-Mail] " . $admin_details['email'] . "<br/>";
136
+            foreach ($info['admins'] as $number => $admin_details) {
137
+                            echo "[E-Mail] " . $admin_details['email'] . "<br/>";
138
+            }
130 139
             echo "</td></tr>";
131 140
             $temparray[] = $candidate;
132 141
         }
@@ -147,8 +156,9 @@  discard block
 block discarded – undo
147 156
             echo "</select></td></tr>";
148 157
         }
149 158
         // issue a big red warning if there are no link candidates at all in the federation
150
-        if (empty($buffer) && empty($candidates))
151
-            echo "<tr><td style='color:#ff0000' colspan='2'>There are no unmapped institutions in the external database for this federation!</td></tr>";
159
+        if (empty($buffer) && empty($candidates)) {
160
+                    echo "<tr><td style='color:#ff0000' colspan='2'>There are no unmapped institutions in the external database for this federation!</td></tr>";
161
+        }
152 162
         echo "</table><button type='submit' name='submitbutton' id='submit' value='" . BUTTON_SAVE . "' disabled >" . _("Create Link") . "</button></form>";
153 163
     }
154 164
     ?>
@@ -160,8 +170,9 @@  discard block
 block discarded – undo
160 170
 if (count($pending_invites) > 0) {
161 171
     echo "<strong>" . _("Pending invitations for this IdP") . "</strong>";
162 172
     echo "<table>";
163
-    foreach ($pending_invites as $invitee)
164
-        echo "<tr><td>$invitee</td></tr>";
173
+    foreach ($pending_invites as $invitee) {
174
+            echo "<tr><td>$invitee</td></tr>";
175
+    }
165 176
     echo "</table>";
166 177
 }
167 178
 ?>
Please login to merge, or discard this patch.
web/admin/inc/auth.inc.php 1 patch
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -59,10 +59,11 @@
 block discarded – undo
59 59
 
60 60
     $url = $_SERVER['HTTP_HOST'] . substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], "/inc/logout.php")) . "/logout_check.php";
61 61
 
62
-    if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on")
63
-        $url = "https://" . $url;
64
-    else
65
-        $url = "http://" . $url;
62
+    if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") {
63
+            $url = "https://" . $url;
64
+    } else {
65
+            $url = "http://" . $url;
66
+    }
66 67
 
67 68
     $as->logout([
68 69
         'ReturnTo' => $url,
Please login to merge, or discard this patch.
web/admin/inc/sendinvite.inc.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -140,7 +140,7 @@
 block discarded – undo
140 140
         $message .= wordwrap(_("Additional message from your federation administrator:"),72) . "
141 141
 ---------------------------------
142 142
 "
143
-                  . wordwrap($customtext[0]['value'],72) . "
143
+                    . wordwrap($customtext[0]['value'],72) . "
144 144
 ---------------------------------
145 145
 
146 146
 ";
Please login to merge, or discard this patch.
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -130,17 +130,17 @@  discard block
 block discarded – undo
130 130
 // then, send out the mail
131 131
 $message = _("Hello,") . "
132 132
     
133
-" . wordwrap($introtext, 72)  . "
133
+" . wordwrap($introtext, 72) . "
134 134
     
135 135
 ";
136 136
 
137 137
 if ($new_idp_authorized_fedadmin) { // see if we are supposed to add a custom message
138 138
     $customtext = $federation->getAttributes('fed:custominvite');
139 139
     if (count($customtext) > 0)
140
-        $message .= wordwrap(_("Additional message from your federation administrator:"),72) . "
140
+        $message .= wordwrap(_("Additional message from your federation administrator:"), 72) . "
141 141
 ---------------------------------
142 142
 "
143
-                  . wordwrap($customtext[0]['value'],72) . "
143
+                  . wordwrap($customtext[0]['value'], 72) . "
144 144
 ---------------------------------
145 145
 
146 146
 ";
@@ -158,8 +158,7 @@  discard block
 block discarded – undo
158 158
         _("and enter the invitation token") . "
159 159
     $newtoken
160 160
 " . ( /* $new_idp_authorized_fedadmin */ FALSE ?
161
-                wordwrap(_("manually. If you reply to this mail, you will reach the federation administrators of your federation."), 72) :
162
-                wordwrap(_("manually. Please do not reply to this mail; this is a send-only address.")) ) . "
161
+                wordwrap(_("manually. If you reply to this mail, you will reach the federation administrators of your federation."), 72) : wordwrap(_("manually. Please do not reply to this mail; this is a send-only address.")) ) . "
163 162
 
164 163
 " . wordwrap(_("Do NOT forward the mail before the token has expired - or the recipients may be able to consume the token on your behalf!"), 72) . "
165 164
 
Please login to merge, or discard this patch.
Braces   +31 added lines, -19 removed lines patch added patch discarded remove patch
@@ -24,8 +24,9 @@  discard block
 block discarded – undo
24 24
     $fed_privs = $user_object->getAttributes("user:fedadmin");
25 25
     // a new IdP was requested and all the required parameters are there
26 26
         foreach ($fed_privs as $onefed) {
27
-            if (strtolower($onefed['value']) == strtolower($country))
28
-                return TRUE;
27
+            if (strtolower($onefed['value']) == strtolower($country)) {
28
+                            return TRUE;
29
+            }
29 30
         }
30 31
         echo "<p>" . _("Something's wrong... you want to create a new institution, but are not a federation admin for the federation it should be in!") . "</p>";
31 32
         exit(1);
@@ -40,8 +41,9 @@  discard block
 block discarded – undo
40 41
 $new_idp_authorized_fedadmin = FALSE;
41 42
 
42 43
 // check if the user is authenticated, and we have a valid mail address
43
-if (!isset($_SESSION['user']) || !isset($_POST['mailaddr']))
44
+if (!isset($_SESSION['user']) || !isset($_POST['mailaddr'])) {
44 45
     exit(1);
46
+}
45 47
 
46 48
 $newmailaddress = valid_string_db($_POST['mailaddr']);
47 49
 $newcountry = "";
@@ -58,8 +60,9 @@  discard block
 block discarded – undo
58 60
     $is_owner = FALSE;
59 61
     $owners = $idp->owner();
60 62
     foreach ($owners as $oneowner) {
61
-        if ($oneowner['ID'] == $_SESSION['user'] && $oneowner['LEVEL'] == "FED")
62
-            $is_owner = TRUE;
63
+        if ($oneowner['ID'] == $_SESSION['user'] && $oneowner['LEVEL'] == "FED") {
64
+                    $is_owner = TRUE;
65
+        }
63 66
     }
64 67
     // check if he is (also) federation admin for the federation this IdP is in. His invitations have more blessing then.
65 68
     $fedadmin = $user_object->isFederationAdmin($idp->federation);
@@ -99,14 +102,17 @@  discard block
 block discarded – undo
99 102
         // see if the inst name is defined in the currently set language; if not, pick its English name; if N/A, pick the last in the list
100 103
         $ourlang = CAT::get_lang();
101 104
         $prettyprintname = "";
102
-        foreach ($extinfo['names'] as $lang => $name)
103
-            if ($lang == $ourlang)
105
+        foreach ($extinfo['names'] as $lang => $name) {
106
+                    if ($lang == $ourlang)
104 107
                 $prettyprintname = $name;
105
-        if ($prettyprintname == "" && isset($extinfo['names']['en']))
106
-            $prettyprintname = $extinfo['names']['en'];
107
-        if ($prettyprintname == "")
108
-            foreach ($extinfo['names'] as $name)
108
+        }
109
+        if ($prettyprintname == "" && isset($extinfo['names']['en'])) {
110
+                    $prettyprintname = $extinfo['names']['en'];
111
+        }
112
+        if ($prettyprintname == "") {
113
+                    foreach ($extinfo['names'] as $name)
109 114
                 $prettyprintname = $name;
115
+        }
110 116
         // fill the rest of the text
111 117
         $introtext = sprintf(_("a %s operator has invited you to manage the IdP  \"%s\"."), Config::$CONSORTIUM['name'], $prettyprintname) . " " . sprintf(_("This invitation is valid for 24 hours from now, i.e. until %s."), strftime("%x %X", time() + 86400));
112 118
         $redirect_destination = "../overview_federation.php?";
@@ -124,8 +130,9 @@  discard block
 block discarded – undo
124 130
 }
125 131
 // are we on https?
126 132
 $proto = "http://";
127
-if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on")
133
+if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") {
128 134
     $proto = "https://";
135
+}
129 136
 
130 137
 // then, send out the mail
131 138
 $message = _("Hello,") . "
@@ -136,15 +143,16 @@  discard block
 block discarded – undo
136 143
 
137 144
 if ($new_idp_authorized_fedadmin) { // see if we are supposed to add a custom message
138 145
     $customtext = $federation->getAttributes('fed:custominvite');
139
-    if (count($customtext) > 0)
140
-        $message .= wordwrap(_("Additional message from your federation administrator:"),72) . "
146
+    if (count($customtext) > 0) {
147
+            $message .= wordwrap(_("Additional message from your federation administrator:"),72) . "
141 148
 ---------------------------------
142 149
 "
143 150
                   . wordwrap($customtext[0]['value'],72) . "
144 151
 ---------------------------------
145 152
 
146 153
 ";
147
-}
154
+    }
155
+    }
148 156
 
149 157
 $message .= wordwrap(_("To enlist as an administrator for that IdP, please click on the following link:"), 72) . "
150 158
     
@@ -192,8 +200,9 @@  discard block
 block discarded – undo
192 200
         // $mail->addReplyTo($fedadmin->getAttributes("user:email")['value'], $fedadmin->getAttributes("user:realname")['value']);
193 201
     }
194 202
 }
195
-if (isset(Config::$APPEARANCE['invitation-bcc-mail']) && Config::$APPEARANCE['invitation-bcc-mail'] !== NULL)
203
+if (isset(Config::$APPEARANCE['invitation-bcc-mail']) && Config::$APPEARANCE['invitation-bcc-mail'] !== NULL) {
196 204
     $mail->addBCC(Config::$APPEARANCE['invitation-bcc-mail']);
205
+}
197 206
 
198 207
 // all addresses are wrapped in a string, but PHPMailer needs a structured list of addressees
199 208
 // sigh... so convert as needed
@@ -201,21 +210,24 @@  discard block
 block discarded – undo
201 210
 $recipients = explode(", ", $newmailaddress);
202 211
 
203 212
 // fill the destinations in PHPMailer API
204
-foreach ($recipients as $recipient)
213
+foreach ($recipients as $recipient) {
205 214
     $mail->addAddress($recipient);
215
+}
206 216
 
207 217
 // what do we want to say?
208 218
 $mail->Subject = sprintf(_("%s: you have been invited to manage an IdP"), Config::$APPEARANCE['productname']);
209 219
 $mail->Body = $message;
210 220
 
211
-if (isset(Config::$CONSORTIUM['certfilename'], Config::$CONSORTIUM['keyfilename'], Config::$CONSORTIUM['keypass']))
221
+if (isset(Config::$CONSORTIUM['certfilename'], Config::$CONSORTIUM['keyfilename'], Config::$CONSORTIUM['keypass'])) {
212 222
     $mail->sign(Config::$CONSORTIUM['certfilename'], Config::$CONSORTIUM['keyfilename'], Config::$CONSORTIUM['keypass']);
223
+}
213 224
 
214 225
 $sent = $mail->send();
215 226
 
216 227
 // invalidate the token immediately if the mail could not be sent!
217
-if (!$sent)
228
+if (!$sent) {
218 229
     $mgmt->invalidateToken($newtoken);
230
+}
219 231
 $status = ($sent ? "SUCCESS" : "FAILURE");
220 232
 header("Location: $redirect_destination" . "invitation=$status");
221 233
 ?>
Please login to merge, or discard this patch.
web/admin/inc/option_xhr.inc.php 2 patches
Switch Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -25,33 +25,33 @@
 block discarded – undo
25 25
     $list = $optioninfo->availableOptions($_GET["class"]);
26 26
 
27 27
     switch ($_GET['class']) {
28
-    case "general":
29
-        $blacklist_item = array_search("general:geo_coordinates", $list);
30
-        if ($blacklist_item !== FALSE) {
31
-            unset($list[$blacklist_item]);
32
-            $list = array_values($list);
33
-        }
34
-        break;
35
-    case "user":
36
-        $blacklist_item = array_search("user:fedadmin", $list);
37
-        if ($blacklist_item !== FALSE) {
38
-            unset($list[$blacklist_item]);
39
-            $list = array_values($list);
40
-        }
41
-        break;
42
-    case "eap":
43
-    case "support":
44
-    case "profile":
45
-    case "media":
46
-    case "fed":
47
-            $list = array_values($list);
48
-        break;
49
-    case "device-specific":
50
-    case "eap-specific":
51
-        break;
52
-    default:
53
-        debug(1,"Unknown type of option!");
54
-        exit(1);
28
+        case "general":
29
+            $blacklist_item = array_search("general:geo_coordinates", $list);
30
+            if ($blacklist_item !== FALSE) {
31
+                unset($list[$blacklist_item]);
32
+                $list = array_values($list);
33
+            }
34
+            break;
35
+        case "user":
36
+            $blacklist_item = array_search("user:fedadmin", $list);
37
+            if ($blacklist_item !== FALSE) {
38
+                unset($list[$blacklist_item]);
39
+                $list = array_values($list);
40
+            }
41
+            break;
42
+        case "eap":
43
+        case "support":
44
+        case "profile":
45
+        case "media":
46
+        case "fed":
47
+                $list = array_values($list);
48
+            break;
49
+        case "device-specific":
50
+        case "eap-specific":
51
+            break;
52
+        default:
53
+            debug(1,"Unknown type of option!");
54
+            exit(1);
55 55
     }
56 56
     // echo "<pre>".print_r($list)."</pre>";
57 57
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
     case "eap-specific":
51 51
         break;
52 52
     default:
53
-        debug(1,"Unknown type of option!");
53
+        debug(1, "Unknown type of option!");
54 54
         exit(1);
55 55
     }
56 56
     // echo "<pre>".print_r($list)."</pre>";
Please login to merge, or discard this patch.
web/admin/inc/filepreview.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,24 +26,28 @@
 block discarded – undo
26 26
     // shouldn't throw E_NOTICE
27 27
     if (@unserialize($blob) !== FALSE) { // an array? must be lang-tagged content
28 28
         $blob = unserialize($blob);
29
-        if (!isset($blob['content']))
30
-            return;
29
+        if (!isset($blob['content'])) {
30
+                    return;
31
+        }
31 32
         $blob = base64_decode($blob['content']);
32 33
     } else {
33 34
         $blob = base64_decode($blob);
34 35
     }
35 36
 
36
-    if ($blob === FALSE)
37
-        return;
37
+    if ($blob === FALSE) {
38
+            return;
39
+    }
38 40
 
39 41
     // Set data type and caching for 30 days
40 42
     $info = new finfo();
41 43
     $filetype = $info->buffer($blob, FILEINFO_MIME_TYPE);
42 44
     header("Content-type: " . $filetype);
43
-    if ($filetype == "text/rtf" || $filetype == "application/rtf")
44
-        header("Content-Disposition: attachment; filename='download.rtf'");
45
-    if ($filetype == "text/plain")
46
-        header("Content-Disposition: attachment; filename='download.txt'");
45
+    if ($filetype == "text/rtf" || $filetype == "application/rtf") {
46
+            header("Content-Disposition: attachment; filename='download.rtf'");
47
+    }
48
+    if ($filetype == "text/plain") {
49
+            header("Content-Disposition: attachment; filename='download.txt'");
50
+    }
47 51
     header("Cache-Control: must-revalidate");
48 52
     $offset = 60 * 60 * 24 * 30;
49 53
     $ExpStr = "Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT";
Please login to merge, or discard this patch.
web/admin/inc/option_html.inc.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     // print_r($prepopulate);
19 19
     $optioninfo = Options::instance();
20 20
     // print_r($prepopulate);
21
-    if (is_array($prepopulate) && ( count($prepopulate) > 1 || $class == "device-specific" || $class == "eap-specific") ) { // editing... fill with values
21
+    if (is_array($prepopulate) && (count($prepopulate) > 1 || $class == "device-specific" || $class == "eap-specific")) { // editing... fill with values
22 22
         $a = 0;
23 23
         foreach ($prepopulate as $option)
24 24
             if (preg_match("/$class:/", $option['name']) && !preg_match("/(profile:QR-user|user:fedadmin)/", $option['name'])) {
@@ -102,16 +102,16 @@  discard block
 block discarded – undo
102 102
         $a = 0;
103 103
         foreach ($list as $key => $value) {
104 104
             $listtype = $optioninfo->optionType($value);
105
-            $retval .="<option id='option-S$rowid-v-$value' value='$value#" . $listtype["type"] . "#" . $listtype["flag"] . "#' ";
105
+            $retval .= "<option id='option-S$rowid-v-$value' value='$value#" . $listtype["type"] . "#" . $listtype["flag"] . "#' ";
106 106
             if ($a == $defaultselect) {
107 107
                 $retval .= "selected='selected'";
108 108
                 $activelisttype = $listtype;
109 109
             }
110
-            $retval .=">" . display_name($value). "</option>";
110
+            $retval .= ">" . display_name($value) . "</option>";
111 111
             $a++;
112 112
         }
113
-        $retval .="</select></td>";
114
-        $retval .="<td>
113
+        $retval .= "</select></td>";
114
+        $retval .= "<td>
115 115
           <select style='display:" . ($activelisttype["flag"] == "ML" ? "block" : "none") . "' name='value[S$rowid-lang]' id='S" . $rowid . "-input-langselect'>
116 116
             <option value='' name='select_language' selected>" . _("select language") . "</option>
117 117
             <option value='C' name='all_languages'>" . _("default/other languages") . "</option>";
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
                 $global_location_count++;
172 172
                 $location_index = $global_location_count;
173 173
                 $link = "<button id='location_b_$global_location_count' class='location_button'>" . _("Click to see location") . " $global_location_count</button>";
174
-                $retval .="<input readonly style='display:none' type='text' name='value[S$rowid-1]' id='S" . $rowid . "-input-text' value='$prefill'>$link";
174
+                $retval .= "<input readonly style='display:none' type='text' name='value[S$rowid-1]' id='S" . $rowid . "-input-text' value='$prefill'>$link";
175 175
                 break;
176 176
             case "file":
177 177
                 $retval .= "<input readonly type='text' name='value[S$rowid-1]' id='S" . $rowid . "-input-string' style='display:none' value='" . urlencode($content) . "'>";
@@ -191,10 +191,10 @@  discard block
 block discarded – undo
191 191
                 };
192 192
                 break;
193 193
             case "string":
194
-                $retval .= "<strong>$content</strong><input type='hidden' name='value[S$rowid-0]' id='S" . $rowid . "-input-string' value=\"".htmlspecialchars($content)."\" style='display:block'>";
194
+                $retval .= "<strong>$content</strong><input type='hidden' name='value[S$rowid-0]' id='S" . $rowid . "-input-string' value=\"" . htmlspecialchars($content) . "\" style='display:block'>";
195 195
                 break;
196 196
             case "text":
197
-                $retval .= "<strong>$content</strong><input type='hidden' name='value[S$rowid-1]' id='S" . $rowid . "-input-text' value=\"".htmlspecialchars($content)."\" style='display:block'>";
197
+                $retval .= "<strong>$content</strong><input type='hidden' name='value[S$rowid-1]' id='S" . $rowid . "-input-text' value=\"" . htmlspecialchars($content) . "\" style='display:block'>";
198 198
                 break;
199 199
             case "boolean":
200 200
                 if ($content == "on")
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
         };
214 214
         $retval .= "</td>";
215 215
     }
216
-    $retval .="
216
+    $retval .= "
217 217
 
218 218
        <td>
219 219
           <button type='button' class='delete' onclick='deleteOption(" . $location_index . ",\"option-S" . $rowid . "\")'>-</button>
Please login to merge, or discard this patch.
Braces   +16 added lines, -12 removed lines patch added patch discarded remove patch
@@ -20,9 +20,10 @@  discard block
 block discarded – undo
20 20
     // print_r($prepopulate);
21 21
     if (is_array($prepopulate) && ( count($prepopulate) > 1 || $class == "device-specific" || $class == "eap-specific") ) { // editing... fill with values
22 22
         $a = 0;
23
-        foreach ($prepopulate as $option)
24
-            if (preg_match("/$class:/", $option['name']) && !preg_match("/(profile:QR-user|user:fedadmin)/", $option['name'])) {
23
+        foreach ($prepopulate as $option) {
24
+                    if (preg_match("/$class:/", $option['name']) && !preg_match("/(profile:QR-user|user:fedadmin)/", $option['name'])) {
25 25
                 $optiontypearray = $optioninfo->optionType($option['name']);
26
+        }
26 27
                 debug(5, "About to execute optiontext with PREFILL!\n");
27 28
                 echo optiontext($a, [$option['name']], ($optiontypearray["type"] == "file" ? 'ROWID-' . $option['level'] . '-' . $option['row'] : $option['value']));
28 29
             }
@@ -52,8 +53,9 @@  discard block
 block discarded – undo
52 53
         echo "</pre>"; */
53 54
         // add as many options as there are different option types
54 55
 
55
-        foreach (array_keys($list) as $key)
56
-            echo optiontext($key, $list);
56
+        foreach (array_keys($list) as $key) {
57
+                    echo optiontext($key, $list);
58
+        }
57 59
     }
58 60
 }
59 61
 
@@ -154,10 +156,11 @@  discard block
 block discarded – undo
154 156
                 $content = $prefill;
155 157
             }
156 158
             $language;
157
-            if ($taggedarray['lang'] == 'C')
158
-                $language = _("(default/other languages)");
159
-            else
160
-                $language = "(" . strtoupper($taggedarray['lang']) . ")";
159
+            if ($taggedarray['lang'] == 'C') {
160
+                            $language = _("(default/other languages)");
161
+            } else {
162
+                            $language = "(" . strtoupper($taggedarray['lang']) . ")";
163
+            }
161 164
             $retval .= $language;
162 165
             $retval .= "<input type='hidden' name='value[S$rowid-lang]' id='S" . $rowid . "-input-langselect' value='" . $taggedarray["lang"] . "' style='display:block'>";
163 166
         } else {
@@ -197,12 +200,13 @@  discard block
 block discarded – undo
197 200
                 $retval .= "<strong>$content</strong><input type='hidden' name='value[S$rowid-1]' id='S" . $rowid . "-input-text' value=\"".htmlspecialchars($content)."\" style='display:block'>";
198 201
                 break;
199 202
             case "boolean":
200
-                if ($content == "on")
201
-                /// Device assessment is "on"
203
+                if ($content == "on") {
204
+                                /// Device assessment is "on"
202 205
                     $display_option = _("on");
203
-                else
204
-                /// Device assessment is "off"
206
+                } else {
207
+                                /// Device assessment is "off"
205 208
                     $display_option = _("off");
209
+                }
206 210
                 $retval .= "<strong>$display_option</strong><input type='hidden' name='value[S$rowid-3]' id='S" . $rowid . "-input-boolean' value='$content' style='display:block'>";
207 211
                 break;
208 212
             default:
Please login to merge, or discard this patch.
web/admin/inc/manageNewInst.inc.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
                 $entities = $thefed->listExternalEntities(TRUE);
76 76
 
77 77
                 foreach ($entities as $v) {
78
-                echo "<option id='".$v['contactlist']."' value='" . $v['ID'] . "'>[" . $fed_value['value'] . "] " . $v['name'] . "</option>";
78
+                echo "<option id='" . $v['contactlist'] . "' value='" . $v['ID'] . "'>[" . $fed_value['value'] . "] " . $v['name'] . "</option>";
79 79
             }
80 80
             }
81 81
 
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
         </tr>
111 111
     </table>
112 112
     <hr/>
113
-    <button type='submit' name='submitbutton' value='<?php echo BUTTON_SAVE;?>'><?php echo _("Send invitation"); ?></button>
113
+    <button type='submit' name='submitbutton' value='<?php echo BUTTON_SAVE; ?>'><?php echo _("Send invitation"); ?></button>
114 114
 </form>
115 115
 <br/>
116 116
 <form action='inc/manageNewInst.inc.php' method='post' accept-charset='UTF-8'>
117
-    <button type='submit' name='submitbutton' value='<?php echo BUTTON_CLOSE;?>'><?php echo _("Close"); ?></button>
117
+    <button type='submit' name='submitbutton' value='<?php echo BUTTON_CLOSE; ?>'><?php echo _("Close"); ?></button>
118 118
 </form>
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,8 +23,9 @@  discard block
 block discarded – undo
23 23
 
24 24
 // if we have a pushed close button, submit attributes and send user back to the overview page
25 25
 
26
-if ((isset($_POST['submitbutton']) && $_POST['submitbutton'] == BUTTON_CLOSE))
26
+if ((isset($_POST['submitbutton']) && $_POST['submitbutton'] == BUTTON_CLOSE)) {
27 27
     header("Location: ../overview_federation.php");
28
+}
28 29
 
29 30
 $cat = new CAT();
30 31
 $cat->set_locale("web_admin");
@@ -93,9 +94,10 @@  discard block
 block discarded – undo
93 94
                 <select id='country' name='country'>
94 95
                     <?php
95 96
                     foreach ($cat->printCountryList() as $iso_code => $country) {
96
-                        foreach ($feds as $fed_value)
97
-                            if (strtoupper($fed_value['value']) == strtoupper($iso_code))
97
+                        foreach ($feds as $fed_value) {
98
+                                                    if (strtoupper($fed_value['value']) == strtoupper($iso_code))
98 99
                                 echo "<option value='$iso_code'>$country</option>";
100
+                        }
99 101
                     }
100 102
                     ?>
101 103
                 </select>
Please login to merge, or discard this patch.
web/admin/inc/toggleRedirect.inc.php 1 patch
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -49,9 +49,11 @@  discard block
 block discarded – undo
49 49
     $eaptype = unserialize(stripslashes($_POST['eaptype']));
50 50
     // is this an actual EAP type we know of?
51 51
     $eap_id = EAP::EAPMethodIdFromArray($eaptype);
52
-    if ($eap_id === FALSE) // oh-oh, unexpected malformed input. Goodbye.
52
+    if ($eap_id === FALSE) {
53
+        // oh-oh, unexpected malformed input. Goodbye.
53 54
         exit(1);
54
-}
55
+    }
56
+    }
55 57
 
56 58
 // there is either one or the other. If both are set, something's fishy.
57 59
 
@@ -107,8 +109,9 @@  discard block
 block discarded – undo
107 109
         $interesting_attribs = [];
108 110
 
109 111
         foreach ($attribs as $attrib) {
110
-            if ($attrib['level'] == "Method" && preg_match('/^' . $keyword . ':/', $attrib['name']))
111
-                $interesting_attribs[] = $attrib;
112
+            if ($attrib['level'] == "Method" && preg_match('/^' . $keyword . ':/', $attrib['name'])) {
113
+                            $interesting_attribs[] = $attrib;
114
+            }
112 115
         }
113 116
         // print_r($interesting_attribs);
114 117
         add_option($keyword, $interesting_attribs);
Please login to merge, or discard this patch.