Test Failed
Branch trunk (d809b8)
by SuperNova.WS
05:48
created

common.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/*
3
 * common.php
4
 *
5
 * Common init file
6
 *
7
 * @version 1.1 Security checks by Gorlum for http://supernova.ws
8
 */
9
10
require_once('includes/init.php');
11
12
global $debug, $template_result, $user, $lang, $planetrow;
13
14
// Напоминание для Администрации, что игра отключена
15
if($template_result[F_GAME_DISABLE]) {
16
  echo '<div class="global_admin_warning">', $template_result[F_GAME_DISABLE_REASON], '</div>';
17
}
18
unset($disable_reason);
19
20
21
if(defined('IN_ADMIN') && IN_ADMIN === true) {
22
  lng_include('admin');
23
} elseif($sys_user_logged_in) {
24
  sys_user_vacation($user);
25
26
  $planet_id = SetSelectedPlanet($user);
27
28
  // TODO НЕ НУЖНО АЛЬЯНС КАЖДЫЙ РАЗ ОБНОВЛЯТЬ!!!
29
  if($user['ally_id']) {
30
    sn_db_transaction_start();
31
    sn_ali_fill_user_ally($user);
32
    if(!$user['ally']['player']['id']) {
33
      // sn_sys_logout(false, true);
34
      // core_auth::logout(false);
35
      classSupernova::$auth->logout(false);
36
      $debug->error("User ID {$user['id']} has ally ID {$user['ally_id']} but no ally info", 'User record error', 502);
37
    }
38
    // TODO UNCOMMENT
39
    que_process($user['ally']['player']);
40
    db_user_set_by_id($user['ally']['player']['id'], '`onlinetime` = ' . SN_TIME_NOW);
0 ignored issues
show
Deprecated Code introduced by
The function db_user_set_by_id() has been deprecated.

This function has been deprecated.

Loading history...
41
    sn_db_transaction_commit();
42
  }
43
44
45
  // TODO - в режиме эмуляции, на самом деле!
46
  sn_db_transaction_start();
47
  $global_data = sys_o_get_updated($user['id'], $planet_id, SN_TIME_NOW);
48
  sn_db_transaction_commit();
49
50
  $planetrow = $global_data['planet'];
51
  if(!($planetrow && isset($planetrow['id']) && $planetrow['id'])) {
52
    // sn_sys_logout(false, true);
53
    // core_auth::logout(false);
54
    classSupernova::$auth->logout(false);
55
    $debug->error("User ID {$user['id']} has no current planet and no homeworld", 'User record error', 502);
56
  }
57
58
  $que = $global_data['que'];
59
}
60
61
require_once('includes/vars_menu.php');
62
63
sys_user_options_unpack($user);
64
65
global $sn_page_name, $sn_mvc;
66
if(!empty($sn_mvc['pages'][INITIAL_PAGE][PAGE_OPTION_EARLY_HEADER])) {
67
  $title = !empty($sn_mvc['pages'][INITIAL_PAGE][PAGE_OPTION_TITLE]) ? $sn_mvc['pages'][INITIAL_PAGE][PAGE_OPTION_TITLE] : '';
68
  renderHeader($page, $title, $template_result, false, $user, classSupernova::$config, $lang, $planetrow);
69
}
70