hooks.php

Shared decode - view only

Get Your Own Account
288.4 KB
Original Size
49.9 KB
Decoded Size
PHP 8.2
PHP Version
14.0.2
ionCube Version
hooks.php
<?php

function adminpanel_generatemulti($name, $relid = '')
{
    global $CONFIG;
    $languages = adminpanel_getlanguages();
    foreach ($languages as $key => $value) {
        $lfields .= "<li><a href=\"javascript:hideOtherLanguage('" . $value . "');\" tabindex=\"-1\">" . ucfirst($value) . '</a></li>';
    }
    $lfield = '';
    if (isset($_REQUEST['a']) && $_REQUEST['a'] == 'megamenu' && \WHMCS\Database\Capsule::schema()->hasTable('mod_adminpanel_cmegamenu') && \WHMCS\Database\Capsule::schema()->hasTable('mod_adminpanel_megamenupages')) {
        $defalang = \WHMCS\Database\Capsule::table('mod_adminpanel_cmegamenu')->where('relid', $relid)->where('setting', $name)->first();
    } else {
        $defalang = \WHMCS\Database\Capsule::table('mod_adminpanel_cpages')->where('relid', $relid)->where('setting', $name)->first();
    }
    foreach ($languages as $key => $value) {
        $fvalue = '';
        if (isset($_REQUEST['a']) && $_REQUEST['a'] == 'megamenu' && \WHMCS\Database\Capsule::schema()->hasTable('mod_adminpanel_cmegamenu') && \WHMCS\Database\Capsule::schema()->hasTable('mod_adminpanel_megamenupages')) {
            $dealang = \WHMCS\Database\Capsule::table('mod_adminpanel_cmegamenu')->where('relid', $relid)->where('setting', $name . '_' . $value)->first();
        } else {
            $dealang = \WHMCS\Database\Capsule::table('mod_adminpanel_cpages')->where('relid', $relid)->where('setting', $name . '_' . $value)->first();
        }
        if (!empty($dealang) > 0) {
            $fvalue = $dealang->value;
        } elseif (strtolower($value) == strtolower($CONFIG['Language']) && $defalang->value) {
            $fvalue = $defalang->value;
        }
        $display = strtolower($value) == strtolower($CONFIG['Language']) ? 'block' : 'none';
        $lfield = $lfield . '<div class="translatable-field lang-' . $value . '" style="display: ' . $display . ";\">\n            <div class=\"col-xs-9\" style=\"margin-right: 0px;padding-right: 0px;padding-left: 0px;\">";
        if ($name == 'custom_html') {
            $lfield .= '<textarea rows="4" id="' . $name . $value . '" name="' . $name . '_' . $value . '" class="form-control input-lang">' . $fvalue . '</textarea>';
            $lfield .= "</div>\n\t\t\t\t<div class=\"col-xs-1\" style=\"padding-left: 0px;\">\n\t\t\t\t\t<button type=\"button\" class=\"btn btn-primary btn-lang-dropdown dropdown-toggle\" style=\"padding: 6px 12px;\" tabindex=\"-1\" data-toggle=\"dropdown\" aria-expanded=\"false\">\n\t\t\t\t\t\t" . $value . "\n\t\t\t\t\t\t<span class=\"caret\"></span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<ul class=\"dropdown-menu dropdown-menu-right\">\n\t\t\t\t\t" . $lfields . "\n\t\t\t\t\t</ul>\n\t\t\t\t</div>\n\t\t\t</div>";
        } else {
            $required = '';
            if (strtolower($CONFIG['Language']) == $value && $name == 'menu_name') {
                $required = 'required="required"';
            }
            $lfield .= '<input type="text" id="' . $name . $value . '" name="' . $name . '_' . $value . '" class="form-control input-lang" value="' . $fvalue . '" ' . $required . '>';
            $lfield .= "</div>\n\t\t\t\t\t<div class=\"col-xs-3\" style=\"padding-left: 0px; max-width: 90px;\">\n\t\t\t\t\t\t<button type=\"button\" class=\"btn btn-primary btn-lang-dropdown dropdown-toggle\" style=\"padding: 6px 12px;\" tabindex=\"-1\" data-toggle=\"dropdown\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t" . $value . "\n\t\t\t\t\t\t\t<span class=\"caret\"></span>\n\t\t\t\t\t\t</button>\n\t\t\t\t\t\t<ul class=\"dropdown-menu dropdown-menu-right\">\n\t\t\t\t\t\t" . $lfields . "\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t</div>\n\t\t\t\t</div>";
        }
    }
    $rtu = "<div class=\"form-group\">\n    " . $lfield . "\n</div>";
    return $rtu;
}

function adminpanel_cgeneratemulti($name, $page = '')
{
    global $CONFIG;
    $languages = adminpanel_getlanguages();
    foreach ($languages as $key => $value) {
        $lfields .= "<li><a href=\"javascript:hideOtherLanguage('" . $value . "');\" tabindex=\"-1\">" . ucfirst($value) . '</a></li>';
    }
    $lfield = '';
    $item = \WHMCS\Database\Capsule::table('mod_adminpanel_config')->where('setting', 'configurations')->where('page', $page)->first();
    $langarray = [];
    if ($item->value) {
        $langarray = unserialize($item->value);
    } else {
        $langarray = [];
    }
    $defalang = $langarray[$name];
    foreach ($languages as $key => $value) {
        $fvalue = '';
        if ($langarray[$name . '_' . $value] != '') {
            $fvalue = $langarray[$name . '_' . $value];
        } elseif (strtolower($value) == strtolower($CONFIG['Language']) && $defalang) {
            $fvalue = $defalang;
        }
        $display = strtolower($value) == strtolower($CONFIG['Language']) ? 'block' : 'none';
        $lfield = $lfield . '<div class="translatable-field lang-' . $value . '" style="display: ' . $display . ";\">\n            <div class=\"col-xs-9\" style=\"margin-right: 0px;padding-right: 0px;padding-left: 0px;\">";
        if ($name == 'caddress' || $name == 'closeticketmessage' || $name == 'data_clear_modal_description' || $name == 'viewtcikets_alert_content' || $name == 'openticket_alert_content' || $name == 'openticket_message_content') {
            $lfield .= '<textarea rows="4" id="' . $name . $value . '" name="' . $name . '_' . $value . '" class="form-control input-lang">' . $fvalue . '</textarea>';
            $lfield .= "</div>\n\t\t\t\t\t<div class=\"col-xs-1\" style=\"padding-left: 0px;\">\n\t\t\t\t\t\t<button type=\"button\" class=\"btn btn-primary btn-lang-dropdown dropdown-toggle\" style=\"padding: 6px 12px;\" tabindex=\"-1\" data-toggle=\"dropdown\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t" . $value . "\n\t\t\t\t\t\t\t<span class=\"caret\"></span>\n\t\t\t\t\t\t</button>\n\t\t\t\t\t\t<ul class=\"dropdown-menu dropdown-menu-right\">\n\t\t\t\t\t\t" . $lfields . "\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t</div>\n\t\t\t\t</div>";
        } else {
            $lfield .= '<input type="text" id="' . $name . $value . '" name="' . $name . '_' . $value . '" class="form-control input-lang" value="' . $fvalue . '">';
            $lfield .= "</div>\n\t\t\t\t\t<div class=\"col-xs-3\" style=\"padding-left: 0px; max-width: 90px;\">\n\t\t\t\t\t\t<button type=\"button\" class=\"btn btn-primary btn-lang-dropdown dropdown-toggle\" style=\"padding: 6px 12px;\" tabindex=\"-1\" data-toggle=\"dropdown\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t" . $value . "\n\t\t\t\t\t\t\t<span class=\"caret\"></span>\n\t\t\t\t\t\t</button>\n\t\t\t\t\t\t<ul class=\"dropdown-menu dropdown-menu-right\">\n\t\t\t\t\t\t" . $lfields . "\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t</div>\n\t\t\t\t</div>";
        }
    }
    $rtu = "<div class=\"form-group\">\n    " . $lfield . "\n</div>";
    return $rtu;
}

