$variables['oep'] = round($variables['max_sectors'] * filter_input(INPUT_POST, 'ore', FILTER_SANITIZE_NUMBER_INT) / 100); $variables['ogp'] = round($variables['max_sectors'] * filter_input(INPUT_POST, 'organics', FILTER_SANITIZE_NUMBER_INT) / 100); $variables['gop'] = round($variables['max_sectors'] * filter_input(INPUT_POST, 'goods', FILTER_SANITIZE_NUMBER_INT) / 100); $variables['enp'] = round($variables['max_sectors'] * filter_input(INPUT_POST, 'energy', FILTER_SANITIZE_NUMBER_INT) / 100); $variables['nump'] = round($variables['max_sectors'] * filter_input(INPUT_POST, 'planets', FILTER_SANITIZE_NUMBER_INT) / 100); $variables['empty'] = $variables['max_sectors'] - $variables['spp'] - $variables['oep'] - $variables['ogp'] - $variables['gop'] - $variables['enp']; $variables['initscommod'] = filter_input(INPUT_POST, 'initscommod', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); $variables['initbcommod'] = filter_input(INPUT_POST, 'initbcommod', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); $variables['fedsecs'] = filter_input(INPUT_POST, 'fedsecs', FILTER_SANITIZE_NUMBER_INT); $variables['loops'] = filter_input(INPUT_POST, 'loops', FILTER_SANITIZE_NUMBER_INT); $variables['swordfish'] = filter_input(INPUT_POST, 'swordfish', FILTER_SANITIZE_URL); $variables['autorun'] = filter_input(INPUT_POST, 'autorun', FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); // Database driven language entries $langvars = Tki\Translate::load($pdo_db, $lang, array('common', 'regional', 'footer', 'global_includes', 'create_universe', 'news')); $variables['update_ticks_results']['sched'] = $tkireg->sched_ticks; $local_table_timer = new Tki\Timer(); $now = time(); $local_table_timer->start(); // Start benchmarking for turns scheduler $sched_file = 'sched_turns.php'; $sql = "INSERT INTO ::prefix::scheduler (run_once, ticks_full, sched_file, last_run) VALUES ('N', :ticks_full, :sched_file, :last_run)"; $stmt = $pdo_db->prepare($sql); $stmt->bindParam(':ticks_full', $tkireg->sched_turns); $stmt->bindParam(':sched_file', $sched_file); $stmt->bindParam(':last_run', $now); $resxx = $stmt->execute(); $variables['update_turns_results']['result'] = Tki\Db::logDbErrors($pdo_db, $resxx, __LINE__, __FILE__); $variables['update_turns_results']['sched'] = $tkireg->sched_turns; $local_table_timer->stop(); $variables['update_turns_results']['elapsed'] = $local_table_timer->elapsed(); $local_table_timer->start();
$variables['spp'] = filter_input(INPUT_POST, 'spp', FILTER_SANITIZE_NUMBER_INT); $variables['oep'] = filter_input(INPUT_POST, 'oep', FILTER_SANITIZE_NUMBER_INT); $variables['ogp'] = filter_input(INPUT_POST, 'ogp', FILTER_SANITIZE_NUMBER_INT); $variables['gop'] = filter_input(INPUT_POST, 'gop', FILTER_SANITIZE_NUMBER_INT); $variables['enp'] = filter_input(INPUT_POST, 'enp', FILTER_SANITIZE_NUMBER_INT); $variables['nump'] = filter_input(INPUT_POST, 'nump', FILTER_SANITIZE_NUMBER_INT); $variables['empty'] = $variables['max_sectors'] - $variables['spp'] - $variables['oep'] - $variables['ogp'] - $variables['gop'] - $variables['enp']; $variables['initscommod'] = filter_input(INPUT_POST, 'initscommod', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); $variables['initbcommod'] = filter_input(INPUT_POST, 'initbcommod', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); $variables['fedsecs'] = filter_input(INPUT_POST, 'fedsecs', FILTER_SANITIZE_NUMBER_INT); $variables['loops'] = filter_input(INPUT_POST, 'loops', FILTER_SANITIZE_NUMBER_INT); $variables['swordfish'] = filter_input(INPUT_POST, 'swordfish', FILTER_SANITIZE_URL); $variables['autorun'] = filter_input(INPUT_POST, 'autorun', FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); // Database driven language entries $langvars = Tki\Translate::load($pdo_db, $lang, array('common', 'regional', 'footer', 'global_includes', 'create_universe', 'news')); $local_table_timer = new Tki\Timer(); $z = 0; $i = 0; $language_files = new DirectoryIterator("languages/"); $lang_file_import_results = array(); foreach ($language_files as $language_filename) { if ($language_filename->isFile() && $language_filename->getExtension() == 'ini') { $lang_name = mb_substr($language_filename->getFilename(), 0, -4); // Import Languages $local_table_timer->start(); // Start benchmarking $lang_result = Tki\File::iniToDb($pdo_db, "languages/" . $language_filename->getFilename(), "languages", $lang_name, $tkireg); $local_table_timer->stop(); $variables['import_lang_results'][$i]['time'] = $local_table_timer->elapsed(); $variables['import_lang_results'][$i]['name'] = ucwords($lang_name); $variables['import_lang_results'][$i]['result'] = $lang_result;
$variables['fedsecs'] = filter_input(INPUT_POST, 'fedsecs', FILTER_SANITIZE_NUMBER_INT); $variables['loops'] = filter_input(INPUT_POST, 'loops', FILTER_SANITIZE_NUMBER_INT); $variables['swordfish'] = filter_input(INPUT_POST, 'swordfish', FILTER_SANITIZE_URL); $variables['autorun'] = filter_input(INPUT_POST, 'autorun', FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); // Database driven language entries $langvars = Tki\Translate::load($pdo_db, $lang, array('common', 'regional', 'footer', 'global_includes', 'create_universe', 'news')); $z = 0; $initsore = $tkireg->ore_limit * $variables['initscommod'] / 100.0; $initsorganics = $tkireg->organics_limit * $variables['initscommod'] / 100.0; $initsgoods = $tkireg->goods_limit * $variables['initscommod'] / 100.0; $initsenergy = $tkireg->energy_limit * $variables['initscommod'] / 100.0; $initbore = $tkireg->ore_limit * $variables['initbcommod'] / 100.0; $initborganics = $tkireg->organics_limit * $variables['initbcommod'] / 100.0; $initbgoods = $tkireg->goods_limit * $variables['initbcommod'] / 100.0; $initbenergy = $tkireg->energy_limit * $variables['initbcommod'] / 100.0; $local_table_timer = new Tki\Timer(); $local_table_timer->start(); // Start benchmarking $insert = $pdo_db->exec("INSERT INTO ::prefix::universe (sector_id, sector_name, zone_id, port_type, port_organics, port_ore, port_goods, port_energy, beacon, angle1, angle2, distance) VALUES ('1', 'Sol', '1', 'special', '0', '0', '0', '0', 'Sol: Hub of the Universe', '0', '0', '0')"); $variables['create_sol_results']['result'] = Tki\Db::logDbErrors($pdo_db, $insert, __LINE__, __FILE__); $catch_results[$z] = $variables['create_sol_results']['result']; $z++; $local_table_timer->stop(); $variables['create_sol_results']['time'] = $local_table_timer->elapsed(); $local_table_timer->start(); // Start benchmarking $insert = $pdo_db->exec("INSERT INTO ::prefix::universe (sector_id, sector_name, zone_id, port_type, port_organics, port_ore, port_goods, port_energy, beacon, angle1, angle2, distance) VALUES ('2', 'Alpha Centauri', '1', 'energy', '0', '0', '0', '0', 'Alpha Centauri: Gateway to the Galaxy', '0', '0', '1')"); $variables['create_ac_results']['result'] = Tki\Db::logDbErrors($pdo_db, $insert, __LINE__, __FILE__); $catch_results[$z] = $variables['create_ac_results']['result']; $z++; $local_table_timer->stop();
$variables['oep'] = filter_input(INPUT_POST, 'oep', FILTER_SANITIZE_NUMBER_INT); $variables['ogp'] = filter_input(INPUT_POST, 'ogp', FILTER_SANITIZE_NUMBER_INT); $variables['gop'] = filter_input(INPUT_POST, 'gop', FILTER_SANITIZE_NUMBER_INT); $variables['enp'] = filter_input(INPUT_POST, 'enp', FILTER_SANITIZE_NUMBER_INT); $variables['nump'] = filter_input(INPUT_POST, 'nump', FILTER_SANITIZE_NUMBER_INT); $variables['empty'] = $variables['max_sectors'] - $variables['spp'] - $variables['oep'] - $variables['ogp'] - $variables['gop'] - $variables['enp']; $variables['initscommod'] = filter_input(INPUT_POST, 'initscommod', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); $variables['initbcommod'] = filter_input(INPUT_POST, 'initbcommod', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); $variables['fedsecs'] = filter_input(INPUT_POST, 'fedsecs', FILTER_SANITIZE_NUMBER_INT); $variables['loops'] = filter_input(INPUT_POST, 'loops', FILTER_SANITIZE_NUMBER_INT); $variables['swordfish'] = filter_input(INPUT_POST, 'swordfish', FILTER_SANITIZE_URL); $variables['autorun'] = filter_input(INPUT_POST, 'autorun', FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); // Database driven language entries $langvars = Tki\Translate::load($pdo_db, $lang, array('common', 'regional', 'footer', 'global_includes', 'create_universe', 'news')); $z = 0; $local_table_timer = new Tki\Timer(); $local_table_timer->start(); // Start benchmarking // Get the sector id for any sector that allows planets $sth = $pdo_db->prepare("SELECT ::prefix::universe.sector_id FROM ::prefix::universe, ::prefix::zones WHERE ::prefix::zones.zone_id=::prefix::universe.zone_id AND ::prefix::zones.allow_planet='Y'"); $sth->execute(); // Place those id's into an array. $open_sectors_result = $sth->fetchAll(); $catch_results[$z] = Tki\Db::logDbErrors($pdo_db, $open_sectors_result, __LINE__, __FILE__); $z++; $i = 0; foreach ($open_sectors_result as $element) { $open_sectors_array[$i] = $element['sector_id']; // Lets trim that 2d array down to a single array $i++; }