本文整理匯總了PHP中pretty_time函數的典型用法代碼示例。如果您正苦於以下問題:PHP pretty_time函數的具體用法?PHP pretty_time怎麽用?PHP pretty_time使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了pretty_time函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: ElementBuildListBox
function ElementBuildListBox($CurrentUser, $CurrentPlanet)
{
global $lang, $pricelist;
// Array del b_hangar_id
$ElementQueue = explode(';', $CurrentPlanet['b_hangar_id']);
$NbrePerType = "";
$NamePerType = "";
$TimePerType = "";
foreach ($ElementQueue as $ElementLine => $Element) {
if ($Element != '') {
$Element = explode(',', $Element);
$ElementTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element[0]);
$QueueTime += $ElementTime * $Element[1];
$TimePerType .= "" . $ElementTime . ",";
$NamePerType .= "'" . html_entity_decode($lang['tech'][$Element[0]]) . "',";
$NbrePerType .= "" . $Element[1] . ",";
}
}
$parse = $lang;
$parse['a'] = $NbrePerType;
$parse['b'] = $NamePerType;
$parse['c'] = $TimePerType;
$parse['b_hangar_id_plus'] = $CurrentPlanet['b_hangar'];
$parse['pretty_time_b_hangar'] = pretty_time($QueueTime - $CurrentPlanet['b_hangar']);
$text .= parsetemplate(gettemplate('buildings_script'), $parse);
return $text;
}
示例2: echo_buildinglist
function echo_buildinglist()
{
/*
Se imprime una lista de naves y defensa en contruccion
*/
global $lang, $user, $planetrow, $pricelist;
//Array del b_hangar_id
$b_hangar_id = explode(';', $planetrow['b_hangar_id']);
$a = $b = $c = "";
foreach ($b_hangar_id as $n => $array) {
if ($array != '') {
$array = explode(',', $array);
//calculamos el tiempo
$time = get_building_time($user, $planetrow, $array[0]);
$totaltime += $time * $array[1];
$c .= "{$time},";
$b .= "'{$lang['tech'][$array[0]]}',";
$a .= "{$array[1]},";
}
}
$parse = $lang;
$parse['a'] = $a;
$parse['b'] = $b;
$parse['c'] = $c;
$parse['b_hangar_id_plus'] = $planetrow['b_hangar'];
$parse['pretty_time_b_hangar'] = pretty_time($totaltime - $planetrow['b_hangar']);
// //$planetrow['last_update']
$text .= parsetemplate(gettemplate('buildings_script'), $parse);
return $text;
}
示例3: ElementBuildListBox
private function ElementBuildListBox($CurrentUser, $CurrentPlanet)
{
global $lang, $pricelist, $displays;
$displays->newblock("buildinglist");
$ElementQueue = explode(';', $CurrentPlanet['b_hangar_id']);
$NbrePerType = "";
$NamePerType = "";
$TimePerType = "";
foreach ($ElementQueue as $ElementLine => $Element) {
if ($Element != '') {
$Element = explode(',', $Element);
$ElementTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element[0]);
$QueueTime += $ElementTime * $Element[1];
$TimePerType .= "" . $ElementTime . ",";
$NamePerType .= "'" . $lang['tech'][$Element[0]] . "',";
$NbrePerType .= "" . $Element[1] . ",";
}
}
//$parse = $lang;
$parse['a'] = $NbrePerType;
$parse['b'] = $NamePerType;
$parse['c'] = $TimePerType;
$parse['b_hangar_id_plus'] = $CurrentPlanet['b_hangar'];
$parse['pretty_time_b_hangar'] = pretty_time($QueueTime - $CurrentPlanet['b_hangar']);
foreach ($parse as $key => $value) {
$displays->assign($key, $value);
}
}
示例4: ElementBuildListQueue
function ElementBuildListQueue($CurrentUser, $CurrentPlanet)
{
global $lang, $pricelist;
$b_building_id = explode(';', $CurrentPlanet['b_building_queue']);
$a = $b = $c = "";
foreach ($b_hangar_id as $n => $array) {
if ($array != '') {
$array = explode(',', $array);
// calculamos el tiempo
$time = GetBuildingTime($user, $CurrentPlanet, $array[0]);
$totaltime += $time * $array[1];
$c .= "{$time},";
$b .= "'{$lang['tech'][$array[0]]}',";
$a .= "{$array[1]},";
}
}
$parse = $lang;
$parse['a'] = $a;
$parse['b'] = $b;
$parse['c'] = $c;
$parse['b_hangar_id_plus'] = $CurrentPlanet['b_hangar'];
$parse['pretty_time_b_hangar'] = pretty_time($totaltime - $CurrentPlanet['b_hangar']);
$text .= parsetemplate(gettemplate('buildings_script'), $parse);
return $text;
}
示例5: setTemplateVars
public function setTemplateVars()
{
global $language, $data_dir;
$this->template->inputLanguage = $language[$_POST["input-extension"]];
$this->template->inputExtension = $_POST["input-extension"];
$this->template->outputLanguage = $language[$_POST["output-extension"]];
$this->template->outputExtension = $_POST["output-extension"];
$corpora = array();
$dir = $data_dir . "/" . $_POST["input-extension"] . "-" . $_POST["output-extension"];
if ($handle = opendir($dir)) {
while (false !== ($entry = readdir($handle))) {
if (preg_match("/(\\d+)\\.info/", $entry, $match)) {
$corpus = array();
$corpus["id"] = $match[1];
$corpus["checkbox_name"] = "corpus-" . $match[1];
$info = file($dir . "/" . $entry);
foreach ($info as $line) {
if (preg_match("/^(\\S+) = (.+)/", $line, $match)) {
$corpus[$match[1]] = $match[2];
}
}
$corpus["upload_time"] = pretty_time($corpus["upload_time"]);
$corpora[] = $corpus;
}
}
}
$this->template->corpora = $corpora;
$this->template->msg = $this->msg;
}
示例6: ShowFleetPage
public static function ShowFleetPage()
{
global $USER, $PLANET, $reslist, $resource, $db, $LNG, $ExtraDM;
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
$PlanetRess->SavePlanetToDB();
$parse = $LNG;
$FleetID = request_var('fleetid', 0);
$GetAction = request_var('action', "");
$template = new template();
$template->loadscript('flotten.js');
if (!empty($FleetID)) {
switch ($GetAction) {
case "sendfleetback":
parent::SendFleetBack($USER, $FleetID);
break;
case "getakspage":
$template->assign_vars(parent::GetAKSPage($USER, $PLANET, $FleetID));
break;
}
}
$MaxExpedition = $USER[$resource[124]];
if ($MaxExpedition >= 1) {
$ExpeditionEnCours = parent::GetCurrentFleets($USER['id'], 15);
$EnvoiMaxExpedition = floor(sqrt($MaxExpedition));
} else {
$ExpeditionEnCours = 0;
$EnvoiMaxExpedition = 0;
}
$MaxFlottes = parent::GetMaxFleetSlots($USER);
$galaxy = request_var('galaxy', $PLANET['galaxy']);
$system = request_var('system', $PLANET['system']);
$planet = request_var('planet', $PLANET['planet']);
$planettype = request_var('planettype', $PLANET['planet_type']);
$target_mission = request_var('target_mission', 0);
$CurrentFleets = $db->query("SELECT * FROM " . FLEETS . " WHERE `fleet_owner` = '" . $USER['id'] . "' AND `fleet_mission` <> 10 ORDER BY `fleet_end_time` ASC;");
$CountCurrentFleets = $db->num_rows($CurrentFleets);
while ($CurrentFleetsRow = $db->fetch_array($CurrentFleets)) {
$fleet = explode(";", $CurrentFleetsRow['fleet_array']);
foreach ($fleet as $ShipID => $ShipCount) {
if (empty($ShipCount)) {
continue;
}
$a = explode(",", $ShipCount);
$FleetList[$CurrentFleetsRow['fleet_id']][$LNG['tech'][$a[0]]] = pretty_number($a[1]);
}
$FlyingFleetList[] = array('id' => $CurrentFleetsRow['fleet_id'], 'mission' => $CurrentFleetsRow['fleet_mission'], 'missionname' => $LNG['type_mission'][$CurrentFleetsRow['fleet_mission']], 'way' => $CurrentFleetsRow['fleet_mess'], 'start_galaxy' => $CurrentFleetsRow['fleet_start_galaxy'], 'start_system' => $CurrentFleetsRow['fleet_start_system'], 'start_planet' => $CurrentFleetsRow['fleet_start_planet'], 'start_time' => date(TDFORMAT, $CurrentFleetsRow['fleet_start_time']), 'end_galaxy' => $CurrentFleetsRow['fleet_end_galaxy'], 'end_system' => $CurrentFleetsRow['fleet_end_system'], 'end_planet' => $CurrentFleetsRow['fleet_end_planet'], 'end_time' => date(TDFORMAT, $CurrentFleetsRow['fleet_end_time']), 'amount' => pretty_number($CurrentFleetsRow['fleet_amount']), 'backin' => pretty_time(floor($CurrentFleetsRow['fleet_end_time'] - TIMESTAMP)), 'FleetList' => $FleetList[$CurrentFleetsRow['fleet_id']]);
}
$db->free_result($CurrentFleets);
foreach ($reslist['fleet'] as $FleetID) {
if ($PLANET[$resource[$FleetID]] > 0) {
$FleetsOnPlanet[] = array('id' => $FleetID, 'name' => $LNG['tech'][$FleetID], 'speed' => parent::GetFleetMaxSpeed($FleetID, $USER), 'count' => pretty_number($PLANET[$resource[$FleetID]]));
}
}
$template->assign_vars(array('FleetsOnPlanet' => $FleetsOnPlanet, 'FlyingFleetList' => $FlyingFleetList, 'fl_number' => $LNG['fl_number'], 'fl_mission' => $LNG['fl_mission'], 'fl_ammount' => $LNG['fl_ammount'], 'fl_beginning' => $LNG['fl_beginning'], 'fl_departure' => $LNG['fl_departure'], 'fl_destiny' => $LNG['fl_destiny'], 'fl_objective' => $LNG['fl_objective'], 'fl_arrival' => $LNG['fl_arrival'], 'fl_order' => $LNG['fl_order'], 'fl_new_mission_title' => $LNG['fl_new_mission_title'], 'fl_ship_type' => $LNG['fl_ship_type'], 'fl_ship_available' => $LNG['fl_ship_available'], 'fl_fleets' => $LNG['fl_fleets'], 'fl_expeditions' => $LNG['fl_expeditions'], 'fl_speed_title' => $LNG['fl_speed_title'], 'fl_max' => $LNG['fl_max'], 'fl_no_more_slots' => $LNG['fl_no_more_slots'], 'fl_continue' => $LNG['fl_continue'], 'fl_no_ships' => $LNG['fl_no_ships'], 'fl_select_all_ships' => $LNG['fl_select_all_ships'], 'fl_remove_all_ships' => $LNG['fl_remove_all_ships'], 'fl_acs' => $LNG['fl_acs'], 'fl_send_back' => $LNG['fl_send_back'], 'fl_returning' => $LNG['fl_returning'], 'fl_r' => $LNG['fl_r'], 'fl_onway' => $LNG['fl_onway'], 'fl_a' => $LNG['fl_a'], 'fl_info_detail' => $LNG['fl_info_detail'], 'fl_bonus' => $LNG['fl_bonus'], 'fl_bonus_attack' => $LNG['fl_bonus_attack'], 'fl_bonus_defensive' => $LNG['fl_bonus_defensive'], 'fl_bonus_shield' => $LNG['fl_bonus_shield'], 'bonus_comp' => $LNG['tech'][115], 'bonus_impul' => $LNG['tech'][117], 'bonus_hyper' => $LNG['tech'][118], 'galaxy' => $galaxy, 'system' => $system, 'planet' => $planet, 'planettype' => $planettype, 'target_mission' => $target_mission, 'envoimaxexpedition' => $EnvoiMaxExpedition, 'expeditionencours' => $ExpeditionEnCours, 'flyingfleets' => $CountCurrentFleets, 'maxfleets' => $MaxFlottes, 'target_mission' => $target_mission, 'currentexpeditions' => $ExpeditionEnCours, 'maxexpeditions' => $EnvoiMaxExpedition, 'slots_available' => $MaxFlottes <= $MaxFlyingFleets - $MaxFlyingRaks ? false : true, 'AKSPage' => $AKSPage, 'bonus_attack' => $USER[$resource[109]] * 10 + (TIMESTAMP - $USER[$resource[700]] <= 0 ? 100 * $ExtraDM[700]['add'] : 0) * 5, 'bonus_defensive' => $USER[$resource[110]] * 10 + (TIMESTAMP - $USER[$resource[701]] <= 0 ? 100 * $ExtraDM[701]['add'] : 0) * 5, 'bonus_shield' => $USER[$resource[111]] * 10 + (TIMESTAMP - $USER[$resource[700]] <= 0 ? 100 * $ExtraDM[700]['add'] : 0) * 5, 'bonus_combustion' => $USER[$resource[115]] * 10 + (TIMESTAMP - $USER[$resource[706]] <= 0 ? 100 * $ExtraDM[706]['add'] : 0), 'bonus_impulse' => $USER[$resource[117]] * 20 + (TIMESTAMP - $USER[$resource[706]] <= 0 ? 100 * $ExtraDM[706]['add'] : 0), 'bonus_hyperspace' => $USER[$resource[118]] * 30 + (TIMESTAMP - $USER[$resource[706]] <= 0 ? 100 * $ExtraDM[706]['add'] : 0)));
$template->show('fleet_table.tpl');
}
示例7: ShowContactPage
function ShowContactPage()
{
global $lang, $displays, $db;
$displays->assignContent('contact');
$QrySelectUser = "SELECT `username`, `email`, `authlevel` ";
$QrySelectUser .= "FROM {{table}} ";
$QrySelectUser .= "WHERE `authlevel` != '0' ORDER BY `authlevel` DESC;";
$GameOps = $db->query($QrySelectUser, 'users');
$QryOpen = "SELECT `register_time` ";
$QryOpen .= "FROM {{table}} ";
$QryOpen .= "WHERE `id` = '1';";
$Open = $db->query($QryOpen, 'users', true);
$parse['game_speed'] = pretty_number($db->game_config['game_speed'] / 2500);
$parse['fleet_speed'] = pretty_number($db->game_config['fleet_speed'] / 2500);
$parse['resource_multiplier'] = pretty_number($db->game_config['resource_multiplier']);
$parse['Fleet_Cdr'] = $db->game_config['Fleet_Cdr'];
$parse['Defs_Cdr'] = $db->game_config['Defs_Cdr'];
$parse['stat_settings'] = pretty_number($db->game_config['stat_settings']);
$parse['stat_update_time'] = pretty_time($db->game_config['stat_update_time'] * 60);
if ($db->game_config['noobprotection'] == 1) {
$parse['noobprotectionmulti'] = $db->game_config['noobprotectionmulti'];
$parse['noobprotectiontime'] = pretty_number($db->game_config['noobprotectiontime']);
$parse['noobprotectiontitle'] = "<a onMouseOver=\"return overlib('" . $lang['ccd_alert_noobprot1'] . " " . $lang['noobprotectionmulti'] . " " . $lang['ccd_alert_noobprot2'] . " " . $lang['noobprotectionmulti'] . "', BELOW, CENTER, WIDTH, 350, CAPTION, 'Aclaracion!',BGCOLOR,'#344566', FGCOLOR,'#344566',TEXTCOLOR,'white',CLOSECOLOR,'lime', CAPCOLOR,'red');\" onMouseOut=\"return nd();\" class=\"big\">" . $lang['ccd_noobprotect'] . " (*)</a>";
} else {
$parse['noobprotectionmulti'] = "<font color=\"red\">Desactivada</color>";
$parse['noobprotectiontime'] = "<font color=\"red\">Desactivada</color>";
$parse['noobprotectiontitle'] = $lang['ccd_noobprotect'];
}
$parse['MAX_GALAXY_IN_WORLD'] = MAX_GALAXY_IN_WORLD;
$parse['MAX_SYSTEM_IN_GALAXY'] = MAX_SYSTEM_IN_GALAXY;
$parse['MAX_PLANET_IN_SYSTEM'] = MAX_PLANET_IN_SYSTEM;
$parse['MAX_PLAYER_PLANETS'] = MAX_PLAYER_PLANETS;
$parse['FIELDS_BY_TERRAFORMER'] = FIELDS_BY_TERRAFORMER;
$parse['FIELDS_BY_MOONBASIS_LEVEL'] = FIELDS_BY_MOONBASIS_LEVEL;
$parse['MAX_BUILDING_QUEUE_SIZE'] = MAX_BUILDING_QUEUE_SIZE;
$parse['MAX_FLEET_OR_DEFS_PER_ROW'] = pretty_number(MAX_FLEET_OR_DEFS_PER_ROW);
$parse['BASE_STORAGE_SIZE'] = pretty_number(BASE_STORAGE_SIZE);
$parse['gamename'] = $_SERVER['HTTP_HOST'];
$parse['servername'] = $db->game_config['game_name'];
$parse['openserver'] = gmdate("d/m/Y G:i:s", $Open['register_time']);
foreach ($parse as $name => $trans) {
$displays->assign($name, $trans);
}
while ($Ops = mysql_fetch_assoc($GameOps)) {
$displays->newBlock("contact");
$Ops["user_level"] = $lang['user_level'][$Ops['authlevel']];
$email = explode("@", $Ops['email']);
$Ops["email_script"] = "<SCRIPT LANGUAGE='JavaScript'>user = '" . $email[0] . "';site = '" . $email[1] . "';document.write('<a href=\"mailto:' + user + '@' + site + '\">'+ user + '@' + site + '</a>');</SCRIPT>";
foreach ($Ops as $name => $trans) {
$displays->assign($name, $trans);
}
unset($Ops);
}
$displays->display('Contacto');
}
示例8: check_suspicious
function check_suspicious(&$session, &$session_list_last_id, &$row)
{
$session[2] = $session[1] - $session[0];
if ($session[2] > SUSPICIOUS_LONG) {
$session[2] = pretty_time($session[2]);
$session[0] = date(FMT_DATE_TIME_SQL, $session[0]);
$session[1] = date(FMT_DATE_TIME_SQL, $session[1]);
$session_list_last_id[] = $session;
}
//$row ?
$session = array(0 => $row['visit_time'], 1 => $row['visit_time']);
}
示例9: eco_bld_tech
function eco_bld_tech($que_type, &$user, &$planet)
{
global $config, $lang;
lng_include('buildings');
lng_include('infos');
if (!mrc_get_level($user, $planet, STRUC_LABORATORY)) {
message($lang['no_laboratory'], $lang['tech'][UNIT_TECHNOLOGIES]);
}
if (eco_unit_busy($user, $planet, UNIT_TECHNOLOGIES)) {
message($lang['eco_bld_msg_err_laboratory_upgrading'], $lang['tech'][UNIT_TECHNOLOGIES]);
}
switch ($action = sys_get_param_escaped('action')) {
case 'build':
$operation_result = que_build($user, $planet);
break;
case 'trim':
que_delete(QUE_RESEARCH, $user, $planet, false);
break;
case 'clear':
que_delete(QUE_RESEARCH, $user, $planet, true);
break;
//case 'build':$operation_result = eco_bld_tech_research($user, $planet);break;
}
$template = gettemplate('buildings_research', true);
if (!empty($operation_result)) {
$template->assign_block_vars('result', $operation_result);
}
$fleet_list = flt_get_fleets_to_planet($planet);
$ques = que_get($user['id'], QUE_RESEARCH);
$que =& $ques['ques'][QUE_RESEARCH][$user['id']][0];
que_tpl_parse($template, QUE_RESEARCH, $user, null, $que);
$in_que =& $ques['in_que'][QUE_RESEARCH][$user['id']][0];
foreach (sn_get_groups('tech') as $unit_id) {
if (eco_can_build_unit($user, $planet, $unit_id) != BUILD_ALLOWED) {
continue;
}
$level_base = mrc_get_level($user, '', $unit_id, false, true);
$level_effective = mrc_get_level($user, '', $unit_id);
$level_in_que = $in_que[$unit_id];
$level_bonus = max(0, $level_effective - $level_base);
$level_base_and_que = $level_base + $level_in_que;
$build_data = eco_get_build_data($user, $planet, $unit_id, $level_base_and_que);
$temp[RES_METAL] = floor($planet['metal'] - $build_data[BUILD_CREATE][RES_METAL]);
$temp[RES_CRYSTAL] = floor($planet['crystal'] - $build_data[BUILD_CREATE][RES_CRYSTAL]);
$temp[RES_DEUTERIUM] = floor($planet['deuterium'] - $build_data[BUILD_CREATE][RES_DEUTERIUM]);
$template->assign_block_vars('production', array('ID' => $unit_id, 'NAME' => $lang['tech'][$unit_id], 'DESCRIPTION' => $lang['info'][$unit_id]['description_short'], 'LEVEL_OLD' => $level_base, 'LEVEL_BONUS' => $level_bonus, 'LEVEL_NEXT' => $level_base + $level_in_que + 1, 'LEVEL_QUED' => $level_in_que, 'LEVEL' => $level_base_and_que, 'BUILD_CAN' => $build_data['CAN'][BUILD_CREATE], 'TIME' => pretty_time($build_data[RES_TIME][BUILD_CREATE]), 'METAL' => $build_data[BUILD_CREATE][RES_METAL], 'CRYSTAL' => $build_data[BUILD_CREATE][RES_CRYSTAL], 'DEUTERIUM' => $build_data[BUILD_CREATE][RES_DEUTERIUM], 'METAL_PRINT' => pretty_number($build_data[BUILD_CREATE][RES_METAL], true, $planet['metal']), 'CRYSTAL_PRINT' => pretty_number($build_data[BUILD_CREATE][RES_CRYSTAL], true, $planet['crystal']), 'DEUTERIUM_PRINT' => pretty_number($build_data[BUILD_CREATE][RES_DEUTERIUM], true, $planet['deuterium']), 'METAL_REST' => pretty_number($temp[RES_METAL], true, true), 'CRYSTAL_REST' => pretty_number($temp[RES_CRYSTAL], true, true), 'DEUTERIUM_REST' => pretty_number($temp[RES_DEUTERIUM], true, true), 'METAL_REST_NUM' => $temp[RES_METAL], 'CRYSTAL_REST_NUM' => $temp[RES_CRYSTAL], 'DEUTERIUM_REST_NUM' => $temp[RES_DEUTERIUM], 'METAL_FLEET' => pretty_number($temp[RES_METAL] + $fleet_list['own']['total'][RES_METAL], true, true), 'CRYSTAL_FLEET' => pretty_number($temp[RES_CRYSTAL] + $fleet_list['own']['total'][RES_CRYSTAL], true, true), 'DEUTERIUM_FLEET' => pretty_number($temp[RES_DEUTERIUM] + $fleet_list['own']['total'][RES_DEUTERIUM], true, true), 'BUILD_CAN2' => $build_data['CAN'][BUILD_CREATE]));
}
// if(count($que['ques'][$que_id][$user['id']][$planet_id]) >= que_get_max_que_length($user, $planet, $que_id, $que_data))
$template->assign_vars(array('QUE_ID' => QUE_RESEARCH, 'FLEET_OWN_COUNT' => $fleet_list['own']['count'], 'ARTIFACT_ID' => ART_HEURISTIC_CHIP, 'ARTIFACT_LEVEL' => mrc_get_level($user, array(), ART_HEURISTIC_CHIP), 'ARTIFACT_NAME' => $lang['tech'][ART_HEURISTIC_CHIP], 'REQUEST_URI' => $_SERVER['REQUEST_URI'], 'PAGE_HEADER' => $page_header = $lang['tech'][UNIT_TECHNOLOGIES] . ($user['user_as_ally'] ? " {$lang['sys_of_ally']} {$user['username']}" : ''), 'CONFIG_RESEARCH_QUE' => $config->server_que_length_research));
display(parsetemplate($template), $page_header);
}
示例10: ShowPlanetMenu
function ShowPlanetMenu($CurrentUser)
{
global $dpath, $lang;
$planets = SortUserPlanets($CurrentUser);
while ($p = mysql_fetch_array($planets)) {
if ($p["destruyed"] == 0) {
$ct = $p["field_max"] + $p["terraformer"] * FIELDS_BY_TERRAFORMER;
if ($p['planet_type'] == 3) {
$ct = $p["field_max"];
}
if ($p['b_building'] != 0) {
UpdatePlanetBatimentQueueList($CurrentUserPlanet, $CurrentUser);
if ($p['b_building'] != 0) {
$BuildQueue = $p['b_building_id'];
$QueueArray = explode(";", $BuildQueue);
$CurrentBuild = explode(",", $QueueArray[0]);
$BuildElement = $CurrentBuild[0];
$BuildLevel = $CurrentBuild[1];
$BuildRestTime = pretty_time($CurrentBuild[3] - time());
$construccion = "" . $lang['tech'][$BuildElement] . "<br>(Construyendo nivel " . $BuildLevel . ")<br>Tiempo restante:" . $BuildRestTime . "";
} else {
CheckPlanetUsedFields($p);
$construccion = $lang['ov_free'];
}
} else {
$construccion = $lang['ov_free'];
}
$popup = "" . $p['name'] . " [" . $p['galaxy'] . ":" . $p['system'] . ":" . $p['planet'] . "]<br>Campos ocupados: " . $p['field_current'] . "/" . $ct . "<br>" . $construccion . "";
if ($t == 0) {
$parse['mplanet'] .= "<th text-decoration:none>";
}
if ($p['planet_type'] == 1 && $p["id"] != $CurrentUser["current_planet"]) {
$parse['mplanet'] .= "<div align=center><a class=mplanet href=game.php?page={$_GET['page']}&gid={$_GET['gid']}&cp=" . $p['id'] . "&mode=" . $_GET['mode'] . "&re=0 onmouseover=\"return overlib('" . $popup . "', CENTER, OFFSETX, -80, OFFSETY, 20, WIDTH, 200)\" onmouseout=\"return nd();\"><img src=" . $dpath . "/planeten/" . $p['image'] . ".jpg border=0 height=78 width=78><br><font color=#2E9AFE>" . $p['name'] . " </font><font color=#58FA58><br>[" . $p['galaxy'] . ":" . $p['system'] . ":" . $p['planet'] . "]</font></a>";
} elseif ($p['planet_type'] == 3 && $p["id"] != $CurrentUser["current_planet"]) {
$parse['mplanet'] .= "<div align=center><a class=mplanet href=game.php?page={$_GET['page']}&gid={$_GET['gid']}&cp=" . $p['id'] . "&mode=" . $_GET['mode'] . "&re=0 onmouseover=\"return overlib('" . $popup . "', CENTER, OFFSETX, -80, OFFSETY, 20, WIDTH, 200)\" onmouseout=\"return nd();\"><img src=" . $dpath . "/planeten/" . $p['image'] . ".jpg border=0 height=78 width=78><br>" . $p['name'] . " (Luna) <font color=#58FA58><br>[" . $p['galaxy'] . ":" . $p['system'] . ":" . $p['planet'] . "]</font></a>";
} else {
$parse['mplanet'] .= "<div align=center><a class=mplanet href=# onmouseover=\"return overlib('" . $popup . "', CENTER, OFFSETX, -80, OFFSETY, 20, WIDTH, 200)\" onmouseout=\"return nd();\"><img src=" . $dpath . "/planeten/" . $p['image'] . ".jpg border=0 height=78 width=78><br><font color=#FFFF00>" . $p['name'] . " </font><font color=#FE9A2E><br>[" . $p['galaxy'] . ":" . $p['system'] . ":" . $p['planet'] . "]</font></a></div>";
}
if ($t == 6) {
$parse['mplanet'] .= "</th>";
$t = 0;
} else {
$t = $t + 1;
}
}
}
$parse['mplanet'] .= "</center></table>";
return parsetemplate(gettemplate('planet_menu'), $parse);
}
示例11: ShowOverviewPage
function ShowOverviewPage()
{
global $CONF, $LNG, $PLANET, $USER, $db, $resource, $UNI;
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
$PlanetRess->SavePlanetToDB();
$template = new template();
$template->getplanets();
$AdminsOnline = $AllPlanets = $Moon = array();
foreach ($template->UserPlanets as $ID => $CPLANET) {
if ($ID == $_SESSION['planet'] || $CPLANET['planet_type'] == 3) {
continue;
}
if (!empty($CPLANET['b_building']) && $CPLANET['b_building'] > TIMESTAMP) {
$Queue = explode(';', $CPLANET['b_building_id']);
$CurrBuild = explode(',', $Queue[0]);
$BuildPlanet = $LNG['tech'][$CurrBuild[0]] . " (" . $CurrBuild[1] . ")<br><span style=\"color:#7F7F7F;\">(" . pretty_time($CurrBuild[3] - TIMESTAMP) . ")</span>";
} else {
$BuildPlanet = $LNG['ov_free'];
}
$AllPlanets[] = array('id' => $CPLANET['id'], 'name' => $CPLANET['name'], 'image' => $CPLANET['image'], 'build' => $BuildPlanet);
}
if ($PLANET['id_luna'] != 0) {
$Moon = $db->uniquequery("SELECT `id`, `name` FROM " . PLANETS . " WHERE `id` = '" . $PLANET['id_luna'] . "';");
}
if (!empty($PLANET['b_building'])) {
$Queue = explode(';', $PLANET['b_building_id']);
$CurrBuild = explode(',', $Queue[0]);
$Build = $LNG['tech'][$CurrBuild[0]] . ' (' . $CurrBuild[1] . ')<br><div id="blc">"' . pretty_time($PLANET['b_building'] - TIMESTAMP) . '</div>';
$template->execscript('BuildTime();');
} else {
$Build = $LNG['ov_free'];
}
$OnlineAdmins = $db->query("SELECT `id`,`username` FROM " . USERS . " WHERE `universe` = '" . $UNI . "' AND `onlinetime` >= '" . (TIMESTAMP - 10 * 60) . "' AND `authlevel` > '0';");
while ($AdminRow = $db->fetch_array($OnlineAdmins)) {
$AdminsOnline[$AdminRow['id']] = $AdminRow['username'];
}
$db->free_result($OnlineAdmins);
$template->loadscript('mbContainer.js');
$template->loadscript('overview.js');
$template->execscript('GetFleets(true);');
$template->assign_vars(array('user_rank' => sprintf($LNG['ov_userrank_info'], pretty_number($USER['total_points']), $LNG['ov_place'], $USER['total_rank'], $USER['total_rank'], $LNG['ov_of'], $CONF['users_amount']), 'is_news' => $CONF['OverviewNewsFrame'], 'news' => makebr($CONF['OverviewNewsText']), 'planetname' => $PLANET['name'], 'planetimage' => $PLANET['image'], 'galaxy' => $PLANET['galaxy'], 'system' => $PLANET['system'], 'planet' => $PLANET['planet'], 'buildtime' => $PLANET['b_building'], 'userid' => $USER['id'], 'username' => $USER['username'], 'build' => $Build, 'Moon' => $Moon, 'AllPlanets' => $AllPlanets, 'AdminsOnline' => $AdminsOnline, 'Teamspeak' => GetTeamspeakData(), 'messages' => $USER['new_message'] > 0 ? $USER['new_message'] == 1 ? $LNG['ov_have_new_message'] : sprintf($LNG['ov_have_new_messages'], pretty_number($USER['new_message'])) : false, 'planet_diameter' => pretty_number($PLANET['diameter']), 'planet_field_current' => $PLANET['field_current'], 'planet_field_max' => CalculateMaxPlanetFields($PLANET), 'planet_temp_min' => $PLANET['temp_min'], 'planet_temp_max' => $PLANET['temp_max'], 'ov_news' => $LNG['ov_news'], 'fcm_moon' => $LNG['fcm_moon'], 'ov_server_time' => $LNG['ov_server_time'], 'ov_planet' => $LNG['ov_planet'], 'ov_planetmenu' => $LNG['ov_planetmenu'], 'ov_diameter' => $LNG['ov_diameter'], 'ov_distance_unit' => $LNG['ov_distance_unit'], 'ov_developed_fields' => $LNG['ov_developed_fields'], 'ov_max_developed_fields' => $LNG['ov_max_developed_fields'], 'ov_fields' => $LNG['ov_fields'], 'ov_temperature' => $LNG['ov_temperature'], 'ov_aprox' => $LNG['ov_aprox'], 'ov_temp_unit' => $LNG['ov_temp_unit'], 'ov_to' => $LNG['ov_to'], 'ov_position' => $LNG['ov_position'], 'ov_points' => $LNG['ov_points'], 'ov_events' => $LNG['ov_events'], 'ov_admins_online' => $LNG['ov_admins_online'], 'ov_no_admins_online' => $LNG['ov_no_admins_online'], 'ov_userbanner' => $LNG['ov_userbanner'], 'ov_teamspeak' => $LNG['ov_teamspeak'], 'ov_your_planet' => $LNG['ov_your_planet'], 'ov_coords' => $LNG['ov_coords'], 'ov_planet_name' => $LNG['ov_planet_name'], 'ov_actions' => $LNG['ov_actions'], 'ov_abandon_planet' => $LNG['ov_abandon_planet'], 'ov_planet_rename' => $LNG['ov_planet_rename'], 'ov_planet_rename_action' => $LNG['ov_planet_rename_action'], 'ov_password' => $LNG['ov_password'], 'ov_with_pass' => $LNG['ov_with_pass'], 'ov_security_confirm' => $LNG['ov_security_confirm'], 'ov_security_request' => $LNG['ov_security_request'], 'ov_delete_planet' => $LNG['ov_delete_planet'], 'ov_planet_abandoned' => $LNG['ov_planet_abandoned'], 'path' => PROTOCOL . $_SERVER['HTTP_HOST'] . HTTP_ROOT));
$template->show("overview_body.tpl");
}
示例12: show
function show()
{
global $USER, $PLANET, $LNG, $UNI, $CONF, $resource, $pricelist;
$GetAll = $GLOBALS['DATABASE']->query("SELECT * FROM `uni1_planets` WHERE id_owner = " . $USER['id'] . " AND destruyed = '0' ORDER by ordernumber ASC;");
$number = 1;
if ($GLOBALS['DATABASE']->numRows($GetAll) > 0) {
while ($messageRow = $GLOBALS['DATABASE']->fetch_array($GetAll)) {
if ($messageRow['b_building'] - TIMESTAMP > 0) {
$Queue = unserialize($messageRow['b_building_id']);
$buildInfo['buildings'] = array('id' => $Queue[0][0], 'level' => $Queue[0][1], 'timeleft' => $messageRow['b_building'] - TIMESTAMP, 'time' => $messageRow['b_building'], 'starttime' => pretty_time($messageRow['b_building'] - TIMESTAMP));
} else {
$buildInfo['buildings'] = false;
}
/* As FR#206 (http://tracker.2moons.cc/view.php?id=206), i added the shipyard and research status here, but i add not them the template. */
if (!empty($messageRow['b_hangar_id'])) {
$Queue = unserialize($messageRow['b_hangar_id']);
//$time = BuildFunctions::getBuildingTime($USER, $messageRow['id'], $Queue[0][0]) * $Queue[0][1];
$time = BuildFunctions::getBuildingTime($USER, 1, $Queue[0][0]) * $Queue[0][1];
$buildInfo['fleet'] = array('id' => $Queue[0][0], 'level' => $Queue[0][1], 'timeleft' => $time - $messageRow['b_hangar'], 'time' => $time, 'starttime' => pretty_time($time - $messageRow['b_hangar']));
} else {
$buildInfo['fleet'] = false;
}
if (!empty($messageRow['b_defense_id'])) {
$Queue = unserialize($messageRow['b_defense_id']);
//$time = BuildFunctions::getBuildingTime($USER, $messageRow['id'], $Queue[0][0]) * $Queue[0][1];
$time = BuildFunctions::getBuildingTime($USER, 1, $Queue[0][0]) * $Queue[0][1];
$buildInfo['defense'] = array('id' => $Queue[0][0], 'level' => $Queue[0][1], 'timeleft' => $time - $messageRow['b_defense'], 'time' => $time, 'starttime' => pretty_time($time - $messageRow['b_defense']));
} else {
$buildInfo['defense'] = false;
}
if ($USER['b_tech'] - TIMESTAMP > 0) {
$Queue = unserialize($USER['b_tech_queue']);
$buildInfo['tech'] = array('id' => $Queue[0][0], 'level' => $Queue[0][1], 'timeleft' => $USER['b_tech'] - TIMESTAMP, 'time' => $USER['b_tech'], 'starttime' => pretty_time($USER['b_tech'] - TIMESTAMP));
} else {
$buildInfo['tech'] = false;
}
$messageList[$messageRow['id']] = array('buildInfo' => $buildInfo, 'name' => $messageRow['name'], 'galaxy' => $messageRow['galaxy'], 'system' => $messageRow['system'], 'planet' => $messageRow['planet'], 'plid' => $messageRow['id'], 'gmetal' => pretty_number($messageRow['metal']), 'gcrystal' => pretty_number($messageRow['crystal']), 'gdeuterium' => pretty_number($messageRow['deuterium']), 'gelyrium' => pretty_number($messageRow['elyrium']), 'gmetalpircent' => round($messageRow['metal'] * 100 / $messageRow['metal_max']), 'gcrystalpircent' => round($messageRow['crystal'] * 100 / $messageRow['crystal_max']), 'gdeuteriumpircent' => round($messageRow['deuterium'] * 100 / $messageRow['deuterium_max']), 'gelyriumpircent' => round($messageRow['elyrium'] * 100 / $messageRow['elyrium_max']), 'energypircent' => round(abs($messageRow['energy'] * ($messageRow['energy'] - abs($messageRow['energy_used'])) / 2)), 'field_current' => $messageRow['field_current'], 'field_max' => $messageRow['field_max'], 'teleport_portal' => $messageRow['teleport_portal'], 'image' => $messageRow['image'], 'force_field_timer' => $messageRow['force_field_timer'], 'energy' => $messageRow['energy'], 'energy_used' => $messageRow['energy_used'], 'metal_mine_porcent' => $messageRow['metal_mine_porcent'] * 10, 'crystal_mine_porcent' => $messageRow['crystal_mine_porcent'] * 10, 'deuterium_sintetizer_porcent' => $messageRow['deuterium_sintetizer_porcent'] * 10, 'elyrium_mine_porcent' => $messageRow['elyrium_mine_porcent'] * 10, 'number' => $number++);
}
}
$this->tplObj->assign_vars(array('messageList' => $messageList, 'timinger' => TIMESTAMP));
$this->display("page.gestion.default.tpl");
}
示例13: ElementBuildListQueue
/**
* ElementBuildListQueue.php
*
* @version 1.0
* @copyright 2008 By Chlorel for XNova
*/
function ElementBuildListQueue($CurrentUser, $CurrentPlanet)
{
// Jamais appelé pour le moment donc totalement modifiable !
/*
alter table `ogame`.`game_planets`
change `name` `name` varchar (255) NULL COLLATE latin1_general_ci,
change `b_building_id` `b_building_id` text NULL COLLATE latin1_general_ci,
change `b_tech_id` `b_tech_id` text NULL COLLATE latin1_general_ci,
change `b_hangar_id` `b_hangar_id` text NULL COLLATE latin1_general_ci,
change `image` `image` varchar (32) DEFAULT 'normaltempplanet01' NOT NULL COLLATE latin1_general_ci,
change `b_building_queue` `b_building_queue` text NULL COLLATE latin1_general_ci,
change `unbau` `unbau` varchar (100) NULL COLLATE latin1_general_ci;
*/
global $lang, $pricelist;
// Array del b_hangar_id
$b_building_id = explode(';', $CurrentPlanet['b_building_queue']);
$a = $b = $c = "";
foreach ($b_hangar_id as $n => $array) {
if ($array != '') {
$array = explode(',', $array);
// calculamos el tiempo
$time = GetBuildingTime($user, $CurrentPlanet, $array[0]);
$totaltime += $time * $array[1];
$c .= "{$time},";
$Replace = array('ä' => 'ae', 'ü' => 'ü', 'ö' => 'ö');
$Name = strtr($Replace, $lang['tech'][$array[0]]);
$b .= "'Test',";
$a .= "{$array[1]},";
}
}
$parse = $lang;
$parse['a'] = $a;
$parse['b'] = $b;
$parse['c'] = $c;
$parse['b_hangar_id_plus'] = $CurrentPlanet['b_hangar'];
$parse['pretty_time_b_hangar'] = pretty_time($totaltime - $CurrentPlanet['b_hangar']);
// //$CurrentPlanet['last_update']
$text .= parsetemplate(gettemplate('buildings_script'), $parse);
#return $text;
}
示例14: GetNextJumpWaitTime
private function GetNextJumpWaitTime($CurMoon)
{
global $resource;
$JumpGateLevel = $CurMoon[$resource[43]];
$LastJumpTime = $CurMoon['last_jump_time'];
if ($JumpGateLevel > 0) {
$NextJumpTime = $LastJumpTime + JUMPGATE_WAIT_TIME;
if ($NextJumpTime >= TIMESTAMP) {
$RestWait = $NextJumpTime - TIMESTAMP;
$RestString = " " . pretty_time($RestWait);
} else {
$RestWait = 0;
$RestString = "";
}
} else {
$RestWait = 0;
$RestString = "";
}
$RetValue['string'] = $RestString;
$RetValue['value'] = $RestWait;
return $RetValue;
}
示例15: __construct
public function __construct()
{
global $USER, $CONF, $PLANET, $resource, $reslist, $LNG, $db, $ExtraDM, $OfficerInfo, $pricelist;
$action = request_var('action', '');
$Offi = request_var('offi', 0);
$Extra = request_var('extra', 0);
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
if ($action == "send" && $USER['urlaubs_modus'] == 0) {
if (!empty($Offi) && !CheckModule(18)) {
$this->UpdateOfficier($Offi);
} elseif (!empty($Extra) && !CheckModule(8)) {
$this->UpdateExtra($Extra);
}
}
$PlanetRess->SavePlanetToDB();
$template = new template();
$template->loadscript('officier.js');
if (!CheckModule(8)) {
foreach ($reslist['dmfunc'] as $Element) {
if ($USER[$resource[$Element]] > TIMESTAMP) {
$template->execscript("GetOfficerTime(" . $Element . ", " . ($USER[$resource[$Element]] - TIMESTAMP) . ");");
}
$ExtraDMList[] = array('id' => $Element, 'active' => $USER[$resource[$Element]] - TIMESTAMP, 'price' => pretty_number($ExtraDM[$Element]['darkmatter']), 'isok' => $USER['darkmatter'] - $ExtraDM[$Element]['darkmatter'] >= 0 ? true : false, 'time' => pretty_time($ExtraDM[$Element]['time'] * 3600), 'name' => $LNG['tech'][$Element], 'desc' => sprintf($LNG['res']['descriptions'][$Element], $ExtraDM[$Element]['add'] * 100));
}
}
if (!CheckModule(18)) {
foreach ($reslist['officier'] as $Element) {
if (($Result = $this->IsOfficierAccessible($Element)) === 0) {
continue;
}
$description = $OfficerInfo[$Element]['info'] ? sprintf($LNG['info'][$Element]['description'], is_float($OfficerInfo[$Element]['info']) ? $OfficerInfo[$Element]['info'] * 100 : $OfficerInfo[$Element]['info'], $pricelist[$Element]['max']) : sprintf($LNG['info'][$Element]['description'], $pricelist[$Element]['max']);
$OfficierList[] = array('id' => $Element, 'level' => $USER[$resource[$Element]], 'name' => $LNG['tech'][$Element], 'desc' => $description, 'Result' => $Result);
}
}
$template->assign_vars(array('ExtraDMList' => $ExtraDMList, 'OfficierList' => $OfficierList, 'user_darkmatter' => floor($USER['darkmatter'] / DM_PRO_OFFICIER_LEVEL), 'of_max_lvl' => $LNG['of_max_lvl'], 'of_recruit' => $LNG['of_recruit'], 'of_darkmatter' => sprintf($LNG['of_points_per_thousand_darkmatter'], DM_PRO_OFFICIER_LEVEL, $LNG['Darkmatter']), 'of_available_points' => $LNG['of_available_points'], 'of_lvl' => $LNG['of_lvl'], 'in_dest_durati' => $LNG['in_dest_durati'], 'of_still' => $LNG['of_still'], 'of_active' => $LNG['of_active'], 'of_update' => $LNG['of_update'], 'in_dest_durati' => $LNG['in_dest_durati'], 'of_dm_trade' => sprintf($LNG['of_dm_trade'], $LNG['Darkmatter'])));
$template->show("officier_overview.tpl");
}