Пример #1
0
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     $parse = $this->_lang;
     $modules_array = '';
     $modules_count = count(explode(';', Functions_Lib::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) . ';';
         }
         Functions_Lib::update_config('modules', $modules_array);
         $parse['alert'] = Administration_Lib::save_message('ok', $this->_lang['se_all_ok_message']);
     }
     // SHOW PAGE
     $modules_array = explode(';', Functions_Lib::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));
 }
Пример #2
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'])) {
             Functions_Lib::update_config('premium_url', Functions_Lib::prep_url($_POST['premium_url']));
         } else {
             $error .= $this->_lang['pr_error_url'];
         }
         if (isset($_POST['trader_darkmatter']) && $_POST['trader_darkmatter'] > 0) {
             Functions_Lib::update_config('trader_darkmatter', $_POST['trader_darkmatter']);
         } else {
             $error .= $this->_lang['pr_error_trader'];
         }
         if ($error != '') {
             $parse['alert'] = Administration_Lib::save_message('warning', $error);
         } else {
             $parse['alert'] = Administration_Lib::save_message('ok', $this->_lang['pr_all_ok_message']);
         }
     }
     $parse['premium_url'] = Functions_Lib::read_config('premium_url');
     $parse['trader_darkmatter'] = Functions_Lib::read_config('trader_darkmatter');
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/premium_view'), $parse));
 }
Пример #3
0
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     $parse = $this->_lang;
     $load_template = parent::$page->get_template('adm/errors_row_view');
     $deleteall = isset($_GET['deleteall']) ? $_GET['deleteall'] : '';
     $file = XGP_ROOT . LOGS_PATH . 'ErrorLog.php';
     $errors_all = file_get_contents($file);
     $i = 0;
     $parse['errors_list'] = '';
     if ($errors_all != "") {
         $errors_all = explode('||', $errors_all);
         foreach ($errors_all as $error) {
             $errors_row = explode('|', $error);
             if (isset($errors_row[3])) {
                 $i++;
                 $parse['errors_list'] .= parent::$page->parse_template($load_template, $errors_row);
             }
         }
     }
     $parse['errors_list_resume'] = $i . $this->_lang['er_errors'];
     if ($deleteall == 'yes') {
         $fh = fopen($file, 'w');
         fclose($fh);
         Functions_Lib::redirect('admin.php?page=errors');
     }
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/errors_view'), $parse));
 }
Пример #4
0
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     $parse = $this->_lang;
     if ($_POST) {
         $login = parent::$db->query_fetch("SELECT `user_id`, `user_name`, `user_password`, `user_banned`\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . USERS . "\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `user_name` = '" . parent::$db->escape_value($_POST['login']) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND `user_password` = '" . sha1($_POST['pass']) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1");
         if ($login['user_banned'] <= time()) {
             $this->remove_ban($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\t\t\t\t\t\t\t\t\t\t\t`user_current_planet` = `user_home_planet_id`\n\t\t\t\t\t\t\t\t\t\t\tWHERE `user_id` ='" . $login['user_id'] . "'");
                 // Redirect to game
                 Functions_Lib::redirect('game.php?page=overview');
             }
         }
         // If login fails
         Functions_Lib::redirect('index.php');
     } else {
         $parse['year'] = date('Y');
         $parse['version'] = VERSION;
         $parse['servername'] = Functions_Lib::read_config('game_name');
         $parse['game_logo'] = Functions_Lib::read_config('game_logo');
         $parse['forum_url'] = Functions_Lib::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);
     }
 }
Пример #5
0
 /**
  * method production_amount
  * param1 $production
  * param2 $boost
  * return production amount
  */
 public static function production_amount($production, $boost, $is_energy = false)
 {
     if ($is_energy) {
         return floor($production * $boost);
     } else {
         return floor($production * Functions_Lib::read_config('resource_multiplier') * $boost);
     }
 }
Пример #6
0
 /**
  * __construct()
  */
 public function __construct()
 {
     parent::__construct();
     // check if session is active
     parent::$users->check_session();
     // Check module access
     Functions_Lib::module_message(Functions_Lib::is_module_accesible(self::MODULE_ID));
     $this->_lang = parent::$lang;
     $this->build_page();
 }
Пример #7
0
 /**
  * __construct()
  */
 public function __construct()
 {
     parent::__construct();
     $this->_lang = parent::$lang;
     if ($this->server_requirementes()) {
         $this->build_page();
     } else {
         die(Functions_Lib::message($this->_lang['ins_no_server_requirements']));
     }
 }
Пример #8
0
/**
 * @project XG Proyect
 * @version 3.x.x build 0000
 * @copyright Copyright (C) 2008 - 2014
 */
