diff --git a/includes/functions/GalaxyRowPlanet.php b/includes/functions/GalaxyRowPlanet.php
index 5a91802e..8b03e0e4 100644
--- a/includes/functions/GalaxyRowPlanet.php
+++ b/includes/functions/GalaxyRowPlanet.php
@@ -17,10 +17,13 @@ function GalaxyRowPlanet($GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy,
$PlanetType = 1;
$Links = [];
+ $isCurrentUser = $GalaxyRowUser['id'] == $_User['id'];
+ $isCurrentGalaxy = $GalaxyRowPlanet['galaxy'] == $CurrentGalaxy;
+
if (
$SensonPhalanxLevel > 0 &&
- $GalaxyRowUser['id'] != $_User['id'] &&
- $GalaxyRowPlanet['galaxy'] == $CurrentGalaxy
+ !$isCurrentUser &&
+ $isCurrentGalaxy
) {
$isInRange = Checks\isTargetInRange([
'originPosition' => $CurrentSystem,
@@ -29,14 +32,16 @@ function GalaxyRowPlanet($GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy,
]);
if ($isInRange) {
- $Links[] = array('prio' => 3, 'txt' => "{$_Lang['gl_phalanx']}");
+ $Links[3] = [
+ 'txt' => "{$_Lang['gl_phalanx']}",
+ ];
}
}
if (
$CurrentMIP > 0 &&
- $GalaxyRowUser['id'] != $_User['id'] &&
- $GalaxyRowPlanet['galaxy'] == $CurrentGalaxy
+ !$isCurrentUser &&
+ $isCurrentGalaxy
) {
$isInRange = Checks\isTargetInRange([
'originPosition' => $CurrentSystem,
@@ -45,68 +50,77 @@ function GalaxyRowPlanet($GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy,
]);
if ($isInRange) {
- $Links[] = array('prio' => 9, 'txt' => "{$_Lang['type_mission'][10]}");
+ $Links[9] = [
+ 'txt' => "{$_Lang['type_mission'][10]}",
+ ];
}
}
- if($GalaxyRowUser['id'] != $_User['id'])
- {
- $Links[] = array('prio' => 1, 'txt' => "{$_Lang['type_mission'][6]}");
- $Links[] = array('prio' => 2, 'txt' => '', 'html' => '
| ');
- $Links[] = array('prio' => 4, 'txt' => "{$_Lang['type_mission'][1]}");
+ if (!$isCurrentUser) {
+ $Links[1] = [
+ 'txt' => "{$_Lang['type_mission'][6]}",
+ ];
+ $Links[2] = [
+ 'txt' => '',
+ 'html' => ' | ',
+ ];
+ $Links[4] = [
+ 'txt' => "{$_Lang['type_mission'][1]}",
+ ];
+
if($GalaxyRowPlanet['id_owner'] > 0)
{
if(($GalaxyRowUser['ally_id'] == $_User['ally_id'] AND $_User['ally_id'] > 0) OR in_array($GalaxyRowUser['id'], $MyBuddies) OR (isset($MyAllyPacts[$GalaxyRowUser['ally_id']]) && $MyAllyPacts[$GalaxyRowUser['ally_id']] >= 3))
{
- $Links[] = array('prio' => 5, 'txt' => "{$_Lang['type_mission'][5]}");
+ $Links[5] = [
+ 'txt' => "{$_Lang['type_mission'][5]}",
+ ];
}
}
}
else
{
- $Links[] = array('prio' => 6, 'txt' => "{$_Lang['type_mission'][4]}");
+ $Links[6] = [
+ 'txt' => "{$_Lang['type_mission'][4]}",
+ ];
+
if(isPro() AND $_User['current_planet'] != $GalaxyRowPlanet['id'])
{
- $Links[] = array('prio' => 8, 'txt' => "{$_Lang['type_mission_quickres']}");
+ $Links[8] = [
+ 'txt' => "{$_Lang['type_mission_quickres']}",
+ ];
}
}
- $Links[] = array('prio' => 7, 'txt' => "{$_Lang['type_mission'][3]}");
+ $Links[7] = [
+ 'txt' => "{$_Lang['type_mission'][3]}",
+ ];
- foreach($Links as $Index => $Data)
- {
- $PriorityArray[$Index] = $Data['prio'];
- }
- array_multisort($PriorityArray, SORT_ASC, $Links);
+ ksort($Links);
- $Parse = array
- (
- 'Lang_Planet' => $_Lang['gl_planet'],
+ $firstLink = array_shift($Links);
+
+ $Parse = [
+ 'Lang_Planet' => $_Lang['gl_planet'],
'PlanetName' => $GalaxyRowPlanet['name'],
'Galaxy' => $Galaxy,
'System' => $System,
'Planet' => $Planet,
- 'SkinPath' => $_SkinPath,
- 'PlanetImg' => $GalaxyRowPlanet['image'],
- 'RowCount' => count($Links),
- 'FirstLink' => $Links[0]['txt'],
+ 'SkinPath' => $_SkinPath,
+ 'PlanetImg' => $GalaxyRowPlanet['image'],
+ 'RowCount' => count($Links) + 1,
+ 'FirstLink' => $firstLink['txt'],
'OtherLinks' => ''
- );
+ ];
+
+ foreach ($Links as $linkEntry) {
+ if (!empty($linkEntry['html'])) {
+ $Parse['OtherLinks'] .= "{$linkEntry['html']}
";
- foreach($Links as $Index => $Data)
- {
- if($Index == 0)
- {
continue;
}
- if(!empty($Data['html']))
- {
- $Parse['OtherLinks'] .= "{$Data['html']}
";
- }
- else
- {
- $Parse['OtherLinks'] .= "{$Data['txt']} |
";
- }
+
+ $Parse['OtherLinks'] .= "{$linkEntry['txt']} |
";
}
return parsetemplate($TPL, $Parse);