/**
  * 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));
 }
 /**
  * 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));
 }
Beispiel #3
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('game_name', $this->_game_config['game_name']);
         Functions_Lib::update_config('game_logo', $this->_game_config['game_logo']);
         Functions_Lib::update_config('lang', $this->_game_config['lang']);
         Functions_Lib::update_config('game_speed', $this->_game_config['game_speed']);
         Functions_Lib::update_config('fleet_speed', $this->_game_config['fleet_speed']);
         Functions_Lib::update_config('resource_multiplier', $this->_game_config['resource_multiplier']);
         Functions_Lib::update_config('admin_email', $this->_game_config['admin_email']);
         Functions_Lib::update_config('forum_url', $this->_game_config['forum_url']);
         Functions_Lib::update_config('reg_enable', $this->_game_config['reg_enable']);
         Functions_Lib::update_config('game_enable', $this->_game_config['game_enable']);
         Functions_Lib::update_config('close_reason', $this->_game_config['close_reason']);
         Functions_Lib::update_config('ssl_enabled', $this->_game_config['ssl_enabled']);
         Functions_Lib::update_config('date_time_zone', $this->_game_config['date_time_zone']);
         Functions_Lib::update_config('date_format', $this->_game_config['date_format']);
         Functions_Lib::update_config('date_format_extended', $this->_game_config['date_format_extended']);
         Functions_Lib::update_config('adm_attack', $this->_game_config['adm_attack']);
         Functions_Lib::update_config('debug', $this->_game_config['debug']);
         Functions_Lib::update_config('fleet_cdr', $this->_game_config['fleet_cdr']);
         Functions_Lib::update_config('defs_cdr', $this->_game_config['defs_cdr']);
         Functions_Lib::update_config('noobprotection', $this->_game_config['noobprotection']);
         Functions_Lib::update_config('noobprotectiontime', $this->_game_config['noobprotectiontime']);
         Functions_Lib::update_config('noobprotectionmulti', $this->_game_config['noobprotectionmulti']);
         $parse['alert'] = Administration_Lib::save_message('ok', $this->_lang['se_all_ok_message']);
     }
     $parse['game_name'] = $this->_game_config['game_name'];
     $parse['game_logo'] = $this->_game_config['game_logo'];
     $parse['language_settings'] = Functions_Lib::get_languages($this->_game_config['lang']);
     $parse['game_speed'] = $this->_game_config['game_speed'] / 2500;
     $parse['fleet_speed'] = $this->_game_config['fleet_speed'] / 2500;
     $parse['resource_multiplier'] = $this->_game_config['resource_multiplier'];
     $parse['admin_email'] = $this->_game_config['admin_email'];
     $parse['forum_url'] = $this->_game_config['forum_url'];
     $parse['closed'] = $this->_game_config['game_enable'] == 1 ? " checked = 'checked' " : "";
     $parse['close_reason'] = stripslashes($this->_game_config['close_reason']);
     $parse['ssl_enabled'] = $this->_game_config['ssl_enabled'] == 1 ? " checked = 'checked' " : "";
     $parse['date_time_zone'] = $this->time_zone_picker();
     $parse['date_format'] = $this->_game_config['date_format'];
     $parse['date_format_extended'] = $this->_game_config['date_format_extended'];
     $parse['adm_attack'] = $this->_game_config['adm_attack'] == 1 ? " checked = 'checked' " : "";
     $parse['debug'] = $this->_game_config['debug'] == 1 ? " checked = 'checked' " : "";
     $parse['shiips'] = $this->_game_config['fleet_cdr'];
     $parse['defenses'] = $this->_game_config['defs_cdr'];
     $parse['noobprot'] = $this->_game_config['noobprotection'] == 1 ? " checked = 'checked' " : "";
     $parse['noobprot2'] = $this->_game_config['noobprotectiontime'];
     $parse['noobprot3'] = $this->_game_config['noobprotectionmulti'];
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/server_view'), $parse));
 }
Beispiel #4
0
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     $parse = $this->_lang;
     $query = isset($_POST['querie']) ? $_POST['querie'] : NULL;
     if ($_POST) {
         $query = str_replace("\\'", "'", str_replace('\\"', '"', $query));
         if (!mysql_query($query)) {
             $parse['alert'] = Administration_Lib::save_message('error', mysql_error());
         } else {
             $parse['alert'] = Administration_Lib::save_message('ok', $this->_lang['qe_succes']);
         }
     }
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/queries_view'), $parse));
 }
 /**
  * __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();
     } else {
         die(Functions_Lib::message($this->_lang['ge_no_permissions']));
     }
 }
 /**
  * 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));
 }
Beispiel #7
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));
 }
Beispiel #8
0
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     $parse = $this->_lang;
     $error = 0;
     $old_version = FALSE;
     $message[1] = '';
     $message[2] = '';
     $message[3] = '';
     $message[4] = '';
     // VERIFICATIONS
     if ($this->_current_user['user_authlevel'] >= 3) {
         if (is_writable(XGP_ROOT . 'application/config/config.php')) {
             $message[1] = $this->_lang['hm_config_file_writable'] . '<br />';
             $error++;
         }
         if (filesize(XGP_ROOT . LOGS_PATH . 'ErrorLog.php') != 0) {
             $message[2] = $this->_lang['hm_database_errors'] . '<br />';
             $error++;
         }
         if ($this->check_updates()) {
             $message[3] = $this->_lang['hm_old_version'] . '<br />';
             $old_version = TRUE;
             $error++;
         }
         if (Administration_Lib::install_dir_exists()) {
             $message[4] = $this->_lang['hm_install_file_detected'] . '<br />';
             $error++;
         }
     }
     if ($error > 1) {
         $parse['error_message'] = '<br />' . $message[1] . $message[2] . $message[3] . $message[4];
         $parse['second_style'] = "alert-error";
         $parse['error_type'] = $this->_lang['hm_errors'];
     } elseif ($error == 1) {
         $parse['error_message'] = '<br />' . $message[1] . $message[2] . $message[3] . $message[4];
         $parse['second_style'] = "alert-block";
         $parse['error_type'] = $this->_lang['hm_warning'];
     } else {
         $parse['error_message'] = $this->_lang['hm_all_ok'];
         $parse['second_style'] = "alert-success";
         $parse['error_type'] = $this->_lang['hm_ok'];
     }
     $parse['game_version'] = Functions_Lib::read_config('version');
     $parse['old_version_alert'] = $old_version ? '<a href="http://www.xgproyect.net/downloads/">' . $this->_lang['hm_update'] . '</a> <i class="icon-download"></i>' : '';
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/home_view'), $parse));
 }
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     $parse = $this->_lang;
     $parse['alert'] = '';
     $parse['language_files'] = $this->get_files();
     if ($_POST) {
         if (isset($_POST['file_edit'])) {
             $this->_current_file = $_POST['file_edit'];
         }
         if (isset($_POST['save_file'])) {
             $this->save_contents($_POST['file_content']);
             $parse['alert'] = Administration_Lib::save_message('ok', $this->_lang['ce_all_ok_message']);
         }
     }
     $parse['language_files'] = $this->get_files();
     $parse['contents'] = empty($this->_current_file) ? '' : $this->get_contents();
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/editor_view'), $parse));
 }
 /**
  * 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));
 }
 /**
  * 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));
 }
 /**
  * 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));
 }
Beispiel #13
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));
 }
Beispiel #14
0
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     $parse = $this->_lang;
     if ($_POST) {
         if ($_POST['resetall'] != 'on') {
             // HANGARES Y DEFENSAS
             if ($_POST['defenses'] == 'on') {
                 parent::$db->query("UPDATE " . DEFENSES . " SET\n\t\t\t\t\t\t\t\t\t\t\t`defense_rocket_launcher` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`defense_light_laser` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`defense_heavy_laser` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`defense_gauss_cannon` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`defense_ion_cannon` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`defense_plasma_turret` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`defense_small_shield_dome` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`defense_large_shield_dome` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`defense_anti-ballistic_missile` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`defense_interplanetary_missile` = '0'");
             }
             if ($_POST['ships'] == 'on') {
                 parent::$db->query("UPDATE " . SHIPS . " SET\n\t\t\t\t\t\t\t\t\t\t\t`ship_small_cargo_ship` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`ship_big_cargo_ship` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`ship_light_fighter` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`ship_heavy_fighter` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`ship_cruiser` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`ship_battleship` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`ship_colony_ship` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`ship_recycler` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`ship_espionage_probe` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`ship_bomber` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`ship_solar_satellite` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`ship_destroyer` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`ship_deathstar` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`ship_battlecruiser` = '0'");
             }
             if ($_POST['h_d'] == 'on') {
                 parent::$db->query("UPDATE " . PLANETS . " SET\n\t\t\t\t\t\t\t\t\t\t\t`planet_b_hangar` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`planet_b_hangar_id` = ''");
             }
             // EDIFICIOS
             if ($_POST['edif_p'] == 'on') {
                 parent::$db->query("UPDATE " . BUILDINGS . " AS b\n\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . PLANETS . " AS p ON b.building_planet_id = p.`planet_id` SET\n\t\t\t\t\t\t\t\t\t\t\t`building_metal_mine` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`building_crystal_mine` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`building_deuterium_sintetizer` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`building_solar_plant` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`building_fusion_reactor` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`building_robot_factory` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`building_nano_factory` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`building_hangar` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`building_metal_store` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`building_crystal_store` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`building_deuterium_tank` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`building_laboratory` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`building_terraformer` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`building_ally_deposit` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`building_missile_silo` = '0'\n\t\t\t\t\t\t\t\t\t\t\tWHERE p.`planet_type` = '1'");
             }
             if ($_POST['edif_l'] == 'on') {
                 parent::$db->query("UPDATE " . BUILDINGS . " AS b\n\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . PLANETS . " AS p ON b.building_planet_id = p.`planet_id` SET\n\t\t\t\t\t\t\t\t\t\t\t`building_mondbasis` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`building_phalanx` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`building_jump_gate` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`planet_last_jump_time` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`fusion_plant` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`building_robot_factory` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`building_hangar` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`building_metal_store` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`building_crystal_store` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`building_deuterium_tank` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`building_ally_deposit` = '0'\n\t\t\t\t\t\t\t\t\t\t\tWHERE p.`planet_type` = '3'");
             }
             if ($_POST['edif'] == 'on') {
                 parent::$db->query("UPDATE " . PLANETS . " SET\n\t\t\t\t\t\t\t\t\t\t\t`planet_b_building` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`planet_b_building_id` = ''");
             }
             // INVESTIGACIONES Y OFICIALES
             if ($_POST['inves'] == 'on') {
                 parent::$db->query("UPDATE " . RESEARCH . " SET\n\t\t\t\t\t\t\t\t\t\t\t`research_espionage_technology` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`research_computer_technology` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`research_weapons_technology` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`research_shielding_technology` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`research_armour_technology` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`research_energy_technology` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`research_hyperspace_technology` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`research_combustion_drive` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`research_impulse_drive` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`research_hyperspace_drive` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`research_laser_technology` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`research_ionic_technology` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`research_plasma_technology` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`research_intergalactic_research_network` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`research_astrophysics` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`research_graviton_technology` = '0'");
             }
             if ($_POST['ofis'] == 'on') {
                 parent::$db->query("UPDATE " . PREMIUM . " SET\n\t\t\t\t\t\t\t\t\t\t\t`premium_officier_commander` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`premium_officier_admiral` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`premium_officier_engineer` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`premium_officier_geologist` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`premium_officier_technocrat` = '0'");
             }
             if ($_POST['inves_c'] == 'on') {
                 parent::$db->query("UPDATE " . PLANETS . " SET\n\t\t\t\t\t\t\t\t\t\t\t`planet_b_tech` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`planet_b_tech_id` = '0'");
                 parent::$db->query("UPDATE " . RESEARCH . " SET\n\t\t\t\t\t\t\t\t\t\t\t`research_current_research` = '0'");
             }
             // RECURSOS
             if ($_POST['dark'] == 'on') {
                 parent::$db->query("UPDATE " . PREMIUM . " SET\n\t\t\t\t\t\t\t\t\t\t\t`premium_dark_matter` = '0'");
             }
             if ($_POST['resources'] == 'on') {
                 parent::$db->query("UPDATE " . PLANETS . " SET\n\t\t\t\t\t\t\t\t\t\t\t`planet_metal` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`planet_crystal` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`planet_deuterium` = '0'");
             }
             // GENERAL
             if ($_POST['notes'] == 'on') {
                 parent::$db->query("TRUNCATE TABLE " . NOTES . "");
             }
             if ($_POST['rw'] == 'on') {
                 parent::$db->query("TRUNCATE TABLE " . REPORTS . "");
             }
             if ($_POST['friends'] == 'on') {
                 parent::$db->query("TRUNCATE TABLE " . BUDDY . "");
             }
             if ($_POST['alliances'] == 'on') {
                 parent::$db->query("TRUNCATE TABLE " . ALLIANCE . "");
                 parent::$db->query("TRUNCATE TABLE " . ALLIANCE_STATISTICS . "");
                 parent::$db->query("UPDATE " . USERS . " SET\n\t\t\t\t\t\t\t\t\t\t\t`user_ally_id` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`user_ally_request` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`user_ally_request_text` = 'NULL',\n\t\t\t\t\t\t\t\t\t\t\t`user_ally_register_time` = '0',\n\t\t\t\t\t\t\t\t\t\t\t`user_ally_rank_id` = '0'");
             }
             if ($_POST['fleets'] == 'on') {
                 parent::$db->query("TRUNCATE TABLE " . FLEETS . "");
             }
             if ($_POST['banneds'] == 'on') {
                 parent::$db->query("TRUNCATE TABLE " . BANNED . "");
                 parent::$db->query("UPDATE " . USERS . " SET\n\t\t\t\t\t\t\t\t\t\t\t`user_banned` = '0'\n\t\t\t\t\t\t\t\t\t\t\tWHERE `user_id` > '1'");
             }
             if ($_POST['messages'] == 'on') {
                 parent::$db->query("TRUNCATE TABLE " . MESSAGES . "");
             }
             if ($_POST['statpoints'] == 'on') {
                 parent::$db->query("TRUNCATE TABLE " . USERS_STATISTICS . "");
                 parent::$db->query("TRUNCATE TABLE " . ALLIANCE_STATISTICS . "");
             }
             if ($_POST['moons'] == 'on') {
                 parent::$db->query("DELETE FROM " . PLANETS . " WHERE `planet_type` = '3'");
             }
         } else {
             $this->reset_universe();
         }
         $parse['alert'] = Administration_Lib::save_message('ok', $this->_lang['re_reset_excess']);
     }
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/reset_view'), $parse));
 }
Beispiel #15
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->fetch_assoc($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(Functions_Lib::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 != '' ? Administration_Lib::save_message($this->_alert_type, $this->_alert_info) : '';
     return parent::$page->parse_template(parent::$page->get_template("adm/alliances_members_view"), $parse);
 }
Beispiel #16
0
 /**
  * method delete_messages
  * param
  * return delete messages
  */
 private function delete_messages()
 {
     $ids_array = '';
     // build the ID's list to delete, we're going to delete them all in one single query
     foreach ($_POST['delete_message'] as $message_id => $delete_status) {
         if ($delete_status == 'on' && $message_id > 0 && is_numeric($message_id)) {
             $ids_array .= $message_id . ',';
         }
     }
     // delete messages
     parent::$db->query("DELETE FROM `" . MESSAGES . "`\r\n\t\t\t\t\t\t\t\tWHERE `message_id` IN (" . rtrim($ids_array, ',') . ")");
     // show alert
     $this->_alert = Administration_Lib::save_message('ok', $this->_lang['mg_delete_ok']);
 }
