Completed
Push — trunk ( e8681e...314ee9 )
by SuperNova.WS
13:57
created

overview.php (2 issues)

1
<?php
2
/**
3
 * index.php - overview.php
4
 *
5
 * 2.4 - copyright (c) 2010 by Gorlum for http://supernova.ws
6
 *     [-] Removed News frame
7
 *     [-] Time & Usersonline moved to Top-Frame
8
 * 2.3 - copyright (c) 2010 by Gorlum for http://supernova.ws
9
 *     [*] Complying with PCG
10
 * 2.2 - copyright (c) 2010 by Gorlum for http://supernova.ws
11
 *     [+] Redo flying fleet list
12
 * 2.1 - copyright (c) 2010 by Gorlum for http://supernova.ws
13
 *     [+] Planets on planet list now have indication of planet fill
14
 *     [+] Planets on planet list now have indication when there is enemy fleet flying to planet
15
 * 2.0 - copyright (c) 2010 by Gorlum for http://supernova.ws
16
 *     [+] Now there is full planet list on right side of screen a-la oGame
17
 *     [+] Planet list now include icons for buildings/tech/fleet on progress
18
 * 1.5 - copyright (c) 2010 by Gorlum for http://supernova.ws
19
 *     [*] Subplanet timers now use sn_timer.js library
20
 * 1.4 - copyright (c) 2010 by Gorlum for http://supernova.ws
21
 *     [*] All mainplanet timers now use new sn_timer.js library
22
 * 1.3 - copyright (c) 2010 by Gorlum for http://supernova.ws
23
 *     [*] Adjusted layouts of player infos
24
 * 1.2 - copyright (c) 2010 by Gorlum for http://supernova.ws
25
 *     [*] Adjusted layouts of planet infos
26
 * 1.1 - Security checks by Gorlum for http://supernova.ws
27
 * @version 1
28
 * @copyright 2008 By Chlorel for XNova
29
 */
