mirror of
https://github.com/Vateron-Media/XC_VM.git
synced 2026-10-19 20:03:38 +02:00
Refactor permission management and authentication processes
- Moved advanced permissions loading to a separate file for better organization and maintainability. - Updated permission checks to utilize a centralized Authorization class for improved code clarity. - Refactored login processes in both admin and reseller APIs to use a dedicated Authenticator class, streamlining the authentication logic. - Introduced RedisManager for handling Redis connections and signal management. - Adjusted error reporting settings in Logger to reduce verbosity in production. - Enhanced playlist generation logic to correctly handle proxy IPs. - Improved handling of optional parameters in streaming URL generation to prevent potential errors.
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
class SettingsRepository {
|
||||
public static function getAll($db, $rGetCacheCallback, $rSetCacheCallback, $rForce = false) {
|
||||
if (!$rForce && is_callable($rGetCacheCallback)) {
|
||||
$rCache = call_user_func($rGetCacheCallback, 'settings', 20);
|
||||
if (!empty($rCache)) {
|
||||
return $rCache;
|
||||
}
|
||||
}
|
||||
|
||||
$rOutput = array();
|
||||
$db->query('SELECT * FROM `settings`');
|
||||
$rRows = $db->get_row();
|
||||
foreach ($rRows as $rKey => $rValue) {
|
||||
$rOutput[$rKey] = $rValue;
|
||||
}
|
||||
|
||||
$rOutput['allow_countries'] = json_decode($rOutput['allow_countries'], true);
|
||||
|
||||
$decodedAllowedSTB = json_decode($rOutput['allowed_stb_types'], true);
|
||||
$rOutput['allowed_stb_types'] = array();
|
||||
if (is_array($decodedAllowedSTB)) {
|
||||
$rOutput['allowed_stb_types'] = array_map('strtolower', $decodedAllowedSTB);
|
||||
}
|
||||
|
||||
$rOutput['stalker_lock_images'] = json_decode($rOutput['stalker_lock_images'], true);
|
||||
if (array_key_exists('bouquet_name', $rOutput)) {
|
||||
$rOutput['bouquet_name'] = str_replace(' ', '_', $rOutput['bouquet_name']);
|
||||
}
|
||||
$rOutput['api_ips'] = !empty($rOutput['api_ips']) ? explode(',', $rOutput['api_ips']) : [];
|
||||
|
||||
if (is_callable($rSetCacheCallback)) {
|
||||
call_user_func($rSetCacheCallback, 'settings', $rOutput);
|
||||
}
|
||||
|
||||
return $rOutput;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user