Initial commit - Last War messaging system

This commit is contained in:
2026-02-19 01:33:28 -06:00
commit 38a8447a64
2162 changed files with 216183 additions and 0 deletions

40
includes/url_helper.php Executable file
View File

@@ -0,0 +1,40 @@
<?php
function getBaseUrl(): string
{
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';
return "{$protocol}://{$host}";
}
function getAppUrl(string $path = ''): string
{
return getBaseUrl() . '/' . ltrim($path, '/');
}
function site_url(string $path = ''): string
{
return getAppUrl($path);
}
function asset(string $path): string
{
return getAppUrl('assets/' . ltrim($path, '/'));
}
function url(string $path): string
{
return getAppUrl($path);
}
function redirect(string $path): void
{
header('Location: ' . site_url($path));
exit;
}
function current_url(): string
{
return getBaseUrl() . ($_SERVER['REQUEST_URI'] ?? '/');
}