Issues (1369)

common.php (2 issues)

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
use DBAL\db_mysql;
11
12
require_once('includes/init.php');
13
14
global $debug, $template_result, $user, $lang, $planetrow;
15
16
// Напоминание для Администрации, что игра отключена
17
if($template_result[F_GAME_DISABLE]) {
18
  echo '<div class="global_admin_warning">', $template_result[F_GAME_DISABLE_REASON], '</div>';
19
}
20
unset($disable_reason);
21
22
23
if(defined('IN_ADMIN') && IN_ADMIN === true) {
24
  lng_include('admin');
25
} elseif(SN::$sys_user_logged_in) {
26
  sys_user_vacation($user);
27
28
  $planet_id = SetSelectedPlanet($user);
29
30
  // TODO НЕ НУЖНО АЛЬЯНС КАЖДЫЙ РАЗ ОБНОВЛЯТЬ!!!
31
  if($user['ally_id']) {
32
    db_mysql::db_transaction_start();
33
    \Alliance\Alliance::sn_ali_fill_user_ally($user);
34
    if(!$user['ally']['player']['id']) {
35
      // sn_sys_logout(false, true);
36
      // core_auth::logout(false);
37
      SN::$auth->logout(false);
38
      $debug->error("User ID {$user['id']} has ally ID {$user['ally_id']} but no ally info", 'User record error', 502);
39
    }
40
    // TODO UNCOMMENT
41
    que_process($user['ally']['player']);
42
    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. ( Ignorable by Annotation )

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

42
    /** @scrutinizer ignore-deprecated */ db_user_set_by_id($user['ally']['player']['id'], '`onlinetime` = ' . SN_TIME_NOW);
Loading history...
43
    db_mysql::db_transaction_commit();
44
  }
45
46
47
  // TODO - в режиме эмуляции, на самом деле!
48
  db_mysql::db_transaction_start();
49
  $global_data = sys_o_get_updated($user['id'], $planet_id, SN_TIME_NOW);
50
  db_mysql::db_transaction_commit();
51
52
  $planetrow = $global_data['planet'];
53
  if(!($planetrow && isset($planetrow['id']) && $planetrow['id'])) {
54
    // sn_sys_logout(false, true);
55
    // core_auth::logout(false);
56
    SN::$auth->logout(false);
57
    $debug->error("User ID {$user['id']} has no current planet and no homeworld", 'User record error', 502);
58
  }
59
60
  $que = $global_data['que'];
61
}
62
63
require_once('includes/vars_menu.php');
64
65
sys_user_options_unpack($user);
66
67
global $sn_page_name, $sn_mvc;
68
if(!empty($sn_mvc['pages'][INITIAL_PAGE][PAGE_OPTION_EARLY_HEADER])) {
69
  $title = !empty($sn_mvc['pages'][INITIAL_PAGE][PAGE_OPTION_TITLE]) ? $sn_mvc['pages'][INITIAL_PAGE][PAGE_OPTION_TITLE] : '';
70
  SnTemplate::renderHeader($page, $title, $template_result, false, $user, SN::$config, $lang, $planetrow);
0 ignored issues
show
The call to SnTemplate::renderHeader() has too few arguments starting with renderedContent. ( Ignorable by Annotation )

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

70
  SnTemplate::/** @scrutinizer ignore-call */ 
71
              renderHeader($page, $title, $template_result, false, $user, SN::$config, $lang, $planetrow);

This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
71
}
72