Skip to content

Commit

Permalink
Improved & more consistent method naming and calls
Browse files Browse the repository at this point in the history
  • Loading branch information
thekabal committed Feb 12, 2017
1 parent f4e02a4 commit 82ff05d
Show file tree
Hide file tree
Showing 14 changed files with 12 additions and 30 deletions.
2 changes: 1 addition & 1 deletion attack.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
{
echo $langvars['l_att_noturn'] . '<br><br>';
}
elseif (Tki\Team::sameTeam($playerinfo['team'], $targetinfo['team']))
elseif (Tki\Team::isSameTeam($playerinfo['team'], $targetinfo['team']))
{
echo "<div style='color:#ff0;'>" . $langvars['l_team_noattack_members'] . "</div>\n";
}
Expand Down
4 changes: 0 additions & 4 deletions classes/Ibank.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// File: classes/Ibank.php
//
// FUTURE: These are horribly bad. They should be broken out of classes, and turned mostly into template
// behaviors. But in the interest of saying goodbye to the includes directory, and raw functions, this
// will at least allow us to auto-load and use classes instead. Plenty to do in the future, though!

namespace Tki;

Expand Down
2 changes: 0 additions & 2 deletions classes/Kabal.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// File: classes/Kabal.php
//
// FUTURE: This class is horribly bad, and needs to be refactored and tested.

namespace Tki;

Expand Down
4 changes: 0 additions & 4 deletions classes/Loan.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// File: classes/Loan.php
//
// FUTURE: These are horribly bad. They should be broken out of classes, and turned mostly into template
// behaviors. But in the interest of saying goodbye to the includes directory, and raw functions, this
// will at least allow us to auto-load and use classes instead. Plenty to do in the future, though!

namespace Tki;

Expand Down
4 changes: 0 additions & 4 deletions classes/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// File: classes/Log.php
//
// FUTURE: These are horribly bad. They should be broken out of classes, and turned mostly into template
// behaviors. But in the interest of saying goodbye to the includes directory, and raw functions, this
// will at least allow us to auto-load and use classes instead. Plenty to do in the future, though!

namespace Tki;

