@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $this->players->db_load_player_by_id($player_id, UBE_PLAYER_IS_DEFENDER); |
148 | 148 | |
149 | 149 | $player_db_row = $this->players[$player_id]->getDbRow(); |
150 | - if($fortifier_level = mrc_get_level($player_db_row, $this->combatMission->dst_planet, MRC_FORTIFIER)) { |
|
150 | + if ($fortifier_level = mrc_get_level($player_db_row, $this->combatMission->dst_planet, MRC_FORTIFIER)) { |
|
151 | 151 | $this->planet_bonus->add_unit_by_snid(MRC_FORTIFIER, $fortifier_level); |
152 | 152 | } |
153 | 153 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $this->rounds[0] = new UBERound(0); |
180 | 180 | $this->rounds[0]->make_snapshot($this->fleet_list); |
181 | 181 | |
182 | - for($round = 1; $round <= 10; $round++) { |
|
182 | + for ($round = 1; $round <= 10; $round++) { |
|
183 | 183 | // Проводим раунд |
184 | 184 | defined('DEBUG_UBE') ? print("Round {$round}<br>") : false; |
185 | 185 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | // Анализируем итоги текущего раунда и готовим данные для следующего |
194 | 194 | $this->combat_result = $this->fleet_list->ubeAnalyzeFleetOutcome($round); |
195 | - if($this->combat_result != UBE_COMBAT_RESULT_DRAW) { |
|
195 | + if ($this->combat_result != UBE_COMBAT_RESULT_DRAW) { |
|
196 | 196 | break; |
197 | 197 | } |
198 | 198 | |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | // Генерируем результат боя |
222 | 222 | $this->fleet_list->ube_analyze_fleets($this->is_simulator, $this->debris, $this->resource_exchange_rates); |
223 | 223 | |
224 | - if(!$this->is_ube_loaded) { |
|
224 | + if (!$this->is_ube_loaded) { |
|
225 | 225 | $this->moon_calculator->calculate_moon($this); |
226 | 226 | |
227 | 227 | // Лутаем ресурсы - если аттакер выиграл |
228 | - if($this->combat_result == UBE_COMBAT_RESULT_WIN) { |
|
228 | + if ($this->combat_result == UBE_COMBAT_RESULT_WIN) { |
|
229 | 229 | $this->sn_ube_combat_analyze_loot(); |
230 | 230 | } |
231 | 231 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | RES_DEUTERIUM => 0, |
246 | 246 | ); |
247 | 247 | |
248 | - if( |
|
248 | + if ( |
|
249 | 249 | (($planet_resource_total = $this->fleet_list[0]->get_resources_amount()) > 0) |
250 | 250 | && |
251 | 251 | (($total_capacity = $this->fleet_list->ube_get_capacity_attackers()) > 0) |
@@ -257,9 +257,9 @@ discard block |
||
257 | 257 | $planet_lootable_percent = $planet_lootable / $planet_resource_total; |
258 | 258 | |
259 | 259 | // Вычисляем сколько ресурсов вывезено |
260 | - foreach($this->fleet_list->_container as $fleet_id => $fleet) { |
|
260 | + foreach ($this->fleet_list->_container as $fleet_id => $fleet) { |
|
261 | 261 | $looted_in_metal = 0; |
262 | - foreach($this->fleet_list[0]->resource_list as $resource_id => $resource_amount) { |
|
262 | + foreach ($this->fleet_list[0]->resource_list as $resource_id => $resource_amount) { |
|
263 | 263 | // Вычисляем какой процент общей емкости трюмов атакующих будет задействован |
264 | 264 | $fleet_lootable_percent = $fleet->fleet_capacity / $total_capacity; |
265 | 265 | $looted = floor($resource_amount * $planet_lootable_percent * $fleet_lootable_percent); |
@@ -325,16 +325,16 @@ discard block |
||
325 | 325 | $destination_user_id = $this->fleet_list[0]->owner_id; |
326 | 326 | |
327 | 327 | // Обновляем поле обломков на планете |
328 | - if(!$this->is_admin_in_combat && $this->debris->debris_total() > 0) { |
|
328 | + if (!$this->is_admin_in_combat && $this->debris->debris_total() > 0) { |
|
329 | 329 | db_planet_set_by_gspt($this->ube_planet_info[PLANET_GALAXY], $this->ube_planet_info[PLANET_SYSTEM], $this->ube_planet_info[PLANET_PLANET], PT_PLANET, |
330 | 330 | "`debris_metal` = `debris_metal` + " . $this->debris->debris_get_resource(RES_METAL) . ", `debris_crystal` = `debris_crystal` + " . $this->debris->debris_get_resource(RES_CRYSTAL) |
331 | 331 | ); |
332 | 332 | } |
333 | 333 | |
334 | - foreach($this->fleet_list->_container as $fleet_id => $UBEFleet) { |
|
334 | + foreach ($this->fleet_list->_container as $fleet_id => $UBEFleet) { |
|
335 | 335 | $ship_count_lost = $UBEFleet->unit_list->unitCountLost(); |
336 | 336 | |
337 | - if($fleet_id) { |
|
337 | + if ($fleet_id) { |
|
338 | 338 | // Флот |
339 | 339 | $UBEFleet->db_save_combat_result_fleet($this->is_small_fleet_recce, $this->moon_calculator->get_reapers_status()); |
340 | 340 | } else { |
@@ -342,19 +342,19 @@ discard block |
||
342 | 342 | |
343 | 343 | // Сохраняем изменения ресурсов - если они есть |
344 | 344 | $resource_delta = $UBEFleet->ube_combat_result_calculate_resources(); |
345 | - if(!empty($resource_delta)) { |
|
345 | + if (!empty($resource_delta)) { |
|
346 | 346 | $temp = array(); |
347 | - foreach($resource_delta as $resource_id => $resource_amount) { |
|
347 | + foreach ($resource_delta as $resource_id => $resource_amount) { |
|
348 | 348 | $resource_db_name = pname_resource_name($resource_id); |
349 | 349 | $temp[] = "`{$resource_db_name}` = `{$resource_db_name}` + ({$resource_amount})"; |
350 | 350 | } |
351 | 351 | db_planet_set_by_id($this->ube_planet_info[PLANET_ID], implode(',', $temp)); |
352 | 352 | } |
353 | 353 | |
354 | - if($ship_count_lost) { |
|
354 | + if ($ship_count_lost) { |
|
355 | 355 | $db_changeset = array(); |
356 | 356 | $planet_row_cache = $this->players[$destination_user_id]->getDbRow(); |
357 | - foreach($UBEFleet->unit_list->_container as $UBEUnit) { |
|
357 | + foreach ($UBEFleet->unit_list->_container as $UBEUnit) { |
|
358 | 358 | $db_changeset['unit'][] = sn_db_unit_changeset_prepare($UBEUnit->unitId, -$UBEUnit->units_lost, $planet_row_cache, $this->ube_planet_info[PLANET_ID]); |
359 | 359 | } |
360 | 360 | db_changeset_apply($db_changeset); |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | // TODO: Связать сабы с флотами констраинтами ON DELETE SET NULL |
366 | 366 | // Для САБов |
367 | 367 | $fleet_group_id_list = $this->fleet_list->ube_get_groups(); |
368 | - if(!empty($fleet_group_id_list)) { |
|
368 | + if (!empty($fleet_group_id_list)) { |
|
369 | 369 | $fleet_group_id_list = implode(',', $fleet_group_id_list); |
370 | 370 | db_acs_delete_by_list($fleet_group_id_list); |
371 | 371 | } |
@@ -374,19 +374,19 @@ discard block |
||
374 | 374 | |
375 | 375 | $bashing_list = array(); |
376 | 376 | $players_sides = $this->players->get_player_sides(); |
377 | - foreach($players_sides as $player_id => $player_side) { |
|
378 | - if($player_side != UBE_PLAYER_IS_ATTACKER) { |
|
377 | + foreach ($players_sides as $player_id => $player_side) { |
|
378 | + if ($player_side != UBE_PLAYER_IS_ATTACKER) { |
|
379 | 379 | continue; |
380 | 380 | } |
381 | - if($this->moon_calculator->get_status() != UBE_MOON_DESTROY_SUCCESS) { |
|
381 | + if ($this->moon_calculator->get_status() != UBE_MOON_DESTROY_SUCCESS) { |
|
382 | 382 | $bashing_list[] = "({$player_id}, {$this->ube_planet_info[PLANET_ID]}, {$this->combat_timestamp})"; |
383 | 383 | } |
384 | - if($this->mission_type_id == MT_ATTACK && $this->is_defender_active_player) { |
|
384 | + if ($this->mission_type_id == MT_ATTACK && $this->is_defender_active_player) { |
|
385 | 385 | $str_loose_or_win = $this->combat_result == UBE_COMBAT_RESULT_WIN ? 'raidswin' : 'raidsloose'; |
386 | 386 | db_user_set_by_id($player_id, "`xpraid` = `xpraid` + 1, `raids` = `raids` + 1, `{$str_loose_or_win}` = `{$str_loose_or_win}` + 1"); |
387 | 387 | } |
388 | 388 | } |
389 | - if(!empty($bashing_list)) { |
|
389 | + if (!empty($bashing_list)) { |
|
390 | 390 | $bashing_list = implode(',', $bashing_list); |
391 | 391 | db_bashing_insert($bashing_list); |
392 | 392 | } |
@@ -413,20 +413,19 @@ discard block |
||
413 | 413 | $planet_info[PLANET_SYSTEM], |
414 | 414 | $planet_info[PLANET_PLANET], |
415 | 415 | htmlentities($planet_info[PLANET_NAME], ENT_COMPAT, 'UTF-8'), |
416 | - classLocale::$lang[$this->combat_result == UBE_COMBAT_RESULT_WIN ? 'ube_report_info_outcome_win' : |
|
417 | - ($this->combat_result == UBE_COMBAT_RESULT_DRAW ? 'ube_report_info_outcome_draw' : 'ube_report_info_outcome_loss')] |
|
416 | + classLocale::$lang[$this->combat_result == UBE_COMBAT_RESULT_WIN ? 'ube_report_info_outcome_win' : ($this->combat_result == UBE_COMBAT_RESULT_DRAW ? 'ube_report_info_outcome_draw' : 'ube_report_info_outcome_loss')] |
|
418 | 417 | ); |
419 | 418 | |
420 | 419 | $text_defender = ''; |
421 | 420 | $debris = $this->debris->get_debris(); |
422 | - foreach($debris as $resource_id => $resource_amount) { |
|
423 | - if($resource_id == RES_DEUTERIUM) { |
|
421 | + foreach ($debris as $resource_id => $resource_amount) { |
|
422 | + if ($resource_id == RES_DEUTERIUM) { |
|
424 | 423 | continue; |
425 | 424 | } |
426 | 425 | |
427 | 426 | $text_defender .= "{$lang['tech'][$resource_id]}: " . pretty_number($resource_amount) . '<br />'; |
428 | 427 | } |
429 | - if($text_defender) { |
|
428 | + if ($text_defender) { |
|
430 | 429 | $text_defender = "{$lang['ube_report_msg_body_debris']}{$text_defender}<br />"; |
431 | 430 | } |
432 | 431 | |
@@ -436,7 +435,7 @@ discard block |
||
436 | 435 | |
437 | 436 | // TODO: Оптимизировать отсылку сообщений - отсылать пакетами |
438 | 437 | $player_sides = $this->players->get_player_sides(); |
439 | - foreach($player_sides as $player_id => $player_side) { |
|
438 | + foreach ($player_sides as $player_id => $player_side) { |
|
440 | 439 | $message = $text_common . ($this->is_small_fleet_recce && ($player_side == UBE_PLAYER_IS_ATTACKER) ? classLocale::$lang['ube_report_msg_body_sfr'] : $text_defender); |
441 | 440 | msg_send_simple_message($player_id, '', $this->combat_timestamp, MSG_TYPE_COMBAT, classLocale::$lang['sys_mess_tower'], classLocale::$lang['sys_mess_attack_report'], $message); |
442 | 441 | } |
@@ -473,11 +472,11 @@ discard block |
||
473 | 472 | $player_id = $player_id == -1 ? $this->players->count() : $player_id; |
474 | 473 | $fleet_id = $player_id; // FOR SIMULATOR! |
475 | 474 | |
476 | - if(empty($this->players[$player_id])) { |
|
475 | + if (empty($this->players[$player_id])) { |
|
477 | 476 | $this->players[$player_id] = new UBEPlayer(); |
478 | 477 | } |
479 | 478 | |
480 | - foreach($side_info as $fleet_data) { |
|
479 | + foreach ($side_info as $fleet_data) { |
|
481 | 480 | $this->players[$player_id]->name = $player_id; |
482 | 481 | $this->players[$player_id]->setSide($attacker); |
483 | 482 | |
@@ -485,32 +484,32 @@ discard block |
||
485 | 484 | $this->fleet_list[$fleet_id] = $objFleet; |
486 | 485 | |
487 | 486 | $this->fleet_list[$fleet_id]->owner_id = $player_id; |
488 | - foreach($fleet_data as $unit_id => $unit_count) { |
|
489 | - if(!$unit_count) { |
|
487 | + foreach ($fleet_data as $unit_id => $unit_count) { |
|
488 | + if (!$unit_count) { |
|
490 | 489 | continue; |
491 | 490 | } |
492 | 491 | |
493 | 492 | $unit_type = get_unit_param($unit_id, P_UNIT_TYPE); |
494 | 493 | |
495 | - if($unit_type == UNIT_SHIPS || $unit_type == UNIT_DEFENCE) { |
|
494 | + if ($unit_type == UNIT_SHIPS || $unit_type == UNIT_DEFENCE) { |
|
496 | 495 | $this->fleet_list[$fleet_id]->unit_list->unitAdjustCount($unit_id, $unit_count); |
497 | - } elseif($unit_type == UNIT_RESOURCES) { |
|
496 | + } elseif ($unit_type == UNIT_RESOURCES) { |
|
498 | 497 | $this->fleet_list[$fleet_id]->resource_list[$unit_id] = $unit_count; |
499 | - } elseif($unit_type == UNIT_TECHNOLOGIES) { |
|
500 | - if($unit_id == TECH_WEAPON) { |
|
498 | + } elseif ($unit_type == UNIT_TECHNOLOGIES) { |
|
499 | + if ($unit_id == TECH_WEAPON) { |
|
501 | 500 | $this->players[$player_id]->player_bonus->add_unit_by_snid(TECH_WEAPON, $unit_count); |
502 | - } elseif($unit_id == TECH_SHIELD) { |
|
501 | + } elseif ($unit_id == TECH_SHIELD) { |
|
503 | 502 | $this->players[$player_id]->player_bonus->add_unit_by_snid(TECH_SHIELD, $unit_count); |
504 | - } elseif($unit_id == TECH_ARMOR) { |
|
503 | + } elseif ($unit_id == TECH_ARMOR) { |
|
505 | 504 | $this->players[$player_id]->player_bonus->add_unit_by_snid(TECH_ARMOR, $unit_count); |
506 | 505 | } |
507 | - } elseif($unit_type == UNIT_GOVERNORS) { |
|
508 | - if($unit_id == MRC_FORTIFIER) { |
|
506 | + } elseif ($unit_type == UNIT_GOVERNORS) { |
|
507 | + if ($unit_id == MRC_FORTIFIER) { |
|
509 | 508 | // Фортифаер даёт бонус ко всему |
510 | 509 | $this->planet_bonus->add_unit_by_snid(MRC_FORTIFIER, $unit_count); |
511 | 510 | } |
512 | - } elseif($unit_type == UNIT_MERCENARIES) { |
|
513 | - if($unit_id == MRC_ADMIRAL) { |
|
511 | + } elseif ($unit_type == UNIT_MERCENARIES) { |
|
512 | + if ($unit_id == MRC_ADMIRAL) { |
|
514 | 513 | $this->players[$player_id]->player_bonus->add_unit_by_snid(MRC_ADMIRAL, $unit_count); |
515 | 514 | } |
516 | 515 | } |
@@ -581,7 +580,7 @@ discard block |
||
581 | 580 | |
582 | 581 | $ube_report = new UBEReport(); |
583 | 582 | $ube = $ube_report->sn_ube_report_load(sys_get_param_str('cypher')); |
584 | - if($ube != UBE_REPORT_NOT_FOUND) { |
|
583 | + if ($ube != UBE_REPORT_NOT_FOUND) { |
|
585 | 584 | $ube_report->sn_ube_report_generate($ube, $template_result); |
586 | 585 | |
587 | 586 | $template = gettemplate('ube_combat_report', $template); |
@@ -614,9 +613,9 @@ discard block |
||
614 | 613 | // sn_ube_report_save($combat_data); |
615 | 614 | // } |
616 | 615 | |
617 | - if(sys_get_param_str('reload')) { |
|
616 | + if (sys_get_param_str('reload')) { |
|
618 | 617 | $ube_new = $ube_report->sn_ube_report_load($ube->get_cypher()); // $combat_data = sn_ube_report_load($combat_data[UBE_REPORT_CYPHER]); |
619 | - if($ube_new != UBE_REPORT_NOT_FOUND && is_object($ube_new)) { |
|
618 | + if ($ube_new != UBE_REPORT_NOT_FOUND && is_object($ube_new)) { |
|
620 | 619 | $ube = $ube_new; |
621 | 620 | } |
622 | 621 | } |
@@ -664,7 +663,7 @@ discard block |
||
664 | 663 | $this->debris->load_from_report_row($report_row); |
665 | 664 | |
666 | 665 | $query = doquery("SELECT * FROM {{ube_report_player}} WHERE `ube_report_id` = {$report_row['ube_report_id']}"); |
667 | - while($player_row = db_fetch($query)) { |
|
666 | + while ($player_row = db_fetch($query)) { |
|
668 | 667 | $this->players->init_player_from_report_info($player_row); |
669 | 668 | } |
670 | 669 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | function gettemplatename($u_dpath) { |
11 | 11 | static $template_names = array(); |
12 | 12 | |
13 | - if(!isset($template_names[$u_dpath])) { |
|
13 | + if (!isset($template_names[$u_dpath])) { |
|
14 | 14 | $template_names[$u_dpath] = file_exists(SN_ROOT_PHYSICAL . $u_dpath . 'tmpl.ini') ? sys_file_read(SN_ROOT_PHYSICAL . $u_dpath . 'tmpl.ini') : TEMPLATE_NAME; |
15 | 15 | } |
16 | 16 | |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | * @param $sn_menu_extra |
53 | 53 | */ |
54 | 54 | function tpl_menu_merge_extra(&$sn_menu, &$sn_menu_extra) { |
55 | - if(empty($sn_menu) || empty($sn_menu_extra)) { |
|
55 | + if (empty($sn_menu) || empty($sn_menu_extra)) { |
|
56 | 56 | return; |
57 | 57 | } |
58 | 58 | |
59 | - foreach($sn_menu_extra as $menu_item_id => $menu_item) { |
|
60 | - if(empty($menu_item['LOCATION'])) { |
|
59 | + foreach ($sn_menu_extra as $menu_item_id => $menu_item) { |
|
60 | + if (empty($menu_item['LOCATION'])) { |
|
61 | 61 | $sn_menu[$menu_item_id] = $menu_item; |
62 | 62 | continue; |
63 | 63 | } |
@@ -66,16 +66,16 @@ discard block |
||
66 | 66 | unset($menu_item['LOCATION']); |
67 | 67 | |
68 | 68 | $is_positioned = $item_location[0]; |
69 | - if($is_positioned == '+' || $is_positioned == '-') { |
|
69 | + if ($is_positioned == '+' || $is_positioned == '-') { |
|
70 | 70 | $item_location = substr($item_location, 1); |
71 | 71 | } else { |
72 | 72 | $is_positioned = ''; |
73 | 73 | } |
74 | 74 | |
75 | - if($item_location) { |
|
75 | + if ($item_location) { |
|
76 | 76 | $menu_keys = array_keys($sn_menu); |
77 | 77 | $insert_position = array_search($item_location, $menu_keys); |
78 | - if($insert_position === false) { |
|
78 | + if ($insert_position === false) { |
|
79 | 79 | $insert_position = count($sn_menu) - 1; |
80 | 80 | $is_positioned = '+'; |
81 | 81 | $item_location = ''; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $spliced = array_splice($sn_menu, $insert_position, count($sn_menu) - $insert_position); |
89 | 89 | $sn_menu[$menu_item_id] = $menu_item; |
90 | 90 | |
91 | - if(!$is_positioned && $item_location) { |
|
91 | + if (!$is_positioned && $item_location) { |
|
92 | 92 | unset($spliced[$item_location]); |
93 | 93 | } |
94 | 94 | $sn_menu = array_merge($sn_menu, $spliced); |
@@ -102,24 +102,24 @@ discard block |
||
102 | 102 | * @param template $template |
103 | 103 | */ |
104 | 104 | function tpl_menu_assign_to_template(&$sn_menu, &$template) { |
105 | - if(empty($sn_menu) || !is_array($sn_menu)) { |
|
105 | + if (empty($sn_menu) || !is_array($sn_menu)) { |
|
106 | 106 | return; |
107 | 107 | } |
108 | 108 | |
109 | - foreach($sn_menu as $menu_item_id => $menu_item) { |
|
110 | - if(!$menu_item) { |
|
109 | + foreach ($sn_menu as $menu_item_id => $menu_item) { |
|
110 | + if (!$menu_item) { |
|
111 | 111 | continue; |
112 | 112 | } |
113 | 113 | |
114 | - if(is_string($menu_item_id)) { |
|
114 | + if (is_string($menu_item_id)) { |
|
115 | 115 | $menu_item['ID'] = $menu_item_id; |
116 | 116 | } |
117 | 117 | |
118 | - if($menu_item['TYPE'] == 'lang') { |
|
118 | + if ($menu_item['TYPE'] == 'lang') { |
|
119 | 119 | $lang_string = &classLocale::$lang; |
120 | - if(preg_match('#(\w+)(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?#', $menu_item['ITEM'], $matches) && count($matches) > 1) { |
|
121 | - for($i = 1; $i < count($matches); $i++) { |
|
122 | - if(defined($matches[$i])) { |
|
120 | + if (preg_match('#(\w+)(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?#', $menu_item['ITEM'], $matches) && count($matches) > 1) { |
|
121 | + for ($i = 1; $i < count($matches); $i++) { |
|
122 | + if (defined($matches[$i])) { |
|
123 | 123 | $matches[$i] = constant($matches[$i]); |
124 | 124 | } |
125 | 125 | $lang_string = &$lang_string[$matches[$i]]; |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | $menu_item['ALT'] = htmlentities($menu_item['ALT']); |
132 | 132 | $menu_item['TITLE'] = htmlentities($menu_item['TITLE']); |
133 | 133 | |
134 | - if(!empty($menu_item['ICON'])) { |
|
135 | - if(is_string($menu_item['ICON'])) { |
|
134 | + if (!empty($menu_item['ICON'])) { |
|
135 | + if (is_string($menu_item['ICON'])) { |
|
136 | 136 | $menu_item['ICON_PATH'] = $menu_item['ICON']; |
137 | 137 | } else { |
138 | 138 | $menu_item['ICON'] = $menu_item_id; |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | 'MENU_START_HIDE' => !empty($_COOKIE[SN_COOKIE . '_menu_hidden']) || defined('SN_GOOGLE'), |
163 | 163 | )); |
164 | 164 | |
165 | - if(isset($template_result['MENU_CUSTOMIZE'])) { |
|
165 | + if (isset($template_result['MENU_CUSTOMIZE'])) { |
|
166 | 166 | $template->assign_vars(array( |
167 | 167 | 'PLAYER_OPTION_MENU_SHOW_ON_BUTTON' => classSupernova::$user_options[PLAYER_OPTION_MENU_SHOW_ON_BUTTON], |
168 | 168 | 'PLAYER_OPTION_MENU_HIDE_ON_BUTTON' => classSupernova::$user_options[PLAYER_OPTION_MENU_HIDE_ON_BUTTON], |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | )); |
177 | 177 | } |
178 | 178 | |
179 | - if(defined('IN_ADMIN') && IN_ADMIN === true && !empty($user['authlevel']) && $user['authlevel'] > 0) { |
|
179 | + if (defined('IN_ADMIN') && IN_ADMIN === true && !empty($user['authlevel']) && $user['authlevel'] > 0) { |
|
180 | 180 | tpl_menu_merge_extra($sn_menu_admin, $sn_menu_admin_extra); |
181 | 181 | tpl_menu_assign_to_template($sn_menu_admin, $template); |
182 | 182 | } else { |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $in_admin = defined('IN_ADMIN') && IN_ADMIN === true; |
217 | 217 | $is_login = defined('LOGIN_LOGOUT') && LOGIN_LOGOUT === true; |
218 | 218 | |
219 | - if(is_object($page)) { |
|
219 | + if (is_object($page)) { |
|
220 | 220 | isset($page->_rootref['MENU']) ? $isDisplayMenu = $page->_rootref['MENU'] : false; |
221 | 221 | isset($page->_rootref['NAVBAR']) ? $isDisplayTopNav = $page->_rootref['NAVBAR'] : false; |
222 | 222 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | !isset($page->_rootref['PAGE_HEADER']) && $title ? $page->assign_var('PAGE_HEADER', $title) : false; |
225 | 225 | } |
226 | 226 | |
227 | - if(empty($user['id']) || !is_numeric($user['id'])) { |
|
227 | + if (empty($user['id']) || !is_numeric($user['id'])) { |
|
228 | 228 | $isDisplayMenu = false; |
229 | 229 | $isDisplayTopNav = false; |
230 | 230 | } |
@@ -236,10 +236,10 @@ discard block |
||
236 | 236 | $user_time_measured_unix = intval(isset($user_time_diff[PLAYER_OPTION_TIME_DIFF_MEASURE_TIME]) ? strtotime($user_time_diff[PLAYER_OPTION_TIME_DIFF_MEASURE_TIME]) : 0); |
237 | 237 | |
238 | 238 | $font_size = !empty($_COOKIE[SN_COOKIE_F]) ? $_COOKIE[SN_COOKIE_F] : classSupernova::$user_options[PLAYER_OPTION_BASE_FONT_SIZE]; |
239 | - if(strpos($font_size, '%') !== false) { |
|
239 | + if (strpos($font_size, '%') !== false) { |
|
240 | 240 | // Размер шрифта в процентах |
241 | 241 | $font_size = min(max(floatval($font_size), FONT_SIZE_PERCENT_MIN), FONT_SIZE_PERCENT_MAX) . '%'; |
242 | - } elseif(strpos($font_size, 'px') !== false) { |
|
242 | + } elseif (strpos($font_size, 'px') !== false) { |
|
243 | 243 | // Размер шрифта в пикселях |
244 | 244 | $font_size = min(max(floatval($font_size), FONT_SIZE_PIXELS_MIN), FONT_SIZE_PIXELS_MAX) . 'px'; |
245 | 245 | } else { |
@@ -251,10 +251,10 @@ discard block |
||
251 | 251 | |
252 | 252 | $template = gettemplate('_global_header', true); |
253 | 253 | |
254 | - if(!empty(classSupernova::$sn_mvc['javascript'])) { |
|
255 | - foreach(classSupernova::$sn_mvc['javascript'] as $page_name => $script_list) { |
|
256 | - if(empty($page_name) || $page_name == $sn_page_name) { |
|
257 | - foreach($script_list as $filename => $content) { |
|
254 | + if (!empty(classSupernova::$sn_mvc['javascript'])) { |
|
255 | + foreach (classSupernova::$sn_mvc['javascript'] as $page_name => $script_list) { |
|
256 | + if (empty($page_name) || $page_name == $sn_page_name) { |
|
257 | + foreach ($script_list as $filename => $content) { |
|
258 | 258 | $template_result['.']['javascript'][] = array( |
259 | 259 | 'FILE' => $filename, |
260 | 260 | 'CONTENT' => $content, |
@@ -280,9 +280,9 @@ discard block |
||
280 | 280 | classSupernova::$sn_mvc['css'][''] = array_merge($standard_css, classSupernova::$sn_mvc['css']['']); |
281 | 281 | |
282 | 282 | |
283 | - foreach(classSupernova::$sn_mvc['css'] as $page_name => $script_list) { |
|
284 | - if(empty($page_name) || $page_name == $sn_page_name) { |
|
285 | - foreach($script_list as $filename => $content) { |
|
283 | + foreach (classSupernova::$sn_mvc['css'] as $page_name => $script_list) { |
|
284 | + if (empty($page_name) || $page_name == $sn_page_name) { |
|
285 | + foreach ($script_list as $filename => $content) { |
|
286 | 286 | $template_result['.']['css'][] = array( |
287 | 287 | 'FILE' => $filename, |
288 | 288 | 'CONTENT' => $content, |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | ), // Проводить замер только если не выставлен флаг форсированного замера И (иссяк интервал замера ИЛИ замера еще не было) |
309 | 309 | //'TIME_UTC_OFFSET' => defined('SN_CLIENT_TIME_UTC_OFFSET') ? SN_CLIENT_TIME_UTC_OFFSET : '', |
310 | 310 | |
311 | - 'title' => ($title ? "{$title} - " : '') . classLocale::$lang['sys_server'] . " {$config->game_name} - " . classLocale::$lang['sys_supernova'] , |
|
311 | + 'title' => ($title ? "{$title} - " : '') . classLocale::$lang['sys_server'] . " {$config->game_name} - " . classLocale::$lang['sys_supernova'], |
|
312 | 312 | '-meta-' => $metatags, |
313 | 313 | 'ADV_SEO_META_DESCRIPTION' => $config->adv_seo_meta_description, |
314 | 314 | 'ADV_SEO_META_KEYWORDS' => $config->adv_seo_meta_keywords, |
@@ -329,12 +329,12 @@ discard block |
||
329 | 329 | $template->assign_recursive($template_result); |
330 | 330 | displayP(parsetemplate($template)); |
331 | 331 | |
332 | - if(($isDisplayMenu || $in_admin) && !isset($_COOKIE['menu_disable'])) { |
|
332 | + if (($isDisplayMenu || $in_admin) && !isset($_COOKIE['menu_disable'])) { |
|
333 | 333 | // $AdminPage = $AdminPage ? $user['authlevel'] : 0; |
334 | 334 | displayP(parsetemplate(tpl_render_menu())); |
335 | 335 | } |
336 | 336 | |
337 | - if($isDisplayTopNav && !$in_admin) { |
|
337 | + if ($isDisplayTopNav && !$in_admin) { |
|
338 | 338 | displayP(parsetemplate(tpl_render_topnav($user, $planetrow))); |
339 | 339 | } |
340 | 340 | |
@@ -342,8 +342,8 @@ discard block |
||
342 | 342 | |
343 | 343 | !is_array($page) ? $page = array($page) : false; |
344 | 344 | $result_added = false; |
345 | - foreach($page as $page_item) { |
|
346 | - if(!$result_added && is_object($page_item) && isset($page_item->_tpldata['result'])) { |
|
345 | + foreach ($page as $page_item) { |
|
346 | + if (!$result_added && is_object($page_item) && isset($page_item->_tpldata['result'])) { |
|
347 | 347 | $page_item = gettemplate('_result_message', $page_item); |
348 | 348 | $temp = $page_item->files['_result_message']; |
349 | 349 | unset($page_item->files['_result_message']); |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | )); |
367 | 367 | displayP(parsetemplate($template)); |
368 | 368 | |
369 | - $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false;; |
|
369 | + $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false; ; |
|
370 | 370 | |
371 | 371 | sn_db_disconnect(); |
372 | 372 | |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | * @param string $type |
405 | 405 | */ |
406 | 406 | function tpl_topnav_event_build(&$template, $FleetList, $type = 'fleet') { |
407 | - if(empty($FleetList)) { |
|
407 | + if (empty($FleetList)) { |
|
408 | 408 | return; |
409 | 409 | } |
410 | 410 | |
@@ -413,19 +413,19 @@ discard block |
||
413 | 413 | $fleet_event_count = 0; |
414 | 414 | $fleet_flying_sorter = array(); |
415 | 415 | $fleet_flying_events = array(); |
416 | - foreach($FleetList->_container as $objFleet) { |
|
416 | + foreach ($FleetList->_container as $objFleet) { |
|
417 | 417 | $will_return = true; |
418 | - if(!$objFleet->isReturning()) { |
|
418 | + if (!$objFleet->isReturning()) { |
|
419 | 419 | // cut fleets on Hold and Expedition |
420 | - if($objFleet->time_arrive_to_target >= SN_TIME_NOW) { |
|
420 | + if ($objFleet->time_arrive_to_target >= SN_TIME_NOW) { |
|
421 | 421 | $objFleet->mission_type == MT_RELOCATE ? $will_return = false : false; |
422 | 422 | tpl_topnav_event_build_helper($objFleet->time_arrive_to_target, EVENT_FLEET_ARRIVE, classLocale::$lang['sys_event_arrive'], $objFleet->target_coordinates_typed(), !$will_return, $objFleet, $fleet_flying_sorter, $fleet_flying_events, $fleet_event_count); |
423 | 423 | } |
424 | - if($objFleet->time_mission_job_complete) { |
|
424 | + if ($objFleet->time_mission_job_complete) { |
|
425 | 425 | tpl_topnav_event_build_helper($objFleet->time_mission_job_complete, EVENT_FLEET_STAY, classLocale::$lang['sys_event_stay'], $objFleet->target_coordinates_typed(), false, $objFleet, $fleet_flying_sorter, $fleet_flying_events, $fleet_event_count); |
426 | 426 | } |
427 | 427 | } |
428 | - if($will_return) { |
|
428 | + if ($will_return) { |
|
429 | 429 | tpl_topnav_event_build_helper($objFleet->time_return_to_source, EVENT_FLEET_RETURN, classLocale::$lang['sys_event_return'], $objFleet->launch_coordinates_typed(), true, $objFleet, $fleet_flying_sorter, $fleet_flying_events, $fleet_event_count); |
430 | 430 | } |
431 | 431 | } |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | asort($fleet_flying_sorter); |
434 | 434 | |
435 | 435 | $fleet_flying_count = $FleetList->count(); |
436 | - foreach($fleet_flying_sorter as $fleet_event_id => $fleet_time) { |
|
436 | + foreach ($fleet_flying_sorter as $fleet_event_id => $fleet_time) { |
|
437 | 437 | $fleet_event = &$fleet_flying_events[$fleet_event_id]; |
438 | 438 | $template->assign_block_vars("flying_{$type}s", array( |
439 | 439 | 'TIME' => max(0, $fleet_time - SN_TIME_NOW), |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | function sn_tpl_render_topnav(&$user, $planetrow) { |
462 | 462 | global $lang, $config, $template_result; |
463 | 463 | |
464 | - if(!is_array($user)) { |
|
464 | + if (!is_array($user)) { |
|
465 | 465 | return ''; |
466 | 466 | } |
467 | 467 | |
@@ -482,8 +482,8 @@ discard block |
||
482 | 482 | |
483 | 483 | $ThisUsersPlanets = db_planet_list_sorted($user); |
484 | 484 | // while ($CurPlanet = db_fetch($ThisUsersPlanets)) |
485 | - foreach($ThisUsersPlanets as $CurPlanet) { |
|
486 | - if($CurPlanet['destruyed']) { |
|
485 | + foreach ($ThisUsersPlanets as $CurPlanet) { |
|
486 | + if ($CurPlanet['destruyed']) { |
|
487 | 487 | continue; |
488 | 488 | } |
489 | 489 | |
@@ -507,8 +507,8 @@ discard block |
||
507 | 507 | */ |
508 | 508 | $fleet_flying_list = array(); |
509 | 509 | $fleet_flying_list[0] = FleetList::dbGetFleetListByOwnerId($user['id']); |
510 | - foreach($fleet_flying_list[0]->_container as $fleet_id => $objFleet) { |
|
511 | - if(empty($fleet_flying_list[$objFleet->mission_type])) { |
|
510 | + foreach ($fleet_flying_list[0]->_container as $fleet_id => $objFleet) { |
|
511 | + if (empty($fleet_flying_list[$objFleet->mission_type])) { |
|
512 | 512 | $fleet_flying_list[$objFleet->mission_type] = new FleetList(); |
513 | 513 | } |
514 | 514 | $fleet_flying_list[$objFleet->mission_type][$fleet_id] = $objFleet; |
@@ -520,8 +520,8 @@ discard block |
||
520 | 520 | que_tpl_parse($template, QUE_RESEARCH, $user, array(), null, !classSupernova::$user_options[PLAYER_OPTION_NAVBAR_RESEARCH_WIDE]); |
521 | 521 | que_tpl_parse($template, SUBQUE_FLEET, $user, $planetrow, null, true); |
522 | 522 | |
523 | - if(!empty(classSupernova::$sn_mvc['navbar_prefix_button']) && is_array(classSupernova::$sn_mvc['navbar_prefix_button'])) { |
|
524 | - foreach(classSupernova::$sn_mvc['navbar_prefix_button'] as $navbar_button_image => $navbar_button_url) { |
|
523 | + if (!empty(classSupernova::$sn_mvc['navbar_prefix_button']) && is_array(classSupernova::$sn_mvc['navbar_prefix_button'])) { |
|
524 | + foreach (classSupernova::$sn_mvc['navbar_prefix_button'] as $navbar_button_image => $navbar_button_url) { |
|
525 | 525 | $template->assign_block_vars('navbar_prefix_button', array( |
526 | 526 | 'IMAGE' => $navbar_button_image, |
527 | 527 | 'URL_RELATIVE' => $navbar_button_url, |
@@ -535,13 +535,13 @@ discard block |
||
535 | 535 | $time_now_parsed = getdate(SN_TIME_NOW); |
536 | 536 | $time_local_parsed = getdate(defined('SN_CLIENT_TIME_LOCAL') ? SN_CLIENT_TIME_LOCAL : SN_TIME_NOW); |
537 | 537 | |
538 | - if($config->game_news_overview) { |
|
538 | + if ($config->game_news_overview) { |
|
539 | 539 | $user_last_read_safe = intval($user['news_lastread']); |
540 | 540 | nws_render($template, "WHERE UNIX_TIMESTAMP(`tsTimeStamp`) >= {$user_last_read_safe}", $config->game_news_overview); |
541 | 541 | } |
542 | 542 | |
543 | 543 | $notes_query = db_note_list_by_owner($user['id'], true); |
544 | - while($note_row = db_fetch($notes_query)) { |
|
544 | + while ($note_row = db_fetch($notes_query)) { |
|
545 | 545 | note_assign($template, $note_row); |
546 | 546 | } |
547 | 547 | |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | 'QUE_ID' => QUE_RESEARCH, |
553 | 553 | 'QUE_HTML' => 'topnav', |
554 | 554 | |
555 | - 'RESEARCH_ONGOING' => (boolean)$user['que'], |
|
555 | + 'RESEARCH_ONGOING' => (boolean) $user['que'], |
|
556 | 556 | |
557 | 557 | 'TIME_TEXT' => sprintf($str_date_format, $time_now_parsed['year'], classLocale::$lang['months'][$time_now_parsed['mon']], $time_now_parsed['mday'], |
558 | 558 | $time_now_parsed['hours'], $time_now_parsed['minutes'], $time_now_parsed['seconds'] |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | 'QUE_STRUCTURES' => QUE_STRUCTURES, |
630 | 630 | )); |
631 | 631 | |
632 | - if((defined('SN_RENDER_NAVBAR_PLANET') && SN_RENDER_NAVBAR_PLANET === true) || ($user['option_list'][OPT_INTERFACE]['opt_int_navbar_resource_force'] && SN_RENDER_NAVBAR_PLANET !== false)) { |
|
632 | + if ((defined('SN_RENDER_NAVBAR_PLANET') && SN_RENDER_NAVBAR_PLANET === true) || ($user['option_list'][OPT_INTERFACE]['opt_int_navbar_resource_force'] && SN_RENDER_NAVBAR_PLANET !== false)) { |
|
633 | 633 | tpl_set_resource_info($template, $planetrow); |
634 | 634 | $template->assign_vars(array( |
635 | 635 | 'SN_RENDER_NAVBAR_PLANET' => true, |
@@ -644,12 +644,12 @@ discard block |
||
644 | 644 | * @param template|string $template |
645 | 645 | */ |
646 | 646 | function displayP($template) { |
647 | - if(is_object($template)) { |
|
648 | - if(empty($template->parsed)) { |
|
647 | + if (is_object($template)) { |
|
648 | + if (empty($template->parsed)) { |
|
649 | 649 | parsetemplate($template); |
650 | 650 | } |
651 | 651 | |
652 | - foreach($template->files as $section => $filename) { |
|
652 | + foreach ($template->files as $section => $filename) { |
|
653 | 653 | $template->display($section); |
654 | 654 | } |
655 | 655 | } else { |
@@ -664,11 +664,11 @@ discard block |
||
664 | 664 | * @return mixed |
665 | 665 | */ |
666 | 666 | function parsetemplate($template, $array = false) { |
667 | - if(is_object($template)) { |
|
667 | + if (is_object($template)) { |
|
668 | 668 | global $user; |
669 | 669 | |
670 | - if(!empty($array) && is_array($array)) { |
|
671 | - foreach($array as $key => $data) { |
|
670 | + if (!empty($array) && is_array($array)) { |
|
671 | + foreach ($array as $key => $data) { |
|
672 | 672 | $template->assign_var($key, $data); |
673 | 673 | } |
674 | 674 | } |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | |
710 | 710 | $template_ex = '.tpl.html'; |
711 | 711 | |
712 | - if($template === false) { |
|
712 | + if ($template === false) { |
|
713 | 713 | return sys_file_read(TEMPLATE_DIR . '/' . $files . $template_ex); |
714 | 714 | } |
715 | 715 | |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | !empty(classSupernova::$sn_mvc['i18n']['']) ? lng_load_i18n(classSupernova::$sn_mvc['i18n']['']) : false; |
730 | 730 | $sn_page_name ? lng_load_i18n(classSupernova::$sn_mvc['i18n'][$sn_page_name]) : false; |
731 | 731 | |
732 | - foreach($files as &$filename) { |
|
732 | + foreach ($files as &$filename) { |
|
733 | 733 | $filename = $filename . $template_ex; |
734 | 734 | } |
735 | 735 | |
@@ -754,13 +754,13 @@ discard block |
||
754 | 754 | 'LANG' => $language ? $language : '', |
755 | 755 | 'referral' => $id_ref ? '&id_ref=' . $id_ref : '', |
756 | 756 | |
757 | - 'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '',// "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''), |
|
757 | + 'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '', // "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''), |
|
758 | 758 | 'FILENAME' => basename($_SERVER['PHP_SELF']), |
759 | 759 | )); |
760 | 760 | |
761 | - foreach(lng_get_list() as $lng_id => $lng_data) { |
|
762 | - if(isset($lng_data['LANG_VARIANTS']) && is_array($lng_data['LANG_VARIANTS'])) { |
|
763 | - foreach($lng_data['LANG_VARIANTS'] as $lang_variant) { |
|
761 | + foreach (lng_get_list() as $lng_id => $lng_data) { |
|
762 | + if (isset($lng_data['LANG_VARIANTS']) && is_array($lng_data['LANG_VARIANTS'])) { |
|
763 | + foreach ($lng_data['LANG_VARIANTS'] as $lang_variant) { |
|
764 | 764 | $lng_data1 = $lng_data; |
765 | 765 | $lng_data1 = array_merge($lng_data1, $lang_variant); |
766 | 766 | $template->assign_block_vars('language', $lng_data1); |
@@ -783,8 +783,8 @@ discard block |
||
783 | 783 | $que = $que['ques'][$que_type][$planet['id_owner']][$planet['id']]; |
784 | 784 | |
785 | 785 | $que_length = 0; |
786 | - if(!empty($que)) { |
|
787 | - foreach($que as $que_item) { |
|
786 | + if (!empty($que)) { |
|
787 | + foreach ($que as $que_item) { |
|
788 | 788 | $template->assign_block_vars('que', que_tpl_parse_element($que_item)); |
789 | 789 | } |
790 | 790 | $que_length = count($que); |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | * @param int $user_dark_matter |
800 | 800 | */ |
801 | 801 | function tpl_planet_density_info(&$template, &$density_price_chart, $user_dark_matter) { |
802 | - foreach($density_price_chart as $density_price_index => &$density_price_data) { |
|
802 | + foreach ($density_price_chart as $density_price_index => &$density_price_data) { |
|
803 | 803 | $density_cost = $density_price_data; |
804 | 804 | $density_number_style = pretty_number($density_cost, true, $user_dark_matter, false, false); |
805 | 805 | |
@@ -823,7 +823,7 @@ discard block |
||
823 | 823 | function tpl_assign_select(&$template, $name, $values) { |
824 | 824 | !is_array($values) ? $values = array($values => $values) : false; |
825 | 825 | |
826 | - foreach($values as $key => $value) { |
|
826 | + foreach ($values as $key => $value) { |
|
827 | 827 | $template->assign_block_vars($name, array( |
828 | 828 | 'KEY' => htmlentities($key, ENT_COMPAT, 'UTF-8'), |
829 | 829 | 'VALUE' => htmlentities($value, ENT_COMPAT, 'UTF-8'), |
@@ -30,29 +30,29 @@ discard block |
||
30 | 30 | } |
31 | 31 | $size = getimagesize(SN_ROOT_PHYSICAL . $img_name); |
32 | 32 | $im = imagecreatefrompng(SN_ROOT_PHYSICAL . $img_name); |
33 | - $image = imagecreatetruecolor($size[0],$size[1]); |
|
34 | - imagecopy($image,$im,0,0,0,0,$size[0],$size[1]); |
|
33 | + $image = imagecreatetruecolor($size[0], $size[1]); |
|
34 | + imagecopy($image, $im, 0, 0, 0, 0, $size[0], $size[1]); |
|
35 | 35 | imagedestroy($im); |
36 | 36 | |
37 | 37 | // Colors |
38 | 38 | $color = "FFFFFF"; |
39 | - $red = hexdec(substr($color,0,2)); |
|
40 | - $green = hexdec(substr($color,2,4)); |
|
41 | - $blue = hexdec(substr($color,4,6)); |
|
42 | - $select = imagecolorallocate($image,$red,$green,$blue); |
|
39 | + $red = hexdec(substr($color, 0, 2)); |
|
40 | + $green = hexdec(substr($color, 2, 4)); |
|
41 | + $blue = hexdec(substr($color, 4, 6)); |
|
42 | + $select = imagecolorallocate($image, $red, $green, $blue); |
|
43 | 43 | $txt_shadow = imagecolorallocatealpha($image, 255, 255, 255, 255); |
44 | 44 | $txt_color = imagecolorallocatealpha($image, 255, 255, 255, 2); |
45 | 45 | $txt_shadow2 = imagecolorallocatealpha($image, 255, 255, 255, 255); |
46 | 46 | $txt_color2 = imagecolorallocatealpha($image, 255, 255, 255, 40); |
47 | 47 | |
48 | - $fonts = array ( |
|
48 | + $fonts = array( |
|
49 | 49 | 'userbar' => SN_ROOT_PHYSICAL . "design/fonts/" . $config->int_userbar_font, |
50 | 50 | 'universe' => SN_ROOT_PHYSICAL . "design/fonts/" . $config->int_banner_fontUniverse, |
51 | 51 | 'raids' => SN_ROOT_PHYSICAL . "design/fonts/" . $config->int_banner_fontRaids, |
52 | 52 | 'info' => SN_ROOT_PHYSICAL . "design/fonts/" . $config->int_banner_fontInfo, |
53 | 53 | ); |
54 | 54 | |
55 | - if($id) |
|
55 | + if ($id) |
|
56 | 56 | { |
57 | 57 | // Querys |
58 | 58 | $user = db_user_by_id($id); |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | $b_user = $user['username']; |
63 | 63 | $b_ally = $user['ally_name']; |
64 | 64 | $b_planet = $planet_row['name']; |
65 | - $b_xyz = "[".$planet_row['galaxy'].":".$planet_row['system'].":".$planet_row['planet']."]"; |
|
66 | - $b_lvl = ($user['total_rank'] ? $user['total_rank'] : $config->users_amount) ."/{$config->users_amount}"; |
|
65 | + $b_xyz = "[" . $planet_row['galaxy'] . ":" . $planet_row['system'] . ":" . $planet_row['planet'] . "]"; |
|
66 | + $b_lvl = ($user['total_rank'] ? $user['total_rank'] : $config->users_amount) . "/{$config->users_amount}"; |
|
67 | 67 | } |
68 | 68 | else |
69 | 69 | { |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | imagettftext($image, 11, 0, 8, 26, $txt_shadow, $fonts['info'], $b_user); |
86 | 86 | imagettftext($image, 11, 0, 6, 23, $txt_color, $fonts['info'], $b_user); |
87 | 87 | |
88 | - if($id) |
|
88 | + if ($id) |
|
89 | 89 | { |
90 | 90 | // Player level - right-alligned |
91 | 91 | $is = imagettfbbox(11, 0, $fonts['info'], $b_lvl); |
@@ -94,37 +94,37 @@ discard block |
||
94 | 94 | |
95 | 95 | // Ally name |
96 | 96 | $is = imagettfbbox(9, 0, $fonts['info'], $b_ally); |
97 | - imagettftext($image, 9, 0, 412-$is[2], 37, $txt_shadow, $fonts['info'], $b_ally); |
|
98 | - imagettftext($image, 9, 0, 410-$is[2], 35, $txt_color, $fonts['info'], $b_ally); |
|
97 | + imagettftext($image, 9, 0, 412 - $is[2], 37, $txt_shadow, $fonts['info'], $b_ally); |
|
98 | + imagettftext($image, 9, 0, 410 - $is[2], 35, $txt_color, $fonts['info'], $b_ally); |
|
99 | 99 | |
100 | 100 | // Player b_planet |
101 | - imagettftext($image, 6, 0, 8, 10, $txt_shadow2, $fonts['raids'], $b_planet." ".$b_xyz); |
|
102 | - imagettftext($image, 6, 0, 6, 9, $txt_color2, $fonts['raids'], $b_planet." ".$b_xyz); |
|
101 | + imagettftext($image, 6, 0, 8, 10, $txt_shadow2, $fonts['raids'], $b_planet . " " . $b_xyz); |
|
102 | + imagettftext($image, 6, 0, 6, 9, $txt_color2, $fonts['raids'], $b_planet . " " . $b_xyz); |
|
103 | 103 | |
104 | 104 | //StatPoint |
105 | - $b_points = classLocale::$lang['ov_points'].": ".pretty_number($user['total_points']); |
|
105 | + $b_points = classLocale::$lang['ov_points'] . ": " . pretty_number($user['total_points']); |
|
106 | 106 | $is = imagettfbbox(8, 0, $fonts['info'], $b_points); |
107 | - imagettftext($image, 8, 0, 412-$is[2], 11, $txt_shadow, $fonts['info'], $b_points); |
|
108 | - imagettftext($image, 8, 0, 410-$is[2], 9, $txt_color, $fonts['info'], $b_points); |
|
107 | + imagettftext($image, 8, 0, 412 - $is[2], 11, $txt_shadow, $fonts['info'], $b_points); |
|
108 | + imagettftext($image, 8, 0, 410 - $is[2], 9, $txt_color, $fonts['info'], $b_points); |
|
109 | 109 | |
110 | 110 | //Raids Total |
111 | 111 | imagettftext($image, 6, 0, 8, 37, $txt_shadow2, $fonts['raids'], classLocale::$lang['NumberOfRaids']); |
112 | 112 | imagettftext($image, 6, 0, 6, 35, $txt_color2, $fonts['raids'], classLocale::$lang['NumberOfRaids']); |
113 | - $b_points = ": ".pretty_number($user['raids']); |
|
113 | + $b_points = ": " . pretty_number($user['raids']); |
|
114 | 114 | imagettftext($image, 6, 0, 61, 37, $txt_shadow2, $fonts['raids'], $b_points); |
115 | 115 | imagettftext($image, 6, 0, 59, 35, $txt_color2, $fonts['raids'], $b_points); |
116 | 116 | |
117 | 117 | //Raids Won |
118 | 118 | imagettftext($image, 6, 0, 8, 47, $txt_shadow2, $fonts['raids'], classLocale::$lang['RaidsWin']); |
119 | 119 | imagettftext($image, 6, 0, 6, 45, $txt_color2, $fonts['raids'], classLocale::$lang['RaidsWin']); |
120 | - $b_points = ": ".pretty_number($user['raidswin']); |
|
120 | + $b_points = ": " . pretty_number($user['raidswin']); |
|
121 | 121 | imagettftext($image, 6, 0, 61, 47, $txt_shadow2, $fonts['raids'], $b_points); |
122 | 122 | imagettftext($image, 6, 0, 59, 45, $txt_color2, $fonts['raids'], $b_points); |
123 | 123 | |
124 | 124 | //Raids Lost |
125 | 125 | imagettftext($image, 6, 0, 8, 57, $txt_shadow2, $fonts['raids'], classLocale::$lang['RaidsLoose']); |
126 | 126 | imagettftext($image, 6, 0, 6, 55, $txt_color2, $fonts['raids'], classLocale::$lang['RaidsLoose']); |
127 | - $b_points = ": ".pretty_number($user['raidsloose']); |
|
127 | + $b_points = ": " . pretty_number($user['raidsloose']); |
|
128 | 128 | imagettftext($image, 6, 0, 61, 57, $txt_shadow2, $fonts['raids'], $b_points); |
129 | 129 | imagettftext($image, 6, 0, 59, 55, $txt_color2, $fonts['raids'], $b_points); |
130 | 130 | } |
@@ -137,25 +137,25 @@ discard block |
||
137 | 137 | $is = imagettfbbox(9, 0, $fonts['userbar'], $b_univ); |
138 | 138 | $is = $size[0] - $is[2] - 2; |
139 | 139 | imagettftext($image, 9, 0, $is, $size[1] - 3, $txt_shadow, $fonts['userbar'], $b_univ); |
140 | - imagettftext($image, 9, 0, $is-1, $size[1] - 5, $txt_color, $fonts['userbar'], $b_univ); |
|
141 | - imagettftext($image, 22, 0, $is-8, $size[1], $txt_color, $fonts['userbar'], '/'); |
|
140 | + imagettftext($image, 9, 0, $is - 1, $size[1] - 5, $txt_color, $fonts['userbar'], $b_univ); |
|
141 | + imagettftext($image, 22, 0, $is - 8, $size[1], $txt_color, $fonts['userbar'], '/'); |
|
142 | 142 | |
143 | 143 | // Player name |
144 | 144 | imagettftext($image, 9, 0, 4, $size[1] - 4, $txt_shadow, $fonts['userbar'], $b_user); |
145 | 145 | imagettftext($image, 9, 0, 2, $size[1] - 6, $txt_color, $fonts['userbar'], $b_user); |
146 | 146 | |
147 | - if($id) |
|
147 | + if ($id) |
|
148 | 148 | { |
149 | 149 | // Player level - right-alligned |
150 | 150 | $isp = imagettfbbox(9, 0, $fonts['userbar'], $b_lvl); |
151 | - imagettftext($image, 9, 0, $is-$isp[2] - 10, $size[1] - 4, $txt_shadow, $fonts['userbar'], $b_lvl); |
|
152 | - imagettftext($image, 9, 0, $is-$isp[2] - 10 - 1, $size[1] - 4 - 1, $txt_color, $fonts['userbar'], $b_lvl); |
|
151 | + imagettftext($image, 9, 0, $is - $isp[2] - 10, $size[1] - 4, $txt_shadow, $fonts['userbar'], $b_lvl); |
|
152 | + imagettftext($image, 9, 0, $is - $isp[2] - 10 - 1, $size[1] - 4 - 1, $txt_color, $fonts['userbar'], $b_lvl); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
156 | 156 | //And now convert it back to PNG-8 |
157 | - $im_result = imagecreate($size[0],$size[1]); |
|
158 | - imagecopy($im_result,$image,0,0,0,0,$size[0],$size[1]); |
|
157 | + $im_result = imagecreate($size[0], $size[1]); |
|
158 | + imagecopy($im_result, $image, 0, 0, 0, 0, $size[0], $size[1]); |
|
159 | 159 | imagedestroy($image); |
160 | 160 | //And save it |
161 | 161 | $imagetypes = imagetypes(); |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | $mip_data = get_unit_param(UNIT_DEF_MISSILE_INTERPLANET); |
15 | 15 | $MIPDamage = floor(mrc_modify_value($attackerTech, false, TECH_WEAPON, $MIPs * $mip_data[P_ATTACK] * mt_rand(80, 120) / 100)); |
16 | - foreach($structures as $key => $structure) |
|
16 | + foreach ($structures as $key => $structure) |
|
17 | 17 | { |
18 | 18 | $unit_info = get_unit_param($key); |
19 | 19 | $amplify = isset($mip_data[P_AMPLIFY][$key]) ? $mip_data[P_AMPLIFY][$key] : 1; |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | { |
32 | 32 | //attacking only selected structure |
33 | 33 | $damageDone = $structures[$targetedStructure][$damageTo]; |
34 | - $structsDestroyed = min( floor($MIPDamage/$damageDone), $structures[$targetedStructure][0] ); |
|
34 | + $structsDestroyed = min(floor($MIPDamage / $damageDone), $structures[$targetedStructure][0]); |
|
35 | 35 | $structures[$targetedStructure][0] -= $structsDestroyed; |
36 | - $MIPDamage -= $structsDestroyed*$damageDone; |
|
36 | + $MIPDamage -= $structsDestroyed * $damageDone; |
|
37 | 37 | } |
38 | 38 | else |
39 | 39 | { |
@@ -44,16 +44,16 @@ discard block |
||
44 | 44 | do |
45 | 45 | { |
46 | 46 | // finding is there any structure that can be damaged with leftovers of $MIPDamage |
47 | - foreach($can_be_damaged as $key => $unit_id) |
|
47 | + foreach ($can_be_damaged as $key => $unit_id) |
|
48 | 48 | { |
49 | 49 | //debug($structures[$unit_id][0]); |
50 | 50 | //debug($structures[$unit_id][$damageTo], $MIPDamage); |
51 | - if($structures[$unit_id][0] <= 0 || $structures[$unit_id][$damageTo] > $MIPDamage) |
|
51 | + if ($structures[$unit_id][0] <= 0 || $structures[$unit_id][$damageTo] > $MIPDamage) |
|
52 | 52 | { |
53 | 53 | unset($can_be_damaged[$key]); |
54 | 54 | } |
55 | 55 | } |
56 | - if(empty($can_be_damaged)) |
|
56 | + if (empty($can_be_damaged)) |
|
57 | 57 | { |
58 | 58 | break; |
59 | 59 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | //debug($destroyed, 'Actually destroyed'); |
73 | 73 | |
74 | 74 | //print('<hr>'); |
75 | - } while($MIPDamage > 0 && !empty($can_be_damaged)); |
|
75 | + } while ($MIPDamage > 0 && !empty($can_be_damaged)); |
|
76 | 76 | //debug($MIPDamage, 'MIPDamage left'); |
77 | 77 | } |
78 | 78 | //debug($structures);//die(); |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | $crystal += $destroyed * $unit_info[P_COST][RES_CRYSTAL] / 4; |
88 | 88 | } |
89 | 89 | |
90 | - $return['structures'] = $structures; // Structures left after attack |
|
91 | - $return['metal'] = floor($metal); // Metal scraps |
|
90 | + $return['structures'] = $structures; // Structures left after attack |
|
91 | + $return['metal'] = floor($metal); // Metal scraps |
|
92 | 92 | $return['crystal'] = floor($crystal); // Crystal scraps |
93 | 93 | |
94 | 94 | return $return; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | $iraks = db_missile_list_by_arrival(); |
114 | 114 | |
115 | - while($fleetRow = db_fetch($iraks)) { |
|
115 | + while ($fleetRow = db_fetch($iraks)) { |
|
116 | 116 | set_time_limit(15); |
117 | 117 | $db_changeset = array(); |
118 | 118 | |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | |
129 | 129 | $rowAttacker = db_user_by_id($fleetRow['fleet_owner'], true); |
130 | 130 | |
131 | - if($target_planet_row['id']) { |
|
131 | + if ($target_planet_row['id']) { |
|
132 | 132 | $planetDefense = array(); |
133 | - foreach(sn_get_groups('defense_active') as $unit_id) { |
|
133 | + foreach (sn_get_groups('defense_active') as $unit_id) { |
|
134 | 134 | $planetDefense[$unit_id] = array(mrc_get_level($targetUser, $target_planet_row, $unit_id, true, true)); |
135 | 135 | } |
136 | 136 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $message = classLocale::$lang['mip_all_destroyed']; |
142 | 142 | $db_changeset['unit'][] = sn_db_unit_changeset_prepare(UNIT_DEF_MISSILE_INTERCEPTOR, -$missiles, $targetUser, $target_planet_row['id']); |
143 | 143 | } else { |
144 | - if($interceptors) { |
|
144 | + if ($interceptors) { |
|
145 | 145 | $message = sprintf(classLocale::$lang['mip_destroyed'], $interceptors); |
146 | 146 | $db_changeset['unit'][] = sn_db_unit_changeset_prepare(UNIT_DEF_MISSILE_INTERCEPTOR, -$interceptors, $targetUser, $target_planet_row['id']); |
147 | 147 | } |
@@ -149,16 +149,16 @@ discard block |
||
149 | 149 | |
150 | 150 | $attackResult = COE_missileAttack($targetUser, $rowAttacker, $missiles - $interceptors, $planetDefense, $fleetRow['primaer']); |
151 | 151 | |
152 | - foreach($attackResult['structures'] as $key => $structure) { |
|
152 | + foreach ($attackResult['structures'] as $key => $structure) { |
|
153 | 153 | $destroyed = $planetDefense[$key][0] - $structure[0]; |
154 | - if($destroyed) { |
|
154 | + if ($destroyed) { |
|
155 | 155 | $db_changeset['unit'][] = sn_db_unit_changeset_prepare($key, -$destroyed, $targetUser, $target_planet_row['id']); |
156 | 156 | |
157 | 157 | $message .= " {$lang['tech'][$key]} - {$destroyed} {$lang['quantity']}<br>"; |
158 | 158 | } |
159 | 159 | } |
160 | 160 | |
161 | - if(!empty($message)) { |
|
161 | + if (!empty($message)) { |
|
162 | 162 | $message = $lang['mip_defense_destroyed'] . $message . "{$lang['mip_recycled']}{$lang['Metal']}: {$attackResult['metal']}, {$lang['Crystal']}: {$attackResult['crystal']}<br>"; |
163 | 163 | |
164 | 164 | db_planet_set_by_id($target_planet_row['id'], "`metal` = `metal` + {$attackResult['metal']}, `crystal` = `crystal` + {$attackResult['crystal']}"); |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | empty($message) ? $message = classLocale::$lang['mip_no_defense'] : false; |
179 | 179 | // empty($message) && ($message = $lang['mip_no_defense']); |
180 | 180 | |
181 | - msg_send_simple_message ( $fleetRow['fleet_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, classLocale::$lang['mip_sender_amd'], classLocale::$lang['mip_subject_amd'], $message_vorlage . $message ); |
|
182 | - msg_send_simple_message ( $fleetRow['fleet_target_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, classLocale::$lang['mip_sender_amd'], classLocale::$lang['mip_subject_amd'], $message_vorlage . $message ); |
|
181 | + msg_send_simple_message($fleetRow['fleet_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, classLocale::$lang['mip_sender_amd'], classLocale::$lang['mip_subject_amd'], $message_vorlage . $message); |
|
182 | + msg_send_simple_message($fleetRow['fleet_target_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, classLocale::$lang['mip_sender_amd'], classLocale::$lang['mip_subject_amd'], $message_vorlage . $message); |
|
183 | 183 | } |
184 | 184 | db_missile_delete($fleetRow); |
185 | 185 | } |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | |
22 | 22 | function sn_admin_planet_edit_template(&$template, $edit_planet_row, $mode) { |
23 | 23 | $unit_list = sn_get_groups($mode); |
24 | - if(empty($unit_list)) { |
|
24 | + if (empty($unit_list)) { |
|
25 | 25 | return; |
26 | 26 | } |
27 | 27 | $name_list = classLocale::$lang['tech']; |
28 | 28 | |
29 | - foreach($unit_list as $unit_id) { |
|
29 | + foreach ($unit_list as $unit_id) { |
|
30 | 30 | $template->assign_block_vars('unit', array( |
31 | 31 | 'ID' => $unit_id, |
32 | 32 | 'NAME' => $name_list[$unit_id], |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | function admin_planet_edit_query_string($unit_id, $unit_amount, $mode) { return sn_function_call(__FUNCTION__, array($unit_id, $unit_amount, $mode)); } |
40 | 40 | |
41 | 41 | function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode) { |
42 | - if($unit_amount && in_array($unit_id, sn_get_groups($mode))) { |
|
42 | + if ($unit_amount && in_array($unit_id, sn_get_groups($mode))) { |
|
43 | 43 | $unit_amount = round($unit_amount); |
44 | 44 | $unit_name = get_unit_param($unit_id, P_NAME); |
45 | 45 | $result = "{$unit_name} = GREATEST(0, {$unit_name} + ({$unit_amount}))"; |