Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed: if planet is unnamed, page titles look incomplete #544

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
6 changes: 5 additions & 1 deletion htdocs/content/buildings.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@

if (isset($cp)) {
$planet = $planetRepo->find($cp->id);
if(null === $planet)
{
return;
}

echo "<h1>Bauhof des Planeten " . $planet->name . "</h1>";
echo "<h1>Bauhof" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "</h1>";

echo $resourceBoxDrawer->getHTML($planet);

Expand Down
6 changes: 5 additions & 1 deletion htdocs/content/bunker.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@

if ($cp) {
$planet = $planetRepo->find($cp->id);
if(null === $planet)
{
return;
}

echo "<h1>Bunker des Planeten " . $planet->name . "</h1>";
echo "<h1>Bunker" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "</h1>";

echo $resourceBoxDrawer->getHTML($planet);

Expand Down
9 changes: 7 additions & 2 deletions htdocs/content/crypto.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@
$request = Request::createFromGlobals();

$planet = $planetRepository->find($cp->id);
if(null === $planet)
{
return;
}

$currentUser = $userRepository->getUser($cu->id);

// Gebäude Level und Arbeiter laden
Expand Down Expand Up @@ -184,13 +189,13 @@ function applyBookmark()
countDown("cdcd", $userCooldown);
}
} else {
echo "<h1>Kryptocenter des Planeten " . $planet->name . "</h1>";
echo "<h1>Kryptocenter" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "</h1>";
echo $resourceBoxDrawer->getHTML($planet);

info_msg("Das Kryptocenter wurde noch nicht gebaut!");
}
} else {
echo "<h1>Kryptocenter des Planeten " . $planet->name . "</h1>";
echo "<h1>Kryptocenter" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "</h1>";
echo $resourceBoxDrawer->getHTML($planet);

info_msg("Aufgrund eines intergalaktischen Moratoriums der Völkerföderation der Galaxie Andromeda
Expand Down
8 changes: 6 additions & 2 deletions htdocs/content/defense.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@
define("DEFQUEUE_CANCEL_END", $config->getFloat('defqueue_cancel_end'));

$planet = $planetRepo->find($cp->id);
if(null === $planet)
{
return;
}

// BEGIN SKRIPT //

Expand All @@ -94,7 +98,7 @@
$peopleWorking = $buildingRepository->getPeopleWorking($planet->id);

// Titel
echo "<h1>Waffenfabrik (Stufe " . $factoryBuilding->currentLevel . ") des Planeten " . $planet->name . "</h1>";
echo "<h1>Waffenfabrik (Stufe " . $factoryBuilding->currentLevel . ")" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "</h1>";

// Ressourcen anzeigen
echo $resourceBoxDrawer->getHTML($planet);
Expand Down Expand Up @@ -1055,7 +1059,7 @@
}
} else {
// Titel
echo "<h1>Waffenfabrik des Planeten " . $planet->name . "</h1>";
echo "<h1>Waffenfabrik" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "</h1>";

// Ressourcen anzeigen
echo $resourceBoxDrawer->getHTML($planet);
Expand Down
6 changes: 5 additions & 1 deletion htdocs/content/economy.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
if ($cp) {

$planet = $planetRepo->find($cp->id);
if(null === $planet)
{
return;
}
$race = $raceRespository->getRace($cu->raceId);

/** @var SpecialistService $specialistService */
Expand All @@ -72,7 +76,7 @@
}
}

echo "<h1>Wirtschaft des Planeten " . $planet->name . "</h1>";
echo "<h1>Wirtschaft" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "</h1>";
echo $resourceBoxDrawer->getHTML($planet);

