Completed
Push — work-fleets ( 1c4183...d64c53 )
by SuperNova.WS
05:36
created
includes/classes/DBStaticChat.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
       JOIN {{users}} AS u ON u.id = cp.chat_player_player_id
13 13
     WHERE
14 14
       `chat_player_refresh_last` >= '{$sql_date}'
15
-      AND (`banaday` IS NULL OR `banaday` <= " . SN_TIME_NOW . ")
15
+      AND (`banaday` IS NULL OR `banaday` <= ".SN_TIME_NOW.")
16 16
       {$ally_add}
17 17
     ORDER BY authlevel DESC, `username`");
18 18
   }
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
           `user` = '{$nick}',
36 36
           `ally_id` = '{$ally_id}',
37 37
           `message` = '{$message}',
38
-          `timestamp` = " . SN_TIME_NOW . ",
38
+          `timestamp` = ".SN_TIME_NOW.",
39 39
           `chat_message_sender_name` = '{$chat_message_sender_name}',
40 40
           `chat_message_recipient_id` = {$chat_message_recipient_id},
41 41
           `chat_message_recipient_name` = '{$chat_message_recipient_name}'"
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
    * @param $user
142 142
    */
143 143
   public static function db_chat_player_update($user) {
144
-    doquery("UPDATE {{chat_player}} SET `chat_player_refresh_last` = " . SN_TIME_NOW . " WHERE `chat_player_player_id` = {$user['id']} LIMIT 1;");
144
+    doquery("UPDATE {{chat_player}} SET `chat_player_refresh_last` = ".SN_TIME_NOW." WHERE `chat_player_player_id` = {$user['id']} LIMIT 1;");
145 145
   }
146 146
 
147 147
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
    * @param $user
213 213
    */
214 214
   public static function db_chat_player_update_activity($user) {
215
-    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
+    doquery("UPDATE {{chat_player}} SET `chat_player_activity` = '".classSupernova::$db->db_escape(SN_TIME_SQL)."' WHERE `chat_player_player_id` = {$user['id']} LIMIT 1");
216 216
   }
217 217
 
218 218
 }
219 219
\ No newline at end of file
Please login to merge, or discard this patch.
includes/classes/DBStaticAlly.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
     `ally_name` = '{$ally_name}',
67 67
     `ally_tag` = '{$ally_tag}',
68 68
     `ally_owner` = '{$user['id']}',
69
-    `ally_owner_range` = '" . classLocale::$lang['ali_leaderRank'] . "',
69
+    `ally_owner_range` = '".classLocale::$lang['ali_leaderRank']."',
70 70
     `ally_members` = 1,
71
-    `ranklist` = '" . classLocale::$lang['ali_defaultRankName'] . ",0,0,0,0,0',
71
+    `ranklist` = '" . classLocale::$lang['ali_defaultRankName'].",0,0,0,0,0',
72 72
     `ally_register_time`= " . SN_TIME_NOW
73 73
     );
74 74
   }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
    * @param $POST_text
88 88
    */
89 89
   public static function db_ally_request_insert($user, $id_ally, $POST_text) {
90
-    doquery("INSERT INTO {{alliance_requests}} SET `id_user` = {$user['id']}, `id_ally`='{$id_ally}', request_text ='{$POST_text}', request_time=" . SN_TIME_NOW . ";");
90
+    doquery("INSERT INTO {{alliance_requests}} SET `id_user` = {$user['id']}, `id_ally`='{$id_ally}', request_text ='{$POST_text}', request_time=".SN_TIME_NOW.";");
91 91
   }
92 92
 
93 93
   /**
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
    * @param $ally
138 138
    */
139 139
   public static function db_ally_update_by_changeset($ally_changeset, $ally) {
140
-    doquery("UPDATE {{alliance}} SET " . implode(',', $ally_changeset) . " WHERE `id`='{$ally['id']}' LIMIT 1;");
140
+    doquery("UPDATE {{alliance}} SET ".implode(',', $ally_changeset)." WHERE `id`='{$ally['id']}' LIMIT 1;");
141 141
   }
142 142
 
143 143
   /**
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
    * @param $d
249 249
    */
