2023-11-19 12:24:38 +00:00
|
|
|
|
2024-03-17 15:48:32 +00:00
|
|
|
<link rel="stylesheet" href="/styles/profiles.css" />
|
2023-11-19 12:24:38 +00:00
|
|
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
if (!$_SESSION['auth']) {
|
|
|
|
header('Location: /signin?callback=/profile');
|
2024-03-17 15:48:32 +00:00
|
|
|
exit();
|
2023-11-19 12:24:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$profile = db_execute("SELECT * FROM `profiles` WHERE id = ? LIMIT 1", [$user['id']]);
|
|
|
|
|
|
|
|
if (empty($profile)) {
|
|
|
|
$profile = [
|
2024-02-20 19:49:42 +00:00
|
|
|
"id" => "9999999",
|
2023-11-19 12:24:38 +00:00
|
|
|
"public_display_name" => false,
|
|
|
|
"public_avatar" => false,
|
|
|
|
"description" => null,
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2024-03-02 12:41:57 +00:00
|
|
|
$avatar = "/assets/default.png";
|
2023-11-19 12:24:38 +00:00
|
|
|
$display_name = "";
|
|
|
|
|
|
|
|
if ($_SESSION['id'] != $profile['id']) {
|
2024-03-02 12:41:57 +00:00
|
|
|
$avatar = get_avatar_url($profile['id']);
|
2023-11-19 12:24:38 +00:00
|
|
|
if ($profile['public_display_name']) {
|
|
|
|
$display_name = get_display_name($profile['id'], false);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$avatar = get_avatar_url($profile['id']);
|
|
|
|
$display_name = get_display_name($profile['id'], false);
|
|
|
|
}
|
|
|
|
|
2024-03-02 12:41:57 +00:00
|
|
|
// Get badges owned by this person
|
2024-05-29 17:33:57 +00:00
|
|
|
$badges = db_execute_all('SELECT * FROM badge_owners INNER JOIN badges b on badge_owners.badge_id = b.id WHERE owner_id = ?; ', [$profile['id']]);
|
2024-03-02 12:41:57 +00:00
|
|
|
if (!empty($badges)) {
|
|
|
|
if (!array_is_list($badges)) {
|
|
|
|
$badges = array (0 => $badges);
|
|
|
|
}
|
|
|
|
}
|
2023-11-19 12:24:38 +00:00
|
|
|
|
|
|
|
?>
|
|
|
|
|