Completed
Branch trunk (78000f)
by SuperNova.WS
25:55 queued 09:00
created
includes/general/math.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 function geometry_progression_sum($n, $b1, $q) {
4
-  return $q != 1 ? ($b1 * (pow($q, $n) - 1)/($q - 1)) : ($n * $b1);
4
+  return $q != 1 ? ($b1 * (pow($q, $n) - 1) / ($q - 1)) : ($n * $b1);
5 5
 }
6 6
 
7 7
 function sn_floor($value)
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
  *
44 44
  * @return float|int
45 45
  */
46
-function sn_rand_gauss_range($range_start, $range_end, $round = true, $strict = 4, $cut_extreme = false)  {
47
-  if($cut_extreme) {
46
+function sn_rand_gauss_range($range_start, $range_end, $round = true, $strict = 4, $cut_extreme = false) {
47
+  if ($cut_extreme) {
48 48
     $range_start--;
49 49
     $range_end++;
50 50
   }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 {
61 61
   $args = func_get_args();
62 62
 
63
-  switch(func_num_args())
63
+  switch (func_num_args())
64 64
   {
65 65
     case 0:
66 66
       // trigger_error('median() requires at least one parameter',E_USER_WARNING);
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     // fallthrough
73 73
 
74 74
     default:
75
-      if(!is_array($args))
75
+      if (!is_array($args))
76 76
       {
77 77
         // trigger_error('median() requires a list of numbers to operate on or an array of numbers', E_USER_NOTICE);
78 78
         return false;
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
       $n = count($args);
84 84
       $h = intval($n / 2);
85 85
 
86
-      if($n % 2 == 0)
86
+      if ($n % 2 == 0)
87 87
       {
88
-        $median = ($args[$h] + $args[$h-1]) / 2;
88
+        $median = ($args[$h] + $args[$h - 1]) / 2;
89 89
       }
90 90
       else
91 91
       {
@@ -103,47 +103,47 @@  discard block
 block discarded – undo
103 103
 }
104 104
 function linear_calc(&$linear, $from = 0, $debug = false)
105 105
 {
106
-  for($i = $from; $i < count($linear); $i++)
106
+  for ($i = $from; $i < count($linear); $i++)
107 107
   {
108 108
     $eq = &$linear[$i];
109
-    for($j = count($eq) - 1; $j >= $from; $j--)
109
+    for ($j = count($eq) - 1; $j >= $from; $j--)
110 110
     {
111 111
       $eq[$j] /= $eq[$from];
112 112
     }
113 113
   }
114
-  if($debug) pdump($linear, 'Нормализовано по х' . $from);
114
+  if ($debug) pdump($linear, 'Нормализовано по х' . $from);
115 115
 
116
-  for($i = $from + 1; $i < count($linear); $i++)
116
+  for ($i = $from + 1; $i < count($linear); $i++)
117 117
   {
118 118
     $eq = &$linear[$i];
119
-    for($j = count($eq) - 1; $j >= $from; $j--)
119
+    for ($j = count($eq) - 1; $j >= $from; $j--)
120 120
     {
121 121
       $eq[$j] -= $linear[$from][$j];
122 122
     }
123 123
   }
124
-  if($debug) pdump($linear, 'Подставили х' . $from);
124
+  if ($debug) pdump($linear, 'Подставили х' . $from);
125 125
 
126
-  if($from < count($linear) - 1)
126
+  if ($from < count($linear) - 1)
127 127
   {
128 128
     linear_calc($linear, $from + 1, $debug);
129 129
   }
130 130
 
131
-  if($from)
131
+  if ($from)
132 132
   {
133
-    for($i = 0; $i < $from; $i++)
133
+    for ($i = 0; $i < $from; $i++)
134 134
     {
135 135
       $eq = &$linear[$i];
136
-      for($j = count($eq) - 1; $j >= $from; $j--)
136
+      for ($j = count($eq) - 1; $j >= $from; $j--)
137 137
       {
138 138
         $eq[$j] = $eq[$j] - $eq[$from] * $linear[$from][$j];
139 139
       }
140 140
     }
141
-    if($debug) pdump($linear, 'Подставили обратно х' . $from);
141
+    if ($debug) pdump($linear, 'Подставили обратно х' . $from);
142 142
   }
143 143
   else
144 144
   {
145
-    if($debug) pdump($linear, 'Результат' . $from);
146
-    foreach($linear as $index => &$eq)
145
+    if ($debug) pdump($linear, 'Результат' . $from);
146
+    foreach ($linear as $index => &$eq)
147 147
     {
148 148
       pdump($eq[count($linear)], 'x' . $index);
149 149
     }
Please login to merge, or discard this patch.
includes/vars_menu.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!defined('INSIDE')) {
3
+if (!defined('INSIDE')) {
4 4
   die('Hack attempt!');
5 5
 }
6 6
 
Please login to merge, or discard this patch.
includes/db/db_queries_users.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     "SELECT `id` AS `ID`, `username` AS `NAME`, `ally_name` AS `ALLY`, `total_points` AS `STAT_POINTS`,
84 84
       `onlinetime` AS `ACTIVITY`
85 85
     FROM {{users}}
86
-    WHERE `onlinetime` >= ". (SN_TIME_NOW - $config->game_users_online_timeout) ." ORDER BY user_as_ally, `". $TypeSort ."` ASC;");
86
+    WHERE `onlinetime` >= ". (SN_TIME_NOW - $config->game_users_online_timeout) . " ORDER BY user_as_ally, `" . $TypeSort . "` ASC;");
87 87
 }
88 88
 
89 89
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
   return doquery("SELECT u.*, COUNT(r.id) AS referral_count, SUM(r.dark_matter) AS referral_dm FROM {{users}} as u
99 99
     LEFT JOIN {{referrals}} as r on r.id_partner = u.id
100 100
     WHERE" .
101
-    ($online ? " `onlinetime` >= ". (SN_TIME_NOW - $config->game_users_online_timeout) : ' user_as_ally IS NULL') .
101
+    ($online ? " `onlinetime` >= " . (SN_TIME_NOW - $config->game_users_online_timeout) : ' user_as_ally IS NULL') .
102 102
     " GROUP BY u.id
103 103
     ORDER BY user_as_ally, {$sort} ASC");
104 104
 }
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
   !is_array($user_id_list) ? $user_id_list = array($user_id_list) : false;
115 115
 
116 116
   $user_list = array();
117
-  foreach($user_id_list as $user_id_unsafe) {
117
+  foreach ($user_id_list as $user_id_unsafe) {
118 118
     $user = db_user_by_id($user_id_unsafe);
119 119
     !empty($user) ? $user_list[$user_id_unsafe] = $user : false;
120 120
   }
Please login to merge, or discard this patch.
includes/alliance/ali_external_search.inc 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 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
 }
Please login to merge, or discard this patch.
includes/alliance/ali_internal_members.inc 1 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
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 }
43 43
 
44 44
 $sort1 = sys_get_param_int('sort1');
45
-if($sort1>5 || $sort1<0) $sort1 = 0;
45
+if ($sort1 > 5 || $sort1 < 0) $sort1 = 0;
46 46
 $sort1s = array(
47 47
   0 => '`ally_rank_id` %1$s;',
48 48
   1 => '`username` %1$s;',
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
   'id, username, galaxy, system, planet, onlinetime, ally_rank_id, ally_register_time, total_points');
59 59
 
60 60
 // while ($userRow = db_fetch($userList))
61
-foreach($userList as $userRow)
61
+foreach ($userList as $userRow)
62 62
 {
63 63
   $i++;
64 64
   if (!isset($ranks[$userRow['ally_rank_id']]))
@@ -68,17 +68,17 @@  discard block
 block discarded – undo
68 68
 
69 69
   if ($ally['ally_owner'] == $userRow['id'])
70 70
   {
71
-    $ally_range = ($ally['ally_owner_range'])?$ally['ally_owner_range']:$lang['Founder'];
71
+    $ally_range = ($ally['ally_owner_range']) ? $ally['ally_owner_range'] : $lang['Founder'];
72 72
   }
73 73
   else
74 74
   {
75
-    if($user_admin)
75
+    if ($user_admin)
76 76
     {
77 77
       $ally_range = '<select onchange="window.location=\'alliance.php?mode=admin&edit=members&id_user=' . $userRow['id'] . '&id_rank=\' + this.value">';
78 78
 
79
-      foreach($ranks as $rankID => $rankArray){
79
+      foreach ($ranks as $rankID => $rankArray) {
80 80
         $ally_range .= '<option value="' . $rankID . '"';
81
-        if($rankID == $userRow['ally_rank_id'])
81
+        if ($rankID == $userRow['ally_rank_id'])
82 82
           $ally_range .= " selected";
83 83
         $ally_range .= '>' . $rankArray['name'];
84 84
         $ally_range .= '</option>';
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
   }
93 93
 
94 94
   $last_active = time() - $userRow["onlinetime"];
95
-  if($user_admin)
95
+  if ($user_admin)
96 96
   {
97
-    if ( $last_active < 60 )
97
+    if ($last_active < 60)
98 98
     {
99 99
       $tmp = "lime>{$lang['On']}";
100 100
     }
@@ -105,12 +105,12 @@  discard block
 block discarded – undo
105 105
     }
106 106
     elseif ($last_active < 60 * 60 * 24)
107 107
     {
108
-      $last_active = round( $last_active / (60 * 60));
108
+      $last_active = round($last_active / (60 * 60));
109 109
       $tmp = "green>{$last_active} {$lang['sys_hrs_short']}";
110 110
     }
111 111
     else
112 112
     {
113
-      $last_active = round( $last_active / (60 * 60 * 24));
113
+      $last_active = round($last_active / (60 * 60 * 24));
114 114
       if ($last_active < 7)
115 115
       {
116 116
         $tmp = "yellow";
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
   }
129 129
   else
130 130
   {
131
-    if($user_onlinestatus)
131
+    if ($user_onlinestatus)
132 132
     {
133
-      if ( $last_active < 60 * 5 )
133
+      if ($last_active < 60 * 5)
134 134
       {
135 135
         $tmp = "lime>{$lang['On']}";
136 136
       }
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/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/ube_report.php 1 patch
Spacing   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
   global $config;
8 8
 
9 9
   // Если уже есть ИД репорта - значит репорт был взят из таблицы. С таким мы не работаем
10
-  if($combat_data[UBE_REPORT_CYPHER])
10
+  if ($combat_data[UBE_REPORT_CYPHER])
11 11
   {
12 12
     return false;
13 13
   }
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
   {
18 18
     $combat_data[UBE_REPORT_CYPHER] = sys_random_string(32);
19 19
   }
20
-  while(doquery("SELECT ube_report_cypher FROM {{ube_report}} WHERE ube_report_cypher = '{$combat_data[UBE_REPORT_CYPHER]}' LIMIT 1 FOR UPDATE", true));
20
+  while (doquery("SELECT ube_report_cypher FROM {{ube_report}} WHERE ube_report_cypher = '{$combat_data[UBE_REPORT_CYPHER]}' LIMIT 1 FOR UPDATE", true));
21 21
 
22 22
   // Инициализация таблицы для пакетной вставки информации
23 23
   $sql_perform = array(
@@ -113,55 +113,55 @@  discard block
 block discarded – undo
113 113
       `ube_report_time_combat` = '" . date(FMT_DATE_TIME_SQL, $combat_data[UBE_TIME]) . "',
114 114
       `ube_report_time_spent` = {$combat_data[UBE_TIME_SPENT]},
115 115
 
116
-      `ube_report_combat_admin` = " . (int)$combat_data[UBE_OPTIONS][UBE_COMBAT_ADMIN] . ",
116
+      `ube_report_combat_admin` = " . (int) $combat_data[UBE_OPTIONS][UBE_COMBAT_ADMIN] . ",
117 117
       `ube_report_mission_type` = {$combat_data[UBE_OPTIONS][UBE_MISSION_TYPE]},
118 118
 
119 119
       `ube_report_combat_result` = {$outcome[UBE_COMBAT_RESULT]},
120
-      `ube_report_combat_sfr` = " . (int)$outcome[UBE_SFR] .",
120
+      `ube_report_combat_sfr` = " . (int) $outcome[UBE_SFR] . ",
121 121
 
122
-      `ube_report_debris_metal` = " . (float)$outcome[UBE_DEBRIS][RES_METAL] . ",
123
-      `ube_report_debris_crystal` = " . (float)$outcome[UBE_DEBRIS][RES_CRYSTAL] . ",
122
+      `ube_report_debris_metal` = " . (float) $outcome[UBE_DEBRIS][RES_METAL] . ",
123
+      `ube_report_debris_crystal` = " . (float) $outcome[UBE_DEBRIS][RES_CRYSTAL] . ",
124 124
       `ube_report_debris_total_in_metal` = " . $ube_report_debris_total_in_metal . ",
125 125
 
126
-      `ube_report_planet_id`          = " . (int)$outcome[UBE_PLANET][PLANET_ID] . ",
126
+      `ube_report_planet_id`          = " . (int) $outcome[UBE_PLANET][PLANET_ID] . ",
127 127
       `ube_report_planet_name`        = '" . db_escape($outcome[UBE_PLANET][PLANET_NAME]) . "',
128
-      `ube_report_planet_size`        = " . (int)$outcome[UBE_PLANET][PLANET_SIZE] . ",
129
-      `ube_report_planet_galaxy`      = " . (int)$outcome[UBE_PLANET][PLANET_GALAXY] . ",
130
-      `ube_report_planet_system`      = " . (int)$outcome[UBE_PLANET][PLANET_SYSTEM] . ",
131
-      `ube_report_planet_planet`      = " . (int)$outcome[UBE_PLANET][PLANET_PLANET] . ",
132
-      `ube_report_planet_planet_type` = " . (int)$outcome[UBE_PLANET][PLANET_TYPE] . ",
128
+      `ube_report_planet_size`        = " . (int) $outcome[UBE_PLANET][PLANET_SIZE] . ",
129
+      `ube_report_planet_galaxy`      = " . (int) $outcome[UBE_PLANET][PLANET_GALAXY] . ",
130
+      `ube_report_planet_system`      = " . (int) $outcome[UBE_PLANET][PLANET_SYSTEM] . ",
131
+      `ube_report_planet_planet`      = " . (int) $outcome[UBE_PLANET][PLANET_PLANET] . ",
132
+      `ube_report_planet_planet_type` = " . (int) $outcome[UBE_PLANET][PLANET_TYPE] . ",
133 133
 
134
-      `ube_report_moon` = " . (int)$outcome[UBE_MOON] .",
135
-      `ube_report_moon_chance` = " . (int)$outcome[UBE_MOON_CHANCE] . ",
136
-      `ube_report_moon_size` = " . (float)$outcome[UBE_MOON_SIZE] . ",
134
+      `ube_report_moon` = " . (int) $outcome[UBE_MOON] . ",
135
+      `ube_report_moon_chance` = " . (int) $outcome[UBE_MOON_CHANCE] . ",
136
+      `ube_report_moon_size` = " . (float) $outcome[UBE_MOON_SIZE] . ",
137 137
 
138
-      `ube_report_moon_reapers` = " . (int)$outcome[UBE_MOON_REAPERS] . ",
139
-      `ube_report_moon_destroy_chance` = " . (int)$outcome[UBE_MOON_DESTROY_CHANCE] . ",
140
-      `ube_report_moon_reapers_die_chance` = " . (int)$outcome[UBE_MOON_REAPERS_DIE_CHANCE] . ",
138
+      `ube_report_moon_reapers` = " . (int) $outcome[UBE_MOON_REAPERS] . ",
139
+      `ube_report_moon_destroy_chance` = " . (int) $outcome[UBE_MOON_DESTROY_CHANCE] . ",
140
+      `ube_report_moon_reapers_die_chance` = " . (int) $outcome[UBE_MOON_REAPERS_DIE_CHANCE] . ",
141 141
 
142
-      `ube_report_capture_result` = " . (int)$outcome[UBE_CAPTURE_RESULT] . "
142
+      `ube_report_capture_result` = " . (int) $outcome[UBE_CAPTURE_RESULT] . "
143 143
   ");
144 144
   $ube_report_id = $combat_data[UBE_REPORT_ID] = db_insert_id();
145 145
 
146 146
   // Сохраняем общую информацию по игрокам
147
-  foreach($combat_data[UBE_PLAYERS] as $player_id => &$player_info)
147
+  foreach ($combat_data[UBE_PLAYERS] as $player_id => &$player_info)
148 148
   {
149 149
     $sql_perform['ube_report_player'][] = array(
150 150
       $ube_report_id,
151 151
       $player_id,
152 152
 
153 153
       "'" . db_escape($player_info[UBE_NAME]) . "'",
154
-      (int)$player_info[UBE_ATTACKER],
154
+      (int) $player_info[UBE_ATTACKER],
155 155
 
156
-      (float)$player_info[UBE_BONUSES][UBE_ATTACK],
157
-      (float)$player_info[UBE_BONUSES][UBE_SHIELD],
158
-      (float)$player_info[UBE_BONUSES][UBE_ARMOR],
156
+      (float) $player_info[UBE_BONUSES][UBE_ATTACK],
157
+      (float) $player_info[UBE_BONUSES][UBE_SHIELD],
158
+      (float) $player_info[UBE_BONUSES][UBE_ARMOR],
159 159
     );
160 160
   }
161 161
 
162 162
   // Всякая информация по флотам
163 163
   $unit_sort_order = 0;
164
-  foreach($combat_data[UBE_FLEETS] as $fleet_id => &$fleet_info)
164
+  foreach ($combat_data[UBE_FLEETS] as $fleet_id => &$fleet_info)
165 165
   {
166 166
     // Сохраняем общую информацию по флотам
167 167
     $sql_perform['ube_report_fleet'][] = array(
@@ -169,20 +169,20 @@  discard block
 block discarded – undo
169 169
       $fleet_info[UBE_OWNER],
170 170
       $fleet_id,
171 171
 
172
-      (float)$fleet_info[UBE_PLANET][PLANET_ID],
172
+      (float) $fleet_info[UBE_PLANET][PLANET_ID],
173 173
       "'" . db_escape($fleet_info[UBE_PLANET][PLANET_NAME]) . "'",
174
-      (int)$fleet_info[UBE_PLANET][PLANET_GALAXY],
175
-      (int)$fleet_info[UBE_PLANET][PLANET_SYSTEM],
176
-      (int)$fleet_info[UBE_PLANET][PLANET_PLANET],
177
-      (int)$fleet_info[UBE_PLANET][PLANET_TYPE],
178
-
179
-      (float)$fleet_info[UBE_RESOURCES][RES_METAL],
180
-      (float)$fleet_info[UBE_RESOURCES][RES_CRYSTAL],
181
-      (float)$fleet_info[UBE_RESOURCES][RES_DEUTERIUM],
182
-
183
-      (float)$fleet_info[UBE_BONUSES][UBE_ATTACK],
184
-      (float)$fleet_info[UBE_BONUSES][UBE_SHIELD],
185
-      (float)$fleet_info[UBE_BONUSES][UBE_ARMOR],
174
+      (int) $fleet_info[UBE_PLANET][PLANET_GALAXY],
175
+      (int) $fleet_info[UBE_PLANET][PLANET_SYSTEM],
176
+      (int) $fleet_info[UBE_PLANET][PLANET_PLANET],
177
+      (int) $fleet_info[UBE_PLANET][PLANET_TYPE],
178
+
179
+      (float) $fleet_info[UBE_RESOURCES][RES_METAL],
180
+      (float) $fleet_info[UBE_RESOURCES][RES_CRYSTAL],
181
+      (float) $fleet_info[UBE_RESOURCES][RES_DEUTERIUM],
182
+
183
+      (float) $fleet_info[UBE_BONUSES][UBE_ATTACK],
184
+      (float) $fleet_info[UBE_BONUSES][UBE_SHIELD],
185
+      (float) $fleet_info[UBE_BONUSES][UBE_ARMOR],
186 186
     );
187 187
 
188 188
     // Сохраняем итоговую информацию по ресурсам флота - потеряно, выброшено, увезено
@@ -191,25 +191,25 @@  discard block
 block discarded – undo
191 191
       $ube_report_id,
192 192
       $fleet_id,
193 193
 
194
-      (float)$fleet_outcome_data[UBE_RESOURCES_LOST][RES_METAL],
195
-      (float)$fleet_outcome_data[UBE_RESOURCES_LOST][RES_CRYSTAL],
196
-      (float)$fleet_outcome_data[UBE_RESOURCES_LOST][RES_DEUTERIUM],
194
+      (float) $fleet_outcome_data[UBE_RESOURCES_LOST][RES_METAL],
195
+      (float) $fleet_outcome_data[UBE_RESOURCES_LOST][RES_CRYSTAL],
196
+      (float) $fleet_outcome_data[UBE_RESOURCES_LOST][RES_DEUTERIUM],
197 197
 
198
-      (float)$fleet_outcome_data[UBE_CARGO_DROPPED][RES_METAL],
199
-      (float)$fleet_outcome_data[UBE_CARGO_DROPPED][RES_CRYSTAL],
200
-      (float)$fleet_outcome_data[UBE_CARGO_DROPPED][RES_DEUTERIUM],
198
+      (float) $fleet_outcome_data[UBE_CARGO_DROPPED][RES_METAL],
199
+      (float) $fleet_outcome_data[UBE_CARGO_DROPPED][RES_CRYSTAL],
200
+      (float) $fleet_outcome_data[UBE_CARGO_DROPPED][RES_DEUTERIUM],
201 201
 
202
-      (float)$fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_METAL],
203
-      (float)$fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_CRYSTAL],
204
-      (float)$fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_DEUTERIUM],
202
+      (float) $fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_METAL],
203
+      (float) $fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_CRYSTAL],
204
+      (float) $fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_DEUTERIUM],
205 205
 
206
-      (float)$fleet_outcome_data[UBE_RESOURCES_LOST_IN_METAL][RES_METAL],
206
+      (float) $fleet_outcome_data[UBE_RESOURCES_LOST_IN_METAL][RES_METAL],
207 207
     );
208 208
 
209 209
     // Сохраняем результаты по юнитам - потеряно и восстановлено
210
-    foreach($fleet_info[UBE_COUNT] as $unit_id => $unit_count)
210
+    foreach ($fleet_info[UBE_COUNT] as $unit_id => $unit_count)
211 211
     {
212
-      if($fleet_outcome_data[UBE_UNITS_LOST][$unit_id] || $fleet_outcome_data[UBE_DEFENCE_RESTORE][$unit_id])
212
+      if ($fleet_outcome_data[UBE_UNITS_LOST][$unit_id] || $fleet_outcome_data[UBE_DEFENCE_RESTORE][$unit_id])
213 213
       {
214 214
         $unit_sort_order++;
215 215
         $sql_perform['ube_report_outcome_unit'][] = array(
@@ -217,8 +217,8 @@  discard block
 block discarded – undo
217 217
           $fleet_id,
218 218
 
219 219
           $unit_id,
220
-          (float)$fleet_outcome_data[UBE_DEFENCE_RESTORE][$unit_id],
221
-          (float)$fleet_outcome_data[UBE_UNITS_LOST][$unit_id],
220
+          (float) $fleet_outcome_data[UBE_DEFENCE_RESTORE][$unit_id],
221
+          (float) $fleet_outcome_data[UBE_UNITS_LOST][$unit_id],
222 222
 
223 223
           $unit_sort_order,
224 224
         );
@@ -228,11 +228,11 @@  discard block
 block discarded – undo
228 228
 
229 229
   // Сохраняем информацию о раундах
230 230
   $unit_sort_order = 0;
231
-  foreach($combat_data[UBE_ROUNDS] as $round => &$round_data)
231
+  foreach ($combat_data[UBE_ROUNDS] as $round => &$round_data)
232 232
   {
233
-    foreach($round_data[UBE_FLEETS] as $fleet_id => &$fleet_data)
233
+    foreach ($round_data[UBE_FLEETS] as $fleet_id => &$fleet_data)
234 234
     {
235
-      foreach($fleet_data[UBE_COUNT] as $unit_id => $unit_count)
235
+      foreach ($fleet_data[UBE_COUNT] as $unit_id => $unit_count)
236 236
       {
237 237
         $unit_sort_order++;
238 238
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 
245 245
           $unit_id,
246 246
           $unit_count,
247
-          (int)$fleet_data[UBE_UNITS_BOOM][$unit_id],
247
+          (int) $fleet_data[UBE_UNITS_BOOM][$unit_id],
248 248
 
249 249
           $fleet_data[UBE_ATTACK][$unit_id],
250 250
           $fleet_data[UBE_SHIELD][$unit_id],
@@ -261,13 +261,13 @@  discard block
 block discarded – undo
261 261
   }
262 262
 
263 263
   // Пакетная вставка данных
264
-  foreach($sql_perform as $table_name => $table_data)
264
+  foreach ($sql_perform as $table_name => $table_data)
265 265
   {
266
-    if(count($table_data) < 2)
266
+    if (count($table_data) < 2)
267 267
     {
268 268
       continue;
269 269
     }
270
-    foreach($table_data as &$record_data)
270
+    foreach ($table_data as &$record_data)
271 271
     {
272 272
       $record_data = '(' . implode(',', $record_data) . ')';
273 273
     }
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
   $report_cypher = db_escape($report_cypher);
287 287
 
288 288
   $report_row = doquery("SELECT * FROM {{ube_report}} WHERE ube_report_cypher = '{$report_cypher}' LIMIT 1", true);
289
-  if(!$report_row)
289
+  if (!$report_row)
290 290
   {
291 291
     return UBE_REPORT_NOT_FOUND;
292 292
   }
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
   $outcome = &$combat_data[UBE_OUTCOME];
341 341
 
342 342
   $query = doquery("SELECT * FROM {{ube_report_player}} WHERE `ube_report_id` = {$report_row['ube_report_id']}");
343
-  while($player_row = db_fetch($query))
343
+  while ($player_row = db_fetch($query))
344 344
   {
345 345
     $combat_data[UBE_PLAYERS][$player_row['ube_report_player_player_id']] = array(
346 346
       UBE_NAME => $player_row['ube_report_player_name'],
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
   }
356 356
 
357 357
   $query = doquery("SELECT * FROM {{ube_report_fleet}} WHERE `ube_report_id` = {$report_row['ube_report_id']}");
358
-  while($fleet_row = db_fetch($query))
358
+  while ($fleet_row = db_fetch($query))
359 359
   {
360 360
     $combat_data[UBE_FLEETS][$fleet_row['ube_report_fleet_fleet_id']] = array(
361 361
       UBE_OWNER => $fleet_row['ube_report_fleet_player_id'],
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
   $rounds_data = &$combat_data[UBE_ROUNDS];
390 390
 
391 391
   $query = doquery("SELECT * FROM {{ube_report_unit}} WHERE `ube_report_id` = {$report_row['ube_report_id']} ORDER BY `ube_report_unit_sort_order`");
392
-  while($round_row = db_fetch($query))
392
+  while ($round_row = db_fetch($query))
393 393
   {
394 394
     $round = $round_row['ube_report_unit_round'];
395 395
     $fleet_id = $round_row['ube_report_unit_fleet_id'];
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
     $side = $combat_data[UBE_FLEETS][$fleet_id][UBE_FLEET_TYPE];
398 398
     $rounds_data[$round][$side][UBE_ATTACK][$fleet_id] = 0;
399 399
 
400
-    if(!isset($rounds_data[$round][UBE_FLEETS][$fleet_id]))
400
+    if (!isset($rounds_data[$round][UBE_FLEETS][$fleet_id]))
401 401
     {
402 402
       $rounds_data[$round][UBE_FLEETS][$fleet_id] = array();
403 403
     }
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 
419 419
 
420 420
   $query = doquery("SELECT * FROM {{ube_report_outcome_fleet}} WHERE `ube_report_id` = {$report_row['ube_report_id']}");
421
-  while($row = db_fetch($query))
421
+  while ($row = db_fetch($query))
422 422
   {
423 423
     $fleet_id = $row['ube_report_outcome_fleet_fleet_id'];
424 424
 
@@ -452,10 +452,10 @@  discard block
 block discarded – undo
452 452
   }
453 453
 
454 454
   $query = doquery("SELECT * FROM {{ube_report_outcome_unit}} WHERE `ube_report_id` = {$report_row['ube_report_id']} ORDER BY `ube_report_outcome_unit_sort_order`");
455
-  while($row = db_fetch($query))
455
+  while ($row = db_fetch($query))
456 456
   {
457 457
     $fleet_id = $row['ube_report_outcome_unit_fleet_id'];
458
-    $side= $combat_data[UBE_FLEETS][$fleet_id][UBE_FLEET_TYPE];
458
+    $side = $combat_data[UBE_FLEETS][$fleet_id][UBE_FLEET_TYPE];
459 459
     $outcome[$side][UBE_FLEETS][$fleet_id][UBE_UNITS_LOST][$row['ube_report_outcome_unit_unit_id']] = $row['ube_report_outcome_unit_lost'];
460 460
     $outcome[$side][UBE_FLEETS][$fleet_id][UBE_DEFENCE_RESTORE][$row['ube_report_outcome_unit_unit_id']] = $row['ube_report_outcome_unit_restored'];
461 461
   }
@@ -487,10 +487,10 @@  discard block
 block discarded – undo
487 487
   $fleets_info = &$combat_data[UBE_FLEETS];
488 488
   $round_template = array();
489 489
   $round_data = &$combat_data[UBE_ROUNDS][$round];
490
-  foreach(array(UBE_ATTACKERS, UBE_DEFENDERS) as $side)
490
+  foreach (array(UBE_ATTACKERS, UBE_DEFENDERS) as $side)
491 491
   {
492 492
     $round_data[$side][UBE_ATTACK] = $round_data[$side][UBE_ATTACK] ? $round_data[$side][UBE_ATTACK] : array();
493
-    foreach($round_data[$side][UBE_ATTACK] as $fleet_id => $temp)
493
+    foreach ($round_data[$side][UBE_ATTACK] as $fleet_id => $temp)
494 494
     {
495 495
       $fleet_data = &$round_data[UBE_FLEETS][$fleet_id];
496 496
       $fleet_data_prev = &$combat_data[UBE_ROUNDS][$round - 1][UBE_FLEETS][$fleet_id];
@@ -500,14 +500,14 @@  discard block
 block discarded – undo
500 500
         'PLAYER_NAME' => htmlentities($combat_data[UBE_PLAYERS][$fleets_info[$fleet_id][UBE_OWNER]][UBE_NAME], ENT_COMPAT, 'UTF-8'),
501 501
       );
502 502
 
503
-      if(is_array($combat_data[UBE_FLEETS][$fleet_id][UBE_PLANET]))
503
+      if (is_array($combat_data[UBE_FLEETS][$fleet_id][UBE_PLANET]))
504 504
       {
505 505
         $fleet_template += $combat_data[UBE_FLEETS][$fleet_id][UBE_PLANET];
506 506
         $fleet_template[PLANET_NAME] = $fleet_template[PLANET_NAME] ? htmlentities($fleet_template[PLANET_NAME], ENT_COMPAT, 'UTF-8') : '';
507 507
         $fleet_template['PLANET_TYPE_TEXT'] = $lang['sys_planet_type_sh'][$fleet_template['PLANET_TYPE']];
508 508
       }
509 509
 
510
-      foreach($fleet_data[UBE_COUNT] as $unit_id => $unit_count)
510
+      foreach ($fleet_data[UBE_COUNT] as $unit_id => $unit_count)
511 511
       {
512 512
         $shields_original = $fleet_data[UBE_SHIELD_BASE][$unit_id] * $fleet_data_prev[UBE_COUNT][$unit_id];
513 513
         $ship_template = array(
@@ -540,11 +540,11 @@  discard block
 block discarded – undo
540 540
   global $lang;
541 541
 
542 542
   $result = array();
543
-  if(!empty($array))
543
+  if (!empty($array))
544 544
   {
545
-    foreach($array as $unit_id => $unit_count)
545
+    foreach ($array as $unit_id => $unit_count)
546 546
     {
547
-      if($unit_count)
547
+      if ($unit_count)
548 548
       {
549 549
         $result[] = array(
550 550
           'NAME' => $lang['tech'][$unit_id],
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
         );
553 553
       }
554 554
     }
555
-    if($header && count($result))
555
+    if ($header && count($result))
556 556
     {
557 557
       array_unshift($result, array('NAME' => $header));
558 558
     }
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 // Генерирует данные для отчета из разобранных данных боя
566 566
 function sn_ube_report_generate(&$combat_data, &$template_result)
567 567
 {
568
-  if(!is_array($combat_data))
568
+  if (!is_array($combat_data))
569 569
   {
570 570
     return;
571 571
   }
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
   $fleets_info = &$combat_data[UBE_FLEETS];
578 578
   $outcome = &$combat_data[UBE_OUTCOME];
579 579
   // Генерируем отчет по флотам
580
-  for($round = 1; $round <= count($combat_data[UBE_ROUNDS]) - 1; $round++)
580
+  for ($round = 1; $round <= count($combat_data[UBE_ROUNDS]) - 1; $round++)
581 581
   {
582 582
     $round_template = array(
583 583
       'NUMBER' => $round,
@@ -589,13 +589,13 @@  discard block
 block discarded – undo
589 589
   }
590 590
 
591 591
   // Боевые потери флотов
592
-  foreach(array(UBE_ATTACKERS, UBE_DEFENDERS) as $side)
592
+  foreach (array(UBE_ATTACKERS, UBE_DEFENDERS) as $side)
593 593
   {
594
-    if(!is_array($outcome[$side][UBE_FLEETS]))
594
+    if (!is_array($outcome[$side][UBE_FLEETS]))
595 595
     {
596 596
       continue;
597 597
     }
598
-    foreach($outcome[$side][UBE_FLEETS] as $fleet_id => $temp)
598
+    foreach ($outcome[$side][UBE_FLEETS] as $fleet_id => $temp)
599 599
     {
600 600
       $player_info = &$players_info[$fleets_info[$fleet_id][UBE_OWNER]];
601 601
       $fleet_outcome = &$outcome[UBE_FLEETS][$fleet_id];
@@ -620,9 +620,9 @@  discard block
 block discarded – undo
620 620
 
621 621
   // Обломки
622 622
   $debris = array();
623
-  foreach(array(RES_METAL, RES_CRYSTAL) as $resource_id)
623
+  foreach (array(RES_METAL, RES_CRYSTAL) as $resource_id)
624 624
   {
625
-    if($resource_amount = $outcome[UBE_DEBRIS][$resource_id])
625
+    if ($resource_amount = $outcome[UBE_DEBRIS][$resource_id])
626 626
     {
627 627
       $debris[] = array(
628 628
         'NAME' => $lang['tech'][$resource_id],
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 
636 636
   // Координаты, тип и название планеты - если есть
637 637
 //R  $planet_owner_id = $combat_data[UBE_FLEETS][0][UBE_OWNER];
638
-  if(isset($combat_data[UBE_OUTCOME][UBE_PLANET]))
638
+  if (isset($combat_data[UBE_OUTCOME][UBE_PLANET]))
639 639
   {
640 640
     $template_result += $combat_data[UBE_OUTCOME][UBE_PLANET];
641 641
     $template_result[PLANET_NAME] = str_replace(' ', '&nbsp;', htmlentities($template_result[PLANET_NAME], ENT_COMPAT, 'UTF-8'));
Please login to merge, or discard this patch.
includes/includes/market_info.inc 1 patch
Spacing   +12 added lines, -12 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
 {
5 5
   $debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403);
6 6
 }
@@ -15,50 +15,50 @@  discard block
 block discarded – undo
15 15
 ));
16 16
 
17 17
 $info_action = sys_get_param_int('action');
18
-if($info_action)
18
+if ($info_action)
19 19
 {
20 20
   try
21 21
   {
22 22
     sn_db_transaction_start();
23 23
 
24 24
     $user = db_user_by_id($user['id'], true);
25
-    if(mrc_get_level($user, null, RES_DARK_MATTER) < $config->rpg_cost_info)
25
+    if (mrc_get_level($user, null, RES_DARK_MATTER) < $config->rpg_cost_info)
26 26
     {
27 27
       throw new Exception(MARKET_NO_DM, ERR_ERROR);
28 28
     }
29 29
 
30
-    switch($info_action)
30
+    switch ($info_action)
31 31
     {
32 32
       case MARKET_INFO_PLAYER:
33 33
         $user_info_name_unsafe = sys_get_param_str_unsafe('user_info_name');
34
-        if(!$user_info_name_unsafe)
34
+        if (!$user_info_name_unsafe)
35 35
         {
36 36
           throw new Exception(MARKET_INFO_PLAYER_WRONG, ERR_ERROR);
37 37
         }
38 38
 
39
-        if(is_id($user_info_name_unsafe))
39
+        if (is_id($user_info_name_unsafe))
40 40
         {
41 41
           $user_info = db_user_by_id($user_info_name_unsafe, true, '`id`, `username`', true);
42 42
         }
43
-        if(!is_array($user_info))
43
+        if (!is_array($user_info))
44 44
         {
45 45
           $user_info = db_user_by_username($user_info_name_unsafe, true, '`id`, `username`', true, true);
46 46
         }
47
-        if(!is_array($user_info))
47
+        if (!is_array($user_info))
48 48
         {
49 49
           throw new Exception(MARKET_INFO_PLAYER_NOT_FOUND, ERR_ERROR);
50 50
         }
51
-        if($user_info['id'] == $user['id'])
51
+        if ($user_info['id'] == $user['id'])
52 52
         {
53 53
           throw new Exception(MARKET_INFO_PLAYER_SAME, ERR_ERROR);
54 54
         }
55 55
 
56 56
         $msg_text = array();
57
-        foreach(sn_get_groups('mercenaries') as $mercenary_id)
57
+        foreach (sn_get_groups('mercenaries') as $mercenary_id)
58 58
         {
59 59
           $msg_text[] = "{$lang['tech'][$mercenary_id]} - " . (($mercenary_level = mrc_get_level($user_info, false, $mercenary_id)) ? "{$lang['sys_level']} {$mercenary_level}" : $lang['eco_mrk_info_not_hired']);
60 60
         }
61
-        if($mercenary_level = mrc_get_level($user_info, false, UNIT_PREMIUM))
61
+        if ($mercenary_level = mrc_get_level($user_info, false, UNIT_PREMIUM))
62 62
         {
63 63
           $msg_text[] = "{$lang['tech'][UNIT_PREMIUM]} - {$mercenary_level} {$lang['sys_level']}";
64 64
         }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
       break;
73 73
     }
74 74
 
75
-    if(!rpg_points_change($user['id'], RPG_MARKET_INFO_MERCENARY, -$config->rpg_cost_info, "Using Black Market page {$lang['eco_mrk_info']} - getting info about user ID {$user_info['id']}"))
75
+    if (!rpg_points_change($user['id'], RPG_MARKET_INFO_MERCENARY, -$config->rpg_cost_info, "Using Black Market page {$lang['eco_mrk_info']} - getting info about user ID {$user_info['id']}"))
76 76
     {
77 77
       // TODO: throw new Exception(MARKET_INFO_PLAYER_SAME, ERR_ERROR);
78 78
     }
Please login to merge, or discard this patch.