Completed
Push — work-fleets ( 753b64...82c271 )
by SuperNova.WS
10:48 queued 05:39
created
buildings.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,15 +14,15 @@  discard block
 block discarded – undo
14 14
  * @copyright 2008 by Chlorel for XNova
15 15
  */
16 16
 
17
-include('common.' . substr(strrchr(__FILE__, '.'), 1));
17
+include('common.'.substr(strrchr(__FILE__, '.'), 1));
18 18
 
19 19
 define('SN_RENDER_NAVBAR_PLANET', true);
20 20
 
21 21
 $mode = sys_get_param_escaped('mode');
22 22
 $mode = (!$mode || $mode == 'buildings') ? QUE_STRUCTURES : ($mode == 'fleet' ? SUBQUE_FLEET : ($mode == 'defense' ? SUBQUE_DEFENSE : ($mode == 'research' ? QUE_RESEARCH : $mode)));
23 23
 
24
-if($building_sort = sys_get_param_id('sort_elements')) {
25
-  if(!empty(classLocale::$lang['player_option_building_sort'][$building_sort])) {
24
+if ($building_sort = sys_get_param_id('sort_elements')) {
25
+  if (!empty(classLocale::$lang['player_option_building_sort'][$building_sort])) {
26 26
     classSupernova::$user_options[array(PLAYER_OPTION_BUILDING_SORT, $mode)] = $building_sort;
27 27
     classSupernova::$user_options[array(PLAYER_OPTION_BUILDING_SORT_INVERSE, $mode)] = sys_get_param_id('sort_elements_inverse', 0);
28 28
   }
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 lng_include('buildings');
33 33
 lng_include('infos');
34 34
 
35
-sn_sys_sector_buy('buildings.php?mode=' . $mode);
35
+sn_sys_sector_buy('buildings.php?mode='.$mode);
36 36
 
37 37
 require_once('includes/includes/eco_bld_structures.php');
38 38
 switch ($mode) {
Please login to merge, or discard this patch.
banned.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@
 block discarded – undo
14 14
  */
15 15
 
16 16
 $allow_anonymous = true;
17
-include('common.' . substr(strrchr(__FILE__, '.'), 1));
17
+include('common.'.substr(strrchr(__FILE__, '.'), 1));
18 18
 
19 19
 $template = gettemplate('banned_body', true);
20 20
 
21 21
 $query = db_banned_list_select();
22 22
 $i = 0;
23
-while($ban_row = db_fetch($query)) {
23
+while ($ban_row = db_fetch($query)) {
24 24
   $template->assign_block_vars('banlist', array(
25 25
     'USER_NAME'   => $ban_row['ban_user_name'],
26 26
     'REASON'      => $ban_row['ban_reason'],
Please login to merge, or discard this patch.
index.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(isset($sn_page_name) || ($sn_page_name = isset($_GET['page']) ? trim(strip_tags($_GET['page'])) : '')) {
4
-  require_once('common.' . substr(strrchr(__FILE__, '.'), 1));
3
+if (isset($sn_page_name) || ($sn_page_name = isset($_GET['page']) ? trim(strip_tags($_GET['page'])) : '')) {
4
+  require_once('common.'.substr(strrchr(__FILE__, '.'), 1));
5 5
 
6
-  if($sn_page_name) {
6
+  if ($sn_page_name) {
7 7
     // Loading page-specific language files
8 8
     global $template;
9 9
     !empty(classSupernova::$sn_mvc['model'][$sn_page_name]) ? execute_hooks(classSupernova::$sn_mvc['model'][$sn_page_name], $template, 'model', $sn_page_name) : false;
10 10
     !empty(classSupernova::$sn_mvc['view'][$sn_page_name]) ? execute_hooks(classSupernova::$sn_mvc['view'][$sn_page_name], $template, 'view', $sn_page_name) : false;
11 11
 
12
-    if(!empty($template_result) && is_object($template)) {
12
+    if (!empty($template_result) && is_object($template)) {
13 13
       $template->assign_recursive($template_result);
14 14
     }
15 15
     display($template, '', true, '', defined('IN_ADMIN') && (IN_ADMIN === true), true);
Please login to merge, or discard this patch.
flying_fleets.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 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
 global $user, $planetrow;
6 6
 
7
-if(!empty($_POST['return']) && is_array($_POST['return'])) {
8
-  foreach($_POST['return'] as $fleet_id) {
9
-    if($fleet_id = idval($fleet_id)) {
7
+if (!empty($_POST['return']) && is_array($_POST['return'])) {
8
+  foreach ($_POST['return'] as $fleet_id) {
9
+    if ($fleet_id = idval($fleet_id)) {
10 10
       sn_db_transaction_start();
11 11
       $objFleet = new Fleet();
12 12
       $objFleet->dbLoad($fleet_id);
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 lng_include('overview');
31 31
 lng_include('fleet');
32 32
 
33
-if(!$planetrow) {
33
+if (!$planetrow) {
34 34
   message(classLocale::$lang['fl_noplanetrow'], classLocale::$lang['fl_error']);
35 35
 }
36 36
 
@@ -38,14 +38,14 @@  discard block
 block discarded – undo
38 38
 
39 39
 $i = 0;
40 40
 $objFleetList = FleetList::dbGetFleetListByOwnerId($user['id']);
41
-if(!empty($objFleetList)) {
42
-  foreach($objFleetList->_container as $fleet_id => $objFleet) {
41
+if (!empty($objFleetList)) {
42
+  foreach ($objFleetList->_container as $fleet_id => $objFleet) {
43 43
     $i++;
44 44
     $fleet_data = tplParseFleetObject($objFleet, $i, $user);
45 45
 
46 46
     $template->assign_block_vars('fleets', $fleet_data['fleet']);
47 47
 
48
-    foreach($fleet_data['ships'] as $ship_data) {
48
+    foreach ($fleet_data['ships'] as $ship_data) {
49 49
       $template->assign_block_vars('fleets.ships', $ship_data);
50 50
     }
51 51
   }
Please login to merge, or discard this patch.
blitz_register.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 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
-if($user['authlevel'] < AUTH_LEVEL_DEVELOPER) {
5
+if ($user['authlevel'] < AUTH_LEVEL_DEVELOPER) {
6 6
   $error_message = classSupernova::$config->game_mode == GAME_BLITZ ? 'sys_blitz_page_disabled' : (
7 7
   !classSupernova::$config->game_blitz_register ? 'sys_blitz_registration_disabled' : ''
8 8
   );
9 9
 
10
-  if($error_message) {
10
+  if ($error_message) {
11 11
     message(classLocale::$lang[$error_message], classLocale::$lang['sys_error'], 'overview.php', 10);
12 12
     die();
13 13
   }
@@ -16,16 +16,16 @@  discard block
 block discarded – undo
16 16
 $current_round = intval(classSupernova::$config->db_loadItem('game_blitz_register_round'));
17 17
 $current_price = intval(classSupernova::$config->db_loadItem('game_blitz_register_price'));
18 18
 
19
-if(classSupernova::$config->db_loadItem('game_blitz_register') == BLITZ_REGISTER_OPEN && (sys_get_param_str('register_me') || sys_get_param_str('register_me_not'))) {
19
+if (classSupernova::$config->db_loadItem('game_blitz_register') == BLITZ_REGISTER_OPEN && (sys_get_param_str('register_me') || sys_get_param_str('register_me_not'))) {
20 20
   sn_db_transaction_start();
21 21
   $user = db_user_by_id($user['id'], true);
22 22
   $is_registered = db_blitz_reg_get_id_by_player_and_round($user, $current_round);
23
-  if(sys_get_param_str('register_me')) {
24
-    if(empty($is_registered) && mrc_get_level($user, null, RES_METAMATTER) >= $current_price) {
23
+  if (sys_get_param_str('register_me')) {
24
+    if (empty($is_registered) && mrc_get_level($user, null, RES_METAMATTER) >= $current_price) {
25 25
       db_blitz_reg_insert($user, $current_round);
26 26
       classSupernova::$auth->account->metamatter_change(RPG_BLITZ_REGISTRATION, -$current_price, "Регистрация в раунде {$current_round} Блица");
27 27
     }
28
-  } elseif(sys_get_param_str('register_me_not') && !empty($is_registered)) {
28
+  } elseif (sys_get_param_str('register_me_not') && !empty($is_registered)) {
29 29
     db_blitz_reg_delete($user, $current_round);
30 30
     classSupernova::$auth->account->metamatter_change(RPG_BLITZ_REGISTRATION_CANCEL, $current_price, "Отмена регистрации в раунде {$current_round} Блица");
31 31
   }
@@ -40,17 +40,17 @@  discard block
 block discarded – undo
40 40
 $blitz_players = 0;
41 41
 $blitz_prize_dark_matter = 0;
42 42
 $blitz_prize_places = 0;
43
-if($user['authlevel'] >= AUTH_LEVEL_DEVELOPER) {
44
-  if(sys_get_param_str('generate')) {
43
+if ($user['authlevel'] >= AUTH_LEVEL_DEVELOPER) {
44
+  if (sys_get_param_str('generate')) {
45 45
     $next_id = 0;
46 46
     $query = db_blitz_reg_get_random_id($current_round);
47
-    while($row = db_fetch($query)) {
47
+    while ($row = db_fetch($query)) {
48 48
       $next_id++;
49
-      $blitz_name = 'Игрок' . $next_id;
49
+      $blitz_name = 'Игрок'.$next_id;
50 50
       $blitz_password = sys_random_string(8);
51 51
       db_blitz_reg_update_with_name_and_password($blitz_name, $blitz_password, $row, $current_round);
52 52
     }
53
-  } elseif(sys_get_param_str('import_generated')) {
53
+  } elseif (sys_get_param_str('import_generated')) {
54 54
     // ЭТО НА БЛИЦЕ!!!
55 55
     db_player_list_blitz_delete_players();
56 56
     db_planets_purge();
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     $system = $system_step;
73 73
     $planet = round(Vector::$knownPlanets / 2);
74 74
 
75
-    foreach($imported_string as &$string_data) {
75
+    foreach ($imported_string as &$string_data) {
76 76
       $string_data = explode(',', $string_data);
77 77
       $username_safe = $string_data[0];
78 78
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
       $moon_row = uni_create_moon($galaxy, $system, $planet, $user_new['id'], 30, '', false);
94 94
 
95
-      if(($system += $system_step) >= Vector::$knownSystems) {
95
+      if (($system += $system_step) >= Vector::$knownSystems) {
96 96
         $galaxy++;
97 97
         $system = $system_step;
98 98
       }
@@ -102,13 +102,13 @@  discard block
 block discarded – undo
102 102
     classSupernova::$config->db_saveItem('users_amount', classSupernova::$config->users_amount + $new_players);
103 103
     // pdump($imported_string);
104 104
     // generated_string
105
-  } elseif(sys_get_param_str('import_result') && ($blitz_result_string = sys_get_param_str('blitz_result_string'))) {
105
+  } elseif (sys_get_param_str('import_result') && ($blitz_result_string = sys_get_param_str('blitz_result_string'))) {
106 106
     $blitz_result = explode(';', $blitz_result_string);
107 107
     $blitz_last_update = $blitz_result[0]; // Пока не используется
108 108
     unset($blitz_result[0]);
109
-    foreach($blitz_result as $blitz_result_data) {
109
+    foreach ($blitz_result as $blitz_result_data) {
110 110
       $blitz_result_data = explode(',', $blitz_result_data);
111
-      if(count($blitz_result_data) == 5) {
111
+      if (count($blitz_result_data) == 5) {
112 112
         $blitz_result_data[1] = db_escape($blitz_result_data[1]);
113 113
         db_blitz_reg_update_results($blitz_result_data, $current_round);
114 114
       }
@@ -116,15 +116,15 @@  discard block
 block discarded – undo
116 116
     $blitz_result = array();
117 117
   }
118 118
 
119
-  if(classSupernova::$config->game_mode == GAME_BLITZ) {
119
+  if (classSupernova::$config->game_mode == GAME_BLITZ) {
120 120
     $blitz_result = array(classSupernova::$config->db_loadItem('var_stat_update'));
121 121
     $query = db_player_list_export_blitz_info();
122
-    while($row = db_fetch($query)) {
122
+    while ($row = db_fetch($query)) {
123 123
       $blitz_result[] = "{$row['id']},{$row['username']},{$row['onlinetime']},{$row['total_rank']},{$row['total_points']}";
124 124
     }
125 125
   } else {
126 126
     $query = db_blitz_reg_get_player_list($current_round);
127
-    while($row = db_fetch($query)) {
127
+    while ($row = db_fetch($query)) {
128 128
       $blitz_generated[] = "{$row['blitz_name']},{$row['blitz_password']}";
129 129
       $row['blitz_online'] ? $blitz_prize_players_active++ : false;
130 130
       $blitz_players++;
@@ -132,13 +132,13 @@  discard block
 block discarded – undo
132 132
     $blitz_prize_dark_matter = $blitz_prize_players_active * 20000;
133 133
     $blitz_prize_places = ceil($blitz_prize_players_active / 5);
134 134
 
135
-    if(sys_get_param_str('prize_calculate') && $blitz_prize_players_active && ($blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'))) {
135
+    if (sys_get_param_str('prize_calculate') && $blitz_prize_players_active && ($blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'))) {
136 136
       // $blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter');
137 137
       $blitz_prize_places_actual = sys_get_param_int('blitz_prize_places');
138 138
       sn_db_transaction_start();
139 139
       $query = db_blitz_reg_get_player_list_order_by_place($current_round);
140
-      while($row = db_fetch($query)) {
141
-        if(!$row['blitz_place']) {
140
+      while ($row = db_fetch($query)) {
141
+        if (!$row['blitz_place']) {
142 142
           continue;
143 143
         }
144 144
 
@@ -147,14 +147,14 @@  discard block
 block discarded – undo
147 147
 
148 148
         $reward = $blitz_prize_dark_matter_actual - $row['blitz_reward_dark_matter'];
149 149
         pdump("{{$row['id']}} {$row['blitz_name']}, Place {$row['blitz_place']}, Prize places {$blitz_prize_places_actual}, Prize {$reward}", $row['id']);
150
-        if($reward) {
150
+        if ($reward) {
151 151
           rpg_points_change($row['user_id'], RPG_BLITZ, $reward, sprintf(
152 152
             classLocale::$lang['sys_blitz_reward_log_message'], $row['blitz_place'], $row['blitz_name']
153 153
           ));
154 154
           db_blitz_reg_update_apply_results($reward, $row, $current_round);
155 155
         }
156 156
 
157
-        if(!$blitz_prize_places_actual || $blitz_prize_dark_matter_actual < 1000) {
157
+        if (!$blitz_prize_places_actual || $blitz_prize_dark_matter_actual < 1000) {
158 158
           break;
159 159
         }
160 160
       }
@@ -169,12 +169,12 @@  discard block
 block discarded – undo
169 169
 
170 170
 $player_registered = false;
171 171
 $query = db_blitz_reg_get_player_list_and_users($current_round);
172
-while($row = db_fetch($query)) {
172
+while ($row = db_fetch($query)) {
173 173
   $tpl_player_data = array(
174 174
     'NAME' => player_nick_render_to_html($row, array('icons' => true, 'color' => true, 'ally' => true)),
175 175
   );
176 176
 
177
-  if(classSupernova::$config->game_blitz_register == BLITZ_REGISTER_DISCLOSURE_NAMES) {
177
+  if (classSupernova::$config->game_blitz_register == BLITZ_REGISTER_DISCLOSURE_NAMES) {
178 178
     // Вот так хитро, что бы не было не единого шанса попадания на страницу данных об игроках Блиц-сервера до закрытия раунда
179 179
     $tpl_player_data = array_merge($tpl_player_data, array(
180 180
       'ID'                       => $row['id'],
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
   }
188 188
 
189 189
   $template->assign_block_vars('registrations', $tpl_player_data);
190
-  if($row['id'] == $user['id']) {
190
+  if ($row['id'] == $user['id']) {
191 191
     $player_registered = $row;
192 192
   }
193 193
 }
Please login to merge, or discard this patch.
market.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  *
10 10
  */
11 11
 
12
-require_once('common.' . substr(strrchr(__FILE__, '.'), 1));
12
+require_once('common.'.substr(strrchr(__FILE__, '.'), 1));
13 13
 
14 14
 define('SN_IN_MARKET', true);
15 15
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 $newstock = $stock;
27 27
 $intError = MARKET_DEAL;
28 28
 
29
-switch($mode)
29
+switch ($mode)
30 30
 {
31 31
   case MARKET_RESOURCES: // Resource trader
32 32
     require('includes/includes/market_trader.inc');
@@ -82,12 +82,12 @@  discard block
 block discarded – undo
82 82
 }
83 83
 
84 84
 $message_id = sys_get_param_int('message');
85
-if($message_id != MARKET_NOTHING)
85
+if ($message_id != MARKET_NOTHING)
86 86
 {
87 87
   $template->assign_block_vars('result', array('MESSAGE' => classLocale::$lang['eco_mrk_errors'][$message_id]));
88 88
 }
89 89
 
90
-if($message)
90
+if ($message)
91 91
 {
92 92
   $template->assign_block_vars('result', array('MESSAGE' => $message));
93 93
 }
Please login to merge, or discard this patch.
docs/txt2html.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -1,58 +1,58 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-function dump($value,$varname = "",$level=0,$dumper = "")
3
+function dump($value, $varname = "", $level = 0, $dumper = "")
4 4
 {
5 5
   if ($varname) $varname .= " = ";
6 6
 
7
-  if ($level==-1)
7
+  if ($level == -1)
8 8
   {
9
-    $trans[' ']='&there4;';
10
-    $trans["\t"]='&rArr;';
11
-    $trans["\n"]='&para;;';
12
-    $trans["\r"]='&lArr;';
13
-    $trans["\0"]='&oplus;';
14
-    return strtr(htmlspecialchars($value),$trans);
9
+    $trans[' '] = '&there4;';
10
+    $trans["\t"] = '&rArr;';
11
+    $trans["\n"] = '&para;;';
12
+    $trans["\r"] = '&lArr;';
13
+    $trans["\0"] = '&oplus;';
14
+    return strtr(htmlspecialchars($value), $trans);
15 15
   }
16
-  if ($level==0) $dumper = '<pre>' . $varname;
16
+  if ($level == 0) $dumper = '<pre>'.$varname;
17 17
 
18 18
   $type = gettype($value);
19 19
   $dumper .= $type;
20 20
 
21
-  if ($type=='string')
21
+  if ($type == 'string')
22 22
   {
23 23
     $dumper .= '('.strlen($value).')';
24
-    $value = dump($value,"",-1);
24
+    $value = dump($value, "", -1);
25 25
   }
26
-  elseif ($type=='boolean') $value= ($value?'true':'false');
27
-  elseif ($type=='object')
26
+  elseif ($type == 'boolean') $value = ($value ? 'true' : 'false');
27
+  elseif ($type == 'object')
28 28
   {
29
-    $props= get_class_vars(get_class($value));
29
+    $props = get_class_vars(get_class($value));
30 30
     $dumper .= '('.count($props).') <u>'.get_class($value).'</u>';
31
-    foreach($props as $key=>$val)
31
+    foreach ($props as $key=>$val)
32 32
     {
33
-      $dumper .= "\n".str_repeat("\t",$level+1).$key.' => ';
34
-      $dumper .= dump($value->$key,"",$level+1);
33
+      $dumper .= "\n".str_repeat("\t", $level + 1).$key.' => ';
34
+      $dumper .= dump($value->$key, "", $level + 1);
35 35
     }
36
-    $value= '';
36
+    $value = '';
37 37
   }
38
-  elseif ($type=='array')
38
+  elseif ($type == 'array')
39 39
   {
40 40
     $dumper .= '('.count($value).')';
41
-    foreach($value as $key=>$val)
41
+    foreach ($value as $key=>$val)
42 42
     {
43
-      $dumper .= "\n".str_repeat("\t",$level+1).dump($key,"",-1).' => ';
44
-      $dumper .= dump($val,"",$level+1);
43
+      $dumper .= "\n".str_repeat("\t", $level + 1).dump($key, "", -1).' => ';
44
+      $dumper .= dump($val, "", $level + 1);
45 45
     }
46
-    $value= '';
46
+    $value = '';
47 47
   }
48 48
   $dumper .= " <b>$value</b>";
49
-  if ($level==0) $dumper .= '</pre>';
49
+  if ($level == 0) $dumper .= '</pre>';
50 50
   return $dumper;
51 51
 }
52 52
 
53 53
 function pdump($value, $varname = '')
54 54
 {
55
-  print('<span style="text-align: left">' . dump($value, $varname) . '</span>');
55
+  print('<span style="text-align: left">'.dump($value, $varname).'</span>');
56 56
 }
57 57
 
58 58
 function debug($value, $varname = '')
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
   $output_buffer .= $string;
68 68
 }
69 69
 
70
-if(substr(getcwd(), -4) != 'docs')
70
+if (substr(getcwd(), -4) != 'docs')
71 71
 {
72 72
   $path_prefix = 'docs/';
73 73
 }
@@ -80,22 +80,22 @@  discard block
 block discarded – undo
80 80
 
81 81
 $filename = 'changelog';
82 82
 
83
-$input =  file_get_contents($path_prefix . $filename . '.txt');
83
+$input = file_get_contents($path_prefix.$filename.'.txt');
84 84
 //$input = iconv('CP1251', 'UTF-8', $input);
85 85
 
86 86
 $input = preg_replace("/\r\n\d\d\d\d\-\d\d\-\d\d\ \d\d\:\d\d/", "[D] $0", $input);
87 87
 
88
-while(strpos($input, "\r\n\r\n") !== false)
88
+while (strpos($input, "\r\n\r\n") !== false)
89 89
 {
90 90
   $input = str_replace("\r\n\r\n", "\r\n", $input);
91 91
 }
92
-while(strpos($input, "~~~") !== false)
92
+while (strpos($input, "~~~") !== false)
93 93
 {
94 94
   $input = str_replace("~~~", "~~", $input);
95 95
 }
96 96
 $input = str_replace("\r\n~~", "~~", $input);
97 97
 
98
-while(strpos($input, "===") !== false)
98
+while (strpos($input, "===") !== false)
99 99
 {
100 100
   $input = str_replace("===", "==", $input);
101 101
 }
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
 $prev_chapter_is_header = false;
107 107
 $output = array();
108 108
 $buffer = array();
109
-foreach($input as &$chapter)
109
+foreach ($input as &$chapter)
110 110
 {
111 111
   $chapter = preg_split("/(\r\n[\[])/", $chapter, -1, PREG_SPLIT_NO_EMPTY); // , PREG_SPLIT_DELIM_CAPTURE
112 112
 
113
-  if(count($chapter) == 1 && !$prev_chapter_is_header)
113
+  if (count($chapter) == 1 && !$prev_chapter_is_header)
114 114
   {
115
-    if(!empty($chapter))
115
+    if (!empty($chapter))
116 116
     {
117 117
       $output[] = $buffer;
118 118
       $buffer = array();
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
   else
124 124
   {
125 125
     $prev_chapter_is_header = false;
126
-    foreach($chapter as &$note)
126
+    foreach ($chapter as &$note)
127 127
     {
128 128
       $note = explode("\r\n", $note);
129 129
       $new_note = true;
@@ -131,13 +131,13 @@  discard block
 block discarded – undo
131 131
 
132 132
       $note_out = array();
133 133
 
134
-      foreach($note as &$line)
134
+      foreach ($note as &$line)
135 135
       {
136
-        if(!$line)
136
+        if (!$line)
137 137
         {
138 138
           continue;
139 139
         }
140
-        if($new_note)
140
+        if ($new_note)
141 141
         {
142 142
           // 78 - 3 = 75
143 143
           $note_out['style'] = $line[0];
@@ -145,9 +145,9 @@  discard block
 block discarded – undo
145 145
         }
146 146
 
147 147
         $buf_str .= $line;
148
-        if(mb_strlen($line, 'utf-8') < ($new_note ? 75 : 79))
148
+        if (mb_strlen($line, 'utf-8') < ($new_note ? 75 : 79))
149 149
         {
150
-          if(!isset($note_out['name']))
150
+          if (!isset($note_out['name']))
151 151
           {
152 152
             $note_out['name'] = $buf_str;
153 153
           }
@@ -201,31 +201,31 @@  discard block
 block discarded – undo
201 201
   'D' => 'date',
202 202
 );
203 203
 
204
-foreach($output as $chapter)
204
+foreach ($output as $chapter)
205 205
 {
206
-  if(!$chapter)
206
+  if (!$chapter)
207 207
   {
208 208
     continue;
209 209
   }
210 210
 
211 211
   buf_print("<h1>{$chapter['name']}</h1>\r\n");
212
-  foreach($chapter['content'] as $block)
212
+  foreach ($chapter['content'] as $block)
213 213
   {
214
-    buf_print("<div class=\"{$styles[$block['style']]}\">" . ($block['style'] != 'D' ? "[{$block['style']}]&nbsp;" : ''));
215
-    buf_print(preg_replace("/\s{2,10}/", " ", $block['name']) . '<br />');
216
-    if(isset($block['lines']))
214
+    buf_print("<div class=\"{$styles[$block['style']]}\">".($block['style'] != 'D' ? "[{$block['style']}]&nbsp;" : ''));
215
+    buf_print(preg_replace("/\s{2,10}/", " ", $block['name']).'<br />');
216
+    if (isset($block['lines']))
217 217
     {
218 218
       $last_spaces = '';
219 219
       $depth = array();
220
-      foreach($block['lines'] as $line)
220
+      foreach ($block['lines'] as $line)
221 221
       {
222
-        if(preg_match("/^(\s+)(\d*|\s)\.*\s*(.*)/", $line, $matches))
222
+        if (preg_match("/^(\s+)(\d*|\s)\.*\s*(.*)/", $line, $matches))
223 223
         {
224 224
           //$line = strlen($matches[1]) . '/' . $matches[2] . '/' . $matches[3];
225 225
           $line = $matches[3];
226
-          if(strlen($matches[1]) > strlen($last_spaces))
226
+          if (strlen($matches[1]) > strlen($last_spaces))
227 227
           {
228
-            if($matches[2])
228
+            if ($matches[2])
229 229
             {
230 230
               buf_print("<ol>\r\n");
231 231
             }
@@ -237,9 +237,9 @@  discard block
 block discarded – undo
237 237
             $last_spaces = $matches[1];
238 238
             $depth[] = $matches[2];
239 239
           }
240
-          elseif(strlen($matches[1]) < strlen($last_spaces) && count($depth))
240
+          elseif (strlen($matches[1]) < strlen($last_spaces) && count($depth))
241 241
           {
242
-            if(array_pop($depth))
242
+            if (array_pop($depth))
243 243
             {
244 244
               buf_print("</ol>\r\n");
245 245
             }
@@ -250,14 +250,14 @@  discard block
 block discarded – undo
250 250
             $last_spaces = $matches[1];
251 251
             buf_print('<li>');
252 252
           }
253
-          elseif(strlen($last_spaces) == strlen($matches[1]))
253
+          elseif (strlen($last_spaces) == strlen($matches[1]))
254 254
           {
255
-            if($matches[2] == '' && $depth[count($depth) - 1] != '')
255
+            if ($matches[2] == '' && $depth[count($depth) - 1] != '')
256 256
             {
257 257
               buf_print("</ol>\r\n");
258 258
               buf_print("<ul>\r\n");
259 259
             }
260
-            elseif($matches[2] != '' && $depth[count($depth) - 1] == '')
260
+            elseif ($matches[2] != '' && $depth[count($depth) - 1] == '')
261 261
             {
262 262
               buf_print("</ul>\r\n");
263 263
               buf_print("<ol>\r\n");
@@ -267,11 +267,11 @@  discard block
 block discarded – undo
267 267
           }
268 268
         }
269 269
         $line = preg_replace("/\s{2,10}/", " ", $line);
270
-        buf_print($line . "<br />\r\n");
270
+        buf_print($line."<br />\r\n");
271 271
       }
272
-      while(count($depth))
272
+      while (count($depth))
273 273
       {
274
-        if(array_pop($depth))
274
+        if (array_pop($depth))
275 275
         {
276 276
           buf_print("</ol>\r\n");
277 277
         }
@@ -286,11 +286,11 @@  discard block
 block discarded – undo
286 286
 }
287 287
 buf_print("</body>\r\n</html>\r\n");
288 288
 
289
-$html = file_get_contents($path_prefix . 'html/' . $filename . '.html');
290
-if($html != $output_buffer)
289
+$html = file_get_contents($path_prefix.'html/'.$filename.'.html');
290
+if ($html != $output_buffer)
291 291
 {
292
-  file_put_contents($path_prefix . 'html/' . $filename . '.html', $output_buffer);
293
-  if(!$path_prefix)
292
+  file_put_contents($path_prefix.'html/'.$filename.'.html', $output_buffer);
293
+  if (!$path_prefix)
294 294
   {
295 295
     print($output_buffer);
296 296
   }
Please login to merge, or discard this patch.
banner.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 */
14 14
 
15 15
 $allow_anonymous = true;
16
-include('includes/init.' . substr(strrchr(__FILE__, '.'), 1));
16
+include('includes/init.'.substr(strrchr(__FILE__, '.'), 1));
17 17
 
18 18
 lng_include('overview');
19 19
 
Please login to merge, or discard this patch.
simulator.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 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
-if(sys_get_param_int('BE_DEBUG') && !defined('BE_DEBUG'))
5
+if (sys_get_param_int('BE_DEBUG') && !defined('BE_DEBUG'))
6 6
 {
7 7
   define('BE_DEBUG', true);
8 8
 }
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 $sym_defender = $_POST['defender'] ? $_POST['defender'] : array();
15 15
 $sym_attacker = $_POST['attacker'] ? $_POST['attacker'] : array();
16 16
 
17
-if($replay)
17
+if ($replay)
18 18
 {
19 19
   $unpacked = sn_ube_simulator_decode_replay($replay);
20 20
 
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
   $sym_attacker = array(1 => $sym_attacker);
28 28
 }
29 29
 
30
-if($_POST['submit'] || $execute)
30
+if ($_POST['submit'] || $execute)
31 31
 {
32 32
   $replay = sn_ube_simulator_encode_replay($sym_defender, 'D');
33 33
   $replay .= sn_ube_simulator_encode_replay($sym_attacker, 'A');
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
   $template = gettemplate('simulator', true);
41 41
   $techs_and_officers = array(TECH_WEAPON, TECH_SHIELD, TECH_ARMOR, MRC_ADMIRAL);
42 42
 
43
-  foreach($techs_and_officers as $tech_id)
43
+  foreach ($techs_and_officers as $tech_id)
44 44
   {
45
-    if(!$sym_attacker[1][$tech_id])
45
+    if (!$sym_attacker[1][$tech_id])
46 46
     {
47 47
       $sym_attacker[1][$tech_id] = mrc_get_level($user, null, $tech_id);
48 48
     }
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
     UNIT_GOVERNORS => array(MRC_FORTIFIER),
57 57
     UNIT_DEFENCE => sn_get_groups('defense_active'),
58 58
   );
59
-  foreach($show_groups as $unit_group_id => $unit_group)
59
+  foreach ($show_groups as $unit_group_id => $unit_group)
60 60
   {
61 61
     $template->assign_block_vars('simulator', array(
62 62
       'GROUP' => $unit_group_id,
63 63
       'NAME' => classLocale::$lang['tech'][$unit_group_id],
64 64
     ));
65 65
 
66
-    foreach($unit_group as $unit_id)
66
+    foreach ($unit_group as $unit_id)
67 67
     {
68 68
       $tab++;
69 69
 
Please login to merge, or discard this patch.