예제 #1
0
function resellerclub_addCustomer($params)
{
    global $CONFIG;
    require ROOTDIR . "/includes/countriescallingcodes.php";
    if (!function_exists("getClientsDetails")) {
        require ROOTDIR . "/includes/clientfunctions.php";
    }
    $clientdetails = foreignChrReplace(getClientsDetails($params['userid']));
    $language = $clientdetails['language'] ? $clientdetails['language'] : $CONFIG['Language'];
    $language = resellerclub_Language($language);
    $postfields['auth-userid'] = $params['ResellerID'];
    $postfields['api-key'] = $params['APIKey'];
    $postfields['username'] = $clientdetails['email'];
    $postfields['passwd'] = resellerclub_genLBRandomPW();
    $postfields['name'] = $clientdetails['firstname'] . " " . $clientdetails['lastname'];
    $companyname = $clientdetails['companyname'];
    if (!$companyname) {
        $companyname = "N/A";
    }
    $postfields['company'] = $companyname;
    $postfields['address-line-1'] = substr($clientdetails['address1'], 0, 64);
    if (64 < $clientdetails['address1']) {
        $postfields['address-line-2'] = substr($clientdetails['address1'] . ", " . $clientdetails['address2'], 64, 128);
    } else {
        $postfields['address-line-2'] = substr($clientdetails['address2'], 0, 64);
    }
    $postfields['city'] = $clientdetails['city'];
    if ($params['country'] != "US") {
        $postfields['state'] = $clientdetails['state'];
    } else {
        $postfields['state'] = convertStateToCode($clientdetails['state'], $clientdetails['country']);
    }
    $postfields['zipcode'] = $clientdetails['postcode'];
    $postfields['country'] = $clientdetails['country'];
    $phonenumber = $clientdetails['phonenumber'];
    $phonenumber = preg_replace("/[^0-9]/", "", $phonenumber);
    $countrycode = $clientdetails['country'];
    $countrycode = $countrycallingcodes[$countrycode];
    $postfields['phone-cc'] = $countrycode;
    $postfields['phone'] = $phonenumber;
    $postfields['lang-pref'] = "" . $language;
    $result = resellerclub_SendCommand("signup", "customers", $postfields, $params, "POST");
    unset($postfields);
    if (strtoupper($result['status']) == "ERROR") {
        if (!$result['message']) {
            $result['message'] = $result['error'];
        }
        return array("error" => $result['message']);
    }
    $customerid = $result;
    return $customerid;
}
예제 #2
0
function ModuleBuildParams($id)
{
    $result = select_query("tblhosting", "", array("id" => $id));
    $data = mysql_fetch_array($result);
    $func_id = $id = $data['id'];
    $userid = $data['userid'];
    $domain = $data['domain'];
    $username = $data['username'];
    $password = html_entity_decode(decrypt($data['password']));
    $pid = $data['packageid'];
    $server = $data['server'];
    $params['accountid'] = $id;
    $params['serviceid'] = $id;
    $params['domain'] = $domain;
    $params['username'] = $username;
    $params['password'] = $password;
    $params['packageid'] = $pid;
    $params['pid'] = $pid;
    $params['serverid'] = $server;
    $result = select_query("tblproducts", "", array("id" => $pid));
    $data = mysql_fetch_array($result);
    $params['type'] = $data['type'];
    $params['producttype'] = $data['type'];
    $params['moduletype'] = $data['servertype'];
    if (!$params['moduletype']) {
        return false;
    }
    if (!isValidforPath($params['moduletype'])) {
        exit("Invalid Server Module Name");
    }
    $counter = 1;
    while ($counter <= 12) {
        $params["configoption" . $counter] = $data["configoption" . $counter];
        $counter += 1;
    }
    $customfields = array();
    $result = full_query("SELECT tblcustomfields.fieldname,tblcustomfieldsvalues.value FROM tblcustomfields,tblcustomfieldsvalues WHERE tblcustomfields.id=tblcustomfieldsvalues.fieldid AND tblcustomfieldsvalues.relid=" . (int) $id . " AND tblcustomfields.relid=" . (int) $pid);
    while ($data = mysql_fetch_array($result)) {
        $customfieldname = $data[0];
        $customfieldvalue = $data[1];
        if (strpos($customfieldname, "|")) {
            $customfieldname = explode("|", $customfieldname);
            $customfieldname = trim($customfieldname[0]);
        }
        if (strpos($customfieldvalue, "|")) {
            $customfieldvalue = explode("|", $customfieldvalue);
            $customfieldvalue = trim($customfieldvalue[0]);
        }
        $customfields[$customfieldname] = $customfieldvalue;
    }
    $params['customfields'] = $customfields;
    $configoptions = array();
    $result = full_query("SELECT tblproductconfigoptions.optionname,tblproductconfigoptions.optiontype,tblproductconfigoptionssub.optionname,tblhostingconfigoptions.qty FROM tblproductconfigoptions,tblproductconfigoptionssub,tblhostingconfigoptions,tblproductconfiglinks WHERE tblhostingconfigoptions.configid=tblproductconfigoptions.id AND tblhostingconfigoptions.optionid=tblproductconfigoptionssub.id AND tblhostingconfigoptions.relid=" . (int) $id . " AND tblproductconfiglinks.gid=tblproductconfigoptions.gid AND tblproductconfiglinks.pid=" . (int) $pid);
    while ($data = mysql_fetch_array($result)) {
        $configoptionname = $data[0];
        $configoptiontype = $data[1];
        $configoptionvalue = $data[2];
        $configoptionqty = $data[3];
        if (strpos($configoptionname, "|")) {
            $configoptionname = explode("|", $configoptionname);
            $configoptionname = trim($configoptionname[0]);
        }
        if (strpos($configoptionvalue, "|")) {
            $configoptionvalue = explode("|", $configoptionvalue);
            $configoptionvalue = trim($configoptionvalue[0]);
        }
        if ($configoptiontype == "3" || $configoptiontype == "4") {
            $configoptionvalue = $configoptionqty;
        }
        $configoptions[$configoptionname] = $configoptionvalue;
    }
    $params['configoptions'] = $configoptions;
    if (!function_exists("getClientsDetails")) {
        require dirname(__FILE__) . "/clientfunctions.php";
    }
    $clientsdetails = getClientsDetails($userid);
    $clientsdetails['fullstate'] = $clientsdetails['state'];
    $clientsdetails['state'] = convertStateToCode($clientsdetails['state'], $clientsdetails['country']);
    $clientsdetails = foreignChrReplace($clientsdetails);
    $params['clientsdetails'] = $clientsdetails;
    if ($server) {
        $result = select_query("tblservers", "", array("id" => $server));
        $data = mysql_fetch_array($result);
        $params['server'] = true;
        $params['serverip'] = $data['ipaddress'];
        $params['serverhostname'] = $data['hostname'];
        $params['serverusername'] = html_entity_decode($data['username']);
        $params['serverpassword'] = html_entity_decode(decrypt($data['password']));
        $params['serveraccesshash'] = html_entity_decode($data['accesshash']);
        $params['serversecure'] = $data['secure'];
    } else {
        $params['server'] = false;
        $params['serverip'] = $params['serverhostname'] = $params['serverusername'] = $params['serverpassword'] = $params['serveraccesshash'] = $params['serversecure'] = "";
    }
    if (!function_exists($params['moduletype'] . "_ConfigOptions")) {
        $modulepath = ROOTDIR . "/modules/servers/" . $params['moduletype'] . "/" . $params['moduletype'] . ".php";
        if (file_exists($modulepath)) {
            require $modulepath;
        } else {
            logActivity("Required Product Module '" . $params['moduletype'] . "' Missing");
        }
    }
    $GLOBALS['moduleparams'] = $params;
    return $params;
}
예제 #3
0
 public function buildParams($vars = "")
 {
     if (count($this->moduleparams)) {
         $params = $this->moduleparams;
         if (is_array($vars)) {
             $params = array_merge($params, $vars);
         }
         return $params;
     }
     $params = array();
     $params['accountid'] = $this->getData("id");
     $params['serviceid'] = $this->getData("id");
     $params['domain'] = $this->getData("domain");
     $params['username'] = $this->getData("username");
     $params['password'] = html_entity_decode($this->getData("password"));
     $params['packageid'] = $this->getData("pid");
     $params['pid'] = $this->getData("pid");
     $params['serverid'] = $this->getData("server");
     $params['type'] = $this->getData("type");
     $params['producttype'] = $this->getData("type");
     $params['moduletype'] = $this->getModule();
     $fields = array();
     $counter = 1;
     while ($counter <= 10) {
         $fields[] = "configoption" . $counter;
         $counter += 1;
     }
     $moduleconfigops = get_query_vals("tblproducts", implode(",", $fields), array("id" => $this->getData("pid")));
     foreach ($fields as $field) {
         $params[$field] = $moduleconfigops[$field];
     }
     $customfields = array();
     $result = full_query("SELECT tblcustomfields.fieldname,tblcustomfieldsvalues.value FROM tblcustomfields,tblcustomfieldsvalues WHERE tblcustomfields.id=tblcustomfieldsvalues.fieldid AND tblcustomfieldsvalues.relid='" . (int) $this->getData("id") . "' AND tblcustomfields.relid='" . (int) $this->getData("pid") . "'");
     while ($data = mysql_fetch_array($result)) {
         $customfieldname = $data[0];
         $customfieldvalue = $data[1];
         if (strpos($customfieldname, "|")) {
             $customfieldname = explode("|", $customfieldname);
             $customfieldname = trim($customfieldname[0]);
         }
         if (strpos($customfieldvalue, "|")) {
             $customfieldvalue = explode("|", $customfieldvalue);
             $customfieldvalue = trim($customfieldvalue[0]);
         }
         $customfields[$customfieldname] = $customfieldvalue;
     }
     $params['customfields'] = $customfields;
     $configoptions = array();
     $result = full_query("SELECT tblproductconfigoptions.optionname,tblproductconfigoptions.optiontype,tblproductconfigoptionssub.optionname,tblhostingconfigoptions.qty FROM tblproductconfigoptions,tblproductconfigoptionssub,tblhostingconfigoptions,tblproductconfiglinks WHERE tblhostingconfigoptions.configid=tblproductconfigoptions.id AND tblhostingconfigoptions.optionid=tblproductconfigoptionssub.id AND tblhostingconfigoptions.relid='" . (int) $this->getData("id") . "' AND tblproductconfiglinks.gid=tblproductconfigoptions.gid AND tblproductconfiglinks.pid='" . (int) $this->getData("pid") . "'");
     while ($data = mysql_fetch_array($result)) {
         $configoptionname = $data[0];
         $configoptiontype = $data[1];
         $configoptionvalue = $data[2];
         $configoptionqty = $data[3];
         if (strpos($configoptionname, "|")) {
             $configoptionname = explode("|", $configoptionname);
             $configoptionname = trim($configoptionname[0]);
         }
         if (strpos($configoptionvalue, "|")) {
             $configoptionvalue = explode("|", $configoptionvalue);
             $configoptionvalue = trim($configoptionvalue[0]);
         }
         if ($configoptiontype == "3" || $configoptiontype == "4") {
             $configoptionvalue = $configoptionqty;
         }
         $configoptions[$configoptionname] = $configoptionvalue;
     }
     $params['configoptions'] = $configoptions;
     if (!function_exists("getClientsDetails")) {
         require dirname(__FILE__) . "/clientfunctions.php";
     }
     $clientsdetails = getClientsDetails($this->getData("userid"));
     $clientsdetails['fullstate'] = $clientsdetails['state'];
     $clientsdetails['state'] = convertStateToCode($clientsdetails['state'], $clientsdetails['country']);
     $clientsdetails = foreignChrReplace($clientsdetails);
     $params['clientsdetails'] = $clientsdetails;
     $data = $this->getServerInfo();
     if (count($data)) {
         $params['server'] = true;
         $params['serverip'] = $data['ipaddress'];
         $params['serverhostname'] = $data['hostname'];
         $params['serverusername'] = html_entity_decode($data['username']);
         $params['serverpassword'] = html_entity_decode(decrypt($data['password']));
         $params['serveraccesshash'] = html_entity_decode($data['accesshash']);
         $params['serversecure'] = $data['secure'];
     } else {
         $params['server'] = false;
         $params['serverip'] = "";
         $params['serverhostname'] = "";
         $params['serverusername'] = "";
         $params['serverpassword'] = "";
         $params['serveraccesshash'] = "";
         $params['serversecure'] = "";
     }
     $this->moduleparams = $params;
     if (is_array($vars)) {
         $params = array_merge($params, $vars);
     }
     return $params;
 }
