예제 #1
0
 /**
  * buildPages
  *
  * @return void
  */
 private function buildPage()
 {
     $parse = $this->langs;
     if ($_POST) {
         $login = parent::$db->queryFetch("SELECT `user_id`, `user_name`, `user_password`, `user_banned`\n                FROM " . USERS . "\n                WHERE `user_name` = '" . parent::$db->escapeValue($_POST['login']) . "'\n                AND `user_password` = '" . sha1($_POST['pass']) . "'\n                LIMIT 1");
         if ($login['user_banned'] <= time()) {
             $this->removeBan($login['user_name']);
         }
         if ($login) {
             // User login
             if (parent::$users->user_login($login['user_id'], $login['user_name'], $login['user_password'])) {
                 // Update current planet
                 parent::$db->query("UPDATE " . USERS . " SET\n                        `user_current_planet` = `user_home_planet_id`\n                        WHERE `user_id` ='" . $login['user_id'] . "'");
                 // Redirect to game
                 FunctionsLib::redirect('game.php?page=overview');
             }
         }
         // If login fails
         FunctionsLib::redirect('index.php');
     } else {
         $parse['year'] = date('Y');
         $parse['version'] = VERSION;
         $parse['servername'] = FunctionsLib::read_config('game_name');
         $parse['game_logo'] = FunctionsLib::read_config('game_logo');
         $parse['forum_url'] = FunctionsLib::read_config('forum_url');
         $parse['js_path'] = JS_PATH . 'home/';
         $parse['css_path'] = CSS_PATH . 'home/';
         $parse['img_path'] = IMG_PATH . 'home/';
         $parse['base_path'] = BASE_PATH;
         parent::$page->display(parent::$page->parse_template(parent::$page->get_template('home/index_body'), $parse), false, '', false);
     }
 }
예제 #2
0
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     $parse = $this->_lang;
     $modules_array = '';
     $modules_count = count(explode(';', FunctionsLib::read_config('modules')));
     $row_template = parent::$page->get_template('adm/modules_row_view');
     $module_rows = '';
     $parse['alert'] = '';
     // SAVE PAGE
     if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['save']) {
         for ($i = 0; $i <= $modules_count - 2; $i++) {
             $modules_array .= (isset($_POST["status{$i}"]) ? 1 : 0) . ';';
         }
         FunctionsLib::update_config('modules', $modules_array);
         $parse['alert'] = AdministrationLib::save_message('ok', $this->_lang['se_all_ok_message']);
     }
     // SHOW PAGE
     $modules_array = explode(';', FunctionsLib::read_config('modules'));
     foreach ($modules_array as $module => $status) {
         if ($status != NULL) {
             $parse['module'] = $module;
             $parse['module_name'] = $this->_lang['module'][$module];
             $parse['module_value'] = $status == 1 ? 'checked' : '';
             $parse['color'] = $status == 1 ? 'text-success' : 'text-error';
             $module_rows .= parent::$page->parse_template($row_template, $parse);
         }
     }
     $parse['module_rows'] = $module_rows;
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template("adm/modules_view"), $parse));
 }
예제 #3
0
 /**
  * __construct()
  */
 public function __construct()
 {
     parent::__construct();
     $this->langs = parent::$lang;
     if ($this->serverRequirementes()) {
         $this->buildPage();
     } else {
         die(FunctionsLib::message($this->langs['ins_no_server_requirements']));
     }
 }
예제 #4
0
 /**
  * __construct()
  */
 public function __construct()
 {
     parent::__construct();
     // check if session is active
     parent::$users->check_session();
     // Check module access
     FunctionsLib::module_message(FunctionsLib::is_module_accesible(self::MODULE_ID));
     $this->_lang = parent::$lang;
     $this->build_page();
 }
예제 #5
0
 /**
  * __construct()
  */
 public function __construct()
 {
     parent::__construct();
     // check if session is active
     parent::$users->check_session();
     // Check module access
     FunctionsLib::module_message(FunctionsLib::is_module_accesible(self::MODULE_ID));
     $this->_lang = parent::$lang;
     $this->_resource = parent::$objects->getObjects();
     $this->_requeriments = parent::$objects->getRelations();
     $this->_current_user = parent::$users->get_user_data();
     $this->_current_planet = parent::$users->get_planet_data();
     $this->build_page();
 }
예제 #6
0
 /**
  * __construct()
  */
 public function __construct()
 {
     parent::__construct();
     // check if session is active
     parent::$users->check_session();
     $this->_lang = parent::$lang;
     $this->_current_user = parent::$users->get_user_data();
     // Check if the user is allowed to access
     if (AdministrationLib::have_access($this->_current_user['user_authlevel']) && AdministrationLib::authorization($this->_current_user['user_authlevel'], 'config_game') == 1) {
         $this->build_page($this->_current_user);
     } else {
         die(FunctionsLib::message($this->_lang['ge_no_permissions']));
     }
 }
예제 #7
0
 /**
  * method missile_mission
  * param $fleet_row
  * return the missile result
  */
 public function missileMission($fleet_row)
 {
     if ($fleet_row['fleet_start_time'] <= time()) {
         if ($fleet_row['fleet_mess'] == 0) {
             $attacker_data = parent::$db->queryFetch("SELECT p.`planet_name`, r.`research_weapons_technology`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . PLANETS . " AS p\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . RESEARCH . " AS r ON r.research_user_id = p.planet_user_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_galaxy` = " . $fleet_row['fleet_start_galaxy'] . " AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_system` = " . $fleet_row['fleet_start_system'] . " AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_planet` = " . $fleet_row['fleet_start_planet'] . " AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_type` = " . $fleet_row['fleet_start_type'] . ";");
             $target_data = parent::$db->queryFetch("SELECT p.`planet_id`, p.`planet_name`, p.`planet_user_id`, d.*, r.`research_shielding_technology`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . PLANETS . " AS p\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . DEFENSES . " AS d ON d.defense_planet_id = p.`planet_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . RESEARCH . " AS r ON r.research_user_id = p.planet_user_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_galaxy` = " . $fleet_row['fleet_end_galaxy'] . " AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_system` = " . $fleet_row['fleet_end_system'] . " AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_planet` = " . $fleet_row['fleet_end_planet'] . " AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_type` = " . $fleet_row['fleet_end_type'] . ";");
             if ($target_data['defense_anti-ballistic_missile'] >= $fleet_row['fleet_amount']) {
                 $message = $this->_lang['ma_all_destroyed'] . '<br>';
                 $amount = $fleet_row['fleet_amount'];
             } else {
                 $amount = 0;
                 if ($target_data['defense_anti-ballistic_missile'] > 0) {
                     $message = $target_data['defense_anti-ballistic_missile'] . $this->_lang['ma_some_destroyed'] . " <br>";
                 }
                 $attack = floor(($fleet_row['fleet_amount'] - $target_data['defense_anti-ballistic_missile']) * ($this->_combat_caps[503]['attack'] * (1 + $attacker_data['research_weapons_technology'] / 10)));
                 $attack_order = $this->set_attack_order($fleet_row['fleet_target_obj']);
                 $destroyed_query = '';
                 // PROCESS THE MISSILE ATTACK
                 for ($t = 0; $t < count($attack_order); $t++) {
                     $n = $attack_order[$t];
                     if ($target_data[$this->_resource[$n]]) {
                         $defense = ($this->_pricelist[$n]['metal'] + parent::$_pricelist[$n]['crystal']) / 10 * (1 + $target_data['research_shielding_technology'] / 10);
                         if ($attack >= $defense * $target_data[$this->_resource[$n]]) {
                             $destroyed = $target_data[$this->_resource[$n]];
                         } else {
                             $destroyed = floor($attack / $defense);
                         }
                         $attack -= $destroyed * $defense;
                         if ($destroyed != 0) {
                             $message .= $this->_lang['tech'][$n] . " (-" . $destroyed . ")<br>";
                             $destroyed_query .= "`" . $this->_resource[$n] . "` = `" . $this->_resource[$n] . "` - " . $destroyed . ",";
                         }
                     }
                 }
                 if ($destroyed_query != '') {
                     parent::$db->query("UPDATE " . DEFENSES . " SET\n\t\t\t\t\t\t\t\t\t\t\t\t{$destroyed_query}\n\t\t\t\t\t\t\t\t\t\t\t\t`defense_anti-ballistic_missile` = '" . $amount . "'\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE defense_planet_id = " . $target_data['id']);
                 }
             }
             $search = array('%1%', '%2%', '%3%');
             $replace = array($fleet_row['fleet_amount'], $attacker_data['planet_name'] . ' [' . $fleet_row['fleet_start_galaxy'] . ':' . $fleet_row['fleet_start_system'] . ':' . $fleet_row['fleet_start_planet'] . '] ', $target_data['name'] . ' [' . $fleet_row['fleet_end_galaxy'] . ':' . $fleet_row['fleet_end_system'] . ':' . $fleet_row['fleet_end_planet'] . '] ');
             $message_vorlage = str_replace($search, $replace, $this->_lang['ma_missile_string']);
             if (empty($message) or $message == '') {
                 $message = $this->_lang['ma_planet_without_defens'];
             }
             FunctionsLib::send_message($target_data['planet_user_id'], '', $fleet_row['fleet_end_time'], 5, $this->_lang['sys_mess_tower'], $this->_lang['gl_missile_attack'], $message_vorlage . $message);
             parent::remove_fleet($fleet_row['fleet_id']);
         }
     }
 }
예제 #8
0
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     // RUN STATISTICS SCRIPT AND THE SET THE RESULT
     $result = StatisticsLib::make_stats();
     // PREPARE DATA TO PARSE
     $parse = $this->_lang;
     $parse['memory_p'] = str_replace(array("%p", "%m"), $result['memory_peak'], $this->_lang['sb_top_memory']);
     $parse['memory_e'] = str_replace(array("%e", "%m"), $result['end_memory'], $this->_lang['sb_final_memory']);
     $parse['memory_i'] = str_replace(array("%i", "%m"), $result['initial_memory'], $this->_lang['sb_start_memory']);
     $parse['alert'] = AdministrationLib::save_message('ok', str_replace("%t", $result['totaltime'], $this->_lang['sb_stats_update']));
     // UPDATE STATISTICS LAST UPDATE
     FunctionsLib::update_config('stat_last_update', $result['stats_time']);
     // SHOW TEMPLATE
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/buildstats_view'), $parse));
 }
