function resellerclubresellerhostingus_ClientArea($params)
{
    if (isset($_POST['cplogin']) && strlen(trim($_POST['cplogin'])) > 0) {
        $cplogin_action = strtolower(trim($_POST['cplogin']));
        switch ($cplogin_action) {
            case 'webhost':
                _redirect_to_webhosting_control_panel($params);
                break;
            case 'mailhost':
                _redirect_to_mailhosting_control_panel($params);
                break;
            case 'dns':
                _redirect_to_dns_control_panel($params);
                break;
            case 'webmail':
                _redirect_to_webmail_control_panel($params);
                break;
            case 'whm':
                _redirect_to_whm_control_panel($params);
                break;
            case 'whmcs_license':
                resellerclubresellerhostingus_GenerateLicense($params);
                break;
        }
    }
    global $smarty;
    global $orderbox;
    try {
        $is_processing = false;
        $plan_pieces = _get_plan_details($params['configoption1']);
        if ('windows' == $plan_pieces['type']) {
            $api_path_orderid_from_domain = '/resellerhosting/windows/us/orderid.json';
            $api_path_order_details = '/resellerhosting/windows/us/details.json';
            $api_path_dns_details = '/resellerhosting/windows/us/dns-record.json';
        } else {
            $api_path_orderid_from_domain = '/resellerhosting/linux/us/orderid.json';
            $api_path_order_details = '/resellerhosting/linux/us/details.json';
            $api_path_dns_details = '/resellerhosting/linux/us/dns-record.json';
        }
        $order_id_result = $orderbox->api('GET', $api_path_orderid_from_domain, array('domain-name' => $params['domain']), $response, 'resellerclubresellerhostingus', 'clientarea');
        if (is_array($order_id_result) && array_key_exists('status', $order_id_result) && strtolower($order_id_result['status']) == 'error') {
            $is_processing = true;
        } else {
            $order_id = $order_id_result;
            $order_details = $orderbox->api('GET', $api_path_order_details, array('order-id' => $order_id), $response, 'resellerclubresellerhostingus', 'clientarea');
            $order_dns_details = $orderbox->api('GET', $api_path_dns_details, array('order-id' => $order_id), $response, 'resellerclubresellerhostingus', 'clientarea');
        }
        //        echo "<pre>";
        //        print_r($order_details);exit;
        $smarty->assign('is_processing', $is_processing);
        if ($is_processing) {
            $smarty->assign('rh_status', 'Processing...');
        } else {
            if ('windows' == $plan_pieces['type']) {
                $cp_url = 'http://' . $order_details['ipaddress'] . ':8880';
            } else {
                $cp_url = 'http://' . $order_details['ipaddress'] . '/cpanel';
                // check if whmcs addon is active for selected plan
                $plans = $orderbox->api('GET', '/products/plan-details.json', array(), $response, 'resellerclubresellerhostingus', 'clientarea');
            }
            $cp_url_href = "<a href=\"{$cp_url}\" target=\"_blank\">{$cp_url}</a>";
            $temp_url_href = "<a href=\"{$order_details['tempurl']}\" target=\"_blank\">{$order_details['tempurl']}</a>";
            $smarty->assign('rh_status', $order_details['currentstatus']);
            $smarty->assign('rh_webhosting_panel', _display_webhosting_panel_form());
            if ('linux' == $plan_pieces['type']) {
                $smarty->assign('rh_whm_panel', _display_whm_panel_form());
            }
            $smarty->assign('rh_mailhosting_panel', _display_mailhosting_panel_form());
            $smarty->assign('rh_dns_panel', _display_dns_panel_form());
            $smarty->assign('rh_webmail_panel', _display_webmail_panel_form());
            $smarty->assign('rh_temp_url', $temp_url_href);
            $smarty->assign('rh_cp_url', $cp_url_href);
            $smarty->assign('rh_cp_username', $order_details['siteadminusername']);
            $smarty->assign('rh_cp_password', $order_details['siteadminpassword']);
            $smarty->assign('rh_ip_address', $order_details['ipaddress']);
            if ($plans['resellerhosting'][$plan_pieces['id']]['includes_whmcs'] == true) {
                if ($order_details['licenseKey']) {
                    $smarty->assign('rh_whmcs_license_key', $order_details['licenseKey']);
                } else {
                    $smarty->assign('rh_whmcs_license_key', _display_whmcs_license_form());
                }
            } else {
                $smarty->assign('rh_whmcs_license_key', '');
            }
            $smarty->assign('rh_mailpop', $order_details['mailpop'] == '-1' ? 'Unlimited' : $order_details['mailpop']);
            $smarty->assign('rh_diskspace', $order_details['space'] == '-1' ? 'Unlimited' : $order_details['space']);
            $smarty->assign('rh_bandwidth', $order_details['bandwidth'] == '-1' ? 'Unlimited' : $order_details['bandwidth']);
            $smarty->assign('rh_allocated_mailspace', $order_details['mailspace'] == '-1' ? 'Unlimited' : $order_details['mailspace'] . " GB");
            $smarty->assign('nameservers', $order_details['ns_detail']);
            $smarty->assign('dns_details', $order_dns_details);
        }
    } catch (Exception $e) {
        return $e->getMessage();
    }
}
コード例 #2
0
function resellerclubresellerhosting_ClientArea($params)
{
    if (isset($_POST['cplogin']) && strlen(trim($_POST['cplogin'])) > 0) {
        $cplogin_action = strtolower(trim($_POST['cplogin']));
        switch ($cplogin_action) {
            case 'webhost':
                _redirect_to_webhosting_control_panel($params);
                break;
            case 'whm':
                _redirect_to_whm($params);
                break;
            case 'whmcs_license':
                resellerclubresellerhosting_GenerateLicense($params);
                break;
        }
    }
    global $smarty;
    global $orderbox;
    try {
        $is_processing = false;
        $plan_pieces = _get_plan_details($params['configoption1']);
        if ('windows' == $plan_pieces['type']) {
            $api_path = '/resellerhosting/windows/orderid.json';
        } else {
            $api_path = '/resellerhosting/orderid.json';
        }
        $order_id_result = $orderbox->api('GET', $api_path, array('domain-name' => $params['domain']), $response);
        if (is_array($order_id_result) && array_key_exists('status', $order_id_result) && strtolower($order_id_result['status']) == 'error') {
            $is_processing = true;
        } else {
            $order_id = $order_id_result;
            if ('windows' == $plan_pieces['type']) {
                $api_path = '/resellerhosting/windows/details.json';
            } else {
                $api_path = '/resellerhosting/details.json';
            }
            $order_details = $orderbox->api('GET', $api_path, array('order-id' => $order_id), $response);
            if (is_array($order_details) && array_key_exists('status', $order_details)) {
                $status = strtolower($order_details['status']);
                if ($status != 'success') {
                    $is_processing = true;
                }
            }
        }
        $smarty->assign('is_processing', $is_processing);
        if ($is_processing) {
            $smarty->assign('rh_status', 'Your order is being processed ...');
        } else {
            if ('windows' == $plan_pieces['type']) {
                $cp_url = 'http://' . $order_details['ipaddress'] . ':8880';
            } else {
                $cp_url = 'http://' . $order_details['ipaddress'] . '/cpanel';
            }
            $cp_url_href = "<a href=\"{$cp_url}\" target=\"_blank\">{$cp_url}</a>";
            $temp_url_href = "<a href=\"{$order_details['tempurl']}\" target=\"_blank\">{$order_details['tempurl']}</a>";
            $smarty->assign('rh_status', $order_details['currentstatus']);
            $smarty->assign('rh_webhosting_panel', _display_webhosting_panel_form());
            $smarty->assign('rh_whm_panel', _display_whm_form());
            $smarty->assign('rh_temp_url', $temp_url_href);
            $smarty->assign('rh_cp_url', $cp_url_href);
            $smarty->assign('rh_cp_username', $order_details['siteadminusername']);
            $smarty->assign('rh_cp_password', $order_details['siteadminpassword']);
            $smarty->assign('rh_ip_address', $order_details['ipaddress']);
            $plans = $orderbox->api('GET', '/products/plan-details.json');
            if ('windows' != $plan_pieces['type'] && $plans['resellerhosting'][$plan_pieces['id']]['includes_whmcs'] == '1') {
                if ($order_details['licenseKey']) {
                    $smarty->assign('rh_whmcs_license_key', $order_details['licenseKey']);
                } else {
                    $smarty->assign('rh_whmcs_license_key', _display_whmcs_license_form());
                }
            } else {
                $smarty->assign('rh_whmcs_license_key', '');
            }
            $smarty->assign('rh_dns_1', $order_details['ns_detail']['0']);
            $smarty->assign('rh_dns_2', $order_details['ns_detail']['1']);
            $smarty->assign('rh_diskspace', $order_details['space'] == '-1' ? 'Unlimited' : $order_details['space']);
            $smarty->assign('rh_bandwidth', $order_details['bandwidth'] == '-1' ? 'Unlimited' : $order_details['bandwidth']);
        }
    } catch (Exception $e) {
        return $e->getMessage();
    }
}