use WHMCS\ClientArea; use WHMCS\Database\Capsule; define('CLIENTAREA', true); require __DIR__ . '/init.php'; $ca = new ClientArea(); $ca->setPageTitle('Wordpress Hosting'); $ca->addToBreadCrumb('index.php', Lang::trans('globalsystemname')); $ca->addToBreadCrumb('wordpresshosting.php', 'Wordpress Hosting'); $ca->initPage(); $pageName = basename($_SERVER['PHP_SELF']); $pageData = Capsule::table("mod_hostx_pages")->where('pageTitle',$pageName)->first(); $gid = $pageData->productGroup; function get_currency() { $clientCurrency = ''; if (isset($_SESSION['uid']) && !empty($_SESSION['uid'])) { $clientCurrency = Capsule::table('tblclients')->select('currency')->where('id', $_SESSION['uid'])->get(); } if (isset($clientCurrency) && !empty($clientCurrency) && $clientCurrency[0]->currency != '0') { $currency = Capsule::table('tblcurrencies')->where('id', $clientCurrency[0]->currency)->first(); } else if (isset($_SESSION['currency']) && !empty($_SESSION['currency'])) { $currency = Capsule::table('tblcurrencies')->where('id', $_SESSION['currency'])->first(); } else { $currency = Capsule::table('tblcurrencies')->where('default', '1')->first(); } return $currency; } if(!empty($gid)){ $command = 'GetProducts'; $postData = array('gid' => $gid); $adminUsername = ''; // Optional for WHMCS 7.2 and later $results = localAPI($command, $postData, $adminUsername); $currency = get_currency(); $currenciCode = $currency->code; $productsData = array(); foreach($results['products']['product'] as $pData){ $chkHidden = Capsule::table('tblproducts')->where('id', $pData['pid'])->where('hidden', 'on')->count(); if($chkHidden!='0'){ $pData['pricing'] = $pData['pricing'][$currenciCode]; $pData['pricing']['monthly'] = formatCurrency($pData['pricing']['monthly'],$currency->id)->toPrefixed(); $pData['pricing']['quarterly'] = formatCurrency($pData['pricing']['quarterly'],$currency->id)->toPrefixed(); $pData['pricing']['semiannually'] = formatCurrency($pData['pricing']['semiannually'],$currency->id)->toPrefixed(); $pData['pricing']['annually'] = formatCurrency($pData['pricing']['annually'],$currency->id)->toPrefixed(); $pData['pricing']['biennially'] = formatCurrency($pData['pricing']['biennially'],$currency->id)->toPrefixed(); $pData['pricing']['triennially'] = formatCurrency($pData['pricing']['triennially'],$currency->id)->toPrefixed(); $pDesc = Capsule::table('mod_hostx_page_products')->select('pHeadSortDesc','pDescription','pFootCaption','pFootSortDesc')->where('productId', $pData['pid'])->where('pageId', $pageData->id)->first(); if(!empty($pDesc)){ $pDesc = (array) $pDesc; }else{ require_once __DIR__ . '/modules/addons/hostx/defaultmenu.php'; $pDesc = $defaultPData; } $pDesc['pHeadSortDesc'] = html_entity_decode($pDesc['pHeadSortDesc']); $pDesc['pDescription'] = html_entity_decode($pDesc['pDescription']); $pDesc['pFootCaption'] = html_entity_decode($pDesc['pFootCaption']); $pDesc['pFootSortDesc'] = html_entity_decode($pDesc['pFootSortDesc']); $pData['customDescription'] = $pDesc; $productsData[] = $pData; } } } $ca->assign('productsData', $productsData); $ca->assign('sidebarHostxRemove', 'true'); # Define the template filename to be used without the .tpl extension $ca->setTemplate('hostx'); $ca->output();