function migrate_to_xml()
{
    $query = $db->query("SELECT * FROM " . DB_PREFIX . "config");
    $search = array('�', '�', '�', '�', '"', '#', '$', '%', '(', ')', '�', '�', '|', '~');
    $replace = array('&#161;', '&#191;', '&#176;', '&#170;', '&#34;', '&#35;', '&#36;', '&#37;', '&#40;', '&#41;', '&#172;', '&#8364;', '&#124;', '&#126;');
    while ($row = $db->fetch_array($query)) {
        if ($row['config_name'] != 'BuildLabWhileRun') {
            Functions_Lib::update_config(strtolower($row['config_name']), str_replace($search, $replace, $row['config_value']));
        }
    }
}
Пример #9
0
 /**
  * method build_page
  * param
  * return the statistics page
  */
 private function build_page()
 {
     $parse = $this->_lang;
     $parse['dpath'] = DPATH;
     $bloc = $this->_lang;
     $mode = isset($_GET['mode']) ? $_GET['mode'] : '';
     $time = isset($_GET['time']) ? $_GET['time'] : '';
     if ($mode == 2 && ($time == 'month' or $time == 'week')) {
         $Selected = $_GET['offi'];
         $time = 'darkmatter_' . $time;
         $set_time = $time == 'darkmatter_month' ? 3600 * 24 * 30 * 3 : 3600 * 24 * 7;
         if (in_array($Selected, $this->_reslist['officier'])) {
             $Result = $this->is_officier_accesible($Selected, $time);
             $Price = $this->get_officier_price($Selected, $time);
             if ($Result !== FALSE) {
                 $this->_current_user['premium_dark_matter'] -= $Price;
                 // IF THE OFFICIER IS ACTIVE
                 if (Officiers_Lib::is_officier_active($this->_current_user[$this->_resource[$Selected]])) {
                     $this->_current_user[$this->_resource[$Selected]] += $set_time;
                     // ADD TIME
                 } else {
                     $this->_current_user[$this->_resource[$Selected]] = time() + $set_time;
                     // SET TIME
                 }
                 parent::$db->query("UPDATE " . PREMIUM . " SET\n\t\t\t\t\t\t\t\t\t\t\t`premium_dark_matter` = '" . $this->_current_user['premium_dark_matter'] . "',\n\t\t\t\t\t\t\t\t\t\t\t`" . $this->_resource[$Selected] . "` = '" . $this->_current_user[$this->_resource[$Selected]] . "'\n\t\t\t\t\t\t\t\t\t\t\tWHERE `premium_user_id` = '" . $this->_current_user['user_id'] . "';");
             }
         }
         Functions_Lib::redirect('game.php?page=officier');
     } else {
         $OfficierRowTPL = parent::$page->get_template('officier/officier_row');
         $parse['disp_off_tbl'] = '';
         $parse['premium_pay_url'] = Functions_Lib::read_config('premium_url') != '' ? Functions_Lib::read_config('premium_url') : 'game.php?page=officier';
         foreach ($this->_lang['tech'] as $Element => $ElementName) {
             if ($Element >= 601 && $Element <= 605) {
                 $bloc['dpath'] = DPATH;
                 $bloc['off_id'] = $Element;
                 $bloc['off_status'] = Officiers_Lib::is_officier_active($this->_current_user[$this->_resource[$Element]]) ? '<font color=lime>' . $this->_lang['of_active'] . ' ' . date(Functions_Lib::read_config('date_format'), $this->_current_user[$this->_resource[$Element]]) . '</font>' : '<font color=red>' . $this->_lang['of_inactive'] . '</font>';
                 $bloc['off_name'] = $ElementName;
                 $bloc['off_desc'] = $this->_lang['res']['descriptions'][$Element];
                 $bloc['off_desc_short'] = $this->_lang['info'][$Element]['description'];
                 $bloc['month_price'] = Format_Lib::pretty_number($this->get_officier_price($Element, 'darkmatter_month'));
                 $bloc['week_price'] = Format_Lib::pretty_number($this->get_officier_price($Element, 'darkmatter_week'));
                 $bloc['img_big'] = $this->get_officier_image($Element, 'img_big');
                 $bloc['img_small'] = $this->get_officier_image($Element, 'img_small');
                 $bloc['off_link_month'] = "game.php?page=officier&mode=2&offi=" . $Element . "&time=month";
                 $bloc['off_link_week'] = "game.php?page=officier&mode=2&offi=" . $Element . "&time=week";
                 $parse['disp_off_tbl'] .= parent::$page->parse_template($OfficierRowTPL, $bloc);
             }
         }
     }
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template('officier/officier_table'), $parse));
 }
Пример #10
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 (Administration_Lib::have_access($this->_current_user['user_authlevel']) && Administration_Lib::authorization($this->_current_user['user_authlevel'], 'config_game') == 1) {
         $this->build_page($this->_current_user);
     } else {
         die(Functions_Lib::message($this->_lang['ge_no_permissions']));
     }
 }
Пример #11
0
 /**
  * __construct()
  */
 public function __construct()
 {
     parent::__construct();
     // check if session is active
     parent::$users->check_session();
     // Check module access
     Functions_Lib::module_message(Functions_Lib::is_module_accesible(self::MODULE_ID));
     $this->_lang = parent::$lang;
     $this->_resource = parent::$objects->get_objects();
     $this->_requeriments = parent::$objects->get_relations();
     $this->_current_user = parent::$users->get_user_data();
     $this->_current_planet = parent::$users->get_planet_data();
     $this->build_page();
 }
Пример #12
0
 /**
  * method missile_mission
  * param $fleet_row
  * return the missile result
  */
 public function missile_mission($fleet_row)
 {
     if ($fleet_row['fleet_start_time'] <= time()) {
         if ($fleet_row['fleet_mess'] == 0) {
             $attacker_data = parent::$db->query_fetch("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->query_fetch("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'];
             }
             Functions_Lib::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']);
         }
     }
 }
Пример #13
0
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     // RUN STATISTICS SCRIPT AND THE SET THE RESULT
     $result = Statistics_Lib::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'] = Administration_Lib::save_message('ok', str_replace("%t", $result['totaltime'], $this->_lang['sb_stats_update']));
     // UPDATE STATISTICS LAST UPDATE
     Functions_Lib::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));
 }
Пример #14
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 (Administration_Lib::have_access($this->_current_user['user_authlevel']) && $this->_current_user['user_authlevel'] == 3) {
         include_once XGP_ROOT . 'application/libraries/Creator_Lib.php';
         $this->_creator = new Creator_Lib();
         $this->build_page();
     } else {
         die(Functions_Lib::message($this->_lang['ge_no_permissions']));
     }
 }
Пример #15
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->get_price($element);
     $resources_total = $element['metal'] + $element['crystal'] + $element['deuterium'];
     $level_mult = pow($element['factor'], $current_level);
     $points = $resources_total * $level_mult / Functions_Lib::read_config('stat_settings');
     return $points;
 }
Пример #16
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();
         Functions_Lib::update_config('reg_enable', $this->_game_config['reg_enable']);
         Functions_Lib::update_config('reg_welcome_message', $this->_game_config['reg_welcome_message']);
         Functions_Lib::update_config('reg_welcome_email', $this->_game_config['reg_welcome_email']);
         $parse['alert'] = Administration_Lib::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));
 }
Пример #17
0
 /**
  * method flying_fleets_table
  * param
  * return the fleets table
  */
 private function flying_fleets_table()
 {
     $table = '';
     $i = 0;
     while ($fleet = parent::$db->fetch_array($this->_flying_fleets)) {
         $block['num'] = ++$i;
         $block['mission'] = $this->resources_pop_up($this->_lang['ff_type_mission'][$fleet['fleet_mission']] . ' ' . (Fleets_Lib::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'] = Format_Lib::pretty_coords($fleet['fleet_start_galaxy'], $fleet['fleet_start_system'], $fleet['fleet_start_planet']);
         $block['departure'] = date(Functions_Lib::read_config('date_format_extended'), $fleet['fleet_creation']);
         $block['objective'] = Format_Lib::pretty_coords($fleet['fleet_end_galaxy'], $fleet['fleet_end_system'], $fleet['fleet_end_planet']);
         $block['arrival'] = date(Functions_Lib::read_config('date_format_extended'), $fleet['fleet_start_time']);
         $block['return'] = date(Functions_Lib::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;
 }
Пример #18
0
 /**
  * method do_search
  * param
  * return do the search
  */
 private function do_search()
 {
     // build the query, run the query and return the result
     $search_result = parent::$db->query($this->build_search_query());
     $template = parent::$page->get_template('adm/messages_row_view');
     $results = '';
     if ($search_result !== FALSE) {
         // loop thru the results
         while ($search_data = parent::$db->fetch_array($search_result)) {
             $search_data['mg_show_hide'] = $this->_lang['mg_show_hide'];
             $search_data['message_time'] = date(Functions_Lib::read_config('date_format_extended'), $search_data['message_time']);
             $search_data['message_text'] = stripslashes(nl2br($search_data['message_text']));
             $results .= parent::$page->parse_template($template, $search_data);
         }
         // return search results with table format of course
         return $results;
     }
     $this->_alert = Administration_Lib::save_message('warning', $this->_lang['mg_no_results']);
 }
Пример #19
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();
         Functions_Lib::update_config('initial_fields', $this->_game_config['initial_fields']);
         Functions_Lib::update_config('metal_basic_income', $this->_game_config['metal_basic_income']);
         Functions_Lib::update_config('crystal_basic_income', $this->_game_config['crystal_basic_income']);
         Functions_Lib::update_config('deuterium_basic_income', $this->_game_config['deuterium_basic_income']);
         Functions_Lib::update_config('energy_basic_income', $this->_game_config['energy_basic_income']);
         $parse['alert'] = Administration_Lib::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));
 }
Пример #20
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>' . Functions_Lib::format_text($_POST['tresc']) . '</b></font>';
                 while ($u = parent::$db->fetch_array($sq)) {
                     Functions_Lib::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->fetch_array($sq)) {
                     mail($u['user_email'], $_POST['temat'], $_POST['tresc']);
                     // 20 per row
                     if ($i % 20 == 0) {
                         sleep(1);
                         // wait, prevent flooding
                     }
                     $i++;
                 }
             }
             $parse['alert'] = Administration_Lib::save_message('ok', $this->_lang['ma_message_sended']);
         } else {
             $parse['alert'] = Administration_Lib::save_message('warning', $this->_lang['ma_subject_needed']);
         }
     }
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/global_message_view'), $parse));
 }
