@@ -50,7 +50,7 @@ |
||
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | public function handle($match): FileResponse|NotFoundResponse{ |
| 53 | - if($match instanceof Match404){ |
|
| 53 | + if($match instanceof Match404) { |
|
| 54 | 54 | return new NotFoundResponse(); |
| 55 | 55 | } |
| 56 | 56 | return new FileResponse($match->filePath, $match->contentType); |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | $middlewareInstance->addMatcher($matcher); |
| 61 | 61 | $middlewareInstance->setRequest($this->request); |
| 62 | 62 | $middlewareResult = $middlewareInstance(...$args); |
| 63 | - if($middlewareResult instanceof HttpResponse){ |
|
| 63 | + if($middlewareResult instanceof HttpResponse) { |
|
| 64 | 64 | return $middlewareResult; |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | } else { |
| 22 | 22 | $headers = [ "Location" => $parsedUrl ]; |
| 23 | 23 | } |
| 24 | - if(isset($redirect_after)){ |
|
| 24 | + if(isset($redirect_after)) { |
|
| 25 | 25 | $_SESSION["redirect_url"] = $redirect_after; |
| 26 | 26 | |
| 27 | 27 | } |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | protected function checkPermissions(string $modifier, mixed ...$params):bool{ |
| 39 | - if($modifier == LoginRequired::class){ |
|
| 39 | + if($modifier == LoginRequired::class) { |
|
| 40 | 40 | $authenticator = new \Lepton\Authenticator\UserAuthenticator(); |
| 41 | 41 | return $authenticator->isLoggedIn(); |
| 42 | 42 | } |
@@ -414,11 +414,13 @@ discard block |
||
| 414 | 414 | * @return QuerySet |
| 415 | 415 | */ |
| 416 | 416 | |
| 417 | - public function do(): QuerySet |
|
| 417 | + public function do { |
|
| 418 | + (): QuerySet |
|
| 418 | 419 | { |
| 419 | 420 | |
| 420 | 421 | // Build the query |
| 421 | 422 | list($query, $values) = $this->buildQuery(); |
| 423 | + } |
|
| 422 | 424 | |
| 423 | 425 | // Connect to DB |
| 424 | 426 | $db = Application::getDb(); |
@@ -484,7 +486,7 @@ discard block |
||
| 484 | 486 | $query .= " ".$this->buildJoin($join); |
| 485 | 487 | $query .= " ".$this->buildJoin($join_t); |
| 486 | 488 | |
| 487 | - if(count($this->filters)>0){ |
|
| 489 | + if(count($this->filters)>0) { |
|
| 488 | 490 | $query .= sprintf(" WHERE %s ", $whereClause); |
| 489 | 491 | } |
| 490 | 492 | |
@@ -83,7 +83,8 @@ |
||
| 83 | 83 | // if it's a main file |
| 84 | 84 | if(key_exists($file, $this->dependancyTree)) { |
| 85 | 85 | $this->dependancyTree[$file] = $this->compileFile($file); |
| 86 | - } else { // if it's an included file |
|
| 86 | + } else { |
|
| 87 | +// if it's an included file |
|
| 87 | 88 | foreach($this->dependancyTree as $main => $dependancies) { |
| 88 | 89 | if(in_array($file, $dependancies)) { |
| 89 | 90 | $this->dependancyTree[$main] = $this->compileFile($main); |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | $template = new Template($path); |
| 22 | 22 | $template->registerFilter(new SiteFilter()); |
| 23 | 23 | |
| 24 | - if(isset($this->custom_filters)){ |
|
| 24 | + if(isset($this->custom_filters)) { |
|
| 25 | 25 | foreach($this->custom_filters as $filter){ |
| 26 | 26 | $template->registerFilter(new $filter()); |
| 27 | 27 | } |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | $user = $authenticator->getLoggedUser(); |
| 50 | 50 | $num_privileges = $user->privileges->and(livello__gte: $level)->count(); |
| 51 | 51 | return ($num_privileges > 0); |
| 52 | - } elseif($modifier == PermissionRequired::class){ |
|
| 52 | + } elseif($modifier == PermissionRequired::class) { |
|
| 53 | 53 | $user = (new UserAuthenticator)->getLoggedUser(); |
| 54 | 54 | die(print_r($params)); |
| 55 | 55 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $user->$hashField = $session_hash; |
| 50 | 50 | $user->save(); |
| 51 | 51 | } |
| 52 | - if(isset($this->config->access_field)){ |
|
| 52 | + if(isset($this->config->access_field)) { |
|
| 53 | 53 | $accessField = $this->config->access_field; |
| 54 | 54 | date_default_timezone_set('Europe/Rome'); |
| 55 | 55 | $user->$accessField = date('Y-m-d H:i:s', time());; |
@@ -72,7 +72,8 @@ discard block |
||
| 72 | 72 | $user = $this->getUserById($user_id); |
| 73 | 73 | |
| 74 | 74 | //$hashField = $this->config->hash_field; |
| 75 | - if (!$user) {// || $user->$hashField !== $_SESSION['session_hash']) { |
|
| 75 | + if (!$user) { |
|
| 76 | +// || $user->$hashField !== $_SESSION['session_hash']) { |
|
| 76 | 77 | return false; |
| 77 | 78 | } |
| 78 | 79 | |