Esempio n. 1
0
     }
 }
 if ($regaction == "custom") {
     check_token("WHMCS.admin.default");
     $values = RegCustomFunction($params, $ac);
     if ($values['error']) {
         infoBox($aInt->lang("domains", "registrarerror"), $values['error'], "error");
     } else {
         if (!$values['message']) {
             $values['message'] = $aInt->lang("domains", "changesuccess");
         }
         infoBox($aInt->lang("domains", "changesuccess"), $values['message'], "success");
     }
 }
 if ($conf == "addedidprotect" || $conf == "removedidprotect") {
     $values = RegIDProtectToggle($params);
     if (is_array($values)) {
         if ($values['error']) {
             infoBox($aInt->lang("domains", "idprotectfailed"), $values['error'], "error");
         } else {
             infoBox($aInt->lang("domains", "idprotectsuccess"), $aInt->lang("domains", "idprotectinfo"), "success");
         }
     }
 }
 $success = $domains->moduleCall("GetNameservers");
 if ($success) {
     $nsvalues = $domains->getModuleReturn();
 } else {
     if (!$infobox) {
         infoBox($aInt->lang("domains", "registrarerror"), $domains->getLastError());
     }
Esempio n. 2
0
function processPaidInvoice($invoiceid, $noemail = "", $date = "")
{
    global $CONFIG;
    $result = select_query("tblinvoices", "invoicenum,userid,status", array("id" => $invoiceid));
    $data = mysql_fetch_array($result);
    $userid = $data['userid'];
    $invoicestatus = $data['status'];
    $invoicenum = $data['invoicenum'];
    if ($invoicestatus != "Unpaid") {
        return false;
    }
    $date = $date ? toMySQLDate($date) . date(" H:i:s") : "now()";
    update_query("tblinvoices", array("status" => "Paid", "datepaid" => $date), array("id" => $invoiceid));
    logActivity("Invoice Marked Paid - Invoice ID: " . $invoiceid, $userid);
    if ($CONFIG['SequentialInvoiceNumbering'] && !$invoicenum) {
        $invoicenumber = $CONFIG['SequentialInvoiceNumberFormat'];
        $invnumval = get_query_val("tblconfiguration", "value", array("setting" => "SequentialInvoiceNumberValue"));
        update_query("tblconfiguration", array("value" => "+1"), array("setting" => "SequentialInvoiceNumberValue"));
        $invoicenumber = str_replace("{NUMBER}", $invnumval, $invoicenumber);
        update_query("tblinvoices", array("invoicenum" => $invoicenumber), array("id" => $invoiceid));
        ++$CONFIG['SequentialInvoiceNumberValue'];
    }
    run_hook("InvoicePaidPreEmail", array("invoiceid" => $invoiceid));
    if (!$noemail) {
        sendMessage("Invoice Payment Confirmation", $invoiceid);
    }
    $result = select_query("tblinvoiceitems", "", "invoiceid='" . mysql_real_escape_string($invoiceid) . "' AND type!=''", "id", "ASC");
    while ($data = mysql_fetch_array($result)) {
        $userid = $data['userid'];
        $type = $data['type'];
        $relid = $data['relid'];
        $amount = $data['amount'];
        if ($type == "Hosting") {
            makeHostingPayment($relid);
        }
        if ($type == "DomainRegister" || $type == "DomainTransfer" || $type == "Domain") {
            makeDomainPayment($relid, $type);
        }
        if ($type == "DomainAddonDNS") {
            $enabledcheck = get_query_val("tbldomains", "dnsmanagement", array("id" => $relid));
            if (!$enabledcheck) {
                $currency = getCurrency($userid);
                $dnscost = get_query_val("tblpricing", "msetupfee", array("type" => "domainaddons", "currency" => $currency['id'], "relid" => 0));
                update_query("tbldomains", array("dnsmanagement" => "on", "recurringamount" => "+=" . $dnscost), array("id" => $relid));
            }
        }
        if ($type == "DomainAddonEMF") {
            $enabledcheck = get_query_val("tbldomains", "emailforwarding", array("id" => $relid));
            if (!$enabledcheck) {
                $currency = getCurrency($userid);
                $emfcost = get_query_val("tblpricing", "qsetupfee", array("type" => "domainaddons", "currency" => $currency['id'], "relid" => 0));
                update_query("tbldomains", array("emailforwarding" => "on", "recurringamount" => "+=" . $emfcost), array("id" => $relid));
            }
        }
        if ($type == "DomainAddonIDP") {
            $enabledcheck = get_query_val("tbldomains", "idprotection", array("id" => $relid));
            if (!$enabledcheck) {
                $currency = getCurrency($userid);
                $idpcost = get_query_val("tblpricing", "ssetupfee", array("type" => "domainaddons", "currency" => $currency['id'], "relid" => 0));
                update_query("tbldomains", array("idprotection" => "on", "recurringamount" => "+=" . $idpcost), array("id" => $relid));
                $data = get_query_vals("tbldomains", "type,domain,registrar,registrationperiod", array("id" => $relid));
                $domainparts = explode(".", $data['domain'], 2);
                $params = array();
                $params['domainid'] = $relid;
                $params['sld'] = $domainparts[0];
                $params['tld'] = $domainparts[1];
                $params['regperiod'] = $data['registrationperiod'];
                $params['registrar'] = $data['registrar'];
                $params['regtype'] = $data['type'];
                if (!function_exists("RegIDProtectToggle")) {
                    require ROOTDIR . "/includes/registrarfunctions.php";
                }
                $values = RegIDProtectToggle($params);
                if ($values['error']) {
                    logActivity("ID Protection Enabling Failed - Error: " . $values['error'] . " - Domain ID: " . $relid, $userid);
                }
                logActivity("ID Protection Enabled Successfully - Domain ID: " . $relid, $userid);
            }
        }
        if ($type == "Addon") {
            makeAddonPayment($relid);
        }
        if ($type == "Upgrade") {
            if (!function_exists("processUpgradePayment")) {
                require dirname(__FILE__) . "/upgradefunctions.php";
            }
            processUpgradePayment($relid, "", "", "true");
        }
        if ($type == "AddFunds") {
            insert_query("tblcredit", array("clientid" => $userid, "date" => "now()", "description" => "Add Funds Invoice #" . $invoiceid, "amount" => $amount, "relid" => $invoiceid));
            update_query("tblclients", array("credit" => "+=" . $amount), array("id" => (int) $userid));
        }
        if ($type == "Invoice") {
            insert_query("tblcredit", array("clientid" => $userid, "date" => "now()", "description" => "Mass Invoice Payment Credit for Invoice #" . $relid, "amount" => $amount));
            update_query("tblclients", array("credit" => "+=" . $amount), array("id" => (int) $userid));
            applyCredit($relid, $userid, $amount);
        }
        if (substr($type, 0, 14) == "ProrataProduct") {
            $newduedate = substr($type, 14);
            update_query("tblhosting", array("nextduedate" => $newduedate, "nextinvoicedate" => $newduedate), array("id" => $relid));
        }
        if (substr($type, 0, 12) == "ProrataAddon") {
            $newduedate = substr($type, 12);
            update_query("tblhostingaddons", array("nextduedate" => $newduedate, "nextinvoicedate" => $newduedate), array("id" => $relid));
        }
    }
    run_hook("InvoicePaid", array("invoiceid" => $invoiceid));
}