Skip to content

Commit

Permalink
move View::show* methods into template
Browse files Browse the repository at this point in the history
  • Loading branch information
Spine committed Dec 9, 2021
1 parent 66c18b1 commit 9669dbe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 9 additions & 11 deletions sections/user/sessions.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php

if (!isset($_GET['userid'])) {
$userId = $Viewer->id();
} elseif (!check_perms('users_view_ips') || !check_perms('users_logout')) {
error(403);
$user = $Viewer;
} else {
$userId = (int)$_GET['userid'];
}
$user = (new Gazelle\Manager\User)->findById($userId);
if (is_null($user)) {
error(404);
if (!$Viewer->permitted('users_view_ips') || !$Viewer->permitted('users_logout')) {
error(403);
}
$user = (new Gazelle\Manager\User)->findById((int)$_GET['userid']);
if (is_null($user)) {
error(404);
}
}

$sessionMan = new Gazelle\Session($userId);
$sessionMan = new Gazelle\Session($user->id());
if (isset($_POST['all'])) {
authorize();
$sessionMan->dropAll();
Expand All @@ -22,11 +22,9 @@
$sessionMan->drop($_POST['session']);
}

View::show_header($user->username().' &rsaquo; Sessions');
echo $Twig->render('user/session.twig', [
'auth' => $Viewer->auth(),
'current' => $SessionID,
'session' => $sessionMan->loadSessions(),
'user' => $user,
]);
View::show_footer();
2 changes: 2 additions & 0 deletions templates/user/session.twig
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ header(user.username ~' &rsaquo; Sessions') }}
<div class="thin">
<h2>{{ user.id|user_url }} &rsaquo; Sessions</h2>
<div class="box pad">
Expand Down Expand Up @@ -38,3 +39,4 @@
</table>
</div>
</div>
{{ footer() }}

0 comments on commit 9669dbe

Please sign in to comment.