@@ -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 | |
@@ -219,13 +219,13 @@ discard block |
||
219 | 219 | ->execute() |
220 | 220 | ->getResult(); |
221 | 221 | } else { |
222 | - $queryResult = $this->db_sql_query($stringQuery . DbSqlHelper::quoteComment($queryTrace)); |
|
222 | + $queryResult = $this->db_sql_query($stringQuery.DbSqlHelper::quoteComment($queryTrace)); |
|
223 | 223 | } |
224 | 224 | if (!$queryResult) { |
225 | 225 | throw new Exception(); |
226 | 226 | } |
227 | 227 | } catch (Exception $e) { |
228 | - classSupernova::$debug->error($this->db_error() . "<br />{$query}<br />", 'SQL Error'); |
|
228 | + classSupernova::$debug->error($this->db_error()."<br />{$query}<br />", 'SQL Error'); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | if ($fetch) { |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | ->execute() |
273 | 273 | ->getIterator(); |
274 | 274 | } else { |
275 | - $queryResult = $this->db_sql_query($stringQuery . DbSqlHelper::quoteComment($queryTrace)); |
|
275 | + $queryResult = $this->db_sql_query($stringQuery.DbSqlHelper::quoteComment($queryTrace)); |
|
276 | 276 | |
277 | 277 | if (!$queryResult) { |
278 | 278 | throw new Exception(); |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | } |
286 | 286 | } |
287 | 287 | } catch (Exception $e) { |
288 | - classSupernova::$debug->error($this->db_error() . "<br />{$query}<br />", 'SQL Error'); |
|
288 | + classSupernova::$debug->error($this->db_error()."<br />{$query}<br />", 'SQL Error'); |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | return $result; |
@@ -354,10 +354,10 @@ discard block |
||
354 | 354 | $this->isWatching = true; |
355 | 355 | $msg = "\$query = \"{$query}\"\n\r"; |
356 | 356 | if (!empty($_POST)) { |
357 | - $msg .= "\n\r" . dump($_POST, '$_POST'); |
|
357 | + $msg .= "\n\r".dump($_POST, '$_POST'); |
|
358 | 358 | } |
359 | 359 | if (!empty($_GET)) { |
360 | - $msg .= "\n\r" . dump($_GET, '$_GET'); |
|
360 | + $msg .= "\n\r".dump($_GET, '$_GET'); |
|
361 | 361 | } |
362 | 362 | classSupernova::$debug->warning($msg, "Watching user {$user['id']}", 399, array('base_dump' => true)); |
363 | 363 | $this->isWatching = false; |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | |
373 | 373 | global $user, $dm_change_legit, $mm_change_legit; |
374 | 374 | |
375 | - switch(true) { |
|
375 | + switch (true) { |
|
376 | 376 | case stripos($query, 'RUNCATE TABL') != false: |
377 | 377 | case stripos($query, 'ROP TABL') != false: |
378 | 378 | case stripos($query, 'ENAME TABL') != false: |
@@ -383,37 +383,37 @@ discard block |
||
383 | 383 | case stripos($query, 'RPG_POINTS') != false && stripos(trim($query), 'UPDATE ') === 0 && !$dm_change_legit: |
384 | 384 | case stripos($query, 'METAMATTER') != false && stripos(trim($query), 'UPDATE ') === 0 && !$mm_change_legit: |
385 | 385 | case stripos($query, 'AUTHLEVEL') != false && $user['authlevel'] < 3 && stripos($query, 'SELECT') !== 0: |
386 | - $report = "Hacking attempt (" . date("d.m.Y H:i:s") . " - [" . time() . "]):\n"; |
|
386 | + $report = "Hacking attempt (".date("d.m.Y H:i:s")." - [".time()."]):\n"; |
|
387 | 387 | $report .= ">Database Inforamation\n"; |
388 | - $report .= "\tID - " . $user['id'] . "\n"; |
|
389 | - $report .= "\tUser - " . $user['username'] . "\n"; |
|
390 | - $report .= "\tAuth level - " . $user['authlevel'] . "\n"; |
|
391 | - $report .= "\tAdmin Notes - " . $user['adminNotes'] . "\n"; |
|
392 | - $report .= "\tCurrent Planet - " . $user['current_planet'] . "\n"; |
|
393 | - $report .= "\tUser IP - " . $user['user_lastip'] . "\n"; |
|
394 | - $report .= "\tUser IP at Reg - " . $user['ip_at_reg'] . "\n"; |
|
395 | - $report .= "\tUser Agent- " . $_SERVER['HTTP_USER_AGENT'] . "\n"; |
|
396 | - $report .= "\tCurrent Page - " . $user['current_page'] . "\n"; |
|
397 | - $report .= "\tRegister Time - " . $user['register_time'] . "\n"; |
|
388 | + $report .= "\tID - ".$user['id']."\n"; |
|
389 | + $report .= "\tUser - ".$user['username']."\n"; |
|
390 | + $report .= "\tAuth level - ".$user['authlevel']."\n"; |
|
391 | + $report .= "\tAdmin Notes - ".$user['adminNotes']."\n"; |
|
392 | + $report .= "\tCurrent Planet - ".$user['current_planet']."\n"; |
|
393 | + $report .= "\tUser IP - ".$user['user_lastip']."\n"; |
|
394 | + $report .= "\tUser IP at Reg - ".$user['ip_at_reg']."\n"; |
|
395 | + $report .= "\tUser Agent- ".$_SERVER['HTTP_USER_AGENT']."\n"; |
|
396 | + $report .= "\tCurrent Page - ".$user['current_page']."\n"; |
|
397 | + $report .= "\tRegister Time - ".$user['register_time']."\n"; |
|
398 | 398 | $report .= "\n"; |
399 | 399 | |
400 | 400 | $report .= ">Query Information\n"; |
401 | - $report .= "\tQuery - " . $query . "\n"; |
|
401 | + $report .= "\tQuery - ".$query."\n"; |
|
402 | 402 | $report .= "\n"; |
403 | 403 | |
404 | 404 | $report .= ">\$_SERVER Information\n"; |
405 | - $report .= "\tIP - " . $_SERVER['REMOTE_ADDR'] . "\n"; |
|
406 | - $report .= "\tHost Name - " . $_SERVER['HTTP_HOST'] . "\n"; |
|
407 | - $report .= "\tUser Agent - " . $_SERVER['HTTP_USER_AGENT'] . "\n"; |
|
408 | - $report .= "\tRequest Method - " . $_SERVER['REQUEST_METHOD'] . "\n"; |
|
409 | - $report .= "\tCame From - " . $_SERVER['HTTP_REFERER'] . "\n"; |
|
410 | - $report .= "\tPage is - " . $_SERVER['SCRIPT_NAME'] . "\n"; |
|
411 | - $report .= "\tUses Port - " . $_SERVER['REMOTE_PORT'] . "\n"; |
|
412 | - $report .= "\tServer Protocol - " . $_SERVER['SERVER_PROTOCOL'] . "\n"; |
|
405 | + $report .= "\tIP - ".$_SERVER['REMOTE_ADDR']."\n"; |
|
406 | + $report .= "\tHost Name - ".$_SERVER['HTTP_HOST']."\n"; |
|
407 | + $report .= "\tUser Agent - ".$_SERVER['HTTP_USER_AGENT']."\n"; |
|
408 | + $report .= "\tRequest Method - ".$_SERVER['REQUEST_METHOD']."\n"; |
|
409 | + $report .= "\tCame From - ".$_SERVER['HTTP_REFERER']."\n"; |
|
410 | + $report .= "\tPage is - ".$_SERVER['SCRIPT_NAME']."\n"; |
|
411 | + $report .= "\tUses Port - ".$_SERVER['REMOTE_PORT']."\n"; |
|
412 | + $report .= "\tServer Protocol - ".$_SERVER['SERVER_PROTOCOL']."\n"; |
|
413 | 413 | |
414 | 414 | $report .= "\n--------------------------------------------------------------------------------------------------\n"; |
415 | 415 | |
416 | - $fp = fopen(SN_ROOT_PHYSICAL . 'badqrys.txt', 'a'); |
|
416 | + $fp = fopen(SN_ROOT_PHYSICAL.'badqrys.txt', 'a'); |
|
417 | 417 | fwrite($fp, $report); |
418 | 418 | fclose($fp); |
419 | 419 | |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | $prefix_length = strlen($this->db_prefix); |
435 | 435 | |
436 | 436 | $tl = array(); |
437 | - while($row = $this->db_fetch($query)) { |
|
437 | + while ($row = $this->db_fetch($query)) { |
|
438 | 438 | foreach ($row as $table_name) { |
439 | 439 | if (strpos($table_name, $this->db_prefix) === 0) { |
440 | 440 | $table_name = substr($table_name, $prefix_length); |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | if (is_bool($query)) { |
566 | 566 | throw new Exception('Result of SHOW STATUS command is boolean - which should never happen. Connection to DB is lost?'); |
567 | 567 | } |
568 | - while($row = db_fetch($query)) { |
|
568 | + while ($row = db_fetch($query)) { |
|
569 | 569 | $result[$row['Variable_name']] = $row['Value']; |
570 | 570 | } |
571 | 571 |
@@ -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 | } |
@@ -131,6 +131,9 @@ discard block |
||
131 | 131 | ); |
132 | 132 | } |
133 | 133 | |
134 | + /** |
|
135 | + * @param integer $config_user_birthday_range |
|
136 | + */ |
|
134 | 137 | public static function db_user_list_to_celebrate($config_user_birthday_range) { |
135 | 138 | // $query = "SELECT |
136 | 139 | // `id`, `username`, `user_birthday`, `user_birthday_celebrated`, |
@@ -208,6 +211,9 @@ discard block |
||
208 | 211 | } |
209 | 212 | |
210 | 213 | |
214 | + /** |
|
215 | + * @param string $username_unsafe |
|
216 | + */ |
|
211 | 217 | public static function db_user_by_username($username_unsafe, $for_update = false, $fields = '*', $player = null, $like = false) { |
212 | 218 | return classSupernova::db_get_user_by_username($username_unsafe, $for_update, $fields, $player, $like); |
213 | 219 | } |
@@ -220,6 +226,9 @@ discard block |
||
220 | 226 | return classSupernova::db_upd_record_by_id(LOC_USER, $user_id, $set); |
221 | 227 | } |
222 | 228 | |
229 | + /** |
|
230 | + * @param boolean $player |
|
231 | + */ |
|
223 | 232 | public static function db_user_by_id($user_id_unsafe, $for_update = false, $fields = '*', $player = null) { |
224 | 233 | return classSupernova::db_get_user_by_id($user_id_unsafe, $for_update, $fields, $player); |
225 | 234 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | ->orderBy(array('`id` DESC')) |
33 | 33 | ->setFetchOne(); |
34 | 34 | |
35 | - return (string)static::$dbStatic->selectValue($query); |
|
35 | + return (string) static::$dbStatic->selectValue($query); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | protected static function whereNotAlly() { |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | static::buildSelect() |
62 | 62 | ->field('id') |
63 | 63 | ->where("`user_as_ally` IS NULL") |
64 | - ->where("`user_bot` = " . USER_BOT_PLAYER) |
|
64 | + ->where("`user_bot` = ".USER_BOT_PLAYER) |
|
65 | 65 | ->setForUpdate(); |
66 | 66 | |
67 | 67 | return static::selectIterator($query); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | } |
220 | 220 | |
221 | 221 | public static function db_user_list_set_mass_mail(&$owners_list, $set) { |
222 | - return classSupernova::db_upd_record_list(LOC_USER, !empty($owners_list) ? '`id` IN (' . implode(',', $owners_list) . ');' : '', $set); |
|
222 | + return classSupernova::db_upd_record_list(LOC_USER, !empty($owners_list) ? '`id` IN ('.implode(',', $owners_list).');' : '', $set); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | public static function db_user_list_set_by_ally_and_rank($ally_id, $ally_rank_id, $set) { |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | $language_new = sys_get_param_str('langer', $user['lang']); |
14 | 14 | |
15 | - if($language_new != $user['lang']) { |
|
15 | + if ($language_new != $user['lang']) { |
|
16 | 16 | classLocale::$lang->lng_switch($language_new); |
17 | 17 | } |
18 | 18 | |
@@ -21,41 +21,41 @@ discard block |
||
21 | 21 | |
22 | 22 | $FMT_DATE = preg_replace(array('/d/', '/m/', '/Y/'), array('DD', 'MM', 'YYYY'), FMT_DATE); |
23 | 23 | |
24 | - if(sys_get_param_str('mode') == 'change') { |
|
25 | - if($user['authlevel'] > 0) { |
|
24 | + if (sys_get_param_str('mode') == 'change') { |
|
25 | + if ($user['authlevel'] > 0) { |
|
26 | 26 | $planet_protection = sys_get_param_int('adm_pl_prot') ? $user['authlevel'] : 0; |
27 | 27 | DBStaticPlanet::db_planet_set_by_owner($user['id'], "`id_level` = '{$planet_protection}'"); |
28 | 28 | DBStaticUser::db_user_set_by_id($user['id'], "`admin_protection` = '{$planet_protection}'"); |
29 | 29 | $user['admin_protection'] = $planet_protection; |
30 | 30 | } |
31 | 31 | |
32 | - if(sys_get_param_int('vacation') && !classSupernova::$config->user_vacation_disable) { |
|
32 | + if (sys_get_param_int('vacation') && !classSupernova::$config->user_vacation_disable) { |
|
33 | 33 | sn_db_transaction_start(); |
34 | - if($user['authlevel'] < 3) { |
|
35 | - if($user['vacation_next'] > SN_TIME_NOW) { |
|
34 | + if ($user['authlevel'] < 3) { |
|
35 | + if ($user['vacation_next'] > SN_TIME_NOW) { |
|
36 | 36 | message(classLocale::$lang['opt_vacation_err_timeout'], classLocale::$lang['Error'], 'index.php?page=options', 5); |
37 | 37 | die(); |
38 | 38 | } |
39 | 39 | |
40 | - if(FleetList::fleet_count_flying($user['id'])) { |
|
40 | + if (FleetList::fleet_count_flying($user['id'])) { |
|
41 | 41 | message(classLocale::$lang['opt_vacation_err_your_fleet'], classLocale::$lang['Error'], 'index.php?page=options', 5); |
42 | 42 | die(); |
43 | 43 | } |
44 | 44 | |
45 | 45 | $que = que_get($user['id'], false); |
46 | - if(!empty($que)) { |
|
46 | + if (!empty($que)) { |
|
47 | 47 | message(classLocale::$lang['opt_vacation_err_que'], classLocale::$lang['Error'], 'index.php?page=options', 5); |
48 | 48 | die(); |
49 | 49 | } |
50 | 50 | |
51 | 51 | $query = classSupernova::db_get_record_list(LOC_PLANET, "`id_owner` = {$user['id']}"); |
52 | - foreach($query as $planet) { |
|
52 | + foreach ($query as $planet) { |
|
53 | 53 | // $planet = sys_o_get_updated($user, $planet, SN_TIME_NOW); |
54 | 54 | // $planet = $planet['planet']; |
55 | 55 | |
56 | 56 | $classConfig = classSupernova::$config; |
57 | 57 | DBStaticPlanet::db_planet_set_by_id($planet['id'], |
58 | - "last_update = " . SN_TIME_NOW . ", energy_used = '0', energy_max = '0', |
|
58 | + "last_update = ".SN_TIME_NOW.", energy_used = '0', energy_max = '0', |
|
59 | 59 | metal_perhour = '{$classConfig->metal_basic_income}', crystal_perhour = '{$classConfig->crystal_basic_income}', deuterium_perhour = '{$classConfig->deuterium_basic_income}', |
60 | 60 | metal_mine_porcent = '0', crystal_mine_porcent = '0', deuterium_sintetizer_porcent = '0', solar_plant_porcent = '0', |
61 | 61 | fusion_plant_porcent = '0', solar_satelit_porcent = '0', ship_sattelite_sloth_porcent = 0" |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | sn_db_transaction_commit(); |
69 | 69 | } |
70 | 70 | |
71 | - foreach($user_option_list as $option_group_id => $option_group) { |
|
72 | - foreach($option_group as $option_name => $option_value) { |
|
73 | - if($user[$option_name] !== null) { |
|
71 | + foreach ($user_option_list as $option_group_id => $option_group) { |
|
72 | + foreach ($option_group as $option_name => $option_value) { |
|
73 | + if ($user[$option_name] !== null) { |
|
74 | 74 | $user[$option_name] = sys_get_param_str($option_name); |
75 | 75 | } else { |
76 | 76 | $user[$option_name] = $option_value; |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | |
82 | 82 | |
83 | 83 | $player_options = sys_get_param('options'); |
84 | - if(!empty($player_options)) { |
|
85 | - array_walk($player_options, function (&$value) { |
|
84 | + if (!empty($player_options)) { |
|
85 | + array_walk($player_options, function(&$value) { |
|
86 | 86 | // TODO - Когда будет больше параметров - сделать больше проверок |
87 | 87 | $value = intval($value); |
88 | 88 | }); |
@@ -93,15 +93,15 @@ discard block |
||
93 | 93 | |
94 | 94 | $username = substr(sys_get_param_str_unsafe('username'), 0, 32); |
95 | 95 | $username_safe = db_escape($username); |
96 | - if($username && $user['username'] != $username && classSupernova::$config->game_user_changename != SERVER_PLAYER_NAME_CHANGE_NONE && sys_get_param_int('username_confirm') && !strpbrk($username, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) { |
|
96 | + if ($username && $user['username'] != $username && classSupernova::$config->game_user_changename != SERVER_PLAYER_NAME_CHANGE_NONE && sys_get_param_int('username_confirm') && !strpbrk($username, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) { |
|
97 | 97 | // проверка на корректность |
98 | 98 | sn_db_transaction_start(); |
99 | 99 | $name_check = db_player_name_history_get_name_by_name($username_safe); |
100 | - if(!$name_check || $name_check['player_id'] == $user['id']) { |
|
100 | + if (!$name_check || $name_check['player_id'] == $user['id']) { |
|
101 | 101 | $user = DBStaticUser::db_user_by_id($user['id'], true); |
102 | - switch(classSupernova::$config->game_user_changename) { |
|
102 | + switch (classSupernova::$config->game_user_changename) { |
|
103 | 103 | case SERVER_PLAYER_NAME_CHANGE_PAY: |
104 | - if(mrc_get_level($user, $planetrow, RES_DARK_MATTER) < classSupernova::$config->game_user_changename_cost) { |
|
104 | + if (mrc_get_level($user, $planetrow, RES_DARK_MATTER) < classSupernova::$config->game_user_changename_cost) { |
|
105 | 105 | $template_result['.']['result'][] = array( |
106 | 106 | 'STATUS' => ERR_ERROR, |
107 | 107 | 'MESSAGE' => classLocale::$lang['opt_msg_name_change_err_no_dm'], |
@@ -131,18 +131,18 @@ discard block |
||
131 | 131 | sn_db_transaction_commit(); |
132 | 132 | } |
133 | 133 | |
134 | - if($new_password = sys_get_param('newpass1')) { |
|
134 | + if ($new_password = sys_get_param('newpass1')) { |
|
135 | 135 | try { |
136 | - if($new_password != sys_get_param('newpass2')) { |
|
136 | + if ($new_password != sys_get_param('newpass2')) { |
|
137 | 137 | throw new Exception(classLocale::$lang['opt_err_pass_unmatched'], ERR_WARNING); |
138 | 138 | } |
139 | 139 | |
140 | - if(!classSupernova::$auth->password_change(sys_get_param('db_password'), $new_password)) { |
|
140 | + if (!classSupernova::$auth->password_change(sys_get_param('db_password'), $new_password)) { |
|
141 | 141 | throw new Exception(classLocale::$lang['opt_err_pass_wrong'], ERR_WARNING); |
142 | 142 | } |
143 | 143 | |
144 | 144 | throw new Exception(classLocale::$lang['opt_msg_pass_changed'], ERR_NONE); |
145 | - } catch(Exception $e) { |
|
145 | + } catch (Exception $e) { |
|
146 | 146 | $template_result['.']['result'][] = array( |
147 | 147 | 'STATUS' => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR, |
148 | 148 | 'MESSAGE' => $e->getMessage() |
@@ -164,12 +164,12 @@ discard block |
||
164 | 164 | $user['gender'] = $user['gender'] == GENDER_UNKNOWN ? $gender : $user['gender']; |
165 | 165 | |
166 | 166 | try { |
167 | - if($user['birthday']) { |
|
167 | + if ($user['birthday']) { |
|
168 | 168 | throw new exception(); |
169 | 169 | } |
170 | 170 | |
171 | 171 | $user_birthday = sys_get_param_str_unsafe('user_birthday'); |
172 | - if(!$user_birthday || $user_birthday == $FMT_DATE) { |
|
172 | + if (!$user_birthday || $user_birthday == $FMT_DATE) { |
|
173 | 173 | throw new exception(); |
174 | 174 | } |
175 | 175 | |
@@ -179,16 +179,16 @@ discard block |
||
179 | 179 | $pos['Y'] = strpos(FMT_DATE, 'Y'); |
180 | 180 | asort($pos); |
181 | 181 | $i = 0; |
182 | - foreach($pos as &$position) { |
|
182 | + foreach ($pos as &$position) { |
|
183 | 183 | $position = ++$i; |
184 | 184 | } |
185 | 185 | |
186 | - $regexp = "/" . preg_replace(array('/\\\\/', '/\//', '/\./', '/\-/', '/d/', '/m/', '/Y/'), array('\\\\\\', '\/', '\.', '\-', '(\d?\d)', '(\d?\d)', '(\d{4})'), FMT_DATE) . "/"; |
|
187 | - if(!preg_match($regexp, $user_birthday, $match)) { |
|
186 | + $regexp = "/".preg_replace(array('/\\\\/', '/\//', '/\./', '/\-/', '/d/', '/m/', '/Y/'), array('\\\\\\', '\/', '\.', '\-', '(\d?\d)', '(\d?\d)', '(\d{4})'), FMT_DATE)."/"; |
|
187 | + if (!preg_match($regexp, $user_birthday, $match)) { |
|
188 | 188 | throw new exception(); |
189 | 189 | } |
190 | 190 | |
191 | - if(!checkdate($match[$pos['m']], $match[$pos['d']], $match[$pos['Y']])) { |
|
191 | + if (!checkdate($match[$pos['m']], $match[$pos['d']], $match[$pos['Y']])) { |
|
192 | 192 | throw new exception(); |
193 | 193 | } |
194 | 194 | |
@@ -196,13 +196,13 @@ discard block |
||
196 | 196 | // EOF black magic! Now we have valid SQL date in $user['user_birthday'] - independent of date format |
197 | 197 | |
198 | 198 | $year = date('Y', SN_TIME_NOW); |
199 | - if(mktime(0, 0, 0, $match[$pos['m']], $match[$pos['d']], $year) > SN_TIME_NOW) { |
|
199 | + if (mktime(0, 0, 0, $match[$pos['m']], $match[$pos['d']], $year) > SN_TIME_NOW) { |
|
200 | 200 | $year--; |
201 | 201 | } |
202 | 202 | $user['user_birthday_celebrated'] = db_escape("{$year}-{$match[$pos['m']]}-{$match[$pos['d']]}"); |
203 | 203 | |
204 | 204 | $user_birthday = ", `user_birthday` = '{$user['user_birthday']}', `user_birthday_celebrated` = '{$user['user_birthday_celebrated']}'"; |
205 | - } catch(exception $e) { |
|
205 | + } catch (exception $e) { |
|
206 | 206 | $user_birthday = ''; |
207 | 207 | } |
208 | 208 | |
@@ -212,14 +212,14 @@ discard block |
||
212 | 212 | $template_result['.']['result'][] = $avatar_upload_result; |
213 | 213 | |
214 | 214 | $user_time_diff = playerTimeDiff::user_time_diff_get(); |
215 | - if(sys_get_param_int('PLAYER_OPTION_TIME_DIFF_FORCED')) { |
|
215 | + if (sys_get_param_int('PLAYER_OPTION_TIME_DIFF_FORCED')) { |
|
216 | 216 | playerTimeDiff::user_time_diff_set(array( |
217 | 217 | PLAYER_OPTION_TIME_DIFF => sys_get_param_int('PLAYER_OPTION_TIME_DIFF'), |
218 | 218 | PLAYER_OPTION_TIME_DIFF_UTC_OFFSET => 0, |
219 | 219 | PLAYER_OPTION_TIME_DIFF_FORCED => 1, |
220 | 220 | PLAYER_OPTION_TIME_DIFF_MEASURE_TIME => SN_TIME_SQL, |
221 | 221 | )); |
222 | - } elseif(sys_get_param_int('opt_time_diff_clear') || $user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) { |
|
222 | + } elseif (sys_get_param_int('opt_time_diff_clear') || $user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) { |
|
223 | 223 | playerTimeDiff::user_time_diff_set(array( |
224 | 224 | PLAYER_OPTION_TIME_DIFF => '', |
225 | 225 | PLAYER_OPTION_TIME_DIFF_UTC_OFFSET => 0, |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | 'STATUS' => ERR_NONE, |
240 | 240 | 'MESSAGE' => classLocale::$lang['opt_msg_saved'] |
241 | 241 | ); |
242 | - } elseif(sys_get_param_str('result') == 'ok') { |
|
242 | + } elseif (sys_get_param_str('result') == 'ok') { |
|
243 | 243 | $template_result['.']['result'][] = array( |
244 | 244 | 'STATUS' => ERR_NONE, |
245 | 245 | 'MESSAGE' => classLocale::$lang['opt_msg_saved'] |
@@ -262,9 +262,9 @@ discard block |
||
262 | 262 | |
263 | 263 | $template = gettemplate('options', $template); |
264 | 264 | |
265 | - $dir = dir(SN_ROOT_PHYSICAL . 'skins'); |
|
266 | - while(($entry = $dir->read()) !== false) { |
|
267 | - if(is_dir("skins/{$entry}") && $entry[0] != '.') { |
|
265 | + $dir = dir(SN_ROOT_PHYSICAL.'skins'); |
|
266 | + while (($entry = $dir->read()) !== false) { |
|
267 | + if (is_dir("skins/{$entry}") && $entry[0] != '.') { |
|
268 | 268 | $template_result['.']['skin_list'][] = array( |
269 | 269 | 'VALUE' => $entry, |
270 | 270 | 'NAME' => $entry, |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | } |
275 | 275 | $dir->close(); |
276 | 276 | |
277 | - foreach(classLocale::$lang['opt_planet_sort_options'] as $key => &$value) { |
|
277 | + foreach (classLocale::$lang['opt_planet_sort_options'] as $key => &$value) { |
|
278 | 278 | $template_result['.']['planet_sort_options'][] = array( |
279 | 279 | 'VALUE' => $key, |
280 | 280 | 'NAME' => $value, |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | ); |
283 | 283 | } |
284 | 284 | |
285 | - foreach(classLocale::$lang['sys_gender_list'] as $key => $value) { |
|
285 | + foreach (classLocale::$lang['sys_gender_list'] as $key => $value) { |
|
286 | 286 | $template_result['.']['gender_list'][] = array( |
287 | 287 | 'VALUE' => $key, |
288 | 288 | 'NAME' => $value, |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | } |
292 | 292 | |
293 | 293 | $lang_list = lng_get_list(); |
294 | - foreach($lang_list as $lang_id => $lang_data) { |
|
294 | + foreach ($lang_list as $lang_id => $lang_data) { |
|
295 | 295 | $template_result['.']['languages'][] = array( |
296 | 296 | 'VALUE' => $lang_id, |
297 | 297 | 'NAME' => $lang_data['LANG_NAME_NATIVE'], |
@@ -300,8 +300,8 @@ discard block |
||
300 | 300 | } |
301 | 301 | |
302 | 302 | |
303 | - if(isset(classLocale::$lang['menu_customize_show_hide_button_state'])) { |
|
304 | - foreach(classLocale::$lang['menu_customize_show_hide_button_state'] as $key => $value) { |
|
303 | + if (isset(classLocale::$lang['menu_customize_show_hide_button_state'])) { |
|
304 | + foreach (classLocale::$lang['menu_customize_show_hide_button_state'] as $key => $value) { |
|
305 | 305 | $template->assign_block_vars('menu_customize_show_hide_button_state', array( |
306 | 306 | 'ID' => $key, |
307 | 307 | 'NAME' => $value, |
@@ -408,10 +408,10 @@ discard block |
||
408 | 408 | 'PAGE_HEADER' => classLocale::$lang['opt_header'], |
409 | 409 | )); |
410 | 410 | |
411 | - foreach($user_option_list as $option_group_id => $option_group) { |
|
412 | - if($option_group_id == OPT_MESSAGE) { |
|
413 | - foreach(DBStaticMessages::$snMessageClassList as $message_class_id => $message_class_data) { |
|
414 | - if($message_class_data['switchable'] || ($message_class_data['email'] && classSupernova::$config->game_email_pm)) { |
|
411 | + foreach ($user_option_list as $option_group_id => $option_group) { |
|
412 | + if ($option_group_id == OPT_MESSAGE) { |
|
413 | + foreach (DBStaticMessages::$snMessageClassList as $message_class_id => $message_class_data) { |
|
414 | + if ($message_class_data['switchable'] || ($message_class_data['email'] && classSupernova::$config->game_email_pm)) { |
|
415 | 415 | $option_name = $message_class_data['name']; |
416 | 416 | |
417 | 417 | $template->assign_block_vars("options_{$option_group_id}", array( |
@@ -423,8 +423,8 @@ discard block |
||
423 | 423 | } |
424 | 424 | } |
425 | 425 | } else { |
426 | - foreach($option_group as $option_name => $option_value) { |
|
427 | - if(array_key_exists($option_name, $user_option_types)) { |
|
426 | + foreach ($option_group as $option_name => $option_value) { |
|
427 | + if (array_key_exists($option_name, $user_option_types)) { |
|
428 | 428 | $option_type = $user_option_types[$option_name]; |
429 | 429 | } else { |
430 | 430 | $option_type = 'switch'; |