Completed
Push — work-fleets ( 4d76fa...c97fe0 )
by SuperNova.WS
05:17
created
includes/alliance/ali_internal_members.inc 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -2,31 +2,31 @@  discard block
 block discarded – undo
2 2
 
3 3
 $classLocale = classLocale::$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
   classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
7 7
 }
8 8
 
9 9
 // Changing rank for single user
10 10
 $id_user = sys_get_param_id('id_user');
11
-if(isset($_GET['id_rank'])) {
11
+if (isset($_GET['id_rank'])) {
12 12
   $id_rank = sys_get_param_int('id_rank');
13 13
 }
14
-if($id_user && isset($id_rank) && $user_admin) {
14
+if ($id_user && isset($id_rank) && $user_admin) {
15 15
   db_user_set_by_id($id_user, "`ally_rank_id` = {$id_rank}");
16 16
 }
17 17
 
18 18
 $id_kick = sys_get_param_id('kick');
19 19
 
20
-if($id_kick && $user_can_kick) {
20
+if ($id_kick && $user_can_kick) {
21 21
   $u = db_user_by_id($id_kick, true);
22
-  if($u['ally_id'] == $ally['id'] && $u['id'] != $ally['ally_owner']) {
22
+  if ($u['ally_id'] == $ally['id'] && $u['id'] != $ally['ally_owner']) {
23 23
     db_user_set_by_id($id_kick, '`ally_id`= null, `ally_name` = null, `ally_tag` = null, ally_register_time = 0, ally_rank_id = 0');
24 24
     db_ally_update_member_decrease($ally);
25 25
   }
26 26
 }
27 27
 
28 28
 $sort2 = sys_get_param_int('sort2');
29
-if($sort2) {
29
+if ($sort2) {
30 30
   $sort2s = "DESC";
31 31
   $sort2 = 0;
32 32
 } else {
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 }
36 36
 
37 37
 $sort1 = sys_get_param_int('sort1');
38
-if($sort1 > 5 || $sort1 < 0) {
38
+if ($sort1 > 5 || $sort1 < 0) {
39 39
   $sort1 = 0;
40 40
 }
41 41
 $sort1s = array(
@@ -49,28 +49,28 @@  discard block
 block discarded – undo
49 49
 
50 50
 $template = gettemplate('ali_members', true);
51 51
 
52
-$userList = db_user_list("`ally_id`= {$user['ally_id']} ORDER BY " . sprintf($sort1s[$sort1], $sort2s), false,
52
+$userList = db_user_list("`ally_id`= {$user['ally_id']} ORDER BY ".sprintf($sort1s[$sort1], $sort2s), false,
53 53
   'id, username, galaxy, system, planet, onlinetime, ally_rank_id, ally_register_time, total_points');
54 54
 
55 55
 // while ($userRow = db_fetch($userList))
56
-foreach($userList as $userRow) {
56
+foreach ($userList as $userRow) {
57 57
   $i++;
58
-  if(!isset($ranks[$userRow['ally_rank_id']])) {
58
+  if (!isset($ranks[$userRow['ally_rank_id']])) {
59 59
     $userRow['ally_rank_id'] = 0;
60 60
   }
61 61
 
62
-  if($ally['ally_owner'] == $userRow['id']) {
62
+  if ($ally['ally_owner'] == $userRow['id']) {
63 63
     $ally_range = ($ally['ally_owner_range']) ? $ally['ally_owner_range'] : classLocale::$lang['Founder'];
64 64
   } else {
65
-    if($user_admin) {
66
-      $ally_range = '<select onchange="window.location=\'alliance.php?mode=admin&edit=members&id_user=' . $userRow['id'] . '&id_rank=\' + this.value">';
65
+    if ($user_admin) {
66
+      $ally_range = '<select onchange="window.location=\'alliance.php?mode=admin&edit=members&id_user='.$userRow['id'].'&id_rank=\' + this.value">';
67 67
 
68
-      foreach($ranks as $rankID => $rankArray) {
69
-        $ally_range .= '<option value="' . $rankID . '"';
70
-        if($rankID == $userRow['ally_rank_id']) {
68
+      foreach ($ranks as $rankID => $rankArray) {
69
+        $ally_range .= '<option value="'.$rankID.'"';
70
+        if ($rankID == $userRow['ally_rank_id']) {
71 71
           $ally_range .= " selected";
72 72
         }
73
-        $ally_range .= '>' . $rankArray['name'];
73
+        $ally_range .= '>'.$rankArray['name'];
74 74
         $ally_range .= '</option>';
75 75
       }
76 76
       $ally_range .= '</select>';
@@ -80,20 +80,20 @@  discard block
 block discarded – undo
80 80
   }
81 81
 
82 82
   $last_active = time() - $userRow["onlinetime"];
83
-  if($user_admin) {
84
-    if($last_active < 60) {
83
+  if ($user_admin) {
84
+    if ($last_active < 60) {
85 85
       $tmp = "lime>{$classLocale['On']}";
86
-    } elseif($last_active < 60 * 60) {
86
+    } elseif ($last_active < 60 * 60) {
87 87
       $last_active = round($last_active / 60);
88 88
       $tmp = "lime>{$last_active} {$classLocale['sys_min_short']}";
89
-    } elseif($last_active < 60 * 60 * 24) {
89
+    } elseif ($last_active < 60 * 60 * 24) {
90 90
       $last_active = round($last_active / (60 * 60));
91 91
       $tmp = "green>{$last_active} {$classLocale['sys_hrs_short']}";
92 92
     } else {
93 93
       $last_active = round($last_active / (60 * 60 * 24));
94
-      if($last_active < 7) {
94
+      if ($last_active < 7) {
95 95
         $tmp = "yellow";
96
-      } elseif($last_active < 30) {
96
+      } elseif ($last_active < 30) {
97 97
         $tmp = "orange";
98 98
       } else {
99 99
         $tmp = "red";
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
       $tmp .= ">{$last_active} {$classLocale['sys_day_short']}";
102 102
     }
103 103
   } else {
104
-    if($user_onlinestatus) {
105
-      if($last_active < 60 * 5) {
104
+    if ($user_onlinestatus) {
105
+      if ($last_active < 60 * 5) {
106 106
         $tmp = "lime>{$classLocale['On']}";
107
-      } elseif($last_active < 60 * 15) {
107
+      } elseif ($last_active < 60 * 15) {
108 108
         $tmp = "yellow>{$classLocale['ali_lessThen15min']}";
109 109
       } else {
110 110
         $tmp = "red>{$classLocale['Off']}";
@@ -124,21 +124,21 @@  discard block
 block discarded – undo
124 124
     'SYSTEM'        => $userRow['system'],
125 125
     'PLANET'        => $userRow['planet'],
126 126
     'POINTS'        => pretty_number($userRow['total_points']),
127
-    'ONLINE'        => '<font color=' . $tmp . '</font>',
127
+    'ONLINE'        => '<font color='.$tmp.'</font>',
128 128
     'RANK'          => $ally_range,
129 129
     'REGISTER_TIME' => date(FMT_DATE_TIME, $userRow['ally_register_time']),
130 130
     'SHOW_KICK'     => $user['id'] != $userRow['id'] && $ally['ally_owner'] != $userRow['id'],
131 131
   ));
132 132
 }
133 133
 
134
-if($i != $ally['ally_members']) {
134
+if ($i != $ally['ally_members']) {
135 135
   db_ally_update_member_set($i, $ally);
136 136
 }
137 137
 
138 138
 $template->assign_vars(array(
139
-  'mode'          => $mode . ($edit ? "&edit=" . $edit : ''),
139
+  'mode'          => $mode.($edit ? "&edit=".$edit : ''),
140 140
   'ADMIN_MODE'    => $user_can_kick,
141
-  'dpath'         => SN_ROOT_VIRTUAL . $dpath,
141
+  'dpath'         => SN_ROOT_VIRTUAL.$dpath,
142 142
   'onlineMessage' => $user_admin ? classLocale::$lang['ali_sys_lastActive'] : classLocale::$lang['Online'],
143 143
   'memberCount'   => count($userList),
144 144
   'memberslist'   => $page_list,
Please login to merge, or discard this patch.
includes/alliance/ali_external_create_ally.inc 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 // Pretty Safe
3 3
 // TODO: Add ally_tag to usertable
4 4
 
5
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
5
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
6 6
   classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
7 7
 }
8 8
 
@@ -11,21 +11,21 @@  discard block
 block discarded – undo
11 11
 $ally_name_raw = sys_get_param_str_unsafe('name');
12 12
 $ally_name = db_escape($ally_name_raw);
13 13
 
14
-if($ally_tag) {
15
-  if(!$ally_name_raw || !$ally_tag_raw) {
14
+if ($ally_tag) {
15
+  if (!$ally_name_raw || !$ally_tag_raw) {
16 16
     message(classLocale::$lang['have_not_name'], classLocale::$lang['make_alliance']);
17 17
   }
18 18
 
19 19
   $query = db_ally_get_by_name_or_tag($ally_tag, $ally_name);
20
-  if($query) {
20
+  if ($query) {
21 21
     message(str_replace('%s', $query['ally_tag'] == $ally_tag_raw ? $ally_tag_raw : $ally_name_raw, classLocale::$lang['always_exist']), classLocale::$lang['make_alliance']);
22 22
   }
23 23
 
24 24
   db_ally_insert($ally_name, $ally_tag, $user);
25 25
   $ally_id = db_insert_id();
26
-  db_user_set_by_id($user['id'], "`ally_tag` = '{$ally_tag}', `ally_id`= {$ally_id}, `ally_name`='{$ally_name}', `ally_register_time`= " . SN_TIME_NOW . "");
26
+  db_user_set_by_id($user['id'], "`ally_tag` = '{$ally_tag}', `ally_id`= {$ally_id}, `ally_name`='{$ally_name}', `ally_register_time`= ".SN_TIME_NOW."");
27 27
 
28
-  $ally_user = classSupernova::db_ins_record(LOC_USER, "`username` = '[{$ally_tag}]', `register_time` = " . SN_TIME_NOW . ", `user_as_ally` = {$ally_id}");
28
+  $ally_user = classSupernova::db_ins_record(LOC_USER, "`username` = '[{$ally_tag}]', `register_time` = ".SN_TIME_NOW.", `user_as_ally` = {$ally_id}");
29 29
   // $ally_user_id = db_insert_id();
30 30
   $ally_user_id = is_array($ally_user) ? $ally_user['id'] : 'NULL';
31 31
   db_ally_update_ally_user($ally_user_id, $ally_id);
Please login to merge, or discard this patch.
includes/alliance/ali_internal_admin_rights.inc 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
3
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
4 4
 {
5 5
   classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
6 6
 }
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 $new_rank_name = sys_get_param_str('newRankName');
15 15
 if ($new_rank_name)
16 16
 {
17
-  foreach($ally_rights as $fieldName)
17
+  foreach ($ally_rights as $fieldName)
18 18
   {
19 19
     $newRank[$fieldName] = 0;
20 20
   }
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 {
29 29
   unset($ranks);
30 30
 
31
-  foreach($rankListInput as $rankID => $rank)
31
+  foreach ($rankListInput as $rankID => $rank)
32 32
   {
33
-    foreach($ally_rights as $rightName)
33
+    foreach ($ally_rights as $rightName)
34 34
     {
35 35
       $ranks[$rankID][$rightName] = $rank[$rightName] ? 1 : 0;
36 36
     }
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 $d = sys_get_param_int('d');
42 42
 if ($d && isset($ranks[$d]))
43 43
 {
44
-  if(count($ranks) == 1)
44
+  if (count($ranks) == 1)
45 45
   {
46 46
     message(classLocale::$lang['ali_adm_lastRank'], classLocale::$lang['ali_adm_rights_title']);
47 47
   }
@@ -53,17 +53,17 @@  discard block
 block discarded – undo
53 53
 
54 54
 if (count($ranks))
55 55
 {
56
-  foreach($ranks as $rankID => $rank)
56
+  foreach ($ranks as $rankID => $rank)
57 57
   {
58 58
     $rank_data = array(
59 59
       'ID'   => $rankID,
60 60
       'NAME' => $rank['name'],
61 61
     );
62 62
 
63
-    for($i = 1; $i < count($rank); $i++)
63
+    for ($i = 1; $i < count($rank); $i++)
64 64
     {
65
-      $rank_data['R' . $i] = (($rank[$ally_rights[$i]] == 1) ? ' checked' : '') ;
66
-      $rank_data['N' . $i] = $ally_rights[$i];
65
+      $rank_data['R'.$i] = (($rank[$ally_rights[$i]] == 1) ? ' checked' : '');
66
+      $rank_data['N'.$i] = $ally_rights[$i];
67 67
     }
68 68
 
69 69
     $template->assign_block_vars('rank', $rank_data);
Please login to merge, or discard this patch.
includes/alliance/ali_internal_admin_request.inc 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
3
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
4 4
   classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
5 5
 }
6 6
 
@@ -10,16 +10,16 @@  discard block
 block discarded – undo
10 10
 
11 11
 $d = sys_get_param_id('d');
12 12
 
13
-if($d) {
13
+if ($d) {
14 14
   db_ally_request_deny($d);
15 15
 }
16 16
 
17 17
 $id_user = sys_get_param_id('id_user');
18 18
 
19
-if($id_user) {
19
+if ($id_user) {
20 20
   $ally_name_safe = db_escape($ally['ally_name']);
21 21
   $ally_tag_safe = db_escape($ally['ally_tag']);
22
-  db_user_set_by_id($id_user, "`ally_id` = '{$ally['id']}', `ally_name` = '{$ally_name_safe}', `ally_tag` = '{$ally_tag_safe}', `ally_register_time` = " . SN_TIME_NOW . ", `ally_rank_id` = 0");
22
+  db_user_set_by_id($id_user, "`ally_id` = '{$ally['id']}', `ally_name` = '{$ally_name_safe}', `ally_tag` = '{$ally_tag_safe}', `ally_register_time` = ".SN_TIME_NOW.", `ally_rank_id` = 0");
23 23
   db_ally_update_member_increase($ally);
24 24
   db_ally_request_delete_by_user_id($id_user);
25 25
 }
Please login to merge, or discard this patch.
includes/db/db_queries_ally.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
     `ally_name` = '{$ally_name}',
65 65
     `ally_tag` = '{$ally_tag}',
66 66
     `ally_owner` = '{$user['id']}',
67
-    `ally_owner_range` = '" . classLocale::$lang['ali_leaderRank'] . "',
67
+    `ally_owner_range` = '".classLocale::$lang['ali_leaderRank']."',
68 68
     `ally_members` = 1,
69
-    `ranklist` = '" . classLocale::$lang['ali_defaultRankName'] . ",0,0,0,0,0',
69
+    `ranklist` = '" . classLocale::$lang['ali_defaultRankName'].",0,0,0,0,0',
70 70
     `ally_register_time`= " . SN_TIME_NOW
71 71
   );
72 72
 }
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
  * @param $POST_text
86 86
  */
87 87
 function db_ally_request_insert($user, $id_ally, $POST_text) {
88
-  doquery("INSERT INTO {{alliance_requests}} SET `id_user` = {$user['id']}, `id_ally`='{$id_ally}', request_text ='{$POST_text}', request_time=" . SN_TIME_NOW . ";");
88
+  doquery("INSERT INTO {{alliance_requests}} SET `id_user` = {$user['id']}, `id_ally`='{$id_ally}', request_text ='{$POST_text}', request_time=".SN_TIME_NOW.";");
89 89
 }
90 90
 
91 91
 /**
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
  * @param $ally
136 136
  */
137 137
 function db_ally_update_by_changeset($ally_changeset, $ally) {
138
-  doquery("UPDATE {{alliance}} SET " . implode(',', $ally_changeset) . " WHERE `id`='{$ally['id']}' LIMIT 1;");
138
+  doquery("UPDATE {{alliance}} SET ".implode(',', $ally_changeset)." WHERE `id`='{$ally['id']}' LIMIT 1;");
139 139
 }
140 140
 
141 141
 /**
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
  * @param $d
247 247
  */
248 248
 function db_ally_request_deny($d) {
249
-  doquery("UPDATE {{alliance_requests}} SET `request_denied` = 1, `request_text` = '" . classLocale::$lang['ali_req_deny_reason'] . "' WHERE `id_user`= {$d} LIMIT 1;");
249
+  doquery("UPDATE {{alliance_requests}} SET `request_denied` = 1, `request_text` = '".classLocale::$lang['ali_req_deny_reason']."' WHERE `id_user`= {$d} LIMIT 1;");
250 250
 }
251 251
 
252 252
 /**
Please login to merge, or discard this patch.
includes/db/db_queries_unit.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
 
22 22
 function db_unit_count_by_user_and_type_and_snid($user_id, $unit_type = 0, $unit_snid = 0) {
23 23
   $query = doquery(
24
-    "SELECT unit_snid, sum(unit_level) as `qty`  FROM {{unit}} WHERE `unit_player_id` = {$user_id} " .
25
-    ($unit_type ? "AND `unit_type` = {$unit_type} " : '') .
26
-    ($unit_snid ? "AND `unit_snid` = {$unit_snid} " : '') .
24
+    "SELECT unit_snid, sum(unit_level) as `qty`  FROM {{unit}} WHERE `unit_player_id` = {$user_id} ".
25
+    ($unit_type ? "AND `unit_type` = {$unit_type} " : '').
26
+    ($unit_snid ? "AND `unit_snid` = {$unit_snid} " : '').
27 27
     'GROUP BY `unit_snid`'
28 28
   );
29 29
   $result = array();
30
-  while($row = db_fetch($query)) {
30
+  while ($row = db_fetch($query)) {
31 31
     $result[$row['unit_snid']] = $row;
32 32
   }
33 33
 
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
     WHERE
45 45
       f.fleet_owner = {$user_id} AND
46 46
       (f.fleet_start_planet_id = {$location_id} OR f.fleet_end_planet_id = {$location_id})
47
-      AND u.unit_snid = {$unit_snid} AND u.`unit_location_type` = " . LOC_FLEET . " AND " . db_unit_time_restrictions() .
48
-    " LIMIT 1" .
47
+      AND u.unit_snid = {$unit_snid} AND u.`unit_location_type` = ".LOC_FLEET." AND ".db_unit_time_restrictions().
48
+    " LIMIT 1".
49 49
     ($for_update ? ' FOR UPDATE' : '')
50 50
   , true);
51 51
 }
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 {
58 58
   return doquery("SELECT DISTINCT unit_location_id AS `id`
59 59
     FROM {{unit}}
60
-    WHERE unit_player_id = {$user_id} AND unit_location_type = " . LOC_PLANET . " AND unit_level > 0 AND unit_snid IN (" . STRUC_LABORATORY . ", " . STRUC_LABORATORY_NANO . ");");
60
+    WHERE unit_player_id = {$user_id} AND unit_location_type = ".LOC_PLANET." AND unit_level > 0 AND unit_snid IN (".STRUC_LABORATORY.", ".STRUC_LABORATORY_NANO.");");
61 61
 }
62 62
 
63 63
 function db_unit_set_by_id($unit_id, $set)
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 function db_unit_list_delete($user_id = 0, $unit_location_type, $unit_location_id, $unit_snid = 0)
79 79
 {
80 80
   return classSupernova::db_del_record_list(LOC_UNIT,
81
-    "`unit_location_type` = {$unit_location_type} AND `unit_location_id` = {$unit_location_id}" .
82
-    ($user_id = idval($user_id) ? " AND `unit_player_id` = {$user_id}" : '') .
81
+    "`unit_location_type` = {$unit_location_type} AND `unit_location_id` = {$unit_location_id}".
82
+    ($user_id = idval($user_id) ? " AND `unit_player_id` = {$user_id}" : '').
83 83
     ($unit_snid = idval($unit_snid) ? " AND `unit_snid` = {$unit_snid}" : ''));
84 84
 }
85 85
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
   return doquery(
91 91
     "SELECT unit_player_id, unit_type, unit_snid, unit_level, count(*) AS unit_amount
92 92
     FROM `{{unit}}`
93
-    WHERE unit_level > 0 AND " . db_unit_time_restrictions() .
93
+    WHERE unit_level > 0 AND " . db_unit_time_restrictions().
94 94
     " GROUP BY unit_player_id, unit_type, unit_snid, unit_level"
95 95
   );
96 96
 }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 
105 105
 function db_unit_list_admin_delete_mercenaries_finished()
106 106
 {
107
-  return doquery("DELETE FROM {{unit}} WHERE unit_time_finish IS NOT NULL AND unit_time_finish < FROM_UNIXTIME(" . SN_TIME_NOW . ") AND unit_type = " . UNIT_MERCENARIES);
107
+  return doquery("DELETE FROM {{unit}} WHERE unit_time_finish IS NOT NULL AND unit_time_finish < FROM_UNIXTIME(".SN_TIME_NOW.") AND unit_type = ".UNIT_MERCENARIES);
108 108
 }
109 109
 
110 110
 function db_unit_list_admin_set_mercenaries_expire_time($default_length)
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
   return doquery(
113 113
     "UPDATE {{unit}}
114 114
     SET
115
-      unit_time_start = FROM_UNIXTIME(" . SN_TIME_NOW . "),
116
-      unit_time_finish = FROM_UNIXTIME(" . (SN_TIME_NOW + $default_length) . ")
115
+      unit_time_start = FROM_UNIXTIME(" . SN_TIME_NOW."),
116
+      unit_time_finish = FROM_UNIXTIME(" . (SN_TIME_NOW + $default_length).")
117 117
     WHERE unit_type = " . UNIT_MERCENARIES
118 118
   );
119 119
 }
Please login to merge, or discard this patch.
includes/db/db_queries_messages.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
   return doquery(
6 6
     "SELECT * FROM {{messages}}
7 7
         WHERE
8
-          `message_type` = '" . MSG_TYPE_PLAYER . "' AND
8
+          `message_type` = '" . MSG_TYPE_PLAYER."' AND
9 9
           ((`message_owner` = '{$user['id']}' AND `message_sender` = '{$recipient_id}')
10 10
           OR
11 11
           (`message_sender` = '{$user['id']}' AND `message_owner` = '{$recipient_id}')) ORDER BY `message_time` DESC LIMIT 20;");
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 FROM
52 52
   {{messages}} AS m
53 53
   LEFT JOIN {{users}} AS u ON u.id = m.message_owner " .
54
-    ($int_type_selected >= 0 ? "WHERE `message_type` = {$int_type_selected} " : '') .
54
+    ($int_type_selected >= 0 ? "WHERE `message_type` = {$int_type_selected} " : '').
55 55
     "ORDER BY
56 56
   `message_id` DESC
57 57
 LIMIT
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 }
60 60
 
61 61
 function db_message_insert_all($message_type, $from, $subject, $text) {
62
-  return doquery($QryInsertMessage = 'INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) ' .
62
+  return doquery($QryInsertMessage = 'INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) '.
63 63
     "SELECT `id`, 0, unix_timestamp(now()), {$message_type}, '{$from}', '{$subject}', '{$text}' FROM {{users}}");
64 64
 }
65 65
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
  * @return array|bool|mysqli_result|null
70 70
  */
71 71
 function db_message_count_by_type($int_type_selected) {
72
-  $page_max = doquery('SELECT COUNT(*) AS `max` FROM {{messages}}' . ($int_type_selected >= 0 ? " WHERE `message_type` = {$int_type_selected};" : ''), true);
72
+  $page_max = doquery('SELECT COUNT(*) AS `max` FROM {{messages}}'.($int_type_selected >= 0 ? " WHERE `message_type` = {$int_type_selected};" : ''), true);
73 73
 
74 74
   return $page_max;
75 75
 }
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
  * @param $int_type_selected
87 87
  */
88 88
 function db_message_list_delete_by_date($delete_date, $int_type_selected) {
89
-  doquery("DELETE FROM {{messages}} WHERE message_time <= UNIX_TIMESTAMP('{$delete_date}')" . ($int_type_selected >= 0 ? " AND `message_type` = {$int_type_selected}" : ''));
89
+  doquery("DELETE FROM {{messages}} WHERE message_time <= UNIX_TIMESTAMP('{$delete_date}')".($int_type_selected >= 0 ? " AND `message_type` = {$int_type_selected}" : ''));
90 90
 }
91 91
 
92 92
 /**
93 93
  * @param $insert_values
94 94
  */
95 95
 function db_message_insert($insert_values) {
96
-  doquery('INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) ' .
97
-    'VALUES ' . implode(',', $insert_values));
96
+  doquery('INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) '.
97
+    'VALUES '.implode(',', $insert_values));
98 98
 }
Please login to merge, or discard this patch.
includes/db/db_queries_chat.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
       JOIN {{users}} AS u ON u.id = cp.chat_player_player_id
11 11
     WHERE
12 12
       `chat_player_refresh_last` >= '{$sql_date}'
13
-      AND (`banaday` IS NULL OR `banaday` <= " . SN_TIME_NOW . ")
13
+      AND (`banaday` IS NULL OR `banaday` <= ".SN_TIME_NOW.")
14 14
       {$ally_add}
15 15
     ORDER BY authlevel DESC, `username`");
16 16
 }
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
           `user` = '{$nick}',
34 34
           `ally_id` = '{$ally_id}',
35 35
           `message` = '{$message}',
36
-          `timestamp` = " . SN_TIME_NOW . ",
36
+          `timestamp` = ".SN_TIME_NOW.",
37 37
           `chat_message_sender_name` = '{$chat_message_sender_name}',
38 38
           `chat_message_recipient_id` = {$chat_message_recipient_id},
39 39
           `chat_message_recipient_name` = '{$chat_message_recipient_name}'"
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
  * @param $user
140 140
  */
141 141
 function db_chat_player_update($user) {
142
-  doquery("UPDATE {{chat_player}} SET `chat_player_refresh_last` = " . SN_TIME_NOW . " WHERE `chat_player_player_id` = {$user['id']} LIMIT 1;");
142
+  doquery("UPDATE {{chat_player}} SET `chat_player_refresh_last` = ".SN_TIME_NOW." WHERE `chat_player_player_id` = {$user['id']} LIMIT 1;");
143 143
 }
144 144
 
145 145
 
@@ -211,5 +211,5 @@  discard block
 block discarded – undo
211 211
  * @param $user
212 212
  */
213 213
 function db_chat_player_update_activity($user) {
214
-  doquery("UPDATE {{chat_player}} SET `chat_player_activity` = '" . classSupernova::$db->db_escape(SN_TIME_SQL) . "' WHERE `chat_player_player_id` = {$user['id']} LIMIT 1");
214
+  doquery("UPDATE {{chat_player}} SET `chat_player_activity` = '".classSupernova::$db->db_escape(SN_TIME_SQL)."' WHERE `chat_player_player_id` = {$user['id']} LIMIT 1");
215 215
 }
Please login to merge, or discard this patch.
includes/db/db_queries.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@  discard block
 block discarded – undo
17 17
 
18 18
 function db_planet_list_admin_list($table_parent_columns, $planet_active, $active_time, $planet_type) {
19 19
   return doquery(
20
-    "SELECT p.*, u.username" . ($table_parent_columns ? ', p1.name AS parent_name' : '') .
20
+    "SELECT p.*, u.username".($table_parent_columns ? ', p1.name AS parent_name' : '').
21 21
     " FROM {{planets}} AS p
22 22
       LEFT JOIN {{users}} AS u ON u.id = p.id_owner" .
23
-    ($table_parent_columns ? ' LEFT JOIN {{planets}} AS p1 ON p1.id = p.parent_planet' : '') .
24
-    " WHERE " . ($planet_active ? "p.last_update >= {$active_time}" : "p.planet_type = {$planet_type}"));
23
+    ($table_parent_columns ? ' LEFT JOIN {{planets}} AS p1 ON p1.id = p.parent_planet' : '').
24
+    " WHERE ".($planet_active ? "p.last_update >= {$active_time}" : "p.planet_type = {$planet_type}"));
25 25
 }
26 26
 
27 27
 function db_planet_list_search($searchtext) {
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
 function db_stat_list_statistic($who, $is_common_stat, $Rank, $start, $source = false) {
87 87
 // pdump($source);
88
-  if(!$source) {
88
+  if (!$source) {
89 89
     $source = array(
90 90
       'statpoints' => 'statpoints',
91 91
       'users'      => 'users',
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
     );
107 107
   }
108 108
 // pdump($source);
109
-  if($who == 1) {
110
-    if($is_common_stat) { // , UNIX_TIMESTAMP(CONCAT(YEAR(CURRENT_DATE), DATE_FORMAT(`user_birthday`, '-%m-%d'))) AS `nearest_birthday`
109
+  if ($who == 1) {
110
+    if ($is_common_stat) { // , UNIX_TIMESTAMP(CONCAT(YEAR(CURRENT_DATE), DATE_FORMAT(`user_birthday`, '-%m-%d'))) AS `nearest_birthday`
111 111
       $query_str =
112 112
         "SELECT
113 113
       @rownum:=@rownum+1 rownum, subject.{$source['id']} as `id`, sp.{$Rank}_rank as rank, sp.{$Rank}_old_rank as rank_old, sp.{$Rank}_points as points, subject.{$source['username']} as `name`, subject.*
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     ORDER BY
122 122
       sp.`{$Rank}_rank`, subject.{$source['id']}
123 123
     LIMIT
124
-      " . $start . ",100;";
124
+      ".$start.",100;";
125 125
     } else { // , UNIX_TIMESTAMP(CONCAT(YEAR(CURRENT_DATE), DATE_FORMAT(`user_birthday`, '-%m-%d'))) AS `nearest_birthday`
126 126
       $query_str =
127 127
         "SELECT
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     ORDER BY
135 135
       subject.{$Rank} DESC, subject.{$source['id']}
136 136
     LIMIT
137
-      " . $start . ",100;";
137
+      ".$start.",100;";
138 138
     }
139 139
   } else {
140 140
     // TODO
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
   ORDER BY
152 152
     sp.`{$Rank}_rank`, subject.id
153 153
   LIMIT
154
-    " . $start . ",100;";
154
+    ".$start.",100;";
155 155
   }
156 156
 
157 157
   return doquery($query_str);
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 function db_get_set_unique_id_value($current_value_unsafe, $db_id_field_name, $db_table_name, $db_value_field_name) {
192 192
   $current_value_safe = db_escape($current_value_unsafe);
193 193
   $value_id = doquery("SELECT `{$db_id_field_name}` AS id_field FROM {{{$db_table_name}}} WHERE `{$db_value_field_name}` = '{$current_value_safe}' LIMIT 1 FOR UPDATE", true);
194
-  if(!isset($value_id['id_field']) || !$value_id['id_field']) {
194
+  if (!isset($value_id['id_field']) || !$value_id['id_field']) {
195 195
     doquery("INSERT INTO {{{$db_table_name}}} (`{$db_value_field_name}`) VALUES ('{$current_value_safe}');");
196 196
     $variable_id = db_insert_id();
197 197
   } else {
@@ -375,9 +375,9 @@  discard block
 block discarded – undo
375 375
  */
376 376
 function db_payment_list_get($flt_payer, $flt_status, $flt_test, $flt_module) {
377 377
   $extra_conditions =
378
-    ($flt_payer > 0 ? "AND payment_user_id = {$flt_payer} " : '') .
379
-    ($flt_status >= 0 ? "AND payment_status = {$flt_status} " : '') .
380
-    ($flt_test >= 0 ? "AND payment_test = {$flt_test} " : '') .
378
+    ($flt_payer > 0 ? "AND payment_user_id = {$flt_payer} " : '').
379
+    ($flt_status >= 0 ? "AND payment_status = {$flt_status} " : '').
380
+    ($flt_test >= 0 ? "AND payment_test = {$flt_test} " : '').
381 381
     ($flt_module ? "AND payment_module_name = '{$flt_module}' " : '');
382 382
   $query = doquery("SELECT * FROM `{{payment}}` WHERE 1 {$extra_conditions} ORDER BY payment_id DESC;");
383 383
 
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 
406 406
 // Log Online *************************************************************************************************************
407 407
 function db_log_online_insert() {
408
-  doquery("INSERT IGNORE INTO {{log_users_online}} SET online_count = " . classSupernova::$config->var_online_user_count);
408
+  doquery("INSERT IGNORE INTO {{log_users_online}} SET online_count = ".classSupernova::$config->var_online_user_count);
409 409
 }
410 410
 
411 411
 // Log *************************************************************************************************************
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
       `ban_user_id` = '{$banned['id']}',
618 618
       `ban_user_name` = '{$banned['username']}',
619 619
       `ban_reason` = '{$reason}',
620
-      `ban_time` = " . SN_TIME_NOW . ",
620
+      `ban_time` = ".SN_TIME_NOW.",
621 621
       `ban_until` = {$ban_until},
622 622
       `ban_issuer_id` = '{$banner['id']}',
623 623
       `ban_issuer_name` = '{$banner['username']}',
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
       `ban_user_name` = '{$banned['username']}',
640 640
       `ban_reason` = '{$reason}',
641 641
       `ban_time` = 0,
642
-      `ban_until` = " . SN_TIME_NOW . ",
642
+      `ban_until` = ".SN_TIME_NOW.",
643 643
       `ban_issuer_id` = '{$banner['id']}',
644 644
       `ban_issuer_name` = '{$banner['username']}',
645 645
       `ban_issuer_email` = '{$banner['email']}'
@@ -699,9 +699,9 @@  discard block
 block discarded – undo
699 699
 function db_ube_report_get_best_battles() {
700 700
   $query = doquery("SELECT *
701 701
       FROM {{ube_report}}
702
-      WHERE `ube_report_time_process` <  DATE(DATE_SUB(NOW(), INTERVAL " . MODULE_INFO_BEST_BATTLES_LOCK_DAYS . " DAY))
702
+      WHERE `ube_report_time_process` <  DATE(DATE_SUB(NOW(), INTERVAL " . MODULE_INFO_BEST_BATTLES_LOCK_DAYS." DAY))
703 703
       ORDER BY `ube_report_debris_total_in_metal` DESC, `ube_report_id` ASC
704
-      LIMIT " . MODULE_INFO_BEST_BATTLES_REPORT_VIEW . ";");
704
+      LIMIT " . MODULE_INFO_BEST_BATTLES_REPORT_VIEW.";");
705 705
 
706 706
   return $query;
707 707
 }
Please login to merge, or discard this patch.