Completed
Push — work-fleets ( 74a0d7...680ce4 )
by SuperNova.WS
05:04
created
includes/alliance/ali_internal_admin_mail.inc 1 patch
Spacing   +3 added lines, -3 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_ALLY') || SN_IN_ALLY !== true)
3
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
4 4
 {
5 5
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
6 6
 }
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
 
18 18
 $lang['r_list'] = "<option value=\"-1\">{$lang['All_players']}</option>";
19 19
 if ($ranks) {
20
-  foreach($ranks as $id => $array) {
21
-    $lang['r_list'] .= "<option value=\"" . $id  . "\">" . $array['name'] . "</option>";
20
+  foreach ($ranks as $id => $array) {
21
+    $lang['r_list'] .= "<option value=\"" . $id . "\">" . $array['name'] . "</option>";
22 22
   }
23 23
 }
24 24
 
Please login to merge, or discard this patch.
includes/alliance/ali_internal_admin_rights.inc 1 patch
Spacing   +8 added lines, -8 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_ALLY') || SN_IN_ALLY !== true)
3
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
4 4
 {
5 5
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
6 6
 }
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 $new_rank_name = sys_get_param_str('newRankName');
15 15
 if ($new_rank_name)
16 16
 {
17
-  foreach($ally_rights as $fieldName)
17
+  foreach ($ally_rights as $fieldName)
18 18
   {
19 19
     $newRank[$fieldName] = 0;
20 20
   }
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 {
29 29
   unset($ranks);
30 30
 
31
-  foreach($rankListInput as $rankID => $rank)
31
+  foreach ($rankListInput as $rankID => $rank)
32 32
   {
33
-    foreach($ally_rights as $rightName)
33
+    foreach ($ally_rights as $rightName)
34 34
     {
35 35
       $ranks[$rankID][$rightName] = $rank[$rightName] ? 1 : 0;
36 36
     }
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 $d = sys_get_param_int('d');
42 42
 if ($d && isset($ranks[$d]))
43 43
 {
44
-  if(count($ranks) == 1)
44
+  if (count($ranks) == 1)
45 45
   {
46 46
     message($lang['ali_adm_lastRank'], $lang['ali_adm_rights_title']);
47 47
   }
@@ -53,16 +53,16 @@  discard block
 block discarded – undo
53 53
 
54 54
 if (count($ranks))
55 55
 {
56
-  foreach($ranks as $rankID => $rank)
56
+  foreach ($ranks as $rankID => $rank)
57 57
   {
58 58
     $rank_data = array(
59 59
       'ID'   => $rankID,
60 60
       'NAME' => $rank['name'],
61 61
     );
62 62
 
63
-    for($i = 1; $i < count($rank); $i++)
63
+    for ($i = 1; $i < count($rank); $i++)
64 64
     {
65
-      $rank_data['R' . $i] = (($rank[$ally_rights[$i]] == 1) ? ' checked' : '') ;
65
+      $rank_data['R' . $i] = (($rank[$ally_rights[$i]] == 1) ? ' checked' : '');
66 66
       $rank_data['N' . $i] = $ally_rights[$i];
67 67
     }
68 68
 
Please login to merge, or discard this patch.
includes/alliance/ali_internal_members.inc 2 patches
Braces   +18 added lines, -27 removed lines patch added patch discarded remove patch
@@ -34,15 +34,16 @@  discard block
 block discarded – undo
34 34
 {
35 35
   $sort2s = "DESC";
36 36
   $sort2 = 0;
37
-}
38
-else
37
+} else
39 38
 {
40 39
   $sort2s = "ASC";
41 40
   $sort2 = 1;
42 41
 }
43 42
 
44 43
 $sort1 = sys_get_param_int('sort1');
45
-if($sort1>5 || $sort1<0) $sort1 = 0;
44
+if($sort1>5 || $sort1<0) {
45
+  $sort1 = 0;
46
+}
46 47
 $sort1s = array(
47 48
   0 => '`ally_rank_id` %1$s;',
48 49
   1 => '`username` %1$s;',
@@ -69,8 +70,7 @@  discard block
 block discarded – undo
69 70
   if ($ally['ally_owner'] == $userRow['id'])
70 71
   {
71 72
     $ally_range = ($ally['ally_owner_range'])?$ally['ally_owner_range']:$lang['Founder'];
72
-  }
73
-  else
73
+  } else
74 74
   {
75 75
     if($user_admin)
76 76
     {
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
 
79 79
       foreach($ranks as $rankID => $rankArray){
80 80
         $ally_range .= '<option value="' . $rankID . '"';
81
-        if($rankID == $userRow['ally_rank_id'])
82
-          $ally_range .= " selected";
81
+        if($rankID == $userRow['ally_rank_id']) {
82
+                  $ally_range .= " selected";
83
+        }
83 84
         $ally_range .= '>' . $rankArray['name'];
84 85
         $ally_range .= '</option>';
85 86
       }
86 87
       $ally_range .= '</select>';
87
-    }
88
-    else
88
+    } else
89 89
     {
90 90
       $ally_range = $ranks[$userRow['ally_rank_id']]['name'];
91 91
     }
@@ -97,53 +97,44 @@  discard block
 block discarded – undo
97 97
     if ( $last_active < 60 )
98 98
     {
99 99
       $tmp = "lime>{$lang['On']}";
100
-    }
101
-    elseif ($last_active < 60 * 60)
100
+    } elseif ($last_active < 60 * 60)
102 101
     {
103 102
       $last_active = round($last_active / 60);
104 103
       $tmp = "lime>{$last_active} {$lang['sys_min_short']}";
105
-    }
106
-    elseif ($last_active < 60 * 60 * 24)
104
+    } elseif ($last_active < 60 * 60 * 24)
107 105
     {
108 106
       $last_active = round( $last_active / (60 * 60));
109 107
       $tmp = "green>{$last_active} {$lang['sys_hrs_short']}";
110
-    }
111
-    else
108
+    } else
112 109
     {
113 110
       $last_active = round( $last_active / (60 * 60 * 24));
114 111
       if ($last_active < 7)
115 112
       {
116 113
         $tmp = "yellow";
117
-      }
118
-      elseif ($last_active < 30)
114
+      } elseif ($last_active < 30)
119 115
       {
120 116
         $tmp = "orange";
121
-      }
122
-      else
117
+      } else
123 118
       {
124 119
         $tmp = "red";
125 120
       }
126 121
       $tmp .= ">{$last_active} {$lang['sys_day_short']}";
127 122
     }
128
-  }
129
-  else
123
+  } else
130 124
   {
131 125
     if($user_onlinestatus)
132 126
     {
133 127
       if ( $last_active < 60 * 5 )
134 128
       {
135 129
         $tmp = "lime>{$lang['On']}";
136
-      }
137
-      elseif ($last_active < 60 * 15)
130
+      } elseif ($last_active < 60 * 15)
138 131
       {
139 132
         $tmp = "yellow>{$lang['ali_lessThen15min']}";
140
-      }
141
-      else
133
+      } else
142 134
       {
143 135
         $tmp = "red>{$lang['Off']}";
144 136
       }
