Passed
Push — release_2_1 ( b6f83a...246761 )
by Tomasz
09:58
created
core/DBConnection.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -62,24 +62,24 @@  discard block
 block discarded – undo
62 62
             case "EXTERNAL":
63 63
             case "FRONTEND":
64 64
             case "DIAGNOSTICS":
65
-                if (!isset(self::${"instance" . $theDb})) {
65
+                if (!isset(self::${"instance".$theDb})) {
66 66
                     $class = __CLASS__;
67
-                    self::${"instance" . $theDb} = new $class($database);
68
-                    DBConnection::${"instance" . $theDb}->databaseInstance = $theDb;
67
+                    self::${"instance".$theDb} = new $class($database);
68
+                    DBConnection::${"instance".$theDb}->databaseInstance = $theDb;
69 69
                 }
70
-                return self::${"instance" . $theDb};
70
+                return self::${"instance".$theDb};
71 71
             case "RADIUS":
72
-                if (!isset(self::${"instance" . $theDb})) {
72
+                if (!isset(self::${"instance".$theDb})) {
73 73
                     $class = __CLASS__;
74 74
                     foreach (\config\ConfAssistant::DB as $name => $oneRadiusAuthDb) {
75 75
                         $theInstance = new $class($name);
76
-                        self::${"instance" . $theDb}[] = $theInstance;
76
+                        self::${"instance".$theDb}[] = $theInstance;
77 77
                         $theInstance->databaseInstance = $theDb;
78 78
                     }
79 79
                 }
80
-                return self::${"instance" . $theDb};
80
+                return self::${"instance".$theDb};
81 81
             default:
82
-                throw new Exception("This type of database (" . strtoupper($database) . ") is not known!");
82
+                throw new Exception("This type of database (".strtoupper($database).") is not known!");
83 83
         }
84 84
     }
85 85
 
@@ -121,18 +121,18 @@  discard block
 block discarded – undo
121 121
             }
122 122
         }
123 123
         // log exact query to debug log, if log level is at 5
124
-        $this->loggerInstance->debug(5, "DB ATTEMPT: ".$this->databaseInstance .": " . $querystring . "\n");
124
+        $this->loggerInstance->debug(5, "DB ATTEMPT: ".$this->databaseInstance.": ".$querystring."\n");
125 125
         if ($types !== NULL) {
126
-            $this->loggerInstance->debug(5, "Argument type sequence: $types, parameters are: " . /** @scrutinizer ignore-type */ print_r($arguments, true));
126
+            $this->loggerInstance->debug(5, "Argument type sequence: $types, parameters are: "./** @scrutinizer ignore-type */ print_r($arguments, true));
127 127
         }
128 128
 
129 129
         if ($this->connection->connect_error) {
130
-            throw new Exception("ERROR: Cannot send query to $this->databaseInstance database (no connection, error number" . $this->connection->connect_error . ")!");
130
+            throw new Exception("ERROR: Cannot send query to $this->databaseInstance database (no connection, error number".$this->connection->connect_error.")!");
131 131
         }
132 132
         if ($types === NULL) {
133 133
             $result = $this->connection->query($querystring);
134 134
             if ($result === FALSE) {
135
-                throw new Exception("DB: Unable to execute simple statement! Error was --> " . $this->connection->error . " <--");
135
+                throw new Exception("DB: Unable to execute simple statement! Error was --> ".$this->connection->error." <--");
136 136
             }
137 137
         } else {
138 138
             // fancy! prepared statement with dedicated argument list
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
                 }
149 149
                 $prepResult = $statementObject->prepare($querystring);
150 150
                 if ($prepResult === FALSE) {
151
-                    throw new Exception("DB: Unable to prepare statement! Statement was --> $querystring <--, error was --> " . $statementObject->error . " <--.");
151
+                    throw new Exception("DB: Unable to prepare statement! Statement was --> $querystring <--, error was --> ".$statementObject->error." <--.");
152 152
                 }
153 153
                 $this->preparedStatements[$querystring] = $statementObject;
154 154
             }
@@ -161,11 +161,11 @@  discard block
 block discarded – undo
161 161
             array_unshift($localArray, $types);
162 162
             $retval = call_user_func_array([$statementObject, "bind_param"], $localArray);
163 163
             if ($retval === FALSE) {
164
-                throw new Exception("DB: Unable to bind parameters to prepared statement! Argument array was --> " . var_export($localArray, TRUE) . " <--. Error was --> " . $statementObject->error . " <--");
164
+                throw new Exception("DB: Unable to bind parameters to prepared statement! Argument array was --> ".var_export($localArray, TRUE)." <--. Error was --> ".$statementObject->error." <--");
165 165
             }
166 166
             $result = $statementObject->execute();
