Skip to content

Commit

Permalink
Rename global_funcs -> universal, global_includes -> insignias, alpha…
Browse files Browse the repository at this point in the history
…betical order, and reformat to fit in 80 characters.
  • Loading branch information
thekabal committed Jan 22, 2021
1 parent a11f2f5 commit ba2d476
Show file tree
Hide file tree
Showing 81 changed files with 262 additions and 181 deletions.
17 changes: 8 additions & 9 deletions admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
require_once './common.php';

// Database driven language entries
$langvars = Tki\Translate::load($pdo_db, $lang, array('admin', 'common',
'global_includes', 'global_funcs', 'combat',
'footer', 'news', 'report', 'main', 'zoneedit',
'planet', 'admin'));
$langvars = Tki\Translate::load($pdo_db, $lang, array('admin', 'combat',
'common', 'footer', 'insignias', 'main',
'news', 'planet', 'report', 'universal',
'zoneedit'));
$title = $langvars['l_admin_title'];

// We only want menu values that come from $_POST, and only want string values
Expand Down Expand Up @@ -88,11 +88,10 @@
}
}

$langvars = Tki\Translate::load($pdo_db, $lang, array('admin', 'common',
'global_includes', 'global_funcs', 'combat',
'footer', 'news', 'report', 'main', 'zoneedit',
'planet', 'admin'));

$langvars = Tki\Translate::load($pdo_db, $lang, array('admin', 'combat',
'common', 'footer', 'insignias', 'main',
'news', 'planet', 'report', 'universal',
'zoneedit'));
$variables['body_class'] = 'admin';
$variables['lang'] = $lang;
$variables['swordfish'] = $swordfish;
Expand Down
6 changes: 3 additions & 3 deletions attack.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
$header->display($pdo_db, $lang, $template, $title);

// Database driven language entries
$langvars = Tki\Translate::load($pdo_db, $lang, array('attack', 'bounty', 'main',
'planet', 'common', 'global_includes',
'global_funcs', 'combat', 'footer', 'news'));
$langvars = Tki\Translate::load($pdo_db, $lang, array('attack', 'bounty',
'combat', 'common', 'footer', 'insignias',
'main', 'news', 'planet', 'universal'));
echo '<h1>' . $title . '</h1>';

if (array_key_exists('ship_id', $_GET))
Expand Down
6 changes: 3 additions & 3 deletions beacon.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
require_once './common.php';

// Database driven language entries
$langvars = Tki\Translate::load($pdo_db, $lang, array('beacon', 'common',
'global_includes', 'global_funcs', 'combat',
'footer', 'news'));
$langvars = Tki\Translate::load($pdo_db, $lang, array('beacon', 'combat',
'common', 'footer', 'insignias', 'news',
'universal'));
$title = $langvars['l_beacon_title'];

$header = new Tki\Header();
Expand Down
6 changes: 3 additions & 3 deletions bounty.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
$login->checkLogin($pdo_db, $lang, $tkireg, $template);

// Database driven language entries
$langvars = Tki\Translate::load($pdo_db, $lang, array('bounty', 'port', 'common',
'global_includes', 'global_funcs', 'combat',
'footer', 'news'));
$langvars = Tki\Translate::load($pdo_db, $lang, array('bounty', 'combat',
'common', 'footer', 'insignias', 'news',
'port', 'universal'));
$title = $langvars['l_by_title'];