Пример #21
0
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     $game_stat = Functions_Lib::read_config('stat');
     $game_stat_level = Functions_Lib::read_config('stat_level');
     $game_stat_settings = Functions_Lib::read_config('stat_settings');
     $game_stat_update_time = Functions_Lib::read_config('stat_update_time');
     $this->_lang['alert'] = '';
     if (isset($_POST['save']) && $_POST['save'] == $this->_lang['cs_save_changes']) {
         if (isset($_POST['stat']) && $_POST['stat'] != $game_stat) {
             Functions_Lib::update_config('stat', $_POST['stat']);
             $game_stat = $_POST['stat'];
             $ASD3 = $_POST['stat'];
         }
         if (isset($_POST['stat_level']) && is_numeric($_POST['stat_level']) && $_POST['stat_level'] != $game_stat_level) {
             Functions_Lib::update_config('stat_level', $_POST['stat_level']);
             $game_stat_level = $_POST['stat_level'];
             $ASD1 = $_POST['stat_level'];
         }
         if (isset($_POST['stat_settings']) && is_numeric($_POST['stat_settings']) && $_POST['stat_settings'] != $game_stat_settings) {
             Functions_Lib::update_config('stat_settings', $_POST['stat_settings']);
             $game_stat_settings = $_POST['stat_settings'];
         }
         if (isset($_POST['stat_update_time']) && is_numeric($_POST['stat_update_time']) && $_POST['stat_update_time'] != $game_stat_update_time) {
             Functions_Lib::update_config('stat_update_time', $_POST['stat_update_time']);
             $game_stat_update_time = $_POST['stat_update_time'];
         }
         $this->_lang['alert'] = Administration_Lib::save_message('ok', $this->_lang['cs_all_ok_message']);
     }
     $selected = "selected=\"selected\"";
     $stat = $game_stat == 1 ? 'sel_sta1' : 'sel_sta0';
     $this->_lang[$stat] = $selected;
     $this->_lang['stat_level'] = $game_stat_level;
     $this->_lang['stat_settings'] = $game_stat_settings;
     $this->_lang['stat_update_time'] = $game_stat_update_time;
     $this->_lang['yes'] = $this->_lang['cs_yes'][1];
     $this->_lang['no'] = $this->_lang['cs_no'][0];
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/statistics_view'), $this->_lang));
 }
Пример #22
0
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     $parse = $this->_lang;
     $update = Functions_Lib::read_config('stat_last_update');
     $backup = Functions_Lib::read_config('last_backup');
     $cleanup = Functions_Lib::read_config('last_cleanup');
     $modules = explode(';', Functions_Lib::read_config('modules'));
     $count_modules = 0;
     // COUNT MODULES
     foreach ($modules as $module) {
         if ($module == 1) {
             $count_modules++;
         }
     }
     // LOAD STATISTICS
     $inactive_time = time() - 60 * 60 * 24 * 7;
     $users_count = parent::$db->query_fetch("SELECT (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tSELECT COUNT(user_id)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . USERS . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ) AS users_count,\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ( SELECT COUNT(user_id)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\tFROM " . USERS . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\tWHERE user_onlinetime < {$inactive_time} AND user_onlinetime <> 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ) AS inactive_count,\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ( SELECT COUNT(setting_user_id)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\tFROM " . SETTINGS . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\tWHERE setting_vacations_status <> 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ) AS on_vacation,\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ( SELECT COUNT(setting_user_id)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\tFROM " . SETTINGS . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\tWHERE setting_delete_account <> 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ) AS to_delete,\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ( SELECT COUNT(user_id)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\tFROM " . USERS . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\tWHERE user_banned <> 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ) AS banned_users,\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ( SELECT COUNT(fleet_id)\n\t\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 ) AS fleets_count");
     // LOAD STATISTICS
     $db_tables = parent::$db->query("SHOW TABLE STATUS");
     $db_size = 0;
     while ($row = parent::$db->fetch_array($db_tables)) {
         $db_size += $row['Data_length'] + $row['Index_length'];
     }
     // PARSE STATISTICS
     $parse['info_points'] = date(Functions_Lib::read_config('date_format_extended'), $update) . ' | ' . Format_Lib::pretty_time(time() - $update);
     $parse['info_backup'] = date(Functions_Lib::read_config('date_format_extended'), $backup) . ' | ' . Format_Lib::pretty_time(time() - $backup);
     $parse['info_cleanup'] = date(Functions_Lib::read_config('date_format_extended'), $cleanup) . ' | ' . Format_Lib::pretty_time(time() - $cleanup);
     $parse['info_modules'] = $count_modules . '/' . (count($modules) - 1);
     $parse['info_total_users'] = $users_count['users_count'];
     $parse['info_inactive_users'] = $users_count['inactive_count'];
     $parse['info_vacation_users'] = $users_count['on_vacation'];
     $parse['info_delete_mode_users'] = $users_count['to_delete'];
     $parse['info_banned_users'] = $users_count['banned_users'];
     $parse['info_flying_fleets'] = $users_count['fleets_count'];
     $parse['info_database_size'] = round($db_size / 1024, 1) . ' kb';
     $parse['info_database_server'] = 'MySQL ' . parent::$db->server_info();
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template("adm/information_view"), $parse));
 }
