Passed
Push — release_2_1 ( 007f3d...3ea6a4 )
by Tomasz
09:51
created
web/admin/action_enrollment.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 ?>
31 31
 <?php
32 32
 
33
-require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php";
33
+require_once dirname(dirname(dirname(__FILE__)))."/config/_config.php";
34 34
 
35 35
 $auth = new \web\lib\admin\Authentication();
36 36
 $deco = new \web\lib\admin\PageDecoration();
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
 $auth->authenticate();
42 42
 
43 43
 if (!isset($_GET['token'])) {
44
-    $elements->errorPage(_("Error creating new IdP binding!"),_("This page needs to be called with a valid invitation token!"));
44
+    $elements->errorPage(_("Error creating new IdP binding!"), _("This page needs to be called with a valid invitation token!"));
45 45
 }
46 46
 
47 47
 if (\config\ConfAssistant::CONSORTIUM['selfservice_registration'] === NULL && $_GET['token'] == "SELF-REGISTER") {
48
-    $elements->errorPage(_("Error creating new IdP binding!"),_("You tried to register in self-service, but this deployment does not allow self-service!"));
48
+    $elements->errorPage(_("Error creating new IdP binding!"), _("You tried to register in self-service, but this deployment does not allow self-service!"));
49 49
 }
50 50
 
51 51
 switch ($_GET['token']) {
@@ -55,23 +55,23 @@  discard block
 block discarded – undo
55 55
         $federation = \config\ConfAssistant::CONSORTIUM['selfservice_registration'];
56 56
         break;
57 57
     default:
58
-        $tokenUnfiltered = $validator->token(filter_input(INPUT_GET,'token'));
58
+        $tokenUnfiltered = $validator->token(filter_input(INPUT_GET, 'token'));
59 59
         $token = htmlspecialchars(strip_tags($tokenUnfiltered));
60 60
         $checkval = $usermgmt->checkTokenValidity($token);
61 61
 }
62 62
 
63 63
 if ($checkval < 0) {
64 64
     echo $deco->pageheader(_("Error creating new IdP binding!"), "ADMIN-IDP");
65
-    echo "<h1>" . _("Error creating new IdP binding!") . "</h1>";
65
+    echo "<h1>"._("Error creating new IdP binding!")."</h1>";
66 66
     switch ($checkval) {
67 67
         case \core\UserManagement::TOKENSTATUS_FAIL_ALREADYCONSUMED:
68
-            echo "<p>" . sprintf(_("Sorry... this token has already been used. The %s is already created. If you got the invitation from a mailing list, probably someone else used it before you."), $elements->nomenclatureParticipant) . "</p>";
68
+            echo "<p>".sprintf(_("Sorry... this token has already been used. The %s is already created. If you got the invitation from a mailing list, probably someone else used it before you."), $elements->nomenclatureParticipant)."</p>";
69 69
             break;
70 70
         case \core\UserManagement::TOKENSTATUS_FAIL_EXPIRED:
71
-            echo "<p>" . sprintf(_("Sorry... this token has expired. Invitation tokens are valid for 24 hours. The %s administrator can create a new one for you."), $elements->nomenclatureFed) . "</p>";
71
+            echo "<p>".sprintf(_("Sorry... this token has expired. Invitation tokens are valid for 24 hours. The %s administrator can create a new one for you."), $elements->nomenclatureFed)."</p>";
72 72
             break;
73 73
         default:
74
-            echo "<p>" . _("Sorry... you have come to the enrollment page without a valid token. Are you a nasty person? If not, you should go to <a href='overview_user.php'>your profile page</a> instead.") . "</p>";
74
+            echo "<p>"._("Sorry... you have come to the enrollment page without a valid token. Are you a nasty person? If not, you should go to <a href='overview_user.php'>your profile page</a> instead.")."</p>";
75 75
     }
76 76
     echo $deco->footer();
77 77
     throw new Exception("Terminating because something is wrong with the token we received.");
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
     case "SELF-REGISTER":
87 87
         $fed = new \core\Federation($federation);
88 88
         $newidp = new \core\IdP($fed->newIdP(core\IdP::TYPE_IDPSP, $user, "FED", "SELFSERVICE"));
89
-        $loggerInstance->writeAudit($user, "MOD", "IdP " . $newidp->identifier . " - selfservice registration");
89
+        $loggerInstance->writeAudit($user, "MOD", "IdP ".$newidp->identifier." - selfservice registration");
90 90
         break;
91 91
     default:
92 92
         $newidp = $usermgmt->createIdPFromToken($token, $user);
93 93
         $usermgmt->invalidateToken($token);
94
-        $loggerInstance->writeAudit($user, "MOD", "IdP " . $newidp->identifier . " - Token used and invalidated");
94
+        $loggerInstance->writeAudit($user, "MOD", "IdP ".$newidp->identifier." - Token used and invalidated");
95 95
         break;
96 96
 }
