diff --git a/classes/Mixshow.php b/classes/Mixshow.php index 693bd04..08037dc 100644 --- a/classes/Mixshow.php +++ b/classes/Mixshow.php @@ -9,9 +9,10 @@ class Mixshow private $slug = ""; private $db = null; private $description = ""; - private $cover = ""; + private $cover = "img/no-image1.png"; private $count; private $mixes = []; + private $updated; public function __construct($value, $db) { @@ -29,7 +30,7 @@ class Mixshow private function load_by_id() { $mixshow = $this->get_mixshow_by_id(); - if ($mixshow && $mixshow['title'] != "") { + if ($mixshow && $mixshow['name'] != "") { return $this->build_mixshow($mixshow); } else { return false; @@ -52,8 +53,16 @@ class Mixshow $this->name = $mixshow['name']; $this->slug = $mixshow['slug']; $this->description = $mixshow['description']; - $this->cover = $mixshow['cover']; - $this->enabled = $mixshow['enabled']; + // is this legacy code? + // the code is legacy if it starts with /dj/, + // if it does, prefix with https://www.utahsdjs.com + if (substr($mixshow['cover'], 0, 5) == "/djs/") { + // remove /djs/ from the string + $mixshow['cover'] = substr($mixshow['cover'], 4); + $this->cover = "https://cdn.utahsdjs.com" . $mixshow['cover']; + } + + $this->updated = $mixshow['lastupdated']; $this->count = $mixshow['count']; $this->load_mixes(); return true; @@ -61,7 +70,7 @@ class Mixshow private function load_mixes() { - $stmt = $this->db->prepare("SELECT value FROM mix_meta WHERE value = ?"); + $stmt = $this->db->prepare("SELECT mix_id FROM mix_meta WHERE value = ? AND attribute = 'mixshow'"); $stmt->bind_param("i", $this->id); $stmt->execute(); $result = $stmt->get_result(); @@ -74,7 +83,7 @@ class Mixshow private function load_by_slug() { $mixshow = $this->get_mixshow_by_slug(); - if ($mixshow && $mixshow['title'] != "") { + if ($mixshow && $mixshow['name'] != "") { return $this->build_mixshow($mixshow); } else { return false; @@ -130,5 +139,8 @@ class Mixshow return $this->mixes; } + public function get_updated(){ + return $this->updated; + } } \ No newline at end of file diff --git a/classes/Mixshows.php b/classes/Mixshows.php new file mode 100644 index 0000000..c2415cf --- /dev/null +++ b/classes/Mixshows.php @@ -0,0 +1,53 @@ +db = $db; + if (!$this->load_all_mixshows()) { + return false; + } else { + return true; + } + + } + + private function load_all_mixshows(): bool + { + $mixshows = $this->get_all_mixshows(); + if ($mixshows) { + $this->mixshows = $mixshows; + return true; + } else { + return false; + } + + + } + + public function get_all_mixshows($order = "ASC") + { + $stmt = $this->db->prepare("SELECT * FROM shows ORDER BY name $order"); + $stmt->execute(); + $result = $stmt->get_result(); + $mixshows = $result->fetch_all(MYSQLI_ASSOC); + $stmt->close(); + return $mixshows; + } + + public function get_nonzero_mixshows() + { + $stmt = $this->db->prepare("SELECT * FROM shows WHERE count > 0 ORDER BY name ASC"); + $stmt->execute(); + $result = $stmt->get_result(); + $mixshows = $result->fetch_all(MYSQLI_ASSOC); + $stmt->close(); + return $mixshows; + } +} \ No newline at end of file diff --git a/classes/User.php b/classes/User.php new file mode 100644 index 0000000..e69fd8e --- /dev/null +++ b/classes/User.php @@ -0,0 +1,50 @@ +db = $db; + } + + /** + * @throws RandomException + */ + public function newUser($username, $password, $email){ + $this->username = $username; + $this->email = $email; + $password2 = password_hash($password, PASSWORD_DEFAULT); + $this->password = $password2; + + $this->location = ""; + $this->bio = ""; + $this->created = date('Y-m-d H:i:s'); + $this->updated = date('Y-m-d H:i:s'); + $this->verified = 0; + $this->role = "user"; + $this->img = ""; + $this->api_key = bin2hex(random_bytes(32)); + + $stmt = $this->db->prepare("INSERT INTO users (username, password, email, img) VALUES (?, ?, ?, ?)"); + $stmt->bind_param("ssss", $this->username, $this->password, $this->email, $this->img); + $stmt->execute(); + $stmt->close(); + + } + + +} \ No newline at end of file diff --git a/dj.php b/dj.php index e7a94d6..9e0b6c0 100644 --- a/dj.php +++ b/dj.php @@ -72,7 +72,7 @@ require_once 'includes/header.php'; if ($dj->get_socials() != []) { ?>
';
- echo '';
+ echo ' ';
+ echo '';
echo $output->get_name();
echo '';
echo ' ';
foreach ($genrelist as $slug => $name) {
echo ' ';
+ // ellipse the genre name if it's too long
echo '' . $name . '';
echo '';
}
@@ -146,12 +147,27 @@ require_once 'includes/header.php';
echo ' ';
$duration = $output->get_duration();
echo $duration['t'];
echo ' ';
+ // date format should just be year
+ $date = $output->get_recorded();
+ if ($date == "") {
+ $date = $output->get_created();
+ }
+ echo date('Y', strtotime($date));
+
+ echo '
get_name(); ?> +
+' . $dj['count'] . ' '; if ($dj['count'] == 1) { echo $locale['mix']; diff --git a/includes/navbar.php b/includes/navbar.php index 2487ce5..5afcf1b 100644 --- a/includes/navbar.php +++ b/includes/navbar.php @@ -41,6 +41,12 @@ $current_lang = $_SESSION['lang'] ?? $config['app']['locale']; echo current_list(); } ?>" href="/djs.php"> +
'Welcome to our Website!', 'description' => 'This is a description in English.', + 'desc' => 'Description', 'userProfile' => "User Profile", 'user' => 'User', 'home' => 'Home', @@ -23,6 +24,7 @@ return [ "mixes" => "Mixes", "mix" => "Mix", "mixNotFound" => "Could not load mix; either the mix wasn't found, was empty, or this mix is private.", + "mixshowNotFound" => "Could not load mixshow; either the mixshow wasn't found, was empty, or this mixshow is private.", "mixName" => "Mix Name", "mixDescription" => "Mix Description", "mixLength" => "Mix Length", @@ -53,6 +55,9 @@ return [ "play" => "Play", "contactus" => "Contact Us", "allrightsreserved" => "All rights reserved.", + "mixshows" => "Mixshows", + "mixshow" => "Mixshow", + "mixshowName" => "Mixshow Name", diff --git a/login.php b/login.php new file mode 100644 index 0000000..98b4f2b --- /dev/null +++ b/login.php @@ -0,0 +1,58 @@ +login($username, $password); + } +} + +require_once 'includes/header.php'; ?> ++ get_slug(); + echo "'>" . $mixshow->get_name() . ""; + if ($i < $mixshowsCount - 1) { + echo ", "; + } + $i++; + } + ?> +
" . $locale['tracklist'] . "
"; - echo "get_name(); ?>
+'; + echo ''; + echo $output->get_name(); + echo ''; + echo '
'; + echo ''; + foreach ($genrelist as $slug => $name) { + echo ' '; + // ellipse the genre name if it's too long + echo '' . $name . ''; + echo ''; + } + echo '
'; + echo ''; + $duration = $output->get_duration(); + echo $duration['t']; + echo '
'; + echo ''; + // date format should just be year + $date = $output->get_recorded(); + if ($date == "") { + $date = $output->get_created(); + } + echo date('Y', strtotime($date)); + + echo '
'; + echo '