167 167
             if ($result === FALSE) {
168
-                throw new Exception("DB: Unable to execute prepared statement! Error was --> " . $statementObject->error . " <--");
168
+                throw new Exception("DB: Unable to execute prepared statement! Error was --> ".$statementObject->error." <--");
169 169
             }
170 170
             $selectResult = $statementObject->get_result();
171 171
             if ($selectResult !== FALSE) {
@@ -175,14 +175,14 @@  discard block
 block discarded – undo
175 175
 
176 176
         // all cases where $result could be FALSE have been caught earlier
177 177
         if ($this->connection->errno) {
178
-            throw new Exception("ERROR: Cannot execute query in $this->databaseInstance database - (hopefully escaped) query was '$querystring', errno was " . $this->connection->errno . "!");
178
+            throw new Exception("ERROR: Cannot execute query in $this->databaseInstance database - (hopefully escaped) query was '$querystring', errno was ".$this->connection->errno."!");
179 179
         }
180 180
 
181 181
 
182 182
         if ($isMoreThanSelect || \config\Master::DEBUG_LEVEL == 5) {
183
-            $this->loggerInstance->writeSQLAudit("[DB: " . strtoupper($this->databaseInstance) . "] " . $querystring);
183
+            $this->loggerInstance->writeSQLAudit("[DB: ".strtoupper($this->databaseInstance)."] ".$querystring);
184 184
             if ($types !== NULL) {
185
-                $this->loggerInstance->writeSQLAudit("Argument type sequence: $types, parameters are: " . /** @scrutinizer ignore-type */ print_r($arguments, true));
185
+                $this->loggerInstance->writeSQLAudit("Argument type sequence: $types, parameters are: "./** @scrutinizer ignore-type */ print_r($arguments, true));
186 186
             }
187 187
         }
188 188
         return $result;
@@ -280,13 +280,13 @@  discard block
 block discarded – undo
280 280
         if (isset(\config\Master::DB[$databaseCapitalised])) {
281 281
             $this->connection = new \mysqli(\config\Master::DB[$databaseCapitalised]['host'], \config\Master::DB[$databaseCapitalised]['user'], \config\Master::DB[$databaseCapitalised]['pass'], \config\Master::DB[$databaseCapitalised]['db']);
282 282
             if ($this->connection->connect_error) {
283
-                throw new Exception("ERROR: Unable to connect to $database database! This is a fatal error, giving up (error number " . $this->connection->connect_errno . ").");
283
+                throw new Exception("ERROR: Unable to connect to $database database! This is a fatal error, giving up (error number ".$this->connection->connect_errno.").");
284 284
             }
285 285
             $this->readOnly = \config\Master::DB[$databaseCapitalised]['readonly'];
286 286
         } else { // one of the RADIUS DBs
287 287
             $this->connection = new \mysqli(\config\ConfAssistant::DB[$databaseCapitalised]['host'], \config\ConfAssistant::DB[$databaseCapitalised]['user'], \config\ConfAssistant::DB[$databaseCapitalised]['pass'], \config\ConfAssistant::DB[$databaseCapitalised]['db']);
288 288
             if ($this->connection->connect_error) {
289
-                throw new Exception("ERROR: Unable to connect to $database database! This is a fatal error, giving up (error number " . $this->connection->connect_errno . ").");
289
+                throw new Exception("ERROR: Unable to connect to $database database! This is a fatal error, giving up (error number ".$this->connection->connect_errno.").");
290 290
             }
291 291
             $this->readOnly = \config\ConfAssistant::DB[$databaseCapitalised]['readonly'];
292 292
         }
Please login to merge, or discard this patch.
web/admin/action_enrollment.php 2 patches
Switch Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -49,15 +49,15 @@
 block discarded – undo
49 49
 }
50 50
 
51 51
 switch ($_GET['token']) {
52
-    case "SELF-REGISTER":
53
-        $token = "SELF-REGISTER";
54
-        $checkval = \core\UserManagement::TOKENSTATUS_OK_NEW;
55
-        $federation = \config\ConfAssistant::CONSORTIUM['selfservice_registration'];
56
-        break;
57
-    default:
58
-        $tokenUnfiltered = $validator->token(filter_input(INPUT_GET,'token'));
59
-        $token = htmlspecialchars(strip_tags($token));
60
-        $checkval = $usermgmt->checkTokenValidity($token);
52
+        case "SELF-REGISTER":
53
+            $token = "SELF-REGISTER";
54
+            $checkval = \core\UserManagement::TOKENSTATUS_OK_NEW;
55
+            $federation = \config\ConfAssistant::CONSORTIUM['selfservice_registration'];
56
+            break;
57
+        default:
58
+            $tokenUnfiltered = $validator->token(filter_input(INPUT_GET,'token'));
59
+            $token = htmlspecialchars(strip_tags($token));
60
+            $checkval = $usermgmt->checkTokenValidity($token);
61 61
 }
