configs
This commit is contained in:
4
config/prod/config.php
Normal file
4
config/prod/config.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
// Für STAGING / DEV:
|
||||
define('ASSET_VERSION', "v1"); // Oder '2025-11-21-dev'
|
||||
5
config/prod/fileload.php
Normal file
5
config/prod/fileload.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
require __DIR__ . "/config.php";
|
||||
require __DIR__ . "/db.php";
|
||||
require __DIR__ . '/../src/functions.php';
|
||||
4
config/staging/config.php
Normal file
4
config/staging/config.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
// Für STAGING / DEV:
|
||||
define('ASSET_VERSION', time()); // Oder '2025-11-21-dev'
|
||||
7
config/staging/fileload.php
Normal file
7
config/staging/fileload.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
require __DIR__ . "/config.php";
|
||||
require __DIR__ . "/db.php";
|
||||
require __DIR__ . '/../src/functions.php';
|
||||
@@ -9,6 +9,41 @@
|
||||
?>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
// CSS im Footer (falls benötigt)
|
||||
foreach ($GLOBALS['page_styles'] as $style) {
|
||||
if ($style['pos'] !== 'footer') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$href = $style['href'];
|
||||
if (!empty($style['version'])) {
|
||||
$href .= (str_contains($href, '?') ? '&' : '?') . 'v=' . urlencode($style['version']);
|
||||
}
|
||||
|
||||
echo '<link rel="stylesheet" href="' . htmlspecialchars($href) . '">' . PHP_EOL;
|
||||
}
|
||||
|
||||
// Scripts im Footer
|
||||
foreach ($GLOBALS['page_footer_scripts'] as $script) {
|
||||
$src = $script['src'];
|
||||
if (!empty($script['version'])) {
|
||||
$src .= (str_contains($src, '?') ? '&' : '?') . 'v=' . urlencode($script['version']);
|
||||
}
|
||||
|
||||
$attr = '';
|
||||
if ($script['async']) {
|
||||
$attr .= ' async';
|
||||
} elseif ($script['defer']) {
|
||||
$attr .= ' defer';
|
||||
}
|
||||
if ($script['type']) {
|
||||
$attr .= ' type="' . htmlspecialchars($script['type']) . '"';
|
||||
}
|
||||
|
||||
echo '<script src="' . htmlspecialchars($src) . '"' . $attr . '></script>' . PHP_EOL;
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Globale JS-Dateien -->
|
||||
<script src="/assets/js/lang.js"></script>
|
||||
|
||||
@@ -38,6 +38,41 @@ $host = $_SERVER['HTTP_HOST'] ?? '';
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Montserrat:wght@600;700;800&display=swap" rel="stylesheet">
|
||||
<?php
|
||||
// CSS im Header
|
||||
foreach ($GLOBALS['page_styles'] as $style) {
|
||||
if ($style['pos'] !== 'header') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$href = $style['href'];
|
||||
if (!empty($style['version'])) {
|
||||
$href .= (str_contains($href, '?') ? '&' : '?') . 'v=' . urlencode($style['version']);
|
||||
}
|
||||
|
||||
echo '<link rel="stylesheet" href="' . htmlspecialchars($href) . '">' . PHP_EOL;
|
||||
}
|
||||
|
||||
// Scripts im Header
|
||||
foreach ($GLOBALS['page_header_scripts'] as $script) {
|
||||
$src = $script['src'];
|
||||
if (!empty($script['version'])) {
|
||||
$src .= (str_contains($src, '?') ? '&' : '?') . 'v=' . urlencode($script['version']);
|
||||
}
|
||||
|
||||
$attr = '';
|
||||
if ($script['async']) {
|
||||
$attr .= ' async';
|
||||
} elseif ($script['defer']) {
|
||||
$attr .= ' defer';
|
||||
}
|
||||
if ($script['type']) {
|
||||
$attr .= ' type="' . htmlspecialchars($script['type']) . '"';
|
||||
}
|
||||
|
||||
echo '<script src="' . htmlspecialchars($src) . '"' . $attr . '></script>' . PHP_EOL;
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Tailwind (Dev) -->
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
|
||||
30
public/assets/js/auth.js
Normal file
30
public/assets/js/auth.js
Normal file
@@ -0,0 +1,30 @@
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
const tabs = document.querySelectorAll(".auth-tab");
|
||||
const panelLogin = document.getElementById("authPanelLogin");
|
||||
const panelRegister = document.getElementById("authPanelRegister");
|
||||
|
||||
if (!tabs.length || !panelLogin || !panelRegister) return;
|
||||
|
||||
tabs.forEach(tab => {
|
||||
tab.addEventListener("click", () => {
|
||||
const target = tab.getAttribute("data-tab"); // "login" oder "register"
|
||||
|
||||
// Tab-Styles
|
||||
tabs.forEach(t => {
|
||||
t.classList.remove("bg-brand-primary", "text-brand-bg");
|
||||
t.classList.add("hover:text-brand-primary");
|
||||
});
|
||||
tab.classList.add("bg-brand-primary", "text-brand-bg");
|
||||
tab.classList.remove("hover:text-brand-primary");
|
||||
|
||||
// Panels
|
||||
if (target === "login") {
|
||||
panelLogin.classList.remove("hidden");
|
||||
panelRegister.classList.add("hidden");
|
||||
} else {
|
||||
panelRegister.classList.remove("hidden");
|
||||
panelLogin.classList.add("hidden");
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
require __DIR__ . "/../config/fileload.php";
|
||||
|
||||
// public/fakecheck/index.php
|
||||
|
||||
// Sprachlogik wie auf der Startseite
|
||||
@@ -19,8 +22,6 @@ $navAnchors = [];
|
||||
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
|
||||
$host = $_SERVER['HTTP_HOST'] ?? 'usbcheck.it';
|
||||
$baseUrl = $scheme . '://' . $host;
|
||||
|
||||
require __DIR__ . '/../../src/functions.php';
|
||||
$lang = $_GET['lang'] ?? 'en';
|
||||
$lang = in_array($lang, ['de','en','it','fr']) ? $lang : 'en';
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<?php
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
require __DIR__ . '/../src/functions.php';
|
||||
require __DIR__ . "/../config/fileload.php";
|
||||
|
||||
|
||||
// Sprachlogik:
|
||||
$lang = $_GET['lang'] ?? 'en';
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
<?php
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
require __DIR__ . '/../../src/functions.php';
|
||||
require __DIR__ . "/../config/fileload.php";
|
||||
|
||||
tpl_add_script('/assets/js/auth.js', 'footer', true, false, '', 'auth-1');
|
||||
// Sprachlogik:
|
||||
$lang = $_GET['lang'] ?? 'en';
|
||||
$lang = in_array($lang, ['de','en','it','fr']) ? $lang : 'en';
|
||||
|
||||
@@ -1,4 +1,72 @@
|
||||
<?php
|
||||
|
||||
<?php
|
||||
|
||||
$GLOBALS['page_header_scripts'] = $GLOBALS['page_header_scripts'] ?? [];
|
||||
$GLOBALS['page_footer_scripts'] = $GLOBALS['page_footer_scripts'] ?? [];
|
||||
$GLOBALS['page_styles'] = $GLOBALS['page_styles'] ?? [];
|
||||
|
||||
/**
|
||||
* Script registrieren
|
||||
*
|
||||
* @param string $src Pfad zur Datei, z. B. '/assets/js/auth.js'
|
||||
* @param string $pos 'header' oder 'footer'
|
||||
* @param bool $defer standard true
|
||||
* @param bool $async standard false
|
||||
* @param string $type z. B. 'module'
|
||||
* @param string|null $version null = nutze ASSET_VERSION (falls definiert),
|
||||
* '' = kein ?v=,
|
||||
* 'xyz'= erzwinge diese Version
|
||||
*/
|
||||
function tpl_add_script(
|
||||
string $src,
|
||||
string $pos = 'footer',
|
||||
bool $defer = true,
|
||||
bool $async = false,
|
||||
string $type = '',
|
||||
?string $version = null
|
||||
): void {
|
||||
// Standard-Verhalten: falls Version nicht explizit gesetzt → globale ASSET_VERSION verwenden
|
||||
if ($version === null && defined('ASSET_VERSION')) {
|
||||
$version = ASSET_VERSION;
|
||||
}
|
||||
|
||||
$data = [
|
||||
'src' => $src,
|
||||
'defer' => $defer,
|
||||
'async' => $async,
|
||||
'type' => $type,
|
||||
'version' => $version, // kann null, '' oder string sein
|
||||
];
|
||||
|
||||
if ($pos === 'header') {
|
||||
$GLOBALS['page_header_scripts'][] = $data;
|
||||
} else {
|
||||
$GLOBALS['page_footer_scripts'][] = $data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* CSS registrieren
|
||||
*
|
||||
* @param string $href Pfad zur CSS
|
||||
* @param string $pos 'header' oder 'footer'
|
||||
* @param string|null $version gleiche Logik wie bei Scripts
|
||||
*/
|
||||
function tpl_add_style(string $href, string $pos = 'header', ?string $version = null): void
|
||||
{
|
||||
if ($version === null && defined('ASSET_VERSION')) {
|
||||
$version = ASSET_VERSION;
|
||||
}
|
||||
|
||||
$GLOBALS['page_styles'][] = [
|
||||
'href' => $href,
|
||||
'pos' => $pos,
|
||||
'version' => $version,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Templating Loader
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user