@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | define('INSTALL', false); |
11 | 11 | define('IN_ADMIN', true); |
12 | 12 | |
13 | -require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
13 | +require('../common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
14 | 14 | |
15 | 15 | if ($user['authlevel'] < 3) { |
16 | 16 | AdminMessage(classLocale::$lang['adm_err_denied']); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | foreach ($value as $interval_data) { |
112 | 112 | print("<tr>"); |
113 | 113 | print("<td>{$user_id}</td><td>{$user_record['username']}</td><td>{$interval_data[0]}</td><td>{$interval_data[1]}</td><td>{$interval_data[2]}</td>"); |
114 | - print("<td>" . date(FMT_DATE_TIME_SQL, $user_record['onlinetime']) . "</td>"); |
|
114 | + print("<td>".date(FMT_DATE_TIME_SQL, $user_record['onlinetime'])."</td>"); |
|
115 | 115 | print("</tr>"); |
116 | 116 | } |
117 | 117 | } |
@@ -45,8 +45,8 @@ |
||
45 | 45 | */ |
46 | 46 | protected function quoteStringAsFieldByRef(&$string) { |
47 | 47 | $string = $this->stringEscape($string); |
48 | - if ((string)$string && '*' != $string) { |
|
49 | - $string = '`' . $string . '`'; |
|
48 | + if ((string) $string && '*' != $string) { |
|
49 | + $string = '`'.$string.'`'; |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | /** |
125 | 125 | * @param string $query |
126 | 126 | * |
127 | - * @return mixed|string |
|
127 | + * @return string |
|
128 | 128 | */ |
129 | 129 | public function replaceTablePlaceholders($query) { |
130 | 130 | $sql = $query; |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
141 | - * @param $query |
|
142 | - * @param $fetch |
|
141 | + * @param string $query |
|
142 | + * @param boolean $fetch |
|
143 | 143 | */ |
144 | 144 | protected function logQuery($query, $fetch) { |
145 | 145 | if (!classSupernova::$config->debug) { |
@@ -257,6 +257,10 @@ discard block |
||
257 | 257 | |
258 | 258 | |
259 | 259 | // TODO Заменить это на новый логгер |
260 | + |
|
261 | + /** |
|
262 | + * @param string $query |
|
263 | + */ |
|
260 | 264 | protected function security_watch_user_queries($query) { |
261 | 265 | global $user; |
262 | 266 | |
@@ -280,6 +284,9 @@ discard block |
||
280 | 284 | } |
281 | 285 | |
282 | 286 | |
287 | + /** |
|
288 | + * @param string $query |
|
289 | + */ |
|
283 | 290 | public function security_query_check_bad_words($query, $skip_query_check = false) { |
284 | 291 | if ($skip_query_check) { |
285 | 292 | return; |
@@ -65,7 +65,7 @@ discard block |
||
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 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $sql = $query; |
131 | 131 | if (strpos($sql, '{{') !== false) { |
132 | 132 | foreach ($this->table_list as $tableName) { |
133 | - $sql = str_replace("{{{$tableName}}}", $this->db_prefix . $tableName, $sql); |
|
133 | + $sql = str_replace("{{{$tableName}}}", $this->db_prefix.$tableName, $sql); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
@@ -150,7 +150,7 @@ discard block |
||
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> </th><th> " . ($fetch ? '+' : ' ') . " </th></tr>"); |
|
153 | + classSupernova::$debug->add("<tr><th>Query {$this->queryCount}: </th><th>$query</th><th>{$file} @ {$line}</th><th> </th><th> ".($fetch ? '+' : ' ')." </th></tr>"); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -210,12 +210,12 @@ discard block |
||
210 | 210 | |
211 | 211 | $queryResult = null; |
212 | 212 | try { |
213 | - $queryResult = $this->db_sql_query($stringQuery . DbSqlHelper::quoteComment($queryTrace)); |
|
213 | + $queryResult = $this->db_sql_query($stringQuery.DbSqlHelper::quoteComment($queryTrace)); |
|
214 | 214 | if (!$queryResult) { |
215 | 215 | throw new Exception(); |
216 | 216 | } |
217 | 217 | } catch (Exception $e) { |
218 | - classSupernova::$debug->error($this->db_error() . "<br />{$query}<br />", 'SQL Error'); |
|
218 | + classSupernova::$debug->error($this->db_error()."<br />{$query}<br />", 'SQL Error'); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | if ($fetch) { |
@@ -336,10 +336,10 @@ discard block |
||
336 | 336 | $this->isWatching = true; |
337 | 337 | $msg = "\$query = \"{$query}\"\n\r"; |
338 | 338 | if (!empty($_POST)) { |
339 | - $msg .= "\n\r" . dump($_POST, '$_POST'); |
|
339 | + $msg .= "\n\r".dump($_POST, '$_POST'); |
|
340 | 340 | } |
341 | 341 | if (!empty($_GET)) { |
342 | - $msg .= "\n\r" . dump($_GET, '$_GET'); |
|
342 | + $msg .= "\n\r".dump($_GET, '$_GET'); |
|
343 | 343 | } |
344 | 344 | classSupernova::$debug->warning($msg, "Watching user {$user['id']}", 399, array('base_dump' => true)); |
345 | 345 | $this->isWatching = false; |
@@ -365,37 +365,37 @@ discard block |
||
365 | 365 | case stripos($query, 'RPG_POINTS') != false && stripos(trim($query), 'UPDATE ') === 0 && !$dm_change_legit: |
366 | 366 | case stripos($query, 'METAMATTER') != false && stripos(trim($query), 'UPDATE ') === 0 && !$mm_change_legit: |
367 | 367 | case stripos($query, 'AUTHLEVEL') != false && $user['authlevel'] < 3 && stripos($query, 'SELECT') !== 0: |
368 | - $report = "Hacking attempt (" . date("d.m.Y H:i:s") . " - [" . time() . "]):\n"; |
|
368 | + $report = "Hacking attempt (".date("d.m.Y H:i:s")." - [".time()."]):\n"; |
|
369 | 369 | $report .= ">Database Inforamation\n"; |
370 | - $report .= "\tID - " . $user['id'] . "\n"; |
|
371 | - $report .= "\tUser - " . $user['username'] . "\n"; |
|
372 | - $report .= "\tAuth level - " . $user['authlevel'] . "\n"; |
|
373 | - $report .= "\tAdmin Notes - " . $user['adminNotes'] . "\n"; |
|
374 | - $report .= "\tCurrent Planet - " . $user['current_planet'] . "\n"; |
|
375 | - $report .= "\tUser IP - " . $user['user_lastip'] . "\n"; |
|
376 | - $report .= "\tUser IP at Reg - " . $user['ip_at_reg'] . "\n"; |
|
377 | - $report .= "\tUser Agent- " . $_SERVER['HTTP_USER_AGENT'] . "\n"; |
|
378 | - $report .= "\tCurrent Page - " . $user['current_page'] . "\n"; |
|
379 | - $report .= "\tRegister Time - " . $user['register_time'] . "\n"; |
|
370 | + $report .= "\tID - ".$user['id']."\n"; |
|
371 | + $report .= "\tUser - ".$user['username']."\n"; |
|
372 | + $report .= "\tAuth level - ".$user['authlevel']."\n"; |
|
373 | + $report .= "\tAdmin Notes - ".$user['adminNotes']."\n"; |
|
374 | + $report .= "\tCurrent Planet - ".$user['current_planet']."\n"; |
|
375 | + $report .= "\tUser IP - ".$user['user_lastip']."\n"; |
|
376 | + $report .= "\tUser IP at Reg - ".$user['ip_at_reg']."\n"; |
|
377 | + $report .= "\tUser Agent- ".$_SERVER['HTTP_USER_AGENT']."\n"; |
|
378 | + $report .= "\tCurrent Page - ".$user['current_page']."\n"; |
|
379 | + $report .= "\tRegister Time - ".$user['register_time']."\n"; |
|
380 | 380 | $report .= "\n"; |
381 | 381 | |
382 | 382 | $report .= ">Query Information\n"; |
383 | - $report .= "\tQuery - " . $query . "\n"; |
|
383 | + $report .= "\tQuery - ".$query."\n"; |
|
384 | 384 | $report .= "\n"; |
385 | 385 | |
386 | 386 | $report .= ">\$_SERVER Information\n"; |
387 | - $report .= "\tIP - " . $_SERVER['REMOTE_ADDR'] . "\n"; |
|
388 | - $report .= "\tHost Name - " . $_SERVER['HTTP_HOST'] . "\n"; |
|
389 | - $report .= "\tUser Agent - " . $_SERVER['HTTP_USER_AGENT'] . "\n"; |
|
390 | - $report .= "\tRequest Method - " . $_SERVER['REQUEST_METHOD'] . "\n"; |
|
391 | - $report .= "\tCame From - " . $_SERVER['HTTP_REFERER'] . "\n"; |
|
392 | - $report .= "\tPage is - " . $_SERVER['SCRIPT_NAME'] . "\n"; |
|
393 | - $report .= "\tUses Port - " . $_SERVER['REMOTE_PORT'] . "\n"; |
|
394 | - $report .= "\tServer Protocol - " . $_SERVER['SERVER_PROTOCOL'] . "\n"; |
|
387 | + $report .= "\tIP - ".$_SERVER['REMOTE_ADDR']."\n"; |
|
388 | + $report .= "\tHost Name - ".$_SERVER['HTTP_HOST']."\n"; |
|
389 | + $report .= "\tUser Agent - ".$_SERVER['HTTP_USER_AGENT']."\n"; |
|
390 | + $report .= "\tRequest Method - ".$_SERVER['REQUEST_METHOD']."\n"; |
|
391 | + $report .= "\tCame From - ".$_SERVER['HTTP_REFERER']."\n"; |
|
392 | + $report .= "\tPage is - ".$_SERVER['SCRIPT_NAME']."\n"; |
|
393 | + $report .= "\tUses Port - ".$_SERVER['REMOTE_PORT']."\n"; |
|
394 | + $report .= "\tServer Protocol - ".$_SERVER['SERVER_PROTOCOL']."\n"; |
|
395 | 395 | |
396 | 396 | $report .= "\n--------------------------------------------------------------------------------------------------\n"; |
397 | 397 | |
398 | - $fp = fopen(SN_ROOT_PHYSICAL . 'badqrys.txt', 'a'); |
|
398 | + $fp = fopen(SN_ROOT_PHYSICAL.'badqrys.txt', 'a'); |
|
399 | 399 | fwrite($fp, $report); |
400 | 400 | fclose($fp); |
401 | 401 |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @return $this |
32 | 32 | */ |
33 | 33 | public function literal($value) { |
34 | - $this->literal = (string)$value; |
|
34 | + $this->literal = (string) $value; |
|
35 | 35 | |
36 | 36 | return $this; |
37 | 37 | } |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | $alias = $this->aliasFromField($functionName, $field); |
65 | 65 | } |
66 | 66 | |
67 | - $this->literal = strtoupper($functionName) . '(' . $this->quoteField($field) . ')'; |
|
67 | + $this->literal = strtoupper($functionName).'('.$this->quoteField($field).')'; |
|
68 | 68 | |
69 | 69 | if (self::SQL_LITERAL_ALIAS_NONE !== $alias && !empty($alias)) { |
70 | - $this->literal .= ' AS `' . $alias . '`'; |
|
70 | + $this->literal .= ' AS `'.$alias.'`'; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | return $this; |
@@ -124,10 +124,10 @@ discard block |
||
124 | 124 | $alias = $this->aliasFromField($functionName, $field); |
125 | 125 | } |
126 | 126 | |
127 | - $this->literal = $this->quoteField($field) . ' IS NULL'; |
|
127 | + $this->literal = $this->quoteField($field).' IS NULL'; |
|
128 | 128 | |
129 | 129 | if (!empty($alias)) { |
130 | - $this->literal .= ' AS `' . $alias . '`'; |
|
130 | + $this->literal .= ' AS `'.$alias.'`'; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | return $this; |
@@ -26,7 +26,7 @@ |
||
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
29 | - * @param mixed $value |
|
29 | + * @param string $value |
|
30 | 30 | * |
31 | 31 | * @return $this |
32 | 32 | */ |
@@ -15,13 +15,13 @@ |
||
15 | 15 | * @return string |
16 | 16 | */ |
17 | 17 | public static function quoteComment($comment) { |
18 | - if($comment == '') { |
|
18 | + if ($comment == '') { |
|
19 | 19 | return ''; |
20 | 20 | } |
21 | 21 | |
22 | - $comment = str_replace(array('/*', '*/'), '__',$comment); |
|
22 | + $comment = str_replace(array('/*', '*/'), '__', $comment); |
|
23 | 23 | |
24 | - return "\r\n/*" . $comment . "*/"; |
|
24 | + return "\r\n/*".$comment."*/"; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | } |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | $crystal += $destroyed * $unit_info[P_COST][RES_CRYSTAL] / 4; |
78 | 78 | } |
79 | 79 | |
80 | - $return['structures'] = $structures; // Structures left after attack |
|
81 | - $return['metal'] = floor($metal); // Metal scraps |
|
80 | + $return['structures'] = $structures; // Structures left after attack |
|
81 | + $return['metal'] = floor($metal); // Metal scraps |
|
82 | 82 | $return['crystal'] = floor($crystal); // Crystal scraps |
83 | 83 | |
84 | 84 | return $return; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | if (!empty($message)) { |
151 | - $message = classLocale::$lang['mip_defense_destroyed'] . $message . "{$classLocale['mip_recycled']}{$classLocale['Metal']}: {$attackResult['metal']}, {$classLocale['Crystal']}: {$attackResult['crystal']}<br>"; |
|
151 | + $message = classLocale::$lang['mip_defense_destroyed'].$message."{$classLocale['mip_recycled']}{$classLocale['Metal']}: {$attackResult['metal']}, {$classLocale['Crystal']}: {$attackResult['crystal']}<br>"; |
|
152 | 152 | |
153 | 153 | DBStaticPlanet::db_planet_set_by_id($target_planet_row['id'], "`metal` = `metal` + {$attackResult['metal']}, `crystal` = `crystal` + {$attackResult['crystal']}"); |
154 | 154 | } |
@@ -165,8 +165,8 @@ discard block |
||
165 | 165 | |
166 | 166 | empty($message) ? $message = classLocale::$lang['mip_no_defense'] : false; |
167 | 167 | |
168 | - DBStaticMessages::msg_send_simple_message($fleetRow['fleet_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, classLocale::$lang['mip_sender_amd'], classLocale::$lang['mip_subject_amd'], $message_vorlage . $message); |
|
169 | - DBStaticMessages::msg_send_simple_message($fleetRow['fleet_target_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, classLocale::$lang['mip_sender_amd'], classLocale::$lang['mip_subject_amd'], $message_vorlage . $message); |
|
168 | + DBStaticMessages::msg_send_simple_message($fleetRow['fleet_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, classLocale::$lang['mip_sender_amd'], classLocale::$lang['mip_subject_amd'], $message_vorlage.$message); |
|
169 | + DBStaticMessages::msg_send_simple_message($fleetRow['fleet_target_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, classLocale::$lang['mip_sender_amd'], classLocale::$lang['mip_subject_amd'], $message_vorlage.$message); |
|
170 | 170 | } |
171 | 171 | DBStaticFleetMissile::db_missile_delete($fleetRow); |
172 | 172 | } |
@@ -1,22 +1,22 @@ |
||
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 | |
7 | -if(!$user_can_send_mails) { |
|
7 | +if (!$user_can_send_mails) { |
|
8 | 8 | message(classLocale::$lang['Denied_access'], classLocale::$lang['Send_circular_mail']); |
9 | 9 | } |
10 | 10 | |
11 | 11 | $POST_text = sys_get_param_str('text'); |
12 | -if($POST_text) { |
|
13 | - message(classLocale::$lang['members_who_recived_message'] . DBStaticMessages::msg_ali_send($POST_text, classLocale::$lang['ali_adm_msg_subject'], sys_get_param_int('r')), classLocale::$lang['Circular_sended'], "alliance.php", ''); |
|
12 | +if ($POST_text) { |
|
13 | + message(classLocale::$lang['members_who_recived_message'].DBStaticMessages::msg_ali_send($POST_text, classLocale::$lang['ali_adm_msg_subject'], sys_get_param_int('r')), classLocale::$lang['Circular_sended'], "alliance.php", ''); |
|
14 | 14 | } |
15 | 15 | |
16 | -$r_list = "<option value=\"-1\">" . classLocale::$lang['All_players'] . "</option>"; |
|
17 | -if($ranks) { |
|
18 | - foreach($ranks as $id => $array) { |
|
19 | - $r_list .= "<option value=\"" . $id . "\">" . $array['name'] . "</option>"; |
|
16 | +$r_list = "<option value=\"-1\">".classLocale::$lang['All_players']."</option>"; |
|
17 | +if ($ranks) { |
|
18 | + foreach ($ranks as $id => $array) { |
|
19 | + $r_list .= "<option value=\"".$id."\">".$array['name']."</option>"; |
|
20 | 20 | } |
21 | 21 | } |
22 | 22 |
@@ -9,7 +9,7 @@ discard block |
||
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 | nws_mark_read($user); |
15 | 15 | $template = gettemplate('announce', true); |
@@ -21,41 +21,41 @@ discard block |
||
21 | 21 | $mode = sys_get_param_str('mode'); |
22 | 22 | |
23 | 23 | $announce = array(); |
24 | -if($user['authlevel'] >= 3) { |
|
25 | - if(!empty($text)) { |
|
24 | +if ($user['authlevel'] >= 3) { |
|
25 | + if (!empty($text)) { |
|
26 | 26 | $announce_time = strtotime($announce_time, SN_TIME_NOW); |
27 | 27 | $announce_time = $announce_time ? $announce_time : SN_TIME_NOW; |
28 | 28 | |
29 | - if($mode == 'edit') { |
|
29 | + if ($mode == 'edit') { |
|
30 | 30 | DBStaticNews::db_news_update_set($announce_time, $text, $detail_url, $announce_id); |
31 | 31 | DBStaticSurvey::db_survey_delete_by_id($announce_id); |
32 | 32 | } else { |
33 | 33 | DBStaticNews::db_news_insert_set($announce_time, $text, $detail_url, $user); |
34 | 34 | $announce_id = db_insert_id(); |
35 | 35 | } |
36 | - if(($survey_question = sys_get_param_str('survey_question')) && ($survey_answers = sys_get_param('survey_answers'))) { |
|
36 | + if (($survey_question = sys_get_param_str('survey_question')) && ($survey_answers = sys_get_param('survey_answers'))) { |
|
37 | 37 | $survey_answers = explode("\r\n", $survey_answers); |
38 | 38 | $survey_until = strtotime($survey_until = sys_get_param_str('survey_until'), SN_TIME_NOW); |
39 | 39 | $survey_until = date(FMT_DATE_TIME_SQL, $survey_until ? $survey_until : SN_TIME_NOW + PERIOD_DAY * 1); |
40 | 40 | DBStaticSurvey::db_survey_insert($announce_id, $survey_question, $survey_until); |
41 | 41 | $survey_id = db_insert_id(); |
42 | - foreach($survey_answers as $survey_answer) { |
|
42 | + foreach ($survey_answers as $survey_answer) { |
|
43 | 43 | $survey_answer = db_escape(trim($survey_answer)); |
44 | - if(empty($survey_answer)) { |
|
44 | + if (empty($survey_answer)) { |
|
45 | 45 | continue; |
46 | 46 | } |
47 | 47 | DBStaticSurveyAnswer::db_survey_answer_insert($survey_id, $survey_answer); |
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
51 | - if($announce_time <= SN_TIME_NOW) { |
|
52 | - if($announce_time > classSupernova::$config->var_news_last && $announce_time == SN_TIME_NOW) { |
|
51 | + if ($announce_time <= SN_TIME_NOW) { |
|
52 | + if ($announce_time > classSupernova::$config->var_news_last && $announce_time == SN_TIME_NOW) { |
|
53 | 53 | classSupernova::$config->db_saveItem('var_news_last', $announce_time); |
54 | 54 | } |
55 | 55 | |
56 | - if(sys_get_param_int('news_mass_mail')) { |
|
56 | + if (sys_get_param_int('news_mass_mail')) { |
|
57 | 57 | $lang_news_more = classLocale::$lang['news_more']; |
58 | - $text = sys_get_param('text') . ($detail_url ? " <a href=\"{$detail_url}\"><span class=\"positive\">{$lang_news_more}</span></a>" : ''); |
|
58 | + $text = sys_get_param('text').($detail_url ? " <a href=\"{$detail_url}\"><span class=\"positive\">{$lang_news_more}</span></a>" : ''); |
|
59 | 59 | DBStaticMessages::msgSendFromAdmin('*', classLocale::$lang['news_title'], $text); |
60 | 60 | } |
61 | 61 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | $survey_answers = ''; |
68 | - switch($mode) { |
|
68 | + switch ($mode) { |
|
69 | 69 | case 'del': |
70 | 70 | DBStaticNews::db_news_delete_by_id($announce_id); |
71 | 71 | $mode = ''; |
@@ -76,9 +76,9 @@ discard block |
||
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 |
||
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); |
@@ -470,6 +470,12 @@ |
||
470 | 470 | {$StartRec}, 25;"); |
471 | 471 | } |
472 | 472 | |
473 | + /** |
|
474 | + * @param integer $message_type |
|
475 | + * @param string $from |
|
476 | + * @param string $subject |
|
477 | + * @param string $text |
|
478 | + */ |
|
473 | 479 | public static function db_message_insert_all($message_type, $from, $subject, $text) { |
474 | 480 | return doquery($QryInsertMessage = 'INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) ' . |
475 | 481 | "SELECT `id`, 0, unix_timestamp(now()), {$message_type}, '{$from}', '{$subject}', '{$text}' FROM {{users}}"); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $owners = array(); |
115 | 115 | } else { |
116 | 116 | $insert_values = array(); |
117 | - $insert_template = "('%u'," . str_replace('%', '%%', " '{$sender}', '{$timestamp}', '{$message_type}', '{$from}', '{$subject}', '{$text}')"); |
|
117 | + $insert_template = "('%u',".str_replace('%', '%%', " '{$sender}', '{$timestamp}', '{$message_type}', '{$from}', '{$subject}', '{$text}')"); |
|
118 | 118 | |
119 | 119 | foreach ($owners as $owner) { |
120 | 120 | if ($user['id'] != $owner) { |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $sendList = array(); |
156 | 156 | $list = ''; |
157 | 157 | $query = DBStaticUser::db_user_list( |
158 | - "ally_id = '{$ally_id}'" . ($ally_rank_id >= 0 ? " AND ally_rank_id = {$ally_rank_id}" : ''), |
|
158 | + "ally_id = '{$ally_id}'".($ally_rank_id >= 0 ? " AND ally_rank_id = {$ally_rank_id}" : ''), |
|
159 | 159 | false, 'id, username'); |
160 | 160 | foreach ($query as $u) { |
161 | 161 | $sendList[] = $u['id']; |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $subject_unsafe = substr($subject_unsafe, strlen(classLocale::$lang['msg_answer_prefix'])); |
247 | 247 | $re++; |
248 | 248 | } |
249 | - $re ? $subject_unsafe = classLocale::$lang['msg_answer_prefix'] . $subject_unsafe : false; |
|
249 | + $re ? $subject_unsafe = classLocale::$lang['msg_answer_prefix'].$subject_unsafe : false; |
|
250 | 250 | |
251 | 251 | $subject_unsafe = $subject_unsafe ? $subject_unsafe : classLocale::$lang['msg_subject_default']; |
252 | 252 | |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | return doquery( |
416 | 416 | "SELECT * FROM {{messages}} |
417 | 417 | WHERE |
418 | - `message_type` = '" . MSG_TYPE_PLAYER . "' AND |
|
418 | + `message_type` = '" . MSG_TYPE_PLAYER."' AND |
|
419 | 419 | ((`message_owner` = '{$user['id']}' AND `message_sender` = '{$recipient_id}') |
420 | 420 | OR |
421 | 421 | (`message_sender` = '{$user['id']}' AND `message_owner` = '{$recipient_id}')) ORDER BY `message_time` DESC LIMIT 20;"); |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | FROM |
464 | 464 | {{messages}} AS m |
465 | 465 | LEFT JOIN {{users}} AS u ON u.id = m.message_owner " . |
466 | - ($int_type_selected >= 0 ? "WHERE `message_type` = {$int_type_selected} " : '') . |
|
466 | + ($int_type_selected >= 0 ? "WHERE `message_type` = {$int_type_selected} " : ''). |
|
467 | 467 | "ORDER BY |
468 | 468 | `message_id` DESC |
469 | 469 | LIMIT |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | } |
472 | 472 | |
473 | 473 | public static function db_message_insert_all($message_type, $from, $subject, $text) { |
474 | - return doquery($QryInsertMessage = 'INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) ' . |
|
474 | + return doquery($QryInsertMessage = 'INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) '. |
|
475 | 475 | "SELECT `id`, 0, unix_timestamp(now()), {$message_type}, '{$from}', '{$subject}', '{$text}' FROM {{users}}"); |
476 | 476 | } |
477 | 477 | |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | * @return array|bool|mysqli_result|null |
482 | 482 | */ |
483 | 483 | public static function db_message_count_by_type($int_type_selected) { |
484 | - $page_max = doquery('SELECT COUNT(*) AS `max` FROM {{messages}}' . ($int_type_selected >= 0 ? " WHERE `message_type` = {$int_type_selected};" : ''), true); |
|
484 | + $page_max = doquery('SELECT COUNT(*) AS `max` FROM {{messages}}'.($int_type_selected >= 0 ? " WHERE `message_type` = {$int_type_selected};" : ''), true); |
|
485 | 485 | |
486 | 486 | return $page_max; |
487 | 487 | } |
@@ -498,15 +498,15 @@ discard block |
||
498 | 498 | * @param $int_type_selected |
499 | 499 | */ |
500 | 500 | public static function db_message_list_delete_by_date($delete_date, $int_type_selected) { |
501 | - doquery("DELETE FROM {{messages}} WHERE message_time <= UNIX_TIMESTAMP('{$delete_date}')" . ($int_type_selected >= 0 ? " AND `message_type` = {$int_type_selected}" : '')); |
|
501 | + doquery("DELETE FROM {{messages}} WHERE message_time <= UNIX_TIMESTAMP('{$delete_date}')".($int_type_selected >= 0 ? " AND `message_type` = {$int_type_selected}" : '')); |
|
502 | 502 | } |
503 | 503 | |
504 | 504 | /** |
505 | 505 | * @param $insert_values |
506 | 506 | */ |
507 | 507 | public static function db_message_insert($insert_values) { |
508 | - doquery('INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) ' . |
|
509 | - 'VALUES ' . implode(',', $insert_values)); |
|
508 | + doquery('INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) '. |
|
509 | + 'VALUES '.implode(',', $insert_values)); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | } |