Passed
Push — work-fleets ( 6f822b...6dcfe4 )
by SuperNova.WS
06:31 queued 16s
created
ajax_version_check.php 2 patches
Switch Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -13,15 +13,15 @@
 block discarded – undo
13 13
   . '&id=' . urlencode(classSupernova::$config->server_updater_id);
14 14
 
15 15
 switch($mode) {
16
-  case SNC_MODE_REGISTER:
17
-    if(classSupernova::$config->server_updater_key || classSupernova::$config->server_updater_id) {
18
-      if($ajax) {
19
-        print(SNC_VER_REGISTER_ERROR_REGISTERED);
16
+    case SNC_MODE_REGISTER:
17
+      if(classSupernova::$config->server_updater_key || classSupernova::$config->server_updater_id) {
18
+        if($ajax) {
19
+          print(SNC_VER_REGISTER_ERROR_REGISTERED);
20
+        }
21
+        die();
20 22
       }
21
-      die();
22
-    }
23
-    $url .= "&name=" . urlencode(classSupernova::$config->game_name) . "&url=" . urlencode(SN_ROOT_VIRTUAL);
24
-  break;
23
+      $url .= "&name=" . urlencode(classSupernova::$config->game_name) . "&url=" . urlencode(SN_ROOT_VIRTUAL);
24
+    break;
25 25
 }
26 26
 
27 27
 $check_result = sn_get_url_contents($url);
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
   . '&key=' . urlencode(classSupernova::$config->server_updater_key)
13 13
   . '&id=' . urlencode(classSupernova::$config->server_updater_id);
14 14
 
15
-switch($mode) {
15
+switch ($mode) {
16 16
   case SNC_MODE_REGISTER:
17
-    if(classSupernova::$config->server_updater_key || classSupernova::$config->server_updater_id) {
18
-      if($ajax) {
17
+    if (classSupernova::$config->server_updater_key || classSupernova::$config->server_updater_id) {
18
+      if ($ajax) {
19 19
         print(SNC_VER_REGISTER_ERROR_REGISTERED);
20 20
       }
21 21
       die();
@@ -25,18 +25,18 @@  discard block
 block discarded – undo
25 25
 }
26 26
 
27 27
 $check_result = sn_get_url_contents($url);
28
-if(!$check_result) {
28
+if (!$check_result) {
29 29
   $version_check = SNC_VER_ERROR_CONNECT;
30
-} elseif(($version_check = intval($check_result)) && $version_check == $check_result) {
30
+} elseif (($version_check = intval($check_result)) && $version_check == $check_result) {
31 31
   $version_check = $check_result;
32 32
 } else {
33 33
   // JSON decode if string
34 34
   $check_result = json_decode($check_result, true);
35 35
   $version_check = $check_result === null ? SNC_VER_UNKNOWN_RESPONSE : $check_result['version_check'];
36 36
 
37
-  switch($mode) {
37
+  switch ($mode) {
38 38
     case SNC_MODE_REGISTER:
39
-      if($check_result['site']['site_key'] && $check_result['site']['site_id'] && $check_result['site']['result'] == SNC_VER_REGISTER_REGISTERED) {
39
+      if ($check_result['site']['site_key'] && $check_result['site']['site_id'] && $check_result['site']['result'] == SNC_VER_REGISTER_REGISTERED) {
40 40
         classSupernova::$config->db_saveItem('server_updater_key', $check_result['site']['site_key']);
41 41
         classSupernova::$config->db_saveItem('server_updater_id', $check_result['site']['site_id']);
42 42
       }
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 classSupernova::$config->db_saveItem('server_updater_check_last', SN_TIME_NOW);
50 50
 classSupernova::$config->db_saveItem('server_updater_check_result', $version_check);
51 51
 
52
-if($ajax) {
52
+if ($ajax) {
53 53
   define('IN_AJAX', true);
54 54
   print($version_check);
55 55
 }
Please login to merge, or discard this patch.
admin/tools.php 2 patches
Switch Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -34,69 +34,69 @@
 block discarded – undo
34 34
 }
35 35
 
36 36
 switch($mode) {
37
-  case ADM_TOOL_CONFIG_RELOAD:
38
-    classSupernova::$config->db_loadAll();
39
-    sys_refresh_tablelist();
40
-
41
-    classSupernova::$config->db_loadItem('game_watchlist');
42
-    if(classSupernova::$config->game_watchlist) {
43
-      classSupernova::$config->game_watchlist_array = explode(';', classSupernova::$config->game_watchlist);
44
-    } else {
45
-      unset(classSupernova::$config->game_watchlist_array);
46
-    }
47
-  break;
48
-
49
-  case ADM_TOOL_MD5:
50
-    $template = gettemplate("admin/md5enc", true);
51
-    $password_seed = sys_get_param_str_unsafe('seed', SN_SYS_SEC_CHARS_ALLOWED);
52
-    $password_length = sys_get_param_int('length', 16);
53
-    $string = ($string = sys_get_param_str_unsafe('string')) ? $string : sys_random_string($password_length, $password_seed);
54
-
55
-    $template->assign_vars(array(
56
-      'SEED'   => $password_seed,
57
-      'LENGTH' => $password_length,
58
-      'STRING' => htmlentities($string),
59
-      'MD5'    => md5($string),
60
-    ));
61
-    display($template, classLocale::$lang['adm_tools_md5_header'], false, '', true);
62
-  break;
63
-
64
-  case ADM_TOOL_FORCE_ALL:
65
-    classSupernova::$config->db_saveItem('db_version', 0);
66
-    require_once('../includes/update.php');
67
-  break;
68
-
69
-  case ADM_TOOL_FORCE_LAST:
70
-    classSupernova::$config->db_saveItem('db_version', floor(classSupernova::$config->db_version - 1));
71
-    require_once('../includes/update.php');
72
-  break;
73
-
74
-  case ADM_TOOL_INFO_PHP:
75
-    phpinfo();
76
-  break;
77
-
78
-  case ADM_TOOL_INFO_SQL:
79
-    $template = gettemplate("simple_table", true);
80
-
81
-    $status = array(
82
-      classLocale::$lang['adm_tool_sql_server_version'] => classSupernova::$db->db_get_server_info(),
83
-      classLocale::$lang['adm_tool_sql_client_version'] => classSupernova::$db->db_get_client_info(),
84
-      classLocale::$lang['adm_tool_sql_host_info']      => classSupernova::$db->db_get_host_info(),
85
-    );
86
-    templateAssignTable($template, 'server', $status);
87
-
88
-    templateAssignTable($template, 'status', classSupernova::$db->db_get_server_stat());
89
-    templateAssignTable($template, 'params', classSupernova::$db->db_core_show_status());
90
-
91
-    $template->assign_vars(array(
92
-      'PAGE_HEADER'   => classLocale::$lang['adm_tool_sql_page_header'],
93
-      'COLUMN_NAME_1' => classLocale::$lang['adm_tool_sql_param_name'],
94
-      'COLUMN_NAME_2' => classLocale::$lang['adm_tool_sql_param_value'],
95
-      'TABLE_FOOTER'  => 'test',
96
-    ));
97
-
98
-    display($template, classLocale::$lang['adm_bn_ttle'], false, '', true);
99
-  break;
37
+    case ADM_TOOL_CONFIG_RELOAD:
38
+      classSupernova::$config->db_loadAll();
39
+      sys_refresh_tablelist();
40
+
41
+      classSupernova::$config->db_loadItem('game_watchlist');
42
+      if(classSupernova::$config->game_watchlist) {
43
+        classSupernova::$config->game_watchlist_array = explode(';', classSupernova::$config->game_watchlist);
44
+      } else {
45
+        unset(classSupernova::$config->game_watchlist_array);
46
+      }
47
+    break;
48
+
49
+    case ADM_TOOL_MD5:
50
+      $template = gettemplate("admin/md5enc", true);
51
+      $password_seed = sys_get_param_str_unsafe('seed', SN_SYS_SEC_CHARS_ALLOWED);
52
+      $password_length = sys_get_param_int('length', 16);
53
+      $string = ($string = sys_get_param_str_unsafe('string')) ? $string : sys_random_string($password_length, $password_seed);
54
+
55
+      $template->assign_vars(array(
56
+        'SEED'   => $password_seed,
57
+        'LENGTH' => $password_length,
58
+        'STRING' => htmlentities($string),
59
+        'MD5'    => md5($string),
60
+      ));
61
+      display($template, classLocale::$lang['adm_tools_md5_header'], false, '', true);
62
+    break;
63
+
64
+    case ADM_TOOL_FORCE_ALL:
65
+      classSupernova::$config->db_saveItem('db_version', 0);
66
+      require_once('../includes/update.php');
67
+    break;
68
+
69
+    case ADM_TOOL_FORCE_LAST:
70
+      classSupernova::$config->db_saveItem('db_version', floor(classSupernova::$config->db_version - 1));
71
+      require_once('../includes/update.php');
72
+    break;
73
+
74
+    case ADM_TOOL_INFO_PHP:
75
+      phpinfo();
76
+    break;
77
+
78
+    case ADM_TOOL_INFO_SQL:
79
+      $template = gettemplate("simple_table", true);
80
+
81
+      $status = array(
82
+        classLocale::$lang['adm_tool_sql_server_version'] => classSupernova::$db->db_get_server_info(),
83
+        classLocale::$lang['adm_tool_sql_client_version'] => classSupernova::$db->db_get_client_info(),
84
+        classLocale::$lang['adm_tool_sql_host_info']      => classSupernova::$db->db_get_host_info(),
85
+      );
86
+      templateAssignTable($template, 'server', $status);
87
+
88
+      templateAssignTable($template, 'status', classSupernova::$db->db_get_server_stat());
89
+      templateAssignTable($template, 'params', classSupernova::$db->db_core_show_status());
90
+
91
+      $template->assign_vars(array(
92
+        'PAGE_HEADER'   => classLocale::$lang['adm_tool_sql_page_header'],
93
+        'COLUMN_NAME_1' => classLocale::$lang['adm_tool_sql_param_name'],
94
+        'COLUMN_NAME_2' => classLocale::$lang['adm_tool_sql_param_value'],
95
+        'TABLE_FOOTER'  => 'test',
96
+      ));
97
+
98
+      display($template, classLocale::$lang['adm_bn_ttle'], false, '', true);
99
+    break;
100 100
 
101 101
 }
102 102
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
13 13
 
14 14
 // if($user['authlevel'] < 1)
15
-if($user['authlevel'] < 3) {
15
+if ($user['authlevel'] < 3) {
16 16
   AdminMessage(classLocale::$lang['adm_err_denied']);
17 17
 }
18 18
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function templateAssignTable($template, $str, $status) {
27 27
   $template->assign_block_vars('table', classLocale::$lang['adm_tool_sql_table'][$str]);
28
-  foreach($status as $key => $value) {
28
+  foreach ($status as $key => $value) {
29 29
     $template->assign_block_vars('table.row', array(
30 30
       'VALUE_1' => $key,
31 31
       'VALUE_2' => $value,
@@ -33,13 +33,13 @@  discard block
 block discarded – undo
33 33
   }
34 34
 }
35 35
 
36
-switch($mode) {
36
+switch ($mode) {
37 37
   case ADM_TOOL_CONFIG_RELOAD:
38 38
     classSupernova::$config->db_loadAll();
39 39
     sys_refresh_tablelist();
40 40
 
41 41
     classSupernova::$config->db_loadItem('game_watchlist');
42
-    if(classSupernova::$config->game_watchlist) {
42
+    if (classSupernova::$config->game_watchlist) {
43 43
       classSupernova::$config->game_watchlist_array = explode(';', classSupernova::$config->game_watchlist);
44 44
     } else {
45 45
       unset(classSupernova::$config->game_watchlist_array);
Please login to merge, or discard this patch.
includes/includes/ube_zi_helpers.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
   print($round);
28 28
   print('<table border=1>');
29 29
   print('<tr align="left">');
30
-  foreach($header as $key => $value)
30
+  foreach ($header as $key => $value)
31 31
   {
32
-    if(is_array($value))
32
+    if (is_array($value))
33 33
     {
34 34
       continue;
35 35
     }
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
   );
62 62
 
63 63
   print('<tr align="right">');
64
-  foreach($unit_crossfire_result as $key => $value)
64
+  foreach ($unit_crossfire_result as $key => $value)
65 65
   {
66
-    if(is_array($value))
66
+    if (is_array($value))
67 67
     {
68 68
       continue;
69 69
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-function sn_ube_combat_helper_round_header($round)
4
-{
3
+function sn_ube_combat_helper_round_header($round) {
5 4
   $header = array(
6 5
     'ИД1',
7 6
     'ИД2',
@@ -40,13 +39,11 @@  discard block
 block discarded – undo
40 39
   print('</tr>');
41 40
 }
42 41
 
43
-function sn_ube_combat_helper_round_footer($round = 0)
44
-{
42
+function sn_ube_combat_helper_round_footer($round = 0) {
45 43
   print('</table>');
46 44
 }
47 45
 
48
-function sn_ube_combat_helper_round_row(&$unit_crossfire_result)
49
-{
46
+function sn_ube_combat_helper_round_row(&$unit_crossfire_result) {
50 47
   $SN = array(
51 48
     SHIP_CARGO_SMALL => 'МаТр', SHIP_CARGO_BIG => 'БоТр', SHIP_CARGO_SUPER => 'СуТр', SHIP_CARGO_HYPER => 'ГпТр',
52 49
     SHIP_SATTELITE_SOLAR => 'СоСп', 
Please login to merge, or discard this patch.
includes/vars/vars_mission_checks.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
   'checkSpeedPercentOld'       => FLIGHT_FLEET_SPEED_WRONG,
11 11
   'checkTargetInUniverse'      => FLIGHT_VECTOR_BEYOND_UNIVERSE,
12 12
   'checkTargetNotSource'       => FLIGHT_VECTOR_SAME_SOURCE,
13
-  'checkSenderNoVacation'      => FLIGHT_PLAYER_VACATION_OWN,  // tODO
13
+  'checkSenderNoVacation'      => FLIGHT_PLAYER_VACATION_OWN, // tODO
14 14
   'checkTargetNoVacation'      => FLIGHT_PLAYER_VACATION,
15 15
   'checkFleetNotEmpty'         => FLIGHT_SHIPS_NO_SHIPS,
16 16
   // 'checkUnitsPositive'         => FLIGHT_SHIPS_NEGATIVE, // Unused - 'cause it's not allowed to put negative units into Unit class
Please login to merge, or discard this patch.
includes/vars/vars_structures.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
       'factor' => 1.5,
16 16
     ),
17 17
     P_UNIT_PRODUCTION => array(
18
-      RES_METAL     => function ($level, $production_factor, $user, $planet_row) {return  40 * $level * pow(1.1, $level) * (0.1 * $production_factor);},
19
-      RES_ENERGY    => function ($level, $production_factor, $user, $planet_row) {return -13 * $level * pow(1.1, $level) * (0.1 * $production_factor);},
18
+      RES_METAL     => function($level, $production_factor, $user, $planet_row) {return  40 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
19
+      RES_ENERGY    => function($level, $production_factor, $user, $planet_row) {return -13 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
20 20
     ),
21 21
     P_MINING_IS_MANAGED => true,
22 22
   ),
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
       'factor' => 1.6,
34 34
     ),
35 35
     P_UNIT_PRODUCTION => array(
36
-      RES_CRYSTAL   => function ($level, $production_factor, $user, $planet_row) {return  32 * $level * pow(1.1, $level) * (0.1 * $production_factor);},
37
-      RES_ENERGY    => function ($level, $production_factor, $user, $planet_row) {return -16 * $level * pow(1.1, $level) * (0.1 * $production_factor);},
36
+      RES_CRYSTAL   => function($level, $production_factor, $user, $planet_row) {return  32 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
37
+      RES_ENERGY    => function($level, $production_factor, $user, $planet_row) {return -16 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
38 38
     ),
39 39
     P_MINING_IS_MANAGED => true,
40 40
   ),
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
       'factor' => 1.5,
52 52
     ),
53 53
     P_UNIT_PRODUCTION => array(
54
-      RES_DEUTERIUM => function ($level, $production_factor, $user, $planet_row) {return  10 * $level * pow(1.1, $level) * (0.1 * $production_factor) * (-0.002 * $planet_row["temp_max"] + 1.28);},
55
-      RES_ENERGY    => function ($level, $production_factor, $user, $planet_row) {return -20 * $level * pow(1.1, $level) * (0.1 * $production_factor);},
54
+      RES_DEUTERIUM => function($level, $production_factor, $user, $planet_row) {return  10 * $level * pow(1.1, $level) * (0.1 * $production_factor) * (-0.002 * $planet_row["temp_max"] + 1.28); },
55
+      RES_ENERGY    => function($level, $production_factor, $user, $planet_row) {return -20 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
56 56
     ),
57 57
     P_MINING_IS_MANAGED => true,
58 58
   ),
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
       'factor' => 1.5,
70 70
     ),
71 71
     P_UNIT_PRODUCTION => array(
72
-      RES_ENERGY    => function ($level, $production_factor, $user, $planet_row) {return ($planet_row["temp_max"] / 5 + 15) * $level * pow(1.1, $level) * (0.1 * $production_factor);},
72
+      RES_ENERGY    => function($level, $production_factor, $user, $planet_row) {return ($planet_row["temp_max"] / 5 + 15) * $level * pow(1.1, $level) * (0.1 * $production_factor); },
73 73
     ),
74 74
     P_MINING_IS_MANAGED => true,
75 75
   ),
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
       'factor' => 1.8,
88 88
     ),
89 89
     P_UNIT_PRODUCTION => array(
90
-      RES_DEUTERIUM => function ($level, $production_factor, $user, $planet_row) {return -10 * $level * pow(1.1, $level) * (0.1 * $production_factor);},
91
-      RES_ENERGY    => function ($level, $production_factor, $user, $planet_row) {return  30 * $level * pow(1.05 + 0.01 * mrc_get_level($user, null, TECH_ENERGY), $level) * (0.1 * $production_factor);},
90
+      RES_DEUTERIUM => function($level, $production_factor, $user, $planet_row) {return -10 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
91
+      RES_ENERGY    => function($level, $production_factor, $user, $planet_row) {return  30 * $level * pow(1.05 + 0.01 * mrc_get_level($user, null, TECH_ENERGY), $level) * (0.1 * $production_factor); },
92 92
     ),
93 93
     P_MINING_IS_MANAGED => true,
94 94
   ),
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
       'factor' => 2,
106 106
     ),
107 107
     'storage' => array(
108
-      RES_METAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level);},
108
+      RES_METAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level); },
109 109
     ),
110 110
   ),
111 111
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
       'factor' => 2,
122 122
     ),
123 123
     'storage' => array(
124
-      RES_CRYSTAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level);},
124
+      RES_CRYSTAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level); },
125 125
     ),
126 126
   ),
127 127
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
       'factor' => 2,
138 138
     ),
139 139
     'storage' => array(
140
-      RES_DEUTERIUM => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level);},
140
+      RES_DEUTERIUM => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level); },
141 141
     ),
142 142
   ),
143 143
 
Please login to merge, or discard this patch.
includes/vars/vars_combats.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     'shield' => 10,
36 36
     'armor' => 400,
37 37
     'attack' => 5,
38
-    'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250, ),
38
+    'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250,),
39 39
   ),
40 40
   SHIP_CARGO_BIG => array(
41 41
     'name' => 'big_ship_cargo',
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     'shield' => 25,
56 56
     'armor' => 1200,
57 57
     'attack' => 5,
58
-    'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250, ),
58
+    'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250,),
59 59
     'engine' => array(
60 60
       array(
61 61
         'tech' => TECH_ENGINE_CHEMICAL,
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     'shield' => 50,
84 84
     'armor' => 3000,
85 85
     'attack' => 10,
86
-    'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250, ),
86
+    'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250,),
87 87
     'engine' => array(
88 88
       array(
89 89
         'tech' => TECH_ENGINE_ION,
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     'shield' => 200,
112 112
     'armor' => 70000,
113 113
     'attack' => 50,
114
-    'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250, ),
114
+    'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250,),
115 115
     'engine' => array(
116 116
       array(
117 117
         'tech' => TECH_ENGINE_HYPER,
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     'shield' => 100,
141 141
     'armor' => 3000,
142 142
     'attack' => 50,
143
-    'amplify' => array(SHIP_SPY => 10.001, SHIP_SATTELITE_SOLAR => 21, ),
143
+    'amplify' => array(SHIP_SPY => 10.001, SHIP_SATTELITE_SOLAR => 21,),
144 144
     'engine' => array(
145 145
       array(
146 146
         'tech' => TECH_ENGINE_ION,
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     'shield' => 10,
169 169
     'armor' => 1600,
170 170
     'attack' => 1,
171
-    'amplify' => array(SHIP_SPY => 500.05, SHIP_SATTELITE_SOLAR => 1050, ),
171
+    'amplify' => array(SHIP_SPY => 500.05, SHIP_SATTELITE_SOLAR => 1050,),
172 172
     'engine' => array(
173 173
       array(
174 174
         'tech' => TECH_ENGINE_CHEMICAL,
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
     'shield' =>  0.01,
197 197
     'armor' => 100,
198 198
     'attack' =>  0.01,
199
-    'amplify' => array( SHIP_SPY => 1,),
199
+    'amplify' => array(SHIP_SPY => 1,),
200 200
     'engine' => array(
201 201
       array(
202 202
         'tech' => TECH_ENGINE_CHEMICAL,
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
       'factor' => 1,
221 221
     ),
222 222
     P_UNIT_PRODUCTION => array(
223
-      RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return ($planet_row["temp_max"] / 4 + 20) * $level * (0.1 * $production_factor);},
223
+      RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return ($planet_row["temp_max"] / 4 + 20) * $level * (0.1 * $production_factor); },
224 224
     ),
225 225
     P_MINING_IS_MANAGED => true,
226 226
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
     'shield' => 10,
230 230
     'armor' => 200,
231 231
     'attack' => 1,
232
-    'amplify' => array(SHIP_SPY => 1, ),
232
+    'amplify' => array(SHIP_SPY => 1,),
233 233
     'engine' => array(
234 234
       array(
235 235
         'tech' => TECH_ENGINE_CHEMICAL,
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
     'shield' => 10,
262 262
     'armor' => 400,
263 263
     'attack' => 50,
264
-    'amplify' => array(SHIP_CARGO_SMALL => 16.4, SHIP_SPY => 10.001, SHIP_SATTELITE_SOLAR => 21, ),
264
+    'amplify' => array(SHIP_CARGO_SMALL => 16.4, SHIP_SPY => 10.001, SHIP_SATTELITE_SOLAR => 21,),
265 265
     'engine' => array(
266 266
       array(
267 267
         'tech' => TECH_ENGINE_CHEMICAL,
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
     'shield' => 25,
291 291
     'armor' => 1000,
292 292
     'attack' => 150,
293
-    'amplify' => array(SHIP_CARGO_SMALL => 8.2, SHIP_SPY => 3.33367, SHIP_SATTELITE_SOLAR => 7, ),
293
+    'amplify' => array(SHIP_CARGO_SMALL => 8.2, SHIP_SPY => 3.33367, SHIP_SATTELITE_SOLAR => 7,),
294 294
     'engine' => array(
295 295
       array(
296 296
         'tech' => TECH_ENGINE_ION,
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
     'shield' =>  50,
350 350
     'armor' => 2700,
351 351
     'attack' => 400,
352
-    'amplify' => array(SHIP_SMALL_FIGHTER_LIGHT => 6.15, SHIP_SPY => 1.25013, SHIP_SATTELITE_SOLAR => 2.625, UNIT_DEF_TURRET_MISSILE => 5.5, ),
352
+    'amplify' => array(SHIP_SMALL_FIGHTER_LIGHT => 6.15, SHIP_SPY => 1.25013, SHIP_SATTELITE_SOLAR => 2.625, UNIT_DEF_TURRET_MISSILE => 5.5,),
353 353
     'engine' => array(
354 354
       array(
355 355
         'tech' => TECH_ENGINE_ION,
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
     'shield' =>  200,
409 409
     'armor' =>  6000,
410 410
     'attack' => 1000,
411
-    'amplify' => array(SHIP_SPY => 0.50005, SHIP_SATTELITE_SOLAR => 1.05, UNIT_DEF_TURRET_MISSILE => 1.76, ),
411
+    'amplify' => array(SHIP_SPY => 0.50005, SHIP_SATTELITE_SOLAR => 1.05, UNIT_DEF_TURRET_MISSILE => 1.76,),
412 412
     'engine' => array(
413 413
       array(
414 414
         'tech' => TECH_ENGINE_HYPER,
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
     'shield' =>  500,
505 505
     'armor' => 11000,
506 506
     'attack' => 2000,
507
-    'amplify' => array(SHIP_SPY => 0.25003, SHIP_SATTELITE_SOLAR => 0.525, SHIP_LARGE_BATTLESHIP => 7.4, UNIT_DEF_TURRET_LASER_SMALL => 1.125, ),
507
+    'amplify' => array(SHIP_SPY => 0.25003, SHIP_SATTELITE_SOLAR => 0.525, SHIP_LARGE_BATTLESHIP => 7.4, UNIT_DEF_TURRET_LASER_SMALL => 1.125,),
508 508
     'engine' => array(
509 509
       array(
510 510
         'tech' => TECH_ENGINE_HYPER,
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
     'shield' => 20,
609 609
     'armor' => 200,
610 610
     'attack' => 80,
611
-    'amplify' => array(SHIP_SPY => 7, ),
611
+    'amplify' => array(SHIP_SPY => 7,),
612 612
   ),
613 613
   UNIT_DEF_TURRET_LASER_SMALL => array(
614 614
     'name' => 'small_laser',
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
     'shield' => 25,
627 627
     'armor' => 200,
628 628
     'attack' => 100,
629
-    'amplify' => array(SHIP_SPY => 5, ),
629
+    'amplify' => array(SHIP_SPY => 5,),
630 630
   ),
631 631
   UNIT_DEF_TURRET_LASER_BIG => array(
632 632
     'name' => 'big_laser',
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
     'shield' => 100,
645 645
     'armor' => 800,
646 646
     'attack' => 250,
647
-    'amplify' => array(SHIP_SPY => 2, ),
647
+    'amplify' => array(SHIP_SPY => 2,),
648 648
   ),
649 649
   UNIT_DEF_TURRET_GAUSS => array(
650 650
     'name' => 'gauss_canyon',
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
     'armor' => 3500,
663 663
     'shield' => 200,
664 664
     'attack' => 1100,
665
-    'amplify' => array(SHIP_SPY => 0.5, ),
665
+    'amplify' => array(SHIP_SPY => 0.5,),
666 666
   ),
667 667
   UNIT_DEF_TURRET_ION => array(
668 668
     'name' => 'ionic_canyon',
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
     'shield' => 500,
681 681
     'armor' => 800,
682 682
     'attack' => 150,
683
-    'amplify' => array(SHIP_SPY => 3.3, ),
683
+    'amplify' => array(SHIP_SPY => 3.3,),
684 684
   ),
685 685
   UNIT_DEF_TURRET_PLASMA => array(
686 686
     'name' => 'buster_canyon',
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
     'shield' => 300,
699 699
     'armor' => 10000,
700 700
     'attack' => 3000,
701
-    'amplify' => array(SHIP_SPY => 0.17, ),
701
+    'amplify' => array(SHIP_SPY => 0.17,),
702 702
   ),
703 703
 
704 704
   UNIT_DEF_SHIELD_SMALL => array(
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
     'shield' => 2000,
719 719
     'armor' => 2000,
720 720
     'attack' => 1,
721
-    'amplify' => array(SHIP_SPY => 500, ),
721
+    'amplify' => array(SHIP_SPY => 500,),
722 722
   ),
723 723
   UNIT_DEF_SHIELD_BIG => array(
724 724
     'name' => 'big_protection_shield',
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
     'shield' => 2000,
738 738
     'armor' => 10000,
739 739
     'attack' => 1,
740
-    'amplify' => array(SHIP_SPY => 500, ),
740
+    'amplify' => array(SHIP_SPY => 500,),
741 741
   ),
742 742
   UNIT_DEF_SHIELD_PLANET => array(
743 743
     'name'      => 'planet_protector',
Please login to merge, or discard this patch.
includes/includes/market_trader.inc 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if((!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) && (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)) {
3
+if ((!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) && (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)) {
4 4
   classSupernova::$debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403);
5 5
 }
6 6
 
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
 
27 27
   // $dm_db_name = pname_resource_name(RES_DARK_MATTER);
28 28
   $exchangeTo = in_array($exchangeTo = sys_get_param_int('exchangeTo'), sn_get_groups('resources_trader')) ? $exchangeTo : 0;
29
-  if($exchangeTo && is_array($tradeList = $_POST['spend'])) {
29
+  if ($exchangeTo && is_array($tradeList = $_POST['spend'])) {
30 30
     $value = 0;
31 31
 
32 32
     sn_db_transaction_start();
33
-    if($planetrow['id_owner']) {
33
+    if ($planetrow['id_owner']) {
34 34
       $global_data = sys_o_get_updated($user, $planetrow, SN_TIME_NOW);
35 35
       $planetrow = $global_data['planet'];
36 36
     }
@@ -40,26 +40,26 @@  discard block
 block discarded – undo
40 40
     }
41 41
 
42 42
     $fields = array();
43
-    foreach(sn_get_groups('resources_trader') as $resource_id) {
43
+    foreach (sn_get_groups('resources_trader') as $resource_id) {
44 44
       $amount = floatval($tradeList[$resource_id]);
45
-      if($amount < 0) {
45
+      if ($amount < 0) {
46 46
         classSupernova::$debug->error('Trying to supply negative resource amount on Black Market Page', 'Hack Attempt', 305);
47 47
       }
48 48
 
49
-      if($resource_id == RES_DARK_MATTER && $exchangeTo == RES_DARK_MATTER) {
49
+      if ($resource_id == RES_DARK_MATTER && $exchangeTo == RES_DARK_MATTER) {
50 50
         continue;
51 51
       }
52 52
 
53 53
       $sign = '+';
54
-      if($exchangeTo == RES_DARK_MATTER) {
54
+      if ($exchangeTo == RES_DARK_MATTER) {
55 55
         $amount = floor($tradeList[RES_DARK_MATTER] / 3 * $rates[RES_DARK_MATTER] / $rates[$resource_id]);
56 56
         $value += $amount;
57 57
       } else {
58 58
         $value += floor($amount * $rates[$resource_id] / $rates[$exchangeTo]);
59
-        if($resource_id == RES_DARK_MATTER) {
59
+        if ($resource_id == RES_DARK_MATTER) {
60 60
           $amount = 0;
61 61
         } else {
62
-          if(mrc_get_level($user, $planetrow, $resource_id, true) < $amount) {
62
+          if (mrc_get_level($user, $planetrow, $resource_id, true) < $amount) {
63 63
             $intError = MARKET_NO_RESOURCES;
64 64
             break;
65 65
           }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         }
69 69
       }
70 70
 
71
-      if($amount) {
71
+      if ($amount) {
72 72
         $fields[pname_resource_name($resource_id)] = "{$sign} {$amount}";
73 73
       }
74 74
     }
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
     $intError = $value <= 0 ? MARKET_ZERO_DEAL : $intError;
79 79
     $intError = mrc_get_level($user, null, RES_DARK_MATTER) < $operation_cost ? MARKET_NO_DM : $intError;
80 80
 
81
-    if($intError == MARKET_DEAL) {
82
-      if($exchangeTo != RES_DARK_MATTER) {
81
+    if ($intError == MARKET_DEAL) {
82
+      if ($exchangeTo != RES_DARK_MATTER) {
83 83
         $amountExchangeTo = floor($value);
84 84
         $fields[pname_resource_name($exchangeTo)] = $amountExchangeTo;
85 85
       }
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
     'EXCHANGE_TO_RESOURCE_ID' => $exchangeTo,
116 116
   ));
117 117
 
118
-  foreach(sn_get_groups('resources_trader') as $resource_id) {
119
-    if($resource_id == RES_DARK_MATTER) {
118
+  foreach (sn_get_groups('resources_trader') as $resource_id) {
119
+    if ($resource_id == RES_DARK_MATTER) {
120 120
       $amount = floor(mrc_get_level($user, null, RES_DARK_MATTER) - classSupernova::$config->rpg_cost_trader);
121 121
     } else {
122 122
       $amount = floor(mrc_get_level($user, $planetrow, $resource_id));
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,8 +33,7 @@
 block discarded – undo
33 33
     if($planetrow['id_owner']) {
34 34
       $global_data = sys_o_get_updated($user, $planetrow, SN_TIME_NOW);
35 35
       $planetrow = $global_data['planet'];
36
-    }
37
-    else {
36
+    } else {
38 37
       // Locking user record
39 38
       $user = DBStaticUser::db_user_by_id($user['id'], true);
40 39
     }
Please login to merge, or discard this patch.
includes/db.php 2 patches
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,6 @@  discard block
 block discarded – undo
16 16
  * @param       $user
17 17
  * @param       $planet
18 18
  * @param array $unit_list
19
- * @param null  $query
20 19
  */
21 20
 function db_change_resources(&$user, &$planet, $unit_list) {
22 21
   $group = sn_get_groups('resources_loot');
@@ -56,6 +55,9 @@  discard block
 block discarded – undo
56 55
 
57 56
 }
58 57
 
58
+/**
59
+ * @param boolean $transaction_should_be_started
60
+ */
59 61
 function sn_db_transaction_check($transaction_should_be_started = null) {
60 62
   return classSupernova::$gc->db->getTransaction()->check($transaction_should_be_started);
61 63
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,22 +24,22 @@
 block discarded – undo
24 24
   $locationType = sys_get_unit_location($user, $planet, key($unit_list));
25 25
 
26 26
   $resourcesChange = array();
27
-  foreach($unit_list as $unit_id => $unit_amount) {
28
-    if(!in_array($unit_id, $group)) {
27
+  foreach ($unit_list as $unit_id => $unit_amount) {
28
+    if (!in_array($unit_id, $group)) {
29 29
       // TODO - remove later
30 30
       print('<h1>СООБЩИТЕ ЭТО АДМИНУ: db_change_resources() вызван для не-ресурсов!</h1>');
31 31
       pdump(debug_backtrace());
32 32
       die('db_change_resources() вызван для не-ресурсов!');
33 33
     }
34 34
 
35
-    if(empty($unit_amount)) {
35
+    if (empty($unit_amount)) {
36 36
       continue;
37 37
     }
38 38
 
39 39
     $resourcesChange[pname_resource_name($unit_id)] += $unit_amount;
40 40
   }
41 41
 
42
-  if($locationType == LOC_USER) {
42
+  if ($locationType == LOC_USER) {
43 43
     $locationId = $user['id'];
44 44
   } else {
45 45
     $locationId = $planet['id'];
Please login to merge, or discard this patch.
includes/pages/chat.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
   $user_auth_level = isset($user['authlevel']) ? $user['authlevel'] : AUTH_LEVEL_ANONYMOUS;
37 37
 
38 38
   $mode = sys_get_param_int('mode');
39
-  switch($mode) {
39
+  switch ($mode) {
40 40
     case CHAT_MODE_ALLY:
41 41
       $template_result['ALLY'] = intval($user['ally_id']);
42 42
       $page_title = classLocale::$lang['chat_ally'];
@@ -49,12 +49,12 @@  discard block
 block discarded – undo
49 49
   }
50 50
 
51 51
   $template_result['.']['smiles'] = array();
52
-  foreach(classSupernova::$design['smiles'] as $auth_level => $replaces) {
53
-    if($auth_level > $user_auth_level) {
52
+  foreach (classSupernova::$design['smiles'] as $auth_level => $replaces) {
53
+    if ($auth_level > $user_auth_level) {
54 54
       continue;
55 55
     }
56 56
 
57
-    foreach($replaces as $bbcode => $filename) {
57
+    foreach ($replaces as $bbcode => $filename) {
58 58
       $template_result['.']['smiles'][] = array(
59 59
         'BBCODE'   => $bbcode,
60 60
         'FILENAME' => $filename,
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
   define('IN_AJAX', true);
78 78
   $skip_fleet_update = true;
79 79
 
80
-  if(
80
+  if (
81 81
     classSupernova::$config->getMode() != CACHER_NO_CACHE
82 82
     &&
83 83
     classSupernova::$config->chat_timeout
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     die();
88 88
   }
89 89
 
90
-  if(($message = sys_get_param_str('message')) && $user['username']) {
90
+  if (($message = sys_get_param_str('message')) && $user['username']) {
91 91
     $ally_id = sys_get_param('ally') && $user['ally_id'] ? $user['ally_id'] : 0;
92 92
     $nickUnsafe = player_nick_compact(player_nick_render_current_to_array($user, array('color' => true, 'icons' => true, 'ally' => !$ally_id)));
93 93
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
   $skip_fleet_update = true;
110 110
 
111 111
   $history = sys_get_param_str('history');
112
-  if(!$history) {
112
+  if (!$history) {
113 113
     classSupernova::$config->array_set('users', $user['id'], 'chat_last_refresh', SN_TIME_MICRO);
114 114
   }
115 115
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
   $last_message = '';
118 118
   $alliance = 0;
119 119
   $template_result['.']['chat'] = array();
120
-  if(
120
+  if (
121 121
     !$history
122 122
     &&
123 123
     classSupernova::$config->getMode() != CACHER_NO_CACHE
@@ -138,11 +138,11 @@  discard block
 block discarded – undo
138 138
 
139 139
     $where_add = '';
140 140
     $last_message = 0;
141
-    if($history) {
141
+    if ($history) {
142 142
       $rows = DBStaticChat::db_chat_message_count_by_ally($alliance);
143 143
       $page_count = ceil($rows['CNT'] / $page_limit);
144 144
 
145
-      for($i = 0; $i < $page_count; $i++) {
145
+      for ($i = 0; $i < $page_count; $i++) {
146 146
         $template_result['.']['page'][] = array(
147 147
           'NUMBER' => $i
148 148
         );
@@ -156,12 +156,12 @@  discard block
 block discarded – undo
156 156
 
157 157
     $start_row = $page * $page_limit;
158 158
     $query = DBStaticChat::db_chat_message_get_page($alliance, $where_add, $start_row, $page_limit);
159
-    while($chat_row = db_fetch($query)) {
159
+    while ($chat_row = db_fetch($query)) {
160 160
       // Little magik here - to retain HTML codes from DB and stripping HTML codes from nick
161 161
       $chat_row['user'] = player_nick_render_to_html($chat_row['user']);
162 162
       $nick_stripped = htmlentities(strip_tags($chat_row['user']), ENT_QUOTES, 'utf-8');
163 163
       $nick = str_replace(strip_tags($chat_row['user']), $nick_stripped, $chat_row['user']);
164
-      if(!$history) {
164
+      if (!$history) {
165 165
         $nick = "<span style=\"cursor: pointer;\" onclick=\"addSmiley('({$nick_stripped})');\">{$nick}</span>";
166 166
       }
167 167
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
   $template = gettemplate('chat_messages', $template);
187 187
   $template->assign_recursive($template_result);
188 188
 
189
-  if($history) {
189
+  if ($history) {
190 190
     display($template, "{$classLocale['chat_history']} - {$classLocale[$alliance ? 'chat_ally' : 'chat_common']}", true, '', false, true);
191 191
   } else {
192 192
     $result['last_message'] = $last_message;
Please login to merge, or discard this patch.