<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.4
 * @ Decoder version: 1.0.2
 * @ Release: 10/08/2022
 */

// Decoded file for php version 74.
if(!defined("IN_SITE")) {
    exit("The Request Not Found");
}
$body = ["title" => __("Cấu hình CRON JOBS") . " | " . $CMSNT->site("title"), "desc" => $CMSNT->site("description"), "keyword" => $CMSNT->site("keywords")];
$body["header"] = "\n<script src=\"https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js\"></script>\n\n\n";
$body["footer"] = "\n<!-- ckeditor -->\n<script src=\"" . BASE_URL("public/ckeditor/ckeditor.js") . "\"></script>\n";
require_once __DIR__ . "/../../models/is_admin.php";
require_once __DIR__ . "/header.php";
require_once __DIR__ . "/sidebar.php";
if(!checkPermission($getUser["admin"], "edit_affiliate")) {
    exit("<script type=\"text/javascript\">if(!alert(\"Bạn không có quyền sử dụng tính năng này\")){window.history.back().location.reload();}</script>");
}
if(isset($_POST["SaveSettings"])) {
    if($CMSNT->site("status_demo") != 0) {
        exit("<script type=\"text/javascript\">if(!alert(\"" . __("This function cannot be used because this is a demo site") . "\")){window.history.back().location.reload();}</script>");
    }
    $Mobile_Detect = new Mobile_Detect();
    $CMSNT->insert("logs", ["user_id" => $getUser["id"], "ip" => myip(), "device" => $Mobile_Detect->getUserAgent(), "createdate" => gettime(), "action" => "Cấu hình CRON JOB"]);
    foreach ($_POST as $key => $value) {
        $CMSNT->update("settings", ["value" => $value], " `name` = '" . $key . "' ");
    }
    $my_text = $CMSNT->site("noti_action");
    $my_text = str_replace("{domain}", $_SERVER["SERVER_NAME"], $my_text);
    $my_text = str_replace("{username}", $getUser["username"], $my_text);
    $my_text = str_replace("{action}", __("Cấu hình CRON JOB"), $my_text);
    $my_text = str_replace("{ip}", myip(), $my_text);
    $my_text = str_replace("{time}", gettime(), $my_text);
    sendMessAdmin($my_text);
    exit("<script type=\"text/javascript\">if(!alert(\"" . __("Save successfully!") . "\")){window.history.back().location.reload();}</script>");
} else {
    echo "\n\n<div class=\"main-content app-content\">\n    <div class=\"container-fluid\">\n        <div class=\"d-md-flex d-block align-items-center justify-content-between my-4 page-header-breadcrumb\">\n            <h1 class=\"page-title fw-semibold fs-18 mb-0\">Cấu hình Cron Jobs</h1>\n            <div class=\"ms-md-1 ms-0\">\n            </div>\n        </div>\n        ";
    if(120 <= time() - $CMSNT->site("check_time_cron_cron")) {
        echo "        <div class=\"alert alert-danger alert-dismissible fade show custom-alert-icon shadow-sm\" role=\"alert\">\n            <svg class=\"svg-danger\" xmlns=\"http://www.w3.org/2000/svg\" height=\"1.5rem\" viewBox=\"0 0 24 24\"\n                width=\"1.5rem\" fill=\"#000000\">\n                <path d=\"M0 0h24v24H0z\" fill=\"none\" />\n                <path\n                    d=\"M15.73 3H8.27L3 8.27v7.46L8.27 21h7.46L21 15.73V8.27L15.73 3zM12 17.3c-.72 0-1.3-.58-1.3-1.3 0-.72.58-1.3 1.3-1.3.72 0 1.3.58 1.3 1.3 0 .72-.58 1.3-1.3 1.3zm1-4.3h-2V7h2v6z\" />\n            </svg>\n            Vui lòng thực hiện <b>CRON JOB</b> liên kết: <a class=\"text-primary\" href=\"";
        echo base_url("cron/cron.php");
        echo "\"\n                target=\"_blank\">";
        echo base_url("cron/cron.php");
        echo "</a> 1 phút 1 lần.\n            <button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"alert\" aria-label=\"Close\"><i\n                    class=\"bi bi-x\"></i></button>\n        </div>\n        ";
    }
    echo "        <div class=\"row\">\n            <div class=\"col-xl-12\">\n                <div class=\"card custom-card\">\n                    <div class=\"card-header justify-content-between\">\n                        <div class=\"card-title\">\n                            CẤU HÌNH CRON JOBS\n                        </div>\n                    </div>\n                    <div class=\"card-body\">\n                        <form action=\"\" method=\"POST\" enctype=\"multipart/form-data\">\n                            <div class=\"row\">\n                                <div class=\"col-lg-12 col-xl-6\">\n                                    <div class=\"row mb-3\">\n                                        <label class=\"col-sm-6 col-form-label\"\n                                            for=\"example-hf-email\">";
    echo __("Trạng thái");
    echo "</label>\n                                        <div class=\"col-sm-6\">\n                                            <select class=\"form-control\" name=\"cronjob_status\" required>\n                                                <option ";
    echo $CMSNT->site("cronjob_status") == 1 ? "selected" : "";
    echo "                                                    value=\"1\">\n                                                    ";
    echo __("ON");
    echo "</option>\n                                                <option ";
    echo $CMSNT->site("cronjob_status") == 0 ? "selected" : "";
    echo "                                                    value=\"0\">\n                                                    ";
    echo __("OFF");
    echo "</option>\n                                            </select>\n                                        </div>\n                                    </div>\n                                    <div class=\"row mb-3\">\n                                        <label class=\"col-sm-6 col-form-label\"\n                                            for=\"example-hf-email\">";
    echo __("Debug");
    echo "</label>\n                                        <div class=\"col-sm-6\">\n                                            <select class=\"form-control\" name=\"cronjob_debug\" required>\n                                                <option ";
    echo $CMSNT->site("cronjob_debug") == 1 ? "selected" : "";
    echo "                                                    value=\"1\">\n                                                    ";
    echo __("ON");
    echo "</option>\n                                                <option ";
    echo $CMSNT->site("cronjob_debug") == 0 ? "selected" : "";
    echo "                                                    value=\"0\">\n                                                    ";
    echo __("OFF");
    echo "</option>\n                                            </select>\n                                        </div>\n                                    </div>\n                                </div>\n                              \n                                <!-- <div class=\"col-lg-12 col-xl-6\">\n                                    <div class=\"row mb-3\">\n                                        <label class=\"col-sm-6 col-form-label\"\n                                            for=\"example-hf-email\">";
    echo __("Timeout");
    echo "</label>\n                                        <div class=\"col-sm-6\">\n                                            <div class=\"input-group\">\n                                                <input type=\"text\" class=\"form-control\"\n                                                    value=\"";
    echo $CMSNT->site("cronjob_timeout");
    echo "\" name=\"cronjob_timeout\"\n                                                    placeholder=\"Thời gian chờ tải link tối đa\">\n                                                <span class=\"input-group-text\">\n                                                    giây\n                                                </span>\n                                            </div>\n                                        </div>\n                                    </div>\n                                </div> -->\n                                <div class=\"col-lg-12 col-xl-6\">\n                                    <div class=\"row mb-3\">\n                                        <label class=\"col-sm-6 col-form-label\"\n                                            for=\"example-hf-email\">";
    echo __("Chu kỳ thanh toán");
    echo "</label>\n                                        <div class=\"col-sm-6\">\n                                            <div class=\"input-group\">\n                                                <textarea class=\"form-control\" rows=\"4\"\n                                                    name=\"cronjob_billing_cycle\">";
    echo $CMSNT->site("cronjob_billing_cycle");
    echo "</textarea>\n                                            </div>\n                                        </div>\n                                    </div>\n                                </div>\n                                \n                                <div class=\"col-lg-12 col-xl-12\">\n                                    <div class=\"row mb-3\">\n                                        <label class=\"col-sm-6 col-form-label\"\n                                            for=\"example-hf-email\">";
    echo __("Lưu ý");
    echo "</label>\n                                        <div class=\"col-sm-12\">\n                                            <textarea id=\"cronjob_note\"\n                                                name=\"cronjob_note\">";
    echo $CMSNT->site("cronjob_note");
    echo "</textarea>\n                                        </div>\n                                    </div>\n                                </div>\n                                <div class=\"col-lg-12 col-xl-6\">\n\n                                </div>\n                            </div>\n                            <a type=\"button\" class=\"btn btn-danger\" href=\"\"><i class=\"fa fa-fw fa-undo me-1\"></i>\n                                ";
    echo __("Reload");
    echo "</a>\n                            <button type=\"submit\" name=\"SaveSettings\" class=\"btn btn-primary\">\n                                <i class=\"fa fa-fw fa-save me-1\"></i> ";
    echo __("Lưu Ngay");
    echo "                            </button>\n                        </form>\n                    </div>\n                </div>\n            </div>\n        </div>\n    </div>\n</div>\n\n\n\n\n\n\n";
    require_once __DIR__ . "/footer.php";
    echo "\n<script>\nCKEDITOR.replace(\"cronjob_note\");\n</script>";
}

?>