@@ -83,7 +83,7 @@ |
||
| 83 | 83 | //The underlying API call gave us back a different content type. Just pass that on... |
| 84 | 84 | return $response; |
| 85 | 85 | } |
| 86 | - $overrides = $request->getAttribute('serializeOverrides'); |
|
| 86 | + $overrides = $request->getAttribute('serializeOverrides'); |
|
| 87 | 87 | if($overrides->has($this->format)) |
| 88 | 88 | { |
| 89 | 89 | return $this->reserializeBody($response, $overrides->get($this->format)); |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | { |
| 31 | 31 | require $GLOBALS['FLIPSIDE_SETTINGS_LOC'].'/class.FlipsideSettings.php'; |
| 32 | 32 | return; |
| 33 | - } |
|
| 33 | + } |
|
| 34 | 34 | if(file_exists('/var/www/secure_settings/class.FlipsideSettings.php')) |
| 35 | 35 | { |
| 36 | 36 | require '/var/www/secure_settings/class.FlipsideSettings.php'; |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | public function getDataSetData($dataSetName) |
| 73 | 73 | { |
| 74 | 74 | if(!isset(\FlipsideSettings::$dataset) || !isset(\FlipsideSettings::$dataset[$dataSetName])) |
| 75 | - { |
|
| 75 | + { |
|
| 76 | 76 | return false; |
| 77 | 77 | } |
| 78 | 78 | return \FlipsideSettings::$dataset[$dataSetName]; |
@@ -80,7 +80,7 @@ |
||
| 80 | 80 | $data = $userDT->read($filter); |
| 81 | 81 | if(strlen($data[0]['userPassword']) === 0) |
| 82 | 82 | { |
| 83 | - $data[0]['userPassword'] = openssl_random_pseudo_bytes(10); |
|
| 83 | + $data[0]['userPassword'] = openssl_random_pseudo_bytes(10); |
|
| 84 | 84 | } |
| 85 | 85 | $hash = hash('sha512', $data[0]['uid'].';'.$data[0]['userPassword'].';'.$data[0]['mail']); |
| 86 | 86 | $update = array('resetHash' => $hash); |
@@ -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 | |
@@ -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: |
@@ -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"))); |
@@ -79,11 +79,11 @@ |
||
| 79 | 79 | { |
| 80 | 80 | $auth = $request->getHeaderLine('Authorization'); |
| 81 | 81 | if(empty($auth)) |
| 82 | - { |
|
| 82 | + { |
|
| 83 | 83 | $request = $request->withAttribute('user', $this->getUserFromSession()); |
| 84 | 84 | } |
| 85 | 85 | else |
| 86 | - { |
|
| 86 | + { |
|
| 87 | 87 | $request = $request->withAttribute('user', $this->getUserFromHeader($auth)); |
| 88 | 88 | } |
| 89 | 89 | $response = $next($request, $response); |
@@ -113,11 +113,11 @@ |
||
| 113 | 113 | public function delete($filter) |
| 114 | 114 | { |
| 115 | 115 | $criteria = $this->getCriteriaFromFilter($filter); |
| 116 | - $res = $this->collection->remove($criteria, array(), $this->name); |
|
| 117 | - if($res === true) |
|
| 118 | - { |
|
| 116 | + $res = $this->collection->remove($criteria, array(), $this->name); |
|
| 117 | + if($res === true) |
|
| 118 | + { |
|
| 119 | 119 | return true; |
| 120 | - } |
|
| 120 | + } |
|
| 121 | 121 | if($res === false || $res['err'] !== null) |
| 122 | 122 | { |
| 123 | 123 | return false; |