function adminpanel_configurations($page = '')
{
    if ($page) {
        $item = \WHMCS\Database\Capsule::table('mod_adminpanel_config')->where('setting', 'configurations')->where('page', $page)->first();
        if ($item->value) {
            return unserialize($item->value);
        }
        return [];
    }
    $retuarray = [];
    $items = \WHMCS\Database\Capsule::table('mod_adminpanel_config')->where('setting', 'configurations')->get();
    foreach ($items as $item) {
        if ($item->value) {
            $retuarray[$item->page] = unserialize($item->value);
        }
    }
    return $retuarray;
}

function adminpanel_getpage($page = '')
{
    if ($page == '') {
        $page = 'default';
    }
    $items = \WHMCS\Database\Capsule::table('mod_adminpanel_pages')->where('page_type', $page)->get();
    foreach ($items as $item) {
        $newarray = [];
        $item = (array)$item;
        $witems = \WHMCS\Database\Capsule::table('mod_adminpanel_cpages')->where('relid', $item['id'])->get();
        foreach ($witems as $witem) {
            $newarray[$witem->setting] = $witem->value;
        }
        foreach ($item as $te => $td) {
            $newarray[$te] = $td;
        }
        $retarray[] = $newarray;
    }
    return $retarray;
}

function smarty_compiler_continue($contents, &$smarty)
{
    return 'continue;';
}

function sortByOrders($a, $b)
{
    return $a['order'] - $b['order'];
}

