Completed
Push — work-fleets ( 451000...e7900f )
by SuperNova.WS
06:16
created

fleet.php (8 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
define('SN_IN_FLEET', true);
4
define('SN_RENDER_NAVBAR_PLANET', true);
5
6
include('common.' . substr(strrchr(__FILE__, '.'), 1));
7
8
// TODO - Переместить это куда-нибудь
9
$fleet_page = sys_get_param_int('fleet_page', sys_get_param_int('mode'));
10
if($fleet_ship_sort = sys_get_param_id('sort_elements') && $fleet_page == 0) {
0 ignored issues
show
Comprehensibility introduced by
Consider adding parentheses for clarity. Current Interpretation: $fleet_ship_sort = (sys_...') && $fleet_page == 0), Probably Intended Meaning: ($fleet_ship_sort = sys_...')) && $fleet_page == 0
Loading history...
11
  define('IN_AJAX', true);
12
  if(!empty(classLocale::$lang['player_option_fleet_ship_sort'][$fleet_ship_sort])) {
13
    // player_save_option($user, PLAYER_OPTION_FLEET_SHIP_SORT, $fleet_ship_sort);
0 ignored issues
show
Unused Code Comprehensibility introduced by
59% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
14
    // player_save_option($user, PLAYER_OPTION_FLEET_SHIP_SORT_INVERSE, sys_get_param_id('fleet_ship_sort_inverse', 0));
0 ignored issues
show
Unused Code Comprehensibility introduced by
62% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
15
    classSupernova::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT] = $fleet_ship_sort;
16
    classSupernova::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT_INVERSE] = sys_get_param_id('sort_elements_inverse', 0);
17
  }
18
  die();
19
}
20
21
global $template_result, $user, $planetrow;
22
$template_result = !empty($template_result) && is_array($template_result) ? $template_result : array();
23
24
25
require_once('includes/includes/flt_functions.php');
26
27
lng_include('fleet');
28
29
//$galaxy = sys_get_param_int('galaxy', $planetrow['galaxy']);
0 ignored issues
show
Unused Code Comprehensibility introduced by
64% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
30
//$system = sys_get_param_int('system', $planetrow['system']);
31
//$planet = sys_get_param_int('planet', $planetrow['planet']);
32
33
$targetVector = new Vector(VECTOR_READ_PARAMS, $planetrow);
34
$target_mission = sys_get_param_int('target_mission', MT_NONE);
35
$ships = sys_get_param_array('ships');
36
$fleet_group_mr = sys_get_param_id('fleet_group');
37
38
39
// Инициализируем объекты значениями по умолчанию
40
$objFleet5 = new Fleet();
41
$objFleet5->initDefaults($user, $planetrow, $targetVector, $target_mission, $ships, $fleet_group_mr);
42
43
44
// TODO
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
45
//if($target_mission == MT_COLONIZE || $target_mission == MT_EXPLORE) {
46
//  $planet_type = PT_PLANET;
47
//} elseif($target_mission == MT_RECYCLE) {
48
//  $planet_type = PT_DEBRIS;
49
//} elseif($target_mission == MT_DESTROY) {
50
//  $planet_type = PT_MOON;
51
//} else {
52
//  $planet_type = sys_get_param_int('planet_type');
53
//  if(!$planet_type) {
54
//    $planet_type = sys_get_param_int('planettype', $planetrow['planet_type']);
55
//  }
56
//}
57
58
// TODO
0 ignored issues
show
Unused Code Comprehensibility introduced by
53% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
59
//$options = array();
60
//$MaxFleets = $options['fleets_max'] = GetMaxFleets($user);
61
//
62
//$FlyingFleets = FleetList::fleet_count_flying($user['id']);
63
//if($MaxFleets <= $FlyingFleets && $fleet_page && $fleet_page != 4) {
64
//  message(classLocale::$lang['fl_noslotfree'], classLocale::$lang['fl_error'], "fleet." . PHP_EX, 5);
65
//}
66
//
67
//$MaxExpeditions = get_player_max_expeditons($user);
68
//if($MaxExpeditions) {
69
//  $FlyingExpeditions = FleetList::fleet_count_flying($user['id'], MT_EXPLORE);
70
//} else {
71
//  $FlyingExpeditions = 0;
72
//}
73
74
75
switch($fleet_page) {
76
  case 3:
77
78
  case 2:
79
    list($ship_amount, $planet_type, $duration) = $objFleet5->fleetPage2Prepare($ship_amount, $debug, $planet, $galaxy, $system, $planet_type, $user, $planetrow);
0 ignored issues
show
The call to Fleet::fleetPage2Prepare() has too many arguments starting with $planetrow.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
80
  // No Break
81
82
  case 1:
83
//    if($galaxy && $system && $planet) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
45% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
84
//      $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET;
85
//
86
//      $TargetPlanet = db_planet_by_gspt($galaxy, $system, $planet, $check_type);
87
//    }
88
89
}
90
91
$objFleet5->fleetPage0Prepare();
92
93
switch($fleet_page) {
94
  case 1:
95
    $objFleet5->fleetPage1($planet_type);
96
  break;
97
98
  case 2:
99
    $objFleet5->fleetPage2();
100
  break;
101
102
  case 3:
103
    require_once('includes/includes/flt_page3.inc');
104
    sn_fleet_page3($duration);
105
  break;
106
107
  case 4:
108
    require('includes/includes/flt_page4.inc');
109
  break;
110
111
  case 5:
112
    require('includes/includes/flt_page5.inc');
113
  break;
114
115
  default:
116
    $objFleet5->fleetPage0();
117
  break;
118
}
119