✨feature: Use single file for global navigation, include on other pages
This commit is contained in:
@@ -26,6 +26,7 @@ $currentSystemSymbol = '';
|
|||||||
|
|
||||||
if (! is_string( $token ) || trim( $token ) === '' ) {
|
if (! is_string( $token ) || trim( $token ) === '' ) {
|
||||||
$envToken = getenv( 'SPACETRADERS_TOKEN' );
|
$envToken = getenv( 'SPACETRADERS_TOKEN' );
|
||||||
|
|
||||||
if (is_string( $envToken ) && trim( $envToken ) !== '' ) {
|
if (is_string( $envToken ) && trim( $envToken ) !== '' ) {
|
||||||
$token = trim( $envToken );
|
$token = trim( $envToken );
|
||||||
$storage->setAgentToken( $token );
|
$storage->setAgentToken( $token );
|
||||||
@@ -146,6 +147,7 @@ try {
|
|||||||
$errorMessage = $e->getMessage();
|
$errorMessage = $e->getMessage();
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
@@ -155,14 +157,11 @@ try {
|
|||||||
|
|
||||||
<script src="https://cdn.tailwindcss.com"></script>
|
<script src="https://cdn.tailwindcss.com"></script>
|
||||||
</head>
|
</head>
|
||||||
<body class="container mx-auto px-4 py-8 bg-stone-800 text-gray-200">
|
|
||||||
<div class="mb-6 flex gap-4">
|
|
||||||
<a href="index.php" class="text-blue-400 hover:underline">Agent Info</a>
|
|
||||||
<a href="mining-fleet.php" class="text-blue-400 hover:underline">Mining Fleet</a>
|
|
||||||
<a href="config.php" class="text-blue-400 hover:underline">Configuration</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h1 class="text-3xl font-bold mb-6 underline decoration-gray-300 w-full">Buy Ships</h1>
|
<body class="container mx-auto px-4 py-8 bg-stone-800 text-gray-200">
|
||||||
|
<?php require __DIR__ . '/main-menu.php'; ?>
|
||||||
|
|
||||||
|
<h1 class="text-3xl font-bold mb-6 underline decoration-gray-300 w-full"><a href="buy-ships.php">Spacetraders - Buy Ships</a></h1>
|
||||||
|
|
||||||
<?php if (isset( $tokenError ) ) : ?>
|
<?php if (isset( $tokenError ) ) : ?>
|
||||||
<div class="mb-6 border border-red-500 p-4 rounded text-red-300">
|
<div class="mb-6 border border-red-500 p-4 rounded text-red-300">
|
||||||
|
|||||||
11
config.php
11
config.php
@@ -35,6 +35,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' ) {
|
|||||||
|
|
||||||
if (! is_string( $token ) || trim( $token ) === '') {
|
if (! is_string( $token ) || trim( $token ) === '') {
|
||||||
$envToken = getenv( 'SPACETRADERS_TOKEN' );
|
$envToken = getenv( 'SPACETRADERS_TOKEN' );
|
||||||
|
|
||||||
if (is_string( $envToken ) && trim( $envToken ) !== '' ) {
|
if (is_string( $envToken ) && trim( $envToken ) !== '' ) {
|
||||||
$token = trim( $envToken );
|
$token = trim( $envToken );
|
||||||
$storage->setAgentToken( $token );
|
$storage->setAgentToken( $token );
|
||||||
@@ -56,7 +57,9 @@ $hasToken = is_string( $token ) && trim( $token ) !== '';
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="container mx-auto px-4 py-8 bg-stone-800 text-gray-200">
|
<body class="container mx-auto px-4 py-8 bg-stone-800 text-gray-200">
|
||||||
<h1 class="text-3xl font-bold mb-6 underline decoration-gray-300 w-full">Spacetraders Configuration</h1>
|
<?php require __DIR__ . '/main-menu.php'; ?>
|
||||||
|
|
||||||
|
<h1 class="text-3xl font-bold mb-6 underline decoration-gray-300 w-full"><a href="config.php">Spacetraders - Configuration</a></h1>
|
||||||
|
|
||||||
<div class="mb-6 border border-gray-600 p-4 rounded">
|
<div class="mb-6 border border-gray-600 p-4 rounded">
|
||||||
<p class="mb-2 text-sm text-gray-300">
|
<p class="mb-2 text-sm text-gray-300">
|
||||||
@@ -89,11 +92,5 @@ $hasToken = is_string( $token ) && trim( $token ) !== '';
|
|||||||
<button type="submit" name="clear_cache" value="1" class="px-4 py-2 bg-gray-600 rounded hover:bg-gray-500">Clear Cache</button>
|
<button type="submit" name="clear_cache" value="1" class="px-4 py-2 bg-gray-600 rounded hover:bg-gray-500">Clear Cache</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex gap-4">
|
|
||||||
<a href="index.php" class="text-blue-400 hover:underline">Agent Info</a>
|
|
||||||
<a href="buy-ships.php" class="text-blue-400 hover:underline">Buy Ships</a>
|
|
||||||
<a href="mining-fleet.php" class="text-blue-400 hover:underline">Mining Fleet</a>
|
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
18
index.php
18
index.php
@@ -237,18 +237,12 @@ try {
|
|||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
<?php exit; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<div class="mb-6">
|
|
||||||
<a href="buy-ships.php" class="text-blue-400 hover:underline">Buy Ships</a>
|
|
||||||
<span class="mx-2">|</span>
|
|
||||||
<a href="mining-fleet.php" class="text-blue-400 hover:underline">Mining Fleet</a>
|
|
||||||
<span class="mx-2">|</span>
|
|
||||||
<a href="config.php" class="text-blue-400 hover:underline">Configuration</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
exit;
|
||||||
|
endif;
|
||||||
|
|
||||||
|
require __DIR__ . '/main-menu.php';
|
||||||
|
|
||||||
$msg = '';
|
$msg = '';
|
||||||
$class = '';
|
$class = '';
|
||||||
|
|
||||||
@@ -267,7 +261,7 @@ try {
|
|||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<h1 class="text-3xl font-bold mb-6 underline decoration-gray-300 w-full">Spacetraders Agent and Ships</h1>
|
<h1 class="text-3xl font-bold mb-6 underline decoration-gray-300 w-full"><a href="index.php" class="">Spacetraders - Dashboard</a></h1>
|
||||||
|
|
||||||
<h2 class="text-2xl font-bold mb-2">
|
<h2 class="text-2xl font-bold mb-2">
|
||||||
Agent: <?php echo htmlspecialchars( ucfirst( strtolower( $agent['symbol'] ) ) ); ?><br>
|
Agent: <?php echo htmlspecialchars( ucfirst( strtolower( $agent['symbol'] ) ) ); ?><br>
|
||||||
|
|||||||
9
main-menu.php
Normal file
9
main-menu.php
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<div class="mb-6">
|
||||||
|
<a href="index.php" class="text-blue-400 hover:underline">Dashboard</a>
|
||||||
|
<span class="mx-2">|</span>
|
||||||
|
<a href="buy-ships.php" class="text-blue-400 hover:underline">Buy Ships</a>
|
||||||
|
<span class="mx-2">|</span>
|
||||||
|
<a href="mining-fleet.php" class="text-blue-400 hover:underline">Mining Fleet</a>
|
||||||
|
<span class="mx-2">|</span>
|
||||||
|
<a href="config.php" class="text-blue-400 hover:underline">Configuration</a>
|
||||||
|
</div>
|
||||||
@@ -48,6 +48,7 @@ $selectedMarketWaypoint = '';
|
|||||||
|
|
||||||
if (! is_string( $token ) || trim( $token ) === '' ) {
|
if (! is_string( $token ) || trim( $token ) === '' ) {
|
||||||
$envToken = getenv( 'SPACETRADERS_TOKEN' );
|
$envToken = getenv( 'SPACETRADERS_TOKEN' );
|
||||||
|
|
||||||
if (is_string( $envToken ) && trim( $envToken ) !== '' ) {
|
if (is_string( $envToken ) && trim( $envToken ) !== '' ) {
|
||||||
$token = trim( $envToken );
|
$token = trim( $envToken );
|
||||||
$storage->setAgentToken( $token );
|
$storage->setAgentToken( $token );
|
||||||
@@ -362,6 +363,7 @@ try {
|
|||||||
$errorMessage = $e->getMessage();
|
$errorMessage = $e->getMessage();
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
@@ -370,14 +372,11 @@ try {
|
|||||||
<title>Spacetraders - Mining Fleet</title>
|
<title>Spacetraders - Mining Fleet</title>
|
||||||
<script src="https://cdn.tailwindcss.com"></script>
|
<script src="https://cdn.tailwindcss.com"></script>
|
||||||
</head>
|
</head>
|
||||||
<body class="container mx-auto px-4 py-8 bg-stone-800 text-gray-200">
|
|
||||||
<div class="mb-6 flex gap-4">
|
|
||||||
<a href="index.php" class="text-blue-400 hover:underline">Agent Info</a>
|
|
||||||
<a href="buy-ships.php" class="text-blue-400 hover:underline">Buy Ships</a>
|
|
||||||
<a href="config.php" class="text-blue-400 hover:underline">Configuration</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h1 class="text-3xl font-bold mb-6 underline decoration-gray-300 w-full">Mining Fleet</h1>
|
<body class="container mx-auto px-4 py-8 bg-stone-800 text-gray-200">
|
||||||
|
<?php require __DIR__ . '/main-menu.php'; ?>
|
||||||
|
|
||||||
|
<h1 class="text-3xl font-bold mb-6 underline decoration-gray-300 w-full"><a href="mining-fleet.php">Spacetraders - Mining Fleet</a></h1>
|
||||||
|
|
||||||
<?php if (isset( $tokenError ) ) : ?>
|
<?php if (isset( $tokenError ) ) : ?>
|
||||||
<div class="mb-6 border border-red-500 p-4 rounded text-red-300">
|
<div class="mb-6 border border-red-500 p-4 rounded text-red-300">
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ $shipSymbol = isset( $_GET['ship'] ) ? trim( (string) $_GET['ship'] ) : '';
|
|||||||
|
|
||||||
if (! is_string( $token ) || trim( $token ) === '' ) {
|
if (! is_string( $token ) || trim( $token ) === '' ) {
|
||||||
$envToken = getenv( 'SPACETRADERS_TOKEN' );
|
$envToken = getenv( 'SPACETRADERS_TOKEN' );
|
||||||
|
|
||||||
if (is_string( $envToken ) && trim( $envToken ) !== '' ) {
|
if (is_string( $envToken ) && trim( $envToken ) !== '' ) {
|
||||||
$token = trim( $envToken );
|
$token = trim( $envToken );
|
||||||
$storage->setAgentToken( $token );
|
$storage->setAgentToken( $token );
|
||||||
@@ -196,6 +197,7 @@ try {
|
|||||||
$errorMessage = $e->getMessage();
|
$errorMessage = $e->getMessage();
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
@@ -204,15 +206,11 @@ try {
|
|||||||
<title>Spacetraders - Ship Details</title>
|
<title>Spacetraders - Ship Details</title>
|
||||||
<script src="https://cdn.tailwindcss.com"></script>
|
<script src="https://cdn.tailwindcss.com"></script>
|
||||||
</head>
|
</head>
|
||||||
<body class="container mx-auto px-4 py-8 bg-stone-800 text-gray-200">
|
|
||||||
<div class="mb-6 flex gap-4">
|
|
||||||
<a href="index.php" class="text-blue-400 hover:underline">Agent Info</a>
|
|
||||||
<a href="mining-fleet.php" class="text-blue-400 hover:underline">Mining Fleet</a>
|
|
||||||
<a href="buy-ships.php" class="text-blue-400 hover:underline">Buy Ships</a>
|
|
||||||
<a href="config.php" class="text-blue-400 hover:underline">Configuration</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h1 class="text-3xl font-bold mb-6 underline decoration-gray-300 w-full">Ship Details</h1>
|
<body class="container mx-auto px-4 py-8 bg-stone-800 text-gray-200">
|
||||||
|
<?php require __DIR__ . '/main-menu.php'; ?>
|
||||||
|
|
||||||
|
<h1 class="text-3xl font-bold mb-6 underline decoration-gray-300 w-full"><a href="ship-details.php">Spacetraders - Ship Details</a></h1>
|
||||||
|
|
||||||
<?php if (isset( $tokenError ) ) : ?>
|
<?php if (isset( $tokenError ) ) : ?>
|
||||||
<div class="mb-6 border border-red-500 p-4 rounded text-red-300">
|
<div class="mb-6 border border-red-500 p-4 rounded text-red-300">
|
||||||
|
|||||||
Reference in New Issue
Block a user