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 ) !== '';

- -
- Agent Info - Buy Ships - Mining Fleet -
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 @@ +
+ Dashboard + | + Buy Ships + | + Mining Fleet + | + Configuration +
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 - -
- Agent Info - Buy Ships - Configuration -
-

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 - -
- Agent Info - Mining Fleet - Buy Ships - Configuration -
-

Ship Details

+ + + +

Spacetraders - Ship Details