Completed
Push — work-fleets ( 6bf235...9b7cc1 )
by SuperNova.WS
07:25
created
includes/db/db_helpers.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,19 +27,19 @@
 block discarded – undo
27 27
  */
28 28
 function db_set_make_safe_string($set, $delta = false) {
29 29
   $set_safe = array();
30
-  foreach($set as $field => $value) {
31
-    if(empty($field)) {
30
+  foreach ($set as $field => $value) {
31
+    if (empty($field)) {
32 32
       continue;
33 33
     }
34 34
 
35
-    $field = '`' . db_escape($field) . '`';
35
+    $field = '`'.db_escape($field).'`';
36 36
     $new_value = $value;
37
-    if($value === null) {
37
+    if ($value === null) {
38 38
       $new_value = 'NULL';
39
-    } elseif(is_string($value) && (string)($new_value = floatval($value)) != (string)$value) {
39
+    } elseif (is_string($value) && (string) ($new_value = floatval($value)) != (string) $value) {
40 40
       // non-float
41
-      $new_value = '"' . db_escape($value) . '"';
42
-    } elseif($delta) {
41
+      $new_value = '"'.db_escape($value).'"';
42
+    } elseif ($delta) {
43 43
       // float and DELTA-set
44 44
       $new_value = "{$field} + ({$new_value})";
45 45
     }
Please login to merge, or discard this patch.
includes/init_secondary.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -2,19 +2,19 @@  discard block
 block discarded – undo
2 2
 
3 3
 $classLocale = classLocale::$lang;
4 4
 
5
-if(classSupernova::$config->server_updater_check_auto && classSupernova::$config->server_updater_check_last + classSupernova::$config->server_updater_check_period <= SN_TIME_NOW) {
6
-  include(SN_ROOT_PHYSICAL . 'ajax_version_check' . DOT_PHP_EX);
5
+if (classSupernova::$config->server_updater_check_auto && classSupernova::$config->server_updater_check_last + classSupernova::$config->server_updater_check_period <= SN_TIME_NOW) {
6
+  include(SN_ROOT_PHYSICAL.'ajax_version_check'.DOT_PHP_EX);
7 7
 }
8 8
 
9
-if(classSupernova::$config->user_birthday_gift && SN_TIME_NOW - classSupernova::$config->user_birthday_celebrate > PERIOD_DAY) {
10
-  require_once(SN_ROOT_PHYSICAL . "includes/includes/user_birthday_celebrate" . DOT_PHP_EX);
9
+if (classSupernova::$config->user_birthday_gift && SN_TIME_NOW - classSupernova::$config->user_birthday_celebrate > PERIOD_DAY) {
10
+  require_once(SN_ROOT_PHYSICAL."includes/includes/user_birthday_celebrate".DOT_PHP_EX);
11 11
   sn_user_birthday_celebrate();
12 12
 }
13 13
 
14
-if(!classSupernova::$config->var_online_user_count || classSupernova::$config->var_online_user_time + 30 < SN_TIME_NOW) {
14
+if (!classSupernova::$config->var_online_user_count || classSupernova::$config->var_online_user_time + 30 < SN_TIME_NOW) {
15 15
   classSupernova::$config->db_saveItem('var_online_user_count', db_user_count(true));
16 16
   classSupernova::$config->db_saveItem('var_online_user_time', SN_TIME_NOW);
17
-  if(classSupernova::$config->server_log_online) {
17
+  if (classSupernova::$config->server_log_online) {
18 18
     db_log_online_insert();
19 19
   }
20 20
 }
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 $template_result[F_ACCOUNT_IS_AUTHORIZED] = $sys_user_logged_in = !empty($user) && isset($user['id']) && $user['id'];
42 42
 //pdump($template_result[F_ACCOUNT_IS_AUTHORIZED]);die();
43 43
 
44
-if(!empty($user['id'])) {
44
+if (!empty($user['id'])) {
45 45
   classSupernova::$user_options->user_change($user['id']);
46 46
 }
47 47
 
@@ -54,15 +54,15 @@  discard block
 block discarded – undo
54 54
     : false
55 55
   );
56 56
 
57
-if($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) {
58
-  $prohibited_characters = array_map(function ($value) {
59
-    return "'" . htmlentities($value, ENT_QUOTES, 'UTF-8') . "'";
57
+if ($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) {
58
+  $prohibited_characters = array_map(function($value) {
59
+    return "'".htmlentities($value, ENT_QUOTES, 'UTF-8')."'";
60 60
   }, str_split(LOGIN_REGISTER_CHARACTERS_PROHIBITED));
61 61
   $template_result[F_LOGIN_MESSAGE] .= implode(', ', $prohibited_characters);
62 62
 }
63 63
 
64 64
 
65
-if(defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) {
65
+if (defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) {
66 66
   pdump("Отключи отладку перед продакшном!");
67 67
 }
68 68
 
@@ -76,17 +76,17 @@  discard block
 block discarded – undo
76 76
   ? define('INSTALL_MODE', GAME_DISABLE_INSTALL)
77 77
   : false;
78 78
 
79
-if($template_result[F_GAME_DISABLE] = classSupernova::$config->game_disable) {
79
+if ($template_result[F_GAME_DISABLE] = classSupernova::$config->game_disable) {
80 80
   $template_result[F_GAME_DISABLE_REASON] = sys_bbcodeParse(
81 81
     classSupernova::$config->game_disable == GAME_DISABLE_REASON
82 82
       ? classSupernova::$config->game_disable_reason
83 83
       : classLocale::$lang['sys_game_disable_reason'][classSupernova::$config->game_disable]
84 84
   );
85
-  if(defined('IN_API')) {
85
+  if (defined('IN_API')) {
86 86
     return;
87 87
   }
88 88
 
89
-  if(
89
+  if (
90 90
     ($user['authlevel'] < 1 || !(defined('IN_ADMIN') && IN_ADMIN))
91 91
     &&
92 92
     !(defined('INSTALL_MODE') && defined('LOGIN_LOGOUT'))
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
 
101 101
 // TODO ban
102 102
 // TODO $skip_ban_check
103
-if($template_result[F_BANNED_STATUS] && !$skip_ban_check) {
104
-  if(defined('IN_API')) {
103
+if ($template_result[F_BANNED_STATUS] && !$skip_ban_check) {
104
+  if (defined('IN_API')) {
105 105
     return;
106 106
   }
107 107
 
@@ -119,15 +119,15 @@  discard block
 block discarded – undo
119 119
 // pdump($allow_anonymous, '$allow_anonymous');
120 120
 // pdump($sys_user_logged_in, '$sys_user_logged_in');
121 121
 
122
-if($sys_user_logged_in && INITIAL_PAGE == 'login') {
123
-  sys_redirect(SN_ROOT_VIRTUAL . 'overview.php');
124
-} elseif($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id'])
122
+if ($sys_user_logged_in && INITIAL_PAGE == 'login') {
123
+  sys_redirect(SN_ROOT_VIRTUAL.'overview.php');
124
+} elseif ($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id'])
125 125
 //  pdump($sn_page_name);
126 126
 //  pdump(INITIAL_PAGE);
127 127
 //  die('{Тут должна быть ваша реклама. Точнее - ввод имени игрока}');
128
-} elseif(!$allow_anonymous && !$sys_user_logged_in) {
128
+} elseif (!$allow_anonymous && !$sys_user_logged_in) {
129 129
   // sn_setcookie(SN_COOKIE, '', time() - PERIOD_WEEK, SN_ROOT_RELATIVE);
130
-  sys_redirect(SN_ROOT_VIRTUAL . 'login.php');
130
+  sys_redirect(SN_ROOT_VIRTUAL.'login.php');
131 131
 }
132 132
 
133 133
 $user_time_diff = playerTimeDiff::user_time_diff_get();
@@ -146,16 +146,16 @@  discard block
 block discarded – undo
146 146
 
147 147
 global $skip_fleet_update;
148 148
 $skip_fleet_update = $skip_fleet_update || $supernova->options['fleet_update_skip'] || defined('IN_ADMIN');
149
-if(
149
+if (
150 150
   !$skip_fleet_update
151 151
   && !(defined('IN_AJAX') && IN_AJAX === true)
152 152
   && SN_TIME_NOW - strtotime(classSupernova::$config->fleet_update_last) > classSupernova::$config->fleet_update_interval
153 153
 ) {
154
-  require_once(SN_ROOT_PHYSICAL . "includes/includes/flt_flying_fleet_handler2" . DOT_PHP_EX);
154
+  require_once(SN_ROOT_PHYSICAL."includes/includes/flt_flying_fleet_handler2".DOT_PHP_EX);
155 155
   flt_flying_fleet_handler($skip_fleet_update);
156 156
 }
157 157
 
158
-if(!defined('IN_AJAX')) {
158
+if (!defined('IN_AJAX')) {
159 159
   print("Scheduled processes is disabled<br />");
160 160
 }
161 161
 // scheduler_process();
Please login to merge, or discard this patch.
includes/general_pname.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 
5 5
 function pname_factory_production_field_name($factory_unit_id)
6 6
 {
7
-  return get_unit_param($factory_unit_id, P_NAME) . '_porcent';
7
+  return get_unit_param($factory_unit_id, P_NAME).'_porcent';
8 8
 }
9 9
 
10 10
 /**
Please login to merge, or discard this patch.
includes/includes/ube_zi_helpers.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
   print($round);
28 28
   print('<table border=1>');
29 29
   print('<tr align="left">');
30
-  foreach($header as $key => $value)
30
+  foreach ($header as $key => $value)
31 31
   {
32
-    if(is_array($value))
32
+    if (is_array($value))
33 33
     {
34 34
       continue;
35 35
     }
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
   );
62 62
 
63 63
   print('<tr align="right">');
64
-  foreach($unit_crossfire_result as $key => $value)
64
+  foreach ($unit_crossfire_result as $key => $value)
65 65
   {
66
-    if(is_array($value))
66
+    if (is_array($value))
67 67
     {
68 68
       continue;
69 69
     }
Please login to merge, or discard this patch.
includes/includes/flt_mission_colonize.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,14 +20,14 @@  discard block
 block discarded – undo
20 20
   $TargetAddress = sprintf(classLocale::$lang['sys_adress_planet'], $fleet_end_coordinates['galaxy'], $fleet_end_coordinates['system'], $fleet_end_coordinates['planet']);
21 21
 
22 22
   $TheMessage = classLocale::$lang['sys_colo_no_colonizer'];
23
-  if($objFleet->shipsGetTotalById(SHIP_COLONIZER) >= 1) {
23
+  if ($objFleet->shipsGetTotalById(SHIP_COLONIZER) >= 1) {
24 24
     $TheMessage = classLocale::$lang['sys_colo_notfree'];
25
-    if(empty($mission_data->dst_planet)) {
25
+    if (empty($mission_data->dst_planet)) {
26 26
       $iPlanetCount = get_player_current_colonies($src_user_row);
27 27
 
28 28
       // Can we colonize more planets?
29 29
       $TheMessage = classLocale::$lang['sys_colo_maxcolo'];
30
-      if($iPlanetCount < get_player_max_colonies($src_user_row)) {
30
+      if ($iPlanetCount < get_player_max_colonies($src_user_row)) {
31 31
         // Yes, we can colonize
32 32
         $TheMessage = classLocale::$lang['sys_colo_badpos'];
33 33
 
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
           $fleet_end_coordinates['galaxy'], $fleet_end_coordinates['system'], $fleet_end_coordinates['planet'],
36 36
           $objFleet->playerOwnerId, "{$classLocale['sys_colo_defaultname']} {$iPlanetCount}", false,
37 37
           array('user_row' => $src_user_row));
38
-        if($NewOwnerPlanet) {
39
-          $TheMessage = classLocale::$lang['sys_colo_arrival'] . $TargetAddress . classLocale::$lang['sys_colo_allisok'];
38
+        if ($NewOwnerPlanet) {
39
+          $TheMessage = classLocale::$lang['sys_colo_arrival'].$TargetAddress.classLocale::$lang['sys_colo_allisok'];
40 40
           msg_send_simple_message($objFleet->playerOwnerId, '', $objFleet->time_arrive_to_target, MSG_TYPE_SPY, classLocale::$lang['sys_colo_mess_from'], classLocale::$lang['sys_colo_mess_report'], $TheMessage);
41 41
 
42 42
           $objFleet->shipAdjustCount(SHIP_COLONIZER, -1);
Please login to merge, or discard this patch.
includes/includes/sys_avatar.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -2,32 +2,32 @@  discard block
 block discarded – undo
2 2
 
3 3
 function sys_avatar_upload($subject_id, &$avatar_field, $prefix = 'avatar') {
4 4
   try {
5
-    $avatar_filename = $fullsize_filename = SN_ROOT_PHYSICAL . 'images/avatar/' . $prefix . '_' . $subject_id;
5
+    $avatar_filename = $fullsize_filename = SN_ROOT_PHYSICAL.'images/avatar/'.$prefix.'_'.$subject_id;
6 6
     $avatar_filename .= '.png';
7 7
     $fullsize_filename .= '_full.png';
8
-    if(sys_get_param_int('avatar_remove')) {
9
-      if(file_exists($avatar_filename) && !unlink($avatar_filename)) {
8
+    if (sys_get_param_int('avatar_remove')) {
9
+      if (file_exists($avatar_filename) && !unlink($avatar_filename)) {
10 10
         throw new Exception(classLocale::$lang['opt_msg_avatar_error_delete'], ERR_ERROR);
11 11
       }
12 12
       $avatar_field = 0;
13 13
       throw new Exception(classLocale::$lang['opt_msg_avatar_removed'], ERR_NONE);
14
-    } elseif($_FILES['avatar']['size']) {
15
-      if(!in_array($_FILES['avatar']['type'], array('image/gif', 'image/jpeg', 'image/jpg', 'image/pjpeg', 'image/png')) || $_FILES['avatar']['size'] > 204800) {
14
+    } elseif ($_FILES['avatar']['size']) {
15
+      if (!in_array($_FILES['avatar']['type'], array('image/gif', 'image/jpeg', 'image/jpg', 'image/pjpeg', 'image/png')) || $_FILES['avatar']['size'] > 204800) {
16 16
         throw new Exception(classLocale::$lang['opt_msg_avatar_error_unsupported'], ERR_WARNING);
17 17
       }
18 18
 
19
-      if($_FILES['avatar']['error']) {
19
+      if ($_FILES['avatar']['error']) {
20 20
         throw new Exception(sprintf(classLocale::$lang['opt_msg_avatar_error_upload'], $_FILES['avatar']['error']), ERR_ERROR);
21 21
       }
22 22
 
23
-      if(!($avatar_image = imagecreatefromstring(file_get_contents($_FILES['avatar']['tmp_name'])))) {
23
+      if (!($avatar_image = imagecreatefromstring(file_get_contents($_FILES['avatar']['tmp_name'])))) {
24 24
         throw new Exception(classLocale::$lang['opt_msg_avatar_error_unsupported'], ERR_WARNING);
25 25
       }
26 26
 
27 27
       $avatar_size = getimagesize($_FILES['avatar']['tmp_name']);
28 28
       $avatar_max_width = classSupernova::$config->avatar_max_width;
29 29
       $avatar_max_height = classSupernova::$config->avatar_max_height;
30
-      if($avatar_size[0] > $avatar_max_width || $avatar_size[1] > $avatar_max_height) {
30
+      if ($avatar_size[0] > $avatar_max_width || $avatar_size[1] > $avatar_max_height) {
31 31
         $aspect_ratio = min($avatar_max_width / $avatar_size[0], $avatar_max_height / $avatar_size[1]);
32 32
         $avatar_image_new = imagecreatetruecolor($avatar_size[0] * $aspect_ratio, $avatar_size[0] * $aspect_ratio);
33 33
         $result = imagecopyresized($avatar_image_new, $avatar_image, 0, 0, 0, 0, $avatar_size[0] * $aspect_ratio, $avatar_size[0] * $aspect_ratio, $avatar_size[0], $avatar_size[1]);
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
         $avatar_image = $avatar_image_new;
36 36
       }
37 37
 
38
-      if(file_exists($avatar_filename) && !unlink($avatar_filename)) {
38
+      if (file_exists($avatar_filename) && !unlink($avatar_filename)) {
39 39
         throw new Exception(classLocale::$lang['opt_msg_avatar_error_delete'], ERR_ERROR);
40 40
       }
41 41
 
42
-      if(!imagepng($avatar_image, $avatar_filename, 9)) {
42
+      if (!imagepng($avatar_image, $avatar_filename, 9)) {
43 43
         throw new Exception(classLocale::$lang['opt_msg_avatar_error_writing'], ERR_ERROR);
44 44
       }
45 45
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
       imagedestroy($avatar_image);
48 48
       throw new Exception(classLocale::$lang['opt_msg_avatar_uploaded'], ERR_NONE);
49 49
     }
50
-  } catch(Exception $e) {
50
+  } catch (Exception $e) {
51 51
     return array(
52 52
       'STATUS'  => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR,
53 53
       'MESSAGE' => $e->getMessage()
Please login to merge, or discard this patch.
reg.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 $id_ref = $_GET['id_ref'] ? intval($_GET['id_ref']) : 0;
4
-$id_ref = $id_ref ? '?id_ref=' . $id_ref : '';
4
+$id_ref = $id_ref ? '?id_ref='.$id_ref : '';
5 5
 
6 6
 header('HTTP/1.1 301 Moved Permanently');
7 7
 header("Location: login.php{$id_ref}#tab_password_reset");
Please login to merge, or discard this patch.
includes/general.php 2 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     }
37 37
   } else {
38 38
     // TODO: This is left for backward compatibility. Appropriate code should be rewrote!
39
-    $func_name = isset(classSupernova::$functions[$func_name]) && is_callable(classSupernova::$functions[$func_name]) ? classSupernova::$functions[$func_name] : ('sn_' . $func_name);
39
+    $func_name = isset(classSupernova::$functions[$func_name]) && is_callable(classSupernova::$functions[$func_name]) ? classSupernova::$functions[$func_name] : ('sn_'.$func_name);
40 40
     if (is_callable($func_name)) {
41 41
       $result = call_user_func_array($func_name, $func_arg);
42 42
     }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
  */
112 112
 function get_exchange_rate($currency_symbol) {
113 113
   $currency_symbol = strtolower($currency_symbol);
114
-  $config_field = 'payment_currency_exchange_' . $currency_symbol;
114
+  $config_field = 'payment_currency_exchange_'.$currency_symbol;
115 115
 
116 116
   // Заворачиваем получение стоимости ММ через перекрываемую процедуру
117 117
   $exchange_rate = floatval($currency_symbol == 'mm_' ? get_mm_cost() : classSupernova::$config->$config_field);
@@ -623,8 +623,8 @@  discard block
 block discarded – undo
623 623
   $from = trim($from ? $from : classSupernova::$config->game_adminEmail);
624 624
 
625 625
   $head = '';
626
-  $head .= "Content-Type: text/" . ($html ? 'html' : 'plain') . "; charset=utf-8 \r\n";
627
-  $head .= "Date: " . date('r') . " \r\n";
626
+  $head .= "Content-Type: text/".($html ? 'html' : 'plain')."; charset=utf-8 \r\n";
627
+  $head .= "Date: ".date('r')." \r\n";
628 628
   $classConfig = classSupernova::$config;
629 629
   $head .= "Return-Path: {$classConfig->game_adminEmail} \r\n";
630 630
   $head .= "From: {$from} \r\n";
@@ -637,10 +637,10 @@  discard block
 block discarded – undo
637 637
   $body = str_replace("\n", "\r\n", $body);
638 638
 
639 639
   if ($html) {
640
-    $body = '<html><head><base href="' . SN_ROOT_VIRTUAL . '"></head><body>' . nl2br($body) . '</body></html>';
640
+    $body = '<html><head><base href="'.SN_ROOT_VIRTUAL.'"></head><body>'.nl2br($body).'</body></html>';
641 641
   }
642 642
 
643
-  $title = '=?UTF-8?B?' . base64_encode($title) . '?=';
643
+  $title = '=?UTF-8?B?'.base64_encode($title).'?=';
644 644
 
645 645
   return @mail($email_unsafe, $title, $body, $head);
646 646
 }
@@ -656,14 +656,14 @@  discard block
 block discarded – undo
656 656
   $classLocale = classLocale::$lang;
657 657
 
658 658
   return
659
-    ($full || $time ? "{$time} {$classLocale['sys_day']}&nbsp;" : '') .
660
-    ($full || $hours ? "{$hours} {$classLocale['sys_hrs']}&nbsp;" : '') .
661
-    ($full || $minutes ? "{$minutes} {$classLocale['sys_min']}&nbsp;" : '') .
659
+    ($full || $time ? "{$time} {$classLocale['sys_day']}&nbsp;" : '').
660
+    ($full || $hours ? "{$hours} {$classLocale['sys_hrs']}&nbsp;" : '').
661
+    ($full || $minutes ? "{$minutes} {$classLocale['sys_min']}&nbsp;" : '').
662 662
     ($full || !$time || $seconds ? "{$seconds} {$classLocale['sys_sec']}" : '');
663 663
 }
664 664
 
665 665
 function sys_time_human_system($time) {
666
-  return $time ? date(FMT_DATE_TIME_SQL, $time) . " ({$time}), " . sys_time_human(SN_TIME_NOW - $time) : '{NEVER}';
666
+  return $time ? date(FMT_DATE_TIME_SQL, $time)." ({$time}), ".sys_time_human(SN_TIME_NOW - $time) : '{NEVER}';
667 667
 }
668 668
 
669 669
 function sys_redirect($url) {
@@ -756,13 +756,13 @@  discard block
 block discarded – undo
756 756
       // usw..
757 757
     );
758 758
 
759
-    $rexep = "#" . strtr(preg_quote($format), $masks) . "#";
759
+    $rexep = "#".strtr(preg_quote($format), $masks)."#";
760 760
     if (preg_match($rexep, $date, $out)) {
761 761
       $ret = array(
762
-        "tm_sec"  => (int)$out['S'],
763
-        "tm_min"  => (int)$out['M'],
764
-        "tm_hour" => (int)$out['H'],
765
-        "tm_mday" => (int)$out['d'],
762
+        "tm_sec"  => (int) $out['S'],
763
+        "tm_min"  => (int) $out['M'],
764
+        "tm_hour" => (int) $out['H'],
765
+        "tm_mday" => (int) $out['d'],
766 766
         "tm_mon"  => $out['m'] ? $out['m'] - 1 : 0,
767 767
         "tm_year" => $out['Y'] > 1900 ? $out['Y'] - 1900 : 0,
768 768
       );
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
         $functions[$function_name] = array();
833 833
       } elseif (!isset($functions[$function_name])) {
834 834
         $functions[$function_name] = array();
835
-        $sn_function_name = 'sn_' . $function_name . ($sub_type ? '_' . $sub_type : '');
835
+        $sn_function_name = 'sn_'.$function_name.($sub_type ? '_'.$sub_type : '');
836 836
         $functions[$function_name][] = $sn_function_name;
837 837
       }
838 838
 
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
   }
900 900
 
901 901
   if (isset($nick_array[NICK_GENDER])) {
902
-    $result[NICK_GENDER] = '<img src="' . ($user['dpath'] ? $user['dpath'] : DEFAULT_SKINPATH) . 'images/gender_' . $nick_array[NICK_GENDER] . '.png" />';
902
+    $result[NICK_GENDER] = '<img src="'.($user['dpath'] ? $user['dpath'] : DEFAULT_SKINPATH).'images/gender_'.$nick_array[NICK_GENDER].'.png" />';
903 903
   }
904 904
 
905 905
   if (isset($nick_array[NICK_AUTH_LEVEL]) || isset($nick_array[NICK_PREMIUM])) {
@@ -931,14 +931,14 @@  discard block
 block discarded – undo
931 931
   }
932 932
 
933 933
   if (isset($nick_array[NICK_CLASS])) {
934
-    $result[NICK_CLASS] = '<span ' . $nick_array[NICK_CLASS] . '>';
934
+    $result[NICK_CLASS] = '<span '.$nick_array[NICK_CLASS].'>';
935 935
     $result[NICK_CLASS_END] = '</span>';
936 936
   }
937 937
 
938 938
   $result[NICK_NICK] = sys_safe_output($nick_array[NICK_NICK]);
939 939
 
940 940
   if (isset($nick_array[NICK_ALLY])) {
941
-    $result[NICK_ALLY] = '[' . sys_safe_output($nick_array[NICK_ALLY]) . ']';
941
+    $result[NICK_ALLY] = '['.sys_safe_output($nick_array[NICK_ALLY]).']';
942 942
   }
943 943
 
944 944
   $result[NICK_HTML] = true;
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
   */
962 962
 
963 963
 
964
-  if ($render_user['user_birthday'] && ($options === true || isset($options['icons']) || isset($options['birthday'])) && (date('Y', SN_TIME_NOW) . date('-m-d', strtotime($render_user['user_birthday'])) == date('Y-m-d', SN_TIME_NOW))) {
964
+  if ($render_user['user_birthday'] && ($options === true || isset($options['icons']) || isset($options['birthday'])) && (date('Y', SN_TIME_NOW).date('-m-d', strtotime($render_user['user_birthday'])) == date('Y-m-d', SN_TIME_NOW))) {
965 965
     $result[NICK_BIRTHSDAY] = '';
966 966
   }
967 967
 
@@ -983,7 +983,7 @@  discard block
 block discarded – undo
983 983
   }
984 984
 
985 985
   if ((isset($options['class']) && $options['class'])) {
986
-    $result[NICK_CLASS] = (isset($result_options[NICK_CLASS]) ? ' ' . $result_options[NICK_CLASS] : '') . $options['class'];
986
+    $result[NICK_CLASS] = (isset($result_options[NICK_CLASS]) ? ' '.$result_options[NICK_CLASS] : '').$options['class'];
987 987
   }
988 988
 
989 989
   if ($render_user['ally_tag'] && ($options === true || (isset($options['ally']) && $options['ally']))) {
@@ -1011,7 +1011,7 @@  discard block
 block discarded – undo
1011 1011
     foreach ($temp as $user_id) {
1012 1012
       $user_id = floatval($user_id);
1013 1013
       if ($user_id) {
1014
-        $user_skip_list[] = '`id` = ' . $user_id;
1014
+        $user_skip_list[] = '`id` = '.$user_id;
1015 1015
       }
1016 1016
     }
1017 1017
   }
@@ -1410,7 +1410,7 @@  discard block
 block discarded – undo
1410 1410
     $time_left = min(floor($time_left / PERIOD_DAY), $term_original);
1411 1411
     $cost_left = $term_original > 0 ? ceil($time_left / $term_original * $original_cost) : 0;
1412 1412
 
1413
-    array_walk_recursive($result, function (&$value) use ($cost_left) {
1413
+    array_walk_recursive($result, function(&$value) use ($cost_left) {
1414 1414
       $value -= $cost_left;
1415 1415
     });
1416 1416
   }
@@ -1465,7 +1465,7 @@  discard block
 block discarded – undo
1465 1465
 }
1466 1466
 
1467 1467
 function print_rr($var, $capture = false) {
1468
-  $print = '<pre>' . htmlspecialchars(print_r($var, true)) . '</pre>';
1468
+  $print = '<pre>'.htmlspecialchars(print_r($var, true)).'</pre>';
1469 1469
   if ($capture) {
1470 1470
     return $print;
1471 1471
   } else {
@@ -1567,7 +1567,7 @@  discard block
 block discarded – undo
1567 1567
       break;
1568 1568
     }
1569 1569
     $sort_option_inverse_closure = $sort_option_inverse ? -1 : 1;
1570
-    usort($ListToSort, function ($a, $b) use ($sort_option_field, $sort_option_inverse_closure) {
1570
+    usort($ListToSort, function($a, $b) use ($sort_option_field, $sort_option_inverse_closure) {
1571 1571
       return $a[$sort_option_field] < $b[$sort_option_field] ? -1 * $sort_option_inverse_closure : (
1572 1572
       $a[$sort_option_field] > $b[$sort_option_field] ? 1 * $sort_option_inverse_closure : 0
1573 1573
       );
Please login to merge, or discard this patch.
Doc Comments   +34 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 require_once('general_pname.php');
12 12
 
13 13
 /**
14
- * @param       $func_name
14
+ * @param       string $func_name
15 15
  * @param array $func_arg
16 16
  *
17 17
  * @return mixed
@@ -62,6 +62,9 @@  discard block
 block discarded – undo
62 62
 }
63 63
 
64 64
 // ----------------------------------------------------------------------------------------------------------------
65
+/**
66
+ * @param string $filename
67
+ */
65 68
 function sys_file_read($filename) {
66 69
   return @file_get_contents($filename);
67 70
 }
@@ -104,7 +107,7 @@  discard block
 block discarded – undo
104 107
 /**
105 108
  * Получение курса обмены валюты в серверную валюту
106 109
  *
107
- * @param $currency_symbol
110
+ * @param string $currency_symbol
108 111
  *
109 112
  * @return float
110 113
  */
@@ -130,7 +133,7 @@  discard block
 block discarded – undo
130 133
  *    - true    - colors number to green if positive or zero; red if negative
131 134
  *    - 0
132 135
  *    - numeric - colors number to green if less then $color; red if greater
133
- * @param int|bool  $limit - generally converts "15000" to "15k", "2000000" to "2kk" etc
136
+ * @param boolean  $limit - generally converts "15000" to "15k", "2000000" to "2kk" etc
134 137
  *    - 0/false - proceed with $floor
135 138
  *    - numeric - divides number to segments by power of $limit and adds 'k' for each segment
136 139
  *        - makes sense for 1000, but works with any number
@@ -229,6 +232,9 @@  discard block
 block discarded – undo
229 232
   return preg_replace($ListCensure, '*', $String);
230 233
 }
231 234
 
235
+/**
236
+ * @param string $email
237
+ */
232 238
 function is_email($email) {
233 239
   return (preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i", $email));
234 240
 }
@@ -266,6 +272,9 @@  discard block
 block discarded – undo
266 272
   return floatval(sys_get_param($param_name, $default));
267 273
 }
268 274
 
275
+/**
276
+ * @param string $param_name
277
+ */
269 278
 function sys_get_param_escaped($param_name, $default = '') {
270 279
   return db_escape(sys_get_param($param_name, $default));
271 280
 }
@@ -434,6 +443,9 @@  discard block
 block discarded – undo
434 443
 }
435 444
 
436 445
 // Generates random string of $length symbols from $allowed_chars charset
446
+/**
447
+ * @param string $allowed_chars
448
+ */
437 449
 function sys_random_string($length = 16, $allowed_chars = SN_SYS_SEC_CHARS_ALLOWED) {
438 450
   $allowed_length = strlen($allowed_chars);
439 451
 
@@ -538,6 +550,10 @@  discard block
 block discarded – undo
538 550
   return implode(';', $fleet_string);
539 551
 }
540 552
 
553
+/**
554
+ * @param string $title
555
+ * @param string $body
556
+ */
541 557
 function mymail($email_unsafe, $title, $body, $from = '', $html = false) {
542 558
   $from = trim($from ? $from : classSupernova::$config->game_adminEmail);
543 559
 
@@ -803,6 +819,9 @@  discard block
 block discarded – undo
803 819
   return serialize($nick_array);
804 820
 }
805 821
 
822
+/**
823
+ * @param string $nick_string
824
+ */
806 825
 function player_nick_uncompact($nick_string) {
807 826
   try {
808 827
     $result = unserialize($nick_string);
@@ -990,6 +1009,9 @@  discard block
 block discarded – undo
990 1009
   return $result;
991 1010
 }
992 1011
 
1012
+/**
1013
+ * @param string $groups
1014
+ */
993 1015
 function isInGroup($groups, $unitId) {
994 1016
   $group = sn_get_groups($groups);
995 1017
 
@@ -1058,6 +1080,9 @@  discard block
 block discarded – undo
1058 1080
   return $ranks;
1059 1081
 }
1060 1082
 
1083
+/**
1084
+ * @param boolean $planet_id
1085
+ */
1061 1086
 function sys_player_new_adjust($user_id, $planet_id) { return sn_function_call(__FUNCTION__, array($user_id, $planet_id, &$result)); }
1062 1087
 
1063 1088
 function sn_sys_player_new_adjust($user_id, $planet_id, &$result) {
@@ -1216,6 +1241,9 @@  discard block
 block discarded – undo
1216 1241
   return $rates;
1217 1242
 }
1218 1243
 
1244
+/**
1245
+ * @param integer $in_resource
1246
+ */
1219 1247
 function get_unit_cost_in(&$cost, $in_resource = RES_METAL) {
1220 1248
   static $rates;
1221 1249
 
@@ -1382,6 +1410,9 @@  discard block
 block discarded – undo
1382 1410
   return version_compare(sn_version_compare_extra($ver1), sn_version_compare_extra($ver2));
1383 1411
 }
1384 1412
 
1413
+/**
1414
+ * @param string $name
1415
+ */
1385 1416
 function sn_setcookie($name, $value = null, $expire = null, $path = SN_ROOT_RELATIVE, $domain = null, $secure = null, $httponly = null) {
1386 1417
   $_COOKIE[$name] = $value;
1387 1418
 
Please login to merge, or discard this patch.
officer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-include('common.' . substr(strrchr(__FILE__, '.'), 1));
3
+include('common.'.substr(strrchr(__FILE__, '.'), 1));
4 4
 
5 5
 $template = gettemplate('viewreport', true);
6 6
 $template->assign_var('PAGE_HINT', classLocale::$lang['cr_view_hint']);
Please login to merge, or discard this patch.