Completed
Pull Request — master (#14)
by Janusz
10:08 queued 04:29
created
devices/apple_mobileconfig/mobileconfig_superclass.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@
 block discarded – undo
129 129
       <key>PayloadIdentifier</key>
130 130
          <string>" . mobileconfig_superclass::$iPhonePayloadPrefix . ".$this->massagedConsortium.$this->massagedCountry.$this->massagedInst.$this->massagedProfile.$this->lang</string>
131 131
       <key>PayloadOrganization</key>
132
-         <string>" . htmlspecialchars(iconv("UTF-8", "UTF-8//IGNORE", $this->attributes['general:instname'][0]), ENT_XML1, 'UTF-8') . ( $this->attributes['internal:profile_count'][0] > 1 ? " (" . htmlspecialchars(iconv("UTF-8", "UTF-8//IGNORE", $this->attributes['profile:name'][0]), ENT_XML1, 'UTF-8') . ")" : "") . "</string>
132
+         <string>" . htmlspecialchars(iconv("UTF-8", "UTF-8//IGNORE", $this->attributes['general:instname'][0]), ENT_XML1, 'UTF-8') . ($this->attributes['internal:profile_count'][0] > 1 ? " (" . htmlspecialchars(iconv("UTF-8", "UTF-8//IGNORE", $this->attributes['profile:name'][0]), ENT_XML1, 'UTF-8') . ")" : "") . "</string>
133 133
       <key>PayloadType</key>
134 134
          <string>Configuration</string>
135 135
       <key>PayloadUUID</key>
Please login to merge, or discard this patch.
core/UserManagement.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
      * @param boolean $isByFedadmin is the invitation token created for a federation admin or from an existing inst admin
212 212
      * @param type $for identifier (typically email address) for which the invitation is created
213 213
      * @param mixed $instIdentifier either an instance of the IdP class (for existing institutions to invite new admins) or a string (new institution - this is the inst name then)
214
-     * @param string $externalId if the IdP to be created is related to an external DB entity, this parameter contains that ID
215
-     * @param type $country if the institution is new (i.e. $inst is a string) this parameter needs to specify the federation of the new inst
216
-     * @return mixed The function returns either the token (as string) or FALSE if something went wrong
214
+     * @param integer $externalId if the IdP to be created is related to an external DB entity, this parameter contains that ID
215
+     * @param integer $country if the institution is new (i.e. $inst is a string) this parameter needs to specify the federation of the new inst
216
+     * @return string|false The function returns either the token (as string) or FALSE if something went wrong
217 217
      */
218 218
     public function createToken($isByFedadmin, $for, $instIdentifier, $externalId = 0, $country = 0) {
219 219
         $escapedFor = DBConnection::escape_value(UserManagement::$databaseType, $for);
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
     /**
244 244
      * Retrieves all pending invitations for an institution or for a federation.
245 245
      * 
246
-     * @param type $idpIdentifier the identifier of the institution. If not set, returns invitations for not-yet-created insts
246
+     * @param integer $idpIdentifier the identifier of the institution. If not set, returns invitations for not-yet-created insts
247 247
      * @return if idp_identifier is set: an array of strings (mail addresses); otherwise an array of tuples (country;name;mail)
248 248
      */
249 249
     public function listPendingInvitations($idpIdentifier = 0) {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -250,8 +250,8 @@
 block discarded – undo
250 250
         $retval = [];
251 251
         $invitations = DBConnection::exec(UserManagement::$databaseType, "SELECT cat_institution_id, country, name, invite_issuer_level, invite_dest_mail, invite_token 
252 252
                                         FROM invitations 
253
-                                        WHERE cat_institution_id " . ( $idpIdentifier != 0 ? "= $idpIdentifier" : "IS NULL") . " AND invite_created >= TIMESTAMPADD(DAY, -1, NOW()) AND used = 0");
254
-        debug(4, "Retrieving pending invitations for " . ($idpIdentifier != 0 ? "IdP $idpIdentifier" : "IdPs awaiting initial creation" ) . ".\n");
253
+                                        WHERE cat_institution_id " . ($idpIdentifier != 0 ? "= $idpIdentifier" : "IS NULL") . " AND invite_created >= TIMESTAMPADD(DAY, -1, NOW()) AND used = 0");
254
+        debug(4, "Retrieving pending invitations for " . ($idpIdentifier != 0 ? "IdP $idpIdentifier" : "IdPs awaiting initial creation") . ".\n");
255 255
         while ($invitationQuery = mysqli_fetch_object($invitations)) {
256 256
             $retval[] = ["country" => $invitationQuery->country, "name" => $invitationQuery->name, "mail" => $invitationQuery->invite_dest_mail, "token" => $invitationQuery->invite_token];
257 257
         }
Please login to merge, or discard this patch.
web/admin/inc/manageAdmins.inc.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
         echo "</td>
138 138
               <td>
139
-                <form action='inc/manageAdmins.inc.php?inst_id=" . $my_inst->identifier . "' method='post' " . ( $oneowner['ID'] != $_SESSION['user'] ? "onsubmit='popupRedirectWindow(this); return false;'" : "" ) . " accept-charset='UTF-8'>
139
+                <form action='inc/manageAdmins.inc.php?inst_id=" . $my_inst->identifier . "' method='post' " . ($oneowner['ID'] != $_SESSION['user'] ? "onsubmit='popupRedirectWindow(this); return false;'" : "") . " accept-charset='UTF-8'>
140 140
                 <input type='hidden' name='admin_id' value='" . $oneowner['ID'] . "'></input>
141 141
                 <button type='submit' name='submitbutton' class='delete' value='" . BUTTON_DELETE . "'>" . _("Delete Administrator") . "</button>
142 142
                 </form>
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
     echo "<strong>" . _("Pending invitations for this IdP") . "</strong>";
155 155
     echo "<table>";
156 156
     foreach ($pending_invites as $invitee)
157
-        echo "<tr><td>".$invitee['mail']."</td></tr>";
157
+        echo "<tr><td>" . $invitee['mail'] . "</td></tr>";
158 158
     echo "</table>";
159 159
 }
160 160
 ?>
Please login to merge, or discard this patch.
Braces   +34 added lines, -25 removed lines patch added patch discarded remove patch
@@ -45,9 +45,10 @@  discard block
 block discarded – undo
45 45
 $is_admin_with_blessing = FALSE;
46 46
 $owners = $my_inst->owner();
47 47
 foreach ($owners as $oneowner) {
48
-    if ($oneowner['ID'] == $_SESSION['user'] && $oneowner['LEVEL'] == "FED")
49
-        $is_admin_with_blessing = TRUE;
50
-}
48
+    if ($oneowner['ID'] == $_SESSION['user'] && $oneowner['LEVEL'] == "FED") {
49
+            $is_admin_with_blessing = TRUE;
50
+    }
51
+    }
51 52
 
52 53
 // if none of the two, send the user away
53 54
 
@@ -65,8 +66,9 @@  discard block
 block discarded – undo
65 66
             $ownermgmt->removeAdminFromIdP($my_inst, $_POST['admin_id']);
66 67
             // if the user deleted himself, go back to overview page. Otherwise, just stay here and display the remaining owners
67 68
             // we don't decide about that here; it's done by JS magic in the calling button
68
-            if ($_POST['admin_id'] == $_SESSION['user'])
69
-                header("Location: $dest");
69
+            if ($_POST['admin_id'] == $_SESSION['user']) {
70
+                            header("Location: $dest");
71
+            }
70 72
         } else {
71 73
             echo "Fatal Error: asked to delete an administrator, but no administrator ID was given!";
72 74
             exit(1);
@@ -91,12 +93,13 @@  discard block
 block discarded – undo
91 93
 if (isset($_GET['invitation'])) {
92 94
     echo "<div class='ca-summary' style='position:relative;'><table>";
93 95
 
94
-    if ($_GET['invitation'] == "SUCCESS")
95
-        echo UI_remark(_("The invitation email was sent successfully."), _("The invitation email was sent."));
96
-    else if ($_GET['invitation'] == "FAILURE")
97
-        echo UI_error(_("The invitation email could not be sent!"), _("The invitation email could not be sent!"));
98
-    else
99
-        echo UI_error(_("Error: unknown result code of invitation!?!"), _("Unknown result!"));
96
+    if ($_GET['invitation'] == "SUCCESS") {
97
+            echo UI_remark(_("The invitation email was sent successfully."), _("The invitation email was sent."));
98
+    } else if ($_GET['invitation'] == "FAILURE") {
99
+            echo UI_error(_("The invitation email could not be sent!"), _("The invitation email could not be sent!"));
100
+    } else {
101
+            echo UI_error(_("Error: unknown result code of invitation!?!"), _("Unknown result!"));
102
+    }
100 103
 
101 104
     echo "</table></div>";
102 105
 }
@@ -119,20 +122,22 @@  discard block
 block discarded – undo
119 122
     foreach ($my_inst->owner() as $oneowner) {
120 123
         $ownerinfo = new User($oneowner['ID']);
121 124
         $ownername = $ownerinfo->getAttributes("user:realname");
122
-        if (count($ownername) > 0)
123
-            $prettyprint = $ownername[0]['value'];
124
-        else
125
-            $prettyprint = _("User without name");
125
+        if (count($ownername) > 0) {
126
+                    $prettyprint = $ownername[0]['value'];
127
+        } else {
128
+                    $prettyprint = _("User without name");
129
+        }
126 130
         echo "
127 131
             <tr>
128 132
               <td>
129 133
                  <strong>$prettyprint</strong>
130 134
                  <br/>";
131 135
 
132
-        if ($oneowner['MAIL'] != "SELF-APPOINTED")
133
-            printf(_("(originally invited as %s)"), $oneowner['MAIL']);
134
-        else
135
-            echo _("(self-appointed)");
136
+        if ($oneowner['MAIL'] != "SELF-APPOINTED") {
137
+                    printf(_("(originally invited as %s)"), $oneowner['MAIL']);
138
+        } else {
139
+                    echo _("(self-appointed)");
140
+        }
136 141
 
137 142
         echo "</td>
138 143
               <td>
@@ -153,8 +158,9 @@  discard block
 block discarded – undo
153 158
 if (count($pending_invites) > 0) {
154 159
     echo "<strong>" . _("Pending invitations for this IdP") . "</strong>";
155 160
     echo "<table>";
156
-    foreach ($pending_invites as $invitee)
157
-        echo "<tr><td>".$invitee['mail']."</td></tr>";
161
+    foreach ($pending_invites as $invitee) {
162
+            echo "<tr><td>".$invitee['mail']."</td></tr>";
163
+    }
158 164
     echo "</table>";
159 165
 }
160 166
 ?>
@@ -167,14 +173,17 @@  discard block
 block discarded – undo
167 173
 if ($is_fed_admin) {
168 174
     $is_admin_himself = FALSE;
169 175
     foreach ($owners as $oneowner) {
170
-        if ($oneowner['ID'] == $_SESSION['user'])
171
-            $is_admin_himself = TRUE;
176
+        if ($oneowner['ID'] == $_SESSION['user']) {
177
+                    $is_admin_himself = TRUE;
178
+        }
172 179
     }
173 180
 
174
-    if (!$is_admin_himself) echo "<form action='inc/manageAdmins.inc.php?inst_id=$my_inst->identifier' method='post' onsubmit='popupRedirectWindow(this); return false;' accept-charset='UTF-8'>
181
+    if (!$is_admin_himself) {
182
+        echo "<form action='inc/manageAdmins.inc.php?inst_id=$my_inst->identifier' method='post' onsubmit='popupRedirectWindow(this); return false;' accept-charset='UTF-8'>
175 183
     <button type='submit' name='submitbutton' value='" . BUTTON_TAKECONTROL . "'>" . _("Take control of this institution") . "</button>
176 184
 </form>";
177
-}
185
+    }
186
+    }
178 187
 ?>
179 188
 <hr/>
180 189
 <form action='inc/manageAdmins.inc.php?inst_id=<?php echo $my_inst->identifier; ?>' method='post' accept-charset='UTF-8'>
Please login to merge, or discard this patch.
web/admin/inc/manageDBLink.inc.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  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
 // if not, must operate on a proper IdP
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
     echo "<strong>" . _("Pending invitations for this IdP") . "</strong>";
162 162
     echo "<table>";
163 163
     foreach ($pending_invites as $invitee)
164
-        echo "<tr><td>".$invitee['mail']."</td></tr>";
164
+        echo "<tr><td>" . $invitee['mail'] . "</td></tr>";
165 165
     echo "</table>";
166 166
 }
167 167
 ?>
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['mail']."</td></tr>";
173
+    foreach ($pending_invites as $invitee) {
174
+            echo "<tr><td>".$invitee['mail']."</td></tr>";
175
+    }
165 176
     echo "</table>";
166 177
 }
