本文整理汇总了PHP中Functions_Lib::read_config方法的典型用法代码示例。如果您正苦于以下问题:PHP Functions_Lib::read_config方法的具体用法?PHP Functions_Lib::read_config怎么用?PHP Functions_Lib::read_config使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Functions_Lib
的用法示例。
在下文中一共展示了Functions_Lib::read_config方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build_page
/**
* 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: build_page
/**
* 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: build_page
/**
* 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);
}
}
示例4: production_amount
/**
* 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);
}
}
示例5: build_page
/**
* 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));
}
示例6: __construct
/**
* __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->_tr_dark_matter = Functions_Lib::read_config('trader_darkmatter');
$this->_current_user = parent::$users->get_user_data();
$this->_current_planet = parent::$users->get_planet_data();
$this->build_page();
}
示例7: __construct
/**
* __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->_game_config = Functions_Lib::read_config('', TRUE);
$this->build_page();
} else {
die(Functions_Lib::message($this->_lang['ge_no_permissions']));
}
}
示例8: flying_fleets_table
/**
* 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;
}
示例9: calculate_points
/**
* 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;
}
示例10: do_search
/**
* 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']);
}
示例11: build_page
/**
* 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));
}
示例12: build_page
/**
* 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));
}
示例13: build_page
/**
* 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'] . '&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'] . '&re=0&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'] . '&re=0&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'] . '&re=0&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']}&re=0&planettype={$p['planet_type']}\">{$p[$resource[$i]]}</a>" : (in_array($i, $reslist['tech']) ? "<a href=\"game.php?page=research&cp={$p['planet_id']}&re=0&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']}&re=0&planettype={$p['planet_type']}\">{$p[$resource[$i]]}</a>" : (in_array($i, $reslist['defense']) ? "<a href=\"game.php?page=defense&cp={$p['planet_id']}&re=0&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);
}
示例14: build_page
/**
* 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));
}
示例15: build_page
/**
* 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));
}