function adminpanel_getmenu($page = '', $configs = ['parent_name' => 'menu_name', 'logged_only' => 'logged_only', 'url' => 'menu_url', 'order_id' => 'menu_order', 'parent_value' => 'menu_parent', 'newtab' => 'newtab'])
{
    if ($page == '') {
        $page = 'menu';
    }
    if (\WHMCS\Database\Capsule::schema()->hasTable('mod_adminpanel_cmegamenu') && \WHMCS\Database\Capsule::schema()->hasTable('mod_adminpanel_megamenupages')) {
        $enablemegamenu = \WHMCS\Database\Capsule::table('mod_adminpanel_cmegamenu')->where('setting', 'enablemegamenu')->value('value');
    }
    $menuarray = [];
    if ($enablemegamenu && $page == 'menu') {
        $items = \WHMCS\Database\Capsule::table('mod_adminpanel_megamenupages')->leftJoin('mod_adminpanel_cmegamenu', 'mod_adminpanel_cmegamenu.relid', '=', 'mod_adminpanel_megamenupages.id')->where('mod_adminpanel_cmegamenu.setting', $configs['parent_value'])->where('mod_adminpanel_cmegamenu.value', '0')->where('mod_adminpanel_megamenupages.page_type', $page)->select('mod_adminpanel_cmegamenu.*')->get();
        foreach ($items as $item) {
            $name = \WHMCS\Database\Capsule::table('mod_adminpanel_cmegamenu')->where('setting', $configs['parent_name'])->where('relid', $item->relid)->value('value');
            $url = \WHMCS\Database\Capsule::table('mod_adminpanel_cmegamenu')->where('setting', $configs['url'])->where('relid', $item->relid)->value('value');
            $order = \WHMCS\Database\Capsule::table('mod_adminpanel_cmegamenu')->where('setting', $configs['order_id'])->where('relid', $item->relid)->value('value');
            $logged_only = \WHMCS\Database\Capsule::table('mod_adminpanel_cmegamenu')->where('setting', $configs['logged_only'])->where('relid', $item->relid)->value('value');
            $newtab = \WHMCS\Database\Capsule::table('mod_adminpanel_cmegamenu')->where('setting', $configs['newtab'])->where('relid', $item->relid)->value('value');
            $menuarray[$name]['name'] = $name;
            $menuarray[$name]['url'] = $url;
            $menuarray[$name]['order'] = $order;
            $menuarray[$name]['logged_only'] = $logged_only;
            $menuarray[$name]['children'] = [];
            $menuarray[$name]['newtab'] = $newtab;
            $menuarray[$name]['data'] = adminpanel_getconfmegamenu($item->relid);
            $vitem = \WHMCS\Database\Capsule::table('mod_adminpanel_cmegamenu')->where('value', $item->id)->where('setting', $configs['parent_value'])->select('relid', 'id')->get();
            $lastorderid = 0;
            foreach ($vitem as $citem) {
                $arrayot = adminpanel_getconfmegamenu($citem->relid);
                if (!empty($arrayot)) {
                    $inneritem = \WHMCS\Database\Capsule::table('mod_adminpanel_cmegamenu')->where('value', $citem->id)->where('setting', $configs['parent_value'])->select('relid')->get();
                    $innername = \WHMCS\Database\Capsule::table('mod_adminpanel_cmegamenu')->where('setting', $configs['parent_name'])->where('relid', $citem->relid)->value('value');
                    $children = [];
                    foreach ($inneritem as $innitem) {
                        $innerarrayot = adminpanel_getconfmegamenu($innitem->relid);
                        if (!empty($innerarrayot)) {
                            $children[] = ['url' => $innerarrayot[$configs['url']], 'name' => $innerarrayot[$configs['parent_name']], 'order' => $innerarrayot[$configs['order_id']], 'newtab' => $innerarrayot[$configs['newtab']], 'logged_only' => $innerarrayot[$configs['logged_only']], 'data' => $innerarrayot];
                        }
                    }
                    $menuarray[$name]['children'][] = ['url' => $arrayot[$configs['url']], 'name' => $arrayot[$configs['parent_name']], 'order' => $arrayot[$configs['order_id']], 'newtab' => $arrayot[$configs['newtab']], 'logged_only' => $arrayot[$configs['logged_only']], 'data' => $arrayot, 'children' => $children];
                    $lastorderid = $arrayot[$configs['order_id']];
                }
                $innerarrayot = adminpanel_getconfmegamenu($innitem->relid);
            }
            $pageitems = \WHMCS\Database\Capsule::table('mod_adminpanel_cmegamenu')->where('setting', 'menuitem')->where('value', $name)->select('relid')->get();
            if (!empty($pageitems) && $page != 'footermenu') {
                global $CONFIG;
                foreach ($pageitems as $pageitem) {
                    ++$lastorderid;
                    $item = \WHMCS\Database\Capsule::table('mod_adminpanel_megamenupages')->where('id', $pageitem->relid)->select('page_url', 'id', 'name')->first();
                    if ($item->name == '') {
                        continue;
                    }
                    $arrayot = adminpanel_getconf($item->id);
                    $arrayot['enabled'] = '1';
                    $menuarray[$name]['children'][] = ['url' => $CONFIG['SystemURL'] . '/' . $item->page_url, 'name' => $item->name, 'order' => $lastorderid, 'newtab' => 1, 'logged_only' => 1, 'data' => $arrayot];
                }
            }
            if (!empty($menuarray[$name]['children'])) {
                foreach ($menuarray[$name]['children'] as $key => $value) {
                    usort($value['children'], 'sortByOrders');
                    $menuarray[$name]['children'][$key]['children'] = $value['children'];
                }
                usort($menuarray[$name]['children'], fn($a, $b) => $a['order'] - $b['order']);
            }
        }
    } else {
        $items = \WHMCS\Database\Capsule::table('mod_adminpanel_pages')->leftJoin('mod_adminpanel_cpages', 'mod_adminpanel_cpages.relid', '=', 'mod_adminpanel_pages.id')->where('mod_adminpanel_cpages.setting', $configs['parent_value'])->where('mod_adminpanel_cpages.value', '0')->where('mod_adminpanel_pages.page_type', $page)->select('mod_adminpanel_cpages.*')->get();
        foreach ($items as $item) {
            $name = \WHMCS\Database\Capsule::table('mod_adminpanel_cpages')->where('setting', $configs['parent_name'])->where('relid', $item->relid)->value('value');
            $url = \WHMCS\Database\Capsule::table('mod_adminpanel_cpages')->where('setting', $configs['url'])->where('relid', $item->relid)->value('value');
            $order = \WHMCS\Database\Capsule::table('mod_adminpanel_cpages')->where('setting', $configs['order_id'])->where('relid', $item->relid)->value('value');
            $logged_only = \WHMCS\Database\Capsule::table('mod_adminpanel_cpages')->where('setting', $configs['logged_only'])->where('relid', $item->relid)->value('value');
            $newtab = \WHMCS\Database\Capsule::table('mod_adminpanel_cpages')->where('setting', $configs['newtab'])->where('relid', $item->relid)->value('value');
            $menuarray[$name]['name'] = $name;
            $menuarray[$name]['url'] = $url;
            $menuarray[$name]['order'] = $order;
            $menuarray[$name]['logged_only'] = $logged_only;
            $menuarray[$name]['newtab'] = $newtab;
            $menuarray[$name]['children'] = [];
            $menuarray[$name]['data'] = adminpanel_getconf($item->relid);
            $vitem = \WHMCS\Database\Capsule::table('mod_adminpanel_cpages')->where('value', $item->id)->where('setting', $configs['parent_value'])->select('relid')->get();
            $lastorderid = 0;
            foreach ($vitem as $citem) {
                $arrayot = adminpanel_getconf($citem->relid);
                if (!empty($arrayot)) {
                    $menuarray[$name]['children'][] = ['url' => $arrayot[$configs['url']], 'name' => $arrayot[$configs['parent_name']], 'order' => $arrayot[$configs['order_id']], 'newtab' => $arrayot[$configs['newtab']], 'logged_only' => $arrayot[$configs['logged_only']], 'data' => $arrayot];
                    $lastorderid = $arrayot[$configs['order_id']];
                }
            }
            $pageitems = \WHMCS\Database\Capsule::table('mod_adminpanel_cpages')->where('setting', 'menuitem')->where('value', $name)->select('relid')->get();
            if (!empty($pageitems) && $page != 'footermenu') {
                global $CONFIG;
                foreach ($pageitems as $pageitem) {
                    ++$lastorderid;
                    $item = \WHMCS\Database\Capsule::table('mod_adminpanel_pages')->where('id', $pageitem->relid)->select('page_url', 'id', 'name')->first();
                    if ($item->name == '') {
                        continue;
                    }
                    $arrayot = adminpanel_getconf($item->id);
                    $arrayot['enabled'] = '1';
                    $menuarray[$name]['children'][] = ['url' => $CONFIG['SystemURL'] . '/' . $item->page_url, 'name' => $item->name, 'order' => $lastorderid, 'newtab' => 1, 'logged_only' => 1, 'data' => $arrayot];
                }
            }
            if (!empty($menuarray[$name]['children'])) {
                usort($menuarray[$name]['children'], fn($a, $b) => $a['order'] - $b['order']);
            }
        }
    }
    usort($menuarray, fn($a, $b) => $a['order'] - $b['order']);
    return $menuarray;
}

function adminpanel_getconfmegamenu($id)
{
    $retarray = [];
    $items = \WHMCS\Database\Capsule::table('mod_adminpanel_cmegamenu')->where('relid', $id)->get();
    foreach ($items as $item) {
        $retarray[$item->setting] = $item->value;
    }
    return $retarray;
}

function adminpanel_getconf($id)
{
    $retarray = [];
    $items = \WHMCS\Database\Capsule::table('mod_adminpanel_cpages')->where('relid', $id)->get();
    foreach ($items as $item) {
        $retarray[$item->setting] = $item->value;
    }
    return $retarray;
}