예제 #4
0
function getGatewayVariables($gateway, $invoiceid = "", $amount = "0.00")
{
    global $whmcs;
    global $CONFIG;
    global $_LANG;
    global $clientsdetails;
    $res = loadGatewayModule($gateway);
    if (!$res) {
        exit("Gateway Module '" . $gateway . "' is Missing or Invalid");
    }
    $gateway = WHMCS_Gateways::makesafename($gateway);
    if (!function_exists($gateway . "_link")) {
        eval("function " . $gateway . "_link({$params}) { return '<form method=\"post\" action=\"" . $params['systemurl'] . "/creditcard.php\" name=\"paymentfrm\"><input type=\"hidden\" name=\"invoiceid\" value=\"" . $params['invoiceid'] . "\"><input type=\"submit\" value=\"" . $params['langpaynow'] . "\"></form>'; }");
    }
    $GATEWAY = array();
    $GATEWAY['paymentmethod'] = $gateway;
    $result = select_query("tblpaymentgateways", "", array("gateway" => $gateway));
    while ($data = mysql_fetch_array($result)) {
        $gVgwsetting = $data['setting'];
        $gVgwvalue = $data['value'];
        $GATEWAY["" . $gVgwsetting] = "" . $gVgwvalue;
    }
    $GATEWAY['companyname'] = $CONFIG['CompanyName'];
    if ($CONFIG['SystemSSLURL']) {
        $GATEWAY['systemurl'] = $CONFIG['SystemSSLURL'];
    } else {
        $GATEWAY['systemurl'] = $CONFIG['SystemURL'];
    }
    $GATEWAY['returnurl'] = $GATEWAY['systemurl'];
    $GATEWAY['langpaynow'] = $_LANG['invoicespaynow'];
    if ($invoiceid) {
        $clientsdetails['fullstate'] = $clientsdetails['state'];
        if (!function_exists("convertStateToCode")) {
            require ROOTDIR . "/includes/clientfunctions.php";
        }
        $clientsdetails['state'] = convertStateToCode($clientsdetails['state'], $clientsdetails['country']);
        $result = select_query("tblclients", "tblinvoices.invoicenum,tblclients.currency,tblcurrencies.code", array("tblinvoices.id" => $invoiceid), "", "", "", "tblinvoices ON tblinvoices.userid=tblclients.id INNER JOIN tblcurrencies ON tblcurrencies.id=tblclients.currency");
        $data = mysql_fetch_array($result);
        $invoicenum = $data['invoicenum'];
        $invoice_currency_id = $data['currency'];
        $invoice_currency_code = $data['code'];
        if (!trim($invoicenum)) {
            $invoicenum = $invoiceid;
        }
        $GATEWAY['description'] = $CONFIG['CompanyName'] . " - " . $_LANG['invoicenumber'] . $invoicenum;
        $GATEWAY['invoiceid'] = $invoiceid;
        $GATEWAY['clientdetails'] = $clientsdetails;
        $GATEWAY['returnurl'] = $GATEWAY['systemurl'] . "/viewinvoice.php?id=" . $invoiceid;
        if ($GATEWAY['convertto']) {
            $result = select_query("tblcurrencies", "code", array("id" => $GATEWAY['convertto']));
            $data = mysql_fetch_array($result);
            $converto_currency_code = $data['code'];
            $converto_amount = convertCurrency($amount, $invoice_currency_id, $GATEWAY['convertto']);
            $GATEWAY['amount'] = format_as_currency($converto_amount);
            $GATEWAY['currency'] = $converto_currency_code;
            $GATEWAY['basecurrencyamount'] = format_as_currency($amount);
            $GATEWAY['basecurrency'] = $invoice_currency_code;
        }
        if (!$GATEWAY['currency']) {
            $GATEWAY['amount'] = format_as_currency($amount);
            $GATEWAY['currency'] = $invoice_currency_code;
        }
    }
    return $GATEWAY;
}
예제 #5
0
function RegTransferDomain($paramvars)
{
    global $CONFIG;
    $domainid = $paramvars['domainid'];
    $passedepp = $paramvars['transfersecret'];
    $result = select_query("tbldomains", "", array("id" => $domainid));
    $data = mysql_fetch_array($result);
    $userid = $data['userid'];
    $domain = $data['domain'];
    $orderid = $data['orderid'];
    $registrar = $data['registrar'];
    $registrationperiod = $data['registrationperiod'];
    $dnsmanagement = $data['dnsmanagement'] ? true : false;
    $emailforwarding = $data['emailforwarding'] ? true : false;
    $idprotection = $data['idprotection'] ? true : false;
    $domainparts = explode(".", $domain, 2);
    $result = select_query("tblorders", "contactid,nameservers,transfersecret", array("id" => $orderid));
    $data = mysql_fetch_array($result);
    $contactid = $data['contactid'];
    $nameservers = $data['nameservers'];
    $transfersecret = $data['transfersecret'];
    if (!function_exists("getClientsDetails")) {
        require dirname(__FILE__) . "/clientfunctions.php";
    }
    $clientsdetails = getClientsDetails($userid, $contactid);
    $clientsdetails['fullstate'] = $clientsdetails['state'];
    $clientsdetails['state'] = convertStateToCode($clientsdetails['state'], $clientsdetails['country']);
    global $params;
    $params = array_merge($paramvars, $clientsdetails);
    $params['registrar'] = $registrar;
    $params['sld'] = $domainparts[0];
    $params['tld'] = $domainparts[1];
    $params['regperiod'] = $registrationperiod;
    $params['dnsmanagement'] = $dnsmanagement;
    $params['emailforwarding'] = $emailforwarding;
    $params['idprotection'] = $idprotection;
    if ($CONFIG['RegistrarAdminUseClientDetails'] == "on") {
        $params['adminfirstname'] = $clientsdetails['firstname'];
        $params['adminlastname'] = $clientsdetails['lastname'];
        $params['admincompanyname'] = $clientsdetails['companyname'];
        $params['adminemail'] = $clientsdetails['email'];
        $params['adminaddress1'] = $clientsdetails['address1'];
        $params['adminaddress2'] = $clientsdetails['address2'];
        $params['admincity'] = $clientsdetails['city'];
        $params['adminfullstate'] = $clientsdetails['fullstate'];
        $params['adminstate'] = $clientsdetails['state'];
        $params['adminpostcode'] = $clientsdetails['postcode'];
        $params['admincountry'] = $clientsdetails['country'];
        $params['adminphonenumber'] = $clientsdetails['phonenumber'];
    } else {
        $params['adminfirstname'] = $CONFIG['RegistrarAdminFirstName'];
        $params['adminlastname'] = $CONFIG['RegistrarAdminLastName'];
        $params['admincompanyname'] = $CONFIG['RegistrarAdminCompanyName'];
        $params['adminemail'] = $CONFIG['RegistrarAdminEmailAddress'];
        $params['adminaddress1'] = $CONFIG['RegistrarAdminAddress1'];
        $params['adminaddress2'] = $CONFIG['RegistrarAdminAddress2'];
        $params['admincity'] = $CONFIG['RegistrarAdminCity'];
        $params['adminstate'] = $CONFIG['RegistrarAdminStateProvince'];
        $params['adminpostcode'] = $CONFIG['RegistrarAdminPostalCode'];
        $params['admincountry'] = $CONFIG['RegistrarAdminCountry'];
        $params['adminphonenumber'] = $CONFIG['RegistrarAdminPhone'];
    }
    require ROOTDIR . "/includes/countriescallingcodes.php";
    $phonenumber = $params['phonenumber'];
    $adminphonenumber = $params['adminphonenumber'];
    $phonenumber = preg_replace("/[^0-9]/", "", $phonenumber);
    $adminphonenumber = preg_replace("/[^0-9]/", "", $adminphonenumber);
    $countrycode = $params['country'];
    $admincountrycode = $params['admincountry'];
    $countrycode = $countrycallingcodes[$countrycode];
    $admincountrycode = $countrycallingcodes[$admincountrycode];
    $params['fullphonenumber'] = "+" . $countrycode . "." . $phonenumber;
    $params['adminfullphonenumber'] = "+" . $admincountrycode . "." . $adminphonenumber;
    if (!$params['ns1'] && !$params['ns2']) {
        $result = select_query("tblorders", "nameservers", array("id" => $orderid));
        $data = mysql_fetch_array($result);
        $nameservers = $data['nameservers'];
        $result = select_query("tblhosting", "server", array("domain" => $domain));
        $data = mysql_fetch_array($result);
        $server = $data['server'];
        if ($server) {
            $result = select_query("tblservers", "", array("id" => $server));
            $data = mysql_fetch_array($result);
            $i = 1;
            while ($i <= 5) {
                $params["ns" . $i] = trim($data["nameserver" . $i]);
                ++$i;
            }
        } else {
            if ($nameservers && $nameservers != ",") {
                $nameservers = explode(",", $nameservers);
                $i = 1;
                while ($i <= 5) {
                    $params["ns" . $i] = trim($nameservers[$i - 1]);
                    ++$i;
                }
            } else {
                $i = 1;
                while ($i <= 5) {
                    $params["ns" . $i] = trim($CONFIG["DefaultNameserver" . $i]);
                    ++$i;
                }
            }
        }
    } else {
        $i = 1;
        while ($i <= 5) {
            $params["ns" . $i] = trim($params["ns" . $i]);
            ++$i;
        }
    }
    $result = select_query("tbldomainsadditionalfields", "", array("domainid" => $domainid));
    while ($data = mysql_fetch_array($result)) {
        $field_name = $data['name'];
        $field_value = $data['value'];
        $params['additionalfields'][$field_name] = $field_value;
    }
    $originaldetails = $params;
    $params = foreignChrReplace($params);
    $params['original'] = $originaldetails;
    if (!$params['transfersecret']) {
        $transfersecret = $transfersecret ? unserialize($transfersecret) : array();
        $params['transfersecret'] = $params['eppcode'] = $transfersecret[$domain];
    } else {
        $params['transfersecret'] = $params['eppcode'] = html_entity_decode($passedepp);
    }
    run_hook("PreDomainRegister", array("domain" => $domain));
    $values = RegCallFunction($params, "TransferDomain");
    if (!is_array($values)) {
        return false;
    }
    if ($values['na']) {
        logActivity("Domain Transfer Not Supported by Module - Domain ID: " . $domainid . " - Domain: " . $domain);
        return array("error" => "Registrar Function Not Supported");
    }
    if ($values['error']) {
        logActivity("Domain Transfer Failed - Domain ID: " . $domainid . " - Domain: " . $domain . " - Error: " . $values['error'], $userid);
        run_hook("AfterRegistrarTransferFailed", array("params" => $params, "error" => $values['error']));
    } else {
        update_query("tbldomains", array("status" => "Pending Transfer"), array("id" => $domainid));
        $array = array("date" => "now()", "title" => "Domain Pending Transfer", "description" => "Check the transfer status of the domain " . $params['sld'] . "." . $params['tld'] . "", "admin" => "", "status" => "In Progress", "duedate" => date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") + 5, date("Y"))));
        insert_query("tbltodolist", $array);
        logActivity("Domain Transfer Initiated Successfully - Domain ID: " . $domainid . " - Domain: " . $domain, $userid);
        run_hook("AfterRegistrarTransfer", array("params" => $params));
    }
    return $values;
}