diff --git a/classes/DJ.php b/classes/DJ.php index 05ae474..0fe5a41 100644 --- a/classes/DJ.php +++ b/classes/DJ.php @@ -1,179 +1,179 @@ -slug = $slug; - $this->db = $db; - if (!$this->load_from_slug()) { - return false; - } else { - return true; - } - } - - private function load_from_slug(): bool - { - $socials = []; - $dj = $this->get_dj_by_slug($this->slug); - if ($dj) { - if (isset($dj['id'])) { - $this->id = $dj['id']; - } - if (isset($dj['name'])) { - $this->name = $dj['name']; - } - if (isset($dj['bio'])) { - $this->bio = $dj['bio']; - } - if (isset($dj['img'])) { - - // is this legacy code? - // the code is legacy if it starts with /dj/, - // if it does, prefix with https://www.utahsdjs.com - if (substr($dj['img'], 0, 5) == "/djs/") { - // remove /djs/ from the string - $dj['img'] = substr($dj['img'], 4); - $this->img = "https://cdn.utahsdjs.com" . $dj['img']; - } else { - $this->img = $dj['img']; - } - } - if (isset($dj['email'])) { - $this->email = $dj['email']; - } - - if (isset($dj['facebook_url'])) { - $this->socials['facebook'] = $dj['facebook_url']; - } - if (isset($dj['instagram_url'])) { - $this->socials['instagram'] = $dj['instagram_url']; - } - if (isset($dj['twitter_url'])) { - $this->socials['twitter'] = $dj['twitter_url']; - } - - if (isset($dj['myspace_url'])) { - $this->socials['myspace'] = $dj['myspace_url']; - } - if (isset($dj['soundcloud_url'])) { - $this->socials['soundcloud'] = $dj['soundcloud_url']; - } - if (isset($dj['mixcloud_url'])) { - $this->socials['mixcloud'] = $dj['mixcloud_url']; - } - if (isset($dj['spotify_url'])) { - $this->socials['spotify'] = $dj['spotify_url']; - } - - if (isset($dj['active'])) { - $this->active = $dj['active']; - } - - - if (isset($dj['claimed_by']) && $dj['claimed_by'] != null) { - // TODO: pull some quick data on the user who claimed this DJ - $this->claimed = true; - - - } - - if (isset($dj['created'])) { - $this->created = $dj['created']; - } - if (isset($dj['updated'])) { - $this->updated = $dj['updated']; - } - - return true; - } else { - return false; - } - } - - private function get_dj_by_slug($slug) - { - $stmt = $this->db->prepare("SELECT * FROM djs WHERE slug = ?"); - $stmt->bind_param("s", $slug); - $stmt->execute(); - $result = $stmt->get_result(); - $dj = $result->fetch_assoc(); - $stmt->close(); - return $dj; - } - - public function get_slug(): string - { - return $this->slug; - } - - public function get_id(): int - { - return $this->id; - } - - public function get_name(): string - { - return $this->name; - } - - public function get_bio(): string - { - return $this->bio; - } - - public function get_img(): string - { - return $this->img; - } - - public function get_active(): bool - { - return $this->active; - } - - public function get_email(): string - { - return $this->email; - } - - public function get_socials(): array - { - return $this->socials; - } - - public function get_created(): string - { - return $this->created; - } - - public function get_updated(): string - { - return $this->updated; - } - - public function get_claimed(): bool - { - return $this->claimed; - } - - +slug = $slug; + $this->db = $db; + if (!$this->load_from_slug()) { + return false; + } else { + return true; + } + } + + private function load_from_slug(): bool + { + $socials = []; + $dj = $this->get_dj_by_slug($this->slug); + if ($dj) { + if (isset($dj['id'])) { + $this->id = $dj['id']; + } + if (isset($dj['name'])) { + $this->name = $dj['name']; + } + if (isset($dj['bio'])) { + $this->bio = $dj['bio']; + } + if (isset($dj['img'])) { + + // is this legacy code? + // the code is legacy if it starts with /dj/, + // if it does, prefix with https://www.utahsdjs.com + if (substr($dj['img'], 0, 5) == "/djs/") { + // remove /djs/ from the string + $dj['img'] = substr($dj['img'], 4); + $this->img = "https://cdn.utahsdjs.com" . $dj['img']; + } else { + $this->img = $dj['img']; + } + } + if (isset($dj['email'])) { + $this->email = $dj['email']; + } + + if (isset($dj['facebook_url'])) { + $this->socials['facebook'] = $dj['facebook_url']; + } + if (isset($dj['instagram_url'])) { + $this->socials['instagram'] = $dj['instagram_url']; + } + if (isset($dj['twitter_url'])) { + $this->socials['twitter'] = $dj['twitter_url']; + } + + if (isset($dj['myspace_url'])) { + $this->socials['myspace'] = $dj['myspace_url']; + } + if (isset($dj['soundcloud_url'])) { + $this->socials['soundcloud'] = $dj['soundcloud_url']; + } + if (isset($dj['mixcloud_url'])) { + $this->socials['mixcloud'] = $dj['mixcloud_url']; + } + if (isset($dj['spotify_url'])) { + $this->socials['spotify'] = $dj['spotify_url']; + } + + if (isset($dj['active'])) { + $this->active = $dj['active']; + } + + + if (isset($dj['claimed_by']) && $dj['claimed_by'] != null) { + // TODO: pull some quick data on the user who claimed this DJ + $this->claimed = true; + + + } + + if (isset($dj['created'])) { + $this->created = $dj['created']; + } + if (isset($dj['updated'])) { + $this->updated = $dj['updated']; + } + + return true; + } else { + return false; + } + } + + private function get_dj_by_slug($slug) + { + $stmt = $this->db->prepare("SELECT * FROM djs WHERE slug = ?"); + $stmt->bind_param("s", $slug); + $stmt->execute(); + $result = $stmt->get_result(); + $dj = $result->fetch_assoc(); + $stmt->close(); + return $dj; + } + + public function get_slug(): string + { + return $this->slug; + } + + public function get_id(): int + { + return $this->id; + } + + public function get_name(): string + { + return $this->name; + } + + public function get_bio(): string + { + return $this->bio; + } + + public function get_img(): string + { + return $this->img; + } + + public function get_active(): bool + { + return $this->active; + } + + public function get_email(): string + { + return $this->email; + } + + public function get_socials(): array + { + return $this->socials; + } + + public function get_created(): string + { + return $this->created; + } + + public function get_updated(): string + { + return $this->updated; + } + + public function get_claimed(): bool + { + return $this->claimed; + } + + } \ No newline at end of file diff --git a/classes/Genre.php b/classes/Genre.php index 7a992f4..8a74623 100644 --- a/classes/Genre.php +++ b/classes/Genre.php @@ -1,102 +1,102 @@ -db = $db; - if (intval($value)) { - $this->id = $value; - if ($this->load_by_id()) { - return true; - } else { - return false; - } - } else { - $this->slug = $value; - if ($this->load_by_slug()) { - return true; - } else { - return false; - } - } - - - } - - private function load_by_id(): bool - { - $genre = $this->get_genre_by_id(); - if ($genre && $genre['name'] != "") { - $this->enabled = $genre['enabled']; - $this->count = $genre['count']; - $this->name = $genre['name']; - $this->slug = $genre['slug']; - return true; - } else { - return false; - } - } - - private function get_genre_by_id() - { - $stmt = $this->db->prepare("SELECT * FROM genres WHERE id = ?"); - $stmt->bind_param("i", $this->id); - $stmt->execute(); - $result = $stmt->get_result(); - $dj = $result->fetch_assoc(); - $stmt->close(); - return $dj; - } - - private function load_by_slug(): bool - { - $genre = $this->get_genre_by_slug(); - - if ($genre && $genre['name'] != "") { - $this->id = $genre['id']; - $this->enabled = $genre['enabled']; - $this->count = $genre['count']; - $this->name = $genre['name']; - return true; - } - return false; - - } - - private function get_genre_by_slug() - { - $stmt = $this->db->prepare("SELECT * FROM genres WHERE slug = ?"); - $stmt->bind_param("s", $this->slug); - $stmt->execute(); - $result = $stmt->get_result(); - $dj = $result->fetch_assoc(); - $stmt->close(); - return $dj; - } - - public function get_slug(): string - { - return $this->slug; - } - - public function get_id(): int - { - return $this->id; - } - - public function get_name(): string - { - return $this->name; - } - - +db = $db; + if (intval($value)) { + $this->id = $value; + if ($this->load_by_id()) { + return true; + } else { + return false; + } + } else { + $this->slug = $value; + if ($this->load_by_slug()) { + return true; + } else { + return false; + } + } + + + } + + private function load_by_id(): bool + { + $genre = $this->get_genre_by_id(); + if ($genre && $genre['name'] != "") { + $this->enabled = $genre['enabled']; + $this->count = $genre['count']; + $this->name = $genre['name']; + $this->slug = $genre['slug']; + return true; + } else { + return false; + } + } + + private function get_genre_by_id() + { + $stmt = $this->db->prepare("SELECT * FROM genres WHERE id = ?"); + $stmt->bind_param("i", $this->id); + $stmt->execute(); + $result = $stmt->get_result(); + $dj = $result->fetch_assoc(); + $stmt->close(); + return $dj; + } + + private function load_by_slug(): bool + { + $genre = $this->get_genre_by_slug(); + + if ($genre && $genre['name'] != "") { + $this->id = $genre['id']; + $this->enabled = $genre['enabled']; + $this->count = $genre['count']; + $this->name = $genre['name']; + return true; + } + return false; + + } + + private function get_genre_by_slug() + { + $stmt = $this->db->prepare("SELECT * FROM genres WHERE slug = ?"); + $stmt->bind_param("s", $this->slug); + $stmt->execute(); + $result = $stmt->get_result(); + $dj = $result->fetch_assoc(); + $stmt->close(); + return $dj; + } + + public function get_slug(): string + { + return $this->slug; + } + + public function get_id(): int + { + return $this->id; + } + + public function get_name(): string + { + return $this->name; + } + + } \ No newline at end of file diff --git a/dj.php b/dj.php index 5851ab8..ae9438a 100644 --- a/dj.php +++ b/dj.php @@ -1,313 +1,313 @@ -get_name() != "") { - $djFound = true; - } -} - - -?> - - -
- - -'; - echo "Claimed"; - echo "
"; - } - - ?> - -$location1
-$value -
- "; - } - $socials = $dj->get_socials(); - - foreach ($socials as $key => $value) { - echo social_line($key, $value); - } - - ?> - -Full Name
-Johnatan Smith
-example@example.com
-Phone
-(097) 234-5678
-Mobile
-(098) 765-4321
-Address
-Bay Area, San Francisco, CA
-assigment Project - Status -
-Web Design
-Website Markup
-One Page
-Mobile Template
-Backend API
-assigment Project - Status -
-Web Design
-Website Markup
-One Page
-Mobile Template
-Backend API
-'; + echo "Claimed"; + echo "
"; + } + + ?> + +$location1
+$value +
+ "; + } + $socials = $dj->get_socials(); + + foreach ($socials as $key => $value) { + echo social_line($key, $value); + } + + ?> + +Full Name
+Johnatan Smith
+example@example.com
+Phone
+(097) 234-5678
+Mobile
+(098) 765-4321
+Address
+Bay Area, San Francisco, CA
+assigment Project + Status +
+Web Design
+Website Markup
+One Page
+Mobile Template
+Backend API
+assigment Project + Status +
+Web Design
+Website Markup
+One Page
+Mobile Template
+Backend API
+'; - echo "Claimed"; - echo "
"; - } - - ?> - -$location1
-$value -
- "; - } - $socials = $dj->get_socials(); - - foreach ($socials as $key => $value) { - echo social_line($key, $value); - } - - ?> - -Full Name
-Johnatan Smith
-example@example.com
-Phone
-(097) 234-5678
-Mobile
-(098) 765-4321
-Address
-Bay Area, San Francisco, CA
-assigment Project - Status -
-Web Design
-Website Markup
-One Page
-Mobile Template
-Backend API
-assigment Project - Status -
-Web Design
-Website Markup
-One Page
-Mobile Template
-Backend API
-'; + echo "Claimed"; + echo "
"; + } + + ?> + +$location1
+$value +
+ "; + } + $socials = $dj->get_socials(); + + foreach ($socials as $key => $value) { + echo social_line($key, $value); + } + + ?> + +Full Name
+Johnatan Smith
+example@example.com
+Phone
+(097) 234-5678
+Mobile
+(098) 765-4321
+Address
+Bay Area, San Francisco, CA
+assigment Project + Status +
+Web Design
+Website Markup
+One Page
+Mobile Template
+Backend API
+assigment Project + Status +
+Web Design
+Website Markup
+One Page
+Mobile Template
+Backend API
+