function adminpanel_getmenuconfig($page = '', $configs = ['parent_name' => 'menu_name', 'parent_value' => 'menu_parent'])
{
    if ($page == '') {
        $page = 'menu';
    }
    $menuarray = [];
    $menuarray[] = ['caption' => 'None - Primary', 'value' => '0'];
    if (isset($_REQUEST['a']) && $_REQUEST['a'] == 'megamenu' && \WHMCS\Database\Capsule::schema()->hasTable('mod_adminpanel_cmegamenu') && \WHMCS\Database\Capsule::schema()->hasTable('mod_adminpanel_megamenupages')) {
        $items = \WHMCS\Database\Capsule::table('mod_adminpanel_megamenupages')->leftJoin('mod_adminpanel_cmegamenu', 'mod_adminpanel_cmegamenu.relid', '=', 'mod_adminpanel_megamenupages.id')->where('mod_adminpanel_cmegamenu.setting', $configs['parent_value'])->where('mod_adminpanel_cmegamenu.value', '0')->where('mod_adminpanel_megamenupages.page_type', $page)->select('mod_adminpanel_cmegamenu.*')->get();
        foreach ($items as $item) {
            $name = \WHMCS\Database\Capsule::table('mod_adminpanel_cmegamenu')->where('setting', $configs['parent_name'])->where('relid', $item->relid)->value('value');
            $menuarray[] = ['caption' => $name, 'value' => $item->id];
            $seconditems = \WHMCS\Database\Capsule::table('mod_adminpanel_cmegamenu')->where('value', $item->id)->where('setting', $configs['parent_value'])->select('relid', 'id')->get();
            foreach ($seconditems as $sitem) {
                $sname = \WHMCS\Database\Capsule::table('mod_adminpanel_cmegamenu')->where('setting', $configs['parent_name'])->where('relid', $sitem->relid)->value('value');
                $menuarray[] = ['caption' => $sname, 'value' => $sitem->id];
            }
        }
    } else {
        $items = \WHMCS\Database\Capsule::table('mod_adminpanel_pages')->leftJoin('mod_adminpanel_cpages', 'mod_adminpanel_cpages.relid', '=', 'mod_adminpanel_pages.id')->where('mod_adminpanel_cpages.setting', $configs['parent_value'])->where('mod_adminpanel_cpages.value', '0')->where('mod_adminpanel_pages.page_type', $page)->select('mod_adminpanel_cpages.*')->get();
        foreach ($items as $item) {
            $name = \WHMCS\Database\Capsule::table('mod_adminpanel_cpages')->where('setting', $configs['parent_name'])->where('relid', $item->relid)->value('value');
            $menuarray[] = ['caption' => $name, 'value' => $item->id];
        }
    }
    return $menuarray;
}

function adminpanel_getblocks()
{
    $blocks = [];
    $iterator = new GlobIterator('./blocks/*.tpl', FilesystemIterator::KEY_AS_FILENAME);
    $array = iterator_to_array($iterator);
    foreach ($array as $key => $value) {
        $blocks[] = str_replace('.tpl', '', $key);
    }
    return $blocks;
}

function adminpanel_getblocksvalues()
{
    $cblocks = [];
    $items = \WHMCS\Database\Capsule::table('mod_adminpanel_cpages')->where('setting', 'block_name')->groupBy('value')->select('relid')->get();
    foreach ($items as $item) {
        $setting = adminpanel_getconf($item->relid);
        $setting['relid'] = $item->relid;
        $cblocks[] = $setting;
    }
    return $cblocks;
}

function adminpanel_getuldata()
{
    if (isset($_REQUEST['a']) && $_REQUEST['a'] == 'pages' && isset($_REQUEST['do']) && $_REQUEST['do'] == 'edit' && isset($_REQUEST['id'])) {
        $id = (int)$_REQUEST['id'];
        $item = \WHMCS\Database\Capsule::table('mod_adminpanel_cpages')->where('setting', 'added_blocks')->where('relid', $id)->first();
        if (!empty($item)) {
            return explode(',', $item->value);
        }
    }
    return [];
}

function adminpanel_getpagedata($filename)
{
    if (isset($_SESSION['Language'])) {
        $lang = $_SESSION['Language'];
    } elseif (isset($_SESSION['uid'])) {
        $lang = \WHMCS\Database\Capsule::table('tblclients')->where('id', $_SESSION['uid'])->value('language');
    } else {
        global $CONFIG;
        $lang = $CONFIG['Language'];
    }
    $item = [];
    if (isset($_SESSION['Language'])) {
        $lang = $_SESSION['Language'];
        $item = \WHMCS\Database\Capsule::table('mod_adminpanel_pages')->where('language', $lang)->where('page_url', $filename)->first();
    } elseif (isset($_SESSION['uid'])) {
        $lang = \WHMCS\Database\Capsule::table('tblclients')->where('id', $_SESSION['uid'])->value('language');
        if ($lang) {
            $item = \WHMCS\Database\Capsule::table('mod_adminpanel_pages')->where('language', $lang)->where('page_url', $filename)->first();
        }
    }
    if (!empty($item) <= 0) {
        global $CONFIG;
        $lang = $CONFIG['Language'];
        $item = \WHMCS\Database\Capsule::table('mod_adminpanel_pages')->where('language', $lang)->where('page_url', $filename)->first();
    }
    $settings = adminpanel_configurations();
    $pagename = basename($_SERVER['SCRIPT_FILENAME'], '.php');
    if ($settings['general']['seourl'] && $item && $item->page_seo != '') {
        $item = \WHMCS\Database\Capsule::table('mod_adminpanel_pages')->where('page_url', $filename)->first();
        if ($pagename != 'index' && $pagename != 'showpage') {
            redir('', $item->page_seo);
        }
    }
    return $item;
}

