Passed
Push — master ( 4e6fdf...928979 )
by
unknown
03:22
created
lib/Cas/Ticket/SQLTicketStore.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         $dsn = $storeConfig->getString('dsn');
38 38
         $username = $storeConfig->getString('username');
39 39
         $password = $storeConfig->getString('password');
40
-        $options =  $storeConfig->getArray('options', array());
40
+        $options = $storeConfig->getArray('options', array());
41 41
         $this->prefix = $storeConfig->getString('prefix', '');
42 42
 
43 43
         $this->pdo = new PDO($dsn, $username, $password, $options);
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      */
88 88
     private function scopeTicketId($ticketId)
89 89
     {
90
-        return $this->prefix . '.' . $ticketId;
90
+        return $this->prefix.'.'.$ticketId;
91 91
     }
92 92
 
93 93
     private function initTableVersionTable()
@@ -96,15 +96,15 @@  discard block
 block discarded – undo
96 96
         $this->tableVersions = array();
97 97
 
98 98
         try {
99
-            $fetchTableVersion = $this->pdo->query('SELECT _name, _version FROM ' . $this->prefix . '_tableVersion');
99
+            $fetchTableVersion = $this->pdo->query('SELECT _name, _version FROM '.$this->prefix.'_tableVersion');
100 100
         } catch (PDOException $e) {
101
-            $this->pdo->exec('CREATE TABLE ' . $this->prefix
101
+            $this->pdo->exec('CREATE TABLE '.$this->prefix
102 102
                 . '_tableVersion (_name VARCHAR(30) NOT NULL UNIQUE, _version INTEGER NOT NULL)');
103 103
             return;
104 104
         }
105 105
 
106 106
         while (($row = $fetchTableVersion->fetch(PDO::FETCH_ASSOC)) !== false) {
107
-            $this->tableVersions[$row['_name']] = (int)$row['_version'];
107
+            $this->tableVersions[$row['_name']] = (int) $row['_version'];
108 108
         }
109 109
     }
110 110
 
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
             return;
116 116
         }
117 117
 
118
-        $query = 'CREATE TABLE ' . $this->prefix
118
+        $query = 'CREATE TABLE '.$this->prefix
119 119
             . '_kvstore (_key VARCHAR(50) NOT NULL, _value TEXT NOT NULL, _expire TIMESTAMP, PRIMARY KEY (_key))';
120 120
         $this->pdo->exec($query);
121 121
 
122
-        $query = 'CREATE INDEX ' . $this->prefix . '_kvstore_expire ON ' . $this->prefix . '_kvstore (_expire)';
122
+        $query = 'CREATE INDEX '.$this->prefix.'_kvstore_expire ON '.$this->prefix.'_kvstore (_expire)';
123 123
         $this->pdo->exec($query);
124 124
 
125 125
         $this->setTableVersion('kvstore', 1);
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         assert('is_int($version)');
151 151
 
