@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | if(isset($this->data['cn'])) |
22 | 22 | { |
23 | 23 | return $this->data['cn']; |
24 | - } |
|
25 | - if(isset($this->data['groupCN'])) |
|
26 | - { |
|
27 | - return $this->data['groupCN']; |
|
28 | - } |
|
24 | + } |
|
25 | + if(isset($this->data['groupCN'])) |
|
26 | + { |
|
27 | + return $this->data['groupCN']; |
|
28 | + } |
|
29 | 29 | return false; |
30 | 30 | } |
31 | 31 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | { |
144 | 144 | $this->tmpMembers = array(); |
145 | 145 | $gid = $this->getGroupName(); |
146 | - $memberDT = $this->auth->getDataTable('groupUserMap'); |
|
146 | + $memberDT = $this->auth->getDataTable('groupUserMap'); |
|
147 | 147 | $mems = $memberDT->read(new \Flipside\Data\Filter('groupCN eq "'.$gid.'"')); |
148 | 148 | $count = count($mems); |
149 | 149 | for($i = 0; $i < $count; $i++) |
@@ -160,16 +160,16 @@ discard block |
||
160 | 160 | } |
161 | 161 | if($isGroup) |
162 | 162 | { |
163 | - array_push($this->tmpMembers, array('gid' => $name)); |
|
163 | + array_push($this->tmpMembers, array('gid' => $name)); |
|
164 | 164 | } |
165 | 165 | else |
166 | 166 | { |
167 | - array_push($this->tmpMembers, array('uid' => $name)); |
|
167 | + array_push($this->tmpMembers, array('uid' => $name)); |
|
168 | 168 | } |
169 | 169 | if($flush) |
170 | 170 | { |
171 | 171 | $gid = $this->getGroupName(); |
172 | - $memberDT = $this->auth->getDataTable('groupUserMap'); |
|
172 | + $memberDT = $this->auth->getDataTable('groupUserMap'); |
|
173 | 173 | //Get all current direct members |
174 | 174 | $existing = $memberDT->read(new \Flipside\Data\Filter('groupCN eq "'.$gid.'"')); |
175 | 175 | $exCount = count($existing); |
@@ -146,47 +146,47 @@ discard block |
||
146 | 146 | { |
147 | 147 | $res = array(); |
148 | 148 | $count = count($this->children); |
149 | - for($i = 0; $i < $count; $i++) |
|
150 | - { |
|
149 | + for($i = 0; $i < $count; $i++) |
|
150 | + { |
|
151 | 151 | if($this->children[$i] === 'and' || $this->children[$i] === 'or') |
152 | - { |
|
152 | + { |
|
153 | 153 | array_push($res, $this->children[$i]); |
154 | - } |
|
155 | - else |
|
156 | - { |
|
154 | + } |
|
155 | + else |
|
156 | + { |
|
157 | 157 | $tmp = $this->children[$i]->php_compare($element); |
158 | - array_push($res, $tmp); |
|
159 | - } |
|
160 | - } |
|
161 | - if($count === 1) |
|
162 | - { |
|
158 | + array_push($res, $tmp); |
|
159 | + } |
|
160 | + } |
|
161 | + if($count === 1) |
|
162 | + { |
|
163 | 163 | return $res[0]; |
164 | - } |
|
165 | - while($count >= 3) |
|
166 | - { |
|
167 | - if($res[1] === 'and') |
|
164 | + } |
|
165 | + while($count >= 3) |
|
166 | + { |
|
167 | + if($res[1] === 'and') |
|
168 | 168 | { |
169 | 169 | $var1 = array_shift($res); |
170 | 170 | array_shift($res); |
171 | 171 | $var2 = array_shift($res); |
172 | - $res = array_merge(array($var1 && $var2), $res); |
|
172 | + $res = array_merge(array($var1 && $var2), $res); |
|
173 | 173 | } |
174 | - else if($res[1] === 'or') |
|
174 | + else if($res[1] === 'or') |
|
175 | 175 | { |
176 | 176 | $var1 = array_shift($res); |
177 | 177 | array_shift($res); |
178 | 178 | $var2 = array_shift($res); |
179 | 179 | $res = array_merge(array($var1 || $var2), $res); |
180 | - } |
|
181 | - $count = count($res); |
|
182 | - } |
|
180 | + } |
|
181 | + $count = count($res); |
|
182 | + } |
|
183 | 183 | return $res[0]; |
184 | 184 | } |
185 | 185 | |
186 | 186 | public function filter_array(&$array) |
187 | 187 | { |
188 | 188 | if(is_array($array)) |
189 | - { |
|
189 | + { |
|
190 | 190 | $res = array_filter($array, array($this, 'filterElement')); |
191 | 191 | return array_values($res); |
192 | 192 | } |
@@ -195,10 +195,10 @@ discard block |
||
195 | 195 | |
196 | 196 | public function contains(string $substr) |
197 | 197 | { |
198 | - if($this->string === null) |
|
199 | - { |
|
198 | + if($this->string === null) |
|
199 | + { |
|
200 | 200 | return null; |
201 | - } |
|
201 | + } |
|
202 | 202 | return strstr($this->string, $substr) !== false; |
203 | 203 | } |
204 | 204 |
@@ -39,7 +39,7 @@ |
||
39 | 39 | throw new \Exception('Unimplemented'); |
40 | 40 | } |
41 | 41 | |
42 | - public function quote(string $string, int $type = \PDO::PARAM_STR): string|false |
|
42 | + public function quote(string $string, int $type = \PDO::PARAM_STR): string | false |
|
43 | 43 | { |
44 | 44 | throw new \Exception('Unimplemented'); |
45 | 45 | } |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | $case = true; |
153 | 153 | } |
154 | 154 | if($case) |
155 | - { |
|
155 | + { |
|
156 | 156 | if(class_exists('MongoRegex')) |
157 | - { |
|
157 | + { |
|
158 | 158 | return array($field=>array('$regex'=>new \MongoRegex('/'.$this->var2.'/i'))); |
159 | 159 | } |
160 | 160 | else |
@@ -257,15 +257,15 @@ discard block |
||
257 | 257 | { |
258 | 258 | case '=': |
259 | 259 | return array($this->var1=>$this->var2); |
260 | - case 'substringof': |
|
261 | - if(class_exists('MongoRegex')) |
|
262 | - { |
|
263 | - return array($this->var1=>array('$regex'=>new \MongoRegex('/'.$this->var2.'/i'))); |
|
264 | - } |
|
265 | - else |
|
266 | - { |
|
260 | + case 'substringof': |
|
261 | + if(class_exists('MongoRegex')) |
|
262 | + { |
|
263 | + return array($this->var1=>array('$regex'=>new \MongoRegex('/'.$this->var2.'/i'))); |
|
264 | + } |
|
265 | + else |
|
266 | + { |
|
267 | 267 | return array($this->var1=>array('$regex'=>new \MongoDB\BSON\Regex($this->var2, 'i'))); |
268 | - } |
|
268 | + } |
|
269 | 269 | case 'indexof': |
270 | 270 | return $this->getMongoIndexOfOperator(); |
271 | 271 | default: |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $this->var2 = $rest; |
97 | 97 | if($this->op === 'in') |
98 | 98 | { |
99 | - $this->var2 = explode(",",trim($rest, " ()")); |
|
99 | + $this->var2 = explode(",", trim($rest, " ()")); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | { |
116 | 116 | $array[$i] = $dataset->quote($this->var2[$i]); |
117 | 117 | } |
118 | - return $this->var1.' IN ('.implode(',',$array).')'; |
|
118 | + return $this->var1.' IN ('.implode(',', $array).')'; |
|
119 | 119 | default: |
120 | 120 | return $this->var1.$this->op.$this->var2; |
121 | 121 | break; |
@@ -152,9 +152,9 @@ |
||
152 | 152 | $case = true; |
153 | 153 | } |
154 | 154 | if($case) |
155 | - { |
|
155 | + { |
|
156 | 156 | if(class_exists('MongoRegex')) |
157 | - { |
|
157 | + { |
|
158 | 158 | return array($field=>array('$regex'=>new \MongoRegex('/'.$this->var2.'/i'))); |
159 | 159 | } |
160 | 160 | else |
@@ -15,12 +15,12 @@ discard block |
||
15 | 15 | |
16 | 16 | public function open($savePath, $sessionName): bool |
17 | 17 | { |
18 | - $this->dataTable = \Flipside\DataSetFactory::getDataTableByNames($this->dataSetName, $this->dataTableName); |
|
19 | - if($this->dataTable) |
|
20 | - { |
|
21 | - return true; |
|
22 | - } |
|
23 | - return false; |
|
18 | + $this->dataTable = \Flipside\DataSetFactory::getDataTableByNames($this->dataSetName, $this->dataTableName); |
|
19 | + if($this->dataTable) |
|
20 | + { |
|
21 | + return true; |
|
22 | + } |
|
23 | + return false; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | public function close(): bool |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | public function read($id): string|false |
32 | 32 | { |
33 | 33 | $filter = new \Flipside\Data\Filter("sessionId eq '$id'"); |
34 | - $data = $this->dataTable->read($filter, array('sessionData')); |
|
34 | + $data = $this->dataTable->read($filter, array('sessionData')); |
|
35 | 35 | if(empty($data)) |
36 | 36 | { |
37 | 37 | return ''; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | public function write($id, $data): bool |
43 | 43 | { |
44 | 44 | $filter = new \Flipside\Data\Filter("sessionId eq '$id'"); |
45 | - $res = $this->dataTable->update($filter, array('sessionData'=>$data, 'sessionLastAccess'=>date("Y-m-d H:i:s"))); |
|
45 | + $res = $this->dataTable->update($filter, array('sessionData'=>$data, 'sessionLastAccess'=>date("Y-m-d H:i:s"))); |
|
46 | 46 | if($res === false) |
47 | 47 | { |
48 | 48 | $res = $this->dataTable->create(array('sessionId'=>$id, 'sessionData'=>$data, 'sessionLastAccess'=>date("Y-m-d H:i:s"))); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | return true; |
29 | 29 | } |
30 | 30 | |
31 | - public function read($id): string|false |
|
31 | + public function read($id): string | false |
|
32 | 32 | { |
33 | 33 | $filter = new \Flipside\Data\Filter("sessionId eq '$id'"); |
34 | 34 | $data = $this->dataTable->read($filter, array('sessionData')); |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | return $this->dataTable->delete($filter); |
61 | 61 | } |
62 | 62 | |
63 | - public function gc($maxlifetime): int|false |
|
63 | + public function gc($maxlifetime): int | false |
|
64 | 64 | { |
65 | - $date = date("Y-m-d H:i:s", time()-$maxlifetime); |
|
65 | + $date = date("Y-m-d H:i:s", time() - $maxlifetime); |
|
66 | 66 | $filter = new \Flipside\Data\Filter("sessionLastAccess lt '$date'"); |
67 | 67 | return $this->dataTable->delete($filter); |
68 | 68 | } |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | $stmt = $this->pdo->query($sql); |
261 | 261 | if($stmt === false) |
262 | 262 | { |
263 | - if (php_sapi_name() !== "cli") { |
|
263 | + if(php_sapi_name() !== "cli") { |
|
264 | 264 | error_log('DB query failed. '.print_r($this->pdo->errorInfo(), true)); |
265 | 265 | } |
266 | 266 | return false; |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | $sql = "INSERT INTO `$tablename` ($cols) VALUES ($set);"; |
311 | 311 | if($this->pdo->exec($sql) === false) |
312 | 312 | { |
313 | - if (php_sapi_name() !== "cli") { |
|
313 | + if(php_sapi_name() !== "cli") { |
|
314 | 314 | error_log('DB query failed. '.print_r($this->pdo->errorInfo(), true)); |
315 | 315 | } |
316 | 316 | return false; |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | return $this->pdo->errorInfo(); |
368 | 368 | } |
369 | 369 | |
370 | - public function quote(string $string, int $type = \PDO::PARAM_STR): string|false |
|
370 | + public function quote(string $string, int $type = \PDO::PARAM_STR): string | false |
|
371 | 371 | { |
372 | 372 | return $this->pdo->quote($string, $type); |
373 | 373 | } |