30
31
//define('SN_RENDER_NAVBAR_PLANET', false);
32
33
include('common.' . substr(strrchr(__FILE__, '.'), 1));
34
35
lng_include('overview');
36
37
$result = array();
38
39
switch ($mode = sys_get_param_str('mode')) {
40
  case 'manage':
41
    sn_sys_sector_buy('overview.php?mode=manage');
42
43
    $user_dark_matter = mrc_get_level($user, false, RES_DARK_MATTER);
44
    $result[] = sn_sys_planet_core_transmute($user, $planetrow);
45
46
    $template = gettemplate('planet_manage', true);
47
    $planet_id = sys_get_param_id('planet_id');
48
49
    if (sys_get_param_str('rename') && $new_name = sys_get_param_str('new_name')) {
50
      $planetrow['name'] = $new_name;
51
//      $new_name = db_escape($new_name);
52
      DBStaticPlanet::db_planet_set_by_id($planetrow['id'], "`name` = '{$new_name}'");
53
    } elseif (sys_get_param_str('action') == 'make_capital') {
54
      try {
55
        sn_db_transaction_start();
56
        $user = db_user_by_id($user['id'], true, '*');
57
        $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true, '*');
58
//        $global_data = sys_o_get_updated($user, $planetrow['id'], SN_TIME_NOW);
59
//        $user = $global_data['user'];
60
//        $planetrow = $global_data['planet'];
61
62
        if ($planetrow['planet_type'] != PT_PLANET) {
63
          throw new exception(classSupernova::$lang['ov_capital_err_not_a_planet'], ERR_ERROR);
64
        }
65
66
        if ($planetrow['id'] == $user['id_planet']) {
67
          throw new exception(classSupernova::$lang['ov_capital_err_capital_already'], ERR_ERROR);
68
        }
69
70
        if ($user_dark_matter < classSupernova::$config->planet_capital_cost) {
71
          throw new exception(classSupernova::$lang['ov_capital_err_no_dark_matter'], ERR_ERROR);
72
        }
73
74
        rpg_points_change($user['id'], RPG_CAPITAL, -classSupernova::$config->planet_capital_cost,
75
          array('Planet %s ID %d at coordinates %s now become Empire Capital', $planetrow['name'], $planetrow['id'], uni_render_coordinates($planetrow))
76
        );
77
78
        db_user_set_by_id($user['id'], "id_planet = {$planetrow['id']}, galaxy = {$planetrow['galaxy']}, system = {$planetrow['system']}, planet = {$planetrow['planet']}");
79
80
        $user['id_planet'] = $planetrow['id'];
81
        $result[] = array(
82
          'STATUS'  => ERR_NONE,
83
          'MESSAGE' => classSupernova::$lang['ov_capital_err_none'],
84
        );
85
        sn_db_transaction_commit();
86
        sys_redirect('overview.php?mode=manage');
87
      } catch (exception $e) {
88
        sn_db_transaction_rollback();
89
        $result[] = array(
90
          'STATUS'  => $e->getCode(),
91
          'MESSAGE' => $e->getMessage(),
92
        );
93
      }
94
    } elseif (sys_get_param_str('action') == 'planet_teleport') {
95
      try {
96
        if (!uni_coordinates_valid($new_coordinates = array(
97
          'galaxy' => sys_get_param_int('new_galaxy'),
98
          'system' => sys_get_param_int('new_system'),
99
          'planet' => sys_get_param_int('new_planet')))
100
        ) {
101
          throw new exception(classSupernova::$lang['ov_teleport_err_wrong_coordinates'], ERR_ERROR);
102
        }
103
104
        sn_db_transaction_start();
105
        // При телепорте обновлять данные не надо - просто получить текущие данные и залочить их
106
        $user = db_user_by_id($user['id'], true, '*');
107
        $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true, '*');
108
//        $global_data = sys_o_get_updated($user, $planetrow['id'], SN_TIME_NOW);
109
//        $user = $global_data['user'];
110
//        $planetrow = $global_data['planet'];
111
112
        $can_teleport = uni_planet_teleport_check($user, $planetrow, $new_coordinates);
113
        if ($can_teleport['result'] != ERR_NONE) {
114
          throw new exception($can_teleport['message'], $can_teleport['result']);
115
        }
116
117
        rpg_points_change($user['id'], RPG_TELEPORT, -classSupernova::$config->planet_teleport_cost,
118
          array(&classSupernova::$lang['ov_teleport_log_record'], $planetrow['name'], $planetrow['id'], uni_render_coordinates($planetrow), uni_render_coordinates($new_coordinates))
119
        );
120
        $planet_teleport_next = SN_TIME_NOW + classSupernova::$config->planet_teleport_timeout;
121
        DBStaticPlanet::db_planet_set_by_gspt($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'], PT_ALL,
122
          "galaxy = {$new_coordinates['galaxy']}, system = {$new_coordinates['system']}, planet = {$new_coordinates['planet']}, planet_teleport_next = {$planet_teleport_next}");
123
124
        if ($planetrow['id'] == $user['id_planet']) {
125
          db_user_set_by_id($user['id'], "galaxy = {$new_coordinates['galaxy']}, system = {$new_coordinates['system']}, planet = {$new_coordinates['planet']}");
126
        }
127
128
        // $global_data = sys_o_get_updated($user, $planetrow['id'], SN_TIME_NOW);
129
        sn_db_transaction_commit();
130
        $user = db_user_by_id($user['id'], true, '*');
131
        $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true, '*');
132
        $result[] = array(
133
          'STATUS'  => ERR_NONE,
134
          'MESSAGE' => classSupernova::$lang['ov_teleport_err_none'],
135
        );
136
        sys_redirect('overview.php?mode=manage');
137
      } catch (exception $e) {
138
        sn_db_transaction_rollback();
139
        $result[] = array(
140
          'STATUS'  => $e->getCode(),
141
          'MESSAGE' => $e->getMessage(),
142
        );
143
      }