250 250
   public static function db_ally_request_deny($d) {
251
-    doquery("UPDATE {{alliance_requests}} SET `request_denied` = 1, `request_text` = '" . classLocale::$lang['ali_req_deny_reason'] . "' WHERE `id_user`= {$d} LIMIT 1;");
251
+    doquery("UPDATE {{alliance_requests}} SET `request_denied` = 1, `request_text` = '".classLocale::$lang['ali_req_deny_reason']."' WHERE `id_user`= {$d} LIMIT 1;");
252 252
   }
253 253
 
254 254
   /**
Please login to merge, or discard this patch.
includes/classes/DBStaticMessages.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
     return doquery(
8 8
       "SELECT * FROM {{messages}}
9 9
         WHERE
10
-          `message_type` = '" . MSG_TYPE_PLAYER . "' AND
10
+          `message_type` = '" . MSG_TYPE_PLAYER."' AND
11 11
           ((`message_owner` = '{$user['id']}' AND `message_sender` = '{$recipient_id}')
12 12
           OR
13 13
           (`message_sender` = '{$user['id']}' AND `message_owner` = '{$recipient_id}')) ORDER BY `message_time` DESC LIMIT 20;");
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 FROM
54 54
   {{messages}} AS m
55 55
   LEFT JOIN {{users}} AS u ON u.id = m.message_owner " .
56
-      ($int_type_selected >= 0 ? "WHERE `message_type` = {$int_type_selected} " : '') .
56
+      ($int_type_selected >= 0 ? "WHERE `message_type` = {$int_type_selected} " : '').
57 57
       "ORDER BY
58 58
   `message_id` DESC
59 59
 LIMIT
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
   }
62 62
 
63 63
   public static function db_message_insert_all($message_type, $from, $subject, $text) {
64
-    return doquery($QryInsertMessage = 'INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) ' .
64
+    return doquery($QryInsertMessage = 'INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) '.
65 65
       "SELECT `id`, 0, unix_timestamp(now()), {$message_type}, '{$from}', '{$subject}', '{$text}' FROM {{users}}");
66 66
   }
67 67
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
    * @return array|bool|mysqli_result|null
72 72
    */
73 73
   public static function db_message_count_by_type($int_type_selected) {
74
-    $page_max = doquery('SELECT COUNT(*) AS `max` FROM {{messages}}' . ($int_type_selected >= 0 ? " WHERE `message_type` = {$int_type_selected};" : ''), true);
74
+    $page_max = doquery('SELECT COUNT(*) AS `max` FROM {{messages}}'.($int_type_selected >= 0 ? " WHERE `message_type` = {$int_type_selected};" : ''), true);
75 75
 
76 76
     return $page_max;
77 77
   }
@@ -88,15 +88,15 @@  discard block
 block discarded – undo
88 88
    * @param $int_type_selected
89 89
    */
90 90
   public static function db_message_list_delete_by_date($delete_date, $int_type_selected) {
91
-    doquery("DELETE FROM {{messages}} WHERE message_time <= UNIX_TIMESTAMP('{$delete_date}')" . ($int_type_selected >= 0 ? " AND `message_type` = {$int_type_selected}" : ''));
91
+    doquery("DELETE FROM {{messages}} WHERE message_time <= UNIX_TIMESTAMP('{$delete_date}')".($int_type_selected >= 0 ? " AND `message_type` = {$int_type_selected}" : ''));
92 92
   }
93 93
 
94 94
   /**
95 95
    * @param $insert_values
96 96
    */
97 97
   public static function db_message_insert($insert_values) {
98
-    doquery('INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) ' .
99
-      'VALUES ' . implode(',', $insert_values));
98
+    doquery('INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) '.
99
+      'VALUES '.implode(',', $insert_values));
100 100
   }
101 101
 
102 102
 
Please login to merge, or discard this patch.
includes/classes/DBStaticFleetACS.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -51,16 +51,16 @@
 block discarded – undo
51 51
    */