62 62
 
63 63
 if ($checkval < 0) {
Please login to merge, or discard this 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($token));
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.
web/diag/magicTelepath.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@
 block discarded – undo
19 19
  *          <base_url>/copyright.php after deploying the software
20 20
  */
21 21
 
22
-require_once dirname(dirname(__DIR__)) . "/config/_config.php";
22
+require_once dirname(dirname(__DIR__))."/config/_config.php";
23 23
 $realm = htmlspecialchars(strip_tags(filter_input(INPUT_GET, 'realm')));
24
-$visited = htmlspecialchars(strip_tags(filter_input(INPUT_GET,'visited')));
25
-$nro = htmlspecialchars(strip_tags(filter_input(INPUT_GET,'nro')));
24
+$visited = htmlspecialchars(strip_tags(filter_input(INPUT_GET, 'visited')));
25
+$nro = htmlspecialchars(strip_tags(filter_input(INPUT_GET, 'nro')));
26 26
 \core\CAT::sessionStart();
27 27
 $languageObject = new core\common\Language();
28 28
 $languageObject->setTextDomain("diagonstics");
Please login to merge, or discard this patch.
web/diag/testTelepath.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  *          <base_url>/copyright.php after deploying the software
20 20
  */
21 21
 
22
-require_once dirname(dirname(__DIR__)) . "/config/_config.php";
22
+require_once dirname(dirname(__DIR__))."/config/_config.php";
23 23
 
24 24
 $therealm = htmlspecialchars(strip_tags(filter_input(INPUT_GET, 'realm')));
25 25
 $thevisited = htmlspecialchars(strip_tags(filter_input(INPUT_GET, 'visited')));
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     $validator = new \web\lib\common\InputValidation();
36 36
     
37 37
     echo "<pre>";
38
-    echo "Testing " . $validatedRealm . " in " . $validator->string($thevisited);
38
+    echo "Testing ".$validatedRealm." in ".$validator->string($thevisited);
39 39
     print_r($telepath->magic());
40 40
     echo "</pre>";
41 41
 }
42 42
\ No newline at end of file
Please login to merge, or discard this patch.
web/accountstatus/accountstatus.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  * @author Stefan Winter <[email protected]>
27 27
  * @package Core
28 28
  */
29
-require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php";
29
+require_once dirname(dirname(dirname(__FILE__)))."/config/_config.php";
30 30
 
31 31
 $cleanToken = FALSE;
32 32
 $invitationObject = new core\SilverbulletInvitation("INVALID");
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
 $statusInfo = ["token" => $cleanToken,
76 76
     "invitation_object" => $invitationObject,
77
-    "OS" => $Gui->operatingSystem,];
77
+    "OS" => $Gui->operatingSystem, ];
78 78
 
79 79
 if ($profile !== NULL) {
80 80
     $attributes = $Gui->profileAttributes($profile->identifier);
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 $caAndSerial = htmlspecialchars(strip_tags($caAndSerialUnfiltered));
89 89
 
90 90
 if ($action !== NULL && $action !== FALSE && $action === \web\lib\common\FormElements::BUTTON_DELETE && $caAndSerial !== NULL && $caAndSerial !== FALSE) {
91
-    $tuple = explode(':',$caAndSerial);
91
+    $tuple = explode(':', $caAndSerial);
92 92
     $ca_type = $tuple[0];
93 93
     $serial = $tuple[1];
94 94
     if ($statusInfo['invitation_object']->invitationTokenStatus != \core\SilverbulletInvitation::SB_TOKENSTATUS_INVALID) {
@@ -103,12 +103,12 @@  discard block
 block discarded – undo
103 103
                 print "//REVOKING\n";
104 104
                 $certObject = new \core\SilverbulletCertificate($serial, $ca_type);
105 105
                 $certObject->revokeCertificate();
106
-                header("Location: accountstatus.php?token=" . $statusInfo['token']);
106
+                header("Location: accountstatus.php?token=".$statusInfo['token']);
107 107
                 exit;
108 108
             }
109 109
         }
110 110
     }
111
-    header("Location: accountstatus.php?token=" . $statusInfo['token']);
111
+    header("Location: accountstatus.php?token=".$statusInfo['token']);
112 112
     exit;
113 113
 }
114 114
 
@@ -133,4 +133,4 @@  discard block
 block discarded – undo
133 133
 $skinObject = new \web\lib\user\Skinjob($_REQUEST['skin'] ?? $_SESSION['skin'] ?? $fedskin[0] ?? \config\Master::APPEARANCE['skins'][0]);
134 134
 
135 135
 // and now, serve actual data
136
-require "../skins/" . $skinObject->skin . "/accountstatus/accountstatus.php";
136
+require "../skins/".$skinObject->skin."/accountstatus/accountstatus.php";
Please login to merge, or discard this patch.