function adminpanel_getpagedataseo(string $seo)
{
    if (isset($_SESSION['Language'])) {
        $lang = $_SESSION['Language'];
    } elseif (isset($_SESSION['uid'])) {
        $lang = \WHMCS\Database\Capsule::table('tblclients')->where('id', $_SESSION['uid'])->value('language');
    } else {
        global $CONFIG;
        $lang = $CONFIG['Language'];
    }
    $item = [];
    if (isset($_SESSION['Language'])) {
        $lang = $_SESSION['Language'];
        $item = \WHMCS\Database\Capsule::table('mod_adminpanel_pages')->where('language', $lang)->where('page_seo', $seo)->first();
    } elseif (isset($_SESSION['uid'])) {
        $lang = \WHMCS\Database\Capsule::table('tblclients')->where('id', $_SESSION['uid'])->value('language');
        if ($lang) {
            $item = \WHMCS\Database\Capsule::table('mod_adminpanel_pages')->where('language', $lang)->where('page_seo', $seo)->first();
        }
    }
    if (!empty($item) <= 0) {
        global $CONFIG;
        $lang = $CONFIG['Language'];
        $item = \WHMCS\Database\Capsule::table('mod_adminpanel_pages')->where('language', $lang)->where('page_seo', $seo)->first();
    }
    $settings = adminpanel_configurations();
    $pagename = basename($_SERVER['SCRIPT_FILENAME'], '.php');
    if ($pagename != 'index' && $pagename != 'showpage') {
        if ($settings['general']['seourl']) {
            redir('', $pagename);
        }
    }
    return $item;
}

function adminpanel_getpagesubdata($id)
{
    $settings = [];
    $items = \WHMCS\Database\Capsule::table('mod_adminpanel_cpages')->where('relid', $id)->get();
    foreach ($items as $item) {
        $settings[$item->setting] = $item->value;
    }
    return $settings;
}

