@@ -25,8 +25,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | ?> |
@@ -59,10 +59,11 @@ |
||
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, |
@@ -24,8 +24,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | ?> |
@@ -26,24 +26,28 @@ |
||
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"; |
@@ -20,9 +20,10 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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: |
@@ -27,9 +27,10 @@ discard block |
||
27 | 27 | exit(1); |
28 | 28 | } |
29 | 29 | |
30 | - foreach ($temp->listFederationAdmins() as $oneowner) |
|
31 | - if ($oneowner == $owner) |
|
30 | + foreach ($temp->listFederationAdmins() as $oneowner) { |
|
31 | + if ($oneowner == $owner) |
|
32 | 32 | return $temp; |
33 | + } |
|
33 | 34 | echo input_validation_error(_("This Federation identifier is not accessible!")); |
34 | 35 | exit(1); |
35 | 36 | } |
@@ -47,9 +48,10 @@ discard block |
||
47 | 48 | } |
48 | 49 | |
49 | 50 | if ($owner !== 0) { // check if the authenticated user is allowed to see this institution |
50 | - foreach ($temp->owner() as $oneowner) |
|
51 | - if ($oneowner['ID'] == $owner) |
|
51 | + foreach ($temp->owner() as $oneowner) { |
|
52 | + if ($oneowner['ID'] == $owner) |
|
52 | 53 | return $temp; |
54 | + } |
|
53 | 55 | echo input_validation_error(_("This IdP identifier is not accessible!")); |
54 | 56 | exit(1); |
55 | 57 | } |
@@ -77,8 +79,9 @@ discard block |
||
77 | 79 | |
78 | 80 | function valid_Device($input) { |
79 | 81 | $devicelist = Devices::listDevices(); |
80 | - if (!isset($devicelist[$input])) |
|
81 | - echo input_validation_error(_("This device does not exist!")); |
|
82 | + if (!isset($devicelist[$input])) { |
|
83 | + echo input_validation_error(_("This device does not exist!")); |
|
84 | + } |
|
82 | 85 | return $input; |
83 | 86 | } |
84 | 87 | |
@@ -89,20 +92,24 @@ discard block |
||
89 | 92 | $retval = filter_var($retval, FILTER_SANITIZE_STRING, ["flags" => FILTER_FLAG_NO_ENCODE_QUOTES]); |
90 | 93 | // unless explicitly wanted, take away intermediate disturbing whitespace |
91 | 94 | // a simple "space" is NOT disturbing :-) |
92 | - if ($allow_whitspace === 0) |
|
93 | - $retval = preg_replace('/(\0|\r|\x0b|\t|\n)/', '', $retval); |
|
94 | - else // even if we allow whitespace, not pathological ones! |
|
95 | + if ($allow_whitspace === 0) { |
|
96 | + $retval = preg_replace('/(\0|\r|\x0b|\t|\n)/', '', $retval); |
|
97 | + } else { |
|
98 | + // even if we allow whitespace, not pathological ones! |
|
95 | 99 | $retval = preg_replace('/(\0|\r|\x0b)/', '', $retval); |
100 | + } |
|
96 | 101 | |
97 | 102 | return $retval; |
98 | 103 | } |
99 | 104 | |
100 | 105 | function valid_consortium_oi($input) { |
101 | 106 | $shallow = valid_string_db($input); |
102 | - if (strlen($shallow) != 6 && strlen($shallow) != 10) |
|
103 | - return FALSE; |
|
104 | - if (!preg_match("/^[a-fA-F0-9]+$/", $shallow)) |
|
105 | - return FALSE; |
|
107 | + if (strlen($shallow) != 6 && strlen($shallow) != 10) { |
|
108 | + return FALSE; |
|
109 | + } |
|
110 | + if (!preg_match("/^[a-fA-F0-9]+$/", $shallow)) { |
|
111 | + return FALSE; |
|
112 | + } |
|
106 | 113 | return $shallow; |
107 | 114 | } |
108 | 115 | |
@@ -167,8 +174,9 @@ discard block |
||
167 | 174 | function valid_coord_serialized($input) { |
168 | 175 | if (is_array(unserialize($input))) { |
169 | 176 | $tentative = unserialize($input); |
170 | - if (isset($tentative['lon']) && isset($tentative['lat']) && valid_coordinate($tentative['lon']) && valid_coordinate($tentative['lat'])) |
|
171 | - return $input; |
|
177 | + if (isset($tentative['lon']) && isset($tentative['lat']) && valid_coordinate($tentative['lon']) && valid_coordinate($tentative['lat'])) { |
|
178 | + return $input; |
|
179 | + } |
|
172 | 180 | } else { |
173 | 181 | echo input_validation_error(_("Wrong coordinate encoding!")); |
174 | 182 | exit(1); |
@@ -186,9 +194,10 @@ discard block |
||
186 | 194 | if ($input != "on") { |
187 | 195 | echo input_validation_error(_("Unknown state of boolean option!")); |
188 | 196 | exit(1); |
189 | - } else |
|
190 | - return $input; |
|
191 | -} |
|
197 | + } else { |
|
198 | + return $input; |
|
199 | + } |
|
200 | + } |
|
192 | 201 | |
193 | 202 | function valid_DB_reference($input) { |
194 | 203 | $table = ""; |
@@ -201,22 +210,26 @@ discard block |
||
201 | 210 | $table = "profile_option"; |
202 | 211 | } elseif (preg_match("/FED/", $input)) { |
203 | 212 | $table = "federation_option"; |
204 | - } else |
|
205 | - return FALSE; |
|
213 | + } else { |
|
214 | + return FALSE; |
|
215 | + } |
|
206 | 216 | if (preg_match("/.*-([0-9]*)/", $input, $rowindexmatch)) { |
207 | 217 | $rowindex = $rowindexmatch[1]; |
208 | - } else |
|
209 | - return FALSE; |
|
218 | + } else { |
|
219 | + return FALSE; |
|
220 | + } |
|
210 | 221 | return ["table" => $table, "rowindex" => $rowindex]; |
211 | 222 | } |
212 | 223 | |
213 | 224 | function valid_host($input) { |
214 | 225 | // is it a valid IP address (IPv4 or IPv6)? |
215 | - if (filter_var($input, FILTER_VALIDATE_IP)) |
|
216 | - return $input; |
|
226 | + if (filter_var($input, FILTER_VALIDATE_IP)) { |
|
227 | + return $input; |
|
228 | + } |
|
217 | 229 | // if not, it must be a host name. Use email validation by prefixing with a local part |
218 | - if (filter_var("stefan@" . $input, FILTER_VALIDATE_EMAIL)) |
|
219 | - return $input; |
|
230 | + if (filter_var("stefan@" . $input, FILTER_VALIDATE_EMAIL)) { |
|
231 | + return $input; |
|
232 | + } |
|
220 | 233 | // if we get here, it's bogus |
221 | 234 | return FALSE; |
222 | 235 | } |
@@ -23,8 +23,9 @@ discard block |
||
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 |
||
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> |
@@ -49,9 +49,11 @@ discard block |
||
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 |
||
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); |
@@ -49,10 +49,11 @@ |
||
49 | 49 | // this variable gets set during "make distribution" only |
50 | 50 | $RELEASE = "THERELEASE"; |
51 | 51 | echo "".Config::$APPEARANCE['productname']." - "; |
52 | -if ($RELEASE != "THERELEASE") |
|
52 | +if ($RELEASE != "THERELEASE") { |
|
53 | 53 | echo sprintf(_("Release %s"), $RELEASE); |
54 | -else |
|
54 | +} else { |
|
55 | 55 | echo _("Unreleased SVN Revision"); |
56 | +} |
|
56 | 57 | echo " © 2011-13 DANTE Ltd. on behalf of the GN3 and GN3plus consortia</div>";?> |
57 | 58 | </body> |
58 | 59 | </html> |