145
-    }
146
-    else
137
+    } else
147 138
     {
148 139
       $sort1 = max($sort1, 4);
149 140
       $tmp = "orange>-";
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 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_ALLY') || SN_IN_ALLY !== true)
3
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
4 4
 {
5 5
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
6 6
 }
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
 */
11 11
 // Changing rank for single user
12 12
 $id_user = sys_get_param_id('id_user');
13
-if(isset($_GET['id_rank']))
13
+if (isset($_GET['id_rank']))
14 14
 {
15 15
   $id_rank = sys_get_param_int('id_rank');
16 16
 }
17
-if($id_user && isset($id_rank) && $user_admin){
17
+if ($id_user && isset($id_rank) && $user_admin) {
18 18
   db_user_set_by_id($id_user, "`ally_rank_id` = {$id_rank}");
19 19
 }
20 20
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 }
44 44
 
45 45
 $sort1 = sys_get_param_int('sort1');
46
-if($sort1>5 || $sort1<0) $sort1 = 0;
46
+if ($sort1 > 5 || $sort1 < 0) $sort1 = 0;
47 47
 $sort1s = array(
48 48
   0 => '`ally_rank_id` %1$s;',
49 49
   1 => '`username` %1$s;',
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
   'id, username, galaxy, system, planet, onlinetime, ally_rank_id, ally_register_time, total_points');
60 60
 
61 61
 // while ($userRow = db_fetch($userList))
62
-foreach($userList as $userRow)
62
+foreach ($userList as $userRow)
63 63
 {
64 64
   $i++;
65 65
   if (!isset($ranks[$userRow['ally_rank_id']]))
@@ -69,17 +69,17 @@  discard block
 block discarded – undo
69 69
 
70 70
   if ($ally['ally_owner'] == $userRow['id'])
71 71
   {
72
-    $ally_range = ($ally['ally_owner_range'])?$ally['ally_owner_range']:classLocale::$lang['Founder'];
72
+    $ally_range = ($ally['ally_owner_range']) ? $ally['ally_owner_range'] : classLocale::$lang['Founder'];
73 73
   }
74 74
   else
75 75
   {
76
-    if($user_admin)
76
+    if ($user_admin)
77 77
     {
78 78
       $ally_range = '<select onchange="window.location=\'alliance.php?mode=admin&edit=members&id_user=' . $userRow['id'] . '&id_rank=\' + this.value">';
79 79
 
80
-      foreach($ranks as $rankID => $rankArray){
80
+      foreach ($ranks as $rankID => $rankArray) {
81 81
         $ally_range .= '<option value="' . $rankID . '"';
82
-        if($rankID == $userRow['ally_rank_id'])
82
+        if ($rankID == $userRow['ally_rank_id'])
83 83
           $ally_range .= " selected";
84 84
         $ally_range .= '>' . $rankArray['name'];
85 85
         $ally_range .= '</option>';
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
   }
94 94
 
95 95
   $last_active = time() - $userRow["onlinetime"];
96
-  if($user_admin)
96
+  if ($user_admin)
97 97
   {
98
-    if ( $last_active < 60 )
98
+    if ($last_active < 60)
99 99
     {
100 100
       $tmp = "lime>{$lang['On']}";
101 101
     }
@@ -106,12 +106,12 @@  discard block
 block discarded – undo
106 106
     }
107 107
     elseif ($last_active < 60 * 60 * 24)
108 108
     {
109
-      $last_active = round( $last_active / (60 * 60));
109
+      $last_active = round($last_active / (60 * 60));
110 110
       $tmp = "green>{$last_active} {$lang['sys_hrs_short']}";
111 111
     }
112 112
     else
113 113
     {
114
-      $last_active = round( $last_active / (60 * 60 * 24));
114
+      $last_active = round($last_active / (60 * 60 * 24));
115 115
       if ($last_active < 7)
116 116
       {
117 117
         $tmp = "yellow";
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
   }
130 130
   else
131 131
   {
132
-    if($user_onlinestatus)
132
+    if ($user_onlinestatus)
133 133
     {
134
-      if ( $last_active < 60 * 5 )
134
+      if ($last_active < 60 * 5)
135 135
       {
136 136
         $tmp = "lime>{$lang['On']}";
137 137
       }
Please login to merge, or discard this patch.
includes/alliance/ali_external_request.inc 2 patches
Spacing   +4 added lines, -4 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_ALLY') || SN_IN_ALLY !== true)
3
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
4 4
 {
5 5
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
6 6
 }
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
     header('Location: alliance.php');
21 21
   }
22 22
 
23
-  if($user_request['request_denied'])
23
+  if ($user_request['request_denied'])
24 24
   {
25 25
     $lang['request_text'] = sprintf($lang['ali_req_deny_msg'], $ally['ally_tag'], $user_request['request_text']);
26 26
   }
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
 
43 43
 $ally = doquery("SELECT * FROM {{alliance}} WHERE `id` ='{$id_ally}'", true);
44 44
 
45
-if(!$ally)
45
+if (!$ally)
46 46
 {
47 47
   message($lang['ali_sys_notFound'], $lang['ali_req_title']);
48 48
 }
49 49
 
50
-if($ally['ally_request_notallow'])
50
+if ($ally['ally_request_notallow'])
51 51
 {
52 52
   message($lang['ali_req_not_allowed'], $lang['ali_req_title']);
53 53
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -115,8 +115,7 @@
 block discarded – undo
115 115
     ));
116 116
 
117 117
     display($template, $lang['tech'][STRUC_MOON_GATE]);
118
-  }
119
-  else
118
+  } else
120 119
   {
121 120
     message($lang['gate_no_src_ga'], $lang['tech'][STRUC_MOON_GATE], "overview.php", 10);
122 121
   }
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
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
3
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
4 4
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
5 5
 }
6 6
 
@@ -9,12 +9,12 @@  discard block
 block discarded – undo
9 9
 }
10 10
 
11 11
 $d = sys_get_param_id('d');
12
-if($d) {
12
+if ($d) {
13 13
   doquery("UPDATE {{alliance_requests}} SET `request_denied` = 1, `request_text` = '{$lang['ali_req_deny_reason']}' WHERE `id_user`= {$d} LIMIT 1;");
14 14
 }
15 15
 
16 16
 $id_user = sys_get_param_id('id_user');
17
-if($id_user) {
17
+if ($id_user) {
18 18
   $ally_name_safe = db_escape($ally['ally_name']);
19 19
   $ally_tag_safe = db_escape($ally['ally_tag']);
20 20
   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/uni_rename.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@  discard block
 block discarded – undo
3 3
   {
4 4
     $template = gettemplate('universe_rename', true);
5 5
 
6
-    if($uni_galaxy < 1 || $uni_galaxy > $config->game_maxGalaxy)
6
+    if ($uni_galaxy < 1 || $uni_galaxy > $config->game_maxGalaxy)
7 7
     {
8 8
       throw new exception($lang['uni_msg_error_wrong_galaxy'], ERR_ERROR);
9 9
     }
10 10
 
11
-    if($uni_system < 0 || $uni_system > $config->game_maxSystem)
11
+    if ($uni_system < 0 || $uni_system > $config->game_maxSystem)
12 12
     {
13 13
       throw new exception($lang['uni_msg_error_wrong_system'], ERR_ERROR);
14 14
     }
@@ -17,12 +17,12 @@  discard block
 block discarded – undo
17 17
     $uni_row['universe_price'] += $uni_system ? $config->uni_price_system : $config->uni_price_galaxy;
18 18
     $uni_row['universe_name'] = strip_tags($uni_row['universe_name'] ? $uni_row['universe_name'] : ($uni_system ? "{$lang['sys_system']} [{$uni_galaxy}:{$uni_system}]" : "{$lang['sys_galaxy']} {$uni_galaxy}"));
19 19
 
20
-    if(sys_get_param_str('uni_name_submit'))
20
+    if (sys_get_param_str('uni_name_submit'))
21 21
     {
22 22
       $uni_row['universe_name'] = strip_tags(sys_get_param_str('uni_name'));
23 23
 
24 24
       $uni_price = sys_get_param_float('uni_price');
25
-      if($uni_price < $uni_row['universe_price'])
25
+      if ($uni_price < $uni_row['universe_price'])
26 26
       {
27 27
         throw new exception($lang['uni_msg_error_low_price'], ERR_ERROR);
28 28
       }
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
       sn_db_transaction_start();
32 32
       $user = db_user_by_id($user['id'], true);
33 33
       // if($user[get_unit_param(RES_DARK_MATTER, P_NAME)] < $uni_price)
34
-      if(mrc_get_level($user, null, RES_DARK_MATTER) < $uni_price)
34
+      if (mrc_get_level($user, null, RES_DARK_MATTER) < $uni_price)
35 35
       {
36 36
         throw new exception($lang['uni_msg_error_no_dm'], ERR_ERROR);
37 37
       }
38 38
 
39
-      if(!rpg_points_change($user['id'], RPG_RENAME, -$uni_price, "Renaming [{$uni_galaxy}:{$uni_system}] to " . sys_get_param_str_unsafe('uni_name')))
39
+      if (!rpg_points_change($user['id'], RPG_RENAME, -$uni_price, "Renaming [{$uni_galaxy}:{$uni_system}] to " . sys_get_param_str_unsafe('uni_name')))
40 40
       {
41 41
         throw new exception($lang['sys_msg_err_update_dm'], ERR_ERROR);
42 42
       }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,8 +46,7 @@
 block discarded – undo
46 46
       sn_db_transaction_commit();
47 47
       sys_redirect("galaxy.php?mode=name&galaxy={$uni_galaxy}&system={$uni_system}");
48 48
     }
49
-  }
50
-  catch (exception $e)
49
+  } catch (exception $e)
51 50
   {
52 51
     sn_db_transaction_rollback();
53 52
     $template->assign_block_vars('result', array(
Please login to merge, or discard this patch.
includes/includes/market_fleeter.inc 1 patch
Spacing   +26 added lines, -26 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) {
3
+if (!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) {
4 4
   $debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403);
5 5
 }
6 6
 
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
   'rpg_cost' => $rpg_cost,
13 13
 ));
14 14
 
15
-if(is_array($shipList)) {
16
-  if(mrc_get_level($user, null, RES_DARK_MATTER) < $rpg_cost) {
15
+if (is_array($shipList)) {
16
+  if (mrc_get_level($user, null, RES_DARK_MATTER) < $rpg_cost) {
17 17
     $intError = MARKET_NO_DM;
18 18
   }
19 19
 
@@ -30,30 +30,30 @@  discard block
 block discarded – undo
30 30
   $qry = array();
31 31
   $total = array();
32 32
   $db_changeset = array();
33
-  foreach($shipList as $shipID => &$shipCount) {
33
+  foreach ($shipList as $shipID => &$shipCount) {
34 34
     $shipCount = ceil(floatval($shipCount));
35
-    if(!$shipCount) {
35
+    if (!$shipCount) {
36 36
       continue;
37 37
     }
38 38
 
39
-    if($shipCount < 0) {
39
+    if ($shipCount < 0) {
40 40
       $debug->warning('User supplied negative ship count on Black Market page', 'Hack Attempt', 307);
41 41
       $intError = MARKET_NEGATIVE_SHIPS;
42 42
       break;
43 43
     }
44 44
 
45
-    if($mode == MARKET_SCRAPPER) {
45
+    if ($mode == MARKET_SCRAPPER) {
46 46
       $amount = mrc_get_level($user, $planetrow, $shipID, true, true); // $planetrow[get_unit_param($shipID, P_NAME)];
47
-    } elseif($mode == MARKET_STOCKMAN) {
47
+    } elseif ($mode == MARKET_STOCKMAN) {
48 48
       $amount = $stock[$shipID];
49 49
     }
50 50
 
51
-    if($amount < $shipCount) {
51
+    if ($amount < $shipCount) {
52 52
       $intError = $error_no_stock;
53 53
       break;
54 54
     }
55 55
 
56
-    if(!in_array($shipID, sn_get_groups('fleet'))) {
56
+    if (!in_array($shipID, sn_get_groups('fleet'))) {
57 57
       $debug->warning('Hack Attempt', 'User supplied non-ship unit ID on Black Market page', 306);
58 58
       $intError = MARKET_NOT_A_SHIP;
59 59
       break;
@@ -69,16 +69,16 @@  discard block
 block discarded – undo
69 69
     $resTemp[RES_CRYSTAL] = floor($build_data[BUILD_CREATE][RES_CRYSTAL] * $shipCount * $config_rpg_scrape_crystal * (-$multiplier));
70 70
     $resTemp[RES_DEUTERIUM] = floor($build_data[BUILD_CREATE][RES_DEUTERIUM] * $shipCount * $config_rpg_scrape_deuterium * (-$multiplier));
71 71
 
72
-    foreach($resTemp as $resID => $resCount) {
72
+    foreach ($resTemp as $resID => $resCount) {
73 73
       $total[$resID] += $resCount;
74 74
     }
75 75
 
76 76
     $message .= "<li>{$lang['tech'][$shipID]}: " . pretty_number($shipCount);
77 77
   }
78 78
 
79
-  if($mode == MARKET_STOCKMAN && $intError == MARKET_DEAL) {
80
-    foreach($total as $resID => $resCount) {
81
-      if(mrc_get_level($user, $planetrow, $resID, true, true) < -$resCount) {
79
+  if ($mode == MARKET_STOCKMAN && $intError == MARKET_DEAL) {
80
+    foreach ($total as $resID => $resCount) {
81
+      if (mrc_get_level($user, $planetrow, $resID, true, true) < -$resCount) {
82 82
         $intError = MARKET_NO_RESOURCES;
83 83
         $debug->warning('Trying to use bug in s/h market', 'S/H Ship Market', 301);
84 84
         break;
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
 
89 89
   $intError = ($intError == MARKET_DEAL) && (array_sum($total) == 0) ? $error_zero_res : $intError;
90 90
 
91
-  if($intError == MARKET_DEAL) {
91
+  if ($intError == MARKET_DEAL) {
92 92
     $message .= '</ul>' . $lang["eco_mrk_{$submode}_res"] . '<ul>';
93
-    foreach($total as $resID => $resCount) {
94
-      if(!$resCount) {
93
+    foreach ($total as $resID => $resCount) {
94
+      if (!$resCount) {
95 95
         continue;
96 96
       }
97 97
 
@@ -125,38 +125,38 @@  discard block
 block discarded – undo
125 125
       'MESSAGE' => $lang['eco_mrk_errors'][$intError],
126 126
     ));
127 127
 
128
-    foreach($shipList as $shipID => $shipCount) {
128
+    foreach ($shipList as $shipID => $shipCount) {
129 129
       $data['ships'][$shipID] = max(0, intval($shipCount));
130 130
     }
131 131
   }
132 132
 }
133 133
 $message = '';
134 134
 
135
-if(!$config->eco_stockman_fleet && $config->eco_stockman_fleet_populate) {
136
-  $config->db_saveItem('eco_stockman_fleet', sys_unit_arr2str(array_map(function($item){return mt_rand(1, 1000);}, sn_get_groups('fleet'))));
135
+if (!$config->eco_stockman_fleet && $config->eco_stockman_fleet_populate) {
136
+  $config->db_saveItem('eco_stockman_fleet', sys_unit_arr2str(array_map(function($item) {return mt_rand(1, 1000); }, sn_get_groups('fleet'))));
137 137
 }
138 138
 
139 139
 tpl_set_resource_info($template, $planetrow, array());
140 140
 
141
-if(!$array) {
141
+if (!$array) {
142 142
   $array = array();
143 143
 }
144 144
 
145 145
 $group_fleet = sn_get_groups('fleet');
146
-foreach($array as $key => $value) {
147
-  if($mode == MARKET_SCRAPPER) {
146
+foreach ($array as $key => $value) {
147
+  if ($mode == MARKET_SCRAPPER) {
148 148
     $shipID = $value;
149 149
     $amount = mrc_get_level($user, $planetrow, $shipID, false, true); // $planetrow[get_unit_param($shipID, P_NAME)];
150
-  } elseif($mode == MARKET_STOCKMAN) {
150
+  } elseif ($mode == MARKET_STOCKMAN) {
151 151
     $shipID = $key;
152 152
     $amount = $value;
153 153
   }
154 154
 
155
-  if(!in_array($shipID, $group_fleet)) {
155
+  if (!in_array($shipID, $group_fleet)) {
156 156
     continue;
157 157
   }
158 158
 
159
-  if($amount > 0) {
159
+  if ($amount > 0) {
160 160
     $build_data = eco_get_build_data($user, $planetrow, $shipID);
161 161
     $template->assign_block_vars('ships', array(
162 162
       'ID'        => $shipID,
Please login to merge, or discard this patch.
includes/includes/art_artifact.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 {
5 5
   global $lang;
6 6
 
7
-  if(!in_array($unit_id, sn_get_groups('artifacts')))
7
+  if (!in_array($unit_id, sn_get_groups('artifacts')))
8 8
   {
9 9
     return;
10 10
   }
@@ -13,24 +13,24 @@  discard block
 block discarded – undo
13 13
   $user = db_user_by_id($user['id'], true);
14 14
 
15 15
   $unit_level = $artifact_level_old = mrc_get_level($user, array(), $unit_id, true);
16
-  if($unit_level > 0)
16
+  if ($unit_level > 0)
17 17
   {
18 18
     $db_changeset = array();
19
-    switch($unit_id)
19
+    switch ($unit_id)
20 20
     {
21 21
       case ART_LHC:
22 22
       case ART_HOOK_SMALL:
23 23
       case ART_HOOK_MEDIUM:
24 24
       case ART_HOOK_LARGE:
25 25
         $has_moon = db_planet_by_parent($planetrow['id'], true, '`id`');
26
-        if($planetrow['planet_type'] == PT_PLANET && !$has_moon['id'])
26
+        if ($planetrow['planet_type'] == PT_PLANET && !$has_moon['id'])
27 27
         {
28 28
           $unit_level--;
29 29
           $moon_chance = $unit_id == ART_LHC ? uni_calculate_moon_chance($planetrow['debris_metal'] + $planetrow['debris_crystal']) : (
30 30
             $unit_id == ART_HOOK_MEDIUM ? mt_rand(1100, 8999) : ($unit_id == ART_HOOK_SMALL ? 1100 : 8999)
31 31
           );
32 32
           $random = $unit_id == ART_LHC ? mt_rand(1, 100) : $moon_chance;
33
-          if($random <= $moon_chance)
33
+          if ($random <= $moon_chance)
34 34
           {
35 35
             $new_moon_row = uni_create_moon($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'], $user['id'], $moon_chance);
36 36
             $message = sprintf($lang['art_moon_create'][$unit_id], $new_moon_row['name'], uni_render_coordinates($planetrow), pretty_number($moon_chance));
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
       case ART_RCD_MEDIUM:
52 52
       case ART_RCD_LARGE:
53 53
         $planetrow = db_planet_by_id($planetrow['id'], true);
54
-        if($planetrow['planet_type'] != PT_PLANET)
54
+        if ($planetrow['planet_type'] != PT_PLANET)
55 55
         {
56 56
           $message = $lang['art_rcd_err_moon'];
57 57
           break;
58 58
         }
59 59
 
60 60
         $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, false);
61
-        if(!empty($que['items']))
61
+        if (!empty($que['items']))
62 62
         {
63 63
           $message = $lang['art_rcd_err_que'];
64 64
           break;
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
 
69 69
         // $deployment_str = '';
70 70
         $sectors_used = 0;
71
-        foreach($artifact_deploy as $deploy_unit_id => $deploy_unit_level)
71
+        foreach ($artifact_deploy as $deploy_unit_id => $deploy_unit_level)
72 72
         {
73
-          if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true))))
73
+          if (!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true))))
74 74
             continue;
75 75
           $sectors_used += $levels_deployed;
76 76
           $db_changeset['unit'][] = sn_db_unit_changeset_prepare($deploy_unit_id, $levels_deployed, $user, $planetrow['id']);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
           //$deployment_str .= ",`{$deploy_unit_name}` = GREATEST(`{$deploy_unit_name}`, {$deploy_unit_level})";
79 79
         }
80 80
 
81
-        if($sectors_used == 0)
81
+        if ($sectors_used == 0)
82 82
         {
83 83
           $message = $lang['art_rcd_err_no_sense'];
84 84
           break;
@@ -93,13 +93,13 @@  discard block
 block discarded – undo
93 93
         $que_item = null;
94 94
         $que = que_get($user['id'], $planetrow['id'], QUE_RESEARCH, true);
95 95
         $current_que = &$que['ques'][QUE_RESEARCH][$user['id']][0];
96
-        if(!empty($current_que))
96
+        if (!empty($current_que))
97 97
         {
98 98
           reset($current_que);
99 99
           $que_item = &$que['ques'][QUE_RESEARCH][$user['id']][0][key($current_que)];
100 100
         }
101 101
 
102
-        if(!empty($que_item) && $que_item['que_time_left'] > 60)
102
+        if (!empty($que_item) && $que_item['que_time_left'] > 60)
103 103
         {
104 104
           $unit_level--;
105 105
           $old_time = $que_item['que_time_left'];
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
         $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, true);
121 121
         $current_que = &$que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']];
122 122
         // $que_item = &$que['que'][QUE_STRUCTURES][0];
123
-        if(!empty($current_que))
123
+        if (!empty($current_que))
124 124
         {
125 125
           reset($current_que);
126 126
           $que_item = &$que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']][key($current_que)];
127 127
         }
128 128
 
129
-        if(isset($que_item) && $que_item['que_time_left'] > 60)
129
+        if (isset($que_item) && $que_item['que_time_left'] > 60)
130 130
         {
131 131
           $unit_level--;
132 132
           $old_time = $que_item['que_time_left'];
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
       break;
145 145
 
146 146
     }
147
-    if($unit_level != $artifact_level_old)
147
+    if ($unit_level != $artifact_level_old)
148 148
     {
149 149
       $db_changeset['unit'][] = sn_db_unit_changeset_prepare($unit_id, $unit_level - $artifact_level_old, $user);
150 150
       db_changeset_apply($db_changeset);
Please login to merge, or discard this patch.
Braces   +8 added lines, -12 removed lines patch added patch discarded remove patch
@@ -34,14 +34,12 @@  discard block
 block discarded – undo
34 34
           {
35 35
             $new_moon_row = uni_create_moon($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'], $user['id'], $moon_chance);
36 36
             $message = sprintf($lang['art_moon_create'][$unit_id], $new_moon_row['name'], uni_render_coordinates($planetrow), pretty_number($moon_chance));
37
-          }
38
-          else
37
+          } else
39 38
           {
40 39
             $message = $lang['art_lhc_moon_fail'];
41 40
           }
42 41
           msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_ADMIN, $lang['art_lhc_from'], $lang['art_lhc_subj'], $message);
43
-        }
44
-        else
42
+        } else
45 43
         {
46 44
           $message = $lang['art_moon_exists'];
47 45
         }
@@ -70,8 +68,9 @@  discard block
 block discarded – undo
70 68
         $sectors_used = 0;
71 69
         foreach($artifact_deploy as $deploy_unit_id => $deploy_unit_level)
72 70
         {
73
-          if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true))))
74
-            continue;
71
+          if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) {
72
+                      continue;
73
+          }
75 74
           $sectors_used += $levels_deployed;
76 75
           $db_changeset['unit'][] = sn_db_unit_changeset_prepare($deploy_unit_id, $levels_deployed, $user, $planetrow['id']);
77 76
           //$deploy_unit_name = get_unit_param($deploy_unit_id, P_NAME);
@@ -107,8 +106,7 @@  discard block
 block discarded – undo
107 106
           db_que_set_time_left_by_id($que_item['que_id'], $que_item['que_time_left']);
108 107
           $message = sprintf($lang['art_heurestic_chip_ok'], $lang['tech'][$que_item['que_unit_id']], $que_item['que_unit_level'], sys_time_human($old_time - $que_item['que_time_left']));
109 108
           msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_QUE, $lang['art_heurestic_chip_subj'], $lang['art_heurestic_chip_subj'], $message);
110
-        }
111
-        else
109
+        } else
112 110
         {
113 111
           $message = $lang['art_heurestic_chip_no_research'];
114 112
         }
@@ -136,8 +134,7 @@  discard block
 block discarded – undo
136 134
             $lang['tech'][$que_item['que_unit_id']], $que_item['que_unit_level'], $planetrow['name'], uni_render_coordinates($planetrow), sys_time_human($old_time - $que_item['que_time_left'])
137 135
           );
138 136
           msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_QUE, $lang['art_nano_builder_subj'], $lang['art_nano_builder_subj'], $message);
139
-        }
140
-        else
137
+        } else
141 138
         {
142 139
           $message = $lang['art_nano_builder_no_que'];
143 140
         }
@@ -149,8 +146,7 @@  discard block
 block discarded – undo
149 146
       $db_changeset['unit'][] = sn_db_unit_changeset_prepare($unit_id, $unit_level - $artifact_level_old, $user);
150 147
       db_changeset_apply($db_changeset);
151 148
     }
152
-  }
153
-  else
149
+  } else
154 150
   {
155 151
     $message = $lang['art_err_no_artifact'];
156 152
   }
Please login to merge, or discard this patch.
includes/includes/flt_page0.inc 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -5,9 +5,9 @@  discard block
 block discarded – undo
5 5
 // @version 1.0
6 6
 // @copyright 2008 by Chlorel for XNova
7 7
 
8
-if($fleet_ship_sort = sys_get_param_id('sort_elements')) {
8
+if ($fleet_ship_sort = sys_get_param_id('sort_elements')) {
9 9
   define('IN_AJAX', true);
10
-  if(!empty($lang['player_option_fleet_ship_sort'][$fleet_ship_sort])) {
10
+  if (!empty($lang['player_option_fleet_ship_sort'][$fleet_ship_sort])) {
11 11
     // player_save_option($user, PLAYER_OPTION_FLEET_SHIP_SORT, $fleet_ship_sort);
12 12
     // player_save_option($user, PLAYER_OPTION_FLEET_SHIP_SORT_INVERSE, sys_get_param_id('fleet_ship_sort_inverse', 0));
13 13
     classSupernova::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT] = $fleet_ship_sort;
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
   die();
17 17
 }
18 18
 
19
-if(SN_IN_FLEET !== true) {
19
+if (SN_IN_FLEET !== true) {
20 20
   $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403);
21 21
 }
22 22
 
23 23
 lng_include('overview');
24 24
 
25
-if(!$planetrow) {
25
+if (!$planetrow) {
26 26
   message($lang['fl_noplanetrow'], $lang['fl_error']);
27 27
 }
28 28
 
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
 
31 31
 $record_index = 0;
32 32
 $ship_list = array();
33
-foreach(sn_get_groups('fleet') as $n => $unit_id) {
33
+foreach (sn_get_groups('fleet') as $n => $unit_id) {
34 34
   $unit_level = mrc_get_level($user, $planetrow, $unit_id, false, true);
35
-  if($unit_level > 0) {
35
+  if ($unit_level > 0) {
36 36
     $ship_data = get_ship_data($unit_id, $user);
37 37
     $ship_list[$unit_id] = array(
38 38
       '__INDEX'     => $record_index++,
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 
51 51
 $fleet_ship_sort = classSupernova::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT];
52 52
 $fleet_ship_sort_inverse = classSupernova::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT_INVERSE];
53
-if($fleet_ship_sort || $fleet_ship_sort_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) {
54
-  switch($fleet_ship_sort) {
53
+if ($fleet_ship_sort || $fleet_ship_sort_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) {
54
+  switch ($fleet_ship_sort) {
55 55
     case PLAYER_OPTION_SORT_NAME: $fleet_ship_sort_field = 'NAME'; break;
56 56
     case PLAYER_OPTION_SORT_SPEED: $fleet_ship_sort_field = 'SPEED'; break;
57 57
     case PLAYER_OPTION_SORT_COUNT: $fleet_ship_sort_field = 'AMOUNT'; break;
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
   });
67 67
 }
68 68
 
69
-foreach($ship_list as $ship_data) {
69
+foreach ($ship_list as $ship_data) {
70 70
   $template->assign_block_vars('ships', $ship_data);
71 71
 }
72 72
 
73
-foreach($lang['player_option_fleet_ship_sort'] as $sort_id => $sort_text) {
73
+foreach ($lang['player_option_fleet_ship_sort'] as $sort_id => $sort_text) {
74 74
   $template->assign_block_vars('ship_sort_list', array(
75 75
     'VALUE' => $sort_id,
76 76
     'TEXT' => $sort_text,
Please login to merge, or discard this patch.