Пример #1
0
     } else {
         $selected = null;
     }
     $charname = $res->fields['character_name'];
     $ship_id = $res->fields['ship_id'];
     echo "<option value={$ship_id} {$selected}>{$charname}</option>";
     $res->MoveNext();
 }
 echo "</select></td></tr>";
 echo "<tr><td>" . $langvars['l_by_amount'] . ":</td><td><input type=text name=amount size=20 maxlength=20></td></tr>";
 echo "<tr><td></td><td><input type=submit value=" . $langvars['l_by_place'] . "><input type=reset value=Clear></td>";
 echo "</table>";
 echo "<input type=hidden name=response value=place>";
 echo "</form>";
 $result3 = $db->Execute("SELECT bounty_on, SUM(amount) as total_bounty FROM {$db->prefix}bounty GROUP BY bounty_on;");
 Tki\Db::LogDbErrors($pdo_db, $result3, __LINE__, __FILE__);
 $i = 0;
 if ($result3) {
     while (!$result3->EOF) {
         $bounties[$i] = $result3->fields;
         $i++;
         $result3->MoveNext();
     }
 }
 $num_bounties = $i;
 if ($num_bounties < 1) {
     echo $langvars['l_by_nobounties'] . "<br>";
 } else {
     echo $langvars['l_by_moredetails'] . "<br><br>";
     echo "<table width=\"100%\" border=0 cellspacing=0 cellpadding=2>";
     echo "<tr bgcolor=\"{$tkireg->color_header}\">";
Пример #2
0
<?php

// The Kabal Invasion - A web-based 4X space game
// Copyright © 2014 The Kabal Invasion development team, Ron Harwood, and the BNT development team
//
//  This program is free software: you can redistribute it and/or modify
//  it under the terms of the GNU Affero General Public License as
//  published by the Free Software Foundation, either version 3 of the
//  License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU Affero General Public License for more details.
//
//  You should have received a copy of the GNU Affero General Public License
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
//
// File: sched_ibank.php
$exponinter = pow($tkireg->ibank_interest + 1, $multiplier);
$expoloan = pow($tkireg->ibank_loaninterest + 1, $multiplier);
echo "<strong>IBANK</strong><p>";
$ibank_result = $db->Execute("UPDATE {$db->prefix}ibank_accounts SET balance = balance * ?, loan = loan * ?", array($exponinter, $expoloan));
Tki\Db::LogDbErrors($pdo_db, $ibank_result, __LINE__, __FILE__);
echo "All IBANK accounts updated ({$multiplier} times).<p>";
$multiplier = 0;
Пример #3
0
        } else {
            $langvars['l_mines_dfighter'] = str_replace("[fighters]", $numfighters, $langvars['l_mines_dfighter']);
            $langvars['l_mines_dfighter'] = str_replace("[mode]", $mode, $langvars['l_mines_dfighter']);
            echo $langvars['l_mines_dfighter'] . "<br>";
        }
        $stamp = date("Y-m-d H:i:s");
        if ($numfighters > 0) {
            if ($fighter_id != 0) {
                $update = $db->Execute("UPDATE {$db->prefix}sector_defense SET quantity = quantity + ? ,fm_setting = ? WHERE defense_id = ?;", array($numfighters, $mode, $fighter_id));
                Tki\Db::LogDbErrors($pdo_db, $update, __LINE__, __FILE__);
            } else {
                $update = $db->Execute("INSERT INTO {$db->prefix}sector_defense (ship_id, sector_id, defense_type, quantity, fm_setting) values (?, ?, ?, ?, ?);", array($playerinfo['ship_id'], $playerinfo['sector'], 'F', $numfighters, $mode));
                Tki\Db::LogDbErrors($pdo_db, $update, __LINE__, __FILE__);
                echo $db->ErrorMsg();
            }
        }
        if ($nummines > 0) {
            if ($mine_id != 0) {
                $update = $db->Execute("UPDATE {$db->prefix}sector_defense SET quantity = quantity + ?, fm_setting = ? WHERE defense_id = ?;", array($nummines, $mode, $mine_id));
                Tki\Db::LogDbErrors($pdo_db, $update, __LINE__, __FILE__);
            } else {
                $update = $db->Execute("INSERT INTO {$db->prefix}sector_defense (ship_id, sector_id, defense_type, quantity, fm_setting) values (?, ?, ?, ?, ?);", array($playerinfo['ship_id'], $playerinfo['sector'], 'M', $nummines, $mode));
                Tki\Db::LogDbErrors($pdo_db, $update, __LINE__, __FILE__);
            }
        }
        $update = $db->Execute("UPDATE {$db->prefix}ships SET last_login = ?, turns = turns - 1, turns_used = turns_used + 1, ship_fighters = ship_fighters - ?, torps = torps - ? WHERE ship_id = ?;", array($stamp, $numfighters, $nummines, $playerinfo['ship_id']));
        Tki\Db::LogDbErrors($pdo_db, $update, __LINE__, __FILE__);
    }
}
Tki\Text::gotomain($pdo_db, $lang);
Tki\Footer::display($pdo_db, $lang, $tkireg, $template);
Пример #4
0
<?php

