Passed
Branch trunk (7dc288)
by SuperNova.WS
06:07
created
buddy.php 1 patch
Braces   +12 added lines, -11 removed lines patch added patch discarded remove patch
@@ -56,8 +56,7 @@  discard block
 block discarded – undo
56 56
             sprintf($lang['buddy_msg_accept_text'], $user['username']));
57 57
           sn_db_transaction_commit();
58 58
           throw new exception('buddy_err_accept_none', ERR_NONE);
59
-        }
60
-        else
59
+        } else
61 60
         {
62 61
           throw new exception('buddy_err_accept_internal', ERR_ERROR);
63 62
         }
@@ -69,9 +68,11 @@  discard block
 block discarded – undo
69 68
           throw new exception('buddy_err_delete_alien', ERR_ERROR);
70 69
         }
71 70
 
72
-        if($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) // Existing friendship
71
+        if($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) {
72
+          // Existing friendship
73 73
         {
74 74
           $ex_friend_id = $buddy_row['BUDDY_SENDER_ID'] == $user['id'] ? $buddy_row['BUDDY_OWNER_ID'] : $buddy_row['BUDDY_SENDER_ID'];
75
+        }
75 76
 
76 77
           msg_send_simple_message($ex_friend_id, $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, $user['username'], $lang['buddy_msg_unfriend_title'],
77 78
             sprintf($lang['buddy_msg_unfriend_text'], $user['username']));
@@ -79,17 +80,19 @@  discard block
 block discarded – undo
79 80
           doquery("DELETE FROM {{buddy}} WHERE `BUDDY_ID` = {$buddy_id} LIMIT 1;");
80 81
           sn_db_transaction_commit();
81 82
           throw new exception('buddy_err_unfriend_none', ERR_NONE);
82
-        }
83
-        elseif($buddy_row['BUDDY_SENDER_ID'] == $user['id']) // Player's outcoming request - either denied or waiting
83
+        } elseif($buddy_row['BUDDY_SENDER_ID'] == $user['id']) {
84
+          // Player's outcoming request - either denied or waiting
84 85
         {
85 86
           doquery("DELETE FROM {{buddy}} WHERE `BUDDY_ID` = {$buddy_id} LIMIT 1;");
87
+        }
86 88
           sn_db_transaction_commit();
87 89
           throw new exception('buddy_err_delete_own', ERR_NONE);
88
-        }
89
-        elseif($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_WAITING) // Deny incoming request
90
+        } elseif($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_WAITING) {
91
+          // Deny incoming request
90 92
         {
91 93
           msg_send_simple_message($buddy_row['BUDDY_SENDER_ID'], $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, $user['username'], $lang['buddy_msg_deny_title'],
92 94
             sprintf($lang['buddy_msg_deny_text'], $user['username']));
95
+        }
93 96
 
94 97
           doquery("UPDATE {{buddy}} SET `BUDDY_STATUS` = " . BUDDY_REQUEST_DENIED . " WHERE `BUDDY_ID` = {$buddy_id} LIMIT 1;");
95 98
           sn_db_transaction_commit();
@@ -104,8 +107,7 @@  discard block
 block discarded – undo
104 107
   if($new_friend_id = sys_get_param_id('request_user_id'))
105 108
   {
106 109
     $new_friend_row = db_user_by_id($new_friend_id, true, '`id`, `username`');
107
-  }
108
-  elseif($new_friend_name = sys_get_param_str_unsafe('request_user_name'))
110
+  } elseif($new_friend_name = sys_get_param_str_unsafe('request_user_name'))
109 111
   {
110 112
     $new_friend_row = db_user_by_username($new_friend_name);
111 113
     $new_friend_name = db_escape($new_friend_name);
@@ -138,8 +140,7 @@  discard block
 block discarded – undo
138 140
     sn_db_transaction_commit();
139 141
     throw new exception('buddy_err_adding_none', ERR_NONE);
140 142
   }