97 97
 
Please login to merge, or discard this patch.
core/IdP.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -115,12 +115,12 @@  discard block
 block discarded – undo
115 115
         $this->name = $this->languageInstance->getLocalisedValue($this->getAttributes('general:instname'));
116 116
         $eligibility = $this->eligibility($instQuery->type);
117 117
         if (in_array(IdP::ELIGIBILITY_IDP, $eligibility) && in_array(IdP::ELIGIBILITY_SP, $eligibility)) {
118
-            $eligType = IdP::TYPE_IDPSP . "";
118
+            $eligType = IdP::TYPE_IDPSP."";
119 119
             $this->type = $eligType;
120 120
         } elseif (in_array(IdP::ELIGIBILITY_IDP, $eligibility)) {
121
-            $eligType = IdP::TYPE_IDP . "";
121
+            $eligType = IdP::TYPE_IDP."";
122 122
         } else {
123
-            $eligType = IdP::TYPE_SP . "";
123
+            $eligType = IdP::TYPE_SP."";
124 124
         }
125 125
         $this->type = $eligType;
126 126
         $this->loggerInstance->debug(4, "--- END Constructing new IdP object $instId ... ---\n");
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
      */
135 135
     public function listProfiles(bool $activeOnly = FALSE)
136 136
     {
137
-        $query = "SELECT profile_id FROM profile WHERE inst_id = $this->identifier" . ($activeOnly ? " AND showtime = 1" : "");
137
+        $query = "SELECT profile_id FROM profile WHERE inst_id = $this->identifier".($activeOnly ? " AND showtime = 1" : "");
138 138
         $allProfiles = $this->databaseHandle->exec($query);
139 139
         $returnarray = [];
140 140
         // SELECT -> resource, not boolean
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
             $returnarray[] = $oneProfile;
145 145
         }
146 146
 
147
-        $this->loggerInstance->debug(4, "listProfiles: " . /** @scrutinizer ignore-type */ print_r($returnarray, true));
147
+        $this->loggerInstance->debug(4, "listProfiles: "./** @scrutinizer ignore-type */ print_r($returnarray, true));
148 148
         return $returnarray;
149 149
     }
150 150
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      */
157 157
     public function listDeployments(bool $activeOnly = FALSE)
158 158
     {
159
-        $query = "SELECT deployment_id FROM deployment WHERE inst_id = $this->identifier" . ($activeOnly ? " AND status = " . AbstractDeployment::ACTIVE : "");
159
+        $query = "SELECT deployment_id FROM deployment WHERE inst_id = $this->identifier".($activeOnly ? " AND status = ".AbstractDeployment::ACTIVE : "");
160 160
         $allDeployments = $this->databaseHandle->exec($query);
161 161
         $returnarray = [];
162 162
         // SELECT -> resource, not boolean
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
             $returnarray[] = new DeploymentManaged($this, $deploymentQuery->deployment_id);
165 165
         }
166 166
 
167
-        $this->loggerInstance->debug(4, "listDeployments: " . /** @scrutinizer ignore-type */ print_r($returnarray, true));
167
+        $this->loggerInstance->debug(4, "listDeployments: "./** @scrutinizer ignore-type */ print_r($returnarray, true));
168 168
         return $returnarray;
169 169
     }
170 170
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
         $redirectProfileIds = [];
191 191
         $allProfileLevels = $this->databaseHandle->exec("SELECT profile_id, sufficient_config + showtime AS maxlevel FROM profile WHERE inst_id = $this->identifier ORDER BY maxlevel DESC");
192 192
         // SELECT yields a resource, not a boolean
193
-        if ($allProfileLevels->num_rows == 0 ) {
193
+        if ($allProfileLevels->num_rows == 0) {
194 194
             return self::PROFILES_INCOMPLETE;
195 195
         }
196 196
         $allProfilesArray = $allProfileLevels->fetch_all(MYSQLI_ASSOC);
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
         $allProfiles = $this->databaseHandle->exec("SELECT MIN(openroaming) AS maxlevel FROM profile WHERE inst_id = $this->identifier");
219 219
         // SELECT yields a resource, not a boolean
220 220
         while ($res = mysqli_fetch_object(/** @scrutinizer ignore-type */ $allProfiles)) {
221
-            return (is_numeric($res->maxlevel) ? (int)$res->maxlevel : AbstractProfile::OVERALL_OPENROAMING_LEVEL_NO ); // insts without profiles should get a "NO"
221
+            return (is_numeric($res->maxlevel) ? (int) $res->maxlevel : AbstractProfile::OVERALL_OPENROAMING_LEVEL_NO); // insts without profiles should get a "NO"
222 222
         }
223 223
         return AbstractProfile::OVERALL_OPENROAMING_LEVEL_NO;
224 224
     }
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
                 case AbstractProfile::PROFILETYPE_SILVERBULLET:
350 350
                     $theProfile = new ProfileSilverbullet($identifier, $this);
351 351
                     $theProfile->addSupportedEapMethod(new \core\common\EAP(\core\common\EAP::EAPTYPE_SILVERBULLET), 1);
352
-                    $theProfile->setRealm($this->identifier . "-" . $theProfile->identifier . "." . strtolower($this->federation) . strtolower(\config\ConfAssistant::SILVERBULLET['realm_suffix']));
352
+                    $theProfile->setRealm($this->identifier."-".$theProfile->identifier.".".strtolower($this->federation).strtolower(\config\ConfAssistant::SILVERBULLET['realm_suffix']));
353 353
                     return $theProfile;
354 354
                 default:
355 355
                     throw new Exception("This type of profile is unknown and can not be added.");
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
     public function getExternalDBId()
493 493
     {
494 494
         if (\config\ConfAssistant::CONSORTIUM['name'] == "eduroam" && isset(\config\ConfAssistant::CONSORTIUM['deployment-voodoo']) && \config\ConfAssistant::CONSORTIUM['deployment-voodoo'] == "Operations Team") { // SW: APPROVED
495
-            $idQuery = $this->databaseHandle->exec("SELECT external_db_id FROM institution WHERE inst_id = $this->identifier AND external_db_syncstate = " . self::EXTERNAL_DB_SYNCSTATE_SYNCED);
495
+            $idQuery = $this->databaseHandle->exec("SELECT external_db_id FROM institution WHERE inst_id = $this->identifier AND external_db_syncstate = ".self::EXTERNAL_DB_SYNCSTATE_SYNCED);
496 496
             // SELECT -> it's a resource, not a boolean
497 497
             if (mysqli_num_rows(/** @scrutinizer ignore-type */ $idQuery) == 0) {
498 498
                 return FALSE;
@@ -558,16 +558,16 @@  discard block
 block discarded – undo
558 558
         }
559 559
         foreach ($baseline as $lang => $value) {
560 560
             if (!key_exists($lang, $newvalues)) {
561
-                $retval[IdP::INSTNAME_CHANGED] .= "#[Language " . strtoupper($lang) . "] DELETED";
561
+                $retval[IdP::INSTNAME_CHANGED] .= "#[Language ".strtoupper($lang)."] DELETED";
562 562
             } else {
563 563
                 if ($value != $newvalues[$lang]) {
564
-                    $retval[IdP::INSTNAME_CHANGED] .= "#[Language " . strtoupper($lang) . "] CHANGED from '" . $baseline[$lang] . "' to '" . $newvalues[$lang] . "'";
564
+                    $retval[IdP::INSTNAME_CHANGED] .= "#[Language ".strtoupper($lang)."] CHANGED from '".$baseline[$lang]."' to '".$newvalues[$lang]."'";
565 565
                 }
566 566
             }
567 567
         }
568 568
         foreach ($newvalues as $lang => $value) {
569 569
             if (!key_exists($lang, $baseline)) {
570
-                $retval[IdP::INSTNAME_CHANGED] .= "#[Language " . strtoupper($lang) . "] ADDED as '" . $value . "'";
570
+                $retval[IdP::INSTNAME_CHANGED] .= "#[Language ".strtoupper($lang)."] ADDED as '".$value."'";
571 571
             }
572 572
         }
573 573
         return $retval;
Please login to merge, or discard this patch.