예제 #9
0
 /**
  * __construct()
  */
 public function __construct()
 {
     parent::__construct();
     // check if session is active
     parent::$users->check_session();
     $this->_lang = parent::$lang;
     $this->_current_user = parent::$users->get_user_data();
     // Check if the user is allowed to access
     if (AdministrationLib::have_access($this->_current_user['user_authlevel']) && $this->_current_user['user_authlevel'] == 3) {
         include_once XGP_ROOT . 'application/libraries/CreatorLib.php';
         $this->_creator = new CreatorLib();
         $this->build_page();
     } else {
         die(FunctionsLib::message($this->_lang['ge_no_permissions']));
     }
 }
예제 #10
0
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     $parse = $this->_lang;
     $parse['alert'] = '';
     if (isset($_POST['opt_save']) && $_POST['opt_save'] == '1') {
         // CHECK BEFORE SAVE
         $this->run_validations();
         FunctionsLib::update_config('reg_enable', $this->_game_config['reg_enable']);
         FunctionsLib::update_config('reg_welcome_message', $this->_game_config['reg_welcome_message']);
         FunctionsLib::update_config('reg_welcome_email', $this->_game_config['reg_welcome_email']);
         $parse['alert'] = AdministrationLib::save_message('ok', $this->_lang['ur_all_ok_message']);
     }
     $parse['reg_closed'] = $this->_game_config['reg_enable'] == 1 ? " checked = 'checked' " : "";
     $parse['reg_welcome_message'] = $this->_game_config['reg_welcome_message'] == 1 ? " checked = 'checked' " : "";
     $parse['reg_welcome_email'] = $this->_game_config['reg_welcome_email'] == 1 ? " checked = 'checked' " : "";
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/registration_view'), $parse));
 }
예제 #11
0
 /**
  * method calculate_points
  * param $element
  * param $level
  * return the points for the current element and level
  */
 public static function calculate_points($element, $level, $type = '')
 {
     switch ($type) {
         case 'tech':
             $current_level = $level;
             break;
         case '':
         default:
             $current_level = $level - 1 < 0 ? 0 : $level - 1;
             break;
     }
     $element = parent::$objects->getPrice($element);
     $resources_total = $element['metal'] + $element['crystal'] + $element['deuterium'];
     $level_mult = pow($element['factor'], $current_level);
     $points = $resources_total * $level_mult / FunctionsLib::read_config('stat_settings');
     return $points;
 }
예제 #12
0
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     $parse = $this->_lang;
     $parse['alert'] = '';
     if (isset($_POST['opt_save']) && $_POST['opt_save'] == '1') {
         // CHECK BEFORE SAVE
         $this->run_validations();
         FunctionsLib::update_config('initial_fields', $this->_game_config['initial_fields']);
         FunctionsLib::update_config('metal_basic_income', $this->_game_config['metal_basic_income']);
         FunctionsLib::update_config('crystal_basic_income', $this->_game_config['crystal_basic_income']);
         FunctionsLib::update_config('deuterium_basic_income', $this->_game_config['deuterium_basic_income']);
         FunctionsLib::update_config('energy_basic_income', $this->_game_config['energy_basic_income']);
         $parse['alert'] = AdministrationLib::save_message('ok', $this->_lang['np_all_ok_message']);
     }
     $parse['initial_fields'] = $this->_game_config['initial_fields'];
     $parse['metal_basic_income'] = $this->_game_config['metal_basic_income'];
     $parse['crystal_basic_income'] = $this->_game_config['crystal_basic_income'];
     $parse['deuterium_basic_income'] = $this->_game_config['deuterium_basic_income'];
     $parse['energy_basic_income'] = $this->_game_config['energy_basic_income'];
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/planets_view'), $parse));
 }
예제 #13
0
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     $parse = $this->_lang;
     $parse['js_path'] = XGP_ROOT . JS_PATH;
     if (isset($_POST) && $_POST && $_GET['mode'] == "change") {
         $info = array(1 => array('color' => 'yellow'), 2 => array('color' => 'skyblue'), 3 => array('color' => 'red'));
         $color = $info[$this->_current_user['user_authlevel']]['color'];
         $level = $this->_lang['user_level'][$this->_current_user['user_authlevel']];
         if (isset($_POST['tresc']) && $_POST['tresc'] != '' && (isset($_POST['temat']) && $_POST['temat'] != '') && (isset($_POST['message']) or isset($_POST['mail']))) {
             $sq = parent::$db->query("SELECT `user_id` , `user_name`, `user_email`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . USERS . "");
             if (isset($_POST['message'])) {
                 $time = time();
                 $from = '<font color="' . $color . '">' . $level . ' ' . $this->_current_user['user_name'] . '</font>';
                 $subject = '<font color="' . $color . '">' . $_POST['temat'] . '</font>';
                 $message = '<font color="' . $color . '"><b>' . FunctionsLib::format_text($_POST['tresc']) . '</b></font>';
                 while ($u = parent::$db->fetchArray($sq)) {
                     FunctionsLib::send_message($u['user_id'], $this->_current_user['user_id'], $time, 5, $from, $subject, $message);
                     $_POST['tresc'] = str_replace(":name:", $u['user_name'], $_POST['tresc']);
                 }
             }
             if (isset($_POST['mail'])) {
                 $i = 0;
                 while ($u = parent::$db->fetchArray($sq)) {
                     mail($u['user_email'], $_POST['temat'], $_POST['tresc']);
                     // 20 per row
                     if ($i % 20 == 0) {
                         sleep(1);
                         // wait, prevent flooding
                     }
                     $i++;
                 }
             }
             $parse['alert'] = AdministrationLib::save_message('ok', $this->_lang['ma_message_sended']);
         } else {
             $parse['alert'] = AdministrationLib::save_message('warning', $this->_lang['ma_subject_needed']);
         }
     }
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/global_message_view'), $parse));
 }
