I'm in a rush to release so I am adding features that are needed to make it usable.
This commit is contained in:
parent
c76ab1abf3
commit
4c2857b445
25 changed files with 2475 additions and 3475 deletions
|
@ -57,7 +57,15 @@ class Mix
|
|||
|
||||
private function get_mix_by_id()
|
||||
{
|
||||
$stmt = $this->db->prepare("SELECT * FROM mix WHERE id = ?");
|
||||
// Check if current user is admin
|
||||
$isAdmin = (isset($_SESSION['user']) && isset($_SESSION['user']['role']) && $_SESSION['user']['role'] === 'admin');
|
||||
|
||||
if ($isAdmin) {
|
||||
$stmt = $this->db->prepare("SELECT * FROM mix WHERE id = ?");
|
||||
} else {
|
||||
// Only return approved mixes (pending = 0) for non-admins
|
||||
$stmt = $this->db->prepare("SELECT * FROM mix WHERE id = ? AND pending = 0");
|
||||
}
|
||||
$stmt->bind_param("i", $this->id);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
@ -65,7 +73,6 @@ class Mix
|
|||
$stmt->close();
|
||||
return $mix;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $mix
|
||||
* @return true
|
||||
|
@ -213,7 +220,14 @@ class Mix
|
|||
|
||||
private function get_mix_by_slug()
|
||||
{
|
||||
$stmt = $this->db->prepare("SELECT * FROM mix WHERE slug = ?");
|
||||
// Check if current user is admin
|
||||
$isAdmin = (isset($_SESSION['user']) && isset($_SESSION['user']['role']) && $_SESSION['user']['role'] === 'admin');
|
||||
|
||||
if ($isAdmin) {
|
||||
$stmt = $this->db->prepare("SELECT * FROM mix WHERE slug = ?");
|
||||
} else {
|
||||
$stmt = $this->db->prepare("SELECT * FROM mix WHERE slug = ? AND pending = 0");
|
||||
}
|
||||
$stmt->bind_param("s", $this->slug);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue