Completed
Push — work-fleets ( 5b06a4...37e31f )
by SuperNova.WS
04:49
created
admin/includes/admin_planet_edit.inc.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
 
22 22
 function sn_admin_planet_edit_template(&$template, $edit_planet_row, $mode) {
23 23
   $unit_list = sn_get_groups($mode);
24
-  if(empty($unit_list)) {
24
+  if (empty($unit_list)) {
25 25
     return;
26 26
   }
27 27
   $name_list = classLocale::$lang['tech'];
28 28
 
29
-  foreach($unit_list as $unit_id) {
29
+  foreach ($unit_list as $unit_id) {
30 30
     $template->assign_block_vars('unit', array(
31 31
       'ID'    => $unit_id,
32 32
       'NAME'  => $name_list[$unit_id],
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 function admin_planet_edit_query_string($unit_id, $unit_amount, $mode) { return sn_function_call(__FUNCTION__, array($unit_id, $unit_amount, $mode)); }
40 40
 
41 41
 function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode) {
42
-  if($unit_amount && in_array($unit_id, sn_get_groups($mode))) {
42
+  if ($unit_amount && in_array($unit_id, sn_get_groups($mode))) {
43 43
     $unit_amount = round($unit_amount);
44 44
     $unit_name = get_unit_param($unit_id, P_NAME);
45 45
     $result = "{$unit_name} = GREATEST(0, {$unit_name} + ({$unit_amount}))";
Please login to merge, or discard this patch.
includes/includes/art_artifact.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 function art_use(&$user, &$planetrow, $unit_id) {
4 4
   global $lang;
5 5
 
6
-  if(!in_array($unit_id, sn_get_groups('artifacts'))) {
6
+  if (!in_array($unit_id, sn_get_groups('artifacts'))) {
7 7
     return;
8 8
   }
9 9
 
@@ -11,21 +11,21 @@  discard block
 block discarded – undo
11 11
   $user = db_user_by_id($user['id'], true);
12 12
 
13 13
   $unit_level = $artifact_level_old = mrc_get_level($user, array(), $unit_id, true);
14
-  if($unit_level > 0) {
14
+  if ($unit_level > 0) {
15 15
     $db_changeset = array();
16
-    switch($unit_id) {
16
+    switch ($unit_id) {
17 17
       case ART_LHC:
18 18
       case ART_HOOK_SMALL:
19 19
       case ART_HOOK_MEDIUM:
20 20
       case ART_HOOK_LARGE:
21 21
         $has_moon = db_planet_by_parent($planetrow['id'], true, '`id`');
22
-        if($planetrow['planet_type'] == PT_PLANET && !$has_moon['id']) {
22
+        if ($planetrow['planet_type'] == PT_PLANET && !$has_moon['id']) {
23 23
           $unit_level--;
24 24
           $moon_chance = $unit_id == ART_LHC ? uni_calculate_moon_chance($planetrow['debris_metal'] + $planetrow['debris_crystal']) : (
25 25
           $unit_id == ART_HOOK_MEDIUM ? mt_rand(1100, 8999) : ($unit_id == ART_HOOK_SMALL ? 1100 : 8999)
26 26
           );
27 27
           $random = $unit_id == ART_LHC ? mt_rand(1, 100) : $moon_chance;
28
-          if($random <= $moon_chance) {
28
+          if ($random <= $moon_chance) {
29 29
             $new_moon_row = uni_create_moon($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'], $user['id'], $moon_chance);
30 30
             $message = sprintf(classLocale::$lang['art_moon_create'][$unit_id], $new_moon_row['name'], uni_render_coordinates($planetrow), pretty_number($moon_chance));
31 31
           } else {
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
41 41
       case ART_RCD_MEDIUM:
42 42
       case ART_RCD_LARGE:
43 43
         $planetrow = db_planet_by_id($planetrow['id'], true);
44
-        if($planetrow['planet_type'] != PT_PLANET) {
44
+        if ($planetrow['planet_type'] != PT_PLANET) {
45 45
           $message = classLocale::$lang['art_rcd_err_moon'];
46 46
           break;
47 47
         }
48 48
 
49 49
         $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, false);
50
-        if(!empty($que['items'])) {
50
+        if (!empty($que['items'])) {
51 51
           $message = classLocale::$lang['art_rcd_err_que'];
52 52
           break;
53 53
         }
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 
57 57
         // $deployment_str = '';
58 58
         $sectors_used = 0;
59
-        foreach($artifact_deploy as $deploy_unit_id => $deploy_unit_level) {
60
-          if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) {
59
+        foreach ($artifact_deploy as $deploy_unit_id => $deploy_unit_level) {
60
+          if (!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) {
61 61
             continue;
62 62
           }
63 63
           $sectors_used += $levels_deployed;
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
           //$deployment_str .= ",`{$deploy_unit_name}` = GREATEST(`{$deploy_unit_name}`, {$deploy_unit_level})";
67 67
         }
68 68
 
69
-        if($sectors_used == 0) {
69
+        if ($sectors_used == 0) {
70 70
           $message = classLocale::$lang['art_rcd_err_no_sense'];
71 71
           break;
72 72
         }
@@ -80,12 +80,12 @@  discard block
 block discarded – undo
80 80
         $que_item = null;
81 81
         $que = que_get($user['id'], $planetrow['id'], QUE_RESEARCH, true);
82 82
         $current_que = &$que['ques'][QUE_RESEARCH][$user['id']][0];
83
-        if(!empty($current_que)) {
83
+        if (!empty($current_que)) {
84 84
           reset($current_que);
85 85
           $que_item = &$que['ques'][QUE_RESEARCH][$user['id']][0][key($current_que)];
86 86
         }
87 87
 
88
-        if(!empty($que_item) && $que_item['que_time_left'] > 60) {
88
+        if (!empty($que_item) && $que_item['que_time_left'] > 60) {
89 89
           $unit_level--;
90 90
           $old_time = $que_item['que_time_left'];
91 91
           $que_item['que_time_left'] = $que_item['que_time_left'] > PERIOD_HOUR ? ceil($que_item['que_time_left'] / 2) : 0;
@@ -103,12 +103,12 @@  discard block
 block discarded – undo
103 103
         $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, true);
104 104
         $current_que = &$que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']];
105 105
         // $que_item = &$que['que'][QUE_STRUCTURES][0];
106
-        if(!empty($current_que)) {
106
+        if (!empty($current_que)) {
107 107
           reset($current_que);
108 108
           $que_item = &$que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']][key($current_que)];
109 109
         }
110 110
 
111
-        if(isset($que_item) && $que_item['que_time_left'] > 60) {
111
+        if (isset($que_item) && $que_item['que_time_left'] > 60) {
112 112
           $unit_level--;
113 113
           $old_time = $que_item['que_time_left'];
114 114
           $que_item['que_time_left'] = $que_item['que_time_left'] > PERIOD_HOUR ? ceil($que_item['que_time_left'] / 2) : 0;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
       break;
124 124
 
125 125
     }
126
-    if($unit_level != $artifact_level_old) {
126
+    if ($unit_level != $artifact_level_old) {
127 127
       $db_changeset['unit'][] = sn_db_unit_changeset_prepare($unit_id, $unit_level - $artifact_level_old, $user);
128 128
       db_changeset_apply($db_changeset);
129 129
     }
Please login to merge, or discard this patch.
includes/includes/flt_page0.inc 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -5,9 +5,9 @@  discard block
 block discarded – undo
5 5
 // @version 1.0
6 6
 // @copyright 2008 by Chlorel for XNova
7 7
 
8
-if($fleet_ship_sort = sys_get_param_id('sort_elements')) {
8
+if ($fleet_ship_sort = sys_get_param_id('sort_elements')) {
9 9
   define('IN_AJAX', true);
10
-  if(!empty(classLocale::$lang['player_option_fleet_ship_sort'][$fleet_ship_sort])) {
10
+  if (!empty(classLocale::$lang['player_option_fleet_ship_sort'][$fleet_ship_sort])) {
11 11
     // player_save_option($user, PLAYER_OPTION_FLEET_SHIP_SORT, $fleet_ship_sort);
12 12
     // player_save_option($user, PLAYER_OPTION_FLEET_SHIP_SORT_INVERSE, sys_get_param_id('fleet_ship_sort_inverse', 0));
13 13
     classSupernova::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT] = $fleet_ship_sort;
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
   die();
17 17
 }
18 18
 
19
-if(SN_IN_FLEET !== true) {
19
+if (SN_IN_FLEET !== true) {
20 20
   $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403);
21 21
 }
22 22
 
23 23
 lng_include('overview');
24 24
 
25
-if(!$planetrow) {
25
+if (!$planetrow) {
26 26
   message(classLocale::$lang['fl_noplanetrow'], classLocale::$lang['fl_error']);
27 27
 }
28 28
 
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
 
31 31
 $record_index = 0;
32 32
 $ship_list = array();
33
-foreach(sn_get_groups('fleet') as $n => $unit_id) {
33
+foreach (sn_get_groups('fleet') as $n => $unit_id) {
34 34
   $unit_level = mrc_get_level($user, $planetrow, $unit_id, false, true);
35
-  if($unit_level > 0) {
35
+  if ($unit_level > 0) {
36 36
     $ship_data = get_ship_data($unit_id, $user);
37 37
     $ship_list[$unit_id] = array(
38 38
       '__INDEX'     => $record_index++,
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 
53 53
 $fleet_ship_sort = classSupernova::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT];
54 54
 $fleet_ship_sort_inverse = classSupernova::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT_INVERSE];
55
-if($fleet_ship_sort || $fleet_ship_sort_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) {
56
-  switch($fleet_ship_sort) {
55
+if ($fleet_ship_sort || $fleet_ship_sort_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) {
56
+  switch ($fleet_ship_sort) {
57 57
     case PLAYER_OPTION_SORT_NAME: $fleet_ship_sort_field = 'NAME'; break;
58 58
     case PLAYER_OPTION_SORT_SPEED: $fleet_ship_sort_field = 'SPEED'; break;
59 59
     case PLAYER_OPTION_SORT_COUNT: $fleet_ship_sort_field = 'AMOUNT'; break;
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
   });
69 69
 }
70 70
 
71
-foreach($ship_list as $ship_data) {
71
+foreach ($ship_list as $ship_data) {
72 72
   $template->assign_block_vars('ships', $ship_data);
73 73
 }
74 74
 
75
-foreach(classLocale::$lang['player_option_fleet_ship_sort'] as $sort_id => $sort_text) {
75
+foreach (classLocale::$lang['player_option_fleet_ship_sort'] as $sort_id => $sort_text) {
76 76
   $template->assign_block_vars('ship_sort_list', array(
77 77
     'VALUE' => $sort_id,
78 78
     'TEXT' => $sort_text,
Please login to merge, or discard this patch.
includes/includes/flt_page4.inc 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(SN_IN_FLEET !== true) {
3
+if (SN_IN_FLEET !== true) {
4 4
   $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403);
5 5
 }
6 6
 
7 7
 $fleetid = sys_get_param_id('fleetid');
8 8
 
9
-if(!is_numeric($fleetid) || empty($fleetid)) {
9
+if (!is_numeric($fleetid) || empty($fleetid)) {
10 10
   header("Location: fleet.php");
11 11
   exit();
12 12
 }
13 13
 
14 14
 $objFleet = new Fleet();
15 15
 $objFleet->dbLoad($fleetid);
16
-if(!$objFleet->dbId) {
16
+if (!$objFleet->dbId) {
17 17
   message(classLocale::$lang['fl_fleet_not_exists'], classLocale::$lang['fl_error']);
18 18
 }
19 19
 
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
   message(classLocale::$lang['fl_isback'], classLocale::$lang['fl_error']);
22 22
 }
23 23
 
24
-if($objFleet->playerOwnerId != $user['id']) {
25
-  $debug->warning(classLocale::$lang['fl_aks_hack_wrong_fleet'],'Wrong Fleet Owner',301);
24
+if ($objFleet->playerOwnerId != $user['id']) {
25
+  $debug->warning(classLocale::$lang['fl_aks_hack_wrong_fleet'], 'Wrong Fleet Owner', 301);
26 26
   message(classLocale::$lang['fl_aks_hack_wrong_fleet'], classLocale::$lang['fl_error']);
27 27
 }
28 28
 
@@ -32,19 +32,19 @@  discard block
 block discarded – undo
32 32
 
33 33
 !$aks && !$userToAdd_unsafe ? $userToAdd_unsafe = $user['username'] : false;
34 34
 
35
-if($userToAdd_unsafe) {
35
+if ($userToAdd_unsafe) {
36 36
   $userToAdd = db_escape($userToAdd_unsafe);
37 37
   $userToAddID = db_user_by_username($userToAdd_unsafe, false, 'id', true, true);
38 38
   $userToAddID = $userToAddID['id'];
39 39
 
40
-  if($objFleet->target_owner_id == $userToAddID) {
40
+  if ($objFleet->target_owner_id == $userToAddID) {
41 41
     message(classLocale::$lang['flt_aks_player_same'], classLocale::$lang['fl_error']);
42 42
   }
43 43
 
44
-  if($userToAddID) {
45
-    if(!$aks) {
44
+  if ($userToAddID) {
45
+    if (!$aks) {
46 46
       // No AСS exists - making one
47
-      if(!$objFleet->group_id) {
47
+      if (!$objFleet->group_id) {
48 48
         db_acs_insert(classLocale::$lang, $fleetid, $user, $objFleet);
49 49
 
50 50
         $aks = db_acs_get_by_fleet($fleetid);
@@ -59,26 +59,26 @@  discard block
 block discarded – undo
59 59
 
60 60
     $isUserExists = false;
61 61
     $invited_ar = explode(",", $aks['eingeladen']);
62
-    foreach($invited_ar as $inv) {
62
+    foreach ($invited_ar as $inv) {
63 63
       if ($userToAddID == $inv) {
64 64
         $isUserExists = true;
65 65
       }
66 66
     }
67 67
 
68
-    if(count($invited_ar) >= 5) {
68
+    if (count($invited_ar) >= 5) {
69 69
       message(classLocale::$lang['flt_aks_error_too_much_players'], classLocale::$lang['fl_error']);
70 70
     }
71 71
 
72
-    if($isUserExists) {
72
+    if ($isUserExists) {
73 73
       $userToAdd_unsafe != $user['username'] ? $add_user_message_mr = sprintf(classLocale::$lang['fl_aks_player_invited_already'], $userToAdd) : false;
74 74
     } else {
75 75
       $add_user_message_mr = sprintf(classLocale::$lang['fl_aks_player_invited'], $userToAdd);
76 76
       db_acs_update($userToAddID, $fleetid)
77
-        or die(sprintf(classLocale::$lang['fl_aks_adding_error'],db_error()));
77
+        or die(sprintf(classLocale::$lang['fl_aks_adding_error'], db_error()));
78 78
       $aks['eingeladen'] .= ',' . $userToAddID;
79 79
     }
80
-    msg_send_simple_message ( $userToAddID, $user['id'], SN_TIME_NOW, MSG_TYPE_COMBAT, $user['username'],
81
-      classLocale::$lang['fl_aks_invite_message_header'], sprintf( classLocale::$lang['fl_aks_invite_message'], $user['username']));
80
+    msg_send_simple_message($userToAddID, $user['id'], SN_TIME_NOW, MSG_TYPE_COMBAT, $user['username'],
81
+      classLocale::$lang['fl_aks_invite_message_header'], sprintf(classLocale::$lang['fl_aks_invite_message'], $user['username']));
82 82
   } else {
83 83
     $add_user_message_mr = sprintf(classLocale::$lang['fl_aks_player_error'], $userToAdd);
84 84
   }
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
   'MISSION_NAME' => classLocale::$lang['type_mission'][MT_AKS],
93 93
 ));
94 94
 
95
-if($aks['eingeladen'] && is_array($members = classSupernova::db_get_record_list(LOC_USER, "`id` in ({$aks['eingeladen']})")) && !empty($members)) {
96
-  foreach($members as $row) {
95
+if ($aks['eingeladen'] && is_array($members = classSupernova::db_get_record_list(LOC_USER, "`id` in ({$aks['eingeladen']})")) && !empty($members)) {
96
+  foreach ($members as $row) {
97 97
     $template->assign_block_vars('invited', array(
98 98
       'NAME' => $row['username'],
99 99
     ));
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 $fleet_data = tplParseFleetObject($objFleet, $i, $user);
119 119
 
120 120
 $template->assign_block_vars('fleets', $fleet_data['fleet']);
121
-foreach($fleet_data['ships'] as $ship_data) {
121
+foreach ($fleet_data['ships'] as $ship_data) {
122 122
   $template->assign_block_vars('fleets.ships', $ship_data);
123 123
 }
124 124
 
Please login to merge, or discard this patch.
includes/includes/eco_bld_structures.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 function sn_eco_build($que_type, &$auser, &$planet) {
19 19
   global $lang, $config, $template_result;
20 20
 
21
-  if($ally_id = sys_get_param_id('ally_id')) {
21
+  if ($ally_id = sys_get_param_id('ally_id')) {
22 22
     define('SN_IN_ALLY', true);
23 23
     $ranks = ally_get_ranks($auser['ally']);
24
-    if($ranks[$auser['ally_rank_id']]['admin'] || $auser['ally']['ally_owner'] == $auser['id']) {
24
+    if ($ranks[$auser['ally_rank_id']]['admin'] || $auser['ally']['ally_owner'] == $auser['id']) {
25 25
       $user = &$auser['ally']['player'];
26 26
       $planet = array(
27 27
         'metal'     => $user['metal'],
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
     }
32 32
   }
33 33
 
34
-  if(!$user) {
34
+  if (!$user) {
35 35
     $user = &$auser;
36 36
   }
37 37
 
38
-  switch($action = sys_get_param_escaped('action')) {
38
+  switch ($action = sys_get_param_escaped('action')) {
39 39
     case 'create': // Add unit to que for build
40 40
     case 'create_autoconvert': // Add unit to que for build
41 41
     case 'destroy': // Add unit to que for remove
@@ -52,23 +52,23 @@  discard block
 block discarded – undo
52 52
 
53 53
   $group_missile = sn_get_groups('missile');
54 54
   $silo_capacity_free = 0;
55
-  if($que_type == QUE_STRUCTURES) {
55
+  if ($que_type == QUE_STRUCTURES) {
56 56
     $build_unit_list = sn_get_groups('build_allow');
57 57
     $build_unit_list = $build_unit_list[$planet['planet_type']];
58 58
     $artifact_id = ART_NANO_BUILDER;
59 59
     $page_header = classLocale::$lang['tech'][UNIT_STRUCTURES];
60
-  } elseif($que_type == QUE_RESEARCH) {
61
-    if(!mrc_get_level($user, $planet, STRUC_LABORATORY)) {
60
+  } elseif ($que_type == QUE_RESEARCH) {
61
+    if (!mrc_get_level($user, $planet, STRUC_LABORATORY)) {
62 62
       message(classLocale::$lang['no_laboratory'], classLocale::$lang['tech'][UNIT_TECHNOLOGIES]);
63 63
     }
64 64
 
65
-    if(eco_unit_busy($user, $planet, UNIT_TECHNOLOGIES)) {
65
+    if (eco_unit_busy($user, $planet, UNIT_TECHNOLOGIES)) {
66 66
       message(classLocale::$lang['eco_bld_msg_err_laboratory_upgrading'], classLocale::$lang['tech'][UNIT_TECHNOLOGIES]);
67 67
     }
68 68
     $build_unit_list = sn_get_groups('tech');
69 69
     $artifact_id = ART_HEURISTIC_CHIP;
70 70
     $page_header = classLocale::$lang['tech'][UNIT_TECHNOLOGIES] . ($user['user_as_ally'] ? "&nbsp;{$lang['sys_of_ally']}&nbsp;{$user['username']}" : '');
71
-  } elseif($que_type == QUE_MERCENARY) {
71
+  } elseif ($que_type == QUE_MERCENARY) {
72 72
 //    if(!mrc_get_level($user, $planet, STRUC_LABORATORY)) {
73 73
 //      message($lang['no_laboratory'], $lang['tech'][UNIT_TECHNOLOGIES]);
74 74
 //    }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     $artifact_id = 0;
81 81
     $page_header = classLocale::$lang['tech'][UNIT_MERCENARIES] . ($user['user_as_ally'] ? "&nbsp;{$lang['sys_of_ally']}&nbsp;{$user['username']}" : '');
82 82
   } else {
83
-    if(mrc_get_level($user, $planet, STRUC_FACTORY_HANGAR) == 0) {
83
+    if (mrc_get_level($user, $planet, STRUC_FACTORY_HANGAR) == 0) {
84 84
       message(classLocale::$lang['need_hangar'], classLocale::$lang['tech'][STRUC_FACTORY_HANGAR]);
85 85
     }
86 86
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     $artifact_id = 0;
90 90
 
91 91
     $silo_capacity_free = mrc_get_level($user, $planet, STRUC_SILO) * get_unit_param(STRUC_SILO, P_CAPACITY);
92
-    foreach($group_missile as $unit_id) {
92
+    foreach ($group_missile as $unit_id) {
93 93
       $silo_capacity_free -= (mrc_get_level($user, $planet, $unit_id, false, true) + (isset($in_que[$unit_id]) && $in_que[$unit_id] ? $in_que[$unit_id] : 0)) * get_unit_param($unit_id, P_UNIT_SIZE);
94 94
     }
95 95
     $silo_capacity_free = max(0, $silo_capacity_free);
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
   */
107 107
 
108 108
   $template = gettemplate('buildings_builds', true);
109
-  if(!empty($operation_result)) {
109
+  if (!empty($operation_result)) {
110 110
     $template_result['.']['result'][] = $operation_result;
111 111
   }
112 112
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 
138 138
   $record_index = 0;
139 139
 
140
-  foreach($build_unit_list as $unit_id) {
140
+  foreach ($build_unit_list as $unit_id) {
141 141
     $level_base = mrc_get_level($user, $planet, $unit_id, false, true);
142 142
     $level_effective = mrc_get_level($user, $planet, $unit_id);
143 143
     $level_in_que = $in_que[$unit_id];
@@ -160,12 +160,12 @@  discard block
 block discarded – undo
160 160
     $can_build = $unit_info[P_MAX_STACK] ? max(0, $unit_info[P_MAX_STACK] - $level_in_que - $level_effective) : $build_data['CAN'][BUILD_CREATE];
161 161
     // Restricting $can_build by free silo capacity
162 162
     $can_build = ($unit_is_missile = in_array($unit_id, $group_missile)) ? min($can_build, floor($silo_capacity_free / $unit_info[P_UNIT_SIZE])) : $can_build;
163
-    if(!$can_build) {
164
-      if(!$build_data['CAN'][BUILD_CREATE]) {
163
+    if (!$can_build) {
164
+      if (!$build_data['CAN'][BUILD_CREATE]) {
165 165
         $build_data['RESULT'][BUILD_CREATE] = BUILD_NO_RESOURCES;
166
-      } elseif($unit_is_missile && $silo_capacity_free < $unit_info[P_UNIT_SIZE]) {
166
+      } elseif ($unit_is_missile && $silo_capacity_free < $unit_info[P_UNIT_SIZE]) {
167 167
         $build_data['RESULT'][BUILD_CREATE] = BUILD_SILO_FULL;
168
-      } elseif($unit_info[P_MAX_STACK]) {
168
+      } elseif ($unit_info[P_MAX_STACK]) {
169 169
         $build_data['RESULT'][BUILD_CREATE] = BUILD_MAX_REACHED;
170 170
       }
171 171
     }
@@ -232,14 +232,14 @@  discard block
 block discarded – undo
232 232
       'MAP_IS_RESOURCE' => !empty($unit_info[P_UNIT_PRODUCTION]),
233 233
     );
234 234
 
235
-    if($unit_stackable) {
235
+    if ($unit_stackable) {
236 236
       $level_production_base = array(
237 237
         'ACTUAL_SHIELD' => pretty_number(mrc_modify_value($user, false, array(MRC_ADMIRAL, TECH_SHIELD), $unit_info['shield'])),
238 238
         'ACTUAL_ARMOR'  => pretty_number(mrc_modify_value($user, false, array(MRC_ADMIRAL, TECH_ARMOR), $unit_info['armor'])),
239 239
         'ACTUAL_WEAPON' => pretty_number(mrc_modify_value($user, false, array(MRC_ADMIRAL, TECH_WEAPON), $unit_info['attack'])),
240 240
       );
241 241
 
242
-      if($unit_info[P_UNIT_TYPE] == UNIT_SHIPS) {
242
+      if ($unit_info[P_UNIT_TYPE] == UNIT_SHIPS) {
243 243
         $ship_data = get_ship_data($unit_id, $user);
244 244
 
245 245
         $level_production_base += array(
@@ -249,9 +249,9 @@  discard block
 block discarded – undo
249 249
         );
250 250
       }
251 251
 
252
-      if($unit_info[P_UNIT_PRODUCTION]) {
253
-        foreach($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) {
254
-          if($resource_income =
252
+      if ($unit_info[P_UNIT_PRODUCTION]) {
253
+        foreach ($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) {
254
+          if ($resource_income =
255 255
             floor(mrc_modify_value($user, $planet, $sn_modifiers_resource, $resource_calc(1, 10, $user, $planet)
256 256
               * ($resource_id == RES_ENERGY ? $config_resource_multiplier_plain : $config_resource_multiplier)
257 257
               * (isset($density_info[$resource_id]) ? $density_info[$resource_id] : 1)))
@@ -261,11 +261,11 @@  discard block
 block discarded – undo
261 261
         }
262 262
       }
263 263
       $production['.']['resource'][] = $level_production_base;
264
-    } elseif($unit_info[P_UNIT_PRODUCTION]) {
264
+    } elseif ($unit_info[P_UNIT_PRODUCTION]) {
265 265
       $level_production_base = array();
266 266
       $element_level_start = $level_effective + $in_que[$unit_id];
267
-      foreach($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) {
268
-        if($resource_income =
267
+      foreach ($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) {
268
+        if ($resource_income =
269 269
           floor(mrc_modify_value($user, $planet, $sn_modifiers_resource, $resource_calc($element_level_start, 10, $user, $planet)
270 270
             * ($resource_id == RES_ENERGY ? $config_resource_multiplier_plain : $config_resource_multiplier)
271 271
             * (isset($density_info[$resource_id]) ? $density_info[$resource_id] : 1)))
@@ -275,10 +275,10 @@  discard block
 block discarded – undo
275 275
       }
276 276
 
277 277
       $level_start = $level_base_and_que > 1 ? $level_effective + $level_in_que - 1 : 1;
278
-      for($i = 0; $i < 6; $i++) {
278
+      for ($i = 0; $i < 6; $i++) {
279 279
         $level_production = array('LEVEL' => $level_start + $i);
280
-        foreach($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) {
281
-          if(
280
+        foreach ($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) {
281
+          if (
282 282
           $resource_income = floor(mrc_modify_value($user, $planet, $sn_modifiers_resource, $resource_calc($level_start + $i, 10, $user, $planet)
283 283
             * ($resource_id == RES_ENERGY ? $config_resource_multiplier_plain : $config_resource_multiplier)
284 284
             * (isset($density_info[$resource_id]) ? $density_info[$resource_id] : 1)))
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
         }
290 290
         $production['.']['resource'][] = $level_production;
291 291
       }
292
-    } elseif($unit_id == TECH_ASTROTECH) {
292
+    } elseif ($unit_id == TECH_ASTROTECH) {
293 293
       $element_level_start = $level_effective + $in_que[$unit_id];
294 294
       $level_production_base = array(
295 295
         UNIT_PLAYER_EXPEDITIONS_MAX => get_player_max_expeditons($user, $element_level_start),
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
       );
298 298
 
299 299
       $level_start = $level_base_and_que > 1 ? $level_effective + $level_in_que - 1 : 1;
300
-      for($i = 0; $i < 6; $i++) {
300
+      for ($i = 0; $i < 6; $i++) {
301 301
         $level_production = array('LEVEL' => $level_start + $i);
302 302
         $level_production['R' . UNIT_PLAYER_EXPEDITIONS_MAX] = get_player_max_expeditons($user, $level_start + $i);
303 303
         $level_production['D' . UNIT_PLAYER_EXPEDITIONS_MAX] = $level_production['R' . UNIT_PLAYER_EXPEDITIONS_MAX] - $level_production_base[UNIT_PLAYER_EXPEDITIONS_MAX];
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
     $template_result['.']['production'][] = $production;
319 319
   }
320 320
 
321
-  foreach(classLocale::$lang['player_option_building_sort'] as $sort_id => $sort_text) {
321
+  foreach (classLocale::$lang['player_option_building_sort'] as $sort_id => $sort_text) {
322 322
     $template->assign_block_vars('sort_values', array(
323 323
       'VALUE' => $sort_id,
324 324
       'TEXT'  => $sort_text,
@@ -327,8 +327,8 @@  discard block
 block discarded – undo
327 327
 
328 328
   $sort_option = classSupernova::$user_options[array(PLAYER_OPTION_BUILDING_SORT, $que_type)];
329 329
   $sort_option_inverse = classSupernova::$user_options[array(PLAYER_OPTION_BUILDING_SORT_INVERSE, $que_type)];
330
-  if($sort_option || $sort_option_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) {
331
-    switch($sort_option) {
330
+  if ($sort_option || $sort_option_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) {
331
+    switch ($sort_option) {
332 332
       case PLAYER_OPTION_SORT_NAME:
333 333
         $sort_option_field = 'NAME';
334 334
       break;
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
       break;
344 344
     }
345 345
     $sort_option_inverse_closure = $sort_option_inverse ? -1 : 1;
346
-    usort($template_result['.']['production'], function ($a, $b) use ($sort_option_field, $sort_option_inverse_closure) {
346
+    usort($template_result['.']['production'], function($a, $b) use ($sort_option_field, $sort_option_inverse_closure) {
347 347
       return $a[$sort_option_field] < $b[$sort_option_field] ? -1 * $sort_option_inverse_closure : (
348 348
       $a[$sort_option_field] > $b[$sort_option_field] ? 1 * $sort_option_inverse_closure : 0
349 349
       );
Please login to merge, or discard this patch.
includes/pages/options.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
   $language_new = sys_get_param_str('langer', $user['lang']);
14 14
 
15
-  if($language_new != $user['lang']) {
15
+  if ($language_new != $user['lang']) {
16 16
     classLocale::$lang->lng_switch($language_new);
17 17
   }
18 18
 
@@ -21,35 +21,35 @@  discard block
 block discarded – undo
21 21
 
22 22
   $FMT_DATE = preg_replace(array('/d/', '/m/', '/Y/'), array('DD', 'MM', 'YYYY'), FMT_DATE);
23 23
 
24
-  if(sys_get_param_str('mode') == 'change') {
25
-    if($user['authlevel'] > 0) {
24
+  if (sys_get_param_str('mode') == 'change') {
25
+    if ($user['authlevel'] > 0) {
26 26
       $planet_protection = sys_get_param_int('adm_pl_prot') ? $user['authlevel'] : 0;
27 27
       db_planet_set_by_owner($user['id'], "`id_level` = '{$planet_protection}'");
28 28
       db_user_set_by_id($user['id'], "`admin_protection` = '{$planet_protection}'");
29 29
       $user['admin_protection'] = $planet_protection;
30 30
     }
31 31
 
32
-    if(sys_get_param_int('vacation') && !$config->user_vacation_disable) {
32
+    if (sys_get_param_int('vacation') && !$config->user_vacation_disable) {
33 33
       sn_db_transaction_start();
34
-      if($user['authlevel'] < 3) {
35
-        if($user['vacation_next'] > SN_TIME_NOW) {
34
+      if ($user['authlevel'] < 3) {
35
+        if ($user['vacation_next'] > SN_TIME_NOW) {
36 36
           message(classLocale::$lang['opt_vacation_err_timeout'], classLocale::$lang['Error'], 'index.php?page=options', 5);
37 37
           die();
38 38
         }
39 39
 
40
-        if(FleetList::fleet_count_flying($user['id'])) {
40
+        if (FleetList::fleet_count_flying($user['id'])) {
41 41
           message(classLocale::$lang['opt_vacation_err_your_fleet'], classLocale::$lang['Error'], 'index.php?page=options', 5);
42 42
           die();
43 43
         }
44 44
 
45 45
         $que = que_get($user['id'], false);
46
-        if(!empty($que)) {
46
+        if (!empty($que)) {
47 47
           message(classLocale::$lang['opt_vacation_err_que'], classLocale::$lang['Error'], 'index.php?page=options', 5);
48 48
           die();
49 49
         }
50 50
 
51 51
         $query = classSupernova::db_get_record_list(LOC_PLANET, "`id_owner` = {$user['id']}");
52
-        foreach($query as $planet) {
52
+        foreach ($query as $planet) {
53 53
           // $planet = sys_o_get_updated($user, $planet, SN_TIME_NOW);
54 54
           // $planet = $planet['planet'];
55 55
 
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
       sn_db_transaction_commit();
68 68
     }
69 69
 
70
-    foreach($user_option_list as $option_group_id => $option_group) {
71
-      foreach($option_group as $option_name => $option_value) {
72
-        if($user[$option_name] !== null) {
70
+    foreach ($user_option_list as $option_group_id => $option_group) {
71
+      foreach ($option_group as $option_name => $option_value) {
72
+        if ($user[$option_name] !== null) {
73 73
           $user[$option_name] = sys_get_param_str($option_name);
74 74
         } else {
75 75
           $user[$option_name] = $option_value;
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
 
81 81
 
82 82
     $player_options = sys_get_param('options');
83
-    if(!empty($player_options)) {
84
-      array_walk($player_options, function (&$value) {
83
+    if (!empty($player_options)) {
84
+      array_walk($player_options, function(&$value) {
85 85
         // TODO - Когда будет больше параметров - сделать больше проверок
86 86
         $value = intval($value);
87 87
       });
@@ -92,15 +92,15 @@  discard block
 block discarded – undo
92 92
 
93 93
     $username = substr(sys_get_param_str_unsafe('username'), 0, 32);
94 94
     $username_safe = db_escape($username);
95
-    if($username && $user['username'] != $username && $config->game_user_changename != SERVER_PLAYER_NAME_CHANGE_NONE && sys_get_param_int('username_confirm') && !strpbrk($username, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) {
95
+    if ($username && $user['username'] != $username && $config->game_user_changename != SERVER_PLAYER_NAME_CHANGE_NONE && sys_get_param_int('username_confirm') && !strpbrk($username, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) {
96 96
       // проверка на корректность
97 97
       sn_db_transaction_start();
98 98
       $name_check = db_player_name_history_get_name_by_name($username_safe);
99
-      if(!$name_check || $name_check['player_id'] == $user['id']) {
99
+      if (!$name_check || $name_check['player_id'] == $user['id']) {
100 100
         $user = db_user_by_id($user['id'], true);
101
-        switch($config->game_user_changename) {
101
+        switch ($config->game_user_changename) {
102 102
           case SERVER_PLAYER_NAME_CHANGE_PAY:
103
-            if(mrc_get_level($user, $planetrow, RES_DARK_MATTER) < $config->game_user_changename_cost) {
103
+            if (mrc_get_level($user, $planetrow, RES_DARK_MATTER) < $config->game_user_changename_cost) {
104 104
               $template_result['.']['result'][] = array(
105 105
                 'STATUS'  => ERR_ERROR,
106 106
                 'MESSAGE' => classLocale::$lang['opt_msg_name_change_err_no_dm'],
@@ -130,18 +130,18 @@  discard block
 block discarded – undo
130 130
       sn_db_transaction_commit();
131 131
     }
132 132
 
133
-    if($new_password = sys_get_param('newpass1')) {
133
+    if ($new_password = sys_get_param('newpass1')) {
134 134
       try {
135
-        if($new_password != sys_get_param('newpass2')) {
135
+        if ($new_password != sys_get_param('newpass2')) {
136 136
           throw new Exception(classLocale::$lang['opt_err_pass_unmatched'], ERR_WARNING);
137 137
         }
138 138
 
139
-        if(!classSupernova::$auth->password_change(sys_get_param('db_password'), $new_password)) {
139
+        if (!classSupernova::$auth->password_change(sys_get_param('db_password'), $new_password)) {
140 140
           throw new Exception(classLocale::$lang['opt_err_pass_wrong'], ERR_WARNING);
141 141
         }
142 142
 
143 143
         throw new Exception(classLocale::$lang['opt_msg_pass_changed'], ERR_NONE);
144
-      } catch(Exception $e) {
144
+      } catch (Exception $e) {
145 145
         $template_result['.']['result'][] = array(
146 146
           'STATUS'  => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR,
147 147
           'MESSAGE' => $e->getMessage()
@@ -182,12 +182,12 @@  discard block
 block discarded – undo
182 182
     $user['gender'] = $user['gender'] == GENDER_UNKNOWN ? $gender : $user['gender'];
183 183
 
184 184
     try {
185
-      if($user['birthday']) {
185
+      if ($user['birthday']) {
186 186
         throw new exception();
187 187
       }
188 188
 
189 189
       $user_birthday = sys_get_param_str_unsafe('user_birthday');
190
-      if(!$user_birthday || $user_birthday == $FMT_DATE) {
190
+      if (!$user_birthday || $user_birthday == $FMT_DATE) {
191 191
         throw new exception();
192 192
       }
193 193
 
@@ -197,16 +197,16 @@  discard block
 block discarded – undo
197 197
       $pos['Y'] = strpos(FMT_DATE, 'Y');
198 198
       asort($pos);
199 199
       $i = 0;
200
-      foreach($pos as &$position) {
200
+      foreach ($pos as &$position) {
201 201
         $position = ++$i;
202 202
       }
203 203
 
204 204
       $regexp = "/" . preg_replace(array('/\\\\/', '/\//', '/\./', '/\-/', '/d/', '/m/', '/Y/'), array('\\\\\\', '\/', '\.', '\-', '(\d?\d)', '(\d?\d)', '(\d{4})'), FMT_DATE) . "/";
205
-      if(!preg_match($regexp, $user_birthday, $match)) {
205
+      if (!preg_match($regexp, $user_birthday, $match)) {
206 206
         throw new exception();
207 207
       }
208 208
 
209
-      if(!checkdate($match[$pos['m']], $match[$pos['d']], $match[$pos['Y']])) {
209
+      if (!checkdate($match[$pos['m']], $match[$pos['d']], $match[$pos['Y']])) {
210 210
         throw new exception();
211 211
       }
212 212
 
@@ -214,13 +214,13 @@  discard block
 block discarded – undo
214 214
       // EOF black magic! Now we have valid SQL date in $user['user_birthday'] - independent of date format
215 215
 
216 216
       $year = date('Y', SN_TIME_NOW);
217
-      if(mktime(0, 0, 0, $match[$pos['m']], $match[$pos['d']], $year) > SN_TIME_NOW) {
217
+      if (mktime(0, 0, 0, $match[$pos['m']], $match[$pos['d']], $year) > SN_TIME_NOW) {
218 218
         $year--;
219 219
       }
220 220
       $user['user_birthday_celebrated'] = db_escape("{$year}-{$match[$pos['m']]}-{$match[$pos['d']]}");
221 221
 
222 222
       $user_birthday = ", `user_birthday` = '{$user['user_birthday']}', `user_birthday_celebrated` = '{$user['user_birthday_celebrated']}'";
223
-    } catch(exception $e) {
223
+    } catch (exception $e) {
224 224
       $user_birthday = '';
225 225
     }
226 226
 
@@ -230,14 +230,14 @@  discard block
 block discarded – undo
230 230
     $template_result['.']['result'][] = $avatar_upload_result;
231 231
 
232 232
     $user_time_diff = playerTimeDiff::user_time_diff_get();
233
-    if(sys_get_param_int('PLAYER_OPTION_TIME_DIFF_FORCED')) {
233
+    if (sys_get_param_int('PLAYER_OPTION_TIME_DIFF_FORCED')) {
234 234
       playerTimeDiff::user_time_diff_set(array(
235 235
         PLAYER_OPTION_TIME_DIFF              => sys_get_param_int('PLAYER_OPTION_TIME_DIFF'),
236 236
         PLAYER_OPTION_TIME_DIFF_UTC_OFFSET   => 0,
237 237
         PLAYER_OPTION_TIME_DIFF_FORCED       => 1,
238 238
         PLAYER_OPTION_TIME_DIFF_MEASURE_TIME => SN_TIME_SQL,
239 239
       ));
240
-    } elseif(sys_get_param_int('opt_time_diff_clear') || $user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) {
240
+    } elseif (sys_get_param_int('opt_time_diff_clear') || $user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) {
241 241
       playerTimeDiff::user_time_diff_set(array(
242 242
         PLAYER_OPTION_TIME_DIFF              => '',
243 243
         PLAYER_OPTION_TIME_DIFF_UTC_OFFSET   => 0,
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
       'STATUS'  => ERR_NONE,
258 258
       'MESSAGE' => classLocale::$lang['opt_msg_saved']
259 259
     );
260
-  } elseif(sys_get_param_str('result') == 'ok') {
260
+  } elseif (sys_get_param_str('result') == 'ok') {
261 261
     $template_result['.']['result'][] = array(
262 262
       'STATUS'  => ERR_NONE,
263 263
       'MESSAGE' => classLocale::$lang['opt_msg_saved']
@@ -285,8 +285,8 @@  discard block
 block discarded – undo
285 285
 //  );
286 286
 
287 287
   $dir = dir(SN_ROOT_PHYSICAL . 'skins');
288
-  while(($entry = $dir->read()) !== false) {
289
-    if(is_dir("skins/{$entry}") && $entry[0] != '.') {
288
+  while (($entry = $dir->read()) !== false) {
289
+    if (is_dir("skins/{$entry}") && $entry[0] != '.') {
290 290
       $template_result['.']['skin_list'][] = array(
291 291
         'VALUE'    => $entry,
292 292
         'NAME'     => $entry,
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
   }
297 297
   $dir->close();
298 298
 
299
-  foreach(classLocale::$lang['opt_planet_sort_options'] as $key => &$value) {
299
+  foreach (classLocale::$lang['opt_planet_sort_options'] as $key => &$value) {
300 300
     $template_result['.']['planet_sort_options'][] = array(
301 301
       'VALUE'    => $key,
302 302
       'NAME'     => $value,
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
       );
313 313
     }
314 314
   */
315
-  foreach(classLocale::$lang['sys_gender_list'] as $key => $value) {
315
+  foreach (classLocale::$lang['sys_gender_list'] as $key => $value) {
316 316
     $template_result['.']['gender_list'][] = array(
317 317
       'VALUE'    => $key,
318 318
       'NAME'     => $value,
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
   }
322 322
 
323 323
   $lang_list = lng_get_list();
324
-  foreach($lang_list as $lang_id => $lang_data) {
324
+  foreach ($lang_list as $lang_id => $lang_data) {
325 325
     $template_result['.']['languages'][] = array(
326 326
       'VALUE'    => $lang_id,
327 327
       'NAME'     => $lang_data['LANG_NAME_NATIVE'],
@@ -330,8 +330,8 @@  discard block
 block discarded – undo
330 330
   }
331 331
 
332 332
 
333
-  if(isset(classLocale::$lang['menu_customize_show_hide_button_state'])) {
334
-    foreach(classLocale::$lang['menu_customize_show_hide_button_state'] as $key => $value) {
333
+  if (isset(classLocale::$lang['menu_customize_show_hide_button_state'])) {
334
+    foreach (classLocale::$lang['menu_customize_show_hide_button_state'] as $key => $value) {
335 335
       $template->assign_block_vars('menu_customize_show_hide_button_state', array(
336 336
         'ID'   => $key,
337 337
         'NAME' => $value,
@@ -441,10 +441,10 @@  discard block
 block discarded – undo
441 441
     'PAGE_HEADER' => classLocale::$lang['opt_header'],
442 442
   ));
443 443
 
444
-  foreach($user_option_list as $option_group_id => $option_group) {
445
-    if($option_group_id == OPT_MESSAGE) {
446
-      foreach($sn_message_class_list as $message_class_id => $message_class_data) {
447
-        if($message_class_data['switchable'] || ($message_class_data['email'] && $config->game_email_pm)) {
444
+  foreach ($user_option_list as $option_group_id => $option_group) {
445
+    if ($option_group_id == OPT_MESSAGE) {
446
+      foreach ($sn_message_class_list as $message_class_id => $message_class_data) {
447
+        if ($message_class_data['switchable'] || ($message_class_data['email'] && $config->game_email_pm)) {
448 448
           $option_name = $message_class_data['name'];
449 449
 
450 450
           $template->assign_block_vars("options_{$option_group_id}", array(
@@ -456,8 +456,8 @@  discard block
 block discarded – undo
456 456
         }
457 457
       }
458 458
     } else {
459
-      foreach($option_group as $option_name => $option_value) {
460
-        if(array_key_exists($option_name, $user_option_types)) {
459
+      foreach ($option_group as $option_name => $option_value) {
460
+        if (array_key_exists($option_name, $user_option_types)) {
461 461
           $option_type = $user_option_types[$option_name];
462 462
         } else {
463 463
           $option_type = 'switch';
Please login to merge, or discard this patch.
includes/pages/imperium.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@  discard block
 block discarded – undo
22 22
   $sn_group_factories = sn_get_groups('factories');
23 23
   $planet_density = sn_get_groups('planet_density');
24 24
 
25
-  if(sys_get_param('save_production')) {
25
+  if (sys_get_param('save_production')) {
26 26
     $production = sys_get_param('percent');
27
-    if(is_array($production) && !empty($production)) {
27
+    if (is_array($production) && !empty($production)) {
28 28
       // sn_db_transaction_start();
29 29
       $query = array();
30 30
       $planet_row_list = db_planet_list_sorted($user, false, '*');
31 31
       // while($planet = db_fetch($planet_row_list))
32
-      foreach($planet_row_list as $planet) {
33
-        foreach($sn_group_factories as $factory_unit_id) {
32
+      foreach ($planet_row_list as $planet) {
33
+        foreach ($sn_group_factories as $factory_unit_id) {
34 34
           $unit_db_name_porcent = pname_factory_production_field_name($factory_unit_id);
35
-          if(
35
+          if (
36 36
             get_unit_param($factory_unit_id, P_MINING_IS_MANAGED)
37 37
             && isset($production[$factory_unit_id][$planet['id']])
38 38
             && ($actual_porcent = intval($production[$factory_unit_id][$planet['id']] / 10)) >= 0
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
           }
44 44
         }
45 45
       }
46
-      foreach($query as $planet_id => $query_data) {
46
+      foreach ($query as $planet_id => $query_data) {
47 47
         db_planet_set_by_id($planet_id, implode(',', $query_data));
48 48
       }
49 49
       // sn_db_transaction_commit();
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
   $planet_row_list = db_planet_list_sorted($user);
54 54
   // while ($planet = db_fetch($planet_row_list))
55
-  foreach($planet_row_list as $planet) {
55
+  foreach ($planet_row_list as $planet) {
56 56
     sn_db_transaction_start();
57 57
     $global_data = sys_o_get_updated($user, $planet['id'], SN_TIME_NOW, false, true);
58 58
     $planets[$planet['id']] = $global_data['planet'];
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
   $template = gettemplate('imperium', $template);
65 65
   $template->assign_var('amount', count($planets) + 2);
66 66
 
67
-  for($i = 100; $i >= 0; $i -= 10) {
67
+  for ($i = 100; $i >= 0; $i -= 10) {
68 68
     $template->assign_block_vars('percent', array('PERCENT' => $i));
69 69
   }
70 70
 
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
   $total['temp_min'] = 1000;
75 75
   $total['temp_max'] = -999;
76 76
 
77
-  foreach($planets as $planet_index => &$planet) {
77
+  foreach ($planets as $planet_index => &$planet) {
78 78
     $list_planet_que = $ques[$planet_index];
79 79
     $planet_template = tpl_parse_planet($planet);
80 80
 
81 81
     $planet_fleet_id = 0;
82
-    $fleet_list = $planet_template['fleet_list'];//flt_get_fleets_to_planet($planet);
83
-    if($fleet_list['own']['count']) {
82
+    $fleet_list = $planet_template['fleet_list']; //flt_get_fleets_to_planet($planet);
83
+    if ($fleet_list['own']['count']) {
84 84
       $planet_fleet_id = "p{$fleet_id}";
85 85
       $fleets[] = tpl_parse_fleet_sn($fleet_list['own']['total'], $planet_fleet_id);
86 86
       $fleet_id++;
@@ -141,17 +141,17 @@  discard block
 block discarded – undo
141 141
     UNIT_DEFENCE            => 'defense',
142 142
   );
143 143
 
144
-  foreach($show_groups as $unit_group_id => $mode) {
144
+  foreach ($show_groups as $unit_group_id => $mode) {
145 145
     $template->assign_block_vars('prods', array(
146 146
       'NAME' => classLocale::$lang['tech'][$unit_group_id],
147 147
     ));
148 148
     $unit_group = get_unit_param('techtree', $unit_group_id);
149
-    foreach($unit_group as $unit_id) {
149
+    foreach ($unit_group as $unit_id) {
150 150
       $unit_count = $unit_count_abs = 0;
151 151
       $block_vars = array();
152 152
       $unit_is_factory = in_array($unit_id, $sn_group_factories) && get_unit_param($unit_id, P_MINING_IS_MANAGED);
153 153
       // $unit_db_name = pname_resource_name($unit_id);
154
-      foreach($planets as $planet) {
154
+      foreach ($planets as $planet) {
155 155
         $unit_level_plain = mrc_get_level($user, $planet, $unit_id, false, true);
156 156
 
157 157
         $level_plus['FACTORY'] = $unit_is_factory;
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         $level_plus['LEVEL_PLUS_GREEN'] = 0;
160 160
 
161 161
         $level_plus['PERCENT'] = $unit_is_factory ? ($unit_level_plain ? $planet[pname_factory_production_field_name($unit_id)] * 10 : -1) : -1;
162
-        switch($mode) {
162
+        switch ($mode) {
163 163
           /*
164 164
           case 'structures':
165 165
             $level_plus_build = $ques[$planet['id']]['in_que'][que_get_unit_que($unit_id)][$user['id']][$planet['id']][$unit_id];
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
           case 'structures':
180 180
           case 'defense':
181 181
             $level_plus_build = $ques[$planet['id']]['in_que'][que_get_unit_que($unit_id)][$user['id']][$planet['id']][$unit_id];
182
-            if($level_plus_build) {
182
+            if ($level_plus_build) {
183 183
               $level_plus['LEVEL_PLUS_GREEN'] = $level_plus_build < 0 ? $level_plus_build : "+{$level_plus_build}";
184 184
               // $level_plus['LEVEL_PLUS_GREEN'] = "+{$level_plus_build}";
185 185
               $total['units'][$unit_id]['LEVEL_PLUS_GREEN'] += $level_plus['LEVEL_PLUS_GREEN'];
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
         $unit_count_abs += $unit_level_plain + abs($level_plus['LEVEL_PLUS_YELLOW']) + abs($level_plus['LEVEL_PLUS_GREEN']);
200 200
       }
201 201
 
202
-      if($unit_count_abs) {
202
+      if ($unit_count_abs) {
203 203
         $template->assign_block_vars('prods', array(
204 204
           'ID'    => $unit_id,
205 205
           'FIELD' => 'unit_' . $unit_id, // pname_resource_name($unit_id), // TODO Делать это прямо в темплейте
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
           'MODE'  => $mode,
208 208
         ));
209 209
 
210
-        foreach($block_vars as $block_var) {
210
+        foreach ($block_vars as $block_var) {
211 211
           $template->assign_block_vars('prods.planet', $block_var);
212 212
         }
213 213
         $unit_green = $total['units'][$unit_id]['LEVEL_PLUS_GREEN'];
Please login to merge, or discard this patch.
includes/pages/contact.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
   $query = db_user_list("`authlevel` > 0 ORDER BY `authlevel` ASC");
17 17
 
18 18
   // while($row = db_fetch($query))
19
-  foreach($query as $row) {
19
+  foreach ($query as $row) {
20 20
     $template_result['.']['contact'][] = array(
21 21
       'NAME'  => $row['username'],
22 22
       'LEVEL' => classLocale::$lang['user_level'][$row['authlevel']],
Please login to merge, or discard this patch.