Пример #23
0
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     $resource = parent::$objects->get_objects();
     $reslist = parent::$objects->get_objects_list();
     $planetsrow = parent::$db->query("SELECT `planet_id`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_name`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_galaxy`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_system`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_planet`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_type`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_image`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_field_current`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_field_max`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_metal`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_metal_perhour`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_crystal`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_crystal_perhour`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_deuterium`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_deuterium_perhour`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_energy_used`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_energy_max`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_metal_mine`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_crystal_mine`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_deuterium_sintetizer`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_solar_plant`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_fusion_reactor`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_robot_factory`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_nano_factory`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_hangar`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_metal_store`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_crystal_store`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_deuterium_tank`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_laboratory`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_terraformer`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_ally_deposit`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_missile_silo`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_mondbasis`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_phalanx`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_jump_gate`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_rocket_launcher`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_light_laser`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_heavy_laser`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_gauss_cannon`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_ion_cannon`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_plasma_turret`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_small_shield_dome`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_large_shield_dome`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_anti-ballistic_missile`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_interplanetary_missile`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_small_cargo_ship`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_big_cargo_ship`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_light_fighter`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_heavy_fighter`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_cruiser`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_battleship`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_colony_ship`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_recycler`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_espionage_probe`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_bomber`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_solar_satellite`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_destroyer`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_deathstar`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_battlecruiser`\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . PLANETS . " AS p\r\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`\r\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`\r\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`\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_user_id` = '" . (int) $this->_current_user['user_id'] . "'\r\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->fetch_array($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'] . '">' . Format_Lib::pretty_number($p['planet_metal']) . '</a> / ' . Format_Lib::pretty_number($p['planet_metal_perhour'] + Functions_Lib::read_config('metal_basic_income')), '<a href="game.php?page=resources&cp=' . $p['planet_id'] . '&amp;re=0&amp;planettype=' . $p['planet_type'] . '">' . Format_Lib::pretty_number($p['planet_crystal']) . '</a> / ' . Format_Lib::pretty_number($p['planet_crystal_perhour'] + Functions_Lib::read_config('crystal_basic_income')), '<a href="game.php?page=resources&cp=' . $p['planet_id'] . '&amp;re=0&amp;planettype=' . $p['planet_type'] . '">' . Format_Lib::pretty_number($p['planet_deuterium']) . '</a> / ' . Format_Lib::pretty_number($p['planet_deuterium_perhour'] + Functions_Lib::read_config('deuterium_basic_income')), Format_Lib::pretty_number($p['planet_energy_max'] - $p['planet_energy_used']) . ' / ' . Format_Lib::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=" . Developments_Lib::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);
 }
Пример #24
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']) {
             Functions_Lib::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->backup_db();
             if ($result != FALSE) {
                 $parse['alert'] = Administration_Lib::save_message('ok', str_replace('%s', round($result / 1024, 2), $this->_lang['bku_backup_done']));
             }
         }
     }
     // PARSE DATA
     $auto_backup_status = Functions_Lib::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));
 }
Пример #25
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->fetch_array($query)) {
         $parse['player'] = $u[1];
         $parse['reason'] = $u[2];
         $parse['since'] = date(Functions_Lib::read_config('date_format_extended'), $u[4]);
         $parse['until'] = date(Functions_Lib::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));
 }
Пример #26
0
 /**
  * method deploy_mission
  * param $fleet_row
  * return the deploy result
  */
 public function deploy_mission($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'], Format_Lib::pretty_number($fleet_row['fleet_resource_metal']), $this->_lang['Crystal'], Format_Lib::pretty_number($fleet_row['fleet_resource_crystal']), $this->_lang['Deuterium'], Format_Lib::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;
             Functions_Lib::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'], Format_Lib::pretty_number($fleet_row['fleet_resource_metal']), $this->_lang['Crystal'], Format_Lib::pretty_number($fleet_row['fleet_resource_crystal']), $this->_lang['Deuterium'], Format_Lib::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;
             Functions_Lib::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']);
         }
     }
 }
Пример #27
0
 /**
  * method check_updates
  * param
  * return check for updates and returns true or false
  */
 private function check_updates()
 {
     if (function_exists('file_get_contents')) {
         $last_v = @file_get_contents('http://xgproyect.xgproyect.net/current.php');
         $system_v = Functions_Lib::read_config('version');
         return version_compare($system_v, $last_v, '<');
     }
 }