141
-}
142
-catch(exception $e)
143
+} catch(exception $e)
143 144
 {
144 145
   $result[] = array(
145 146
     'STATUS'  => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR,
Please login to merge, or discard this patch.
includes/db/db_queries.php 1 patch
Braces   +11 added lines, -22 removed lines patch added patch discarded remove patch
@@ -6,8 +6,7 @@  discard block
 block discarded – undo
6 6
 require_once('db_queries_fleet.php');
7 7
 
8 8
 
9
-function db_planet_list_admin_list($table_parent_columns, $planet_active, $active_time, $planet_type)
10
-{
9
+function db_planet_list_admin_list($table_parent_columns, $planet_active, $active_time, $planet_type) {
11 10
   return doquery(
12 11
     "SELECT p.*, u.username" . ($table_parent_columns ? ', p1.name AS parent_name' : '') .
13 12
     " FROM {{planets}} AS p
@@ -16,8 +15,7 @@  discard block
 block discarded – undo
16 15
     " WHERE " . ($planet_active ? "p.last_update >= {$active_time}" : "p.planet_type = {$planet_type}"));
17 16
 }
18 17
 
19
-function db_planet_list_search($searchtext)
20
-{
18
+function db_planet_list_search($searchtext) {
21 19
   return doquery(
22 20
     "SELECT
23 21
       p.galaxy, p.system, p.planet, p.planet_type, p.name as planet_name,
@@ -37,8 +35,7 @@  discard block
 block discarded – undo
37 35
 
38 36
 
39 37
 
40
-function db_user_list_search($searchtext)
41
-{
38
+function db_user_list_search($searchtext) {
42 39
   return doquery(
43 40
     "SELECT
44 41
       pn.player_name, u.id as uid, u.username, u.ally_id, u.id_planet, u.total_points, u.total_rank,
@@ -56,8 +53,7 @@  discard block
 block discarded – undo
56 53
   );
57 54
 }
58 55
 
59
-function db_buddy_list_by_user($user_id)
60
-{
56
+function db_buddy_list_by_user($user_id) {
61 57
 //  return ($user_id = intval($user_id)) ? doquery(
62 58
   return ($user_id = idval($user_id)) ? doquery(
63 59
     "SELECT
@@ -87,8 +83,7 @@  discard block
 block discarded – undo
87 83
 
88 84
 
89 85
 
90
-function db_unit_records_sum($unit_id, $user_skip_list_unit)
91
-{
86
+function db_unit_records_sum($unit_id, $user_skip_list_unit) {
92 87
   return doquery (
93 88
     "SELECT unit_player_id, username, sum(unit_level) as unit_level
94 89
           FROM {{unit}} JOIN {{users}} AS u ON u.id = unit_player_id
@@ -99,8 +94,7 @@  discard block
 block discarded – undo
99 94
     , true);
100 95
 }
101 96
 
102
-function db_unit_records_plain($unit_id, $user_skip_list_unit)
103
-{
97
+function db_unit_records_plain($unit_id, $user_skip_list_unit) {
104 98
   return doquery (
105 99
     "SELECT unit_player_id, username, unit_level
106 100
           FROM {{unit}} JOIN {{users}} AS u ON u.id = unit_player_id
@@ -184,15 +178,13 @@  discard block
 block discarded – undo
184 178
 }
185 179
 
186 180
 
187
-function db_stat_list_delete_ally_player()
188
-{
181
+function db_stat_list_delete_ally_player() {
189 182
   return doquery('DELETE s FROM `{{statpoints}}` AS s JOIN `{{users}}` AS u ON u.id = s.id_owner WHERE s.id_ally IS NULL AND u.user_as_ally IS NOT NULL');
190 183
 }
191 184
 
192 185
 
193 186
 
194
-function db_chat_player_list_online($chat_refresh_rate, $ally_add)
195
-{
187
+function db_chat_player_list_online($chat_refresh_rate, $ally_add) {
196 188
   $sql_date = SN_TIME_NOW - $chat_refresh_rate * 2;
197 189
 
198 190
   return doquery(
@@ -206,13 +198,11 @@  discard block
 block discarded – undo
206 198
     ORDER BY authlevel DESC, `username`");
207 199
 }
208 200
 
209
-function db_referrals_list_by_id($user_id)
210
-{
201
+function db_referrals_list_by_id($user_id) {
211 202
   return doquery("SELECT r.*, u.username, u.register_time FROM {{referrals}} AS r LEFT JOIN {{users}} AS u ON u.id = r.id WHERE id_partner = {$user_id}");
212 203
 }
213 204
 
214
-function db_message_list_admin_by_type($int_type_selected, $StartRec)
215
-{
205
+function db_message_list_admin_by_type($int_type_selected, $StartRec) {
216 206
   return doquery("SELECT
217 207
   message_id as `ID`,
218 208
   message_from as `FROM`,
@@ -231,8 +221,7 @@  discard block
 block discarded – undo
231 221
 }
232 222
 
233 223
 
234
-function db_message_insert_all($message_type, $from, $subject, $text)
235
-{
224
+function db_message_insert_all($message_type, $from, $subject, $text) {
236 225
   return doquery($QryInsertMessage = 'INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) ' .
237 226
     "SELECT `id`, 0, unix_timestamp(now()), {$message_type}, '{$from}', '{$subject}', '{$text}' FROM {{users}}");
238 227
 }
Please login to merge, or discard this patch.
includes/functions/int_fleet_events.php 1 patch
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,8 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 
4
-function flt_parse_fleets_to_events($fleet_list, $planet_scanned = false)
5
-{
4
+function flt_parse_fleets_to_events($fleet_list, $planet_scanned = false) {
6 5
   global $config, $user, $fleet_number, $lang;
7 6
 
8 7
   $fleet_events = array();
@@ -23,12 +22,10 @@  discard block
 block discarded – undo
23 22
     if($fleet['fleet_end_planet'] > $config->game_maxPlanet)
24 23
     {
25 24
       $fleet['fleet_end_name'] = $lang['ov_fleet_exploration'];
26
-    }
27
-    elseif($fleet['fleet_mission'] == MT_COLONIZE)
25
+    } elseif($fleet['fleet_mission'] == MT_COLONIZE)
28 26
     {
29 27
       $fleet['fleet_end_name'] = $lang['ov_fleet_colonization'];
30
-    }
31
-    else
28
+    } else
32 29
     {
33 30
       $planet_end = DBStaticPlanet::db_planet_by_gspt($fleet['fleet_end_galaxy'], $fleet['fleet_end_system'], $fleet['fleet_end_planet'], $planet_end_type, false, 'name');
34 31
       $fleet['fleet_end_name'] = $planet_end['name'];
@@ -80,8 +77,7 @@  discard block
 block discarded – undo
80 77
   return $fleet_events;
81 78
 }
82 79
 
83
-function flt_register_fleet_event($fleet, $ov_label, $planet_end_type)
84
-{
80
+function flt_register_fleet_event($fleet, $ov_label, $planet_end_type) {
85 81
   global $user, $planetrow, $fleet_number;
86 82
 
87 83
   switch($fleet['ov_label'] = $ov_label)
@@ -121,8 +117,7 @@  discard block
 block discarded – undo
121 117
   if($fleet['fleet_owner'] == $user['id'])
122 118
   {
123 119
     $user_data = $user;
124
-  }
125
-  else
120
+  } else
126 121
   {
127 122
     $user_data = db_user_by_id($fleet['fleet_owner']);
128 123
   }
@@ -134,8 +129,7 @@  discard block
 block discarded – undo
134 129
  * @param array    $planetrow
135 130
  * @param template $template
136 131
  */
137
-function int_planet_pretemplate($planetrow, &$template)
138
-{
132
+function int_planet_pretemplate($planetrow, &$template) {
139 133
   global $lang, $user;
140 134
 
141 135
   $governor_id = $planetrow['PLANET_GOVERNOR_ID'];
Please login to merge, or discard this patch.