/** * 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)); }
private function ElementBuildListBox($current_page) { $ElementQueue = explode(';', $this->_current_planet['planet_b_hangar_id']); $NbrePerType = ''; $NamePerType = ''; $TimePerType = ''; $QueueTime = 0; foreach ($ElementQueue as $ElementLine => $Element) { if ($Element != '') { $Element = explode(',', $Element); $ElementTime = Developments_Lib::development_time($this->_current_user, $this->_current_planet, $Element[0]); $QueueTime += $ElementTime * $Element[1]; $TimePerType .= "" . $ElementTime . ","; $NamePerType .= "'" . html_entity_decode($this->_lang['tech'][$Element[0]], ENT_COMPAT, "utf-8") . "',"; $NbrePerType .= "" . $Element[1] . ","; } } $parse = $this->_lang; $parse['a'] = $NbrePerType; $parse['b'] = $NamePerType; $parse['c'] = $TimePerType; $parse['b_hangar_id_plus'] = $this->_current_planet['planet_b_hangar']; $parse['current_page'] = $current_page; $parse['pretty_time_b_hangar'] = Format_Lib::pretty_time($QueueTime - $this->_current_planet['planet_b_hangar']); return parent::$page->parse_template(parent::$page->get_template('buildings/buildings_script'), $parse); }
private function GetNextJumpWaitTime($CurMoon) { $JumpGateLevel = $CurMoon[$this->_resource[43]]; $LastJumpTime = $CurMoon['planet_last_jump_time']; if ($JumpGateLevel > 0) { $WaitBetweenJmp = 60 * 60 * (1 / $JumpGateLevel); $NextJumpTime = $LastJumpTime + $WaitBetweenJmp; if ($NextJumpTime >= time()) { $RestWait = $NextJumpTime - time(); $RestString = " " . Format_Lib::pretty_time($RestWait); } else { $RestWait = 0; $RestString = ""; } } else { $RestWait = 0; $RestString = ""; } $RetValue['string'] = $RestString; $RetValue['value'] = $RestWait; return $RetValue; }
/** * method get_planets * param $user_planet * param $is_current_planet * return building in progress or free text */ private function get_current_work($user_planet, $is_current_planet = TRUE) { // THE PLANET IS "FREE" BY DEFAULT $building_block = $this->_lang['ov_free']; if (!$is_current_planet) { // UPDATE THE PLANET INFORMATION FIRST, MAY BE SOMETHING HAS JUST FINISHED Update_Lib::update_buildings_queue($user_planet, $this->_current_user); } if ($user_planet['planet_b_building'] != 0) { if ($user_planet['planet_b_building'] != 0) { $queue = explode(';', $user_planet['planet_b_building_id']); // GET ALL $current_building = explode(',', $queue[0]); // GET ONLY THE FIRST ELEMENT $building = $current_building[0]; // THE BUILDING $level = $current_building[1]; // THE LEVEL $time_to_end = $current_building[3] - time(); // THE TIME // THE BUILDING BLOCK if ($is_current_planet) { $building_block = Developments_Lib::current_building("overview", $building); $building_block .= $this->_lang['tech'][$building] . ' (' . $level . ')'; $building_block .= "<br /><div id=\"blc\" class=\"z\">" . Format_Lib::pretty_time($time_to_end) . "</div>"; $building_block .= "\n<script language=\"JavaScript\">"; $building_block .= "\n\tpp = \"" . $time_to_end . "\";\n"; $building_block .= "\n\tpk = \"" . 1 . "\";\n"; $building_block .= "\n\tpm = \"cancel\";\n"; $building_block .= "\n\tpl = \"" . $this->_current_planet['planet_id'] . "\";\n"; $building_block .= "\n\tt();\n"; $building_block .= "\n</script>\n"; } else { $building_block = '' . $this->_lang['tech'][$building] . ' (' . $level . ')'; $building_block .= '<br><font color="#7f7f7f">(' . Format_Lib::pretty_time($time_to_end) . ')</font>'; } } } // BACK TO THE PLANET! return $building_block; }
/** * method formated_development_time * param $time * return the formated time transcript */ public static function formated_development_time($time) { return "<br>" . parent::$lang['fgf_time'] . Format_Lib::pretty_time($time); }