diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 2246fb6e..b6b26b4e 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -354,12 +354,6 @@ parameters: count: 1 path: src/Core/Auth/Authenticator.php - - - message: '#^Call to function method_exists\(\) with ''BlocklistService'' and ''getBlockedIPs'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: src/Core/Auth/BruteforceGuard.php - - message: '#^Method XcVm\\Core\\Database\\Database\:\:escape\(\) should return string\|null but return statement is missing\.$#' identifier: return.missing @@ -619,73 +613,73 @@ parameters: path: src/Domain/Epg/EPG.php - - message: '#^Method EpgService\:\:getById\(\) should return array\|null but return statement is missing\.$#' + message: '#^Method XcVm\\Domain\\Epg\\EpgService\:\:getById\(\) should return array\|null but return statement is missing\.$#' identifier: return.missing count: 1 path: src/Domain/Epg/EpgService.php - - message: '#^Method EpgService\:\:getProgramme\(\) should return array\|null but return statement is missing\.$#' + message: '#^Method XcVm\\Domain\\Epg\\EpgService\:\:getProgramme\(\) should return array\|null but return statement is missing\.$#' identifier: return.missing count: 1 path: src/Domain/Epg/EpgService.php - - message: '#^Method LineService\:\:updateLineSignal\(\) with return type void returns false but should not return anything\.$#' + message: '#^Method XcVm\\Domain\\Line\\LineService\:\:updateLineSignal\(\) with return type void returns false but should not return anything\.$#' identifier: return.void count: 1 path: src/Domain/Line/LineService.php - - message: '#^Method LineService\:\:updateLineSignal\(\) with return type void returns true but should not return anything\.$#' + message: '#^Method XcVm\\Domain\\Line\\LineService\:\:updateLineSignal\(\) with return type void returns true but should not return anything\.$#' identifier: return.void count: 1 path: src/Domain/Line/LineService.php - - message: '#^Method LineService\:\:updateLinesSignal\(\) with return type void returns false but should not return anything\.$#' + message: '#^Method XcVm\\Domain\\Line\\LineService\:\:updateLinesSignal\(\) with return type void returns false but should not return anything\.$#' identifier: return.void count: 1 path: src/Domain/Line/LineService.php - - message: '#^Method LineService\:\:updateLinesSignal\(\) with return type void returns true but should not return anything\.$#' + message: '#^Method XcVm\\Domain\\Line\\LineService\:\:updateLinesSignal\(\) with return type void returns true but should not return anything\.$#' identifier: return.void count: 1 path: src/Domain/Line/LineService.php - - message: '#^Method BlocklistService\:\:checkISP\(\) should return bool but returns int\.$#' + message: '#^Method XcVm\\Domain\\Security\\BlocklistService\:\:checkISP\(\) should return bool but returns int\.$#' identifier: return.type count: 2 path: src/Domain/Security/BlocklistService.php - - message: '#^Method BlocklistService\:\:getISPById\(\) should return array\|null but return statement is missing\.$#' + message: '#^Method XcVm\\Domain\\Security\\BlocklistService\:\:getISPById\(\) should return array\|null but return statement is missing\.$#' identifier: return.missing count: 1 path: src/Domain/Security/BlocklistService.php - - message: '#^Method BlocklistService\:\:getRTMPIPById\(\) should return array\|null but return statement is missing\.$#' + message: '#^Method XcVm\\Domain\\Security\\BlocklistService\:\:getRTMPIPById\(\) should return array\|null but return statement is missing\.$#' identifier: return.missing count: 1 path: src/Domain/Security/BlocklistService.php - - message: '#^Method BlocklistService\:\:getUserAgentById\(\) should return array\|null but return statement is missing\.$#' + message: '#^Method XcVm\\Domain\\Security\\BlocklistService\:\:getUserAgentById\(\) should return array\|null but return statement is missing\.$#' identifier: return.missing count: 1 path: src/Domain/Security/BlocklistService.php - - message: '#^Method BlocklistService\:\:isProxy\(\) should return bool but returns null\.$#' + message: '#^Method XcVm\\Domain\\Security\\BlocklistService\:\:isProxy\(\) should return bool but returns null\.$#' identifier: return.type count: 1 path: src/Domain/Security/BlocklistService.php - - message: '#^Method ServerRepository\:\:getById\(\) should return array\|null but returns false\.$#' + message: '#^Method XcVm\\Domain\\Server\\ServerRepository\:\:getById\(\) should return array\|null but returns false\.$#' identifier: return.type count: 1 path: src/Domain/Server/ServerRepository.php @@ -817,7 +811,7 @@ parameters: path: src/Domain/Stream/CategoryService.php - - message: '#^Method ConnectionTracker\:\:getCapacity\(\) should return array\ but returns array\\|object\.$#' + message: '#^Method XcVm\\Domain\\Stream\\ConnectionTracker\:\:getCapacity\(\) should return array\ but returns array\\|object\.$#' identifier: return.type count: 1 path: src/Domain/Stream/ConnectionTracker.php @@ -847,7 +841,7 @@ parameters: path: src/Domain/Stream/PlaylistGenerator.php - - message: '#^Method PlaylistGenerator\:\:generate\(\) should return string but returns false\.$#' + message: '#^Method XcVm\\Domain\\Stream\\PlaylistGenerator\:\:generate\(\) should return string but returns false\.$#' identifier: return.type count: 3 path: src/Domain/Stream/PlaylistGenerator.php @@ -949,7 +943,7 @@ parameters: path: src/Domain/Stream/PlaylistGenerator.php - - message: '#^Parameter \#2 \$rYear of static method StreamSorter\:\:formatTitle\(\) expects int\|string, null given\.$#' + message: '#^Parameter \#2 \$rYear of static method XcVm\\Domain\\Stream\\StreamSorter\:\:formatTitle\(\) expects int\|string, null given\.$#' identifier: argument.type count: 2 path: src/Domain/Stream/PlaylistGenerator.php @@ -973,19 +967,19 @@ parameters: path: src/Domain/Stream/StreamProcess.php - - message: '#^Method StreamProcess\:\:deleteCache\(\) with return type void returns null but should not return anything\.$#' + message: '#^Method XcVm\\Domain\\Stream\\StreamProcess\:\:deleteCache\(\) with return type void returns null but should not return anything\.$#' identifier: return.void count: 1 path: src/Domain/Stream/StreamProcess.php - - message: '#^Method StreamProcess\:\:updateStreams\(\) with return type void returns false but should not return anything\.$#' + message: '#^Method XcVm\\Domain\\Stream\\StreamProcess\:\:updateStreams\(\) with return type void returns false but should not return anything\.$#' identifier: return.void count: 1 path: src/Domain/Stream/StreamProcess.php - - message: '#^Method StreamProcess\:\:updateStreams\(\) with return type void returns true but should not return anything\.$#' + message: '#^Method XcVm\\Domain\\Stream\\StreamProcess\:\:updateStreams\(\) with return type void returns true but should not return anything\.$#' identifier: return.void count: 1 path: src/Domain/Stream/StreamProcess.php @@ -1051,7 +1045,7 @@ parameters: path: src/Domain/Stream/StreamProcess.php - - message: '#^Method StreamService\:\:parseM3U\(\) should return array but returns M3uParser\\M3uData\.$#' + message: '#^Method XcVm\\Domain\\Stream\\StreamService\:\:parseM3U\(\) should return array but returns M3uParser\\M3uData\.$#' identifier: return.type count: 2 path: src/Domain/Stream/StreamService.php @@ -1087,31 +1081,31 @@ parameters: path: src/Domain/User/ResellerAPI.php - - message: '#^Method ResellerAPI\:\:processEnigma\(\) should return array but returns false\.$#' + message: '#^Method XcVm\\Domain\\User\\ResellerAPI\:\:processEnigma\(\) should return array but returns false\.$#' identifier: return.type count: 2 path: src/Domain/User/ResellerAPI.php - - message: '#^Method ResellerAPI\:\:processLine\(\) should return array but returns false\.$#' + message: '#^Method XcVm\\Domain\\User\\ResellerAPI\:\:processLine\(\) should return array but returns false\.$#' identifier: return.type count: 2 path: src/Domain/User/ResellerAPI.php - - message: '#^Method ResellerAPI\:\:processMAG\(\) should return array but returns false\.$#' + message: '#^Method XcVm\\Domain\\User\\ResellerAPI\:\:processMAG\(\) should return array but returns false\.$#' identifier: return.type count: 2 path: src/Domain/User/ResellerAPI.php - - message: '#^Method ResellerAPI\:\:processUser\(\) should return array but returns false\.$#' + message: '#^Method XcVm\\Domain\\User\\ResellerAPI\:\:processUser\(\) should return array but returns false\.$#' identifier: return.type count: 3 path: src/Domain/User/ResellerAPI.php - - message: '#^Method ResellerAPI\:\:submitTicket\(\) should return array but returns false\.$#' + message: '#^Method XcVm\\Domain\\User\\ResellerAPI\:\:submitTicket\(\) should return array but returns false\.$#' identifier: return.type count: 1 path: src/Domain/User/ResellerAPI.php @@ -1129,7 +1123,7 @@ parameters: path: src/Domain/User/ResellerAPI.php - - message: '#^Method TicketRepository\:\:getById\(\) should return array\|false but returns null\.$#' + message: '#^Method XcVm\\Domain\\User\\TicketRepository\:\:getById\(\) should return array\|false but returns null\.$#' identifier: return.type count: 1 path: src/Domain/User/TicketRepository.php @@ -1165,37 +1159,37 @@ parameters: path: src/Domain/User/TicketRepository.php - - message: '#^Method UserRepository\:\:getAuthUserByCredentials\(\) should return array\|null but return statement is missing\.$#' + message: '#^Method XcVm\\Domain\\User\\UserRepository\:\:getAuthUserByCredentials\(\) should return array\|null but return statement is missing\.$#' identifier: return.missing count: 2 path: src/Domain/User/UserRepository.php - - message: '#^Method UserRepository\:\:getE2Info\(\) should return array\|null but returns false\.$#' + message: '#^Method XcVm\\Domain\\User\\UserRepository\:\:getE2Info\(\) should return array\|null but returns false\.$#' identifier: return.type count: 1 path: src/Domain/User/UserRepository.php - - message: '#^Method UserRepository\:\:getLineById\(\) should return array\|null but return statement is missing\.$#' + message: '#^Method XcVm\\Domain\\User\\UserRepository\:\:getLineById\(\) should return array\|null but return statement is missing\.$#' identifier: return.missing count: 1 path: src/Domain/User/UserRepository.php - - message: '#^Method UserRepository\:\:getRegisteredUserById\(\) should return array\|null but return statement is missing\.$#' + message: '#^Method XcVm\\Domain\\User\\UserRepository\:\:getRegisteredUserById\(\) should return array\|null but return statement is missing\.$#' identifier: return.missing count: 1 path: src/Domain/User/UserRepository.php - - message: '#^Method UserRepository\:\:getStreamingUserInfo\(\) should return array\|null but returns false\.$#' + message: '#^Method XcVm\\Domain\\User\\UserRepository\:\:getStreamingUserInfo\(\) should return array\|null but returns false\.$#' identifier: return.type count: 6 path: src/Domain/User/UserRepository.php - - message: '#^Method UserRepository\:\:getUserInfo\(\) should return array\|null but returns false\.$#' + message: '#^Method XcVm\\Domain\\User\\UserRepository\:\:getUserInfo\(\) should return array\|null but returns false\.$#' identifier: return.type count: 6 path: src/Domain/User/UserRepository.php @@ -1273,13 +1267,13 @@ parameters: path: src/Domain/Vod/MovieService.php - - message: '#^Method SeriesService\:\:getById\(\) should return array\|false but returns null\.$#' + message: '#^Method XcVm\\Domain\\Vod\\SeriesService\:\:getById\(\) should return array\|false but returns null\.$#' identifier: return.type count: 1 path: src/Domain/Vod/SeriesService.php - - message: '#^Method SeriesService\:\:getByTMDBId\(\) should return array\|false but returns null\.$#' + message: '#^Method XcVm\\Domain\\Vod\\SeriesService\:\:getByTMDBId\(\) should return array\|false but returns null\.$#' identifier: return.type count: 1 path: src/Domain/Vod/SeriesService.php @@ -1291,13 +1285,13 @@ parameters: path: src/Domain/Vod/SeriesService.php - - message: '#^Method TMDbService\:\:addCategories\(\) with return type void returns true but should not return anything\.$#' + message: '#^Method XcVm\\Domain\\Vod\\TMDbService\:\:addCategories\(\) with return type void returns true but should not return anything\.$#' identifier: return.void count: 1 path: src/Domain/Vod/TMDbService.php - - message: '#^Method TMDbService\:\:getMovie\(\) should return array\|null but returns Movie\.$#' + message: '#^Method XcVm\\Domain\\Vod\\TMDbService\:\:getMovie\(\) should return array\|null but returns Movie\.$#' identifier: return.type count: 1 path: src/Domain/Vod/TMDbService.php diff --git a/src/Cli/Commands/ArchiveCommand.php b/src/Cli/Commands/ArchiveCommand.php index ee13b9ed..eb31c20c 100644 --- a/src/Cli/Commands/ArchiveCommand.php +++ b/src/Cli/Commands/ArchiveCommand.php @@ -1,5 +1,6 @@ false, 'create_mag' => false, 'create_enigma' => false, 'stream_ids' => array(), 'series_ids' => array(), 'category_ids' => array(), 'users' => array(), 'direct_reports' => array(), 'all_reports' => array(), 'report_map' => array()); - $rUser = \UserRepository::getRegisteredUserById($rUserID); + $rUser = \XcVm\Domain\User\UserRepository::getRegisteredUserById($rUserID); if (!$rUser) { } else { @@ -259,7 +260,7 @@ class AuthRepository { if (!$rUsers) { } else { - $rReturn['users'] = \UserRepository::getSubUsers($rUser['id']); + $rReturn['users'] = \XcVm\Domain\User\UserRepository::getSubUsers($rUser['id']); foreach ($rReturn['users'] as $rUserID => $rUserData) { if ($rUser['id'] != $rUserData['parent']) { diff --git a/src/Core/Auth/Authenticator.php b/src/Core/Auth/Authenticator.php index f8df50af..ae4356d9 100644 --- a/src/Core/Auth/Authenticator.php +++ b/src/Core/Auth/Authenticator.php @@ -2,6 +2,7 @@ declare(strict_types=1); namespace XcVm\Core\Auth; +use XcVm\Domain\User\UserRepository; use XcVm\Core\Util\NetworkUtils; use XcVm\Core\Logging\Logger; @@ -96,7 +97,7 @@ class Authenticator { } $rIP = \XcVm\Core\Util\NetworkUtils::getUserIP(); - $rUserInfo = \UserRepository::getAuthUserByCredentials($rData['username'], $rData['password']); + $rUserInfo = \XcVm\Domain\User\UserRepository::getAuthUserByCredentials($rData['username'], $rData['password']); $rAccessCode = AuthRepository::getCurrentCode(true); if (!isset($rUserInfo)) { @@ -168,7 +169,7 @@ class Authenticator { } $rIP = \XcVm\Core\Util\NetworkUtils::getUserIP(); - $rUserInfo = \UserRepository::getAuthUserByCredentials($rData['username'], $rData['password']); + $rUserInfo = \XcVm\Domain\User\UserRepository::getAuthUserByCredentials($rData['username'], $rData['password']); $rAccessCode = AuthRepository::getCurrentCode(true); if (!isset($rUserInfo)) { diff --git a/src/Core/Auth/BruteforceGuard.php b/src/Core/Auth/BruteforceGuard.php index 1240e83d..4e24a2ce 100644 --- a/src/Core/Auth/BruteforceGuard.php +++ b/src/Core/Auth/BruteforceGuard.php @@ -2,6 +2,8 @@ declare(strict_types=1); namespace XcVm\Core\Auth; +use XcVm\Domain\Server\ServerRepository; +use XcVm\Domain\Security\BlocklistService; use XcVm\Core\Util\NetworkUtils; use XcVm\Core\Config\SettingsManager; @@ -53,8 +55,8 @@ class BruteforceGuard { * @return array */ private static function getAllowedIPs(): array { - if (class_exists('ServerRepository', false)) { - return \ServerRepository::getAllowedIPs(); + if (class_exists(\XcVm\Domain\Server\ServerRepository::class, false)) { + return \XcVm\Domain\Server\ServerRepository::getAllowedIPs(); } if (isset($GLOBALS['rAllowedIPs'])) { return $GLOBALS['rAllowedIPs']; @@ -68,8 +70,8 @@ class BruteforceGuard { * @return array */ private static function getBlockedIPs(): array { - if (class_exists('BlocklistService', false)) { - return \BlocklistService::getBlockedIPs(); + if (class_exists(\XcVm\Domain\Security\BlocklistService::class, false)) { + return \XcVm\Domain\Security\BlocklistService::getBlockedIPs(); } if (isset($GLOBALS['rBlockedIPs'])) { return $GLOBALS['rBlockedIPs']; @@ -110,8 +112,8 @@ class BruteforceGuard { $db->query('INSERT INTO `blocked_ips` (`ip`,`notes`,`date`) VALUES(?,?,?)', $ip, $reason, time()); } // Force-refresh blocked IPs cache - if (class_exists('BlocklistService', false) && method_exists('BlocklistService', 'getBlockedIPs')) { - \BlocklistService::getBlockedIPs(true); + if (class_exists(\XcVm\Domain\Security\BlocklistService::class, false)) { + \XcVm\Domain\Security\BlocklistService::getBlockedIPs(true); } } touch(FLOOD_TMP_PATH . 'block_' . $ip); diff --git a/src/Core/Config/DomainResolver.php b/src/Core/Config/DomainResolver.php index 4ee7e5b6..c94f1ecd 100644 --- a/src/Core/Config/DomainResolver.php +++ b/src/Core/Config/DomainResolver.php @@ -1,6 +1,7 @@ set('core.request', RequestManager::getAll()); $rContainer->set('core.config', ConfigReader::getAll()); $rContainer->set('core.settings', SettingsManager::getAll()); - $rContainer->set('core.servers', \ServerRepository::getAll()); - $rContainer->set('core.bouquets', \BouquetService::getAll()); - $rContainer->set('core.categories', \CategoryService::getFromDatabase()); + $rContainer->set('core.servers', \XcVm\Domain\Server\ServerRepository::getAll()); + $rContainer->set('core.bouquets', \XcVm\Domain\Bouquet\BouquetService::getAll()); + $rContainer->set('core.categories', \XcVm\Domain\Stream\CategoryService::getFromDatabase()); } /** diff --git a/src/Core/Logging/LoggerInterface.php b/src/Core/Logging/LoggerInterface.php index bfe07dba..42acc440 100644 --- a/src/Core/Logging/LoggerInterface.php +++ b/src/Core/Logging/LoggerInterface.php @@ -1,6 +1,7 @@ */ @@ -61,12 +62,12 @@ class SystemInfo { $rJSON['total_mem_used_percent'] = 100; } - // Network interface selection: delegate to \ServerRepository for backward compat + // Network interface selection: delegate to \XcVm\Domain\Server\ServerRepository for backward compat $rNetworkInterface = null; - if (defined('SERVER_ID') && isset(\ServerRepository::getAll()[SERVER_ID]['network_interface'])) { - $rNetworkInterface = \ServerRepository::getAll()[SERVER_ID]['network_interface'] == 'auto' + if (defined('SERVER_ID') && isset(\XcVm\Domain\Server\ServerRepository::getAll()[SERVER_ID]['network_interface'])) { + $rNetworkInterface = \XcVm\Domain\Server\ServerRepository::getAll()[SERVER_ID]['network_interface'] == 'auto' ? null - : \ServerRepository::getAll()[SERVER_ID]['network_interface']; + : \XcVm\Domain\Server\ServerRepository::getAll()[SERVER_ID]['network_interface']; } $rJSON['network_info'] = self::getNetwork($rNetworkInterface); diff --git a/src/Domain/Bouquet/BouquetService.php b/src/Domain/Bouquet/BouquetService.php index e3ade5b5..410ebd68 100644 --- a/src/Domain/Bouquet/BouquetService.php +++ b/src/Domain/Bouquet/BouquetService.php @@ -1,5 +1,9 @@ format('U'); - } catch (Exception $e) { + } catch (\Exception $e) { } } } @@ -285,9 +291,9 @@ class EnigmaService { if (!(0 < strlen($rData['exp_date']) && $rData['exp_date'] != '1970-01-01')) { } else { try { - $rDate = new DateTime($rData['exp_date']); + $rDate = new \DateTime($rData['exp_date']); $rUserArray['exp_date'] = $rDate->format('U'); - } catch (Exception $e) { + } catch (\Exception $e) { return array('status' => STATUS_INVALID_DATE, 'data' => $rData); } } diff --git a/src/Domain/Device/MagService.php b/src/Domain/Device/MagService.php index d260df8f..18f96801 100644 --- a/src/Domain/Device/MagService.php +++ b/src/Domain/Device/MagService.php @@ -1,5 +1,11 @@ format('U'); - } catch (Exception $e) { + } catch (\Exception $e) { } } } @@ -309,9 +315,9 @@ class MagService { if (isset($rData['exp_date']) && !isset($rData['no_expire'])) { if (0 < strlen($rData['exp_date']) && $rData['exp_date'] != '1970-01-01') { try { - $rDate = new DateTime($rData['exp_date']); + $rDate = new \DateTime($rData['exp_date']); $rUserArray['exp_date'] = $rDate->format('U'); - } catch (Exception $e) { + } catch (\Exception $e) { return array('status' => STATUS_INVALID_DATE, 'data' => $rData); } } diff --git a/src/Domain/Epg/EPG.php b/src/Domain/Epg/EPG.php index 78cc5a44..7ca67349 100644 --- a/src/Domain/Epg/EPG.php +++ b/src/Domain/Epg/EPG.php @@ -1,5 +1,7 @@ rEPGSource = $rXML; $this->rValid = true; $this->log("[EPG] EPG source loaded successfully: $rSource"); - } catch (Exception $e) { + } catch (\Exception $e) { FileLogger::log('epg', 'EPG failed to process: ' . $rSource); - $this->log("[EPG] Exception while loading EPG: " . $e->getMessage() . " | Source: $rSource"); + $this->log("[EPG] \Exception while loading EPG: " . $e->getMessage() . " | Source: $rSource"); } } } diff --git a/src/Domain/Epg/EpgService.php b/src/Domain/Epg/EpgService.php index aea41c52..0edc8c75 100644 --- a/src/Domain/Epg/EpgService.php +++ b/src/Domain/Epg/EpgService.php @@ -1,5 +1,7 @@ format('U'); - } catch (Exception $e) { + } catch (\Exception $e) { } } } @@ -246,9 +252,9 @@ class LineService { if (!(0 < strlen($rData['exp_date']) && $rData['exp_date'] != '1970-01-01')) { } else { try { - $rDate = new DateTime($rData['exp_date']); + $rDate = new \DateTime($rData['exp_date']); $rArray['exp_date'] = $rDate->format('U'); - } catch (Exception $e) { + } catch (\Exception $e) { return array('status' => STATUS_INVALID_DATE, 'data' => $rData); } } diff --git a/src/Domain/Line/PackageService.php b/src/Domain/Line/PackageService.php index 72e55179..c440421b 100644 --- a/src/Domain/Line/PackageService.php +++ b/src/Domain/Line/PackageService.php @@ -1,5 +1,8 @@ zRangeByScore('SERVER#' . $rServerID, '-inf', '+inf'); @@ -264,7 +267,7 @@ class ConnectionTracker { * @return array|null Updated connection data, or null on exec failure. */ public static function updateConnection(array $rData, array $rChanges = [], ?string $rOption = null): ?array { - $rRedis = RedisManager::instance(); + $rRedis = \RedisManager::instance(); if (!$rRedis) { return null; } @@ -326,7 +329,7 @@ class ConnectionTracker { * @return array|false MULTI/EXEC result. */ public static function redisSignal(int $rPID, int $rServerID, int $rRTMP, $rCustomData = null) { - $rRedis = RedisManager::instance(); + $rRedis = \RedisManager::instance(); if (!$rRedis) { return false; } @@ -346,7 +349,7 @@ class ConnectionTracker { * @return array Map of userID => connections[] (or count, or keys). */ public static function getUserConnections(array $rUserIDs, bool $rCount = false, bool $rKeysOnly = false): array { - $rRedis = RedisManager::instance(); + $rRedis = \RedisManager::instance(); if (!$rRedis) { return []; } @@ -393,7 +396,7 @@ class ConnectionTracker { * @return array Map of serverID => connections[] (or count, or keys). */ public static function getServerConnections(array $rServerIDs, bool $rProxy = false, bool $rCount = false, bool $rKeysOnly = false): array { - $rRedis = RedisManager::instance(); + $rRedis = \RedisManager::instance(); if (!$rRedis) { return []; } @@ -437,7 +440,7 @@ class ConnectionTracker { * @return array Map of userID => connection data. */ public static function getFirstConnection(array $rUserIDs): array { - $rRedis = RedisManager::instance(); + $rRedis = \RedisManager::instance(); if (!$rRedis) { return []; } @@ -476,7 +479,7 @@ class ConnectionTracker { * @return array Map of streamID => connections[] (or count). */ public static function getStreamConnections(array $rStreamIDs, bool $rGroup = true, bool $rCount = false): array { - $rRedis = RedisManager::instance(); + $rRedis = \RedisManager::instance(); if (!$rRedis) { return []; } @@ -527,7 +530,7 @@ class ConnectionTracker { * @return array Connections grouped by identity, or [count, unique]. */ public static function getRedisConnections(?int $rUserID = null, ?int $rServerID = null, ?int $rStreamID = null, bool $rOpenOnly = false, bool $rCountOnly = false, bool $rGroup = true, bool $rHLSOnly = false): array { - $rRedis = RedisManager::instance(); + $rRedis = \RedisManager::instance(); if (!$rRedis) { return ($rCountOnly ? array(0, 0) : array()); } @@ -586,7 +589,7 @@ class ConnectionTracker { * @return array|null Deserialized connection data, or null if not found. */ public static function getConnection(string $rUUID): ?array { - $rRedis = RedisManager::instance(); + $rRedis = \RedisManager::instance(); if (!$rRedis) { return null; } @@ -605,7 +608,7 @@ class ConnectionTracker { * @return array|false MULTI/EXEC result. */ public static function createConnection(array $rData) { - $rRedis = RedisManager::instance(); + $rRedis = \RedisManager::instance(); if (!$rRedis) { return false; } @@ -635,7 +638,7 @@ class ConnectionTracker { * @return array UUID keys or deserialized connection data. */ public static function getLineConnections(int $rUserID, bool $rActive = false, bool $rKeys = false): array { - $rRedis = RedisManager::instance(); + $rRedis = \RedisManager::instance(); if (!$rRedis) { return []; } @@ -657,7 +660,7 @@ class ConnectionTracker { * @return array Array of deserialized ended connection data. */ public static function getEnded(): array { - $rRedis = RedisManager::instance(); + $rRedis = \RedisManager::instance(); if (!$rRedis) { return []; } @@ -702,11 +705,11 @@ class ConnectionTracker { if (!empty($rActivityInfo)) { global $rSettings, $rServers; $db = self::db(); - if (!$rSettings['redis_handler'] || is_object(RedisManager::instance())) { + if (!$rSettings['redis_handler'] || is_object(\RedisManager::instance())) { } else { - RedisManager::ensureConnected(); + \RedisManager::ensureConnected(); } - $rRedisObj = RedisManager::instance(); + $rRedisObj = \RedisManager::instance(); if (!$rRedisObj && $rSettings['redis_handler']) { return false; } diff --git a/src/Domain/Stream/PlaylistGenerator.php b/src/Domain/Stream/PlaylistGenerator.php index 28101146..4783f011 100644 --- a/src/Domain/Stream/PlaylistGenerator.php +++ b/src/Domain/Stream/PlaylistGenerator.php @@ -1,5 +1,7 @@ query('UPDATE `lines` SET `forced_country` = ? WHERE `id` = ?', $rUserInfo['forced_country'], $rUserInfo['id']); } @@ -558,7 +562,7 @@ class UserRepository { if (!($rUserInfo['isp_violate'] == 0 && strtolower($rUserInfo['con_isp_name']) != strtolower($rUserInfo['isp_desc']))) { } else { if ($rCached) { - RedisManager::setSignal('isp/' . $rUserInfo['id'], json_encode(array($rUserInfo['con_isp_name'], $rUserInfo['isp_asn']))); + \RedisManager::setSignal('isp/' . $rUserInfo['id'], json_encode(array($rUserInfo['con_isp_name'], $rUserInfo['isp_asn']))); } else { $db->query('UPDATE `lines` SET `isp_desc` = ?, `as_number` = ? WHERE `id` = ?', $rUserInfo['con_isp_name'], $rUserInfo['isp_asn'], $rUserInfo['id']); } diff --git a/src/Domain/User/UserService.php b/src/Domain/User/UserService.php index 6de311c3..a724ad20 100644 --- a/src/Domain/User/UserService.php +++ b/src/Domain/User/UserService.php @@ -1,5 +1,8 @@ getSeason($rData['tmdb_id'], intval($rData['season_num']))->getJSON(), true); diff --git a/src/Domain/Vod/MovieService.php b/src/Domain/Vod/MovieService.php index 9ea1f234..3bcce007 100644 --- a/src/Domain/Vod/MovieService.php +++ b/src/Domain/Vod/MovieService.php @@ -1,5 +1,11 @@ WatchService::getWatchCategories(1), 2 => WatchService::getWatchCategories(2)); + $rWatchCategories = array(1 => \WatchService::getWatchCategories(1), 2 => \WatchService::getWatchCategories(2)); foreach ($rImportStreams as $rImportStream) { $rData = array('import' => true, 'type' => 'movie', 'title' => $rImportStream['title'], 'file' => $rImportStream['url'], 'subtitles' => array(), 'servers' => $rServerIDs, 'fb_category_id' => $rCategories, 'fb_bouquets' => $rBouquets, 'disable_tmdb' => $rDisableTMDB, 'ignore_no_match' => $rIgnoreMatch, 'bouquets' => array(), 'category_id' => array(), 'language' => SettingsManager::getAll()['tmdb_language'], 'watch_categories' => $rWatchCategories, 'read_native' => $rData['read_native'], 'movie_symlink' => $rData['movie_symlink'], 'remove_subtitles' => $rData['remove_subtitles'], 'direct_source' => $rData['direct_source'], 'direct_proxy' => $rData['direct_proxy'], 'auto_encode' => $rRestart, 'auto_upgrade' => false, 'fallback_title' => false, 'ffprobe_input' => false, 'transcode_profile_id' => $rData['transcode_profile_id'], 'target_container' => $rImportStream['container'], 'max_genres' => intval(SettingsManager::getAll()['max_genres']), 'duplicate_tmdb' => true); @@ -989,9 +995,9 @@ class MovieService { require_once MAIN_HOME . 'Modules/tmdb/lib/TmdbClient.php'; if (0 < strlen(SettingsManager::getAll()['tmdb_language'])) { - $rTMDB = new TMDB(SettingsManager::getAll()['tmdb_api_key'], SettingsManager::getAll()['tmdb_language']); + $rTMDB = new \TMDB(SettingsManager::getAll()['tmdb_api_key'], SettingsManager::getAll()['tmdb_language']); } else { - $rTMDB = new TMDB(SettingsManager::getAll()['tmdb_api_key']); + $rTMDB = new \TMDB(SettingsManager::getAll()['tmdb_api_key']); } return json_decode(json_encode($rTMDB->getSimilarMovies($rID, $rPage)), true); diff --git a/src/Domain/Vod/SeriesService.php b/src/Domain/Vod/SeriesService.php index fd9284bb..44f21bf7 100644 --- a/src/Domain/Vod/SeriesService.php +++ b/src/Domain/Vod/SeriesService.php @@ -1,5 +1,10 @@ WatchService::getWatchCategories(1), 2 => WatchService::getWatchCategories(2)); + $rWatchCategories = array(1 => \WatchService::getWatchCategories(1), 2 => \WatchService::getWatchCategories(2)); foreach ($rImportStreams as $rImportStream) { $rData = array('import' => true, 'type' => 'series', 'title' => $rImportStream['title'], 'file' => $rImportStream['url'], 'subtitles' => array(), 'servers' => $rServerIDs, 'fb_category_id' => $rCategories, 'fb_bouquets' => $rBouquets, 'disable_tmdb' => false, 'ignore_no_match' => false, 'bouquets' => array(), 'category_id' => array(), 'language' => SettingsManager::getAll()['tmdb_language'], 'watch_categories' => $rWatchCategories, 'read_native' => $rData['read_native'], 'movie_symlink' => $rData['movie_symlink'], 'remove_subtitles' => $rData['remove_subtitles'], 'direct_source' => $rData['direct_source'], 'direct_proxy' => $rData['direct_proxy'], 'auto_encode' => $rRestart, 'auto_upgrade' => false, 'fallback_title' => false, 'ffprobe_input' => false, 'transcode_profile_id' => $rData['transcode_profile_id'], 'target_container' => $rImportStream['container'], 'max_genres' => intval(SettingsManager::getAll()['max_genres']), 'duplicate_tmdb' => true); @@ -494,9 +499,9 @@ class SeriesService { require_once MAIN_HOME . 'Modules/tmdb/lib/TmdbClient.php'; if (0 < strlen(SettingsManager::getAll()['tmdb_language'])) { - $rTMDB = new TMDB(SettingsManager::getAll()['tmdb_api_key'], SettingsManager::getAll()['tmdb_language']); + $rTMDB = new \TMDB(SettingsManager::getAll()['tmdb_api_key'], SettingsManager::getAll()['tmdb_language']); } else { - $rTMDB = new TMDB(SettingsManager::getAll()['tmdb_api_key']); + $rTMDB = new \TMDB(SettingsManager::getAll()['tmdb_api_key']); } return json_decode(json_encode($rTMDB->getSimilarSeries($rID, $rPage)), true); @@ -520,7 +525,7 @@ class SeriesService { } /** - * Update series seasons from TMDB. + * Update series seasons from \TMDB. */ public static function updateFromTMDB($rID) { $db = self::db(); @@ -535,12 +540,12 @@ class SeriesService { if (0 >= strlen($rTMDBID)) { } else { if (0 < strlen($rRow['tmdb_language'])) { - $rTMDB = new TMDB(SettingsManager::getAll()['tmdb_api_key'], $rRow['tmdb_language']); + $rTMDB = new \TMDB(SettingsManager::getAll()['tmdb_api_key'], $rRow['tmdb_language']); } else { if (0 < strlen(SettingsManager::getAll()['tmdb_language'])) { - $rTMDB = new TMDB(SettingsManager::getAll()['tmdb_api_key'], SettingsManager::getAll()['tmdb_language']); + $rTMDB = new \TMDB(SettingsManager::getAll()['tmdb_api_key'], SettingsManager::getAll()['tmdb_language']); } else { - $rTMDB = new TMDB(SettingsManager::getAll()['tmdb_api_key']); + $rTMDB = new \TMDB(SettingsManager::getAll()['tmdb_api_key']); } } @@ -634,9 +639,9 @@ class SeriesService { } /** - * Fetch a series by its TMDB id. + * Fetch a series by its \TMDB id. * - * @param int $rID TMDB id. + * @param int $rID \TMDB id. * @return array|false The series row, or false if not found. */ public static function getByTMDBId($rID) { diff --git a/src/Domain/Vod/TMDbService.php b/src/Domain/Vod/TMDbService.php index d7a90e20..71577574 100644 --- a/src/Domain/Vod/TMDbService.php +++ b/src/Domain/Vod/TMDbService.php @@ -1,5 +1,7 @@ getMovie($rID) ?: null); } /** - * Fetch series metadata from TMDB. + * Fetch series metadata from \TMDB. * - * @param int $rID TMDB series id. + * @param int $rID \TMDB series id. * @return array|null Series metadata, or null on failure. */ public static function getSeries($rID) { require_once MAIN_HOME . 'Modules/tmdb/lib/TmdbClient.php'; if (0 < strlen(SettingsManager::getAll()['tmdb_language'])) { - $rTMDB = new TMDB(SettingsManager::getAll()['tmdb_api_key'], SettingsManager::getAll()['tmdb_language']); + $rTMDB = new \TMDB(SettingsManager::getAll()['tmdb_api_key'], SettingsManager::getAll()['tmdb_language']); } else { - $rTMDB = new TMDB(SettingsManager::getAll()['tmdb_api_key']); + $rTMDB = new \TMDB(SettingsManager::getAll()['tmdb_api_key']); } return (json_decode($rTMDB->getTVShow($rID)->getJSON(), true) ?: null); } /** - * Fetch season metadata (with episodes) from TMDB. + * Fetch season metadata (with episodes) from \TMDB. * - * @param int $rID TMDB series id. + * @param int $rID \TMDB series id. * @param int $rSeason Season number. * @return array|null Season metadata, or null on failure. */ @@ -85,18 +87,18 @@ class TMDbService { require_once MAIN_HOME . 'Modules/tmdb/lib/TmdbClient.php'; if (0 < strlen(SettingsManager::getAll()['tmdb_language'])) { - $rTMDB = new TMDB(SettingsManager::getAll()['tmdb_api_key'], SettingsManager::getAll()['tmdb_language']); + $rTMDB = new \TMDB(SettingsManager::getAll()['tmdb_api_key'], SettingsManager::getAll()['tmdb_language']); } else { - $rTMDB = new TMDB(SettingsManager::getAll()['tmdb_api_key']); + $rTMDB = new \TMDB(SettingsManager::getAll()['tmdb_api_key']); } return json_decode($rTMDB->getSeason($rID, intval($rSeason))->getJSON(), true); } /** - * Fetch a series trailer URL/key from TMDB. + * Fetch a series trailer URL/key from \TMDB. * - * @param int $rTMDBID TMDB series id. + * @param int $rTMDBID \TMDB series id. * @param string|null $rLanguage Preferred language, or null for default. * @return string|null Trailer reference, or null if none. */ @@ -125,9 +127,9 @@ class TMDbService { } /** - * Fetch episode still images from TMDB. + * Fetch episode still images from \TMDB. * - * @param int $rTMDBID TMDB series id. + * @param int $rTMDBID \TMDB series id. * @param int $rSeason Season number. * @param int $rEpisode Episode number. * @return array Still image references. @@ -144,7 +146,7 @@ class TMDbService { } /** - * Import TMDB genres as VOD categories. + * Import \TMDB genres as VOD categories. * * @return void */ @@ -153,9 +155,9 @@ class TMDbService { require_once MAIN_HOME . 'Modules/tmdb/lib/TmdbClient.php'; if (0 < strlen(SettingsManager::getAll()['tmdb_language'])) { - $rTMDB = new TMDB(SettingsManager::getAll()['tmdb_api_key'], SettingsManager::getAll()['tmdb_language']); + $rTMDB = new \TMDB(SettingsManager::getAll()['tmdb_api_key'], SettingsManager::getAll()['tmdb_language']); } else { - $rTMDB = new TMDB(SettingsManager::getAll()['tmdb_api_key']); + $rTMDB = new \TMDB(SettingsManager::getAll()['tmdb_api_key']); } $rCurrentCats = array('movie' => array(), 'series' => array()); @@ -190,7 +192,7 @@ class TMDbService { } /** - * Refresh the TMDB genre → category mappings. + * Refresh the \TMDB genre → category mappings. * * @return void */ @@ -199,9 +201,9 @@ class TMDbService { require_once MAIN_HOME . 'Modules/tmdb/lib/TmdbClient.php'; if (0 < strlen(SettingsManager::getAll()['tmdb_language'])) { - $rTMDB = new TMDB(SettingsManager::getAll()['tmdb_api_key'], SettingsManager::getAll()['tmdb_language']); + $rTMDB = new \TMDB(SettingsManager::getAll()['tmdb_api_key'], SettingsManager::getAll()['tmdb_language']); } else { - $rTMDB = new TMDB(SettingsManager::getAll()['tmdb_api_key']); + $rTMDB = new \TMDB(SettingsManager::getAll()['tmdb_api_key']); } $rCurrentCats = array(1 => array(), 2 => array()); diff --git a/src/Infrastructure/ResellerApiDispatcher.php b/src/Infrastructure/ResellerApiDispatcher.php index a072da12..234e7f54 100644 --- a/src/Infrastructure/ResellerApiDispatcher.php +++ b/src/Infrastructure/ResellerApiDispatcher.php @@ -1,5 +1,16 @@ >
diff --git a/src/Public/Controllers/Admin/ArchiveController.php b/src/Public/Controllers/Admin/ArchiveController.php index a0559ebd..f2199f08 100644 --- a/src/Public/Controllers/Admin/ArchiveController.php +++ b/src/Public/Controllers/Admin/ArchiveController.php @@ -1,5 +1,7 @@ > diff --git a/src/Public/Views/admin/cache.php b/src/Public/Views/admin/cache.php index 7cbb3f41..a981ffcd 100644 --- a/src/Public/Views/admin/cache.php +++ b/src/Public/Views/admin/cache.php @@ -1,4 +1,5 @@
diff --git a/src/Public/Views/admin/created_channel.php b/src/Public/Views/admin/created_channel.php index 77e2cbe5..eb6e936b 100644 --- a/src/Public/Views/admin/created_channel.php +++ b/src/Public/Views/admin/created_channel.php @@ -1,4 +1,9 @@
>
diff --git a/src/Public/Views/admin/created_channel_mass.php b/src/Public/Views/admin/created_channel_mass.php index b03cfb6a..3a8325f8 100644 --- a/src/Public/Views/admin/created_channel_mass.php +++ b/src/Public/Views/admin/created_channel_mass.php @@ -1,4 +1,6 @@
}); setTimeout(pingSession, 30000); headerStats(); diff --git a/src/Public/Views/admin/enigma_mass.php b/src/Public/Views/admin/enigma_mass.php index 362a1440..4e1cd6d2 100644 --- a/src/Public/Views/admin/enigma_mass.php +++ b/src/Public/Views/admin/enigma_mass.php @@ -1,4 +1,6 @@