Completed
Push — trunk ( d06df9...f48ee3 )
by SuperNova.WS
11:23
created
includes/alliance/ali_internal_admin.inc 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -3,26 +3,26 @@  discard block
 block discarded – undo
3 3
 use Alliance\DBStaticAlly;
4 4
 use Old\Avatar;
5 5
 
6
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
6
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
7 7
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
8 8
 }
9 9
 
10
-if(!$user_admin) {
10
+if (!$user_admin) {
11 11
   SnTemplate::messageBox($lang['Denied_access'], $lang['ally_admin']);
12 12
 }
13 13
 
14 14
 $template = SnTemplate::gettemplate('ali_admin', $template);
15 15
 
16 16
 $text_list = array(
17
-  1 => array ('db_field' => 'ally_description', 'text_type' => 'Public_text_of_alliance'),
18
-  2 => array ('db_field' => 'ally_text', 'text_type' => 'Internal_text'),
19
-  3 => array ('db_field' => 'ally_request', 'text_type' => 'Show_of_request_text'),
17
+  1 => array('db_field' => 'ally_description', 'text_type' => 'Public_text_of_alliance'),
18
+  2 => array('db_field' => 'ally_text', 'text_type' => 'Internal_text'),
19
+  3 => array('db_field' => 'ally_request', 'text_type' => 'Show_of_request_text'),
20 20
 );
21 21
 
22 22
 $allyTextID = sys_get_param_int('t', 1);
23
-$allyTextID = ($allyTextID<1 || $allyTextID>3) ? 1 : $allyTextID;
23
+$allyTextID = ($allyTextID < 1 || $allyTextID > 3) ? 1 : $allyTextID;
24 24
 
25
-if(sys_get_param_str('isSaveOptions')) {
25
+if (sys_get_param_str('isSaveOptions')) {
26 26
   $new_image = $ally['ally_image'];
27 27
   $avatar_upload_result = Avatar::sys_avatar_upload($ally['id'], $new_image, 'ally');
28 28
   $template->assign_vars([
@@ -31,32 +31,32 @@  discard block
 block discarded – undo
31 31
   ]);
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
       SnTemplate::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
       SnTemplate::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
     SnTemplate::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
     SnTemplate::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_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 = SnTemplate::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/alliance/ali_info.inc 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -3,14 +3,14 @@  discard block
 block discarded – undo
3 3
 use Alliance\AllianceHelper;
4 4
 use Alliance\DBStaticAlly;
5 5
 
6
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
6
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
7 7
 {
8 8
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
9 9
 }
10 10
 
11 11
 $template = SnTemplate::gettemplate('ali_info', true);
12 12
 
13
-if($mode == 'exit')
13
+if ($mode == 'exit')
14 14
 {
15 15
   if ($ally['ally_owner'] == $user['id'])
16 16
   {
@@ -27,25 +27,25 @@  discard block
 block discarded – undo
27 27
     SnTemplate::messageBox(sprintf($lang['ali_info_leave_success'], $ally['ally_name']), $lang['sys_alliance']);
28 28
   }
29 29
 }
30
-elseif($mode == 'ainfo')
30
+elseif ($mode == 'ainfo')
31 31
 {
32 32
   $tag = sys_get_param_str('tag');
33 33
   $id_ally = sys_get_param_id('a');
34
-  if($tag)
34
+  if ($tag)
35 35
   {
36 36
     $ally = doquery("SELECT * FROM {{alliance}} WHERE ally_tag='{$tag}' LIMIT 1;", '', true);
37 37
   }
38
-  elseif($id_ally)
38
+  elseif ($id_ally)
39 39
   {
40 40
     $ally = doquery("SELECT * FROM {{alliance}} WHERE id='{$id_ally}' LIMIT 1;", '', true);
41 41
   }
42 42
 
43
-  if(!$ally)
43
+  if (!$ally)
44 44
   {
45 45
     SnTemplate::messageBox($lang['ali_sys_notFound'], $lang['Ally_info_1']);
46 46
   }
47 47
 
48
-  if(!$ally['ally_description'])
48
+  if (!$ally['ally_description'])
49 49
   {
50 50
     $ally['ally_description'] = $lang['Ally_nodescription'];
51 51
   }
@@ -54,17 +54,17 @@  discard block
 block discarded – undo
54 54
     'EXTERNAL'     => true,
55 55
     'USER_ALLY_ID' => $user['ally_id'],
56 56
   ));
57
-  $page_header          = $lang['sys_alliance'];
57
+  $page_header = $lang['sys_alliance'];
58 58
 }
59 59
 else
60 60
 {
61 61
   $page_header = $lang['your_alliance'];
62 62
 
63
-  if($ally['ally_owner'] == $user['id'])
63
+  if ($ally['ally_owner'] == $user['id'])
64 64
   {
65 65
     $range = $ally['ally_owner_range'] ? $ally['ally_owner_range'] : $lang['Founder'];
66 66
   }
67
-  elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name']))
67
+  elseif ($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name']))
68 68
   {
69 69
     $range = $ranks[$user['ally_rank_id']]['name'];
70 70
   }
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 ]);
100 100
 
101 101
 $relations = ali_relations($ally['id']);
102
-foreach($relations as $relation)
102
+foreach ($relations as $relation)
103 103
 {
104
-  if($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id'])
104
+  if ($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id'])
105 105
   {
106 106
     $template->assign_block_vars('relation', array(
107 107
       'NAME'     => $relation['alliance_diplomacy_contr_ally_name'],
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -26,16 +26,14 @@  discard block
 block discarded – undo
26 26
     $lang['Go_out_welldone'] = str_replace("%s", $ally_name, $lang['Go_out_welldone']);
27 27
     SnTemplate::messageBox(sprintf($lang['ali_info_leave_success'], $ally['ally_name']), $lang['sys_alliance']);
28 28
   }
29
-}
30
-elseif($mode == 'ainfo')
29
+} elseif($mode == 'ainfo')
31 30
 {
32 31
   $tag = sys_get_param_str('tag');
33 32
   $id_ally = sys_get_param_id('a');
34 33
   if($tag)
35 34
   {
36 35
     $ally = doquery("SELECT * FROM {{alliance}} WHERE ally_tag='{$tag}' LIMIT 1;", '', true);
37
-  }
38
-  elseif($id_ally)
36
+  } elseif($id_ally)
39 37
   {
40 38
     $ally = doquery("SELECT * FROM {{alliance}} WHERE id='{$id_ally}' LIMIT 1;", '', true);
41 39
   }
@@ -55,20 +53,17 @@  discard block
 block discarded – undo
55 53
     'USER_ALLY_ID' => $user['ally_id'],
56 54
   ));
57 55
   $page_header          = $lang['sys_alliance'];
58
-}
59
-else
56
+} else
60 57
 {
61 58
   $page_header = $lang['your_alliance'];
62 59
 
63 60
   if($ally['ally_owner'] == $user['id'])
64 61
   {
65 62
     $range = $ally['ally_owner_range'] ? $ally['ally_owner_range'] : $lang['Founder'];
66
-  }
67
-  elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name']))
63
+  } elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name']))
68 64
   {
69 65
     $range = $ranks[$user['ally_rank_id']]['name'];
70
-  }
71
-  else
66
+  } else
72 67
   {
73 68
     $range = $lang['member'];
74 69
   }