$header = new Tki\Header();
Expand Down
19 changes: 9 additions & 10 deletions classes/CheckDefenses.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ public static function sectorFighters(\PDO $pdo_db, string $lang, int $sector, s
$total_sec_fighters = 0;

$langvars = \Tki\Translate::load($pdo_db, $lang, array('common',
'footer', 'global_funcs',
'global_includes', 'news',
'sector_fighters'));
'footer', 'insignias', 'news',
'sector_fighters', 'universal'));
echo $langvars['l_sf_attacking'] . "<br>";
$targetfighters = $total_sec_fighters;
$playerbeams = \Tki\CalcLevels::abstractLevels($playerinfo['beams'], $tkireg);
Expand Down Expand Up @@ -242,10 +241,10 @@ public static function sectorFighters(\PDO $pdo_db, string $lang, int $sector, s
public static function fighters(\PDO $pdo_db, $old_db, string $lang, int $sector, array $playerinfo, \Tki\Reg $tkireg, string $title, $calledfrom): void
{
// Database driven language entries
$langvars = \Tki\Translate::load($pdo_db, $lang, array('check_defenses',
'combat', 'common', 'footer',
'global_funcs', 'global_includes',
'news', 'regional'));
$langvars = \Tki\Translate::load($pdo_db, $lang, array(
'check_defenses', 'combat', 'common',
'footer', 'insignias', 'news',
'regional', 'universal'));
/*
// Get sectorinfo from database
$sectors_gateway = new \Tki\Sectors\SectorsGateway($pdo_db); // Build a sector gateway object to handle the SQL calls
Expand Down Expand Up @@ -432,9 +431,9 @@ public static function fighters(\PDO $pdo_db, $old_db, string $lang, int $sector
public static function mines(\PDO $pdo_db, $old_db, string $lang, int $sector, string $title, array $playerinfo, \Tki\Reg $tkireg): void
{
// Database driven language entries
$langvars = \Tki\Translate::load($pdo_db, $lang, array('check_defenses',
'common', 'global_includes',
'combat', 'footer', 'news'));
$langvars = \Tki\Translate::load($pdo_db, $lang, array('combat',
'common', 'check_defenses',
'insignias', 'footer', 'news'));
// Get sectorinfo from database
//$sectors_gateway = new \Tki\Sectors\SectorsGateway($pdo_db); // Build a sector gateway object to handle the SQL calls
//$sectorinfo = $sectors_gateway->selectSectorInfo($sector);
Expand Down
2 changes: 1 addition & 1 deletion classes/Footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function display(\PDO $pdo_db, string $lang, Reg $tkireg, Smarty $templat
{
// Database driven language entries
$langvars_temp = Translate::load($pdo_db, $lang, array('common',
'footer', 'global_includes',
'footer', 'insignias',
'logout', 'news'));
// Use array merge so that we do not clobber the langvars array,
// and only add to it the items needed for footer
Expand Down
2 changes: 1 addition & 1 deletion classes/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function checkLogin(\PDO $pdo_db, string $lang, Reg $tkireg, Smarty $temp
{
// Database driven language entries
$langvars = Translate::load($pdo_db, $lang, array('common', 'footer',
'global_funcs', 'login', 'self_destruct'));
'login', 'self_destruct', 'universal'));
$game_closed = new Game();
$playerinfo = Player::auth($pdo_db, $lang, $langvars, $tkireg, $template);

Expand Down
4 changes: 2 additions & 2 deletions classes/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class Text
{
public static function gotoMain(\PDO $pdo_db, string $lang): void
{
$langvars = Translate::load($pdo_db, $lang, array('global_funcs',
'common'));
$langvars = Translate::load($pdo_db, $lang, array('common',
'universal'));
echo str_replace('[here]', "<a href='main.php'>" . $langvars['l_here'] . '</a>', $langvars['l_global_mmenu']);
}
}
5 changes: 2 additions & 3 deletions classes/TraderouteBuildCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ class TraderouteBuildCreate
public static function create(\PDO $pdo_db, $old_db, string $lang, Reg $tkireg, Smarty $template, array $playerinfo, int $num_traderoutes, string $ptype1, string $ptype2, int $port_id1, int $port_id2, int $team_planet_id1, int $team_planet_id2, string $move_type, int $circuit_type, int $editing, ?int $planet_id1 = null, ?int $planet_id2 = null): void
{
$langvars = \Tki\Translate::load($pdo_db, $lang, array('common',
'footer', 'global_funcs',
'global_includes', 'regional',
'traderoutes'));
'footer', 'insignias', 'regional',
'traderoutes', 'universal'));
$admin_log = new AdminLog();
$src_id = null;
$dest_id = null;
Expand Down
4 changes: 2 additions & 2 deletions classes/TraderouteBuildNew.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class TraderouteBuildNew
public static function new(\PDO $pdo_db, string $lang, Reg $tkireg, Smarty $template, int $num_traderoutes, array $playerinfo, ?int $traderoute_id = null): void
{
$langvars = \Tki\Translate::load($pdo_db, $lang, array('common',
'footer', 'global_funcs',
'global_includes', 'traderoutes'));
'footer', 'insignias', 'traderoutes',
'universal'));
$editroute = null;
$planets = array();
$num_planets = 0;
Expand Down
5 changes: 2 additions & 3 deletions classes/TraderouteCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ class TraderouteCheck
public static function isCompatible(\PDO $pdo_db, string $lang, string $type1, string $type2, string $move, int $circuit, array $src, array $dest, array $playerinfo, Reg $tkireg, Smarty $template): void
{
$langvars = \Tki\Translate::load($pdo_db, $lang, array('common',
'footer', 'global_funcs',
'global_includes', 'regional',
'traderoutes'));
'footer', 'insignias', 'regional',
'traderoutes', 'universal'));
$admin_log = new AdminLog();

// Check circuit compatibility (we only use types 1 and 2 so block anything else)
Expand Down
15 changes: 6 additions & 9 deletions classes/TraderouteResults.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ class TraderouteResults
public static function tableTop(\PDO $pdo_db, string $lang, Reg $tkireg): void
{
$langvars = \Tki\Translate::load($pdo_db, $lang, array('common',
'footer', 'global_funcs',
'global_includes', 'regional',
'traderoutes'));
'footer', 'insignias', 'regional',
'traderoutes', 'universal'));
echo "<table border='1' cellspacing='1' cellpadding='2' width='65%' align='center'>\n";
echo " <tr bgcolor='" . $tkireg->color_line2 . "'>\n";
echo " <td align='center' colspan='7'><strong><font color='white'>" . $langvars['l_tdr_res'] . "</font></strong></td>\n";
Expand Down Expand Up @@ -85,9 +84,8 @@ public static function closeTable(): void
public static function displayTotals(\PDO $pdo_db, string $lang, int $total_profit): void
{
$langvars = \Tki\Translate::load($pdo_db, $lang, array('common',
'footer', 'global_funcs',
'global_includes', 'regional',
'traderoutes'));
'footer', 'insignias', 'regional',
'traderoutes', 'universal'));
if ($total_profit > 0)
{
echo "<p><center><font size=3 color=white><strong>" . $langvars['l_tdr_totalprofit'] . " : <font style='color:#0f0;'><strong>" . number_format(abs($total_profit), 0, $langvars['local_number_dec_point'], $langvars['local_number_thousands_sep']) . "</strong></font><br>\n";
Expand All @@ -101,9 +99,8 @@ public static function displayTotals(\PDO $pdo_db, string $lang, int $total_prof
public static function displaySummary(\PDO $pdo_db, string $lang, string $tdr_display_creds, array $dist, array $playerinfo): void
{
$langvars = \Tki\Translate::load($pdo_db, $lang, array('common',
'footer', 'global_funcs',
'global_includes', 'regional',
'traderoutes'));
'footer', 'insignias', 'regional',
'traderoutes', 'universal'));
echo "\n<font size='3' color='white'><strong>" . $langvars['l_tdr_turnsused'] . " : <font style='color:#f00;'>$dist[triptime]</font></strong></font><br>";
echo "\n<font size='3' color='white'><strong>" . $langvars['l_tdr_turnsleft'] . " : <font style='color:#0f0;'>$playerinfo[turns]</font></strong></font><br>";
echo "\n<font size='3' color='white'><strong>" . $langvars['l_tdr_credits'] . " : <font style='color:#0f0;'> $tdr_display_creds\n</font></strong></font><br> </strong></font></center>\n";
Expand Down
10 changes: 4 additions & 6 deletions classes/TraderouteSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ class TraderouteSettings
public static function before(\PDO $pdo_db, string $lang, Reg $tkireg, Smarty $template, array $playerinfo): void
{
$langvars = \Tki\Translate::load($pdo_db, $lang, array('common',
'footer', 'global_funcs',
'global_includes', 'regional',
'traderoutes'));
'footer', 'insignias', 'regional',
'traderoutes', 'universal'));
echo "<p><font size=3 color=blue><strong>" . $langvars['l_tdr_globalset'] . "</strong></font><p>";
echo "<font color=white size=2><strong>" . $langvars['l_tdr_sportsrc'] . " :</strong></font><p>" .
"<form accept-charset='utf-8' action=traderoute.php?command=setsettings method=post>" .
Expand Down Expand Up @@ -114,9 +113,8 @@ public static function after(\PDO $pdo_db, array $playerinfo, int $colonists, in
public static function afterOutput(\PDO $pdo_db, string $lang, Reg $tkireg, Smarty $template): void
{
$langvars = \Tki\Translate::load($pdo_db, $lang, array('common',
'footer', 'global_funcs',
'global_includes', 'regional',
'traderoutes'));
'footer', 'insignias', 'regional',
'traderoutes', 'universal'));
$langvars['l_tdr_returnmenu'] = str_replace("[here]", "<a href='traderoute.php'>" .
$langvars['l_here'] . "</a>", $langvars['l_tdr_returnmenu']);
echo $langvars['l_tdr_globalsetsaved'] . " " . $langvars['l_tdr_returnmenu'];
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"scripts": {
"tests": [
"phpcs --standard=/var/www/html/tki/vendor/bin/phpcs.xml . --ignore=templates,vendor",
"phpstan analyze --no-progress --no-ansi -l 8 -c vendor/bin/phpstan.neon .",
"phpstan analyze --no-progress --no-ansi -l 2 -c vendor/bin/phpstan.neon .",
"psalm -c vendor/bin/psalm.xml --no-progress ."
],
"disabled-due-to-php8-problems-tests": [
Expand Down
7 changes: 3 additions & 4 deletions copyright.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@
$link = null;

// Database driven language entries
$langvars = Tki\Translate::load($pdo_db, $lang, array('main', 'login', 'logout',
'index', 'common', 'regional',
'footer', 'global_includes'));

$langvars = Tki\Translate::load($pdo_db, $lang, array('common', 'footer',
'index', 'insignias', 'login',
'logout', 'main', 'regional'));
$variables = null;
$variables['lang'] = $lang;
$variables['link'] = $link;
Expand Down
4 changes: 3 additions & 1 deletion create_universe/0.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@
*/

// Database driven language entries
$langvars = Tki\Translate::load($pdo_db, $lang, array('common', 'regional', 'footer', 'global_includes', 'create_universe', 'options', 'news'));
$langvars = Tki\Translate::load($pdo_db, $lang, array('common',
'create_universe', 'footer', 'insignias',
'news', 'options', 'regional'));
$variables['title'] = $langvars['l_cu_title'];

$header = new Tki\Header();
Expand Down
4 changes: 3 additions & 1 deletion create_universe/10.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
$variables['max_sectors'] = $tkireg->max_sectors;

// Database driven language entries
$langvars = Tki\Translate::load($pdo_db, $lang, array('common', 'regional', 'footer', 'global_includes', 'create_universe', 'news'));
$langvars = Tki\Translate::load($pdo_db, $lang, array('common',
'create_universe', 'footer', 'insignias',
'news', 'regional'));
$variables['title'] = $langvars['l_cu_title'];

$header = new Tki\Header();
Expand Down
4 changes: 3 additions & 1 deletion create_universe/20.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@
$variables['autorun'] = filter_input(INPUT_POST, 'autorun', FILTER_VALIDATE_BOOL, FILTER_NULL_ON_FAILURE);

// Database driven language entries
$langvars = Tki\Translate::load($pdo_db, $lang, array('common', 'regional', 'footer', 'global_includes', 'create_universe', 'news'));
$langvars = Tki\Translate::load($pdo_db, $lang, array('common',
'create_universe', 'footer', 'insignias',
'news', 'regional'));
$variables['title'] = $langvars['l_cu_title'];

$header = new Tki\Header();
Expand Down
8 changes: 4 additions & 4 deletions create_universe/30.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@
}

// Database driven language entries
$langvars = Tki\Translate::load($pdo_db, $lang, array('common', 'regional', 'footer', 'global_includes', 'create_universe', 'news'));
$variables['title'] = $langvars['l_cu_title'];

$langvars = Tki\Translate::load($pdo_db, $lang, array('common',
'create_universe', 'footer', 'insignias',
'news', 'regional'));
$variables['title'] = $langvars['l_cu_title'];
$header = new Tki\Header();
$header->display($pdo_db, $lang, $template, $variables['title'], $variables['body_class']);
$template->addVariables('langvars', $langvars);
$template->addVariables('variables', $variables);
$template->display('templates/classic/create_universe/30.tpl');

$footer = new Tki\Footer();
$footer->display($pdo_db, $lang, $tkireg, $template);
4 changes: 3 additions & 1 deletion create_universe/40.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@
}

