| @@ -20,7 +20,7 @@ discard block | ||
| 20 | 20 | |
| 21 | 21 | public function login(Request $request, Response $response) | 
| 22 | 22 |      { | 
| 23 | - phpCAS::client(CAS_VERSION_2_0,'auth.univ-lorraine.fr',443,''); | |
| 23 | + phpCAS::client(CAS_VERSION_2_0, 'auth.univ-lorraine.fr', 443, ''); | |
| 24 | 24 | phpCAS::setNoCasServerValidation(); | 
| 25 | 25 | phpCAS::forceAuthentication(); | 
| 26 | 26 | |
| @@ -32,7 +32,7 @@ discard block | ||
| 32 | 32 | |
| 33 | 33 | public function logout(Request $request, Response $response) | 
| 34 | 34 |      { | 
| 35 | - phpCAS::client(CAS_VERSION_2_0,'auth.univ-lorraine.fr',443,''); | |
| 35 | + phpCAS::client(CAS_VERSION_2_0, 'auth.univ-lorraine.fr', 443, ''); | |
| 36 | 36 | phpCAS::logout(); | 
| 37 | 37 | } | 
| 38 | 38 | } | 
| @@ -4,11 +4,11 @@ | ||
| 4 | 4 | use Security\Resources\Middleware\AuthMiddleware; | 
| 5 | 5 | |
| 6 | 6 | |
| 7 | -$app->group('', function ()  { | |
| 7 | +$app->group('', function() { | |
| 8 | 8 |      $this->get('/login', 'AuthController:login')->setName('login'); | 
| 9 | 9 | })->add(new GuestMiddleware($container)); | 
| 10 | 10 | |
| 11 | -$app->group('', function () { | |
| 11 | +$app->group('', function() { | |
| 12 | 12 |          $this->get('/logout', 'AuthController:logout')->setName('logout'); | 
| 13 | 13 | })->add(new AuthMiddleware($container)); | 
| 14 | 14 | |
| @@ -20,12 +20,12 @@ | ||
| 20 | 20 | */ | 
| 21 | 21 | public function __invoke(Request $request, Response $response, callable $next) | 
| 22 | 22 |      { | 
| 23 | -       if (isset($_SESSION['phpCAS']['user']))  { | |
| 23 | +        if (isset($_SESSION['phpCAS']['user']))  { | |
| 24 | 24 | if (in_array($_SESSION['phpCAS']['user'], $this->container['parameters']['administrators'])) | 
| 25 | 25 | return $next($request, $response); | 
| 26 | - } | |
| 26 | + } | |
| 27 | 27 | |
| 28 | -       $this->flash->addMessage('error', '<i class="minus circle icon"></i> You are not allowed to access to this content.'); | |
| 29 | -       return $response->withRedirect($this->router->pathFor('wrong-entry')); | |
| 28 | +        $this->flash->addMessage('error', '<i class="minus circle icon"></i> You are not allowed to access to this content.'); | |
| 29 | +        return $response->withRedirect($this->router->pathFor('wrong-entry')); | |
| 30 | 30 | } | 
| 31 | 31 | } | 
| @@ -20,7 +20,7 @@ | ||
| 20 | 20 | */ | 
| 21 | 21 | public function __invoke(Request $request, Response $response, callable $next) | 
| 22 | 22 |      { | 
| 23 | -       if (isset($_SESSION['phpCAS']['user']))  { | |
| 23 | +       if (isset($_SESSION['phpCAS']['user'])) { | |
| 24 | 24 | if (in_array($_SESSION['phpCAS']['user'], $this->container['parameters']['administrators'])) | 
| 25 | 25 | return $next($request, $response); | 
| 26 | 26 | } | 
| @@ -21,8 +21,9 @@ | ||
| 21 | 21 | public function __invoke(Request $request, Response $response, callable $next) | 
| 22 | 22 |      { | 
| 23 | 23 |         if (isset($_SESSION['phpCAS']['user']))  { | 
| 24 | - if (in_array($_SESSION['phpCAS']['user'], $this->container['parameters']['administrators'])) | |
| 25 | - return $next($request, $response); | |
| 24 | +            if (in_array($_SESSION['phpCAS']['user'], $this->container['parameters']['administrators'])) { | |
| 25 | + return $next($request, $response); | |
| 26 | + } | |
| 26 | 27 | } | 
| 27 | 28 | |
| 28 | 29 |         $this->flash->addMessage('error', '<i class="minus circle icon"></i> You are not allowed to access to this content.'); | 
| @@ -33,8 +33,9 @@ | ||
| 33 | 33 | |
| 34 | 34 | $res = []; | 
| 35 | 35 |              foreach($students as $student) { | 
| 36 | - if ($student['uid'][0] != null) | |
| 37 | - $res += [ $student['uid'][0] => $student['displayname'][0] ]; | |
| 36 | +                if ($student['uid'][0] != null) { | |
| 37 | + $res += [ $student['uid'][0] => $student['displayname'][0] ]; | |
| 38 | + } | |
| 38 | 39 | } | 
| 39 | 40 | |
| 40 | 41 | return $this->json($response, $res); | 
| @@ -27,9 +27,9 @@ | ||
| 27 | 27 | $students = $this->ldap($filter, ['displayname', 'uid']); | 
| 28 | 28 | $res = []; | 
| 29 | 29 | |
| 30 | -            foreach($students as $student) { | |
| 30 | +            foreach ($students as $student) { | |
| 31 | 31 | if ($student['uid'][0] != null) | 
| 32 | - $res += [ $student['uid'][0] => $student['displayname'][0] ]; | |
| 32 | + $res += [$student['uid'][0] => $student['displayname'][0]]; | |
| 33 | 33 | } | 
| 34 | 34 | |
| 35 | 35 | return $this->json($response, $res); | 
| @@ -3,9 +3,9 @@ | ||
| 3 | 3 | use App\Resources\Middleware\CountryMiddleware; | 
| 4 | 4 | use \Security\Resources\Middleware\AdminMiddleware; | 
| 5 | 5 | |
| 6 | -$app->group('/{country:[a-z]{2}}', function () use ($container) { | |
| 6 | +$app->group('/{country:[a-z]{2}}', function() use ($container) { | |
| 7 | 7 | |
| 8 | -    $this->group('/tools', function () use ($container) { | |
| 8 | +    $this->group('/tools', function() use ($container) { | |
| 9 | 9 |          $this->map(['GET', 'POST'], '/find-student', 'AdminController:findStudent')->setName('find-student'); | 
| 10 | 10 | })->add(new AdminMiddleware($container)); | 
| 11 | 11 | |
| @@ -27,8 +27,9 @@ | ||
| 27 | 27 | ]); | 
| 28 | 28 | |
| 29 | 29 |          foreach (json_decode($enrollments->getBody()->getContents()) as $enrollment) { | 
| 30 | - if ($enrollment->class->title != null) | |
| 31 | - array_push($classes, $enrollment->class); | |
| 30 | +            if ($enrollment->class->title != null) { | |
| 31 | + array_push($classes, $enrollment->class); | |
| 32 | + } | |
| 32 | 33 | } | 
| 33 | 34 | |
| 34 | 35 | return $this->view->render($response, 'App/user.twig',[ | 
| @@ -31,10 +31,10 @@ | ||
| 31 | 31 | array_push($classes, $enrollment->class); | 
| 32 | 32 | } | 
| 33 | 33 | |
| 34 | - return $this->view->render($response, 'App/user.twig',[ | |
| 34 | + return $this->view->render($response, 'App/user.twig', [ | |
| 35 | 35 | 'classes' => $classes, | 
| 36 | 36 |              'student_name' => $this->ldapFirst("uid=$id")['displayname'][0] | 
| 37 | - ] ); | |
| 37 | + ]); | |
| 38 | 38 | |
| 39 | 39 | } | 
| 40 | 40 | |
| @@ -69,15 +69,15 @@ | ||
| 69 | 69 | */ | 
| 70 | 70 | public function createJWT() | 
| 71 | 71 |      { | 
| 72 | -        return json_decode( $this->http->request('POST', 'auth/login', [ | |
| 73 | - 'headers' => [ 'X-Requested-With' => 'XMLHttpRequest' ], | |
| 72 | +        return json_decode($this->http->request('POST', 'auth/login', [ | |
| 73 | + 'headers' => ['X-Requested-With' => 'XMLHttpRequest'], | |
| 74 | 74 | 'json' => [ | 
| 75 | 75 | 'username' => $this->parameters['api']['username'], | 
| 76 | 76 | 'password' => $this->parameters['api']['password'] | 
| 77 | 77 | ] | 
| 78 | 78 | ]) | 
| 79 | 79 | ->getBody() | 
| 80 | - ->getContents() ); | |
| 80 | + ->getContents()); | |
| 81 | 81 | } | 
| 82 | 82 | |
| 83 | 83 | |
| @@ -63,7 +63,7 @@ | ||
| 63 | 63 | |
| 64 | 64 |          foreach (glob(__DIR__ . '/../' . DICTIONARY_PATH . '*.json') as $file) { | 
| 65 | 65 | $language = json_decode(file_get_contents($file), GLOB_BRACE); | 
| 66 | - $languages += [ $language['LANGUAGE'] => substr(basename($file), 0, 2) ]; | |
| 66 | + $languages += [$language['LANGUAGE'] => substr(basename($file), 0, 2)]; | |
| 67 | 67 | } | 
| 68 | 68 | |
| 69 | 69 | return $languages; | 
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | |
| 5 | 5 |  $app->get('/', 'AppController:redirectHome')->setName('wrong-entry'); | 
| 6 | 6 | |
| 7 | -$app->group('/{country:[a-z]{2}}', function () { | |
| 7 | +$app->group('/{country:[a-z]{2}}', function() { | |
| 8 | 8 |      $this->get('', 'AppController:home')->setName('home'); | 
| 9 | 9 |      $this->get('/users/{id}', 'UserController:user')->setName('user-profile'); | 
| 10 | 10 | })->add(new CountryMiddleware($container)); |