Completed
Push — trunk ( d06df9...f48ee3 )
by SuperNova.WS
11:23
created
classes/_SnCacheInternal.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
     //print("<br />CACHE CLEAR {$cache_id} " . ($hard ? 'HARD' : 'SOFT') . "<br />");
53 53
     if ($hard && !empty(_SnCacheInternal::$data[$location_type])) {
54 54
       // Здесь нельзя делать unset - надо записывать NULL, что бы это отразилось на зависимых записях
55
-      array_walk(_SnCacheInternal::$data[$location_type], function (&$item) { $item = null; });
55
+      array_walk(_SnCacheInternal::$data[$location_type], function(&$item) { $item = null; });
56 56
     }
57 57
     _SnCacheInternal::$locator[$location_type] = [];
58 58
     _SnCacheInternal::$queries[$location_type] = [];
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
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
     "SELECT `id` AS `ID`, `username` AS `NAME`, `ally_name` AS `ALLY`, `total_points` AS `STAT_POINTS`,
181 181
       `onlinetime` AS `ACTIVITY`
182 182
     FROM `{{users}}`
183
-    WHERE `onlinetime` >= ". (SN_TIME_NOW - $config->game_users_online_timeout) ." ORDER BY user_as_ally, `". $TypeSort ."` ASC;");
183
+    WHERE `onlinetime` >= ". (SN_TIME_NOW - $config->game_users_online_timeout) . " ORDER BY user_as_ally, `" . $TypeSort . "` ASC;");
184 184
 }
185 185
 
186 186
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
   return doquery("SELECT u.*, COUNT(r.id) AS referral_count, SUM(r.dark_matter) AS referral_dm FROM {{users}} as u
196 196
     LEFT JOIN {{referrals}} as r on r.id_partner = u.id
197 197
     WHERE" .
198
-    ($online ? " `onlinetime` >= ". (SN_TIME_NOW - $config->game_users_online_timeout) : ' user_as_ally IS NULL') .
198
+    ($online ? " `onlinetime` >= " . (SN_TIME_NOW - $config->game_users_online_timeout) : ' user_as_ally IS NULL') .
199 199
     " GROUP BY u.id
200 200
     ORDER BY user_as_ally, {$sort} ASC");
201 201
 }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
   !is_array($user_id_list) ? $user_id_list = array($user_id_list) : false;
212 212
 
213 213
   $user_list = array();
214
-  foreach($user_id_list as $user_id_unsafe) {
214
+  foreach ($user_id_list as $user_id_unsafe) {
215 215
     $user = db_user_by_id($user_id_unsafe);
216 216
     !empty($user) ? $user_list[$user_id_unsafe] = $user : false;
217 217
   }
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);
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.
classes/Alliance/AllianceMember.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
    * @return bool
47 47
    */
48 48
   public function changeTitle(AllianceTitle $title) {
49
-    if(!$title instanceof AllianceTitle) {
49
+    if (!$title instanceof AllianceTitle) {
50 50
       return false;
51 51
     }
52 52
 
Please login to merge, or discard this patch.
classes/Alliance/AllianceTitleList.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         continue;
46 46
       }
47 47
 
48
-      $result[] = (string)$title;
48
+      $result[] = (string) $title;
49 49
     }
50 50
 
51 51
     return implode(';', $result);
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
    * Updates title names and access rights with current ones
68 68
    */
69 69
   public function updateTitles() {
70
-    $this->alliance->titleList = (string)$this;
70
+    $this->alliance->titleList = (string) $this;
71 71
   }
72 72
 
