Completed
Push — work-fleets ( 22b5bc...08ace7 )
by SuperNova.WS
06:13
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 $template_result, $user;
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
      classSupernova::$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
    DBStaticUser::db_user_set_by_id_DEPRECATED($user['ally']['player']['id'], '`onlinetime` = ' . SN_TIME_NOW);
0 ignored issues
show
Deprecated Code introduced by
The method DBStaticUser::db_user_set_by_id_DEPRECATED() has been deprecated.

This method 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
    classSupernova::$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/vars_menu.php';
62
63
sys_user_options_unpack($user);
64