Beispiel #17
0
 /**
  * method make_user
  * param
  * return a created user
  */
 private function make_user()
 {
     $parse = $this->_lang;
     $parse['level_combo'] = $this->build_level_combo();
     if (isset($_POST['add_user']) && $_POST['add_user']) {
         $name = (string) $_POST['name'];
         $pass = (string) $_POST['password'];
         $email = (string) $_POST['email'];
         $galaxy = (int) $_POST['galaxy'];
         $system = (int) $_POST['system'];
         $planet = (int) $_POST['planet'];
         $auth = (int) $_POST['authlevel'];
         $time = time();
         $i = 0;
         $error = '';
         $check_user = parent::$db->query_fetch("SELECT `user_name`\n\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\tWHERE `user_name` = '" . parent::$db->escape_value($_POST['name']) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1");
         $check_email = parent::$db->query_fetch("SELECT `user_email`\n\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\tWHERE `user_email` = '" . parent::$db->escape_value($_POST['email']) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1");
         $check_planet = parent::$db->query_fetch("SELECT COUNT(planet_id) AS count\n\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\tWHERE `planet_galaxy` = '" . $galaxy . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_system` = '" . $system . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_planet` = '" . $planet . "' LIMIT 1");
         if (!is_numeric($galaxy) && !is_numeric($system) && !is_numeric($planet)) {
             $error = $this->_lang['mk_user_only_numbers'];
             $i++;
         } elseif ($galaxy > MAX_GALAXY_IN_WORLD or $system > MAX_SYSTEM_IN_GALAXY || $planet > MAX_PLANET_IN_SYSTEM || $galaxy < 1 || $system < 1 || $planet < 1) {
             $error = $this->_lang['mk_user_wrong_coords'];
             $i++;
         }
         if (!$name or !$email or !$galaxy or !$system or !$planet) {
             $error .= $this->_lang['mk_user_complete_all'];
             $i++;
         }
         if (!Functions_Lib::valid_email(strip_tags($email))) {
             $error .= $this->_lang['mk_user_invalid_email'];
             $i++;
         }
         if ($check_user) {
             $error .= $this->_lang['mk_user_existing_name'];
             $i++;
         }
         if ($check_email) {
             $error .= $this->_lang['mk_user_existing_email'];
             $i++;
         }
         if ($check_planet['count'] != 0) {
             $error .= $this->_lang['mk_user_existing_planet'];
             $i++;
         }
         if (isset($_POST['password_check']) && $_POST['password_check']) {
             $pass = $this->generate_password();
         } else {
             if (strlen($pass) < 4) {
                 $error .= $this->_lang['mk_user_invalid_password'];
                 $i++;
             }
         }
         if ($i == 0) {
             parent::$db->query("INSERT INTO " . USERS . " SET\n\t\t\t\t\t\t\t\t\t\t`user_name` = '" . parent::$db->escape_value(strip_tags($name)) . "',\n\t\t\t\t\t\t\t\t\t\t`user_email` = '" . parent::$db->escape_value($email) . "',\n\t\t\t\t\t\t\t\t\t\t`user_email_permanent` = '" . parent::$db->escape_value($email) . "',\n\t\t\t\t\t\t\t\t\t\t`user_ip_at_reg` = '" . $_SERVER['REMOTE_ADDR'] . "',\n\t\t\t\t\t\t\t\t\t\t`user_home_planet_id` = '0',\n\t\t\t\t\t\t\t\t\t\t`user_register_time` = '" . $time . "',\n\t\t\t\t\t\t\t\t\t\t`user_onlinetime` = '" . $time . "',\n\t\t\t\t\t\t\t\t\t\t`user_authlevel` = '" . $auth . "',\n\t\t\t\t\t\t\t\t\t\t`user_password`='" . sha1($pass) . "';");
             $last_user_id = parent::$db->insert_id();
             $this->_creator->create_planet($galaxy, $system, $planet, $last_user_id, '', TRUE);
             $last_planet_id = parent::$db->insert_id();
             parent::$db->query("UPDATE " . USERS . " SET\n\t\t\t\t\t\t\t\t\t\t`user_home_planet_id` = '" . $last_planet_id . "',\n\t\t\t\t\t\t\t\t\t\t`user_current_planet` = '" . $last_planet_id . "',\n\t\t\t\t\t\t\t\t\t\t`user_galaxy` = '" . $galaxy . "',\n\t\t\t\t\t\t\t\t\t\t`user_system` = '" . $system . "',\n\t\t\t\t\t\t\t\t\t\t`user_planet` = '" . $planet . "'\n\t\t\t\t\t\t\t\t\t\tWHERE `user_id` = '" . $last_user_id . "'\n\t\t\t\t\t\t\t\t\t\tLIMIT 1;");
             parent::$db->query("INSERT INTO " . RESEARCH . " SET\n\t\t\t\t\t\t\t\t\t\t`research_user_id` = '" . $last_user_id . "';");
             parent::$db->query("INSERT INTO " . USERS_STATISTICS . " SET\n\t\t\t\t\t\t\t\t\t\t`user_statistic_user_id` = '" . $last_user_id . "';");
             parent::$db->query("INSERT INTO " . PREMIUM . " SET\n\t\t\t\t\t\t\t\t\t\t`premium_user_id` = '" . $last_user_id . "';");
             parent::$db->query("INSERT INTO " . SETTINGS . " SET\n\t\t\t\t\t\t\t\t\t\t`setting_user_id` = '" . $last_user_id . "';");
             $this->_alert = Administration_Lib::save_message('ok', str_replace('%s', $pass, $this->_lang['mk_user_added']));
         } else {
             $this->_alert = Administration_Lib::save_message('warning', '<br/>' . $error);
         }
     }
     return parent::$page->parse_template(parent::$page->get_template('adm/maker_user_view'), $parse);
 }
Beispiel #18
0
 /**
  * method show_ban
  * param
  * return build the ban page
  */
 private function show_ban()
 {
     $parse = $this->_lang;
     $parse['js_path'] = XGP_ROOT . JS_PATH;
     $ban_name = isset($_GET['ban_name']) ? parent::$db->escape_value($_GET['ban_name']) : NULL;
     if (isset($_GET['banuser']) && isset($_GET['ban_name'])) {
         $parse['name'] = $ban_name;
         $parse['banned_until'] = '';
         $parse['changedate'] = $this->_lang['bn_auto_lift_ban_message'];
         $parse['vacation'] = '';
         $banned_user = parent::$db->query_fetch("SELECT b.*, s.`setting_user_id`, s.`setting_vacations_status`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM `" . BANNED . "` AS b\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN `" . SETTINGS . "` AS s\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tON s.`setting_user_id` = (SELECT `user_id`\n\t\t\t\t\t\t\t\t\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\t\t\t\t\t\t\t\t\t\tWHERE `user_name` = '" . $ban_name . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `banned_who` = '" . $ban_name . "'");
         if ($banned_user) {
             $parse['banned_until'] = $this->_lang['bn_banned_until'] . ' (' . date(Functions_Lib::read_config('date_format_extended'), $banned_user['banned_longer']) . ')';
             $parse['reason'] = $banned_user['banned_theme'];
             $parse['changedate'] = '<div style="float:left">' . $this->_lang['bn_change_date'] . '</div><div style="float:right">' . Administration_Lib::show_pop_up($this->_lang['bn_edit_ban_help']) . '</div>';
         }
         $parse['vacation'] = $banned_user['setting_vacations_status'] ? 'checked="checked"' : '';
         if (isset($_POST['bannow']) && $_POST['bannow']) {
             if (!is_numeric($_POST['days']) or !is_numeric($_POST['hour'])) {
                 $parse['alert'] = Administration_Lib::save_message('warning', $this->_lang['bn_all_fields_required']);
             } else {
                 $reas = (string) $_POST['why'];
                 $days = (int) $_POST['days'];
                 $hour = (int) $_POST['hour'];
                 $admin_name = $this->_current_user['user_name'];
                 $admin_mail = $this->_current_user['user_email'];
                 $current_time = time();
                 $ban_time = $days * 86400;
                 $ban_time += $hour * 3600;
                 if ($banned_user['banned_longer'] > time()) {
                     $ban_time += $banned_user['banned_longer'] - time();
                 }
                 if ($ban_time + $current_time < time()) {
                     $banned_until = $current_time;
                 } else {
                     $banned_until = $current_time + $ban_time;
                 }
                 if ($banned_user) {
                     parent::$db->query("UPDATE " . BANNED . "  SET\n\t\t\t\t\t\t\t\t\t\t\t`banned_who` = '" . $ban_name . "',\n\t\t\t\t\t\t\t\t\t\t\t`banned_theme` = '" . $reas . "',\n\t\t\t\t\t\t\t\t\t\t\t`banned_who2` = '" . $ban_name . "',\n\t\t\t\t\t\t\t\t\t\t\t`banned_time` = '" . $current_time . "',\n\t\t\t\t\t\t\t\t\t\t\t`banned_longer` = '" . $banned_until . "',\n\t\t\t\t\t\t\t\t\t\t\t`banned_author` = '" . $admin_name . "',\n\t\t\t\t\t\t\t\t\t\t\t`banned_email` = '" . $admin_mail . "'\n\t\t\t\t\t\t\t\t\t\t\tWHERE `banned_who2` = '" . $ban_name . "';");
                 } else {
                     parent::$db->query("INSERT INTO " . BANNED . " SET\n\t\t\t\t\t\t\t\t\t\t\t`banned_who` = '" . $ban_name . "',\n\t\t\t\t\t\t\t\t\t\t\t`banned_theme` = '" . $reas . "',\n\t\t\t\t\t\t\t\t\t\t\t`banned_who2` = '" . $ban_name . "',\n\t\t\t\t\t\t\t\t\t\t\t`banned_time` = '" . $current_time . "',\n\t\t\t\t\t\t\t\t\t\t\t`banned_longer` = '" . $banned_until . "',\n\t\t\t\t\t\t\t\t\t\t\t`banned_author` = '" . $admin_name . "',\n\t\t\t\t\t\t\t\t\t\t\t`banned_email` = '" . $admin_mail . "';");
                 }
                 $user_id = parent::$db->query_fetch("SELECT `user_id`\n\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\tWHERE `user_name` = '" . $ban_name . "' LIMIT 1");
                 parent::$db->query("UPDATE " . USERS . " AS u, " . SETTINGS . " AS s, " . PLANETS . " AS p SET\n\t\t\t\t\t\t\t\t\t\t\tu.`user_banned` = '" . $banned_until . "',\n\t\t\t\t\t\t\t\t\t\t\ts.`setting_vacations_status` = '" . (isset($_POST['vacat']) ? 1 : 0) . "',\n\t\t\t\t\t\t\t\t\t\t\tp.`planet_building_metal_mine_porcent` = '0',\n\t\t\t\t\t\t\t\t\t\t\tp.`planet_building_crystal_mine_porcent` = '0',\n\t\t\t\t\t\t\t\t\t\t\tp.`planet_building_deuterium_sintetizer_porcent` = '0'\n\t\t\t\t\t\t\t\t\t\t\tWHERE u.`user_id` = " . $user_id['user_id'] . "\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND s.`setting_user_id` = " . $user_id['user_id'] . "\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND p.`planet_user_id` = " . $user_id['user_id'] . ";");
                 $parse['alert'] = Administration_Lib::save_message('ok', str_replace('%s', $ban_name, $this->_lang['bn_ban_success']));
             }
         }
     } else {
         Functions_Lib::redirect('admin.php?page=ban');
     }
     return parent::$page->parse_template(parent::$page->get_template("adm/ban_result_view"), $parse);
 }
Beispiel #19
0
<?php

/**
 * @project XG Proyect
 * @version 3.x.x build 0000
 * @copyright Copyright (C) 2008 - 2016
 */
define('IN_ADMIN', TRUE);
define('XGP_ROOT', './');
require XGP_ROOT . 'application/core/common.php';
include_once XGP_ROOT . 'application/libraries/adm/Administration_Lib.php';
// check if SSL is setted
Administration_Lib::secure_connection();
switch (isset($_GET['page']) ? $_GET['page'] : '') {
    // ----------------------------------------------------------------------------------------------------------------------------------------------//
    case '':
    default:
        include_once XGP_ROOT . ADMIN_PATH . 'home.php';
        new Home();
        break;
        // ----------------------------------------------------------------------------------------------------------------------------------------------//
    // ----------------------------------------------------------------------------------------------------------------------------------------------//
    case 'moderation':
        include_once XGP_ROOT . ADMIN_PATH . 'moderation.php';
        new Moderation();
        break;
        // ----------------------------------------------------------------------------------------------------------------------------------------------//
    // ----------------------------------------------------------------------------------------------------------------------------------------------//
    case 'reset':
        include_once XGP_ROOT . ADMIN_PATH . 'reset.php';
        new Reset();
Beispiel #20
0
 /**
  * method get_data_moons
  * param
  * return the moons page for the current user
  */
 private function get_data_moons()
 {
     $sub_query = '';
     // CHOOSE THE ACTION
     switch ($this->_edit) {
         case 'moon':
             $get_query = 'm.* ';
             break;
         case 'buildings':
             $get_query = 'b.* ';
             break;
         case 'ships':
             $get_query = 's.* ';
             break;
         case 'defenses':
             $get_query = 'd.* ';
             break;
         case '':
         default:
             $get_query = 'm.*, b.*, d.*, s.*';
             break;
     }
     // SWITCH
     if ($this->_moon > 0) {
         $sub_query = ' AND m.`planet_id` = ' . $this->_moon;
     }
     $moons_query = parent::$db->query("SELECT {$get_query}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . PLANETS . " AS m\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . BUILDINGS . " AS b ON b.building_planet_id = m.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 = m.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 = m.planet_id\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE m.`planet_user_id` = '" . $this->_id . "'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND m.`planet_type` = 3{$sub_query};");
     $parse = $this->_lang;
     $parse['moons'] = str_replace('%s', $this->_user_query['user_name'], $this->_lang['us_user_moons']);
     // CHOOSE THE ACTION
     switch ($this->_edit) {
         case 'moon':
             $parse += $this->edit_main($moons_query);
             $view = parent::$page->parse_template(parent::$page->get_template("adm/users_moons_main_view"), $parse);
             break;
         case 'buildings':
             $parse['buildings_table'] = $this->edit_buildings($moons_query, 3);
             $view = parent::$page->parse_template(parent::$page->get_template("adm/users_planets_buildings_view"), $parse);
             break;
         case 'ships':
             $parse['ships_table'] = $this->edit_ships($moons_query);
             $view = parent::$page->parse_template(parent::$page->get_template("adm/users_planets_ships_view"), $parse);
             break;
         case 'defenses':
             $parse['defenses_table'] = $this->edit_defenses($moons_query, 3);
             $view = parent::$page->parse_template(parent::$page->get_template("adm/users_planets_defenses_view"), $parse);
             break;
         case 'delete':
             parent::$db->query("UPDATE " . PLANETS . " AS m, " . USERS . " AS u SET\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tm.`planet_destroyed` = '" . (time() + PLANETS_LIFE_TIME * 3600) . "',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tu.`user_current_planet` = u.`user_home_planet_id`\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE m.`planet_id` = '" . (int) $this->_moon . "' AND\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tm.`planet_type` = '3';");
             $this->refresh_page();
             break;
         case '':
         default:
             $parse['moons_table'] = $this->moons_table($moons_query);
             $view = parent::$page->parse_template(parent::$page->get_template("adm/users_moons_view"), $parse);
             break;
     }
     // SWITCH
     $parse['alert_info'] = $this->_alert_type != '' ? Administration_Lib::save_message($this->_alert_type, $this->_alert_info) : '';
     return $view;
 }
Beispiel #21
0
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     $parse = $this->_lang;
     $parse['alert'] = '';
     if (isset($_POST['mode']) && $_POST['mode']) {
         $view_m = isset($_POST['view_m']) ? $this->set_rank($_POST['view_m']) : '';
         $edit_m = isset($_POST['edit_m']) ? $this->set_rank($_POST['edit_m']) : '';
         $config_m = isset($_POST['config_m']) ? $this->set_rank($_POST['config_m']) : '';
         $tools_m = isset($_POST['tools_m']) ? $this->set_rank($_POST['tools_m']) : '';
         $log_m = isset($_POST['log_m']) ? $this->set_rank($_POST['log_m']) : '';
         $maintenance_m = isset($_POST['maintenance_m']) ? $this->set_rank($_POST['maintenance_m']) : '';
         $view_o = isset($_POST['view_o']) ? $this->set_rank($_POST['view_o']) : '';
         $edit_o = isset($_POST['edit_o']) ? $this->set_rank($_POST['edit_o']) : '';
         $config_o = isset($_POST['config_o']) ? $this->set_rank($_POST['config_o']) : '';
         $tools_o = isset($_POST['tools_o']) ? $this->set_rank($_POST['tools_o']) : '';
         $log_o = isset($_POST['log_o']) ? $this->set_rank($_POST['log_o']) : '';
         $maintenance_o = isset($_POST['maintenance_o']) ? $this->set_rank($_POST['maintenance_o']) : '';
         $log_a = isset($_POST['log_a']) ? $this->set_rank($_POST['log_a']) : '';
         $QueryEdit = $view_m . "," . $edit_m . "," . $config_m . "," . $tools_m . "," . $log_m . "," . $maintenance_m . ";" . $view_o . "," . $edit_o . "," . $config_o . "," . $tools_o . "," . $log_o . "," . $maintenance_o . ";" . $log_a . ";";
         Functions_Lib::update_config('moderation', $QueryEdit);
         $parse['alert'] = Administration_Lib::save_message('ok', $this->_lang['mod_all_ok_message']);
     }
     $QueryModeration = Functions_Lib::read_config('moderation');
     $QueryModerationEx = explode(";", $QueryModeration);
     $Moderator = explode(",", $QueryModerationEx[0]);
     $Operator = explode(",", $QueryModerationEx[1]);
     $Administrator = explode(",", $QueryModerationEx[2]);
     // MODERADORES
     if ($Moderator[0] == 1) {
         $parse['view_m'] = 'checked = "checked"';
     }
     if ($Moderator[1] == 1) {
         $parse['edit_m'] = 'checked = "checked"';
     }
     if ($Moderator[2] == 1) {
         $parse['config_m'] = 'checked = "checked"';
     }
     if ($Moderator[3] == 1) {
         $parse['tools_m'] = 'checked = "checked"';
     }
     if ($Moderator[4] == 1) {
         $parse['log_m'] = 'checked = "checked"';
     }
     if ($Moderator[5] == 1) {
         $parse['maintenance_m'] = 'checked = "checked"';
     }
     // OPERADORES
     if ($Operator[0] == 1) {
         $parse['view_o'] = 'checked = "checked"';
     }
     if ($Operator[1] == 1) {
         $parse['edit_o'] = 'checked = "checked"';
     }
     if ($Operator[2] == 1) {
         $parse['config_o'] = 'checked = "checked"';
     }
     if ($Operator[3] == 1) {
         $parse['tools_o'] = 'checked = "checked"';
     }
     if ($Operator[4] == 1) {
         $parse['log_o'] = 'checked = "checked"';
     }
     if ($Operator[5] == 1) {
         $parse['maintenance_o'] = 'checked = "checked"';
     }
     // ADMINISTRADOR (SOLO PARA EL HISTORIAL)
     if ($Administrator[0] == 1) {
         $parse['log_a'] = 'checked = "checked"';
     }
     $parse['mods'] = $this->_lang['user_level'][1];
     $parse['oper'] = $this->_lang['user_level'][2];
     $parse['adm'] = $this->_lang['user_level'][3];
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/moderation_view'), $parse));
 }