Пример #28
0
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     if (!array_key_exists($this->_element_id, $this->_resource)) {
         Functions_Lib::redirect('game.php?page=techtree');
     }
     $GateTPL = '';
     $DestroyTPL = '';
     $TableHeadTPL = '';
     $TableFooterTPL = '';
     $parse = $this->_lang;
     $parse['dpath'] = DPATH;
     $parse['name'] = $this->_lang['info'][$this->_element_id]['name'];
     $parse['image'] = $this->_element_id;
     $parse['description'] = $this->_lang['info'][$this->_element_id]['description'];
     if ($this->_element_id < 13 or $this->_element_id == 43 && $this->_current_planet[$this->_resource[43]] > 0) {
         $PageTPL = parent::$page->get_template('infos/info_buildings_table');
     } elseif ($this->_element_id < 200) {
         $PageTPL = parent::$page->get_template('infos/info_buildings_general');
     } elseif ($this->_element_id < 400) {
         $PageTPL = parent::$page->get_template('infos/info_buildings_fleet');
     } elseif ($this->_element_id < 600) {
         $PageTPL = parent::$page->get_template('infos/info_buildings_defense');
     } else {
         $PageTPL = parent::$page->get_template('infos/info_officiers_general');
     }
     //S�lo hay destroy en <200
     if ($this->_element_id < 200 && $this->_element_id != 33 && $this->_element_id != 41) {
         $DestroyTPL = parent::$page->get_template('infos/info_buildings_destroy');
     }
     if ($this->_element_id >= 1 && $this->_element_id <= 3) {
         $PageTPL = parent::$page->get_template('infos/info_buildings_table');
         $TableHeadTPL = parent::$page->get_template('infos/info_production_header');
         $TableTPL = parent::$page->get_template('infos/info_production_body');
     } elseif ($this->_element_id == 4) {
         $PageTPL = parent::$page->get_template('infos/info_buildings_table');
         $TableHeadTPL = parent::$page->get_template('infos/info_production_simple_header');
         $TableTPL = parent::$page->get_template('infos/info_production_simple_body');
     } elseif ($this->_element_id >= 22 && $this->_element_id <= 24) {
         $PageTPL = parent::$page->get_template('infos/info_buildings_table');
         $DestroyTPL = parent::$page->get_template('infos/info_buildings_destroy');
         $TableHeadTPL = parent::$page->get_template('infos/info_storage_header');
         $TableTPL = parent::$page->get_template('infos/info_storage_table');
     } elseif ($this->_element_id == 12) {
         $TableHeadTPL = parent::$page->get_template('infos/info_energy_header');
         $TableTPL = parent::$page->get_template('infos/info_energy_body');
     } elseif ($this->_element_id == 42) {
         $TableHeadTPL = parent::$page->get_template('infos/info_range_header');
         $TableTPL = parent::$page->get_template('infos/info_range_body');
     } elseif ($this->_element_id == 43) {
         $GateTPL = parent::$page->get_template('infos/info_gate_table');
         if ($_POST) {
             Functions_Lib::message($this->DoFleetJump(), "game.php?page=infos&gid=43", 2);
         }
     } elseif ($this->_element_id == 124) {
         $PageTPL = parent::$page->get_template('infos/info_buildings_table');
         $DestroyTPL = parent::$page->get_template('infos/info_buildings_destroy');
         $TableHeadTPL = parent::$page->get_template('infos/info_astrophysics_header');
         $TableTPL = parent::$page->get_template('infos/info_astrophysics_table');
         $TableFooterTPL = parent::$page->get_template('infos/info_astrophysics_footer');
     } elseif ($this->_element_id >= 202 && $this->_element_id <= 250) {
         $PageTPL = parent::$page->get_template('infos/info_buildings_fleet');
         $parse['element_typ'] = $this->_lang['tech'][200];
         $parse['rf_info_to'] = $this->ShowRapidFireTo();
         $parse['rf_info_fr'] = $this->ShowRapidFireFrom();
         $parse['hull_pt'] = Format_Lib::pretty_number($this->_pricelist[$this->_element_id]['metal'] + $this->_pricelist[$this->_element_id]['crystal']);
         $parse['shield_pt'] = Format_Lib::pretty_number($this->_combat_caps[$this->_element_id]['shield']);
         $parse['attack_pt'] = Format_Lib::pretty_number($this->_combat_caps[$this->_element_id]['attack']);
         $parse['capacity_pt'] = Format_Lib::pretty_number($this->_pricelist[$this->_element_id]['capacity']);
         $parse['base_speed'] = Format_Lib::pretty_number($this->_pricelist[$this->_element_id]['speed']);
         $parse['base_conso'] = Format_Lib::pretty_number($this->_pricelist[$this->_element_id]['consumption']);
         if ($this->_element_id == 202) {
             $parse['upd_speed'] = "<font color=\"yellow\">(" . Format_Lib::pretty_number($this->_pricelist[$this->_element_id]['speed2']) . ")</font>";
             $parse['upd_conso'] = "<font color=\"yellow\">(" . Format_Lib::pretty_number($this->_pricelist[$this->_element_id]['consumption2']) . ")</font>";
         } elseif ($this->_element_id == 211) {
             $parse['upd_speed'] = "<font color=\"yellow\">(" . Format_Lib::pretty_number($this->_pricelist[$this->_element_id]['speed2']) . ")</font>";
         }
     } elseif ($this->_element_id >= 401 && $this->_element_id <= 550) {
         $PageTPL = parent::$page->get_template('infos/info_buildings_defense');
         $parse['element_typ'] = $this->_lang['tech'][400];
         if ($this->_element_id < 500) {
             $parse['rf_info_to'] = $this->ShowRapidFireTo();
             $parse['rf_info_fr'] = $this->ShowRapidFireFrom();
         }
         $parse['hull_pt'] = Format_Lib::pretty_number($this->_pricelist[$this->_element_id]['metal'] + $this->_pricelist[$this->_element_id]['crystal']);
         $parse['shield_pt'] = Format_Lib::pretty_number($this->_combat_caps[$this->_element_id]['shield']);
         $parse['attack_pt'] = Format_Lib::pretty_number($this->_combat_caps[$this->_element_id]['attack']);
     }
     if ($TableHeadTPL != '') {
         $parse['table_head'] = parent::$page->parse_template($TableHeadTPL, $this->_lang);
         if ($this->_element_id >= 22 && $this->_element_id <= 24) {
             $parse['table_data'] = $this->storage_table($TableTPL);
         } elseif ($this->_element_id == 124) {
             $parse['table_data'] = $this->astrophysics_table($TableTPL);
         } else {
             $parse['table_data'] = $this->ShowProductionTable($TableTPL);
         }
     }
     if ($TableFooterTPL != '') {
         $parse['table_footer'] = parent::$page->parse_template($TableFooterTPL, $this->_lang);
     }
     $page = parent::$page->parse_template($PageTPL, $parse);
     if ($GateTPL != '') {
         if ($this->_current_planet[$this->_resource[$this->_element_id]] > 0) {
             $RestString = $this->GetNextJumpWaitTime($this->_current_planet);
             $parse['gate_start_link'] = $this->planet_link($this->_current_planet);
             if ($RestString['value'] != 0) {
                 $parse['gate_time_script'] = Functions_Lib::chrono_applet("Gate", "1", $RestString['value'], TRUE);
                 $parse['gate_wait_time'] = "<div id=\"bxx" . "Gate" . "1" . "\"></div>";
                 $parse['gate_script_go'] = Functions_Lib::chrono_applet("Gate", "1", $RestString['value'], FALSE);
             } else {
                 $parse['gate_time_script'] = "";
                 $parse['gate_wait_time'] = "";
                 $parse['gate_script_go'] = "";
             }
             $parse['gate_dest_moons'] = $this->BuildJumpableMoonCombo($this->_current_user, $this->_current_planet);
             $parse['gate_fleet_rows'] = $this->BuildFleetListRows($this->_current_planet);
             $page .= parent::$page->parse_template($GateTPL, $parse);
         }
     }
     if ($DestroyTPL != '') {
         if (isset($this->_current_planet[$this->_resource[$this->_element_id]]) && $this->_current_planet[$this->_resource[$this->_element_id]] > 0) {
             $NeededRessources = Developments_Lib::development_price($this->_current_user, $this->_current_planet, $this->_element_id, TRUE, TRUE);
             $DestroyTime = Developments_Lib::development_time($this->_current_user, $this->_current_planet, $this->_element_id) / 2;
             $parse['destroyurl'] = "game.php?page=" . Developments_Lib::set_building_page($this->_element_id) . "&cmd=destroy&building=" . $this->_element_id;
             $parse['levelvalue'] = $this->_current_planet[$this->_resource[$this->_element_id]];
             $parse['nfo_metal'] = $this->_lang['Metal'];
             $parse['nfo_crysta'] = $this->_lang['Crystal'];
             $parse['nfo_deuter'] = $this->_lang['Deuterium'];
             $parse['metal'] = Format_Lib::pretty_number($NeededRessources['metal']);
             $parse['crystal'] = Format_Lib::pretty_number($NeededRessources['crystal']);
             $parse['deuterium'] = Format_Lib::pretty_number($NeededRessources['deuterium']);
             $parse['destroytime'] = Format_Lib::pretty_time($DestroyTime);
             $page .= parent::$page->parse_template($DestroyTPL, $parse);
         }
     }
     parent::$page->display($page);
 }