144
    } elseif (sys_get_param_str('action') == 'planet_abandon') {
145
      // if(sec_password_check($user['id'], sys_get_param('abandon_confirm'))) {
146
      if (classSupernova::$auth->password_check(sys_get_param('abandon_confirm'))) {
147
        if ($user['id_planet'] != $user['current_planet'] && $user['current_planet'] == $planet_id) {
148
          $destroyed = SN_TIME_NOW + 60 * 60 * 24;
149
          DBStaticPlanet::db_planet_set_by_id($user['current_planet'], "`destruyed`='{$destroyed}', `id_owner`=0");
150
          DBStaticPlanet::db_planet_set_by_parent($user['current_planet'], "`destruyed`='{$destroyed}', `id_owner`=0");
151
          db_user_set_by_id($user['id'], '`current_planet` = `id_planet`');
152
          messageBox(classSupernova::$lang['ov_delete_ok'], classSupernova::$lang['colony_abandon'], 'overview.php?mode=manage');
153
        } else {
154
          messageBox(classSupernova::$lang['ov_delete_wrong_planet'], classSupernova::$lang['colony_abandon'], 'overview.php?mode=manage');
155
        }
156
      } else {
157
        messageBox(classSupernova::$lang['ov_delete_wrong_pass'], classSupernova::$lang['colony_abandon'], 'overview.php?mode=manage');
158
      }
159
    } elseif (
160
      ($hire = sys_get_param_int('hire')) && in_array($hire, sn_get_groups('governors'))
161
      && (
162
        !get_unit_param($hire, P_MAX_STACK) ||
163
        ($planetrow['PLANET_GOVERNOR_ID'] != $hire) ||
164
        (
165
          $planetrow['PLANET_GOVERNOR_ID'] == $hire &&
166
          $planetrow['PLANET_GOVERNOR_LEVEL'] < get_unit_param($hire, P_MAX_STACK)
167
        )
168
      )
169
    ) {
170
      sn_db_transaction_start();
171
      $user = db_user_by_id($user['id'], true);
0 ignored issues
show
Deprecated Code introduced by
The function db_user_by_id() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

171
      $user = /** @scrutinizer ignore-deprecated */ db_user_by_id($user['id'], true);
Loading history...
172
      $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true);
173
      $build_data = eco_get_build_data($user, $planetrow, $hire, $planetrow['PLANET_GOVERNOR_ID'] == $hire ? $planetrow['PLANET_GOVERNOR_LEVEL'] : 0);
0 ignored issues
show
$user of type false is incompatible with the type array expected by parameter $user of eco_get_build_data(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

173
      $build_data = eco_get_build_data(/** @scrutinizer ignore-type */ $user, $planetrow, $hire, $planetrow['PLANET_GOVERNOR_ID'] == $hire ? $planetrow['PLANET_GOVERNOR_LEVEL'] : 0);
Loading history...
174
      if ($build_data['CAN'][BUILD_CREATE]) {
175
        if ($planetrow['PLANET_GOVERNOR_ID'] == $hire) {
176
          $planetrow['PLANET_GOVERNOR_LEVEL']++;
177
          $query = '`PLANET_GOVERNOR_LEVEL` + 1';
178
        } else {
179
          $planetrow['PLANET_GOVERNOR_LEVEL'] = 1;
180
          $planetrow['PLANET_GOVERNOR_ID'] = $hire;
181
          $query = '1';
182
        }
183
        DBStaticPlanet::db_planet_set_by_id($planetrow['id'], "`PLANET_GOVERNOR_ID` = {$hire}, `PLANET_GOVERNOR_LEVEL` = {$query}");
184
        rpg_points_change(
185
          $user['id'],
186
          RPG_GOVERNOR,
187
          -$build_data[BUILD_CREATE][RES_DARK_MATTER],
188
          sprintf(classSupernova::$lang['ov_governor_purchase'], classSupernova::$lang['tech'][$hire], $hire, $planetrow['PLANET_GOVERNOR_LEVEL'], uni_render_planet_full($planetrow, '', false, true))
189
        );
190
191
        //  => 'Игрок купил Губернатора %1$s ID %2$d уровня %3$d на планету %4$s',
192
        // die();
193
      }
194
      sn_db_transaction_commit();
195
      sys_redirect('overview.php?mode=manage');
196
      die();
197
    }
198
199
    lng_include('mrc_mercenary');
200
    int_planet_pretemplate($planetrow, $template);
201
    foreach (sn_get_groups('governors') as $governor_id) {
202
      if ($planetrow['planet_type'] == PT_MOON && $governor_id == MRC_TECHNOLOGIST) {
203
        continue;
204
      }
205
206
      $governor_level = $planetrow['PLANET_GOVERNOR_ID'] == $governor_id ? $planetrow['PLANET_GOVERNOR_LEVEL'] : 0;
207
      $build_data = eco_get_build_data($user, $planetrow, $governor_id, $governor_level);
208
      $template->assign_block_vars('governors', array(
209
        'ID'         => $governor_id,
210
        'NAME'       => classSupernova::$lang['tech'][$governor_id],
211
        'COST'       => $build_data[BUILD_CREATE][RES_DARK_MATTER],
212
        'MAX'        => get_unit_param($governor_id, P_MAX_STACK),
213
        'LEVEL'      => $governor_level,
214
        'LEVEL_PLUS' => mrc_get_level($user, $planetrow, $governor_id) - $governor_level,
215
      ));
216
    }
217
218
    $user_dark_matter = mrc_get_level($user, false, RES_DARK_MATTER);
