Skip to content

Commit

Permalink
0.2.25
Browse files Browse the repository at this point in the history
Исправление различных багов, добавление логирования HTTP 500, исправление Maps под FPS, различные добавления переводов.
  • Loading branch information
FlamesONE committed Feb 8, 2022
1 parent b38d2d2 commit 6caf2c1
Show file tree
Hide file tree
Showing 14 changed files with 160 additions and 56 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@
- Перейти на ваш сайт с извлеченной Levels Ranks WEB и пройти процесс установки.
- Profit!

Конфигурация NGINX:
-----
```
location / {
auth_basic $auth;
try_files $uri $uri/ /index.php?$query_string;
rewrite ^([^.]*[^/])$ $1/ permanent;
rewrite !.(gif|jpg|png|ico|css|js|svg|js_controller.php)$ /index.php;
}
```

Детальная настройка базы данных:
-----

Expand Down
62 changes: 62 additions & 0 deletions app/ext/ErrorsHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php

namespace app\ext;

class ErrorsHandler
{
public static function fatal_handler()
{
$errors = error_get_last();
!is_null( $errors ) && self::return_error( $errors );
}

/**
* Вернуть шаблон с ошибкой
*/
protected static function return_error( array $errors )
{
file_put_contents( substr(__DIR__, 0, -4)."\\logs\\".date("Y-m-d").".txt", "\n".date("Y-m-d H:i:s") . " - NEW ERROR [".$errors['type']."] \n FILE - ".$errors['file']." \n MESSAGE - ".$errors['message'] . " \n LINE - ".$errors['line'], FILE_APPEND | LOCK_EX );
die("Exception script, check web server logs");
}

public static function error_handler( $error_level, $error_message, $error_file, $error_line )
{
$error = [
"lvl" => $error_level,
"message" => $error_message,
"file" => $error_file,
"line" => $error_line
];

/**
* Отлавливаем проблемы с парсингом и фатальной ошибкой
*/
switch ($error_level)
{
case E_ERROR:
case E_CORE_ERROR:
case E_COMPILE_ERROR:
case E_PARSE:
self::return_error( $error );
break;
case E_USER_ERROR:
case E_RECOVERABLE_ERROR:
self::return_error( $error );
break;
case E_WARNING:
case E_CORE_WARNING:
case E_COMPILE_WARNING:
case E_USER_WARNING:
case E_NOTICE:
case E_USER_NOTICE:
case E_STRICT:
default:
}
}

public function setErrors()
{
set_error_handler([$this, "error_handler"]);
register_shutdown_function([$this, 'fatal_handler']);
}
}
4 changes: 2 additions & 2 deletions app/includes/auth/steam.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
require 'app/ext/LightOpenID.php';
try
{
$openid = new LightOpenID( 'http:' . $this->General->arr_general['site'] );
$openid = new LightOpenID( empty( $_SERVER['HTTPS'] ) ? 'http:' : "https:" . $this->General->arr_general['site'] );
if ( ! $openid->mode )
{
$openid->identity = 'https://steamcommunity.com/openid';
Expand Down Expand Up @@ -50,7 +50,7 @@

if( empty( $test = $Pdox->table("")->where("steam", $steam32)->get() ) )
{
$nick = json_decode( file_get_contents( 'http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=' . $this->General->arr_general['web_key'] . '&steamids=' . $matches[1] ), true );
$nick = json_decode( file_get_contents( 'https://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=' . $this->General->arr_general['web_key'] . '&steamids=' . $matches[1] ), true );

$insert_data = [
"steam" => $steam32,
Expand Down
Empty file added app/logs/1.txt
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<a <?php if ($Modules->array_modules['module_page_profiles']['setting']['status'] == '1'){ ?>href="<?php echo $General->arr_general['site'] ?>profiles/<?php print $General->arr_general['only_steam_64'] === 1 ? con_steam32to64( $res_bans[ $i ]['authid'] ) : $res_bans[ $i ]['authid']?>/?search=1"<?php } ?>><?php echo action_text_clear( action_text_trim($res_bans[ $i ]['name'], 13) )?></a>
</th>
<?php if( $General->arr_general['avatars'] != 0 ) {?>
<th class="text-right tb-avatar <?php $res_bans[ $i ]['aid'] != '0' && print 'a-type'?>" <?php if ($Modules->array_modules['module_page_profiles']['setting']['status'] == '1' && $res_bans[ $i ]['aid'] != '0'){ ?>onclick="location.href = '<?php echo $General->arr_general['site'] ?>profiles/<?php print $General->arr_general['only_steam_64'] === 1 ? con_steam32to64( $res_bans[ $i ]['admin_authid'] ) : $res_bans[ $i ]['admin_authid']?>/?search=1' "<?php } ?>><img class="rounded-circle" id="<?php echo con_steam32to64( $res_bans[ $i ]['admin_authid'] ) ?>"<?php echo $i < '20' ? 'src' : 'data-src'?>="<?php echo $res_bans[ $i ]['admin_authid'] != 'STEAM_ID_SERVER' ? $General->getAvatar( con_steam32to64( $res_bans[ $i ]['admin_authid'] ), 2 ) : 'storage/cache/img/avatars_random/20.jpg'?>"></th><?php }?>
<th class="text-right tb-avatar <?php $res_bans[ $i ]['aid'] != '0' && print 'a-type'?>" <?php if ($Modules->array_modules['module_page_profiles']['setting']['status'] == '1' && $res_bans[ $i ]['aid'] != '0'){ ?>onclick="location.href = '<?php echo $General->arr_general['site'] ?>profiles/<?php print $General->arr_general['only_steam_64'] === 1 ? con_steam32to64( $res_bans[ $i ]['admin_authid'] ) : $res_bans[ $i ]['admin_authid']?>/?search=1' "<?php } ?>><img class="rounded-circle" id="<?php echo con_steam32to64( $res_bans[ $i ]['admin_authid'] ) ?>"<?php echo $i < '20' ? 'src' : 'data-src'?>="<?php echo $res_bans[ $i ]['admin_authid'] != 'STEAM_ID_SERVER' ? $General->getAvatar( con_steam32to64( $res_bans[ $i ]['admin_authid'] ), 2 ) : $General->arr_general['site'] . 'storage/cache/img/avatars_random/20.jpg'?>"></th><?php }?>
<th class="text-left <?php $res_bans[ $i ]['aid'] != '0' && print 'pointer'?>" <?php if ($Modules->array_modules['module_page_profiles']['setting']['status'] == '1' && $res_bans[ $i ]['aid'] != '0'): ?>onclick="location.href = '<?php echo $General->arr_general['site'] ?>profiles/<?php print $General->arr_general['only_steam_64'] === 1 ? con_steam32to64( $res_bans[ $i ]['admin_authid'] ) : $res_bans[ $i ]['admin_authid']?>/?search=1' "<?php endif; ?>>
<a <?php if ($Modules->array_modules['module_page_profiles']['setting']['status'] == '1' && $res_bans[ $i ]['aid'] != '0'): ?>href="<?php echo $General->arr_general['site'] ?>profiles/<?php print $General->arr_general['only_steam_64'] === 1 ? con_steam32to64( $res_bans[ $i ]['admin_authid'] ) : $res_bans[ $i ]['admin_authid']?>/?search=1"<?php endif; ?>><?php echo action_text_clear( action_text_trim($res_bans[ $i ]['user'], 13) )?></a>
</th>
Expand Down Expand Up @@ -92,7 +92,7 @@
<a <?php if ($Modules->array_modules['module_page_profiles']['setting']['status'] == '1'){ ?>href="<?php echo $General->arr_general['site'] ?>profiles/<?php print $General->arr_general['only_steam_64'] === 1 ? con_steam32to64( $res_comms[ $i ]['authid'] ) : $res_comms[ $i ]['authid']?>/?search=1"<?php } ?>><?php echo action_text_clear( action_text_trim($res_comms[ $i ]['name'], 13) )?></a>
</th>
<?php if( $General->arr_general['avatars'] != 0 ) {?>
<th class="text-right tb-avatar <?php $res_comms[ $i ]['aid'] != '0' && print 'a-type'?>" <?php if ($Modules->array_modules['module_page_profiles']['setting']['status'] == '1' && $res_comms[ $i ]['aid'] != '0'){ ?>onclick="location.href = '<?php echo $General->arr_general['site'] ?>profiles/<?php print $General->arr_general['only_steam_64'] === 1 ? con_steam32to64( $res_comms[ $i ]['admin_authid'] ) : $res_comms[ $i ]['admin_authid']?>/?search=1' "<?php } ?>><img class="rounded-circle" id="<?php echo con_steam32to64( $res_comms[ $i ]['admin_authid'] ) ?>"<?php $i < '20' ? print 'src' : print 'data-src'?>="<?php echo $res_comms[ $i ]['admin_authid'] != 'STEAM_ID_SERVER' ? $General->getAvatar( con_steam32to64( $res_comms[ $i ]['admin_authid'] ), 2 ) : 'storage/cache/img/avatars_random/20.jpg'?>"></th><?php }?>
<th class="text-right tb-avatar <?php $res_comms[ $i ]['aid'] != '0' && print 'a-type'?>" <?php if ($Modules->array_modules['module_page_profiles']['setting']['status'] == '1' && $res_comms[ $i ]['aid'] != '0'){ ?>onclick="location.href = '<?php echo $General->arr_general['site'] ?>profiles/<?php print $General->arr_general['only_steam_64'] === 1 ? con_steam32to64( $res_comms[ $i ]['admin_authid'] ) : $res_comms[ $i ]['admin_authid']?>/?search=1' "<?php } ?>><img class="rounded-circle" id="<?php echo con_steam32to64( $res_comms[ $i ]['admin_authid'] ) ?>"<?php $i < '20' ? print 'src' : print 'data-src'?>="<?php echo $res_comms[ $i ]['admin_authid'] != 'STEAM_ID_SERVER' ? $General->getAvatar( con_steam32to64( $res_comms[ $i ]['admin_authid'] ), 2 ) : $General->arr_general['site'] . 'storage/cache/img/avatars_random/20.jpg'?>"></th><?php }?>
<th class="text-left <?php $res_comms[ $i ]['aid'] != '0' && print 'pointer'?>" <?php if ($Modules->array_modules['module_page_profiles']['setting']['status'] == '1' && $res_comms[ $i ]['aid'] != '0'): ?>onclick="location.href = '<?php echo $General->arr_general['site'] ?>profiles/<?php print $General->arr_general['only_steam_64'] === 1 ? con_steam32to64( $res_comms[ $i ]['admin_authid'] ) : $res_comms[ $i ]['admin_authid']?>/?search=1' "<?php endif; ?>>
<a <?php if ($Modules->array_modules['module_page_profiles']['setting']['status'] == '1' && $res_comms[ $i ]['aid'] != '0'): ?>href="<?php echo $General->arr_general['site'] ?>profiles/<?php print $General->arr_general['only_steam_64'] === 1 ? con_steam32to64( $res_comms[ $i ]['admin_authid'] ) : $res_comms[ $i ]['admin_authid']?>/?search=1"<?php endif; ?>><?php echo action_text_clear( action_text_trim($res_comms[ $i ]['user'], 13) )?></a>
</th>
Expand Down
4 changes: 2 additions & 2 deletions app/modules/disabled/module_page_bans/forward/data.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
$mod = $Db->db_data['SourceBans'][0]['mod'];

// Подсчёт кол-ва страниц
$page_max = ceil($Db->queryNum('SourceBans', $Db->db_data['SourceBans'][0]['USER_ID'], $Db->db_data['SourceBans'][0]['DB_num'], "SELECT COUNT(*) FROM `" . $Db->db_data['SourceBans'][0]['Table'] . "bans` ")[0]/PLAYERS_ON_PAGE);
$page_max = ceil($Db->queryNum('SourceBans', $Db->db_data['SourceBans'][0]['USER_ID'], $Db->db_data['SourceBans'][0]['DB_num'], "SELECT COUNT(*) FROM " . $Db->db_data['SourceBans'][0]['Table'] . "bans ")[0]/PLAYERS_ON_PAGE);

$page_num_min = ($page_num - 1) * PLAYERS_ON_PAGE;

( $page_num > $page_max || $page_num <= '0' ) && header('Location: ' . $General->arr_general['site']);

// Запрос на получение информации о банах
$res = $Db->queryAll('SourceBans', $Db->db_data['SourceBans'][0]['USER_ID'], $Db->db_data['SourceBans'][0]['DB_num'], "SELECT `" . $Db->db_data['SourceBans'][0]['Table'] . "bans`.`name`, `" . $Db->db_data['SourceBans'][0]['Table'] . "bans`.`authid`, `" . $Db->db_data['SourceBans'][0]['Table'] . "bans`.`created`, `" . $Db->db_data['SourceBans'][0]['Table'] . "bans`.`length`, `" . $Db->db_data['SourceBans'][0]['Table'] . "bans`.`reason`, `" . $Db->db_data['SourceBans'][0]['Table'] . "bans`.`type`, `" . $Db->db_data['SourceBans'][0]['Table'] . "bans.ends, " . $Db->db_data['SourceBans'][0]['Table'] . "bans`.`RemoveType`, `sb_admins`.`user`, `sb_admins`.`aid`, `sb_admins`.`authid` AS `admin_authid` FROM `" . $Db->db_data['SourceBans'][0]['Table'] . "bans` INNER JOIN `sb_admins` ON `" . $Db->db_data['SourceBans'][0]['Table'] . "bans`.`aid`=`sb_admins`.`aid` order by `created` desc LIMIT " . $page_num_min . "," . PLAYERS_ON_PAGE . " ");
$res = $Db->queryAll('SourceBans', $Db->db_data['SourceBans'][0]['USER_ID'], $Db->db_data['SourceBans'][0]['DB_num'], "SELECT " . $Db->db_data['SourceBans'][0]['Table'] . "bans.name, " . $Db->db_data['SourceBans'][0]['Table'] . "bans.authid, " . $Db->db_data['SourceBans'][0]['Table'] . "bans.created, " . $Db->db_data['SourceBans'][0]['Table'] . "bans.length, " . $Db->db_data['SourceBans'][0]['Table'] . "bans.reason, " . $Db->db_data['SourceBans'][0]['Table'] . "bans.type, " . $Db->db_data['SourceBans'][0]['Table'] . "bans.ends, " . $Db->db_data['SourceBans'][0]['Table'] . "bans.RemoveType, IFNULL(sb_admins.user, 'Админ снят') AS `user`, sb_admins.aid, sb_admins.authid AS admin_authid FROM " . $Db->db_data['SourceBans'][0]['Table'] . "bans LEFT JOIN sb_admins ON " . $Db->db_data['SourceBans'][0]['Table'] . "bans.aid=sb_admins.aid order by created desc LIMIT " . $page_num_min . "," . PLAYERS_ON_PAGE . " ");
// Задаём заголовок страницы.
$Modules->set_page_title( $General->arr_general['short_name'] . ' :: ' . $Translate->get_translate_phrase('_Bans') . ' :: ' . $Translate->get_translate_phrase('_Page') . ' ' . $page_num );

Expand Down
5 changes: 2 additions & 3 deletions app/modules/disabled/module_page_comms/forward/data.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@
$mod = $Db->db_data['SourceBans'][0]['mod'];

// Подсчёт кол-ва страниц
$page_max = ceil($Db->queryNum('SourceBans', $Db->db_data['SourceBans'][0]['USER_ID'], $Db->db_data['SourceBans'][0]['DB_num'], "SELECT COUNT(*) FROM `" . $Db->db_data['SourceBans'][0]['Table'] . "comms` ")[0]/PLAYERS_ON_PAGE);
$page_max = ceil($Db->queryNum('SourceBans', $Db->db_data['SourceBans'][0]['USER_ID'], $Db->db_data['SourceBans'][0]['DB_num'], "SELECT COUNT(*) FROM " . $Db->db_data['SourceBans'][0]['Table'] . "comms ")[0]/PLAYERS_ON_PAGE);

$page_num_min = ($page_num - 1) * PLAYERS_ON_PAGE;

( $page_num > $page_max || $page_num <= '0' ) && header('Location: ' . $General->arr_general['site']);

// Запрос на получение информации о мутах
$res = $Db->queryAll('SourceBans', $Db->db_data['SourceBans'][0]['USER_ID'], $Db->db_data['SourceBans'][0]['DB_num'], "SELECT `" . $Db->db_data['SourceBans'][0]['Table'] . "comms`.`name`, `" . $Db->db_data['SourceBans'][0]['Table'] . "comms`.`authid`, `" . $Db->db_data['SourceBans'][0]['Table'] . "comms`.`created`, `" . $Db->db_data['SourceBans'][0]['Table'] . "comms`.`length`, `" . $Db->db_data['SourceBans'][0]['Table'] . "comms`.`reason`, `" . $Db->db_data['SourceBans'][0]['Table'] . "comms`.`type`, `" . $Db->db_data['SourceBans'][0]['Table'] . "comms`.`ends`, `" . $Db->db_data['SourceBans'][0]['Table'] . "comms`.`RemoveType`, IFNULL(`sb_admins`.`user`, 'Админ снят') AS `user`, `sb_admins`.`aid`, `sb_admins`.`authid` AS `admin_authid` FROM `" . $Db->db_data['SourceBans'][0]['Table'] . "comms` LEFT JOIN `sb_admins` ON `" . $Db->db_data['SourceBans'][0]['Table'] . "comms`.`aid`=`sb_admins`.`aid` order by `created` desc LIMIT " . $page_num_min . "," . PLAYERS_ON_PAGE . " ");

$res = $Db->queryAll('SourceBans', $Db->db_data['SourceBans'][0]['USER_ID'], $Db->db_data['SourceBans'][0]['DB_num'], "SELECT " . $Db->db_data['SourceBans'][0]['Table'] . "comms.name, " . $Db->db_data['SourceBans'][0]['Table'] . "comms.authid, " . $Db->db_data['SourceBans'][0]['Table'] . "comms.created, " . $Db->db_data['SourceBans'][0]['Table'] . "comms.length, " . $Db->db_data['SourceBans'][0]['Table'] . "comms.reason, " . $Db->db_data['SourceBans'][0]['Table'] . "comms.type, " . $Db->db_data['SourceBans'][0]['Table'] . "comms.ends, " . $Db->db_data['SourceBans'][0]['Table'] . "comms.RemoveType, IFNULL(sb_admins.user, 'Админ снят') AS `user`, sb_admins.aid, sb_admins.authid AS admin_authid FROM " . $Db->db_data['SourceBans'][0]['Table'] . "comms LEFT JOIN sb_admins ON " . $Db->db_data['SourceBans'][0]['Table'] . "comms.aid=sb_admins.aid order by created desc LIMIT " . $page_num_min . "," . PLAYERS_ON_PAGE . " ");
// Задаём заголовок страницы.
$Modules->set_page_title( $General->arr_general['short_name'] . ' :: ' . $Translate->get_translate_phrase('_Comms') . ' :: ' . $Translate->get_translate_phrase('_Page') . ' ' . $page_num );

Expand Down
19 changes: 18 additions & 1 deletion app/modules/module_page_profiles/ext/Player.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,10 @@ function __construct( $General, $Db, $Modules, $id, $sg, $search ) {
else:
$this->unusualkills = false;
endif;

if ( $Db->mysql_table_search( 'FPS', 0, 0, 'fps_maps' ) == 1 ):
$this->maps = $this->get_db_maps_fps();
endif;
endif;

if( ! empty( $this->found[ $this->server_group ]['DB_mod'] ) && $this->found[ $this->server_group ]['DB_mod'] == 'RankMeKento' ):
Expand Down Expand Up @@ -437,7 +441,7 @@ public function get_db_top_with_player() {
FROM `fps_players`
INNER JOIN `fps_servers_stats` ON `fps_players`.`account_id` = `fps_servers_stats`.`account_id`
WHERE `fps_servers_stats`.`server_id` = '{$this->found[ $this->server_group ]['server_int']}'
AND '{$this->get_value()}' < `fps_servers_stats`.`points`
AND `fps_servers_stats`.`points` > '{$this->get_value()}'
ORDER BY `value` ASC LIMIT 5" ) );
$size_a = sizeof( $a );
$b = array_merge( $a, $this->Db->queryAll( 'FPS', 0, 0, "SELECT `fps_players`.`nickname` AS `name`,
Expand Down Expand Up @@ -684,6 +688,19 @@ private function get_db_plugin_module_maps() {
return $b;
}

private function get_db_maps_fps()
{
$maps = $this->Db->queryAll("FPS", 0, 0, "
SELECT `name_map`, `rounds_ct` + `rounds_t` AS `rounds_win` FROM `fps_maps`
WHERE `account_id` LIKE '%" . (con_steam64to3_int($this->get_steam_64())) . "%' AND `fps_maps`.`server_id` = '{$this->found[ $this->server_group ]['server_int']}'");

$all = [];
for ( $i = 0, $c = sizeof( $maps ); $i < $c; $i++ )
$all += [ $maps[ $i ]['name_map'] => $maps[ $i ]['rounds_win'] ];

return $all;
}

private function get_db_plugin_module_geoip() {
$a = $this->Db->query('LevelsRanks', $this->found[ $this->server_group ]['USER_ID'], $this->found[ $this->server_group ]['DB'], "SELECT `country`, `city` FROM `" . $this->found[ $this->server_group ]['Table'] . "_geoip` WHERE `steam` LIKE '%" . $this->get_steam_32_short() . "%' LIMIT 1" );

Expand Down
Loading

0 comments on commit 6caf2c1

Please sign in to comment.