current(); if (isset($_GET['logout'])) { $users->logout(); $user = null; } if (!$user) { header(sprintf('Location: %slogin.php', WWW_URL)); exit; } if (isset($_GET['empty_trash'])) { $users->emptyTrash($user); header('Location: ./'); exit; } $quota = $users->quota($user, true); $free = format_bytes($quota->free); $used = format_bytes($quota->used); $total = format_bytes($quota->total); $trash = format_bytes($quota->trash ?? 0); $percent = $quota->total ? floor(($quota->used / $quota->total)*100) . '%' : '100%'; $www_url = WWW_URL; $username = htmlspecialchars($user->login); $trash_button = ''; if ($quota->trash) { $trash_button = '
Empty trash now'; } html_head('My files'); echo <<Manage my files

Hello, {$username} !

{$percent} used, {$free} free

Used {$used} out of a total of {$total}.
Trash: {$trash}. {$trash_button}
WebDAV URL

{$user->dav_url}

NextCloud URL
{$www_url}
Use this URL to setup a NextCloud or ownCloud client to access your files.

Logout

EOF; if ($user->is_admin) { echo '

Manager users

'; } html_foot();