@@ -281,6 +281,9 @@ discard block |
||
| 281 | 281 | |
| 282 | 282 | // ------------------------------------------------------------------------------------------------ |
| 283 | 283 | // Читает боевой отчет из БД |
| 284 | +/** |
|
| 285 | + * @param string $report_cypher |
|
| 286 | + */ |
|
| 284 | 287 | function sn_ube_report_load($report_cypher) |
| 285 | 288 | { |
| 286 | 289 | $report_cypher = db_escape($report_cypher); |
@@ -480,6 +483,9 @@ discard block |
||
| 480 | 483 | |
| 481 | 484 | // ------------------------------------------------------------------------------------------------ |
| 482 | 485 | // Парсит инфу о раунде для темплейта |
| 486 | +/** |
|
| 487 | + * @param integer $round |
|
| 488 | + */ |
|
| 483 | 489 | function sn_ube_report_round_fleet(&$combat_data, $round) |
| 484 | 490 | { |
| 485 | 491 | global $lang; |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | global $config; |
| 8 | 8 | |
| 9 | 9 | // Если уже есть ИД репорта - значит репорт был взят из таблицы. С таким мы не работаем |
| 10 | - if($combat_data[UBE_REPORT_CYPHER]) |
|
| 10 | + if ($combat_data[UBE_REPORT_CYPHER]) |
|
| 11 | 11 | { |
| 12 | 12 | return false; |
| 13 | 13 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | { |
| 18 | 18 | $combat_data[UBE_REPORT_CYPHER] = sys_random_string(32); |
| 19 | 19 | } |
| 20 | - while(doquery("SELECT ube_report_cypher FROM {{ube_report}} WHERE ube_report_cypher = '{$combat_data[UBE_REPORT_CYPHER]}' LIMIT 1 FOR UPDATE", true)); |
|
| 20 | + while (doquery("SELECT ube_report_cypher FROM {{ube_report}} WHERE ube_report_cypher = '{$combat_data[UBE_REPORT_CYPHER]}' LIMIT 1 FOR UPDATE", true)); |
|
| 21 | 21 | |
| 22 | 22 | // Инициализация таблицы для пакетной вставки информации |
| 23 | 23 | $sql_perform = array( |
@@ -113,55 +113,55 @@ discard block |
||
| 113 | 113 | `ube_report_time_combat` = '" . date(FMT_DATE_TIME_SQL, $combat_data[UBE_TIME]) . "', |
| 114 | 114 | `ube_report_time_spent` = {$combat_data[UBE_TIME_SPENT]}, |
| 115 | 115 | |
| 116 | - `ube_report_combat_admin` = " . (int)$combat_data[UBE_OPTIONS][UBE_COMBAT_ADMIN] . ", |
|
| 116 | + `ube_report_combat_admin` = " . (int) $combat_data[UBE_OPTIONS][UBE_COMBAT_ADMIN] . ", |
|
| 117 | 117 | `ube_report_mission_type` = {$combat_data[UBE_OPTIONS][UBE_MISSION_TYPE]}, |
| 118 | 118 | |
| 119 | 119 | `ube_report_combat_result` = {$outcome[UBE_COMBAT_RESULT]}, |
| 120 | - `ube_report_combat_sfr` = " . (int)$outcome[UBE_SFR] .", |
|
| 120 | + `ube_report_combat_sfr` = " . (int) $outcome[UBE_SFR] . ", |
|
| 121 | 121 | |
| 122 | - `ube_report_debris_metal` = " . (float)$outcome[UBE_DEBRIS][RES_METAL] . ", |
|
| 123 | - `ube_report_debris_crystal` = " . (float)$outcome[UBE_DEBRIS][RES_CRYSTAL] . ", |
|
| 122 | + `ube_report_debris_metal` = " . (float) $outcome[UBE_DEBRIS][RES_METAL] . ", |
|
| 123 | + `ube_report_debris_crystal` = " . (float) $outcome[UBE_DEBRIS][RES_CRYSTAL] . ", |
|
| 124 | 124 | `ube_report_debris_total_in_metal` = " . $ube_report_debris_total_in_metal . ", |
| 125 | 125 | |
| 126 | - `ube_report_planet_id` = " . (int)$outcome[UBE_PLANET][PLANET_ID] . ", |
|
| 126 | + `ube_report_planet_id` = " . (int) $outcome[UBE_PLANET][PLANET_ID] . ", |
|
| 127 | 127 | `ube_report_planet_name` = '" . db_escape($outcome[UBE_PLANET][PLANET_NAME]) . "', |
| 128 | - `ube_report_planet_size` = " . (int)$outcome[UBE_PLANET][PLANET_SIZE] . ", |
|
| 129 | - `ube_report_planet_galaxy` = " . (int)$outcome[UBE_PLANET][PLANET_GALAXY] . ", |
|
| 130 | - `ube_report_planet_system` = " . (int)$outcome[UBE_PLANET][PLANET_SYSTEM] . ", |
|
| 131 | - `ube_report_planet_planet` = " . (int)$outcome[UBE_PLANET][PLANET_PLANET] . ", |
|
| 132 | - `ube_report_planet_planet_type` = " . (int)$outcome[UBE_PLANET][PLANET_TYPE] . ", |
|
| 128 | + `ube_report_planet_size` = " . (int) $outcome[UBE_PLANET][PLANET_SIZE] . ", |
|
| 129 | + `ube_report_planet_galaxy` = " . (int) $outcome[UBE_PLANET][PLANET_GALAXY] . ", |
|
| 130 | + `ube_report_planet_system` = " . (int) $outcome[UBE_PLANET][PLANET_SYSTEM] . ", |
|
| 131 | + `ube_report_planet_planet` = " . (int) $outcome[UBE_PLANET][PLANET_PLANET] . ", |
|
| 132 | + `ube_report_planet_planet_type` = " . (int) $outcome[UBE_PLANET][PLANET_TYPE] . ", |
|
| 133 | 133 | |
| 134 | - `ube_report_moon` = " . (int)$outcome[UBE_MOON] .", |
|
| 135 | - `ube_report_moon_chance` = " . (int)$outcome[UBE_MOON_CHANCE] . ", |
|
| 136 | - `ube_report_moon_size` = " . (float)$outcome[UBE_MOON_SIZE] . ", |
|
| 134 | + `ube_report_moon` = " . (int) $outcome[UBE_MOON] . ", |
|
| 135 | + `ube_report_moon_chance` = " . (int) $outcome[UBE_MOON_CHANCE] . ", |
|
| 136 | + `ube_report_moon_size` = " . (float) $outcome[UBE_MOON_SIZE] . ", |
|
| 137 | 137 | |
| 138 | - `ube_report_moon_reapers` = " . (int)$outcome[UBE_MOON_REAPERS] . ", |
|
| 139 | - `ube_report_moon_destroy_chance` = " . (int)$outcome[UBE_MOON_DESTROY_CHANCE] . ", |
|
| 140 | - `ube_report_moon_reapers_die_chance` = " . (int)$outcome[UBE_MOON_REAPERS_DIE_CHANCE] . ", |
|
| 138 | + `ube_report_moon_reapers` = " . (int) $outcome[UBE_MOON_REAPERS] . ", |
|
| 139 | + `ube_report_moon_destroy_chance` = " . (int) $outcome[UBE_MOON_DESTROY_CHANCE] . ", |
|
| 140 | + `ube_report_moon_reapers_die_chance` = " . (int) $outcome[UBE_MOON_REAPERS_DIE_CHANCE] . ", |
|
| 141 | 141 | |
| 142 | - `ube_report_capture_result` = " . (int)$outcome[UBE_CAPTURE_RESULT] . " |
|
| 142 | + `ube_report_capture_result` = " . (int) $outcome[UBE_CAPTURE_RESULT] . " |
|
| 143 | 143 | "); |
| 144 | 144 | $ube_report_id = $combat_data[UBE_REPORT_ID] = db_insert_id(); |
| 145 | 145 | |
| 146 | 146 | // Сохраняем общую информацию по игрокам |
| 147 | - foreach($combat_data[UBE_PLAYERS] as $player_id => &$player_info) |
|
| 147 | + foreach ($combat_data[UBE_PLAYERS] as $player_id => &$player_info) |
|
| 148 | 148 | { |
| 149 | 149 | $sql_perform['ube_report_player'][] = array( |
| 150 | 150 | $ube_report_id, |
| 151 | 151 | $player_id, |
| 152 | 152 | |
| 153 | 153 | "'" . db_escape($player_info[UBE_NAME]) . "'", |
| 154 | - (int)$player_info[UBE_ATTACKER], |
|
| 154 | + (int) $player_info[UBE_ATTACKER], |
|
| 155 | 155 | |
| 156 | - (float)$player_info[UBE_BONUSES][UBE_ATTACK], |
|
| 157 | - (float)$player_info[UBE_BONUSES][UBE_SHIELD], |
|
| 158 | - (float)$player_info[UBE_BONUSES][UBE_ARMOR], |
|
| 156 | + (float) $player_info[UBE_BONUSES][UBE_ATTACK], |
|
| 157 | + (float) $player_info[UBE_BONUSES][UBE_SHIELD], |
|
| 158 | + (float) $player_info[UBE_BONUSES][UBE_ARMOR], |
|
| 159 | 159 | ); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | // Всякая информация по флотам |
| 163 | 163 | $unit_sort_order = 0; |
| 164 | - foreach($combat_data[UBE_FLEETS] as $fleet_id => &$fleet_info) |
|
| 164 | + foreach ($combat_data[UBE_FLEETS] as $fleet_id => &$fleet_info) |
|
| 165 | 165 | { |
| 166 | 166 | // Сохраняем общую информацию по флотам |
| 167 | 167 | $sql_perform['ube_report_fleet'][] = array( |
@@ -169,20 +169,20 @@ discard block |
||
| 169 | 169 | $fleet_info[UBE_OWNER], |
| 170 | 170 | $fleet_id, |
| 171 | 171 | |
| 172 | - (float)$fleet_info[UBE_PLANET][PLANET_ID], |
|
| 172 | + (float) $fleet_info[UBE_PLANET][PLANET_ID], |
|
| 173 | 173 | "'" . db_escape($fleet_info[UBE_PLANET][PLANET_NAME]) . "'", |
| 174 | - (int)$fleet_info[UBE_PLANET][PLANET_GALAXY], |
|
| 175 | - (int)$fleet_info[UBE_PLANET][PLANET_SYSTEM], |
|
| 176 | - (int)$fleet_info[UBE_PLANET][PLANET_PLANET], |
|
| 177 | - (int)$fleet_info[UBE_PLANET][PLANET_TYPE], |
|
| 178 | - |
|
| 179 | - (float)$fleet_info[UBE_RESOURCES][RES_METAL], |
|
| 180 | - (float)$fleet_info[UBE_RESOURCES][RES_CRYSTAL], |
|
| 181 | - (float)$fleet_info[UBE_RESOURCES][RES_DEUTERIUM], |
|
| 182 | - |
|
| 183 | - (float)$fleet_info[UBE_BONUSES][UBE_ATTACK], |
|
| 184 | - (float)$fleet_info[UBE_BONUSES][UBE_SHIELD], |
|
| 185 | - (float)$fleet_info[UBE_BONUSES][UBE_ARMOR], |
|
| 174 | + (int) $fleet_info[UBE_PLANET][PLANET_GALAXY], |
|
| 175 | + (int) $fleet_info[UBE_PLANET][PLANET_SYSTEM], |
|
| 176 | + (int) $fleet_info[UBE_PLANET][PLANET_PLANET], |
|
| 177 | + (int) $fleet_info[UBE_PLANET][PLANET_TYPE], |
|
| 178 | + |
|
| 179 | + (float) $fleet_info[UBE_RESOURCES][RES_METAL], |
|
| 180 | + (float) $fleet_info[UBE_RESOURCES][RES_CRYSTAL], |
|
| 181 | + (float) $fleet_info[UBE_RESOURCES][RES_DEUTERIUM], |
|
| 182 | + |
|
| 183 | + (float) $fleet_info[UBE_BONUSES][UBE_ATTACK], |
|
| 184 | + (float) $fleet_info[UBE_BONUSES][UBE_SHIELD], |
|
| 185 | + (float) $fleet_info[UBE_BONUSES][UBE_ARMOR], |
|
| 186 | 186 | ); |
| 187 | 187 | |
| 188 | 188 | // Сохраняем итоговую информацию по ресурсам флота - потеряно, выброшено, увезено |
@@ -191,25 +191,25 @@ discard block |
||
| 191 | 191 | $ube_report_id, |
| 192 | 192 | $fleet_id, |
| 193 | 193 | |
| 194 | - (float)$fleet_outcome_data[UBE_RESOURCES_LOST][RES_METAL], |
|
| 195 | - (float)$fleet_outcome_data[UBE_RESOURCES_LOST][RES_CRYSTAL], |
|
| 196 | - (float)$fleet_outcome_data[UBE_RESOURCES_LOST][RES_DEUTERIUM], |
|
| 194 | + (float) $fleet_outcome_data[UBE_RESOURCES_LOST][RES_METAL], |
|
| 195 | + (float) $fleet_outcome_data[UBE_RESOURCES_LOST][RES_CRYSTAL], |
|
| 196 | + (float) $fleet_outcome_data[UBE_RESOURCES_LOST][RES_DEUTERIUM], |
|
| 197 | 197 | |
| 198 | - (float)$fleet_outcome_data[UBE_CARGO_DROPPED][RES_METAL], |
|
| 199 | - (float)$fleet_outcome_data[UBE_CARGO_DROPPED][RES_CRYSTAL], |
|
| 200 | - (float)$fleet_outcome_data[UBE_CARGO_DROPPED][RES_DEUTERIUM], |
|
| 198 | + (float) $fleet_outcome_data[UBE_CARGO_DROPPED][RES_METAL], |
|
| 199 | + (float) $fleet_outcome_data[UBE_CARGO_DROPPED][RES_CRYSTAL], |
|
| 200 | + (float) $fleet_outcome_data[UBE_CARGO_DROPPED][RES_DEUTERIUM], |
|
| 201 | 201 | |
| 202 | - (float)$fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_METAL], |
|
| 203 | - (float)$fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_CRYSTAL], |
|
| 204 | - (float)$fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_DEUTERIUM], |
|
| 202 | + (float) $fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_METAL], |
|
| 203 | + (float) $fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_CRYSTAL], |
|
| 204 | + (float) $fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_DEUTERIUM], |
|
| 205 | 205 | |
| 206 | - (float)$fleet_outcome_data[UBE_RESOURCES_LOST_IN_METAL][RES_METAL], |
|
| 206 | + (float) $fleet_outcome_data[UBE_RESOURCES_LOST_IN_METAL][RES_METAL], |
|
| 207 | 207 | ); |
| 208 | 208 | |
| 209 | 209 | // Сохраняем результаты по юнитам - потеряно и восстановлено |
| 210 | - foreach($fleet_info[UBE_COUNT] as $unit_id => $unit_count) |
|
| 210 | + foreach ($fleet_info[UBE_COUNT] as $unit_id => $unit_count) |
|
| 211 | 211 | { |
| 212 | - if($fleet_outcome_data[UBE_UNITS_LOST][$unit_id] || $fleet_outcome_data[UBE_DEFENCE_RESTORE][$unit_id]) |
|
| 212 | + if ($fleet_outcome_data[UBE_UNITS_LOST][$unit_id] || $fleet_outcome_data[UBE_DEFENCE_RESTORE][$unit_id]) |
|
| 213 | 213 | { |
| 214 | 214 | $unit_sort_order++; |
| 215 | 215 | $sql_perform['ube_report_outcome_unit'][] = array( |
@@ -217,8 +217,8 @@ discard block |
||
| 217 | 217 | $fleet_id, |
| 218 | 218 | |
| 219 | 219 | $unit_id, |
| 220 | - (float)$fleet_outcome_data[UBE_DEFENCE_RESTORE][$unit_id], |
|
| 221 | - (float)$fleet_outcome_data[UBE_UNITS_LOST][$unit_id], |
|
| 220 | + (float) $fleet_outcome_data[UBE_DEFENCE_RESTORE][$unit_id], |
|
| 221 | + (float) $fleet_outcome_data[UBE_UNITS_LOST][$unit_id], |
|
| 222 | 222 | |
| 223 | 223 | $unit_sort_order, |
| 224 | 224 | ); |
@@ -228,11 +228,11 @@ discard block |
||
| 228 | 228 | |
| 229 | 229 | // Сохраняем информацию о раундах |
| 230 | 230 | $unit_sort_order = 0; |
| 231 | - foreach($combat_data[UBE_ROUNDS] as $round => &$round_data) |
|
| 231 | + foreach ($combat_data[UBE_ROUNDS] as $round => &$round_data) |
|
| 232 | 232 | { |
| 233 | - foreach($round_data[UBE_FLEETS] as $fleet_id => &$fleet_data) |
|
| 233 | + foreach ($round_data[UBE_FLEETS] as $fleet_id => &$fleet_data) |
|
| 234 | 234 | { |
| 235 | - foreach($fleet_data[UBE_COUNT] as $unit_id => $unit_count) |
|
| 235 | + foreach ($fleet_data[UBE_COUNT] as $unit_id => $unit_count) |
|
| 236 | 236 | { |
| 237 | 237 | $unit_sort_order++; |
| 238 | 238 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | |
| 245 | 245 | $unit_id, |
| 246 | 246 | $unit_count, |
| 247 | - (int)$fleet_data[UBE_UNITS_BOOM][$unit_id], |
|
| 247 | + (int) $fleet_data[UBE_UNITS_BOOM][$unit_id], |
|
| 248 | 248 | |
| 249 | 249 | $fleet_data[UBE_ATTACK][$unit_id], |
| 250 | 250 | $fleet_data[UBE_SHIELD][$unit_id], |
@@ -261,13 +261,13 @@ discard block |
||
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | // Пакетная вставка данных |
| 264 | - foreach($sql_perform as $table_name => $table_data) |
|
| 264 | + foreach ($sql_perform as $table_name => $table_data) |
|
| 265 | 265 | { |
| 266 | - if(count($table_data) < 2) |
|
| 266 | + if (count($table_data) < 2) |
|
| 267 | 267 | { |
| 268 | 268 | continue; |
| 269 | 269 | } |
| 270 | - foreach($table_data as &$record_data) |
|
| 270 | + foreach ($table_data as &$record_data) |
|
| 271 | 271 | { |
| 272 | 272 | $record_data = '(' . implode(',', $record_data) . ')'; |
| 273 | 273 | } |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | $report_cypher = db_escape($report_cypher); |
| 287 | 287 | |
| 288 | 288 | $report_row = doquery("SELECT * FROM {{ube_report}} WHERE ube_report_cypher = '{$report_cypher}' LIMIT 1", true); |
| 289 | - if(!$report_row) |
|
| 289 | + if (!$report_row) |
|
| 290 | 290 | { |
| 291 | 291 | return UBE_REPORT_NOT_FOUND; |
| 292 | 292 | } |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | $outcome = &$combat_data[UBE_OUTCOME]; |
| 341 | 341 | |
| 342 | 342 | $query = doquery("SELECT * FROM {{ube_report_player}} WHERE `ube_report_id` = {$report_row['ube_report_id']}"); |
| 343 | - while($player_row = db_fetch($query)) |
|
| 343 | + while ($player_row = db_fetch($query)) |
|
| 344 | 344 | { |
| 345 | 345 | $combat_data[UBE_PLAYERS][$player_row['ube_report_player_player_id']] = array( |
| 346 | 346 | UBE_NAME => $player_row['ube_report_player_name'], |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | $query = doquery("SELECT * FROM {{ube_report_fleet}} WHERE `ube_report_id` = {$report_row['ube_report_id']}"); |
| 358 | - while($fleet_row = db_fetch($query)) |
|
| 358 | + while ($fleet_row = db_fetch($query)) |
|
| 359 | 359 | { |
| 360 | 360 | $combat_data[UBE_FLEETS][$fleet_row['ube_report_fleet_fleet_id']] = array( |
| 361 | 361 | UBE_OWNER => $fleet_row['ube_report_fleet_player_id'], |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | $rounds_data = &$combat_data[UBE_ROUNDS]; |
| 390 | 390 | |
| 391 | 391 | $query = doquery("SELECT * FROM {{ube_report_unit}} WHERE `ube_report_id` = {$report_row['ube_report_id']} ORDER BY `ube_report_unit_sort_order`"); |
| 392 | - while($round_row = db_fetch($query)) |
|
| 392 | + while ($round_row = db_fetch($query)) |
|
| 393 | 393 | { |
| 394 | 394 | $round = $round_row['ube_report_unit_round']; |
| 395 | 395 | $fleet_id = $round_row['ube_report_unit_fleet_id']; |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | $side = $combat_data[UBE_FLEETS][$fleet_id][UBE_FLEET_TYPE]; |
| 398 | 398 | $rounds_data[$round][$side][UBE_ATTACK][$fleet_id] = 0; |
| 399 | 399 | |
| 400 | - if(!isset($rounds_data[$round][UBE_FLEETS][$fleet_id])) |
|
| 400 | + if (!isset($rounds_data[$round][UBE_FLEETS][$fleet_id])) |
|
| 401 | 401 | { |
| 402 | 402 | $rounds_data[$round][UBE_FLEETS][$fleet_id] = array(); |
| 403 | 403 | } |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | |
| 419 | 419 | |
| 420 | 420 | $query = doquery("SELECT * FROM {{ube_report_outcome_fleet}} WHERE `ube_report_id` = {$report_row['ube_report_id']}"); |
| 421 | - while($row = db_fetch($query)) |
|
| 421 | + while ($row = db_fetch($query)) |
|
| 422 | 422 | { |
| 423 | 423 | $fleet_id = $row['ube_report_outcome_fleet_fleet_id']; |
| 424 | 424 | |
@@ -452,10 +452,10 @@ discard block |
||
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | $query = doquery("SELECT * FROM {{ube_report_outcome_unit}} WHERE `ube_report_id` = {$report_row['ube_report_id']} ORDER BY `ube_report_outcome_unit_sort_order`"); |
| 455 | - while($row = db_fetch($query)) |
|
| 455 | + while ($row = db_fetch($query)) |
|
| 456 | 456 | { |
| 457 | 457 | $fleet_id = $row['ube_report_outcome_unit_fleet_id']; |
| 458 | - $side= $combat_data[UBE_FLEETS][$fleet_id][UBE_FLEET_TYPE]; |
|
| 458 | + $side = $combat_data[UBE_FLEETS][$fleet_id][UBE_FLEET_TYPE]; |
|
| 459 | 459 | $outcome[$side][UBE_FLEETS][$fleet_id][UBE_UNITS_LOST][$row['ube_report_outcome_unit_unit_id']] = $row['ube_report_outcome_unit_lost']; |
| 460 | 460 | $outcome[$side][UBE_FLEETS][$fleet_id][UBE_DEFENCE_RESTORE][$row['ube_report_outcome_unit_unit_id']] = $row['ube_report_outcome_unit_restored']; |
| 461 | 461 | } |
@@ -487,10 +487,10 @@ discard block |
||
| 487 | 487 | $fleets_info = &$combat_data[UBE_FLEETS]; |
| 488 | 488 | $round_template = array(); |
| 489 | 489 | $round_data = &$combat_data[UBE_ROUNDS][$round]; |
| 490 | - foreach(array(UBE_ATTACKERS, UBE_DEFENDERS) as $side) |
|
| 490 | + foreach (array(UBE_ATTACKERS, UBE_DEFENDERS) as $side) |
|
| 491 | 491 | { |
| 492 | 492 | $round_data[$side][UBE_ATTACK] = $round_data[$side][UBE_ATTACK] ? $round_data[$side][UBE_ATTACK] : array(); |
| 493 | - foreach($round_data[$side][UBE_ATTACK] as $fleet_id => $temp) |
|
| 493 | + foreach ($round_data[$side][UBE_ATTACK] as $fleet_id => $temp) |
|
| 494 | 494 | { |
| 495 | 495 | $fleet_data = &$round_data[UBE_FLEETS][$fleet_id]; |
| 496 | 496 | $fleet_data_prev = &$combat_data[UBE_ROUNDS][$round - 1][UBE_FLEETS][$fleet_id]; |
@@ -500,14 +500,14 @@ discard block |
||
| 500 | 500 | 'PLAYER_NAME' => htmlentities($combat_data[UBE_PLAYERS][$fleets_info[$fleet_id][UBE_OWNER]][UBE_NAME], ENT_COMPAT, 'UTF-8'), |
| 501 | 501 | ); |
| 502 | 502 | |
| 503 | - if(is_array($combat_data[UBE_FLEETS][$fleet_id][UBE_PLANET])) |
|
| 503 | + if (is_array($combat_data[UBE_FLEETS][$fleet_id][UBE_PLANET])) |
|
| 504 | 504 | { |
| 505 | 505 | $fleet_template += $combat_data[UBE_FLEETS][$fleet_id][UBE_PLANET]; |
| 506 | 506 | $fleet_template[PLANET_NAME] = $fleet_template[PLANET_NAME] ? htmlentities($fleet_template[PLANET_NAME], ENT_COMPAT, 'UTF-8') : ''; |
| 507 | 507 | $fleet_template['PLANET_TYPE_TEXT'] = $lang['sys_planet_type_sh'][$fleet_template['PLANET_TYPE']]; |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | - foreach($fleet_data[UBE_COUNT] as $unit_id => $unit_count) |
|
| 510 | + foreach ($fleet_data[UBE_COUNT] as $unit_id => $unit_count) |
|
| 511 | 511 | { |
| 512 | 512 | $shields_original = $fleet_data[UBE_SHIELD_BASE][$unit_id] * $fleet_data_prev[UBE_COUNT][$unit_id]; |
| 513 | 513 | $ship_template = array( |
@@ -540,11 +540,11 @@ discard block |
||
| 540 | 540 | global $lang; |
| 541 | 541 | |
| 542 | 542 | $result = array(); |
| 543 | - if(!empty($array)) |
|
| 543 | + if (!empty($array)) |
|
| 544 | 544 | { |
| 545 | - foreach($array as $unit_id => $unit_count) |
|
| 545 | + foreach ($array as $unit_id => $unit_count) |
|
| 546 | 546 | { |
| 547 | - if($unit_count) |
|
| 547 | + if ($unit_count) |
|
| 548 | 548 | { |
| 549 | 549 | $result[] = array( |
| 550 | 550 | 'NAME' => $lang['tech'][$unit_id], |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | ); |
| 553 | 553 | } |
| 554 | 554 | } |
| 555 | - if($header && count($result)) |
|
| 555 | + if ($header && count($result)) |
|
| 556 | 556 | { |
| 557 | 557 | array_unshift($result, array('NAME' => $header)); |
| 558 | 558 | } |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | // Генерирует данные для отчета из разобранных данных боя |
| 566 | 566 | function sn_ube_report_generate(&$combat_data, &$template_result) |
| 567 | 567 | { |
| 568 | - if(!is_array($combat_data)) |
|
| 568 | + if (!is_array($combat_data)) |
|
| 569 | 569 | { |
| 570 | 570 | return; |
| 571 | 571 | } |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | $fleets_info = &$combat_data[UBE_FLEETS]; |
| 578 | 578 | $outcome = &$combat_data[UBE_OUTCOME]; |
| 579 | 579 | // Генерируем отчет по флотам |
| 580 | - for($round = 1; $round <= count($combat_data[UBE_ROUNDS]) - 1; $round++) |
|
| 580 | + for ($round = 1; $round <= count($combat_data[UBE_ROUNDS]) - 1; $round++) |
|
| 581 | 581 | { |
| 582 | 582 | $round_template = array( |
| 583 | 583 | 'NUMBER' => $round, |
@@ -589,13 +589,13 @@ discard block |
||
| 589 | 589 | } |
| 590 | 590 | |
| 591 | 591 | // Боевые потери флотов |
| 592 | - foreach(array(UBE_ATTACKERS, UBE_DEFENDERS) as $side) |
|
| 592 | + foreach (array(UBE_ATTACKERS, UBE_DEFENDERS) as $side) |
|
| 593 | 593 | { |
| 594 | - if(!is_array($outcome[$side][UBE_FLEETS])) |
|
| 594 | + if (!is_array($outcome[$side][UBE_FLEETS])) |
|
| 595 | 595 | { |
| 596 | 596 | continue; |
| 597 | 597 | } |
| 598 | - foreach($outcome[$side][UBE_FLEETS] as $fleet_id => $temp) |
|
| 598 | + foreach ($outcome[$side][UBE_FLEETS] as $fleet_id => $temp) |
|
| 599 | 599 | { |
| 600 | 600 | $player_info = &$players_info[$fleets_info[$fleet_id][UBE_OWNER]]; |
| 601 | 601 | $fleet_outcome = &$outcome[UBE_FLEETS][$fleet_id]; |
@@ -620,9 +620,9 @@ discard block |
||
| 620 | 620 | |
| 621 | 621 | // Обломки |
| 622 | 622 | $debris = array(); |
| 623 | - foreach(array(RES_METAL, RES_CRYSTAL) as $resource_id) |
|
| 623 | + foreach (array(RES_METAL, RES_CRYSTAL) as $resource_id) |
|
| 624 | 624 | { |
| 625 | - if($resource_amount = $outcome[UBE_DEBRIS][$resource_id]) |
|
| 625 | + if ($resource_amount = $outcome[UBE_DEBRIS][$resource_id]) |
|
| 626 | 626 | { |
| 627 | 627 | $debris[] = array( |
| 628 | 628 | 'NAME' => $lang['tech'][$resource_id], |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | |
| 636 | 636 | // Координаты, тип и название планеты - если есть |
| 637 | 637 | //R $planet_owner_id = $combat_data[UBE_FLEETS][0][UBE_OWNER]; |
| 638 | - if(isset($combat_data[UBE_OUTCOME][UBE_PLANET])) |
|
| 638 | + if (isset($combat_data[UBE_OUTCOME][UBE_PLANET])) |
|
| 639 | 639 | { |
| 640 | 640 | $template_result += $combat_data[UBE_OUTCOME][UBE_PLANET]; |
| 641 | 641 | $template_result[PLANET_NAME] = str_replace(' ', ' ', htmlentities($template_result[PLANET_NAME], ENT_COMPAT, 'UTF-8')); |
@@ -2,8 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | // ------------------------------------------------------------------------------------------------ |
| 4 | 4 | // Записывает боевой отчет в БД |
| 5 | -function sn_ube_report_save(&$combat_data) |
|
| 6 | -{ |
|
| 5 | +function sn_ube_report_save(&$combat_data) { |
|
| 7 | 6 | global $config; |
| 8 | 7 | |
| 9 | 8 | // Если уже есть ИД репорта - значит репорт был взят из таблицы. С таким мы не работаем |
@@ -281,8 +280,7 @@ discard block |
||
| 281 | 280 | |
| 282 | 281 | // ------------------------------------------------------------------------------------------------ |
| 283 | 282 | // Читает боевой отчет из БД |
| 284 | -function sn_ube_report_load($report_cypher) |
|
| 285 | -{ |
|
| 283 | +function sn_ube_report_load($report_cypher) { |
|
| 286 | 284 | $report_cypher = db_escape($report_cypher); |
| 287 | 285 | |
| 288 | 286 | $report_row = doquery("SELECT * FROM {{ube_report}} WHERE ube_report_cypher = '{$report_cypher}' LIMIT 1", true); |
@@ -480,8 +478,7 @@ discard block |
||
| 480 | 478 | |
| 481 | 479 | // ------------------------------------------------------------------------------------------------ |
| 482 | 480 | // Парсит инфу о раунде для темплейта |
| 483 | -function sn_ube_report_round_fleet(&$combat_data, $round) |
|
| 484 | -{ |
|
| 481 | +function sn_ube_report_round_fleet(&$combat_data, $round) { |
|
| 485 | 482 | global $lang; |
| 486 | 483 | |
| 487 | 484 | $fleets_info = &$combat_data[UBE_FLEETS]; |
@@ -535,8 +532,7 @@ discard block |
||
| 535 | 532 | |
| 536 | 533 | // ------------------------------------------------------------------------------------------------ |
| 537 | 534 | // Рендерит таблицу общего результата боя |
| 538 | -function sn_ube_report_table_render(&$array, $header) |
|
| 539 | -{ |
|
| 535 | +function sn_ube_report_table_render(&$array, $header) { |
|
| 540 | 536 | global $lang; |
| 541 | 537 | |
| 542 | 538 | $result = array(); |
@@ -563,8 +559,7 @@ discard block |
||
| 563 | 559 | |
| 564 | 560 | // ------------------------------------------------------------------------------------------------ |
| 565 | 561 | // Генерирует данные для отчета из разобранных данных боя |
| 566 | -function sn_ube_report_generate(&$combat_data, &$template_result) |
|
| 567 | -{ |
|
| 562 | +function sn_ube_report_generate(&$combat_data, &$template_result) { |
|
| 568 | 563 | if(!is_array($combat_data)) |
| 569 | 564 | { |
| 570 | 565 | return; |
@@ -92,9 +92,9 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | for ($Option = 10; $Option >= 0; $Option--) |
| 94 | 94 | { |
| 95 | - $template->assign_block_vars('option', array( |
|
| 96 | - 'VALUE' => $Option * 10, |
|
| 97 | - )); |
|
| 95 | + $template->assign_block_vars('option', array( |
|
| 96 | + 'VALUE' => $Option * 10, |
|
| 97 | + )); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | $caps_real = eco_get_planet_caps($user, $planetrow, 3600); |
@@ -163,14 +163,14 @@ discard block |
||
| 163 | 163 | int_calc_storage_bar(RES_DEUTERIUM); |
| 164 | 164 | |
| 165 | 165 | $template->assign_vars(array( |
| 166 | - 'PLANET_NAME' => $planetrow['name'], |
|
| 167 | - 'PLANET_TYPE' => $planetrow['planet_type'], |
|
| 168 | - 'PLANET_DENSITY_INDEX' => $planet_density_index, |
|
| 169 | - 'PLANET_CORE_TEXT' => $lang['uni_planet_density_types'][$planet_density_index], |
|
| 166 | + 'PLANET_NAME' => $planetrow['name'], |
|
| 167 | + 'PLANET_TYPE' => $planetrow['planet_type'], |
|
| 168 | + 'PLANET_DENSITY_INDEX' => $planet_density_index, |
|
| 169 | + 'PLANET_CORE_TEXT' => $lang['uni_planet_density_types'][$planet_density_index], |
|
| 170 | 170 | |
| 171 | - 'PRODUCTION_LEVEL' => floor($caps_real['efficiency'] * 100), |
|
| 171 | + 'PRODUCTION_LEVEL' => floor($caps_real['efficiency'] * 100), |
|
| 172 | 172 | |
| 173 | - 'PAGE_HINT' => $lang['res_hint'], |
|
| 173 | + 'PAGE_HINT' => $lang['res_hint'], |
|
| 174 | 174 | )); |
| 175 | 175 | |
| 176 | 176 | display($template, $lang['res_planet_production']); |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | )); |
| 47 | 47 | }; |
| 48 | 48 | |
| 49 | -$ValidList['percent'] = array ( 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 ); |
|
| 49 | +$ValidList['percent'] = array(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100); |
|
| 50 | 50 | $template = gettemplate('resources', true); |
| 51 | 51 | |
| 52 | 52 | $transmutation_result = sn_sys_planet_core_transmute($user, $planetrow); |
| 53 | -if(!empty($transmutation_result)) |
|
| 53 | +if (!empty($transmutation_result)) |
|
| 54 | 54 | { |
| 55 | 55 | $template->assign_block_vars('result', $transmutation_result); // array('STATUS' => $transmutation_result['STATUS'], 'MESSAGE' => $transmutation_result['MESSAGE'])); |
| 56 | 56 | } |
@@ -59,20 +59,20 @@ discard block |
||
| 59 | 59 | $production = $_POST['production']; |
| 60 | 60 | //$SubQry = ''; |
| 61 | 61 | $SubQry = array(); |
| 62 | -if(is_array($production)) { |
|
| 63 | - foreach($production as $prod_id => $percent) { |
|
| 64 | - if($percent > 100 || $percent < 0) { |
|
| 62 | +if (is_array($production)) { |
|
| 63 | + foreach ($production as $prod_id => $percent) { |
|
| 64 | + if ($percent > 100 || $percent < 0) { |
|
| 65 | 65 | $debug->warning('Supplying wrong production percent (less then 0 or greater then 100)', 'Hack attempt', 302, array('base_dump' => true)); |
| 66 | 66 | die(); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $prod_id = intval($prod_id); |
| 70 | - if(in_array($prod_id, $sn_group_factories) && get_unit_param($prod_id, P_MINING_IS_MANAGED)) { |
|
| 70 | + if (in_array($prod_id, $sn_group_factories) && get_unit_param($prod_id, P_MINING_IS_MANAGED)) { |
|
| 71 | 71 | $field_name = pname_factory_production_field_name($prod_id); |
| 72 | 72 | $percent = floor($percent / 10); |
| 73 | 73 | $planetrow[$field_name] = $percent; |
| 74 | 74 | //$SubQry .= "`{$field_name}` = '{$percent}',"; |
| 75 | - $SubQry[] = "`{$field_name}` = '{$percent}'"; |
|
| 75 | + $SubQry[] = "`{$field_name}` = '{$percent}'"; |
|
| 76 | 76 | } else { |
| 77 | 77 | $debug->warning('Supplying wrong ID in production array - attempt to change some field - ID' . $prod_id, 'Resource Page', 301); |
| 78 | 78 | continue; |
@@ -108,9 +108,9 @@ discard block |
||
| 108 | 108 | 'ENERGY_TYPE' => pretty_number($caps_real['production'][RES_ENERGY][0], true, true), |
| 109 | 109 | )); |
| 110 | 110 | |
| 111 | -foreach($sn_group_factories as $unit_id) |
|
| 111 | +foreach ($sn_group_factories as $unit_id) |
|
| 112 | 112 | { |
| 113 | - if(mrc_get_level($user, $planetrow, $unit_id) > 0 && get_unit_param($unit_id)) |
|
| 113 | + if (mrc_get_level($user, $planetrow, $unit_id) > 0 && get_unit_param($unit_id)) |
|
| 114 | 114 | { |
| 115 | 115 | $level_plain = mrc_get_level($user, $planetrow, $unit_id, false, true); |
| 116 | 116 | $template->assign_block_vars('production', array( |
@@ -24,8 +24,7 @@ |
||
| 24 | 24 | |
| 25 | 25 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
| 26 | 26 | |
| 27 | -function int_calc_storage_bar($resource_id) |
|
| 28 | -{ |
|
| 27 | +function int_calc_storage_bar($resource_id) { |
|
| 29 | 28 | global $lang, $template, $caps_real, $planetrow, $user; |
| 30 | 29 | |
| 31 | 30 | $totalProduction = $caps_real['total'][$resource_id]; |
@@ -39,8 +39,8 @@ |
||
| 39 | 39 | 0 => $row['visit_time'], // start |
| 40 | 40 | 1 => $row['visit_time'], // end |
| 41 | 41 | ) |
| 42 | - //: false |
|
| 43 | - ; |
|
| 42 | + //: false |
|
| 43 | + ; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $session_list = array(); |
@@ -19,13 +19,13 @@ discard block |
||
| 19 | 19 | // define('SESSION_INTERRUPT', 15*60); // Можно увеличить до 4 часов - никито не может сидеть 2 суток с перерывом менее 4 часов |
| 20 | 20 | // define('SUSPICIOUS_LONG', 2 * 60*60); // Тогда это увеличиваем до, скажем суток - и там смотрим |
| 21 | 21 | |
| 22 | -define('SESSION_INTERRUPT', 1 * 60*60); // Можно увеличить до 4 часов - никито не может сидеть 2 суток с перерывом менее 4 часов |
|
| 23 | -define('SUSPICIOUS_LONG', 16 * 60*60); // Тогда это увеличиваем до, скажем суток - и там смотрим |
|
| 22 | +define('SESSION_INTERRUPT', 1 * 60 * 60); // Можно увеличить до 4 часов - никито не может сидеть 2 суток с перерывом менее 4 часов |
|
| 23 | +define('SUSPICIOUS_LONG', 16 * 60 * 60); // Тогда это увеличиваем до, скажем суток - и там смотрим |
|
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | function check_suspicious(&$session, &$session_list_last_id, &$row) { |
| 27 | 27 | $session[2] = $session[1] - $session[0]; |
| 28 | - if($session[2] > SUSPICIOUS_LONG) |
|
| 28 | + if ($session[2] > SUSPICIOUS_LONG) |
|
| 29 | 29 | { |
| 30 | 30 | $session[2] = pretty_time($session[2]); |
| 31 | 31 | $session[0] = date(FMT_DATE_TIME_SQL, $session[0]); |
@@ -46,24 +46,24 @@ discard block |
||
| 46 | 46 | $session_list = array(); |
| 47 | 47 | $query = doquery("SELECT `visit_time`, user_id FROM {{counter}} where user_id <> 0 and visit_time > UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 7 DAY)) order by user_id, visit_time;"); |
| 48 | 48 | $session = array(); |
| 49 | -if($row = db_fetch($query)) { |
|
| 49 | +if ($row = db_fetch($query)) { |
|
| 50 | 50 | $session = array( |
| 51 | 51 | 0 => strtotime($row['visit_time']), // start |
| 52 | 52 | 1 => strtotime($row['visit_time']), // end |
| 53 | 53 | ); |
| 54 | 54 | $last_id = $row['user_id']; |
| 55 | 55 | } |
| 56 | -while($row = db_fetch($query)) { |
|
| 56 | +while ($row = db_fetch($query)) { |
|
| 57 | 57 | $row['visit_time'] = strtotime($row['visit_time']); |
| 58 | - if($last_id == $row['user_id']) { |
|
| 58 | + if ($last_id == $row['user_id']) { |
|
| 59 | 59 | // Тот же юзер |
| 60 | - if($row['visit_time'] - $session[1] <= SESSION_INTERRUPT) { // Та же сессия |
|
| 60 | + if ($row['visit_time'] - $session[1] <= SESSION_INTERRUPT) { // Та же сессия |
|
| 61 | 61 | $session[1] = $row['visit_time']; |
| 62 | 62 | } else { |
| 63 | 63 | // Новая сессия |
| 64 | 64 | // check_suspicious($session, $session_list[$last_id], $row); |
| 65 | 65 | $session[2] = $session[1] - $session[0]; |
| 66 | - if($session[2] > SUSPICIOUS_LONG) |
|
| 66 | + if ($session[2] > SUSPICIOUS_LONG) |
|
| 67 | 67 | { |
| 68 | 68 | $session[2] = pretty_time($session[2]); |
| 69 | 69 | $session[0] = date(FMT_DATE_TIME_SQL, $session[0]); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | } else { |
| 79 | 79 | // check_suspicious($session, $session_list[$last_id], $row); |
| 80 | 80 | $session[2] = $session[1] - $session[0]; |
| 81 | - if($session[2] > SUSPICIOUS_LONG) |
|
| 81 | + if ($session[2] > SUSPICIOUS_LONG) |
|
| 82 | 82 | { |
| 83 | 83 | $session[2] = pretty_time($session[2]); |
| 84 | 84 | $session[0] = date(FMT_DATE_TIME_SQL, $session[0]); |
@@ -93,11 +93,11 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | -if($last_id) { |
|
| 96 | +if ($last_id) { |
|
| 97 | 97 | // check_suspicious($session, $session_list[$last_id], $row = array('time' => 0)); |
| 98 | 98 | $session[2] = $session[1] - $session[0]; |
| 99 | 99 | |
| 100 | - if($session[2] > SUSPICIOUS_LONG) |
|
| 100 | + if ($session[2] > SUSPICIOUS_LONG) |
|
| 101 | 101 | { |
| 102 | 102 | $session[2] = pretty_time($session[2]); |
| 103 | 103 | $session[0] = date(FMT_DATE_TIME_SQL, $session[0]); |
@@ -111,9 +111,9 @@ discard block |
||
| 111 | 111 | print("<td>ID</td><td>Username</td><td>Start</td><td>End</td><td>Length</td>"); |
| 112 | 112 | print("<td>Last online</td>"); |
| 113 | 113 | print("</tr>"); |
| 114 | -foreach($session_list as $user_id => $value) { |
|
| 114 | +foreach ($session_list as $user_id => $value) { |
|
| 115 | 115 | $user_record = doquery("SELECT `username`, onlinetime FROM {{users}} WHERE id = {$user_id};", true); |
| 116 | - foreach($value as $interval_data) { |
|
| 116 | + foreach ($value as $interval_data) { |
|
| 117 | 117 | print("<tr>"); |
| 118 | 118 | print("<td>{$user_id}</td><td>{$user_record['username']}</td><td>{$interval_data[0]}</td><td>{$interval_data[1]}</td><td>{$interval_data[2]}</td>"); |
| 119 | 119 | print("<td>" . date(FMT_DATE_TIME_SQL, $user_record['onlinetime']) . "</td>"); |
@@ -22,12 +22,10 @@ discard block |
||
| 22 | 22 | if($delete = sys_get_param_id('delete')) |
| 23 | 23 | { |
| 24 | 24 | doquery("DELETE FROM `{{logs}}` WHERE `log_id` = {$delete} LIMIT 1;"); |
| 25 | -} |
|
| 26 | -elseif(sys_get_param_str('delete_update_info')) |
|
| 25 | +} elseif(sys_get_param_str('delete_update_info')) |
|
| 27 | 26 | { |
| 28 | 27 | doquery("DELETE FROM `{{logs}}` WHERE `log_code` in (103, 180, 191);"); |
| 29 | -} |
|
| 30 | -elseif(sys_get_param_str('deleteall') == 'yes') |
|
| 28 | +} elseif(sys_get_param_str('deleteall') == 'yes') |
|
| 31 | 29 | { |
| 32 | 30 | // doquery("TRUNCATE TABLE `{{logs}}`"); |
| 33 | 31 | } |
@@ -51,8 +49,7 @@ discard block |
||
| 51 | 49 | } |
| 52 | 50 | } |
| 53 | 51 | $template->assign_vars($errorInfo); |
| 54 | -} |
|
| 55 | -else |
|
| 52 | +} else |
|
| 56 | 53 | { |
| 57 | 54 | $template = gettemplate('admin/adm_log_main', true); |
| 58 | 55 | |
@@ -18,26 +18,26 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | messageBoxAdminAccessDenied(AUTH_LEVEL_ADMINISTRATOR); |
| 20 | 20 | |
| 21 | -if($delete = sys_get_param_id('delete')) |
|
| 21 | +if ($delete = sys_get_param_id('delete')) |
|
| 22 | 22 | { |
| 23 | 23 | doquery("DELETE FROM `{{logs}}` WHERE `log_id` = {$delete} LIMIT 1;"); |
| 24 | 24 | } |
| 25 | -elseif(sys_get_param_str('delete_update_info')) |
|
| 25 | +elseif (sys_get_param_str('delete_update_info')) |
|
| 26 | 26 | { |
| 27 | 27 | doquery("DELETE FROM `{{logs}}` WHERE `log_code` in (103, 180, 191);"); |
| 28 | 28 | } |
| 29 | -elseif(sys_get_param_str('deleteall') == 'yes') |
|
| 29 | +elseif (sys_get_param_str('deleteall') == 'yes') |
|
| 30 | 30 | { |
| 31 | 31 | // doquery("TRUNCATE TABLE `{{logs}}`"); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | -if($detail = sys_get_param_id('detail')) |
|
| 34 | +if ($detail = sys_get_param_id('detail')) |
|
| 35 | 35 | { |
| 36 | 36 | $template = gettemplate('admin/adm_log_main_detail', true); |
| 37 | 37 | |
| 38 | 38 | $errorInfo = doquery("SELECT * FROM `{{logs}}` WHERE `log_id` = {$detail} LIMIT 1;", true); |
| 39 | 39 | $error_dump = unserialize($errorInfo['log_dump']); |
| 40 | - if(is_array($error_dump)) |
|
| 40 | + if (is_array($error_dump)) |
|
| 41 | 41 | { |
| 42 | 42 | foreach ($error_dump as $key => $value) |
| 43 | 43 | { |
@@ -57,11 +57,11 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | $i = 0; |
| 59 | 59 | $query = doquery("SELECT * FROM `{{logs}}` ORDER BY log_id DESC LIMIT 100;"); |
| 60 | - while($u = db_fetch($query)) |
|
| 60 | + while ($u = db_fetch($query)) |
|
| 61 | 61 | { |
| 62 | 62 | $i++; |
| 63 | 63 | $v = array(); |
| 64 | - foreach($u as $key => $value) |
|
| 64 | + foreach ($u as $key => $value) |
|
| 65 | 65 | { |
| 66 | 66 | $v[strtoupper($key)] = $value; |
| 67 | 67 | } |
@@ -72,8 +72,7 @@ |
||
| 72 | 72 | if(sys_get_param('page_prev') && $int_page_current > 1) |
| 73 | 73 | { |
| 74 | 74 | $int_page_current--; |
| 75 | -} |
|
| 76 | -elseif(sys_get_param('page_next') && $int_page_current < $page_max) |
|
| 75 | +} elseif(sys_get_param('page_next') && $int_page_current < $page_max) |
|
| 77 | 76 | { |
| 78 | 77 | $int_page_current++; |
| 79 | 78 | } |
@@ -8,8 +8,8 @@ discard block |
||
| 8 | 8 | * |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -define('INSIDE' , true); |
|
| 12 | -define('INSTALL' , false); |
|
| 11 | +define('INSIDE', true); |
|
| 12 | +define('INSTALL', false); |
|
| 13 | 13 | define('IN_ADMIN', true); |
| 14 | 14 | |
| 15 | 15 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
@@ -28,9 +28,9 @@ discard block |
||
| 28 | 28 | ), |
| 29 | 29 | ); |
| 30 | 30 | $template->assign_block_vars('int_type_selected', $allowed_types[-1]); |
| 31 | -foreach($sn_message_class_list as $key => $value) |
|
| 31 | +foreach ($sn_message_class_list as $key => $value) |
|
| 32 | 32 | { |
| 33 | - if($key == MSG_TYPE_NEW || $key == MSG_TYPE_OUTBOX) |
|
| 33 | + if ($key == MSG_TYPE_NEW || $key == MSG_TYPE_OUTBOX) |
|
| 34 | 34 | { |
| 35 | 35 | continue; |
| 36 | 36 | } |
@@ -43,19 +43,19 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | $message_delete = sys_get_param_id('msg_del'); |
| 46 | -if(sys_get_param('str_delete_selected') && is_array($message_delete = sys_get_param('selected')) && !empty($message_delete)) |
|
| 46 | +if (sys_get_param('str_delete_selected') && is_array($message_delete = sys_get_param('selected')) && !empty($message_delete)) |
|
| 47 | 47 | { |
| 48 | 48 | $message_delete = implode(', ', $message_delete); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | -if($message_delete) |
|
| 51 | +if ($message_delete) |
|
| 52 | 52 | { |
| 53 | 53 | doquery("DELETE FROM {{messages}} WHERE `message_id` in ({$message_delete});"); |
| 54 | 54 | $template->assign_block_vars('result', array('MESSAGE' => sprintf($lang['mlst_messages_deleted'], $message_delete))); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | |
| 58 | -if(sys_get_param('str_delete_date') && checkdate($month = sys_get_param_id('delete_month'), $day = sys_get_param_id('delete_day'), $year = sys_get_param_id('delete_year'))) |
|
| 58 | +if (sys_get_param('str_delete_date') && checkdate($month = sys_get_param_id('delete_month'), $day = sys_get_param_id('delete_day'), $year = sys_get_param_id('delete_year'))) |
|
| 59 | 59 | { |
| 60 | 60 | $delete_date = "{$year}-{$month}-{$day}"; |
| 61 | 61 | doquery("DELETE FROM {{messages}} WHERE message_time <= UNIX_TIMESTAMP('{$delete_date}')" . ($int_type_selected >= 0 ? " AND `message_type` = {$int_type_selected}" : '')); |
@@ -68,16 +68,16 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | $int_page_current = min(sys_get_param_id('int_page_current', 1), $page_max); |
| 70 | 70 | |
| 71 | -if(sys_get_param('page_prev') && $int_page_current > 1) |
|
| 71 | +if (sys_get_param('page_prev') && $int_page_current > 1) |
|
| 72 | 72 | { |
| 73 | 73 | $int_page_current--; |
| 74 | 74 | } |
| 75 | -elseif(sys_get_param('page_next') && $int_page_current < $page_max) |
|
| 75 | +elseif (sys_get_param('page_next') && $int_page_current < $page_max) |
|
| 76 | 76 | { |
| 77 | 77 | $int_page_current++; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | -for($i = 1; $i <= $page_max; $i++) |
|
| 80 | +for ($i = 1; $i <= $page_max; $i++) |
|
| 81 | 81 | { |
| 82 | 82 | $template->assign_block_vars('page', array('NUMBER' => $i)); |
| 83 | 83 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $StartRec = ($int_page_current - 1) * 25; |
| 86 | 86 | |
| 87 | 87 | $Messages = db_message_list_admin_by_type($int_type_selected, $StartRec); |
| 88 | -while($row = db_fetch($Messages)) |
|
| 88 | +while ($row = db_fetch($Messages)) |
|
| 89 | 89 | { |
| 90 | 90 | $row['FROM'] = htmlentities($row['FROM'], ENT_COMPAT, 'UTF-8'); |
| 91 | 91 | $row['OWNER_NAME'] = htmlentities($row['OWNER_NAME'], ENT_COMPAT, 'UTF-8'); |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -function admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list){return sn_function_call('admin_planet_edit_mode', array(&$template, &$admin_planet_edit_mode_list));} |
|
| 3 | +function admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list) {return sn_function_call('admin_planet_edit_mode', array(&$template, &$admin_planet_edit_mode_list)); } |
|
| 4 | 4 | function sn_admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list) |
| 5 | 5 | { |
| 6 | 6 | global $lang; |
@@ -19,19 +19,19 @@ discard block |
||
| 19 | 19 | return $mode; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | -function admin_planet_edit_template(&$template, $edit_planet_row, $mode){return sn_function_call('admin_planet_edit_template', array(&$template, $edit_planet_row, $mode));} |
|
| 22 | +function admin_planet_edit_template(&$template, $edit_planet_row, $mode) {return sn_function_call('admin_planet_edit_template', array(&$template, $edit_planet_row, $mode)); } |
|
| 23 | 23 | function sn_admin_planet_edit_template(&$template, $edit_planet_row, $mode) |
| 24 | 24 | { |
| 25 | 25 | global $lang; |
| 26 | 26 | |
| 27 | 27 | $unit_list = sn_get_groups($mode); |
| 28 | - if(empty($unit_list)) |
|
| 28 | + if (empty($unit_list)) |
|
| 29 | 29 | { |
| 30 | 30 | return; |
| 31 | 31 | } |
| 32 | 32 | $name_list = $lang['tech']; |
| 33 | 33 | |
| 34 | - foreach($unit_list as $unit_id) |
|
| 34 | + foreach ($unit_list as $unit_id) |
|
| 35 | 35 | { |
| 36 | 36 | $template->assign_block_vars('unit', array( |
| 37 | 37 | 'ID' => $unit_id, |
@@ -42,10 +42,10 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | -function admin_planet_edit_query_string($unit_id, $unit_amount, $mode){return sn_function_call('admin_planet_edit_query_string', array($unit_id, $unit_amount, $mode));} |
|
| 45 | +function admin_planet_edit_query_string($unit_id, $unit_amount, $mode) {return sn_function_call('admin_planet_edit_query_string', array($unit_id, $unit_amount, $mode)); } |
|
| 46 | 46 | function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode) |
| 47 | 47 | { |
| 48 | - if($unit_amount && in_array($unit_id, sn_get_groups($mode))) |
|
| 48 | + if ($unit_amount && in_array($unit_id, sn_get_groups($mode))) |
|
| 49 | 49 | { |
| 50 | 50 | $unit_amount = round($unit_amount); |
| 51 | 51 | $unit_name = get_unit_param($unit_id, P_NAME); |
@@ -1,8 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | function admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list){return sn_function_call('admin_planet_edit_mode', array(&$template, &$admin_planet_edit_mode_list));} |
| 4 | -function sn_admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list) |
|
| 5 | -{ |
|
| 4 | +function sn_admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list) { |
|
| 6 | 5 | global $lang; |
| 7 | 6 | |
| 8 | 7 | $admin_planet_edit_mode_list = array_merge(isset($admin_planet_edit_mode_list) ? $admin_planet_edit_mode_list : array(), array( |
@@ -20,8 +19,7 @@ discard block |
||
| 20 | 19 | } |
| 21 | 20 | |
| 22 | 21 | function admin_planet_edit_template(&$template, $edit_planet_row, $mode){return sn_function_call('admin_planet_edit_template', array(&$template, $edit_planet_row, $mode));} |
| 23 | -function sn_admin_planet_edit_template(&$template, $edit_planet_row, $mode) |
|
| 24 | -{ |
|
| 22 | +function sn_admin_planet_edit_template(&$template, $edit_planet_row, $mode) { |
|
| 25 | 23 | global $lang; |
| 26 | 24 | |
| 27 | 25 | $unit_list = sn_get_groups($mode); |
@@ -43,15 +41,13 @@ discard block |
||
| 43 | 41 | } |
| 44 | 42 | |
| 45 | 43 | function admin_planet_edit_query_string($unit_id, $unit_amount, $mode){return sn_function_call('admin_planet_edit_query_string', array($unit_id, $unit_amount, $mode));} |
| 46 | -function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode) |
|
| 47 | -{ |
|
| 44 | +function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode) { |
|
| 48 | 45 | if($unit_amount && in_array($unit_id, sn_get_groups($mode))) |
| 49 | 46 | { |
| 50 | 47 | $unit_amount = round($unit_amount); |
| 51 | 48 | $unit_name = get_unit_param($unit_id, P_NAME); |
| 52 | 49 | $result = "{$unit_name} = GREATEST(0, {$unit_name} + ({$unit_amount}))"; |
| 53 | - } |
|
| 54 | - else |
|
| 50 | + } else |
|
| 55 | 51 | { |
| 56 | 52 | $result = ''; |
| 57 | 53 | } |
@@ -19,8 +19,8 @@ |
||
| 19 | 19 | $template = gettemplate('banned_body', true); |
| 20 | 20 | |
| 21 | 21 | $query = doquery("SELECT * FROM {{banned}} ORDER BY `ban_id` DESC;"); |
| 22 | -$i=0; |
|
| 23 | -while($ban_row = db_fetch($query)) |
|
| 22 | +$i = 0; |
|
| 23 | +while ($ban_row = db_fetch($query)) |
|
| 24 | 24 | { |
| 25 | 25 | $template->assign_block_vars('banlist', array( |
| 26 | 26 | 'USER_NAME' => $ban_row['ban_user_name'], |
@@ -21,8 +21,8 @@ |
||
| 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($lang['player_option_building_sort'][$building_sort])) { |
|
| 24 | +if ($building_sort = sys_get_param_id('sort_elements')) { |
|
| 25 | + if (!empty($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 | } |
@@ -13,11 +13,11 @@ discard block |
||
| 13 | 13 | $time_server = $time_local - $time_diff |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -if($font_size = sys_get_param_str('font_size')) { |
|
| 17 | - if(strpos($font_size, '%') !== false) { |
|
| 16 | +if ($font_size = sys_get_param_str('font_size')) { |
|
| 17 | + if (strpos($font_size, '%') !== false) { |
|
| 18 | 18 | // Размер шрифта в процентах |
| 19 | 19 | $font_size = min(max(floatval($font_size), FONT_SIZE_PERCENT_MIN), FONT_SIZE_PERCENT_MAX) . '%'; |
| 20 | - } elseif(strpos($font_size, 'px') !== false) { |
|
| 20 | + } elseif (strpos($font_size, 'px') !== false) { |
|
| 21 | 21 | // Размер шрифта в пикселях |
| 22 | 22 | $font_size = min(max(floatval($font_size), FONT_SIZE_PIXELS_MIN), FONT_SIZE_PIXELS_MAX) . 'px'; |
| 23 | 23 | } else { |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | classSupernova::$user_options[PLAYER_OPTION_BASE_FONT_SIZE] = $font_size; |
| 30 | 30 | } else { |
| 31 | 31 | $user_time_diff = playerTimeDiff::user_time_diff_get(); |
| 32 | - if($user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) { |
|
| 32 | + if ($user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) { |
|
| 33 | 33 | $time_diff = intval($user_time_diff[PLAYER_OPTION_TIME_DIFF]); |
| 34 | 34 | } else { |
| 35 | 35 | $user_time_diff = playerTimeDiff::user_time_diff_probe(); |