Skip to content

Commit

Permalink
Improvements thanks to Scrutinizer
Browse files Browse the repository at this point in the history
  • Loading branch information
thekabal committed Sep 20, 2021
1 parent 3b97d6b commit d40188d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 21 deletions.
6 changes: 1 addition & 5 deletions classes/Realspace.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,18 +124,14 @@ public function realSpaceMove(\PDO $pdo_db, string $lang, int $destination, Regi
$stmt->bindParam(':ship_id', $playerinfo['ship_id'], \PDO::PARAM_INT);
$stmt->execute();
$defenses_present = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$nsfighters = array();
if ($defenses_present !== false)
{
$sql = "SELECT * FROM ::prefix::ships WHERE ship_id = :ship_id";
$stmt = $pdo_db->prepare($sql);
$stmt->bindParam(':ship_id', $defenses_present['ship_id'], \PDO::PARAM_INT);
$stmt->execute();
$nsfighters = $stmt->fetchAll(\PDO::FETCH_ASSOC);
if (!is_array($nsfighters))
{
$nsfighters = array();
}

if ($nsfighters['team'] != $playerinfo['team'] || $playerinfo['team'] == 0)
{
$hostile = 1;
Expand Down
22 changes: 6 additions & 16 deletions classes/SetPaths.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,24 +73,14 @@ public static function setGamedomain(): string

if ($gamedomain !== null && strlen($gamedomain) > 0)
{
$pos = strpos($gamedomain, 'https://');
if (is_int($pos))
{
$gamedomain = substr($gamedomain, $pos + 7);
}
$pos = (int) strpos($gamedomain, 'https://');
$gamedomain = substr($gamedomain, $pos);

$pos = strpos($gamedomain, 'www.');
if (is_int($pos))
{
$gamedomain = substr($gamedomain, $pos + 4);
}
$pos = (int) strpos($gamedomain, 'www.') + 4;
$gamedomain = substr($gamedomain, $pos);

$pos = strpos($gamedomain, ':');

if (is_int($pos))
{
$gamedomain = substr($gamedomain, 0, $pos);
}
$pos = (int) strpos($gamedomain, ':');
$gamedomain = substr($gamedomain, 0, $pos);

if ($gamedomain[0] != '.')
{
Expand Down

0 comments on commit d40188d

Please sign in to comment.