<?php
/**
*
* @ This file is created by http://DeZender.Net
* @ deZender (PHP7 Decoder for SourceGuardian Encoder)
*
* @ Version			:	5.0.1.0
* @ Author			:	DeZender
* @ Release on		:	22.04.2022
* @ Official site	:	http://DeZender.Net
*
*/

$jsondata = file_get_contents("./api/json/brbox_xcdata.json");
$data = json_decode($jsondata, true);
$json = $data["app"];
$message = "<div class=\"alert alert-primary\" id=\"flash-msg\"><h4><i class=\"icon fa fa-check\"></i>Items Updated!</h4></div>";
if (isset($_POST["submit"])) {
    $jsonData = file_get_contents("./api/json/brbox_xcdata.json");
    $arrayData = json_decode($jsonData, true);
    if (empty($_POST["show_cat_count"])) {
        $show_cat_count = "yes";
    } else {
        $show_cat_count = $_POST["show_cat_count"];
    }
    if (empty($_POST["load_last_channel"])) {
        $load_last_channel = "no";
    } else {
        $load_last_channel = $_POST["load_last_channel"];
    }
    if (empty($_POST["login_logo"])) {
        $login_logo = "yes";
    } else {
        $login_logo = $_POST["login_logo"];
    }
    if (empty($_POST["logs"])) {
        $logs = "no";
    } else {
        $logs = $_POST["logs"];
    }
    if (empty($_POST["all_cat"])) {
        $all_cat = "yes";
    } else {
        $all_cat = $_POST["all_cat"];
    }
    if (empty($_POST["filter_status"])) {
        $filter_status = "No";
    } else {
        $filter_status = $_POST["filter_status"];
    }
    if (empty($_POST["agent"])) {
        $agent = "brboxXC";
    } else {
        $agent = $_POST["agent"];
    }
    if (empty($_POST["login_type"])) {
        $login_type = "login";
    } else {
        $login_type = $_POST["login_type"];
    }
    if (empty($_POST["btn_login_settings"])) {
        $btn_login_settings = "Yes";
    } else {
        $btn_login_settings = $_POST["btn_login_settings"];
    }
    if (empty($_POST["stream_type"])) {
        $stream_type = "ts";
    } else {
        $stream_type = $_POST["stream_type"];
    }
    $replacementData = ["app" => ["login_type" => $login_type, "show_cat_count" => $show_cat_count, "load_last_channel" => $load_last_channel, "login_logo" => $login_logo, "logs" => $logs, "all_cat" => $all_cat, "filter_status" => $filter_status, "btn_login_settings" => $btn_login_settings, "stream_type" => $stream_type, "agent" => $agent]];
    $newArrayData = array_replace_recursive($arrayData, $replacementData);
    $newJsonData = json_encode($newArrayData, JSON_UNESCAPED_UNICODE);
    file_put_contents("./api/json/brbox_xcdata.json", $newJsonData);
    header("Location: extra.php?message=" . $message);
}
include "includes/header.php";
echo " <!-- Begin Page Content -->\n        <div class=\"container-fluid\">\n\n";
if (isset($_GET["message"])) {
    echo $_GET["message"];
}
echo "          <!-- Content Row -->\n          <div class=\"row\">\n\n            <!-- First Column -->\n            <div class=\"col-lg-12\">\n\n              <!-- Custom codes -->\n                <div class=\"card text-text-primary\">\n                <div class=\"card-header bg-primary py-3\">\n                <center><h4 align=\"center\" class=\"m-0 text-white\"><i class=\"fa fa-wrench\"\n                                    style=\"font-size:20px\">&nbsp;&nbsp;</i> Extra Settings</h4>\n                        \n\t\t\t\t\t\t</center>\n\n            </div>\n                <div class=\"card-body\">\n                            <form method=\"post\">\n\t\t\t\t\t\t\t<div class=\"form-group \">\n                            <label class=\" text-primary control-label requiredField\" for=\"aa\" >\n               <strong> Login Type</strong> \n                        </label>\n\t\t\t\t\t\t\t<select class=\"form-control text-primary\" id=\"select\" name=\"login_type\">\n";
echo "                                        <option value=\"login\" " . $login . " >User / Pass</option>" . "\n";
echo "                                        <option value=\"mac\" " . $mac . " >Mac Address</option>" . "\n";
echo "                                        <option value=\"activation\" " . $code . " >Activation Code</option>" . "\n";
echo "                                    </select>                                \n                                </div>\n\t\t\t\t\t\t<div class=\"form-group\">\n                        <label class=\"control-label \" for=\"agent\">\n                        <strong> User Agent</strong>\n                        </label>\n                        <div class=\"input-group\">\n";
echo "                        <input class=\"form-control text-primary\" name=\"agent\"  value=\"" . $json["agent"] . "\" type=\"text\"/>" . "\n";
echo "                        </div>\n                        </div>\n\t\t\t\t\t    <form method=\"post\">\n\t\t\t\t\t    <div class=\"form-group \">\n                        <label class=\"control-label requiredField\" for=\"logs\" >\n                        <strong> Show App Logs</strong>\n                        </label>\n                        <p>\t\t\n\t\t\t\t\t\t\t<label>True\n\t\t\t\t\t\t\t<input type=\"radio\" name=\"logs\" value=\"yes\"  \n";
if ($json["logs"] == "yes") {
    echo "checked=\\\"checked\\\"";
}
echo "\t>\n\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t<label>False\n\t\t\t\t\t\t\t<input type=\"radio\" name=\"logs\" value=\"no\" \n";
if ($json["logs"] == "no") {
    echo "checked=\\\"checked\\\"";
}
echo "\t\t\t\t\t\t\t  \n\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t</div>\t\t\t\t\t    <form method=\"post\">\n\t\t\t\t\t    <div class=\"form-group \">\n                        <label class=\"control-label requiredField\" for=\"all_cat\" >\n                        <strong> Show All Categories</strong>\n                        </label>\n                        <p>\t\t\n\t\t\t\t\t\t\t<label>True\n\t\t\t\t\t\t\t<input type=\"radio\" name=\"all_cat\" value=\"yes\"  \n";
if ($json["all_cat"] == "yes") {
    echo "checked=\\\"checked\\\"";
}
echo "\t>\n\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t<label>False\n\t\t\t\t\t\t\t<input type=\"radio\" name=\"all_cat\" value=\"no\" \n";
if ($json["all_cat"] == "no") {
    echo "checked=\\\"checked\\\"";
}
echo "\t\t\t\t\t\t\t  \n\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t</div>\t\t\t\t\t    <form method=\"post\">\n\t\t\t\t\t    <div class=\"form-group \">\n                        <label class=\"control-label requiredField\" for=\"show_cat_count\" >\n                        <strong> Show Category Count</strong>\n                        </label>\n                        <p>\t\t\n\t\t\t\t\t\t\t<label>True\n\t\t\t\t\t\t\t<input type=\"radio\" name=\"show_cat_count\" value=\"yes\"  \n";
if ($json["show_cat_count"] == "yes") {
    echo "checked=\\\"checked\\\"";
}
echo "\t>\n\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t<label>False\n\t\t\t\t\t\t\t<input type=\"radio\" name=\"show_cat_count\" value=\"No\" \n";
if ($json["show_cat_count"] == "No") {
    echo "checked=\\\"checked\\\"";
}
echo "\t\t\t\t\t\t\t  \n\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t</div>\t\t\t\t\t    <form method=\"post\">\n\t\t\t\t\t\t<div class=\"form-group \">\n                        <label class=\"control-label requiredField\" for=\"load_last_channel\" >\n                        <strong> Load Last Channel</strong>\n                        </label>\n                        <p>\t\t\n\t\t\t\t\t\t\t<label>True\n\t\t\t\t\t\t\t<input type=\"radio\" name=\"load_last_channel\" value=\"Yes\"  \n";
if ($json["load_last_channel"] == "Yes") {
    echo "checked=\\\"checked\\\"";
}
echo "\t>\n\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t<label>False\n\t\t\t\t\t\t\t<input type=\"radio\" name=\"load_last_channel\" value=\"no\" \n";
if ($json["load_last_channel"] == "no") {
    echo "checked=\\\"checked\\\"";
}
echo "\t\t\t\t\t\t\t  \n\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t</div>\t\t\t\t\t\t<div class=\"form-group \">\n                        <label class=\"control-label requiredField\" for=\"btn_login_settings\" >\n                        <strong> Show Settings On Login</strong>\n                        </label>\n                        <p>\t\t\n\t\t\t\t\t\t\t<label>True\n\t\t\t\t\t\t\t<input type=\"radio\" name=\"btn_login_settings\" value=\"yes\"  \n";
if ($json["btn_login_settings"] == "yes") {
    echo "checked=\\\"checked\\\"";
}
echo "\t>\n\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t<label>False\n\t\t\t\t\t\t\t<input type=\"radio\" name=\"btn_login_settings\" value=\"no\" \n";
if ($json["btn_login_settings"] == "no") {
    echo "checked=\\\"checked\\\"";
}
echo "\t\t\t\t\t\t\t  \n\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t</div>                                <div class=\"form-group \">\n                                    <label class=\"control-label\" for=\"stream_type\" >\n                                        <strong> Stream Format</strong>\n                                    </label>\n                                    <p\t\t\n\t\t\t\t\t\t\t<label>HLS\n\t\t\t\t\t\t\t<input type=\"radio\" name=\"stream_type\" value=\"m3u8\"  \n";
if ($json["stream_type"] == "m3u8") {
    echo "checked=\\\"checked\\\"";
}
echo "\t>\n\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t<label>MPEGTS\n\t\t\t\t\t\t\t<input type=\"radio\" name=\"stream_type\" value=\"ts\" \n";
if ($json["stream_type"] == "ts") {
    echo "checked=\\\"checked\\\"";
}
echo "\t\t\t\t\t\t\t  \n\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t</div>                        <button class=\"btn btn-success btn-icon-split\" name=\"submit\" type=\"submit\">\n                        <span class=\"icon text-white-50\"><i class=\"fas fa-check\"></i></span><span class=\"text\">Update App Settings</span>\n                        </button>\n                        </div>\n                        </div>\n                        </form>\n                </div>\n              </div>\n            </div>           \n\n    <br><br><br>";
include "includes/footer.php";
require "includes/brbox.php";
echo "</body>\n";

?>