Completed
Branch work-fleets (4d76fa)
by SuperNova.WS
05:23
created
includes/alliance/ali_internal_admin_mail.inc 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 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
 
7
-if(!$user_can_send_mails) {
7
+if (!$user_can_send_mails) {
8 8
   message(classLocale::$lang['Denied_access'], classLocale::$lang['Send_circular_mail']);
9 9
 }
10 10
 
11 11
 $POST_text = sys_get_param_str('text');
12
-if($POST_text) {
12
+if ($POST_text) {
13 13
   message(classLocale::$lang['members_who_recived_message'] . msg_ali_send($POST_text, classLocale::$lang['ali_adm_msg_subject'], sys_get_param_int('r')), classLocale::$lang['Circular_sended'], "alliance.php", '');
14 14
 }
15 15
 
16 16
 $r_list = "<option value=\"-1\">" . classLocale::$lang['All_players'] . "</option>";
17
-if($ranks) {
18
-  foreach($ranks as $id => $array) {
17
+if ($ranks) {
18
+  foreach ($ranks as $id => $array) {
19 19
     $r_list .= "<option value=\"" . $id . "\">" . $array['name'] . "</option>";
20 20
   }
21 21
 }
Please login to merge, or discard this patch.
admin/admin_chat.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
 
15 15
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
16 16
 
17
-if($user['authlevel'] < 3) {
17
+if ($user['authlevel'] < 3) {
18 18
   AdminMessage(classLocale::$lang['adm_err_denied']);
19 19
 }
20 20
 
21
-if($delete = sys_get_param_str('delete')) {
21
+if ($delete = sys_get_param_str('delete')) {
22 22
   db_chat_message_delete($delete);
23
-} elseif(sys_get_param_str('deleteall') == 'yes') {
23
+} elseif (sys_get_param_str('deleteall') == 'yes') {
24 24
   db_chat_message_purge();
25 25
 }
26 26
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 $query = db_chat_message_get_last_25();
30 30
 $i = 0;
31
-while($e = db_fetch($query)) {
31
+while ($e = db_fetch($query)) {
32 32
   $i++;
33 33
   $template->assign_block_vars('messages', array(
34 34
     'ID' => $e['messageid'],
Please login to merge, or discard this patch.
admin/banned.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
18 18
 
19
-if($user['authlevel'] < 1) {
19
+if ($user['authlevel'] < 1) {
20 20
   AdminMessage(classLocale::$lang['adm_err_denied']);
21 21
 }
22 22
 
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
 $template = gettemplate("admin/admin_ban", true);
29 29
 
30 30
 $player_banned_row = db_user_by_username($name_unsafe);
31
-if($mode == 'banit' && $action) {
32
-  if($player_banned_row) {
31
+if ($mode == 'banit' && $action) {
32
+  if ($player_banned_row) {
33 33
     $reas = $_POST['why'];
34 34
     $days = $_POST['days'];
35 35
     $hour = $_POST['hour'];
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     $adm_bn_thpl = classLocale::$lang['adm_bn_thpl'];
50 50
     $DoneMessage = "{$adm_bn_thpl} {$name_output} {$adm_bn_isbn}";
51 51
 
52
-    if($is_vacation) {
52
+    if ($is_vacation) {
53 53
       $DoneMessage .= classLocale::$lang['adm_bn_vctn'];
54 54
     }
55 55
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
   }
60 60
 
61 61
   AdminMessage($DoneMessage, classLocale::$lang['adm_ban_title']);
62
-} elseif($mode == 'unbanit' && $action) {
62
+} elseif ($mode == 'unbanit' && $action) {
63 63
   sys_admin_player_ban_unset($user, $player_banned_row, ($reason = sys_get_param_str('why')) ? $reason : classLocale::$lang['sys_unbanned']);
64 64
 
65 65
   $DoneMessage = classLocale::$lang['adm_unbn_thpl'] . " " . $name_output . " " . classLocale::$lang['adm_unbn_isbn'];
Please login to merge, or discard this patch.
includes/includes/flt_page4.inc 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -2,28 +2,28 @@  discard block
 block discarded – undo
2 2
 
3 3
 $classLocale = classLocale::$lang;
4 4
 
5
-if(SN_IN_FLEET !== true) {
5
+if (SN_IN_FLEET !== true) {
6 6
   $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403);
7 7
 }
8 8
 
9 9
 $fleetid = sys_get_param_id('fleetid');
10 10
 
11
-if(!is_numeric($fleetid) || empty($fleetid)) {
11
+if (!is_numeric($fleetid) || empty($fleetid)) {
12 12
   header("Location: fleet.php");
13 13
   exit();
14 14
 }
15 15
 
16 16
 $objFleet = new Fleet();
17 17
 $objFleet->dbLoad($fleetid);
18
-if(!$objFleet->dbId) {
18
+if (!$objFleet->dbId) {
19 19
   message(classLocale::$lang['fl_fleet_not_exists'], classLocale::$lang['fl_error']);
20 20
 }
21 21
 
22
-if($objFleet->time_arrive_to_target <= SN_TIME_NOW || $objFleet->time_return_to_source < SN_TIME_NOW || $objFleet->isReturning()) {
22
+if ($objFleet->time_arrive_to_target <= SN_TIME_NOW || $objFleet->time_return_to_source < SN_TIME_NOW || $objFleet->isReturning()) {
23 23
   message(classLocale::$lang['fl_isback'], classLocale::$lang['fl_error']);
24 24
 }
25 25
 
26
-if($objFleet->playerOwnerId != $user['id']) {
26
+if ($objFleet->playerOwnerId != $user['id']) {
27 27
   $debug->warning(classLocale::$lang['fl_aks_hack_wrong_fleet'], 'Wrong Fleet Owner', 301);
28 28
   message(classLocale::$lang['fl_aks_hack_wrong_fleet'], classLocale::$lang['fl_error']);
29 29
 }
@@ -34,19 +34,19 @@  discard block
 block discarded – undo
34 34
 
35 35
 !$aks && !$userToAdd_unsafe ? $userToAdd_unsafe = $user['username'] : false;
36 36
 
37
-if($userToAdd_unsafe) {
37
+if ($userToAdd_unsafe) {
38 38
   $userToAdd = db_escape($userToAdd_unsafe);
39 39
   $userToAddID = db_user_by_username($userToAdd_unsafe, false, 'id', true, true);
40 40
   $userToAddID = $userToAddID['id'];
41 41
 
42
-  if($objFleet->target_owner_id == $userToAddID) {
42
+  if ($objFleet->target_owner_id == $userToAddID) {
43 43
     message(classLocale::$lang['flt_aks_player_same'], classLocale::$lang['fl_error']);
44 44
   }
45 45
 
46
-  if($userToAddID) {
47
-    if(!$aks) {
46
+  if ($userToAddID) {
47
+    if (!$aks) {
48 48
       // No AСS exists - making one
49
-      if(!$objFleet->group_id) {
49
+      if (!$objFleet->group_id) {
50 50
         db_acs_insert($fleetid, $user, $objFleet);
51 51
 
52 52
         $aks = db_acs_get_by_fleet($fleetid);
@@ -61,17 +61,17 @@  discard block
 block discarded – undo
61 61
 
62 62
     $isUserExists = false;
63 63
     $invited_ar = explode(",", $aks['eingeladen']);
64
-    foreach($invited_ar as $inv) {
65
-      if($userToAddID == $inv) {
64
+    foreach ($invited_ar as $inv) {
65
+      if ($userToAddID == $inv) {
66 66
         $isUserExists = true;
67 67
       }
68 68
     }
69 69
 
70
-    if(count($invited_ar) >= 5) {
70
+    if (count($invited_ar) >= 5) {
71 71
       message(classLocale::$lang['flt_aks_error_too_much_players'], classLocale::$lang['fl_error']);
72 72
     }
73 73
 
74
-    if($isUserExists) {
74
+    if ($isUserExists) {
75 75
       $userToAdd_unsafe != $user['username'] ? $add_user_message_mr = sprintf(classLocale::$lang['fl_aks_player_invited_already'], $userToAdd) : false;
76 76
     } else {
77 77
       $add_user_message_mr = sprintf(classLocale::$lang['fl_aks_player_invited'], $userToAdd);
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
   'MISSION_NAME' => classLocale::$lang['type_mission'][MT_AKS],
94 94
 ));
95 95
 
96
-if($aks['eingeladen'] && is_array($members = classSupernova::db_get_record_list(LOC_USER, "`id` in ({$aks['eingeladen']})")) && !empty($members)) {
97
-  foreach($members as $row) {
96
+if ($aks['eingeladen'] && is_array($members = classSupernova::db_get_record_list(LOC_USER, "`id` in ({$aks['eingeladen']})")) && !empty($members)) {
97
+  foreach ($members as $row) {
98 98
     $template->assign_block_vars('invited', array(
99 99
       'NAME' => $row['username'],
100 100
     ));
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 $fleet_data = tplParseFleetObject($objFleet, $i, $user);
120 120
 
121 121
 $template->assign_block_vars('fleets', $fleet_data['fleet']);
122
-foreach($fleet_data['ships'] as $ship_data) {
122
+foreach ($fleet_data['ships'] as $ship_data) {
123 123
   $template->assign_block_vars('fleets.ships', $ship_data);
124 124
 }
125 125
 
Please login to merge, or discard this patch.
infos.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -47,20 +47,20 @@  discard block
 block discarded – undo
47 47
   ));
48 48
 
49 49
   $ActualProd = floor($Prod[$BuildID]);
50
-  if($BuildID != STRUC_MINE_FUSION) {
50
+  if ($BuildID != STRUC_MINE_FUSION) {
51 51
     $ActualNeed = floor($Prod[STRUC_MINE_SOLAR]);
52 52
   } else {
53 53
     $ActualNeed = floor($Prod[STRUC_MINE_DEUTERIUM]);
54 54
   }
55 55
 
56 56
   $BuildStartLvl = $CurrentBuildtLvl - 2;
57
-  if($BuildStartLvl < 1) {
57
+  if ($BuildStartLvl < 1) {
58 58
     $BuildStartLvl = 1;
59 59
   }
60 60
   $Table = '';
61 61
   $ProdFirst = 0;
62
-  for($BuildLevel = $BuildStartLvl; $BuildLevel < $BuildStartLvl + 10; $BuildLevel++) {
63
-    if($BuildID != STRUC_MOON_PHALANX) {
62
+  for ($BuildLevel = $BuildStartLvl; $BuildLevel < $BuildStartLvl + 10; $BuildLevel++) {
63
+    if ($BuildID != STRUC_MOON_PHALANX) {
64 64
       $Prod[STRUC_MINE_METAL] = floor(mrc_modify_value(
65 65
         $CurrentUser,
66 66
         $CurrentPlanet,
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
       ));
88 88
 
89 89
       $bloc['build_lvl'] = ($CurrentBuildtLvl == $BuildLevel) ? "<font color=\"#ff0000\">" . $BuildLevel . "</font>" : $BuildLevel;
90
-      if($ProdFirst > 0) {
91
-        if($BuildID != STRUC_MINE_FUSION) {
90
+      if ($ProdFirst > 0) {
91
+        if ($BuildID != STRUC_MINE_FUSION) {
92 92
           $bloc['build_gain'] = "<font color=\"lime\">(" . pretty_number(floor($Prod[$BuildID] - $ProdFirst)) . ")</font>";
93 93
         } else {
94 94
           $bloc['build_gain'] = "<font color=\"lime\">(" . pretty_number(floor($Prod[STRUC_MINE_SOLAR] - $ProdFirst)) . ")</font>";
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
       } else {
97 97
         $bloc['build_gain'] = '';
98 98
       }
99
-      if($BuildID != STRUC_MINE_FUSION) {
99
+      if ($BuildID != STRUC_MINE_FUSION) {
100 100
         $bloc['build_prod'] = pretty_number(floor($Prod[$BuildID]));
101 101
         $bloc['build_prod_diff'] = pretty_number(floor($Prod[$BuildID] - $ActualProd), true, true);
102 102
         $bloc['build_need'] = pretty_number(floor($Prod[STRUC_MINE_SOLAR]), true, true);
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
         $bloc['build_need'] = pretty_number(floor($Prod[STRUC_MINE_DEUTERIUM]), true, true);
108 108
         $bloc['build_need_diff'] = pretty_number(floor($Prod[STRUC_MINE_DEUTERIUM] - $ActualNeed), true, true);
109 109
       }
110
-      if($ProdFirst == 0) {
111
-        if($BuildID != STRUC_MINE_FUSION) {
110
+      if ($ProdFirst == 0) {
111
+        if ($BuildID != STRUC_MINE_FUSION) {
112 112
           $ProdFirst = floor($Prod[$BuildID]);
113 113
         } else {
114 114
           $ProdFirst = floor($Prod[STRUC_MINE_SOLAR]);
@@ -133,22 +133,22 @@  discard block
 block discarded – undo
133 133
 
134 134
   $str_rapid_from = '';
135 135
   $str_rapid_to = '';
136
-  foreach(sn_get_groups(array('fleet', 'defense_active')) as $enemy_id) {
136
+  foreach (sn_get_groups(array('fleet', 'defense_active')) as $enemy_id) {
137 137
     $enemy_data = get_unit_param($enemy_id);
138 138
     $enemy_durability = $enemy_data['shield'] + $enemy_data['armor'];
139 139
 
140 140
     $rapid = floor($unit_data['attack'] * (isset($unit_data['amplify'][$enemy_id]) ? $unit_data['amplify'][$enemy_id] : 1) / $enemy_durability);
141
-    if($rapid >= 1) {
141
+    if ($rapid >= 1) {
142 142
       $str_rapid_to .= "{$classLocale['nfo_rf_again']} {$classLocale['tech'][$enemy_id]} <font color=\"#00ff00\">{$rapid}</font><br>";
143 143
     }
144 144
 
145 145
     $rapid = floor($enemy_data['attack'] * (isset($enemy_data['amplify'][$unit_id]) ? $enemy_data['amplify'][$unit_id] : 1) / $unit_durability);
146
-    if($rapid >= 1) {
146
+    if ($rapid >= 1) {
147 147
       $str_rapid_from .= "{$classLocale['tech'][$enemy_id]} {$classLocale['nfo_rf_from']} <font color=\"#ff0000\">{$rapid}</font><br>";
148 148
     }
149 149
   }
150 150
 
151
-  if($str_rapid_to && $str_rapid_from) {
151
+  if ($str_rapid_to && $str_rapid_from) {
152 152
     $str_rapid_to .= '<hr>';
153 153
   }
154 154
 
@@ -156,16 +156,16 @@  discard block
 block discarded – undo
156 156
 }
157 157
 
158 158
 $unit_id = sys_get_param_id('gid');
159
-if($unit_id == RES_DARK_MATTER) {
159
+if ($unit_id == RES_DARK_MATTER) {
160 160
   sys_redirect('dark_matter.php');
161 161
 }
162 162
 
163
-if($unit_id == RES_METAMATTER) {
163
+if ($unit_id == RES_METAMATTER) {
164 164
   sys_redirect('metamatter.php');
165 165
 }
166 166
 
167 167
 lng_include('infos');
168
-if(!$unit_id || (!get_unit_param($unit_id) && !isset(classLocale::$lang['info'][$unit_id]))) {
168
+if (!$unit_id || (!get_unit_param($unit_id) && !isset(classLocale::$lang['info'][$unit_id]))) {
169 169
   sys_redirect('index.php?page=techtree');
170 170
 }
171 171
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 $unit_data = get_unit_param($unit_id);
175 175
 $unit_type = $unit_data['type'];
176 176
 
177
-if($unit_type == UNIT_SHIPS) {
177
+if ($unit_type == UNIT_SHIPS) {
178 178
   $template_result['UNIT_IS_SHIP'] = true;
179 179
 
180 180
   $ship_data = get_ship_data($unit_id, $user);
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
   );
191 191
 
192 192
   $engine_template_info = array();
193
-  foreach($unit_data['engine'] as $unit_engine_data) {
193
+  foreach ($unit_data['engine'] as $unit_engine_data) {
194 194
     $unit_engine_data = get_engine_data($user, $unit_engine_data);
195 195
 
196 196
     $engine_template_info[] = array(
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 
210 210
 
211 211
 $sn_data_group_combat = sn_get_groups('combat');
212
-if(in_array($unit_id, $sn_data_group_combat)) {
212
+if (in_array($unit_id, $sn_data_group_combat)) {
213 213
   $template_result['UNIT_IS_COMBAT'] = true;
214 214
 
215 215
   $unit_durability = $unit_data['shield'] + $unit_data['armor'];
@@ -217,21 +217,21 @@  discard block
 block discarded – undo
217 217
   $volley_arr = $rapid_to = $rapid_from = array();
218 218
   $str_rapid_from = '';
219 219
   $str_rapid_to = '';
220
-  foreach($sn_data_group_combat as $enemy_id) {
220
+  foreach ($sn_data_group_combat as $enemy_id) {
221 221
     $enemy_data = get_unit_param($enemy_id);
222 222
     $enemy_durability = $enemy_data['shield'] + $enemy_data['armor'];
223 223
 
224 224
     $rapid = $unit_data['attack'] * (isset($unit_data['amplify'][$enemy_id]) ? $unit_data['amplify'][$enemy_id] : 1) / $enemy_durability;
225
-    if($rapid >= 1) {
225
+    if ($rapid >= 1) {
226 226
       $volley_arr[$enemy_id]['TO'] = floor($rapid);
227 227
     }
228 228
 
229 229
     $rapid = $enemy_data['attack'] * (isset($enemy_data['amplify'][$unit_id]) ? $enemy_data['amplify'][$unit_id] : 1) / $unit_durability;
230
-    if($rapid >= 1) {
230
+    if ($rapid >= 1) {
231 231
       $volley_arr[$enemy_id]['FROM'] = floor($rapid);
232 232
     }
233 233
   }
234
-  foreach($volley_arr as $enemy_id => &$rapid) {
234
+  foreach ($volley_arr as $enemy_id => &$rapid) {
235 235
     $rapid['ENEMY_ID'] = $enemy_id;
236 236
     $rapid['ENEMY_NAME'] = classLocale::$lang['tech'][$enemy_id];
237 237
   }
@@ -249,11 +249,11 @@  discard block
 block discarded – undo
249 249
 
250 250
 }
251 251
 
252
-if(classLocale::$lang['info'][$unit_id]['effect']) {
252
+if (classLocale::$lang['info'][$unit_id]['effect']) {
253 253
   $template_result['UNIT_EFFECT'] = classLocale::$lang['info'][$unit_id]['effect'];
254 254
 }
255 255
 
256
-if($unit_data['bonus']) {
256
+if ($unit_data['bonus']) {
257 257
   $unit_bonus = !$unit_data['bonus'] || $unit_data['bonus_type'] == BONUS_ABILITY ? '' : (
258 258
     ($unit_data['bonus'] >= 0 ? '+' : '') . $unit_data['bonus'] . ($unit_data['bonus_type'] == BONUS_PERCENT ? '%' : '')
259 259
   );
Please login to merge, or discard this patch.
includes/classes/Account.php 2 patches
Doc Comments   +21 added lines patch added patch discarded remove patch
@@ -171,6 +171,10 @@  discard block
 block discarded – undo
171 171
    * @return bool
172 172
    */
173 173
   // OK v4.5
174
+
175
+  /**
176
+   * @param string $account_name_unsafe
177
+   */
174 178
   public function db_get_by_name($account_name_unsafe) {
175 179
     $this->reset();
176 180
 
@@ -207,6 +211,11 @@  discard block
 block discarded – undo
207 211
    *
208 212
    */
209 213
   // OK v4.5
214
+
215
+  /**
216
+   * @param string $account_name_unsafe
217
+   * @param string $email_unsafe
218
+   */
210 219
   public function db_get_by_name_or_email($account_name_unsafe, $email_unsafe) {
211 220
     $this->reset();
212 221
 
@@ -223,6 +232,13 @@  discard block
 block discarded – undo
223 232
    * @throws Exception
224 233
    */
225 234
   // OK v4.5
235
+
236
+  /**
237
+   * @param string $account_name_unsafe
238
+   * @param string $password_raw
239
+   * @param string $email_unsafe
240
+   * @param string $language_unsafe
241
+   */
226 242
   public function db_create($account_name_unsafe, $password_raw, $email_unsafe, $language_unsafe = null, $salt_unsafe = null) {
227 243
     $this->reset();
228 244
 
@@ -317,6 +333,11 @@  discard block
 block discarded – undo
317 333
    * @return int|string
318 334
    */
319 335
   // OK 4.8
336
+
337
+  /**
338
+   * @param integer $change_type
339
+   * @param double $metamatter
340
+   */
320 341
   protected function db_mm_log_insert($comment, $change_type, $metamatter, $user_id_unsafe) {
321 342
     $provider_id_safe = intval(core_auth::$main_provider->provider_id);
322 343
     //$account_id_safe = $this->db->db_escape($this->account_id);
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
     $this->reset();
80 80
     $this->db = is_object($db) ? $db : classSupernova::$db;
81 81
 
82
-    foreach($this->table_check as $table_name) {
83
-      if(empty($this->db->table_list[$table_name])) {
82
+    foreach ($this->table_check as $table_name) {
83
+      if (empty($this->db->table_list[$table_name])) {
84 84
         die('Если вы видите это сообщение первый раз после обновления релиза - просто перегрузите страницу.<br />
85 85
               В противном случае - сообщите Администрации сервера об ошибке.<br/>
86 86
               Не хватает таблицы для работы системы авторизации: ' . $table_name);
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
    */
105 105
   // OK v4.6
106 106
   public function password_change($old_password_unsafe, $new_password_unsafe, $salt_unsafe = null) {
107
-    if(!$this->password_check($old_password_unsafe)) {
107
+    if (!$this->password_check($old_password_unsafe)) {
108 108
       return false;
109 109
     }
110 110
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
   // OK v4.5
126 126
   public function assign_from_db_row($row) {
127 127
     $this->reset();
128
-    if(empty($row) || !is_array($row)) {
128
+    if (empty($row) || !is_array($row)) {
129 129
       return false;
130 130
     }
131 131
     $this->account_id = $row['account_id'];
@@ -242,11 +242,11 @@  discard block
 block discarded – undo
242 242
         `account_email` = LOWER('{$email_safe}'),
243 243
         `account_language` = '{$language_safe}'"
244 244
     );
245
-    if(!$result) {
245
+    if (!$result) {
246 246
       throw new Exception(REGISTER_ERROR_ACCOUNT_CREATE, ERR_ERROR);
247 247
     }
248 248
 
249
-    if(!($account_id = $this->db->db_insert_id())) {
249
+    if (!($account_id = $this->db->db_insert_id())) {
250 250
       throw new Exception(REGISTER_ERROR_ACCOUNT_CREATE, ERR_ERROR);
251 251
     }
252 252
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
       WHERE `account_id` = '{$account_id_safe}'"
277 277
     ) ? true : false;
278 278
 
279
-    if($result) {
279
+    if ($result) {
280 280
       $result = $this->db_get_by_id($this->account_id);
281 281
     }
282 282
 
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
   public function metamatter_change($change_type, $metamatter, $comment = '', $already_changed = false) {
364 364
     global $debug, $mm_change_legit;
365 365
 
366
-    if(!$this->is_exists || !($metamatter = round(floatval($metamatter)))) {
366
+    if (!$this->is_exists || !($metamatter = round(floatval($metamatter)))) {
367 367
       $debug->error('Ошибка при попытке манипуляции с ММ');
368 368
 
369 369
       return false;
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 
374 374
     $mm_change_legit = true;
375 375
     // $sn_data_metamatter_db_name = pname_resource_name(RES_METAMATTER);
376
-    if($already_changed) {
376
+    if ($already_changed) {
377 377
       $metamatter_total_delta = 0;
378 378
       $result = -1;
379 379
     } else {
@@ -387,13 +387,13 @@  discard block
 block discarded – undo
387 387
         ($metamatter_total_delta ? ", `account_immortal` = IF(`account_metamatter_total` + '{$metamatter_total_delta}' >= {$classConfig->player_metamatter_immortal}, NOW(), `account_immortal`), `account_metamatter_total` = `account_metamatter_total` + '{$metamatter_total_delta}'" : '') .
388 388
         " WHERE `account_id` = {$account_id_safe}"
389 389
       );
390
-      if(!$result) {
390
+      if (!$result) {
391 391
         $debug->error("Error adjusting Metamatter for player ID {$this->account_id} (Player Not Found?) with {$metamatter}. Reason: {$comment}", 'Metamatter Change', 402);
392 392
       }
393 393
       $result = classSupernova::$db->db_affected_rows();
394 394
     }
395 395
 
396
-    if(empty(core_auth::$user['id'])) {
396
+    if (empty(core_auth::$user['id'])) {
397 397
       $user_list = PlayerToAccountTranslate::db_translate_get_users_from_account_list(core_auth::$main_provider->provider_id, $this->account_id);
398 398
       reset($user_list);
399 399
       $user_id_unsafe = key($user_list);
@@ -402,30 +402,30 @@  discard block
 block discarded – undo
402 402
     }
403 403
     $user_id_safe = $this->db->db_escape($user_id_unsafe);
404 404
 
405
-    if(!$result) {
405
+    if (!$result) {
406 406
       $debug->error("Error adjusting Metamatter for player ID {$this->account_id} (Player Not Found?) with {$metamatter}. Reason: {$comment}", 'Metamatter Change', 402);
407 407
     }
408 408
 
409
-    if(!$already_changed) {
409
+    if (!$already_changed) {
410 410
       $this->account_metamatter += $metamatter;
411 411
       $this->account_metamatter_total += $metamatter_total_delta;
412 412
     }
413 413
 
414
-    if(is_array($comment)) {
414
+    if (is_array($comment)) {
415 415
       $comment = call_user_func_array('sprintf', $comment);
416 416
     }
417 417
 
418 418
     $result = $this->db_mm_log_insert($comment, $change_type, $metamatter, $user_id_unsafe);
419 419
 
420
-    if($metamatter > 0 && !empty($user_id_safe)) {
420
+    if ($metamatter > 0 && !empty($user_id_safe)) {
421 421
       $old_referral = db_referral_get_by_id($user_id_safe);
422
-      if($old_referral['id']) {
422
+      if ($old_referral['id']) {
423 423
         $dark_matter_from_metamatter = $metamatter * AFFILIATE_MM_TO_REFERRAL_DM;
424 424
         db_referral_update_dm($user_id_safe, $dark_matter_from_metamatter);
425 425
         $new_referral = db_referral_get_by_id($user_id_safe);
426 426
 
427 427
         $partner_bonus = floor($new_referral['dark_matter'] / classSupernova::$config->rpg_bonus_divisor) - ($old_referral['dark_matter'] >= classSupernova::$config->rpg_bonus_minimum ? floor($old_referral['dark_matter'] / classSupernova::$config->rpg_bonus_divisor) : 0);
428
-        if($partner_bonus > 0 && $new_referral['dark_matter'] >= classSupernova::$config->rpg_bonus_minimum) {
428
+        if ($partner_bonus > 0 && $new_referral['dark_matter'] >= classSupernova::$config->rpg_bonus_minimum) {
429 429
           rpg_points_change($new_referral['id_partner'], RPG_REFERRAL_BOUGHT_MM, $partner_bonus, "Incoming MM From Referral ID {$user_id_safe}");
430 430
         }
431 431
       }
Please login to merge, or discard this patch.
includes/vars_structures.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
       'factor' => 1.5,
16 16
     ),
17 17
     P_UNIT_PRODUCTION => array(
18
-      RES_METAL     => function ($level, $production_factor, $user, $planet_row) {return  40 * $level * pow(1.1, $level) * (0.1 * $production_factor);},
19
-      RES_ENERGY    => function ($level, $production_factor, $user, $planet_row) {return -13 * $level * pow(1.1, $level) * (0.1 * $production_factor);},
18
+      RES_METAL     => function($level, $production_factor, $user, $planet_row) {return  40 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
19
+      RES_ENERGY    => function($level, $production_factor, $user, $planet_row) {return -13 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
20 20
     ),
21 21
     P_MINING_IS_MANAGED => true,
22 22
   ),
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
       'factor' => 1.6,
34 34
     ),
35 35
     P_UNIT_PRODUCTION => array(
36
-      RES_CRYSTAL   => function ($level, $production_factor, $user, $planet_row) {return  32 * $level * pow(1.1, $level) * (0.1 * $production_factor);},
37
-      RES_ENERGY    => function ($level, $production_factor, $user, $planet_row) {return -16 * $level * pow(1.1, $level) * (0.1 * $production_factor);},
36
+      RES_CRYSTAL   => function($level, $production_factor, $user, $planet_row) {return  32 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
37
+      RES_ENERGY    => function($level, $production_factor, $user, $planet_row) {return -16 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
38 38
     ),
39 39
     P_MINING_IS_MANAGED => true,
40 40
   ),
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
       'factor' => 1.5,
52 52
     ),
53 53
     P_UNIT_PRODUCTION => array(
54
-      RES_DEUTERIUM => function ($level, $production_factor, $user, $planet_row) {return  10 * $level * pow(1.1, $level) * (0.1 * $production_factor) * (-0.002 * $planet_row["temp_max"] + 1.28);},
55
-      RES_ENERGY    => function ($level, $production_factor, $user, $planet_row) {return -20 * $level * pow(1.1, $level) * (0.1 * $production_factor);},
54
+      RES_DEUTERIUM => function($level, $production_factor, $user, $planet_row) {return  10 * $level * pow(1.1, $level) * (0.1 * $production_factor) * (-0.002 * $planet_row["temp_max"] + 1.28); },
55
+      RES_ENERGY    => function($level, $production_factor, $user, $planet_row) {return -20 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
56 56
     ),
57 57
     P_MINING_IS_MANAGED => true,
58 58
   ),
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
       'factor' => 1.5,
70 70
     ),
71 71
     P_UNIT_PRODUCTION => array(
72
-      RES_ENERGY    => function ($level, $production_factor, $user, $planet_row) {return ($planet_row["temp_max"] / 5 + 15) * $level * pow(1.1, $level) * (0.1 * $production_factor);},
72
+      RES_ENERGY    => function($level, $production_factor, $user, $planet_row) {return ($planet_row["temp_max"] / 5 + 15) * $level * pow(1.1, $level) * (0.1 * $production_factor); },
73 73
     ),
74 74
     P_MINING_IS_MANAGED => true,
75 75
   ),
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
       'factor' => 1.8,
88 88
     ),
89 89
     P_UNIT_PRODUCTION => array(
90
-      RES_DEUTERIUM => function ($level, $production_factor, $user, $planet_row) {return -10 * $level * pow(1.1, $level) * (0.1 * $production_factor);},
91
-      RES_ENERGY    => function ($level, $production_factor, $user, $planet_row) {return  30 * $level * pow(1.05 + 0.01 * mrc_get_level($user, null, TECH_ENERGY), $level) * (0.1 * $production_factor);},
90
+      RES_DEUTERIUM => function($level, $production_factor, $user, $planet_row) {return -10 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
91
+      RES_ENERGY    => function($level, $production_factor, $user, $planet_row) {return  30 * $level * pow(1.05 + 0.01 * mrc_get_level($user, null, TECH_ENERGY), $level) * (0.1 * $production_factor); },
92 92
     ),
93 93
     P_MINING_IS_MANAGED => true,
94 94
   ),
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
       'factor' => 2,
106 106
     ),
107 107
     'storage' => array(
108
-      RES_METAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level);},
108
+      RES_METAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level); },
109 109
     ),
110 110
   ),
111 111
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
       'factor' => 2,
122 122
     ),
123 123
     'storage' => array(
124
-      RES_CRYSTAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level);},
124
+      RES_CRYSTAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level); },
125 125
     ),
126 126
   ),
127 127
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
       'factor' => 2,
138 138
     ),
139 139
     'storage' => array(
140
-      RES_DEUTERIUM => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level);},
140
+      RES_DEUTERIUM => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level); },
141 141
     ),
142 142
   ),
143 143
 
Please login to merge, or discard this patch.
includes/classes/cache.php 2 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -81,6 +81,10 @@  discard block
 block discarded – undo
81 81
   // -------------------------------------------------------------------------
82 82
   // Here comes low-level functions - those that directly works with cacher engines
83 83
   // -------------------------------------------------------------------------
84
+
85
+  /**
86
+   * @param string $name
87
+   */
84 88
   public function __set($name, $value) {
85 89
     switch ($name) {
86 90
       case '_MODE':
@@ -132,6 +136,9 @@  discard block
 block discarded – undo
132 136
     return null;
133 137
   }
134 138
 
139
+  /**
140
+   * @param string $name
141
+   */
135 142
   public function __isset($name) {
136 143
     switch (self::$mode) {
137 144
       case CACHER_NO_CACHE:
Please login to merge, or discard this patch.
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -46,19 +46,19 @@  discard block
 block discarded – undo
46 46
   protected static $cacheObject;
47 47
 
48 48
   public function __construct($prefIn = 'CACHE_', $init_mode = false) {
49
-    if(!($init_mode === false || $init_mode === CACHER_NO_CACHE || ($init_mode === CACHER_XCACHE && extension_loaded('xcache')))) {
49
+    if (!($init_mode === false || $init_mode === CACHER_NO_CACHE || ($init_mode === CACHER_XCACHE && extension_loaded('xcache')))) {
50 50
       throw new UnexpectedValueException('Wrong work mode or current mode does not supported on your server');
51 51
     }
52 52
 
53 53
     $this->prefix = $prefIn;
54
-    if(extension_loaded('xcache') && ($init_mode === CACHER_XCACHE || $init_mode === false)) {
55
-      if(self::$mode === CACHER_NOT_INIT) {
54
+    if (extension_loaded('xcache') && ($init_mode === CACHER_XCACHE || $init_mode === false)) {
55
+      if (self::$mode === CACHER_NOT_INIT) {
56 56
         self::$mode = CACHER_XCACHE;
57 57
       }
58 58
     } else {
59
-      if(self::$mode === CACHER_NOT_INIT) {
59
+      if (self::$mode === CACHER_NOT_INIT) {
60 60
         self::$mode = CACHER_NO_CACHE;
61
-        if(!self::$data) {
61
+        if (!self::$data) {
62 62
           self::$data = array();
63 63
         }
64 64
       }
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
   }
67 67
 
68 68
   public static function getInstance($prefIn = 'CACHE_', $table_name = '') {
69
-    if(!isset(self::$cacheObject)) {
69
+    if (!isset(self::$cacheObject)) {
70 70
       $className = get_class();
71 71
       self::$cacheObject = new $className($prefIn);
72 72
     }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
   // Here comes low-level functions - those that directly works with cacher engines
84 84
   // -------------------------------------------------------------------------
85 85
   public function __set($name, $value) {
86
-    switch($name) {
86
+    switch ($name) {
87 87
       case '_MODE':
88 88
         throw new UnexpectedValueException('You can not change cacher mode on-the-fly!');
89 89
       break;
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
       break;
94 94
 
95 95
       default:
96
-        switch(self::$mode) {
96
+        switch (self::$mode) {
97 97
           case CACHER_NO_CACHE:
98 98
             self::$data[$this->prefix . $name] = $value;
99 99
           break;
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
   }
108 108
 
109 109
   public function __get($name) {
110
-    switch($name) {
110
+    switch ($name) {
111 111
       case '_MODE':
112 112
         return self::$mode;
113 113
       break;
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
       break;
118 118
 
119 119
       default:
120
-        switch(self::$mode) {
120
+        switch (self::$mode) {
121 121
           case CACHER_NO_CACHE:
122 122
             return self::$data[$this->prefix . $name];
123 123
           break;
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
   }
135 135
 
136 136
   public function __isset($name) {
137
-    switch(self::$mode) {
137
+    switch (self::$mode) {
138 138
       case CACHER_NO_CACHE:
139 139
         return isset(self::$data[$this->prefix . $name]);
140 140
       break;
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
   }
149 149
 
150 150
   public function __unset($name) {
151
-    switch(self::$mode) {
151
+    switch (self::$mode) {
152 152
       case CACHER_NO_CACHE:
153 153
         unset(self::$data[$this->prefix . $name]);
154 154
       break;
@@ -161,11 +161,11 @@  discard block
 block discarded – undo
161 161
 
162 162
   public function unset_by_prefix($prefix_unset = '') {
163 163
     static $array_clear;
164
-    !$array_clear ? $array_clear = function (&$v, $k, $p) {
164
+    !$array_clear ? $array_clear = function(&$v, $k, $p) {
165 165
       strpos($k, $p) === 0 ? $v = null : false;
166 166
     } : false;
167 167
 
168
-    switch(self::$mode) {
168
+    switch (self::$mode) {
169 169
       case CACHER_NO_CACHE:
170 170
 //        array_walk(self::$data, create_function('&$v,$k,$p', 'if(strpos($k, $p) === 0)$v = NULL;'), $this->prefix.$prefix_unset);
171 171
         array_walk(self::$data, $array_clear, $this->prefix . $prefix_unset);
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
       break;
175 175
 
176 176
       case CACHER_XCACHE:
177
-        if(!function_exists('xcache_unset_by_prefix')) {
177
+        if (!function_exists('xcache_unset_by_prefix')) {
178 178
           return false;
179 179
         }
180 180
 
@@ -191,13 +191,13 @@  discard block
 block discarded – undo
191 191
   protected function make_element_name($args, $diff = 0) {
192 192
     $num_args = count($args);
193 193
 
194
-    if($num_args < 1) {
194
+    if ($num_args < 1) {
195 195
       return false;
196 196
     }
197 197
 
198 198
     $name = '';
199 199
     $aName = array();
200
-    for($i = 0; $i <= $num_args - 1 - $diff; $i++) {
200
+    for ($i = 0; $i <= $num_args - 1 - $diff; $i++) {
201 201
       $name .= "[{$args[$i]}]";
202 202
       array_unshift($aName, $name);
203 203
     }
@@ -209,15 +209,15 @@  discard block
 block discarded – undo
209 209
     $args = func_get_args();
210 210
     $name = $this->make_element_name($args, 1);
211 211
 
212
-    if(!$name) {
212
+    if (!$name) {
213 213
       return null;
214 214
     }
215 215
 
216
-    if($this->$name[0] === null) {
217
-      for($i = count($name) - 1; $i > 0; $i--) {
216
+    if ($this->$name[0] === null) {
217
+      for ($i = count($name) - 1; $i > 0; $i--) {
218 218
         $cName = "{$name[$i]}_COUNT";
219
-        $cName1 = "{$name[$i-1]}_COUNT";
220
-        if($this->$cName1 == null || $i == 1) {
219
+        $cName1 = "{$name[$i - 1]}_COUNT";
220
+        if ($this->$cName1 == null || $i == 1) {
221 221
           $this->$cName++;
222 222
         }
223 223
       }
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 
231 231
   public function array_get() {
232 232
     $name = $this->make_element_name(func_get_args());
233
-    if(!$name) {
233
+    if (!$name) {
234 234
       return null;
235 235
     }
236 236
 
@@ -239,12 +239,12 @@  discard block
 block discarded – undo
239 239
 
240 240
   public function array_count() {
241 241
     $name = $this->make_element_name(func_get_args());
242
-    if(!$name) {
242
+    if (!$name) {
243 243
       return 0;
244 244
     }
245 245
     $cName = "{$name[0]}_COUNT";
246 246
     $retVal = $this->$cName;
247
-    if(!$retVal) {
247
+    if (!$retVal) {
248 248
       $retVal = null;
249 249
     }
250 250
 
@@ -254,18 +254,18 @@  discard block
 block discarded – undo
254 254
   public function array_unset() {
255 255
     $name = $this->make_element_name(func_get_args());
256 256
 
257
-    if(!$name) {
257
+    if (!$name) {
258 258
       return false;
259 259
     }
260 260
     $this->unset_by_prefix($name[0]);
261 261
 
262
-    for($i = 1; $i < count($name); $i++) {
262
+    for ($i = 1; $i < count($name); $i++) {
263 263
       $cName = "{$name[$i]}_COUNT";
264
-      $cName1 = "{$name[$i-1]}_COUNT";
264
+      $cName1 = "{$name[$i - 1]}_COUNT";
265 265
 
266
-      if($i == 1 || $this->$cName1 === null) {
266
+      if ($i == 1 || $this->$cName1 === null) {
267 267
         $this->$cName--;
268
-        if($this->$cName <= 0) {
268
+        if ($this->$cName <= 0) {
269 269
           unset($this->$cName);
270 270
         }
271 271
       }
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
   }
276 276
 
277 277
   public function dumpData() {
278
-    switch(self::$mode) {
278
+    switch (self::$mode) {
279 279
       case CACHER_NO_CACHE:
280 280
         return dump(self::$data, $this->prefix);
281 281
       break;
@@ -326,13 +326,13 @@  discard block
 block discarded – undo
326 326
     $this->sql_index_field = "{$table_name}_name";
327 327
     $this->sql_value_field = "{$table_name}_value";
328 328
 
329
-    if(!$this->_DB_LOADED) {
329
+    if (!$this->_DB_LOADED) {
330 330
       $this->db_loadAll();
331 331
     }
332 332
   }
333 333
 
334 334
   public static function getInstance($gamePrefix = 'sn_', $table_name = '') {
335
-    if(!isset(self::$cacheObject)) {
335
+    if (!isset(self::$cacheObject)) {
336 336
       $className = get_class();
337 337
       self::$cacheObject = new $className($gamePrefix, $table_name);
338 338
     }
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 
343 343
   public function db_loadItem($index) {
344 344
     $result = null;
345
-    if($index) {
345
+    if ($index) {
346 346
       $index_safe = db_escape($index);
347 347
       $result = doquery("SELECT `{$this->sql_value_field}` FROM `{{{$this->table_name}}}` WHERE `{$this->sql_index_field}` = '{$index_safe}' FOR UPDATE", true);
348 348
       // В две строки - что бы быть уверенным в порядке выполнения
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
     $this->loadDefaults();
358 358
 
359 359
     $query = doquery("SELECT * FROM {{{$this->table_name}}} FOR UPDATE;");
360
-    while($row = db_fetch($query)) {
360
+    while ($row = db_fetch($query)) {
361 361
       $this->$row[$this->sql_index_field] = $row[$this->sql_value_field];
362 362
     }
363 363
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
   }
366 366
 
367 367
   public function loadDefaults() {
368
-    foreach($this->defaults as $defName => $defValue) {
368
+    foreach ($this->defaults as $defName => $defValue) {
369 369
       $this->$defName = $defValue;
370 370
     }
371 371
   }
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
   }
382 382
 
383 383
   public function db_saveItem($item_list, $value = null) {
384
-    if(empty($item_list)) {
384
+    if (empty($item_list)) {
385 385
       return;
386 386
     }
387 387
 
@@ -389,8 +389,8 @@  discard block
 block discarded – undo
389 389
 
390 390
     // Сначала записываем данные в базу - что бы поймать все блокировки
391 391
     $qry = array();
392
-    foreach($item_list as $item_name => $item_value) {
393
-      if($item_name) {
392
+    foreach ($item_list as $item_name => $item_value) {
393
+      if ($item_name) {
394 394
         $item_value = db_escape($item_value === null ? $this->$item_name : $item_value);
395 395
         $item_name = db_escape($item_name);
396 396
         $qry[] = "('{$item_name}', '{$item_value}')";
@@ -399,8 +399,8 @@  discard block
 block discarded – undo
399 399
     doquery("REPLACE INTO `{{" . $this->table_name . "}}` (`{$this->sql_index_field}`, `{$this->sql_value_field}`) VALUES " . implode(',', $qry) . ";");
400 400
 
401 401
     // И только после взятия блокировок - меняем значения в кэше
402
-    foreach($item_list as $item_name => $item_value) {
403
-      if($item_name && $item_value !== null) {
402
+    foreach ($item_list as $item_name => $item_value) {
403
+      if ($item_name && $item_value !== null) {
404 404
         $this->$item_name = $item_value;
405 405
       }
406 406
     }
@@ -587,9 +587,9 @@  discard block
 block discarded – undo
587 587
     'advGoogleLeftMenuCode'        => '(Place here code for banner)',
588 588
 
589 589
     // Alliance bonus calculations
590
-    'ali_bonus_algorithm'          => 0,  // Bonus calculation algorithm
590
+    'ali_bonus_algorithm'          => 0, // Bonus calculation algorithm
591 591
     'ali_bonus_brackets'           => 10, // Brackets count for ALI_BONUS_BY_RANK
592
-    'ali_bonus_brackets_divisor'   => 10,// Bonus divisor for ALI_BONUS_BY_RANK
592
+    'ali_bonus_brackets_divisor'   => 10, // Bonus divisor for ALI_BONUS_BY_RANK
593 593
     'ali_bonus_divisor'            => 10000000, // Rank divisor for ALI_BONUS_BY_POINTS
594 594
     'ali_bonus_members'            => 10, // Minumum alliace size to start using bonus
595 595
 
@@ -620,25 +620,25 @@  discard block
 block discarded – undo
620 620
     'deuterium_basic_income'       => 0,
621 621
     'eco_scale_storage'            => 1,
622 622
     'eco_stockman_fleet'           => '', // Black Market - Starting amount of s/h ship merchant to sell
623
-    'eco_stockman_fleet_populate'  => 1,  // Populate empty Stockman fleet with ships or not
623
+    'eco_stockman_fleet_populate'  => 1, // Populate empty Stockman fleet with ships or not
624 624
     'empire_mercenary_base_period' => PERIOD_MONTH, // Base
625 625
     'empire_mercenary_temporary'   => 0, // Temporary empire-wide mercenaries
626 626
     'energy_basic_income'          => 0,
627 627
 
628 628
     // Bashing protection settings
629
-    'fleet_bashing_attacks'        => 3,      // Max amount of attack per wave - 3 by default
630
-    'fleet_bashing_interval'       => 1800,   // Maximum interval between attacks when they still count as one wave - 30m by default
631
-    'fleet_bashing_scope'          => 86400,  // Interval on which bashing waves counts - 24h by default
632
-    'fleet_bashing_war_delay'      => 43200,  // Delay before start bashing after declaring war to alliance - 12h by default
633
-    'fleet_bashing_waves'          => 3,      // Max amount of waves per day - 3 by default
629
+    'fleet_bashing_attacks'        => 3, // Max amount of attack per wave - 3 by default
630
+    'fleet_bashing_interval'       => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default
631
+    'fleet_bashing_scope'          => 86400, // Interval on which bashing waves counts - 24h by default
632
+    'fleet_bashing_war_delay'      => 43200, // Delay before start bashing after declaring war to alliance - 12h by default
633
+    'fleet_bashing_waves'          => 3, // Max amount of waves per day - 3 by default
634 634
 
635 635
     'Fleet_Cdr'   => 30,
636 636
     'fleet_speed' => 1,
637 637
 
638 638
     'fleet_update_interval' => 4,
639 639
 
640
-    'game_adminEmail'       => 'root@localhost',    // Admin's email to show to users
641
-    'game_counter'          => 0,  // Does built-in page hit counter is on?
640
+    'game_adminEmail'       => 'root@localhost', // Admin's email to show to users
641
+    'game_counter'          => 0, // Does built-in page hit counter is on?
642 642
     // Defaults
643 643
     'game_default_language' => 'ru',
644 644
     'game_default_skin'     => 'skins/EpicBlue/',
@@ -652,13 +652,13 @@  discard block
 block discarded – undo
652 652
     'game_maxSystem'      => 199,
653 653
     'game_maxPlanet'      => 15,
654 654
     // Game global settings
655
-    'game_mode'           => 0,           // 0 - SuperNova, 1 - oGame
655
+    'game_mode'           => 0, // 0 - SuperNova, 1 - oGame
656 656
     'game_name'           => 'SuperNova', // Server name (would be on banners and on top of left menu)
657 657
 
658 658
     'game_news_actual'   => 259200, // How long announcement would be marked as "New". In seconds. Default - 3 days
659
-    'game_news_overview' => 3,    // How much last news to show in Overview page
659
+    'game_news_overview' => 3, // How much last news to show in Overview page
660 660
     // Noob protection
661
-    'game_noob_factor'   => 5,    // Multiplier to divide "stronger" and "weaker" users
661
+    'game_noob_factor'   => 5, // Multiplier to divide "stronger" and "weaker" users
662 662
     'game_noob_points'   => 5000, // Below this point user threated as noob. 0 to disable
663 663
 
664 664
     'game_multiaccount_enabled' => 0, // 1 - allow interactions for players with same IP (multiaccounts)
@@ -707,8 +707,8 @@  discard block
 block discarded – undo
707 707
     'payment_currency_exchange_wmu' => 30,
708 708
     'payment_currency_exchange_wmz' => 1,
709 709
 
710
-    'payment_lot_price' => 1,     // Lot price in default currency
711
-    'payment_lot_size'  => 2500,  // Lot size. Also service as minimum amount of DM that could be bought with one transaction
710
+    'payment_lot_price' => 1, // Lot price in default currency
711
+    'payment_lot_size'  => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction
712 712
 
713 713
     'planet_teleport_cost'    => 50000, //
714 714
     'planet_teleport_timeout' => 86400, //
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
     'resource_multiplier'     => 1,
727 727
 
728 728
     //Roleplay system
729
-    'rpg_bonus_divisor'       => 10,    // Amount of DM referral shoud get for partner have 1 DM bonus
729
+    'rpg_bonus_divisor'       => 10, // Amount of DM referral shoud get for partner have 1 DM bonus
730 730
     'rpg_bonus_minimum'       => 10000, // Minimum DM ammount for starting paying bonuses to affiliate
731 731
 
732 732
     // Black Market - General
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
   }
814 814
 
815 815
   public static function getInstance($gamePrefix = 'sn_', $table_name = 'config') {
816
-    if(!isset(self::$cacheObject)) {
816
+    if (!isset(self::$cacheObject)) {
817 817
       $className = get_class();
818 818
       self::$cacheObject = new $className($gamePrefix, $table_name);
819 819
     }
Please login to merge, or discard this patch.
search.php 1 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
   message(classLocale::$lang['sys_blitz_page_disabled'], classLocale::$lang['sys_error'], 'overview.php', 10);
17 17
   die();
18 18
 }
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 
26 26
 $template = gettemplate('search', true);
27 27
 
28
-if($searchtext && $type) {
29
-  switch($type) {
28
+if ($searchtext && $type) {
29
+  switch ($type) {
30 30
     case "planetname":
31 31
       // $search = db_planet_list_search($searchtext);
32 32
     break;
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
     break;
42 42
   }
43 43
 
44
-  while($row = db_fetch($search)) {
45
-    if($type == 'playername' || $type == 'planetname') {
44
+  while ($row = db_fetch($search)) {
45
+    if ($type == 'playername' || $type == 'planetname') {
46 46
       $template->assign_block_vars('search_result', array(
47 47
         'PLAYER_ID'       => $row['uid'],
48 48
         'PLAYER_NAME'     => htmlentities($row['username'], ENT_COMPAT, 'UTF-8'),
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         'ALLY_NAME'       => htmlentities($row['ally_name'], ENT_COMPAT, 'UTF-8'),
58 58
         'ALLY_TAG'        => htmlentities($row['ally_tag'], ENT_COMPAT, 'UTF-8'),
59 59
       ));
60
-    } elseif($type == 'ally') {
60
+    } elseif ($type == 'ally') {
61 61
       $template->assign_block_vars('search_result', array(
62 62
         'ALLY_NAME'     => htmlentities($row['ally_name'], ENT_COMPAT, 'UTF-8'),
63 63
         'ALLY_TAG'      => htmlentities($row['ally_tag'], ENT_COMPAT, 'UTF-8'),
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
   'ally'       => 'sys_alliance',
76 76
 );
77 77
 
78
-foreach($search_type as $type_id => $type_lang) {
78
+foreach ($search_type as $type_id => $type_lang) {
79 79
   $template->assign_block_vars('type', array(
80 80
     'ID'       => $type_id,
81 81
     'TEXT'     => classLocale::$lang[$type_lang],
Please login to merge, or discard this patch.