Completed
Push — work-fleets ( 22b5bc...08ace7 )
by SuperNova.WS
06:13
created

buildings.php (4 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
/**
4
 * buildings.php
5
 *
6
 *  Allow building of... hmm... buildings
7
 *
8
 * @version 1.3s Security checks by Gorlum for http://supernova.ws
9
 * @version 1.3
10
// History version
11
// 1.0 - Nettoyage modularisation
12
// 1.1 - Mise au point, mise en fonction pour linarisation du fonctionnement
13
// 1.2 - Liste de construction batiments
14
 * @copyright 2008 by Chlorel for XNova
15
 */
16
17
include('common.' . substr(strrchr(__FILE__, '.'), 1));
18
19
define('SN_RENDER_NAVBAR_PLANET', true);
20
21
$mode = sys_get_param_escaped('mode');
22
$mode = (!$mode || $mode == 'buildings') ? QUE_STRUCTURES : ($mode == 'fleet' ? SUBQUE_FLEET : ($mode == 'defense' ? SUBQUE_DEFENSE : ($mode == 'research' ? QUE_RESEARCH : $mode)));
23
24
if($building_sort = sys_get_param_id('sort_elements')) {
25
  if(!empty(classLocale::$lang['player_option_building_sort'][$building_sort])) {
26
    classSupernova::$user_options[array(PLAYER_OPTION_BUILDING_SORT, $mode)] = $building_sort;
27
    classSupernova::$user_options[array(PLAYER_OPTION_BUILDING_SORT_INVERSE, $mode)] = sys_get_param_id('sort_elements_inverse', 0);
28
  }
29
  die();
30
}
31
32
lng_include('buildings');
33
lng_include('infos');
34
35
sn_sys_sector_buy('buildings.php?mode=' . $mode);
36
37
require_once('includes/includes/eco_bld_structures.php');
38
switch ($mode) {
39
//  case UNIT_MERCENARIES:
0 ignored issues
show
Unused Code Comprehensibility introduced by
56% 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...
40
//    require_once('includes/includes/eco_bld_structures.php');
41
//    eco_build(QUE_MERCENARY, $user, $planetrow);
42
//  break;
43
44 View Code Duplication
  case QUE_RESEARCH:
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
45
    defined("GAME_RESEARCH_DISABLED") && GAME_RESEARCH_DISABLED ? eco_build(SUBQUE_FLEET, $user, $planetrow) : eco_build(QUE_RESEARCH, $user, $planetrow);
46
  break;
47
48
  case SUBQUE_DEFENSE:
49 View Code Duplication
  case SUBQUE_FLEET:
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
50
    defined("GAME_DEFENSE_DISABLED") && GAME_DEFENSE_DISABLED ? eco_build(SUBQUE_FLEET, $user, $planetrow) : eco_build($mode, $user, $planetrow);
51
  break;
52
53
  case QUE_STRUCTURES:
54 View Code Duplication
  default:
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
55
    defined("GAME_STRUCTURES_DISABLED") && GAME_STRUCTURES_DISABLED ? eco_build(SUBQUE_FLEET, $user, $planetrow) : eco_build(QUE_STRUCTURES, $user, $planetrow);
56
  break;
57
}
58