@@ -37,7 +37,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -70,6 +70,6 @@ |
||
| 70 | 70 | */ |
| 71 | 71 | private function scopeTicketId($ticketId) |
| 72 | 72 | { |
| 73 | - return $this->prefix . '.' . $ticketId; |
|
| 73 | + return $this->prefix.'.'.$ticketId; |
|
| 74 | 74 | } |
| 75 | 75 | } |
@@ -36,11 +36,11 @@ discard block |
||
| 36 | 36 | $path = $config->resolvePath($storeConfig['directory']); |
| 37 | 37 | |
| 38 | 38 | if (!is_dir($path)) { |
| 39 | - throw new Exception('Directory for CAS Server ticket storage [' . $path . '] does not exists. '); |
|
| 39 | + throw new Exception('Directory for CAS Server ticket storage ['.$path.'] does not exists. '); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | if (!is_writable($path)) { |
| 43 | - throw new Exception('Directory for CAS Server ticket storage [' . $path . '] is not writable. '); |
|
| 43 | + throw new Exception('Directory for CAS Server ticket storage ['.$path.'] is not writable. '); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $this->pathToTicketDirectory = preg_replace('/\/$/', '', $path); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function getTicket($ticketId) |
| 54 | 54 | { |
| 55 | - $filename = $this->pathToTicketDirectory . '/' . $ticketId; |
|
| 55 | + $filename = $this->pathToTicketDirectory.'/'.$ticketId; |
|
| 56 | 56 | |
| 57 | 57 | if (file_exists($filename)) { |
| 58 | 58 | $content = file_get_contents($filename); |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | public function addTicket(array $ticket) |
| 67 | 67 | { |
| 68 | - $filename = $this->pathToTicketDirectory . '/' . $ticket['id']; |
|
| 68 | + $filename = $this->pathToTicketDirectory.'/'.$ticket['id']; |
|
| 69 | 69 | file_put_contents($filename, serialize($ticket)); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function deleteTicket($ticketId) |
| 76 | 76 | { |
| 77 | - $filename = $this->pathToTicketDirectory . '/' . $ticketId; |
|
| 77 | + $filename = $this->pathToTicketDirectory.'/'.$ticketId; |
|
| 78 | 78 | |
| 79 | 79 | if (file_exists($filename)) { |
| 80 | 80 | unlink($filename); |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | |
| 29 | 29 | public function getValidateSuccessResponse($username) |
| 30 | 30 | { |
| 31 | - return "yes\n" . $username . "\n"; |
|
| 31 | + return "yes\n".$username."\n"; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | public function getValidateFailureResponse() |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | private function workAroundForBuggyJasigXmlParser($xmlString) |
| 175 | 175 | { |
| 176 | 176 | // when will people stop hand coding xml handling....? |
| 177 | - return str_replace('><', '>' . PHP_EOL . '<', str_replace(PHP_EOL, '', $xmlString)); |
|
| 177 | + return str_replace('><', '>'.PHP_EOL.'<', str_replace(PHP_EOL, '', $xmlString)); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | private function generateCas20Attribute($xmlDocument, $attributeName, $attributeValue) |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | $attributeValueNode = $xmlDocument->createTextNode($this->base64EncodeAttributes ? |
| 183 | 183 | base64_encode($attributeValue) : $attributeValue); |
| 184 | 184 | |
| 185 | - $attributeElement = $xmlDocument->createElement('cas:' . $attributeName); |
|
| 185 | + $attributeElement = $xmlDocument->createElement('cas:'.$attributeName); |
|
| 186 | 186 | |
| 187 | 187 | $attributeElement->appendChild($attributeValueNode); |
| 188 | 188 | |