I'm in a rush to release so I am adding features that are needed to make it usable.

This commit is contained in:
Cody Cook 2025-02-17 22:03:33 -08:00
commit 4c2857b445
25 changed files with 2475 additions and 3475 deletions

View file

@ -139,7 +139,19 @@ class DJ
private function loadDJMixes(): void
{
$stmt = $this->db->prepare("SELECT * FROM mix WHERE dj1 = ? OR dj2 = ? OR dj3 = ?");
// Determine if the current user is an admin.
$isAdmin = false;
if (isset($_SESSION['user']) && isset($_SESSION['user']['role']) && $_SESSION['user']['role'] === 'admin') {
$isAdmin = true;
}
if ($isAdmin) {
$stmt = $this->db->prepare("SELECT * FROM mix WHERE dj1 = ? OR dj2 = ? OR dj3 = ?");
} else {
// Only return mixes that are approved (pending = 0) for non-admin users.
$stmt = $this->db->prepare("SELECT * FROM mix WHERE (dj1 = ? OR dj2 = ? OR dj3 = ?) AND pending = 0");
}
$stmt->bind_param("iii", $this->id, $this->id, $this->id);
$stmt->execute();
$result = $stmt->get_result();
@ -149,10 +161,9 @@ class DJ
}
$stmt->close();
$this->mixes = $mixes;
}
private function loadBySlug(): bool
{
$socials = [];