Update README.md and sync files.

This commit is contained in:
Cody Cook 2024-05-06 21:48:35 -07:00
commit da93d643d9
11 changed files with 763 additions and 2 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
/includes/config.toml
/.idea
/fontawesome-free-6.5.2-web/
/_form/

View file

@ -1 +1,59 @@
* [DJ Mix Hosting Software](#dj-mix-hosting-software)
* [About](#about)
* [Features](#features)
* [Installation](#installation)
* [Usage](#usage)
* [Contributing](#contributing)
* [License](#license)
* [Contact](#contact)
* [Acknowledgements](#acknowledgements)
# DJ Mix Hosting Software
[![Crowdin](https://badges.crowdin.net/djmixhostingsoftware/localized.svg)](https://crowdin.com/project/djmixhostingsoftware)
## About
DJ Mix Hosting Software is a web application that allows users to upload and share their DJ mixes. The application is
built using PHP and MySQL.
## Features
- User login/registration
- Add, edit, delete DJs
- Add, upload, edit, delete mixes
- View mixes by DJ
- View mixes by genre
- Basic SEO
- S3 file storage _(optional)_
- MP3 tag editing _(optional)_
## Installation
The repo is the source code for the application. You will need to point your web server to this directory.
Create a MySQL database using the .sql files in the `sql` directory.
Copy `includes/config.toml.default` to `includes/config.toml` and update the settings as needed.
## Usage
The application is designed to be used by DJs to upload and share their mixes. Users can listen to mixes by DJ or genre.
Why would you use this over Soundcloud or Mixcloud? You have full control over the mixes and can customize the application to your liking.
## Contributing
Contributions are welcome. Please see the [CONTRIBUTING.md](CONTRIBUTING.md) file for more information.
## License
This is to be determined.
## Contact
Please see the [CONTRIBUTING.md](CONTRIBUTING.md) file for contact information.
## Acknowledgements
- [Bootstrap](https://getbootstrap.com/)
- [Font Awesome](https://fontawesome.com/)
- [jQuery](https://jquery.com/)
- [PHP](https://www.php.net/)
- [MariaDB](https://mariadb.org/)
- [AWS S3](https://aws.amazon.com/s3/)
- [DigitalOcean](https://www.digitalocean.com/)
- [Crowdin](https://crowdin.com/)
- [Cody Cook](https://codycook.us])

60
classes/Schema.php Normal file
View file

@ -0,0 +1,60 @@
<?php
class Schema
{
private $albumProductionType = "DJMixAlbum";
private $type = "";
private $name = "";
private $byArtist = "";
private $inAlbum = "";
private $genre = "";
private $url = "";
private $image = "";
private $duration = "";
private $datePublished = "";
/*
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "MusicRecording",
"name": "Future Primitive",
"byArtist": {
"@type": "MusicGroup",
"name": "10-E",
"image": "/djs/10e/profile.jpg"
},
"inAlbum": {
"@type": "MusicAlbum",
"name": "Future Primitive"
},
"genre": "Trance",
"url": "https://utahsdjs.com/mix/future-primitive",
"image": "https://utahsdjs.com//djs/no-art-provided.png",
"duration": "PT1H11M5S",
"datePublished": "2009-03-02 23:57:01",
"description": "Listen to Future Primitive on Utah's DJs.",
"interactionStatistic": {
"@type": "InteractionCounter",
"interactionType": "https://schema.org/ListenAction",
"userInteractionCount": "537",
"url": "https://utahsdjs.com/mix/future-primitive/download"
}
}
*/
}

60
classes/Telegram.php Normal file
View file

@ -0,0 +1,60 @@
<?php
class Telegram
{
private $token = "";
private $chat_id = "";
private $parse_mode = "HTML";
private $disable_web_page_preview = true;
private $disable_notification = false;
private $reply_to_message_id = 0;
private $message = "";
private $url = "https://api.telegram.org/bot";
public function __construct($token, $chat_id, $reply_to_message_id = 0)
{
$this->token = $token;
$this->chat_id = $chat_id;
$this->reply_to_message_id = $reply_to_message_id;
$this->url .= $this->token;
}
public function send_message($message)
{
$this->message = $message;
$result = $this->sendMessage();
if ($result) {
return json_decode($result, true);
}
return false;
}
private function sendMessage()
{
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => $this->url . "/sendMessage",
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => [
'chat_id' => $this->chat_id,
'text' => $this->message,
'parse_mode' => $this->parse_mode,
'disable_web_page_preview' => $this->disable_web_page_preview,
'disable_notification' => $this->disable_notification,
'reply_to_message_id' => $this->reply_to_message_id
],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => false,
CURLOPT_SSL_VERIFYPEER => false
]);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
}

88
classes/Upload.php Normal file
View file

@ -0,0 +1,88 @@
<?php
class Upload
{
private $file;
private $file_name;
private $file_size;
private $file_tmp;
private $file_type;
private $file_ext;
private $file_path;
private $extensions = array("mp3", "zip");
private $upload_dir = "uploads/";
private $errors = array();
private $ok = false;
private $config;
private $uuid = "";
public function __construct($file, $config)
{
$this->file = $file;
$this->file_name = $file['name'];
$this->file_size = $file['size'];
$this->file_tmp = $file['tmp_name'];
$this->file_type = $file['type'];
$this->config = $config;
$ext = explode('.', $file['name']);
$this->file_ext = strtolower(end($ext));
$this->uuid = uniqid();
}
private function check_file_size(): bool
{
if ($this->file_size > $this->config['uploads']['max_file_size']){
$this->errors[] = "File size is too large";
return false;
}
return true;
}
private function check_file_extension(): bool
{
if (!in_array($this->file_ext, $this->extensions)){
$this->errors[] = "Invalid file extension";
return false;
}
return true;
}
private function check_file_exists(): bool
{
if (file_exists($this->upload_dir . $this->file_name)){
$this->errors[] = "File already exists";
return false;
}
return true;
}
private function move_file(): bool
{
if (move_uploaded_file($this->file_tmp, $this->upload_dir . $this->uuid)){
$this->file_path = $this->upload_dir . $this->uuid;
return true;
}
return false;
}
public function dump_all()
{
$array = array(
"file" => $this->file,
"file_name" => $this->file_name,
"file_size" => $this->file_size,
"file_tmp" => $this->file_tmp,
"file_type" => $this->file_type,
"file_ext" => $this->file_ext,
"file_path" => $this->file_path,
"extensions" => $this->extensions,
"upload_dir" => $this->upload_dir,
"errors" => $this->errors,
"ok" => $this->ok,
"uuid" => $this->uuid
);
}
}

66
contact.php Normal file
View file

@ -0,0 +1,66 @@
<?php
require 'includes/globals.php';
require_once 'classes/Database.php';
if ($_POST) {
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
require 'classes/Telegram.php';
$telegram = new Telegram($config['notifications']['telegram']['token'], $config['notifications']['telegram']['chat_id']);
$result = $telegram->send_message("Name: $name\nEmail: $email\nMessage: $message");
}
$title = $locale['contactus'];
require_once 'includes/header.php';
if ($_POST) {
if ($result['ok']) {
echo '<div class="alert alert-success" role="alert">Message sent successfully</div>';
} else {
echo '<div class="alert alert-danger" role="alert">An error occurred while sending the message</div>';
}
}
?>
<section style="background-color: #eee;">
<div class="container py-5">
<div class="row">
<div class="col">
<nav aria-label="breadcrumb" class="bg-body-tertiary rounded-3 p-3 mb-4">
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item"><a href="/"><?php echo $locale['home']; ?></a></li>
<li class="breadcrumb-item active"><a href="/contact.php"><?php echo $locale['contactus']; ?></a></li>
</ol>
</nav>
</div>
</div>
</div>
</section>
<div class="container py-5">
<div class="row">
<div class="col">
<h1><?php echo $locale['contactus']; ?></h1>
<p>For any inquiries, please complete the form below.</p>
</div>
</div>
<div class="row">
<div class="col-lg-6">
<form action="contact.php" method="post">
<div class="mb-3">
<label for="name" class="form-label">Name</label>
<input type="text" class="form-control" id="name" name="name" required>
</div>
<div class="mb-3">
<label for="email" class="form-label">Email</label>
<input type="email" class="form-control" id="email" name="email" required>
</div>
<div class="mb-3">
<label for="message" class="form-label">Message</label>
<textarea class="form-control" id="message" name="message" rows="3" required></textarea>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
</div>
<?php
require_once 'includes/footer.php';

View file

@ -1,3 +1,23 @@
<section style="background-color: #eee;">
<div class="container py-5">
<div class="row">
<div class="col text-center">
<p><?php
// copyright
echo "&copy; 2008 - ";
echo date('Y');
echo " " . $locale['allrightsreserved'];
?></p>
</div>
</div>
<div class="row">
<div class="col text-center">
Created using <a href="https://gitea.threefifteen.info/cody/dj_mix_hosting_software">DJ Mix Hosting Software</a>
</div>
</div>
</div>
</section>
<script src="../js/bootstrap.bundle.min.js"></script>

View file

@ -58,7 +58,7 @@ $current_lang = $_SESSION['lang'] ?? $config['app']['locale'];
</select>
</div>
</div>
<?php
if (isset($_SESSION['user'])) {
echo '<a class="nav-link" href="/profile.php">' . $locale['userProfile'] . '</a>';
@ -73,4 +73,5 @@ $current_lang = $_SESSION['lang'] ?? $config['app']['locale'];
</form>
</div>
</div>
</div>
</header>

View file

@ -15,4 +15,5 @@ require 'includes/header.php'; ?>
</div>
</div>
</section>
<?php require 'includes/footer.php'; ?>

View file

@ -51,6 +51,8 @@ return [
"downloadMix" => "Download Mix",
"plays" => "Plays",
"play" => "Play",
"contactus" => "Contact Us",
"allrightsreserved" => "All rights reserved.",

404
sql/database.sql Normal file
View file

@ -0,0 +1,404 @@
-- --------------------------------------------------------
-- Server version: 10.11.6-MariaDB-0+deb12u1 - Debian 12
-- Server OS: debian-linux-gnu
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-- Dumping database structure for djmixhostingsoftware
DROP DATABASE IF EXISTS `djmixhostingsoftware`;
CREATE DATABASE IF NOT EXISTS `djmixhostingsoftware` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */;
USE `djmixhostingsoftware`;
-- Dumping structure for table djmixhostingsoftware.djs
DROP TABLE IF EXISTS `djs`;
CREATE TABLE IF NOT EXISTS `djs` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` longtext NOT NULL,
`bio` longtext DEFAULT NULL,
`slug` longtext NOT NULL,
`img` longtext DEFAULT NULL,
`active` tinyint(1) unsigned DEFAULT NULL,
`deceased` tinyint(1) unsigned DEFAULT NULL,
`email` varchar(300) DEFAULT NULL,
`enabled` tinyint(4) NOT NULL DEFAULT 0,
`status` tinyint(4) DEFAULT NULL,
`facebook_url` varchar(50) DEFAULT NULL,
`instagram_url` varchar(50) DEFAULT NULL,
`myspace_url` varchar(50) DEFAULT NULL,
`custom1_url` varchar(200) DEFAULT NULL,
`homepage_url` varchar(200) DEFAULT NULL,
`twitter_url` varchar(50) DEFAULT NULL,
`linktree_url` varchar(50) DEFAULT NULL,
`soundcloud_url` varchar(50) DEFAULT NULL,
`mixcloud_url` varchar(50) DEFAULT NULL,
`socials` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`socials`)),
`claimed_by` varchar(50) DEFAULT NULL,
`count` int(11) DEFAULT NULL,
`created` timestamp NOT NULL DEFAULT current_timestamp(),
`lastupdated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=903 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='The DJ database.';
-- Data exporting was unselected.
-- Dumping structure for table djmixhostingsoftware.emails
DROP TABLE IF EXISTS `emails`;
CREATE TABLE IF NOT EXISTS `emails` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`messageId` varchar(75) DEFAULT NULL,
`sender` varchar(128) DEFAULT NULL,
`recipients` text DEFAULT NULL,
`subject` text DEFAULT NULL,
`bodyText` text DEFAULT NULL,
`bodyHTML` text DEFAULT NULL,
`error` text DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `messageId` (`messageId`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
-- Data exporting was unselected.
-- Dumping structure for table djmixhostingsoftware.errors
DROP TABLE IF EXISTS `errors`;
CREATE TABLE IF NOT EXISTS `errors` (
`id` int(6) unsigned NOT NULL AUTO_INCREMENT,
`error` varchar(255) DEFAULT NULL,
`url` varchar(255) DEFAULT NULL,
`useragent` varchar(255) DEFAULT NULL,
`server` varchar(255) DEFAULT NULL,
`ip` varchar(255) DEFAULT NULL,
`time` varchar(255) DEFAULT NULL,
`querystring` varchar(255) DEFAULT NULL,
`requesturi` varchar(255) DEFAULT NULL,
`scriptname` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9143 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
-- Data exporting was unselected.
-- Dumping structure for table djmixhostingsoftware.genres
DROP TABLE IF EXISTS `genres`;
CREATE TABLE IF NOT EXISTS `genres` (
`item` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id` int(11) unsigned NOT NULL,
`enabled` int(11) unsigned NOT NULL DEFAULT 1,
`count` int(11) unsigned NOT NULL DEFAULT 0,
`name` varchar(50) NOT NULL,
`slug` varchar(50) NOT NULL,
PRIMARY KEY (`item`),
UNIQUE KEY `slug` (`slug`)
) ENGINE=InnoDB AUTO_INCREMENT=236 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='The Genre Database.';
-- Data exporting was unselected.
-- Dumping structure for table djmixhostingsoftware.mix
DROP TABLE IF EXISTS `mix`;
CREATE TABLE IF NOT EXISTS `mix` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(200) NOT NULL,
`slug` varchar(50) NOT NULL,
`description` varchar(500) DEFAULT NULL,
`cover` varchar(150) DEFAULT NULL,
`url` varchar(200) NOT NULL,
`seconds` int(10) unsigned DEFAULT NULL,
`mediaplayer` int(11) unsigned DEFAULT NULL,
`dj1` int(11) unsigned NOT NULL,
`dj2` int(11) unsigned DEFAULT NULL,
`dj3` int(11) unsigned DEFAULT NULL,
`pending` tinyint(4) unsigned NOT NULL DEFAULT 1,
`recorded` timestamp NULL DEFAULT NULL,
`created` timestamp NULL DEFAULT current_timestamp(),
`lastupdated` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `slug` (`slug`)
) ENGINE=InnoDB AUTO_INCREMENT=1153 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
-- Data exporting was unselected.
-- Dumping structure for table djmixhostingsoftware.mix_file
DROP TABLE IF EXISTS `mix_file`;
CREATE TABLE IF NOT EXISTS `mix_file` (
`id` varchar(50) NOT NULL DEFAULT uuid(),
`filename` varchar(100) NOT NULL,
`seconds` int(11) unsigned NOT NULL,
`mime` varchar(50) NOT NULL,
`hash` char(50) NOT NULL,
`created` timestamp NOT NULL DEFAULT current_timestamp(),
`lastupdated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
KEY `id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
-- Data exporting was unselected.
-- Dumping structure for table djmixhostingsoftware.mix_meta
DROP TABLE IF EXISTS `mix_meta`;
CREATE TABLE IF NOT EXISTS `mix_meta` (
`meta_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`mix_id` int(11) unsigned NOT NULL,
`attribute` longtext NOT NULL,
`value` longtext NOT NULL,
`created` timestamp NOT NULL DEFAULT current_timestamp(),
`updated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`meta_id`),
KEY `mixId` (`mix_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3987 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
-- Data exporting was unselected.
-- Dumping structure for table djmixhostingsoftware.plays
DROP TABLE IF EXISTS `plays`;
CREATE TABLE IF NOT EXISTS `plays` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`mix_id` int(11) unsigned NOT NULL,
`ip` varchar(100) NOT NULL,
`created` timestamp NULL DEFAULT current_timestamp(),
`updated` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5344 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Implemented 2023/04/09 at 12:01 AM';
-- Data exporting was unselected.
-- Dumping structure for table djmixhostingsoftware.ratings
DROP TABLE IF EXISTS `ratings`;
CREATE TABLE IF NOT EXISTS `ratings` (
`id` char(36) NOT NULL DEFAULT uuid(),
`mixId` int(10) unsigned NOT NULL,
`guid` char(36) NOT NULL DEFAULT '0',
`rating` int(1) unsigned NOT NULL DEFAULT 5,
`created` timestamp NOT NULL DEFAULT current_timestamp(),
`updated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `mixId_guid` (`mixId`,`guid`),
KEY `guid` (`guid`),
CONSTRAINT `guid` FOREIGN KEY (`guid`) REFERENCES `users` (`guid`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `Rating` CHECK (`rating` >= 1 and `rating` <= 5)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
-- Data exporting was unselected.
-- Dumping structure for table djmixhostingsoftware.release
DROP TABLE IF EXISTS `release`;
CREATE TABLE IF NOT EXISTS `release` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` longtext NOT NULL,
`description` longtext DEFAULT NULL,
`cover` int(11) NOT NULL,
`lastupdated` datetime DEFAULT NULL,
`created` datetime DEFAULT NULL,
`slug` longtext DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
-- Data exporting was unselected.
-- Dumping structure for table djmixhostingsoftware.release_meta
DROP TABLE IF EXISTS `release_meta`;
CREATE TABLE IF NOT EXISTS `release_meta` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`release_id` int(11) NOT NULL,
`mix_id` int(11) NOT NULL,
`sortorder` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
-- Data exporting was unselected.
-- Dumping structure for table djmixhostingsoftware.shows
DROP TABLE IF EXISTS `shows`;
CREATE TABLE IF NOT EXISTS `shows` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` longtext NOT NULL,
`description` longtext DEFAULT NULL,
`cover` longtext DEFAULT NULL,
`slug` longtext DEFAULT NULL,
`count` int(11) DEFAULT NULL,
`created` datetime DEFAULT current_timestamp(),
`lastupdated` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
-- Data exporting was unselected.
-- Dumping structure for table djmixhostingsoftware.stats
DROP TABLE IF EXISTS `stats`;
CREATE TABLE IF NOT EXISTS `stats` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`uuid` varchar(50) NOT NULL DEFAULT uuid(),
`timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
`djs` int(11) NOT NULL,
`mixes` int(11) NOT NULL,
`genres` int(11) NOT NULL,
`mixshows` int(11) NOT NULL,
`downloads` int(11) NOT NULL,
`plays` int(11) NOT NULL,
`seconds` bigint(20) NOT NULL,
PRIMARY KEY (`uuid`) USING BTREE,
KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=420 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
-- Data exporting was unselected.
-- Dumping structure for table djmixhostingsoftware.users
DROP TABLE IF EXISTS `users`;
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`guid` char(36) NOT NULL DEFAULT uuid(),
`username` varchar(25) NOT NULL,
`firstName` varchar(50) DEFAULT NULL,
`lastName` varchar(50) DEFAULT NULL,
`email` varchar(200) NOT NULL,
`emailVerified` tinyint(1) NOT NULL DEFAULT 0,
`password` varchar(255) NOT NULL,
`img` varchar(500) DEFAULT NULL,
`apiKey` varchar(64) DEFAULT NULL,
`created` timestamp NOT NULL DEFAULT current_timestamp(),
`lastupdated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`isAdmin` tinyint(1) unsigned DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY `guid` (`guid`),
UNIQUE KEY `username` (`username`),
UNIQUE KEY `email` (`email`),
UNIQUE KEY `apiKey` (`apiKey`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
-- Data exporting was unselected.
-- Dumping structure for trigger djmixhostingsoftware.dj_insert_trigger
DROP TRIGGER IF EXISTS `dj_insert_trigger`;
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER `dj_insert_trigger` BEFORE INSERT ON `djs` FOR EACH ROW BEGIN
SET NEW.email = IFNULL(NULLIF(NEW.email, ''), NULL);
SET NEW.facebook_url = IFNULL(NULLIF(NEW.facebook_url, ''), NULL);
SET NEW.instagram_url = IFNULL(NULLIF(NEW.instagram_url, ''), NULL);
SET NEW.myspace_url = IFNULL(NULLIF(NEW.myspace_url, ''), NULL);
SET NEW.custom1_url = IFNULL(NULLIF(NEW.custom1_url, ''), NULL);
SET NEW.homepage_url = IFNULL(NULLIF(NEW.homepage_url, ''), NULL);
SET NEW.twitter_url = IFNULL(NULLIF(NEW.twitter_url, ''), NULL);
SET NEW.bio = IFNULL(NULLIF(NEW.bio, ''), NULL);
SET NEW.img = IFNULL(NULLIF(NEW.img, ''), NULL);
SET NEW.linktree_url = IFNULL(NULLIF(NEW.linktree_url, ''), NULL);
SET NEW.soundcloud_url = IFNULL(NULLIF(NEW.soundcloud_url, ''), NULL);
SET NEW.mixcloud_url = IFNULL(NULLIF(NEW.mixcloud_url, ''), NULL);
SET NEW.claimed_by = IFNULL(NULLIF(NEW.claimed_by, ''), NULL);
END//
DELIMITER ;
SET SQL_MODE=@OLDTMP_SQL_MODE;
-- Dumping structure for trigger djmixhostingsoftware.dj_update_trigger
DROP TRIGGER IF EXISTS `dj_update_trigger`;
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER `dj_update_trigger` BEFORE UPDATE ON `djs` FOR EACH ROW BEGIN
SET NEW.email = IFNULL(NULLIF(NEW.email, ''), NULL);
SET NEW.facebook_url = IFNULL(NULLIF(NEW.facebook_url, ''), NULL);
SET NEW.instagram_url = IFNULL(NULLIF(NEW.instagram_url, ''), NULL);
SET NEW.myspace_url = IFNULL(NULLIF(NEW.myspace_url, ''), NULL);
SET NEW.custom1_url = IFNULL(NULLIF(NEW.custom1_url, ''), NULL);
SET NEW.homepage_url = IFNULL(NULLIF(NEW.homepage_url, ''), NULL);
SET NEW.twitter_url = IFNULL(NULLIF(NEW.twitter_url, ''), NULL);
SET NEW.linktree_url = IFNULL(NULLIF(NEW.linktree_url, ''), NULL);
SET NEW.soundcloud_url = IFNULL(NULLIF(NEW.soundcloud_url, ''), NULL);
SET NEW.mixcloud_url = IFNULL(NULLIF(NEW.mixcloud_url, ''), NULL);
SET NEW.claimed_by = IFNULL(NULLIF(NEW.claimed_by, ''), NULL);
SET NEW.bio = IFNULL(NULLIF(NEW.bio, ''), NULL);
SET NEW.img = IFNULL(NULLIF(NEW.img, ''), NULL);
END//
DELIMITER ;
SET SQL_MODE=@OLDTMP_SQL_MODE;
-- Dumping structure for trigger djmixhostingsoftware.email_change
DROP TRIGGER IF EXISTS `email_change`;
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER email_change
BEFORE UPDATE ON users
FOR EACH ROW
BEGIN
IF NEW.email <> OLD.email THEN
SET NEW.emailVerified = 0;
END IF;
END//
DELIMITER ;
SET SQL_MODE=@OLDTMP_SQL_MODE;
-- Dumping structure for trigger djmixhostingsoftware.mix_before_update
DROP TRIGGER IF EXISTS `mix_before_update`;
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER mix_before_update
BEFORE UPDATE ON mix
FOR EACH ROW
BEGIN
IF NEW.description = '' THEN
SET NEW.description = NULL;
END IF;
IF NEW.cover = '' THEN
SET NEW.cover = NULL;
END IF;
END//
DELIMITER ;
SET SQL_MODE=@OLDTMP_SQL_MODE;
-- Dumping structure for trigger djmixhostingsoftware.mix_recorded_before_update
DROP TRIGGER IF EXISTS `mix_recorded_before_update`;
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER mix_recorded_before_update
BEFORE UPDATE ON mix
FOR EACH ROW
BEGIN
IF NEW.recorded = '0000-00-00 00:00:00' THEN
SET NEW.recorded = NULL;
END IF;
END//
DELIMITER ;
SET SQL_MODE=@OLDTMP_SQL_MODE;
-- Dumping structure for trigger djmixhostingsoftware.tracklist_trim_insert
DROP TRIGGER IF EXISTS `tracklist_trim_insert`;
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER tracklist_trim_insert
BEFORE INSERT ON mix_meta
FOR EACH ROW
BEGIN
IF NEW.attribute = 'tracklist' THEN
SET NEW.value = REGEXP_REPLACE(NEW.value, '^(\\s*(\\r\\n|\\r|\\n))+|(\\s*(\\r\\n|\\r|\\n))+$', '');
SET NEW.value = REGEXP_REPLACE(NEW.value, '(\\r\\n\\s*){2,}|(\\n\\s*){2,}', '\r\n\r\n');
END IF;
END//
DELIMITER ;
SET SQL_MODE=@OLDTMP_SQL_MODE;
-- Dumping structure for trigger djmixhostingsoftware.tracklist_trim_update
DROP TRIGGER IF EXISTS `tracklist_trim_update`;
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER tracklist_trim_update
BEFORE UPDATE ON mix_meta
FOR EACH ROW
BEGIN
IF NEW.attribute = 'tracklist' THEN
SET NEW.value = REGEXP_REPLACE(NEW.value, '^(\\s*(\\r\\n|\\r|\\n))+|(\\s*(\\r\\n|\\r|\\n))+$', '');
SET NEW.value = REGEXP_REPLACE(NEW.value, '(\\r\\n\\s*){2,}|(\\n\\s*){2,}', '\r\n\r\n');
END IF;
END//
DELIMITER ;
SET SQL_MODE=@OLDTMP_SQL_MODE;
/*!40103 SET TIME_ZONE=IFNULL(@OLD_TIME_ZONE, 'system') */;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */;