We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -35,8 +35,7 @@ discard block |
||
| 35 | 35 | header('location: /error.php?msg=Invalid sector ID'); |
| 36 | 36 | exit; |
| 37 | 37 | } |
| 38 | - } |
|
| 39 | - else if (isset($_REQUEST['galaxy_id'])) { |
|
| 38 | + } else if (isset($_REQUEST['galaxy_id'])) { |
|
| 40 | 39 | $galaxyID = $_REQUEST['galaxy_id']; |
| 41 | 40 | if (!is_numeric($galaxyID)) { |
| 42 | 41 | header('location: /error.php?msg=Galaxy ID was not a number.'); |
@@ -44,8 +43,7 @@ discard block |
||
| 44 | 43 | } |
| 45 | 44 | try { |
| 46 | 45 | $galaxy = SmrGalaxy::getGalaxy(SmrSession::getGameID(), $galaxyID); |
| 47 | - } |
|
| 48 | - catch (Exception $e) { |
|
| 46 | + } catch (Exception $e) { |
|
| 49 | 47 | header('location: /error.php?msg=Invalid galaxy ID'); |
| 50 | 48 | exit; |
| 51 | 49 | } |
@@ -117,7 +115,6 @@ discard block |
||
| 117 | 115 | $template->assign('AJAX_ENABLE_REFRESH', false); |
| 118 | 116 | |
| 119 | 117 | $template->display('GalaxyMap.inc'); |
| 120 | -} |
|
| 121 | -catch (Throwable $e) { |
|
| 118 | +} catch (Throwable $e) { |
|
| 122 | 119 | handleException($e); |
| 123 | 120 | } |
@@ -15,16 +15,19 @@ discard block |
||
| 15 | 15 | $location->addHardwareSold($_REQUEST['add_hardware_id']); |
| 16 | 16 | } |
| 17 | 17 | if (isset($_REQUEST['remove_ships']) && is_array($_REQUEST['remove_ships'])) { |
| 18 | - foreach ($_REQUEST['remove_ships'] as $shipTypeID) |
|
| 19 | - $location->removeShipSold($shipTypeID); |
|
| 18 | + foreach ($_REQUEST['remove_ships'] as $shipTypeID) { |
|
| 19 | + $location->removeShipSold($shipTypeID); |
|
| 20 | + } |
|
| 20 | 21 | } |
| 21 | 22 | if (isset($_REQUEST['remove_weapons']) && is_array($_REQUEST['remove_weapons'])) { |
| 22 | - foreach ($_REQUEST['remove_weapons'] as $weaponTypeID) |
|
| 23 | - $location->removeWeaponSold($weaponTypeID); |
|
| 23 | + foreach ($_REQUEST['remove_weapons'] as $weaponTypeID) { |
|
| 24 | + $location->removeWeaponSold($weaponTypeID); |
|
| 25 | + } |
|
| 24 | 26 | } |
| 25 | 27 | if (isset($_REQUEST['remove_hardware']) && is_array($_REQUEST['remove_hardware'])) { |
| 26 | - foreach ($_REQUEST['remove_hardware'] as $hardwareTypeID) |
|
| 27 | - $location->removeHardwareSold($hardwareTypeID); |
|
| 28 | + foreach ($_REQUEST['remove_hardware'] as $hardwareTypeID) { |
|
| 29 | + $location->removeHardwareSold($hardwareTypeID); |
|
| 30 | + } |
|
| 28 | 31 | } |
| 29 | 32 | |
| 30 | 33 | $location->setFed(isset($_REQUEST['fed'])); |
@@ -47,7 +50,6 @@ discard block |
||
| 47 | 50 | 'Name' => $db->getField('hardware_name')); |
| 48 | 51 | } |
| 49 | 52 | $template->assign('AllHardware', $hardware); |
| 50 | -} |
|
| 51 | -else { |
|
| 53 | +} else { |
|
| 52 | 54 | $template->assign('Locations', SmrLocation::getAllLocations()); |
| 53 | 55 | } |
@@ -5,10 +5,10 @@ |
||
| 5 | 5 | create_error('You must choose the messages you want to delete.'); |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | - foreach ($_REQUEST['message_id'] as $id) |
|
| 9 | - $db->query('DELETE FROM message_boxes WHERE message_id = ' . $db->escapeNumber($id)); |
|
| 10 | -} |
|
| 11 | -else if ($action == 'All Messages') { |
|
| 8 | + foreach ($_REQUEST['message_id'] as $id) { |
|
| 9 | + $db->query('DELETE FROM message_boxes WHERE message_id = ' . $db->escapeNumber($id)); |
|
| 10 | + } |
|
| 11 | + } else if ($action == 'All Messages') { |
|
| 12 | 12 | if (!isset($var['box_type_id'])) { |
| 13 | 13 | create_error('No box selected.'); |
| 14 | 14 | } |
@@ -27,8 +27,9 @@ |
||
| 27 | 27 | // put hidden fields in for log type to have all fields selected on next page. |
| 28 | 28 | $logTypes = array(); |
| 29 | 29 | $db->query('SELECT log_type_id FROM log_type'); |
| 30 | - while ($db->nextRecord()) |
|
| 31 | - $logTypes[] = $db->getInt('log_type_id'); |
|
| 30 | + while ($db->nextRecord()) { |
|
| 31 | + $logTypes[] = $db->getInt('log_type_id'); |
|
| 32 | + } |
|
| 32 | 33 | $template->assign('LogTypes', $logTypes); |
| 33 | 34 | |
| 34 | 35 | $template->assign('LogConsoleFormHREF', SmrSession::getNewHREF(create_container('skeleton.php', 'log_console_detail.php'))); |
@@ -28,8 +28,7 @@ |
||
| 28 | 28 | |
| 29 | 29 | // put the msg into the database |
| 30 | 30 | $db->query('INSERT INTO voting (question, end) VALUES(' . $db->escapeString($question) . ',' . $db->escapeNumber($end) . ')'); |
| 31 | -} |
|
| 32 | -else if ($_REQUEST['action'] == 'Add Option') { |
|
| 31 | +} else if ($_REQUEST['action'] == 'Add Option') { |
|
| 33 | 32 | if (empty($option)) { |
| 34 | 33 | create_error('You have to specify an option message.'); |
| 35 | 34 | } |
@@ -19,8 +19,7 @@ discard block |
||
| 19 | 19 | } |
| 20 | 20 | SmrSector::saveSectors(); |
| 21 | 21 | $var['message'] = '<span class="green">Success</span> : Succesfully created galaxies.'; |
| 22 | -} |
|
| 23 | -else if ($submit == 'Redo Connections') { |
|
| 22 | +} else if ($submit == 'Redo Connections') { |
|
| 24 | 23 | $galaxy = SmrGalaxy::getGalaxy($var['game_id'], $var['gal_on']); |
| 25 | 24 | if (!$galaxy->setConnectivity($_REQUEST['connect'])) { |
| 26 | 25 | $var['message'] = '<span class="red">Error</span> : Regenerating connections failed.'; |
@@ -28,13 +27,11 @@ discard block |
||
| 28 | 27 | $var['message'] = '<span class="green">Success</span> : Regenerated connectivity with ' . $_REQUEST['connect'] . '% target.'; |
| 29 | 28 | } |
| 30 | 29 | SmrSector::saveSectors(); |
| 31 | -} |
|
| 32 | -elseif ($submit == 'Toggle Link') { |
|
| 30 | +} elseif ($submit == 'Toggle Link') { |
|
| 33 | 31 | $linkSector = SmrSector::getSector($var['game_id'], $var['sector_id']); |
| 34 | 32 | $linkSector->toggleLink($var['dir']); |
| 35 | 33 | SmrSector::saveSectors(); |
| 36 | -} |
|
| 37 | -elseif ($submit == 'Create Locations') { |
|
| 34 | +} elseif ($submit == 'Create Locations') { |
|
| 38 | 35 | $galSectors = SmrSector::getGalaxySectors($var['game_id'], $var['gal_on']); |
| 39 | 36 | foreach ($galSectors as $galSector) { |
| 40 | 37 | $galSector->removeAllLocations(); |
@@ -54,8 +51,7 @@ discard block |
||
| 54 | 51 | } |
| 55 | 52 | } |
| 56 | 53 | $var['message'] = '<span class="green">Success</span> : Succesfully added locations.'; |
| 57 | -} |
|
| 58 | -elseif ($submit == 'Create Warps') { |
|
| 54 | +} elseif ($submit == 'Create Warps') { |
|
| 59 | 55 | //get all warp info from all gals, some need to be removed, some need to be added |
| 60 | 56 | $galaxy = SmrGalaxy::getGalaxy($var['game_id'], $var['gal_on']); |
| 61 | 57 | $galSectors = $galaxy->getSectors(); |
@@ -95,8 +91,7 @@ discard block |
||
| 95 | 91 | } |
| 96 | 92 | SmrSector::saveSectors(); |
| 97 | 93 | $var['message'] = '<span class="green">Success</span> : Succesfully added warps.'; |
| 98 | -} |
|
| 99 | -elseif ($submit == 'Create Planets') { |
|
| 94 | +} elseif ($submit == 'Create Planets') { |
|
| 100 | 95 | $galaxy = SmrGalaxy::getGalaxy($var['game_id'], $var['gal_on']); |
| 101 | 96 | $galSectors = $galaxy->getSectors(); |
| 102 | 97 | foreach ($galSectors as $galSector) { |
@@ -109,13 +104,15 @@ discard block |
||
| 109 | 104 | $numberOfPlanets = $_POST['type' . $planetTypeID]; |
| 110 | 105 | for ($i = 1; $i <= $numberOfPlanets; $i++) { |
| 111 | 106 | $galSector = $galSectors[array_rand($galSectors)]; |
| 112 | - while ($galSector->hasPlanet()) $galSector = $galSectors[array_rand($galSectors)]; //1 per sector |
|
| 107 | + while ($galSector->hasPlanet()) { |
|
| 108 | + $galSector = $galSectors[array_rand($galSectors)]; |
|
| 109 | + } |
|
| 110 | + //1 per sector |
|
| 113 | 111 | $galSector->createPlanet($planetTypeID); |
| 114 | 112 | } |
| 115 | 113 | } |
| 116 | 114 | $var['message'] = '<span class="green">Success</span> : Succesfully added planets.'; |
| 117 | -} |
|
| 118 | -elseif ($submit == 'Create Ports') { |
|
| 115 | +} elseif ($submit == 'Create Ports') { |
|
| 119 | 116 | $numLevelPorts = []; |
| 120 | 117 | for ($i = 1; $i <= SmrPort::MAX_LEVEL; $i++) { |
| 121 | 118 | $numLevelPorts[$i] = $_REQUEST['port' . $i] ?? 0; |
@@ -170,27 +167,23 @@ discard block |
||
| 170 | 167 | } |
| 171 | 168 | SmrPort::savePorts(); |
| 172 | 169 | $var['message'] = '<span class="green">Success</span> : Succesfully added ports.'; |
| 173 | - } |
|
| 174 | - else { |
|
| 170 | + } else { |
|
| 175 | 171 | $var['message'] = '<span class="red">Error: Your port race distribution must equal 100!</span>'; |
| 176 | 172 | } |
| 177 | -} |
|
| 178 | -elseif ($submit == 'Edit Sector') { |
|
| 173 | +} elseif ($submit == 'Edit Sector') { |
|
| 179 | 174 | $editSector = SmrSector::getSector($var['game_id'], $var['sector_id']); |
| 180 | 175 | |
| 181 | 176 | //update planet |
| 182 | 177 | if ($_POST['plan_type'] != '0') { |
| 183 | 178 | if (!$editSector->hasPlanet()) { |
| 184 | 179 | $editSector->createPlanet($_POST['plan_type']); |
| 185 | - } |
|
| 186 | - else { |
|
| 180 | + } else { |
|
| 187 | 181 | $type = $editSector->getPlanet()->getTypeID(); |
| 188 | 182 | if ($_POST['plan_type'] != $type) { |
| 189 | 183 | $editSector->getPlanet()->setTypeID($_POST['plan_type']); |
| 190 | 184 | } |
| 191 | 185 | } |
| 192 | - } |
|
| 193 | - else { |
|
| 186 | + } else { |
|
| 194 | 187 | $editSector->removePlanet(); |
| 195 | 188 | } |
| 196 | 189 | |
@@ -267,8 +260,7 @@ discard block |
||
| 267 | 260 | function checkSectorAllowedForLoc(SmrSector $sector, SmrLocation $location) { |
| 268 | 261 | if (!$location->isHQ()) { |
| 269 | 262 | return (count($sector->getLocations()) < 4 && !$sector->offersFederalProtection()); |
| 270 | - } |
|
| 271 | - else { |
|
| 263 | + } else { |
|
| 272 | 264 | //HQs are here |
| 273 | 265 | //find a sector where there are no locations yet |
| 274 | 266 | return !$sector->hasLocation(); |
@@ -19,8 +19,7 @@ |
||
| 19 | 19 | $approved[$accountId] = get_album_nick($accountId); |
| 20 | 20 | } |
| 21 | 21 | $template->assign('Approved', $approved); |
| 22 | -} |
|
| 23 | -else { |
|
| 22 | +} else { |
|
| 24 | 23 | // check if the given account really has an entry |
| 25 | 24 | $db->query('SELECT * FROM album WHERE account_id = ' . $db->escapeNumber($account_id) . ' AND Approved = \'YES\''); |
| 26 | 25 | if ($db->nextRecord()) { |
@@ -30,7 +30,9 @@ |
||
| 30 | 30 | $offenderAccount->addPoints($_REQUEST['offenderBanPoints'], $account, 7, $suspicion); |
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | -if (isset($_REQUEST['offendedReply'])) $offendedReply = $_REQUEST['offendedReply']; |
|
| 33 | +if (isset($_REQUEST['offendedReply'])) { |
|
| 34 | + $offendedReply = $_REQUEST['offendedReply']; |
|
| 35 | +} |
|
| 34 | 36 | |
| 35 | 37 | if (isset($offendedReply) && $offendedReply != '') { |
| 36 | 38 | //next message |
@@ -51,8 +51,7 @@ |
||
| 51 | 51 | WHERE album_id = '.$db->escapeNumber($account_id) . ' AND |
| 52 | 52 | comment_id IN ('.$db->escapeArray($comment_ids) . ')'); |
| 53 | 53 | } |
| 54 | -} |
|
| 55 | -else { |
|
| 54 | +} else { |
|
| 56 | 55 | create_error('No action chosen!'); |
| 57 | 56 | } |
| 58 | 57 | |