219
    $planet_density_index = $planetrow['density_index'];
220
    $density_price_chart = planet_density_price_chart($planetrow);
221
    tpl_planet_density_info($template, $density_price_chart, $user_dark_matter);
222
223
    $sector_cost = eco_get_build_data($user, $planetrow, UNIT_SECTOR, mrc_get_level($user, $planetrow, UNIT_SECTOR), true);
224
    $sector_cost = $sector_cost[BUILD_CREATE][RES_DARK_MATTER];
225
    $planet_fill = floor($planetrow['field_current'] / eco_planet_fields_max($planetrow) * 100);
226
    $planet_fill = $planet_fill > 100 ? 100 : $planet_fill;
227
    $can_teleport = uni_planet_teleport_check($user, $planetrow);
228
    $template->assign_vars(array(
229
      'DARK_MATTER' => $user_dark_matter,
230
231
      'PLANET_FILL'          => floor($planetrow['field_current'] / eco_planet_fields_max($planetrow) * 100),
232
      'PLANET_FILL_BAR'      => $planet_fill,
233
      'SECTOR_CAN_BUY'       => $sector_cost <= $user_dark_matter,
234
      'SECTOR_COST'          => $sector_cost,
235
      'SECTOR_COST_TEXT'     => HelperString::numberFloorAndFormat($sector_cost),
236
      'planet_field_current' => $planetrow['field_current'],
237
      'planet_field_max'     => eco_planet_fields_max($planetrow),
238
239
      'CAN_TELEPORT'         => $can_teleport['result'] == ERR_NONE,
240
      'CAN_NOT_TELEPORT_MSG' => $can_teleport['message'],
241
      'TELEPORT_COST_TEXT'   => prettyNumberStyledCompare(classSupernova::$config->planet_teleport_cost, $user_dark_matter),
242
243
      'CAN_CAPITAL'       => $user_dark_matter >= classSupernova::$config->planet_capital_cost,
244
      'CAPITAL_COST_TEXT' => prettyNumberStyledCompare(classSupernova::$config->planet_capital_cost, $user_dark_matter),
245
246
      'PLANET_DENSITY_INDEX' => $planet_density_index,
247
      'PLANET_CORE_TEXT'     => classSupernova::$lang['uni_planet_density_types'][$planet_density_index],
248
249
      'IS_CAPITAL' => $planetrow['id'] == $user['id_planet'],
250
251
      'PAGE_HINT' => classSupernova::$lang['ov_manage_page_hint'],
252
    ));
253
254
    foreach ($result as &$a_result) {
255
      $template->assign_block_vars('result', $a_result);
256
    }
257
258
    display($template, classSupernova::$lang['rename_and_abandon_planet']);
259
  break;
260
261
  default:
262
    sn_sys_sector_buy();
263
264
    if (sys_get_param_str('rename') && $new_name = sys_get_param_str('new_name')) {
265
      $planetrow['name'] = $new_name;
266
      $new_name_safe = db_escape($new_name);
267
      DBStaticPlanet::db_planet_set_by_id($planetrow['id'], "`name` = '{$new_name_safe}'");
268
    }
269
270
    $result[] = sn_sys_planet_core_transmute($user, $planetrow);
271
272
    $template = gettemplate('planet_overview', true);
273
274
    $user_dark_matter = mrc_get_level($user, false, RES_DARK_MATTER);
275
    $planet_density_index = $planetrow['density_index'];
276
    $density_price_chart = planet_density_price_chart($planetrow);
277
    tpl_planet_density_info($template, $density_price_chart, $user_dark_matter);
278
279
    rpg_level_up($user, RPG_STRUCTURE);
280
    rpg_level_up($user, RPG_RAID);
281
    rpg_level_up($user, RPG_TECH);
282
    rpg_level_up($user, RPG_EXPLORE);
283
284
    $fleet_id = 1;
285
286
    $fleets = flt_parse_fleets_to_events(fleet_and_missiles_list_incoming($user['id']));
287
288
    $planet_count = 0;
289
    $planets_query = DBStaticPlanet::db_planet_list_sorted($user, false, '*');