167 178
 ?>
Please login to merge, or discard this patch.
core/Federation.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
             }
65 65
             $numberQuery = DBConnection::exec("INST", $query);
66 66
             while ($queryResult = mysqli_fetch_object($numberQuery)) {
67
-                $dataArray[$deviceArray['display']] = ["ADMIN" => ( $queryResult->admin === NULL ? "0" : $queryResult->admin), "USER" => ($queryResult->user === NULL ? "0" : $queryResult->user)];
67
+                $dataArray[$deviceArray['display']] = ["ADMIN" => ($queryResult->admin === NULL ? "0" : $queryResult->admin), "USER" => ($queryResult->user === NULL ? "0" : $queryResult->user)];
68 68
                 $grossAdmin = $grossAdmin + $queryResult->admin;
69 69
                 $grossUser = $grossUser + $queryResult->user;
70 70
             }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
                 $retstring .= "<tr><td><strong>TOTAL</strong></td><td><strong>" . $data['TOTAL']['ADMIN'] . "</strong></td><td><strong>" . $data['TOTAL']['USER'] . "</strong></td></tr>";
89 89
                 break;
90 90
             case "XML":
91
-                $retstring .= "<federation id='" . ( $federationid == NULL ? "ALL" : $federationid ) . "' ts='" . date("Y-m-d") . "T" . date("H:i:s") . "'>\n";
91
+                $retstring .= "<federation id='" . ($federationid == NULL ? "ALL" : $federationid) . "' ts='" . date("Y-m-d") . "T" . date("H:i:s") . "'>\n";
92 92
                 foreach ($data as $device => $numbers) {
93 93
                     if ($device == "TOTAL") {
94 94
                         continue;
Please login to merge, or discard this patch.
core/DBConnection.php 1 patch
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -84,6 +84,7 @@  discard block
 block discarded – undo
84 84
     /**
85 85
      * executes a query and triggers logging to the SQL audit log if it's not a SELECT
86 86
      * @param string $querystring the query to be executed
87
+     * @param string $database
87 88
      * @return mixed the query result as mysqli_result object; or TRUE on non-return-value statements
88 89
      */
89 90
     public static function exec($database, $querystring) {
@@ -134,6 +135,8 @@  discard block
 block discarded – undo
134 135
     /**
135 136
      * Checks if a raw data pointer is public data (return value FALSE) or if 
136 137
      * yes who the authorised admins to view it are (return array of user IDs)
138
+     * @param string $table
139
+     * @param string $row
137 140
      */
138 141
     public static function isDataRestricted($table, $row) {
139 142
         if ($table != "institution_option" && $table != "profile_option" && $table != "federation_option") {
@@ -177,6 +180,7 @@  discard block
 block discarded – undo
177 180
 
178 181
     /**
179 182
      * Retrieves the last auto-id of an INSERT. Needs to be called immediately after the corresponding exec() call
183
+     * @param string $database
180 184
      * @return int the last autoincrement-ID
181 185
      */
182 186
     public static function lastID($database) {
Please login to merge, or discard this patch.
web/admin/action_fedcheck.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 require_once("../resources/inc/header.php");
19 19
 require_once("../resources/inc/footer.php");
20 20
 
21
-function profilechecks(IdP $idpinfo,Profile $profile) {
21
+function profilechecks(IdP $idpinfo, Profile $profile) {
22 22
 
23 23
     $tabletext = "<tr><td>" . $idpinfo->name . "</td><td>" . $profile->name . "</td>";
24 24
     
@@ -30,12 +30,12 @@  discard block
 block discarded – undo
30 30
         // update database with the findings
31 31
         
32 32
         DBConnection::exec("INST", "UPDATE profile SET "
33
-                . "status_dns = ".RETVAL_SKIPPED.", "
34
-                . "status_cert = ".RETVAL_SKIPPED.", "
35
-                . "status_reachability = ". RETVAL_SKIPPED.", "
36
-                . "status_TLS = ".RETVAL_SKIPPED.", "
33
+                . "status_dns = " . RETVAL_SKIPPED . ", "
34
+                . "status_cert = " . RETVAL_SKIPPED . ", "
35
+                . "status_reachability = " . RETVAL_SKIPPED . ", "
36
+                . "status_TLS = " . RETVAL_SKIPPED . ", "
37 37
                 . "last_status_check = NOW() "
38
-                . "WHERE profile_id = ".$profile->identifier);
38
+                . "WHERE profile_id = " . $profile->identifier);
39 39
         
40 40
         return $tabletext;
41 41
     }
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
     }
83 83
 
84 84
     if ($NAPTR_issues) {
85
-        $tabletext .= UI_error(0,0,true);
85
+        $tabletext .= UI_error(0, 0, true);
86 86
     } else {
87
-        $tabletext .= UI_okay(0,0,true);
87
+        $tabletext .= UI_okay(0, 0, true);
88 88
     }
89 89
     
90 90
     $UDPErrors = false;
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
     }
107 107
     
108 108
     $tabletext .= "</td><td>";
109
-    $tabletext .= UI_message($certBiggestOddity,0,0,true);
109
+    $tabletext .= UI_message($certBiggestOddity, 0, 0, true);
110 110
         
111 111
     $tabletext .= "</td><td>";
112 112
     if (!$UDPErrors) {
113
-        $tabletext .= UI_okay(0,0,true);
113
+        $tabletext .= UI_okay(0, 0, true);
114 114
     } else {
115
-        $tabletext .= UI_error(0,0,true);
115
+        $tabletext .= UI_error(0, 0, true);
116 116
     }
117 117
     
118 118
     $tabletext .= "</td><td>";
@@ -127,19 +127,19 @@  discard block
 block discarded – undo
127 127
         }
128 128
     }
129 129
     if (!$dynamicErrors) {
130
-        $tabletext .= UI_okay(0,0,true);
130
+        $tabletext .= UI_okay(0, 0, true);
131 131
     } else {
132
-        $tabletext .= UI_error(0,0,true);
132
+        $tabletext .= UI_error(0, 0, true);
133 133
     }
134 134
     $tabletext .= "</td></tr>";
135 135
 
136 136
     DBConnection::exec("INST", "UPDATE profile SET "
137
-                . "status_dns = ".($NAPTR_issues ? RETVAL_INVALID : RETVAL_OK) . ", "
138
-                . "status_cert = ".($certBiggestOddity) . ", "
139
-                . "status_reachability = ".($UDPErrors ? RETVAL_INVALID : RETVAL_OK) . ", "
140
-                . "status_TLS = ".($dynamicErrors ? RETVAL_INVALID : RETVAL_OK) . ", "
137
+                . "status_dns = " . ($NAPTR_issues ? RETVAL_INVALID : RETVAL_OK) . ", "
138
+                . "status_cert = " . ($certBiggestOddity) . ", "
139
+                . "status_reachability = " . ($UDPErrors ? RETVAL_INVALID : RETVAL_OK) . ", "
140
+                . "status_TLS = " . ($dynamicErrors ? RETVAL_INVALID : RETVAL_OK) . ", "
141 141
                 . "last_status_check = NOW() "
142
-                . "WHERE profile_id = ".$profile->identifier);    
142
+                . "WHERE profile_id = " . $profile->identifier);    
143 143
         
144 144
     return $tabletext;
145 145
 }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
     echo "<h2>" . _("Profiles marked as visible (V)") . "</h2>" . "<table>";