// The Kabal Invasion - A web-based 4X space game
// Copyright © 2014 The Kabal Invasion development team, Ron Harwood, and the BNT development team
//
//  This program is free software: you can redistribute it and/or modify
//  it under the terms of the GNU Affero General Public License as
//  published by the Free Software Foundation, either version 3 of the
//  License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU Affero General Public License for more details.
//
//  You should have received a copy of the GNU Affero General Public License
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
//
// File: sched_turns.php
echo "<strong>TURNS</strong><br><br>";
echo "Adding turns...";
$resa = $db->Execute("UPDATE {$db->prefix}ships SET turns = LEAST (turns + ({$tkireg->turns_per_tick} * {$multiplier}), {$tkireg->max_turns}) WHERE turns < {$tkireg->max_turns}");
//$resa = $db->Execute("UPDATE {$db->prefix}ships SET turns = LEAST (turns + (? * ?), ?) WHERE turns < ?", array($tkireg->turns_per_tick, $multiplier, $tkireg->max_turns, $tkireg->max_turns));
$debug = Tki\Db::LogDbErrors($pdo_db, $resa, __LINE__, __FILE__);
isQueryOk($pdo_db, $debug);
echo "<br>";
$multiplier = 0;
Пример #5
0
                // Either we got an error in the SQL Query or <> 1 records was changed.
                echo $langvars['l_opt2_passchangeerr'] . "<br><br>";
            } else {
                // Log user in
                $_SESSION['password'] = $newpass1;
                $_SESSION['logged_in'] = true;
                $_SESSION['username'] = $playerinfo['email'];
            }
            // Send email to user & admin notifying of password change
            $langvars['l_mail_message'] = str_replace("[ip]", $request->server->get('REMOTE_ADDR'), $langvars['l_mail_message']);
            $langvars['l_mail_message'] = str_replace("[game_name]", $tkireg->game_name, $langvars['l_mail_message']);
            // Some reason \r\n is broken, so replace them now.
            $langvars['l_mail_message'] = str_replace('\\r\\n', "\r\n", $langvars['l_mail_message']);
            // Need to set the topic with the game name.
            $langvars['l_mail_topic'] = str_replace("[game_name]", $tkireg->game_name, $langvars['l_mail_topic']);
            mail($playerinfo['email'], $langvars['l_mail_topic'], $langvars['l_mail_message'], "From: {$tkireg->admin_mail}\r\nReply-To: {$tkireg->admin_mail}\r\nX-Mailer: PHP/" . phpversion());
            // Reset recovery_time to zero
            $recovery_update_result = $db->Execute("UPDATE {$db->prefix}ships SET recovery_time = null WHERE email = ?;", array($playerinfo['email']));
            Tki\Db::LogDbErrors($pdo_db, $recovery_update_result, __LINE__, __FILE__);
            echo $langvars['l_pwr_success'] . "<br><br>";
            echo str_replace("[here]", "<a href='main.php'>" . $langvars['l_here'] . "</a>", $langvars['l_global_mmenu']);
            // Redirect to game
            header('Refresh: 5;url=main.php');
        }
    }
} else {
    // This reset code is not valid.
    echo $langvars['l_pwr_invalid'];
    // Admin log this attempt to use an invalid code
}
Tki\Footer::display($pdo_db, $lang, $tkireg, $template);
Пример #6
0
    // Build a player gateway object to handle the SQL calls
    $online = $players_gateway->selectPlayersLoggedIn($since_stamp, $stamp);
    // Online is the (int) count of the numbers of players currently logged in via SQL select
}
$elapsed = (int) 999;
// Default value for elapsed, overridden with an actual value if its available
if ($tkireg !== null) {
    if (property_exists($tkireg, 'tkitimer')) {
        $tkireg->tkitimer->stop();
        $elapsed = $tkireg->tkitimer->elapsed();
    }
}
// Suppress the news ticker on the IBANK and index pages
$news_ticker_active = !(preg_match("/index.php/i", $request->server->get('SCRIPT_NAME')) || preg_match("/ibank.php/i", $request->server->get('SCRIPT_NAME')) || preg_match("/new.php/i", $request->server->get('SCRIPT_NAME')));
// Suppress the news ticker if the database is not active
if (!Tki\Db::isActive($pdo_db)) {
    $news_ticker_active = false;
}
// Update counter
$scheduler_gateway = new \Tki\Scheduler\SchedulerGateway($pdo_db);
// Build a scheduler gateway object to handle the SQL calls
$last_run = $scheduler_gateway->selectSchedulerLastRun();
// Last run is the (int) count of the numbers of players currently logged in via SQL select or false if DB is not active
if ($last_run !== false) {
    $seconds_left = $tkireg->sched_ticks * 60 - (time() - $last_run);
    $display_update_ticker = true;
} else {
    $seconds_left = (int) 0;
    $display_update_ticker = false;
}
// End update counter
Пример #7
0
//  You should have received a copy of the GNU Affero General Public License
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
//
// File: sched_tow.php
echo "<strong>ZONES</strong><br><br>";
echo "Towing bigger players out of restricted zones...";
$num_to_tow = 0;
do {
    $res = $db->Execute("SELECT ship_id,character_name,hull,sector,{$db->prefix}universe.zone_id,max_hull FROM {$db->prefix}ships,{$db->prefix}universe,{$db->prefix}zones WHERE sector=sector_id AND {$db->prefix}universe.zone_id={$db->prefix}zones.zone_id AND max_hull<>0 AND (({$db->prefix}ships.hull + {$db->prefix}ships.engines + {$db->prefix}ships.computer + {$db->prefix}ships.beams + {$db->prefix}ships.torp_launchers + {$db->prefix}ships.shields + {$db->prefix}ships.armor)/7) >max_hull AND ship_destroyed='N'");
    Tki\Db::LogDbErrors($pdo_db, $res, __LINE__, __FILE__);
    if ($res) {
        $num_to_tow = $res->RecordCount();
        echo "<br>{$num_to_tow} players to tow:<br>";
        while (!$res->EOF) {
            $row = $res->fields;
            echo "...towing {$row['character_name']} out of {$row['sector']} ...";
            $newsector = random_int(0, (int) $max_sectors - 1);
            echo " to sector {$newsector}.<br>";
            $query = $db->Execute("UPDATE {$db->prefix}ships SET sector = ?, cleared_defenses=' ' WHERE ship_id=?", array($newsector, $row['ship_id']));
            Tki\Db::LogDbErrors($pdo_db, $query, __LINE__, __FILE__);
            Tki\PlayerLog::WriteLog($pdo_db, $row['ship_id'], LOG_TOW, "{$row['sector']}|{$newsector}|{$row['max_hull']}");
            Tki\LogMove::writeLog($pdo_db, $row['ship_id'], $newsector);
            $res->MoveNext();
        }
    } else {
        echo "<br>No players to tow.<br>";
    }
} while ($num_to_tow);
echo "<br>";
$multiplier = 0;
// No need to run this again
Пример #8
0
        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']));
            Tki\Db::LogDbErrors($pdo_db, $resx, __LINE__, __FILE__);
            $changed_sectors[$i] = str_replace("[sector]", $row['sector_id'], $langvars['l_admin_updated_distance']);
            $changed_sectors[$i] = str_replace("[distance]", $distance, $changed_sectors[$i]);
            $i++;
            $result->MoveNext();
        }
        // End transaction
        $trans_status = $db->CompleteTrans();
        // Complete the transaction
        Tki\Db::LogDbErrors($pdo_db, $trans_status, __LINE__, __FILE__);
    }
}
$title = $langvars['l_change_uni_title'];
// Set array with all used variables in page
$variables['lang'] = $lang;
$variables['changed_sectors'] = $changed_sectors;
$variables['swordfish'] = $swordfish;
$variables['universe_size'] = $universe_size;
$variables['action'] = $action;
$variables['radius'] = $radius;
// Set the module name.
$variables['module'] = $module_name;
// Now set a container for the variables and langvars and send them off to the template system
$variables['container'] = "variable";
$langvars['container'] = "langvar";
Пример #9
0
    $free_power = Tki\CalcLevels::energy($playerinfo['power'], $tkireg) - $playerinfo['ship_energy'];
    $total_cost = $trade_ore * $ore_price + $trade_organics * $organics_price + $trade_goods * $goods_price + $trade_energy * $energy_price;
    if ($free_holds < $cargo_exchanged) {
        echo $langvars['l_notenough_cargo'] . "  <a href=planet.php?planet_id={$planet_id}>" . $langvars['l_clickme'] . "</a> " . $langvars['l_toplanetmenu'] . "<br><br>";
    } elseif ($trade_energy > $free_power) {
        echo $langvars['l_notenough_power'] . " <a href=planet.php?planet_id={$planet_id}>" . $langvars['l_clickme'] . "</a> " . $langvars['l_toplanetmenu'] . "<br><br>";
    } elseif ($playerinfo['turns'] < 1) {
        echo $langvars['l_notenough_turns'] . "<br><br>";
    } elseif ($playerinfo['credits'] < $total_cost) {
        echo $langvars['l_notenough_credits'] . "<br><br>";
    } elseif ($trade_organics > $planetinfo['organics']) {
        echo $langvars['l_exceed_organics'] . "  ";
    } elseif ($trade_ore > $planetinfo['ore']) {
        echo $langvars['l_exceed_ore'] . "  ";
    } elseif ($trade_goods > $planetinfo['goods']) {
        echo $langvars['l_exceed_goods'] . "  ";
    } elseif ($trade_energy > $planetinfo['energy']) {
        echo $langvars['l_exceed_energy'] . "  ";
    } else {
        echo $langvars['l_totalcost'] . ": {$total_cost}<br>" . $langvars['l_traded_ore'] . ": {$trade_ore}<br>" . $langvars['l_traded_organics'] . ": {$trade_organics}<br>" . $langvars['l_traded_goods'] . ": {$trade_goods}<br>" . $langvars['l_traded_energy'] . ": {$trade_energy}<br><br>";
        // Update ship cargo, credits and turns
        $trade_result = $db->Execute("UPDATE {$db->prefix}ships SET turns = turns - 1, turns_used = turns_used + 1, credits = credits - ?, ship_ore = ship_ore + ?, ship_organics = ship_organics + ?, " . "ship_goods = ship_goods + ?, ship_energy = ship_energy + ? WHERE ship_id = ?;", array($total_cost, $trade_ore, $trade_organics, $trade_goods, $trade_energy, $playerinfo['ship_id']));
        Tki\Db::LogDbErrors($pdo_db, $trade_result, __LINE__, __FILE__);
        $trade_result2 = $db->Execute("UPDATE {$db->prefix}planets SET ore = ore - ?, organics = organics - ?, goods = goods - ?, energy = energy - ?, credits = credits + ? WHERE planet_id = ?;", array($trade_ore, $trade_organics, $trade_goods, $trade_energy, $total_cost, $planet_id));
        Tki\Db::LogDbErrors($pdo_db, $trade_result2, __LINE__, __FILE__);
        echo $langvars['l_trade_complete'] . "<br><br>";
    }
}
Tki\Score::updateScore($pdo_db, $playerinfo['ship_id'], $tkireg, $playerinfo);
Tki\Text::gotomain($pdo_db, $lang);
Tki\Footer::display($pdo_db, $lang, $tkireg, $template);
Пример #10
0
             $search_query = $search_query . ",a" . $j . ".link_dest ";
         }
         $search_query = $search_query . ")";
     }
     $search_query = $search_query . "ORDER BY a1.link_start, a1.link_dest ";
     for ($i = 2; $i <= $search_depth; $i++) {
         $search_query = $search_query . ", a" . $i . ".link_dest";
     }
     $search_query = $search_query . " LIMIT 1";
     //echo "$search_query\n\n";
     $db->SetFetchMode(ADODB_FETCH_NUM);
     $search_result = $db->Execute($search_query);
     if ($search_result === false) {
         die('Invalid query');
     } else {
         Tki\Db::LogDbErrors($pdo_db, $search_result, __LINE__, __FILE__);
         $found = $search_result->RecordCount();
         if ($found > 0) {
             break;
         }
     }
 }
 if ($found > 0) {
     echo "<h3>" . $langvars['l_nav_pathfnd'] . "</h3>\n";
     $links = $search_result->fields;
     echo $links[0];
     for ($i = 1; $i < $search_depth + 1; $i++) {
         echo " >> " . $links[$i];
     }
     $db->SetFetchMode(ADODB_FETCH_ASSOC);
     echo "<br><br>";
Пример #11
0
header('X-Content-Type-Options: nosniff');
// Prevents MIME-sniffing away from the declared content-type.
ob_start(array('Tki\\Compress', 'compress'));
// Start a buffer, and when it closes (at the end of a request),
// call the callback function 'Tki\Compress' to properly handle
// detection of compression.
$pdo_db = new Tki\Db();
$pdo_db = $pdo_db->initDb('pdo');
// Connect to db using pdo
$db = new Tki\Db();
$db = $db->initDb('adodb');
// Connect to db using adodb also - for now - to be eliminated!
if ($pdo_db !== null) {
    $tkireg = new Tki\Reg($pdo_db);
    // TKI Registry object -  passing config variables via classes
    $tkireg->tkitimer = new Tki\Timer();
    // Create a benchmark timer to get benchmarking data for everything
    $tkireg->tkitimer->start();
    // Start benchmarking immediately
}
$langvars = null;
// Language variables in every page, set them to a null value first
$template = new \Tki\Smarty();
$template->setTheme($tkireg->default_template);
if ($pdo_db !== null && Tki\Db::isActive($pdo_db)) {
    $tki_session = new Tki\Sessions($pdo_db);
    session_start();
}
$lang = $tkireg->default_lang;
use Symfony\Component\HttpFoundation\Request;
$request = Request::createFromGlobals();
Пример #12
0
$owner = 1;
$team_zone = 'N';
$allow_beacon = 'Y';
$allow_attack = 'Y';
$allow_planetattack = 'Y';
$allow_warpedit = 'Y';
$allow_planet = 'Y';
$allow_trade = 'Y';
$allow_defenses = 'Y';
$max_hull = '0';
$stmt = $pdo_db->prepare($sql);
$stmt->bindParam(':zone_name', $tkireg->admin_zone_name);
$stmt->bindValue(':owner', 0);
$stmt->bindParam(':team_zone', $team_zone);
$stmt->bindParam(':allow_beacon', $allow_beacon);
$stmt->bindParam(':allow_attack', $allow_attack);
$stmt->bindParam(':allow_planetattack', $allow_planetattack);
$stmt->bindParam(':allow_warpedit', $allow_warpedit);
$stmt->bindParam(':allow_planet', $allow_planet);
$stmt->bindParam(':allow_trade', $allow_trade);
$stmt->bindParam(':allow_defenses', $allow_defenses);
$stmt->bindParam(':max_hull', $max_hull);
$resxx = $stmt->execute();
$variables['admin_zone_results']['result'] = Tki\Db::logDbErrors($pdo_db, $resxx, __LINE__, __FILE__);
$local_table_timer->stop();
$variables['admin_zone_results']['elapsed'] = $local_table_timer->elapsed();
Tki\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/80.tpl');
Tki\Footer::display($pdo_db, $lang, $tkireg, $template);
Пример #13
0
shuffle($sql_query);
// FUTURE: This select should have an error check that is reflected in the template
//$catch_results[$z] = Tki\Db::logDbErrors($pdo_db, $sql_query, __LINE__, __FILE__);
$z++;
for ($i = 1; $i <= $loops; $i++) {
    $update = "UPDATE ::prefix::universe SET port_type='energy',port_ore={$initbore},port_organics={$initborganics},port_goods={$initsgoods},port_energy={$initbenergy} WHERE ";
    for ($j = $start; $j < $finish; $j++) {
        $update .= "(port_type='none' and sector_id=" . $sql_query[$j] . ")";
        if ($j < $finish - 1) {
            $update .= " or ";
        } else {
            $update .= ";";
        }
    }
    $resx = $pdo_db->exec($update);
    $variables['insert_energy_ports'][$i]['result'] = Tki\Db::logDbErrors($pdo_db, $resx, __LINE__, __FILE__);
    $catch_results[$z] = $variables['insert_energy_ports'][$i]['result'];
    $z++;
    $local_table_timer->stop();
    $variables['insert_energy_ports'][$i]['elapsed'] = $local_table_timer->elapsed();
    $variables['insert_energy_ports'][$i]['loop'] = $i;
    $variables['insert_energy_ports'][$i]['loops'] = $loops;
    $variables['insert_energy_ports'][$i]['start'] = $start + 1;
    $variables['insert_energy_ports'][$i]['finish'] = $finish;
    $start = $finish;
    $finish += $loopsize;
    if ($finish > $variables['enp']) {
        $finish = $variables['enp'];
    }
}
for ($t = 0; $t < $z; $t++) {
Пример #14
0
    // Checking IBANK Loan Credits
    if ($bankinfo['loan'] < 0) {
        echo "'-> <span style='color:#f00;'>Detected Loan Credits Flip on IBANK Account: {$bankinfo['ship_id']}.</span> <span style='color:#0f0;'>*** FIXED ***</span><br>\n";
        $resk = $db->Execute("UPDATE {$db->prefix}ibank_accounts SET loan = ? WHERE ship_id = ? LIMIT 1;", array(0, $bankinfo['ship_id']));
        Tki\Db::LogDbErrors($pdo_db, $resk, __LINE__, __FILE__);
        if ($db->ErrorNo() > 0) {
            echo "error: " . $db->ErrorMsg() . "<br>\n";
        }
        $detected = (bool) true;
        Tki\AdminLog::writeLog($pdo_db, 960, "21|{$bankinfo['ship_id']}|{$bankinfo['balance']}");
    }
    $tdres->MoveNext();
}
echo "Validating IBANK Transfer Amount Credits...<br>\n";
$tdres = $db->Execute("SELECT transfer_id, source_id, dest_id, amount FROM {$db->prefix}ibank_transfers");
Tki\Db::LogDbErrors($pdo_db, $tdres, __LINE__, __FILE__);
/*
while (!$tdres->EOF)
{
    $transferinfo = $tdres->fields;

    // Checking IBANK Transfer Amount Credits
    if ($transferinfo['amount'] < 0)
    {
        echo "'-> <span style='color:#f00;'>Detected Transfer Amount Credits Flip on IBANK Transfer: {$transferinfo['ship_id']}.</span> <span style='color:#0f0;'>*** FIXED ***</span><br>\n";
        $db->Execute ("UPDATE {$db->prefix}ibank_transfers SET amount = ? WHERE transfer_id = ? LIMIT 1;", array(0, $transferinfo['transfer_id']));
        if ($db->ErrorNo() > 0)
        {
            echo "error: ". $db->ErrorMsg() . "<br>\n";
        }
        $detected = (bool) true;
Пример #15
0
$gameconfig_result = Tki\File::iniToDb($pdo_db, "config/classic_config.ini", "gameconfig", "game", $tkireg);
$local_table_timer->stop();
if ($gameconfig_result === true) {
    $variables['import_config_results']['result'] = true;
    $variables['import_config_results']['time'] = $local_table_timer->elapsed();
} else {
    $variables['import_config_results']['result'] = $gameconfig_result;
    $variables['import_config_results']['time'] = $local_table_timer->elapsed();
}
$catch_results[$z] = $gameconfig_result;
$z++;
for ($t = 0; $t < $z; $t++) {
    if ($catch_results[$t] !== true) {
        $variables['autorun'] = false;
        // We disable autorun if any errors occur in processing
    }
}
// Write the number of sectors chosen during CU to the database
$local_table_timer->start();
// Start benchmarking
$stmt = $pdo_db->prepare("UPDATE ::prefix::gameconfig SET value = ? WHERE name='max_sectors'");
$result = $stmt->execute(array($variables['max_sectors']));
$local_table_timer->stop();
$variables['update_config_results']['result'] = Tki\Db::logDbErrors($pdo_db, $result, __LINE__, __FILE__);
$variables['update_config_results']['time'] = $local_table_timer->elapsed();
$lang = $tkireg->default_lang;
Tki\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/50.tpl');
Tki\Footer::display($pdo_db, $lang, $tkireg, $template);
Пример #16
0
    $variables['insert_random_twoway_result'][$i]['start'] = $start;
    $variables['insert_random_twoway_result'][$i]['finish'] = $finish;
    $start = $finish + 1;
    $finish += $loopsize;
    if ($finish > $tkireg->max_sectors) {
        $finish = $tkireg->max_sectors;
    }
}
$local_table_timer->start();
// Start benchmarking
$sql = "DELETE FROM ::prefix::links WHERE link_start = :linkstart OR link_dest = :linkdest";
$stmt = $pdo_db->prepare($sql);
$stmt->bindParam(':linkstart', $tkireg->max_sectors);
$stmt->bindParam(':linkdest', $tkireg->max_sectors);
$resx = $stmt->execute();
$variables['remove_links_results']['result'] = Tki\Db::logDbErrors($pdo_db, $resx, __LINE__, __FILE__);
$catch_results[$z] = $variables['remove_links_results']['result'];
$z++;
$local_table_timer->stop();
$variables['remove_links_results']['elapsed'] = $local_table_timer->elapsed();
for ($t = 0; $t < $z; $t++) {
    if ($catch_results[$t] !== true) {
        $variables['autorun'] = false;
        // We disable autorun if any errors occur in processing
    }
}
Tki\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/70.tpl');
Tki\Footer::display($pdo_db, $lang, $tkireg, $template);