290
    foreach ($planets_query as $an_id => $planetRecord) {
291
      sn_db_transaction_start();
292
      $updatedData = sys_o_get_updated($user, $planetRecord['id'], SN_TIME_NOW, false, true);
293
      sn_db_transaction_commit();
294
295
      $templatizedPlanet = tpl_parse_planet($updatedData['planet'], $fleets_to_planet);
296
297
      if ($planetRecord['planet_type'] == PT_MOON) {
298
        continue;
299
      }
300
      $moon = DBStaticPlanet::db_planet_by_parent($planetRecord['id']);
301
      if ($moon) {
302
        $moon_fill = min(100, floor($moon['field_current'] / eco_planet_fields_max($moon) * 100));
303
      } else {
304
        $moon_fill = 0;
305
      }
306
307
      $moon_fleets = flt_get_fleets_to_planet($moon);
308
      $template->assign_block_vars('planet', array_merge($templatizedPlanet, array(
309
        'MOON_ID'    => $moon['id'],
310
        'MOON_NAME'  => $moon['name'],
311
        'MOON_IMG'   => $moon['image'],
312
        'MOON_FILL'  => min(100, $moon_fill),
313
        'MOON_ENEMY' => $moon_fleets['enemy']['count'],
314
315
        'MOON_PLANET' => $moon['parent_planet'],
316
      )));
317
318
      $planet_count++;
319
    }
320
321
    tpl_assign_fleet($template, $fleets_to_planet);
322
    tpl_assign_fleet($template, $fleets);
323
324
    $lune = $planetrow['planet_type'] == PT_PLANET ? DBStaticPlanet::db_planet_by_parent($planetrow['id']) : DBStaticPlanet::db_planet_by_id($planetrow['parent_planet']);
325
    if ($lune) {
326
      $template->assign_vars(array(
327
        'MOON_ID'   => $lune['id'],
328
        'MOON_IMG'  => $lune['image'],
329
        'MOON_NAME' => $lune['name'],
330
      ));
331
    }
332
333
    $planet_fill = floor($planetrow['field_current'] / eco_planet_fields_max($planetrow) * 100);
334
    $planet_fill = $planet_fill > 100 ? 100 : $planet_fill;
335
336
    $planet_recyclers_orbiting = 0;
337
    foreach (sn_get_groups('flt_recyclers') as $recycler_id) {
338
      $planet_recyclers_orbiting += mrc_get_level($user, $planetrow, $recycler_id);
339
    }
340
341
    int_planet_pretemplate($planetrow, $template);
342
343
    $sn_group_ques = sn_get_groups('ques');
344
    if (!defined('GAME_STRUCTURES_DISABLED') || !GAME_STRUCTURES_DISABLED) {
345
      foreach (array(QUE_STRUCTURES => $sn_group_ques[QUE_STRUCTURES]) as $que_id => $que_type_data) {
346
        $this_que = $que['ques'][$que_id][$user['id']][$planetrow['id']];
347
        $template->assign_block_vars('ques', array(
348
          'ID'     => $que_id,
349
          'NAME'   => classSupernova::$lang['sys_ques'][$que_id],
350
          'LENGTH' => empty($this_que) ? 0 : count($this_que),
351
        ));
352
353
        if (!empty($this_que)) {
354
          foreach ($this_que as $que_item) {
355
            $template->assign_block_vars('que', que_tpl_parse_element($que_item));
356
          }
357
        }
358
      }
359
    }
360
361
    $que_hangar_length = tpl_assign_hangar($template, $planetrow, SUBQUE_FLEET);
362
    $template->assign_block_vars('ques', array(
363
      'ID'     => QUE_HANGAR,
364
      'NAME'   => classSupernova::$lang['sys_ques'][QUE_HANGAR],
365
      'LENGTH' => $que_hangar_length,
366
    ));
367
368
    if (!defined('GAME_DEFENSE_DISABLED') || !GAME_DEFENSE_DISABLED) {
369
      $que_hangar_length = tpl_assign_hangar($template, $planetrow, SUBQUE_DEFENSE);
370
      $template->assign_block_vars('ques', array(
371
        'ID'     => SUBQUE_DEFENSE,
372
        'NAME'   => classSupernova::$lang['sys_ques'][SUBQUE_DEFENSE],
373
        'LENGTH' => $que_hangar_length,
374
      ));
375
    }
376
377
    $overview_planet_rows = $user['opt_int_overview_planet_rows'];
378
    $overview_planet_columns = $user['opt_int_overview_planet_columns'];
379
380
    if ($overview_planet_rows <= 0 && $overview_planet_columns <= 0) {
381
      $overview_planet_rows = $user_option_list[OPT_INTERFACE]['opt_int_overview_planet_rows'];
382
      $overview_planet_columns = $user_option_list[OPT_INTERFACE]['opt_int_overview_planet_columns'];
383
    }
