<?php

if (!defined("ABSPATH"))
    exit;

#load msorg settings


if (!isset($_GET["plain_receipt"]) && is_user_logged_in()) {
    //TOP
    include_once(__DIR__ . "/top.html");

}
$slug = get_query_var("pagename");
$_GET["vend"] = get_query_var("vtupress-vend");
$page2 = get_query_var("vtupress-page2");
$page3 = get_query_var("vtupress-page3");


//PAGES
if (!isset($_GET["vend"])) {
    include_once(__DIR__ . "/msorg.php");
} elseif (isset($_GET["wp"])) {
    $url = $_GET["vend"];
    include_once VTUPRESS_PATH . "/wp-render.php";
} else {

    switch ($_GET["vend"]) {
        case "dashboard":
            include_once(__DIR__ . "/msorg.php");
        break;
        case "bet":
            if (vp_option_array($option_array, "betcontrol") == "checked") {
                echo "<div class='container'>";
                include_once(__DIR__ . "/services/bet.php");
                echo "</div>";
            }
            break;

        case "crypto":
            if (is_plugin_active("vprest/vprest.php") && vp_option_array($option_array, "resell") == "yes" && vp_option_array($option_array, "allow_crypto") == "yes") {
                echo "<div class='container'>";
                include_once(__DIR__ . "/sections/crypto-gift.php");
                echo "</div>";
            }
            break;
        case "gift-card":
            if (is_plugin_active("vprest/vprest.php") && vp_option_array($option_array, "resell") == "yes" && vp_option_array($option_array, "allow_cards") == "yes") {
                echo "<div class='container'>";
                include_once(__DIR__ . "/sections/crypto-gift.php");
                echo "</div>";
            }
            break;
        case "bvn":
            if (vp_option_array($option_array, "setbvn") == "yes" && vp_option_array($option_array, "vtupress_custom_bvn") == "yes") {
                echo "<div class='container'>";
                include_once(__DIR__ . "/sections/bvn.php");
                echo "</div>";
            }
            break;
        case "message":
            echo "<div class='container p-2'>";
            echo "<div class='mt-3 mx-2 p-2'>";
            include_once(__DIR__ . "/sections/messages.php");
            echo "</div>";
            echo "</div>";
            break;
        case "account":
            echo "<div class='container p-2'>";
            echo "<div class='mt-3 mx-2 p-2'>";
            include_once(__DIR__ . "/sections/account.php");
            echo "</div>";
            echo "</div>";
            break;
        case "withdraw":
            echo "<div class='container p-2'>";
            echo "<div class='mt-3 mx-2 p-2'>";
            include_once(__DIR__ . "/sections/withdraw-referral.php");
            echo "</div>";
            echo "</div>";
            break;
        case "referral-details":
            echo "<div class='container p-2'>";
            echo "<div class='mt-3 mx-2 p-2'>";
            include_once(__DIR__ . "/sections/ref-info.html");
            echo "</div>";
            echo "</div>";
            break;
        case "referrals":
            echo "<div class='container p-2'>";
            echo "<div class='mt-3 mx-2 p-2'>";
            include_once(__DIR__ . "/sections/withdraw-referral.php");
            echo "</div>";
            echo "</div>";
            break;
        case "kyc":
            echo "<div class='container p-2'>";
            echo "<div class='mt-3 mx-2 p-2'>";
            include_once(__DIR__ . "/sections/kyc.php");
            echo "</div>";
            echo "</div>";
            break;
        case "upgrade":
            echo "<div class='container p-2'>";
            echo "<div class='mt-3 mx-2 p-2'>";
            include_once(__DIR__ . "/sections/upgrade.php");
            echo "</div>";
            echo "</div>";
            break;
        case "developer":
            echo "<div class='container p-2'>";
            echo "<div class='mt-3 mx-2 p-2'>";
            include_once(__DIR__ . "/sections/developer.php");
            echo "</div>";
            echo "</div>";
            break;
        case "stats":
            echo "<div class='container p-2'>";
            echo "<div class='mt-3 mx-2 p-2'>";
            include_once(__DIR__ . "/sections/statistics.php");
            echo "</div>";
            echo "</div>";
            break;
        case "history":
            echo "<div class='container p-2'>";
            echo "<div class='mt-3 mx-2 p-2'>";
            include_once(__DIR__ . "/sections/history.php");
            echo "</div>";
            echo "</div>";

            break;
        case "history-plain":
            echo "<div class='container p-2'>";
            echo "<div class='mt-3 mx-2 p-2'>";
            include_once(__DIR__ . "/sections/id_cards/control.php");
            echo "</div>";
            echo "</div>";

            break;
        default:
            if (isset($services_array[$_GET["vend"]]) && $services_array[$_GET["vend"]]["status"] == "on") {
                echo "<div class='container'>";
                include_once(__DIR__ . "/services.php");
                echo "</div>";
            } else {
                echo "<link rel=\"stylesheet\" href=\"" .
                    plugins_url('vtupress-templates/templates/msorg') . "/msorg_template/form.css?v=1\" media=\"all\">";

                echo "<div class='container'>";
                if (has_action("template_user_feature")) {
                    do_action("template_user_feature");
                } else {
                    echo "<div class='alert alert-warning'>Service / Feature not found</div>";
                }
                echo "</div>";
            }
            break;
    }

}

//BOTTOM
if (!isset($_GET["plain_receipt"]) && is_user_logged_in()) {
    include_once(__DIR__ . "/bottom.html");
}
?>