Completed
Push — work-fleets ( 21e5a3...e0f70d )
by SuperNova.WS
05:07
created
admin/admin_chat.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
 
15 15
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
16 16
 
17
-if($user['authlevel'] < 3) {
17
+if ($user['authlevel'] < 3) {
18 18
   AdminMessage(classLocale::$lang['adm_err_denied']);
19 19
 }
20 20
 
21
-if($delete = sys_get_param_str('delete')) {
21
+if ($delete = sys_get_param_str('delete')) {
22 22
   db_chat_message_delete($delete);
23
-} elseif(sys_get_param_str('deleteall') == 'yes') {
23
+} elseif (sys_get_param_str('deleteall') == 'yes') {
24 24
   db_chat_message_purge();
25 25
 }
26 26
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 $query = db_chat_message_get_last_25();
30 30
 $i = 0;
31
-while($e = db_fetch($query)) {
31
+while ($e = db_fetch($query)) {
32 32
   $i++;
33 33
   $template->assign_block_vars('messages', array(
34 34
     'ID' => $e['messageid'],
Please login to merge, or discard this patch.
admin/banned.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
18 18
 
19
-if($user['authlevel'] < 1) {
19
+if ($user['authlevel'] < 1) {
20 20
   AdminMessage(classLocale::$lang['adm_err_denied']);
21 21
 }
22 22
 
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
 $template = gettemplate("admin/admin_ban", true);
29 29
 
30 30
 $player_banned_row = db_user_by_username($name_unsafe);
31
-if($mode == 'banit' && $action) {
32
-  if($player_banned_row) {
31
+if ($mode == 'banit' && $action) {
32
+  if ($player_banned_row) {
33 33
     $reas = $_POST['why'];
34 34
     $days = $_POST['days'];
35 35
     $hour = $_POST['hour'];
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     $adm_bn_thpl = classLocale::$lang['adm_bn_thpl'];
50 50
     $DoneMessage = "{$adm_bn_thpl} {$name_output} {$adm_bn_isbn}";
51 51
 
52
-    if($is_vacation) {
52
+    if ($is_vacation) {
53 53
       $DoneMessage .= classLocale::$lang['adm_bn_vctn'];
54 54
     }
55 55
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
   }
60 60
 
61 61
   AdminMessage($DoneMessage, classLocale::$lang['adm_ban_title']);
62
-} elseif($mode == 'unbanit' && $action) {
62
+} elseif ($mode == 'unbanit' && $action) {
63 63
   sys_admin_player_ban_unset($user, $player_banned_row, ($reason = sys_get_param_str('why')) ? $reason : classLocale::$lang['sys_unbanned']);
64 64
 
65 65
   $DoneMessage = classLocale::$lang['adm_unbn_thpl'] . " " . $name_output . " " . classLocale::$lang['adm_unbn_isbn'];
Please login to merge, or discard this patch.
admin/planet_compensate.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2
-define('INSIDE'  , true);
3
-define('INSTALL' , false);
2
+define('INSIDE', true);
3
+define('INSTALL', false);
4 4
 define('IN_ADMIN', true);
5 5
 
6 6
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
7 7
 
8
-if($user['authlevel'] < 3)
8
+if ($user['authlevel'] < 3)
9 9
 {
10 10
   AdminMessage(classLocale::$lang['adm_err_denied']);
11 11
 }
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 $username_unsafe = sys_get_param_str_unsafe('username');
26 26
 $username = sys_get_param_escaped('username');
27 27
 
28
-if($galaxy_src)
28
+if ($galaxy_src)
29 29
 {
30 30
   sn_db_transaction_start();
31 31
   $errors = array();
@@ -35,41 +35,41 @@  discard block
 block discarded – undo
35 35
   $planet = sys_o_get_updated($owner, array('galaxy' => $galaxy_src, 'system' => $system_src, 'planet' => $planet_src, 'planet_type' => 1), SN_TIME_NOW);
36 36
   $que    = $planet['que'];
37 37
   $planet = $planet['planet'];
38
-  if(!$planet)
38
+  if (!$planet)
39 39
   {
40 40
     $errors[] = classLocale::$lang['adm_pl_comp_err_0'];
41 41
   }
42 42
 
43
-  if($planet['destruyed'])
43
+  if ($planet['destruyed'])
44 44
   {
45 45
     $errors[] = classLocale::$lang['adm_pl_comp_err_1'];
46 46
   }
47 47
 
48
-  if($planet['id_owner'] != $owner['id'] || !$username)
48
+  if ($planet['id_owner'] != $owner['id'] || !$username)
49 49
   {
50 50
     $errors[] = classLocale::$lang['adm_pl_comp_err_4'];
51 51
   }
52 52
 
53 53
   $destination = sys_o_get_updated($owner, array('galaxy' => $galaxy_dst, 'system' => $system_dst, 'planet' => $planet_dst, 'planet_type' => 1), SN_TIME_NOW);
54 54
   $destination = $destination['planet'];
55
-  if(!$destination)
55
+  if (!$destination)
56 56
   {
57 57
     $errors[] = classLocale::$lang['adm_pl_comp_err_2'];
58 58
   }
59 59
 
60
-  if($planet['id'] == $destination['id'])
60
+  if ($planet['id'] == $destination['id'])
61 61
   {
62 62
     $errors[] = classLocale::$lang['adm_pl_comp_err_5'];
63 63
   }
64 64
 
65
-  if($planet['id_owner'] != $destination['id_owner'])
65
+  if ($planet['id_owner'] != $destination['id_owner'])
66 66
   {
67 67
     $errors[] = classLocale::$lang['adm_pl_comp_err_3'];
68 68
   }
69 69
 
70
-  if(!empty($errors))
70
+  if (!empty($errors))
71 71
   {
72
-    foreach($errors as $error)
72
+    foreach ($errors as $error)
73 73
     {
74 74
       $template->assign_block_vars('error', array(
75 75
         'TEXT' => $error,
@@ -83,14 +83,14 @@  discard block
 block discarded – undo
83 83
     killer_add_planet($planet);
84 84
 
85 85
     $moon = db_planet_by_gspt($galaxy_src, $system_src, $planet_src, PT_MOON, true);
86
-    if($moon)
86
+    if ($moon)
87 87
     {
88 88
       $moon = sys_o_get_updated($owner, $moon, SN_TIME_NOW);
89 89
       $moon = $moon['planet'];
90 90
       killer_add_planet($moon);
91 91
     }
92 92
 
93
-    foreach(sn_get_groups('resources_loot') as $resource_id)
93
+    foreach (sn_get_groups('resources_loot') as $resource_id)
94 94
     {
95 95
       $resource_name = pname_resource_name($resource_id);
96 96
       $template->assign_var("{$resource_name}_cost", $final_cost[$resource_id]);
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
       $template->assign_var("{$resource_name}_bonus", $final_cost[$resource_id]);
99 99
     }
100 100
 
101
-    if($_GET['btn_confirm'])
101
+    if ($_GET['btn_confirm'])
102 102
     {
103 103
       $time = SN_TIME_NOW + PERIOD_DAY;
104 104
 
105 105
       db_unit_list_delete($planet['id_owner'], LOC_PLANET, $planet['id']);
106 106
       db_planet_set_by_id($planet['id'], "id_owner = 0, destruyed = {$time}");
107
-      if($moon)
107
+      if ($moon)
108 108
       {
109 109
         db_unit_list_delete($planet['id_owner'], LOC_PLANET, $moon['id']);
110 110
         db_planet_set_by_id($moon['id'], "id_owner = 0, destruyed = {$time}");
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
   'username' => $username,
132 132
 ));
133 133
 
134
-display(parsetemplate($template), classLocale::$lang['adm_pl_comp_title'], false, '', true );
134
+display(parsetemplate($template), classLocale::$lang['adm_pl_comp_title'], false, '', true);
135 135
 
136 136
 function killer_add_planet($planet)
137 137
 {
@@ -146,34 +146,34 @@  discard block
 block discarded – undo
146 146
   }
147 147
   */
148 148
 
149
-  foreach(sn_get_groups('structures') as $unit_id)
149
+  foreach (sn_get_groups('structures') as $unit_id)
150 150
   {
151 151
     $build_level = mrc_get_level($user, $planet, $unit_id, true, true);
152
-    if($build_level > 0)
152
+    if ($build_level > 0)
153 153
     {
154 154
       $unit_cost = get_unit_param($unit_id, 'cost');
155 155
       $build_factor = $unit_cost['factor'] != 1 ? (1 - pow($unit_cost['factor'], $build_level)) / (1 - $unit_cost['factor']) : $unit_cost['factor'];
156
-      foreach($sn_group_resources_loot as $resource_id)
156
+      foreach ($sn_group_resources_loot as $resource_id)
157 157
       {
158 158
         $final_cost[$resource_id] += isset($unit_cost[$resource_id]) && $unit_cost[$resource_id] > 0 ? floor($unit_cost[$resource_id] * $build_factor) : 0;
159 159
       }
160 160
     }
161 161
   }
162 162
 
163
-  foreach(sn_get_groups(array('defense', 'fleet')) as $unit_id)
163
+  foreach (sn_get_groups(array('defense', 'fleet')) as $unit_id)
164 164
   {
165 165
     $unit_count = mrc_get_level($user, $planet, $unit_id, true, true);
166
-    if($unit_count > 0)
166
+    if ($unit_count > 0)
167 167
     {
168 168
       $unit_cost = get_unit_param($unit_id, 'cost');
169
-      foreach($sn_group_resources_loot as $resource_id)
169
+      foreach ($sn_group_resources_loot as $resource_id)
170 170
       {
171 171
         $final_cost[$resource_id] += isset($unit_cost[$resource_id]) && $unit_cost[$resource_id] > 0 ? floor($unit_cost[$resource_id] * $unit_count) : 0;
172 172
       }
173 173
     }
174 174
   }
175 175
 
176
-  foreach($sn_group_resources_loot as $resource_id)
176
+  foreach ($sn_group_resources_loot as $resource_id)
177 177
   {
178 178
     $final_cost[$resource_id] += floor(mrc_get_level($user, $planet, $resource_id, true, true));
179 179
   }
Please login to merge, or discard this patch.
includes/classes/db_mysql_v5.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
 
31 31
     static $need_keys = array('server', 'user', 'pass', 'name', 'prefix');
32 32
 
33
-    if($this->connected) {
33
+    if ($this->connected) {
34 34
       return true;
35 35
     }
36 36
 
37
-    if(empty($settings) || !is_array($settings) || array_intersect($need_keys, array_keys($settings)) != $need_keys) {
37
+    if (empty($settings) || !is_array($settings) || array_intersect($need_keys, array_keys($settings)) != $need_keys) {
38 38
       $debug->error_fatal('There is missconfiguration in your config.php. Check it again');
39 39
     }
40 40
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     return mysqli_fetch_assoc($query);
85 85
   }
86 86
   function mysql_fetch_row(&$query) {
87
-if(is_bool($query)) {
87
+if (is_bool($query)) {
88 88
   pdump(debug_backtrace());
89 89
   pdie();
90 90
 }
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     return mysqli_real_escape_string($this->link, $unescaped_string);
95 95
   }
96 96
   function mysql_close_link() {
97
-    if(is_object($this->link)) {
97
+    if (is_object($this->link)) {
98 98
       $this->link->close();
99 99
       $this->connected = false;
100 100
       unset($this->link);
Please login to merge, or discard this patch.
includes/classes/functions_template.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
 
139 139
     preg_match_all('#<!-- INCLUDE (\{\$?[A-Z0-9\-_]+\}|[a-zA-Z0-9\_\-\+\./]+) -->#', $code, $matches);
140 140
     $include_blocks = $matches[1];
141
-    if($include_blocks)
141
+    if ($include_blocks)
142 142
     {
143
-      foreach($include_blocks as &$included_file)
143
+      foreach ($include_blocks as &$included_file)
144 144
       {
145 145
         $included_file .= '.tpl.html';
146 146
       }
@@ -446,8 +446,8 @@  discard block
 block discarded – undo
446 446
 
447 447
     $tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){';
448 448
 //    $tag_template_php .= '$this->_block_counter["'. $tag_args . '"] = $_' . $tag_args . '_i;';
449
-    $tag_template_php .= '$_'. $tag_args . '_val = &' . $varref . '[$_'. $tag_args. '_i];';
450
-    $tag_template_php .= '$this->_block_value["'. $tag_args . '"] = &' . $varref . '[$_'. $tag_args. '_i];';
449
+    $tag_template_php .= '$_' . $tag_args . '_val = &' . $varref . '[$_' . $tag_args . '_i];';
450
+    $tag_template_php .= '$this->_block_value["' . $tag_args . '"] = &' . $varref . '[$_' . $tag_args . '_i];';
451 451
 
452 452
     return $tag_template_php;
453 453
   }
@@ -551,10 +551,10 @@  discard block
 block discarded – undo
551 551
         break;
552 552
 
553 553
         case 'is':
554
-          $is_arg_start = ($tokens[$i-1] == ')') ? array_pop($is_arg_stack) : $i-1;
554
+          $is_arg_start = ($tokens[$i - 1] == ')') ? array_pop($is_arg_stack) : $i - 1;
555 555
           $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start));
556 556
 
557
-          $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1));
557
+          $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i + 1));
558 558
 
559 559
           array_splice($tokens, $is_arg_start, sizeof($tokens), $new_tokens);
560 560
 
@@ -814,11 +814,11 @@  discard block
 block discarded – undo
814 814
     }
815 815
     else if ($include_last_iterator)
816 816
     {
817
-      return '$_'. $blocks[$blockcount] . '_val';
817
+      return '$_' . $blocks[$blockcount] . '_val';
818 818
     }
819 819
     else
820 820
     {
821
-      return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']';
821
+      return '$_' . $blocks[$blockcount - 1] . '_val[\'' . $blocks[$blockcount] . '\']';
822 822
     }
823 823
   }
824 824
 
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
     if ($fp = @fopen($filename, 'wb'))
836 836
     {
837 837
       @flock($fp, LOCK_EX);
838
-      @fwrite ($fp, $data);
838
+      @fwrite($fp, $data);
839 839
       @flock($fp, LOCK_UN);
840 840
       @fclose($fp);
841 841
 
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
   */
853 853
   private function minify($html)
854 854
   {
855
-    if(!classSupernova::$config->tpl_minifier)
855
+    if (!classSupernova::$config->tpl_minifier)
856 856
     {
857 857
       return $html;
858 858
     }
@@ -862,14 +862,14 @@  discard block
 block discarded – undo
862 862
     $html = preg_replace('/(<script[^>]*?>.*?<\/script>)/si', '#pre#', $html);
863 863
     $html = preg_replace('/>[\s]*</', '><', $html); // Strip spacechars between tags
864 864
     $html = preg_replace('/[\s]+/', ' ', $html); // Replace several spacechars with one space
865
-    if(!empty($pre[0]))
865
+    if (!empty($pre[0]))
866 866
     {
867
-      foreach($pre[0] as $tag)
867
+      foreach ($pre[0] as $tag)
868 868
       {
869 869
         $tag = preg_replace('/^\ *\/\/[^\<]*?$/m', ' ', $tag); // Strips comments - except those that contains HTML comment inside
870 870
         $tag = preg_replace('/[\ \t]{2,}/', ' ', $tag); // Replace several spaces by one
871 871
         $tag = preg_replace('/\s{2,}/', "\r\n", $tag); // Replace several linefeeds by one
872
-        $html = preg_replace('/#pre#/', $tag, $html,1);
872
+        $html = preg_replace('/#pre#/', $tag, $html, 1);
873 873
       }
874 874
     }
875 875
 
Please login to merge, or discard this patch.
includes/includes/flt_page4.inc 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -2,28 +2,28 @@  discard block
 block discarded – undo
2 2
 
3 3
 $classLocale = classLocale::$lang;
4 4
 
5
-if(SN_IN_FLEET !== true) {
5
+if (SN_IN_FLEET !== true) {
6 6
   $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403);
7 7
 }
8 8
 
9 9
 $fleetid = sys_get_param_id('fleetid');
10 10
 
11
-if(!is_numeric($fleetid) || empty($fleetid)) {
11
+if (!is_numeric($fleetid) || empty($fleetid)) {
12 12
   header("Location: fleet.php");
13 13
   exit();
14 14
 }
15 15
 
16 16
 $objFleet = new Fleet();
17 17
 $objFleet->dbLoad($fleetid);
18
-if(!$objFleet->dbId) {
18
+if (!$objFleet->dbId) {
19 19
   message(classLocale::$lang['fl_fleet_not_exists'], classLocale::$lang['fl_error']);
20 20
 }
21 21
 
22
-if($objFleet->time_arrive_to_target <= SN_TIME_NOW || $objFleet->time_return_to_source < SN_TIME_NOW || $objFleet->isReturning()) {
22
+if ($objFleet->time_arrive_to_target <= SN_TIME_NOW || $objFleet->time_return_to_source < SN_TIME_NOW || $objFleet->isReturning()) {
23 23
   message(classLocale::$lang['fl_isback'], classLocale::$lang['fl_error']);
24 24
 }
25 25
 
26
-if($objFleet->playerOwnerId != $user['id']) {
26
+if ($objFleet->playerOwnerId != $user['id']) {
27 27
   $debug->warning(classLocale::$lang['fl_aks_hack_wrong_fleet'], 'Wrong Fleet Owner', 301);
28 28
   message(classLocale::$lang['fl_aks_hack_wrong_fleet'], classLocale::$lang['fl_error']);
29 29
 }
@@ -34,19 +34,19 @@  discard block
 block discarded – undo
34 34
 
35 35
 !$aks && !$userToAdd_unsafe ? $userToAdd_unsafe = $user['username'] : false;
36 36
 
37
-if($userToAdd_unsafe) {
37
+if ($userToAdd_unsafe) {
38 38
   $userToAdd = db_escape($userToAdd_unsafe);
39 39
   $userToAddID = db_user_by_username($userToAdd_unsafe, false, 'id', true, true);
40 40
   $userToAddID = $userToAddID['id'];
41 41
 
42
-  if($objFleet->target_owner_id == $userToAddID) {
42
+  if ($objFleet->target_owner_id == $userToAddID) {
43 43
     message(classLocale::$lang['flt_aks_player_same'], classLocale::$lang['fl_error']);
44 44
   }
45 45
 
46
-  if($userToAddID) {
47
-    if(!$aks) {
46
+  if ($userToAddID) {
47
+    if (!$aks) {
48 48
       // No AСS exists - making one
49
-      if(!$objFleet->group_id) {
49
+      if (!$objFleet->group_id) {
50 50
         db_acs_insert($fleetid, $user, $objFleet);
51 51
 
52 52
         $aks = db_acs_get_by_fleet($fleetid);
@@ -61,17 +61,17 @@  discard block
 block discarded – undo
61 61
 
62 62
     $isUserExists = false;
63 63
     $invited_ar = explode(",", $aks['eingeladen']);
64
-    foreach($invited_ar as $inv) {
65
-      if($userToAddID == $inv) {
64
+    foreach ($invited_ar as $inv) {
65
+      if ($userToAddID == $inv) {
66 66
         $isUserExists = true;
67 67
       }
68 68
     }
69 69
 
70
-    if(count($invited_ar) >= 5) {
70
+    if (count($invited_ar) >= 5) {
71 71
       message(classLocale::$lang['flt_aks_error_too_much_players'], classLocale::$lang['fl_error']);
72 72
     }
73 73
 
74
-    if($isUserExists) {
74
+    if ($isUserExists) {
75 75
       $userToAdd_unsafe != $user['username'] ? $add_user_message_mr = sprintf(classLocale::$lang['fl_aks_player_invited_already'], $userToAdd) : false;
76 76
     } else {
77 77
       $add_user_message_mr = sprintf(classLocale::$lang['fl_aks_player_invited'], $userToAdd);
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
   'MISSION_NAME' => classLocale::$lang['type_mission'][MT_AKS],
94 94
 ));
95 95
 
96
-if($aks['eingeladen'] && is_array($members = classSupernova::db_get_record_list(LOC_USER, "`id` in ({$aks['eingeladen']})")) && !empty($members)) {
97
-  foreach($members as $row) {
96
+if ($aks['eingeladen'] && is_array($members = classSupernova::db_get_record_list(LOC_USER, "`id` in ({$aks['eingeladen']})")) && !empty($members)) {
97
+  foreach ($members as $row) {
98 98
     $template->assign_block_vars('invited', array(
99 99
       'NAME' => $row['username'],
100 100
     ));
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 $fleet_data = tplParseFleetObject($objFleet, $i, $user);
120 120
 
121 121
 $template->assign_block_vars('fleets', $fleet_data['fleet']);
122
-foreach($fleet_data['ships'] as $ship_data) {
122
+foreach ($fleet_data['ships'] as $ship_data) {
123 123
   $template->assign_block_vars('fleets.ships', $ship_data);
124 124
 }
125 125
 
Please login to merge, or discard this patch.