Пример #29
0
 public function build_page()
 {
     $parse = $this->_lang;
     if (isset($_POST['fmenge'])) {
         $Missiles[502] = $this->_current_planet[$this->_resource[502]];
         $Missiles[503] = $this->_current_planet[$this->_resource[503]];
         $SiloSize = $this->_current_planet[$this->_resource[44]];
         $MaxMissiles = $SiloSize * 10;
         $BuildQueue = $this->_current_planet['planet_b_hangar_id'];
         $BuildArray = explode(";", $BuildQueue);
         $totalCount = 0;
         for ($QElement = 0; $QElement < count($BuildArray); $QElement++) {
             $ElmentArray = explode(",", $BuildArray[$QElement]);
             if ($ElmentArray[0] == 502) {
                 $Missiles[502] += $ElmentArray[1];
             } elseif ($ElmentArray[0] == 503) {
                 $Missiles[503] += $ElmentArray[1];
             }
         }
         foreach ($_POST['fmenge'] as $Element => $Count) {
             if ($Element < 300 or $Element > 550) {
                 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 ($Element == 407 or $Element == 408) {
                     if (!$this->is_shield_in_queue($BuildQueue, $Element)) {
                         $Count = 1;
                     } else {
                         $Count = 0;
                     }
                 }
                 if (Developments_Lib::is_development_allowed($this->_current_user, $this->_current_planet, $Element)) {
                     $MaxElements = $this->GetMaxConstructibleElements($Element, $this->_current_planet);
                     if ($Element == 502 || $Element == 503) {
                         $ActuMissiles = $Missiles[502] + 2 * $Missiles[503];
                         $MissilesSpace = $MaxMissiles - $ActuMissiles;
                         if ($Element == 502) {
                             if ($Count > $MissilesSpace) {
                                 $Count = $MissilesSpace;
                             }
                         } else {
                             if ($Count > floor($MissilesSpace / 2)) {
                                 $Count = floor($MissilesSpace / 2);
                             }
                         }
                         if ($Count > $MaxElements) {
                             $Count = $MaxElements;
                         }
                         $Missiles[$Element] += $Count;
                     } else {
                         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\r\n\t\t\t\t\t\t\t\t\t\tp.`planet_b_hangar_id` = '" . $this->_current_planet['planet_b_hangar_id'] . "',\r\n\t\t\t\t\t\t\t\t\t\tp.`planet_metal` = '" . $this->_current_planet['planet_metal'] . "',\r\n\t\t\t\t\t\t\t\t\t\tp.`planet_crystal` = '" . $this->_current_planet['planet_crystal'] . "',\r\n\t\t\t\t\t\t\t\t\t\tp.`planet_deuterium` = '" . $this->_current_planet['planet_deuterium'] . "'\r\n\t\t\t\t\t\t\t\t\t\tWHERE p.`planet_id` = '" . $this->_current_planet['planet_id'] . "';");
         }
         Functions_Lib::redirect('game.php?page=defense');
     }
     if ($this->_current_planet[$this->_resource[21]] == 0) {
         Functions_Lib::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 > 400 && $Element <= 599) {
             if (Developments_Lib::is_development_allowed($this->_current_user, $this->_current_planet, $Element)) {
                 $CanBuildOne = Developments_Lib::is_development_payable($this->_current_user, $this->_current_planet, $Element, FALSE);
                 $BuildOneElementTime = Developments_Lib::development_time($this->_current_user, $this->_current_planet, $Element);
                 $ElementCount = $this->_current_planet[$this->_resource[$Element]];
                 $ElementNbre = $ElementCount == 0 ? "" : " (" . $this->_lang['bd_available'] . Format_Lib::pretty_number($ElementCount) . ")";
                 $parse['add_element'] = '';
                 $parse['dpath'] = DPATH;
                 $parse['element'] = $Element;
                 $parse['element_name'] = $ElementName;
                 $parse['element_description'] = $this->_lang['res']['descriptions'][$Element];
                 $parse['element_price'] = Developments_Lib::formated_development_price($this->_current_user, $this->_current_planet, $Element, FALSE);
                 $parse['building_time'] = Developments_Lib::formated_development_time($BuildOneElementTime);
                 $parse['element_nbre'] = $ElementNbre;
                 if ($CanBuildOne && !parent::$users->is_on_vacations($this->_current_user)) {
                     $InQueue = strpos($this->_current_planet['planet_b_hangar_id'], $Element . ",");
                     $IsBuildp = $this->_current_planet[$this->_resource[407]] >= 1 ? TRUE : FALSE;
                     $IsBuildg = $this->_current_planet[$this->_resource[408]] >= 1 ? TRUE : FALSE;
                     $BuildIt = TRUE;
                     if ($Element == 407 || $Element == 408) {
                         $BuildIt = FALSE;
                         if ($Element == 407 && !$IsBuildp && $InQueue === FALSE) {
                             $BuildIt = TRUE;
                         }
                         if ($Element == 408 && !$IsBuildg && $InQueue === FALSE) {
                             $BuildIt = TRUE;
                         }
                     }
                     if (!$BuildIt) {
                         $parse['add_element'] = '<font color="red">' . $this->_lang['bd_protection_shield_only_one'] . '</font>';
                     } elseif ($NotBuilding) {
                         $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_defenses'] = '<tr><td class="c" colspan="2" align="center"><input type="submit" value="' . $this->_lang['bd_build_defenses'] . '"></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('defenses');
     }
     $parse['buildlist'] = $PageTable;
     $parse['buildinglist'] = $BuildQueue;
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template('buildings/buildings_defense'), $parse));
 }
Пример #30
0
 /**
  * method recycle_message
  * param $owner
  * param $message
  * param $time
  * param $status_message
  * return send a message with the recycle details
  */
 private function recycle_message($owner, $message, $time, $status_message)
 {
     Functions_Lib::send_message($owner, '', $time, 5, $this->_lang['sys_mess_spy_control'], $status_message, $message);
 }