Test Failed
Branch trunk (d809b8)
by SuperNova.WS
05:48
created
admin/admin_analyze_matter.php 1 patch
Spacing   +8 added lines, -9 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
 
16 16
 $constants = get_defined_constants(true);
17 17
 $rpgConstants = array();
18
-foreach($constants['user'] as $constantName => $constantValue) {
19
-  if(substr($constantName, 0, 4) == 'RPG_') {
18
+foreach ($constants['user'] as $constantName => $constantValue) {
19
+  if (substr($constantName, 0, 4) == 'RPG_') {
20 20
     $rpgConstants[$constantValue] = $constantName;
21 21
   }
22 22
 }
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 GROUP BY log_dark_matter_reason, IF(sign((log_dark_matter_amount)) > 0, 1, -1) ORDER BY sum(log_dark_matter_amount) DESC;
34 34
 ");
35 35
 
36
-while($row = classSupernova::$db->db_fetch($result)) {
36
+while ($row = classSupernova::$db->db_fetch($result)) {
37 37
   $row['CONSTANT'] = $rpgConstants[$row['REASON']];
38 38
 
39 39
   $row['DM_AMOUNT_TEXT'] = pretty_number($row['DM_AMOUNT']);
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 GROUP BY reason, if(sign((amount)) > 0, 1, -1) ORDER BY sum(amount) DESC;
56 56
 ");
57 57
 
58
-while($row = classSupernova::$db->db_fetch($result)) {
59
-  if(empty($spent[$row['BALANCE']])) {
58
+while ($row = classSupernova::$db->db_fetch($result)) {
59
+  if (empty($spent[$row['BALANCE']])) {
60 60
     $spent[$row['BALANCE']] = array();
61 61
   }
62 62
 
@@ -66,16 +66,15 @@  discard block
 block discarded – undo
66 66
   $spent[$row['BALANCE']] = array_merge_recursive_numeric($spent[$row['BALANCE']], $row);
67 67
 }
68 68
 
69
-foreach($spent as &$row) {
69
+foreach ($spent as &$row) {
70 70
   @$row['TOTAL_COUNT'] = $row['MM_COUNT'] + $row['DM_COUNT'];
71 71
   @$row['TOTAL_AMOUNT'] = $row['MM_AMOUNT'] + $row['DM_AMOUNT'];
72 72
   @$row['TOTAL_AMOUNT_TEXT'] = pretty_number($row['TOTAL_AMOUNT']);
73 73
   @$row['TOTAL_COUNT_TEXT'] = pretty_number($row['TOTAL_COUNT']);
74 74
 }
75 75
 
76
-usort($spent, function ($a, $b) {
77
-  return $a['TOTAL_AMOUNT'] < $b['TOTAL_AMOUNT'] ? -1 :
78
-    ($a['TOTAL_AMOUNT'] > $b['TOTAL_AMOUNT'] ? 1 : 0);
76
+usort($spent, function($a, $b) {
77
+  return $a['TOTAL_AMOUNT'] < $b['TOTAL_AMOUNT'] ? -1 : ($a['TOTAL_AMOUNT'] > $b['TOTAL_AMOUNT'] ? 1 : 0);
79 78
 });
80 79
 
81 80
 
Please login to merge, or discard this patch.
admin/adm_flying_fleets.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 //while($CurrentFleet = db_fetch($FlyingFleets))
22 22
 
23 23
 $all_flying_fleets = db_fleet_list('', DB_SELECT_PLAIN);
24
-foreach($all_flying_fleets as $fleet_id => $CurrentFleet) {
24
+foreach ($all_flying_fleets as $fleet_id => $CurrentFleet) {
25 25
   $FleetOwner = db_user_by_id($CurrentFleet['fleet_owner']);
26 26
   $TargetOwner = db_user_by_id($CurrentFleet['fleet_target_owner']);
27 27
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
   $fleet_data['fleet']['STAY_TIME_INT'] = $CurrentFleet['fleet_end_stay'];
33 33
 
34 34
   $template->assign_block_vars('fleets', $fleet_data['fleet']);
35
-  foreach($fleet_data['ships'] as $ship_data) {
35
+  foreach ($fleet_data['ships'] as $ship_data) {
36 36
     $template->assign_block_vars('fleets.ships', $ship_data);
37 37
   }
38 38
 }
Please login to merge, or discard this patch.
admin/adm_user_analyze.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -19,13 +19,13 @@  discard block
 block discarded – undo
19 19
 // define('SESSION_INTERRUPT', 15*60); // Можно увеличить до 4 часов - никито не может сидеть 2 суток с перерывом менее 4 часов
20 20
 // define('SUSPICIOUS_LONG', 2 * 60*60); // Тогда это увеличиваем до, скажем суток - и там смотрим
21 21
 
22
-define('SESSION_INTERRUPT', 1 * 60*60); // Можно увеличить до 4 часов - никито не может сидеть 2 суток с перерывом менее 4 часов
23
-define('SUSPICIOUS_LONG', 16 * 60*60); // Тогда это увеличиваем до, скажем суток - и там смотрим
22
+define('SESSION_INTERRUPT', 1 * 60 * 60); // Можно увеличить до 4 часов - никито не может сидеть 2 суток с перерывом менее 4 часов
23
+define('SUSPICIOUS_LONG', 16 * 60 * 60); // Тогда это увеличиваем до, скажем суток - и там смотрим
24 24
 
25 25
 
26 26
 function check_suspicious(&$session, &$session_list_last_id, &$row) {
27 27
   $session[2] = $session[1] - $session[0];
28
-  if($session[2] > SUSPICIOUS_LONG)
28
+  if ($session[2] > SUSPICIOUS_LONG)
29 29
   {
30 30
     $session[2] = pretty_time($session[2]);
31 31
     $session[0] = date(FMT_DATE_TIME_SQL, $session[0]);
@@ -46,24 +46,24 @@  discard block
 block discarded – undo
46 46
 $session_list = array();
47 47
 $query = doquery("SELECT `visit_time`, user_id FROM {{counter}} where user_id <> 0 and visit_time > UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 7 DAY)) order by user_id, visit_time;");
48 48
 $session = array();
49
-if($row = db_fetch($query)) {
49
+if ($row = db_fetch($query)) {
50 50
   $session = array(
51 51
     0 => strtotime($row['visit_time']), // start
52 52
     1 => strtotime($row['visit_time']), // end
53 53
   );
54 54
   $last_id = $row['user_id'];
55 55
 }
56
-while($row = db_fetch($query)) {
56
+while ($row = db_fetch($query)) {
57 57
   $row['visit_time'] = strtotime($row['visit_time']);
58
-  if($last_id == $row['user_id']) {
58
+  if ($last_id == $row['user_id']) {
59 59
     // Тот же юзер
60
-    if($row['visit_time'] - $session[1] <= SESSION_INTERRUPT) { // Та же сессия
60
+    if ($row['visit_time'] - $session[1] <= SESSION_INTERRUPT) { // Та же сессия
61 61
       $session[1] = $row['visit_time'];
62 62
     } else {
63 63
       // Новая сессия
64 64
 //      check_suspicious($session, $session_list[$last_id], $row);
65 65
       $session[2] = $session[1] - $session[0];
66
-      if($session[2] > SUSPICIOUS_LONG)
66
+      if ($session[2] > SUSPICIOUS_LONG)
67 67
       {
68 68
         $session[2] = pretty_time($session[2]);
69 69
         $session[0] = date(FMT_DATE_TIME_SQL, $session[0]);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
   } else {
79 79
 //    check_suspicious($session, $session_list[$last_id], $row);
80 80
     $session[2] = $session[1] - $session[0];
81
-      if($session[2] > SUSPICIOUS_LONG)
81
+      if ($session[2] > SUSPICIOUS_LONG)
82 82
       {
83 83
         $session[2] = pretty_time($session[2]);
84 84
         $session[0] = date(FMT_DATE_TIME_SQL, $session[0]);
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
   }
94 94
 }
95 95
 
96
-if($last_id) {
96
+if ($last_id) {
97 97
   // check_suspicious($session, $session_list[$last_id], $row = array('time' => 0));
98 98
   $session[2] = $session[1] - $session[0];
99 99
 
100
-  if($session[2] > SUSPICIOUS_LONG)
100
+  if ($session[2] > SUSPICIOUS_LONG)
101 101
   {
102 102
     $session[2] = pretty_time($session[2]);
103 103
     $session[0] = date(FMT_DATE_TIME_SQL, $session[0]);
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
 print("<td>ID</td><td>Username</td><td>Start</td><td>End</td><td>Length</td>");
112 112
 print("<td>Last online</td>");
113 113
 print("</tr>");
114
-foreach($session_list as $user_id => $value) {
114
+foreach ($session_list as $user_id => $value) {
115 115
   $user_record = doquery("SELECT `username`, onlinetime FROM {{users}} WHERE id = {$user_id};", true);
116
-  foreach($value as $interval_data) {
116
+  foreach ($value as $interval_data) {
117 117
     print("<tr>");
118 118
     print("<td>{$user_id}</td><td>{$user_record['username']}</td><td>{$interval_data[0]}</td><td>{$interval_data[1]}</td><td>{$interval_data[2]}</td>");
119 119
     print("<td>" . date(FMT_DATE_TIME_SQL, $user_record['onlinetime']) . "</td>");
Please login to merge, or discard this patch.
includes/functions/_news.php 1 patch
Spacing   +14 added lines, -15 removed lines patch added patch discarded remove patch
@@ -23,15 +23,15 @@  discard block
 block discarded – undo
23 23
   $template->assign_var('NEWS_COUNT', db_num_rows($announce_list));
24 24
 
25 25
   $users = array();
26
-  while($announce = db_fetch($announce_list)) {
27
-    if($announce['user_id'] && !isset($users[$announce['user_id']])) {
26
+  while ($announce = db_fetch($announce_list)) {
27
+    if ($announce['user_id'] && !isset($users[$announce['user_id']])) {
28 28
       $users[$announce['user_id']] = db_user_by_id($announce['user_id']);
29 29
     }
30 30
 
31 31
     $survey_vote = array('survey_vote_id' => 1);
32 32
     $survey_complete = strtotime($announce['survey_until']) < SN_TIME_NOW;
33 33
 
34
-    if($announce['survey_id'] && !empty($user['id'])) {
34
+    if ($announce['survey_id'] && !empty($user['id'])) {
35 35
       $survey_vote = !$survey_complete ? $survey_vote = doquery("SELECT `survey_vote_id` FROM `{{survey_votes}}` WHERE survey_parent_id = {$announce['survey_id']} AND survey_vote_user_id = {$user['id']} LIMIT 1;", true) : array();
36 36
     }
37 37
 
@@ -43,8 +43,7 @@  discard block
 block discarded – undo
43 43
       'ANNOUNCE'        => classSupernova::$gc->bbCodeParser->expandBbCode($announce['strAnnounce'], intval($announce['authlevel'])),
44 44
       'DETAIL_URL'      => $announce['detail_url'],
45 45
       'USER_NAME'       =>
46
-        isset($users[$announce['user_id']]) && $users[$announce['user_id']] ? player_nick_render_to_html($users[$announce['user_id']], array('color' => true)):
47
-        js_safe_string($announce['user_name']),
46
+        isset($users[$announce['user_id']]) && $users[$announce['user_id']] ? player_nick_render_to_html($users[$announce['user_id']], array('color' => true)) : js_safe_string($announce['user_name']),
48 47
       'NEW'             => $announce['unix_time'] + $config->game_news_actual >= SN_TIME_NOW,
49 48
       'FUTURE'          => $announce['unix_time'] > SN_TIME_NOW,
50 49
       'SURVEY_ID'       => $announce['survey_id'],
@@ -54,13 +53,13 @@  discard block
 block discarded – undo
54 53
       'SURVEY_UNTIL'    => $announce['survey_until'],
55 54
     ));
56 55
 
57
-    foreach($announce_exploded as $announce_paragraph) {
56
+    foreach ($announce_exploded as $announce_paragraph) {
58 57
       $template->assign_block_vars('announces.paragraph', array(
59 58
         'TEXT' => $announce_paragraph,
60 59
       ));
61 60
     }
62 61
 
63
-    if($announce['survey_id']) {
62
+    if ($announce['survey_id']) {
64 63
       $survey_query = doquery(
65 64
         "SELECT survey_answer_text AS `TEXT`, count(DISTINCT survey_vote_id) AS `VOTES`
66 65
           FROM `{{survey_answers}}` AS sa
@@ -71,15 +70,15 @@  discard block
 block discarded – undo
71 70
       );
72 71
       $survey_vote_result = array();
73 72
       $total_votes = 0;
74
-      while($row = db_fetch($survey_query)) {
73
+      while ($row = db_fetch($survey_query)) {
75 74
         $survey_vote_result[] = $row;
76 75
         $total_votes += $row['VOTES'];
77 76
       }
78 77
 
79
-      if(empty($survey_vote) && !$survey_complete) {
78
+      if (empty($survey_vote) && !$survey_complete) {
80 79
         // Can vote
81 80
         $survey_query = doquery("SELECT * FROM {{survey_answers}} WHERE survey_parent_id  = {$announce['survey_id']} ORDER BY survey_answer_id;");
82
-        while($row = db_fetch($survey_query)) {
81
+        while ($row = db_fetch($survey_query)) {
83 82
           $template->assign_block_vars('announces.survey_answers', array(
84 83
             'ID' => $row['survey_answer_id'],
85 84
             'TEXT' => $row['survey_answer_text'],
@@ -87,7 +86,7 @@  discard block
 block discarded – undo
87 86
         }
88 87
       } else {
89 88
         // Show result
90
-        foreach($survey_vote_result as &$vote_result) {
89
+        foreach ($survey_vote_result as &$vote_result) {
91 90
           $vote_percent = $total_votes ? $vote_result['VOTES'] / $total_votes * 100 : 0;
92 91
           $vote_result['PERCENT'] = $vote_percent;
93 92
           $vote_result['PERCENT_TEXT'] = round($vote_percent, 1);
@@ -104,7 +103,7 @@  discard block
 block discarded – undo
104 103
 }
105 104
 
106 105
 function nws_mark_read(&$user) {
107
-  if(isset($user['id'])) {
106
+  if (isset($user['id'])) {
108 107
     db_user_set_by_id($user['id'], '`news_lastread` = ' . SN_TIME_NOW);
109 108
     $user['news_lastread'] = SN_TIME_NOW;
110 109
   }
@@ -112,17 +111,17 @@  discard block
 block discarded – undo
112 111
 }
113 112
 
114 113
 function survey_vote(&$user) {
115
-  if(empty($user['id'])) {
114
+  if (empty($user['id'])) {
116 115
     return true;
117 116
   }
118 117
 
119 118
   sn_db_transaction_start();
120 119
   $survey_id = sys_get_param_id('survey_id');
121 120
   $is_voted = doquery("SELECT `survey_vote_id` FROM `{{survey_votes}}` WHERE survey_parent_id = {$survey_id} AND survey_vote_user_id = {$user['id']} FOR UPDATE;", true);
122
-  if(empty($is_voted)) {
121
+  if (empty($is_voted)) {
123 122
     $survey_vote_id = sys_get_param_id('survey_vote');
124 123
     $is_answer_exists = doquery("SELECT `survey_answer_id` FROM `{{survey_answers}}` WHERE survey_parent_id = {$survey_id} AND survey_answer_id = {$survey_vote_id};", true);
125
-    if(!empty($is_answer_exists)) {
124
+    if (!empty($is_answer_exists)) {
126 125
       $user_name_safe = db_escape($user['username']);
127 126
       doquery("INSERT INTO {{survey_votes}} SET `survey_parent_id` = {$survey_id}, `survey_parent_answer_id` = {$survey_vote_id}, `survey_vote_user_id` = {$user['id']}, `survey_vote_user_name` = '{$user_name_safe}';");
128 127
     }
Please login to merge, or discard this patch.
includes/functions/flt_mission_missile.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
   $mip_data = get_unit_param(UNIT_DEF_MISSILE_INTERPLANET);
15 15
   $MIPDamage = floor(mrc_modify_value($attackerTech, false, TECH_WEAPON, $MIPs * $mip_data[P_ATTACK] * mt_rand(80, 120) / 100));
16
-  foreach($structures as $key => $structure)
16
+  foreach ($structures as $key => $structure)
17 17
   {
18 18
     $unit_info = get_unit_param($key);
19 19
     $amplify = isset($mip_data[P_AMPLIFY][$key]) ? $mip_data[P_AMPLIFY][$key] : 1;
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
   {
32 32
     //attacking only selected structure
33 33
     $damageDone = $structures[$targetedStructure][$damageTo];
34
-    $structsDestroyed = min( floor($MIPDamage/$damageDone), $structures[$targetedStructure][0] );
34
+    $structsDestroyed = min(floor($MIPDamage / $damageDone), $structures[$targetedStructure][0]);
35 35
     $structures[$targetedStructure][0] -= $structsDestroyed;
36
-    $MIPDamage -= $structsDestroyed*$damageDone;
36
+    $MIPDamage -= $structsDestroyed * $damageDone;
37 37
   }
38 38
   else
39 39
   {
@@ -44,16 +44,16 @@  discard block
 block discarded – undo
44 44
     do
45 45
     {
46 46
       // finding is there any structure that can be damaged with leftovers of $MIPDamage
47
-      foreach($can_be_damaged as $key => $unit_id)
47
+      foreach ($can_be_damaged as $key => $unit_id)
48 48
       {
49 49
 //debug($structures[$unit_id][0]);
50 50
 //debug($structures[$unit_id][$damageTo], $MIPDamage);
51
-        if($structures[$unit_id][0] <= 0 || $structures[$unit_id][$damageTo] > $MIPDamage)
51
+        if ($structures[$unit_id][0] <= 0 || $structures[$unit_id][$damageTo] > $MIPDamage)
52 52
         {
53 53
           unset($can_be_damaged[$key]);
54 54
         }
55 55
       }
56
-      if(empty($can_be_damaged))
56
+      if (empty($can_be_damaged))
57 57
       {
58 58
         break;
59 59
       }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 //debug($destroyed, 'Actually destroyed');
73 73
 
74 74
 //print('<hr>');
75
-    } while($MIPDamage > 0 && !empty($can_be_damaged));
75
+    } while ($MIPDamage > 0 && !empty($can_be_damaged));
76 76
 //debug($MIPDamage, 'MIPDamage left');
77 77
   }
78 78
 //debug($structures);//die();
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
     $crystal += $destroyed * $unit_info[P_COST][RES_CRYSTAL] / 4;
88 88
   }
89 89
 
90
-  $return['structures'] = $structures;     // Structures left after attack
91
-  $return['metal']      = floor($metal);   // Metal scraps
90
+  $return['structures'] = $structures; // Structures left after attack
91
+  $return['metal']      = floor($metal); // Metal scraps
92 92
   $return['crystal']    = floor($crystal); // Crystal scraps
93 93
 
94 94
   return $return;
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
   $iraks = doquery("SELECT * FROM {{iraks}} WHERE `fleet_end_time` <= " . SN_TIME_NOW . " FOR UPDATE;");
114 114
 
115
-  while($fleetRow = db_fetch($iraks)) {
115
+  while ($fleetRow = db_fetch($iraks)) {
116 116
     set_time_limit(15);
117 117
     $db_changeset = array();
118 118
 
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 
129 129
     $rowAttacker = db_user_by_id($fleetRow['fleet_owner'], true);
130 130
 
131
-    if($target_planet_row['id']) {
131
+    if ($target_planet_row['id']) {
132 132
       $planetDefense = array();
133
-      foreach(sn_get_groups('defense_active') as $unit_id) {
133
+      foreach (sn_get_groups('defense_active') as $unit_id) {
134 134
         $planetDefense[$unit_id] = array(mrc_get_level($targetUser, $target_planet_row, $unit_id, true, true));
135 135
       }
136 136
 
@@ -141,23 +141,23 @@  discard block
 block discarded – undo
141 141
         $message = $lang['mip_all_destroyed'];
142 142
         $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit(UNIT_DEF_MISSILE_INTERCEPTOR, -$missiles, $targetUser, $target_planet_row['id']);
143 143
       } else {
144
-        if($interceptors) {
144
+        if ($interceptors) {
145 145
           $message = sprintf($lang['mip_destroyed'], $interceptors);
146 146
           $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit(UNIT_DEF_MISSILE_INTERCEPTOR, -$interceptors, $targetUser, $target_planet_row['id']);
147 147
         }
148 148
 
149 149
         $attackResult = COE_missileAttack($targetUser, $rowAttacker, $missiles - $interceptors, $planetDefense, $fleetRow['primaer']);
150 150
 
151
-        foreach($attackResult['structures'] as $key => $structure) {
151
+        foreach ($attackResult['structures'] as $key => $structure) {
152 152
           $destroyed = $planetDefense[$key][0] - $structure[0];
153
-          if($destroyed) {
153
+          if ($destroyed) {
154 154
             $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($key, -$destroyed, $targetUser, $target_planet_row['id']);
155 155
 
156 156
             $message .= "&nbsp;&nbsp;{$lang['tech'][$key]} - {$destroyed} {$lang['quantity']}<br>";
157 157
           }
158 158
         }
159 159
 
160
-        if(!empty($message)) {
160
+        if (!empty($message)) {
161 161
           $message = $lang['mip_defense_destroyed'] . $message . "{$lang['mip_recycled']}{$lang['Metal']}: {$attackResult['metal']}, {$lang['Crystal']}: {$attackResult['crystal']}<br>";
162 162
 
163 163
           DBStaticPlanet::db_planet_set_by_id($target_planet_row['id'], "`metal` = `metal` + {$attackResult['metal']}, `crystal` = `crystal` + {$attackResult['crystal']}");
@@ -174,8 +174,8 @@  discard block
 block discarded – undo
174 174
 
175 175
       empty($message) ? $message = $lang['mip_no_defense'] : false;
176 176
 
177
-      msg_send_simple_message ( $fleetRow['fleet_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, $lang['mip_sender_amd'], $lang['mip_subject_amd'], $message_vorlage . $message );
178
-      msg_send_simple_message ( $fleetRow['fleet_target_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, $lang['mip_sender_amd'], $lang['mip_subject_amd'], $message_vorlage . $message );
177
+      msg_send_simple_message($fleetRow['fleet_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, $lang['mip_sender_amd'], $lang['mip_subject_amd'], $message_vorlage . $message);
178
+      msg_send_simple_message($fleetRow['fleet_target_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, $lang['mip_sender_amd'], $lang['mip_subject_amd'], $message_vorlage . $message);
179 179
     }
180 180
     doquery("DELETE FROM {{iraks}} WHERE id = '{$fleetRow['id']}';");
181 181
   }
Please login to merge, or discard this patch.
includes/pages/admin/user_view.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -186,11 +186,11 @@
 block discarded – undo
186 186
   }
187 187
 
188 188
   $exclude = $user_row;
189
-  foreach($blocks as $title => $fields) {
189
+  foreach ($blocks as $title => $fields) {
190 190
     userBlockAssign($exclude, $template, $title, $fields);
191 191
   }
192 192
 
193
-  if(!empty($exclude)) {
193
+  if (!empty($exclude)) {
194 194
     userBlockAssign($exclude, $template, '!!! НЕИЗВЕСТНЫЕ ПАРАМЕТРЫ !!!', array_keys($exclude));
195 195
   }
196 196
 
Please login to merge, or discard this patch.
includes/db.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * @copyright 2008-2015 Gorlum for Project "SuperNova.WS"
6 6
  */
7 7
 
8
-if(!defined('INSIDE')) {
8
+if (!defined('INSIDE')) {
9 9
   die();
10 10
 }
11 11
 
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
 function db_change_units_perform($query, $tablename, $object_id) {
15 15
   $query = implode(',', $query);
16
-  if($query && $object_id) {
16
+  if ($query && $object_id) {
17 17
     return classSupernova::db_upd_record_by_id($tablename == 'users' ? LOC_USER : LOC_PLANET, $object_id, $query);
18 18
   }
19 19
 }
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
 
30 30
   $group = sn_get_groups('resources_loot');
31 31
 
32
-  foreach($unit_list as $unit_id => $unit_amount) {
33
-    if(!in_array($unit_id, $group)) {
32
+  foreach ($unit_list as $unit_id => $unit_amount) {
33
+    if (!in_array($unit_id, $group)) {
34 34
       // TODO - remove later
35 35
       print('<h1>СООБЩИТЕ ЭТО АДМИНУ: db_change_units() вызван для не-ресурсов!</h1>');
36 36
       pdump(debug_backtrace());
37 37
       die('db_change_units() вызван для не-ресурсов!');
38 38
     }
39 39
 
40
-    if(!$unit_amount) {
40
+    if (!$unit_amount) {
41 41
       continue;
42 42
     }
43 43
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     $unit_location = sys_get_unit_location($user, $planet, $unit_id);
47 47
 
48 48
     // Changing value in object
49
-    switch($unit_location) {
49
+    switch ($unit_location) {
50 50
       case LOC_USER:
51 51
         $user[$unit_db_name] += $unit_amount;
52 52
         break;
Please login to merge, or discard this patch.
includes/vars.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
   SNC_VER_ERROR_MISSMATCH_KEY_ID => 'error',
167 167
 );
168 168
 
169
-$tableList = array( 'aks', 'alliance', 'alliance_requests', 'announce', 'annonce', 'banned', 'buddy', 'chat', 'config', 'counter',
169
+$tableList = array('aks', 'alliance', 'alliance_requests', 'announce', 'annonce', 'banned', 'buddy', 'chat', 'config', 'counter',
170 170
   'errors', 'fleets', 'fleet_log', 'galaxy', 'iraks', 'logs', 'log_dark_matter', 'messages', 'notes', 'planets', 'quest',
171 171
   'quest_status', 'referrals', 'rw', 'statpoints', 'users'
172 172
 );
@@ -257,14 +257,14 @@  discard block
 block discarded – undo
257 257
 $user_option_list = array();
258 258
 
259 259
 $user_option_list[OPT_MESSAGE] = array();
260
-foreach($sn_message_class_list as $message_class_id => $message_class_data)
260
+foreach ($sn_message_class_list as $message_class_id => $message_class_data)
261 261
 {
262
-  if($message_class_data['switchable'])
262
+  if ($message_class_data['switchable'])
263 263
   {
264 264
     $user_option_list[OPT_MESSAGE]["opt_{$message_class_data['name']}"] = 1;
265 265
   }
266 266
 
267
-  if($message_class_data['email'])
267
+  if ($message_class_data['email'])
268 268
   {
269 269
     $user_option_list[OPT_MESSAGE]["opt_email_{$message_class_data['name']}"] = 0;
270 270
   }
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
         UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_ICE_HYDROGEN,
848 848
         UNIT_PLANET_DENSITY_RARITY => 30, // 1, // 40.00, // * 1/121 0,82645
849 849
         UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_PERFECT,
850
-        UNIT_RESOURCES => array(RES_METAL => 0.20, RES_CRYSTAL => 0.60, RES_DEUTERIUM => 7.10, ),
850
+        UNIT_RESOURCES => array(RES_METAL => 0.20, RES_CRYSTAL => 0.60, RES_DEUTERIUM => 7.10,),
851 851
         UNIT_PLANET_DENSITY_MAX_SECTORS => 150,
852 852
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 11,
853 853
       ),
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
         UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_ICE_METHANE,
857 857
         UNIT_PLANET_DENSITY_RARITY =>  130, // 6, // 6.67, // * 6,0	4,95868
858 858
         UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_GOOD,
859
-        UNIT_RESOURCES => array(RES_METAL => 0.55, RES_CRYSTAL => 0.85, RES_DEUTERIUM => 4.60, ),
859
+        UNIT_RESOURCES => array(RES_METAL => 0.55, RES_CRYSTAL => 0.85, RES_DEUTERIUM => 4.60,),
860 860
         UNIT_PLANET_DENSITY_MAX_SECTORS => 200,
861 861
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 6,
862 862
       ),
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
         UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_ICE_WATER,
866 866
         UNIT_PLANET_DENSITY_RARITY =>  450, //20, // 2.00, // * 20,0	16,52893
867 867
         UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_AVERAGE,
868
-        UNIT_RESOURCES => array(RES_METAL => 0.86, RES_CRYSTAL => 0.95, RES_DEUTERIUM => 2.20, ),
868
+        UNIT_RESOURCES => array(RES_METAL => 0.86, RES_CRYSTAL => 0.95, RES_DEUTERIUM => 2.20,),
869 869
         UNIT_PLANET_DENSITY_MAX_SECTORS => 999,
870 870
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 0,
871 871
       ),
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
         UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_CRYSTAL_RAW,
876 876
         UNIT_PLANET_DENSITY_RARITY => 20, // 1, // 40.00, // *1,0	0,82645
877 877
         UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_PERFECT,
878
-        UNIT_RESOURCES => array(RES_METAL => 0.40, RES_CRYSTAL => 12.37, RES_DEUTERIUM => 0.50, ),
878
+        UNIT_RESOURCES => array(RES_METAL => 0.40, RES_CRYSTAL => 12.37, RES_DEUTERIUM => 0.50,),
879 879
         UNIT_PLANET_DENSITY_MAX_SECTORS => 150,
880 880
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 11,
881 881
       ),
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
         UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_CRYSTAL_SILICATE,
885 885
         UNIT_PLANET_DENSITY_RARITY => 140, // 5.71, // * 7,0	5,78512
886 886
         UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_GOOD,
887
-        UNIT_RESOURCES => array(RES_METAL => 0.67, RES_CRYSTAL => 4.50, RES_DEUTERIUM => 0.85, ),
887
+        UNIT_RESOURCES => array(RES_METAL => 0.67, RES_CRYSTAL => 4.50, RES_DEUTERIUM => 0.85,),
888 888
         UNIT_PLANET_DENSITY_MAX_SECTORS => 200,
889 889
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 6,
890 890
       ),
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
         UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_CRYSTAL_STONE,
894 894
         UNIT_PLANET_DENSITY_RARITY => 500, // 1.90, // * 21,0	17,35537
895 895
         UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_AVERAGE,
896
-        UNIT_RESOURCES => array(RES_METAL => 0.80, RES_CRYSTAL => 2.00, RES_DEUTERIUM => 0.95, ),
896
+        UNIT_RESOURCES => array(RES_METAL => 0.80, RES_CRYSTAL => 2.00, RES_DEUTERIUM => 0.95,),
897 897
         UNIT_PLANET_DENSITY_MAX_SECTORS => 999,
898 898
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 0,
899 899
       ),
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
         UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_STANDARD,
904 904
         UNIT_PLANET_DENSITY_RARITY => 1000, // 1.0, // * 40,0	33,05785
905 905
         UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_NORMAL,
906
-        UNIT_RESOURCES => array(RES_METAL => 1.00, RES_CRYSTAL => 1.00, RES_DEUTERIUM => 1.00, ),
906
+        UNIT_RESOURCES => array(RES_METAL => 1.00, RES_CRYSTAL => 1.00, RES_DEUTERIUM => 1.00,),
907 907
         UNIT_PLANET_DENSITY_MAX_SECTORS => 999,
908 908
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 0,
909 909
       ),
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
         UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_METAL_ORE,
914 914
         UNIT_PLANET_DENSITY_RARITY => 550, // 2.11, // * 19,0	15,70248
915 915
         UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_AVERAGE,
916
-        UNIT_RESOURCES => array(RES_METAL => 1.60, RES_CRYSTAL => 0.90, RES_DEUTERIUM => 0.80, ),
916
+        UNIT_RESOURCES => array(RES_METAL => 1.60, RES_CRYSTAL => 0.90, RES_DEUTERIUM => 0.80,),
917 917
         UNIT_PLANET_DENSITY_MAX_SECTORS => 999,
918 918
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 0,
919 919
       ),
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
         UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_METAL_PERIDOT,
923 923
         UNIT_PLANET_DENSITY_RARITY => 120, // 8.00, // * 5,0	4,13223
924 924
         UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_GOOD,
925
-        UNIT_RESOURCES => array(RES_METAL => 4.71, RES_CRYSTAL => 0.80, RES_DEUTERIUM => 0.55, ),
925
+        UNIT_RESOURCES => array(RES_METAL => 4.71, RES_CRYSTAL => 0.80, RES_DEUTERIUM => 0.55,),
926 926
         UNIT_PLANET_DENSITY_MAX_SECTORS => 200,
927 927
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 6,
928 928
       ),
@@ -931,7 +931,7 @@  discard block
 block discarded – undo
931 931
         UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_METAL_RAW,
932 932
         UNIT_PLANET_DENSITY_RARITY => 25, // 40.00, // * 1,0	0,82645
933 933
         UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_PERFECT,
934
-        UNIT_RESOURCES => array(RES_METAL => 8.00, RES_CRYSTAL => 0.40, RES_DEUTERIUM => 0.25, ),
934
+        UNIT_RESOURCES => array(RES_METAL => 8.00, RES_CRYSTAL => 0.40, RES_DEUTERIUM => 0.25,),
935 935
         UNIT_PLANET_DENSITY_MAX_SECTORS => 150,
936 936
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 11,
937 937
       ),
@@ -1061,7 +1061,7 @@  discard block
 block discarded – undo
1061 1061
     ),
1062 1062
 
1063 1063
     // Tech list
1064
-    'tech'      => array (
1064
+    'tech'      => array(
1065 1065
       TECH_ARMOR => TECH_ARMOR, TECH_WEAPON => TECH_WEAPON, TECH_SHIELD => TECH_SHIELD,
1066 1066
       TECH_SPY => TECH_SPY, TECH_COMPUTER => TECH_COMPUTER,
1067 1067
       TECH_ENERGY => TECH_ENERGY, TECH_LASER => TECH_LASER, TECH_ION => TECH_ION, TECH_PLASMA => TECH_PLASMA, TECH_HYPERSPACE => TECH_HYPERSPACE,
@@ -1072,7 +1072,7 @@  discard block
 block discarded – undo
1072 1072
     ),
1073 1073
 
1074 1074
     // Mercenaries
1075
-    'mercenaries' => array (
1075
+    'mercenaries' => array(
1076 1076
       MRC_STOCKMAN => MRC_STOCKMAN, MRC_SPY => MRC_SPY, MRC_ACADEMIC => MRC_ACADEMIC,
1077 1077
       MRC_ADMIRAL => MRC_ADMIRAL, MRC_COORDINATOR => MRC_COORDINATOR, MRC_NAVIGATOR => MRC_NAVIGATOR,
1078 1078
     ),
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
       SHIP_RECYCLER => SHIP_RECYCLER, SHIP_COLONIZER => SHIP_COLONIZER, SHIP_SPY => SHIP_SPY, SHIP_SATTELITE_SOLAR => SHIP_SATTELITE_SOLAR
1099 1099
      ),
1100 1100
     // Defensive building list
1101
-    'defense'   => array (UNIT_DEF_TURRET_MISSILE => UNIT_DEF_TURRET_MISSILE, UNIT_DEF_TURRET_LASER_SMALL => UNIT_DEF_TURRET_LASER_SMALL,
1101
+    'defense'   => array(UNIT_DEF_TURRET_MISSILE => UNIT_DEF_TURRET_MISSILE, UNIT_DEF_TURRET_LASER_SMALL => UNIT_DEF_TURRET_LASER_SMALL,
1102 1102
                           UNIT_DEF_TURRET_LASER_BIG => UNIT_DEF_TURRET_LASER_BIG, UNIT_DEF_TURRET_GAUSS => UNIT_DEF_TURRET_GAUSS,
1103 1103
                           UNIT_DEF_TURRET_ION => UNIT_DEF_TURRET_ION, UNIT_DEF_TURRET_PLASMA => UNIT_DEF_TURRET_PLASMA,
1104 1104
 
@@ -1108,7 +1108,7 @@  discard block
 block discarded – undo
1108 1108
     ),
1109 1109
 
1110 1110
     // Missiles list
1111
-    'missile'   => array (UNIT_DEF_MISSILE_INTERCEPTOR => UNIT_DEF_MISSILE_INTERCEPTOR, UNIT_DEF_MISSILE_INTERPLANET => UNIT_DEF_MISSILE_INTERPLANET, ),
1111
+    'missile'   => array(UNIT_DEF_MISSILE_INTERCEPTOR => UNIT_DEF_MISSILE_INTERCEPTOR, UNIT_DEF_MISSILE_INTERPLANET => UNIT_DEF_MISSILE_INTERPLANET,),
1112 1112
 
1113 1113
     // Combat units list
1114 1114
     'combat'    => array(
@@ -1148,9 +1148,9 @@  discard block
 block discarded – undo
1148 1148
     ),
1149 1149
 
1150 1150
     // Resource list
1151
-    'resources' => array ( 0 => 'metal', 1 => 'crystal', 2 => 'deuterium', 3 => 'dark_matter'),
1151
+    'resources' => array(0 => 'metal', 1 => 'crystal', 2 => 'deuterium', 3 => 'dark_matter'),
1152 1152
     // Resources all
1153
-    'resources_all' => array(RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_ENERGY => RES_ENERGY, RES_DARK_MATTER => RES_DARK_MATTER, RES_METAMATTER => RES_METAMATTER, ),
1153
+    'resources_all' => array(RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_ENERGY => RES_ENERGY, RES_DARK_MATTER => RES_DARK_MATTER, RES_METAMATTER => RES_METAMATTER,),
1154 1154
     // Resources can be produced on planet
1155 1155
     'resources_planet' => array(RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_ENERGY => RES_ENERGY),
1156 1156
     // Resources can be looted from planet
@@ -1169,13 +1169,13 @@  discard block
 block discarded – undo
1169 1169
     ),
1170 1170
 
1171 1171
     // Resources that can be tradeable in market trader AND be a quest_rewards
1172
-    'quest_rewards' => array(RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_DARK_MATTER => RES_DARK_MATTER, ),
1172
+    'quest_rewards' => array(RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_DARK_MATTER => RES_DARK_MATTER,),
1173 1173
 
1174 1174
 //      // Ques list
1175 1175
 //      'ques' => array(QUE_STRUCTURES, QUE_HANGAR, QUE_RESEARCH),
1176 1176
 
1177
-    'STAT_COMMON' => array(STAT_TOTAL => STAT_TOTAL, STAT_FLEET => STAT_FLEET, STAT_TECH => STAT_TECH, STAT_BUILDING => STAT_BUILDING, STAT_DEFENSE => STAT_DEFENSE, STAT_RESOURCE => STAT_RESOURCE, ),
1178
-    'STAT_PLAYER' => array(STAT_RAID_TOTAL => STAT_RAID_TOTAL, STAT_RAID_WON => STAT_RAID_WON, STAT_RAID_LOST => STAT_RAID_LOST, STAT_LVL_BUILDING => STAT_LVL_BUILDING, STAT_LVL_TECH => STAT_LVL_TECH, STAT_LVL_RAID => STAT_LVL_RAID, ),
1177
+    'STAT_COMMON' => array(STAT_TOTAL => STAT_TOTAL, STAT_FLEET => STAT_FLEET, STAT_TECH => STAT_TECH, STAT_BUILDING => STAT_BUILDING, STAT_DEFENSE => STAT_DEFENSE, STAT_RESOURCE => STAT_RESOURCE,),
1178
+    'STAT_PLAYER' => array(STAT_RAID_TOTAL => STAT_RAID_TOTAL, STAT_RAID_WON => STAT_RAID_WON, STAT_RAID_LOST => STAT_RAID_LOST, STAT_LVL_BUILDING => STAT_LVL_BUILDING, STAT_LVL_TECH => STAT_LVL_TECH, STAT_LVL_RAID => STAT_LVL_RAID,),
1179 1179
   ),
1180 1180
 );
1181 1181
 
Please login to merge, or discard this patch.
includes/alliance/ali_internal_admin_mail.inc 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 global $lang;
4 4
 
5
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
5
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
6 6
 {
7 7
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
8 8
 }
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 $page = gettemplate('ali_admin_mail', true);
21 21
 
22 22
 if ($ranks) {
23
-  foreach($ranks as $id => $array) {
23
+  foreach ($ranks as $id => $array) {
24 24
     $page->assign_block_vars('ranks', array(
25 25
       'NAME' => $array['name'],
26 26
       'VALUE' => $id,
Please login to merge, or discard this patch.