Please login to merge, or discard this patch.
includes/alliance/ali_internal_admin_diplomacy.inc 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 use Alliance\DBStaticAlly;
4 4
 use \DBAL\DbQuery;
5 5
 
6
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
6
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
7 7
 {
8 8
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
9 9
 }
@@ -18,28 +18,28 @@  discard block
 block discarded – undo
18 18
 $ally_name_safe = db_escape($user['ally_name']);
19 19
 
20 20
 $autoAccept = false;
21
-if(sys_get_param_str('ali_dip_offer_make'))
21
+if (sys_get_param_str('ali_dip_offer_make'))
22 22
 {
23 23
   $alliance_negotiation_relation = sys_get_param_str('alliance_negotiation_relation');
24
-  if(!array_key_exists($alliance_negotiation_relation, $sn_diplomacy_relation_list))
24
+  if (!array_key_exists($alliance_negotiation_relation, $sn_diplomacy_relation_list))
25 25
   {
26 26
     SnTemplate::messageBox($lang['ali_dip_err_wrong_offer'], $page_title);
27 27
   }
28 28
 
29 29
   $alliance_negotiation_contr_ally_id = sys_get_param_id('alliance_negotiation_contr_ally_id');
30
-  if($alliance_negotiation_contr_ally_id == $user['ally_id'])
30
+  if ($alliance_negotiation_contr_ally_id == $user['ally_id'])
31 31
   {
32 32
     SnTemplate::messageBox($lang['ali_dip_err_same_ally'], $page_title);
33 33
   }
34 34
 
35 35
   $contr_ally_row = doquery("SELECT `ally_name` FROM {{alliance}} WHERE `id` = {$alliance_negotiation_contr_ally_id} LIMIT 1;", '', true);
36
-  if(!$contr_ally_row)
36
+  if (!$contr_ally_row)
37 37
   {
38 38
     SnTemplate::messageBox($lang['ali_dip_err_no_ally'], $page_title);
39 39
   }
40 40
 
41 41
   $relation_current_id = ali_relation($user['ally_id'], $alliance_negotiation_contr_ally_id);
42
-  if($alliance_negotiation_relation == $relation_current_id)
42
+  if ($alliance_negotiation_relation == $relation_current_id)
43 43
   {
44 44
     SnTemplate::messageBox(sprintf($lang['ali_dip_err_offer_same'], $lang['ali_dip_relations'][$alliance_negotiation_relation]), $page_title);
45 45
   }
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
   $relation_new = $sn_diplomacy_relation_list[$alliance_negotiation_relation];
53 53
   $relation_current = $sn_diplomacy_relation_list[$relation_current_id];
54
-  if($relation_new['enter_delay'] == -1 || $relation_current['exit_delay'] == -1)
54
+  if ($relation_new['enter_delay'] == -1 || $relation_current['exit_delay'] == -1)
55 55
   {
56 56
     DbQuery::build()
57 57
       ->setTable('alliance_negotiation')
@@ -85,39 +85,39 @@  discard block
 block discarded – undo
85 85
 else
86 86
 {
87 87
   $offer_id = sys_get_param_id('offer_id');
88
-  if($offer_id)
88
+  if ($offer_id)
89 89
   {
90 90
     $offer_answer = sys_get_param_str('answer');
91 91
 
92 92
     $negotiation = doquery("SELECT * FROM {{alliance_negotiation}} WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;", '', true);
93
-    if(!$negotiation)
93
+    if (!$negotiation)
94 94
     {
95 95
       SnTemplate::messageBox($lang['ali_dip_err_offer_none'], $page_title);
96 96
     }
97
-    elseif($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id'])
97
+    elseif ($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id'])
98 98
     {
99 99
       // TODO: Add log of hack attempt
100 100
       SnTemplate::messageBox($lang['ali_dip_err_offer_alien'], $page_title);
101 101
     }
102
-    elseif($negotiation['alliance_negotiation_ally_id'] == $user['ally_id'])
102
+    elseif ($negotiation['alliance_negotiation_ally_id'] == $user['ally_id'])
103 103
     {
104
-      if($offer_answer == 'accept')
104
+      if ($offer_answer == 'accept')
105 105
       {
106 106
         // TODO: Add log of hack attempt
107 107
         SnTemplate::messageBox($lang['ali_dip_err_offer_accept_own'], $page_title);
108 108
       }
109
-      elseif($offer_answer == 'deny')
109
+      elseif ($offer_answer == 'deny')
110 110
       {
111 111
         doquery("DELETE FROM {{alliance_negotiation}} WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;");
112 112
       }
113 113
     }
114 114
     else
115 115
     {
116
-      if($offer_answer == 'accept')
116
+      if ($offer_answer == 'accept')
117 117
       {
118 118
         $accept_offer = true;
119 119
       }
120
-      elseif($offer_answer == 'deny')
120
+      elseif ($offer_answer == 'deny')
121 121
       {
122 122
         DBStaticAlly::db_ally_negotiation_update_status_1($offer_id);
123 123
       }
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
   }
126 126
 }
127 127
 
128
-if($accept_offer)
128
+if ($accept_offer)
129 129
 {
130 130
   sn_db_transaction_start();
131 131
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
   sn_db_transaction_commit();
186 186
 }
187 187
 
188
-foreach($sn_diplomacy_relation_list as $diplomacy_relation_id => $diplomacy_relation)
188
+foreach ($sn_diplomacy_relation_list as $diplomacy_relation_id => $diplomacy_relation)
189 189
 {
190 190
   $template->assign_block_vars('relation', array(
191 191
     'ID'   => $diplomacy_relation_id,
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 }
195 195
 
196 196
 $query = doquery("SELECT id, ally_name, ally_tag FROM {{alliance}} WHERE `id` != {$user['ally_id']} ORDER BY ally_name;");
197
-while($alliance = db_fetch($query))
197
+while ($alliance = db_fetch($query))
198 198
 {
199 199
   $template->assign_block_vars('alliance', array(
200 200
     'ID'   => $alliance['id'],
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
   WHERE
214 214
     alliance_negotiation_ally_id = {$user['ally_id']} OR alliance_negotiation_contr_ally_id = {$user['ally_id']};"
215 215
 );
216
-while($offer = db_fetch($query))
216
+while ($offer = db_fetch($query))
217 217
 {
218 218
   $template->assign_block_vars('offer', array(
219 219
     'ID'       => $offer['alliance_negotiation_id'],
Please login to merge, or discard this patch.
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -68,8 +68,7 @@  discard block
 block discarded – undo
68 68
       ->doInsert();
69 69
 
70 70
     $accept_offer = false;
71
-  }
72
-  else
71
+  } else
73 72
   {
74 73
     $accept_offer = true;
75 74
     $autoAccept = true;
@@ -81,8 +80,7 @@  discard block
 block discarded – undo
81 80
       'alliance_negotiation_relation' => $alliance_negotiation_relation,
82 81
     );
83 82
   }
84
-}
85
-else
83
+} else
86 84
 {
87 85
   $offer_id = sys_get_param_id('offer_id');
88 86
   if($offer_id)
@@ -93,31 +91,26 @@  discard block
 block discarded – undo
93 91
     if(!$negotiation)
94 92
     {
95 93
       SnTemplate::messageBox($lang['ali_dip_err_offer_none'], $page_title);
96
-    }
97
-    elseif($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id'])
94
+    } elseif($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id'])
98 95
     {
99 96
       // TODO: Add log of hack attempt
100 97
       SnTemplate::messageBox($lang['ali_dip_err_offer_alien'], $page_title);
101
-    }
102
-    elseif($negotiation['alliance_negotiation_ally_id'] == $user['ally_id'])
98
+    } elseif($negotiation['alliance_negotiation_ally_id'] == $user['ally_id'])
103 99
     {
104 100
       if($offer_answer == 'accept')
105 101
       {
106 102
         // TODO: Add log of hack attempt
107 103
         SnTemplate::messageBox($lang['ali_dip_err_offer_accept_own'], $page_title);
108
-      }
109
-      elseif($offer_answer == 'deny')
104
+      } elseif($offer_answer == 'deny')
110 105
       {
111 106
         doquery("DELETE FROM {{alliance_negotiation}} WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;");
112 107
       }
113
-    }
114
-    else
108
+    } else
115 109
     {
116 110
       if($offer_answer == 'accept')
117 111
       {
118 112
         $accept_offer = true;
119
-      }
120
-      elseif($offer_answer == 'deny')
113
+      } elseif($offer_answer == 'deny')
121 114
       {
122 115
         DBStaticAlly::db_ally_negotiation_update_status_1($offer_id);
123 116
       }
Please login to merge, or discard this patch.
includes/includes/flt_page3.inc 1 patch
Spacing   +34 added lines, -35 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 use Planet\DBStaticPlanet;
9 9
 use Unit\DBStaticUnit;
10 10
 
11
-if(SN_IN_FLEET !== true) {
11
+if (SN_IN_FLEET !== true) {
12 12
   $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403);
13 13
 }
14 14
 
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     $errorlist .= $lang['fl_limit_galaxy'];
28 28
   if (!$system || $system > $config->game_maxSystem || $system < 1)
29 29
     $errorlist .= $lang['fl_limit_system'];
30
-  if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE ))
30
+  if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE))
31 31
     $errorlist .= $lang['fl_limit_planet'];
32 32
   if ($planetrow['galaxy'] == $galaxy && $planetrow['system'] == $system && $planetrow['planet'] == $planet && $planetrow['planet_type'] == $planet_type)
33 33
     $errorlist .= $lang['fl_ownpl_err'];
@@ -54,35 +54,35 @@  discard block
 block discarded – undo
54 54
   $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true);
55 55
 
56 56
   if ($target_mission == MT_EXPLORE) {
57
-    if ($MaxExpeditions == 0 ) {
57
+    if ($MaxExpeditions == 0) {
58 58
       $errorlist .= $lang['fl_expe_notech'];
59
-    } elseif ($FlyingExpeditions >= $MaxExpeditions ) {
59
+    } elseif ($FlyingExpeditions >= $MaxExpeditions) {
60 60
       $errorlist .= $lang['fl_expe_max'];
61 61
     }
62 62
   } else {
63
-    if ($TargetPlanet['id_owner']){
63
+    if ($TargetPlanet['id_owner']) {
64 64
       if ($target_mission == MT_COLONIZE)
65 65
         $errorlist .= $lang['fl_colonized'];
66 66
 
67
-      if ($TargetPlanet['id_owner'] == $planetrow['id_owner']){
67
+      if ($TargetPlanet['id_owner'] == $planetrow['id_owner']) {
68 68
         if ($target_mission == MT_ATTACK)
69 69
           $errorlist .= $lang['fl_no_self_attack'];
70 70
 
71 71
         if ($target_mission == MT_SPY)
72 72
           $errorlist .= $lang['fl_no_self_spy'];
73
-      }else{
73
+      } else {
74 74
         if ($target_mission == MT_RELOCATE)
75 75
           $errorlist .= $lang['fl_only_stay_at_home'];
76 76
       }
77
-    }else{
78
-      if ($target_mission < MT_COLONIZE){
77
+    } else {
78
+      if ($target_mission < MT_COLONIZE) {
79 79
         $errorlist .= $lang['fl_unknow_target'];
80
-      }else{
80
+      } else {
81 81
         if ($target_mission == MT_DESTROY)
82 82
           $errorlist .= $lang['fl_nomoon'];
83 83
 
84
-        if ($target_mission == MT_RECYCLE){
85
-          if($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0)
84
+        if ($target_mission == MT_RECYCLE) {
85
+          if ($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0)
86 86
             $errorlist .= $lang['fl_nodebris'];
87 87
         }
88 88
       }
@@ -90,13 +90,13 @@  discard block
 block discarded – undo
90 90
   }
91 91
 
92 92
 
93
-  if(is_object($captainModule = moduleCaptain()) && $captain_id = sys_get_param_id('captain_id')) {
93
+  if (is_object($captainModule = moduleCaptain()) && $captain_id = sys_get_param_id('captain_id')) {
94 94
     $captain = $captainModule->unit_captain_get($planetrow['id']);
95 95
 //      mrc_get_level($user, $planetrow, UNIT_CAPTAIN, true);
96
-    if(!$captain) {
96
+    if (!$captain) {
97 97
       $errorlist .= $lang['module_unit_captain_error_no_captain'];
98
-    } elseif($captain['unit_location_type'] == LOC_PLANET) {
99
-      if($target_mission == MT_RELOCATE && ($arriving_captain = mrc_get_level($user, $TargetPlanet, UNIT_CAPTAIN, true))) {
98
+    } elseif ($captain['unit_location_type'] == LOC_PLANET) {
99
+      if ($target_mission == MT_RELOCATE && ($arriving_captain = mrc_get_level($user, $TargetPlanet, UNIT_CAPTAIN, true))) {
100 100
         $errorlist .= $lang['module_unit_captain_error_captain_already_bound'];
101 101
       }
102 102
     } else {
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
   $fleet_group = max(0, intval($_POST['fleet_group']));
121 121
   //But is it acs??
122 122
   //Well all acs fleets must have a fleet code.
123
-  if($fleet_group) {
123
+  if ($fleet_group) {
124 124
     //Also it must be mission type 2
125 125
     $target_mission = MT_AKS;
126 126
 
127 127
     //The co-ords must be the same as where the acs fleet is going.
128 128
     $target = "g{$galaxy}s{$system}p{$planet}t{$planet_type}";
129
-    if($_POST['acs_target_mr'] == $target) {
129
+    if ($_POST['acs_target_mr'] == $target) {
130 130
       //ACS attack must exist (if acs fleet has arrived this will also return false (2 checks in 1!!!)
131 131
       $aks = DbFleetStatic::dbAcsGetById($fleet_group);
132 132
       if (!$aks) {
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     }
143 143
   }
144 144
   //Check that a failed acs attack isn't being sent, if it is, make it an attack fleet.
145
-  if(!$fleet_group && $target_mission == MT_AKS) {
145
+  if (!$fleet_group && $target_mission == MT_AKS) {
146 146
     $target_mission = MT_ATTACK;
147 147
   }
148 148
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
   $options = [P_FLEET_ATTACK_SPEED_PERCENT_TENTH => $speed_percent, P_FLEET_ATTACK_FLEET_GROUP => $fleet_group, P_FLEET_ATTACK_RESOURCES_SUM => $StorageNeeded];
153 153
   $cant_attack = flt_can_attack($planetrow, $TargetPlanet, $fleetarray, $target_mission, $options);
154 154
 
155
-  if($cant_attack !== ATTACK_ALLOWED) {
155
+  if ($cant_attack !== ATTACK_ALLOWED) {
156 156
     SnTemplate::messageBox("<span class='error'><b>{$lang['fl_attack_error'][$cant_attack]}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 99);
157 157
   }
158 158
 
@@ -163,11 +163,10 @@  discard block
 block discarded – undo
163 163
 
164 164
   $fleet['start_time'] = $duration + SN_TIME_NOW;
165 165
 
166
-  $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) :
167
-    ($target_mission == MT_HOLD ? 12 : 0);
168
-  if($max_duration) {
166
+  $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) : ($target_mission == MT_HOLD ? 12 : 0);
167
+  if ($max_duration) {
169 168
     $StayDuration = sys_get_param_id('missiontime');
170
-    if($StayDuration > $max_duration || $StayDuration < 1) {
169
+    if ($StayDuration > $max_duration || $StayDuration < 1) {
171 170
       $debug->warning('Supplying wrong mission time', 'Hack attempt', 302, array('base_dump' => true));
172 171
       die();
173 172
     }
@@ -177,10 +176,10 @@  discard block
 block discarded – undo
177 176
     $StayDuration = 0;
178 177
     $StayTime     = 0;
179 178
   }
180
-  $fleet['end_time']   = $StayDuration + (2 * $duration) + SN_TIME_NOW;
179
+  $fleet['end_time'] = $StayDuration + (2 * $duration) + SN_TIME_NOW;
181 180
 
182
-  if($aks && $target_mission == MT_AKS) {
183
-    if ($fleet['start_time']>$aks['ankunft']) {
181
+  if ($aks && $target_mission == MT_AKS) {
182
+    if ($fleet['start_time'] > $aks['ankunft']) {
184 183
       SnTemplate::messageBox($lang['fl_aks_too_slow'] . 'Fleet arrival: ' . date(FMT_DATE_TIME, $fleet['start_time']) . " AKS arrival: " . date(FMT_DATE_TIME, $aks['ankunft']), $lang['fl_error']);
185 184
     }
186 185
     $fleet['start_time'] = $aks['ankunft'];
@@ -191,14 +190,14 @@  discard block
 block discarded – undo
191 190
   $FleetShipCount      = 0;
192 191
   $db_changeset = array();
193 192
   foreach ($fleetarray as $Ship => $Count) {
194
-    $FleetStorage    += get_unit_param($Ship, P_CAPACITY) * $Count;
193
+    $FleetStorage += get_unit_param($Ship, P_CAPACITY) * $Count;
195 194
     $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($Ship, -$Count, $user, $planetrow['id']);
196 195
   }
197 196
   $fleet_array = sys_unit_arr2str($fleetarray);
198
-  $FleetShipCount  += array_sum($fleetarray);
199
-  $FleetStorage        -= $consumption;
197
+  $FleetShipCount += array_sum($fleetarray);
198
+  $FleetStorage -= $consumption;
200 199
 
201
-  if ( $StorageNeeded > $FleetStorage) {
200
+  if ($StorageNeeded > $FleetStorage) {
202 201
     SnTemplate::messageBox("<span class='error'><b>" . $lang['fl_nostoragespa'] . HelperString::numberFloorAndFormat($StorageNeeded - $FleetStorage) . "</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
203 202
   }
204 203
   if ($planetrow['deuterium'] < $TransDeuterium + $consumption) {
@@ -247,7 +246,7 @@  discard block
 block discarded – undo
247 246
 //    ));
248 247
 //  }
249 248
 
250
-  if(is_array($captain)) {
249
+  if (is_array($captain)) {
251 250
     DBStaticUnit::db_unit_set_by_id($captain['unit_id'], "`unit_location_type` = " . LOC_FLEET . ", `unit_location_id` = {$fleet_id}");
252 251
   }
253 252
 
@@ -260,7 +259,7 @@  discard block
 block discarded – undo
260 259
     'START_LEFT'         => floor($fleet['end_time'] + 1 - SN_TIME_NOW),
261 260
   );
262 261
 
263
-  if(!empty($TargetPlanet)) {
262
+  if (!empty($TargetPlanet)) {
264 263
     $template_route += array(
265 264
       'END_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$TargetPlanet['planet_type']],
266 265
       'END_COORDS'       => uni_render_coordinates($TargetPlanet),
@@ -273,8 +272,8 @@  discard block
 block discarded – undo
273 272
   $template->assign_block_vars('fleets', $template_route);
274 273
 
275 274
   $sn_groups_fleet = sn_get_groups('fleet');
276
-  foreach($fleetarray as $ship_id => $ship_count) {
277
-    if(in_array($ship_id, $sn_groups_fleet) && $ship_count) {
275
+  foreach ($fleetarray as $ship_id => $ship_count) {
276
+    if (in_array($ship_id, $sn_groups_fleet) && $ship_count) {
278 277
 //      $ship_base_data = get_ship_data($ship_id, $user);
279 278
       $template->assign_block_vars('fleets.ships', array(
280 279
         'ID'          => $ship_id,
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($lang['player_option_fleet_ship_sort'][$fleet_ship_sort])) {
10
+  if (!empty($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
     SN::$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
   SnTemplate::messageBox($lang['fl_noplanetrow'], $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 = SN::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT];
54 54
 $fleet_ship_sort_inverse = SN::$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($lang['player_option_fleet_ship_sort'] as $sort_id => $sort_text) {
75
+foreach ($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_page1.inc 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -7,18 +7,18 @@  discard block
 block discarded – undo
7 7
 use Fleet\DbFleetStatic;
8 8
 use Planet\DBStaticPlanet;
9 9
 
10
-if(SN_IN_FLEET !== true) {
10
+if (SN_IN_FLEET !== true) {
11 11
   $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403);
12 12
 }
13 13
 
14 14
 $template = SnTemplate::gettemplate('fleet1', true);
15 15
 
16 16
 $ships = sys_get_param('ships', array());
17
-if(!is_array($ships)) {
17
+if (!is_array($ships)) {
18 18
   $ships = array();
19 19
 }
20 20
 
21
-foreach(array(PT_PLANET, PT_DEBRIS, PT_MOON) as $possible_planet_type_id) {
21
+foreach (array(PT_PLANET, PT_DEBRIS, PT_MOON) as $possible_planet_type_id) {
22 22
   $template->assign_block_vars('possible_planet_type_id', array(
23 23
     'ID' => $possible_planet_type_id,
24 24
     'NAME' => $lang['sys_planet_type_sh'][$possible_planet_type_id],
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
   'START_NAME'         => $planetrow['name'],
32 32
 );
33 33
 
34
-if(!empty($TargetPlanet)) {
34
+if (!empty($TargetPlanet)) {
35 35
   $template_route += array(
36 36
     'END_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$TargetPlanet['planet_type']],
37 37
     'END_COORDS'       => uni_render_coordinates($TargetPlanet),
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
 $template->assign_block_vars('fleets', $template_route);
43 43
 
44 44
 $sn_groups_fleet = sn_get_groups('fleet');
45
-foreach($ships as $ship_id => $ship_count) {
46
-  if(in_array($ship_id, $sn_groups_fleet) && $ship_count) {
45
+foreach ($ships as $ship_id => $ship_count) {
46
+  if (in_array($ship_id, $sn_groups_fleet) && $ship_count) {
47 47
     $ship_info = get_unit_param($ship_id);
48
-    if($ship_count > mrc_get_level($user, $planetrow, $ship_id, false, true)) {
48
+    if ($ship_count > mrc_get_level($user, $planetrow, $ship_id, false, true)) {
49 49
       $page .= $lang['fl_noenought'];
50 50
     } else {
51 51
       $fleet['fleetarray'][$ship_id]  = $ship_count;
@@ -64,13 +64,13 @@  discard block
 block discarded – undo
64 64
   }
65 65
 }
66 66
 
67
-if(empty($fleet['fleetarray'])) {
67
+if (empty($fleet['fleetarray'])) {
68 68
   SnTemplate::messageBox($lang['fl_err_no_ships'], $lang['fl_error'], 'fleet' . DOT_PHP_EX, 5);
69 69
 }
70 70
 
71 71
 // Building list of shortcuts
72 72
 $query = doquery("SELECT * FROM {{notes}} WHERE `owner` = {$user['id']} AND `galaxy` <> 0 AND `system` <> 0 AND `planet` <> 0 ORDER BY `priority` DESC, `galaxy`, `system`, `planet`, `planet_type`;");
73
-while($shortcut = db_fetch($query)) {
73
+while ($shortcut = db_fetch($query)) {
74 74
   $template->assign_block_vars('shortcut', array(
75 75
     'NAME'       => $shortcut['title'],
76 76
     'GALAXY'     => $shortcut['galaxy'],
@@ -84,10 +84,10 @@  discard block
 block discarded – undo
84 84
 }
85 85
 
86 86
 // Building list of own planets & moons
87
-$colonies = DBStaticPlanet::db_planet_list_sorted ( $user );
88
-if(count($colonies) > 1) {
87
+$colonies = DBStaticPlanet::db_planet_list_sorted($user);
88
+if (count($colonies) > 1) {
89 89
   // while($row = db_fetch($colonies))
90
-  foreach($colonies as $row) {
90
+  foreach ($colonies as $row) {
91 91
     $template->assign_block_vars('colonies', array(
92 92
       'NAME'       => $row['name'],
93 93
       'GALAXY'     => $row['galaxy'],
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
 //ACS Start
103 103
 //Need to look for acs attacks.
104 104
 $aks_madnessred = DbFleetStatic::dbAcsGetAll();
105
-while($row = db_fetch($aks_madnessred)) {
105
+while ($row = db_fetch($aks_madnessred)) {
106 106
   $members = explode(',', $row['eingeladen']);
107
-  foreach($members as $a => $b) {
107
+  foreach ($members as $a => $b) {
108 108
     if ($b == $user['id']) {
109 109
       $template->assign_block_vars('acss', array(
110 110
         'ID'         => $row['id'],
Please login to merge, or discard this patch.
includes/includes/flt_page4.inc 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -3,18 +3,18 @@  discard block
 block discarded – undo
3 3
 use Fleet\DbFleetStatic;
4 4
 use Planet\DBStaticPlanet;
5 5
 
6
-if(SN_IN_FLEET !== true) {
6
+if (SN_IN_FLEET !== true) {
7 7
   $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403);
8 8
 }
9 9
 
10 10
 $fleetid = sys_get_param_id('fleetid');
11 11
 
12
-if(!is_numeric($fleetid) || empty($fleetid)) {
12
+if (!is_numeric($fleetid) || empty($fleetid)) {
13 13
   sys_redirect("fleet.php");
14 14
 }
15 15
 
16 16
 $fleet = DbFleetStatic::db_fleet_get($fleetid);
17
-if(!$fleet) {
17
+if (!$fleet) {
18 18
   SnTemplate::messageBox($lang['fl_fleet_not_exists'], $lang['fl_error']);
19 19
 }
20 20
 
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
   SnTemplate::messageBox($lang['fl_isback'], $lang['fl_error']);
23 23
 }
24 24
 
25
-if($fleet['fleet_owner'] != $user['id']) {
26
-  $debug->warning($lang['fl_aks_hack_wrong_fleet'],'Wrong Fleet Owner',301);
25
+if ($fleet['fleet_owner'] != $user['id']) {
26
+  $debug->warning($lang['fl_aks_hack_wrong_fleet'], 'Wrong Fleet Owner', 301);
27 27
   SnTemplate::messageBox($lang['fl_aks_hack_wrong_fleet'], $lang['fl_error']);
28 28
 }
29 29
 
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
   'MISSION_NAME' => $lang['type_mission'][MT_AKS],
58 58
 ));
59 59
 
60
-if($aks['eingeladen'] && is_array($members = SN::db_get_record_list(LOC_USER, "`id` in ({$aks['eingeladen']})")) && !empty($members)) {
61
-  foreach($members as $row) {
60
+if ($aks['eingeladen'] && is_array($members = SN::db_get_record_list(LOC_USER, "`id` in ({$aks['eingeladen']})")) && !empty($members)) {
61
+  foreach ($members as $row) {
62 62
     $template->assign_block_vars('invited', array(
63 63
       'NAME' => $row['username'],
64 64
     ));
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 $i++;
69 69
 $fleet_row = DbFleetStatic::db_fleet_get($fleetid);
70 70
 
71
-if(is_array($fleet_row) && !empty($fleet_row)) {
71
+if (is_array($fleet_row) && !empty($fleet_row)) {
72 72
 $planet_start = DBStaticPlanet::db_planet_by_id($fleet_row['fleet_start_planet_id']);
73 73
 $fleet_row['fleet_start_name'] = !empty($planet_start['name']) ? $planet_start['name'] : '';
74 74
 $planet_end = DBStaticPlanet::db_planet_by_id($fleet_row['fleet_end_planet_id']);
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
 $fleet_data = tpl_parse_fleet_db($fleet_row, $i, $user);
78 78
 $template->assign_block_vars('fleets', $fleet_data['fleet']);
79
-foreach($fleet_data['ships'] as $ship_data) {
79
+foreach ($fleet_data['ships'] as $ship_data) {
80 80
   $template->assign_block_vars('fleets.ships', $ship_data);
81 81
 }
82 82
 }
Please login to merge, or discard this patch.
includes/includes/eco_bld_structures.php 1 patch
Spacing   +35 added lines, -35 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 = \Alliance\Alliance::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 = $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
       SnTemplate::messageBox($lang['no_laboratory'], $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
       SnTemplate::messageBox($lang['eco_bld_msg_err_laboratory_upgrading'], $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 = $lang['eco_bld_research_page_name'] . ($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
 //      messageBox($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 = $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
       SnTemplate::messageBox($lang['need_hangar'], $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 = SnTemplate::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
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
   $record_index = 0;
138 138
 
139
-  foreach($build_unit_list as $unit_id) {
139
+  foreach ($build_unit_list as $unit_id) {
140 140
     $level_base = mrc_get_level($user, $planet, $unit_id, false, true);
141 141
     $level_effective = mrc_get_level($user, $planet, $unit_id);
142 142
     $level_in_que = $in_que[$unit_id];
@@ -159,12 +159,12 @@  discard block
 block discarded – undo
159 159
     $can_build = $unit_info[P_MAX_STACK] ? max(0, $unit_info[P_MAX_STACK] - $level_in_que - $level_effective) : $build_data['CAN'][BUILD_CREATE];
160 160
     // Restricting $can_build by free silo capacity
161 161
     $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;
162
-    if(!$can_build) {
163
-      if(!$build_data['CAN'][BUILD_CREATE]) {
162
+    if (!$can_build) {
163
+      if (!$build_data['CAN'][BUILD_CREATE]) {
164 164
         $build_data['RESULT'][BUILD_CREATE] = BUILD_NO_RESOURCES;
165
-      } elseif($unit_is_missile && $silo_capacity_free < $unit_info[P_UNIT_SIZE]) {
165
+      } elseif ($unit_is_missile && $silo_capacity_free < $unit_info[P_UNIT_SIZE]) {
166 166
         $build_data['RESULT'][BUILD_CREATE] = BUILD_SILO_FULL;
167
-      } elseif($unit_info[P_MAX_STACK]) {
167
+      } elseif ($unit_info[P_MAX_STACK]) {
168 168
         $build_data['RESULT'][BUILD_CREATE] = BUILD_MAX_REACHED;
169 169
       }
170 170
     }
@@ -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' => HelperString::numberFloorAndFormat(mrc_modify_value($user, false, array(MRC_ADMIRAL, TECH_SHIELD), $unit_info['shield'])),
238 238
         'ACTUAL_ARMOR'  => HelperString::numberFloorAndFormat(mrc_modify_value($user, false, array(MRC_ADMIRAL, TECH_ARMOR), $unit_info['armor'])),
239 239
         'ACTUAL_WEAPON' => HelperString::numberFloorAndFormat(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,24 +275,24 @@  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)))
285 285
           ) {
286 286
             $level_production['R' . $resource_id] = $resource_income;
287 287
             $level_production['D' . $resource_id] = $resource_income - $level_production_base[$resource_id];
288
-            if($level_production['D' . $resource_id] == 0) {
288
+            if ($level_production['D' . $resource_id] == 0) {
289 289
               $level_production['D' . $resource_id] = '-';
290 290
             }
291 291
           }
292 292
         }
293 293
         $production['.']['resource'][] = $level_production;
294 294
       }
295
-    } elseif($unit_id == TECH_ASTROTECH) {
295
+    } elseif ($unit_id == TECH_ASTROTECH) {
296 296
       $element_level_start = $level_effective + $in_que[$unit_id];
297 297
       $level_production_base = array(
298 298
         UNIT_PLAYER_EXPEDITIONS_MAX => get_player_max_expeditons($user, $element_level_start),
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
       );
301 301
 
302 302
       $level_start = $level_base_and_que > 1 ? $level_effective + $level_in_que - 1 : 1;
303
-      for($i = 0; $i < 6; $i++) {
303
+      for ($i = 0; $i < 6; $i++) {
304 304
         $level_production = array('LEVEL' => $level_start + $i);
305 305
         $level_production['R' . UNIT_PLAYER_EXPEDITIONS_MAX] = get_player_max_expeditons($user, $level_start + $i);
306 306
         $level_production['D' . UNIT_PLAYER_EXPEDITIONS_MAX] = $level_production['R' . UNIT_PLAYER_EXPEDITIONS_MAX] - $level_production_base[UNIT_PLAYER_EXPEDITIONS_MAX];
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
     $template_result['.']['production'][] = $production;
322 322
   }
323 323
 
324
-  foreach($lang['player_option_building_sort'] as $sort_id => $sort_text) {
324
+  foreach ($lang['player_option_building_sort'] as $sort_id => $sort_text) {
325 325
     $template->assign_block_vars('sort_values', array(
326 326
       'VALUE' => $sort_id,
327 327
       'TEXT'  => $sort_text,
@@ -330,8 +330,8 @@  discard block
 block discarded – undo
330 330
 
331 331
   $sort_option = SN::$user_options[array(PLAYER_OPTION_BUILDING_SORT, $que_type)];
332 332
   $sort_option_inverse = SN::$user_options[array(PLAYER_OPTION_BUILDING_SORT_INVERSE, $que_type)];
333
-  if($sort_option || $sort_option_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) {
334
-    switch($sort_option) {
333
+  if ($sort_option || $sort_option_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) {
334
+    switch ($sort_option) {
335 335
       case PLAYER_OPTION_SORT_NAME:
336 336
         $sort_option_field = 'NAME';
337 337
       break;
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
       break;
347 347
     }
348 348
     $sort_option_inverse_closure = $sort_option_inverse ? -1 : 1;
349
-    usort($template_result['.']['production'], function ($a, $b) use ($sort_option_field, $sort_option_inverse_closure) {
349
+    usort($template_result['.']['production'], function($a, $b) use ($sort_option_field, $sort_option_inverse_closure) {
350 350
       return $a[$sort_option_field] < $b[$sort_option_field] ? -1 * $sort_option_inverse_closure : (
351 351
       $a[$sort_option_field] > $b[$sort_option_field] ? 1 * $sort_option_inverse_closure : 0
352 352
       );
Please login to merge, or discard this patch.