Expand Down
4 changes: 2 additions & 2 deletions classes/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static function checkLogin(\PDO $pdo_db, string $lang, Reg $tkireg, Smart
Game::isGameClosed($pdo_db, $tkireg, $lang, $template, $langvars);

// Handle authentication check - Will die if fails, or return correct playerinfo
$playerinfo = Player::handleAuth($pdo_db, $lang, $langvars, $tkireg, $template);
$playerinfo = Player::auth($pdo_db, $lang, $langvars, $tkireg, $template);

// Establish timestamp for interval in checking bans
$stamp = date('Y-m-d H:i:s');
Expand All @@ -40,7 +40,7 @@ public static function checkLogin(\PDO $pdo_db, string $lang, Reg $tkireg, Smart
$timestamp['last'] = (int) strtotime($playerinfo['last_login']);

// Check for ban - Ignore the false return if not
Player::handleBan($pdo_db, $lang, $timestamp, $template, $playerinfo, $langvars, $tkireg);
Player::ban($pdo_db, $lang, $timestamp, $template, $playerinfo, $langvars, $tkireg);

// Check for destroyed ship - Ignore the false return if not
Ship::isDestroyed($pdo_db, $lang, $tkireg, $langvars, $template, $playerinfo);
Expand Down
2 changes: 1 addition & 1 deletion classes/Planet.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function getOwner(\PDO $pdo_db, int $planet_id, &$owner_info): bool
return false;
}

public static function planetBombing(\PDO $pdo_db, string $lang, array $langvars, Reg $tkireg, array $playerinfo, array $ownerinfo, array $planetinfo, Smarty $template): void
public static function bombing(\PDO $pdo_db, string $lang, array $langvars, Reg $tkireg, array $playerinfo, array $ownerinfo, array $planetinfo, Smarty $template): void
{
if ($playerinfo['turns'] < 1)
{
Expand Down
2 changes: 1 addition & 1 deletion classes/PlanetReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static function baseBuildCheck($langvars, Reg $tkireg, $planet, int $i):
}
}

public static function planetReportMenu(array $playerinfo, array $langvars): void
public static function menu(array $playerinfo, array $langvars): void
{
echo "<div style='width:90%; margin:auto; font-size:14px;'>\n";
echo "<strong><a href=\"planet_report.php?preptype=1\" name=\"Planet Status\">Planet Status</a></strong><br>" .
Expand Down
4 changes: 0 additions & 4 deletions classes/PlanetReportCE.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// File: classes/PlanetReportCE.php
//
// FUTURE: These are horribly bad. They should be broken out of classes, and turned mostly into template
// behaviors. But in the interest of saying goodbye to the includes directory, and raw functions, this
// will at least allow us to auto-load and use classes instead. Plenty to do in the future, though!

namespace Tki;

Expand Down
4 changes: 2 additions & 2 deletions classes/Player.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

class Player
{
public static function handleAuth(\PDO $pdo_db, string $lang, array $langvars, Reg $tkireg, Smarty $template)
public static function auth(\PDO $pdo_db, string $lang, array $langvars, Reg $tkireg, Smarty $template)
{
$request = Request::createFromGlobals();
$flag = true;
Expand Down Expand Up @@ -97,7 +97,7 @@ public static function handleAuth(\PDO $pdo_db, string $lang, array $langvars, R
}
}

public static function handleBan(\PDO $pdo_db, string $lang, $timestamp, Smarty $template, array $playerinfo, array $langvars, Reg $tkireg)
public static function ban(\PDO $pdo_db, string $lang, $timestamp, Smarty $template, array $playerinfo, array $langvars, Reg $tkireg)
{
// Check to see if the player is banned every 60 seconds (may need to ajust this).
if ($timestamp['now'] >= ($timestamp['last'] + 60))
Expand Down
2 changes: 1 addition & 1 deletion classes/Team.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

class Team
{
public static function sameTeam($attacker_team = null, $attackie_team = null) : bool
public static function isSameTeam($attacker_team = null, $attackie_team = null) : bool
{
if (($attacker_team != $attackie_team) || ($attacker_team == 0 || $attackie_team == 0))
{
Expand Down
2 changes: 1 addition & 1 deletion planet.php
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@
}
elseif ($command == "bomb" && $tkireg->allow_sofa)
{
Planet::planetBombing($pdo_db, $lang, $langvars, $tkireg, $playerinfo, $ownerinfo, $planetinfo, $template);
Planet::bombing($pdo_db, $lang, $langvars, $tkireg, $playerinfo, $ownerinfo, $planetinfo, $template);
}
elseif ($command == "scan")
{
Expand Down
4 changes: 2 additions & 2 deletions planet_report.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@
{
$title = $title . ": Menu";
echo "<h1>" . $title . "</h1>\n";
Tki\PlanetReport::planetReportMenu($playerinfo, $langvars);
Tki\PlanetReport::menu($playerinfo, $langvars);
}
else // Display the menu if no valid options are passed in
{
$title = $title . ": Status";
echo "<h1>" . $title . "</h1>\n";
Tki\PlanetReport::planetReportMenu($playerinfo, $langvars);
Tki\PlanetReport::menu($playerinfo, $langvars);
}

echo "<br><br>";
Expand Down
2 changes: 1 addition & 1 deletion ship.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
echo $langvars['l_ship_perform'] . "<br><br>";
echo "<a href=scan.php?ship_id=$ship_id>" . $langvars['l_planet_scn_link'] . "</a><br>";

if (!Tki\Team::sameTeam($playerinfo['team'], $othership['team']))
if (!Tki\Team::isSameTeam($playerinfo['team'], $othership['team']))
{
echo "<a href=attack.php?ship_id=$ship_id>" . $langvars['l_planet_att_link'] . "</a><br>";
}
Expand Down

0 comments on commit 82ff05d

Please sign in to comment.