178 178
     echo rowdescription();
179 179
     foreach ($profiles_showtime as $oneprofile)
180
-        echo profilechecks($oneprofile['idp'],$oneprofile['profile']);
180
+        echo profilechecks($oneprofile['idp'], $oneprofile['profile']);
181 181
     echo "</table>";
182 182
 }
183 183
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
     echo "<h2>" . _("Profiles with sufficient configuration, not marked as visible (C)") . "</h2>" . "<table>";
186 186
     echo rowdescription();
187 187
     foreach ($profiles_confready as $oneprofile)
188
-        echo profilechecks($oneprofile['idp'],$oneprofile['profile']);
188
+        echo profilechecks($oneprofile['idp'], $oneprofile['profile']);
189 189
     echo "</table>";
190 190
 }
191 191
 ?>
Please login to merge, or discard this patch.
Braces   +32 added lines, -21 removed lines patch added patch discarded remove patch
@@ -44,10 +44,11 @@  discard block
 block discarded – undo
44 44
     // NAPTR existence check
45 45
     $tabletext .= "<td>";
46 46
     $naptr = $testsuite->NAPTR();
47
-    if ($naptr != RETVAL_NOTCONFIGURED)
48
-        switch ($naptr) {
47
+    if ($naptr != RETVAL_NOTCONFIGURED) {
48
+            switch ($naptr) {
49 49
             case RETVAL_NONAPTR:
50 50
                 $tabletext .= _("No NAPTR records");
51
+    }
51 52
                 break;
52 53
             case RETVAL_ONLYUNRELATEDNAPTR:
53 54
                 $tabletext .= sprintf(_("No associated NAPTR records"));
@@ -62,23 +63,26 @@  discard block
 block discarded – undo
62 63
 
63 64
     if ($naptr > 0) {
64 65
         $naptrValid = $testsuite->NAPTR_compliance();
65
-        if ($naptrValid == RETVAL_INVALID)
66
-            $NAPTR_issues = true;
66
+        if ($naptrValid == RETVAL_INVALID) {
67
+                    $NAPTR_issues = true;
68
+        }
67 69
     }
68 70
 
69 71
     // SRV resolution
70 72
 
71 73
     if ($naptr > 0 && $naptrValid == RETVAL_OK) {
72 74
         $srv = $testsuite->NAPTR_SRV();
73
-        if ($srv == RETVAL_INVALID)
74
-            $NAPTR_issues = true;
75
+        if ($srv == RETVAL_INVALID) {
76
+                    $NAPTR_issues = true;
77
+        }
75 78
     }
76 79
 
77 80
     // IP addresses for the hosts
78 81
     if ($naptr > 0 && $naptrValid == RETVAL_OK && $srv > 0) {
79 82
         $hosts = $testsuite->NAPTR_hostnames();
80
-        if ($hosts == RETVAL_INVALID)
81
-            $NAPTR_issues = true;
83
+        if ($hosts == RETVAL_INVALID) {
84
+                    $NAPTR_issues = true;
85
+        }
82 86
     }
83 87
 
84 88
     if ($NAPTR_issues) {
@@ -94,14 +98,17 @@  discard block
 block discarded – undo
94 98
         $testsuite->UDP_reachability($hostindex, true, true);
95 99
         $results = $testsuite->UDP_reachability_result[$hostindex];
96 100
         //echo "<pre>".print_r($results,true)."</pre>";
97
-        if ($results['packetflow_sane'] != TRUE)
98
-            $UDPErrors = true;
99
-        if (empty($results['packetflow'][11]))
100
-            $UDPErrors = true;
101
+        if ($results['packetflow_sane'] != TRUE) {
102
+                    $UDPErrors = true;
103
+        }
104
+        if (empty($results['packetflow'][11])) {
105
+                    $UDPErrors = true;
106
+        }
101 107
         if (count($results['cert_oddities']) > 0) {
102
-            foreach ($results['cert_oddities'] as $oddity)
103
-                if ($oddity['level'] > $certBiggestOddity)
108
+            foreach ($results['cert_oddities'] as $oddity) {
109
+                            if ($oddity['level'] > $certBiggestOddity)
104 110
                     $certBiggestOddity = $oddity['level'];
111
+            }
105 112
         }
106 113
     }
107 114
     
@@ -122,8 +129,9 @@  discard block
 block discarded – undo
122 129
     if ($naptr > 0 && count($testsuite->NAPTR_hostname_records) > 0) {
123 130
         foreach ($testsuite->NAPTR_hostname_records as $hostindex => $addr) {
124 131
             $retval = $testsuite->TLS_clients_side_check($addr);
125
-            if ($retval != RETVAL_OK && $retval != RETVAL_SKIPPED)
126
-                $dynamicErrors = true;
132
+            if ($retval != RETVAL_OK && $retval != RETVAL_SKIPPED) {
133
+                            $dynamicErrors = true;
134
+            }
127 135
         }
128 136
     }
129 137
     if (!$dynamicErrors) {
@@ -165,10 +173,11 @@  discard block
 block discarded – undo
165 173
 $profiles_showtime = [];
166 174
 $profiles_readyconf = [];
167 175
 
168
-foreach ($allIDPs as $index => $oneidp)
176
+foreach ($allIDPs as $index => $oneidp) {
169 177
     foreach ($oneidp['instance']->listProfiles() as $profile)
170 178
         if ($profile->isShowtime()) {
171 179
             $profiles_showtime[] = ['idp' => $oneidp['instance'], 'profile' => $profile];
180
+}
172 181
         } else if ($profile->readyForShowtime()) {
173 182
             $profiles_confready[] = ['idp' => $oneidp['instance'], 'profile' => $profile];
174 183
         }
@@ -176,16 +185,18 @@  discard block
 block discarded – undo
176 185
 if (count($profiles_showtime) > 0) {
177 186
     echo "<h2>" . _("Profiles marked as visible (V)") . "</h2>" . "<table>";
178 187
     echo rowdescription();
179
-    foreach ($profiles_showtime as $oneprofile)
180
-        echo profilechecks($oneprofile['idp'],$oneprofile['profile']);
188
+    foreach ($profiles_showtime as $oneprofile) {
189
+            echo profilechecks($oneprofile['idp'],$oneprofile['profile']);
190
+    }
181 191
     echo "</table>";
182 192
 }
183 193
 
184 194
 if (count($profiles_confready) > 0) {
185 195
     echo "<h2>" . _("Profiles with sufficient configuration, not marked as visible (C)") . "</h2>" . "<table>";
186 196
     echo rowdescription();
187
-    foreach ($profiles_confready as $oneprofile)
188
-        echo profilechecks($oneprofile['idp'],$oneprofile['profile']);
197
+    foreach ($profiles_confready as $oneprofile) {
198
+            echo profilechecks($oneprofile['idp'],$oneprofile['profile']);
199
+    }
189 200
     echo "</table>";
190 201
 }
191 202
 ?>
Please login to merge, or discard this patch.
core/Profile.php 3 patches
Doc Comments   +13 added lines, -8 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      * supported EAP types from the DB and stores them in the priv_ arrays.
74 74
      * 
75 75
      * @param int $profileId identifier of the profile in the DB
76
-     * @param IdP $idpObject optionally, the institution to which this Profile belongs. Saves the construction of the IdP instance. If omitted, an extra query and instantiation is executed to find out.
76
+     * @param integer $idpObject optionally, the institution to which this Profile belongs. Saves the construction of the IdP instance. If omitted, an extra query and instantiation is executed to find out.
77 77
      */
78 78
     public function __construct($profileId, $idpObject = 0) {
79 79
         debug(3, "--- BEGIN Constructing new Profile object ... ---\n");
@@ -215,6 +215,9 @@  discard block
 block discarded – undo
215 215
         debug(3, "--- END Constructing new Profile object ... ---\n");
216 216
     }
217 217
 
218
+    /**
219
+     * @param string $devicesOrEAPMethods
220
+     */
218 221
     private function fetchDeviceOrEAPLevelAttributes($devicesOrEAPMethods) {
219 222
         // only one of the two is allowed to be set
220 223
         $temparray = [];
@@ -322,6 +325,8 @@  discard block
 block discarded – undo
322 325
      * 
323 326
      * @param string device the device identifier string
324 327
      * @param string path the path where the new installer can be found
328
+     * @param string $device
329
+     * @param string $path
325 330
      */
326 331
     public function updateCache($device, $path, $mime) {
327 332
         $escapedDevice = DBConnection::escape_value($this->databaseType, $device);
@@ -334,9 +339,9 @@  discard block
 block discarded – undo
334 339
     /**
335 340
      * Log a new download for our stats
336 341
      * 
337
-     * @param device the device id string
338
-     * @param area either admin or user
339
-     * @return TRUE if incrementing worked, FALSE if not
342
+     * @param device string device id string
343
+     * @param area string admin or user
344
+     * @return boolean if incrementing worked, FALSE if not
340 345
      */
341 346
     public function incrementDownloadStats($device, $area) {
342 347
         $escapedDevice = DBConnection::escape_value($this->databaseType, $device);
@@ -349,7 +354,7 @@  discard block
 block discarded – undo
349 354
 
350 355
     /**
351 356
      * Retrieve current download stats from database, either for one specific device or for all devices
352
-     * @param string $device the device id string
357
+     * @param integer $device the device id string
353 358
      * @return mixed user downloads of this profile; if device is given, returns the counter as int, otherwise an array with devicename => counter
354 359
      */
355 360
     public function getUserDownloadStats($device = 0) {
@@ -382,7 +387,7 @@  discard block
 block discarded – undo
382 387
      * @param string $attrName name of the attribute to set
383 388
      * @param string $attrValue value of the attribute to set
384 389
      * @param int $eapType identifier of the EAP type in the database. 0 if the attribute is valid for all EAP types.
385
-     * @param string $device identifier of the device in the databse. Omit the argument if attribute is valid for all devices.
390
+     * @param integer $device identifier of the device in the databse. Omit the argument if attribute is valid for all devices.
386 391
      */
387 392
     private function addAttributeAllLevels($attrName, $attrValue, $eapType, $device = 0) {
388 393
         $escapedAttrName = DBConnection::escape_value($this->databaseType, $attrName);
@@ -549,7 +554,7 @@  discard block
 block discarded – undo
549 554
     /**
550 555
      * list all devices marking their availabiblity and possible redirects
551 556
      *
552
-     * @param string $locale for text-based attributes, either returns values for the default value, or if specified here, in the locale specified
557
+     * @param integer $locale for text-based attributes, either returns values for the default value, or if specified here, in the locale specified
553 558
      * @return array of device ids display names and their status
554 559
      */
555 560
     public function listDevices($locale = 0) {
@@ -640,7 +645,7 @@  discard block
 block discarded – undo
640 645
      * as wel as the chosen language.
641 646
      * can be called with an optional $eap argument
642 647
      * 
643
-     * @param array $eap if specified, retrieves attributes specific to the given EAP type
648
+     * @param integer $eap if specified, retrieves attributes specific to the given EAP type
644 649
      * @return array list of attributes in collapsed style (index is the attrib name, value is an array of different values)
645 650
      */
646 651
     public function getCollapsedAttributes($eap = 0) {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         // add internal attributes
127 127
         // they share many attribute properties, so condense the generation
128 128
 
129
-        $localValueIfAny = (preg_match('/@/', $this->realm) ? substr($this->realm, 0, strpos($this->realm, '@')) : "anonymous" );
129
+        $localValueIfAny = (preg_match('/@/', $this->realm) ? substr($this->realm, 0, strpos($this->realm, '@')) : "anonymous");
130 130
 
131 131
         $internalAttributes = [
132 132
             "internal:profile_count" => $idp->profileCount(),
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 
252 252
                 $temparray[] = [
253 253
                     "name" => $attributeQuery->option_name,
254
-                    "value" => ( $decodedAttribute['lang'] == "" ? $decodedAttribute['content'] : serialize($decodedAttribute)),
254
+                    "value" => ($decodedAttribute['lang'] == "" ? $decodedAttribute['content'] : serialize($decodedAttribute)),
255 255
                     "level" => "Method",
256 256
                     "row" => $attributeQuery->row,
257 257
                     "flag" => $optinfo['flag'],
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
         $escapedAttrValue = DBConnection::escape_value($this->databaseType, $attrValue);
390 390
 
391 391
         DBConnection::exec($this->databaseType, "INSERT INTO $this->entityOptionTable ($this->entityIdColumn, option_name, option_value, eap_method_id" . ($device !== 0 ? ",device_id" : "") . ") 
392
-                          VALUES(" . $this->identifier . ", '$escapedAttrName', '$escapedAttrValue', $eapType" . ($device !== 0 ? ",'" . DBConnection::escape_value($this->databaseType, $device) . "'" : "" ) . ")");
392
+                          VALUES(" . $this->identifier . ", '$escapedAttrName', '$escapedAttrValue', $eapType" . ($device !== 0 ? ",'" . DBConnection::escape_value($this->databaseType, $device) . "'" : "") . ")");
393 393
         $this->updateFreshness();
394 394
     }
395 395
 
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
      */
457 457
     public function setRealmCheckUser($shallwe, $localpart = NULL) {
458 458
         DBConnection::exec($this->databaseType, "UPDATE profile SET checkuser_outer = " . ($shallwe == true ? "1" : "0") .
459
-                ( $localpart !== NULL ? ", checkuser_value = '$localpart' " : "") .
459
+                ($localpart !== NULL ? ", checkuser_value = '$localpart' " : "") .
460 460
                 " WHERE profile_id = $this->identifier");
461 461
     }
462 462
 
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -692,11 +692,11 @@
 block discarded – undo
692 692
                     $out[$name][0] = (isset($S[$this->langIndex])) ? $S[$this->langIndex] : $S['C'];
693 693
                 }
694 694
                 if (isset($S['en'])) {
695
-                   $out[$name][1] = $S['en'];
695
+                    $out[$name][1] = $S['en'];
696 696
                 } elseif(isset($S['C'])) {
697
-                   $out[$name][1] = $S['C'];
697
+                    $out[$name][1] = $S['C'];
698 698
                 } else {
699
-                   $out[$name][1] = $out[$name][0];
699
+                    $out[$name][1] = $out[$name][0];
700 700
                 }
701 701
             } else {
702 702
                 if (isset($temp[$name]['Method'])) {
Please login to merge, or discard this patch.