52 52
   public static function db_acs_insert($fleetid, $user, $objFleet) {
53 53
     doquery("INSERT INTO {{aks}} SET
54
-          `name` = '" . db_escape(classLocale::$lang['flt_acs_prefix'] . $fleetid) . "',
55
-          `teilnehmer` = '" . $user['id'] . "',
56
-          `flotten` = '" . $fleetid . "',
57
-          `ankunft` = '" . $objFleet->time_arrive_to_target . "',
58
-          `galaxy` = '" . $objFleet->fleet_end_galaxy . "',
59
-          `system` = '" . $objFleet->fleet_end_system . "',
60
-          `planet` = '" . $objFleet->fleet_end_planet . "',
61
-          `planet_type` = '" . $objFleet->fleet_end_type . "',
62
-          `eingeladen` = '" . $user['id'] . "',
63
-          `fleet_end_time` = '" . $objFleet->time_return_to_source . "'");
54
+          `name` = '" . db_escape(classLocale::$lang['flt_acs_prefix'].$fleetid)."',
55
+          `teilnehmer` = '" . $user['id']."',
56
+          `flotten` = '" . $fleetid."',
57
+          `ankunft` = '" . $objFleet->time_arrive_to_target."',
58
+          `galaxy` = '" . $objFleet->fleet_end_galaxy."',
59
+          `system` = '" . $objFleet->fleet_end_system."',
60
+          `planet` = '" . $objFleet->fleet_end_planet."',
61
+          `planet_type` = '" . $objFleet->fleet_end_type."',
62
+          `eingeladen` = '" . $user['id']."',
63
+          `fleet_end_time` = '" . $objFleet->time_return_to_source."'");
64 64
   }
65 65
 
66 66
   /**
Please login to merge, or discard this patch.
includes/classes/DBStaticFleetMissile.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
    * @return array|bool|mysqli_result|null
24 24
    */
25 25
   public static function db_missile_list_by_arrival() {
26
-    $iraks = doquery("SELECT * FROM {{iraks}} WHERE `fleet_end_time` <= " . SN_TIME_NOW . " FOR UPDATE;");
26
+    $iraks = doquery("SELECT * FROM {{iraks}} WHERE `fleet_end_time` <= ".SN_TIME_NOW." FOR UPDATE;");
27 27
 
28 28
     return $iraks;
29 29
   }
Please login to merge, or discard this patch.
includes/classes/DBStaticNews.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 function db_news_insert_set($announce_time, $text, $detail_url, $user) {
13 13
   doquery("INSERT INTO {{announce}}
14 14
         SET `tsTimeStamp` = FROM_UNIXTIME({$announce_time}), `strAnnounce`='{$text}', detail_url = '{$detail_url}',
15
-        `user_id` = {$user['id']}, `user_name` = '" . db_escape($user['username']) . "'");
15
+        `user_id` = {$user['id']}, `user_name` = '".db_escape($user['username'])."'");
16 16
 }
17 17
 
18 18
 function db_survey_insert($announce_id, $survey_question, $survey_until) {
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
       LEFT JOIN {{survey}} AS s ON s.survey_announce_id = a.idAnnounce
94 94
       LEFT JOIN {{users}} AS u ON u.id = a.user_id
95 95
     {$query_where}
96
-    ORDER BY `tsTimeStamp` DESC, idAnnounce" .
96
+    ORDER BY `tsTimeStamp` DESC, idAnnounce".
97 97
     ($query_limit ? " LIMIT {$query_limit}" : ''));
98 98
 
99 99
   $template->assign_var('NEWS_COUNT', db_num_rows($announce_list));
Please login to merge, or discard this patch.
announce.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 $allow_anonymous = true;
12
-include('common.' . substr(strrchr(__FILE__, '.'), 1));
12
+include('common.'.substr(strrchr(__FILE__, '.'), 1));
13 13
 
14 14
 global $config;
15 15
 
@@ -23,40 +23,40 @@  discard block
 block discarded – undo
23 23
 $mode = sys_get_param_str('mode');
24 24
 
25 25
 $announce = array();
26
-if($user['authlevel'] >= 3) {
27
-  if(!empty($text)) {
26
+if ($user['authlevel'] >= 3) {
27
+  if (!empty($text)) {
28 28
     $announce_time = strtotime($announce_time, SN_TIME_NOW);
29 29
     $announce_time = $announce_time ? $announce_time : SN_TIME_NOW;
30 30
 
31
-    if($mode == 'edit') {
31
+    if ($mode == 'edit') {
32 32
       DBStaticNews::db_news_update_set($announce_time, $text, $detail_url, $announce_id);
33 33
       DBStaticSurvey::db_survey_delete_by_id($announce_id);
34 34
     } else {
35 35
       DBStaticNews::db_news_insert_set($announce_time, $text, $detail_url, $user);
36 36
       $announce_id = db_insert_id();
37 37
     }
38
-    if(($survey_question = sys_get_param_str('survey_question')) && ($survey_answers = sys_get_param('survey_answers'))) {
38
+    if (($survey_question = sys_get_param_str('survey_question')) && ($survey_answers = sys_get_param('survey_answers'))) {
39 39
       $survey_answers = explode("\r\n", $survey_answers);
40 40
       $survey_until = strtotime($survey_until = sys_get_param_str('survey_until'), SN_TIME_NOW);
41 41
       $survey_until = date(FMT_DATE_TIME_SQL, $survey_until ? $survey_until : SN_TIME_NOW + PERIOD_DAY * 1);
42 42
       DBStaticSurvey::db_survey_insert($announce_id, $survey_question, $survey_until);
43 43
       $survey_id = db_insert_id();
44
-      foreach($survey_answers as $survey_answer) {
44
+      foreach ($survey_answers as $survey_answer) {
45 45
         $survey_answer = db_escape(trim($survey_answer));
46
-        if(empty($survey_answer)) {
46
+        if (empty($survey_answer)) {
47 47
           continue;
48 48
         }
49 49
         DBStaticSurveyAnswer::db_survey_answer_insert($survey_id, $survey_answer);
50 50
       }
51 51
     }
52 52
 
53
-    if($announce_time <= SN_TIME_NOW) {
54
-      if($announce_time > $config->var_news_last && $announce_time == SN_TIME_NOW) {
53
+    if ($announce_time <= SN_TIME_NOW) {
54
+      if ($announce_time > $config->var_news_last && $announce_time == SN_TIME_NOW) {
55 55
         $config->db_saveItem('var_news_last', $announce_time);
56 56
       }
57 57
 
58
-      if(sys_get_param_int('news_mass_mail')) {
59
-        $text = sys_get_param('text') . ($detail_url ? " <a href=\"{$detail_url}\"><span class=\"positive\">{$lang['news_more']}</span></a>" : '');
58
+      if (sys_get_param_int('news_mass_mail')) {
59
+        $text = sys_get_param('text').($detail_url ? " <a href=\"{$detail_url}\"><span class=\"positive\">{$lang['news_more']}</span></a>" : '');
60 60
         msg_send_simple_message('*', 0, 0, MSG_TYPE_ADMIN, $lang['sys_administration'], $lang['news_title'], $text);
61 61
       }
62 62
     }
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
   }
67 67
 
68 68
   $survey_answers = '';
69
-  switch($mode) {
69
+  switch ($mode) {
70 70
     case 'del':
71 71
       DBStaticNews::db_news_delete_by_id($announce_id);
72 72
       $mode = '';
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
       $template->assign_var('ID', $announce_id);
77 77
     case 'copy':
78 78
       $announce = DBStaticNews::db_news_with_survey_select_by_id($announce_id);
79
-      if($announce['survey_id']) {
79
+      if ($announce['survey_id']) {
80 80
         $query = DBStaticSurveyAnswer::db_survey_answer_text_select_by_news($announce);
81
-        while($row = db_fetch($query)) {
81
+        while ($row = db_fetch($query)) {
82 82
           $survey_answers[] = $row['survey_answer_text'];
83 83
         }
84 84
         $survey_answers = implode("\r\n", $survey_answers);
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     break;
87 87
   }
88 88
 } else {
89
-  $annQuery = 'WHERE UNIX_TIMESTAMP(`tsTimeStamp`) <= ' . SN_TIME_NOW;
89
+  $annQuery = 'WHERE UNIX_TIMESTAMP(`tsTimeStamp`) <= '.SN_TIME_NOW;
90 90
 }
91 91
 
92 92
 nws_render($template, $annQuery, 20);
Please login to merge, or discard this patch.
includes/classes/db_mysql.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
   public function load_db_settings() {
66 66
     $dbsettings = array();
67 67
 
68
-    require(SN_ROOT_PHYSICAL . "config" . DOT_PHP_EX);
68
+    require(SN_ROOT_PHYSICAL."config".DOT_PHP_EX);
69 69
 
70 70
     $this->dbsettings = $dbsettings;
71 71
   }
@@ -73,23 +73,23 @@  discard block
 block discarded – undo
73 73
   public function sn_db_connect($external_db_settings = null) {
74 74
     $this->db_disconnect();
75 75
 
76
-    if(!empty($external_db_settings) && is_array($external_db_settings)) {
76
+    if (!empty($external_db_settings) && is_array($external_db_settings)) {
77 77
       $this->dbsettings = $external_db_settings;
78 78
     }
79 79
 
80
-    if(empty($this->dbsettings)) {
80
+    if (empty($this->dbsettings)) {
81 81
       $this->load_db_settings();
82 82
     }
83 83
 
84 84
     // TODO - фатальные (?) ошибки на каждом шагу. Хотя - скорее Эксепшны
85
-    if(!empty($this->dbsettings)) {
85
+    if (!empty($this->dbsettings)) {
86 86
       $driver_name = empty($this->dbsettings['sn_driver']) ? 'db_mysql_v5' : $this->dbsettings['sn_driver'];
87 87
       $this->driver = new $driver_name();
88 88
       $this->db_prefix = $this->dbsettings['prefix'];
89 89
 
90 90
       $this->connected = $this->connected || $this->driver_connect();
91 91
 
92
-      if($this->connected) {
92
+      if ($this->connected) {
93 93
         $this->table_list = $this->db_get_table_list();
94 94
         // TODO Проверка на пустоту
95 95
       }
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
   }
102 102
 
103 103
   protected function driver_connect() {
104
-    if(!is_object($this->driver)) {
104
+    if (!is_object($this->driver)) {
105 105
       classSupernova::$debug->error_fatal('DB Error - No driver for MySQL found!');
106 106
     }
107 107
 
108
-    if(!method_exists($this->driver, 'mysql_connect')) {
108
+    if (!method_exists($this->driver, 'mysql_connect')) {
109 109
       classSupernova::$debug->error_fatal('DB Error - WRONG MySQL driver!');
110 110
     }
111 111
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
   }
114 114
 
115 115
   public function db_disconnect() {
116
-    if($this->connected) {
116
+    if ($this->connected) {
117 117
       $this->connected = !$this->driver_disconnect();
118 118
       $this->connected = false;
119 119
     }
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
    */
129 129
   public function replaceTablePlaceholders($query) {
130 130
     $sql = $query;
131
-    if(strpos($sql, '{{') !== false) {
132
-      foreach($this->table_list as $tableName) {
133
-        $sql = str_replace("{{{$tableName}}}", $this->db_prefix . $tableName, $sql);
131
+    if (strpos($sql, '{{') !== false) {
132
+      foreach ($this->table_list as $tableName) {
133
+        $sql = str_replace("{{{$tableName}}}", $this->db_prefix.$tableName, $sql);
134 134
       }
135 135
     }
136 136
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
    * @param       $fetch
143 143
    */
144 144
   protected function logQuery($query, $fetch) {
145
-    if(!classSupernova::$config->debug) {
145
+    if (!classSupernova::$config->debug) {
146 146
       return;
147 147
     }
148 148
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     $arr = debug_backtrace();
151 151
     $file = end(explode('/', $arr[0]['file']));
152 152
     $line = $arr[0]['line'];
153
-    classSupernova::$debug->add("<tr><th>Query {$this->queryCount}: </th><th>$query</th><th>{$file} @ {$line}</th><th>&nbsp;</th><th> " . ($fetch ? '+' : '&nbsp;') . " </th></tr>");
153
+    classSupernova::$debug->add("<tr><th>Query {$this->queryCount}: </th><th>$query</th><th>{$file} @ {$line}</th><th>&nbsp;</th><th> ".($fetch ? '+' : '&nbsp;')." </th></tr>");
154 154
   }
155 155
 
156 156
 
@@ -160,18 +160,18 @@  discard block
 block discarded – undo
160 160
    * @return void
161 161
    */
162 162
   protected function commentQuery(&$sql) {
163
-    if(!defined('DEBUG_SQL_COMMENT')) {
163
+    if (!defined('DEBUG_SQL_COMMENT')) {
164 164
       return;
165 165
     }
166 166
     $backtrace = debug_backtrace();
167 167
     $sql_comment = classSupernova::$debug->compact_backtrace($backtrace, defined('DEBUG_SQL_COMMENT_LONG'));
168 168
 
169
-    $sql_commented = '/* ' . implode("<br />", $sql_comment) . '<br /> */ ' . preg_replace("/\s+/", ' ', $sql);
170
-    if(defined('DEBUG_SQL_ONLINE')) {
169
+    $sql_commented = '/* '.implode("<br />", $sql_comment).'<br /> */ '.preg_replace("/\s+/", ' ', $sql);
170
+    if (defined('DEBUG_SQL_ONLINE')) {
171 171
       classSupernova::$debug->warning($sql_commented, 'SQL Debug', LOG_DEBUG_SQL);
172 172
     }
173 173
 
174
-    if(defined('DEBUG_SQL_ERROR')) {
174
+    if (defined('DEBUG_SQL_ERROR')) {
175 175
       array_unshift($sql_comment, preg_replace("/\s+/", ' ', $sql));
176 176
       classSupernova::$debug->add_to_array($sql_comment);
177 177
     }
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
    * @return array|bool|mysqli_result|null
186 186
    */
187 187
   public function execute($statement) {
188
-    return $this->doquery((string)$statement);
188
+    return $this->doquery((string) $statement);
189 189
   }
190 190
 
191 191
   /**
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
   }
200 200
 
201 201
   public function doquery($query, $table = '', $fetch = false, $skip_query_check = false) {
202
-    if(!is_string($table)) {
202
+    if (!is_string($table)) {
203 203
       $fetch = $table;
204 204
     }
205 205
 
206
-    if(!$this->connected) {
206
+    if (!$this->connected) {
207 207
       $this->sn_db_connect();
208 208
     }
209 209
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 
215 215
     $sql = $this->replaceTablePlaceholders($query);
216 216
     $this->commentQuery($sql);
217
-    !($sqlquery = $this->db_sql_query($sql)) ? classSupernova::$debug->error(db_error() . "<br />$sql<br />", 'SQL Error') : false;
217
+    !($sqlquery = $this->db_sql_query($sql)) ? classSupernova::$debug->error(db_error()."<br />$sql<br />", 'SQL Error') : false;
218 218
 
219 219
     return $fetch ? $this->db_fetch($sqlquery) : $sqlquery;
220 220
   }
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
   protected function security_watch_user_queries($query) {
225 225
     global $user;
226 226
 
227
-    if(
227
+    if (
228 228
       !$this->isWatching // Not already watching
229 229
       && !empty(classSupernova::$config->game_watchlist_array) // There is some players in watchlist
230 230
       && in_array($user['id'], classSupernova::$config->game_watchlist_array) // Current player is in watchlist
@@ -232,11 +232,11 @@  discard block
 block discarded – undo
232 232
     ) {
233 233
       $this->isWatching = true;
234 234
       $msg = "\$query = \"{$query}\"\n\r";
235
-      if(!empty($_POST)) {
236
-        $msg .= "\n\r" . dump($_POST, '$_POST');
235
+      if (!empty($_POST)) {
236
+        $msg .= "\n\r".dump($_POST, '$_POST');
237 237
       }
238
-      if(!empty($_GET)) {
239
-        $msg .= "\n\r" . dump($_GET, '$_GET');
238
+      if (!empty($_GET)) {
239
+        $msg .= "\n\r".dump($_GET, '$_GET');
240 240
       }
241 241
       classSupernova::$debug->warning($msg, "Watching user {$user['id']}", 399, array('base_dump' => true));
242 242
       $this->isWatching = false;
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
   public function security_query_check_bad_words($query) {
248 248
     global $user, $dm_change_legit, $mm_change_legit;
249 249
 
250
-    switch(true) {
250
+    switch (true) {
251 251
       case stripos($query, 'RUNCATE TABL') != false:
252 252
       case stripos($query, 'ROP TABL') != false:
253 253
       case stripos($query, 'ENAME TABL') != false:
@@ -258,37 +258,37 @@  discard block
 block discarded – undo
258 258
       case stripos($query, 'RPG_POINTS') != false && stripos(trim($query), 'UPDATE ') === 0 && !$dm_change_legit:
259 259
       case stripos($query, 'METAMATTER') != false && stripos(trim($query), 'UPDATE ') === 0 && !$mm_change_legit:
260 260
       case stripos($query, 'AUTHLEVEL') != false && $user['authlevel'] < 3 && stripos($query, 'SELECT') !== 0:
261
-        $report = "Hacking attempt (" . date("d.m.Y H:i:s") . " - [" . time() . "]):\n";
261
+        $report = "Hacking attempt (".date("d.m.Y H:i:s")." - [".time()."]):\n";
262 262
         $report .= ">Database Inforamation\n";
263
-        $report .= "\tID - " . $user['id'] . "\n";
264
-        $report .= "\tUser - " . $user['username'] . "\n";
265
-        $report .= "\tAuth level - " . $user['authlevel'] . "\n";
266
-        $report .= "\tAdmin Notes - " . $user['adminNotes'] . "\n";
267
-        $report .= "\tCurrent Planet - " . $user['current_planet'] . "\n";
268
-        $report .= "\tUser IP - " . $user['user_lastip'] . "\n";
269
-        $report .= "\tUser IP at Reg - " . $user['ip_at_reg'] . "\n";
270
-        $report .= "\tUser Agent- " . $_SERVER['HTTP_USER_AGENT'] . "\n";
271
-        $report .= "\tCurrent Page - " . $user['current_page'] . "\n";
272
-        $report .= "\tRegister Time - " . $user['register_time'] . "\n";
263
+        $report .= "\tID - ".$user['id']."\n";
264
+        $report .= "\tUser - ".$user['username']."\n";
265
+        $report .= "\tAuth level - ".$user['authlevel']."\n";
266
+        $report .= "\tAdmin Notes - ".$user['adminNotes']."\n";
267
+        $report .= "\tCurrent Planet - ".$user['current_planet']."\n";
268
+        $report .= "\tUser IP - ".$user['user_lastip']."\n";
269
+        $report .= "\tUser IP at Reg - ".$user['ip_at_reg']."\n";
270
+        $report .= "\tUser Agent- ".$_SERVER['HTTP_USER_AGENT']."\n";
271
+        $report .= "\tCurrent Page - ".$user['current_page']."\n";
272
+        $report .= "\tRegister Time - ".$user['register_time']."\n";
273 273
         $report .= "\n";
274 274
 
275 275
         $report .= ">Query Information\n";
276
-        $report .= "\tQuery - " . $query . "\n";
276
+        $report .= "\tQuery - ".$query."\n";
277 277
         $report .= "\n";
278 278
 
279 279
         $report .= ">\$_SERVER Information\n";
280
-        $report .= "\tIP - " . $_SERVER['REMOTE_ADDR'] . "\n";
281
-        $report .= "\tHost Name - " . $_SERVER['HTTP_HOST'] . "\n";
282
-        $report .= "\tUser Agent - " . $_SERVER['HTTP_USER_AGENT'] . "\n";
283
-        $report .= "\tRequest Method - " . $_SERVER['REQUEST_METHOD'] . "\n";
284
-        $report .= "\tCame From - " . $_SERVER['HTTP_REFERER'] . "\n";
285
-        $report .= "\tPage is - " . $_SERVER['SCRIPT_NAME'] . "\n";
286
-        $report .= "\tUses Port - " . $_SERVER['REMOTE_PORT'] . "\n";
287
-        $report .= "\tServer Protocol - " . $_SERVER['SERVER_PROTOCOL'] . "\n";
280
+        $report .= "\tIP - ".$_SERVER['REMOTE_ADDR']."\n";
281
+        $report .= "\tHost Name - ".$_SERVER['HTTP_HOST']."\n";
282
+        $report .= "\tUser Agent - ".$_SERVER['HTTP_USER_AGENT']."\n";
283
+        $report .= "\tRequest Method - ".$_SERVER['REQUEST_METHOD']."\n";
284
+        $report .= "\tCame From - ".$_SERVER['HTTP_REFERER']."\n";
285
+        $report .= "\tPage is - ".$_SERVER['SCRIPT_NAME']."\n";
286
+        $report .= "\tUses Port - ".$_SERVER['REMOTE_PORT']."\n";
287
+        $report .= "\tServer Protocol - ".$_SERVER['SERVER_PROTOCOL']."\n";
288 288
 
289 289
         $report .= "\n--------------------------------------------------------------------------------------------------\n";
290 290
 
291
-        $fp = fopen(SN_ROOT_PHYSICAL . 'badqrys.txt', 'a');
291
+        $fp = fopen(SN_ROOT_PHYSICAL.'badqrys.txt', 'a');
292 292
         fwrite($fp, $report);
293 293
         fclose($fp);
294 294
 
@@ -309,11 +309,11 @@  discard block
 block discarded – undo
309 309
     $prefix_length = strlen($this->db_prefix);
310 310
 
311 311
     $tl = array();
312
-    while($row = $this->db_fetch($query)) {
313
-      foreach($row as $table_name) {
314
-        if(strpos($table_name, $this->db_prefix) === 0) {
312
+    while ($row = $this->db_fetch($query)) {
313
+      foreach ($row as $table_name) {
314
+        if (strpos($table_name, $this->db_prefix) === 0) {
315 315
           $table_name = substr($table_name, $prefix_length);
316
-        } elseif($prefixed_only) {
316
+        } elseif ($prefixed_only) {
317 317
           continue;
318 318
         }
319 319
         // $table_name = str_replace($db_prefix, '', $table_name);
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
     $result = array();
409 409
 
410 410
     $status = explode('  ', $this->driver->mysql_stat());
411
-    foreach($status as $value) {
411
+    foreach ($status as $value) {
412 412
       $row = explode(': ', $value);
413 413
       $result[$row[0]] = $row[1];
414 414
     }
@@ -424,10 +424,10 @@  discard block
 block discarded – undo
424 424
     $result = array();
425 425
 
426 426
     $query = $this->db_sql_query('SHOW STATUS;');
427
-    if(is_bool($query)) {
427
+    if (is_bool($query)) {
428 428
       throw new Exception('Result of SHOW STATUS command is boolean - which should never happen. Connection to DB is lost?');
429 429
     }
430
-    while($row = db_fetch($query)) {
430
+    while ($row = db_fetch($query)) {
431 431
       $result[$row['Variable_name']] = $row['Value'];
432 432
     }
433 433
 
Please login to merge, or discard this patch.
includes/classes/DBStaticNote.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
    * @param $note_id_edit
37 37
    */
38 38
   public static function db_note_update_by_id($note_priority, $note_title, $note_text, $note_galaxy, $note_system, $note_planet, $note_planet_type, $note_sticky, $note_id_edit) {
39
-    doquery("UPDATE {{notes}} SET `time` = " . SN_TIME_NOW . ", `priority` = {$note_priority}, `title` = '{$note_title}', `text` = '{$note_text}',
39
+    doquery("UPDATE {{notes}} SET `time` = ".SN_TIME_NOW.", `priority` = {$note_priority}, `title` = '{$note_title}', `text` = '{$note_text}',
40 40
         `galaxy` = {$note_galaxy}, `system` = {$note_system}, `planet` = {$note_planet}, `planet_type` = {$note_planet_type}, `sticky` = {$note_sticky}
41 41
         WHERE `id` = {$note_id_edit} LIMIT 1;");
42 42
   }
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
    * @param $note_sticky
54 54
    */
55 55
   public static function db_note_insert($user, $note_priority, $note_title, $note_text, $note_galaxy, $note_system, $note_planet, $note_planet_type, $note_sticky) {
56
-    doquery("INSERT INTO {{notes}} SET `owner` = {$user['id']}, `time` = " . SN_TIME_NOW . ", `priority` = {$note_priority}, `title` = '{$note_title}', `text` = '{$note_text}',
56
+    doquery("INSERT INTO {{notes}} SET `owner` = {$user['id']}, `time` = ".SN_TIME_NOW.", `priority` = {$note_priority}, `title` = '{$note_title}', `text` = '{$note_text}',
57 57
         `galaxy` = {$note_galaxy}, `system` = {$note_system}, `planet` = {$note_planet}, `planet_type` = {$note_planet_type}, `sticky` = {$note_sticky};");
58 58
   }
59 59
 
Please login to merge, or discard this patch.