Esempio n. 1
0
function licensing_CreateAccount($params)
{
    if (!LICENSINGADDONLICENSE) {
        return "Your WHMCS license key is not enabled to use the Licensing Addon yet. Navigate to Addons > Licensing Manager to resolve.";
    }
    $result = select_query("mod_licensing", "COUNT(*)", array("serviceid" => $params['serviceid']));
    $data = mysql_fetch_array($result);
    if ($data[0]) {
        return "A license has already been generated for this item";
    }
    $length = $params['configoption1'];
    $prefix = $params['configoption2'];
    $licensekey = licensing_genkey($length, $prefix);
    insert_query("mod_licensing", array("serviceid" => $params['serviceid'], "licensekey" => $licensekey, "validdomain" => "", "validip" => "", "validdirectory" => "", "reissues" => "0", "status" => "Reissued"));
    updateService(array("domain" => $licensekey, "username" => "", "password" => ""));
    $addonid = explode("|", $params['configoption7']);
    $addonid = $addonid[0];
    if ($addonid) {
        $result = select_query("tblhosting", "orderid,paymentmethod", array("id" => $params['serviceid']));
        $data = mysql_fetch_array($result);
        $orderid = $data['orderid'];
        $paymentmethod = $data['paymentmethod'];
        $result = select_query("tbladdons", "", array("id" => $addonid));
        $data = mysql_fetch_array($result);
        $addonname = $data['name'];
        $result = select_query("tblpricing", "", array("relid" => $addonid, "type" => "addon", "currency" => $params['clientsdetails']['currency']));
        $data2 = mysql_fetch_array($result);
        $addonsetupfee = $data2['msetupfee'];
        $addonrecurring = $data2['monthly'];
        $addonbillingcycle = $data['billingcycle'];
        $addontax = $data['tax'];
        if ($addonbillingcycle == "Monthly") {
            $nextduedate = date("Y-m-d", mktime(0, 0, 0, date("m") + 1, date("d"), date("Y")));
        } else {
            if ($addonbillingcycle == "Quarterly") {
                $nextduedate = date("Y-m-d", mktime(0, 0, 0, date("m") + 3, date("d"), date("Y")));
            } else {
                if ($addonbillingcycle == "Semi-Annually") {
                    $nextduedate = date("Y-m-d", mktime(0, 0, 0, date("m") + 6, date("d"), date("Y")));
                } else {
                    if ($addonbillingcycle == "Annually") {
                        $nextduedate = date("Y-m-d", mktime(0, 0, 0, date("m") + 12, date("d"), date("Y")));
                    } else {
                        if ($addonbillingcycle == "Biennially") {
                            $nextduedate = date("Y-m-d", mktime(0, 0, 0, date("m") + 24, date("d"), date("Y")));
                        } else {
                            $nextduedate = "0000-00-00";
                        }
                    }
                }
            }
        }
        insert_query("tblhostingaddons", array("orderid" => $orderid, "hostingid" => $params['serviceid'], "addonid" => $addonid, "setupfee" => $addonsetupfee, "recurring" => $addonrecurring, "billingcycle" => $addonbillingcycle, "tax" => $addontax, "status" => "Active", "regdate" => "now()", "nextduedate" => $nextduedate, "nextinvoicedate" => $nextduedate, "paymentmethod" => $paymentmethod));
    }
    return "success";
}
Esempio n. 2
0
function enomtruste_CreateAccount($params)
{
    updateService(array("username" => "", "password" => ""));
    $withseal = $params['configoption3'];
    $numyears = $params['configoption4'];
    $result = select_query("tblhosting", "billingcycle", array("id" => $params['serviceid']));
    $data = mysql_fetch_array($result);
    $billingcycle = $data[0];
    if ($billingcycle == "Biennially") {
        $numyears = "2";
    }
    if ($billingcycle == "Triennially") {
        $numyears = "3";
    }
    if ($params['configoptions']['Seal']) {
        $withseal = true;
    }
    if ($params['configoptions']['NumYears']) {
        $numyears = $params['configoptions']['NumYears'];
    }
    $apiproducttype = $withseal ? "TRUSTePrivacyPolicySeal" : "TRUSTePrivacyPolicy";
    $postfields = array();
    $postfields['command'] = "PurchaseServices";
    $postfields['Service'] = $apiproducttype;
    $postfields['NumYears'] = $numyears;
    $postfields['EmailNotify'] = "0";
    $xmldata = enomtruste_call($params, $postfields);
    if ($xmldata['INTERFACE-RESPONSE']['ERRCOUNT'] == 0) {
        $result = "success";
        if (!mysql_num_rows(full_query("SHOW TABLES LIKE 'mod_enomtruste'"))) {
            full_query("CREATE TABLE `mod_enomtruste` ( `serviceid` INT(10) NOT NULL , `subscrid` INT(10) NOT NULL )");
        }
        $subscrid = $xmldata['INTERFACE-RESPONSE']['SUBSCRIPTIONID'];
        insert_query("mod_enomtruste", array("serviceid" => $params['serviceid'], "subscrid" => $subscrid));
        $domain = $params['domain'];
        if (!$domain) {
            $domain = $params['customfields']["Domain Name"];
        }
        $postfields = array();
        $postfields['command'] = "PP_UpdateSubscriptionDetails";
        $postfields['SubscriptionID'] = $subscrid;
        $postfields['DomainName'] = $domain;
        $postfields['EmailAddress'] = $params['clientsdetails']['email'];
        $xmldata = enomtruste_call($params, $postfields);
    } else {
        $result = $xmldata['INTERFACE-RESPONSE']['ERRORS']['ERR1'];
        if (!$result) {
            $result = "An Unknown Error Occurred";
        }
    }
    return $result;
}
Esempio n. 3
0
function globalsignssl_CreateAccount($params)
{
    $result = select_query("tblsslorders", "COUNT(*)", array("serviceid" => $params['serviceid']));
    $data = mysql_fetch_array($result);
    if ($data[0]) {
        return "An SSL Order already exists for this order";
    }
    updateService(array("username" => "", "password" => ""));
    $sslorderid = insert_query("tblsslorders", array("userid" => $params['clientsdetails']['userid'], "serviceid" => $params['serviceid'], "remoteid" => "", "module" => "globalsignssl", "certtype" => $params['configoption3'], "status" => "Awaiting Configuration"));
    global $CONFIG;
    $sslconfigurationlink = $CONFIG['SystemURL'] . "/configuressl.php?cert=" . md5($sslorderid);
    $sslconfigurationlink = "<a href=\"" . $sslconfigurationlink . "\">" . $sslconfigurationlink . "</a>";
    sendMessage("SSL Certificate Configuration Required", $params['serviceid'], array("ssl_configuration_link" => $sslconfigurationlink));
    return "success";
}
Esempio n. 4
0
function enomssl_CreateAccount($params)
{
    $result = select_query("tblsslorders", "COUNT(*)", array("serviceid" => $params['serviceid']));
    $data = mysql_fetch_array($result);
    if ($data[0]) {
        return "An SSL Order already exists for this order";
    }
    updateService(array("username" => "", "password" => ""));
    $certtype = $params['configoptions']["Certificate Type"] ? $params['configoptions']["Certificate Type"] : $params['configoption3'];
    $certyears = $params['configoptions']['Years'] ? $params['configoptions']['Years'] : $params['configoption4'];
    $certtype = str_replace(" ", "-", strtolower($certtype));
    $postfields = array();
    $postfields['uid'] = $params['configoption1'];
    $postfields['pw'] = $params['configoption2'];
    $postfields['ProductType'] = $certtype;
    $postfields['Quantity'] = $certyears;
    $postfields['ClearItems'] = "yes";
    $postfields['command'] = "AddToCart";
    $postfields['ResponseType'] = "XML";
    $result = enomssl_call($postfields, $params['configoption5']);
    if (!is_array($result) && substr($result, 0, 4) == "CURL") {
        return $result;
    }
    $error = $result['INTERFACE-RESPONSE']['ERRORS']['ERR1'];
    if ($error) {
        return $error;
    }
    $postfields = array();
    $postfields['uid'] = $params['configoption1'];
    $postfields['pw'] = $params['configoption2'];
    $postfields['command'] = "InsertNewOrder";
    $postfields['ResponseType'] = "XML";
    $result = enomssl_call($postfields, $params['configoption5']);
    $error = $result['INTERFACE-RESPONSE']['ERRORS']['ERR1'];
    if ($error) {
        return $error;
    }
    $orderid = $result['INTERFACE-RESPONSE']['ORDERID'];
    $sslorderid = insert_query("tblsslorders", array("userid" => $params['clientsdetails']['userid'], "serviceid" => $params['serviceid'], "remoteid" => $orderid, "module" => "enomssl", "certtype" => $certtype, "status" => "Awaiting Configuration"));
    global $CONFIG;
    $sslconfigurationlink = $CONFIG['SystemURL'] . "/configuressl.php?cert=" . md5($sslorderid);
    $sslconfigurationlink = "<a href=\"" . $sslconfigurationlink . "\">" . $sslconfigurationlink . "</a>";
    sendMessage("SSL Certificate Configuration Required", $params['serviceid'], array("ssl_configuration_link" => $sslconfigurationlink));
    return "success";
}
Esempio n. 5
0
function helm4_CreateAccount($params)
{
    $fields = array("AccountName" => $params['serverusername'], "Username" => $params['serverusername'], "Password" => $params['serverpassword'], "action" => "GetAccountByName", "UserAccountName" => $params['clientsdetails']['email'], "IncludeChildren" => "false");
    $result = helm4_connect($params['serverip'], $fields);
    $helmaccountid = $result['RESULTS']['RESULTDATA']['RECORD']['ACCOUNTID'];
    if ($helmaccountid) {
        $helmaccountusername = $result['RESULTS']['RESULTDATA']['RECORD']['PRIMARYLOGINNAME'];
        $result = select_query("tblhosting", "username,password", array("username" => $helmaccountusername));
        $data = mysql_fetch_array($result);
        updateService(array("username" => $data['username'], "password" => $data['password']));
    }
    if (!$helmaccountid) {
        $country = $params['clientsdetails']['country'];
        if ($country == "UK") {
            $country = "GB";
        }
        $fields = array("AccountName" => $params['serverusername'], "Username" => $params['serverusername'], "Password" => $params['serverpassword'], "action" => "CreateAccount", "AccountRoleId" => $params['configoption1'], "NewAccountName" => $params['clientsdetails']['email'], "CompanyName" => $params['clientsdetails']['firstname'] . " " . $params['clientsdetails']['lastname'], "AccountEmailAddress" => $params['clientsdetails']['email'], "AdminLoginName" => $params['username'], "AdminLoginPassword" => $params['password'], "AdminEmailAddress" => $params['clientsdetails']['email'], "FirstName" => $params['clientsdetails']['firstname'], "LastName" => $params['clientsdetails']['lastname'], "Address1" => $params['clientsdetails']['address1'], "Address2" => $params['clientsdetails']['address2'], "Address3" => "", "Town" => $params['clientsdetails']['city'], "PostCode" => $params['clientsdetails']['postcode'], "CountryCode" => $country, "CountyName" => $params['clientsdetails']['county']);
        $result = helm4_connect($params['serverip'], $fields);
        $resultcode = $result['RESULTS']['RESULTCODE'];
        $resultdescription = $result['RESULTS']['RESULTDESCRIPTION'];
        $helmaccountid = $result['RESULTS']['RESULTDATA'];
        if ($resultcode != "0") {
            return $resultdescription;
        }
    }
    $fields = array("AccountName" => $params['serverusername'], "Username" => $params['serverusername'], "Password" => $params['serverpassword'], "action" => "AddPackage", "UserAccountID" => $helmaccountid, "PlanID" => $params['configoption2'], "PackageName" => $params['domain'], "Quantity" => "1");
    $result = helm4_connect($params['serverip'], $fields);
    $resultcode = $result['RESULTS']['RESULTCODE'];
    $resultdescription = $result['RESULTS']['RESULTDESCRIPTION'];
    if ($resultcode != "0") {
        return $resultdescription;
    }
    $helmpackageid = $result['RESULTS']['RESULTDATA']['RECORD']['PACKAGEID'];
    $fields = array("AccountName" => $params['serverusername'], "Username" => $params['serverusername'], "Password" => $params['serverpassword'], "action" => "AddDomainToPackage", "UserAccountID" => $helmaccountid, "PackageID" => $helmpackageid, "DomainName" => $params['domain'], "IsPark" => "false");
    $result = helm4_connect($params['serverip'], $fields);
    $resultcode = $result['RESULTS']['RESULTCODE'];
    $resultdescription = $result['RESULTS']['RESULTDESCRIPTION'];
    if ($resultcode != "0") {
        return $resultdescription;
    }
    return "success";
}
Esempio n. 6
0
function autorelease_CreateAccount($params)
{
    if ($params['configoption1'] == "Add To-Do List Item") {
        $todoarray['title'] = "Service Provisioned";
        $todoarray['description'] = "Service ID # " . $params['serviceid'] . " was just auto provisioned";
        $todoarray['status'] = "Pending";
        $todoarray['date'] = $todoarray['duedate'] = date("Y-m-d");
        insert_query("tbltodolist", $todoarray);
    } else {
        if ($params['configoption1'] == "Create Support Ticket") {
            $postfields['action'] = "openticket";
            $postfields['clientid'] = $params['clientsdetails']['userid'];
            $postfields['deptid'] = $params['configoption6'] ? $params['configoption6'] : "1";
            $postfields['subject'] = "Service Provisioned";
            $postfields['message'] = "Service ID # " . $params['serviceid'] . " was just auto provisioned";
            $postfields['priority'] = "Low";
            localAPI($postfields['action'], $postfields, 1);
        }
    }
    updateService(array("username" => "", "password" => ""));
    return "success";
}
Esempio n. 7
0
function resellerclubssl_CreateAccount($params)
{
    require ROOTDIR . "/includes/countriescallingcodes.php";
    $result = select_query("tblsslorders", "COUNT(*)", array("serviceid" => $params['serviceid']));
    $data = mysql_fetch_array($result);
    if ($data[0]) {
        return "An SSL Order already exists for this order";
    }
    $domainname = $params['domain'];
    if ($params['customfields']["Domain Name"]) {
        $domainname = $params['customfields']["Domain Name"];
    }
    updateService(array("domain" => $domainname, "username" => "", "password" => ""));
    $certtype = $params['configoptions']["Certificate Type"] ? $params['configoptions']["Certificate Type"] : $params['configoption3'];
    $certyears = 7;
    if ($params['configoptions']['Years']) {
        $certyears = $params['configoptions']['Years'];
    } else {
        $billingcycle = get_query_val("tblhosting", "billingcycle", array("id" => $params['serviceid']));
        if ($billingcycle == "Biennially") {
            $certyears = 8;
        } else {
            if ($billingcycle == "Triennially") {
                $certyears = 9;
            }
        }
    }
    if ($certtype == "SSL123") {
        $apicerttype = "fssl";
    } else {
        if ($certtype == "SGC SuperCert") {
            $apicerttype = "sgc";
        } else {
            if ($certtype == "Web Server") {
                $apicerttype = "ssl";
            } else {
                if ($certtype == "Wildcard") {
                    $apicerttype = "wild";
                }
            }
        }
    }
    $postfields = array();
    $postfields['auth-userid'] = $params['configoption1'];
    $postfields['auth-password'] = $params['configoption2'];
    $postfields['username'] = $params['clientsdetails']['email'];
    $result = resellerclubssl_SendCommand("details", "customers", $postfields, $params, "GET");
    unset($postfields['username']);
    if ($result['response']['status'] == "ERROR") {
        $postfields['lang-pref'] = resellerclubssl_Language($params['clientsdetails']['language']);
        $postfields['username'] = $params['clientsdetails']['email'];
        $postfields['passwd'] = resellerclubssl_genLBRandomPW();
        $postfields['name'] = $params['clientsdetails']['firstname'] . " " . $params['clientsdetails']['lastname'];
        $postfields['company'] = $params['clientsdetails']['companyname'] ? $params['clientsdetails']['companyname'] : "N/A";
        $postfields['address-line-1'] = $params['clientsdetails']['address1'];
        $postfields['address-line-2'] = $params['clientsdetails']['address1'];
        $postfields['city'] = $params['clientsdetails']['city'];
        $postfields['state'] = $params['clientsdetails']['state'];
        $postfields['zipcode'] = $params['clientsdetails']['postcode'];
        $postfields['country'] = $params['clientsdetails']['country'];
        $postfields['phone'] = preg_replace("/[^0-9]/", "", $params['clientsdetails']['phonenumber']);
        $postfields['phone-cc'] = $countrycallingcodes[$params['clientsdetails']['country']];
        $result = resellerclubssl_SendCommand("signup", "customers", $postfields, $params, "POST");
        if ($result['response']['status'] == "ERROR") {
            return $result['response']['message'];
        }
        $customerid = $result['int'];
        unset($postfields);
        $postfields = array();
        $postfields['auth-userid'] = $params['configoption1'];
        $postfields['auth-password'] = $params['configoption2'];
    } else {
        foreach ($result['hashtable']['entry'] as $entry => $value) {
            if ($value['string'][0] == "customerid") {
                $customerid = $value['string'][1];
                continue;
            }
        }
    }
    if (!$customerid) {
        return array("error" => "Error obtaining customer id");
    }
    $postfields['customer-id'] = $customerid;
    $postfields['domain-name'] = $domainname;
    $postfields['years'] = $certyears;
    $postfields['additional-licenses'] = 0;
    $postfields['cert-key'] = $apicerttype;
    $postfields['invoice-option'] = "NoInvoice";
    $result = resellerclubssl_SendCommand("add", "digitalcertificate", $postfields, $params, "POST");
    if ($result['response']['status'] == "ERROR") {
        return $result['response']['message'];
    }
    foreach ($result['hashtable']['entry'] as $entry => $value) {
        if ($value['string'][0] == "orderid") {
            $orderid = $value['string'][1];
            continue;
        }
    }
    $sslorderid = insert_query("tblsslorders", array("userid" => $params['clientsdetails']['userid'], "serviceid" => $params['serviceid'], "remoteid" => $orderid, "module" => "resellerclubssl", "certtype" => $certtype, "status" => "Awaiting Configuration"));
    if (!$orderid) {
        return "Unable to obtain Order-ID";
    }
    global $CONFIG;
    $sslconfigurationlink = $CONFIG['SystemURL'] . "/configuressl.php?cert=" . md5($sslorderid);
    $sslconfigurationlink = "<a href=\"" . $sslconfigurationlink . "\">" . $sslconfigurationlink . "</a>";
    sendMessage("SSL Certificate Configuration Required", $params['serviceid'], array("ssl_configuration_link" => $sslconfigurationlink));
    return "success";
}
Esempio n. 8
0
function globalsignvouchers_CreateAccount($params)
{
    if (!mysql_num_rows(full_query("SHOW TABLES LIKE 'mod_gsvouchers'"))) {
        full_query("CREATE TABLE `mod_gsvouchers` ( `serviceid` INT(10) NOT NULL , `voucher` TEXT NOT NULL )");
    }
    $result = select_query("mod_gsvouchers", "voucher", array("serviceid" => $params['serviceid']));
    $data = mysql_fetch_array($result);
    $voucher = $data[0];
    if ($voucher) {
        return "OneClickSSL Voucher Code Already Provisioned";
    }
    $user = $params['configoption1'];
    $pass = $params['configoption3'];
    $ssltype = $params['configoption2'];
    $validityperiod = $params['configoption4'];
    $coupon = $params['configoption5'];
    $orderkind = $params['configoption6'];
    $campaign = $params['configoption7'];
    $testmode = $params['configoption8'];
    $transfer = $params['configoptions']['Transfer'];
    $domain = $params['domain'];
    if (!$domain) {
        $domain = $params['customfields']['Domain'];
    }
    updateService(array("domain" => $domain, "username" => "", "password" => ""));
    $result = select_query("tblhosting", "billingcycle", array("id" => $params['serviceid']));
    $data = mysql_fetch_array($result);
    $billingcycle = $data[0];
    if ($billingcycle == "Biennially") {
        $validityperiod = "2";
    }
    if ($billingcycle == "Triennially") {
        $validityperiod = "3";
    }
    if ($params['configoptions']['NumYears']) {
        $validityperiod = $params['configoptions']['NumYears'];
    }
    $wsdlorderurl = $testmode ? "https://testsystem.globalsign.com/vc/ws/VoucherOrder?wsdl" : "https://system.globalsign.com/vc/ws/VoucherOrder?wsdl";
    if ($ssltype == "DomainSSL") {
        $ssltype = "VoucherDV";
    } else {
        if ($ssltype == "AlphaSSL") {
            $ssltype = "VoucherAlpha";
        }
    }
    $orderkind = "new";
    if ($transfer) {
        $orderkind = "transfer";
    }
    if ($validityperiod < 10) {
        $validityperiod *= 17;
    }
    require ROOTDIR . "/includes/countriescallingcodes.php";
    $countrycode = $params['clientsdetails']['country'];
    $phonenumber = $params['clientsdetails']['phonenumber'];
    $phonenumber = preg_replace("/[^0-9]/", "", $phonenumber);
    $countrycode = $countrycallingcodes[$countrycode];
    $phonenumber = $countrycode . substr($phonenumber, 0, 3) . "-" . substr($phonenumber, 3);
    $request = array();
    $request['Request']['OrderRequestHeader']['AuthToken']['UserName'] = $user;
    $request['Request']['OrderRequestHeader']['AuthToken']['Password'] = $pass;
    $request['Request']['OrderRequestParameter']['ProductCode'] = $ssltype;
    $request['Request']['OrderRequestParameter']['OrderKind'] = $orderkind;
    $request['Request']['OrderRequestParameter']['ValidityPeriod']['Months'] = $validityperiod;
    $request['Request']['FQDN'] = $domain;
    $request['Request']['ContactInfo']['FirstName'] = $params['clientsdetails']['firstname'];
    $request['Request']['ContactInfo']['LastName'] = $params['clientsdetails']['lastname'];
    $request['Request']['ContactInfo']['Phone'] = $phonenumber;
    $request['Request']['ContactInfo']['Email'] = $params['clientsdetails']['email'];
    $client = new SoapClient($wsdlorderurl);
    $result = $client->VoucherOrder($request);
    logModuleCall("globalsignvouchers", "order", $request, (array) $result, "", array($user, $pass));
    $errorcode = $result->Response->OrderResponseHeader->SuccessCode;
    if (0 <= $errorcode) {
        $voucher = $result->Response->Voucher;
        insert_query("mod_gsvouchers", array("serviceid" => $params['serviceid'], "voucher" => $voucher));
        sendMessage("GlobalSign OneClickSSL Welcome Email", $params['serviceid'], array("voucher" => $voucher));
        return "success";
    }
    $errormsg = "";
    if (is_array($result->Response->OrderResponseHeader->Errors->Error)) {
        foreach ($result->Response->OrderResponseHeader->Errors->Error as $err) {
            $errormsg .= "Error Code: " . $err->ErrorCode . " - " . $err->ErrorField . " - " . $err->ErrorMessage . " || ";
        }
        $errormsg = substr($errormsg, 0, 0 - 4);
    } else {
        $errormsg = "Error Code: " . $result->Response->OrderResponseHeader->Errors->Error->ErrorCode . " - " . $result->Response->OrderResponseHeader->Errors->Error->ErrorField . " - " . $result->Response->OrderResponseHeader->Errors->Error->ErrorMessage;
    }
    if (!$errormsg) {
        $errormsg = "An Unknown Error Occurred. Please contact support.";
    }
    return $errormsg;
}
Esempio n. 9
0
    //get the new service corresponding to the ID
    $services = new Service($_GET['ID']);
    //checks to see if this is a valid ID or not
    if ($services->get_service_id() == "") {
        $link = $_SERVER['PHP_SELF'] . "?action=showID&ID=" . $_GET['ID'];
        $serviceForm->error("Warning: Failed to load. Reason: " . $services->get_error(), $link);
    }
    //if this is a service update then update the service
    if (isset($_POST['updateInfo']) && $_SESSION['access'] >= 50) {
        $layer = $services->get_service_layer();
        if ($layer == 2) {
            $services = new Layer2_service($_GET['ID']);
        } else {
            $services = new Layer3_service($_GET['ID']);
        }
        updateService($services);
    } else {
        if (isset($_POST['updateModal']) && $_SESSION['access'] >= 50) {
            $services = new Layer2_service_port($_POST['interfaceID']);
            updateModal($services);
        } else {
            if (isset($_POST['addPort']) && $_SESSION['access'] >= 50) {
                $servicePort = new Layer2_service_port();
                addPort($servicePort, $services);
            } else {
                displayService($services);
            }
        }
    }
} else {
    if ($_GET['action'] == editServiceType && $_SESSION['access'] >= 50 || $_GET['action'] == showServiceType) {