Various new features.
This commit is contained in:
parent
ad68f515e0
commit
36e6e23a68
14 changed files with 437 additions and 523 deletions
|
@ -7,4 +7,6 @@
|
|||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
110
includes/globals.php
Normal file
110
includes/globals.php
Normal file
|
@ -0,0 +1,110 @@
|
|||
<?php
|
||||
|
||||
// read toml config file
|
||||
require_once 'vendor/autoload.php';
|
||||
|
||||
use Yosymfony\Toml\Toml;
|
||||
|
||||
$config = Toml::ParseFile('includes/config.toml');
|
||||
require_once 'functions/i18n.php';
|
||||
require_once 'includes/sessions.php';
|
||||
require_once 'includes/lang_loader.php';
|
||||
|
||||
|
||||
/**
|
||||
* @param int $count
|
||||
* @param mixed $dj
|
||||
* @param mixed $locale
|
||||
* @return void
|
||||
*/
|
||||
function card_output(int $count, mixed $dj, mixed $locale): void
|
||||
{
|
||||
if ($count % 4 == 0) {
|
||||
echo '<div class="row">';
|
||||
}
|
||||
echo '<div class="col-md-3">';
|
||||
echo '<div class="card mb-4">';
|
||||
echo '<div class="card-body">';
|
||||
echo '<h5 class="card-title" title="' . $dj['name'] . '">' . $dj['name'] . '</h5>';
|
||||
echo '<p class="card-text">' . $dj['count'] . ' ';
|
||||
if ($dj['count'] == 1) {
|
||||
echo $locale['mix'];
|
||||
} else {
|
||||
echo $locale['mixes'];
|
||||
}
|
||||
echo '</p>';
|
||||
}
|
||||
|
||||
function social_line($social, $value): string
|
||||
{
|
||||
$icon = "";
|
||||
$url = "";
|
||||
$color = "#000000";
|
||||
|
||||
switch ($social) {
|
||||
case "facebook":
|
||||
$icon = "fa-brands fa-facebook";
|
||||
$url = "https://www.facebook.com/$value";
|
||||
$color = "#3b5998";
|
||||
$name = "Facebook";
|
||||
break;
|
||||
case "instagram":
|
||||
$icon = "fa-brands fa-instagram";
|
||||
$url = "https://www.instagram.com/$value";
|
||||
$color = "#ac2bac";
|
||||
$name = "Instagram";
|
||||
break;
|
||||
case "twitter":
|
||||
$icon = "fa-brands fa-twitter";
|
||||
$url = "https://www.twitter.com/$value";
|
||||
$color = "#55acee";
|
||||
$name = "Twitter";
|
||||
break;
|
||||
case "myspace":
|
||||
$icon = "fa-brands fa-myspace";
|
||||
$url = "https://www.myspace.com/$value";
|
||||
$color = "#000000";
|
||||
$name = "Myspace";
|
||||
break;
|
||||
case "soundcloud":
|
||||
$icon = "fa-brands fa-soundcloud";
|
||||
$url = "https://www.soundcloud.com/$value";
|
||||
$color = "#ff8800";
|
||||
$name = "Soundcloud";
|
||||
break;
|
||||
case "mixcloud":
|
||||
$icon = "fa-brands fa-mixcloud";
|
||||
$url = "https://www.mixcloud.com/$value";
|
||||
$color = "#00c7f7";
|
||||
$name = "Mixcloud";
|
||||
break;
|
||||
case "spotify":
|
||||
$icon = "fa-brands fa-spotify";
|
||||
$url = "https://www.spotify.com/$value";
|
||||
$color = "#1DB954";
|
||||
$name = "Spotify";
|
||||
break;
|
||||
}
|
||||
|
||||
return "
|
||||
<li class='list-group-item d-flex justify-content-between align-items-center p-3'>
|
||||
<i class='fa $icon fa-lg' style='color: $color;'></i>
|
||||
<p class='mb-0'><a href='$url'>$value</a>
|
||||
</p>
|
||||
</li>";
|
||||
}
|
||||
|
||||
function box_line($title, $value): string
|
||||
{
|
||||
|
||||
return "<hr>
|
||||
<div class='row'>
|
||||
<div class='col-sm-3'>
|
||||
<p class='mb-0'>$title</p>
|
||||
</div>
|
||||
<div class='col-sm-9'>
|
||||
<p class='text-muted mb-0'>$value</p>
|
||||
</div>
|
||||
</div>";
|
||||
|
||||
}
|
|
@ -1,7 +1,45 @@
|
|||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title><?php echo $config['app']['name']; ?></title>
|
||||
<link href="../css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="fontawesome/css/all.css" rel="stylesheet"/>
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/css/select2.min.css" rel="stylesheet" />
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/js/select2.min.js"></script>
|
||||
<!doctype html >
|
||||
<html lang="<?php echo $lang ?>">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title><?php echo $config['app']['name']; ?></title>
|
||||
<link href="../css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="fontawesome/css/all.css" rel="stylesheet"/>
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/css/select2.min.css" rel="stylesheet"/>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/js/select2.min.js"></script>
|
||||
|
||||
<?php
|
||||
if (basename($_SERVER['SCRIPT_NAME']) == 'genres.php' || basename($_SERVER['SCRIPT_NAME']) == 'djs.php') { ?>
|
||||
<style>
|
||||
.card {
|
||||
height: 160px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.card-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.card-text {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.btn {
|
||||
margin-top: auto;
|
||||
}
|
||||
|
||||
</style>
|
||||
<?php } ?>
|
||||
</head>
|
||||
<body style="background-color: #eee;">
|
||||
<?php require 'includes/navbar.php'; ?>
|
|
@ -14,7 +14,7 @@ $current_lang = $_SESSION['lang'] ?? $config['app']['locale'];
|
|||
?>
|
||||
<header class="navbar navbar-expand-md navbar-dark bg-dark sticky-top shadow">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand pe-3" href="#"><?php echo htmlspecialchars($config['app']['name']); ?></a>
|
||||
<a class="navbar-brand pe-3" href="/"><?php echo htmlspecialchars($config['app']['name']); ?></a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarToggle"
|
||||
aria-controls="navbarToggle" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
|
@ -34,10 +34,15 @@ $current_lang = $_SESSION['lang'] ?? $config['app']['locale'];
|
|||
if (basename($_SERVER['SCRIPT_NAME']) == 'genres.php') {
|
||||
echo current_list();
|
||||
} ?>" href="/genres.php"><?php echo $locale['genres']; ?></a>
|
||||
</li> <li class="nav-item">
|
||||
<a class="nav-link<?php
|
||||
if (basename($_SERVER['SCRIPT_NAME']) == 'djs.php') {
|
||||
echo current_list();
|
||||
} ?>" href="/djs.php"><?php echo $locale['djs']; ?></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="dropdown">
|
||||
<div class="dropdown">
|
||||
<select class="form-select" id="languageSelect" onchange="location = this.value;">
|
||||
<?php
|
||||
$currentUrl = strtok($_SERVER["REQUEST_URI"], '?');
|
||||
|
@ -51,21 +56,21 @@ $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>';
|
||||
} else {
|
||||
echo '<a class="nav-link" href="/login.php">' . $locale['login'] . '</a>';
|
||||
}
|
||||
?>
|
||||
<form class="d-flex" role="search">
|
||||
<input class="form-control me-2" type="search" placeholder="<?php echo $locale['search']; ?>"
|
||||
aria-label="<?php echo $locale['search']; ?>">
|
||||
<button class="btn btn-outline-success" type="submit"><?php echo $locale['search']; ?></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
if (isset($_SESSION['user'])) {
|
||||
echo '<a class="nav-link" href="/profile.php">' . $locale['userProfile'] . '</a>';
|
||||
} else {
|
||||
echo '<a class="nav-link" href="/login.php">' . $locale['login'] . '</a>';
|
||||
}
|
||||
?>
|
||||
<form class="d-flex" role="search">
|
||||
<input class="form-control me-2" type="search" placeholder="<?php echo $locale['search']; ?>"
|
||||
aria-label="<?php echo $locale['search']; ?>">
|
||||
<button class="btn btn-outline-success" type="submit"><?php echo $locale['search']; ?></button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue