Completed
Push — work-fleets ( f5fbda...1bdd41 )
by SuperNova.WS
06:04
created

common.php (1 issue)

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;
13
14
// Напоминание для Администрации, что игра отключена
15
if($template_result[F_GAME_DISABLE]) {
16
  // $disable_reason = sys_bbcodeParse($config->game_disable_reason); // Должна быть инициализирована выше по коду - в init.php
0 ignored issues
show
Unused Code Comprehensibility introduced by
47% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
17
  echo '<div class="global_admin_warning">', $template_result[F_GAME_DISABLE_REASON], '</div>';
18
}
19
unset($disable_reason);
20
21
22
if(defined('IN_ADMIN') && IN_ADMIN === true) {
23
  lng_include('admin');
24
} elseif($sys_user_logged_in) {
25
  sys_user_vacation($user);
26
27
  $planet_id = SetSelectedPlanet($user);
28
29
  // TODO НЕ НУЖНО АЛЬЯНС КАЖДЫЙ РАЗ ОБНОВЛЯТЬ!!!
30
  if($user['ally_id']) {
31
    sn_db_transaction_start();
32
    sn_ali_fill_user_ally($user);
33
    if(!$user['ally']['player']['id']) {
34
      // sn_sys_logout(false, true);
35
      // core_auth::logout(false);
36
      classSupernova::$auth->logout(false);
37
      $debug->error("User ID {$user['id']} has ally ID {$user['ally_id']} but no ally info", 'User record error', 502);
38
    }
39
    // TODO UNCOMMENT
40
    que_process($user['ally']['player']);
41
    db_user_set_by_id($user['ally']['player']['id'], '`onlinetime` = ' . SN_TIME_NOW);
42
    sn_db_transaction_commit();
43
  }
44
45
46
  // TODO - в режиме эмуляции, на самом деле!
47
  sn_db_transaction_start();
48
  $global_data = sys_o_get_updated($user['id'], $planet_id, SN_TIME_NOW);
49
  sn_db_transaction_commit();
50
51
  $planetrow = $global_data['planet'];
52
  if(!($planetrow && isset($planetrow['id']) && $planetrow['id'])) {
53
    // sn_sys_logout(false, true);
54
    // core_auth::logout(false);
55
    classSupernova::$auth->logout(false);
56
    $debug->error("User ID {$user['id']} has no current planet and no homeworld", 'User record error', 502);
57
  }
58
59
  $que = $global_data['que'];
60
}
61
62
require_once('includes/vars_menu.php');
63
64
sys_user_options_unpack($user);
65