Completed
Push — trunk ( cc9b3e...f009e4 )
by SuperNova.WS
04:37
created
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/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.
includes/includes/upd_helpers.php 1 patch
Spacing   +38 added lines, -38 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('IN_UPDATE')) {
3
+if (!defined('IN_UPDATE')) {
4 4
   die('Trying to call update helpers externally!');
5 5
 }
6 6
 
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
8 8
   global $update_tables;
9 9
 
10 10
   upd_add_more_time();
11
-  if(!$no_log) {
11
+  if (!$no_log) {
12 12
     upd_log_message("Performing query '{$query}'");
13 13
   }
14 14
 
15
-  if(strpos($query, '{{') !== false) {
16
-    foreach($update_tables as $tableName => $cork) {
15
+  if (strpos($query, '{{') !== false) {
16
+    foreach ($update_tables as $tableName => $cork) {
17 17
       $query = str_replace("{{{$tableName}}}", classSupernova::$db->db_prefix . $tableName, $query);
18 18
     }
19 19
   }
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
   global $config, $sys_log_disabled;
26 26
 
27 27
   $config->db_loadItem($key);
28
-  if($condition || !isset($config->$key)) {
28
+  if ($condition || !isset($config->$key)) {
29 29
     upd_add_more_time();
30
-    if(!$sys_log_disabled) {
30
+    if (!$sys_log_disabled) {
31 31
       upd_log_message("Updating config key '{$key}' with value '{$default_value}'");
32 32
     }
33 33
     $config->db_saveItem($key, $default_value);
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 function upd_log_message($message) {
56 56
   global $sys_log_disabled, $upd_log, $debug;
57 57
 
58
-  if($sys_log_disabled)
58
+  if ($sys_log_disabled)
59 59
   {
60 60
 //    print("{$message}<br />");
61 61
   } else {
@@ -67,15 +67,15 @@  discard block
 block discarded – undo
67 67
 function upd_unset_table_info($table_name) {
68 68
   global $update_tables, $update_indexes, $update_foreigns;
69 69
 
70
-  if(isset($update_tables[$table_name])) {
70
+  if (isset($update_tables[$table_name])) {
71 71
     unset($update_tables[$table_name]);
72 72
   }
73 73
 
74
-  if(isset($update_indexes[$table_name])) {
74
+  if (isset($update_indexes[$table_name])) {
75 75
     unset($update_indexes[$table_name]);
76 76
   }
77 77
 
78
-  if(isset($update_foreigns[$table_name])) {
78
+  if (isset($update_foreigns[$table_name])) {
79 79
     unset($update_foreigns[$table_name]);
80 80
   }
81 81
 }
@@ -89,18 +89,18 @@  discard block
 block discarded – undo
89 89
   upd_unset_table_info($tableName);
90 90
 
91 91
   $q1 = upd_do_query("SHOW FULL COLUMNS FROM {$prefix_table_name};", true);
92
-  while($r1 = db_fetch($q1)) {
92
+  while ($r1 = db_fetch($q1)) {
93 93
     $update_tables[$tableName][$r1['Field']] = $r1;
94 94
   }
95 95
 
96 96
   $q1 = upd_do_query("SHOW INDEX FROM {$prefix_table_name};", true);
97
-  while($r1 = db_fetch($q1)) {
97
+  while ($r1 = db_fetch($q1)) {
98 98
     $update_indexes[$tableName][$r1['Key_name']] .= "{$r1['Column_name']},";
99 99
     $update_indexes_full[$tableName][$r1['Key_name']][$r1['Column_name']] = $r1;
100 100
   }
101 101
 
102
-  $q1 = upd_do_query("SELECT * FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = '" . db_escape(classSupernova::$db_name). "' AND TABLE_NAME = '{$prefix_table_name}' AND REFERENCED_TABLE_NAME is not null;", true);
103
-  while($r1 = db_fetch($q1)) {
102
+  $q1 = upd_do_query("SELECT * FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = '" . db_escape(classSupernova::$db_name) . "' AND TABLE_NAME = '{$prefix_table_name}' AND REFERENCED_TABLE_NAME is not null;", true);
103
+  while ($r1 = db_fetch($q1)) {
104 104
     $table_referenced = str_replace($config->db_prefix, '', $r1['REFERENCED_TABLE_NAME']);
105 105
 
106 106
     $update_foreigns[$tableName][$r1['CONSTRAINT_NAME']] .= "{$r1['COLUMN_NAME']},{$table_referenced},{$r1['REFERENCED_COLUMN_NAME']};";
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 function upd_alter_table($table, $alters, $condition = true) {
111 111
   global $config, $update_tables;
112 112
 
113
-  if(!$condition) {
113
+  if (!$condition) {
114 114
     return;
115 115
   }
116 116
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
   $alters_print = is_array($alters) ? dump($alters) : $alters;
119 119
   upd_log_message("Altering table '{$table}' with alterations {$alters_print}");
120 120
 
121
-  if(!is_array($alters)) {
121
+  if (!is_array($alters)) {
122 122
     $alters = array($alters);
123 123
   }
124 124
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 
129 129
   $result = upd_do_query($qry);
130 130
   $error = db_error();
131
-  if($error) {
131
+  if ($error) {
132 132
     die("Altering error for table `{$table}`: {$error}<br />{$alters_print}");
133 133
   }
134 134
 
@@ -155,19 +155,19 @@  discard block
 block discarded – undo
155 155
 function upd_create_table($table_name, $declaration, $tableOptions = '') {
156 156
   global $config, $update_tables;
157 157
 
158
-  if(!$update_tables[$table_name]) {
158
+  if (!$update_tables[$table_name]) {
159 159
     upd_do_query('set foreign_key_checks = 0;', true);
160 160
     $declaration = trim($declaration);
161
-    if(substr($declaration, 0, 1) != '(') {
161
+    if (substr($declaration, 0, 1) != '(') {
162 162
       $declaration = "($declaration)";
163 163
     }
164 164
     $tableOptions = trim($tableOptions);
165
-    if(!empty($tableOptions)) {
165
+    if (!empty($tableOptions)) {
166 166
       $declaration .= $tableOptions;
167 167
     }
168 168
     $result = upd_do_query("CREATE TABLE IF NOT EXISTS `{$config->db_prefix}{$table_name}` {$declaration}");
169 169
     $error = db_error();
170
-    if($error) {
170
+    if ($error) {
171 171
       die("Creating error for table `{$table_name}`: {$error}<br />" . dump($declaration));
172 172
     }
173 173
     upd_do_query('set foreign_key_checks = 1;', true);
@@ -193,14 +193,14 @@  discard block
 block discarded – undo
193 193
 
194 194
 
195 195
 function upd_db_unit_changeset_prepare($unit_id, $unit_value, $user, $planet_id = null) {
196
-  if(!is_array($user)) {
196
+  if (!is_array($user)) {
197 197
     // TODO - remove later
198 198
     print('<h1>СООБЩИТЕ ЭТО АДМИНУ: upd_db_unit_changeset_prepare() - USER is not ARRAY</h1>');
199 199
     pdump(debug_backtrace());
200 200
     die('USER is not ARRAY');
201 201
   }
202 202
 
203
-  if(!isset($user['id']) || !$user['id']) {
203
+  if (!isset($user['id']) || !$user['id']) {
204 204
     // TODO - remove later
205 205
     print('<h1>СООБЩИТЕ ЭТО АДМИНУ: upd_db_unit_changeset_prepare() - USER[id] пустой</h1>');
206 206
     pdump($user);
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 
216 216
   $db_changeset = array();
217 217
   $temp = upd_db_unit_by_location($user['id'], $unit_location, $location_id, $unit_id, true, 'unit_id');
218
-  if($temp['unit_id']) {
218
+  if ($temp['unit_id']) {
219 219
     // update
220 220
     $db_changeset = array(
221 221
       'action' => SQL_OP_UPDATE,
@@ -261,53 +261,53 @@  discard block
 block discarded – undo
261 261
 
262 262
 
263 263
 function upd_db_changeset_apply($db_changeset) {
264
-  if(!is_array($db_changeset) || empty($db_changeset)) {
264
+  if (!is_array($db_changeset) || empty($db_changeset)) {
265 265
     return;
266 266
   }
267 267
 
268
-  foreach($db_changeset as $table_name => $table_data) {
269
-    foreach($table_data as $record_id => $conditions) {
268
+  foreach ($db_changeset as $table_name => $table_data) {
269
+    foreach ($table_data as $record_id => $conditions) {
270 270
       $where = '';
271
-      if(!empty($conditions['where'])) {
271
+      if (!empty($conditions['where'])) {
272 272
         $where = 'WHERE ' . implode(' AND ', $conditions['where']);
273 273
       }
274 274
 
275 275
       $fields = array();
276
-      if($conditions['fields']) {
277
-        foreach($conditions['fields'] as $field_name => $field_data) {
276
+      if ($conditions['fields']) {
277
+        foreach ($conditions['fields'] as $field_name => $field_data) {
278 278
           $condition = "`{$field_name}` = ";
279 279
           $value = '';
280
-          if($field_data['delta']) {
280
+          if ($field_data['delta']) {
281 281
             $value = "`{$field_name}`" . ($field_data['delta'] >= 0 ? '+' : '') . $field_data['delta'];
282
-          } elseif($field_data['set']) {
283
-            $value = (is_string($field_data['set']) ? "'{$field_data['set']}'": $field_data['set']);
282
+          } elseif ($field_data['set']) {
283
+            $value = (is_string($field_data['set']) ? "'{$field_data['set']}'" : $field_data['set']);
284 284
           }
285
-          if($value) {
285
+          if ($value) {
286 286
             $fields[] = $condition . $value;
287 287
           }
288 288
         }
289 289
       }
290 290
       $fields = implode(',', $fields);
291 291
 
292
-      switch($conditions['action']) {
292
+      switch ($conditions['action']) {
293 293
         case SQL_OP_DELETE:
294 294
           upd_do_query("DELETE FROM {{{$table_name}}} {$where}");
295 295
           break;
296 296
 
297 297
         case SQL_OP_UPDATE:
298
-          if($fields) {
298
+          if ($fields) {
299 299
             upd_do_query("UPDATE {{{$table_name}}} SET {$fields} {$where}");
300 300
           }
301 301
           break;
302 302
 
303 303
         case SQL_OP_INSERT:
304
-          if($fields) {
304
+          if ($fields) {
305 305
             upd_do_query("INSERT INTO {{{$table_name}}} SET {$fields}");
306 306
           }
307 307
           break;
308 308
 
309 309
         case SQL_OP_REPLACE:
310
-          if($fields) {
310
+          if ($fields) {
311 311
             upd_do_query("REPLACE INTO {{{$table_name}}} SET {$fields}");
312 312
           }
313 313
           break;
Please login to merge, or discard this patch.
jumpgate.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -14,39 +14,39 @@  discard block
 block discarded – undo
14 14
 
15 15
 lng_include('fleet');
16 16
 
17
-if($TargetPlanet = sys_get_param_id('jmpto'))
17
+if ($TargetPlanet = sys_get_param_id('jmpto'))
18 18
 {
19 19
   sn_db_transaction_start();
20 20
   db_user_by_id($user['id'], true, 'id');
21 21
   $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true);
22
-  if(!($NextJumpTime = uni_get_time_to_jump($planetrow)))
22
+  if (!($NextJumpTime = uni_get_time_to_jump($planetrow)))
23 23
   {
24 24
     $TargetGate = DBStaticPlanet::db_planet_by_id($TargetPlanet, true, '`id`, `last_jump_time`');
25
-    if(mrc_get_level($user, $TargetGate, STRUC_MOON_GATE) > 0)
25
+    if (mrc_get_level($user, $TargetGate, STRUC_MOON_GATE) > 0)
26 26
     {
27
-      $NextDestTime = uni_get_time_to_jump ( $TargetGate );
28
-      if(!$NextDestTime)
27
+      $NextDestTime = uni_get_time_to_jump($TargetGate);
28
+      if (!$NextDestTime)
29 29
       {
30 30
         // $SubQueryOri = "";
31 31
         // $SubQueryDes = "";
32 32
         $ship_list = sys_get_param('ships');
33 33
         $db_changeset = array();
34
-        foreach($ship_list as $ship_id => $ship_count)
34
+        foreach ($ship_list as $ship_id => $ship_count)
35 35
         {
36
-          if(!in_array($ship_id, sn_get_groups('fleet')))
36
+          if (!in_array($ship_id, sn_get_groups('fleet')))
37 37
           {
38 38
             continue;
39 39
           }
40 40
 
41 41
           $ship_count = max(0, min(floor($ship_count), mrc_get_level($user, $planetrow, $ship_id)));
42
-          if($ship_count)
42
+          if ($ship_count)
43 43
           {
44 44
             $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($ship_id, -$ship_count, $user, $planetrow['id']);
45 45
             $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($ship_id, $ship_count, $user, $TargetGate['id']);
46 46
           }
47 47
         }
48 48
         // Dit monsieur, y avait quelque chose a envoyer ???
49
-        if(!empty($db_changeset))
49
+        if (!empty($db_changeset))
50 50
         {
51 51
           DBStaticPlanet::db_planet_set_by_id($TargetGate['id'], "`last_jump_time` = " . SN_TIME_NOW . "");
52 52
           DBStaticPlanet::db_planet_set_by_id($planetrow['id'], "`last_jump_time` = " . SN_TIME_NOW . "");
@@ -55,31 +55,31 @@  discard block
 block discarded – undo
55 55
           db_user_set_by_id($user['id'], "`current_planet` = '{$TargetGate['id']}'");
56 56
 
57 57
           $planetrow['last_jump_time'] = SN_TIME_NOW;
58
-          $RetMessage = $lang['gate_jump_done'] ." - ". pretty_time(uni_get_time_to_jump($planetrow));
58
+          $RetMessage = $lang['gate_jump_done'] . " - " . pretty_time(uni_get_time_to_jump($planetrow));
59 59
         } else {
60 60
           $RetMessage = $lang['gate_wait_data'];
61 61
         }
62 62
       } else {
63
-        $RetMessage = $lang['gate_wait_dest'] ." - ". pretty_time($NextDestTime);
63
+        $RetMessage = $lang['gate_wait_dest'] . " - " . pretty_time($NextDestTime);
64 64
       }
65 65
     } else {
66 66
       $RetMessage = $lang['gate_no_dest_g'];
67 67
     }
68 68
   } else {
69
-    $RetMessage = $lang['gate_wait_star'] ." - ". pretty_time($NextJumpTime);
69
+    $RetMessage = $lang['gate_wait_star'] . " - " . pretty_time($NextJumpTime);
70 70
   }
71 71
   sn_db_transaction_commit();
72 72
   messageBox($RetMessage, $lang['tech'][STRUC_MOON_GATE], "jumpgate.php", 10);
73 73
 } else {
74 74
   $template = gettemplate('jumpgate', true);
75
-  if(mrc_get_level($user, $planetrow, STRUC_MOON_GATE) > 0)
75
+  if (mrc_get_level($user, $planetrow, STRUC_MOON_GATE) > 0)
76 76
   {
77 77
     $Combo = '';
78 78
     $MoonList = DBStaticPlanet::db_planet_list_moon_other($user['id'], $planetrow['id']);
79 79
     // while($CurMoon = db_fetch($MoonList))
80
-    foreach($MoonList as $CurMoon)
80
+    foreach ($MoonList as $CurMoon)
81 81
     {
82
-      if(mrc_get_level($user, $CurMoon, STRUC_MOON_GATE) >= 1)
82
+      if (mrc_get_level($user, $CurMoon, STRUC_MOON_GATE) >= 1)
83 83
       {
84 84
         $NextJumpTime = uni_get_time_to_jump($CurMoon);
85 85
         $template->assign_block_vars('moon', array(
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
       }
94 94
     }
95 95
 
96
-    foreach(sn_get_groups('fleet') as $Ship)
96
+    foreach (sn_get_groups('fleet') as $Ship)
97 97
     {
98
-      if(($ship_count = mrc_get_level($user, $planetrow, $Ship)) <= 0)
98
+      if (($ship_count = mrc_get_level($user, $planetrow, $Ship)) <= 0)
99 99
       {
100 100
         continue;
101 101
       }
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
   messageBox($lang['sys_blitz_page_disabled'], $lang['sys_error'], 'overview.php', 10);
17 17
   die();
18 18
 }
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
 
26 26
 $template = gettemplate('search', true);
27 27
 
28
-if($searchtext && $type)
28
+if ($searchtext && $type)
29 29
 {
30
-  switch($type)
30
+  switch ($type)
31 31
   {
32 32
     case "planetname":
33 33
       // $search = db_planet_list_search($searchtext);
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
     break;
44 44
   }
45 45
 
46
-  while($row = db_fetch($search))
46
+  while ($row = db_fetch($search))
47 47
   {
48
-    if($type=='playername' || $type=='planetname')
48
+    if ($type == 'playername' || $type == 'planetname')
49 49
     {
50 50
       $template->assign_block_vars('search_result', array(
51 51
         'PLAYER_ID' => $row['uid'],
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         'ALLY_TAG' => htmlentities($row['ally_tag'], ENT_COMPAT, 'UTF-8'),
63 63
       ));
64 64
     }
65
-    elseif($type=='ally')
65
+    elseif ($type == 'ally')
66 66
     {
67 67
       $template->assign_block_vars('search_result', array(
68 68
         'ALLY_NAME' => htmlentities($row['ally_name'], ENT_COMPAT, 'UTF-8'),
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
   'ally' => 'sys_alliance',
82 82
 );
83 83
 
84
-foreach($search_type as $type_id => $type_lang)
84
+foreach ($search_type as $type_id => $type_lang)
85 85
 {
86 86
   $template->assign_block_vars('type', array(
87 87
     'ID' => $type_id,
Please login to merge, or discard this patch.
flying_fleets.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -2,9 +2,9 @@  discard block
 block discarded – undo
2 2
 
3 3
 include('common.' . substr(strrchr(__FILE__, '.'), 1));
4 4
 
5
-if(!empty($_POST['return']) && is_array($_POST['return'])) {
6
-  foreach($_POST['return'] as $fleet_id) {
7
-    if($fleet_id = idval($fleet_id)) {
5
+if (!empty($_POST['return']) && is_array($_POST['return'])) {
6
+  foreach ($_POST['return'] as $fleet_id) {
7
+    if ($fleet_id = idval($fleet_id)) {
8 8
       sn_db_transaction_start();
9 9
       $FleetRow = db_fleet_get($fleet_id);
10 10
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 lng_include('overview');
24 24
 lng_include('fleet');
25 25
 
26
-if(!$planetrow) {
26
+if (!$planetrow) {
27 27
   messageBox($lang['fl_noplanetrow'], $lang['fl_error']);
28 28
 }
29 29
 
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
 
32 32
 $i = 0;
33 33
 $fleet_list = fleet_list_by_owner_id($user['id']);
34
-foreach($fleet_list as $fleet_id => $fleet_row) {
34
+foreach ($fleet_list as $fleet_id => $fleet_row) {
35 35
   $i++;
36 36
   $fleet_data = tpl_parse_fleet_db($fleet_row, $i, $user);
37 37
 
38 38
   $template->assign_block_vars('fleets', $fleet_data['fleet']);
39 39
 
40
-  foreach($fleet_data['ships'] as $ship_data) {
40
+  foreach ($fleet_data['ships'] as $ship_data) {
41 41
     $template->assign_block_vars('fleets.ships', $ship_data);
42 42
   }
43 43
 }
Please login to merge, or discard this patch.
includes/alliance/ali_internal_admin.inc 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,25 +1,25 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
3
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
4 4
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
5 5
 }
6 6
 
7
-if(!$user_admin) {
7
+if (!$user_admin) {
8 8
   messageBox($lang['Denied_access'], $lang['ally_admin']);
9 9
 }
10 10
 
11 11
 $template = gettemplate('ali_admin', $template);
12 12
 
13 13
 $text_list = array(
14
-  1 => array ('db_field' => 'ally_description', 'text_type' => 'Public_text_of_alliance'),
15
-  2 => array ('db_field' => 'ally_text', 'text_type' => 'Internal_text'),
16
-  3 => array ('db_field' => 'ally_request', 'text_type' => 'Show_of_request_text'),
14
+  1 => array('db_field' => 'ally_description', 'text_type' => 'Public_text_of_alliance'),
15
+  2 => array('db_field' => 'ally_text', 'text_type' => 'Internal_text'),
16
+  3 => array('db_field' => 'ally_request', 'text_type' => 'Show_of_request_text'),
17 17
 );
18 18
 
19 19
 $allyTextID = sys_get_param_int('t', 1);
20
-$allyTextID = ($allyTextID<1 || $allyTextID>3) ? 1 : $allyTextID;
20
+$allyTextID = ($allyTextID < 1 || $allyTextID > 3) ? 1 : $allyTextID;
21 21
 
22
-if(sys_get_param_str('isSaveOptions')) {
22
+if (sys_get_param_str('isSaveOptions')) {
23 23
   require_once('includes/includes/sys_avatar.php');
24 24
 
25 25
   $new_image = $ally['ally_image'];
@@ -31,32 +31,32 @@  discard block
 block discarded – undo
31 31
 //  $template->assign_block_vars('result', $avatar_upload_result);
32 32
 
33 33
   $ally_changeset = array();
34
-  if(($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) && $new_tag != $ally['ally_tag']) {
34
+  if (($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) && $new_tag != $ally['ally_tag']) {
35 35
     $new_tag_unsafe = $new_tag;
36 36
     $new_tag = db_escape($new_tag);
37 37
     $isTaggedAllyExists = DBStaticAlly::db_ally_get_by_tag($new_tag);
38
-    if(!empty($isTaggedAllyExists)) {
38
+    if (!empty($isTaggedAllyExists)) {
39 39
       messageBox(sprintf($lang['ally_message_tag_exists'], $new_tag_unsafe), '', 'alliance.php?mode=admin&edit=ally');
40 40
     }
41 41
     $ally_changeset[] = "`ally_tag`='{$new_tag}'";
42 42
     db_user_set_by_id($ally['ally_user_id'], "`username`='[{$new_tag}]'");
43 43
   }
44 44
 
45
-  if(($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) && $new_name != $ally['ally_name']) {
45
+  if (($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) && $new_name != $ally['ally_name']) {
46 46
     $new_name_unsafe = $new_name;
47 47
     $new_name = db_escape($new_name);
48 48
     $isTaggedAllyExists = DBStaticAlly::db_ally_get_by_name($new_name);
49
-    if(!empty($isTaggedAllyExists)) {
49
+    if (!empty($isTaggedAllyExists)) {
50 50
       messageBox(sprintf($lang['ally_message_name_exists'], $new_name_unsafe), '', 'alliance.php?mode=admin&edit=ally');
51 51
     }
52 52
     $ally_changeset[] = "`ally_name`='{$new_name}'";
53 53
   }
54 54
 
55
-  if(($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) && $new_owner_rank != $ally['ally_owner_range']) {
55
+  if (($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) && $new_owner_rank != $ally['ally_owner_range']) {
56 56
     $new_owner_rank = db_escape($new_owner_rank);
57 57
     $ally_changeset[] = "`ally_owner_range` = '{$new_owner_rank}'";
58 58
   }
59
-  if(($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) && $new_web != $ally['ally_web']) {
59
+  if (($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) && $new_web != $ally['ally_web']) {
60 60
     $new_web = db_escape($new_web);
61 61
     $ally_changeset[] = "`ally_web` = '{$new_web}'";
62 62
   }
@@ -65,31 +65,31 @@  discard block
 block discarded – undo
65 65
 //  if(($new_request = sys_get_param_int('request_notallow', $ally['ally_request_notallow'])) && $new_request != $ally['ally_request_notallow']) {
66 66
 //    $ally_changeset[] = "`ally_request_notallow` = '{$new_request}'";
67 67
 //  }
68
-  if($new_image != $ally['ally_image']) {
68
+  if ($new_image != $ally['ally_image']) {
69 69
     $new_image = intval($new_image);
70 70
     $ally_changeset[] = "`ally_image` = '{$new_image}'";
71 71
   }
72 72
 
73
-  if(!empty($ally_changeset)) {
73
+  if (!empty($ally_changeset)) {
74 74
     doquery("UPDATE {{alliance}} SET " . implode(',', $ally_changeset) . " WHERE `id`='{$ally['id']}' LIMIT 1;");
75 75
     sys_redirect('alliance.php?mode=admin&edit=ally');
76 76
   }
77 77
 }
78
-elseif(sys_get_param_str('isSaveText'))
78
+elseif (sys_get_param_str('isSaveText'))
79 79
 {
80 80
   $text = sys_get_param_str_both('text');
81 81
   doquery("UPDATE {{alliance}} SET `{$text_list[$allyTextID]['db_field']}`='{$text['safe']}' WHERE `id`='{$ally['id']}';");
82 82
   $ally[$text_list[$allyTextID]['db_field']] = $text['unsafe'];
83 83
 }
84
-elseif(sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader'))
84
+elseif (sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader'))
85 85
 {
86
-  if(!$isAllyOwner)
86
+  if (!$isAllyOwner)
87 87
   {
88 88
     messageBox($lang['Denied_access'], $lang['ally_admin']);
89 89
   }
90 90
 
91 91
   $newLeader = db_user_by_id($idNewLeader, false, `ally_id`);
92
-  if($newLeader['ally_id'] == $user['ally_id'])
92
+  if ($newLeader['ally_id'] == $user['ally_id'])
93 93
   {
94 94
     sn_db_transaction_start();
95 95
     db_user_set_by_id($user['id'], "`ally_rank_id`='0'");
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
     sys_redirect('alliance.php');
100 100
   }
101 101
 }
102
-elseif(sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband'))
102
+elseif (sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband'))
103 103
 {
104
-  if(!$isAllyOwner)
104
+  if (!$isAllyOwner)
105 105
   {
106 106
     messageBox($lang['Denied_access'], $lang['ally_admin']);
107 107
   }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
   'ally_name' => htmlspecialchars($ally['ally_name']),
125 125
   'ally_tag' => htmlspecialchars($ally['ally_tag']),
126 126
   'ally_web' => htmlspecialchars($ally['ally_web']),
127
-  'ally_request_notallow_0' => (( $ally['ally_request_notallow']) ? ' SELECTED' : ''),
127
+  'ally_request_notallow_0' => (($ally['ally_request_notallow']) ? ' SELECTED' : ''),
128 128
   'ally_request_notallow_1' => ((!$ally['ally_request_notallow']) ? ' SELECTED' : ''),
129 129
   'ally_owner_range' => htmlspecialchars($ally['ally_owner_range']),
130 130
   'hideNotOwner' => $ally['ally_owner'] != $user['id'] ? 'display: hide;' : '',
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 {
134 134
   $userAllyAdmins = db_user_list("`ally_id`= {$ally['id']}", false, '`id`, `username`');
135 135
   unset($tmp);
136
-  foreach($userAllyAdmins as $userAllyAdmin)
136
+  foreach ($userAllyAdmins as $userAllyAdmin)
137 137
   {
138 138
     $tmp .= "<option value={$userAllyAdmin['id']}>{$userAllyAdmin['username']}</option>";
139 139
   }
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
   $template->assign_var('adminMembers', $tmp);
142 142
 }
143 143
 
144
-foreach($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale)
144
+foreach ($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale)
145 145
 {
146
-  if(!$sn_ali_admin_action_locale['title'])
146
+  if (!$sn_ali_admin_action_locale['title'])
147 147
   {
148 148
     continue;
149 149
   }
Please login to merge, or discard this patch.
includes/alliance/ali_info.inc 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
3
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
4 4
 {
5 5
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
6 6
 }
7 7
 
8 8
 $template = gettemplate('ali_info', true);
9 9
 
10
-if($mode == 'exit')
10
+if ($mode == 'exit')
11 11
 {
12 12
   if ($ally['ally_owner'] == $user['id'])
13 13
   {
@@ -24,25 +24,25 @@  discard block
 block discarded – undo
24 24
     messageBox(sprintf($lang['ali_info_leave_success'], $ally['ally_name']), $lang['sys_alliance']);
25 25
   }
26 26
 }
27
-elseif($mode == 'ainfo')
27
+elseif ($mode == 'ainfo')
28 28
 {
29 29
   $tag = sys_get_param_str('tag');
30 30
   $id_ally = sys_get_param_id('a');
31
-  if($tag)
31
+  if ($tag)
32 32
   {
33 33
     $ally = doquery("SELECT * FROM {{alliance}} WHERE ally_tag='{$tag}' LIMIT 1;", '', true);
34 34
   }
35
-  elseif($id_ally)
35
+  elseif ($id_ally)
36 36
   {
37 37
     $ally = doquery("SELECT * FROM {{alliance}} WHERE id='{$id_ally}' LIMIT 1;", '', true);
38 38
   }
39 39
 
40
-  if(!$ally)
40
+  if (!$ally)
41 41
   {
42 42
     messageBox($lang['ali_sys_notFound'], $lang['Ally_info_1']);
43 43
   }
44 44
 
45
-  if(!$ally['ally_description'])
45
+  if (!$ally['ally_description'])
46 46
   {
47 47
     $ally['ally_description'] = $lang['Ally_nodescription'];
48 48
   }
@@ -51,17 +51,17 @@  discard block
 block discarded – undo
51 51
     'EXTERNAL'     => true,
52 52
     'USER_ALLY_ID' => $user['ally_id'],
53 53
   ));
54
-  $page_header          = $lang['sys_alliance'];
54
+  $page_header = $lang['sys_alliance'];
55 55
 }
56 56
 else
57 57
 {
58 58
   $page_header = $lang['your_alliance'];
59 59
 
60
-  if($ally['ally_owner'] == $user['id'])
60
+  if ($ally['ally_owner'] == $user['id'])
61 61
   {
62 62
     $range = $ally['ally_owner_range'] ? $ally['ally_owner_range'] : $lang['Founder'];
63 63
   }
64
-  elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name']))
64
+  elseif ($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name']))
65 65
   {
66 66
     $range = $ranks[$user['ally_rank_id']]['name'];
67 67
   }
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 ));
106 106
 
107 107
 $relations = ali_relations($ally['id']);
108
-foreach($relations as $relation)
108
+foreach ($relations as $relation)
109 109
 {
110
-  if($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id'])
110
+  if ($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id'])
111 111
   {
112 112
     $template->assign_block_vars('relation', array(
113 113
       'NAME'     => $relation['alliance_diplomacy_contr_ally_name'],
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
   }
118 118
 }
119 119
 
120
-function ali_render(){$func_args = func_get_args();return sn_function_call(__FUNCTION__, $func_args);}
120
+function ali_render() {$func_args = func_get_args(); return sn_function_call(__FUNCTION__, $func_args); }
121 121
 ali_render();
122 122
 
123 123
 display($template, "{$lang['alliance']} [{$ally['ally_name']}]");
Please login to merge, or discard this patch.
includes/alliance/ali_external_request.inc 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
3
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
4 4
 {
5 5
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
6 6
 }
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
     sys_redirect('alliance.php');
21 21
   }
22 22
 
23
-  if($user_request['request_denied'])
23
+  if ($user_request['request_denied'])
24 24
   {
25 25
     $lang['request_text'] = sprintf($lang['ali_req_deny_msg'], $ally['ally_tag'], $user_request['request_text']);
26 26
   }
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
 
44 44
 $ally = doquery("SELECT * FROM {{alliance}} WHERE `id` ='{$id_ally}'", true);
45 45
 
46
-if(!$ally)
46
+if (!$ally)
47 47
 {
48 48
   messageBox($lang['ali_sys_notFound'], $lang['ali_req_title']);
49 49
 }
50 50
 
51
-if($ally['ally_request_notallow'])
51
+if ($ally['ally_request_notallow'])
52 52
 {
53 53
   messageBox($lang['ali_req_not_allowed'], $lang['ali_req_title']);
54 54
 }
Please login to merge, or discard this patch.