384
385
    if ($overview_planet_rows > 0 && $overview_planet_columns <= 0) {
386
      $overview_planet_columns = ceil($planet_count / $overview_planet_rows);
387
    }
388
389
    $sector_cost = eco_get_build_data($user, $planetrow, UNIT_SECTOR, mrc_get_level($user, $planetrow, UNIT_SECTOR), true);
390
    $sector_cost = $sector_cost[BUILD_CREATE][RES_DARK_MATTER];
391
    $governor_level = $planetrow['PLANET_GOVERNOR_ID'] ? mrc_get_level($user, $planetrow, $planetrow['PLANET_GOVERNOR_ID'], false, true) : 0;
392
    $template->assign_vars(array(
393
      'USER_ID'        => $user['id'],
394
      'user_username'  => $user['username'],
395
      'USER_AUTHLEVEL' => $user['authlevel'],
396
397
      'NEW_MESSAGES'    => $user['new_message'],
398
      'NEW_LEVEL_MINER' => $level_miner,
399
      'NEW_LEVEL_RAID'  => $level_raid,
400
401
      'planet_diameter'      => HelperString::numberFloorAndFormat($planetrow['diameter']),
402
      'planet_field_current' => $planetrow['field_current'],
403
      'planet_field_max'     => eco_planet_fields_max($planetrow),
404
      'PLANET_FILL'          => floor($planetrow['field_current'] / eco_planet_fields_max($planetrow) * 100),
405
      'PLANET_FILL_BAR'      => $planet_fill,
406
      'metal_debris'         => HelperString::numberFloorAndFormat($planetrow['debris_metal']),
407
      'crystal_debris'       => HelperString::numberFloorAndFormat($planetrow['debris_crystal']),
408
      'PLANET_RECYCLERS'     => $planet_recyclers_orbiting,
409
      'planet_image'         => $planetrow['image'],
410
      'planet_temp_min'      => $planetrow['temp_min'],
411
      'planet_temp_avg'      => round(($planetrow['temp_min'] + $planetrow['temp_max']) / 2),
412
      'planet_temp_max'      => $planetrow['temp_max'],
413
      'planet_density'       => $planetrow['density'],
414
      'planet_density_index' => $planetrow['density_index'],
415
      'planet_density_text'  => classSupernova::$lang['uni_planet_density_types'][$planetrow['density_index']],
416
417
      'GATE_LEVEL'          => mrc_get_level($user, $planetrow, STRUC_MOON_GATE),
418
      'GATE_JUMP_REST_TIME' => uni_get_time_to_jump($planetrow),
419
420
      'ADMIN_EMAIL' => classSupernova::$config->game_adminEmail,
421
422
      'PLANET_GOVERNOR_ID'         => $planetrow['PLANET_GOVERNOR_ID'],
423
      'PLANET_GOVERNOR_LEVEL'      => $governor_level,
424
      'PLANET_GOVERNOR_LEVEL_PLUS' => mrc_get_level($user, $planetrow, $planetrow['PLANET_GOVERNOR_ID']) - $governor_level,
425
      'PLANET_GOVERNOR_NAME'       => classSupernova::$lang['tech'][$planetrow['PLANET_GOVERNOR_ID']],
426
427
      'LIST_ROW_COUNT'    => $overview_planet_rows,
428
      'LIST_COLUMN_COUNT' => $overview_planet_columns,
429
430
      'DARK_MATTER' => $user_dark_matter,
431
432
      'PLANET_DENSITY_INDEX' => $planet_density_index,
433
      'PLANET_CORE_TEXT'     => classSupernova::$lang['uni_planet_density_types'][$planet_density_index],
434
435
      'SECTOR_CAN_BUY'   => $sector_cost <= mrc_get_level($user, null, RES_DARK_MATTER),
436
      'SECTOR_COST'      => $sector_cost,
437
      'SECTOR_COST_TEXT' => HelperString::numberFloorAndFormat($sector_cost),
438
439
      'PAGE_HEADER' => classSupernova::$lang['ov_overview']. " - " . classSupernova::$lang['sys_planet_type'][$planetrow['planet_type']] . " {$planetrow['name']} [{$planetrow['galaxy']}:{$planetrow['system']}:{$planetrow['planet']}]",
440
    ));
441
    tpl_set_resource_info($template, $planetrow, $fleets_to_planet);
442
443
    foreach ($result as &$a_result) {
444
      $template->assign_block_vars('result', $a_result);
445
    }
446
447
    display($template);
448
  break;
449
}
450