// Database driven language entries
$langvars = Tki\Translate::load($pdo_db, $lang, array('common', 'regional', 'footer', 'global_includes', 'create_universe', 'news'));
$langvars = Tki\Translate::load($pdo_db, $lang, array('common',
'create_universe', 'footer', 'insignias',
'news', 'regional'));
$variables['title'] = $langvars['l_cu_title'];

$header = new Tki\Header();
Expand Down
4 changes: 3 additions & 1 deletion create_universe/50.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@
$variables['autorun'] = filter_input(INPUT_POST, 'autorun', FILTER_VALIDATE_BOOL, FILTER_NULL_ON_FAILURE);

// Database driven language entries
$langvars = Tki\Translate::load($pdo_db, $lang, array('common', 'regional', 'footer', 'global_includes', 'create_universe', 'news'));
$langvars = Tki\Translate::load($pdo_db, $lang, array('common',
'create_universe', 'footer', 'insignias',
'news', 'regional'));
$variables['title'] = $langvars['l_cu_title'];

$local_table_timer = new Tki\Timer();
Expand Down
4 changes: 3 additions & 1 deletion create_universe/60.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@
$variables['autorun'] = filter_input(INPUT_POST, 'autorun', FILTER_VALIDATE_BOOL, FILTER_NULL_ON_FAILURE);

// Database driven language entries
$langvars = Tki\Translate::load($pdo_db, $lang, array('common', 'regional', 'footer', 'global_includes', 'create_universe', 'news'));
$langvars = Tki\Translate::load($pdo_db, $lang, array('common',
'create_universe', 'footer', 'insignias',
'news', 'regional'));
$variables['title'] = $langvars['l_cu_title'];

$catch_results = array();
Expand Down
Loading

0 comments on commit ba2d476

Please sign in to comment.