Skip to content

Commit

Permalink
References to $db now are $old_db
Browse files Browse the repository at this point in the history
  • Loading branch information
thekabal committed Jul 13, 2020
1 parent d3e557a commit b742d78
Show file tree
Hide file tree
Showing 63 changed files with 537 additions and 537 deletions.
22 changes: 11 additions & 11 deletions admin/bans_editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

$bans = null;
$players = null;
$res = $db->Execute("SELECT ban_mask FROM {$db->prefix}ip_bans");
$res = $old_db->Execute("SELECT ban_mask FROM {$old_db->prefix}ip_bans");
Tki\Db::logDbErrors($pdo_db, $res, __LINE__, __FILE__);
while (!$res->EOF)
{
Expand Down Expand Up @@ -78,7 +78,7 @@
echo "<td align=center><font size=2 color=white>" . $printban . "</td>" .
"<td align=center><font size=2 color=white>";

$res = $db->Execute("SELECT character_name, ship_id, email FROM {$db->prefix}ships WHERE ip_address LIKE ?;", array($ban));
$res = $old_db->Execute("SELECT character_name, ship_id, email FROM {$old_db->prefix}ships WHERE ip_address LIKE ?;", array($ban));
Tki\Db::logDbErrors($pdo_db, $res, __LINE__, __FILE__);
unset($players);
$players = null;
Expand Down Expand Up @@ -130,7 +130,7 @@
elseif ($command == 'showips')
{
$ips = array();
$res = $db->Execute("SELECT DISTINCT ip_address FROM {$db->prefix}ships");
$res = $old_db->Execute("SELECT DISTINCT ip_address FROM {$old_db->prefix}ships");
Tki\Db::logDbErrors($pdo_db, $res, __LINE__, __FILE__);
while (!$res->EOF)
{
Expand Down Expand Up @@ -166,7 +166,7 @@
echo "<td align=center><font size=2 color=white>" . $ip . "</td>" .
"<td align=center><font size=2 color=white>";

$res = $db->Execute("SELECT character_name, ship_id, email FROM {$db->prefix}ships WHERE ip_address = ?;", array($ip));
$res = $old_db->Execute("SELECT character_name, ship_id, email FROM {$old_db->prefix}ships WHERE ip_address = ?;", array($ip));
Tki\Db::logDbErrors($pdo_db, $res, __LINE__, __FILE__);
unset($players);
$players = null;
Expand Down Expand Up @@ -267,9 +267,9 @@
$printban = htmlentities($printban, ENT_QUOTES | ENT_HTML5, 'UTF-8');
echo "<font size=2 color=white><strong>" . $langvars['l_admin_ban_success'] . " " . $printban . "</strong>.<p>";

$resx = $db->Execute("INSERT INTO {$db->prefix}ip_bans values (NULL, ?);", array($banmask));
$resx = $old_db->Execute("INSERT INTO {$old_db->prefix}ip_bans values (NULL, ?);", array($banmask));
Tki\Db::logDbErrors($pdo_db, $resx, __LINE__, __FILE__);
$res = $db->Execute("SELECT DISTINCT character_name FROM {$db->prefix}ships, {$db->prefix}ip_bans WHERE ip_address LIKE ban_mask");
$res = $old_db->Execute("SELECT DISTINCT character_name FROM {$old_db->prefix}ships, {$old_db->prefix}ip_bans WHERE ip_address LIKE ban_mask");
Tki\Db::logDbErrors($pdo_db, $res, __LINE__, __FILE__);
echo $langvars['l_admin_affected_players'] . " :<p>";
while (!$res->EOF)
Expand All @@ -289,12 +289,12 @@
$ip = $_POST['ip'];
if ($ban !== null)
{
$res = $db->Execute("SELECT * FROM {$db->prefix}ip_bans WHERE ban_mask = ?;", array($ban));
$res = $old_db->Execute("SELECT * FROM {$old_db->prefix}ip_bans WHERE ban_mask = ?;", array($ban));
Tki\Db::logDbErrors($pdo_db, $res, __LINE__, __FILE__);
}
else
{
$res = $db->Execute("SELECT * FROM {$db->prefix}ip_bans WHERE ? LIKE ban_mask;", array($ip));
$res = $old_db->Execute("SELECT * FROM {$old_db->prefix}ip_bans WHERE ? LIKE ban_mask;", array($ip));
Tki\Db::logDbErrors($pdo_db, $res, __LINE__, __FILE__);
}

Expand All @@ -309,12 +309,12 @@

if ($ban !== null)
{
$resx = $db->Execute("DELETE FROM {$db->prefix}ip_bans WHERE ban_mask = ?;", array($ban));
$resx = $old_db->Execute("DELETE FROM {$old_db->prefix}ip_bans WHERE ban_mask = ?;", array($ban));
Tki\Db::logDbErrors($pdo_db, $resx, __LINE__, __FILE__);
}
else
{
$resx = $db->Execute("DELETE FROM {$db->prefix}ip_bans WHERE ? LIKE ban_mask;", array($ip));
$resx = $old_db->Execute("DELETE FROM {$old_db->prefix}ip_bans WHERE ? LIKE ban_mask;", array($ip));
Tki\Db::logDbErrors($pdo_db, $resx, __LINE__, __FILE__);
}

Expand All @@ -324,7 +324,7 @@
$query_string = $query_string . " OR ip_address LIKE '" . $bans[$i]['ban_mask'] . "'";
}

$res = $db->Execute("SELECT DISTINCT character_name FROM {$db->prefix}ships WHERE ?;", array($query_string));
$res = $old_db->Execute("SELECT DISTINCT character_name FROM {$old_db->prefix}ships WHERE ?;", array($query_string));
Tki\Db::logDbErrors($pdo_db, $res, __LINE__, __FILE__);
$nbplayers = $res->RecordCount();
$players = null;
Expand Down
2 changes: 1 addition & 1 deletion admin/log_viewer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/

$players = array();
$res = $db->Execute("SELECT ship_id, character_name FROM {$db->prefix}ships ORDER BY character_name ASC");
$res = $old_db->Execute("SELECT ship_id, character_name FROM {$old_db->prefix}ships ORDER BY character_name ASC");
Tki\Db::logDbErrors($pdo_db, $res, __LINE__, __FILE__);
while (!$res->EOF)
{
Expand Down
4 changes: 2 additions & 2 deletions admin/perf_monitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
*
*/

//adodb_perf::table("{$db->prefix}adodb_logsql");
$perf = NewPerfMonitor($db);
//adodb_perf::table("{$old_db->prefix}adodb_logsql");
$perf = NewPerfMonitor($old_db);
$pollsecs = 5;
$perf->UI($pollsecs);

Expand Down
8 changes: 4 additions & 4 deletions admin/planet_editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
if (empty($planet_id))
{
echo "<select size='15' name='planet'>";
$res = $db->Execute("SELECT planet_id, name, sector_id FROM {$db->prefix}planets ORDER BY sector_id");
$res = $old_db->Execute("SELECT planet_id, name, sector_id FROM {$old_db->prefix}planets ORDER BY sector_id");
Tki\Db::logDbErrors($pdo_db, $res, __LINE__, __FILE__);
while (!$res->EOF)
{
Expand Down Expand Up @@ -65,7 +65,7 @@
echo "<table border='0' cellspacing='2' cellpadding='2'>";
echo "<tr><td><tt>" . $langvars['l_admin_planet_owner'] . "</tt></td><td>";
echo "<select size='1' name='owner'>";
$ressuba = $db->Execute("SELECT ship_id,character_name FROM {$db->prefix}ships ORDER BY character_name");
$ressuba = $old_db->Execute("SELECT ship_id,character_name FROM {$old_db->prefix}ships ORDER BY character_name");
Tki\Db::logDbErrors($pdo_db, $ressuba, __LINE__, __FILE__);
echo "<option value='0'>" . $langvars['l_admin_no_one'] . "</option>";
while (!$ressuba->EOF)
Expand Down Expand Up @@ -115,12 +115,12 @@
$_defeated = empty($defeated) ? "N" : "Y";
$_base = empty($base) ? "N" : "Y";
$_sells = empty($sells) ? "N" : "Y";
$planupdate = $db->Execute("UPDATE {$db->prefix}planets SET sector_id = ?, defeated = ?, name = ?, base = ?, sells = ?, owner = ?, organics = ?, ore = ?, goods = ?, energy = ?, team = ?, colonists = ?,credits = ? ,fighters = ?, torps = ?, prod_organics= ? , prod_ore = ?, prod_goods = ?, prod_energy = ?, prod_fighters = ?, prod_torp = ? WHERE planet_id = ?", array($sector_id, $_defeated, $name, $_base, $_sells, $owner, $organics, $ore, $goods, $energy, $team, $colonists, $credits, $fighters, $torps, $prod_organics, $prod_ore, $prod_goods, $prod_energy, $prod_fighters, $prod_torp, $planet_id));
$planupdate = $old_db->Execute("UPDATE {$old_db->prefix}planets SET sector_id = ?, defeated = ?, name = ?, base = ?, sells = ?, owner = ?, organics = ?, ore = ?, goods = ?, energy = ?, team = ?, colonists = ?,credits = ? ,fighters = ?, torps = ?, prod_organics= ? , prod_ore = ?, prod_goods = ?, prod_energy = ?, prod_fighters = ?, prod_torp = ? WHERE planet_id = ?", array($sector_id, $_defeated, $name, $_base, $_sells, $owner, $organics, $ore, $goods, $energy, $team, $colonists, $credits, $fighters, $torps, $prod_organics, $prod_ore, $prod_goods, $prod_energy, $prod_fighters, $prod_torp, $planet_id));
Tki\Db::logDbErrors($pdo_db, $planupdate, __LINE__, __FILE__);
if (!$planupdate)
{
echo $langvars['l_admin_changes_failed'] . "<br><br>";
echo $db->ErrorMsg() . "<br>";
echo $old_db->ErrorMsg() . "<br>";
}
else
{
Expand Down
8 changes: 4 additions & 4 deletions admin/sector_editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
if ($_POST['sector'] === null)
{
$sectors = array();
$res = $db->Execute("SELECT sector_id FROM {$db->prefix}universe ORDER BY sector_id");
$res = $old_db->Execute("SELECT sector_id FROM {$old_db->prefix}universe ORDER BY sector_id");
Tki\Db::logDbErrors($pdo_db, $res, __LINE__, __FILE__);
while (!$res->EOF)
{
Expand All @@ -59,7 +59,7 @@
$variables['sector_name'] = $row['sector_name'];

$zones = array();
$ressubb = $db->Execute("SELECT zone_id,zone_name FROM {$db->prefix}zones ORDER BY zone_name");
$ressubb = $old_db->Execute("SELECT zone_id,zone_name FROM {$old_db->prefix}zones ORDER BY zone_name");
Tki\Db::logDbErrors($pdo_db, $ressubb, __LINE__, __FILE__);
while (!$ressubb->EOF)
{
Expand Down Expand Up @@ -101,13 +101,13 @@
elseif ($_POST['operation'] == "save")
{
// Update database
$secupdate = $db->Execute("UPDATE {$db->prefix}universe SET sector_name=?, zone_id=?, beacon=?, port_type=?, port_organics=?, port_ore=?, port_goods=?, port_energy=?, distance=?, angle1=?, angle2=? WHERE sector_id=?;", array($_POST['sector_name'], $_POST['zone_id'], $_POST['beacon'], $_POST['port_type'], $_POST['port_organics'], $_POST['port_ore'], $_POST['port_goods'], $_POST['port_energy'], $_POST['distance'], $_POST['angle1'], $_POST['angle2'], $_POST['sector']));
$secupdate = $old_db->Execute("UPDATE {$old_db->prefix}universe SET sector_name=?, zone_id=?, beacon=?, port_type=?, port_organics=?, port_ore=?, port_goods=?, port_energy=?, distance=?, angle1=?, angle2=? WHERE sector_id=?;", array($_POST['sector_name'], $_POST['zone_id'], $_POST['beacon'], $_POST['port_type'], $_POST['port_organics'], $_POST['port_ore'], $_POST['port_goods'], $_POST['port_energy'], $_POST['distance'], $_POST['angle1'], $_POST['angle2'], $_POST['sector']));
Tki\Db::logDbErrors($pdo_db, $secupdate, __LINE__, __FILE__);

if (!$secupdate)
{
$variables['secupdate'] = false;
$variables['db_error_msg'] = $db->ErrorMsg();
$variables['db_error_msg'] = $old_db->ErrorMsg();
}
else
{
Expand Down
8 changes: 4 additions & 4 deletions admin/universe_editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@

if ($action == "doexpand")
{
$result = $db->Execute("SELECT sector_id FROM {$db->prefix}universe ORDER BY sector_id ASC");
$result = $old_db->Execute("SELECT sector_id FROM {$old_db->prefix}universe ORDER BY sector_id ASC");
Tki\Db::logDbErrors($pdo_db, $result, __LINE__, __FILE__);

if (!$result->EOF)
{
$resa = $db->StartTrans(); // We enclose the updates in a transaction as it is faster
$resa = $old_db->StartTrans(); // We enclose the updates in a transaction as it is faster
Tki\Db::logDbErrors($pdo_db, $resa, __LINE__, __FILE__);

// Begin transaction
while (!$result->EOF)
{
$row = $result->fields;
$distance = random_int(1, (int) $radius);
$resx = $db->Execute("UPDATE {$db->prefix}universe SET distance = ? WHERE sector_id = ?", array($distance, $row['sector_id']));
$resx = $old_db->Execute("UPDATE {$old_db->prefix}universe SET distance = ? WHERE sector_id = ?", array($distance, $row['sector_id']));
Tki\Db::logDbErrors($pdo_db, $resx, __LINE__, __FILE__);

$changed_sectors[$i] = str_replace("[sector]", $row['sector_id'], $langvars['l_admin_updated_distance']);
Expand All @@ -52,7 +52,7 @@
}

// End transaction
$trans_status = $db->CompleteTrans(); // Complete the transaction
$trans_status = $old_db->CompleteTrans(); // Complete the transaction
Tki\Db::logDbErrors($pdo_db, $trans_status, __LINE__, __FILE__);
}
}
Expand Down
4 changes: 2 additions & 2 deletions admin/user_editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
if (empty($_POST['user']))
{
$players = array();
$res = $db->Execute("SELECT ship_id, character_name FROM {$db->prefix}ships ORDER BY character_name");
$res = $old_db->Execute("SELECT ship_id, character_name FROM {$old_db->prefix}ships ORDER BY character_name");
Tki\Db::logDbErrors($pdo_db, $res, __LINE__, __FILE__);
while (!$res->EOF)
{
Expand Down Expand Up @@ -112,7 +112,7 @@
$_dev_fuelscoop = empty($_POST['dev_fuelscoop']) ? "N" : "Y";
$variables['debug'] = $_dev_escapepod;
// FUTURE: Needs password updating as well
$resx = $db->Execute("UPDATE {$db->prefix}ships SET character_name=?, email=?, ship_name=?, ship_destroyed=?, hull=?, engines=?, power=?, computer=?, sensors=?, armor=?, shields=?, beams=?, torp_launchers=?, cloak=?, credits=?, turns=?, dev_warpedit=?, dev_genesis=?, dev_beacon=?, dev_emerwarp=?, dev_escapepod=?, dev_fuelscoop=?, dev_minedeflector=?, sector=?, ship_ore=?, ship_organics=?, ship_goods=?, ship_energy=?, ship_colonists=?, ship_fighters=?, torps=?, armor_pts=? WHERE ship_id=?", array($_POST['character_name'], $_POST['email'], $_POST['ship_name'], $_ship_destroyed, $_POST['hull'], $_POST['engines'], $_POST['power'], $_POST['computer'], $_POST['sensors'], $_POST['armor'], $_POST['shields'], $_POST['beams'], $_POST['torp_launchers'], $_POST['cloak'], $_POST['credits'], $_POST['turns'], $_POST['dev_warpedit'], $_POST['dev_genesis'], $_POST['dev_beacon'], $_POST['dev_emerwarp'], $_dev_escapepod, $_dev_fuelscoop, $_POST['dev_minedeflector'], $_POST['sector'], $_POST['ship_ore'], $_POST['ship_organics'], $_POST['ship_goods'], $_POST['ship_energy'], $_POST['ship_colonists'], $_POST['ship_fighters'], $_POST['torps'], $_POST['armor_pts'], $_POST['user']));
$resx = $old_db->Execute("UPDATE {$old_db->prefix}ships SET character_name=?, email=?, ship_name=?, ship_destroyed=?, hull=?, engines=?, power=?, computer=?, sensors=?, armor=?, shields=?, beams=?, torp_launchers=?, cloak=?, credits=?, turns=?, dev_warpedit=?, dev_genesis=?, dev_beacon=?, dev_emerwarp=?, dev_escapepod=?, dev_fuelscoop=?, dev_minedeflector=?, sector=?, ship_ore=?, ship_organics=?, ship_goods=?, ship_energy=?, ship_colonists=?, ship_fighters=?, torps=?, armor_pts=? WHERE ship_id=?", array($_POST['character_name'], $_POST['email'], $_POST['ship_name'], $_ship_destroyed, $_POST['hull'], $_POST['engines'], $_POST['power'], $_POST['computer'], $_POST['sensors'], $_POST['armor'], $_POST['shields'], $_POST['beams'], $_POST['torp_launchers'], $_POST['cloak'], $_POST['credits'], $_POST['turns'], $_POST['dev_warpedit'], $_POST['dev_genesis'], $_POST['dev_beacon'], $_POST['dev_emerwarp'], $_dev_escapepod, $_dev_fuelscoop, $_POST['dev_minedeflector'], $_POST['sector'], $_POST['ship_ore'], $_POST['ship_organics'], $_POST['ship_goods'], $_POST['ship_energy'], $_POST['ship_colonists'], $_POST['ship_fighters'], $_POST['torps'], $_POST['armor_pts'], $_POST['user']));
Tki\Db::logDbErrors($pdo_db, $resx, __LINE__, __FILE__);
$button_main = false;
$variables['user'] = '';
Expand Down
4 changes: 2 additions & 2 deletions admin/zone_editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
{
$zones = array();

$res = $db->Execute("SELECT zone_id, zone_name FROM {$db->prefix}zones ORDER BY zone_name");
$res = $old_db->Execute("SELECT zone_id, zone_name FROM {$old_db->prefix}zones ORDER BY zone_name");
Tki\Db::logDbErrors($pdo_db, $res, __LINE__, __FILE__);
while (!$res->EOF)
{
Expand Down Expand Up @@ -96,7 +96,7 @@
$_zone_attack = empty($zone_attack) ? "N" : "Y";
$_zone_warpedit = empty($zone_warpedit) ? "N" : "Y";
$_zone_planet = empty($zone_planet) ? "N" : "Y";
$resx = $db->Execute("UPDATE {$db->prefix}zones SET zone_name = ?, allow_beacon = ? , allow_attack= ? , allow_warpedit = ? , allow_planet = ?, max_hull = ? WHERE zone_id = ?;", array($zone_name, $_zone_beacon, $_zone_attack, $_zone_warpedit, $_zone_planet, $zone_hull, $_POST['zone']));
$resx = $old_db->Execute("UPDATE {$old_db->prefix}zones SET zone_name = ?, allow_beacon = ? , allow_attack= ? , allow_warpedit = ? , allow_planet = ?, max_hull = ? WHERE zone_id = ?;", array($zone_name, $_zone_beacon, $_zone_attack, $_zone_warpedit, $_zone_planet, $zone_hull, $_POST['zone']));
Tki\Db::logDbErrors($pdo_db, $resx, __LINE__, __FILE__);
$button_main = false;
}
Expand Down
Loading

0 comments on commit b742d78

Please sign in to comment.