@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $odata = $request->getAttribute('odata', new \Flipside\ODataParams(array())); |
| 109 | 109 | $params = $this->manipulateParameters($request, $odata); |
| 110 | 110 | $areas = $dataTable->read($odata->filter, $odata->select, $odata->top, |
| 111 | - $odata->skip, $odata->orderby, $params); |
|
| 111 | + $odata->skip, $odata->orderby, $params); |
|
| 112 | 112 | if($areas === false) |
| 113 | 113 | { |
| 114 | 114 | $areas = array(); |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $odata = $request->getAttribute('odata', new \Flipside\ODataParams(array())); |
| 160 | 160 | $filter = $this->getFilterForPrimaryKey($args['name']); |
| 161 | 161 | $areas = $dataTable->read($filter, $odata->select, $odata->top, |
| 162 | - $odata->skip, $odata->orderby); |
|
| 162 | + $odata->skip, $odata->orderby); |
|
| 163 | 163 | if(empty($areas)) |
| 164 | 164 | { |
| 165 | 165 | return $response->withStatus(404); |
@@ -265,18 +265,18 @@ |
||
| 265 | 265 | } |
| 266 | 266 | switch($this->op) |
| 267 | 267 | { |
| 268 | - case '!=': |
|
| 269 | - return $value != $this->var2; |
|
| 270 | - case '=': |
|
| 271 | - return $value == $this->var2; |
|
| 272 | - case '<': |
|
| 273 | - return $value < $this->var2; |
|
| 274 | - case '<=': |
|
| 275 | - return $value <= $this->var2; |
|
| 276 | - case '>': |
|
| 277 | - return $value > $this->var2; |
|
| 278 | - case '>=': |
|
| 279 | - return $value >= $this->var2; |
|
| 268 | + case '!=': |
|
| 269 | + return $value != $this->var2; |
|
| 270 | + case '=': |
|
| 271 | + return $value == $this->var2; |
|
| 272 | + case '<': |
|
| 273 | + return $value < $this->var2; |
|
| 274 | + case '<=': |
|
| 275 | + return $value <= $this->var2; |
|
| 276 | + case '>': |
|
| 277 | + return $value > $this->var2; |
|
| 278 | + case '>=': |
|
| 279 | + return $value >= $this->var2; |
|
| 280 | 280 | } |
| 281 | 281 | } |
| 282 | 282 | } |
@@ -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 |
@@ -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)); |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | $settings = array("settings"=>["determineRouteBeforeAppMiddleware"=>true, 'displayErrorDetails'=> true]); |
| 12 | 12 | parent::__construct($settings); |
| 13 | 13 | $c = $this->getContainer(); |
| 14 | - $c['errorHandler'] = function($c) { return new WebErrorHandler();}; |
|
| 14 | + $c['errorHandler'] = function($c) { return new WebErrorHandler(); }; |
|
| 15 | 15 | $this->add(new AuthMiddleware()); |
| 16 | 16 | $this->add(new ODataMiddleware()); |
| 17 | 17 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | public function registerAPI($uri, $api) |
| 25 | 25 | { |
| 26 | - $group = $this->group($uri, function() use($api){$api->setup($this);}); |
|
| 26 | + $group = $this->group($uri, function() use($api){$api->setup($this); }); |
|
| 27 | 27 | $group->add(new \Flipside\Http\Rest\SerializationMiddleware()); |
| 28 | 28 | $group->add(new \Flipside\Http\Rest\CORSMiddleware($this->getContainer())); |
| 29 | 29 | } |
@@ -11,7 +11,9 @@ discard block |
||
| 11 | 11 | $settings = array("settings"=>["determineRouteBeforeAppMiddleware"=>true, 'displayErrorDetails'=> true]); |
| 12 | 12 | parent::__construct($settings); |
| 13 | 13 | $c = $this->getContainer(); |
| 14 | - $c['errorHandler'] = function($c) { return new WebErrorHandler();}; |
|
| 14 | + $c['errorHandler'] = function($c) |
|
| 15 | + { |
|
| 16 | +return new WebErrorHandler();}; |
|
| 15 | 17 | $this->add(new AuthMiddleware()); |
| 16 | 18 | $this->add(new ODataMiddleware()); |
| 17 | 19 | } |
@@ -23,7 +25,9 @@ discard block |
||
| 23 | 25 | |
| 24 | 26 | public function registerAPI($uri, $api) |
| 25 | 27 | { |
| 26 | - $group = $this->group($uri, function() use($api){$api->setup($this);}); |
|
| 28 | + $group = $this->group($uri, function() use($api) |
|
| 29 | + { |
|
| 30 | +$api->setup($this);}); |
|
| 27 | 31 | $group->add(new \Flipside\Http\Rest\SerializationMiddleware()); |
| 28 | 32 | $group->add(new \Flipside\Http\Rest\CORSMiddleware($this->getContainer())); |
| 29 | 33 | } |
@@ -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); |
@@ -131,7 +131,7 @@ |
||
| 131 | 131 | private function hashLDAPPassword($password, $salt) |
| 132 | 132 | { |
| 133 | 133 | $shaHashed = sha1($password.$salt); |
| 134 | - $packed = pack("H*",$shaHashed); |
|
| 134 | + $packed = pack("H*", $shaHashed); |
|
| 135 | 135 | $encoded = base64_encode($packed.$salt); |
| 136 | 136 | return "{SSHA}".$encoded; |
| 137 | 137 | } |
@@ -131,7 +131,7 @@ |
||
| 131 | 131 | private function hashLDAPPassword($password, $salt) |
| 132 | 132 | { |
| 133 | 133 | $shaHashed = sha1($password.$salt); |
| 134 | - $packed = pack("H*",$shaHashed); |
|
| 134 | + $packed = pack("H*", $shaHashed); |
|
| 135 | 135 | $encoded = base64_encode($packed.$salt); |
| 136 | 136 | return "{SSHA}".$encoded; |
| 137 | 137 | } |
@@ -219,7 +219,8 @@ |
||
| 219 | 219 | public function getGroupByName($name) |
| 220 | 220 | { |
| 221 | 221 | $group = $this->getEntityByFilter('group', "cn eq '$name'", '\Flipside\Auth\SQLGroup'); |
| 222 | - if($group === null) { |
|
| 222 | + if($group === null) |
|
| 223 | + { |
|
| 223 | 224 | return $this->getEntityByFilter('group', "gid eq '$name'", '\Flipside\Auth\SQLGroup'); |
| 224 | 225 | } |
| 225 | 226 | return $group; |
@@ -8,22 +8,22 @@ discard block |
||
| 8 | 8 | * @copyright Copyright (c) 2015, Austin Artistic Reconstruction |
| 9 | 9 | * @license http://www.apache.org/licenses/ Apache 2.0 License |
| 10 | 10 | */ |
| 11 | -if(file_exists(__DIR__ . '/vendor/autoload.php')) |
|
| 11 | +if(file_exists(__DIR__.'/vendor/autoload.php')) |
|
| 12 | 12 | { |
| 13 | - require(__DIR__ . '/vendor/autoload.php'); |
|
| 13 | + require(__DIR__.'/vendor/autoload.php'); |
|
| 14 | 14 | } |
| 15 | -set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__); |
|
| 16 | -spl_autoload_register(function ($class) { |
|
| 15 | +set_include_path(get_include_path().PATH_SEPARATOR.__DIR__); |
|
| 16 | +spl_autoload_register(function($class) { |
|
| 17 | 17 | |
| 18 | 18 | // project-specific namespace prefix |
| 19 | 19 | $prefix = 'Flipside\\'; |
| 20 | 20 | |
| 21 | 21 | // base directory for the namespace prefix |
| 22 | - $base_dir = __DIR__ . '/'; |
|
| 22 | + $base_dir = __DIR__.'/'; |
|
| 23 | 23 | |
| 24 | 24 | // does the class use the namespace prefix? |
| 25 | 25 | $len = strlen($prefix); |
| 26 | - if (strncmp($prefix, $class, $len) !== 0) { |
|
| 26 | + if(strncmp($prefix, $class, $len) !== 0) { |
|
| 27 | 27 | // no, move to the next registered autoloader |
| 28 | 28 | return; |
| 29 | 29 | } |
@@ -34,10 +34,10 @@ discard block |
||
| 34 | 34 | // replace the namespace prefix with the base directory, replace namespace |
| 35 | 35 | // separators with directory separators in the relative class name, append |
| 36 | 36 | // with .php |
| 37 | - $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; |
|
| 37 | + $file = $base_dir.str_replace('\\', '/', $relative_class).'.php'; |
|
| 38 | 38 | |
| 39 | 39 | // if the file exists, require it |
| 40 | - if (file_exists($file)) { |
|
| 40 | + if(file_exists($file)) { |
|
| 41 | 41 | require $file; |
| 42 | 42 | } |
| 43 | 43 | }); |
@@ -13,7 +13,8 @@ discard block |
||
| 13 | 13 | require(__DIR__ . '/vendor/autoload.php'); |
| 14 | 14 | } |
| 15 | 15 | set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__); |
| 16 | -spl_autoload_register(function ($class) { |
|
| 16 | +spl_autoload_register(function ($class) |
|
| 17 | +{ |
|
| 17 | 18 | |
| 18 | 19 | // project-specific namespace prefix |
| 19 | 20 | $prefix = 'Flipside\\'; |
@@ -23,7 +24,8 @@ discard block |
||
| 23 | 24 | |
| 24 | 25 | // does the class use the namespace prefix? |
| 25 | 26 | $len = strlen($prefix); |
| 26 | - if (strncmp($prefix, $class, $len) !== 0) { |
|
| 27 | + if (strncmp($prefix, $class, $len) !== 0) |
|
| 28 | + { |
|
| 27 | 29 | // no, move to the next registered autoloader |
| 28 | 30 | return; |
| 29 | 31 | } |
@@ -37,7 +39,8 @@ discard block |
||
| 37 | 39 | $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; |
| 38 | 40 | |
| 39 | 41 | // if the file exists, require it |
| 40 | - if (file_exists($file)) { |
|
| 42 | + if (file_exists($file)) |
|
| 43 | + { |
|
| 41 | 44 | require $file; |
| 42 | 45 | } |
| 43 | 46 | }); |
@@ -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); |
@@ -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 | } |