73 73
   protected function extractTitles() {
Please login to merge, or discard this patch.
classes/Bonus/BonusAtom.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,8 +58,7 @@
 block discarded – undo
58 58
    * @return int
59 59
    */
60 60
   public static function calcBonusPower($unitInfo) {
61
-    return isset($unitInfo[P_BONUS_VALUE]) ? $unitInfo[P_BONUS_VALUE] :
62
-      (static::calcBonusType($unitInfo) == BONUS_ABILITY ? 1 : 0);
61
+    return isset($unitInfo[P_BONUS_VALUE]) ? $unitInfo[P_BONUS_VALUE] : (static::calcBonusType($unitInfo) == BONUS_ABILITY ? 1 : 0);
63 62
   }
64 63
 
65 64
   /**
Please login to merge, or discard this patch.
classes/Bonus/BonusListAtom.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,8 +58,8 @@
 block discarded – undo
58 58
   protected function bonusSort(BonusAtom $a, BonusAtom $b) {
59 59
     static $bonusOrder = [BonusAtom::class, BonusAtomAbility::class, BonusAtomAdd::class, BonusAtomPercent::class, BonusAtomMultiply::class];
60 60
 
61
-    $indexA = (int)array_search(get_class($a), $bonusOrder);
62
-    $indexB = (int)array_search(get_class($b), $bonusOrder);
61
+    $indexA = (int) array_search(get_class($a), $bonusOrder);
62
+    $indexB = (int) array_search(get_class($b), $bonusOrder);
63 63
 
64 64
     return $indexA == $indexB ? 0 : ($indexA > $indexB ? +1 : -1);
65 65
   }
Please login to merge, or discard this patch.
classes/Bonus/ValueStorage.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -48,20 +48,20 @@  discard block
 block discarded – undo
48 48
   }
49 49
 
50 50
   protected function initValues() {
51
-    $this[UNIT_SERVER_SPEED_BUILDING] = function (ValueStorage $vs) {
51
+    $this[UNIT_SERVER_SPEED_BUILDING] = function(ValueStorage $vs) {
52 52
       return new ValueBonused(UNIT_SERVER_SPEED_BUILDING, floatval($vs->getGlobalContainer()->config->game_speed));
53 53
     };
54
-    $this[UNIT_SERVER_SPEED_MINING] = function (ValueStorage $vs) {
54
+    $this[UNIT_SERVER_SPEED_MINING] = function(ValueStorage $vs) {
55 55
       return new ValueBonused(UNIT_SERVER_SPEED_MINING, floatval($vs->getGlobalContainer()->config->resource_multiplier));
56 56
     };
57
-    $this[UNIT_SERVER_SPEED_FLEET] = function (ValueStorage $vs) {
57
+    $this[UNIT_SERVER_SPEED_FLEET] = function(ValueStorage $vs) {
58 58
       return new ValueBonused(UNIT_SERVER_SPEED_FLEET, floatval($vs->getGlobalContainer()->config->fleet_speed));
59 59
     };
60
-    $this[UNIT_SERVER_SPEED_EXPEDITION] = function (ValueStorage $vs) {
60
+    $this[UNIT_SERVER_SPEED_EXPEDITION] = function(ValueStorage $vs) {
61 61
       return new ValueBonused(UNIT_SERVER_SPEED_EXPEDITION, floatval(1));
62 62
     };
63 63
 
64
-    $this[UNIT_SERVER_FLEET_NOOB_POINTS] = function (ValueStorage $vs) {
64
+    $this[UNIT_SERVER_FLEET_NOOB_POINTS] = function(ValueStorage $vs) {
65 65
       $config = $vs->getGlobalContainer()->config;
66 66
 
67 67
       return new ValueBonused(
@@ -69,11 +69,11 @@  discard block
 block discarded – undo
69 69
         floatval($config->game_noob_points * $vs->getBase(UNIT_SERVER_SPEED_MINING))
70 70
       );
71 71
     };
72
-    $this[UNIT_SERVER_FLEET_NOOB_FACTOR] = function (ValueStorage $vs) {
72
+    $this[UNIT_SERVER_FLEET_NOOB_FACTOR] = function(ValueStorage $vs) {
73 73
       return new ValueBonused(UNIT_SERVER_FLEET_NOOB_FACTOR, floatval($vs->getGlobalContainer()->config->game_noob_factor));
74 74
     };
75 75
 
76
-    $this[UNIT_SERVER_PAYMENT_MM_PER_CURRENCY] = function (ValueStorage $vs) {
76
+    $this[UNIT_SERVER_PAYMENT_MM_PER_CURRENCY] = function(ValueStorage $vs) {
77 77
       return new ValueBonused(UNIT_SERVER_PAYMENT_MM_PER_CURRENCY, floatval($vs->getGlobalContainer()->config->payment_currency_exchange_mm_));
78 78
     };
79 79
   }
Please login to merge, or discard this patch.
classes/Unit/Governor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@
 block discarded – undo
105 105
    * @return int
106 106
    */
107 107
   public function getMaxLevel() {
108
-    $snId =  $this->getSnId();
108
+    $snId = $this->getSnId();
109 109
     return !empty($snId) ? get_unit_param($snId, P_MAX_STACK) : 0;
110 110
   }
111 111
 
Please login to merge, or discard this patch.