mirror of
https://github.com/Vateron-Media/XC_VM.git
synced 2026-09-16 12:01:36 +02:00
refactor: expand Rector to Streaming / Public\Controllers / Ministra (stage 2)
Widen the Rector config to the remaining class-based trees (Streaming, Public\Controllers, Ministra), keeping the templates, procedural front-controllers (Public/stream, Public/admin, Ministra/portal.php) and the streaming hot-path bootstraps out. Also document the recurring dropped-parens bug + the review grep in the config header. The resulting 107-file pass (94 Public\Controllers, 11 Streaming, 2 Ministra) was reviewed against the suite + PHPStan + the usual scans: - No dropped-parens bug this time (the assignment-in-condition pattern didn't occur in these files). - 6 locally-called private static helpers became instance methods (behaviour-preserving; all called via $this->, no static call sites); one unused private param dropped (FanoutConfig::desired $rSnapshot, call site updated). - De Morgan / ternary / dead-code simplifications; two `$x = getById()` truthy-assignments folded into the condition (no comparison, safe). PHPStan level 5 clean; suite 721 tests / 0 errors.
This commit is contained in:
+23
-5
@@ -7,12 +7,21 @@ use Rector\Config\RectorConfig;
|
||||
use Rector\TypeDeclaration\Rector\StmtsAwareInterface\SafeDeclareStrictTypesRector;
|
||||
|
||||
/**
|
||||
* Rector configuration for XC_VM — stage 1 (scaffolding + audit).
|
||||
* Rector configuration for XC_VM — stage 2 (class-based trees).
|
||||
*
|
||||
* Scope is deliberately narrow: only the PSR-4, class-based trees
|
||||
* (Core / Domain / Cli / Infrastructure). Procedural entry points, view
|
||||
* templates (short tags), the legacy \TMDB library, runtime-installed modules,
|
||||
* the committed vendor and the streaming hot-path are excluded — see withSkip().
|
||||
* Scope is the PSR-4, class-based trees: Core / Domain / Cli / Infrastructure
|
||||
* plus Streaming, Public\Controllers and the Ministra classes. Deliberately
|
||||
* EXCLUDED (see withSkip / withPaths): view templates (Public/Views, short
|
||||
* tags), procedural front-controllers (Public/stream, Public/admin,
|
||||
* Ministra/portal.php), the legacy \TMDB library, runtime-installed modules,
|
||||
* the committed vendor and the streaming hot-path bootstraps.
|
||||
*
|
||||
* KNOWN BUG — review every run: the empty-if/else inversion drops the parens
|
||||
* around an assignment-in-condition, e.g. `if (($k = array_search(...)) === false)`
|
||||
* becomes `if ($k = array_search(...) !== false)` — assigning the bool to $k.
|
||||
* PHPStan catches only some cases. After each `make rector-fix`, grep the diff:
|
||||
* grep -rnE 'if \(\$[A-Za-z_]+ = .*(!==|===) (false|true|null)\)' src/
|
||||
* and restore the parens on any hit before committing.
|
||||
*
|
||||
* Paths are anchored with __DIR__ (this file lives in build/) so the config
|
||||
* behaves the same whether invoked from the repo root (make rector) or from
|
||||
@@ -36,11 +45,20 @@ return RectorConfig::configure()
|
||||
__DIR__ . '/../src/Domain',
|
||||
__DIR__ . '/../src/Cli',
|
||||
__DIR__ . '/../src/Infrastructure',
|
||||
// Stage 2 — class-based trees that were deferred:
|
||||
__DIR__ . '/../src/Streaming',
|
||||
__DIR__ . '/../src/Public/Controllers',
|
||||
__DIR__ . '/../src/Ministra',
|
||||
])
|
||||
->withSkip([
|
||||
// Legacy global \TMDB library — not PSR-4, vendored verbatim.
|
||||
__DIR__ . '/../src/Infrastructure/Tmdb/lib',
|
||||
|
||||
// Ministra procedural front-controller (short tags, injected globals) —
|
||||
// excluded from PHPStan for the same reason. PortalHandler/PortalHelpers
|
||||
// (classes, next to it) ARE analysed.
|
||||
__DIR__ . '/../src/Ministra/portal.php',
|
||||
|
||||
// Streaming hot-path — refactored later in its own cautious phase.
|
||||
__DIR__ . '/../src/Infrastructure/Bootstrap/StreamingRequestBootstrap.php',
|
||||
__DIR__ . '/../src/Infrastructure/Bootstrap/WebApiBootstrap.php',
|
||||
|
||||
+103
-176
@@ -165,8 +165,7 @@ class PortalHandler {
|
||||
? false
|
||||
: intval($rSettings["playback_limit"]);
|
||||
|
||||
if (!empty($rTotal["playback_limit"])) {
|
||||
} else {
|
||||
if (empty($rTotal["playback_limit"])) {
|
||||
$rTotal["enable_playback_limit"] = false;
|
||||
}
|
||||
|
||||
@@ -178,11 +177,8 @@ class PortalHandler {
|
||||
$rTotal["enable_buffering_indication"] = 1;
|
||||
$rTotal["watchdog_timeout"] = mt_rand(80, 120);
|
||||
|
||||
if (
|
||||
!(empty($rTotal["aspect"]) &&
|
||||
$rServers[SERVER_ID]["server_protocol"] == "https")
|
||||
) {
|
||||
} else {
|
||||
if (empty($rTotal["aspect"]) &&
|
||||
$rServers[SERVER_ID]["server_protocol"] == "https") {
|
||||
$rTotal["aspect"] = "16";
|
||||
}
|
||||
|
||||
@@ -579,8 +575,7 @@ class PortalHandler {
|
||||
exit(json_encode(["js" => true]));
|
||||
|
||||
case "set_screensaver_delay":
|
||||
if (empty($_SERVER["HTTP_COOKIE"])) {
|
||||
} else {
|
||||
if (!empty($_SERVER["HTTP_COOKIE"])) {
|
||||
$rDelay = intval($rRequest["screensaver_delay"]);
|
||||
$ctx["device"]["screensaver_delay"] = $rDelay;
|
||||
$db->query(
|
||||
@@ -594,8 +589,7 @@ class PortalHandler {
|
||||
exit(json_encode(["js" => true]));
|
||||
|
||||
case "set_playback_buffer":
|
||||
if (empty($_SERVER["HTTP_COOKIE"])) {
|
||||
} else {
|
||||
if (!empty($_SERVER["HTTP_COOKIE"])) {
|
||||
$rBufferBytes = intval($rRequest["playback_buffer_bytes"]);
|
||||
$rBufferSize = intval($rRequest["playback_buffer_size"]);
|
||||
$ctx["device"]["playback_buffer_bytes"] = $rBufferBytes;
|
||||
@@ -644,8 +638,7 @@ class PortalHandler {
|
||||
exit(json_encode(["js" => true]));
|
||||
|
||||
case "set_locale":
|
||||
if (empty($rRequest["locale"])) {
|
||||
} else {
|
||||
if (!empty($rRequest["locale"])) {
|
||||
$ctx["device"]["locale"] = $rRequest["locale"];
|
||||
$db->query(
|
||||
"UPDATE `mag_devices` SET `locale` = ? WHERE `mag_id` = ?",
|
||||
@@ -658,8 +651,7 @@ class PortalHandler {
|
||||
exit(json_encode(["js" => []]));
|
||||
|
||||
case "set_hdmi_reaction":
|
||||
if (empty($_SERVER["HTTP_COOKIE"]) || !isset($rRequest["data"])) {
|
||||
} else {
|
||||
if (!(empty($_SERVER["HTTP_COOKIE"]) || !isset($rRequest["data"]))) {
|
||||
$rReaction = $rRequest["data"];
|
||||
$ctx["device"]["hdmi_event_reaction"] = $rReaction;
|
||||
$db->query(
|
||||
@@ -700,8 +692,7 @@ class PortalHandler {
|
||||
);
|
||||
$rData = ["data" => ["msgs" => 0, "additional_services_on" => 1]];
|
||||
|
||||
if (0 >= $db->num_rows()) {
|
||||
} else {
|
||||
if (0 < $db->num_rows()) {
|
||||
$rEvents = $db->get_row();
|
||||
$db->query(
|
||||
"SELECT count(*) FROM `mag_events` WHERE `mag_device_id` = ? AND `status` = 0 ",
|
||||
@@ -723,9 +714,7 @@ class PortalHandler {
|
||||
],
|
||||
];
|
||||
$rAutoStatus = ["reboot", "reload_portal", "play_channel", "cut_off"];
|
||||
|
||||
if (!in_array($rEvents["event"], $rAutoStatus)) {
|
||||
} else {
|
||||
if (in_array($rEvents["event"], $rAutoStatus)) {
|
||||
$db->query(
|
||||
"UPDATE `mag_events` SET `status` = 1 WHERE `id` = ?",
|
||||
$rEvents["id"],
|
||||
@@ -757,36 +746,31 @@ class PortalHandler {
|
||||
global $rSettings, $rCategories;
|
||||
$rCategories = is_array($rCategories ?? null) ? $rCategories : [];
|
||||
|
||||
switch ($rReqAction) {
|
||||
case "get_categories":
|
||||
$rOutput = [];
|
||||
$rOutput["js"] = [];
|
||||
|
||||
if ($rSettings["show_all_category_mag"] != 1) {
|
||||
} else {
|
||||
$rOutput["js"][] = [
|
||||
"id" => "*",
|
||||
"title" => "All",
|
||||
"alias" => "*",
|
||||
"censored" => 0,
|
||||
];
|
||||
}
|
||||
|
||||
foreach ($rCategories as $rCategory) {
|
||||
if (
|
||||
if ($rReqAction === "get_categories") {
|
||||
$rOutput = [];
|
||||
$rOutput["js"] = [];
|
||||
if ($rSettings["show_all_category_mag"] == 1) {
|
||||
$rOutput["js"][] = [
|
||||
"id" => "*",
|
||||
"title" => "All",
|
||||
"alias" => "*",
|
||||
"censored" => 0,
|
||||
];
|
||||
}
|
||||
foreach ($rCategories as $rCategory) {
|
||||
if (
|
||||
$rCategory["category_type"] == "movie" &&
|
||||
in_array($rCategory["id"], $ctx["device"]["category_ids"])
|
||||
) {
|
||||
$rOutput["js"][] = [
|
||||
"id" => $rCategory["id"],
|
||||
"title" => $rCategory["category_name"],
|
||||
"alias" => $rCategory["category_name"],
|
||||
"censored" => intval($rCategory["is_adult"]),
|
||||
];
|
||||
}
|
||||
$rOutput["js"][] = [
|
||||
"id" => $rCategory["id"],
|
||||
"title" => $rCategory["category_name"],
|
||||
"alias" => $rCategory["category_name"],
|
||||
"censored" => intval($rCategory["is_adult"]),
|
||||
];
|
||||
}
|
||||
|
||||
exit(json_encode($rOutput));
|
||||
}
|
||||
exit(json_encode($rOutput));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -840,8 +824,7 @@ class PortalHandler {
|
||||
"play/" .
|
||||
$rToken;
|
||||
|
||||
if (!$rSettings["mag_keep_extension"]) {
|
||||
} else {
|
||||
if ($rSettings["mag_keep_extension"]) {
|
||||
$rURL .= "?ext=." . $rSettings["mag_container"];
|
||||
}
|
||||
} else {
|
||||
@@ -857,8 +840,7 @@ class PortalHandler {
|
||||
]));
|
||||
|
||||
case "set_claim":
|
||||
if (empty($rRequest["id"]) || empty($rRequest["real_type"])) {
|
||||
} else {
|
||||
if (!(empty($rRequest["id"]) || empty($rRequest["real_type"]))) {
|
||||
$rID = intval($rRequest["id"]);
|
||||
$rRealType = $rRequest["real_type"];
|
||||
$rDate = date("Y-m-d H:i:s");
|
||||
@@ -926,18 +908,13 @@ class PortalHandler {
|
||||
$rTime = time();
|
||||
$rEPGData = [];
|
||||
|
||||
if (!file_exists(EPG_PATH . "stream_" . intval($rChannelID))) {
|
||||
} else {
|
||||
if (file_exists(EPG_PATH . "stream_" . intval($rChannelID))) {
|
||||
$rRows = igbinary_unserialize(
|
||||
file_get_contents(EPG_PATH . "stream_" . $rChannelID),
|
||||
);
|
||||
|
||||
foreach ($rRows as $rRow) {
|
||||
if (
|
||||
!(($rRow["start"] <= $rTime && $rTime <= $rRow["end"]) ||
|
||||
$rTime <= $rRow["start"])
|
||||
) {
|
||||
} else {
|
||||
if (($rRow["start"] <= $rTime && $rTime <= $rRow["end"]) ||
|
||||
$rTime <= $rRow["start"]) {
|
||||
$rRow["start_timestamp"] = $rRow["start"];
|
||||
$rRow["stop_timestamp"] = $rRow["end"];
|
||||
$rEPGData[] = $rRow;
|
||||
@@ -945,19 +922,18 @@ class PortalHandler {
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($rEPGData)) {
|
||||
} else {
|
||||
if ($rEPGData !== []) {
|
||||
$rTimeDifference = TimeUtils::getDiffTimezone($ctx["timezone"]) ?: 0;
|
||||
$i = 0;
|
||||
|
||||
for ($n = 0; $n < count($rEPGData); $n++) {
|
||||
$counter = count($rEPGData);
|
||||
for ($n = 0; $n < $counter; $n++) {
|
||||
if ($rEPGData[$n]["end"] >= time()) {
|
||||
$rStartTime = new \DateTime();
|
||||
$rStartTime->setTimestamp($rEPGData[$n]["start"]);
|
||||
$rStartTime->modify((string) $rTimeDifference . " seconds");
|
||||
$rStartTime->modify($rTimeDifference . " seconds");
|
||||
$rEndTime = new \DateTime();
|
||||
$rEndTime->setTimestamp($rEPGData[$n]["end"]);
|
||||
$rEndTime->modify((string) $rTimeDifference . " seconds");
|
||||
$rEndTime->modify($rTimeDifference . " seconds");
|
||||
$rEPG["js"][$i]["id"] = $rEPGData[$n]["id"];
|
||||
$rEPG["js"][$i]["ch_id"] = $rChannelID;
|
||||
$rEPG["js"][$i]["correct"] = $rStartTime->format("Y-m-d H:i:s");
|
||||
@@ -993,8 +969,7 @@ class PortalHandler {
|
||||
case "set_last_id":
|
||||
$rChannelID = intval($rRequest["id"]);
|
||||
|
||||
if (0 >= $rChannelID) {
|
||||
} else {
|
||||
if (0 < $rChannelID) {
|
||||
$ctx["device"]["last_itv_id"] = $rChannelID;
|
||||
$db->query(
|
||||
"UPDATE `mag_devices` SET `last_itv_id` = ? WHERE `mag_id` = ?",
|
||||
@@ -1010,8 +985,7 @@ class PortalHandler {
|
||||
$rOutput = [];
|
||||
$rNumber = 1;
|
||||
|
||||
if ($rSettings["show_all_category_mag"] != 1) {
|
||||
} else {
|
||||
if ($rSettings["show_all_category_mag"] == 1) {
|
||||
$rOutput["js"][] = [
|
||||
"id" => "*",
|
||||
"title" => "All",
|
||||
@@ -1057,8 +1031,7 @@ class PortalHandler {
|
||||
|
||||
switch ($rReqAction) {
|
||||
case "set_claim":
|
||||
if (empty($rRequest["id"]) || empty($rRequest["real_type"])) {
|
||||
} else {
|
||||
if (!(empty($rRequest["id"]) || empty($rRequest["real_type"]))) {
|
||||
$rID = intval($rRequest["id"]);
|
||||
$rRealType = $rRequest["real_type"];
|
||||
$rDate = date("Y-m-d H:i:s");
|
||||
@@ -1074,15 +1047,11 @@ class PortalHandler {
|
||||
exit(json_encode(["js" => true]));
|
||||
|
||||
case "set_fav":
|
||||
if (empty($rRequest["video_id"])) {
|
||||
} else {
|
||||
if (!empty($rRequest["video_id"])) {
|
||||
$rVideoID = intval($rRequest["video_id"]);
|
||||
|
||||
if (in_array($rVideoID, $ctx["device"]["fav_channels"]["movie"])) {
|
||||
} else {
|
||||
if (!in_array($rVideoID, $ctx["device"]["fav_channels"]["movie"])) {
|
||||
$ctx["device"]["fav_channels"]["movie"][] = $rVideoID;
|
||||
}
|
||||
|
||||
$db->query(
|
||||
"UPDATE `mag_devices` SET `fav_channels` = ? WHERE `mag_id` = ?",
|
||||
json_encode($ctx["device"]["fav_channels"]),
|
||||
@@ -1094,16 +1063,13 @@ class PortalHandler {
|
||||
exit(json_encode(["js" => true]));
|
||||
|
||||
case "del_fav":
|
||||
if (empty($rRequest["video_id"])) {
|
||||
} else {
|
||||
if (!empty($rRequest["video_id"])) {
|
||||
$rVideoID = intval($rRequest["video_id"]);
|
||||
|
||||
foreach ($ctx["device"]["fav_channels"]["movie"] as $rKey => $rValue) {
|
||||
if ($rValue != $rVideoID) {
|
||||
} else {
|
||||
if ($rValue == $rVideoID) {
|
||||
unset($ctx["device"]["fav_channels"]["movie"][$rKey]);
|
||||
|
||||
goto B79ca0d52db6b02d; //break;
|
||||
goto B79ca0d52db6b02d;
|
||||
//break;
|
||||
}
|
||||
}
|
||||
B79ca0d52db6b02d:
|
||||
@@ -1121,8 +1087,7 @@ class PortalHandler {
|
||||
$rOutput = [];
|
||||
$rOutput["js"] = [];
|
||||
|
||||
if ($rSettings["show_all_category_mag"] != 1) {
|
||||
} else {
|
||||
if ($rSettings["show_all_category_mag"] == 1) {
|
||||
$rOutput["js"][] = [
|
||||
"id" => "*",
|
||||
"title" => "All",
|
||||
@@ -1194,8 +1159,7 @@ class PortalHandler {
|
||||
$rCommand = ["series_data" => $rCommand, "type" => "series"];
|
||||
}
|
||||
|
||||
if (!$rSeries) {
|
||||
} else {
|
||||
if ($rSeries) {
|
||||
$rCommand["type"] = "series";
|
||||
}
|
||||
|
||||
@@ -1208,8 +1172,7 @@ class PortalHandler {
|
||||
break;
|
||||
|
||||
case "series":
|
||||
if (empty($rCommand["series_data"])) {
|
||||
} else {
|
||||
if (!empty($rCommand["series_data"])) {
|
||||
[$rCommand["series_id"], $rCommand["season_num"]] = explode(
|
||||
":",
|
||||
basename($rCommand["series_data"], ".mpg"),
|
||||
@@ -1262,8 +1225,7 @@ class PortalHandler {
|
||||
"play/" .
|
||||
$rToken;
|
||||
|
||||
if (!$rSettings["mag_keep_extension"]) {
|
||||
} else {
|
||||
if ($rSettings["mag_keep_extension"]) {
|
||||
$rURL .= "?ext=." . $rCommand["target_container"];
|
||||
}
|
||||
|
||||
@@ -1300,8 +1262,7 @@ class PortalHandler {
|
||||
|
||||
switch ($rReqAction) {
|
||||
case "set_claim":
|
||||
if (empty($rRequest["id"]) || empty($rRequest["real_type"])) {
|
||||
} else {
|
||||
if (!(empty($rRequest["id"]) || empty($rRequest["real_type"]))) {
|
||||
$rID = intval($rRequest["id"]);
|
||||
$rRealType = $rRequest["real_type"];
|
||||
$rDate = date("Y-m-d H:i:s");
|
||||
@@ -1317,15 +1278,11 @@ class PortalHandler {
|
||||
exit(json_encode(["js" => true]));
|
||||
|
||||
case "set_fav":
|
||||
if (empty($rRequest["video_id"])) {
|
||||
} else {
|
||||
if (!empty($rRequest["video_id"])) {
|
||||
$rVideoID = intval($rRequest["video_id"]);
|
||||
|
||||
if (in_array($rVideoID, $ctx["device"]["fav_channels"]["series"])) {
|
||||
} else {
|
||||
if (!in_array($rVideoID, $ctx["device"]["fav_channels"]["series"])) {
|
||||
$ctx["device"]["fav_channels"]["series"][] = $rVideoID;
|
||||
}
|
||||
|
||||
$db->query(
|
||||
"UPDATE `mag_devices` SET `fav_channels` = ? WHERE `mag_id` = ?",
|
||||
json_encode($ctx["device"]["fav_channels"]),
|
||||
@@ -1337,16 +1294,13 @@ class PortalHandler {
|
||||
exit(json_encode(["js" => true]));
|
||||
|
||||
case "del_fav":
|
||||
if (empty($rRequest["video_id"])) {
|
||||
} else {
|
||||
if (!empty($rRequest["video_id"])) {
|
||||
$rVideoID = intval($rRequest["video_id"]);
|
||||
|
||||
foreach ($ctx["device"]["fav_channels"]["series"] as $rKey => $rValue) {
|
||||
if ($rValue != $rVideoID) {
|
||||
} else {
|
||||
if ($rValue == $rVideoID) {
|
||||
unset($ctx["device"]["fav_channels"]["series"][$rKey]);
|
||||
|
||||
goto c2cd03c4f6bdbdea; //break;
|
||||
goto c2cd03c4f6bdbdea;
|
||||
//break;
|
||||
}
|
||||
}
|
||||
c2cd03c4f6bdbdea:
|
||||
@@ -1364,8 +1318,7 @@ class PortalHandler {
|
||||
$rOutput = [];
|
||||
$rOutput["js"] = [];
|
||||
|
||||
if ($rSettings["show_all_category_mag"] != 1) {
|
||||
} else {
|
||||
if ($rSettings["show_all_category_mag"] == 1) {
|
||||
$rOutput["js"][] = [
|
||||
"id" => "*",
|
||||
"title" => "All",
|
||||
@@ -1374,7 +1327,7 @@ class PortalHandler {
|
||||
];
|
||||
}
|
||||
|
||||
foreach ($rCategories as $rCategoryID => $rCategory) {
|
||||
foreach ($rCategories as $rCategory) {
|
||||
if (
|
||||
$rCategory["category_type"] == "series" &&
|
||||
in_array($rCategory["id"], $rCategoryIDs)
|
||||
@@ -1394,7 +1347,7 @@ class PortalHandler {
|
||||
$rOutput = [];
|
||||
$rOutput["js"][] = ["id" => "*", "title" => "*"];
|
||||
|
||||
foreach ($rCategories as $rCategoryID => $rCategory) {
|
||||
foreach ($rCategories as $rCategory) {
|
||||
if (
|
||||
$rCategory["category_type"] == "series" &&
|
||||
in_array($rCategory["id"], $rCategoryIDs)
|
||||
@@ -1441,23 +1394,21 @@ class PortalHandler {
|
||||
public static function handleAccountInfo(string $rReqAction, array &$ctx) {
|
||||
global $rSettings;
|
||||
|
||||
switch ($rReqAction) {
|
||||
case "get_main_info":
|
||||
if (empty($ctx["device"]["exp_date"])) {
|
||||
if ($rReqAction === "get_main_info") {
|
||||
if (empty($ctx["device"]["exp_date"])) {
|
||||
$rExpiry = "Unlimited";
|
||||
} else {
|
||||
$rExpiry = date("F j, Y, g:i a", $ctx["device"]["exp_date"]);
|
||||
}
|
||||
|
||||
exit(json_encode([
|
||||
"js" => [
|
||||
"mac" => $ctx["mac"],
|
||||
"phone" => $rExpiry,
|
||||
"message" => htmlspecialchars_decode(
|
||||
str_replace("\n", "<br/>", $rSettings["mag_message"]),
|
||||
),
|
||||
],
|
||||
]));
|
||||
} else {
|
||||
$rExpiry = date("F j, Y, g:i a", $ctx["device"]["exp_date"]);
|
||||
}
|
||||
exit(json_encode([
|
||||
"js" => [
|
||||
"mac" => $ctx["mac"],
|
||||
"phone" => $rExpiry,
|
||||
"message" => htmlspecialchars_decode(
|
||||
str_replace("\n", "<br/>", $rSettings["mag_message"]),
|
||||
),
|
||||
],
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1478,7 +1429,7 @@ class PortalHandler {
|
||||
exit(getStations(null, $rFav, $rSortBy));
|
||||
|
||||
case "get_all_fav_radio":
|
||||
exit(getStations(null, 1, null));
|
||||
exit(getStations(null, 1));
|
||||
|
||||
case "set_fav":
|
||||
$f3f9f9fa3c58c22b = empty($rRequest["fav_radio"]) ? "" : $rRequest["fav_radio"];
|
||||
@@ -1511,15 +1462,12 @@ class PortalHandler {
|
||||
|
||||
switch ($rReqAction) {
|
||||
case "get_next_part_url":
|
||||
if (empty($rRequest["id"])) {
|
||||
} else {
|
||||
if (!empty($rRequest["id"])) {
|
||||
$rID = $rRequest["id"];
|
||||
$rStreamID = substr($rID, 0, strpos($rID, "_"));
|
||||
$rDate = strtotime(substr($rID, strpos($rID, "_") + 1));
|
||||
$rRow = getepg($rStreamID, $rDate, $rDate + 86400)[0] ?: null;
|
||||
|
||||
if (!$rRow) {
|
||||
} else {
|
||||
if ($rRow) {
|
||||
$rRow = $db->get_row();
|
||||
$rProgramStart = $rRow["start"];
|
||||
$rDuration = intval(($rRow["end"] - $rRow["start"]) / 60);
|
||||
@@ -1551,12 +1499,9 @@ class PortalHandler {
|
||||
$rToken .
|
||||
"?&osd_title=" .
|
||||
$rTitle;
|
||||
|
||||
if (!$rSettings["mag_keep_extension"]) {
|
||||
} else {
|
||||
if ($rSettings["mag_keep_extension"]) {
|
||||
$rURL .= "&ext=.ts";
|
||||
}
|
||||
|
||||
exit(json_encode(["js" => $ctx["player"] . $rURL]));
|
||||
}
|
||||
}
|
||||
@@ -1600,8 +1545,7 @@ class PortalHandler {
|
||||
"play/" .
|
||||
$rToken;
|
||||
|
||||
if (!$rSettings["mag_keep_extension"]) {
|
||||
} else {
|
||||
if ($rSettings["mag_keep_extension"]) {
|
||||
$rURL .= "?ext=.ts";
|
||||
}
|
||||
|
||||
@@ -1706,15 +1650,12 @@ class PortalHandler {
|
||||
$rStartTime = strtotime($rReqDate . " 00:00:00");
|
||||
$rEndTime = strtotime($rReqDate . " 23:59:59");
|
||||
|
||||
if (!file_exists(EPG_PATH . "stream_" . intval($rChannelID))) {
|
||||
} else {
|
||||
if (file_exists(EPG_PATH . "stream_" . intval($rChannelID))) {
|
||||
$rRows = igbinary_unserialize(
|
||||
file_get_contents(EPG_PATH . "stream_" . $rChannelID),
|
||||
);
|
||||
|
||||
foreach ($rRows as $rRow) {
|
||||
if (!($rStartTime <= $rRow["start"] && $rRow["start"] <= $rEndTime)) {
|
||||
} else {
|
||||
if ($rStartTime <= $rRow["start"] && $rRow["start"] <= $rEndTime) {
|
||||
$rRow["start_timestamp"] = $rRow["start"];
|
||||
$rRow["stop_timestamp"] = $rRow["end"];
|
||||
$rEPGDatas[] = $rRow;
|
||||
@@ -1732,8 +1673,7 @@ class PortalHandler {
|
||||
$rRequest["ch_id"],
|
||||
);
|
||||
|
||||
if (0 >= $db->num_rows()) {
|
||||
} else {
|
||||
if (0 < $db->num_rows()) {
|
||||
$rStreamRow = $db->get_row();
|
||||
}
|
||||
}
|
||||
@@ -1741,29 +1681,21 @@ class PortalHandler {
|
||||
$rChannelIDx = 0;
|
||||
|
||||
foreach ($rEPGDatas as $rKey => $rEPGData) {
|
||||
if (
|
||||
!($rEPGData["start_timestamp"] <= time() &&
|
||||
time() <= $rEPGData["stop_timestamp"])
|
||||
) {
|
||||
} else {
|
||||
if ($rEPGData["start_timestamp"] <= time() &&
|
||||
time() <= $rEPGData["stop_timestamp"]) {
|
||||
$rChannelIDx = $rKey + 1;
|
||||
|
||||
goto Aeb56a67ad642976; //break;
|
||||
goto Aeb56a67ad642976;
|
||||
//break;
|
||||
}
|
||||
}
|
||||
Aeb56a67ad642976:
|
||||
if ($rPage != 0) {
|
||||
} else {
|
||||
if ($rPage == 0) {
|
||||
$rDefaultPage = true;
|
||||
$rPage = ceil($rChannelIDx / $rPageItems);
|
||||
|
||||
if ($rPage != 0) {
|
||||
} else {
|
||||
if ($rPage == 0) {
|
||||
$rPage = 1;
|
||||
}
|
||||
|
||||
if ($rReqDate == date("Y-m-d")) {
|
||||
} else {
|
||||
if ($rReqDate != date("Y-m-d")) {
|
||||
$rPage = 1;
|
||||
$rDefaultPage = false;
|
||||
}
|
||||
@@ -1772,21 +1704,21 @@ class PortalHandler {
|
||||
$rProgram = array_slice($rEPGDatas, ($rPage - 1) * $rPageItems, $rPageItems);
|
||||
$rData = [];
|
||||
$rTimeDifference = TimeUtils::getDiffTimezone($ctx["timezone"]);
|
||||
$counter = count($rProgram);
|
||||
|
||||
for ($i = 0; $i < count($rProgram); $i++) {
|
||||
for ($i = 0; $i < $counter; $i++) {
|
||||
$open = 0;
|
||||
|
||||
if (time() > $rProgram[$i]["stop_timestamp"]) {
|
||||
} else {
|
||||
if (time() <= $rProgram[$i]["stop_timestamp"]) {
|
||||
$open = 1;
|
||||
}
|
||||
|
||||
$rStartTime = new \DateTime();
|
||||
$rStartTime->setTimestamp($rProgram[$i]["start"]);
|
||||
$rStartTime->modify((string) $rTimeDifference . " seconds");
|
||||
$rStartTime->modify($rTimeDifference . " seconds");
|
||||
$rEndTime = new \DateTime();
|
||||
$rEndTime->setTimestamp($rProgram[$i]["end"]);
|
||||
$rEndTime->modify((string) $rTimeDifference . " seconds");
|
||||
$rEndTime->modify($rTimeDifference . " seconds");
|
||||
$rData[$i]["id"] = $rProgram[$i]["id"] . "_" . $rChannelID;
|
||||
$rData[$i]["ch_id"] = $rChannelID;
|
||||
$rData[$i]["time"] = $rStartTime->format("Y-m-d H:i:s");
|
||||
@@ -1848,31 +1780,27 @@ class PortalHandler {
|
||||
$rRequest["ch_id"],
|
||||
);
|
||||
|
||||
if (0 >= $db->num_rows()) {
|
||||
} else {
|
||||
if (0 < $db->num_rows()) {
|
||||
$rStreamRow = $db->get_row();
|
||||
}
|
||||
}
|
||||
|
||||
$rTime = strtotime(date("Y-m-d 00:00:00"));
|
||||
|
||||
if (!file_exists(EPG_PATH . "stream_" . intval($rChannelID))) {
|
||||
} else {
|
||||
if (file_exists(EPG_PATH . "stream_" . intval($rChannelID))) {
|
||||
$rRows = igbinary_unserialize(
|
||||
file_get_contents(EPG_PATH . "stream_" . $rChannelID),
|
||||
);
|
||||
|
||||
foreach ($rRows as $rRow) {
|
||||
if ($rTime > $rRow["start"]) {
|
||||
} else {
|
||||
if ($rTime <= $rRow["start"]) {
|
||||
$rRow["start_timestamp"] = $rRow["start"];
|
||||
$rRow["stop_timestamp"] = $rRow["end"];
|
||||
$rStartTime = new \DateTime();
|
||||
$rStartTime->setTimestamp($rRow["start"]);
|
||||
$rStartTime->modify((string) $rTimeDifference . " seconds");
|
||||
$rStartTime->modify($rTimeDifference . " seconds");
|
||||
$rEndTime = new \DateTime();
|
||||
$rEndTime->setTimestamp($rRow["end"]);
|
||||
$rEndTime->modify((string) $rTimeDifference . " seconds");
|
||||
$rEndTime->modify($rTimeDifference . " seconds");
|
||||
$rOutput["js"][] = [
|
||||
"start_timestamp" => $rStartTime->getTimestamp(),
|
||||
"stop_timestamp" => $rEndTime->getTimestamp(),
|
||||
@@ -1894,8 +1822,7 @@ class PortalHandler {
|
||||
* @param array &$ctx Context array
|
||||
*/
|
||||
public static function handleUnauthenticated(string $rReqType, string $rReqAction, array &$ctx) {
|
||||
if (!($rReqType == "stb" && $rReqAction == "get_profile")) {
|
||||
} else {
|
||||
if ($rReqType == "stb" && $rReqAction == "get_profile") {
|
||||
BruteforceGuard::checkBruteforce($ctx["ip"], $ctx["mac"]);
|
||||
BruteforceGuard::checkFlood();
|
||||
}
|
||||
|
||||
+46
-109
@@ -49,8 +49,7 @@ class PortalHelpers {
|
||||
}
|
||||
}
|
||||
|
||||
if (0 >= $db->num_rows()) {
|
||||
} else {
|
||||
if (0 < $db->num_rows()) {
|
||||
$rDevice = $db->get_row();
|
||||
$rUserInfo = UserRepository::getStreamingUserInfo(
|
||||
$rSettings,
|
||||
@@ -70,27 +69,18 @@ class PortalHelpers {
|
||||
$rDevice["fav_channels"] = !empty($rDevice["fav_channels"])
|
||||
? json_decode($rDevice["fav_channels"], true)
|
||||
: [];
|
||||
|
||||
if (!empty($rDevice["fav_channels"]["live"])) {
|
||||
} else {
|
||||
if (empty($rDevice["fav_channels"]["live"])) {
|
||||
$rDevice["fav_channels"]["live"] = [];
|
||||
}
|
||||
|
||||
if (!empty($rDevice["fav_channels"]["movie"])) {
|
||||
} else {
|
||||
if (empty($rDevice["fav_channels"]["movie"])) {
|
||||
$rDevice["fav_channels"]["movie"] = [];
|
||||
}
|
||||
|
||||
if (!empty($rDevice["fav_channels"]["series"])) {
|
||||
} else {
|
||||
if (empty($rDevice["fav_channels"]["series"])) {
|
||||
$rDevice["fav_channels"]["series"] = [];
|
||||
}
|
||||
|
||||
if (!empty($rDevice["fav_channels"]["radio_streams"])) {
|
||||
} else {
|
||||
if (empty($rDevice["fav_channels"]["radio_streams"])) {
|
||||
$rDevice["fav_channels"]["radio_streams"] = [];
|
||||
}
|
||||
|
||||
$rDevice["mag_player"] = trim($rDevice["mag_player"]);
|
||||
unset($rDevice["channel_ids"]);
|
||||
$rDevice["get_profile_vars"] = [
|
||||
@@ -177,33 +167,26 @@ class PortalHelpers {
|
||||
$rDevice["generated"] = time();
|
||||
}
|
||||
} else {
|
||||
if (!$rDevice) {
|
||||
} else {
|
||||
if ($rDevice) {
|
||||
$rLiveIDs = $rVODIDs = $rRadioIDs = $rCategoryIDs = $rChannelIDs = $rSeriesIDs = [];
|
||||
|
||||
foreach ($rDevice["bouquet"] as $rID) {
|
||||
if (!isset($rBouquets[$rID]["streams"])) {
|
||||
} else {
|
||||
if (isset($rBouquets[$rID]["streams"])) {
|
||||
$rChannelIDs = array_merge($rChannelIDs, $rBouquets[$rID]["streams"]);
|
||||
}
|
||||
|
||||
if (!isset($rBouquets[$rID]["series"])) {
|
||||
} else {
|
||||
if (isset($rBouquets[$rID]["series"])) {
|
||||
$rSeriesIDs = array_merge($rSeriesIDs, $rBouquets[$rID]["series"]);
|
||||
}
|
||||
|
||||
if (!isset($rBouquets[$rID]["channels"])) {
|
||||
} else {
|
||||
if (isset($rBouquets[$rID]["channels"])) {
|
||||
$rLiveIDs = array_merge($rLiveIDs, $rBouquets[$rID]["channels"]);
|
||||
}
|
||||
|
||||
if (!isset($rBouquets[$rID]["movies"])) {
|
||||
} else {
|
||||
if (isset($rBouquets[$rID]["movies"])) {
|
||||
$rVODIDs = array_merge($rVODIDs, $rBouquets[$rID]["movies"]);
|
||||
}
|
||||
|
||||
if (!isset($rBouquets[$rID]["radios"])) {
|
||||
} else {
|
||||
if (isset($rBouquets[$rID]["radios"])) {
|
||||
$rRadioIDs = array_merge($rRadioIDs, $rBouquets[$rID]["radios"]);
|
||||
}
|
||||
}
|
||||
@@ -245,8 +228,7 @@ class PortalHelpers {
|
||||
: [];
|
||||
|
||||
foreach ($rData as $rItem) {
|
||||
if ($rStartDate && !($rStartDate < $rItem["end"] && $rItem["start"] < $rFinishDate)) {
|
||||
} else {
|
||||
if (!$rStartDate || $rStartDate < $rItem["end"] && $rItem["start"] < $rFinishDate) {
|
||||
if ($rByID) {
|
||||
$rReturn[$rItem["id"]] = $rItem;
|
||||
} else {
|
||||
@@ -277,8 +259,7 @@ class PortalHelpers {
|
||||
public static function getProgramme($rStreamID, $rProgrammeID) {
|
||||
$rData = self::getEPG($rStreamID, null, null, true);
|
||||
|
||||
if (!isset($rData[$rProgrammeID])) {
|
||||
} else {
|
||||
if (isset($rData[$rProgrammeID])) {
|
||||
return $rData[$rProgrammeID];
|
||||
}
|
||||
}
|
||||
@@ -353,29 +334,24 @@ class PortalHelpers {
|
||||
$rKey = $rStart + 1;
|
||||
$rWhereV = $rWhere = [];
|
||||
|
||||
if (0 >= count($rTypes)) {
|
||||
} else {
|
||||
if (0 < count($rTypes)) {
|
||||
$rWhere[] = "`type` IN (" . implode(",", self::convertTypes($rTypes)) . ")";
|
||||
}
|
||||
|
||||
if (empty($rCategoryID)) {
|
||||
} else {
|
||||
if (!empty($rCategoryID)) {
|
||||
$rWhere[] = "JSON_CONTAINS(`category_id`, ?, '\$')";
|
||||
$rWhereV[] = $rCategoryID;
|
||||
}
|
||||
|
||||
if (empty($rPicking["genre"]) || $rPicking["genre"] == "*") {
|
||||
} else {
|
||||
if (!empty($rPicking["genre"]) && $rPicking["genre"] != "*") {
|
||||
$rWhere[] = "JSON_CONTAINS(`category_id`, ?, '\$')";
|
||||
$rWhereV[] = $rPicking["genre"];
|
||||
}
|
||||
|
||||
$rChannels = StreamSorter::sortChannels($rChannels);
|
||||
|
||||
if (empty($rFav)) {
|
||||
} else {
|
||||
if (!empty($rFav)) {
|
||||
$favoriteChannelIds = [];
|
||||
|
||||
foreach ($rTypes as $rType) {
|
||||
foreach ($rDevice["fav_channels"][$rType] as $rStreamID) {
|
||||
$favoriteChannelIds[] = intval($rStreamID);
|
||||
@@ -384,20 +360,17 @@ class PortalHelpers {
|
||||
$rChannels = array_intersect($favoriteChannelIds, $rChannels);
|
||||
}
|
||||
|
||||
if (empty($rSearchBy)) {
|
||||
} else {
|
||||
if (!empty($rSearchBy)) {
|
||||
$rWhere[] = "`stream_display_name` LIKE ?";
|
||||
$rWhereV[] = "%" . $rSearchBy . "%";
|
||||
}
|
||||
|
||||
if (empty($rPicking["abc"]) || $rPicking["abc"] == "*") {
|
||||
} else {
|
||||
if (!empty($rPicking["abc"]) && $rPicking["abc"] != "*") {
|
||||
$rWhere[] = "UCASE(LEFT(`stream_display_name`, 1)) = ?";
|
||||
$rWhereV[] = strtoupper($rPicking["abc"]);
|
||||
}
|
||||
|
||||
if (empty($rPicking["years"]) || $rPicking["years"] == "*") {
|
||||
} else {
|
||||
if (!empty($rPicking["years"]) && $rPicking["years"] != "*") {
|
||||
$rWhere[] = "`year` = ?";
|
||||
$rWhereV[] = $rPicking["years"];
|
||||
}
|
||||
@@ -533,17 +506,12 @@ class PortalHelpers {
|
||||
foreach ($rSeries as $rSeriesID => $rSeriesO) {
|
||||
$rSeriesO["last_modified"] = $rSeriesO["last_modified_stream"];
|
||||
|
||||
if (
|
||||
!empty($rCategoryID) &&
|
||||
!in_array($rCategoryID, json_decode($rSeriesO["category_id"], true))
|
||||
) {
|
||||
} else {
|
||||
if (empty($rCategoryID) || in_array($rCategoryID, json_decode($rSeriesO["category_id"], true))) {
|
||||
if (in_array($rCategoryID, json_decode($rSeriesO["category_id"], true))) {
|
||||
$rSeriesO["category_id"] = $rCategoryID;
|
||||
} else {
|
||||
[$rSeriesO["category_id"]] = json_decode($rSeriesO["category_id"], true);
|
||||
}
|
||||
|
||||
if (
|
||||
(empty($rSearchBy) || stristr($rSeriesO["title"], $rSearchBy)) &&
|
||||
!(!empty($rPicking["abc"]) &&
|
||||
@@ -556,18 +524,11 @@ class PortalHelpers {
|
||||
$rPicking["years"] != "*" &&
|
||||
$rSeriesO["year"] != $rPicking["years"])
|
||||
) {
|
||||
if (empty($rFav)) {
|
||||
} else {
|
||||
if (!empty($rFav)) {
|
||||
$rFound = false;
|
||||
|
||||
if (
|
||||
empty($rDevice["fav_channels"][$rType]) ||
|
||||
!in_array($rSeriesID, $rDevice["fav_channels"][$rType])
|
||||
) {
|
||||
} else {
|
||||
if (!empty($rDevice["fav_channels"][$rType]) && in_array($rSeriesID, $rDevice["fav_channels"][$rType])) {
|
||||
$rFound = true;
|
||||
}
|
||||
|
||||
if (!$rFound) {
|
||||
continue;
|
||||
}
|
||||
@@ -630,8 +591,7 @@ class PortalHelpers {
|
||||
$rDefaultPage = false;
|
||||
$rPage = !empty($rRequest["p"]) ? $rRequest["p"] : 0;
|
||||
|
||||
if ($rPage != 0) {
|
||||
} else {
|
||||
if ($rPage == 0) {
|
||||
$rDefaultPage = true;
|
||||
$rPage = 1;
|
||||
}
|
||||
@@ -776,8 +736,7 @@ class PortalHelpers {
|
||||
];
|
||||
}
|
||||
|
||||
if ($rDefaultPage) {
|
||||
} else {
|
||||
if (!$rDefaultPage) {
|
||||
$rPage = 0;
|
||||
}
|
||||
|
||||
@@ -834,13 +793,10 @@ class PortalHelpers {
|
||||
$rCounter = count($rItems);
|
||||
$rChannelIDx = 0;
|
||||
|
||||
if ($rPage != 0) {
|
||||
} else {
|
||||
if ($rPage == 0) {
|
||||
$rDefaultPage = true;
|
||||
$rPage = ceil($rChannelIDx / $rPageItems);
|
||||
|
||||
if ($rPage != 0) {
|
||||
} else {
|
||||
if ($rPage == 0) {
|
||||
$rPage = 1;
|
||||
}
|
||||
}
|
||||
@@ -849,10 +805,8 @@ class PortalHelpers {
|
||||
$rDatas = [];
|
||||
|
||||
foreach ($rItems as $rKey => $rMovie) {
|
||||
if (is_null($rFav) || $rFav != 1) {
|
||||
} else {
|
||||
if (in_array($rMovie["id"], $rDevice["fav_channels"]["series"])) {
|
||||
} else {
|
||||
if (!is_null($rFav) && $rFav == 1) {
|
||||
if (!in_array($rMovie["id"], $rDevice["fav_channels"]["series"])) {
|
||||
$rCounter--;
|
||||
}
|
||||
}
|
||||
@@ -862,8 +816,7 @@ class PortalHelpers {
|
||||
$rMaxAdded = 0;
|
||||
|
||||
foreach ($rMovie as $vod) {
|
||||
if ($rMaxAdded >= $vod["added"]) {
|
||||
} else {
|
||||
if ($rMaxAdded < $vod["added"]) {
|
||||
$rMaxAdded = $vod["added"];
|
||||
}
|
||||
}
|
||||
@@ -1028,8 +981,7 @@ class PortalHelpers {
|
||||
$rDefaultPage = false;
|
||||
$rPage = !empty($rRequest["p"]) ? $rRequest["p"] : 0;
|
||||
|
||||
if ($rPage != 0) {
|
||||
} else {
|
||||
if ($rPage == 0) {
|
||||
$rDefaultPage = true;
|
||||
$rPage = 1;
|
||||
}
|
||||
@@ -1075,8 +1027,7 @@ class PortalHelpers {
|
||||
"play/" .
|
||||
$rToken;
|
||||
|
||||
if (!$rSettings["mag_keep_extension"]) {
|
||||
} else {
|
||||
if ($rSettings["mag_keep_extension"]) {
|
||||
$rStreamURL .= "?ext=." . $rSettings["mag_container"];
|
||||
}
|
||||
|
||||
@@ -1102,8 +1053,7 @@ class PortalHelpers {
|
||||
];
|
||||
}
|
||||
|
||||
if ($rDefaultPage) {
|
||||
} else {
|
||||
if (!$rDefaultPage) {
|
||||
$rPage = 0;
|
||||
}
|
||||
|
||||
@@ -1142,12 +1092,9 @@ class PortalHelpers {
|
||||
$rPage = isset($rRequest["p"]) ? intval($rRequest["p"]) : 0;
|
||||
$rPosition = 0;
|
||||
|
||||
if (!($rPage == 0 && $rCategoryID != -1)) {
|
||||
} else {
|
||||
if ($rPage == 0 && $rCategoryID != -1) {
|
||||
$rDefaultPage = true;
|
||||
|
||||
if ($rRequest["p"] != 0 || empty($rDevice["last_itv_id"])) {
|
||||
} else {
|
||||
if ($rRequest["p"] == 0 && !empty($rDevice["last_itv_id"])) {
|
||||
$rPosition = self::getItems(
|
||||
$rDevice,
|
||||
["live", "created_live"],
|
||||
@@ -1160,17 +1107,14 @@ class PortalHelpers {
|
||||
0,
|
||||
$rDevice["last_itv_id"],
|
||||
);
|
||||
|
||||
if ($rPosition) {
|
||||
$rPage = floor(($rPosition - 1) / $rPageItems) + 1;
|
||||
$rPosition = $rPosition - ($rPage - 1) * $rPageItems;
|
||||
$rPosition -= ($rPage - 1) * $rPageItems;
|
||||
} else {
|
||||
$rPosition = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ($rPage != 0) {
|
||||
} else {
|
||||
if ($rPage == 0) {
|
||||
$rPage = 1;
|
||||
}
|
||||
}
|
||||
@@ -1252,8 +1196,7 @@ class PortalHelpers {
|
||||
"play/" .
|
||||
$rToken;
|
||||
|
||||
if (!$rSettings["mag_keep_extension"]) {
|
||||
} else {
|
||||
if ($rSettings["mag_keep_extension"]) {
|
||||
$rStreamURL .= "?ext=." . $rSettings["mag_container"];
|
||||
}
|
||||
|
||||
@@ -1266,10 +1209,10 @@ class PortalHelpers {
|
||||
if ($rStream["now_playing"]) {
|
||||
$rStartTime = new \DateTime();
|
||||
$rStartTime->setTimestamp($rStream["now_playing"]["start"]);
|
||||
$rStartTime->modify((string) $rTimeDifference . " seconds");
|
||||
$rStartTime->modify($rTimeDifference . " seconds");
|
||||
$rEndTime = new \DateTime();
|
||||
$rEndTime->setTimestamp($rStream["now_playing"]["end"]);
|
||||
$rEndTime->modify((string) $rTimeDifference . " seconds");
|
||||
$rEndTime->modify($rTimeDifference . " seconds");
|
||||
$rNowPlaying =
|
||||
$rStartTime->format("H:i") .
|
||||
" - " .
|
||||
@@ -1350,8 +1293,7 @@ class PortalHelpers {
|
||||
];
|
||||
}
|
||||
|
||||
if ($rDefaultPage) {
|
||||
} else {
|
||||
if (!$rDefaultPage) {
|
||||
$rPage = 0;
|
||||
$rPosition = 0;
|
||||
}
|
||||
@@ -1372,8 +1314,7 @@ class PortalHelpers {
|
||||
// ─── Сортировка ──────────────────────────────────────────────────
|
||||
|
||||
public static function sortArrayStreamRating($a, $b) {
|
||||
if (isset($a["rating"])) {
|
||||
} else {
|
||||
if (!isset($a["rating"])) {
|
||||
if (isset($a["movie_properties"]) && isset($b["movie_properties"])) {
|
||||
if (!is_array($a["movie_properties"])) {
|
||||
$a = json_decode($a["movie_properties"], true);
|
||||
@@ -1401,13 +1342,11 @@ class PortalHelpers {
|
||||
public static function sortArrayStreamAdded($a, $b) {
|
||||
$rColumn = isset($a["added"]) ? "added" : "last_modified";
|
||||
|
||||
if (is_numeric($a[$rColumn])) {
|
||||
} else {
|
||||
if (!is_numeric($a[$rColumn])) {
|
||||
$a[$rColumn] = strtotime($a["added"]);
|
||||
}
|
||||
|
||||
if (is_numeric($b[$rColumn])) {
|
||||
} else {
|
||||
if (!is_numeric($b[$rColumn])) {
|
||||
$b[$rColumn] = strtotime($b[$rColumn]);
|
||||
}
|
||||
|
||||
@@ -1441,8 +1380,7 @@ class PortalHelpers {
|
||||
$rHeaders = [];
|
||||
|
||||
foreach ($_SERVER as $rName => $rValue) {
|
||||
if (substr($rName, 0, 5) != "HTTP_") {
|
||||
} else {
|
||||
if (substr($rName, 0, 5) == "HTTP_") {
|
||||
$rHeaders[
|
||||
str_replace(
|
||||
" ",
|
||||
@@ -1462,8 +1400,7 @@ class PortalHelpers {
|
||||
public static function shutdown() {
|
||||
global $db;
|
||||
|
||||
if (!is_object($db)) {
|
||||
} else {
|
||||
if (is_object($db)) {
|
||||
$db->close_mysql();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ class ActiveCodeDetailsController {
|
||||
*/
|
||||
public function index(): never {
|
||||
if (
|
||||
!(defined('PHP_ERRORS') && PHP_ERRORS)
|
||||
(!defined('PHP_ERRORS') || !PHP_ERRORS)
|
||||
&& strtolower($_SERVER['HTTP_X_REQUESTED_WITH'] ?? '') !== 'xmlhttprequest'
|
||||
) {
|
||||
exit();
|
||||
|
||||
@@ -94,7 +94,7 @@ class BackupAjaxController extends BaseAjaxController {
|
||||
unlink(MAIN_HOME . 'backups/' . $rBackup . '.sql');
|
||||
}
|
||||
|
||||
if (0 < strlen($rSettings['dropbox_token'])) {
|
||||
if ((string) $rSettings['dropbox_token'] !== '') {
|
||||
BackupService::deleteRemote('/' . $rBackup . '.sql');
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ class BackupAjaxController extends BaseAjaxController {
|
||||
if (!file_exists($rFilename)) {
|
||||
$rFilename = MAIN_HOME . 'tmp/restore.sql';
|
||||
|
||||
if (0 < strlen($rSettings['dropbox_token'])) {
|
||||
if ((string) $rSettings['dropbox_token'] !== '') {
|
||||
if (!BackupService::downloadRemote('/' . $rBackup . '.sql', $rFilename)) {
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ class CacheAjaxController extends BaseAjaxController {
|
||||
|
||||
$rRedis = RedisManager::instance();
|
||||
|
||||
if (!$rRedis) {
|
||||
if (!$rRedis instanceof \Redis) {
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
|
||||
@@ -371,7 +371,7 @@ class EpgAjaxController extends BaseAjaxController {
|
||||
$rCategoryIDs = json_decode($rStream['category_id'], true);
|
||||
$rCategories = CategoryService::getAllByType('live');
|
||||
|
||||
if (0 < strlen(RequestManager::get('category'))) {
|
||||
if ((string) RequestManager::get('category') !== '') {
|
||||
$rCategory = ($rCategories[intval(RequestManager::get('category'))]['category_name'] ?: 'No Category');
|
||||
} else {
|
||||
$rCategory = ($rCategories[$rCategoryIDs[0]]['category_name'] ?: 'No Category');
|
||||
|
||||
@@ -125,7 +125,7 @@ class MiscAjaxController extends BaseAjaxController {
|
||||
$rFilter = ['mp4', 'mkv', 'avi', 'mpg', 'flv', '3gp', 'm4v', 'wmv', 'mov', 'ts', 'srt', 'sub', 'sbv'];
|
||||
}
|
||||
|
||||
if (!(RequestManager::has('server') && RequestManager::has('dir'))) {
|
||||
if (!RequestManager::has('server') || !RequestManager::has('dir')) {
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ class MiscAjaxController extends BaseAjaxController {
|
||||
$this->requireXhr();
|
||||
$this->gate('adv', 'edit_movie');
|
||||
|
||||
if (!(RequestManager::has('id') && 0 < intval(RequestManager::get('id')))) {
|
||||
if (!RequestManager::has('id') || 0 >= intval(RequestManager::get('id'))) {
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ class MiscAjaxController extends BaseAjaxController {
|
||||
|
||||
global $db;
|
||||
|
||||
if (!(RequestManager::has('id') && 0 < intval(RequestManager::get('id')))) {
|
||||
if (!RequestManager::has('id') || 0 >= intval(RequestManager::get('id'))) {
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ class PackageAjaxController extends BaseAjaxController {
|
||||
if ($db->num_rows() == 1) {
|
||||
$rData = $db->get_row();
|
||||
|
||||
if (isset($rOverride[$rData['id']]['official_credits']) && 0 < strlen($rOverride[$rData['id']]['official_credits'])) {
|
||||
if (isset($rOverride[$rData['id']]['official_credits']) && (string) $rOverride[$rData['id']]['official_credits'] !== '') {
|
||||
$rData['cost_credits'] = $rOverride[$rData['id']]['official_credits'];
|
||||
}
|
||||
|
||||
|
||||
@@ -267,23 +267,7 @@ class SearchAjaxController extends BaseAjaxController {
|
||||
$rCategories = CategoryService::getAllByType(null);
|
||||
$rGroups = GroupService::getAll();
|
||||
|
||||
$rCtx = compact(
|
||||
'rServerItems',
|
||||
'rServerCount',
|
||||
'rSeriesTitles',
|
||||
'rConnectionCount',
|
||||
'rSeriesInfo',
|
||||
'rUsersCount',
|
||||
'rLinesCount',
|
||||
'rOwnerNames',
|
||||
'rLinesInfo',
|
||||
'rLineConnectionCount',
|
||||
'rStreamNames',
|
||||
'rDeviceLines',
|
||||
'rCategories',
|
||||
'rGroups',
|
||||
'rTables'
|
||||
);
|
||||
$rCtx = ['rServerItems' => $rServerItems, 'rServerCount' => $rServerCount, 'rSeriesTitles' => $rSeriesTitles, 'rConnectionCount' => $rConnectionCount, 'rSeriesInfo' => $rSeriesInfo, 'rUsersCount' => $rUsersCount, 'rLinesCount' => $rLinesCount, 'rOwnerNames' => $rOwnerNames, 'rLinesInfo' => $rLinesInfo, 'rLineConnectionCount' => $rLineConnectionCount, 'rStreamNames' => $rStreamNames, 'rDeviceLines' => $rDeviceLines, 'rCategories' => $rCategories, 'rGroups' => $rGroups, 'rTables' => $rTables];
|
||||
|
||||
foreach ($rItems as $rItem) {
|
||||
$rReturn['items'][] = $this->buildItem($rItem, $rCtx);
|
||||
@@ -566,8 +550,8 @@ class SearchAjaxController extends BaseAjaxController {
|
||||
}
|
||||
}
|
||||
|
||||
if (!(count(json_decode($rServerItem['cchannel_rsources'], true)) == count(json_decode($rItem['stream_source'], true)) || $rServerItem['parent_id'])) {
|
||||
$rStatus = 6;
|
||||
if (count(json_decode($rServerItem['cchannel_rsources'], true)) != count(json_decode($rItem['stream_source'], true)) && !$rServerItem['parent_id']) {
|
||||
return 6;
|
||||
}
|
||||
|
||||
return $rStatus;
|
||||
@@ -620,7 +604,7 @@ class SearchAjaxController extends BaseAjaxController {
|
||||
|
||||
return [
|
||||
'stars_full' => $rRating ? $rFull : 0,
|
||||
'half' => $rRating ? $rHalf : false,
|
||||
'half' => $rRating && $rHalf,
|
||||
'empty' => $rRating ? 5 - ($rFull + ($rHalf ? 1 : 0)) : 0,
|
||||
'year' => $rYear ? (string) $rYear : '',
|
||||
];
|
||||
|
||||
@@ -238,7 +238,7 @@ class ServerAjaxController extends BaseAjaxController {
|
||||
}
|
||||
}
|
||||
|
||||
if (0 < $rData['id'] && 0 < $rData['font_size'] && 0 < strlen($rData['font_color']) && 0 < strlen($rData['xy_offset']) && (0 < strlen($rData['message']) || $rData['type'] < 3)) {
|
||||
if (0 < $rData['id'] && 0 < $rData['font_size'] && (string) $rData['font_color'] !== '' && (string) $rData['xy_offset'] !== '' && ((string) $rData['message'] !== '' || $rData['type'] < 3)) {
|
||||
if (SettingsManager::get('redis_handler')) {
|
||||
if (isset($rData['user'])) {
|
||||
$rRows = ConnectionTracker::getRedisConnections($rData['id'], null, null, true, false, false);
|
||||
|
||||
@@ -32,11 +32,7 @@ class StatsAjaxController extends BaseAjaxController {
|
||||
$rTime = AdminHelpers::roundUpToAny(time(), 10);
|
||||
$rNearestRange = $rTime - $rLimit;
|
||||
$rPeriod = 60;
|
||||
$rStatsRange = [];
|
||||
|
||||
foreach (range($rNearestRange, $rTime, $rPeriod) as $i) {
|
||||
$rStatsRange[] = $i;
|
||||
}
|
||||
$rStatsRange = range($rNearestRange, $rTime, $rPeriod);
|
||||
$rServerStats = [];
|
||||
|
||||
if (RequestManager::has('server_id')) {
|
||||
|
||||
@@ -267,12 +267,12 @@ class StreamToolsAjaxController extends BaseAjaxController {
|
||||
} else {
|
||||
$rStream = StreamRepository::getById(RequestManager::get('stream'));
|
||||
$rStreamOptions = StreamRepository::getOptions(RequestManager::get('stream'));
|
||||
$rUA = (0 < strlen($rStreamOptions[1]['value'])) ? ' -user_agent ' . escapeshellarg($rStreamOptions[1]['value']) : '';
|
||||
$rUA = ((string) $rStreamOptions[1]['value'] !== '') ? ' -user_agent ' . escapeshellarg($rStreamOptions[1]['value']) : '';
|
||||
$rCookie = RequestManager::has('cookie') ? ' -cookies ' . escapeshellarg(StreamUtils::fixCookie($rStreamOptions[17]['value'])) : '';
|
||||
$rURL = StreamUtils::parseStreamURL(json_decode($rStream['stream_source'], true)[intval(RequestManager::get('id'))]);
|
||||
}
|
||||
|
||||
if (0 < strlen($rURL)) {
|
||||
if ((string) $rURL !== '') {
|
||||
$rStreamInfoText = "<table style='width: 300px;' class='table-data' align='center'><tbody><tr><td colspan='4'>Stream probe failed!</td></tr></tbody></table>";
|
||||
$rStreamInfo = null;
|
||||
|
||||
|
||||
@@ -45,6 +45,6 @@ class ArchiveController extends BaseAdminController {
|
||||
|
||||
$rTitle = (!is_null($rRecordings) ? 'Recordings' : 'TV Archive');
|
||||
$this->setTitle($rTitle);
|
||||
$this->render('archive', compact('rRecordings', 'rStream', 'rArchive'));
|
||||
$this->render('archive', ['rRecordings' => $rRecordings, 'rStream' => $rStream, 'rArchive' => $rArchive]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,6 @@ class BouquetListController extends BaseAdminController {
|
||||
|
||||
$rBouquets = BouquetService::getAllSimple();
|
||||
|
||||
$this->render('bouquets', compact('rBouquets'));
|
||||
$this->render('bouquets', ['rBouquets' => $rBouquets]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,12 +27,9 @@ class ChannelOrderController extends BaseAdminController {
|
||||
$db->query('SELECT COUNT(`id`) AS `count` FROM `streams`;');
|
||||
$rCount = $db->get_row()['count'];
|
||||
|
||||
if (!($rCount <= 50000 || $rOverride)) {
|
||||
} else {
|
||||
if ($rCount <= 50000 || $rOverride) {
|
||||
$db->query('SELECT `id`, `type`, `stream_display_name`, `category_id` FROM `streams` ORDER BY `order` ASC, `stream_display_name` ASC;');
|
||||
|
||||
if (0 >= $db->num_rows()) {
|
||||
} else {
|
||||
if (0 < $db->num_rows()) {
|
||||
foreach ($db->get_rows() as $rRow) {
|
||||
if ($rRow['type'] == 1 || $rRow['type'] == 3) {
|
||||
$rOrdered['stream'][] = $rRow;
|
||||
@@ -43,8 +40,7 @@ class ChannelOrderController extends BaseAdminController {
|
||||
if ($rRow['type'] == 4) {
|
||||
$rOrdered['radio'][] = $rRow;
|
||||
} else {
|
||||
if ($rRow['type'] != 5) {
|
||||
} else {
|
||||
if ($rRow['type'] == 5) {
|
||||
$rOrdered['series'][] = $rRow;
|
||||
}
|
||||
}
|
||||
@@ -55,6 +51,6 @@ class ChannelOrderController extends BaseAdminController {
|
||||
}
|
||||
|
||||
$this->setTitle('Channel Order');
|
||||
$this->render('channel_order', compact('rOverride', 'rOrdered', 'rCount'));
|
||||
$this->render('channel_order', ['rOverride' => $rOverride, 'rOrdered' => $rOrdered, 'rCount' => $rCount]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,6 @@ class CodeEditController extends BaseAdminController {
|
||||
}
|
||||
|
||||
$this->setTitle('Access Code');
|
||||
$this->render('code', compact('rCode'));
|
||||
$this->render('code', ['rCode' => $rCode]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,14 +106,6 @@ class CreatedChannelController extends BaseAdminController {
|
||||
)));
|
||||
|
||||
$this->setTitle('Created Channel');
|
||||
$this->render('created_channel', compact(
|
||||
'rCategories',
|
||||
'rTranscodeProfiles',
|
||||
'rChannel',
|
||||
'rOnDemand',
|
||||
'rServerTree',
|
||||
'rProperties',
|
||||
'rChannelSys'
|
||||
));
|
||||
$this->render('created_channel', ['rCategories' => $rCategories, 'rTranscodeProfiles' => $rTranscodeProfiles, 'rChannel' => $rChannel, 'rOnDemand' => $rOnDemand, 'rServerTree' => $rServerTree, 'rProperties' => $rProperties, 'rChannelSys' => $rChannelSys]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,6 @@ class CreatedChannelMassController extends BaseAdminController {
|
||||
}
|
||||
|
||||
$this->setTitle('Mass Edit Channels');
|
||||
$this->render('created_channel_mass', compact('rCategories', 'rTranscodeProfiles', 'rServerTree'));
|
||||
$this->render('created_channel_mass', ['rCategories' => $rCategories, 'rTranscodeProfiles' => $rTranscodeProfiles, 'rServerTree' => $rServerTree]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,8 +39,7 @@ class DashboardController extends BaseAdminController {
|
||||
}
|
||||
|
||||
// Server ID validation
|
||||
if (!RequestManager::has('server_id') || isset($rServers[RequestManager::get('server_id')])) {
|
||||
} else {
|
||||
if (RequestManager::has('server_id') && !isset($rServers[RequestManager::get('server_id')])) {
|
||||
$this->redirect('dashboard');
|
||||
return;
|
||||
}
|
||||
@@ -55,8 +54,7 @@ class DashboardController extends BaseAdminController {
|
||||
$db->query('SELECT `geoip_country_code`, COUNT(`geoip_country_code`) AS `count` FROM `lines_activity` GROUP BY `geoip_country_code` ORDER BY `count` DESC;');
|
||||
}
|
||||
|
||||
if (0 >= $db->num_rows()) {
|
||||
} else {
|
||||
if (0 < $db->num_rows()) {
|
||||
$i = 0;
|
||||
foreach ($db->get_rows() as $rRow) {
|
||||
if ($i < count($rColourMap)) {
|
||||
@@ -113,15 +111,7 @@ class DashboardController extends BaseAdminController {
|
||||
)));
|
||||
|
||||
$this->setTitle('Dashboard');
|
||||
$this->render('dashboard', compact(
|
||||
'rColours',
|
||||
'rColourMap',
|
||||
'rConnectionMap',
|
||||
'rConnectionCount',
|
||||
'rServerStats',
|
||||
'rOrderedServers',
|
||||
'rStatusItems'
|
||||
));
|
||||
$this->render('dashboard', ['rColours' => $rColours, 'rColourMap' => $rColourMap, 'rConnectionMap' => $rConnectionMap, 'rConnectionCount' => $rConnectionCount, 'rServerStats' => $rServerStats, 'rOrderedServers' => $rOrderedServers, 'rStatusItems' => $rStatusItems]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,6 +34,6 @@ class EnigmaController extends BaseAdminController {
|
||||
}
|
||||
|
||||
$this->setTitle('Enigma Device');
|
||||
$this->render('enigma', compact('rDevice'));
|
||||
$this->render('enigma', ['rDevice' => $rDevice]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,6 @@ class EpgController extends BaseAdminController {
|
||||
}
|
||||
|
||||
$this->setTitle('EPG');
|
||||
$this->render('epg', compact('rEPGArr'));
|
||||
$this->render('epg', ['rEPGArr' => $rEPGArr]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,16 +83,6 @@ class EpgViewController extends BaseAdminController {
|
||||
}
|
||||
|
||||
$this->setTitle('TV Guide');
|
||||
$this->render('epg_view', compact(
|
||||
'rPageInt',
|
||||
'rLimit',
|
||||
'rStart',
|
||||
'rStreamIDs',
|
||||
'rCount',
|
||||
'rPages',
|
||||
'rPagination',
|
||||
'rWhereString',
|
||||
'rOrderBy'
|
||||
));
|
||||
$this->render('epg_view', ['rPageInt' => $rPageInt, 'rLimit' => $rLimit, 'rStart' => $rStart, 'rStreamIDs' => $rStreamIDs, 'rCount' => $rCount, 'rPages' => $rPages, 'rPagination' => $rPagination, 'rWhereString' => $rWhereString, 'rOrderBy' => $rOrderBy]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,6 +92,6 @@ class EpisodeController extends BaseAdminController {
|
||||
)));
|
||||
|
||||
$this->setTitle('Episode');
|
||||
$this->render('episode', compact('rSeriesArr', 'rEpisode', 'rServerTree', 'rStreamSys', 'rMulti'));
|
||||
$this->render('episode', ['rSeriesArr' => $rSeriesArr, 'rEpisode' => $rEpisode, 'rServerTree' => $rServerTree, 'rStreamSys' => $rStreamSys, 'rMulti' => $rMulti]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,6 @@ class EpisodeListController extends BaseAdminController {
|
||||
}
|
||||
|
||||
$this->setTitle('Episodes');
|
||||
$this->render('episodes', compact('rAudioCodecs', 'rVideoCodecs'));
|
||||
$this->render('episodes', ['rAudioCodecs' => $rAudioCodecs, 'rVideoCodecs' => $rVideoCodecs]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,6 @@ class EpisodeMassController extends BaseAdminController {
|
||||
}
|
||||
|
||||
$this->setTitle('Mass Edit Episodes');
|
||||
$this->render('episodes_mass', compact('rSeries', 'rServerTree'));
|
||||
$this->render('episodes_mass', ['rSeries' => $rSeries, 'rServerTree' => $rServerTree]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,6 @@ class GroupEditController extends BaseAdminController {
|
||||
}
|
||||
|
||||
$this->setTitle('Group');
|
||||
$this->render('group', compact('rGroup', 'rGroupIDs', 'rPackageIDs', 'rNotice'));
|
||||
$this->render('group', ['rGroup' => $rGroup, 'rGroupIDs' => $rGroupIDs, 'rPackageIDs' => $rPackageIDs, 'rNotice' => $rNotice]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,6 @@ class HmacEditController extends BaseAdminController {
|
||||
}
|
||||
|
||||
$this->setTitle('HMAC Key');
|
||||
$this->render('hmac', compact('rHMAC'));
|
||||
$this->render('hmac', ['rHMAC' => $rHMAC]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,6 @@ class IspEditController extends BaseAdminController {
|
||||
}
|
||||
|
||||
$this->setTitle('Blocked ISP');
|
||||
$this->render('isp', compact('rISPArr'));
|
||||
$this->render('isp', ['rISPArr' => $rISPArr]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,9 +37,8 @@ class LineController extends BaseAdminController {
|
||||
if ($db->num_rows() > 0) {
|
||||
header('Location: mag?id=' . intval($db->get_row()['mag_id']));
|
||||
exit;
|
||||
} else {
|
||||
AdminHelpers::goHome();
|
||||
}
|
||||
AdminHelpers::goHome();
|
||||
}
|
||||
|
||||
if ($rLine['is_e2']) {
|
||||
@@ -47,9 +46,8 @@ class LineController extends BaseAdminController {
|
||||
if ($db->num_rows() > 0) {
|
||||
header('Location: enigma?id=' . intval($db->get_row()['device_id']));
|
||||
exit;
|
||||
} else {
|
||||
AdminHelpers::goHome();
|
||||
}
|
||||
AdminHelpers::goHome();
|
||||
}
|
||||
} else {
|
||||
if (!Authorization::check('adv', 'add_user')) {
|
||||
|
||||
@@ -23,6 +23,6 @@ class LineIpsController extends BaseAdminController {
|
||||
$rRange = intval(RequestManager::get('range') ?? 0);
|
||||
$rLineIPs = igbinary_unserialize(file_get_contents(CACHE_TMP_PATH . 'lines_per_ip')) ?: [];
|
||||
|
||||
$this->render('line_ips', compact('rRange', 'rLineIPs'));
|
||||
$this->render('line_ips', ['rRange' => $rRange, 'rLineIPs' => $rLineIPs]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,6 @@ class LiveConnectionsController extends BaseAdminController {
|
||||
}
|
||||
|
||||
$this->setTitle('Live Connections');
|
||||
$this->render('live_connections', compact('rSearchUser', 'rSearchStream'));
|
||||
$this->render('live_connections', ['rSearchUser' => $rSearchUser, 'rSearchStream' => $rSearchStream]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,6 @@ class MagController extends BaseAdminController {
|
||||
}
|
||||
|
||||
$this->setTitle('MAG Device');
|
||||
$this->render('mag', compact('rDevice'));
|
||||
$this->render('mag', ['rDevice' => $rDevice]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,19 +136,19 @@ class ModulesController extends BaseAdminController {
|
||||
}
|
||||
|
||||
$parts = [];
|
||||
if ($found) {
|
||||
if ($found !== []) {
|
||||
$parts[] = 'Updates available: ' . implode(', ', $found) . '.';
|
||||
}
|
||||
if ($failed) {
|
||||
if ($failed !== []) {
|
||||
$parts[] = 'Could not check ' . implode('; ', $failed) . '.';
|
||||
}
|
||||
if (!$parts) {
|
||||
if ($parts === []) {
|
||||
$parts[] = 'All installed modules are up to date (' . $checked . ' checked'
|
||||
. ($skipped ? ', ' . $skipped . ' not installed — skipped' : '') . ').';
|
||||
}
|
||||
|
||||
$flash = [
|
||||
'type' => $found ? 'success' : ($failed ? 'warning' : 'info'),
|
||||
'type' => $found !== [] ? 'success' : ($failed !== [] ? 'warning' : 'info'),
|
||||
'message' => implode(' ', $parts),
|
||||
];
|
||||
break;
|
||||
|
||||
@@ -93,16 +93,6 @@ class MovieController extends BaseAdminController {
|
||||
)));
|
||||
|
||||
$this->setTitle('Movie');
|
||||
$this->render('movie', compact(
|
||||
'rCategories',
|
||||
'rTranscodeProfiles',
|
||||
'rMovie',
|
||||
'rServerTree',
|
||||
'activeStreamingServers',
|
||||
'rStreamSys',
|
||||
'rMovieSource',
|
||||
'rSource',
|
||||
'rPathSources'
|
||||
));
|
||||
$this->render('movie', ['rCategories' => $rCategories, 'rTranscodeProfiles' => $rTranscodeProfiles, 'rMovie' => $rMovie, 'rServerTree' => $rServerTree, 'activeStreamingServers' => $activeStreamingServers, 'rStreamSys' => $rStreamSys, 'rMovieSource' => $rMovieSource, 'rSource' => $rSource, 'rPathSources' => $rPathSources]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,6 @@ class MovieListController extends BaseAdminController {
|
||||
}
|
||||
|
||||
$this->setTitle('Movies');
|
||||
$this->render('movies', compact('rCategories', 'rAudioCodecs', 'rVideoCodecs'));
|
||||
$this->render('movies', ['rCategories' => $rCategories, 'rAudioCodecs' => $rAudioCodecs, 'rVideoCodecs' => $rVideoCodecs]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,6 @@ class MovieMassController extends BaseAdminController {
|
||||
)));
|
||||
|
||||
$this->setTitle('Mass Edit Movies');
|
||||
$this->render('movie_mass', compact('rCategories', 'rTranscodeProfiles', 'rServerTree'));
|
||||
$this->render('movie_mass', ['rCategories' => $rCategories, 'rTranscodeProfiles' => $rTranscodeProfiles, 'rServerTree' => $rServerTree]);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -37,6 +37,6 @@ class PlexAddController extends BaseAdminController {
|
||||
}
|
||||
|
||||
$this->setTitle('Add Library');
|
||||
$this->render('plex_add', compact('rFolder', 'rBouquets'));
|
||||
$this->render('plex_add', ['rFolder' => $rFolder, 'rBouquets' => $rBouquets]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,6 @@ class ProcessMonitorController extends BaseAdminController {
|
||||
$rStatus = ['D' => 'Uninterruptible Sleep', 'I' => 'Idle', 'R' => 'Running', 'S' => 'Interruptible Sleep', 'T' => 'Stopped', 'W' => 'Paging', 'X' => 'Dead', 'Z' => 'Zombie'];
|
||||
|
||||
$this->setTitle('Process Monitor');
|
||||
$this->render('process_monitor', compact('rStreams', 'rFS', 'rProcesses', 'rStatus'));
|
||||
$this->render('process_monitor', ['rStreams' => $rStreams, 'rFS' => $rFS, 'rProcesses' => $rProcesses, 'rStatus' => $rStatus]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,6 @@ class ProfileEditController extends BaseAdminController {
|
||||
}
|
||||
|
||||
$this->setTitle('Transcoding Profile');
|
||||
$this->render('profile', compact('rProfileArr', 'rProfileOptions', 'rDevices'));
|
||||
$this->render('profile', ['rProfileArr' => $rProfileArr, 'rProfileOptions' => $rProfileOptions, 'rDevices' => $rDevices]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,6 @@ class ProviderEditController extends BaseAdminController {
|
||||
}
|
||||
|
||||
$this->setTitle('Stream Provider');
|
||||
$this->render('provider', compact('rProvider'));
|
||||
$this->render('provider', ['rProvider' => $rProvider]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,6 @@ class ProxiesController extends BaseAdminController {
|
||||
$rServers = ServerRepository::getAll(true);
|
||||
|
||||
$this->setTitle('Proxy Servers');
|
||||
$this->render('proxies', compact('rServers'));
|
||||
$this->render('proxies', ['rServers' => $rServers]);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -95,13 +95,6 @@ class RadioController extends BaseAdminController {
|
||||
)));
|
||||
|
||||
$this->setTitle('Radio Stations');
|
||||
$this->render('radio', compact(
|
||||
'rStation',
|
||||
'rOnDemand',
|
||||
'rStationArguments',
|
||||
'rServerTree',
|
||||
'rStationOptions',
|
||||
'rStationSys'
|
||||
));
|
||||
$this->render('radio', ['rStation' => $rStation, 'rOnDemand' => $rOnDemand, 'rStationArguments' => $rStationArguments, 'rServerTree' => $rServerTree, 'rStationOptions' => $rStationOptions, 'rStationSys' => $rStationSys]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,6 @@ class RadioListController extends BaseAdminController {
|
||||
$rCategories = CategoryService::getAllByType('radio');
|
||||
|
||||
$this->setTitle('Radio Stations');
|
||||
$this->render('radios', compact('rCategories'));
|
||||
$this->render('radios', ['rCategories' => $rCategories]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,6 @@ class RadioMassController extends BaseAdminController {
|
||||
)));
|
||||
|
||||
$this->setTitle('Mass Edit Stations');
|
||||
$this->render('radio_mass', compact('rCategories', 'rServerTree'));
|
||||
$this->render('radio_mass', ['rCategories' => $rCategories, 'rServerTree' => $rServerTree]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,8 +33,7 @@ class RecordController extends BaseAdminController {
|
||||
$rStream = StreamRepository::getById($rRequestData['id']);
|
||||
$rProgramme = EpgService::getProgramme($rRequestData['id'], $rRequestData['programme']);
|
||||
|
||||
if ($rStream && $rStream['type'] == 1 && $rProgramme) {
|
||||
} else {
|
||||
if (!($rStream && $rStream['type'] == 1 && $rProgramme)) {
|
||||
$this->redirect('record');
|
||||
return;
|
||||
}
|
||||
@@ -44,19 +43,15 @@ class RecordController extends BaseAdminController {
|
||||
$rStream = StreamRepository::getById($rArchive['stream_id']);
|
||||
$rProgramme = ['start' => $rArchive['start'], 'end' => $rArchive['end'], 'title' => $rArchive['title'], 'description' => $rArchive['description'], 'archive' => true];
|
||||
|
||||
if ($rStream && $rStream['type'] == 1 && $rProgramme) {
|
||||
} else {
|
||||
if (!($rStream && $rStream['type'] == 1 && $rProgramme)) {
|
||||
$this->redirect('record');
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!isset($rRequestData['stream_id'])) {
|
||||
} else {
|
||||
if (isset($rRequestData['stream_id'])) {
|
||||
$rStream = StreamRepository::getById($rRequestData['stream_id']);
|
||||
$rProgramme = ['start' => strtotime($rRequestData['start_date']), 'end' => strtotime($rRequestData['start_date']) + intval($rRequestData['duration']) * 60, 'title' => '', 'description' => ''];
|
||||
|
||||
if (!(!$rStream || $rStream['type'] != 1 || !$rProgramme || $rProgramme['end'] < time())) {
|
||||
} else {
|
||||
if (!$rStream || $rStream['type'] != 1 || !$rProgramme || $rProgramme['end'] < time()) {
|
||||
header('Location: record');
|
||||
}
|
||||
}
|
||||
@@ -68,8 +63,7 @@ class RecordController extends BaseAdminController {
|
||||
|
||||
foreach ($db->get_rows() as $rRow) {
|
||||
$rAvailableServers[] = $rRow['server_id'];
|
||||
if (!(!$rBitrate && $rRow['bitrate'] || $rRow['bitrate'] && $rBitrate < $rRow['bitrate'])) {
|
||||
} else {
|
||||
if (!$rBitrate && $rRow['bitrate'] || $rRow['bitrate'] && $rBitrate < $rRow['bitrate']) {
|
||||
$rBitrate = $rRow['bitrate'];
|
||||
}
|
||||
}
|
||||
@@ -80,6 +74,6 @@ class RecordController extends BaseAdminController {
|
||||
}
|
||||
|
||||
$this->setTitle('Record');
|
||||
$this->render('record', compact('rStream', 'rProgramme', 'rAvailableServers', 'rBitrate'));
|
||||
$this->render('record', ['rStream' => $rStream, 'rProgramme' => $rProgramme, 'rAvailableServers' => $rAvailableServers, 'rBitrate' => $rBitrate]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,6 @@ class ReviewController extends BaseAdminController {
|
||||
)));
|
||||
|
||||
$this->setTitle('Review');
|
||||
$this->render('review', compact('rType', 'rCategorySet', 'rLogoSet'));
|
||||
$this->render('review', ['rType' => $rType, 'rCategorySet' => $rCategorySet, 'rLogoSet' => $rLogoSet]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,6 @@ class RtmpIpEditController extends BaseAdminController {
|
||||
}
|
||||
|
||||
$this->setTitle('RTMP IP');
|
||||
$this->render('rtmp_ip', compact('rIPArr'));
|
||||
$this->render('rtmp_ip', ['rIPArr' => $rIPArr]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,6 @@ class RtmpMonitorController extends BaseAdminController {
|
||||
$rRTMPInfo = ServerRepository::getRTMPStats(RequestManager::get('server'));
|
||||
|
||||
$this->setTitle('RTMP Monitor');
|
||||
$this->render('rtmp_monitor', compact('rRTMPInfo'));
|
||||
$this->render('rtmp_monitor', ['rRTMPInfo' => $rRTMPInfo]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,6 @@ class SerieController extends BaseAdminController {
|
||||
}
|
||||
|
||||
$this->setTitle('TV Series');
|
||||
$this->render('serie', compact('rSeriesArr', 'rTranscodeProfiles', 'rServerTree'));
|
||||
$this->render('serie', ['rSeriesArr' => $rSeriesArr, 'rTranscodeProfiles' => $rTranscodeProfiles, 'rServerTree' => $rServerTree]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,6 @@ class SeriesListController extends BaseAdminController {
|
||||
$rCategories = CategoryService::getAllByType('series');
|
||||
|
||||
$this->setTitle('TV Series');
|
||||
$this->render('series', compact('rCategories'));
|
||||
$this->render('series', ['rCategories' => $rCategories]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,6 @@ class SeriesMassController extends BaseAdminController {
|
||||
$rCategories = CategoryService::getAllByType('series');
|
||||
|
||||
$this->setTitle('Mass Edit Series');
|
||||
$this->render('series_mass', compact('rCategories'));
|
||||
$this->render('series_mass', ['rCategories' => $rCategories]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,18 +72,6 @@ class ServerController extends BaseAdminController {
|
||||
$rSSLLog = ServerRepository::getSSLLog($rServerArr['id']);
|
||||
|
||||
$this->setTitle('Edit Server');
|
||||
$this->render('server', compact(
|
||||
'rServerArr',
|
||||
'rWatchdog',
|
||||
'rServiceMax',
|
||||
'rInterfaces',
|
||||
'rCertificate',
|
||||
'rCertValid',
|
||||
'rHasCert',
|
||||
'rExpiration',
|
||||
'rFS',
|
||||
'rMounted',
|
||||
'rSSLLog'
|
||||
));
|
||||
$this->render('server', ['rServerArr' => $rServerArr, 'rWatchdog' => $rWatchdog, 'rServiceMax' => $rServiceMax, 'rInterfaces' => $rInterfaces, 'rCertificate' => $rCertificate, 'rCertValid' => $rCertValid, 'rHasCert' => $rHasCert, 'rExpiration' => $rExpiration, 'rFS' => $rFS, 'rMounted' => $rMounted, 'rSSLLog' => $rSSLLog]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,6 @@ class ServerInstallController extends BaseAdminController {
|
||||
$title = ($rType === 1) ? 'Install Proxy' : 'Install Server';
|
||||
$this->setTitle($title);
|
||||
|
||||
$this->render('server_install', compact('rType', 'rServerArr'));
|
||||
$this->render('server_install', ['rType' => $rType, 'rServerArr' => $rServerArr]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,6 @@ class ServerListController extends BaseAdminController {
|
||||
$this->setTitle('Servers');
|
||||
|
||||
$rServers = ServerRepository::getAll(true);
|
||||
$this->render('servers', compact('rServers'));
|
||||
$this->render('servers', ['rServers' => $rServers]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,6 @@ class ServerOrderController extends BaseAdminController {
|
||||
array_multisort(array_column($rOrderedServers, 'order'), SORT_ASC, $rOrderedServers);
|
||||
|
||||
$this->setTitle('Server Order');
|
||||
$this->render('server_order', compact('rOrderedServers'));
|
||||
$this->render('server_order', ['rOrderedServers' => $rOrderedServers]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,14 +100,6 @@ class ServerViewController extends BaseAdminController {
|
||||
['apexcharts']
|
||||
)));
|
||||
|
||||
$this->render('server_view', compact(
|
||||
'rServer',
|
||||
'rWatchdog',
|
||||
'rStats',
|
||||
'rCertificate',
|
||||
'rCertValid',
|
||||
'rHasCert',
|
||||
'rExpiration'
|
||||
));
|
||||
$this->render('server_view', ['rServer' => $rServer, 'rWatchdog' => $rWatchdog, 'rStats' => $rStats, 'rCertificate' => $rCertificate, 'rCertValid' => $rCertValid, 'rHasCert' => $rHasCert, 'rExpiration' => $rExpiration]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class SettingsController extends BaseAdminController {
|
||||
|
||||
$binVersionData = json_decode(@file_get_contents(BIN_PATH . 'bin_version.json'), true) ?: [];
|
||||
$BinVersion = $binVersionData['release'] ?? 'N/A';
|
||||
$BinOS = self::resolveOsLabel($binVersionData);
|
||||
$BinOS = $this->resolveOsLabel($binVersionData);
|
||||
|
||||
// xc_fanout daemon (`-version`), xcvm_core extension marker and yt-dlp — Info tab.
|
||||
$rFanoutBin = BIN_PATH . 'xc_fanout/xc_fanout';
|
||||
@@ -56,19 +56,7 @@ class SettingsController extends BaseAdminController {
|
||||
: 'N/A';
|
||||
|
||||
$this->setTitle('Settings');
|
||||
$this->render('settings', compact(
|
||||
'rSettings',
|
||||
'rStreamArguments',
|
||||
'GeoLite2',
|
||||
'GeoISP',
|
||||
'Nginx',
|
||||
'BinVersion',
|
||||
'BinOS',
|
||||
'rUpdate',
|
||||
'FanoutVersion',
|
||||
'XcvmCoreVersion',
|
||||
'YtDlpVersion'
|
||||
));
|
||||
$this->render('settings', ['rSettings' => $rSettings, 'rStreamArguments' => $rStreamArguments, 'GeoLite2' => $GeoLite2, 'GeoISP' => $GeoISP, 'Nginx' => $Nginx, 'BinVersion' => $BinVersion, 'BinOS' => $BinOS, 'rUpdate' => $rUpdate, 'FanoutVersion' => $FanoutVersion, 'XcvmCoreVersion' => $XcvmCoreVersion, 'YtDlpVersion' => $YtDlpVersion]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,7 +69,7 @@ class SettingsController extends BaseAdminController {
|
||||
*
|
||||
* @param array<string,mixed> $binVersionData
|
||||
*/
|
||||
private static function resolveOsLabel(array $binVersionData): string {
|
||||
private function resolveOsLabel(array $binVersionData): string {
|
||||
$dist = trim((string) ($binVersionData['distribution'] ?? ''));
|
||||
$version = trim((string) ($binVersionData['distribution_version'] ?? ''));
|
||||
|
||||
@@ -94,7 +82,7 @@ class SettingsController extends BaseAdminController {
|
||||
if (!empty($osRelease['PRETTY_NAME'])) {
|
||||
return (string) $osRelease['PRETTY_NAME'];
|
||||
}
|
||||
$label = trim((string) ($osRelease['NAME'] ?? '') . ' ' . (string) ($osRelease['VERSION_ID'] ?? ''));
|
||||
$label = trim(($osRelease['NAME'] ?? '') . ' ' . ($osRelease['VERSION_ID'] ?? ''));
|
||||
if ($label !== '') {
|
||||
return $label;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,6 @@ class SettingsPlexController extends BaseAdminController {
|
||||
}
|
||||
|
||||
$this->setTitle('Plex Settings');
|
||||
$this->render('settings_plex', compact('rBouquets'));
|
||||
$this->render('settings_plex', ['rBouquets' => $rBouquets]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,6 @@ class StreamCategoriesController extends BaseAdminController {
|
||||
}
|
||||
|
||||
$this->setTitle('Stream Categories');
|
||||
$this->render('stream_categories', compact('rCategories', 'rMainCategories'));
|
||||
$this->render('stream_categories', ['rCategories' => $rCategories, 'rMainCategories' => $rMainCategories]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,6 @@ class StreamCategoryController extends BaseAdminController {
|
||||
}
|
||||
|
||||
$this->setTitle('Stream Category');
|
||||
$this->render('stream_category', compact('rCategoryArr'));
|
||||
$this->render('stream_category', ['rCategoryArr' => $rCategoryArr]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,18 +98,6 @@ class StreamController extends BaseAdminController {
|
||||
)));
|
||||
|
||||
$this->setTitle('Stream');
|
||||
$this->render('stream', compact(
|
||||
'rStream',
|
||||
'rEPGSources',
|
||||
'rStreamArguments',
|
||||
'rTranscodeProfiles',
|
||||
'rOnDemand',
|
||||
'rEPGJS',
|
||||
'rServerTree',
|
||||
'rAudioDevices',
|
||||
'rVideoDevices',
|
||||
'rStreamOptions',
|
||||
'rStreamSys'
|
||||
));
|
||||
$this->render('stream', ['rStream' => $rStream, 'rEPGSources' => $rEPGSources, 'rStreamArguments' => $rStreamArguments, 'rTranscodeProfiles' => $rTranscodeProfiles, 'rOnDemand' => $rOnDemand, 'rEPGJS' => $rEPGJS, 'rServerTree' => $rServerTree, 'rAudioDevices' => $rAudioDevices, 'rVideoDevices' => $rVideoDevices, 'rStreamOptions' => $rStreamOptions, 'rStreamSys' => $rStreamSys]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,6 @@ class StreamListController extends BaseAdminController {
|
||||
}
|
||||
|
||||
$this->setTitle('Streams');
|
||||
$this->render('streams', compact('rAudioCodecs', 'rVideoCodecs'));
|
||||
$this->render('streams', ['rAudioCodecs' => $rAudioCodecs, 'rVideoCodecs' => $rVideoCodecs]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,6 @@ class StreamMassController extends BaseAdminController {
|
||||
)));
|
||||
|
||||
$this->setTitle('Mass Edit Streams');
|
||||
$this->render('stream_mass', compact('rCategories', 'rStreamArguments', 'rTranscodeProfiles', 'rServerTree'));
|
||||
$this->render('stream_mass', ['rCategories' => $rCategories, 'rStreamArguments' => $rStreamArguments, 'rTranscodeProfiles' => $rTranscodeProfiles, 'rServerTree' => $rServerTree]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,6 @@ class StreamRankController extends BaseAdminController {
|
||||
$rRows = $db->get_rows();
|
||||
|
||||
$this->setTitle('Stream Rank');
|
||||
$this->render('stream_rank', compact('rStreamTypes', 'rPeriod', 'rRows'));
|
||||
$this->render('stream_rank', ['rStreamTypes' => $rStreamTypes, 'rPeriod' => $rPeriod, 'rRows' => $rRows]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,15 +30,12 @@ class StreamReviewController extends BaseAdminController {
|
||||
foreach (array_keys(RequestManager::getAll()) as $rKey) {
|
||||
$rSplit = explode('_', $rKey);
|
||||
|
||||
if (!($rSplit[0] == 'modified' && RequestManager::get($rKey) == 1)) {
|
||||
} else {
|
||||
if ($rSplit[0] == 'modified' && RequestManager::get($rKey) == 1) {
|
||||
$rID = intval($rSplit[1]);
|
||||
$rChanges[$rID] = [];
|
||||
|
||||
foreach (['name', 'channel_id', 'epg_id'] as $rChangeKey) {
|
||||
$rChanges[$rID][$rChangeKey] = RequestManager::get($rChangeKey . '_' . $rID);
|
||||
}
|
||||
|
||||
foreach (['bouquets', 'categories'] as $rChangeKey) {
|
||||
$rChanges[$rID][$rChangeKey] = json_decode(RequestManager::get($rChangeKey . '_' . $rID), true);
|
||||
}
|
||||
@@ -46,28 +43,21 @@ class StreamReviewController extends BaseAdminController {
|
||||
}
|
||||
|
||||
foreach ($rChanges as $rID => $rStream) {
|
||||
if (!RequestManager::get('save_bouquets')) {
|
||||
} else {
|
||||
if (RequestManager::get('save_bouquets')) {
|
||||
$rHasBouquets = [];
|
||||
|
||||
foreach (BouquetService::getAll() as $rBouquetID => $rBouquet) {
|
||||
if (!(in_array($rID, $rBouquet['streams']) || in_array($rID, $rBouquet['channels']))) {
|
||||
} else {
|
||||
if (in_array($rID, $rBouquet['streams']) || in_array($rID, $rBouquet['channels'])) {
|
||||
$rHasBouquets[] = $rBouquetID;
|
||||
}
|
||||
}
|
||||
$rAddBouquet = [];
|
||||
|
||||
foreach ($rHasBouquets as $rBouquetID) {
|
||||
if (in_array($rBouquetID, $rStream['bouquets'])) {
|
||||
} else {
|
||||
if (!in_array($rBouquetID, $rStream['bouquets'])) {
|
||||
BouquetService::removeItems('stream', $rBouquetID, $rID);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($rStream['bouquets'] as $rBouquetID) {
|
||||
if (in_array($rBouquetID, $rHasBouquets)) {
|
||||
} else {
|
||||
if (!in_array($rBouquetID, $rHasBouquets)) {
|
||||
$rAddBouquet[] = $rBouquetID;
|
||||
BouquetService::addItems('stream', $rBouquetID, $rID);
|
||||
}
|
||||
@@ -91,51 +81,40 @@ class StreamReviewController extends BaseAdminController {
|
||||
header('Location: ./streams?status=' . STATUS_SUCCESS);
|
||||
|
||||
exit();
|
||||
} else {
|
||||
if (!RequestManager::has('streams')) {
|
||||
} else {
|
||||
$rStreams = json_decode(RequestManager::get('streams'), true);
|
||||
$rCategories = CategoryService::getAllByType('live');
|
||||
$rBouquets = BouquetService::getAllSimple();
|
||||
$rStreamBouquets = [];
|
||||
foreach ($rBouquets as $rBouquet) {
|
||||
}
|
||||
if (RequestManager::has('streams')) {
|
||||
$rStreams = json_decode(RequestManager::get('streams'), true);
|
||||
$rCategories = CategoryService::getAllByType('live');
|
||||
$rBouquets = BouquetService::getAllSimple();
|
||||
$rStreamBouquets = [];
|
||||
foreach ($rBouquets as $rBouquet) {
|
||||
$rBouquetChannels = json_decode($rBouquet['bouquet_channels'], true);
|
||||
|
||||
foreach ($rBouquetChannels as $rStreamID) {
|
||||
if (!in_array($rStreamID, $rStreams)) {
|
||||
} else {
|
||||
$rStreamBouquets[$rStreamID][] = $rBouquet['id'];
|
||||
}
|
||||
foreach ($rBouquetChannels as $rStreamID) {
|
||||
if (in_array($rStreamID, $rStreams)) {
|
||||
$rStreamBouquets[$rStreamID][] = $rBouquet['id'];
|
||||
}
|
||||
}
|
||||
$rOptions = ['categories' => RequestManager::has('edit_categories'), 'epg' => RequestManager::has('edit_epg'), 'bouquets' => RequestManager::has('edit_bouquets')];
|
||||
$rWidth = [25, 20, 20];
|
||||
|
||||
if ($rOptions['categories'] || $rOptions['bouquets'] || $rOptions['epg']) {
|
||||
} else {
|
||||
$rWidth = [90, 0, 0];
|
||||
}
|
||||
|
||||
$rImport = [];
|
||||
|
||||
if (0 >= count($rStreams)) {
|
||||
} else {
|
||||
$db->query('SELECT * FROM `streams` WHERE `id` IN (' . implode(',', array_map('intval', $rStreams)) . ');');
|
||||
|
||||
foreach ($db->get_rows() as $rRow) {
|
||||
$rImport[] = ['id' => $rRow['id'], 'channel_id' => ($rRow['channel_id'] ?: ''), 'epg_id' => ($rRow['epg_id'] ?: ''), 'title' => ($rRow['stream_display_name'] ?: ''), 'category' => json_decode($rRow['category_id'], true), 'bouquets' => ($rStreamBouquets[$rRow['id']] ?: [])];
|
||||
}
|
||||
}
|
||||
|
||||
if (count($rImport) != 0) {
|
||||
} else {
|
||||
$_STATUS = STATUS_NO_SOURCES;
|
||||
$rImport = null;
|
||||
}
|
||||
$rOptions = ['categories' => RequestManager::has('edit_categories'), 'epg' => RequestManager::has('edit_epg'), 'bouquets' => RequestManager::has('edit_bouquets')];
|
||||
$rWidth = [25, 20, 20];
|
||||
if (!($rOptions['categories'] || $rOptions['bouquets'] || $rOptions['epg'])) {
|
||||
$rWidth = [90, 0, 0];
|
||||
}
|
||||
$rImport = [];
|
||||
if (0 < count($rStreams)) {
|
||||
$db->query('SELECT * FROM `streams` WHERE `id` IN (' . implode(',', array_map('intval', $rStreams)) . ');');
|
||||
foreach ($db->get_rows() as $rRow) {
|
||||
$rImport[] = ['id' => $rRow['id'], 'channel_id' => ($rRow['channel_id'] ?: ''), 'epg_id' => ($rRow['epg_id'] ?: ''), 'title' => ($rRow['stream_display_name'] ?: ''), 'category' => json_decode($rRow['category_id'], true), 'bouquets' => ($rStreamBouquets[$rRow['id']])];
|
||||
}
|
||||
}
|
||||
if (count($rImport) == 0) {
|
||||
$_STATUS = STATUS_NO_SOURCES;
|
||||
$rImport = null;
|
||||
}
|
||||
}
|
||||
|
||||
$this->setTitle('Review');
|
||||
$this->render('stream_review', compact('rStreams', 'rCategories', 'rBouquets', 'rStreamBouquets', 'rOptions', 'rWidth', 'rImport'));
|
||||
$this->render('stream_review', ['rStreams' => $rStreams, 'rCategories' => $rCategories, 'rBouquets' => $rBouquets, 'rStreamBouquets' => $rStreamBouquets, 'rOptions' => $rOptions, 'rWidth' => $rWidth, 'rImport' => $rImport]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,8 +30,7 @@ class StreamViewController extends BaseAdminController {
|
||||
|
||||
global $db;
|
||||
|
||||
if (RequestManager::has('id') && ($rStream = StreamRepository::getById(RequestManager::get('id')))) {
|
||||
} else {
|
||||
if (!RequestManager::has('id') || !$rStream = StreamRepository::getById(RequestManager::get('id'))) {
|
||||
AdminHelpers::goHome();
|
||||
}
|
||||
|
||||
@@ -49,12 +48,10 @@ class StreamViewController extends BaseAdminController {
|
||||
if ($rStream['type'] == 1) {
|
||||
$rEPGData = EpgService::getChannelEpg($rStream);
|
||||
|
||||
if (0 >= $rStream['vframes_server_id']) {
|
||||
} else {
|
||||
if (0 < $rStream['vframes_server_id']) {
|
||||
$rExpires = time() + 3600;
|
||||
$rTokenData = ['session_id' => session_id(), 'expires' => $rExpires, 'stream_id' => intval(RequestManager::get('id')), 'ip' => NetworkUtils::getUserIP()];
|
||||
$rUIToken = Encryption::mintToken(json_encode($rTokenData), SettingsManager::get('live_streaming_pass'), OPENSSL_EXTRA, (bool) SettingsManager::get('secure_stream_tokens'));
|
||||
|
||||
if (AdminHelpers::issecure()) {
|
||||
$rVServer = ServerRepository::getAll()[$rStream['vframes_server_id']];
|
||||
$rImage = 'https://' . (($rVServer['domain_name'] ? $rVServer['domain_name'] : $rVServer['server_ip'])) . ':' . intval($rVServer['https_broadcast_port']) . '/admin/thumb?uitoken=' . $rUIToken;
|
||||
@@ -70,21 +67,16 @@ class StreamViewController extends BaseAdminController {
|
||||
$rProperties = json_decode($rStream['movie_properties'], true);
|
||||
$rImage = (!empty($rProperties['backdrop_path'][0]) ? ImageUtils::validateURL($rProperties['backdrop_path'][0], (AdminHelpers::issecure() ? 'https' : 'http')) : ImageUtils::validateURL($rProperties['movie_image'], (AdminHelpers::issecure() ? 'https' : 'http')));
|
||||
|
||||
if (empty($rImage)) {
|
||||
} else {
|
||||
if (@getimagesize($rImage)) {
|
||||
} else {
|
||||
if (!empty($rImage)) {
|
||||
if (!@getimagesize($rImage)) {
|
||||
$rImage = null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($rStream['type'] != 3) {
|
||||
} else {
|
||||
if ($rStream['type'] == 3) {
|
||||
$rCCInfo = null;
|
||||
$db->query('SELECT `streams_servers`.`stream_started`, `streams_servers`.`cc_info` FROM `streams` LEFT JOIN `streams_servers` ON `streams_servers`.`stream_id` = `streams`.`id` AND `streams_servers`.`parent_id` IS NULL WHERE `streams`.`id` = ? GROUP BY `streams`.`id`;', $rStream['id']);
|
||||
|
||||
if (0 >= $db->num_rows()) {
|
||||
} else {
|
||||
if (0 < $db->num_rows()) {
|
||||
$rServerRow = $db->get_row();
|
||||
$rCCInfo = json_decode($rServerRow['cc_info'], true);
|
||||
$rSeconds = time() - intval($rServerRow['stream_started']);
|
||||
@@ -93,35 +85,18 @@ class StreamViewController extends BaseAdminController {
|
||||
}
|
||||
}
|
||||
|
||||
if ($rStream['type'] != 5) {
|
||||
} else {
|
||||
if ($rStream['type'] == 5) {
|
||||
$rSeries = null;
|
||||
$db->query('SELECT * FROM `streams_series` WHERE `id` = (SELECT `series_id` FROM `streams_episodes` WHERE `stream_id` = ?);', $rStream['id']);
|
||||
|
||||
if (0 >= $db->num_rows()) {
|
||||
} else {
|
||||
if (0 < $db->num_rows()) {
|
||||
$rSeries = $db->get_row();
|
||||
}
|
||||
|
||||
$rSeriesID = $rSeries['id'];
|
||||
}
|
||||
|
||||
$rStreamStats = StreamRepository::getStats($rStream['id']);
|
||||
|
||||
$this->setTitle('View ' . $rTypeString);
|
||||
$this->render('stream_view', compact(
|
||||
'rStream',
|
||||
'rTypeString',
|
||||
'rEPGData',
|
||||
'rImage',
|
||||
'rUIToken',
|
||||
'rAdaptiveLink',
|
||||
'rProperties',
|
||||
'rSeries',
|
||||
'rSeriesID',
|
||||
'rStreamStats',
|
||||
'rCCInfo',
|
||||
'rSeconds'
|
||||
));
|
||||
$this->render('stream_view', ['rStream' => $rStream, 'rTypeString' => $rTypeString, 'rEPGData' => $rEPGData, 'rImage' => $rImage, 'rUIToken' => $rUIToken, 'rAdaptiveLink' => $rAdaptiveLink, 'rProperties' => $rProperties, 'rSeries' => $rSeries, 'rSeriesID' => $rSeriesID, 'rStreamStats' => $rStreamStats, 'rCCInfo' => $rCCInfo, 'rSeconds' => $rSeconds]);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,7 +19,7 @@ class TheftDetectionController extends BaseAdminController {
|
||||
$this->requirePermission();
|
||||
$this->setTitle('VOD Theft Detection');
|
||||
|
||||
$rRange = intval($this->input('range')) ?: 0;
|
||||
$rRange = intval($this->input('range'));
|
||||
$cacheFile = CACHE_TMP_PATH . 'theft_detection';
|
||||
$rTheftDetection = file_exists($cacheFile)
|
||||
? (igbinary_unserialize(file_get_contents($cacheFile)) ?: [])
|
||||
|
||||
@@ -28,6 +28,6 @@ class TicketController extends BaseAdminController {
|
||||
}
|
||||
|
||||
$this->setTitle('Ticket');
|
||||
$this->render('ticket', compact('rTicket'));
|
||||
$this->render('ticket', ['rTicket' => $rTicket]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,6 @@ class TicketViewController extends BaseAdminController {
|
||||
}
|
||||
|
||||
$this->setTitle('View Ticket');
|
||||
$this->render('ticket_view', compact('rTicketInfo'));
|
||||
$this->render('ticket_view', ['rTicketInfo' => $rTicketInfo]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ class TicketsController extends BaseAdminController {
|
||||
$rStatusArray = ['CLOSED', 'OPEN', 'RESPONDED TO', 'READ BY USER', 'NEW RESPONSE', 'READ BY ME', 'READ BY USER'];
|
||||
|
||||
$this->setTitle('Tickets');
|
||||
$this->render('tickets', compact('rStatusArray'));
|
||||
$this->render('tickets', ['rStatusArray' => $rStatusArray]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class TmdbController {
|
||||
}
|
||||
|
||||
$term = RequestManager::get('term') ?? '';
|
||||
if (strlen($term) === 0) {
|
||||
if ((string) $term === '') {
|
||||
echo json_encode(['result' => false]);
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -33,6 +33,6 @@ class UserController extends BaseAdminController {
|
||||
$rPackages = $rUser ? PackageService::getAll($rUser['member_group_id']) : [];
|
||||
|
||||
$this->setTitle('User');
|
||||
$this->render('user', compact('rUser', 'rPackages'));
|
||||
$this->render('user', ['rUser' => $rUser, 'rPackages' => $rPackages]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,6 @@ class UseragentController extends BaseAdminController {
|
||||
}
|
||||
|
||||
$this->setTitle('Block User-Agent');
|
||||
$this->render('useragent', compact('rUAArr'));
|
||||
$this->render('useragent', ['rUAArr' => $rUAArr]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class ActiveCodeApiController extends BaseApiController {
|
||||
?? ($jsonInput['device_id'] ?? $jsonInput['device'] ?? '')
|
||||
);
|
||||
|
||||
$action = trim(
|
||||
trim(
|
||||
RequestManager::get('action')
|
||||
?? ($jsonInput['action'] ?? 'auth')
|
||||
);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -22,8 +22,7 @@ class AdminApiController {
|
||||
|
||||
$_ERRORS = [];
|
||||
foreach (get_defined_constants(true)['user'] as $rKey => $rValue) {
|
||||
if (substr($rKey, 0, 7) != 'STATUS_') {
|
||||
} else {
|
||||
if (substr($rKey, 0, 7) == 'STATUS_') {
|
||||
$_ERRORS[intval($rValue)] = $rKey;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ class Enigma2ApiController {
|
||||
$rCData = $rChannels->addChild('playlist_url');
|
||||
$rCData->addCData($this->url . 'enigma2?username=' . $this->username . '&password=' . $this->password . '&type=get_live_streams&cat_id=0' . $rCategory['id']);
|
||||
|
||||
foreach ($this->liveCategories as $rCategoryID => $rCategory) {
|
||||
foreach ($this->liveCategories as $rCategory) {
|
||||
$rChannels = $rXML->addChild('channel');
|
||||
$rChannels->addChild('title', base64_encode($rCategory['category_name']));
|
||||
$rChannels->addChild('description', base64_encode('Live Streams Category'));
|
||||
@@ -191,7 +191,7 @@ class Enigma2ApiController {
|
||||
$rCData = $rChannels->addChild('playlist_url');
|
||||
$rCData->addCData($this->url . 'enigma2?username=' . $this->username . '&password=' . $this->password . '&type=get_vod_streams&cat_id=0' . $rCategory['id']);
|
||||
|
||||
foreach ($this->vodCategories as $rCategoryID => $rCategory) {
|
||||
foreach ($this->vodCategories as $rCategory) {
|
||||
$rChannels = $rXML->addChild('channel');
|
||||
$rChannels->addChild('title', base64_encode($rCategory['category_name']));
|
||||
$rChannels->addChild('description', base64_encode('Movie Streams Category'));
|
||||
@@ -217,7 +217,7 @@ class Enigma2ApiController {
|
||||
$rCData = $rChannels->addChild('playlist_url');
|
||||
$rCData->addCData($this->url . 'enigma2?username=' . $this->username . '&password=' . $this->password . '&type=get_series&cat_id=0' . $rCategory['id']);
|
||||
|
||||
foreach ($this->seriesCategories as $rCategoryID => $rCategory) {
|
||||
foreach ($this->seriesCategories as $rCategory) {
|
||||
$rChannels = $rXML->addChild('channel');
|
||||
$rChannels->addChild('title', base64_encode($rCategory['category_name']));
|
||||
$rChannels->addChild('description', base64_encode('TV Series Category'));
|
||||
@@ -315,7 +315,7 @@ class Enigma2ApiController {
|
||||
private function getSeriesStreams(?int $rSeriesID, ?int $rSeason, ?int $rCatID) {
|
||||
global $db;
|
||||
|
||||
if (!(isset($rSeriesID) && isset($rSeason))) {
|
||||
if (!isset($rSeriesID) || !isset($rSeason)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ class Enigma2ApiController {
|
||||
$rSettings = SettingsManager::getAll();
|
||||
$rCategoryID = is_null($rCatID) ? null : $rCatID;
|
||||
|
||||
if (!(isset($rCatID) || is_null($rCatID))) {
|
||||
if (!isset($rCatID) && !is_null($rCatID)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -425,7 +425,7 @@ class Enigma2ApiController {
|
||||
$rSettings = SettingsManager::getAll();
|
||||
$rCategoryID = is_null($rCatID) ? null : $rCatID;
|
||||
|
||||
if (!(isset($rCatID) || is_null($rCatID))) {
|
||||
if (!isset($rCatID) && !is_null($rCatID)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -481,7 +481,7 @@ class Enigma2ApiController {
|
||||
$rCategory->addChild('category_id', 1);
|
||||
$rCategory->addChild('category_title', $rSettings['server_name']);
|
||||
|
||||
if (!empty($this->liveStreams)) {
|
||||
if ($this->liveStreams !== []) {
|
||||
$rChannels = $rXML->addChild('channel');
|
||||
$rChannels->addChild('title', base64_encode('Live Streams'));
|
||||
$rChannels->addChild('description', base64_encode('Live Streams Category'));
|
||||
@@ -490,7 +490,7 @@ class Enigma2ApiController {
|
||||
$rCData->addCData($this->url . 'enigma2?username=' . $this->username . '&password=' . $this->password . '&type=get_live_categories');
|
||||
}
|
||||
|
||||
if (!empty($this->vodStreams)) {
|
||||
if ($this->vodStreams !== []) {
|
||||
$rChannels = $rXML->addChild('channel');
|
||||
$rChannels->addChild('title', base64_encode('VOD'));
|
||||
$rChannels->addChild('description', base64_encode('Video On Demand Category'));
|
||||
|
||||
@@ -100,7 +100,7 @@ class EpgApiController extends BaseApiController {
|
||||
header('Content-Type: application/xml; charset=utf-8');
|
||||
}
|
||||
|
||||
self::readChunked($rFile);
|
||||
$this->readChunked($rFile);
|
||||
} else {
|
||||
generateError('DOWNLOAD_LIMIT_REACHED', false);
|
||||
http_response_code(429);
|
||||
@@ -110,7 +110,7 @@ class EpgApiController extends BaseApiController {
|
||||
exit();
|
||||
}
|
||||
|
||||
private static function readChunked($rFilename) {
|
||||
private function readChunked($rFilename) {
|
||||
$rHandle = fopen($rFilename, 'rb');
|
||||
|
||||
if ($rHandle !== false) {
|
||||
|
||||
@@ -49,7 +49,7 @@ class PlayerApiController {
|
||||
* @param string $rPath Absolute cache file path
|
||||
* @return array|null Decoded cache payload, or null when unavailable
|
||||
*/
|
||||
private static function readStreamCache(string $rPath): ?array {
|
||||
private function readStreamCache(string $rPath): ?array {
|
||||
if (!is_file($rPath)) {
|
||||
return null;
|
||||
}
|
||||
@@ -206,10 +206,9 @@ class PlayerApiController {
|
||||
|
||||
echo json_encode($output);
|
||||
exit();
|
||||
} else {
|
||||
BruteforceGuard::checkBruteforce(null, null, $rUsername ?? '');
|
||||
generateError('INVALID_CREDENTIALS');
|
||||
}
|
||||
BruteforceGuard::checkBruteforce(null, null, $rUsername ?? '');
|
||||
generateError('INVALID_CREDENTIALS');
|
||||
}
|
||||
|
||||
public function shutdown() {
|
||||
@@ -269,29 +268,27 @@ class PlayerApiController {
|
||||
|
||||
$rEPGs = [];
|
||||
|
||||
if (count($rStreamIDs) > 0) {
|
||||
foreach ($rStreamIDs as $rStreamID) {
|
||||
if (!file_exists(EPG_PATH . 'stream_' . intval($rStreamID))) {
|
||||
continue;
|
||||
}
|
||||
foreach ($rStreamIDs as $rStreamID) {
|
||||
if (!file_exists(EPG_PATH . 'stream_' . intval($rStreamID))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$rRows = igbinary_unserialize(file_get_contents(EPG_PATH . 'stream_' . $rStreamID));
|
||||
|
||||
foreach ($rRows as $rRow) {
|
||||
if ($rFromNow && $rRow['end'] < time()) {
|
||||
continue;
|
||||
}
|
||||
foreach ($rRows as $rRow) {
|
||||
if ($rFromNow && $rRow['end'] < time()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$rRow['title'] = base64_encode($rRow['title']);
|
||||
$rRow['description'] = base64_encode($rRow['description']);
|
||||
$rRow['start'] = intval($rRow['start']);
|
||||
$rRow['end'] = intval($rRow['end']);
|
||||
$rRow['title'] = base64_encode($rRow['title']);
|
||||
$rRow['description'] = base64_encode($rRow['description']);
|
||||
$rRow['start'] = intval($rRow['start']);
|
||||
$rRow['end'] = intval($rRow['end']);
|
||||
|
||||
if ($rMulti) {
|
||||
$rEPGs[$rStreamID][] = $rRow;
|
||||
} else {
|
||||
$rEPGs[] = $rRow;
|
||||
}
|
||||
if ($rMulti) {
|
||||
$rEPGs[$rStreamID][] = $rRow;
|
||||
} else {
|
||||
$rEPGs[] = $rRow;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -311,8 +308,8 @@ class PlayerApiController {
|
||||
$output = [];
|
||||
|
||||
if ($rCached) {
|
||||
$rSeriesInfo = self::readStreamCache(SERIES_TMP_PATH . 'series_' . $rSeriesID);
|
||||
$rRows = self::readStreamCache(SERIES_TMP_PATH . 'episodes_' . $rSeriesID);
|
||||
$rSeriesInfo = $this->readStreamCache(SERIES_TMP_PATH . 'series_' . $rSeriesID);
|
||||
$rRows = $this->readStreamCache(SERIES_TMP_PATH . 'episodes_' . $rSeriesID);
|
||||
} else {
|
||||
$db->query('SELECT * FROM `streams_episodes` t1 INNER JOIN `streams` t2 ON t2.id=t1.stream_id WHERE t1.series_id = ? ORDER BY t1.season_num ASC, t1.episode_num ASC', $rSeriesID);
|
||||
$rRows = $db->get_rows(true, 'season_num', false);
|
||||
@@ -438,7 +435,7 @@ class PlayerApiController {
|
||||
}
|
||||
|
||||
foreach ($this->userInfo['series_ids'] as $rSeriesID) {
|
||||
$rSeriesItem = self::readStreamCache(SERIES_TMP_PATH . 'series_' . $rSeriesID);
|
||||
$rSeriesItem = $this->readStreamCache(SERIES_TMP_PATH . 'series_' . $rSeriesID);
|
||||
if ($rSeriesItem === null) {
|
||||
// Cache not warmed for this series — it would contribute
|
||||
// nothing (foreach over a null category_id), so skip it.
|
||||
@@ -460,7 +457,7 @@ class PlayerApiController {
|
||||
$output[] = ['num' => ++$rMovieNum, 'name' => StreamSorter::formatTitle($rSeriesItem['title'], $rSeriesItem['year']), 'title' => $rSeriesItem['title'], 'year' => strval($rSeriesItem['year']), 'stream_type' => 'series', 'series_id' => (int) $rSeriesItem['id'], 'cover' => ImageUtils::validateURL($rSeriesItem['cover']), 'plot' => $rSeriesItem['plot'], 'cast' => $rSeriesItem['cast'], 'director' => $rSeriesItem['director'], 'genre' => $rSeriesItem['genre'], 'release_date' => $rSeriesItem['release_date'], 'releaseDate' => $rSeriesItem['release_date'], 'last_modified' => $rSeriesItem['last_modified'], 'rating' => number_format($rating, 0), 'rating_5based' => number_format($rating * 0.5, 1) + 0, 'backdrop_path' => $rBackdrops, 'youtube_trailer' => $rSeriesItem['youtube_trailer'], 'episode_run_time' => strval($rSeriesItem['episode_run_time']), 'category_id' => strval($rCategoryID), 'category_ids' => $rCategoryIDs];
|
||||
}
|
||||
|
||||
if (!($rCategoryIDSearch || $rSettings['show_category_duplicates'])) {
|
||||
if (!$rCategoryIDSearch && !$rSettings['show_category_duplicates']) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -660,7 +657,7 @@ class PlayerApiController {
|
||||
$rRows = igbinary_unserialize(file_get_contents(EPG_PATH . 'stream_' . $rStreamID));
|
||||
|
||||
foreach ($rRows as $rRow) {
|
||||
if (!($rRow['start'] <= $rTime && $rTime <= $rRow['end'] || $rTime <= $rRow['start'])) {
|
||||
if (($rRow['start'] > $rTime || $rTime > $rRow['end']) && $rTime > $rRow['start']) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -731,7 +728,7 @@ class PlayerApiController {
|
||||
|
||||
foreach ($rChannels as $rChannel) {
|
||||
if ($rCached) {
|
||||
$rChannelData = self::readStreamCache(STREAMS_TMP_PATH . 'stream_' . intval($rChannel));
|
||||
$rChannelData = $this->readStreamCache(STREAMS_TMP_PATH . 'stream_' . intval($rChannel));
|
||||
if ($rChannelData === null) {
|
||||
continue;
|
||||
}
|
||||
@@ -777,7 +774,7 @@ class PlayerApiController {
|
||||
$output[] = ['num' => ++$rLiveNum, 'name' => $rChannel['stream_display_name'], 'stream_type' => $rChannel['type_key'], 'stream_id' => (int) $rChannel['id'], 'stream_icon' => $rStreamIcon, 'epg_channel_id' => $rChannel['channel_id'], 'added' => ($rChannel['added'] ?: ''), 'custom_sid' => strval($rChannel['custom_sid']), 'tv_archive' => $rTVArchive, 'direct_source' => $rURL, 'tv_archive_duration' => ($rTVArchive ? intval($rChannel['tv_archive_duration']) : 0), 'category_id' => strval($rCategoryID), 'category_ids' => $rCategoryIDs, 'thumbnail' => $rThumbURL];
|
||||
}
|
||||
|
||||
if (!($rCategoryIDSearch || $rSettings['show_category_duplicates'])) {
|
||||
if (!$rCategoryIDSearch && !$rSettings['show_category_duplicates']) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -796,7 +793,7 @@ class PlayerApiController {
|
||||
$rVODID = intval($rRequest['vod_id']);
|
||||
|
||||
if ($rCached) {
|
||||
$rRowData = self::readStreamCache(STREAMS_TMP_PATH . 'stream_' . intval($rVODID));
|
||||
$rRowData = $this->readStreamCache(STREAMS_TMP_PATH . 'stream_' . intval($rVODID));
|
||||
$rRow = $rRowData !== null ? ($rRowData['info'] ?? null) : null;
|
||||
} else {
|
||||
$db->query('SELECT * FROM `streams` WHERE `id` = ?', $rVODID);
|
||||
@@ -907,7 +904,7 @@ class PlayerApiController {
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array($rChannel['type_key'], ['movie'])) {
|
||||
if ($rChannel['type_key'] == 'movie') {
|
||||
$rProperties = json_decode((string) $rChannel['movie_properties'], true);
|
||||
|
||||
if (!is_array($rProperties)) {
|
||||
@@ -930,7 +927,7 @@ class PlayerApiController {
|
||||
$output[] = ['num' => ++$rMovieNum, 'name' => StreamSorter::formatTitle($rChannel['stream_display_name'], $rChannel['year']), 'title' => $rChannel['stream_display_name'], 'year' => strval($rChannel['year']), 'stream_type' => $rChannel['type_key'], 'stream_id' => (int) $rChannel['id'], 'stream_icon' => (ImageUtils::validateURL($rProperties['movie_image'] ?? '') ?: ''), 'rating' => number_format($rating, 1) + 0, 'rating_5based' => number_format($rating * 0.5, 1) + 0, 'added' => strval(($rChannel['added'] ?: '')), 'plot' => $rProperties['plot'] ?? null, 'cast' => $rProperties['cast'] ?? null, 'director' => $rProperties['director'] ?? null, 'genre' => $rProperties['genre'] ?? null, 'release_date' => $rProperties['release_date'] ?? null, 'youtube_trailer' => $rProperties['youtube_trailer'] ?? null, 'episode_run_time' => $rProperties['episode_run_time'] ?? null, 'category_id' => strval($rCategoryID), 'category_ids' => $rCategoryIDs, 'container_extension' => $rChannel['target_container'], 'custom_sid' => strval($rChannel['custom_sid']), 'direct_source' => $rURL];
|
||||
}
|
||||
|
||||
if (!($rCategoryIDSearch || $rSettings['show_category_duplicates'])) {
|
||||
if (!$rCategoryIDSearch && !$rSettings['show_category_duplicates']) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -956,7 +953,7 @@ class PlayerApiController {
|
||||
'active_cons' => strval($this->userInfo['active_cons'] ?? '0'),
|
||||
'created_at' => strval($this->userInfo['created_at'] ?? ''),
|
||||
'max_connections' => strval($this->userInfo['max_connections'] ?? '1'),
|
||||
'allowed_output_formats' => self::getOutputFormats($this->userInfo['allowed_outputs'])
|
||||
'allowed_output_formats' => $this->getOutputFormats($this->userInfo['allowed_outputs'])
|
||||
];
|
||||
|
||||
if (!empty($token)) {
|
||||
@@ -979,7 +976,7 @@ class PlayerApiController {
|
||||
return $output;
|
||||
}
|
||||
|
||||
private static function getOutputFormats($rFormats) {
|
||||
private function getOutputFormats($rFormats) {
|
||||
$rFormatArray = [1 => 'm3u8', 2 => 'ts', 3 => 'rtmp'];
|
||||
$rReturn = [];
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@ use XcVm\Domain\User\UserRepository;
|
||||
use XcVm\Domain\User\UserService;
|
||||
|
||||
class ResellerAPIWrapper {
|
||||
public static $db = null;
|
||||
public static $db;
|
||||
|
||||
public static $rKey = null;
|
||||
public static $rKey;
|
||||
|
||||
public static function filterRow($rData, $rShow, $rHide, $rSkipResult = false) {
|
||||
if ($rShow || $rHide) {
|
||||
@@ -25,19 +25,15 @@ class ResellerAPIWrapper {
|
||||
$rRow = $rData['data'];
|
||||
}
|
||||
$rReturn = [];
|
||||
if (!$rRow) {
|
||||
} else {
|
||||
if ($rRow) {
|
||||
foreach (array_keys($rRow) as $rKey) {
|
||||
if ($rShow) {
|
||||
if (!in_array($rKey, $rShow)) {
|
||||
} else {
|
||||
if (in_array($rKey, $rShow)) {
|
||||
$rReturn[$rKey] = $rRow[$rKey];
|
||||
}
|
||||
} else {
|
||||
if (!$rHide) {
|
||||
} else {
|
||||
if (in_array($rKey, $rHide)) {
|
||||
} else {
|
||||
if ($rHide) {
|
||||
if (!in_array($rKey, $rHide)) {
|
||||
$rReturn[$rKey] = $rRow[$rKey];
|
||||
}
|
||||
}
|
||||
@@ -55,8 +51,7 @@ class ResellerAPIWrapper {
|
||||
|
||||
public static function filterRows($rRows, $rShow, $rHide) {
|
||||
$rReturn = [];
|
||||
if (!$rRows['data']) {
|
||||
} else {
|
||||
if ($rRows['data']) {
|
||||
foreach ($rRows['data'] as $rRow) {
|
||||
$rReturn[] = self::filterRow($rRow, $rShow, $rHide, true);
|
||||
}
|
||||
@@ -94,8 +89,7 @@ class ResellerAPIWrapper {
|
||||
unset(ResellerAPI::$rUserInfo['password']);
|
||||
$rUserInfo = ResellerAPI::$rUserInfo;
|
||||
$rPermissions = ResellerAPI::$rPermissions;
|
||||
if (0 >= strlen($rUserInfo['timezone'])) {
|
||||
} else {
|
||||
if ((string) $rUserInfo['timezone'] !== '') {
|
||||
date_default_timezone_set($rUserInfo['timezone']);
|
||||
}
|
||||
return true;
|
||||
@@ -115,7 +109,7 @@ class ResellerAPIWrapper {
|
||||
$rPackages = [];
|
||||
$rOverride = json_decode($rUserInfo['override_packages'], true);
|
||||
foreach (PackageService::getAll($rUserInfo['member_group_id']) as $rPackage) {
|
||||
if (isset($rOverride[$rPackage['id']]['official_credits']) && 0 < strlen($rOverride[$rPackage['id']]['official_credits'])) {
|
||||
if (isset($rOverride[$rPackage['id']]['official_credits']) && (string) $rOverride[$rPackage['id']]['official_credits'] !== '') {
|
||||
$rPackage['official_credits'] = intval($rOverride[$rPackage['id']]['official_credits']);
|
||||
} else {
|
||||
$rPackage['official_credits'] = intval($rPackage['official_credits']);
|
||||
@@ -126,20 +120,18 @@ class ResellerAPIWrapper {
|
||||
}
|
||||
|
||||
public static function getLine($rID) {
|
||||
if (!(($rLine = UserRepository::getLineById($rID)) && Authorization::check('line', $rID))) {
|
||||
if (!$rLine = UserRepository::getLineById($rID) || !Authorization::check('line', $rID)) {
|
||||
return ['status' => 'STATUS_FAILURE'];
|
||||
}
|
||||
return ['status' => 'STATUS_SUCCESS', 'data' => $rLine];
|
||||
}
|
||||
|
||||
public static function createLine($rData) {
|
||||
if (!isset($rData['edit'])) {
|
||||
} else {
|
||||
if (isset($rData['edit'])) {
|
||||
unset($rData['edit']);
|
||||
}
|
||||
$rReturn = parseerror(ResellerAPI::processLine($rData));
|
||||
if (!isset($rReturn['data']['insert_id'])) {
|
||||
} else {
|
||||
if (isset($rReturn['data']['insert_id'])) {
|
||||
$rReturn['data'] = self::getLine($rReturn['data']['insert_id'])['data'];
|
||||
}
|
||||
return $rReturn;
|
||||
@@ -150,23 +142,19 @@ class ResellerAPIWrapper {
|
||||
return ['status' => 'STATUS_FAILURE'];
|
||||
}
|
||||
$rData['edit'] = $rID;
|
||||
if (!isset($rData['isp_clear'])) {
|
||||
} else {
|
||||
if (isset($rData['isp_clear'])) {
|
||||
$rData['isp_clear'] = '';
|
||||
}
|
||||
$rReturn = parseerror(ResellerAPI::processLine($rData));
|
||||
if (!isset($rReturn['data']['insert_id'])) {
|
||||
} else {
|
||||
if (isset($rReturn['data']['insert_id'])) {
|
||||
$rReturn['data'] = self::getLine($rReturn['data']['insert_id'])['data'];
|
||||
}
|
||||
return $rReturn;
|
||||
}
|
||||
|
||||
public static function deleteLine($rID) {
|
||||
if (!UserRepository::getLineById($rID)) {
|
||||
} else {
|
||||
if (!LineService::deleteLineById($rID)) {
|
||||
} else {
|
||||
if (UserRepository::getLineById($rID)) {
|
||||
if (LineService::deleteLineById($rID)) {
|
||||
return ['status' => 'STATUS_SUCCESS'];
|
||||
}
|
||||
}
|
||||
@@ -190,10 +178,8 @@ class ResellerAPIWrapper {
|
||||
}
|
||||
|
||||
public static function getMAG($rID) {
|
||||
if (!($rDevice = MagService::getById($rID))) {
|
||||
} else {
|
||||
if (!Authorization::check('line', $rDevice['user_id'])) {
|
||||
} else {
|
||||
if ($rDevice = MagService::getById($rID)) {
|
||||
if (Authorization::check('line', $rDevice['user_id'])) {
|
||||
return ['status' => 'STATUS_SUCCESS', 'data' => $rDevice];
|
||||
}
|
||||
}
|
||||
@@ -201,13 +187,11 @@ class ResellerAPIWrapper {
|
||||
}
|
||||
|
||||
public static function createMAG($rData) {
|
||||
if (!isset($rData['edit'])) {
|
||||
} else {
|
||||
if (isset($rData['edit'])) {
|
||||
unset($rData['edit']);
|
||||
}
|
||||
$rReturn = parseerror(ResellerAPI::processMAG($rData));
|
||||
if (!isset($rReturn['data']['insert_id'])) {
|
||||
} else {
|
||||
if (isset($rReturn['data']['insert_id'])) {
|
||||
$rReturn['data'] = self::getMAG($rReturn['data']['insert_id'])['data'];
|
||||
}
|
||||
return $rReturn;
|
||||
@@ -218,23 +202,19 @@ class ResellerAPIWrapper {
|
||||
return ['status' => 'STATUS_FAILURE'];
|
||||
}
|
||||
$rData['edit'] = $rID;
|
||||
if (!isset($rData['isp_clear'])) {
|
||||
} else {
|
||||
if (isset($rData['isp_clear'])) {
|
||||
$rData['isp_clear'] = '';
|
||||
}
|
||||
$rReturn = parseerror(ResellerAPI::processMAG($rData));
|
||||
if (!isset($rReturn['data']['insert_id'])) {
|
||||
} else {
|
||||
if (isset($rReturn['data']['insert_id'])) {
|
||||
$rReturn['data'] = self::getMAG($rReturn['data']['insert_id'])['data'];
|
||||
}
|
||||
return $rReturn;
|
||||
}
|
||||
|
||||
public static function deleteMAG($rID) {
|
||||
if (!MagService::getById($rID)) {
|
||||
} else {
|
||||
if (!MagService::deleteDevice($rID)) {
|
||||
} else {
|
||||
if (MagService::getById($rID)) {
|
||||
if (MagService::deleteDevice($rID)) {
|
||||
return ['status' => 'STATUS_SUCCESS'];
|
||||
}
|
||||
}
|
||||
@@ -267,10 +247,8 @@ class ResellerAPIWrapper {
|
||||
}
|
||||
|
||||
public static function getEnigma($rID) {
|
||||
if (!($rDevice = EnigmaService::getById($rID))) {
|
||||
} else {
|
||||
if (!Authorization::check('line', $rDevice['user_id'])) {
|
||||
} else {
|
||||
if ($rDevice = EnigmaService::getById($rID)) {
|
||||
if (Authorization::check('line', $rDevice['user_id'])) {
|
||||
return ['status' => 'STATUS_SUCCESS', 'data' => $rDevice];
|
||||
}
|
||||
}
|
||||
@@ -278,13 +256,11 @@ class ResellerAPIWrapper {
|
||||
}
|
||||
|
||||
public static function createEnigma($rData) {
|
||||
if (!isset($rData['edit'])) {
|
||||
} else {
|
||||
if (isset($rData['edit'])) {
|
||||
unset($rData['edit']);
|
||||
}
|
||||
$rReturn = parseerror(ResellerAPI::processEnigma($rData));
|
||||
if (!isset($rReturn['data']['insert_id'])) {
|
||||
} else {
|
||||
if (isset($rReturn['data']['insert_id'])) {
|
||||
$rReturn['data'] = self::getEnigma($rReturn['data']['insert_id'])['data'];
|
||||
}
|
||||
return $rReturn;
|
||||
@@ -295,23 +271,19 @@ class ResellerAPIWrapper {
|
||||
return ['status' => 'STATUS_FAILURE'];
|
||||
}
|
||||
$rData['edit'] = $rID;
|
||||
if (!isset($rData['isp_clear'])) {
|
||||
} else {
|
||||
if (isset($rData['isp_clear'])) {
|
||||
$rData['isp_clear'] = '';
|
||||
}
|
||||
$rReturn = parseerror(ResellerAPI::processEnigma($rData));
|
||||
if (!isset($rReturn['data']['insert_id'])) {
|
||||
} else {
|
||||
if (isset($rReturn['data']['insert_id'])) {
|
||||
$rReturn['data'] = self::getEnigma($rReturn['data']['insert_id'])['data'];
|
||||
}
|
||||
return $rReturn;
|
||||
}
|
||||
|
||||
public static function deleteEnigma($rID) {
|
||||
if (!EnigmaService::getById($rID)) {
|
||||
} else {
|
||||
if (!EnigmaService::deleteDevice($rID)) {
|
||||
} else {
|
||||
if (EnigmaService::getById($rID)) {
|
||||
if (EnigmaService::deleteDevice($rID)) {
|
||||
return ['status' => 'STATUS_SUCCESS'];
|
||||
}
|
||||
}
|
||||
@@ -344,43 +316,38 @@ class ResellerAPIWrapper {
|
||||
}
|
||||
|
||||
public static function getUser($rID) {
|
||||
if (!(($rUser = UserRepository::getRegisteredUserById($rID)) && Authorization::check('user', $rUser['id']))) {
|
||||
if (!$rUser = UserRepository::getRegisteredUserById($rID) || !Authorization::check('user', $rUser['id'])) {
|
||||
return ['status' => 'STATUS_FAILURE'];
|
||||
}
|
||||
return ['status' => 'STATUS_SUCCESS', 'data' => $rUser];
|
||||
}
|
||||
|
||||
public static function createUser($rData) {
|
||||
if (!isset($rData['edit'])) {
|
||||
} else {
|
||||
if (isset($rData['edit'])) {
|
||||
unset($rData['edit']);
|
||||
}
|
||||
$rReturn = parseerror(ResellerAPI::processUser($rData));
|
||||
if (!isset($rReturn['data']['insert_id'])) {
|
||||
} else {
|
||||
if (isset($rReturn['data']['insert_id'])) {
|
||||
$rReturn['data'] = self::getUser($rReturn['data']['insert_id'])['data'];
|
||||
}
|
||||
return $rReturn;
|
||||
}
|
||||
|
||||
public static function editUser($rID, $rData) {
|
||||
if (!(($rUser = self::getUser($rID)) && isset($rUser['data']))) {
|
||||
if (!$rUser = self::getUser($rID) || !isset($rUser['data'])) {
|
||||
return ['status' => 'STATUS_FAILURE'];
|
||||
}
|
||||
$rData['edit'] = $rID;
|
||||
$rReturn = parseerror(ResellerAPI::processUser($rData));
|
||||
if (!isset($rReturn['data']['insert_id'])) {
|
||||
} else {
|
||||
if (isset($rReturn['data']['insert_id'])) {
|
||||
$rReturn['data'] = self::getUser($rReturn['data']['insert_id'])['data'];
|
||||
}
|
||||
return $rReturn;
|
||||
}
|
||||
|
||||
public static function deleteUser($rID) {
|
||||
if (!(($rUser = self::getUser($rID)) && isset($rUser['data']))) {
|
||||
} else {
|
||||
if (!UserService::deleteRegisteredUser($rID)) {
|
||||
} else {
|
||||
if (($rUser = self::getUser($rID)) && isset($rUser['data'])) {
|
||||
if (UserService::deleteRegisteredUser($rID)) {
|
||||
return ['status' => 'STATUS_SUCCESS'];
|
||||
}
|
||||
}
|
||||
@@ -388,7 +355,7 @@ class ResellerAPIWrapper {
|
||||
}
|
||||
|
||||
public static function disableUser($rID) {
|
||||
if (!(($rUser = self::getUser($rID)) && isset($rUser['data']))) {
|
||||
if (!$rUser = self::getUser($rID) || !isset($rUser['data'])) {
|
||||
return ['status' => 'STATUS_FAILURE'];
|
||||
}
|
||||
self::$db->query('UPDATE `users` SET `status` = 0 WHERE `id` = ?;', $rID);
|
||||
@@ -396,7 +363,7 @@ class ResellerAPIWrapper {
|
||||
}
|
||||
|
||||
public static function enableUser($rID) {
|
||||
if (!(($rUser = self::getUser($rID)) && isset($rUser['data']))) {
|
||||
if (!$rUser = self::getUser($rID) || !isset($rUser['data'])) {
|
||||
return ['status' => 'STATUS_FAILURE'];
|
||||
}
|
||||
self::$db->query('UPDATE `users` SET `status` = 1 WHERE `id` = ?;', $rID);
|
||||
@@ -405,18 +372,14 @@ class ResellerAPIWrapper {
|
||||
|
||||
public static function adjustCredits($rID, $rCredits, $rNote) {
|
||||
global $rUserInfo;
|
||||
if (strlen($rNote) != 0) {
|
||||
} else {
|
||||
if (strlen($rNote) == 0) {
|
||||
$rNote = 'Reseller API Adjustment';
|
||||
}
|
||||
if (!(($rUser = self::getUser($rID)) && isset($rUser['data']))) {
|
||||
} else {
|
||||
if (!is_numeric($rCredits)) {
|
||||
} else {
|
||||
if (($rUser = self::getUser($rID)) && isset($rUser['data'])) {
|
||||
if (is_numeric($rCredits)) {
|
||||
$rOwnerCredits = intval($rUserInfo['credits']) - intval($rCredits);
|
||||
$rNewCredits = intval($rUser['data']['credits']) + intval($rCredits);
|
||||
if (!(0 <= $rNewCredits && 0 <= $rOwnerCredits)) {
|
||||
} else {
|
||||
if (0 <= $rNewCredits && 0 <= $rOwnerCredits) {
|
||||
self::$db->query('UPDATE `users` SET `credits` = ? WHERE `id` = ?;', $rOwnerCredits, $rUserInfo['id']);
|
||||
self::$db->query('UPDATE `users` SET `credits` = ? WHERE `id` = ?;', $rNewCredits, $rUser['data']['id']);
|
||||
self::$db->query('INSERT INTO `users_credits_logs`(`target_id`, `admin_id`, `amount`, `date`, `reason`) VALUES(?, ?, ?, ?, ?);', $rUser['data']['id'], $rUserInfo['id'], $rCredits, time(), $rNote);
|
||||
@@ -432,12 +395,10 @@ class ResellerAPIWrapper {
|
||||
if (!function_exists('parseError')) {
|
||||
function parseError($rArray) {
|
||||
global $_ERRORS;
|
||||
if (!(isset($rArray['status']) && is_numeric($rArray['status']))) {
|
||||
} else {
|
||||
if (isset($rArray['status']) && is_numeric($rArray['status'])) {
|
||||
$rArray['status'] = $_ERRORS[$rArray['status']];
|
||||
}
|
||||
if ($rArray) {
|
||||
} else {
|
||||
if (!$rArray) {
|
||||
$rArray['status'] = 'STATUS_NO_PERMISSIONS';
|
||||
}
|
||||
return $rArray;
|
||||
|
||||
@@ -21,8 +21,7 @@ class ResellerRestApiController {
|
||||
|
||||
$_ERRORS = [];
|
||||
foreach (get_defined_constants(true)['user'] as $rKey => $rValue) {
|
||||
if (substr($rKey, 0, 7) != 'STATUS_') {
|
||||
} else {
|
||||
if (substr($rKey, 0, 7) == 'STATUS_') {
|
||||
$_ERRORS[intval($rValue)] = $rKey;
|
||||
}
|
||||
}
|
||||
@@ -31,7 +30,7 @@ class ResellerRestApiController {
|
||||
ResellerAPIWrapper::$rKey = $rData['api_key'];
|
||||
if (!empty(RequestManager::get('api_key')) && ResellerAPIWrapper::createSession()) {
|
||||
$rAction = $rData['action'];
|
||||
$rStart = (intval($rData['start']) ?: 0);
|
||||
$rStart = (intval($rData['start']));
|
||||
$rLimit = (intval($rData['limit']) ?: 50);
|
||||
unset($rData['api_key'], $rData['action'], $rData['start'], $rData['limit']);
|
||||
if (RequestManager::has('show_columns')) {
|
||||
@@ -139,8 +138,7 @@ class ResellerRestApiController {
|
||||
echo json_encode(ResellerAPIWrapper::convertEnigma(RequestManager::get('id')));
|
||||
break;
|
||||
case 'get_user':
|
||||
if (in_array('password', $rHideColumns)) {
|
||||
} else {
|
||||
if (!in_array('password', $rHideColumns)) {
|
||||
$rHideColumns[] = 'password';
|
||||
}
|
||||
echo json_encode(ResellerAPIWrapper::filterRow(ResellerAPIWrapper::getUser($rData['id']), $rShowColumns, $rHideColumns));
|
||||
|
||||
@@ -190,15 +190,11 @@ class XPluginApiController {
|
||||
|
||||
$rType = $rRequest['t'];
|
||||
|
||||
switch ($rType) {
|
||||
case 'screen':
|
||||
$rInfo = getimagesize($_FILES['f']['tmp_name']);
|
||||
|
||||
if ($rInfo && $rInfo[2] == IMAGETYPE_JPEG) {
|
||||
if ($rType === 'screen') {
|
||||
$rInfo = getimagesize($_FILES['f']['tmp_name']);
|
||||
if ($rInfo && $rInfo[2] == IMAGETYPE_JPEG) {
|
||||
move_uploaded_file($_FILES['f']['tmp_name'], E2_IMAGES_PATH . $rDeviceInfo['device_id'] . '_screen_' . time() . '_' . uniqid() . '.jpg');
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,8 +51,7 @@ class EpisodesController extends BasePlayerController {
|
||||
if (SettingsManager::get('player_hide_incompatible')) {
|
||||
$db->query('SELECT MAX(`compatible`) AS `compatible` FROM `streams_servers` LEFT JOIN `streams_episodes` ON `streams_episodes`.`stream_id` = `streams_servers`.`stream_id` WHERE `series_id` = ? AND `season_num` = ?;', $rSeries['id'], $rRow['season_num']);
|
||||
|
||||
if (!$db->get_row()['compatible']) {
|
||||
} else {
|
||||
if ($db->get_row()['compatible']) {
|
||||
$rSeasons[] = $rRow['season_num'];
|
||||
}
|
||||
} else {
|
||||
@@ -69,16 +68,15 @@ class EpisodesController extends BasePlayerController {
|
||||
|
||||
$rLegacy = false;
|
||||
$rEpisodes = $db->get_rows();
|
||||
$counter = count($rEpisodes);
|
||||
|
||||
for ($i = 0; $i < count($rEpisodes); $i++) {
|
||||
for ($i = 0; $i < $counter; $i++) {
|
||||
$rURLs[$rEpisodes[$i]['id']] = $rDomainName . 'series/' . $rUserInfo['username'] . '/' . $rUserInfo['password'] . '/' . $rEpisodes[$i]['id'] . '.' . $rEpisodes[$i]['target_container'];
|
||||
$rProperties = json_decode($rEpisodes[$i]['movie_properties'], true);
|
||||
$rSubtitles[$rEpisodes[$i]['id']] = getSubtitles($rEpisodes[$i]['id'], $rProperties['subtitle'] ?? []);
|
||||
|
||||
if ($rEpisodes[$i]['target_container'] == 'mp4') {
|
||||
} else {
|
||||
if ($rEpisodes[$i]['target_container'] != 'mp4') {
|
||||
$rProxySubtitles = [];
|
||||
|
||||
foreach ($rSubtitles[$rEpisodes[$i]['id']] as $rSubtitle) {
|
||||
$rSubtitle['file'] = 'proxy.php?url=' . Encryption::mintToken($rSubtitle['file'], SettingsManager::get('live_streaming_pass'), 'd8de497ebccf4f4697a1da20219c7c33', (bool) SettingsManager::get('secure_stream_tokens'));
|
||||
$rProxySubtitles[] = $rSubtitle;
|
||||
@@ -89,13 +87,11 @@ class EpisodesController extends BasePlayerController {
|
||||
}
|
||||
$rSeason = null;
|
||||
|
||||
if (!$rSeries['tmdb_id']) {
|
||||
} else {
|
||||
if ($rSeries['tmdb_id']) {
|
||||
if (!file_exists(TMP_PATH . 'tmdb_' . $rSeries['tmdb_id'] . '_' . $rSeasonNo)) {
|
||||
$rSeason = TMDbService::getSeason($rSeries['tmdb_id'], $rSeasonNo);
|
||||
|
||||
if (!$rSeason) {
|
||||
} else {
|
||||
if ($rSeason) {
|
||||
file_put_contents(TMP_PATH . 'tmdb_' . $rSeries['tmdb_id'] . '_' . $rSeasonNo, igbinary_serialize($rSeason));
|
||||
}
|
||||
} else {
|
||||
@@ -121,14 +117,12 @@ class EpisodesController extends BasePlayerController {
|
||||
$rSimilar = [];
|
||||
$rSimilarArray = json_decode($rSeries['similar'], true);
|
||||
|
||||
if (0 >= count($rSimilarArray)) {
|
||||
} else {
|
||||
if (0 < count($rSimilarArray)) {
|
||||
if (SettingsManager::get('player_hide_incompatible')) {
|
||||
$db->query('SELECT * FROM `streams_series` WHERE `tmdb_id` IN (' . implode(',', $rSimilarArray) . ') AND (SELECT MAX(`compatible`) FROM `streams_servers` LEFT JOIN `streams_episodes` ON `streams_episodes`.`stream_id` = `streams_servers`.`stream_id` WHERE `streams_episodes`.`series_id` = `streams_series`.`id`) = 1 LIMIT 6;');
|
||||
} else {
|
||||
$db->query('SELECT * FROM `streams_series` WHERE `tmdb_id` IN (' . implode(',', $rSimilarArray) . ') LIMIT 6;');
|
||||
}
|
||||
|
||||
foreach ($db->get_rows() as $rRow) {
|
||||
$rSimilar[] = ['type' => 'series', 'id' => $rRow['id'], 'title' => $rRow['title'], 'year' => ($rRow['year'] ?: ($rRow['releaseDate'] ? substr($rRow['releaseDate'], 0, 4) : null)), 'rating' => $rRow['rating'], 'cover' => (ImageUtils::validateURL($rRow['cover']) ?: ''), 'backdrop' => (ImageUtils::validateURL(json_decode($rRow['backdrop_path'], true)[0]) ?: '')];
|
||||
$rSimilarIDs[] = $rRow['id'];
|
||||
|
||||
@@ -46,32 +46,26 @@ class HomeController extends BasePlayerController {
|
||||
$rPopular['series'] = [];
|
||||
}
|
||||
|
||||
if (!(0 < count($rPopular['movies']) && 0 < count($rUserInfo['vod_ids'] ?? []))) {
|
||||
} else {
|
||||
if (0 < count($rPopular['movies']) && 0 < count($rUserInfo['vod_ids'] ?? [])) {
|
||||
if (SettingsManager::get('player_hide_incompatible')) {
|
||||
$db->query('SELECT `id`, `stream_display_name`, `year`, `rating`, `movie_properties` FROM `streams` WHERE `id` IN (' . implode(',', $rPopular['movies']) . ') AND `id` IN (' . implode(',', $rUserInfo['vod_ids']) . ') AND (SELECT MAX(`compatible`) FROM `streams_servers` WHERE `streams_servers`.`stream_id` = `streams`.`id` LIMIT 1) = 1 ORDER BY FIELD(id, ' . implode(',', $rPopular['movies']) . ') ASC LIMIT 50;');
|
||||
} else {
|
||||
$db->query('SELECT `id`, `stream_display_name`, `year`, `rating`, `movie_properties` FROM `streams` WHERE `id` IN (' . implode(',', $rPopular['movies']) . ') AND `id` IN (' . implode(',', $rUserInfo['vod_ids']) . ') ORDER BY FIELD(id, ' . implode(',', $rPopular['movies']) . ') ASC LIMIT 50;');
|
||||
}
|
||||
|
||||
$rStreams = $db->get_rows();
|
||||
|
||||
foreach ($rStreams as $rStream) {
|
||||
$rProperties = json_decode($rStream['movie_properties'], true);
|
||||
$rPopularNow[] = ['type' => 'movie', 'id' => $rStream['id'], 'title' => $rStream['stream_display_name'], 'year' => ($rStream['year'] ?: null), 'rating' => $rStream['rating'], 'cover' => (ImageUtils::validateURL($rProperties['movie_image']) ?: ''), 'backdrop' => (ImageUtils::validateURL($rProperties['backdrop_path'][0]) ?: '')];
|
||||
}
|
||||
}
|
||||
|
||||
if (!(0 < count($rPopular['series']) && 0 < count($rUserInfo['series_ids'] ?? []))) {
|
||||
} else {
|
||||
if (0 < count($rPopular['series']) && 0 < count($rUserInfo['series_ids'] ?? [])) {
|
||||
if (SettingsManager::get('player_hide_incompatible')) {
|
||||
$db->query('SELECT `id`, `title`, `year`, `rating`, `cover`, `backdrop_path` FROM `streams_series` WHERE `id` IN (' . implode(',', $rPopular['series']) . ') AND `id` IN (' . implode(',', $rUserInfo['series_ids']) . ') AND (SELECT MAX(`compatible`) FROM `streams_servers` LEFT JOIN `streams_episodes` ON `streams_episodes`.`stream_id` = `streams_servers`.`stream_id` WHERE `streams_episodes`.`series_id` = `streams_series`.`id`) = 1 ORDER BY FIELD(id, ' . implode(',', $rPopular['series']) . ') ASC LIMIT 50;');
|
||||
} else {
|
||||
$db->query('SELECT `id`, `title`, `year`, `rating`, `cover`, `backdrop_path` FROM `streams_series` WHERE `id` IN (' . implode(',', $rPopular['series']) . ') AND `id` IN (' . implode(',', $rUserInfo['series_ids']) . ') ORDER BY FIELD(id, ' . implode(',', $rPopular['series']) . ') ASC LIMIT 50;');
|
||||
}
|
||||
|
||||
$rStreams = $db->get_rows();
|
||||
|
||||
foreach ($rStreams as $rStream) {
|
||||
$rBackdrop = json_decode($rStream['backdrop_path'], true);
|
||||
$rPopularNow[] = ['type' => 'episodes', 'id' => $rStream['id'], 'title' => $rStream['title'], 'year' => ($rStream['year'] ?: (substr($rStream['releaseDate'], 0, 4) ?: null)), 'rating' => $rStream['rating'], 'cover' => (ImageUtils::validateURL($rStream['cover']) ?: ''), 'backdrop' => (ImageUtils::validateURL($rBackdrop[0]) ?: '')];
|
||||
|
||||
@@ -29,27 +29,20 @@ class ListingsController extends BasePlayerController {
|
||||
if (RequestManager::has('id')) {
|
||||
$rReturn = ['id' => RequestManager::get('id'), 'title' => 'LIVE TV', 'epg_title' => 'No Programme Information...', 'epg_description' => '', 'url' => null];
|
||||
|
||||
if (!isset($rFlip[RequestManager::get('id')])) {
|
||||
} else {
|
||||
if (isset($rFlip[RequestManager::get('id')])) {
|
||||
$rStart = intval(RequestManager::get('start') ?? time());
|
||||
$rDuration = intval(RequestManager::get('duration') ?? 0);
|
||||
$db->query('SELECT `id`, `stream_display_name`, `channel_id`, `epg_id` FROM `streams` WHERE `id` = ?;', RequestManager::get('id'));
|
||||
|
||||
if ($db->num_rows() != 1) {
|
||||
} else {
|
||||
if ($db->num_rows() == 1) {
|
||||
$rStream = $db->get_row();
|
||||
$rReturn['title'] = $rStream['stream_display_name'];
|
||||
$rEPGRow = (EpgService::getStreamEpg(RequestManager::get('id'), $rStart, $rStart + 86400)[0] ?? null);
|
||||
|
||||
if (!$rEPGRow) {
|
||||
} else {
|
||||
if ($rEPGRow) {
|
||||
$rReturn['epg_title'] = date('h:ia', $rEPGRow['start']) . ' - ' . $rEPGRow['title'];
|
||||
$rReturn['epg_description'] = $rEPGRow['description'];
|
||||
}
|
||||
}
|
||||
|
||||
$rDomainName = DomainResolver::resolve(SERVER_ID, !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443);
|
||||
|
||||
if ($rStart + $rDuration * 60 < time() && 0 < $rDuration) {
|
||||
$rReturn['url'] = $rDomainName . 'timeshift/' . $rUserInfo['username'] . '/' . $rUserInfo['password'] . '/' . $rDuration . '/' . $rStart . '/' . intval(RequestManager::get('id')) . '.m3u8';
|
||||
} else {
|
||||
@@ -61,11 +54,10 @@ class ListingsController extends BasePlayerController {
|
||||
} else {
|
||||
$rReturn = ['Channels' => []];
|
||||
$rChannels = [];
|
||||
$rHideEmpty = (intval(RequestManager::get('hideempty')) ?: 0);
|
||||
$rHideEmpty = (intval(RequestManager::get('hideempty')));
|
||||
|
||||
foreach (array_map('intval', explode(',', RequestManager::get('channels'))) as $rChannelID) {
|
||||
if (!($rChannelID && isset($rFlip[$rChannelID]))) {
|
||||
} else {
|
||||
if ($rChannelID && isset($rFlip[$rChannelID])) {
|
||||
$rChannels[] = $rChannelID;
|
||||
}
|
||||
}
|
||||
@@ -81,51 +73,40 @@ class ListingsController extends BasePlayerController {
|
||||
|
||||
if (!file_exists(TMP_PATH . 'cache_' . $rCacheID) || 600 < time() - filemtime(TMP_PATH . 'cache_' . $rCacheID)) {
|
||||
$rListings = [];
|
||||
|
||||
if (0 >= count($rChannels)) {
|
||||
$rArchiveInfo = [];
|
||||
$db->query('SELECT `id`, `tv_archive_duration`, `tv_archive_server_id` FROM `streams` WHERE `id` IN (' . implode(',', $rChannels) . ');');
|
||||
if (0 >= $db->num_rows()) {
|
||||
} else {
|
||||
$rArchiveInfo = [];
|
||||
$db->query('SELECT `id`, `tv_archive_duration`, `tv_archive_server_id` FROM `streams` WHERE `id` IN (' . implode(',', $rChannels) . ');');
|
||||
|
||||
if (0 >= $db->num_rows()) {
|
||||
} else {
|
||||
foreach ($db->get_rows() as $rRow) {
|
||||
$rArchiveInfo[$rRow['id']] = $rRow;
|
||||
}
|
||||
foreach ($db->get_rows() as $rRow) {
|
||||
$rArchiveInfo[$rRow['id']] = $rRow;
|
||||
}
|
||||
|
||||
$rEPGs = EpgService::getStreamsEpg($rChannels, $rStartDate, $rFinishDate);
|
||||
|
||||
foreach ($rEPGs as $rChannelID => $rEPGData) {
|
||||
}
|
||||
$rEPGs = EpgService::getStreamsEpg($rChannels, $rStartDate, $rFinishDate);
|
||||
foreach ($rEPGs as $rChannelID => $rEPGData) {
|
||||
$rFullSize = 0;
|
||||
|
||||
foreach ($rEPGData as $rEPGItem) {
|
||||
$rCapStart = ($rEPGItem['start'] < $rStartDate ? $rStartDate : $rEPGItem['start']);
|
||||
$rCapEnd = ($rFinishDate < $rEPGItem['end'] ? $rFinishDate : $rEPGItem['end']);
|
||||
$rDuration = ($rCapEnd - $rCapStart) / 60;
|
||||
$rArchive = null;
|
||||
foreach ($rEPGData as $rEPGItem) {
|
||||
$rCapStart = ($rEPGItem['start'] < $rStartDate ? $rStartDate : $rEPGItem['start']);
|
||||
$rCapEnd = ($rFinishDate < $rEPGItem['end'] ? $rFinishDate : $rEPGItem['end']);
|
||||
$rDuration = ($rCapEnd - $rCapStart) / 60;
|
||||
$rArchive = null;
|
||||
|
||||
if (!isset($rArchiveInfo[$rChannelID])) {
|
||||
} else {
|
||||
if (!(0 < $rArchiveInfo[$rChannelID]['tv_archive_server_id'] && 0 < $rArchiveInfo[$rChannelID]['tv_archive_duration'])) {
|
||||
} else {
|
||||
if (time() - $rEPGItem['tv_archive_duration'] * 86400 > $rEPGItem['start']) {
|
||||
} else {
|
||||
$rArchive = [$rEPGItem['start'], intval(($rEPGItem['end'] - $rEPGItem['start']) / 60)];
|
||||
}
|
||||
if (isset($rArchiveInfo[$rChannelID])) {
|
||||
if (0 < $rArchiveInfo[$rChannelID]['tv_archive_server_id'] && 0 < $rArchiveInfo[$rChannelID]['tv_archive_duration']) {
|
||||
if (time() - $rEPGItem['tv_archive_duration'] * 86400 <= $rEPGItem['start']) {
|
||||
$rArchive = [$rEPGItem['start'], intval(($rEPGItem['end'] - $rEPGItem['start']) / 60)];
|
||||
}
|
||||
}
|
||||
|
||||
$rRelativeSize = round($rDuration * $rPerUnit, 2);
|
||||
$rFullSize += $rRelativeSize;
|
||||
|
||||
if (100 >= $rFullSize) {
|
||||
} else {
|
||||
$rRelativeSize -= $rFullSize - 100;
|
||||
}
|
||||
|
||||
$rListings[$rChannelID][] = ['ListingId' => $rEPGItem['id'], 'ChannelId' => $rChannelID, 'Title' => $rEPGItem['title'], 'RelativeSize' => $rRelativeSize, 'StartTime' => date('h:ia', $rCapStart), 'EndTime' => date('h:ia', $rCapEnd), 'Start' => $rEPGItem['start'], 'End' => $rEPGItem['end'], 'Specialisation' => 'tv', 'Archive' => $rArchive];
|
||||
}
|
||||
|
||||
$rRelativeSize = round($rDuration * $rPerUnit, 2);
|
||||
$rFullSize += $rRelativeSize;
|
||||
|
||||
if (100 < $rFullSize) {
|
||||
$rRelativeSize -= $rFullSize - 100;
|
||||
}
|
||||
|
||||
$rListings[$rChannelID][] = ['ListingId' => $rEPGItem['id'], 'ChannelId' => $rChannelID, 'Title' => $rEPGItem['title'], 'RelativeSize' => $rRelativeSize, 'StartTime' => date('h:ia', $rCapStart), 'EndTime' => date('h:ia', $rCapEnd), 'Start' => $rEPGItem['start'], 'End' => $rEPGItem['end'], 'Specialisation' => 'tv', 'Archive' => $rArchive];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,30 +114,24 @@ class ListingsController extends BasePlayerController {
|
||||
$db->query('SELECT `id`, `stream_icon`, `stream_display_name`, `tv_archive_duration`, `tv_archive_server_id`, `category_id` FROM `streams` WHERE `id` IN (' . implode(',', $rChannels) . ') ORDER BY FIELD(`id`, ' . implode(',', $rChannels) . ') ASC;');
|
||||
|
||||
foreach ($db->get_rows() as $rStream) {
|
||||
if ($rHideEmpty && 0 >= count($rListings[$rStream['id']] ?? [])) {
|
||||
} else {
|
||||
if (!$rHideEmpty || 0 < count($rListings[$rStream['id']] ?? [])) {
|
||||
if (0 < $rStream['tv_archive_duration'] && 0 < $rStream['tv_archive_server_id']) {
|
||||
$rArchive = $rStream['tv_archive_duration'];
|
||||
} else {
|
||||
$rArchive = 0;
|
||||
}
|
||||
|
||||
$rDefaultArray = $rDefaultEPG;
|
||||
$rDefaultArray['ChannelId'] = $rStream['id'];
|
||||
$rCategoryIDs = json_decode($rStream['category_id'], true);
|
||||
$rCategories = CategoryService::getFromDatabase('live');
|
||||
|
||||
if (0 < strlen(RequestManager::get('category') ?? '')) {
|
||||
if ((string) (RequestManager::get('category') ?? '') !== '') {
|
||||
$rCategory = ($rCategories[intval(RequestManager::get('category'))]['category_name'] ?? 'No Category');
|
||||
} else {
|
||||
$rCategory = ($rCategories[$rCategoryIDs[0] ?? null]['category_name'] ?? 'No Category');
|
||||
}
|
||||
|
||||
if (1 >= count($rCategoryIDs)) {
|
||||
} else {
|
||||
if (1 < count($rCategoryIDs)) {
|
||||
$rCategory .= ' (+' . (count($rCategoryIDs) - 1) . ' others)';
|
||||
}
|
||||
|
||||
$rReturn['Channels'][] = ['Id' => $rStream['id'], 'DisplayName' => $rStream['stream_display_name'], 'CategoryName' => $rCategory, 'Archive' => $rArchive, 'Image' => (ImageUtils::validateURL($rStream['stream_icon']) ?: ''), 'TvListings' => ($rListings[$rStream['id']] ?? [$rDefaultArray])];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ class MoviesController extends BasePlayerController {
|
||||
global $db, $rUserInfo;
|
||||
|
||||
if (RequestManager::has('sort') && RequestManager::get('sort') == 'popular') {
|
||||
$rPopular = true;
|
||||
$rPopular = (igbinary_unserialize(file_get_contents(CONTENT_PATH . 'tmdb_popular'))['movies'] ?: []);
|
||||
|
||||
if (0 < count($rPopular) && 0 < count($rUserInfo['vod_ids'])) {
|
||||
@@ -41,44 +40,37 @@ class MoviesController extends BasePlayerController {
|
||||
$rYearStart = (intval(RequestManager::get('year_s') ?? 0) ?: 1900);
|
||||
$rYearEnd = (intval(RequestManager::get('year_e') ?? 0) ?: date('Y'));
|
||||
|
||||
if (!($rYearStart < 1900 || date('Y') < $rYearStart)) {
|
||||
} else {
|
||||
if ($rYearStart < 1900 || date('Y') < $rYearStart) {
|
||||
$rYearStart = 1900;
|
||||
}
|
||||
|
||||
if (!($rYearEnd < 1900 || date('Y') < $rYearEnd || $rYearEnd < $rYearStart)) {
|
||||
} else {
|
||||
if ($rYearEnd < 1900 || date('Y') < $rYearEnd || $rYearEnd < $rYearStart) {
|
||||
$rYearEnd = date('Y');
|
||||
}
|
||||
|
||||
if (!(1900 < $rYearStart || $rYearEnd < date('Y'))) {
|
||||
} else {
|
||||
if (1900 < $rYearStart || $rYearEnd < date('Y')) {
|
||||
$rPicking['year_range'] = [$rYearStart, $rYearEnd];
|
||||
}
|
||||
|
||||
$rRatingStart = (floatval(RequestManager::get('rating_s') ?? 0) ?: 0);
|
||||
$rRatingEnd = (floatval(RequestManager::get('rating_e') ?? 0) ?: 10);
|
||||
|
||||
if (!($rRatingStart < 0 || 10 < $rRatingStart)) {
|
||||
} else {
|
||||
if ($rRatingStart < 0 || 10 < $rRatingStart) {
|
||||
$rRatingStart = 0;
|
||||
}
|
||||
|
||||
if (!($rRatingEnd < 0 || 10 < $rRatingEnd || $rRatingEnd < $rRatingStart)) {
|
||||
} else {
|
||||
if ($rRatingEnd < 0 || 10 < $rRatingEnd || $rRatingEnd < $rRatingStart) {
|
||||
$rRatingEnd = 10;
|
||||
}
|
||||
|
||||
if (!(0 < $rRatingStart || $rRatingEnd < 10)) {
|
||||
} else {
|
||||
if (0 < $rRatingStart || $rRatingEnd < 10) {
|
||||
$rPicking['rating_range'] = [$rRatingStart, $rRatingEnd];
|
||||
}
|
||||
|
||||
$rCategoryID = (intval(RequestManager::get('category') ?? 0) ?: null);
|
||||
$rSearchBy = (RequestManager::get('search') ?? null);
|
||||
|
||||
if (!$rSearchBy) {
|
||||
} else {
|
||||
if ($rSearchBy) {
|
||||
$rPage = 1;
|
||||
$rLimit = 100;
|
||||
}
|
||||
@@ -93,22 +85,18 @@ class MoviesController extends BasePlayerController {
|
||||
foreach ($rShuffle as $rStream) {
|
||||
$rProperties = json_decode($rStream['movie_properties'], true);
|
||||
|
||||
if (empty($rProperties['backdrop_path'][0])) {
|
||||
} else {
|
||||
if (!empty($rProperties['backdrop_path'][0])) {
|
||||
$rCover = ImageUtils::validateURL($rProperties['backdrop_path'][0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($rPopular || (isset($rSearchBy) && $rSearchBy)) {
|
||||
} else {
|
||||
if (!$rPopular && (!isset($rSearchBy) || !$rSearchBy)) {
|
||||
$rCount = $rStreams['count'];
|
||||
$rPages = ceil($rCount / $rLimit);
|
||||
$rPagination = [];
|
||||
|
||||
foreach (range($rPage - 2, $rPage + 2) as $i) {
|
||||
if (!(1 <= $i && $i <= $rPages)) {
|
||||
} else {
|
||||
if (1 <= $i && $i <= $rPages) {
|
||||
$rPagination[] = $i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,14 +52,12 @@ class PlayerMovieController extends BasePlayerController {
|
||||
$rSimilar = [];
|
||||
$rSimilarArray = json_decode($rStream['similar'], true);
|
||||
|
||||
if (0 >= count($rSimilarArray)) {
|
||||
} else {
|
||||
if (0 < count($rSimilarArray)) {
|
||||
if (SettingsManager::get('player_hide_incompatible')) {
|
||||
$db->query('SELECT * FROM `streams` WHERE `tmdb_id` IN (' . implode(',', $rSimilarArray) . ') AND (SELECT MAX(`compatible`) FROM `streams_servers` WHERE `streams_servers`.`stream_id` = `streams`.`id` LIMIT 1) = 1 LIMIT 6;');
|
||||
} else {
|
||||
$db->query('SELECT * FROM `streams` WHERE `tmdb_id` IN (' . implode(',', $rSimilarArray) . ') LIMIT 6;');
|
||||
}
|
||||
|
||||
foreach ($db->get_rows() as $rRow) {
|
||||
$rSimilarProperties = json_decode($rRow['movie_properties'], true);
|
||||
$rSimilar[] = ['type' => 'movie', 'id' => $rRow['id'], 'title' => ($rRow['title'] ?? $rRow['stream_display_name']), 'year' => ($rRow['year'] ?: null), 'rating' => $rSimilarProperties['rating'], 'cover' => (ImageUtils::validateURL($rSimilarProperties['movie_image']) ?: ''), 'backdrop' => (ImageUtils::validateURL($rSimilarProperties['backdrop_path'][0] ?? '') ?: '')];
|
||||
@@ -67,23 +65,19 @@ class PlayerMovieController extends BasePlayerController {
|
||||
}
|
||||
}
|
||||
|
||||
if (count($rSimilar) >= 6) {
|
||||
} else {
|
||||
if (count($rSimilar) < 6) {
|
||||
if (0 < count($rSimilarIDs)) {
|
||||
$rPrevious = '`stream_id` NOT IN (' . implode(',', $rSimilarIDs) . ') AND ';
|
||||
} else {
|
||||
$rPrevious = '';
|
||||
}
|
||||
|
||||
if (SettingsManager::get('player_hide_incompatible')) {
|
||||
$db->query('SELECT `streams`.*, COUNT(`user_id`) AS `count` FROM `lines_activity` LEFT JOIN `streams` ON `streams`.`id` = `lines_activity`.`stream_id` WHERE `user_id` IN (SELECT DISTINCT(`user_id`) FROM `lines_activity` WHERE `stream_id` = ? AND (`date_end` - `date_start` > 60)) AND `type` = 2 AND ' . $rPrevious . ' `stream_id` IN (' . implode(',', $rUserInfo['vod_ids']) . ') AND (SELECT MAX(`compatible`) FROM `streams_servers` WHERE `streams_servers`.`stream_id` = `streams`.`id` LIMIT 1) = 1 GROUP BY `stream_id` ORDER BY `count` DESC LIMIT ' . (6 - count($rSimilar)) . ';', $rStream['id']);
|
||||
} else {
|
||||
$db->query('SELECT `streams`.*, COUNT(`user_id`) AS `count` FROM `lines_activity` LEFT JOIN `streams` ON `streams`.`id` = `lines_activity`.`stream_id` WHERE `user_id` IN (SELECT DISTINCT(`user_id`) FROM `lines_activity` WHERE `stream_id` = ? AND (`date_end` - `date_start` > 60)) AND `type` = 2 AND ' . $rPrevious . ' `stream_id` IN (' . implode(',', $rUserInfo['vod_ids']) . ') GROUP BY `stream_id` ORDER BY `count` DESC LIMIT ' . (6 - count($rSimilar)) . ';', $rStream['id']);
|
||||
}
|
||||
|
||||
foreach ($db->get_rows() as $rRow) {
|
||||
if (!$rRow['id']) {
|
||||
} else {
|
||||
if ($rRow['id']) {
|
||||
$rSimilarProperties = json_decode($rRow['movie_properties'], true);
|
||||
$rSimilar[] = ['type' => 'movie', 'id' => $rRow['id'], 'title' => ($rRow['title'] ?? $rRow['stream_display_name']), 'year' => ($rRow['year'] ?: null), 'rating' => $rSimilarProperties['rating'], 'cover' => (ImageUtils::validateURL($rSimilarProperties['movie_image']) ?: ''), 'backdrop' => (ImageUtils::validateURL($rSimilarProperties['backdrop_path'][0] ?? '') ?: '')];
|
||||
$rSimilarIDs[] = $rRow['id'];
|
||||
|
||||
@@ -22,24 +22,18 @@ class PlayerProfileController extends BasePlayerController {
|
||||
public function index() {
|
||||
global $db, $rUserInfo;
|
||||
|
||||
if (!SettingsManager::get('player_allow_bouquet')) {
|
||||
} else {
|
||||
if (SettingsManager::get('player_allow_bouquet')) {
|
||||
$rBouquetNames = [];
|
||||
|
||||
foreach (BouquetService::getAll() as $rBouquet) {
|
||||
if (isset($rBouquet['id'], $rBouquet['bouquet_name'])) {
|
||||
$rBouquetNames[$rBouquet['id']] = $rBouquet['bouquet_name'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!RequestManager::has('bouquet_order')) {
|
||||
} else {
|
||||
if (RequestManager::has('bouquet_order')) {
|
||||
$rBouquetOrder = json_decode(RequestManager::get('bouquet_order'), true);
|
||||
$rUserInfo['bouquet'] = array_map('intval', AdminHelpers::sortArrayByArray($rUserInfo['bouquet'], $rBouquetOrder));
|
||||
$db->query('UPDATE `lines` SET `bouquet` = ? WHERE `id` = ?;', '[' . implode(',', $rUserInfo['bouquet']) . ']', $rUserInfo['id']);
|
||||
|
||||
if (!SettingsManager::get('enable_cache')) {
|
||||
} else {
|
||||
if (SettingsManager::get('enable_cache')) {
|
||||
LineService::updateLineSignal($rUserInfo['id']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class PlayerProxyController extends BasePlayerController {
|
||||
if (substr($rURL, 0, 4) === 'http') {
|
||||
$rData = file_get_contents($rURL);
|
||||
|
||||
if (strlen($rData) > 0) {
|
||||
if ((string) $rData !== '') {
|
||||
header('Content-Description: File Transfer');
|
||||
header('Content-type: application/octet-stream');
|
||||
header('Content-Disposition: attachment; filename="' . md5($rURL . SettingsManager::get('live_streaming_pass')) . '.vtt"');
|
||||
|
||||
@@ -20,7 +20,6 @@ class SeriesController extends BasePlayerController {
|
||||
global $db, $rUserInfo;
|
||||
|
||||
if (RequestManager::has('sort') && RequestManager::get('sort') == 'popular') {
|
||||
$rPopular = true;
|
||||
$rPopular = (igbinary_unserialize(file_get_contents(CONTENT_PATH . 'tmdb_popular'))['series'] ?: []);
|
||||
|
||||
if (0 < count($rPopular) && 0 < count($rUserInfo['series_ids'])) {
|
||||
@@ -41,44 +40,37 @@ class SeriesController extends BasePlayerController {
|
||||
$rYearStart = (intval(RequestManager::get('year_s') ?? 0) ?: 1900);
|
||||
$rYearEnd = (intval(RequestManager::get('year_e') ?? 0) ?: date('Y'));
|
||||
|
||||
if (!($rYearStart < 1900 || date('Y') < $rYearStart)) {
|
||||
} else {
|
||||
if ($rYearStart < 1900 || date('Y') < $rYearStart) {
|
||||
$rYearStart = 1900;
|
||||
}
|
||||
|
||||
if (!($rYearEnd < 1900 || date('Y') < $rYearEnd || $rYearEnd < $rYearStart)) {
|
||||
} else {
|
||||
if ($rYearEnd < 1900 || date('Y') < $rYearEnd || $rYearEnd < $rYearStart) {
|
||||
$rYearEnd = date('Y');
|
||||
}
|
||||
|
||||
if (!(1900 < $rYearStart || $rYearEnd < date('Y'))) {
|
||||
} else {
|
||||
if (1900 < $rYearStart || $rYearEnd < date('Y')) {
|
||||
$rPicking['year_range'] = [$rYearStart, $rYearEnd];
|
||||
}
|
||||
|
||||
$rRatingStart = (intval(RequestManager::get('rating_s') ?? 0) ?: 0);
|
||||
$rRatingStart = (intval(RequestManager::get('rating_s') ?? 0));
|
||||
$rRatingEnd = (intval(RequestManager::get('rating_e') ?? 0) ?: 10);
|
||||
|
||||
if (!($rRatingStart < 0 || 10 < $rRatingStart)) {
|
||||
} else {
|
||||
if ($rRatingStart < 0 || 10 < $rRatingStart) {
|
||||
$rRatingStart = 0;
|
||||
}
|
||||
|
||||
if (!($rRatingEnd < 0 || 10 < $rRatingEnd || $rRatingEnd < $rRatingStart)) {
|
||||
} else {
|
||||
if ($rRatingEnd < 0 || 10 < $rRatingEnd || $rRatingEnd < $rRatingStart) {
|
||||
$rRatingEnd = 10;
|
||||
}
|
||||
|
||||
if (!(0 < $rRatingStart || $rRatingEnd < 10)) {
|
||||
} else {
|
||||
if (0 < $rRatingStart || $rRatingEnd < 10) {
|
||||
$rPicking['rating_range'] = [$rRatingStart, $rRatingEnd];
|
||||
}
|
||||
|
||||
$rCategoryID = (intval(RequestManager::get('category') ?? 0) ?: null);
|
||||
$rSearchBy = (RequestManager::get('search') ?? null);
|
||||
|
||||
if (!$rSearchBy) {
|
||||
} else {
|
||||
if ($rSearchBy) {
|
||||
$rPage = 1;
|
||||
$rLimit = 100;
|
||||
}
|
||||
@@ -93,22 +85,18 @@ class SeriesController extends BasePlayerController {
|
||||
foreach ($rShuffle as $rStream) {
|
||||
$rBackdrop = json_decode($rStream['backdrop_path'], true);
|
||||
|
||||
if (empty($rBackdrop[0])) {
|
||||
} else {
|
||||
if (!empty($rBackdrop[0])) {
|
||||
$rCover = ImageUtils::validateURL($rBackdrop[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($rPopular || (isset($rSearchBy) && $rSearchBy)) {
|
||||
} else {
|
||||
if (!$rPopular && (!isset($rSearchBy) || !$rSearchBy)) {
|
||||
$rCount = $rSeries['count'];
|
||||
$rPages = ceil($rCount / $rLimit);
|
||||
$rPagination = [];
|
||||
|
||||
foreach (range($rPage - 2, $rPage + 2) as $i) {
|
||||
if (!(1 <= $i && $i <= $rPages)) {
|
||||
} else {
|
||||
if (1 <= $i && $i <= $rPages) {
|
||||
$rPagination[] = $i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class ResellerLoginController {
|
||||
|
||||
if ($_STATUS === STATUS_SUCCESS) {
|
||||
$rReferer = RequestManager::get('referrer') ?? '';
|
||||
if (strlen($rReferer) > 0) {
|
||||
if ((string) $rReferer !== '') {
|
||||
$rReferer = basename($rReferer);
|
||||
if (substr($rReferer, 0, 6) === 'logout') {
|
||||
$rReferer = 'dashboard';
|
||||
|
||||
@@ -56,7 +56,7 @@ class ResellerTableController extends BaseResellerController {
|
||||
$rPermissions['category_ids'] = $rPermissions['category_ids'] ?? [];
|
||||
$rPermissions['series_ids'] = $rPermissions['series_ids'] ?? [];
|
||||
$rPermissions['subresellers'] = $rPermissions['subresellers'] ?? [];
|
||||
if (0 < strlen($rUserInfo['timezone'])) {
|
||||
if ((string) $rUserInfo['timezone'] !== '') {
|
||||
date_default_timezone_set($rUserInfo['timezone']);
|
||||
}
|
||||
} else {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -25,7 +25,7 @@ class StreamAuth {
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($rAvailableServers)) {
|
||||
if ($rAvailableServers === []) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class StreamAuth {
|
||||
}
|
||||
|
||||
$rAcceptServers = array_filter($rAcceptServers, 'is_numeric');
|
||||
if (empty($rAcceptServers)) {
|
||||
if ($rAcceptServers === []) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ class StreamAuth {
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($rPriorityServers) && empty($rRedirectID)) {
|
||||
if ($rPriorityServers === [] && empty($rRedirectID)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class ProxySelector {
|
||||
$rAcceptServers[$rServerID] = (0 < $rServers[$rServerID]['total_clients'] && $rOnlineClients < $rServers[$rServerID]['total_clients'] ? $rServerCapacity[$rServerID]['capacity'] : false);
|
||||
}
|
||||
$rAcceptServers = array_filter($rAcceptServers, 'is_numeric');
|
||||
if (empty($rAcceptServers)) {
|
||||
if ($rAcceptServers === []) {
|
||||
return null;
|
||||
}
|
||||
$rKeys = array_keys($rAcceptServers);
|
||||
@@ -65,9 +65,8 @@ class ProxySelector {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!(empty($rPriorityServers) && empty($rRedirectID))) {
|
||||
$rRedirectID = (empty($rRedirectID) ? array_search(min($rPriorityServers), $rPriorityServers) : $rRedirectID);
|
||||
return $rRedirectID;
|
||||
if ($rPriorityServers !== [] || !empty($rRedirectID)) {
|
||||
return empty($rRedirectID) ? array_search(min($rPriorityServers), $rPriorityServers) : $rRedirectID;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -44,17 +44,14 @@ class FFprobeRunner {
|
||||
$rOutput['of_duration'] = (!empty($rCodecs['format']['duration']) ? $rCodecs['format']['duration'] : 'N/A');
|
||||
$rOutput['duration'] = (!empty($rCodecs['format']['duration']) ? gmdate('H:i:s', intval($rCodecs['format']['duration'])) : 'N/A');
|
||||
foreach ($rCodecs['streams'] as $rCodec) {
|
||||
if (isset($rCodec['codec_type']) && !($rCodec['codec_type'] != 'audio' && $rCodec['codec_type'] != 'video' && $rCodec['codec_type'] != 'subtitle')) {
|
||||
if (isset($rCodec['codec_type']) && in_array($rCodec['codec_type'], ['audio', 'video', 'subtitle'])) {
|
||||
if ($rCodec['codec_type'] == 'audio' || $rCodec['codec_type'] == 'video') {
|
||||
if (!empty($rOutput['codecs'][$rCodec['codec_type']])) {
|
||||
} else {
|
||||
if (empty($rOutput['codecs'][$rCodec['codec_type']])) {
|
||||
$rOutput['codecs'][$rCodec['codec_type']] = $rCodec;
|
||||
}
|
||||
} else {
|
||||
if ($rCodec['codec_type'] != 'subtitle') {
|
||||
} else {
|
||||
if (isset($rOutput['codecs'][$rCodec['codec_type']])) {
|
||||
} else {
|
||||
if ($rCodec['codec_type'] == 'subtitle') {
|
||||
if (!isset($rOutput['codecs'][$rCodec['codec_type']])) {
|
||||
$rOutput['codecs'][$rCodec['codec_type']] = [];
|
||||
}
|
||||
$rOutput['codecs'][$rCodec['codec_type']][] = $rCodec;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user