Completed
Push — trunk ( 56d310...72cafa )
by SuperNova.WS
04:23
created
includes/includes/market_info.inc 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,8 +79,7 @@
 block discarded – undo
79 79
 
80 80
     sn_db_transaction_commit();
81 81
     throw new Exception($info_action, ERR_NONE);
82
-  }
83
-  catch (Exception $e)
82
+  } catch (Exception $e)
84 83
   {
85 84
     sn_db_transaction_rollback();
86 85
 
Please login to merge, or discard this 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);
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.
includes/includes/market_trader.inc 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if((!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) && (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)) {
3
+if ((!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) && (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)) {
4 4
   $debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403);
5 5
 }
6 6
 
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
 
28 28
   // $dm_db_name = pname_resource_name(RES_DARK_MATTER);
29 29
   $exchangeTo = in_array($exchangeTo = sys_get_param_int('exchangeTo'), sn_get_groups('resources_trader')) ? $exchangeTo : 0;
30
-  if($exchangeTo && is_array($tradeList = $_POST['spend'])) {
30
+  if ($exchangeTo && is_array($tradeList = $_POST['spend'])) {
31 31
     $value = 0;
32 32
     $qry = array();
33 33
 
34 34
     sn_db_transaction_start();
35
-    if($planetrow['id_owner']) {
35
+    if ($planetrow['id_owner']) {
36 36
       $global_data = sys_o_get_updated($user, $planetrow, SN_TIME_NOW);
37 37
       $planetrow = $global_data['planet'];
38 38
     }
@@ -41,27 +41,27 @@  discard block
 block discarded – undo
41 41
       $user = db_user_by_id($user['id'], true);
42 42
     }
43 43
 
44
-    foreach(sn_get_groups('resources_trader') as $resource_id) {
44
+    foreach (sn_get_groups('resources_trader') as $resource_id) {
45 45
       $amount = floatval($tradeList[$resource_id]);
46
-      if($amount < 0) {
46
+      if ($amount < 0) {
47 47
         $debug->error('Trying to supply negative resource amount on Black Market Page', 'Hack Attempt', 305);
48 48
       }
49 49
 
50
-      if($resource_id == RES_DARK_MATTER && $exchangeTo == RES_DARK_MATTER) {
50
+      if ($resource_id == RES_DARK_MATTER && $exchangeTo == RES_DARK_MATTER) {
51 51
         continue;
52 52
       }
53 53
 
54 54
       $resource_db_name = pname_resource_name($resource_id);
55
-      if($exchangeTo == RES_DARK_MATTER) {
55
+      if ($exchangeTo == RES_DARK_MATTER) {
56 56
         $sign = '+';
57 57
         $amount = floor($tradeList[RES_DARK_MATTER] / 3 * $rates[RES_DARK_MATTER] / $rates[$resource_id]);
58 58
         $value += $amount;
59 59
       } else {
60 60
         $value += floor($amount * $rates[$resource_id] / $rates[$exchangeTo]);
61
-        if($resource_id == RES_DARK_MATTER) {
61
+        if ($resource_id == RES_DARK_MATTER) {
62 62
           $amount = 0;
63 63
         } else {
64
-          if(mrc_get_level($user, $planetrow, $resource_id, true) < $amount) {
64
+          if (mrc_get_level($user, $planetrow, $resource_id, true) < $amount) {
65 65
             $intError = MARKET_NO_RESOURCES;
66 66
             break;
67 67
           }
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
         }
71 71
       }
72 72
 
73
-      if($amount) {
73
+      if ($amount) {
74 74
         $qry[] = "`{$resource_db_name}` = `{$resource_db_name}` {$sign} {$amount}";
75 75
       }
76 76
     }
77 77
 
78
-    if($exchangeTo != RES_DARK_MATTER) {
78
+    if ($exchangeTo != RES_DARK_MATTER) {
79 79
       $amount = floor($value);
80 80
       $exchange_to_db_name = pname_resource_name($exchangeTo);
81 81
       $qry[] = "`{$exchange_to_db_name}` = `{$exchange_to_db_name}` + {$amount}";
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     $intError = $value <= 0 ? MARKET_ZERO_DEAL : $intError;
87 87
     $intError = mrc_get_level($user, null, RES_DARK_MATTER) < $operation_cost ? MARKET_NO_DM : $intError;
88 88
 
89
-    if($intError == MARKET_DEAL) {
89
+    if ($intError == MARKET_DEAL) {
90 90
       $qry = implode(', ', $qry);
91 91
       $table = $planetrow['id_owner'] ? 'planets' : 'users';
92 92
 
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
     'EXCHANGE_TO_RESOURCE_ID' => $exchangeTo,
112 112
   ));
113 113
 
114
-  foreach(sn_get_groups('resources_trader') as $resource_id) {
115
-    if($resource_id == RES_DARK_MATTER) {
114
+  foreach (sn_get_groups('resources_trader') as $resource_id) {
115
+    if ($resource_id == RES_DARK_MATTER) {
116 116
       $amount = floor(mrc_get_level($user, null, RES_DARK_MATTER) - $config->rpg_cost_trader);
117 117
     } else {
118 118
       $amount = floor(mrc_get_level($user, $planetrow, $resource_id));
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,8 +35,7 @@
 block discarded – undo
35 35
     if($planetrow['id_owner']) {
36 36
       $global_data = sys_o_get_updated($user, $planetrow, SN_TIME_NOW);
37 37
       $planetrow = $global_data['planet'];
38
-    }
39
-    else {
38
+    } else {
40 39
       // Locking user record
41 40
       $user = db_user_by_id($user['id'], true);
42 41
     }
Please login to merge, or discard this patch.
includes/includes/user_birthday_celebrate.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 
9 9
   $query = db_user_list_to_celebrate($config->user_birthday_range);
10 10
 
11
-  while($row = db_fetch($query))
11
+  while ($row = db_fetch($query))
12 12
   {
13 13
     $row['username'] = db_escape($row['username']);
14 14
     rpg_points_change($row['id'], RPG_BIRTHDAY, $config->user_birthday_gift, "Birthday gift for user {$row['username']} ID {$row['id']} on his birthday on {$row['user_birthday']}. Gift last gaved at {$row['user_birthday_celebrated']}");
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-function sn_user_birthday_celebrate()
4
-{
3
+function sn_user_birthday_celebrate() {
5 4
   global $config, $lang;
6 5
 
7 6
   sn_db_transaction_start();
Please login to merge, or discard this patch.
includes/includes/flt_mission_colonize.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,12 +17,12 @@  discard block
 block discarded – undo
17 17
 
18 18
   global $lang;
19 19
 
20
-  $TargetAdress = sprintf ($lang['sys_adress_planet'], $fleet_row['fleet_end_galaxy'], $fleet_row['fleet_end_system'], $fleet_row['fleet_end_planet']);
20
+  $TargetAdress = sprintf($lang['sys_adress_planet'], $fleet_row['fleet_end_galaxy'], $fleet_row['fleet_end_system'], $fleet_row['fleet_end_planet']);
21 21
 
22 22
   $fleet_array = sys_unit_str2arr($fleet_row['fleet_array']);
23 23
 
24 24
   $TheMessage = $lang['sys_colo_no_colonizer'];
25
-  if($fleet_array[SHIP_COLONIZER] >= 1)
25
+  if ($fleet_array[SHIP_COLONIZER] >= 1)
26 26
   {
27 27
     $TheMessage = $lang['sys_colo_notfree'];
28 28
     if (!$mission_data['dst_planet'] || empty($mission_data['dst_planet']))
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
       // Can we colonize more planets?
33 33
       $TheMessage = $lang['sys_colo_maxcolo'];
34
-      if($iPlanetCount < get_player_max_colonies($src_user_row))
34
+      if ($iPlanetCount < get_player_max_colonies($src_user_row))
35 35
       {
36 36
         // Yes, we can colonize
37 37
         $TheMessage = $lang['sys_colo_badpos'];
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         if ($NewOwnerPlanet)
43 43
         {
44 44
           $TheMessage = $lang['sys_colo_arrival'] . $TargetAdress . $lang['sys_colo_allisok'];
45
-          msg_send_simple_message ( $fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_SPY, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], $TheMessage);
45
+          msg_send_simple_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_SPY, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], $TheMessage);
46 46
 
47 47
           $fleet_array[SHIP_COLONIZER]--;
48 48
           $fleet_row['fleet_amount']--;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,8 +10,7 @@
 block discarded – undo
10 10
 // ----------------------------------------------------------------------------------------------------------------
11 11
 // Mission Case 9: -> Coloniser
12 12
 //
13
-function flt_mission_colonize(&$mission_data)
14
-{
13
+function flt_mission_colonize(&$mission_data) {
15 14
   $fleet_row          = &$mission_data['fleet'];
16 15
   $src_user_row       = &$mission_data['src_user'];
17 16
 
Please login to merge, or discard this patch.
includes/pages/battle_report.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 
16 16
   $combat_data = sn_ube_report_load(sys_get_param_str('cypher'));
17 17
 
18
-  if($combat_data != UBE_REPORT_NOT_FOUND) {
18
+  if ($combat_data != UBE_REPORT_NOT_FOUND) {
19 19
     sn_ube_report_generate($combat_data, $template_result);
20 20
     $template = gettemplate('ube_combat_report', $template);
21 21
     $template->assign_vars(array(
Please login to merge, or discard this patch.
includes/pages/techtree.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@
 block discarded – undo
14 14
   global $lang, $user, $planetrow;
15 15
 
16 16
   $tech_tree = array();
17
-  foreach(get_unit_param('techtree') as $unit_group_id => $unit_list)
17
+  foreach (get_unit_param('techtree') as $unit_group_id => $unit_list)
18 18
   {
19 19
     $tech_tree[] = array(
20 20
       'NAME' => $lang['tech'][$unit_group_id],
21 21
       'GROUP_ID' => $unit_group_id,
22 22
     );
23 23
 
24
-    foreach($unit_list as $unit_id)
24
+    foreach ($unit_list as $unit_id)
25 25
     {
26 26
       $sn_data_unit = get_unit_param($unit_id);
27 27
       $level_basic = $sn_data_unit[P_STACKABLE] ? 0 : mrc_get_level($user, $planetrow, $unit_id, false, true);
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,7 @@
 block discarded – undo
6 6
  * version 2.0 copyright (c) 2012 by Gorlum for http://supernova.ws
7 7
  */
8 8
 
9
-function sn_techtree_view($template = null)
10
-{
9
+function sn_techtree_view($template = null) {
11 10
   global $lang, $user, $planetrow;
12 11
 
13 12
   $tech_tree = array();
Please login to merge, or discard this patch.
includes/functions/geoip.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-function geoip_status(){return sn_function_call('geoip_status', array(&$result));}
3
+function geoip_status() {return sn_function_call('geoip_status', array(&$result)); }
4 4
 function sn_geoip_status(&$result) {
5 5
   return $result = false;
6 6
 }
7 7
 
8
-function geoip_ip_info($ip){return sn_function_call('geoip_ip_info', array($ip, &$result));}
8
+function geoip_ip_info($ip) {return sn_function_call('geoip_ip_info', array($ip, &$result)); }
9 9
 function sn_geoip_ip_info($ip, &$result) {
10 10
   return $result = false;
11 11
 }
Please login to merge, or discard this patch.
includes/functions/rpg_points.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -85,28 +85,28 @@  discard block
 block discarded – undo
85 85
 function rpg_points_change($user_id, $change_type, $dark_matter, $comment = false, $already_changed = false) {
86 86
   global $debug, $config, $dm_change_legit, $user;
87 87
 
88
-  if(!$user_id) {
88
+  if (!$user_id) {
89 89
     return false;
90 90
   }
91 91
 
92 92
   $dm_change_legit = true;
93 93
   $sn_data_dark_matter_db_name = pname_resource_name(RES_DARK_MATTER);
94 94
 
95
-  if($already_changed) {
95
+  if ($already_changed) {
96 96
     $rows_affected = 1;
97 97
   } else {
98 98
     $changeset = array();
99 99
     $a_user = db_user_by_id($user_id, true);
100
-    if($dark_matter < 0) {
100
+    if ($dark_matter < 0) {
101 101
       $dark_matter_exists = mrc_get_level($a_user, null, RES_DARK_MATTER, false, true);
102 102
       $dark_matter_exists < 0 ? $dark_matter_exists = 0 : false;
103 103
       $metamatter_to_reduce = -$dark_matter - $dark_matter_exists;
104
-      if($metamatter_to_reduce > 0) {
104
+      if ($metamatter_to_reduce > 0) {
105 105
         $metamatter_exists = mrc_get_level($a_user, null, RES_METAMATTER);
106
-        if($metamatter_exists < $metamatter_to_reduce) {
106
+        if ($metamatter_exists < $metamatter_to_reduce) {
107 107
           $debug->error('Ошибка снятия ТМ - ММ+ТМ меньше, чем сумма для снятия!', 'Ошибка снятия ТМ', LOG_ERR_INT_NOT_ENOUGH_DARK_MATTER);
108 108
         }
109
-        if(is_array($comment)) {
109
+        if (is_array($comment)) {
110 110
           $comment = call_user_func_array('sprintf', $comment);
111 111
         }
112 112
 //        mm_points_change($user_id, $change_type, -$metamatter_to_reduce, 'ММ в ТМ: ' . (-$dark_matter) . ' ТМ = ' . $dark_matter_exists . ' ТМ + ' . $metamatter_to_reduce . ' ММ. ' . $comment);
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
     $rows_affected = classSupernova::$db->db_affected_rows();
122 122
   }
123 123
 
124
-  if($rows_affected || !$dark_matter) {
124
+  if ($rows_affected || !$dark_matter) {
125 125
     $page_url = db_escape($_SERVER['SCRIPT_NAME']);
126
-    if(is_array($comment)) {
126
+    if (is_array($comment)) {
127 127
       $comment = call_user_func_array('sprintf', $comment);
128 128
     }
129 129
     $comment = db_escape($comment);
@@ -137,18 +137,18 @@  discard block
 block discarded – undo
137 137
         {$dark_matter}, '{$comment}', '{$page_url}', {$user_id}
138 138
       );");
139 139
 
140
-    if($user['id'] == $user_id) {
140
+    if ($user['id'] == $user_id) {
141 141
       $user['dark_matter'] += $dark_matter;
142 142
     }
143 143
 
144
-    if($dark_matter > 0) {
144
+    if ($dark_matter > 0) {
145 145
       $old_referral = doquery("SELECT * FROM {{referrals}} WHERE `id` = {$user_id} LIMIT 1 FOR UPDATE;", '', true);
146
-      if($old_referral['id']) {
146
+      if ($old_referral['id']) {
147 147
         doquery("UPDATE {{referrals}} SET dark_matter = dark_matter + '{$dark_matter}' WHERE `id` = {$user_id} LIMIT 1;");
148 148
         $new_referral = doquery("SELECT * FROM {{referrals}} WHERE `id` = {$user_id} LIMIT 1;", '', true);
149 149
 
150 150
         $partner_bonus = floor($new_referral['dark_matter'] / $config->rpg_bonus_divisor) - ($old_referral['dark_matter'] >= $config->rpg_bonus_minimum ? floor($old_referral['dark_matter'] / $config->rpg_bonus_divisor) : 0);
151
-        if($partner_bonus > 0 && $new_referral['dark_matter'] >= $config->rpg_bonus_minimum) {
151
+        if ($partner_bonus > 0 && $new_referral['dark_matter'] >= $config->rpg_bonus_minimum) {
152 152
           rpg_points_change($new_referral['id_partner'], RPG_REFERRAL, $partner_bonus, "Incoming From Referral ID {$user_id}");
153 153
         }
154 154
       }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 {
166 166
   $q = 1.03;
167 167
 
168
-  switch($type)
168
+  switch ($type)
169 169
   {
170 170
     case RPG_STRUCTURE:
171 171
       $field_level = 'lvl_minier';
@@ -203,19 +203,19 @@  discard block
 block discarded – undo
203 203
 
204 204
   $xp = &$user[$field_xp];
205 205
 
206
-  if($xp_to_add)
206
+  if ($xp_to_add)
207 207
   {
208 208
     $xp += $xp_to_add;
209 209
     db_user_set_by_id($user['id'], "`{$field_xp}` = `{$field_xp}` + '{$xp_to_add}'");
210 210
   }
211 211
 
212 212
   $level = $user[$field_level];
213
-  while($xp > rpg_xp_for_level($level + 1, $b1, $q))
213
+  while ($xp > rpg_xp_for_level($level + 1, $b1, $q))
214 214
   {
215 215
     $level++;
216 216
   }
217 217
   $level -= $user[$field_level];
218
-  if($level > 0)
218
+  if ($level > 0)
219 219
   {
220 220
     db_user_set_by_id($user['id'], "`{$field_level}` = `{$field_level}` + '{$level}'");
221 221
     rpg_points_change($user['id'], $type, $level * 1000, $comment);
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 
226 226
 function rpg_xp_for_level($level, $b1, $q)
227 227
 {
228
-  return floor($b1 * (pow($q, $level) - 1)/($q - 1));
228
+  return floor($b1 * (pow($q, $level) - 1) / ($q - 1));
229 229
 }
230 230
 
231 231
 function rpg_get_miner_xp($level)
Please login to merge, or discard this patch.
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -161,8 +161,7 @@  discard block
 block discarded – undo
161 161
   return $rows_affected;
162 162
 }
163 163
 
164
-function rpg_level_up(&$user, $type, $xp_to_add = 0)
165
-{
164
+function rpg_level_up(&$user, $type, $xp_to_add = 0) {
166 165
   $q = 1.03;
167 166
 
168 167
   switch($type)
@@ -223,27 +222,22 @@  discard block
 block discarded – undo
223 222
   }
224 223
 }
225 224
 
226
-function rpg_xp_for_level($level, $b1, $q)
227
-{
225
+function rpg_xp_for_level($level, $b1, $q) {
228 226
   return floor($b1 * (pow($q, $level) - 1)/($q - 1));
229 227
 }
230 228
 
231
-function rpg_get_miner_xp($level)
232
-{
229
+function rpg_get_miner_xp($level) {
233 230
   return rpg_xp_for_level($level, 50, 1.03);
234 231
 }
235 232
 
236
-function RPG_get_raider_xp($level)
237
-{
233
+function RPG_get_raider_xp($level) {
238 234
   return rpg_xp_for_level($level, 10, 1.03);
239 235
 }
240 236
 
241
-function rpg_get_tech_xp($level)
242
-{
237
+function rpg_get_tech_xp($level) {
243 238
   return rpg_xp_for_level($level, 50, 1.03);
244 239
 }
245 240
 
246
-function rpg_get_explore_xp($level)
247
-{
241
+function rpg_get_explore_xp($level) {
248 242
   return rpg_xp_for_level($level, 10, 1.05);
249 243
 }
Please login to merge, or discard this patch.
search.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,8 +61,7 @@
 block discarded – undo
61 61
         'ALLY_NAME' => htmlentities($row['ally_name'], ENT_COMPAT, 'UTF-8'),
62 62
         'ALLY_TAG' => htmlentities($row['ally_tag'], ENT_COMPAT, 'UTF-8'),
63 63
       ));
64
-    }
65
-    elseif($type=='ally')
64
+    } elseif($type=='ally')
66 65
     {
67 66
       $template->assign_block_vars('search_result', array(
68 67
         'ALLY_NAME' => htmlentities($row['ally_name'], ENT_COMPAT, 'UTF-8'),
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 include('common.' . substr(strrchr(__FILE__, '.'), 1));
14 14
 
15
-if(classSupernova::$config->game_mode == GAME_BLITZ) {
15
+if (classSupernova::$config->game_mode == GAME_BLITZ) {
16 16
   messageBox($lang['sys_blitz_page_disabled'], $lang['sys_error'], 'overview.php', 10);
17 17
   die();
18 18
 }
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
 
26 26
 $template = gettemplate('search', true);
27 27
 
28
-if($searchtext && $type)
28
+if ($searchtext && $type)
29 29
 {
30
-  switch($type)
30
+  switch ($type)
31 31
   {
32 32
     case "planetname":
33 33
       // $search = db_planet_list_search($searchtext);
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
     break;
44 44
   }
45 45
 
46
-  while($row = db_fetch($search))
46
+  while ($row = db_fetch($search))
47 47
   {
48
-    if($type=='playername' || $type=='planetname')
48
+    if ($type == 'playername' || $type == 'planetname')
49 49
     {
50 50
       $template->assign_block_vars('search_result', array(
51 51
         'PLAYER_ID' => $row['uid'],
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         'ALLY_TAG' => htmlentities($row['ally_tag'], ENT_COMPAT, 'UTF-8'),
63 63
       ));
64 64
     }
65
-    elseif($type=='ally')
65
+    elseif ($type == 'ally')
66 66
     {
67 67
       $template->assign_block_vars('search_result', array(
68 68
         'ALLY_NAME' => htmlentities($row['ally_name'], ENT_COMPAT, 'UTF-8'),
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
   'ally' => 'sys_alliance',
82 82
 );
83 83
 
84
-foreach($search_type as $type_id => $type_lang)
84
+foreach ($search_type as $type_id => $type_lang)
85 85
 {
86 86
   $template->assign_block_vars('type', array(
87 87
     'ID' => $type_id,
Please login to merge, or discard this patch.