id/profile.php

45 lines
1.1 KiB
PHP
Raw Normal View History

2023-11-19 12:24:38 +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');
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
$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
?>