Passed
Push — master ( 0ded32...a2fae3 )
by Tomasz
04:40
created
web/admin/inc/sendinvite.inc.php 1 patch
Switch Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -77,90 +77,90 @@
 block discarded – undo
77 77
 }
78 78
 
79 79
 switch ($operationMode) {
80
-    case OPERATION_MODE_EDIT:
81
-        $idp = $validator->IdP($_GET['inst_id']);
82
-        // editing IdPs is done from within the popup. When we're done, send the 
83
-        // user back to the popup (append the result of the operation later)
84
-        $redirect_destination = "manageAdmins.inc.php?inst_id=" . $idp->identifier . "&";
85
-        $mailaddress = abortOnBogusMail($newmailaddress, $redirect_destination);
86
-        // is the user admin of this IdP?
87
-        $is_owner = FALSE;
88
-        $owners = $idp->owner();
89
-        foreach ($owners as $oneowner) {
90
-            if ($oneowner['ID'] == $_SESSION['user'] && $oneowner['LEVEL'] == "FED") {
91
-                $is_owner = TRUE;
80
+        case OPERATION_MODE_EDIT:
81
+            $idp = $validator->IdP($_GET['inst_id']);
82
+            // editing IdPs is done from within the popup. When we're done, send the 
83
+            // user back to the popup (append the result of the operation later)
84
+            $redirect_destination = "manageAdmins.inc.php?inst_id=" . $idp->identifier . "&";
85
+            $mailaddress = abortOnBogusMail($newmailaddress, $redirect_destination);
86
+            // is the user admin of this IdP?
87
+            $is_owner = FALSE;
88
+            $owners = $idp->owner();
89
+            foreach ($owners as $oneowner) {
90
+                if ($oneowner['ID'] == $_SESSION['user'] && $oneowner['LEVEL'] == "FED") {
91
+                    $is_owner = TRUE;
92
+                }
93
+            }
94
+            // check if he is (also) federation admin for the federation this IdP is in. His invitations have more blessing then.
95
+            $fedadmin = $userObject->isFederationAdmin($idp->federation);
96
+            // check if he is either one, if not, complain
97
+            if (!$is_owner && !$fedadmin) {
98
+                echo "<p>" . sprintf(_("Something's wrong... you are a %s admin, but not for the %s the requested %s belongs to!"), $uiElements->nomenclature_fed, $uiElements->nomenclature_fed, $uiElements->nomenclature_inst) . "</p>";
99
+                exit(1);
92 100
             }
93
-        }
94
-        // check if he is (also) federation admin for the federation this IdP is in. His invitations have more blessing then.
95
-        $fedadmin = $userObject->isFederationAdmin($idp->federation);
96
-        // check if he is either one, if not, complain
97
-        if (!$is_owner && !$fedadmin) {
98
-            echo "<p>" . sprintf(_("Something's wrong... you are a %s admin, but not for the %s the requested %s belongs to!"), $uiElements->nomenclature_fed, $uiElements->nomenclature_fed, $uiElements->nomenclature_inst) . "</p>";
99
-            exit(1);
100
-        }
101 101
 
102
-        $prettyprintname = $idp->name;
103
-        $newtoken = $mgmt->createToken($fedadmin, $mailaddress, $idp);
104
-        $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP " . $idp->identifier . " - Token created for " . $mailaddress);
105
-        $introtext = sprintf(_("a %s of the %s %s \"%s\" has invited you to manage the %s together with him."), $uiElements->nomenclature_fed, CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $uiElements->nomenclature_inst, $prettyprintname, $uiElements->nomenclature_inst) . " " . sprintf(_("This invitation is valid for 24 hours from now, i.e. until %s."), strftime("%x %X", time() + 86400));
106
-        break;
107
-    case OPERATION_MODE_NEWUNLINKED:
108
-        $redirect_destination = "../overview_federation.php?";
109
-        $mailaddress = abortOnBogusMail($newmailaddress, $redirect_destination);
110
-        // run an input check and conversion of the raw inputs... just in case
111
-        $newinstname = $validator->string($_POST['name']);
112
-        $newcountry = $validator->string($_POST['country']);
113
-        $new_idp_authorized_fedadmin = $userObject->isFederationAdmin($newcountry);
114
-        if ($new_idp_authorized_fedadmin !== TRUE) {
115
-            throw new Exception("Something's wrong... you want to create a new " . $uiElements->nomenclature_inst . ", but are not a " . $uiElements->nomenclature_fed . " admin for the " . $uiElements->nomenclature_fed . " it should be in!");
116
-        }
117
-        $federation = $validator->Federation($newcountry);
118
-        $prettyprintname = $newinstname;
119
-        $introtext = sprintf(_("a %s %s has invited you to manage the future %s  \"%s\" (%s)."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $uiElements->nomenclature_fed, $uiElements->nomenclature_inst, $prettyprintname, $newcountry) . " " . sprintf(_("This invitation is valid for 24 hours from now, i.e. until %s."), strftime("%x %X", time() + 86400));
120
-        // send the user back to his federation overview page, append the result of the operation later
121
-        // do the token creation magic
122
-        $newtoken = $mgmt->createToken(TRUE, $mailaddress, $newinstname, 0, $newcountry);
123
-        $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP FUTURE  - Token created for " . $mailaddress);
124
-        break;
125
-    case OPERATION_MODE_NEWFROMDB:
126
-        $redirect_destination = "../overview_federation.php?";
127
-        $mailaddress = abortOnBogusMail($newmailaddress, $redirect_destination);
128
-        // a real external DB entry was submitted and all the required parameters are there
129
-        $newexternalid = $validator->string($_POST['externals']);
130
-        $extinfo = $catInstance->getExternalDBEntityDetails($newexternalid);
131
-        $new_idp_authorized_fedadmin = $userObject->isFederationAdmin($extinfo['country']);
132
-        if ($new_idp_authorized_fedadmin !== TRUE) {
133
-            throw new Exception("Something's wrong... you want to create a new " . $uiElements->nomenclature_inst . ", but are not a " . $uiElements->nomenclature_fed . " admin for the " . $uiElements->nomenclature_fed . " it should be in!");
134
-        }
135
-        $federation = $validator->Federation($extinfo['country']);
136
-        $newcountry = $extinfo['country'];
137
-        // 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
138
-        $prettyprintname = "";
139
-        foreach ($extinfo['names'] as $lang => $name) {
140
-            if ($lang == $languageInstance->getLang()) {
141
-                $prettyprintname = $name;
102
+            $prettyprintname = $idp->name;
103
+            $newtoken = $mgmt->createToken($fedadmin, $mailaddress, $idp);
104
+            $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP " . $idp->identifier . " - Token created for " . $mailaddress);
105
+            $introtext = sprintf(_("a %s of the %s %s \"%s\" has invited you to manage the %s together with him."), $uiElements->nomenclature_fed, CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $uiElements->nomenclature_inst, $prettyprintname, $uiElements->nomenclature_inst) . " " . sprintf(_("This invitation is valid for 24 hours from now, i.e. until %s."), strftime("%x %X", time() + 86400));
106
+            break;
107
+        case OPERATION_MODE_NEWUNLINKED:
108
+            $redirect_destination = "../overview_federation.php?";
109
+            $mailaddress = abortOnBogusMail($newmailaddress, $redirect_destination);
110
+            // run an input check and conversion of the raw inputs... just in case
111
+            $newinstname = $validator->string($_POST['name']);
112
+            $newcountry = $validator->string($_POST['country']);
113
+            $new_idp_authorized_fedadmin = $userObject->isFederationAdmin($newcountry);
114
+            if ($new_idp_authorized_fedadmin !== TRUE) {
115
+                throw new Exception("Something's wrong... you want to create a new " . $uiElements->nomenclature_inst . ", but are not a " . $uiElements->nomenclature_fed . " admin for the " . $uiElements->nomenclature_fed . " it should be in!");
142 116
             }
143
-        }
144
-        if ($prettyprintname == "" && isset($extinfo['names']['en'])) {
145
-            $prettyprintname = $extinfo['names']['en'];
146
-        }
147
-        if ($prettyprintname == "") {
148
-            foreach ($extinfo['names'] as $name) {
149
-                $prettyprintname = $name;
117
+            $federation = $validator->Federation($newcountry);
118
+            $prettyprintname = $newinstname;
119
+            $introtext = sprintf(_("a %s %s has invited you to manage the future %s  \"%s\" (%s)."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $uiElements->nomenclature_fed, $uiElements->nomenclature_inst, $prettyprintname, $newcountry) . " " . sprintf(_("This invitation is valid for 24 hours from now, i.e. until %s."), strftime("%x %X", time() + 86400));
120
+            // send the user back to his federation overview page, append the result of the operation later
121
+            // do the token creation magic
122
+            $newtoken = $mgmt->createToken(TRUE, $mailaddress, $newinstname, 0, $newcountry);
123
+            $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP FUTURE  - Token created for " . $mailaddress);
124
+            break;
125
+        case OPERATION_MODE_NEWFROMDB:
126
+            $redirect_destination = "../overview_federation.php?";
127
+            $mailaddress = abortOnBogusMail($newmailaddress, $redirect_destination);
128
+            // a real external DB entry was submitted and all the required parameters are there
129
+            $newexternalid = $validator->string($_POST['externals']);
130
+            $extinfo = $catInstance->getExternalDBEntityDetails($newexternalid);
131
+            $new_idp_authorized_fedadmin = $userObject->isFederationAdmin($extinfo['country']);
132
+            if ($new_idp_authorized_fedadmin !== TRUE) {
133
+                throw new Exception("Something's wrong... you want to create a new " . $uiElements->nomenclature_inst . ", but are not a " . $uiElements->nomenclature_fed . " admin for the " . $uiElements->nomenclature_fed . " it should be in!");
150 134
             }
151
-        }
152
-        // fill the rest of the text
153
-        $introtext = sprintf(_("a %s %s has invited you to manage the %s  \"%s\"."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $uiElements->nomenclature_fed, $uiElements->nomenclature_inst, $prettyprintname) . " " . sprintf(_("This invitation is valid for 24 hours from now, i.e. until %s."), strftime("%x %X", time() + 86400));
154
-        // do the token creation magic
155
-        $newtoken = $mgmt->createToken(TRUE, $mailaddress, $prettyprintname, $newexternalid);
156
-        $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP FUTURE  - Token created for " . $mailaddress);
157
-        break;
158
-    default: // includes OPERATION_MODE_INVALID
159
-        $wrongcontent = print_r($_POST, TRUE);
160
-        echo "<pre>Wrong parameters in POST:
135
+            $federation = $validator->Federation($extinfo['country']);
136
+            $newcountry = $extinfo['country'];
137
+            // 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
138
+            $prettyprintname = "";
139
+            foreach ($extinfo['names'] as $lang => $name) {
140
+                if ($lang == $languageInstance->getLang()) {
141
+                    $prettyprintname = $name;
142
+                }
143
+            }
144
+            if ($prettyprintname == "" && isset($extinfo['names']['en'])) {
145
+                $prettyprintname = $extinfo['names']['en'];
146
+            }
147
+            if ($prettyprintname == "") {
148
+                foreach ($extinfo['names'] as $name) {
149
+                    $prettyprintname = $name;
150
+                }
151
+            }
152
+            // fill the rest of the text
153
+            $introtext = sprintf(_("a %s %s has invited you to manage the %s  \"%s\"."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $uiElements->nomenclature_fed, $uiElements->nomenclature_inst, $prettyprintname) . " " . sprintf(_("This invitation is valid for 24 hours from now, i.e. until %s."), strftime("%x %X", time() + 86400));
154
+            // do the token creation magic
155
+            $newtoken = $mgmt->createToken(TRUE, $mailaddress, $prettyprintname, $newexternalid);
156
+            $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP FUTURE  - Token created for " . $mailaddress);
157
+            break;
158
+        default: // includes OPERATION_MODE_INVALID
159
+            $wrongcontent = print_r($_POST, TRUE);
160
+            echo "<pre>Wrong parameters in POST:
161 161
 " . htmlspecialchars($wrongcontent) . "
162 162
 </pre>";
163
-        exit(1);
163
+            exit(1);
164 164
 }
165 165
 // are we on https?
166 166
 $proto = "http://";
Please login to merge, or discard this patch.
core/UserAPI.php 1 patch
Doc Comments   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -125,6 +125,7 @@  discard block
 block discarded – undo
125 125
      * 
126 126
      * @param string $device
127 127
      * @param AbstractProfile $profile
128
+     * @param string $generatedFor
128 129
      * @return array info about the new installer (mime and link)
129 130
      */
130 131
     private function generateNewInstaller($device, $profile, $generatedFor, $token, $password) {
@@ -459,6 +460,10 @@  discard block
 block discarded – undo
459 460
         readfile($file);
460 461
     }
461 462
 
463
+    /**
464
+     * @param string $destFile
465
+     * @param integer $resize
466
+     */
462 467
     private function processImage($inputImage, $destFile, $width, $height, $resize) {
463 468
         $info = new \finfo();
464 469
         $filetype = $info->buffer($inputImage, FILEINFO_MIME_TYPE);
@@ -485,7 +490,6 @@  discard block
 block discarded – undo
485 490
      * When called for DiscoJuice, first check if file cache exists
486 491
      * If not then generate the file and save it in the cache
487 492
      * @param int $idp IdP identifier
488
-     * @param int $disco flag turning on image generation for DiscoJuice
489 493
      * @param int $width maximum width of the generated image 
490 494
      * @param int $height  maximum height of the generated image
491 495
      * if one of these is 0 then it is treated as no upper bound
Please login to merge, or discard this patch.
core/DeviceConfig.php 1 patch
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -260,6 +260,9 @@  discard block
 block discarded – undo
260 260
         return _("Sorry, this should not happen - no additional information is available");
261 261
     }
262 262
     
263
+    /**
264
+     * @param string $file
265
+     */
263 266
     private function findSourceFile($file) {
264 267
         if (is_file($this->module_path . '/Files/' . $this->device_id . '/' . $file)) {
265 268
             return $this->module_path . '/Files/' . $this->device_id . '/' . $file;
@@ -540,6 +543,9 @@  discard block
 block discarded – undo
540 543
         'application/pdf' => 'pdf',
541 544
     ];
542 545
 
546
+    /**
547
+     * @param string $type
548
+     */
543 549
     private function saveLogoFile($logos,$type) {
544 550
         $iterator = 0;
545 551
         $returnarray = [];
Please login to merge, or discard this patch.
web/admin/action_enrollment.php 1 patch
Switch Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -53,14 +53,14 @@
 block discarded – undo
53 53
 }
54 54
 
55 55
 switch ($_GET['token']) {
56
-    case "SELF-REGISTER":
57
-        $token = "SELF-REGISTER";
58
-        $checkval = \core\UserManagement::TOKENSTATUS_OK_NEW;
59
-        $federation = CONFIG_CONFASSISTANT['CONSORTIUM']['selfservice_registration'];
60
-        break;
61
-    default:
62
-        $token = $validator->token(filter_input(INPUT_GET,'token',FILTER_SANITIZE_STRING));
63
-        $checkval = $usermgmt->checkTokenValidity($token);
56
+        case "SELF-REGISTER":
57
+            $token = "SELF-REGISTER";
58
+            $checkval = \core\UserManagement::TOKENSTATUS_OK_NEW;
59
+            $federation = CONFIG_CONFASSISTANT['CONSORTIUM']['selfservice_registration'];
60
+            break;
61
+        default:
62
+            $token = $validator->token(filter_input(INPUT_GET,'token',FILTER_SANITIZE_STRING));
63
+            $checkval = $usermgmt->checkTokenValidity($token);
64 64
 }
65 65
 
66 66
 if ($checkval < 0) {
Please login to merge, or discard this patch.
web/lib/admin/OptionDisplay.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -205,7 +205,7 @@
 block discarded – undo
205 205
      * @param int $rowid the HTML field base name of the option to be displayed
206 206
      * @param string $optionName the name of the option to display
207 207
      * @param string $optionValue the value of the option to display
208
-     * @param mixed $optionLang the language of the option to display
208
+     * @param null|string $optionLang the language of the option to display
209 209
      * @return string HTML code
210 210
      * @throws Exception
211 211
      */
Please login to merge, or discard this patch.
core/AbstractProfile.php 1 patch
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -96,6 +96,12 @@
 block discarded – undo
96 96
      */
97 97
     protected $frontendHandle;
98 98
 
99
+    /**
100
+     * @param integer $idpIdentifier
101
+     * @param string $deviceId
102
+     * @param string $area
103
+     * @param string $lang
104
+     */
99 105
     protected function saveDownloadDetails($idpIdentifier, $profileId, $deviceId, $area, $lang, $eapType) {
100 106
         if (CONFIG['PATHS']['logdir']) {
101 107
             $file = fopen(CONFIG['PATHS']['logdir'] . "/download_details.log", "a");
Please login to merge, or discard this patch.
core/ProfileSilverbullet.php 1 patch
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -56,6 +56,9 @@  discard block
 block discarded – undo
56 56
 
57 57
     const PRODUCTNAME = "Managed IdP";
58 58
 
59
+    /**
60
+     * @param integer $length
61
+     */
59 62
     public static function randomString(
60 63
     $length, $keyspace = '23456789abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
61 64
     ) {
@@ -238,6 +241,7 @@  discard block
 block discarded – undo
238 241
     /**
239 242
      * create a CSR
240 243
      * 
244
+     * @param resource $privateKey
241 245
      * @return 
242 246
      */
243 247
     private function generateCsr($privateKey) {
@@ -277,6 +281,7 @@  discard block
 block discarded – undo
277 281
      * take a CSR and sign it with our issuing CA's certificate
278 282
      * 
279 283
      * @param mixed $csr the CSR
284
+     * @param integer $expiryDays
280 285
      */
281 286
     private function signCsr($csr, $expiryDays) {
282 287
         switch (CONFIG_CONFASSISTANT['SILVERBULLET']['CA']['type']) {
Please login to merge, or discard this patch.