7171require (INCLUDE_PATH . '/class_db.php ' );
7272require (INCLUDE_PATH . '/functions.php ' );
7373
74+ $ container = require ROOT_PATH . '/bootstrap.php ' ;
75+ $ playerRepo = $ container ->get (\Repository \PlayerRepository::class);
76+ $ optionService = $ container ->get (\Service \OptionService::class);
77+
7478$ db_classname = 'DB_ ' . DB_TYPE ;
7579if (class_exists ($ db_classname ))
7680{
8185 error ('Database class does not exist. Please check your config.php file for DB_TYPE ' );
8286}
8387
84- $ container = require ROOT_PATH . '/bootstrap.php ' ;
85- $ optionService = $ container ->get (\Service \OptionService::class);
86-
8788$ g_options = $ optionService ->getAllOptions ();
8889if (empty ($ g_options )) {
8990 error ('Warning: Could not find any options in the database. Check HLStats configuration. ' );
@@ -276,14 +277,7 @@ function f_num($number) {
276277 $ plKills = $ playerdata ['kills ' ];
277278 $ playerDeaths = $ playerdata ['deaths ' ];
278279
279- $ rank = get_player_rank (
280- $ db ,
281- $ plGame ,
282- $ rankType ,
283- $ plValue ,
284- $ plKills ,
285- $ playerDeaths
286- );
280+ $ rank = $ playerRepo ->getPlayerRank ($ plGame , $ rankType , $ plValue , $ plKills , $ playerDeaths );
287281
288282 if (is_null ($ rank )) {
289283 $ rank = 'Unknown ' ;
@@ -427,11 +421,10 @@ function f_num($number) {
427421 $ timestamp = $ playerdata ['connection_time ' ];
428422 $ days = floor ($ timestamp / 86400 );
429423 $ hours = $ days * 24 ;
430- $ hours += floor ($ timestamp / 3600 ) % 24 ;
431- if ($ hours < 10 ) {
432- $ hours = '0 ' . (int )$ hours ;
433- }
434- $ min = floor ($ timestamp / 60 ) % 60 ;
424+ $ hours += floor ($ timestamp / 3600 % 24 );
425+ if ($ hours < 10 )
426+ $ hours = '0 ' .$ hours ;
427+ $ min = floor ($ timestamp / 60 % 60 );
435428 if ($ min < 10 )
436429 $ min = '0 ' .$ min ;
437430 $ sec = floor ($ timestamp % 60 );
@@ -494,4 +487,4 @@ function f_num($number) {
494487 imagedestroy ($ watermark );
495488
496489}
497- ?>
490+ ?>
0 commit comments