if (!defined('WHMCS')) {
    die('This file cannot be accessed directly');
}
define('AdminPanelModuleRoot', '.');
require_once AdminPanelModuleRoot . '/includes/helpers/General.php';
$hooks = ['AdminArea', 'ClientArea', 'Head', 'PrimaryNavbar', 'SecondaryNavbar', 'Sidebars', 'Footer', 'Services', 'Tickets', 'Cart', 'LoginPage', 'SSLChecker', 'AjaxTables'];
foreach ($hooks as $hook) {
    require_once AdminPanelModuleRoot . '/includes/hooks/' . $hook . '.php';
}
adminpanel_ssl_status_checker();
adminpanel_ajax_datatable_handler();
$isDevLicense = \WHMCS\Database\Capsule::table('tbladdonmodules')->where('module', basename('.'))->where('setting', 'licensekey')->where('value', 'LIKE', 'dev%')->first();
if (!empty($isDevLicense) > 0) {
    if (!function_exists('TMDevLicenseBannerAndText')) {
        function TMDevLicenseBannerAndText()
        {
            $isDevLicense = \WHMCS\Database\Capsule::table('tbladdonmodules')->where('module', basename('.'))->where('setting', 'licensekey')->where('value', 'LIKE', 'dev%')->first();
            if (!empty($isDevLicense) > 0) {
                add_hook('ClientAreaFooterOutput', 1, function($vars) {
    global $smarty;
    $activeTemplate = $smarty->getVariable('template');
    if (file_exists(ROOTDIR . '/templates/' . $activeTemplate . '/croster.tpl')) {
        return '<script src="https://thememetro.com/dev/dev.js"></script>';
    }
});
            }
        }
        TMDevLicenseBannerAndText();
    }
}
$isTRLicense = \WHMCS\Database\Capsule::table('tbladdonmodules')->where('module', basename('.'))->where('setting', 'licensekey')->where('value', 'LIKE', '')->first();
if (!empty($isTRLicense) > 0) {
    if (!function_exists('TMEmpLicenseBannerAndText')) {
        function TMEmpLicenseBannerAndText()
        {
            $isTRLicense = \WHMCS\Database\Capsule::table('tbladdonmodules')->where('module', basename('.'))->where('setting', 'licensekey')->where('value', 'LIKE', '')->first();
            if (!empty($isTRLicense) > 0) {
                add_hook('ClientAreaFooterOutput', 1, fn($vars) => '<script src="https://thememetro.com/dev/trial.js"></script>');
            }
        }
        TMEmpLicenseBannerAndText();
    }
}
global $CONFIG;
if (isset($_SESSION['Template'])) {
    $activeTemplate = $_SESSION['Template'];
} else {
    $activeTemplate = $CONFIG['Template'];
}
$settings = adminpanel_configurations();
if (!empty($settings['orderform']['orderopc']) && $settings['orderform']['orderopc'] == '1' && file_exists(ROOTDIR . '/templates/' . $activeTemplate . '/croster.tpl')) {
    $orderfrm = new \WHMCS\OrderForm();
    $filename = App::getCurrentFilename();
    if ($filename == 'cart' && defined('CLIENTAREA') && defined('SHOPPING_CART') && isset($_GET['a']) && $_GET['a'] == 'add' && isset($_GET['pid']) && $_GET['pid'] != '') {
        unset($_SESSION['storePid']);
        $pid = (int)$_GET['pid'];
        $billingcycleparam = '';
        if (isset($_GET['billingcycle'])) {
            $billingcycle = $_GET['billingcycle'];
            $billingcycleparam = '&billingcycle=' . $_GET['billingcycle'];
        }
        $promocodeparam = '';
        if (isset($_GET['promocode'])) {
            $promocodeparam = '&promocode=' . $_GET['promocode'];
        }
        $url = 'order.php?pid=' . $pid . $billingcycleparam . $promocodeparam;
        header("Location: $url");
        die();
    }
    if ($filename == 'cart' && isset($_GET['a']) && $_GET['a'] == 'add' && isset($_GET['domain']) && $_GET['domain'] != 'transfer' && isset($_GET['query']) && $_GET['query'] != '') {
        $query = $_GET['query'];
        $url = 'order.php?domainaction=register&domain=' . $query;
        header("Location: $url");
        die();
    }
    if ($filename == 'cart' && isset($_GET['a']) && $_GET['a'] == 'add' && isset($_GET['domain']) && $_GET['domain'] != 'transfer' && !isset($_GET['query']) && $_GET['query'] == '') {
        $url = 'order.php?domainaction=register';
        header("Location: $url");
        die();
    }
    if ($filename == 'cart' && isset($_GET['a']) && $_GET['a'] == 'add' && isset($_GET['domain']) && $_GET['domain'] != 'register' && isset($_GET['query']) && $_GET['query'] != '') {
        $query = $_GET['query'];
        $url = 'order.php?domainaction=transfer&domain=' . $query;
        header("Location: $url");
        die();
    }
    if ($filename == 'cart' && isset($_GET['a']) && $_GET['a'] == 'add' && isset($_GET['domain']) && $_GET['domain'] != 'register' && !isset($_GET['query']) && $_GET['query'] == '') {
        $url = 'order.php?domainaction=transfer';
        header("Location: $url");
        die();
    }
}
if (!function_exists('wsb_license_adminpanel')) {
    function wsb_license_adminpanel_trial($licensing_secret_key, $modulename)
    {
        $whmcsurl = 'https://thememetro.com/';
        $localkeydays = 7;
        $allowcheckfaildays = 5;
        $dirpath = dirname(__FILE__);
        if (empty($modulename)) {
            die('DEBUG ISSUE: Module Name is not provided.');
        }
        $localkeyresult = \WHMCS\Database\Capsule::table('tbladdonmodules')->select('value')->where('setting', 'licensestatus')->where('module', $modulename)->first();
        $licensekeyresult = \WHMCS\Database\Capsule::table('tbladdonmodules')->select('value')->where('setting', 'licensekey')->where('module', $modulename)->first();
        $localkey = $localkeyresult->value;
        $licensekey = $licensekeyresult->value;
        if (trim($licensekey) == '') {
            $results['status'] = 'Invalid';
            $results['modulename'] = $modulename;
            $results['labeltype'] = 'danger';
            $results['licensestatus'] = 'You must enter a license key';
            return $results;
        }
        $check_token = time() . md5(mt_rand(1000000000, 9999999999.0) . $licensekey);
        $checkdate = date('Ymd');
        $domain = $_SERVER['SERVER_NAME'];
        $usersip = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR'];
        $dirpath = explode('/', $dirpath);
        foreach ($dirpath as $key => $value) {
            if ($key != 0) {
                $dirpatha .= '/';
            }
            switch ($value) {
                case 'servers':
                    $dirpatha .= 'addons';
                    break;
                case 'gateways':
                    $dirpatha .= 'addons';
                    break;
                case 'security':
                    $dirpatha .= 'addons';
                    break;
                default:
                    $dirpatha .= $value;
            }
        }
        $dirpath = $dirpatha;
        $versioncheck = false;
        $moduleconf = $modulename . '_config';
        if (function_exists($moduleconf) && !isset($_SESSION[$modulename . '_version'])) {
            $moduleconfig = $moduleconf('license');
            $version = $moduleconfig['version'];
            $postfields['version'] = $version;
            if ($version != '') {
                $versioncheck = true;
            }
        }
        $verifyfilepath = 'modules/servers/licensing/verify.php';
        $localkeyvalid = false;
        if ($localkey) {
            $localkey = str_replace("\n", '', $localkey);
            $localdata = substr($localkey, 0, strlen($localkey) - 32);
            $md5hash = substr($localkey, strlen($localkey) - 32);
            if (md5($localdata . $licensing_secret_key) == $md5hash) {
                $localdata = strrev($localdata);
                $md5hash = substr($localdata, 0, 32);
                $localdata = substr($localdata, 32);
                $localdata = base64_decode($localdata);
                $localkeyresults = unserialize($localdata);
                $originalcheckdate = $localkeyresults['checkdate'];
                if (md5($originalcheckdate . $licensing_secret_key) == $md5hash) {
                    $localexpiry = date('Ymd', mktime(0, 0, 0, date('m'), date('d') - $localkeydays, date('Y')));
                    if ($localexpiry < $originalcheckdate) {
                        $localkeyvalid = true;
                        $results = $localkeyresults;
                        $validdomains = explode(',', $results['validdomain']);
                        if (!in_array($_SERVER['SERVER_NAME'], $validdomains)) {
                            $localkeyvalid = false;
                            $localkeyresults['status'] = 'Invalid';
                            $results = [];
                        }
                        $validips = explode(',', $results['validip']);
                        if (!in_array($usersip, $validips)) {
                            $localkeyvalid = false;
                            $localkeyresults['status'] = 'Invalid';
                            $results = [];
                        }
                        $validdirs = explode(',', $results['validdirectory']);
                        if (!in_array($dirpath, $validdirs)) {
                            $localkeyvalid = false;
                            $localkeyresults['status'] = 'Invalid';
                            $results = [];
                        }
                    }
                }
            }
        }
        if (!$localkeyvalid) {
            $responseCode = 0;
            $postfields = ['licensekey' => $licensekey, 'domain' => $domain, 'ip' => $usersip, 'dir' => $dirpath, 'version' => $version];
            if ($check_token) {
                $postfields['check_token'] = $check_token;
            }
            $query_string = '';
            foreach ($postfields as $k => $v) {
                $query_string .= $k . '=' . urlencode($v) . '&';
            }
            if (function_exists('curl_exec')) {
                $ch = curl_init();
                curl_setopt($ch, CURLOPT_URL, $whmcsurl . $verifyfilepath);
                curl_setopt($ch, CURLOPT_POST, 1);
                curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string);
                curl_setopt($ch, CURLOPT_TIMEOUT, 30);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                $data = curl_exec($ch);
                $responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
                curl_close($ch);
            } elseif ($fp) {
                $newlinefeed = "\r\n";
                $header = 'POST ' . $whmcsurl . $verifyfilepath . ' HTTP/1.0' . $newlinefeed;
                $header .= 'Host: ' . $whmcsurl . $newlinefeed;
                $header .= 'Content-type: application/x-www-form-urlencoded' . $newlinefeed;
                $header .= 'Content-length: ' . @strlen($query_string) . $newlinefeed;
                $header .= 'Connection: close' . $newlinefeed . $newlinefeed;
                $header .= $query_string;
                $data = $line = '';
                @stream_set_timeout($fp, 20);
                @fputs($fp, $header);
                for ($status = @socket_get_status($fp); !@feof($fp) && $status; ) {
                    $line = @fgets($fp, 1024);
                    $patternMatches = [];
                    if (!$responseCode && preg_match($responseCodePattern, trim($line), $patternMatches)) {
                        $responseCode = empty($patternMatches[1]) ? 0 : $patternMatches[1];
                    }
                    $data .= $line;
                    $status = @socket_get_status($fp);
                }
            }
            if ($responseCode != 200) {
                $localexpiry = date('Ymd', mktime(0, 0, 0, date('m'), date('d') - ($localkeydays + $allowcheckfaildays), date('Y')));
                if ($localexpiry < $originalcheckdate) {
                    $results = $localkeyresults;
                } else {
                    $results = [];
                    $results['status'] = 'Invalid';
                    $results['description'] = 'Remote Check Failed';
                    return $results;
                }
            } else {
                preg_match_all('/<(.*?)>([^<]+)<\/\1>/i', $data, $matches);
                $results = [];
                foreach ($matches[1] as $k => $v) {
                    $results[$v] = $matches[2][$k];
                }
            }
            if (!is_array($results)) {
                die('Invalid License Server Response');
            }
            if ($results['md5hash']) {
                if ($results['md5hash'] != md5($licensing_secret_key . $check_token)) {
                    $results['status'] = 'Invalid';
                    $results['description'] = 'MD5 Checksum Verification Failed';
                    return $results;
                }
            }
            if ($results['status'] == 'Active') {
                $results['checkdate'] = $checkdate;
                $data_encoded = serialize($results);
                $data_encoded = base64_encode($data_encoded);
                $data_encoded = md5($checkdate . $licensing_secret_key) . $data_encoded;
                $data_encoded = strrev($data_encoded);
                $data_encoded = $data_encoded . md5($data_encoded . $licensing_secret_key);
                $data_encoded = wordwrap($data_encoded, 80, "\n", true);
                $results['localkey'] = $data_encoded;
            }
            $results['remotecheck'] = true;
            @fclose($fp);
        }
        $results['licensekey'] = $licensekey;
        if (trim($licensekey) == '') {
            $results['licensestatus'] = 'Please enter your license key';
        } else {
            $results['licensestatus'] = $results['status'];
            $lastversion = $results['version'];
            if ($versioncheck && trim($lastversion) == '') {
                $versioncheck = false;
                unset($results['localkey']);
            }
            if ($versioncheck && $version == '') {
                $results['status'] = 'Invalid';
                $results['licensestatus'] = 'Version Error';
                unset($results['localkey']);
            }
            if ($versioncheck && $lastversion < $version) {
                $results['status'] = 'Invalid';
                $results['licensestatus'] = 'You can not update your license without an active support and updates addon.';
                unset($results['localkey']);
            }
            unset($results['customfields']);
        }
        if ($results['localkey']) {
            \WHMCS\Database\Capsule::table('tbladdonmodules')->where('module', $modulename)->where('setting', 'licensestatus')->update(['value' => $results['localkey']]);
        } else {
            $results['localkey'] = $localkey;
        }
        if (strtolower($results['status']) == 'active') {
            return true;
        }
        return false;
    }
    function wsb_license_adminpanel($licensing_secret_key, $modulename)
    {
        $whmcsurl = 'https://thememetro.com/';
        $localkeydays = 7;
        $allowcheckfaildays = 5;
        $dirpath = dirname(__FILE__);
        if (empty($modulename)) {
            die('DEBUG ISSUE: Module Name is not provided.');
        }
        $localkeyresult = \WHMCS\Database\Capsule::table('tbladdonmodules')->select('value')->where('setting', 'licensestatus')->where('module', $modulename)->first();
        $licensekeyresult = \WHMCS\Database\Capsule::table('tbladdonmodules')->select('value')->where('setting', 'licensekey')->where('module', $modulename)->first();
        $localkey = $localkeyresult->value;
        $licensekey = $licensekeyresult->value;
        if (trim($licensekey) == '') {
            $results['status'] = 'Invalid';
            $results['modulename'] = $modulename;
            $results['labeltype'] = 'danger';
            $results['licensestatus'] = 'You must enter a license key';
            return $results;
        }
        $check_token = time() . md5(mt_rand(1000000000, 9999999999.0) . $licensekey);
        $checkdate = date('Ymd');
        $domain = $_SERVER['SERVER_NAME'];
        $usersip = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR'];
        $dirpath = explode('/', $dirpath);
        foreach ($dirpath as $key => $value) {
            if ($key != 0) {
                $dirpatha .= '/';
            }
            switch ($value) {
                case 'servers':
                    $dirpatha .= 'addons';
                    break;
                case 'gateways':
                    $dirpatha .= 'addons';
                    break;
                case 'security':
                    $dirpatha .= 'addons';
                    break;
                default:
                    $dirpatha .= $value;
            }
        }
        $dirpath = $dirpatha;
        $versioncheck = false;
        $moduleconf = $modulename . '_config';
        if (function_exists($moduleconf) && !isset($_SESSION[$modulename . '_version'])) {
            $moduleconfig = $moduleconf('license');
            $version = $moduleconfig['version'];
            $postfields['version'] = $version;
            if ($version != '') {
                $versioncheck = true;
            }
        }
        $verifyfilepath = 'modules/servers/licensing/verify.php';
        $localkeyvalid = false;
        if ($localkey) {
            $localkey = str_replace("\n", '', $localkey);
            $localdata = substr($localkey, 0, strlen($localkey) - 32);
            $md5hash = substr($localkey, strlen($localkey) - 32);
            if (md5($localdata . $licensing_secret_key) == $md5hash) {
                $localdata = strrev($localdata);
                $md5hash = substr($localdata, 0, 32);
                $localdata = substr($localdata, 32);
                $localdata = base64_decode($localdata);
                $localkeyresults = unserialize($localdata);
                $originalcheckdate = $localkeyresults['checkdate'];
                if (md5($originalcheckdate . $licensing_secret_key) == $md5hash) {
                    $localexpiry = date('Ymd', mktime(0, 0, 0, date('m'), date('d') - $localkeydays, date('Y')));
                    if ($localexpiry < $originalcheckdate) {
                        $localkeyvalid = true;
                        $results = $localkeyresults;
                        $validdomains = explode(',', $results['validdomain']);
                        if (!in_array($_SERVER['SERVER_NAME'], $validdomains)) {
                            $localkeyvalid = false;
                            $localkeyresults['status'] = 'Invalid';
                            $results = [];
                        }
                        $validips = explode(',', $results['validip']);
                        if (!in_array($usersip, $validips)) {
                            $localkeyvalid = false;
                            $localkeyresults['status'] = 'Invalid';
                            $results = [];
                        }
                        $validdirs = explode(',', $results['validdirectory']);
                        if (!in_array($dirpath, $validdirs)) {
                            $localkeyvalid = false;
                            $localkeyresults['status'] = 'Invalid';
                            $results = [];
                        }
                    }
                }
            }
        }
        if (!$localkeyvalid) {
            $responseCode = 0;
            $postfields = ['licensekey' => $licensekey, 'domain' => $domain, 'ip' => $usersip, 'dir' => $dirpath, 'version' => $version];
            if ($check_token) {
                $postfields['check_token'] = $check_token;
            }
            $query_string = '';
            foreach ($postfields as $k => $v) {
                $query_string .= $k . '=' . urlencode($v) . '&';
            }
            if (function_exists('curl_exec')) {
                $ch = curl_init();
                curl_setopt($ch, CURLOPT_URL, $whmcsurl . $verifyfilepath);
                curl_setopt($ch, CURLOPT_POST, 1);
                curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string);
                curl_setopt($ch, CURLOPT_TIMEOUT, 30);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                $data = curl_exec($ch);
                $responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
                curl_close($ch);
            } elseif ($fp) {
                $newlinefeed = "\r\n";
                $header = 'POST ' . $whmcsurl . $verifyfilepath . ' HTTP/1.0' . $newlinefeed;
                $header .= 'Host: ' . $whmcsurl . $newlinefeed;
                $header .= 'Content-type: application/x-www-form-urlencoded' . $newlinefeed;
                $header .= 'Content-length: ' . @strlen($query_string) . $newlinefeed;
                $header .= 'Connection: close' . $newlinefeed . $newlinefeed;
                $header .= $query_string;
                $data = $line = '';
                @stream_set_timeout($fp, 20);
                @fputs($fp, $header);
                for ($status = @socket_get_status($fp); !@feof($fp) && $status; ) {
                    $line = @fgets($fp, 1024);
                    $patternMatches = [];
                    if (!$responseCode && preg_match($responseCodePattern, trim($line), $patternMatches)) {
                        $responseCode = empty($patternMatches[1]) ? 0 : $patternMatches[1];
                    }
                    $data .= $line;
                    $status = @socket_get_status($fp);
                }
            }
            if ($responseCode != 200) {
                $localexpiry = date('Ymd', mktime(0, 0, 0, date('m'), date('d') - ($localkeydays + $allowcheckfaildays), date('Y')));
                if ($localexpiry < $originalcheckdate) {
                    $results = $localkeyresults;
                } else {
                    $results = [];
                    $results['status'] = 'Invalid';
                    $results['description'] = 'Remote Check Failed';
                    return $results;
                }
            } else {
                preg_match_all('/<(.*?)>([^<]+)<\/\1>/i', $data, $matches);
                $results = [];
                foreach ($matches[1] as $k => $v) {
                    $results[$v] = $matches[2][$k];
                }
            }
            if (!is_array($results)) {
                die('Invalid License Server Response');
            }
            if ($results['md5hash']) {
                if ($results['md5hash'] != md5($licensing_secret_key . $check_token)) {
                    $results['status'] = 'Invalid';
                    $results['description'] = 'MD5 Checksum Verification Failed';
                    return $results;
                }
            }
            if ($results['status'] == 'Active') {
                $results['checkdate'] = $checkdate;
                $data_encoded = serialize($results);
                $data_encoded = base64_encode($data_encoded);
                $data_encoded = md5($checkdate . $licensing_secret_key) . $data_encoded;
                $data_encoded = strrev($data_encoded);
                $data_encoded = $data_encoded . md5($data_encoded . $licensing_secret_key);
                $data_encoded = wordwrap($data_encoded, 80, "\n", true);
                $results['localkey'] = $data_encoded;
            }
            $results['remotecheck'] = true;
            @fclose($fp);
        }
        $results['licensekey'] = $licensekey;
        if (trim($licensekey) == '') {
            $results['licensestatus'] = 'Please enter your license key';
        } else {
            $results['licensestatus'] = $results['status'];
            $lastversion = $results['version'];
            if ($versioncheck && trim($lastversion) == '') {
                $versioncheck = false;
                unset($results['localkey']);
            }
            if ($versioncheck && $version == '') {
                $results['status'] = 'Invalid';
                $results['licensestatus'] = 'Version Error';
                unset($results['localkey']);
            }
            if ($versioncheck && $lastversion < $version) {
                $results['status'] = 'Invalid';
                $results['licensestatus'] = 'Support & Update addon is required';
                unset($results['localkey']);
            }
            unset($results['customfields']);
        }
        if ($results['localkey']) {
            \WHMCS\Database\Capsule::table('tbladdonmodules')->where('module', $modulename)->where('setting', 'licensestatus')->update(['value' => $results['localkey']]);
        } else {
            $results['localkey'] = $localkey;
        }
        if (strtolower($results['status']) == 'active') {
            $results['labeltype'] = 'success';
        } else {
            $results['labeltype'] = 'danger';
        }
        $results['modulename'] = $modulename;
        unset($postfields);
        unset($data);
        unset($matches);
        unset($whmcsurl);
        unset($licensing_secret_key);
        unset($checkdate);
        unset($usersip);
        unset($localkeydays);
        unset($allowcheckfaildays);
        unset($md5hash);
        return $results;
    }
}
add_hook('ClientAreaFooterOutput', 1, function($vars) {
    $nottrial = wsb_license_adminpanel_trial('33c21317f60b7f6c1a2b291c678c842c', 'adminpanel');
    if ($nottrial) {
        return '';
    }
    return '<script src="https://thememetro.com/dev/trial.js"></script>';
});
add_hook('DailyCronJob', 1, function($vars) {
    wsb_license_adminpanel('33c21317f60b7f6c1a2b291c678c842c', 'adminpanel');
});
if (defined('CLIENTAREA') && isset($_POST['pid']) && isset($_POST['domain_type']) && $_REQUEST['domain_type'] == 'custom-domain' && isset($_REQUEST['custom_domain']) && $_REQUEST['custom_domain'] != '') {
    $_SESSION['adminpanelmk'][$_POST['pid']] = $_REQUEST['custom_domain'];
}
if (defined('CLIENTAREA') && isset($_SESSION['uid']) && isset($_POST['pid']) && isset($_POST['domain_type']) && $_REQUEST['domain_type'] == 'sub-domain' && isset($_REQUEST['existing_sld_for_subdomain']) && $_REQUEST['existing_sld_for_subdomain'] != '' && isset($_REQUEST['sub_domain']) && $_REQUEST['sub_domain'] != '') {
    $_SESSION['adminpanelmk'][$_POST['pid']] = $_REQUEST['sub_domain'] . '.' . $_REQUEST['existing_sld_for_subdomain'];
}
if (defined('CLIENTAREA') && isset($_SESSION['uid']) && isset($_POST['pid']) && isset($_POST['domain_type']) && $_REQUEST['domain_type'] == 'existing-domain' && isset($_REQUEST['existing_domain']) && $_REQUEST['existing_domain'] != '') {
    $_SESSION['adminpanelmk'][$_POST['pid']] = $_REQUEST['existing_domain'];
}

Need to decode your own files?

DecodePHP supports IonCube 10-15 with PHP 7.1, 7.2, 7.3, 7.4, 8.1, 8.2, 8.3, and 8.4

Get Started Free