if (isset($_GET['action']) && $_GET['action'] == "update") {
Expand Down
7 changes: 6 additions & 1 deletion htdocs/content/haven.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use EtoA\Ship\ShipRepository;
use EtoA\Ship\ShipTransformRepository;
use EtoA\Support\BBCodeUtils;
use EtoA\Support\StringUtils;
use EtoA\UI\ResourceBoxDrawer;
use EtoA\Universe\Planet\PlanetRepository;

Expand All @@ -32,8 +33,12 @@

if ($cp) {
$planet = $planetRepo->find($cp->id);
if(null === $planet)
{
return;
}

echo '<h1>Raumschiffhafen des Planeten ' . $planet->name . '</h1>';
echo "<h1>Raumschiffhafen" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "</h1>";
echo $resourceBoxDrawer->getHTML($planet);

if (!$cu->isVerified) {
Expand Down
6 changes: 5 additions & 1 deletion htdocs/content/market.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
********/

$planet = $planetRepo->find($cp->id);
if(null === $planet)
{
return;
}

if ($config->getBoolean('market_enabled')) {
$mode = isset($_GET['mode']) ? $_GET['mode'] : "";
Expand All @@ -72,7 +76,7 @@
define("MARKET_TAX", max(1, MARKET_SELL_TAX * ($specialist !== null ? $specialist->tradeBonus : 1)));

// Show title
echo '<h1>Marktplatz (Stufe ' . $market->currentLevel . ') des Planeten ' . $planet->name . '</h1>';
echo "<h1>Marktplatz (Stufe " . $market->currentLevel . ")" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "</h1>";
echo $resourceBoxDrawer->getHTML($planet);

if (!$market->isDeactivated()) {
Expand Down
9 changes: 7 additions & 2 deletions htdocs/content/missiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@
define("MISSILE_SILO_FLIGHTS_PER_LEVEL", $config->getInt('missile_silo_flights_per_level'));

$planet = $planetRepo->find($cp->id);
if(null === $planet)
{
return;
}

// TODO: needed?
echo "<form action=\"?page=$page\" method=\"post\">";

// Gebäude Level und Arbeiter laden
Expand All @@ -71,7 +76,7 @@
$max_flights = $missileBuilding->currentLevel * MISSILE_SILO_FLIGHTS_PER_LEVEL;

// Titel
echo "<h1>Raketensilo (Stufe " . $missileBuilding->currentLevel . ") des Planeten " . $planet->name . "</h1>";
echo "<h1>Raketensilo (Stufe " . $missileBuilding->currentLevel . ")" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "</h1>";

// Ressourcen anzeigen
echo $resourceBoxDrawer->getHTML($planet);
Expand Down Expand Up @@ -733,7 +738,7 @@ function applyBookmark()
}
} else {
// Titel
echo "<h1>Raketensilo des Planeten " . $planet->name . "</h1>";
echo "<h1>Raketensilo" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "</h1>";

// Ressourcen anzeigen
echo $resourceBoxDrawer->getHTML($planet);
Expand Down
6 changes: 5 additions & 1 deletion htdocs/content/population.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@

if ($cp) {
$planet = $planetRepo->find($cp->id);
if(null === $planet)
{
return;
}

echo '<h1>Bevölkerungsübersicht des Planeten ' . $planet->name . '</h1>';
echo "<h1>Bevölkerungsübersicht" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "</h1>";
echo '<div id="population_info"></div>'; // Nur zu testzwecken
echo $resourceBoxDrawer->getHTML($planet);

Expand Down
6 changes: 5 additions & 1 deletion htdocs/content/recycle.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@
define("RECYC_MAX_PAYBACK", $config->getFloat('recyc_max_payback'));

$planet = $planetRepo->find($cp->id);
if(null === $planet)
{
return;
}

echo "<h1>Recyclingstation des Planeten " . $planet->name . "</h1>";
echo "<h1>Recyclingstation" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "</h1>";
echo $resourceBoxDrawer->getHTML($planet);

//Recycling Level laden
Expand Down
8 changes: 6 additions & 2 deletions htdocs/content/research.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,18 @@

if (isset($cp)) {
$planet = $planetRepo->find($cp->id);
if(null === $planet)
{
return;
}

$researchBuilding = $buildingRepository->getEntityBuilding($cu->getId(), $planet->id, BuildingId::TECHNOLOGY);
if ($researchBuilding !== null && $researchBuilding->currentLevel > 0) {
define("GEN_TECH_LEVEL", $technologyRepository->getTechnologyLevel($cu->getId(), TechnologyId::GEN));
$minBuildTimeFactor = (0.1 - (GEN_TECH_LEVEL / 100));

// Überschrift
echo "<h1>Forschungslabor (Stufe " . $researchBuilding->currentLevel . ") des Planeten " . $planet->name . "</h1>";
echo "<h1>Forschungslabor (Stufe " . $researchBuilding->currentLevel . ")" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "</h1>";
echo $resourceBoxDrawer->getHTML($planet);

// Forschungsliste laden && Gentech level definieren
Expand Down Expand Up @@ -922,7 +926,7 @@ function setCountdown()
}
}
} else {
echo "<h1>Forschungslabor des Planeten " . $planet->name . "</h1>";
echo "<h1>Forschungslabor" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "</h1>";
echo $resourceBoxDrawer->getHTML($planet);
info_msg("Das Forschungslabor wurde noch nicht gebaut!");
}
Expand Down
6 changes: 5 additions & 1 deletion htdocs/content/shipyard.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@
define("SHIPQUEUE_CANCEL_END", $config->getFloat('shipqueue_cancel_end'));

$planet = $planetRepo->find($cp->id);
if(null === $planet)
{
return;
}

/** @var TechnologyRepository $technologyRepository */
$technologyRepository = $app[TechnologyRepository::class];
Expand Down Expand Up @@ -1085,7 +1089,7 @@
}
} else {
// Titel
echo "<h1>Raumschiffswerft des Planeten " . $planet->name . "</h1>";
echo "<h1>Raumschiffswerft" . (!StringUtils::empty_strict($planet->name) ? " des Planeten " . $planet->name : "") . "</h1>";

// Ressourcen anzeigen
echo $resourceBoxDrawer->getHTML($planet);
Expand Down
3 changes: 2 additions & 1 deletion htdocs/content/techtree.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use EtoA\Technology\TechnologyRepository;
use EtoA\Technology\TechnologyRequirementRepository;
use EtoA\Technology\TechnologyTypeRepository;
use EtoA\Support\StringUtils;

/** @var BuildingDataRepository $buildRepository */
$buildRepository = $app[BuildingDataRepository::class];
Expand Down Expand Up @@ -137,7 +138,7 @@
if (isset($cp)) {

// Daten anzeigen
echo "<h1>Technikbaum des Planeten " . $cp->name() . "</h1>";
echo "<h1>Technikbaum" . (!StringUtils::empty_strict($cp->name()) ? " des Planeten " . $cp->name() : "") . "</h1>";

// Tab-Navigation anzeigen
show_tab_menu("mode", array(
Expand Down
Loading