From f94b4dda9519d87b1aeb9adb4bb9d6cf305179ca Mon Sep 17 00:00:00 2001 From: Keith Solomon Date: Tue, 10 Feb 2026 08:29:45 -0600 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8feature:=20Use=20single=20file=20for?= =?UTF-8?q?=20global=20navigation,=20include=20on=20other=20pages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buy-ships.php | 23 +++++++++++------------ config.php | 11 ++++------- index.php | 16 +++++----------- main-menu.php | 9 +++++++++ mining-fleet.php | 29 ++++++++++++++--------------- ship-details.php | 22 ++++++++++------------ 6 files changed, 53 insertions(+), 57 deletions(-) create mode 100644 main-menu.php diff --git a/buy-ships.php b/buy-ships.php index fdc9fdf..82a3476 100644 --- a/buy-ships.php +++ b/buy-ships.php @@ -17,15 +17,16 @@ $config = require __DIR__ . '/lib/project-config.php'; $storage = new SpacetradersStorage( $config['db_path'] ); $token = $storage->getAgentToken(); -$statusMessage = ''; -$errorMessage = ''; -$ships = array(); -$shipyards = array(); -$agent = array(); +$statusMessage = ''; +$errorMessage = ''; +$ships = array(); +$shipyards = array(); +$agent = array(); $currentSystemSymbol = ''; if (! is_string( $token ) || trim( $token ) === '' ) { $envToken = getenv( 'SPACETRADERS_TOKEN' ); + if (is_string( $envToken ) && trim( $envToken ) !== '' ) { $token = trim( $envToken ); $storage->setAgentToken( $token ); @@ -146,6 +147,7 @@ try { $errorMessage = $e->getMessage(); } ?> + @@ -155,14 +157,11 @@ try { - -
- Agent Info - Mining Fleet - Configuration -
-

Buy Ships

+ + + +

Spacetraders - Buy Ships

diff --git a/config.php b/config.php index 2cd41eb..6871c93 100644 --- a/config.php +++ b/config.php @@ -35,6 +35,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' ) { if (! is_string( $token ) || trim( $token ) === '') { $envToken = getenv( 'SPACETRADERS_TOKEN' ); + if (is_string( $envToken ) && trim( $envToken ) !== '' ) { $token = trim( $envToken ); $storage->setAgentToken( $token ); @@ -56,7 +57,9 @@ $hasToken = is_string( $token ) && trim( $token ) !== ''; -

Spacetraders Configuration

+ + +

Spacetraders - Configuration

@@ -89,11 +92,5 @@ $hasToken = is_string( $token ) && trim( $token ) !== '';

- - diff --git a/index.php b/index.php index 48c4e83..1cafe97 100644 --- a/index.php +++ b/index.php @@ -237,18 +237,12 @@ try {
- - + - Buy Ships - | - Mining Fleet - | - Configuration - + require __DIR__ . '/main-menu.php'; - -

Spacetraders Agent and Ships

+

Spacetraders - Dashboard

Agent:
diff --git a/main-menu.php b/main-menu.php new file mode 100644 index 0000000..e91edac --- /dev/null +++ b/main-menu.php @@ -0,0 +1,9 @@ + diff --git a/mining-fleet.php b/mining-fleet.php index afd9cd7..2e0ed02 100644 --- a/mining-fleet.php +++ b/mining-fleet.php @@ -36,18 +36,19 @@ $config = require __DIR__ . '/lib/project-config.php'; $storage = new SpacetradersStorage( $config['db_path'] ); $token = $storage->getAgentToken(); -$statusMessage = ''; -$errorMessage = ''; -$actionResults = array(); -$agent = array(); -$ships = array(); -$miningShips = array(); -$activeContracts = array(); -$marketWaypoints = array(); +$statusMessage = ''; +$errorMessage = ''; +$actionResults = array(); +$agent = array(); +$ships = array(); +$miningShips = array(); +$activeContracts = array(); +$marketWaypoints = array(); $selectedMarketWaypoint = ''; if (! is_string( $token ) || trim( $token ) === '' ) { $envToken = getenv( 'SPACETRADERS_TOKEN' ); + if (is_string( $envToken ) && trim( $envToken ) !== '' ) { $token = trim( $envToken ); $storage->setAgentToken( $token ); @@ -362,6 +363,7 @@ try { $errorMessage = $e->getMessage(); } ?> + @@ -370,14 +372,11 @@ try { Spacetraders - Mining Fleet - - -

Mining Fleet

+ + + +

Spacetraders - Mining Fleet

diff --git a/ship-details.php b/ship-details.php index 088b0fd..a720f25 100644 --- a/ship-details.php +++ b/ship-details.php @@ -18,13 +18,14 @@ $storage = new SpacetradersStorage( $config['db_path'] ); $token = $storage->getAgentToken(); $statusMessage = ''; -$errorMessage = ''; -$ship = array(); -$shipList = array(); -$shipSymbol = isset( $_GET['ship'] ) ? trim( (string) $_GET['ship'] ) : ''; +$errorMessage = ''; +$ship = array(); +$shipList = array(); +$shipSymbol = isset( $_GET['ship'] ) ? trim( (string) $_GET['ship'] ) : ''; if (! is_string( $token ) || trim( $token ) === '' ) { $envToken = getenv( 'SPACETRADERS_TOKEN' ); + if (is_string( $envToken ) && trim( $envToken ) !== '' ) { $token = trim( $envToken ); $storage->setAgentToken( $token ); @@ -196,6 +197,7 @@ try { $errorMessage = $e->getMessage(); } ?> + @@ -204,15 +206,11 @@ try { Spacetraders - Ship Details - - -

Ship Details

+ + + +

Spacetraders - Ship Details