Test Failed
Push — trunk ( 132e87...b3f953 )
by SuperNova.WS
11:54
created
admin/planet_compensate.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
   } else {
66 66
   db_mysql::db_transaction_start();
67 67
   SN::$gc->db->lockRecords([
68
-    'users'   => [$owner['id'],],
68
+    'users'   => [$owner['id'], ],
69 69
     'planets' => [$planet['id'], $destination['id'], !empty($moon['id']) ? $moon['id'] : 0],
70 70
   ]);
71 71
 
Please login to merge, or discard this patch.
admin/ajax_maintenance.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @var array $user
12 12
  */
13 13
 
14
-if(
14
+if (
15 15
   ($user['authlevel'] < 3)
16 16
   &&
17 17
   (empty($config->admin_http_key) || empty($_GET['admin_http_key']) || $_GET['admin_http_key'] != $config->admin_http_key)
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 }
23 23
 
24 24
 // If we have  already passed here through admin_http_key - then we can safely assume that it's admin
25
-if(empty($user['authlevel'])) {
25
+if (empty($user['authlevel'])) {
26 26
   $user['authlevel'] = 3;
27 27
 }
28 28
 
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 
36 36
 // [#] info_best_battles 1b0
37 37
 $best_reports = array();
38
-if(defined('MODULE_INFO_BEST_BATTLES_QUERY')) {
38
+if (defined('MODULE_INFO_BEST_BATTLES_QUERY')) {
39 39
   $query = doquery(MODULE_INFO_BEST_BATTLES_QUERY);
40
-  while($row = db_fetch($query)) {
40
+  while ($row = db_fetch($query)) {
41 41
     $best_reports[] = $row['ube_report_id'];
42 42
   }
43 43
 }
@@ -220,16 +220,16 @@  discard block
 block discarded – undo
220 220
 
221 221
 function sn_maintenance_pack_user_list($user_list) {
222 222
   $user_list = explode(',', $user_list);
223
-  foreach($user_list as $key => $user_id) {
224
-    if(!is_numeric($user_id)) {
223
+  foreach ($user_list as $key => $user_id) {
224
+    if (!is_numeric($user_id)) {
225 225
       unset($user_list[$key]);
226 226
     }
227 227
   }
228 228
 
229 229
   $result = array();
230
-  if(!empty($user_list)) {
230
+  if (!empty($user_list)) {
231 231
     $query = doquery("SELECT `id` FROM `{{users}}` WHERE `id` in (" . implode(',', $user_list) . ")");
232
-    while($row = db_fetch($query)) {
232
+    while ($row = db_fetch($query)) {
233 233
       $result[] = $row['id'];
234 234
     }
235 235
   }
@@ -244,11 +244,11 @@  discard block
 block discarded – undo
244 244
 $old_server_status == GAME_DISABLE_NONE ? SN::$config->pass()->game_disable = GAME_DISABLE_MAINTENANCE : false;
245 245
 db_mysql::db_transaction_commit();
246 246
 
247
-foreach($ques as $que_transaction) {
247
+foreach ($ques as $que_transaction) {
248 248
   db_mysql::db_transaction_start();
249 249
 
250 250
   !is_array($que_transaction) ? $que_transaction = array($que_transaction) : false;
251
-  foreach($que_transaction as $que) {
251
+  foreach ($que_transaction as $que) {
252 252
     set_time_limit(120);
253 253
     $QryResult = doquery($que);
254 254
     //$msg .= '<hr>' . $que . '<hr>';
Please login to merge, or discard this patch.
admin/adm_log_main.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -18,15 +18,15 @@  discard block
 block discarded – undo
18 18
 
19 19
 SnTemplate::messageBoxAdminAccessDenied(AUTH_LEVEL_ADMINISTRATOR);
20 20
 
21
-if($delete = sys_get_param_id('delete'))
21
+if ($delete = sys_get_param_id('delete'))
22 22
 {
23 23
   doquery("DELETE FROM `{{logs}}` WHERE `log_id` = {$delete} LIMIT 1;");
24 24
 }
25
-elseif(sys_get_param_str('delete_update_info'))
25
+elseif (sys_get_param_str('delete_update_info'))
26 26
 {
27 27
   doquery("DELETE FROM `{{logs}}` WHERE `log_code` in (103, 180, 191);");
28 28
 }
29
-elseif(sys_get_param_str('deleteall') == 'yes')
29
+elseif (sys_get_param_str('deleteall') == 'yes')
30 30
 {
31 31
 //  doquery("TRUNCATE TABLE `{{logs}}`");
32 32
 }
@@ -50,19 +50,19 @@  discard block
 block discarded – undo
50 50
   return $result;
51 51
 }
52 52
 
53
-if($detail = sys_get_param_id('detail'))
53
+if ($detail = sys_get_param_id('detail'))
54 54
 {
55 55
   $template = SnTemplate::gettemplate('admin/adm_log_main_detail', true);
56 56
 
57 57
   $errorInfo = doquery("SELECT * FROM `{{logs}}` WHERE `log_id` = {$detail} LIMIT 1;", true);
58 58
   $error_dump = json_decode($errorInfo['log_dump'], true);
59
-  if(is_array($error_dump))
59
+  if (is_array($error_dump))
60 60
   {
61 61
     foreach ($error_dump as $key => $value)
62 62
     {
63 63
       // Parsing user options to readable state
64
-      if($key == 'user' ) {
65
-        if(!empty($value['options'])) {
64
+      if ($key == 'user') {
65
+        if (!empty($value['options'])) {
66 66
           $value['options'] = explode(USER_OPTIONS_SPLIT, $value['options']);
67 67
         }
68 68
       }
@@ -87,12 +87,12 @@  discard block
 block discarded – undo
87 87
 
88 88
   $i = 0;
89 89
   $query = doquery("SELECT * FROM `{{logs}}` ORDER BY log_id DESC LIMIT 100;");
90
-  while($u = db_fetch($query))
90
+  while ($u = db_fetch($query))
91 91
   {
92 92
     $i++;
93 93
     $v = [];
94 94
     $u['log_text'] = str_replace("\n", "<br />", $u['log_text']);
95
-    foreach($u as $key => $value)
95
+    foreach ($u as $key => $value)
96 96
     {
97 97
       $v[strtoupper($key)] = $value;
98 98
     }
Please login to merge, or discard this patch.
language/de/system.mo.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -978,7 +978,7 @@
 block discarded – undo
978 978
     REGISTER_ERROR_USERNAME_WRONG => 'Ungültiger Spielername',
979 979
     REGISTER_ERROR_ACCOUNT_NAME_EXISTS => 'Der Kontoname ist bereits vergeben. Versuchen Sie, sich mit diesem Namen und Ihrem Passwort anzumelden oder das Passwort zurückzusetzen',
980 980
     REGISTER_ERROR_PASSWORD_INSECURE => 'Ungültiges Passwort. Das Passwort muss mindestens ' . PASSWORD_LENGTH_MIN . ' Zeichen lang sein',
981
-    REGISTER_ERROR_USERNAME_SHORT => 'Name zu kurz. Der Name muss mindestens ' . LOGIN_LENGTH_MIN. ' Zeichen lang sein',
981
+    REGISTER_ERROR_USERNAME_SHORT => 'Name zu kurz. Der Name muss mindestens ' . LOGIN_LENGTH_MIN . ' Zeichen lang sein',
982 982
     REGISTER_ERROR_PASSWORD_DIFFERENT => 'Passwort und Bestätigungspasswort stimmen nicht überein. Überprüfen Sie die Eingabe',
983 983
     REGISTER_ERROR_EMAIL_EMPTY => 'E-Mail darf nicht leer sein',
984 984
     REGISTER_ERROR_EMAIL_WRONG => 'Die eingegebene E-Mail ist keine gültige E-Mail-Adresse. Überprüfen Sie die Schreibweise oder verwenden Sie eine andere E-Mail-Adresse',
Please login to merge, or discard this patch.
language/es/system.mo.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -977,7 +977,7 @@
 block discarded – undo
977 977
     REGISTER_ERROR_USERNAME_WRONG => 'Nombre de usuario incorrecto',
978 978
     REGISTER_ERROR_ACCOUNT_NAME_EXISTS => 'El nombre de cuenta ya está en uso. Intenta iniciar sesión con este nombre y tu contraseña o restablecer tu contraseña',
979 979
     REGISTER_ERROR_PASSWORD_INSECURE => 'Contraseña incorrecta. La contraseña debe tener al menos ' . PASSWORD_LENGTH_MIN . ' caracteres',
980
-    REGISTER_ERROR_USERNAME_SHORT => 'Nombre demasiado corto. Debe tener al menos ' . LOGIN_LENGTH_MIN. ' caracteres',
980
+    REGISTER_ERROR_USERNAME_SHORT => 'Nombre demasiado corto. Debe tener al menos ' . LOGIN_LENGTH_MIN . ' caracteres',
981 981
     REGISTER_ERROR_PASSWORD_DIFFERENT => 'La contraseña y la confirmación no coinciden. Verifica los datos',
982 982
     REGISTER_ERROR_EMAIL_EMPTY => 'El correo electrónico no puede estar vacío',
983 983
     REGISTER_ERROR_EMAIL_WRONG => 'El correo electrónico ingresado no es válido. Verifica la dirección o usa otra',
Please login to merge, or discard this patch.
includes/alliance/ali_info.inc 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -4,14 +4,14 @@  discard block
 block discarded – undo
4 4
 use Alliance\DBStaticAlly;
5 5
 use DBAL\db_mysql;
6 6
 
7
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
7
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
8 8
 {
9 9
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
10 10
 }
11 11
 
12 12
 $template = SnTemplate::gettemplate('ali_info', true);
13 13
 
14
-if($mode == 'exit')
14
+if ($mode == 'exit')
15 15
 {
16 16
   if ($ally['ally_owner'] == $user['id'])
17 17
   {
@@ -28,25 +28,25 @@  discard block
 block discarded – undo
28 28
     SnTemplate::messageBox(sprintf($lang['ali_info_leave_success'], $ally['ally_name']), $lang['sys_alliance']);
29 29
   }
30 30
 }
31
-elseif($mode == 'ainfo')
31
+elseif ($mode == 'ainfo')
32 32
 {
33 33
   $tag = sys_get_param_str('tag');
34 34
   $id_ally = sys_get_param_id('a');
35
-  if($tag)
35
+  if ($tag)
36 36
   {
37 37
     $ally = doquery("SELECT * FROM {{alliance}} WHERE ally_tag='{$tag}' LIMIT 1;", '', true);
38 38
   }
39
-  elseif($id_ally)
39
+  elseif ($id_ally)
40 40
   {
41 41
     $ally = doquery("SELECT * FROM {{alliance}} WHERE id='{$id_ally}' LIMIT 1;", '', true);
42 42
   }
43 43
 
44
-  if(!$ally)
44
+  if (!$ally)
45 45
   {
46 46
     SnTemplate::messageBox($lang['ali_sys_notFound'], $lang['Ally_info_1']);
47 47
   }
48 48
 
49
-  if(!$ally['ally_description'])
49
+  if (!$ally['ally_description'])
50 50
   {
51 51
     $ally['ally_description'] = $lang['Ally_nodescription'];
52 52
   }
@@ -55,17 +55,17 @@  discard block
 block discarded – undo
55 55
     'EXTERNAL'     => true,
56 56
     'USER_ALLY_ID' => $user['ally_id'],
57 57
   ));
58
-  $page_header          = $lang['sys_alliance'];
58
+  $page_header = $lang['sys_alliance'];
59 59
 }
60 60
 else
61 61
 {
62 62
   $page_header = $lang['your_alliance'];
63 63
 
64
-  if($ally['ally_owner'] == $user['id'])
64
+  if ($ally['ally_owner'] == $user['id'])
65 65
   {
66 66
     $range = $ally['ally_owner_range'] ? $ally['ally_owner_range'] : $lang['Founder'];
67 67
   }
68
-  elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name']))
68
+  elseif ($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name']))
69 69
   {
70 70
     $range = $ranks[$user['ally_rank_id']]['name'];
71 71
   }
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
 ]);
101 101
 
102 102
 $relations = ali_relations($ally['id']);
103
-foreach($relations as $relation)
103
+foreach ($relations as $relation)
104 104
 {
105
-  if($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id'])
105
+  if ($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id'])
106 106
   {
107 107
     $template->assign_block_vars('relation', array(
108 108
       'NAME'     => $relation['alliance_diplomacy_contr_ally_name'],
Please login to merge, or discard this patch.
includes/alliance/ali_internal_admin.inc 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -4,26 +4,26 @@  discard block
 block discarded – undo
4 4
 use DBAL\db_mysql;
5 5
 use Old\Avatar;
6 6
 
7
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
7
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
8 8
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
9 9
 }
10 10
 
11
-if(!$user_admin) {
11
+if (!$user_admin) {
12 12
   SnTemplate::messageBox($lang['Denied_access'], $lang['ally_admin']);
13 13
 }
14 14
 
15 15
 $template = SnTemplate::gettemplate('ali_admin', $template);
16 16
 
17 17
 $text_list = array(
18
-  1 => array ('db_field' => 'ally_description', 'text_type' => 'Public_text_of_alliance'),
19
-  2 => array ('db_field' => 'ally_text', 'text_type' => 'Internal_text'),
20
-  3 => array ('db_field' => 'ally_request', 'text_type' => 'Show_of_request_text'),
18
+  1 => array('db_field' => 'ally_description', 'text_type' => 'Public_text_of_alliance'),
19
+  2 => array('db_field' => 'ally_text', 'text_type' => 'Internal_text'),
20
+  3 => array('db_field' => 'ally_request', 'text_type' => 'Show_of_request_text'),
21 21
 );
22 22
 
23 23
 $allyTextID = sys_get_param_int('t', 1);
24
-$allyTextID = ($allyTextID<1 || $allyTextID>3) ? 1 : $allyTextID;
24
+$allyTextID = ($allyTextID < 1 || $allyTextID > 3) ? 1 : $allyTextID;
25 25
 
26
-if(sys_get_param_str('isSaveOptions')) {
26
+if (sys_get_param_str('isSaveOptions')) {
27 27
   $new_image = $ally['ally_image'];
28 28
   $avatar_upload_result = Avatar::sys_avatar_upload($ally['id'], $new_image, 'ally');
29 29
   $template->assign_vars([
@@ -32,32 +32,32 @@  discard block
 block discarded – undo
32 32
   ]);
33 33
 
34 34
   $ally_changeset = array();
35
-  if(($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) && $new_tag != $ally['ally_tag']) {
35
+  if (($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) && $new_tag != $ally['ally_tag']) {
36 36
     $new_tag_unsafe = $new_tag;
37 37
     $new_tag = SN::$db->db_escape($new_tag);
38 38
     $isTaggedAllyExists = DBStaticAlly::db_ally_get_by_tag($new_tag);
39
-    if(!empty($isTaggedAllyExists)) {
39
+    if (!empty($isTaggedAllyExists)) {
40 40
       SnTemplate::messageBox(sprintf($lang['ally_message_tag_exists'], $new_tag_unsafe), '', 'alliance.php?mode=admin&edit=ally');
41 41
     }
42 42
     $ally_changeset[] = "`ally_tag`='{$new_tag}'";
43 43
     db_user_set_by_id($ally['ally_user_id'], "`username`='[{$new_tag}]'");
44 44
   }
45 45
 
46
-  if(($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) && $new_name != $ally['ally_name']) {
46
+  if (($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) && $new_name != $ally['ally_name']) {
47 47
     $new_name_unsafe = $new_name;
48 48
     $new_name = SN::$db->db_escape($new_name);
49 49
     $isTaggedAllyExists = DBStaticAlly::db_ally_get_by_name($new_name);
50
-    if(!empty($isTaggedAllyExists)) {
50
+    if (!empty($isTaggedAllyExists)) {
51 51
       SnTemplate::messageBox(sprintf($lang['ally_message_name_exists'], $new_name_unsafe), '', 'alliance.php?mode=admin&edit=ally');
52 52
     }
53 53
     $ally_changeset[] = "`ally_name`='{$new_name}'";
54 54
   }
55 55
 
56
-  if(($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) && $new_owner_rank != $ally['ally_owner_range']) {
56
+  if (($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) && $new_owner_rank != $ally['ally_owner_range']) {
57 57
     $new_owner_rank = SN::$db->db_escape($new_owner_rank);
58 58
     $ally_changeset[] = "`ally_owner_range` = '{$new_owner_rank}'";
59 59
   }
60
-  if(($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) && $new_web != $ally['ally_web']) {
60
+  if (($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) && $new_web != $ally['ally_web']) {
61 61
     $new_web = SN::$db->db_escape($new_web);
62 62
     $ally_changeset[] = "`ally_web` = '{$new_web}'";
63 63
   }
@@ -66,31 +66,31 @@  discard block
 block discarded – undo
66 66
 //  if(($new_request = sys_get_param_int('request_notallow', $ally['ally_request_notallow'])) && $new_request != $ally['ally_request_notallow']) {
67 67
 //    $ally_changeset[] = "`ally_request_notallow` = '{$new_request}'";
68 68
 //  }
69
-  if($new_image != $ally['ally_image']) {
69
+  if ($new_image != $ally['ally_image']) {
70 70
     $new_image = intval($new_image);
71 71
     $ally_changeset[] = "`ally_image` = '{$new_image}'";
72 72
   }
73 73
 
74
-  if(!empty($ally_changeset)) {
74
+  if (!empty($ally_changeset)) {
75 75
     doquery("UPDATE {{alliance}} SET " . implode(',', $ally_changeset) . " WHERE `id`='{$ally['id']}' LIMIT 1;");
76 76
     sys_redirect('alliance.php?mode=admin&edit=ally');
77 77
   }
78 78
 }
79
-elseif(sys_get_param_str('isSaveText'))
79
+elseif (sys_get_param_str('isSaveText'))
80 80
 {
81 81
   $text = sys_get_param_str_both('text');
82 82
   doquery("UPDATE {{alliance}} SET `{$text_list[$allyTextID]['db_field']}`='{$text['safe']}' WHERE `id`='{$ally['id']}';");
83 83
   $ally[$text_list[$allyTextID]['db_field']] = $text['unsafe'];
84 84
 }
85
-elseif(sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader'))
85
+elseif (sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader'))
86 86
 {
87
-  if(!$isAllyOwner)
87
+  if (!$isAllyOwner)
88 88
   {
89 89
     SnTemplate::messageBox($lang['Denied_access'], $lang['ally_admin']);
90 90
   }
91 91
 
92 92
   $newLeader = db_user_by_id($idNewLeader, false);
93
-  if($newLeader['ally_id'] == $user['ally_id'])
93
+  if ($newLeader['ally_id'] == $user['ally_id'])
94 94
   {
95 95
     db_mysql::db_transaction_start();
96 96
     db_user_set_by_id($user['id'], "`ally_rank_id`='0'");
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
     sys_redirect('alliance.php');
101 101
   }
102 102
 }
103
-elseif(sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband'))
103
+elseif (sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband'))
104 104
 {
105
-  if(!$isAllyOwner)
105
+  if (!$isAllyOwner)
106 106
   {
107 107
     SnTemplate::messageBox($lang['Denied_access'], $lang['ally_admin']);
108 108
   }
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
   'ally_name' => htmlspecialchars($ally['ally_name']),
126 126
   'ally_tag' => htmlspecialchars($ally['ally_tag']),
127 127
   'ally_web' => htmlspecialchars($ally['ally_web']),
128
-  'ally_request_notallow_0' => (( $ally['ally_request_notallow']) ? ' SELECTED' : ''),
128
+  'ally_request_notallow_0' => (($ally['ally_request_notallow']) ? ' SELECTED' : ''),
129 129
   'ally_request_notallow_1' => ((!$ally['ally_request_notallow']) ? ' SELECTED' : ''),
130 130
   'ally_owner_range' => htmlspecialchars($ally['ally_owner_range']),
131 131
   'hideNotOwner' => $ally['ally_owner'] != $user['id'] ? 'display: hide;' : '',
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 {
135 135
   $userAllyAdmins = db_user_list("`ally_id`= {$ally['id']}", false, '`id`, `username`');
136 136
   unset($tmp);
137
-  foreach($userAllyAdmins as $userAllyAdmin)
137
+  foreach ($userAllyAdmins as $userAllyAdmin)
138 138
   {
139 139
     $tmp .= "<option value={$userAllyAdmin['id']}>{$userAllyAdmin['username']}</option>";
140 140
   }
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
   $template->assign_var('adminMembers', $tmp);
143 143
 }
144 144
 
145
-foreach($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale)
145
+foreach ($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale)
146 146
 {
147
-  if(!$sn_ali_admin_action_locale['title'])
147
+  if (!$sn_ali_admin_action_locale['title'])
148 148
   {
149 149
     continue;
150 150
   }
Please login to merge, or discard this patch.
includes/alliance/ali_internal_admin_diplomacy.inc 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 use DBAL\db_mysql;
5 5
 use \DBAL\DbQuery;
6 6
 
7
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
7
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
8 8
 {
9 9
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
10 10
 }
@@ -19,28 +19,28 @@  discard block
 block discarded – undo
19 19
 $ally_name_safe = SN::$db->db_escape($user['ally_name']);
20 20
 
21 21
 $autoAccept = false;
22
-if(sys_get_param_str('ali_dip_offer_make'))
22
+if (sys_get_param_str('ali_dip_offer_make'))
23 23
 {
24 24
   $alliance_negotiation_relation = sys_get_param_str('alliance_negotiation_relation');
25
-  if(!array_key_exists($alliance_negotiation_relation, $sn_diplomacy_relation_list))
25
+  if (!array_key_exists($alliance_negotiation_relation, $sn_diplomacy_relation_list))
26 26
   {
27 27
     SnTemplate::messageBox($lang['ali_dip_err_wrong_offer'], $page_title);
28 28
   }
29 29
 
30 30
   $alliance_negotiation_contr_ally_id = sys_get_param_id('alliance_negotiation_contr_ally_id');
31
-  if($alliance_negotiation_contr_ally_id == $user['ally_id'])
31
+  if ($alliance_negotiation_contr_ally_id == $user['ally_id'])
32 32
   {
33 33
     SnTemplate::messageBox($lang['ali_dip_err_same_ally'], $page_title);
34 34
   }
35 35
 
36 36
   $contr_ally_row = doquery("SELECT `ally_name` FROM {{alliance}} WHERE `id` = {$alliance_negotiation_contr_ally_id} LIMIT 1;", '', true);
37
-  if(!$contr_ally_row)
37
+  if (!$contr_ally_row)
38 38
   {
39 39
     SnTemplate::messageBox($lang['ali_dip_err_no_ally'], $page_title);
40 40
   }
41 41
 
42 42
   $relation_current_id = ali_relation($user['ally_id'], $alliance_negotiation_contr_ally_id);
43
-  if($alliance_negotiation_relation == $relation_current_id)
43
+  if ($alliance_negotiation_relation == $relation_current_id)
44 44
   {
45 45
     SnTemplate::messageBox(sprintf($lang['ali_dip_err_offer_same'], $lang['ali_dip_relations'][$alliance_negotiation_relation]), $page_title);
46 46
   }
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
   $relation_new = $sn_diplomacy_relation_list[$alliance_negotiation_relation];
54 54
   $relation_current = $sn_diplomacy_relation_list[$relation_current_id];
55
-  if($relation_new['enter_delay'] == -1 || $relation_current['exit_delay'] == -1)
55
+  if ($relation_new['enter_delay'] == -1 || $relation_current['exit_delay'] == -1)
56 56
   {
57 57
     DbQuery::build()
58 58
       ->setTable('alliance_negotiation')
@@ -86,39 +86,39 @@  discard block
 block discarded – undo
86 86
 else
87 87
 {
88 88
   $offer_id = sys_get_param_id('offer_id');
89
-  if($offer_id)
89
+  if ($offer_id)
90 90
   {
91 91
     $offer_answer = sys_get_param_str('answer');
92 92
 
93 93
     $negotiation = doquery("SELECT * FROM {{alliance_negotiation}} WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;", '', true);
94
-    if(!$negotiation)
94
+    if (!$negotiation)
95 95
     {
96 96
       SnTemplate::messageBox($lang['ali_dip_err_offer_none'], $page_title);
97 97
     }
98
-    elseif($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id'])
98
+    elseif ($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id'])
99 99
     {
100 100
       // TODO: Add log of hack attempt
101 101
       SnTemplate::messageBox($lang['ali_dip_err_offer_alien'], $page_title);
102 102
     }
103
-    elseif($negotiation['alliance_negotiation_ally_id'] == $user['ally_id'])
103
+    elseif ($negotiation['alliance_negotiation_ally_id'] == $user['ally_id'])
104 104
     {
105
-      if($offer_answer == 'accept')
105
+      if ($offer_answer == 'accept')
106 106
       {
107 107
         // TODO: Add log of hack attempt
108 108
         SnTemplate::messageBox($lang['ali_dip_err_offer_accept_own'], $page_title);
109 109
       }
110
-      elseif($offer_answer == 'deny')
110
+      elseif ($offer_answer == 'deny')
111 111
       {
112 112
         doquery("DELETE FROM {{alliance_negotiation}} WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;");
113 113
       }
114 114
     }
115 115
     else
116 116
     {
117
-      if($offer_answer == 'accept')
117
+      if ($offer_answer == 'accept')
118 118
       {
119 119
         $accept_offer = true;
120 120
       }
121
-      elseif($offer_answer == 'deny')
121
+      elseif ($offer_answer == 'deny')
122 122
       {
123 123
         DBStaticAlly::db_ally_negotiation_update_status_1($offer_id);
124 124
       }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
   }
127 127
 }
128 128
 
129
-if($accept_offer)
129
+if ($accept_offer)
130 130
 {
131 131
   db_mysql::db_transaction_start();
132 132
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
   db_mysql::db_transaction_commit();
187 187
 }
188 188
 
189
-foreach($sn_diplomacy_relation_list as $diplomacy_relation_id => $diplomacy_relation)
189
+foreach ($sn_diplomacy_relation_list as $diplomacy_relation_id => $diplomacy_relation)
190 190
 {
191 191
   $template->assign_block_vars('relation', array(
192 192
     'ID'   => $diplomacy_relation_id,
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 }
196 196
 
197 197
 $query = doquery("SELECT id, ally_name, ally_tag FROM {{alliance}} WHERE `id` != {$user['ally_id']} ORDER BY ally_name;");
198
-while($alliance = db_fetch($query))
198
+while ($alliance = db_fetch($query))
199 199
 {
200 200
   $template->assign_block_vars('alliance', array(
201 201
     'ID'   => $alliance['id'],
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
   WHERE
215 215
     alliance_negotiation_ally_id = {$user['ally_id']} OR alliance_negotiation_contr_ally_id = {$user['ally_id']};"
216 216
 );
217
-while($offer = db_fetch($query))
217
+while ($offer = db_fetch($query))
218 218
 {
219 219
   $template->assign_block_vars('offer', array(
220 220
     'ID'       => $offer['alliance_negotiation_id'],
Please login to merge, or discard this patch.
includes/includes/market_trader.inc 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 use DBAL\db_mysql;
4 4
 
5
-if((!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) && (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)) {
5
+if ((!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) && (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)) {
6 6
   $debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403);
7 7
 }
8 8
 
@@ -29,12 +29,12 @@  discard block
 block discarded – undo
29 29
 
30 30
   // $dm_db_name = pname_resource_name(RES_DARK_MATTER);
31 31
   $exchangeTo = in_array($exchangeTo = sys_get_param_int('exchangeTo'), sn_get_groups('resources_trader')) ? $exchangeTo : 0;
32
-  if($exchangeTo && is_array($tradeList = $_POST['spend'])) {
32
+  if ($exchangeTo && is_array($tradeList = $_POST['spend'])) {
33 33
     $value = 0;
34 34
     $qry = array();
35 35
 
36 36
     db_mysql::db_transaction_start();
37
-    if($planetrow['id_owner']) {
37
+    if ($planetrow['id_owner']) {
38 38
       $global_data = sys_o_get_updated($planetrow['id_owner'], $planetrow['id'], SN_TIME_NOW);
39 39
       $planetrow = $global_data['planet'];
40 40
     }
@@ -43,27 +43,27 @@  discard block
 block discarded – undo
43 43
       $user = db_user_by_id($user['id'], true);
44 44
     }
45 45
 
46
-    foreach(sn_get_groups('resources_trader') as $resource_id) {
46
+    foreach (sn_get_groups('resources_trader') as $resource_id) {
47 47
       $amount = floatval($tradeList[$resource_id]);
48
-      if($amount < 0) {
48
+      if ($amount < 0) {
49 49
         $debug->error('Trying to supply negative resource amount on Black Market Page', 'Hack Attempt', 305);
50 50
       }
51 51
 
52
-      if($resource_id == RES_DARK_MATTER && $exchangeTo == RES_DARK_MATTER) {
52
+      if ($resource_id == RES_DARK_MATTER && $exchangeTo == RES_DARK_MATTER) {
53 53
         continue;
54 54
       }
55 55
 
56 56
       $resource_db_name = pname_resource_name($resource_id);
57
-      if($exchangeTo == RES_DARK_MATTER) {
57
+      if ($exchangeTo == RES_DARK_MATTER) {
58 58
         $sign = '+';
59 59
         $amount = floor($tradeList[RES_DARK_MATTER] / 3 * $rates[RES_DARK_MATTER] / $rates[$resource_id]);
60 60
         $value += $amount;
61 61
       } else {
62 62
         $value += floor($amount * $rates[$resource_id] / $rates[$exchangeTo]);
63
-        if($resource_id == RES_DARK_MATTER) {
63
+        if ($resource_id == RES_DARK_MATTER) {
64 64
           $amount = 0;
65 65
         } else {
66
-          if(mrc_get_level($user, $planetrow, $resource_id, true) < $amount) {
66
+          if (mrc_get_level($user, $planetrow, $resource_id, true) < $amount) {
67 67
             $intError = MARKET_NO_RESOURCES;
68 68
             break;
69 69
           }
@@ -72,12 +72,12 @@  discard block
 block discarded – undo
72 72
         }
73 73
       }
74 74
 
75
-      if($amount) {
75
+      if ($amount) {
76 76
         $qry[] = "`{$resource_db_name}` = `{$resource_db_name}` {$sign} {$amount}";
77 77
       }
78 78
     }
79 79
 
80
-    if($exchangeTo != RES_DARK_MATTER) {
80
+    if ($exchangeTo != RES_DARK_MATTER) {
81 81
       $amount = floor($value);
82 82
       $exchange_to_db_name = pname_resource_name($exchangeTo);
83 83
       $qry[] = "`{$exchange_to_db_name}` = `{$exchange_to_db_name}` + {$amount}";
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     $intError = $value <= 0 ? MARKET_ZERO_DEAL : $intError;
89 89
     $intError = mrc_get_level($user, null, RES_DARK_MATTER) < $operation_cost ? MARKET_NO_DM : $intError;
90 90
 
91
-    if($intError == MARKET_DEAL) {
91
+    if ($intError == MARKET_DEAL) {
92 92
       $qry = implode(', ', $qry);
93 93
       $table = $planetrow['id_owner'] ? 'planets' : 'users';
94 94
 
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
     'EXCHANGE_TO_RESOURCE_ID' => $exchangeTo,
112 112
   ));
113 113
 
114
-  foreach(sn_get_groups('resources_trader') as $resource_id) {
115
-    if($resource_id == RES_DARK_MATTER) {
114
+  foreach (sn_get_groups('resources_trader') as $resource_id) {
115
+    if ($resource_id == RES_DARK_MATTER) {
116 116
       $amount = floor(mrc_get_level($user, null, RES_DARK_MATTER) - $config->rpg_cost_trader);
117 117
     } else {
118 118
       $amount = floor(mrc_get_level($user, $planetrow, $resource_id));
Please login to merge, or discard this patch.