require_once './common.php'; Tki\Login::checkLogin($pdo_db, $lang, $tkireg, $template); // Database driven language entries $langvars = Tki\Translate::load($pdo_db, $lang, array('ibank', 'common', 'global_includes', 'global_funcs', 'footer', 'news', 'regional')); $title = $langvars['l_ibank_title']; $body_class = 'ibank'; Tki\Header::display($pdo_db, $lang, $template, $title, $body_class); $stmt = $pdo_db->prepare("SELECT * FROM ::prefix::ships WHERE email=:email"); $stmt->bindParam(':email', $_SESSION['username']); $result = $stmt->execute(); Tki\Db::logDbErrors($pdo_db, $result, __LINE__, __FILE__); $playerinfo = $stmt->fetch(PDO::FETCH_ASSOC); $stmt = $pdo_db->prepare("SELECT * FROM ::prefix::ibank_accounts WHERE ship_id=:ship_id"); $stmt->bindParam(':ship_id', $playerinfo['ship_id']); $result = $stmt->execute(); Tki\Db::logDbErrors($pdo_db, $result, __LINE__, __FILE__); $account = $stmt->fetch(PDO::FETCH_ASSOC); echo "<body class='" . $body_class . "'>"; echo "<center>"; echo '<img src="' . $template->getVariables('template_dir') . '/images/div1.png" alt="" style="width: 600px; height:21px">'; echo '<div style="width:600px; max-width:600px;" class="ibank">'; echo '<table style="width:600px; height:350px;" border="0px">'; echo '<tr><td style="background-image:URL(' . $template->getVariables('template_dir') . '/images/ibankscreen.png); background-repeat:no-repeat;" align="center">'; echo '<table style="width:550px; height:300px;" border="0px">'; if (!$tkireg->allow_ibank) { Tki\Ibank::ibankError($pdo_db, $langvars, $langvars['l_ibank_malfunction'], "main.php", $lang, $tkireg, $template); } // Detect if this variable exists, and filter it. Returns false if anything wasn't right. $command = null; $command = filter_input(INPUT_GET, 'command', FILTER_SANITIZE_STRING); if (mb_strlen(trim($command)) === 0) {
$lang_dir = new DirectoryIterator('languages/'); $lang_list = array(); $i = 0; foreach ($lang_dir as $file_info) { // If it is a PHP file, add it to the list of accepted language files if ($file_info->isFile() && $file_info->getExtension() == 'php') { $lang_file = mb_substr($file_info->getFilename(), 0, -8); // The actual file name // Select from the database and return the localized name of the language $query = "SELECT value FROM ::prefix::languages WHERE category = 'regional' AND section = :section AND name = 'local_lang_name';"; $result = $pdo_db->prepare($query); Tki\Db::logDbErrors($pdo_db, $query, __LINE__, __FILE__); if ($result !== false) { $result->bindParam(':section', $lang_file); $final_result = $result->execute(); Tki\Db::logDbErrors($pdo_db, $query, __LINE__, __FILE__); $row = $result->fetch(); if ($row !== false) { $variables['lang_list'][$i]['value'] = $row['value']; } else { // Load language ini file to get regional local_lang_name value $ini_file = './languages/' . $lang_file . '.ini'; $parsed_lang_file = parse_ini_file($ini_file, true); $variables['lang_list'][$i]['value'] = $parsed_lang_file['regional']['local_lang_name']; } } else { // Load language ini file to get regional local_lang_name value $ini_file = './languages/' . $lang_file . '.ini'; $parsed_lang_file = parse_ini_file($ini_file, true); $variables['lang_list'][$i]['value'] = $parsed_lang_file['regional']['local_lang_name']; }
$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);
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++) {
$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);
$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);