152 152
         $this->insertOrUpdate(
153
-            $this->prefix . '_tableVersion',
153
+            $this->prefix.'_tableVersion',
154 154
             array('_name'),
155 155
             array(
156 156
                 '_name' => $name,
@@ -169,17 +169,17 @@  discard block
 block discarded – undo
169 169
     {
170 170
         assert('is_string($table)');
171 171
 
172
-        $colNames = '(' . implode(', ', array_keys($data)) . ')';
173
-        $values = 'VALUES(:' . implode(', :', array_keys($data)) . ')';
172
+        $colNames = '('.implode(', ', array_keys($data)).')';
173
+        $values = 'VALUES(:'.implode(', :', array_keys($data)).')';
174 174
 
175 175
         switch ($this->driver) {
176 176
             case 'mysql':
177
-                $query = 'REPLACE INTO ' . $table . ' ' . $colNames . ' ' . $values;
177
+                $query = 'REPLACE INTO '.$table.' '.$colNames.' '.$values;
178 178
                 $query = $this->pdo->prepare($query);
179 179
                 $query->execute($data);
180 180
                 return;
181 181
             case 'sqlite':
182
-                $query = 'INSERT OR REPLACE INTO ' . $table . ' ' . $colNames . ' ' . $values;
182
+                $query = 'INSERT OR REPLACE INTO '.$table.' '.$colNames.' '.$values;
183 183
                 $query = $this->pdo->prepare($query);
184 184
                 $query->execute($data);
185 185
                 return;
@@ -187,18 +187,18 @@  discard block
 block discarded – undo
187 187
 
188 188
         /* Default implementation. Try INSERT, and UPDATE if that fails. */
189 189
 
190
-        $insertQuery = 'INSERT INTO ' . $table . ' ' . $colNames . ' ' . $values;
190
+        $insertQuery = 'INSERT INTO '.$table.' '.$colNames.' '.$values;
191 191
         $insertQuery = $this->pdo->prepare($insertQuery);
192 192
         try {
193 193
             $insertQuery->execute($data);
194 194
             return;
195 195
         } catch (PDOException $e) {
196
-            $ecode = (string)$e->getCode();
196
+            $ecode = (string) $e->getCode();
197 197
             switch ($ecode) {
198 198
                 case '23505': /* PostgreSQL */
199 199
                     break;
200 200
                 default:
201
-                    SimpleSAML\Logger::error('casserver: Error while saving data: ' . $e->getMessage());
201
+                    SimpleSAML\Logger::error('casserver: Error while saving data: '.$e->getMessage());
202 202
                     throw $e;
203 203
             }
204 204
         }
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 
209 209
         foreach ($data as $col => $value) {
210 210
 
211
-            $tmp = $col . ' = :' . $col;
211
+            $tmp = $col.' = :'.$col;
212 212
 
213 213
             if (in_array($col, $keys, true)) {
214 214
                 $condCols[] = $tmp;
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
             }
218 218
         }
219 219
 
220
-        $updateQuery = 'UPDATE ' . $table . ' SET ' . implode(',', $updateCols) . ' WHERE '
220
+        $updateQuery = 'UPDATE '.$table.' SET '.implode(',', $updateCols).' WHERE '
221 221
             . implode(' AND ', $condCols);
222 222
         $updateQuery = $this->pdo->prepare($updateQuery);
223 223
         $updateQuery->execute($data);
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 
226 226
     private function cleanKVStore()
227 227
     {
228
-        $query = 'DELETE FROM ' . $this->prefix . '_kvstore WHERE _expire < :now';
228
+        $query = 'DELETE FROM '.$this->prefix.'_kvstore WHERE _expire < :now';
229 229
         $params = array('now' => gmdate('Y-m-d H:i:s'));
230 230
 
231 231
         $query = $this->pdo->prepare($query);
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
             $key = sha1($key);
245 245
         }
246 246
 
247
-        $query = 'SELECT _value FROM ' . $this->prefix
247
+        $query = 'SELECT _value FROM '.$this->prefix
248 248
             . '_kvstore WHERE _key = :key AND (_expire IS NULL OR _expire > :now)';
249 249
         $params = array('key' => $key, 'now' => gmdate('Y-m-d H:i:s'));
250 250
 
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
             '_expire' => $expire,
302 302
         );
303 303
 
304
-        $this->insertOrUpdate($this->prefix . '_kvstore', array('_key'), $data);
304
+        $this->insertOrUpdate($this->prefix.'_kvstore', array('_key'), $data);
305 305
     }
306 306
 
307 307
     /**
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
             '_key' => $key,
320 320
         );
321 321
 
322
-        $query = 'DELETE FROM ' . $this->prefix . '_kvstore WHERE _key=:_key';
322
+        $query = 'DELETE FROM '.$this->prefix.'_kvstore WHERE _key=:_key';
323 323
         $query = $this->pdo->prepare($query);
324 324
         $query->execute($data);
325 325
     }
Please login to merge, or discard this patch.
www/validate.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -68,34 +68,34 @@  discard block
 block discarded – undo
68 68
                     echo $protocol->getValidateFailureResponse();
69 69
                 } else {
70 70
                     if ($ticketFactory->isExpired($serviceTicket)) {
71
-                        $message = 'Ticket has ' . var_export($_GET['ticket'], true) . ' expired';
71
+                        $message = 'Ticket has '.var_export($_GET['ticket'], true).' expired';
72 72
                     } else {
73 73
                         if (sanitize($serviceTicket['service']) == sanitize($_GET['service'])) {
74 74
                             $message = 'Mismatching service parameters: expected '
75 75
                                 . var_export($serviceTicket['service'], true)
76
-                                . ' but was: ' . var_export($_GET['service'], true);
76
+                                . ' but was: '.var_export($_GET['service'], true);
77 77
                         } else {
78 78
                             $message = 'Ticket was issue from single sign on session';
79 79
                         }
80 80
                     }
81
-                    SimpleSAML\Logger::debug('casserver:' . $message);
81
+                    SimpleSAML\Logger::debug('casserver:'.$message);
82 82
 
83 83
                     echo $protocol->getValidateFailureResponse();
84 84
                 }
85 85
             }
86 86
         } else {
87 87
             if (is_null($serviceTicket)) {
88
-                $message = 'ticket: ' . var_export($_GET['ticket'], true) . ' not recognized';
88
+                $message = 'ticket: '.var_export($_GET['ticket'], true).' not recognized';
89 89
             } else {
90
-                $message = 'ticket: ' . var_export($_GET['ticket'], true) . ' is not a service ticket';
90
+                $message = 'ticket: '.var_export($_GET['ticket'], true).' is not a service ticket';
91 91
             }
92 92
 
93
-            SimpleSAML\Logger::debug('casserver:' . $message);
93
+            SimpleSAML\Logger::debug('casserver:'.$message);
94 94
 
95 95
             echo $protocol->getValidateFailureResponse();
96 96
         }
97 97
     } catch (Exception $e) {
98
-        SimpleSAML\Logger::error('casserver:validate: internal server error. ' . var_export($e->getMessage(), true));
98
+        SimpleSAML\Logger::error('casserver:validate: internal server error. '.var_export($e->getMessage(), true));
99 99
 
100 100
         echo $protocol->getValidateFailureResponse();
101 101
     }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         $message = 'Missing ticket parameter: [ticket]';
107 107
     }
108 108
 
109
-    SimpleSAML\Logger::debug('casserver:' . $message);
109
+    SimpleSAML\Logger::debug('casserver:'.$message);
110 110
 
111 111
     echo $protocol->getValidateFailureResponse();
112 112
 }
Please login to merge, or discard this patch.
www/cas.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,9 +39,9 @@
 block discarded – undo
39 39
 if (!isset($validFunctions[$function])) {
40 40
     $message = 'Not a valid function for cas.php.';
41 41
 
42
-    SimpleSAML\Logger::debug('casserver:' . $message);
42
+    SimpleSAML\Logger::debug('casserver:'.$message);
43 43
 
44 44
     throw new Exception($message);
45 45
 }
46 46
 
47
-include(dirname(__FILE__) . '/' . $validFunctions[$function] . '.php');
47
+include(dirname(__FILE__).'/'.$validFunctions[$function].'.php');
Please login to merge, or discard this patch.
www/logout.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 if (!$casconfig->getValue('enable_logout', false)) {
29 29
     $message = 'Logout not allowed';
30 30
 
31
-    SimpleSAML\Logger::debug('casserver:' . $message);
31
+    SimpleSAML\Logger::debug('casserver:'.$message);
32 32
 
33 33
     throw new Exception($message);
34 34
 }
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 if ($skipLogoutPage && !array_key_exists('url', $_GET)) {
39 39
     $message = 'Required URL query parameter [url] not provided. (CAS Server)';
40 40
 
41
-    SimpleSAML\Logger::debug('casserver:' . $message);
41
+    SimpleSAML\Logger::debug('casserver:'.$message);
42 42
 
43 43
     throw new Exception($message);
44 44
 }
Please login to merge, or discard this patch.
www/utility/urlUtils.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,11 +29,11 @@
 block discarded – undo
29 29
         }
30 30
         if (!ctype_alnum($legalUrl[0])) {
31 31
             // Probably a regex. Suppress errors incase the format is invalid
32
-            $result =  @preg_match($legalUrl, $service);
32
+            $result = @preg_match($legalUrl, $service);
33 33
             if ($result === 1) {
34 34
                 return true;
35 35
             } elseif ($result === false) {
36
-                SimpleSAML\Logger::warning("Invalid CAS legal service url '$legalUrl'. Error " . preg_last_error());
36
+                SimpleSAML\Logger::warning("Invalid CAS legal service url '$legalUrl'. Error ".preg_last_error());
37 37
             }
38 38
         } elseif (strpos($service, $legalUrl) === 0) {
39 39
             return true;
Please login to merge, or discard this patch.
www/utility/validateTicket.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
                             'sessionId' => $serviceTicket['sessionId']
79 79
                         ));
80 80
                         try {
81
-                            SimpleSAML\Utils\HTTP::fetch($pgtUrl . '?pgtIou=' . $proxyGrantingTicket['iou']
82
-                                . '&pgtId=' . $proxyGrantingTicket['id']);
81
+                            SimpleSAML\Utils\HTTP::fetch($pgtUrl.'?pgtIou='.$proxyGrantingTicket['iou']
82
+                                . '&pgtId='.$proxyGrantingTicket['id']);
83 83
 
84 84
                             $protocol->setProxyGrantingTicketIOU($proxyGrantingTicket['iou']);
85 85
 
@@ -92,29 +92,29 @@  discard block
 block discarded – undo
92 92
                 echo $protocol->getValidateSuccessResponse($serviceTicket['userName']);
93 93
             } else {
94 94
                 if ($ticketFactory->isExpired($serviceTicket)) {
95
-                    $message = 'Ticket ' . var_export($_GET['ticket'], true) . ' has expired';
95
+                    $message = 'Ticket '.var_export($_GET['ticket'], true).' has expired';
96 96
 
97
-                    SimpleSAML\Logger::debug('casserver:' . $message);
97
+                    SimpleSAML\Logger::debug('casserver:'.$message);
98 98
 
99 99
                     echo $protocol->getValidateFailureResponse('INVALID_TICKET', $message);
100 100
                 } else {
101 101
                     if (sanitize($serviceTicket['service']) != sanitize($_GET['service'])) {
102 102
                         $message = 'Mismatching service parameters: expected '
103 103
                             . var_export($serviceTicket['service'], true)
104
-                            . ' but was: ' . var_export($_GET['service'], true);
104
+                            . ' but was: '.var_export($_GET['service'], true);
105 105
 
106
-                        SimpleSAML\Logger::debug('casserver:' . $message);
106
+                        SimpleSAML\Logger::debug('casserver:'.$message);
107 107
 
108 108
                         echo $protocol->getValidateFailureResponse('INVALID_SERVICE', $message);
109 109
                     } else {
110 110
                         if ($serviceTicket['forceAuthn'] != $forceAuthn) {
111 111
                             $message = 'Ticket was issue from single sign on session';
112 112
 
113
-                            SimpleSAML\Logger::debug('casserver:' . $message);
113
+                            SimpleSAML\Logger::debug('casserver:'.$message);
114 114
 
115 115
                             echo $protocol->getValidateFailureResponse('INVALID_TICKET', $message);
116 116
                         } else {
117
-                            SimpleSAML\Logger::error('casserver:' . $method . ': internal server error.');
117
+                            SimpleSAML\Logger::error('casserver:'.$method.': internal server error.');
118 118
 
119 119
                             echo $protocol->getValidateFailureResponse('INTERNAL_ERROR', 'Unknown internal error');
120 120
                         }
@@ -123,23 +123,23 @@  discard block
 block discarded – undo
123 123
             }
124 124
         } else {
125 125
             if (is_null($serviceTicket)) {
126
-                $message = 'Ticket ' . var_export($_GET['ticket'], true) . ' not recognized';
126
+                $message = 'Ticket '.var_export($_GET['ticket'], true).' not recognized';
127 127
 
128
-                SimpleSAML\Logger::debug('casserver:' . $message);
128
+                SimpleSAML\Logger::debug('casserver:'.$message);
129 129
 
130 130
                 echo $protocol->getValidateFailureResponse('INVALID_TICKET', $message);
131 131
             } else {
132 132
                 if ($ticketFactory->isProxyTicket($serviceTicket) && $method == 'serviceValidate') {
133
-                    $message = 'Ticket ' . var_export($_GET['ticket'], true)
133
+                    $message = 'Ticket '.var_export($_GET['ticket'], true)
134 134
                         . ' is a proxy ticket. Use proxyValidate instead.';
135 135
 
136
-                    SimpleSAML\Logger::debug('casserver:' . $message);
136
+                    SimpleSAML\Logger::debug('casserver:'.$message);
137 137
 
138 138
                     echo $protocol->getValidateFailureResponse('INVALID_TICKET', $message);
139 139
                 } else {
140
-                    $message = 'Ticket ' . var_export($_GET['ticket'], true) . ' is not a service ticket';
140
+                    $message = 'Ticket '.var_export($_GET['ticket'], true).' is not a service ticket';
141 141
 
142
-                    SimpleSAML\Logger::debug('casserver:' . $message);
142
+                    SimpleSAML\Logger::debug('casserver:'.$message);
143 143
 
144 144
                     echo $protocol->getValidateFailureResponse('INVALID_TICKET', $message);
145 145
                 }
@@ -156,13 +156,13 @@  discard block
 block discarded – undo
156 156
     if (!array_key_exists('service', $_GET)) {
157 157
         $message = 'Missing service parameter: [service]';
158 158
 
159
-        SimpleSAML\Logger::debug('casserver:' . $message);
159
+        SimpleSAML\Logger::debug('casserver:'.$message);
160 160
 
161 161
         echo $protocol->getValidateFailureResponse('INVALID_REQUEST', $message);
162 162
     } else {
163 163
         $message = 'Missing ticket parameter: [ticket]';
164 164
 
165
-        SimpleSAML\Logger::debug('casserver:' . $message);
165
+        SimpleSAML\Logger::debug('casserver:'.$message);
166 166
 
167 167
         echo $protocol->getValidateFailureResponse('INVALID_REQUEST', $message);
168 168
     }
Please login to merge, or discard this patch.
www/proxy.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -63,42 +63,42 @@
 block discarded – undo
63 63
 
64 64
             echo $protocol->getProxySuccessResponse($proxyTicket['id']);
65 65
         } else {
66
-            $message = 'Ticket ' . var_export($_GET['pgt'], true) . ' has expired';
66
+            $message = 'Ticket '.var_export($_GET['pgt'], true).' has expired';
67 67
 
68
-            SimpleSAML\Logger::debug('casserver:' . $message);
68
+            SimpleSAML\Logger::debug('casserver:'.$message);
69 69
 
70 70
             echo $protocol->getProxyFailureResponse('BAD_PGT', $message);
71 71
         }
72 72
     } elseif (!$ticketFactory->isProxyGrantingTicket($proxyGrantingTicket)) {
73
-        $message = 'Not a valid proxy granting ticket id: ' . var_export($_GET['pgt'], true);
73
+        $message = 'Not a valid proxy granting ticket id: '.var_export($_GET['pgt'], true);
74 74
 
75
-        SimpleSAML\Logger::debug('casserver:' . $message);
75
+        SimpleSAML\Logger::debug('casserver:'.$message);
76 76
 
77 77
         echo $protocol->getProxyFailureResponse('BAD_PGT', $message);
78 78
     } else {
79
-        $message = 'Ticket ' . var_export($_GET['pgt'], true) . ' not recognized';
79
+        $message = 'Ticket '.var_export($_GET['pgt'], true).' not recognized';
80 80
 
81
-        SimpleSAML\Logger::debug('casserver:' . $message);
81
+        SimpleSAML\Logger::debug('casserver:'.$message);
82 82
 
83 83
         echo $protocol->getProxyFailureResponse('BAD_PGT', $message);
84 84
     }
85 85
 } elseif (!array_key_exists('targetService', $_GET)) {
86 86
     $message = 'Missing target service parameter [targetService]';
87 87
 
88
-    SimpleSAML\Logger::debug('casserver:' . $message);
88
+    SimpleSAML\Logger::debug('casserver:'.$message);
89 89
 
90 90
     echo $protocol->getProxyFailureResponse('INVALID_REQUEST', $message);
91 91
 } elseif (!checkServiceURL(sanitize($_GET['targetService']), $legal_target_service_urls)) {
92 92
     $message = 'Target service parameter not listed as a legal service: [targetService] = '
93 93
         . var_export($_GET['targetService'], true);
94 94
 
95
-    SimpleSAML\Logger::debug('casserver:' . $message);
95
+    SimpleSAML\Logger::debug('casserver:'.$message);
96 96
 
97 97
     echo $protocol->getProxyFailureResponse('INVALID_REQUEST', $message);
98 98
 } else {
99 99
     $message = 'Missing proxy granting ticket parameter: [pgt]';
100 100
 
101
-    SimpleSAML\Logger::debug('casserver:' . $message);
101
+    SimpleSAML\Logger::debug('casserver:'.$message);
102 102
 
103 103
     echo $protocol->getProxyFailureResponse('INVALID_REQUEST', $message);
104 104
 }
Please login to merge, or discard this patch.
www/login.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 if (isset($_GET['service']) && !checkServiceURL(sanitize($_GET['service']), $legal_service_urls)) {
40 40
     $message = 'Service parameter provided to CAS server is not listed as a legal service: [service] = '
41 41
         . var_export($_GET['service'], true);
42
-    SimpleSAML\Logger::debug('casserver:' . $message);
42
+    SimpleSAML\Logger::debug('casserver:'.$message);
43 43
 
44 44
     throw new Exception($message);
45 45
 }
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     } else {
55 55
         $message = 'Scope parameter provided to CAS server is not listed as legal scope: [scope] = '
56 56
             . var_export($_GET['scope'], true);
57
-        SimpleSAML\Logger::debug('casserver:' . $message);
57
+        SimpleSAML\Logger::debug('casserver:'.$message);
58 58
 
59 59
         throw new Exception($message);
60 60
     }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         $query['language'] = is_string($_GET['language']) ? $_GET['language'] : null;
101 101
     }
102 102
 
103
-    $returnUrl = SimpleSAML\Utils\HTTP::getSelfURLNoQuery() . '?' . http_build_query($query);
103
+    $returnUrl = SimpleSAML\Utils\HTTP::getSelfURLNoQuery().'?'.http_build_query($query);
104 104
 
105 105
     $params = array(
106 106
         'ForceAuthn' => $forceAuthn,
Please login to merge, or discard this patch.