예제 #14
0
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     $resource = parent::$objects->getObjects();
     $reslist = parent::$objects->getObjectsList();
     $planetsrow = parent::$db->query("SELECT `planet_id`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_name`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_galaxy`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_system`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_planet`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_type`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_image`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_field_current`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_field_max`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_metal`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_metal_perhour`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_crystal`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_crystal_perhour`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_deuterium`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_deuterium_perhour`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_energy_used`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_energy_max`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_metal_mine`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_crystal_mine`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_deuterium_sintetizer`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_solar_plant`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_fusion_reactor`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_robot_factory`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_nano_factory`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_hangar`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_metal_store`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_crystal_store`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_deuterium_tank`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_laboratory`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_terraformer`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_ally_deposit`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_missile_silo`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_mondbasis`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_phalanx`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_jump_gate`,\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_rocket_launcher`,\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_light_laser`,\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_heavy_laser`,\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_gauss_cannon`,\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_ion_cannon`,\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_plasma_turret`,\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_small_shield_dome`,\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_large_shield_dome`,\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_anti-ballistic_missile`,\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_interplanetary_missile`,\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_small_cargo_ship`,\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_big_cargo_ship`,\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_light_fighter`,\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_heavy_fighter`,\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_cruiser`,\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_battleship`,\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_colony_ship`,\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_recycler`,\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_espionage_probe`,\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_bomber`,\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_solar_satellite`,\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_destroyer`,\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_deathstar`,\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_battlecruiser`\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . PLANETS . " AS p\n\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . BUILDINGS . " AS b ON b.building_planet_id = p.`planet_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . DEFENSES . " AS d ON d.defense_planet_id = p.`planet_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . SHIPS . " AS s ON s.ship_planet_id = p.`planet_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_user_id` = '" . (int) $this->_current_user['user_id'] . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND `planet_destroyed` = 0;");
     $parse = $this->_lang;
     $planet = array();
     $r = array();
     $EmpireRowTPL = parent::$page->get_template('empire/empire_row');
     $f = array('file_images', 'file_names', 'file_coordinates', 'file_fields', 'file_metal', 'file_crystal', 'file_deuterium', 'file_energy');
     $m = array('build', 'tech', 'fleet', 'defense');
     $n = array('building_row', 'technology_row', 'fleet_row', 'defense_row');
     while ($p = parent::$db->fetchArray($planetsrow)) {
         $planet[] = $p;
     }
     $parse['mount'] = count($planet) + 1;
     foreach ($planet as $p) {
         $datat = array('<a href="game.php?page=overview&cp=' . $p['planet_id'] . '&amp;re=0"><img src="' . DPATH . 'planets/small/s_' . $p['planet_image'] . '.jpg" border="0" height="80" width="80"></a>', $p['planet_name'], "[<a href=\"game.php?page=galaxy&mode=3&galaxy={$p['planet_galaxy']}&system={$p['planet_system']}\">{$p['planet_galaxy']}:{$p['planet_system']}:{$p['planet_planet']}</a>]", $p['planet_field_current'] . '/' . $p['planet_field_max'], '<a href="game.php?page=resources&cp=' . $p['planet_id'] . '&amp;re=0&amp;planettype=' . $p['planet_type'] . '">' . FormatLib::pretty_number($p['planet_metal']) . '</a> / ' . FormatLib::pretty_number($p['planet_metal_perhour'] + FunctionsLib::read_config('metal_basic_income')), '<a href="game.php?page=resources&cp=' . $p['planet_id'] . '&amp;re=0&amp;planettype=' . $p['planet_type'] . '">' . FormatLib::pretty_number($p['planet_crystal']) . '</a> / ' . FormatLib::pretty_number($p['planet_crystal_perhour'] + FunctionsLib::read_config('crystal_basic_income')), '<a href="game.php?page=resources&cp=' . $p['planet_id'] . '&amp;re=0&amp;planettype=' . $p['planet_type'] . '">' . FormatLib::pretty_number($p['planet_deuterium']) . '</a> / ' . FormatLib::pretty_number($p['planet_deuterium_perhour'] + FunctionsLib::read_config('deuterium_basic_income')), FormatLib::pretty_number($p['planet_energy_max'] - $p['planet_energy_used']) . ' / ' . FormatLib::pretty_number($p['planet_energy_max']));
         for ($k = 0; $k < 8; $k++) {
             $parse[$f[$k]] = isset($parse[$f[$k]]) ? $parse[$f[$k]] : '';
             $data['text'] = $datat[$k];
             $parse[$f[$k]] .= parent::$page->parse_template($EmpireRowTPL, $data);
         }
         foreach ($resource as $i => $res) {
             $r[$i] = isset($r[$i]) ? $r[$i] : '';
             $data['text'] = !isset($p[$resource[$i]]) && !isset($this->_current_user[$resource[$i]]) ? '0' : (in_array($i, $reslist['build']) ? "<a href=\"game.php?page=" . DevelopmentsLib::set_building_page($i) . "&cp={$p['planet_id']}&amp;re=0&amp;planettype={$p['planet_type']}\">{$p[$resource[$i]]}</a>" : (in_array($i, $reslist['tech']) ? "<a href=\"game.php?page=research&cp={$p['planet_id']}&amp;re=0&amp;planettype={$p['planet_type']}\">{$this->_current_user[$resource[$i]]}</a>" : (in_array($i, $reslist['fleet']) ? "<a href=\"game.php?page=shipyard&cp={$p['planet_id']}&amp;re=0&amp;planettype={$p['planet_type']}\">{$p[$resource[$i]]}</a>" : (in_array($i, $reslist['defense']) ? "<a href=\"game.php?page=defense&cp={$p['planet_id']}&amp;re=0&amp;planettype={$p['planet_type']}\">{$p[$resource[$i]]}</a>" : '0'))));
             $r[$i] .= parent::$page->parse_template($EmpireRowTPL, $data);
         }
     }
     for ($j = 0; $j < 4; $j++) {
         foreach ($reslist[$m[$j]] as $a => $i) {
             $parse[$n[$j]] = isset($parse[$n[$j]]) ? $parse[$n[$j]] : '';
             $data['text'] = $this->_lang['tech'][$i];
             $parse[$n[$j]] .= "<tr>" . parent::$page->parse_template($EmpireRowTPL, $data) . $r[$i] . "</tr>";
         }
     }
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template('empire/empire_table'), $parse), FALSE);
 }
예제 #15
0
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     $parse = $this->_lang;
     // ON POST
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         // SAVE DATA
         if (isset($_POST['save']) && $_POST['save']) {
             FunctionsLib::update_config('auto_backup', isset($_POST['auto_backup']) && $_POST['auto_backup'] == 'on' ? 1 : 0);
         }
         // BACKUP DATABASE RIGHT NOW
         if (isset($_POST['backup']) && $_POST['backup']) {
             $result = parent::$db->backupDb();
             if ($result != FALSE) {
                 $parse['alert'] = AdministrationLib::save_message('ok', str_replace('%s', round($result / 1024, 2), $this->_lang['bku_backup_done']));
             }
         }
     }
     // PARSE DATA
     $auto_backup_status = FunctionsLib::read_config('auto_backup');
     $parse['color'] = $auto_backup_status == 1 ? 'text-success' : 'text-error';
     $parse['checked'] = $auto_backup_status == 1 ? 'checked' : '';
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template("adm/backup_view"), $parse));
 }
예제 #16
0
 /**
  * deployMission
  *
  * @param array $fleet_row Fleet row
  *
  * @return void
  */
 public function deployMission($fleet_row)
 {
     if ($fleet_row['fleet_mess'] == 0) {
         if ($fleet_row['fleet_start_time'] <= time()) {
             $target_coords = sprintf($this->_lang['sys_adress_planet'], $fleet_row['fleet_end_galaxy'], $fleet_row['fleet_end_system'], $fleet_row['fleet_end_planet']);
             $target_resources = sprintf($this->_lang['sys_stay_mess_goods'], $this->_lang['Metal'], FormatLib::pretty_number($fleet_row['fleet_resource_metal']), $this->_lang['Crystal'], FormatLib::pretty_number($fleet_row['fleet_resource_crystal']), $this->_lang['Deuterium'], FormatLib::pretty_number($fleet_row['fleet_resource_deuterium']));
             $target_message = $this->_lang['sys_stay_mess_start'] . "<a href=\"game.php?page=galaxy&mode=3&galaxy=" . $fleet_row['fleet_end_galaxy'] . "&system=" . $fleet_row['fleet_end_system'] . "\">";
             $target_message .= $target_coords . "</a>" . $this->_lang['sys_stay_mess_end'] . "<br />" . $target_resources;
             FunctionsLib::send_message($fleet_row['fleet_target_owner'], '', $fleet_row['fleet_start_time'], 5, $this->_lang['sys_mess_qg'], $this->_lang['sys_stay_mess_stay'], $target_message);
             parent::restore_fleet($fleet_row, false);
             parent::remove_fleet($fleet_row['fleet_id']);
         }
     } else {
         if ($fleet_row['fleet_end_time'] <= time()) {
             $target_coords = sprintf($this->_lang['sys_adress_planet'], $fleet_row['fleet_start_galaxy'], $fleet_row['fleet_start_system'], $fleet_row['fleet_start_planet']);
             $target_resources = sprintf($this->_lang['sys_stay_mess_goods'], $this->_lang['Metal'], FormatLib::pretty_number($fleet_row['fleet_resource_metal']), $this->_lang['Crystal'], FormatLib::pretty_number($fleet_row['fleet_resource_crystal']), $this->_lang['Deuterium'], FormatLib::pretty_number($fleet_row['fleet_resource_deuterium']));
             $target_message = $this->_lang['sys_stay_mess_back'] . "<a href=\"game.php?page=galaxy&mode=3&galaxy=" . $fleet_row['fleet_start_galaxy'] . "&system=" . $fleet_row['fleet_start_system'] . "\">";
             $target_message .= $target_coords . "</a>" . $this->_lang['sys_stay_mess_bend'] . "<br />" . $target_resources;
             FunctionsLib::send_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_end_time'], 5, $this->_lang['sys_mess_qg'], $this->_lang['sys_mess_fleetback'], $target_message);
             parent::restore_fleet($fleet_row, true);
             parent::remove_fleet($fleet_row['fleet_id']);
         }
     }
 }
예제 #17
0
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     $parse = $this->_lang;
     $query = parent::$db->query("SELECT *\n\t\t\t\t\t\t\t\t\t\t\tFROM " . BANNED . "\n\t\t\t\t\t\t\t\t\t\t\tORDER BY `banned_id`;");
     $i = 0;
     $sub_template = parent::$page->get_template('banned/banned_row');
     $body = '';
     while ($u = parent::$db->fetchArray($query)) {
         $parse['player'] = $u[1];
         $parse['reason'] = $u[2];
         $parse['since'] = date(FunctionsLib::read_config('date_format_extended'), $u[4]);
         $parse['until'] = date(FunctionsLib::read_config('date_format_extended'), $u[5]);
         $parse['by'] = $u[6];
         $i++;
         $body .= parent::$page->parse_template($sub_template, $parse);
     }
     if ($i == 0) {
         $parse['banned_msg'] = $this->_lang['bn_no_players_banned'];
     } else {
         $parse['banned_msg'] = $this->_lang['bn_exists'] . $i . $this->_lang['bn_players_banned'];
     }
     $parse['banned_players'] = $body;
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template('banned/banned_body'), $parse));
 }
예제 #18
0
 /**
  * method time_zone_picker
  * param
  * return return the select options
  */
 private function time_zone_picker()
 {
     $utc = new DateTimeZone('UTC');
     $dt = new DateTime('now', $utc);
     $time_zones = '';
     $current_time_zone = FunctionsLib::read_config('date_time_zone');
     // Get the data
     foreach (DateTimeZone::listIdentifiers() as $tz) {
         $current_tz = new DateTimeZone($tz);
         $offset = $current_tz->getOffset($dt);
         $transition = $current_tz->getTransitions($dt->getTimestamp(), $dt->getTimestamp());
         foreach ($transition as $element => $data) {
             $time_zones_data[$data['offset']][] = $tz;
         }
     }
     // Sort by key
     ksort($time_zones_data);
     // Build the combo
     foreach ($time_zones_data as $offset => $tz) {
         $time_zones .= '<optgroup label="GMT' . $this->format_offset($offset) . '">';
         foreach ($tz as $key => $zone) {
             $time_zones .= '<option value="' . $zone . '" ' . ($current_time_zone == $zone ? ' selected' : '') . ' >' . $zone . '</option>';
         }
         $time_zones .= '</optgroup>';
     }
     // Return data
     return $time_zones;
 }
예제 #19
0
 /**
  * method get_research_info
  * param
  * return the research page for the current user
  */
 private function get_data_members()
 {
     $parse = $this->_lang;
     $parse['al_alliance_members'] = str_replace('%s', $this->_alliance_query['alliance_name'], $this->_lang['al_alliance_members']);
     $all_members = $this->get_members();
     $alliance_ranks = unserialize($this->_alliance_query['alliance_ranks']);
     $template = parent::$page->get_template('adm/alliances_members_row_view');
     $members = '';
     if (!empty($all_members)) {
         while ($member = parent::$db->fetchAssoc($all_members)) {
             $member['alliance_request'] = $member['alliance_request'] ? $this->_lang['al_request_yes'] : $this->_lang['al_request_no'];
             $member['ally_request_text'] = $member['ally_request_text'] ? $this->_lang['ally_request_text'] : '-';
             $member['alliance_register_time'] = date(FunctionsLib::read_config('date_format_extended'), $member['alliance_register_time']);
             if ($member['user_id'] == $member['alliance_owner']) {
                 $member['ally_rank'] = $member['alliance_owner_range'];
             } else {
                 if (isset($member['ally_rank'])) {
                     $member['ally_rank'] = $alliance_ranks[$member['ally_rank']]['name'];
                 } else {
                     $member['ally_rank'] = $this->_lang['al_rank_not_defined'];
                 }
             }
             $members .= parent::$page->parse_template($template, $member);
         }
     }
     $parse['members_table'] = empty($members) ? '<tr><td colspan="6" class="align_center text-error">' . $this->_lang['al_no_ranks'] . '</td></tr>' : $members;
     $parse['alert_info'] = $this->_alert_type != '' ? AdministrationLib::save_message($this->_alert_type, $this->_alert_info) : '';
     return parent::$page->parse_template(parent::$page->get_template("adm/alliances_members_view"), $parse);
 }
예제 #20
0
 /**
  * method show_queue
  * param $Sprice
  * return (array) the queue to build data
  */
 private function show_queue(&$Sprice = FALSE)
 {
     $lang = $this->_lang;
     $CurrentQueue = $this->_current_planet['planet_b_building_id'];
     $QueueID = 0;
     $to_destroy = 0;
     $BuildMode = '';
     if ($CurrentQueue != 0) {
         $QueueArray = explode(";", $CurrentQueue);
         $ActualCount = count($QueueArray);
     } else {
         $QueueArray = '0';
         $ActualCount = 0;
     }
     $ListIDRow = '';
     if ($ActualCount != 0) {
         $PlanetID = $this->_current_planet['planet_id'];
         for ($QueueID = 0; $QueueID < $ActualCount; $QueueID++) {
             $BuildArray = explode(",", $QueueArray[$QueueID]);
             $BuildEndTime = floor($BuildArray[3]);
             $CurrentTime = floor(time());
             if ($BuildMode == 'destroy') {
                 $to_destroy++;
             }
             if ($BuildEndTime >= $CurrentTime) {
                 $ListID = $QueueID + 1;
                 $building = $BuildArray[0];
                 $BuildLevel = $BuildArray[1];
                 $BuildMode = $BuildArray[4];
                 $BuildTime = $BuildEndTime - time();
                 $ElementTitle = $this->_lang['tech'][$building];
                 if (isset($Sprice[$building]) && $Sprice !== FALSE && $BuildLevel > $Sprice[$building]) {
                     $Sprice[$building] = $BuildLevel;
                 }
                 if ($ListID > 0) {
                     $ListIDRow .= "<tr>";
                     if ($BuildMode == 'build') {
                         $ListIDRow .= "\t<td class=\"l\" colspan=\"2\">" . $ListID . ".: " . $ElementTitle . " " . $BuildLevel . "</td>";
                     } else {
                         $ListIDRow .= "\t<td class=\"l\" colspan=\"2\">" . $ListID . ".: " . $ElementTitle . " " . $BuildLevel . " " . $this->_lang['bd_dismantle'] . "</td>";
                     }
                     $ListIDRow .= "\t<td class=\"k\">";
                     if ($ListID == 1) {
                         $ListIDRow .= "\t\t<div id=\"blc\" class=\"z\">" . $BuildTime . "<br>";
                         $ListIDRow .= "\t\t<a href=\"game.php?page=" . $this->_current_page . "&listid=" . $ListID . "&amp;cmd=cancel&amp;planet=" . $PlanetID . "\">" . $this->_lang['bd_interrupt'] . "</a></div>";
                         $ListIDRow .= "\t\t<script language=\"JavaScript\">";
                         $ListIDRow .= "\t\t\tpp = \"" . $BuildTime . "\";\n";
                         $ListIDRow .= "\t\t\tpk = \"" . $ListID . "\";\n";
                         $ListIDRow .= "\t\t\tpm = \"cancel\";\n";
                         $ListIDRow .= "\t\t\tpl = \"" . $PlanetID . "\";\n";
                         $ListIDRow .= "\t\t\tt();\n";
                         $ListIDRow .= "\t\t</script>";
                         $ListIDRow .= "\t\t<strong color=\"lime\"><br><font color=\"lime\">" . date(FunctionsLib::read_config('date_format_extended'), $BuildEndTime) . "</font></strong>";
                     } else {
                         $ListIDRow .= "\t\t<font color=\"red\">";
                         $ListIDRow .= "\t\t<a href=\"game.php?page=" . $this->_current_page . "&listid=" . $ListID . "&amp;cmd=remove&amp;planet=" . $PlanetID . "\">" . $this->_lang['bd_cancel'] . "</a></font>";
                     }
                     $ListIDRow .= "\t</td>";
                     $ListIDRow .= "</tr>";
                 }
             }
         }
     }
     $RetValue['to_destoy'] = $to_destroy;
     $RetValue['lenght'] = $ActualCount;
     $RetValue['buildlist'] = $ListIDRow;
     return $RetValue;
 }
예제 #21
0
 public function build_page()
 {
     $parse = $this->_lang;
     if (isset($_POST['fmenge'])) {
         $AddedInQueue = FALSE;
         $totalCount = 0;
         foreach ($_POST['fmenge'] as $Element => $Count) {
             if ($Element < 200 or $Element > 300) {
                 continue;
             }
             $Element = (int) $Element;
             $Count = (int) $Count;
             $totalCount += $Count;
             if ($Count > MAX_FLEET_OR_DEFS_PER_ROW) {
                 $Count = MAX_FLEET_OR_DEFS_PER_ROW;
             }
             if ($Count != 0) {
                 if (DevelopmentsLib::is_development_allowed($this->_current_user, $this->_current_planet, $Element)) {
                     $MaxElements = $this->GetMaxConstructibleElements($Element, $this->_current_planet);
                     if ($Count > $MaxElements) {
                         $Count = $MaxElements;
                     }
                     $Ressource = $this->GetElementRessources($Element, $Count);
                     if ($Count >= 1) {
                         $this->_current_planet['planet_metal'] -= $Ressource['metal'];
                         $this->_current_planet['planet_crystal'] -= $Ressource['crystal'];
                         $this->_current_planet['planet_deuterium'] -= $Ressource['deuterium'];
                         $this->_current_planet['planet_b_hangar_id'] .= '' . $Element . ',' . $Count . ';';
                     }
                 }
             }
         }
         if ($totalCount > 0) {
             parent::$db->query("UPDATE " . PLANETS . " AS p SET\n                                                                            p.`planet_b_hangar_id` = '" . $this->_current_planet['planet_b_hangar_id'] . "',\n                                                                            p.`planet_metal` = '" . $this->_current_planet['planet_metal'] . "',\n                                                                            p.`planet_crystal` = '" . $this->_current_planet['planet_crystal'] . "',\n                                                                            p.`planet_deuterium` = '" . $this->_current_planet['planet_deuterium'] . "'\n                                                                            WHERE p.`planet_id` = '" . $this->_current_planet['planet_id'] . "';");
         }
         FunctionsLib::redirect('game.php?page=shipyard');
     }
     if ($this->_current_planet[$this->_resource[21]] == 0) {
         FunctionsLib::message($this->_lang['bd_shipyard_required'], '', '', TRUE);
     }
     $NotBuilding = TRUE;
     if ($this->_current_planet['planet_b_building_id'] != 0) {
         $CurrentQueue = $this->_current_planet['planet_b_building_id'];
         if (strpos($CurrentQueue, ";")) {
             // FIX BY LUCKY - IF THE SHIPYARD IS IN QUEUE THE USER CANT RESEARCH ANYTHING...
             $QueueArray = explode(";", $CurrentQueue);
             for ($i = 0; $i < MAX_BUILDING_QUEUE_SIZE; $i++) {
                 $ListIDArray = explode(",", $QueueArray[$i]);
                 $Element = $ListIDArray[0];
                 if ($Element == 21 or $Element == 14 or $Element == 15) {
                     break;
                 }
             }
             // END - FIX
         } else {
             $CurrentBuilding = $CurrentQueue;
         }
         if ($CurrentBuilding == 21 or $CurrentBuilding == 14 or $CurrentBuilding == 15 or ($Element == 21 or $Element == 14 or $Element == 15)) {
             $parse['message'] = "<font color=\"red\">" . $this->_lang['bd_building_shipyard'] . "</font>";
             $NotBuilding = FALSE;
         }
     }
     $TabIndex = 0;
     $PageTable = '';
     $BuildQueue = '';
     foreach ($this->_lang['tech'] as $Element => $ElementName) {
         if ($Element > 201 && $Element <= 399) {
             if (DevelopmentsLib::is_development_allowed($this->_current_user, $this->_current_planet, $Element)) {
                 $CanBuildOne = DevelopmentsLib::is_development_payable($this->_current_user, $this->_current_planet, $Element, FALSE);
                 $BuildOneElementTime = DevelopmentsLib::development_time($this->_current_user, $this->_current_planet, $Element);
                 $ElementCount = $this->_current_planet[$this->_resource[$Element]];
                 $ElementNbre = $ElementCount == 0 ? "" : " (" . $this->_lang['bd_available'] . FormatLib::pretty_number($ElementCount) . ")";
                 $parse['dpath'] = DPATH;
                 $parse['add_element'] = '';
                 $parse['element'] = $Element;
                 $parse['element_name'] = $ElementName;
                 $parse['element_description'] = $this->_lang['res']['descriptions'][$Element];
                 $parse['element_price'] = DevelopmentsLib::formated_development_price($this->_current_user, $this->_current_planet, $Element, FALSE);
                 $parse['building_time'] = DevelopmentsLib::formated_development_time($BuildOneElementTime);
                 $parse['element_nbre'] = $ElementNbre;
                 if ($CanBuildOne && $NotBuilding && !parent::$users->is_on_vacations($this->_current_user)) {
                     $TabIndex++;
                     $parse['add_element'] = '<input type=text name=fmenge[' . $Element . '] alt="' . $this->_lang['tech'][$Element] . '" size=6 maxlength=6 value=0 tabindex=' . $TabIndex . '>';
                 }
                 if ($NotBuilding) {
                     $parse['build_fleet'] = '<tr><td class="c" colspan="2" align="center"><input type="submit" value="' . $this->_lang['bd_build_ships'] . '"></td></tr>';
                 }
                 $PageTable .= parent::$page->parse_template(parent::$page->get_template('buildings/buildings_fleet_row'), $parse);
             }
         }
     }
     if ($this->_current_planet['planet_b_hangar_id'] != '') {
         $BuildQueue .= $this->ElementBuildListBox('shipyard');
     }
     $parse['buildlist'] = $PageTable;
     $parse['buildinglist'] = $BuildQueue;
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template('buildings/buildings_fleet'), $parse));
 }
예제 #22
0
 /**
  * method send_fleet
  * param
  * return send fleet routine
  */
 private function send_fleet()
 {
     $max_spy_probes = $this->_current_user['setting_probes_amount'];
     $UserSpyProbes = $this->_current_planet['ship_espionage_probe'];
     $UserRecycles = $this->_current_planet['ship_recycler'];
     $UserDeuterium = $this->_current_planet['planet_deuterium'];
     $UserMissiles = $this->_current_planet['defense_interplanetary_missile'];
     $fleet = array();
     $speedalls = array();
     $PartialFleet = FALSE;
     $PartialCount = 0;
     $order = isset($_POST['order']) ? $_POST['order'] : NULL;
     $ResultMessage = '';
     $fleet['fleetlist'] = '';
     $fleet['amount'] = '';
     switch ($order) {
         case 6:
             $_POST['ship210'] = $_POST['shipcount'];
             break;
         case 7:
             $_POST['ship208'] = $_POST['shipcount'];
             break;
         case 8:
             $_POST['ship209'] = $_POST['shipcount'];
             break;
     }
     foreach ($this->_reslist['fleet'] as $Node => $ShipID) {
         $TName = "ship" . $ShipID;
         if (isset($_POST[$TName]) && $ShipID > 200 && $ShipID < 300 && $_POST[$TName] > 0) {
             if ($_POST[$TName] > $this->_current_planet[$this->_resource[$ShipID]]) {
                 $fleet['fleetarray'][$ShipID] = $this->_current_planet[$this->_resource[$ShipID]];
                 $fleet['fleetlist'] .= $ShipID . "," . $this->_current_planet[$this->_resource[$ShipID]] . ";";
                 $fleet['amount'] += $this->_current_planet[$this->_resource[$ShipID]];
                 $PartialCount += $this->_current_planet[$this->_resource[$ShipID]];
                 $PartialFleet = TRUE;
             } else {
                 $fleet['fleetarray'][$ShipID] = $_POST[$TName];
                 $fleet['fleetlist'] .= $ShipID . "," . $_POST[$TName] . ";";
                 $fleet['amount'] += $_POST[$TName];
                 $speedalls[$ShipID] = $_POST[$TName];
             }
         }
     }
     $errors_types = array(600 => $this->_lang['gl_success'], 601 => $this->_lang['gl_error'], 602 => $this->_lang['gl_no_moon'], 603 => $this->_lang['gl_noob_protection'], 604 => $this->_lang['gl_too_strong'], 605 => $this->_lang['gl_vacation_mode'], 610 => $this->_lang['gl_only_amount_ships'], 611 => $this->_lang['gl_no_ships'], 612 => $this->_lang['gl_no_slots'], 613 => $this->_lang['gl_no_deuterium'], 614 => $this->_lang['gl_no_planet'], 615 => $this->_lang['gl_not_enough_storage'], 616 => $this->_lang['gl_multi_alarm']);
     if ($PartialFleet == TRUE) {
         if ($PartialCount < 1) {
             die("611 ");
         }
     }
     $galaxy = isset($_POST['galaxy']) ? (int) $_POST['galaxy'] : 0;
     $system = isset($_POST['system']) ? (int) $_POST['system'] : 0;
     $planet = isset($_POST['planet']) ? (int) $_POST['planet'] : 0;
     $FleetArray = isset($fleet['fleetarray']) ? $fleet['fleetarray'] : NULL;
     if ($galaxy > MAX_GALAXY_IN_WORLD or $galaxy < 1 or ($system > MAX_SYSTEM_IN_GALAXY or $system < 1) or ($planet > MAX_PLANET_IN_SYSTEM or $planet < 1) or is_null($FleetArray)) {
         die("614 ");
     }
     $CurrentFlyingFleets = parent::$db->queryFetch("SELECT COUNT(fleet_id) AS `Nbre`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . FLEETS . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `fleet_owner` = '" . $this->_current_user['user_id'] . "';");
     $CurrentFlyingFleets = $CurrentFlyingFleets['Nbre'];
     $TargetRow = parent::$db->queryFetch("SELECT *\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . PLANETS . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_galaxy` = '" . parent::$db->escapeValue($_POST['galaxy']) . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_system` = '" . parent::$db->escapeValue($_POST['system']) . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_planet` = '" . parent::$db->escapeValue($_POST['planet']) . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_type` = '" . parent::$db->escapeValue($_POST['planettype']) . "';");
     if ($TargetRow['planet_user_id'] == '') {
         $TargetUser = $this->_current_user;
     } elseif ($TargetRow['planet_user_id'] != '') {
         $TargetUser = parent::$db->queryFetch("SELECT u.`user_id`, u.`user_onlinetime`, u.`user_authlevel`, s.`setting_vacations_status`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . USERS . " AS u\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . SETTINGS . " AS s ON s.setting_user_id = u.user_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `user_id` = '" . $TargetRow['planet_user_id'] . "';");
     }
     // invisible debris by jstar
     if ($order == 8) {
         $TargetGPlanet = parent::$db->queryFetch("SELECT planet_invisible_start_time, planet_debris_metal, planet_debris_crystal\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . PLANETS . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE planet_galaxy = '" . parent::$db->escapeValue($_POST['galaxy']) . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tplanet_system = '" . parent::$db->escapeValue($_POST['system']) . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tplanet_planet = '" . parent::$db->escapeValue($_POST['planet']) . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tplanet_type = 1;");
         if ($TargetGPlanet['planet_debris_metal'] == 0 && $TargetGPlanet['planet_debris_crystal'] == 0 && time() > $TargetGPlanet['planet_invisible_start_time'] + DEBRIS_LIFE_TIME) {
             die;
         }
     }
     $user_points = $this->_noob->return_points($this->_current_user['user_id'], $TargetUser['user_id']);
     $CurrentPoints = $user_points['user_points'];
     $TargetPoints = $user_points['target_points'];
     $TargetVacat = $TargetUser['setting_vacations_status'];
     if (FleetsLib::get_max_fleets($this->_current_user[$this->_resource[108]], $this->_current_user['premium_officier_admiral']) <= $CurrentFlyingFleets) {
         die("612 ");
     }
     if (!is_array($FleetArray)) {
         die("611 ");
     }
     if (!($order == 6 or $order == 8)) {
         die("601 ");
     }
     if ($TargetVacat && $order != 8 or $this->_current_user['setting_vacations_status']) {
         die("605 ");
     }
     if ($TargetUser['user_onlinetime'] >= time() - 60 * 60 * 24 * 7) {
         if ($this->_noob->is_weak($CurrentPoints, $TargetPoints) && $TargetRow['planet_user_id'] != '' && $order == 6) {
             die("603 ");
         }
         if ($this->_noob->is_strong($CurrentPoints, $TargetPoints) && $TargetRow['planet_user_id'] != '' && $order == 6) {
             die("604 ");
         }
     }
     if ($TargetRow['planet_user_id'] == '' && $order != 8) {
         die("601 ");
     }
     if ($TargetRow['planet_user_id'] == $this->_current_planet['planet_user_id'] && $order == 6) {
         die("601 ");
     }
     $Distance = FleetsLib::target_distance($this->_current_planet['planet_galaxy'], $_POST['galaxy'], $this->_current_planet['planet_system'], $_POST['system'], $this->_current_planet['planet_planet'], $_POST['planet']);
     $speedall = FleetsLib::fleet_max_speed($FleetArray, 0, $this->_current_user);
     $SpeedAllMin = min($speedall);
     $Duration = FleetsLib::mission_duration(10, $SpeedAllMin, $Distance, FunctionsLib::fleet_speed_factor());
     $fleet['fly_time'] = $Duration;
     $fleet['start_time'] = $Duration + time();
     $fleet['end_time'] = $Duration * 2 + time();
     $FleetShipCount = 0;
     $FleetDBArray = "";
     $FleetSubQRY = "";
     $consumption = 0;
     $SpeedFactor = FunctionsLib::fleet_speed_factor();
     foreach ($FleetArray as $Ship => $Count) {
         if ($Ship != '') {
             $ShipSpeed = $this->_pricelist[$Ship]['speed'];
             $spd = 35000 / ($Duration * $SpeedFactor - 10) * sqrt($Distance * 10 / $ShipSpeed);
             $basicConsumption = $this->_pricelist[$Ship]['consumption'] * $Count;
             $consumption += $basicConsumption * $Distance / 35000 * ($spd / 10 + 1) * ($spd / 10 + 1);
             $FleetShipCount += $Count;
             $FleetDBArray .= $Ship . "," . $Count . ";";
             $FleetSubQRY .= "`" . $this->_resource[$Ship] . "` = `" . $this->_resource[$Ship] . "` - " . $Count . " , ";
         }
     }
     $consumption = round($consumption) + 1;
     if ($UserDeuterium < $consumption) {
         die("613 ");
     }
     if (FunctionsLib::read_config('adm_attack') == 1 && $TargetUser['user_authlevel'] > 0) {
         die("601 ");
     }
     parent::$db->query("INSERT INTO " . FLEETS . " SET\n\t\t\t\t\t\t\t\t`fleet_owner` = '" . $this->_current_user['user_id'] . "',\n\t\t\t\t\t\t\t\t`fleet_mission` = '" . intval($order) . "',\n\t\t\t\t\t\t\t\t`fleet_amount` = '" . $FleetShipCount . "',\n\t\t\t\t\t\t\t\t`fleet_array` = '" . $FleetDBArray . "',\n\t\t\t\t\t\t\t\t`fleet_start_time` = '" . $fleet['start_time'] . "',\n\t\t\t\t\t\t\t\t`fleet_start_galaxy` = '" . $this->_current_planet['planet_galaxy'] . "',\n\t\t\t\t\t\t\t\t`fleet_start_system` = '" . $this->_current_planet['planet_system'] . "',\n\t\t\t\t\t\t\t\t`fleet_start_planet` = '" . $this->_current_planet['planet_planet'] . "',\n\t\t\t\t\t\t\t\t`fleet_start_type` = '" . $this->_current_planet['planet_type'] . "',\n\t\t\t\t\t\t\t\t`fleet_end_time` = '" . $fleet['end_time'] . "',\n\t\t\t\t\t\t\t\t`fleet_end_galaxy` = '" . intval($_POST['galaxy']) . "',\n\t\t\t\t\t\t\t\t`fleet_end_system` = '" . intval($_POST['system']) . "',\n\t\t\t\t\t\t\t\t`fleet_end_planet` = '" . intval($_POST['planet']) . "',\n\t\t\t\t\t\t\t\t`fleet_end_type` = '" . intval($_POST['planettype']) . "',\n\t\t\t\t\t\t\t\t`fleet_target_owner` = '" . $TargetRow['planet_user_id'] . "',\n\t\t\t\t\t\t\t\t`fleet_creation` = '" . time() . "';");
     $UserDeuterium -= $consumption;
     parent::$db->query("UPDATE " . PLANETS . " AS p\n\t\t\t\t\t\t\t\tINNER JOIN " . SHIPS . " AS s ON s.ship_planet_id = p.`planet_id` SET\n\t\t\t\t\t\t\t\t{$FleetSubQRY}\n\t\t\t\t\t\t\t\tp.`planet_deuterium` = '" . ($UserDeuterium < 1 ? 0 : $UserDeuterium) . "'\n\t\t\t\t\t\t\t\tWHERE p.`planet_id` = '" . $this->_current_planet['planet_id'] . "';");
     $CurrentFlyingFleets++;
     foreach ($FleetArray as $Ships => $Count) {
         if ($max_spy_probes > $this->_current_planet[$this->_resource[$Ships]]) {
             $ResultMessage = "610 " . $FleetShipCount;
         }
     }
     if ($ResultMessage == '') {
         $ResultMessage = "600 " . $Ships;
     }
     die($ResultMessage);
 }
예제 #23
0
 /**
  * method secure_connection
  * param
  * return stablish a secure connection and force it
  */
 public static function secure_connection()
 {
     if (FunctionsLib::read_config('ssl_enabled') == 1 && $_SERVER['SERVER_PORT'] !== 443 && (empty($_SERVER['HTTPS']) or $_SERVER['HTTPS'] === 'off')) {
         FunctionsLib::redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
     }
 }
예제 #24
0
 /**
  * method flying_fleets_table
  * param
  * return the fleets table
  */
 private function flying_fleets_table()
 {
     $table = '';
     $i = 0;
     while ($fleet = parent::$db->fetchArray($this->_flying_fleets)) {
         $block['num'] = ++$i;
         $block['mission'] = $this->resources_pop_up($this->_lang['ff_type_mission'][$fleet['fleet_mission']] . ' ' . (FleetsLib::is_fleet_returning($fleet) ? $this->_lang['ff_r'] : $this->_lang['ff_a']), $fleet);
         $block['amount'] = $this->ships_pop_up($this->_lang['ff_ships'], $fleet);
         $block['beginning'] = FormatLib::pretty_coords($fleet['fleet_start_galaxy'], $fleet['fleet_start_system'], $fleet['fleet_start_planet']);
         $block['departure'] = date(FunctionsLib::read_config('date_format_extended'), $fleet['fleet_creation']);
         $block['objective'] = FormatLib::pretty_coords($fleet['fleet_end_galaxy'], $fleet['fleet_end_system'], $fleet['fleet_end_planet']);
         $block['arrival'] = date(FunctionsLib::read_config('date_format_extended'), $fleet['fleet_start_time']);
         $block['return'] = date(FunctionsLib::read_config('date_format_extended'), $fleet['fleet_end_time']);
         $table .= parent::$page->parse_template(parent::$page->get_template('adm/fleet_rows_view'), $block);
     }
     return $table;
 }
예제 #25
0
 /**
  * __construct()
  */
 public function __construct()
 {
     $this->_protection = FunctionsLib::read_config('noobprotection');
     $this->_protectiontime = FunctionsLib::read_config('noobprotectiontime');
     $this->_protectionmulti = FunctionsLib::read_config('noobprotectionmulti');
 }
예제 #26
0
    ini_set('display_errors', 1);
    error_reporting(E_ALL);
} else {
    // Only for Betas, it's going to be changed
    ini_set('display_errors', 1);
    error_reporting(E_ALL);
}
$debug = FunctionsLib::load_library('DebugLib');
$db = new Database();
$installed = FunctionsLib::read_config('game_installed');
$game_version = FunctionsLib::read_config('version');
$game_lang = FunctionsLib::read_config('lang');
$current_page = isset($_GET['page']) ? $_GET['page'] : '';
// check if is installed
if ($installed == 0 && !defined('IN_INSTALL')) {
    FunctionsLib::redirect(XGP_ROOT . 'install/');
}
// define game version
if ($installed != 0) {
    define('VERSION', $game_version == '' ? '' : 'v' . $game_version);
}
// define game language
define('DEFAULT_LANG', $game_lang == '' ? 'spanish' : $game_lang);
if (!defined('IN_INSTALL')) {
    require_once XGP_ROOT . CORE_PATH . 'Sessions.php';
    require_once XGP_ROOT . CORE_PATH . 'Hooks.php';
    require_once XGP_ROOT . LIB_PATH . 'StatisticsLib.php';
    require_once XGP_ROOT . LIB_PATH . 'UpdateResourcesLib.php';
    require_once XGP_ROOT . LIB_PATH . 'UpdateLib.php';
    // Sessions
    $session = new Sessions();
예제 #27
0
 private function deleteFleetShortcuts($id)
 {
     $scarray = explode(";", $this->_current_user['user_fleet_shortcuts']);
     unset($scarray[$id]);
     $this->_current_user['user_fleet_shortcuts'] = implode(";", $scarray);
     parent::$db->query("UPDATE " . USERS . " SET\n\t\t\t\t\t\t\tuser_fleet_shortcuts='" . $this->_current_user['user_fleet_shortcuts'] . "'\n\t\t\t\t\t\t\tWHERE user_id=" . $this->_current_user['user_id']);
     FunctionsLib::redirect('game.php?page=shortcuts');
 }
예제 #28
0
 /**
  * @method createAccount
  * @return negative value if an error ocurred, or 0 if admin account was successfully created
  *          -1: Some field is empty
  *          -2: Admin email is invalid
  */
 private function createAccount()
 {
     // validations
     if (empty($_POST['adm_user']) || empty($_POST['adm_pass']) || empty($_POST['adm_email'])) {
         return -1;
     }
     if (!FunctionsLib::valid_email($_POST['adm_email'])) {
         return -2;
     }
     // some default values
     $adm_name = parent::$db->escapeValue($_POST['adm_user']);
     $adm_email = parent::$db->escapeValue($_POST['adm_email']);
     $adm_pass = sha1($_POST['adm_pass']);
     // a bunch of of queries :/
     parent::$db->query("INSERT INTO " . USERS . " SET\n            `user_id` = '1',\n            `user_name` = '" . $adm_name . "',\n            `user_email` = '" . $adm_email . "',\n            `user_email_permanent` = '" . $adm_email . "',\n            `user_ip_at_reg` = '" . $_SERVER['REMOTE_ADDR'] . "',\n            `user_agent` = '',\n            `user_authlevel` = '3',\n            `user_home_planet_id` = '1',\n            `user_galaxy` = '1',\n            `user_system` = '1',\n            `user_planet` = '1',\n            `user_current_planet` = '1',\n            `user_register_time` = '" . time() . "',\n            `user_password` = '" . $adm_pass . "';");
     $this->_planet->createPlanetWithOptions(array('planet_user_id' => 1, 'planet_name' => $adm_name, 'planet_galaxy' => 1, 'planet_system' => 1, 'planet_planet' => 1, 'planet_last_update' => time(), 'planet_metal' => 500, 'planet_crystal' => 500, 'planet_deuterium' => 0));
     parent::$db->query("INSERT INTO " . RESEARCH . " SET `research_user_id` = '1';");
     parent::$db->query("INSERT INTO " . USERS_STATISTICS . " SET `user_statistic_user_id` = '1';");
     parent::$db->query("INSERT INTO " . PREMIUM . " SET `premium_user_id` = '1';");
     parent::$db->query("INSERT INTO " . SETTINGS . " SET `setting_user_id` = '1';");
     parent::$db->query("INSERT INTO " . BUILDINGS . " SET `building_planet_id` = '1';");
     parent::$db->query("INSERT INTO " . DEFENSES . " SET `defense_planet_id` = '1';");
     parent::$db->query("INSERT INTO " . SHIPS . " SET `ship_planet_id` = '1';");
     // write the new admin email for support and debugging
     FunctionsLib::update_config('admin_email', $adm_email);
     return true;
 }
예제 #29
0
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     $parse = $this->_lang;
     if ($this->_current_user['premium_dark_matter'] < $this->_tr_dark_matter) {
         FunctionsLib::message(str_replace('%s', $this->_tr_dark_matter, $this->_lang['tr_darkmatter_needed']), '', '', TRUE);
         die;
     }
     if (isset($_POST['ress']) && $_POST['ress'] != '') {
         switch ($_POST['ress']) {
             case 'metal':
                 if ($_POST['cristal'] < 0 or $_POST['deut'] < 0) {
                     FunctionsLib::message($this->_lang['tr_only_positive_numbers'], "game.php?page=trader", 1);
                 } else {
                     $necessaire = $_POST['cristal'] * 2 + $_POST['deut'] * 4;
                     $amout = array('metal' => 0, 'crystal' => $_POST['cristal'], 'deuterium' => $_POST['deut']);
                     $storage = $this->check_storage($amout);
                     if (is_string($storage)) {
                         die(FunctionsLib::message($storage, 'game.php?page=trader', '2'));
                     }
                     if ($this->_current_planet['planet_metal'] > $necessaire) {
                         parent::$db->query("UPDATE " . PLANETS . " SET\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_metal` = `planet_metal` - " . round($necessaire) . ",\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_crystal` = `planet_crystal` + " . round($_POST['cristal']) . ",\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_deuterium` = `planet_deuterium` + " . round($_POST['deut']) . "\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_id` = '" . $this->_current_planet['planet_id'] . "';");
                         $this->_current_planet['planet_metal'] -= $necessaire;
                         $this->_current_planet['planet_crystal'] += isset($_POST['cristal']) ? $_POST['cristal'] : 0;
                         $this->_current_planet['planet_deuterium'] += isset($_POST['deut']) ? $_POST['deut'] : 0;
                         $this->discount_dark_matter();
                         // REDUCE DARKMATTER
                     } else {
                         FunctionsLib::message($this->_lang['tr_not_enought_metal'], "game.php?page=trader", 1);
                     }
                 }
                 break;
             case 'cristal':
                 if ($_POST['metal'] < 0 or $_POST['deut'] < 0) {
                     FunctionsLib::message($this->_lang['tr_only_positive_numbers'], "game.php?page=trader", 1);
                 } else {
                     $necessaire = abs($_POST['metal']) * 0.5 + abs($_POST['deut']) * 2;
                     $amout = array('metal' => $_POST['metal'], 'crystal' => 0, 'deuterium' => $_POST['deut']);
                     $storage = $this->check_storage($amout);
                     if (is_string($storage)) {
                         die(FunctionsLib::message($storage, 'game.php?page=trader', '2'));
                     }
                     if ($this->_current_planet['planet_crystal'] > $necessaire) {
                         parent::$db->query("UPDATE " . PLANETS . " SET\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_metal` = `planet_metal` + " . round($_POST['metal']) . ",\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_crystal` = `planet_crystal` - " . round($necessaire) . ",\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_deuterium` = `planet_deuterium` + " . round($_POST['deut']) . "\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_id` = '" . $this->_current_planet['planet_id'] . "';");
                         $this->_current_planet['planet_metal'] += isset($_POST['metal']) ? $_POST['metal'] : 0;
                         $this->_current_planet['planet_crystal'] -= $necessaire;
                         $this->_current_planet['planet_deuterium'] += isset($_POST['deut']) ? $_POST['deut'] : 0;
                         $this->discount_dark_matter($this->_current_user);
                         // REDUCE DARKMATTER
                     } else {
                         FunctionsLib::message($this->_lang['tr_not_enought_crystal'], "game.php?page=trader", 1);
                     }
                 }
                 break;
             case 'deuterium':
                 if ($_POST['cristal'] < 0 or $_POST['metal'] < 0) {
                     FunctionsLib::message($this->_lang['tr_only_positive_numbers'], "game.php?page=trader", 1);
                 } else {
                     $necessaire = abs($_POST['metal']) * 0.25 + abs($_POST['cristal']) * 0.5;
                     $amout = array('metal' => $_POST['metal'], 'crystal' => $_POST['cristal'], 'deuterium' => 0);
                     $storage = $this->check_storage($amout);
                     if (is_string($storage)) {
                         die(message($storage, 'game.php?page=trader', '2'));
                     }
                     if ($this->_current_planet['planet_deuterium'] > $necessaire) {
                         parent::$db->query("UPDATE " . PLANETS . " SET\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_metal` = `planet_metal` + " . round($_POST['metal']) . ",\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_crystal` = `planet_crystal` + " . round($_POST['cristal']) . ",\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_deuterium` = `planet_deuterium` - " . round($necessaire) . "\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_id` = '" . $this->_current_planet['planet_id'] . "';");
                         $this->_current_planet['planet_metal'] += isset($_POST['metal']) ? $_POST['metal'] : 0;
                         $this->_current_planet['planet_crystal'] += isset($_POST['cristal']) ? $_POST['cristal'] : 0;
                         $this->_current_planet['planet_deuterium'] -= $necessaire;
                         $this->discount_dark_matter($this->_current_user);
                         // REDUCE DARKMATTER
                     } else {
                         FunctionsLib::message($this->_lang['tr_not_enought_deuterium'], "game.php?page=trader", 1);
                     }
                 }
                 break;
         }
         FunctionsLib::message($this->_lang['tr_exchange_done'], "game.php?page=trader", 1);
     } else {
         $template = parent::$page->get_template('trader/trader_main');
         if (isset($_POST['action'])) {
             $parse['mod_ma_res'] = '1';
             switch (isset($_POST['choix']) ? $_POST['choix'] : NULL) {
                 case 'metal':
                     $template = parent::$page->get_template('trader/trader_metal');
                     $parse['mod_ma_res_a'] = '2';
                     $parse['mod_ma_res_b'] = '4';
                     break;
                 case 'cristal':
                     $template = parent::$page->get_template('trader/trader_cristal');
                     $parse['mod_ma_res_a'] = '0.5';
                     $parse['mod_ma_res_b'] = '2';
                     break;
                 case 'deut':
                     $template = parent::$page->get_template('trader/trader_deuterium');
                     $parse['mod_ma_res_a'] = '0.25';
                     $parse['mod_ma_res_b'] = '0.5';
                     break;
             }
         }
     }
     parent::$page->display(parent::$page->parse_template($template, $parse));
 }
예제 #30
0
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     $parse = $this->_lang;
     $parse['alert'] = '';
     $error = '';
     if (isset($_POST['save'])) {
         if (isset($_POST['premium_url']) && !empty($_POST['premium_url'])) {
             FunctionsLib::update_config('premium_url', FunctionsLib::prep_url($_POST['premium_url']));
         } else {
             $error .= $this->_lang['pr_error_url'];
         }
         if (isset($_POST['trader_darkmatter']) && $_POST['trader_darkmatter'] > 0) {
             FunctionsLib::update_config('trader_darkmatter', $_POST['trader_darkmatter']);
         } else {
             $error .= $this->_lang['pr_error_trader'];
         }
         if ($error != '') {
             $parse['alert'] = AdministrationLib::save_message('warning', $error);
         } else {
             $parse['alert'] = AdministrationLib::save_message('ok', $this->_lang['pr_all_ok_message']);
         }
     }
     $parse['premium_url'] = FunctionsLib::read_config('premium_url');
     $parse['trader_darkmatter'] = FunctionsLib::read_config('trader_darkmatter');
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/premium_view'), $parse));
 }