Completed
Push — trunk ( 8c8cf8...dc0cf2 )
by SuperNova.WS
04:27
created
includes/includes/flt_page2.inc 1 patch
Spacing   +10 added lines, -11 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     'START_NAME'         => $planetrow['name'],
28 28
   );
29 29
 
30
-  if(!empty($TargetPlanet)) {
30
+  if (!empty($TargetPlanet)) {
31 31
     $template_route += array(
32 32
       'END_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$TargetPlanet['planet_type']],
33 33
       'END_COORDS'       => uni_render_coordinates($TargetPlanet),
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
   $template->assign_block_vars('fleets', $template_route);
39 39
 
40 40
   $sn_groups_fleet = sn_get_groups('fleet');
41
-  foreach($fleetarray as $ship_id => $ship_count) {
42
-    if(in_array($ship_id, $sn_groups_fleet) && $ship_count) {
41
+  foreach ($fleetarray as $ship_id => $ship_count) {
42
+    if (in_array($ship_id, $sn_groups_fleet) && $ship_count) {
43 43
 //      $ship_base_data = get_ship_data($ship_id, $user);
44 44
       $template->assign_block_vars('fleets.ships', array(
45 45
         'ID'          => $ship_id,
@@ -57,11 +57,10 @@  discard block
 block discarded – undo
57 57
     $fleet_capacity += get_unit_param($Ship, P_CAPACITY) * $Count;
58 58
   }
59 59
 
60
-  $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) :
61
-    (isset($missiontype[MT_HOLD]) ? 12 : 0);
62
-  if($max_duration) {
60
+  $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) : (isset($missiontype[MT_HOLD]) ? 12 : 0);
61
+  if ($max_duration) {
63 62
     $config_game_speed_expedition = ($target_mission == MT_EXPLORE && $config->game_speed_expedition ? $config->game_speed_expedition : 1);
64
-    for($i = 1; $i <= $max_duration; $i++) {
63
+    for ($i = 1; $i <= $max_duration; $i++) {
65 64
       $template->assign_block_vars('duration', array(
66 65
         'ID' => $i,
67 66
         'TIME' => pretty_time(ceil($i * 3600 / $config_game_speed_expedition)),
@@ -80,7 +79,7 @@  discard block
 block discarded – undo
80 79
   // $TableTitle = uni_render_planet_full($planetrow) . '&nbsp;=&gt;&nbsp;' . uni_render_planet_full($temp);
81 80
 
82 81
   $sn_group_resources = sn_get_groups('resources');
83
-  for($i = 0; $i<3; $i++) {
82
+  for ($i = 0; $i < 3; $i++) {
84 83
     $amount = $planetrow[$sn_group_resources[$i]] - ($i == 2 ? $consumption : 0);
85 84
     $template->assign_block_vars('resources', array(
86 85
       'ID' => $i,
@@ -90,7 +89,7 @@  discard block
 block discarded – undo
90 89
     ));
91 90
   }
92 91
 
93
-  if(is_object($captainModule = moduleCaptain()) && ($captain = $captainModule->unit_captain_get($planetrow['id'])) && $captain['unit_location_type'] == LOC_PLANET) {
92
+  if (is_object($captainModule = moduleCaptain()) && ($captain = $captainModule->unit_captain_get($planetrow['id'])) && $captain['unit_location_type'] == LOC_PLANET) {
94 93
     $template->assign_vars(array(
95 94
       'CAPTAIN_ID' => $captain['unit_id'],
96 95
       'CAPTAIN_LEVEL' => $captain['captain_level'],
@@ -112,9 +111,9 @@  discard block
 block discarded – undo
112 111
 
113 112
 
114 113
     'speedallsmin' => sys_get_param_float('speedallsmin'),
115
-    'speed' => sys_get_param_int('speed') ,
114
+    'speed' => sys_get_param_int('speed'),
116 115
 
117
-    'fleet_group' => sys_get_param_id('fleet_group') ,
116
+    'fleet_group' => sys_get_param_id('fleet_group'),
118 117
     'acs_target_mr' => sys_get_param_str('acs_target_mr'),
119 118
 
120 119
     'MAX_DURATION' => $max_duration,
Please login to merge, or discard this patch.
includes/functions/sys_user.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 function sys_user_vacation($user) {
10 10
   global $config;
11 11
 
12
-  if(sys_get_param_str('vacation') == 'leave') {
12
+  if (sys_get_param_str('vacation') == 'leave') {
13 13
     if ($user['vacation'] < SN_TIME_NOW) {
14 14
       $user['vacation'] = 0;
15 15
       $user['vacation_next'] = SN_TIME_NOW + $config->player_vacation_timeout;
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     }
18 18
   }
19 19
 
20
-  if($user['vacation']) {
20
+  if ($user['vacation']) {
21 21
     // sn_sys_logout(false, true);
22 22
     // core_auth::logout(false, true);
23 23
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
   \DBAL\DbQuery::build()->setTable('users')->setValues($field_set)->doInsert();
142 142
   $user_new = db_user_by_id(db_insert_id());
143 143
 
144
-  if(!($options['galaxy'] && $options['system'] && $options['planet'])) {
144
+  if (!($options['galaxy'] && $options['system'] && $options['planet'])) {
145 145
     $options['galaxy'] = $config->LastSettedGalaxyPos;
146 146
     $options['system'] = $config->LastSettedSystemPos;
147 147
     $segment_size = floor($config->game_maxPlanet / 3);
@@ -149,19 +149,19 @@  discard block
 block discarded – undo
149 149
     $segment++;
150 150
     $options['planet'] = mt_rand(1 + $segment * $segment_size, ($segment + 1) * $segment_size);
151 151
 
152
-    while(true) {
153
-      if($options['planet'] > $config->game_maxPlanet) {
152
+    while (true) {
153
+      if ($options['planet'] > $config->game_maxPlanet) {
154 154
         $options['planet'] = mt_rand(0, $segment_size - 1) + 1;
155 155
         $options['system']++;
156 156
       }
157
-      if($options['system'] > $config->game_maxSystem) {
157
+      if ($options['system'] > $config->game_maxSystem) {
158 158
         $options['system'] = 1;
159 159
         $options['galaxy']++;
160 160
       }
161 161
       $options['galaxy'] > $config->game_maxGalaxy ? $options['galaxy'] = 1 : false;
162 162
 
163 163
       $galaxy_row = DBStaticPlanet::db_planet_by_gspt($options['galaxy'], $options['system'], $options['planet'], PT_PLANET, true, 'id');
164
-      if(!$galaxy_row['id']) {
164
+      if (!$galaxy_row['id']) {
165 165
         $config->db_saveItem(array(
166 166
           'LastSettedGalaxyPos' => $options['galaxy'],
167 167
           'LastSettedSystemPos' => $options['system'],
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
   $username_safe = db_escape($username_unsafe);
185 185
   doquery("REPLACE INTO {{player_name_history}} SET `player_id` = {$user_new['id']}, `player_name` = '{$username_safe}'");
186 186
 
187
-  if(!empty($options['partner_id']) && ($referral_row = db_user_by_id($options['partner_id'], true))) {
187
+  if (!empty($options['partner_id']) && ($referral_row = db_user_by_id($options['partner_id'], true))) {
188 188
     doquery("INSERT INTO {{referrals}} SET `id` = {$user_new['id']}, `id_partner` = {$options['partner_id']}");
189 189
   }
190 190
 
Please login to merge, or discard this patch.
dark_matter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 include_once('common.' . substr(strrchr(__FILE__, '.'), 1));
4 4
 
5
-if(SN::$gc->modules->countModulesInGroup('payment') && !defined('SN_GOOGLE')) {
5
+if (SN::$gc->modules->countModulesInGroup('payment') && !defined('SN_GOOGLE')) {
6 6
   sys_redirect('metamatter.php');
7 7
 }
8 8
 
Please login to merge, or discard this patch.
classes/Planet/DBStaticPlanet.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,8 +68,7 @@
 block discarded – undo
68 68
     $galaxy = isset($vector[$prefix . 'galaxy']) ? intval($vector[$prefix . 'galaxy']) : 0;
69 69
     $system = isset($vector[$prefix . 'system']) ? intval($vector[$prefix . 'system']) : 0;
70 70
     $planet = isset($vector[$prefix . 'planet']) ? intval($vector[$prefix . 'planet']) : 0;
71
-    $planet_type = isset($vector[$prefix . 'planet_type']) ? intval($vector[$prefix . 'planet_type']) :
72
-      (isset($vector[$prefix . 'type']) ? intval($vector[$prefix . 'type']) : 0);
71
+    $planet_type = isset($vector[$prefix . 'planet_type']) ? intval($vector[$prefix . 'planet_type']) : (isset($vector[$prefix . 'type']) ? intval($vector[$prefix . 'type']) : 0);
73 72
     $planet_type = $planet_type == PT_DEBRIS ? PT_PLANET : $planet_type;
74 73
 
75 74
     return DBStaticPlanet::db_planet_by_gspt_safe($galaxy, $system, $planet, $planet_type, $for_update, $fields);
Please login to merge, or discard this patch.
classes/Universe/Universe.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@
 block discarded – undo
8 8
   const MOON_MIN_SIZE = 1100;
9 9
   const MOON_MAX_SIZE = 8999;
10 10
 
11
-  const MOON_DEBRIS_MIN = 1000000;    // Minimum amount of debris to span a moon
12
-  const MOON_CHANCE_MIN_PERCENT = 1;  // Minimum chance to span a moon
11
+  const MOON_DEBRIS_MIN = 1000000; // Minimum amount of debris to span a moon
12
+  const MOON_CHANCE_MIN_PERCENT = 1; // Minimum chance to span a moon
13 13
   const MOON_CHANCE_MAX_PERCENT = 30; // Maximum chance to span a moon
14 14
 
15 15
   /**
Please login to merge, or discard this patch.
classes/Fleet/FleetDispatcher.php 1 patch
Spacing   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -465,15 +465,11 @@
 block discarded – undo
465 465
   protected function flt_flyingFleetsSort($a, $b) {
466 466
     return
467 467
       // Сравниваем время флотов - кто раньше, тот и первый обрабатывается
468
-      $a['fleet_time'] > $b['fleet_time'] ? 1 : ($a['fleet_time'] < $b['fleet_time'] ? -1 :
469
-        // Если время - одинаковое, сравниваем события флотов
468
+      $a['fleet_time'] > $b['fleet_time'] ? 1 : ($a['fleet_time'] < $b['fleet_time'] ? -1 : // Если время - одинаковое, сравниваем события флотов
470 469
         // Если события - одинаковые, то флоты равны
471
-        ($a['fleet_event'] == $b['fleet_event'] ? 0 :
472
-          // Если события разные - первыми считаем прибывающие флоты
473
-          ($a['fleet_event'] == EVENT_FLT_ARRIVE ? 1 : ($b['fleet_event'] == EVENT_FLT_ARRIVE ? -1 :
474
-            // Если нет прибывающих флотов - дальше считаем флоты, которые закончили миссию
475
-            ($a['fleet_event'] == EVENT_FLT_ACOMPLISH ? 1 : ($b['fleet_event'] == EVENT_FLT_ACOMPLISH ? -1 :
476
-              // Если нет флотов, закончивших задание - остались возвращающиеся флоты, которые равны между собой
470
+        ($a['fleet_event'] == $b['fleet_event'] ? 0 : // Если события разные - первыми считаем прибывающие флоты
471
+          ($a['fleet_event'] == EVENT_FLT_ARRIVE ? 1 : ($b['fleet_event'] == EVENT_FLT_ARRIVE ? -1 : // Если нет прибывающих флотов - дальше считаем флоты, которые закончили миссию
472
+            ($a['fleet_event'] == EVENT_FLT_ACOMPLISH ? 1 : ($b['fleet_event'] == EVENT_FLT_ACOMPLISH ? -1 : // Если нет флотов, закончивших задание - остались возвращающиеся флоты, которые равны между собой
477 473
               // TODO: Добавить еще проверку по ID флота и/или времени запуска - что бы обсчитывать их в порядке запуска
478 474
               (
479 475
               0 // Вообще сюда доходить не должно - будет отсекаться на равенстве событий
Please login to merge, or discard this patch.
classes/DBAL/OldDbChangeSet.php 1 patch
Spacing   +1 added lines, -3 removed lines patch added patch discarded remove patch
@@ -142,9 +142,7 @@
 block discarded – undo
142 142
           // Простое условие - $field_id = $field_value
143 143
           if (is_string($field_id)) {
144 144
             $field_value =
145
-              $field_value === null ? 'NULL' :
146
-                (is_string($field_value) ? "'" . db_escape($field_value) . "'" :
147
-                  (is_bool($field_value) ? intval($field_value) : $field_value));
145
+              $field_value === null ? 'NULL' : (is_string($field_value) ? "'" . db_escape($field_value) . "'" : (is_bool($field_value) ? intval($field_value) : $field_value));
148 146
             $the_conditions[] = "`{$field_id}` = {$field_value}";
149 147
           } else {
150 148
             die('Неподдерживаемый тип условия');
Please login to merge, or discard this patch.
includes/alliance/ali_internal_admin_request.inc 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 use Alliance\DBStaticAlly;
4 4
 
5
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
5
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
6 6
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
7 7
 }
8 8
 
@@ -11,12 +11,12 @@  discard block
 block discarded – undo
11 11
 }
12 12
 
13 13
 $d = sys_get_param_id('d');
14
-if($d) {
14
+if ($d) {
15 15
   doquery("UPDATE {{alliance_requests}} SET `request_denied` = 1, `request_text` = '{$lang['ali_req_deny_reason']}' WHERE `id_user`= {$d} LIMIT 1;");
16 16
 }
17 17
 
18 18
 $id_user = sys_get_param_id('id_user');
19
-if($id_user) {
19
+if ($id_user) {
20 20
   $ally_name_safe = db_escape($ally['ally_name']);
21 21
   $ally_tag_safe = db_escape($ally['ally_tag']);
22 22
   db_user_set_by_id($id_user, "`ally_id` = '{$ally['id']}', `ally_name` = '{$ally_name_safe}', `ally_tag` = '{$ally_tag_safe}', `ally_register_time` = " . SN_TIME_NOW . ", `ally_rank_id` = 0");
Please login to merge, or discard this patch.
includes/includes/flt_page1.inc 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -6,18 +6,18 @@  discard block
 block discarded – undo
6 6
 
7 7
 use Planet\DBStaticPlanet;
8 8
 
9
-if(SN_IN_FLEET !== true) {
9
+if (SN_IN_FLEET !== true) {
10 10
   $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403);
11 11
 }
12 12
 
13 13
 $template = gettemplate('fleet1', true);
14 14
 
15 15
 $ships = sys_get_param('ships', array());
16
-if(!is_array($ships)) {
16
+if (!is_array($ships)) {
17 17
   $ships = array();
18 18
 }
19 19
 
20
-foreach(array(PT_PLANET, PT_DEBRIS, PT_MOON) as $possible_planet_type_id) {
20
+foreach (array(PT_PLANET, PT_DEBRIS, PT_MOON) as $possible_planet_type_id) {
21 21
   $template->assign_block_vars('possible_planet_type_id', array(
22 22
     'ID' => $possible_planet_type_id,
23 23
     'NAME' => $lang['sys_planet_type_sh'][$possible_planet_type_id],
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
   'START_NAME'         => $planetrow['name'],
31 31
 );
32 32
 
33
-if(!empty($TargetPlanet)) {
33
+if (!empty($TargetPlanet)) {
34 34
   $template_route += array(
35 35
     'END_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$TargetPlanet['planet_type']],
36 36
     'END_COORDS'       => uni_render_coordinates($TargetPlanet),
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
 $template->assign_block_vars('fleets', $template_route);
42 42
 
43 43
 $sn_groups_fleet = sn_get_groups('fleet');
44
-foreach($ships as $ship_id => $ship_count) {
45
-  if(in_array($ship_id, $sn_groups_fleet) && $ship_count) {
44
+foreach ($ships as $ship_id => $ship_count) {
45
+  if (in_array($ship_id, $sn_groups_fleet) && $ship_count) {
46 46
     $ship_info = get_unit_param($ship_id);
47
-    if($ship_count > mrc_get_level($user, $planetrow, $ship_id, false, true)) {
47
+    if ($ship_count > mrc_get_level($user, $planetrow, $ship_id, false, true)) {
48 48
       $page .= $lang['fl_noenought'];
49 49
     } else {
50 50
       $fleet['fleetarray'][$ship_id]  = $ship_count;
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
   }
64 64
 }
65 65
 
66
-if(empty($fleet['fleetarray'])) {
66
+if (empty($fleet['fleetarray'])) {
67 67
   messageBox($lang['fl_err_no_ships'], $lang['fl_error'], 'fleet' . DOT_PHP_EX, 5);
68 68
 }
69 69
 
70 70
 // Building list of shortcuts
71 71
 $query = doquery("SELECT * FROM {{notes}} WHERE `owner` = {$user['id']} AND `galaxy` <> 0 AND `system` <> 0 AND `planet` <> 0 ORDER BY `priority` DESC, `galaxy`, `system`, `planet`, `planet_type`;");
72
-while($shortcut = db_fetch($query)) {
72
+while ($shortcut = db_fetch($query)) {
73 73
   $template->assign_block_vars('shortcut', array(
74 74
     'NAME'       => $shortcut['title'],
75 75
     'GALAXY'     => $shortcut['galaxy'],
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
 }
84 84
 
85 85
 // Building list of own planets & moons
86
-$colonies = DBStaticPlanet::db_planet_list_sorted ( $user );
87
-if(count($colonies) > 1) {
86
+$colonies = DBStaticPlanet::db_planet_list_sorted($user);
87
+if (count($colonies) > 1) {
88 88
   // while($row = db_fetch($colonies))
89
-  foreach($colonies as $row) {
89
+  foreach ($colonies as $row) {
90 90
     $template->assign_block_vars('colonies', array(
91 91
       'NAME'       => $row['name'],
92 92
       'GALAXY'     => $row['galaxy'],
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 //ACS Start
102 102
 //Need to look for acs attacks.
103 103
 $aks_madnessred = doquery('SELECT * FROM {{aks}};');
104
-while($row = db_fetch($aks_madnessred)) {
104
+while ($row = db_fetch($aks_madnessred)) {
105 105
   $members = explode(',', $row['eingeladen']);
106
-  foreach($members as $a => $b) {
106
+  foreach ($members as $a => $b) {
107 107
     if ($b == $user['id']) {
108 108
       $template->assign_block_vars('acss', array(
109 109
         'ID'         => $row['id'],
Please login to merge, or discard this patch.