Example #1
0
$adminbuttonarray = "";
if ($module) {
    if (!isValidforPath($module)) {
        exit("Invalid Server Module Name");
    }
    $modulepath = ROOTDIR . "/modules/servers/" . $module . "/" . $module . ".php";
    if (file_exists($modulepath)) {
        require_once $modulepath;
    }
    if (function_exists($module . "_AdminCustomButtonArray")) {
        $adminbuttonarray = call_user_func($module . "_AdminCustomButtonArray");
    }
}
if ($modop == "create") {
    check_token("WHMCS.admin.default");
    $result = ServerCreateAccount($id);
    wSetCookie("ModCmdResult", $result);
    redir("userid=" . $userid . "&id=" . $id . "&act=create&ajaxupdate=1");
}
if ($modop == "suspend") {
    check_token("WHMCS.admin.default");
    $result = ServerSuspendAccount($id, $suspreason);
    wSetCookie("ModCmdResult", $result);
    if ($result == "success" && $suspemail == "true") {
        sendMessage("Service Suspension Notification", $id);
    }
    redir("userid=" . $userid . "&id=" . $id . "&act=suspend&ajaxupdate=1");
}
if ($modop == "unsuspend") {
    check_token("WHMCS.admin.default");
    $result = ServerUnsuspendAccount($id);
Example #2
0
<?php

/**
 *
 * @ WHMCS FULL DECODED & NULLED
 *
 * @ Version  : 5.2.15
 * @ Author   : MTIMER
 * @ Release on : 2013-12-24
 * @ Website  : http://www.mtimer.cn
 *
 **/
if (!defined("WHMCS")) {
    exit("This file cannot be accessed directly");
}
if (!function_exists("ServerCreateAccount")) {
    require ROOTDIR . "/includes/modulefunctions.php";
}
$result = select_query("tblhosting", "packageid", array("id" => $_POST['accountid']));
$data = mysql_fetch_array($result);
$packageid = $data['packageid'];
$result = ServerCreateAccount($_POST['accountid']);
if ($result == "success") {
    $apiresults = array("result" => "success");
    return 1;
}
$apiresults = array("result" => "error", "message" => $result);
Example #3
0
     if ($status == "Terminated") {
         $updateqry['status'] = "Expired";
     }
     if (count($updateqry)) {
         checkPermission("Edit Clients Domains");
         foreach ($seldomains as $did) {
             update_query("tbldomains", $updateqry, array("id" => $did));
         }
         logActivity("Mass Updated Domains IDs: " . implode(",", $seldomains) . (" - User ID: " . $userid), $userid);
     }
 }
 $moduleresults = array();
 if ($masscreate) {
     checkPermission("Perform Server Operations");
     foreach ($selproducts as $serviceid) {
         $modresult = ServerCreateAccount($serviceid);
         if ($modresult != "success") {
             $moduleresults[] = "Service ID " . $serviceid . ": " . $modresult;
             continue;
         }
         $moduleresults[] = "Service ID " . $serviceid . ": " . $aInt->lang("services", "createsuccess");
     }
 }
 if ($masssuspend) {
     checkPermission("Perform Server Operations");
     foreach ($selproducts as $serviceid) {
         $modresult = ServerSuspendAccount($serviceid);
         if ($modresult != "success") {
             $moduleresults[] = "Service ID " . $serviceid . ": " . $modresult;
             continue;
         }
Example #4
0
function makeHostingPayment($func_domainid)
{
    global $CONFIG;
    global $disable_to_do_list_entries;
    $result = select_query("tblhosting", "", array("id" => $func_domainid));
    $data = mysql_fetch_array($result);
    $userid = $data['userid'];
    $billingcycle = $data['billingcycle'];
    $domain = $data['domain'];
    $packageid = $data['packageid'];
    $regdate = $data['regdate'];
    $nextduedate = $data['nextduedate'];
    $status = $data['domainstatus'];
    $server = $data['server'];
    $paymentmethod = $data['paymentmethod'];
    $suspendreason = $data['suspendreason'];
    $result = select_query("tblproducts", "", array("id" => $packageid));
    $data = mysql_fetch_array($result);
    $producttype = $data['type'];
    $productname = $data['name'];
    $module = $data['servertype'];
    $proratabilling = $data['proratabilling'];
    $proratadate = $data['proratadate'];
    $proratachargenextmonth = $data['proratachargenextmonth'];
    $autosetup = $data['autosetup'];
    if ($regdate == $nextduedate && $proratabilling) {
        $orderyear = substr($regdate, 0, 4);
        $ordermonth = substr($regdate, 5, 2);
        $orderday = substr($regdate, 8, 2);
        $proratavalues = getProrataValues($billingcycle, $product_onetime, $proratadate, $proratachargenextmonth, $orderday, $ordermonth, $orderyear, $userid);
        $nextduedate = $proratavalues['date'];
    } else {
        $nextduedate = getInvoicePayUntilDate($nextduedate, $billingcycle, true);
    }
    update_query("tblhosting", array("nextduedate" => $nextduedate, "nextinvoicedate" => $nextduedate), array("id" => $func_domainid));
    if (!function_exists("getModuleType")) {
        include dirname(__FILE__) . "/modulefunctions.php";
    }
    if ($status == "Pending" && $autosetup == "payment" && $module) {
        if (getNewClientAutoProvisionStatus($userid)) {
            logActivity("Running Module Create on Payment", $userid);
            $result = ServerCreateAccount($func_domainid);
            if ($result == "success") {
                sendMessage("defaultnewacc", $func_domainid);
                sendAdminMessage("Automatic Setup Successful", array("client_id" => $userid, "service_id" => $func_domainid, "service_product" => $productname, "service_domain" => $domain, "error_msg" => ""), "account");
            } else {
                sendAdminMessage("Automatic Setup Failed", array("client_id" => $userid, "service_id" => $func_domainid, "service_product" => $productname, "service_domain" => $domain, "error_msg" => $result), "account");
            }
        } else {
            logActivity("Module Create on Payment Suppressed for New Client", $userid);
        }
    }
    $suspenddate = date("Ymd", mktime(0, 0, 0, date("m"), date("d") - $CONFIG['AutoSuspensionDays'], date("Y")));
    if ($status == "Suspended" && $CONFIG['AutoUnsuspend'] == "on" && $module && !$suspendreason && $suspenddate <= str_replace("-", "", $nextduedate)) {
        logActivity("Running Auto Unsuspend on Payment", $userid);
        $moduleresult = ServerUnsuspendAccount($func_domainid);
        if ($moduleresult == "success") {
            sendAdminMessage("Service Unsuspension Successful", array("client_id" => $userid, "service_id" => $func_domainid, "service_product" => $productname, "service_domain" => $domain, "error_msg" => ""), "account");
        } else {
            sendAdminMessage("Service Unsuspension Failed", array("client_id" => $userid, "service_id" => $func_domainid, "service_product" => $productname, "service_domain" => $domain, "error_msg" => $moduleresult), "account");
            if (!$disable_to_do_list_entries) {
                insert_query("tbltodolist", array("date" => "now()", "title" => "Manual Unsuspend Required", "description" => "The order placed for " . $domain . " has received its next payment and the automatic unsuspend has failed<br />Client ID: " . $userid . "<br>Product/Service: " . $productname . "<br>Domain: " . $domain, "admin" => "", "status" => "Pending", "duedate" => date("Y-m-d")));
            }
        }
    }
    if ($status != "Pending") {
        ServerRenew($func_domainid);
    }
    AffiliatePayment("", $func_domainid);
    $result = select_query("tblhostingaddons", "id,addonid", "hostingid=" . (int) $func_domainid . " AND addonid>0 AND billingcycle IN ('Free','Free Account') AND status='Pending'");
    while ($data = mysql_fetch_array($result)) {
        $aid = $data['id'];
        $addonid = $data['addonid'];
        $result = select_query("tbladdons", "autoactivate,welcomeemail", array("id" => $addonid));
        $data = mysql_fetch_array($result);
        $autoactivate = $data['autoactivate'];
        $welcomeemail = $data['welcomeemail'];
        if ($autoactivate) {
            update_query("tblhostingaddons", array("status" => "Active"), array("id" => $aid));
            if ($welcomeemail) {
                $result = select_query("tblemailtemplates", "name", array("id" => $welcomeemail));
                $data = mysql_fetch_array($result);
                $welcomeemailname = $data['name'];
                sendMessage($welcomeemailname, $func_domainid);
            }
            run_hook("AddonActivation", array("id" => $aid, "userid" => $userid, "serviceid" => $func_domainid, "addonid" => $addonid));
        }
    }
}
Example #5
0
function acceptOrder($orderid, $vars = array())
{
    if (!$orderid) {
        return false;
    }
    if (!is_array($vars)) {
        $vars = array();
    }
    $errors = array();
    run_hook("AcceptOrder", array("orderid" => $orderid));
    $result = select_query("tblhosting", "", array("orderid" => $orderid, "domainstatus" => "Pending"));
    while ($data = mysql_fetch_array($result)) {
        $productid = $data['id'];
        $updateqry = array();
        if ($vars['products'][$productid]['server']) {
            $updateqry['server'] = $vars['products'][$productid]['server'];
        }
        if ($vars['products'][$productid]['username']) {
            $updateqry['username'] = $vars['products'][$productid]['username'];
        }
        if ($vars['products'][$productid]['password']) {
            $updateqry['password'] = encrypt($vars['products'][$productid]['password']);
        }
        if ($vars['api']['serverid']) {
            $updateqry['server'] = $vars['api']['serverid'];
        }
        if ($vars['api']['username']) {
            $updateqry['username'] = $vars['api']['username'];
        }
        if ($vars['api']['password']) {
            $updateqry['password'] = $vars['api']['password'];
        }
        if (count($updateqry)) {
            update_query("tblhosting", $updateqry, array("id" => $productid));
        }
        $result2 = select_query("tblhosting", "tblproducts.servertype,tblproducts.autosetup", array("tblhosting.id" => $productid), "", "", "", "tblproducts ON tblproducts.id=tblhosting.packageid");
        $data = mysql_fetch_array($result2);
        $module = $data['servertype'];
        $autosetup = $data['autosetup'];
        $autosetup = $autosetup ? true : false;
        $sendwelcome = $autosetup ? true : false;
        if (count($vars)) {
            $autosetup = $vars['products'][$productid]['runcreate'];
            $sendwelcome = $vars['products'][$productid]['sendwelcome'];
            if (isset($vars['api']['autosetup'])) {
                $autosetup = $vars['api']['autosetup'];
            }
            if (isset($vars['api']['sendemail'])) {
                $sendwelcome = $vars['api']['sendemail'];
            }
        }
        if ($autosetup) {
            if ($module) {
                logActivity("Running Module Create on Accept Pending Order");
                if (!isValidforPath($module)) {
                    exit("Invalid Server Module Name");
                }
                require_once ROOTDIR . ("/modules/servers/" . $module . "/" . $module . ".php");
                $moduleresult = ServerCreateAccount($productid);
                if ($moduleresult == "success") {
                    if ($sendwelcome) {
                        sendMessage("defaultnewacc", $productid);
                    }
                }
                $errors[] = $moduleresult;
            }
        }
        update_query("tblhosting", array("domainstatus" => "Active"), array("id" => $productid));
        if ($sendwelcome) {
            sendMessage("defaultnewacc", $productid);
        }
    }
    $result = select_query("tblhostingaddons", "", array("orderid" => $orderid, "status" => "Pending"));
    while ($data = mysql_fetch_array($result)) {
        $aid = $data['id'];
        $hostingid = $data['hostingid'];
        $addonid = $data['addonid'];
        if ($addonid) {
            $result2 = select_query("tbladdons", "", array("id" => $addonid));
            $data = mysql_fetch_array($result2);
            $welcomeemail = $data['welcomeemail'];
            $sendwelcome = $welcomeemail ? true : false;
            if (count($vars)) {
                $sendwelcome = $vars['addons'][$aid]['sendwelcome'];
            }
            if (isset($vars['api']['sendemail'])) {
                $sendwelcome = $vars['api']['sendemail'];
            }
            if ($welcomeemail && $sendwelcome) {
                $result3 = select_query("tblemailtemplates", "name", array("id" => $welcomeemail));
                $data = mysql_fetch_array($result3);
                $welcomeemailname = $data['name'];
                sendMessage($welcomeemailname, $hostingid);
            }
            if (!$userid) {
                $result3 = select_query("tblorders", "userid", array("id" => $orderid));
                $data = mysql_fetch_array($result3);
                $userid = $data['userid'];
            }
            run_hook("AddonActivation", array("id" => $aid, "userid" => $userid, "serviceid" => $hostingid, "addonid" => $addonid));
        }
    }
    update_query("tblhostingaddons", array("status" => "Active"), array("orderid" => $orderid, "status" => "Pending"));
    $result = select_query("tbldomains", "", array("orderid" => $orderid, "status" => "Pending"));
    while ($data = mysql_fetch_array($result)) {
        $domainid = $data['id'];
        $regtype = $data['type'];
        $domain = $data['domain'];
        $registrar = $data['registrar'];
        $emailmessage = $regtype == "Transfer" ? "Domain Transfer Initiated" : "Domain Registration Confirmation";
        if ($vars['domains'][$domainid]['registrar']) {
            $registrar = $vars['domains'][$domainid]['registrar'];
        }
        if ($vars['api']['registrar']) {
            $registrar = $vars['api']['registrar'];
        }
        if ($registrar) {
            update_query("tbldomains", array("registrar" => $registrar), array("id" => $domainid));
        }
        if ($vars['domains'][$domainid]['sendregistrar']) {
            $sendregistrar = "on";
        }
        if ($vars['domains'][$domainid]['sendemail']) {
            $sendemail = "on";
        }
        if (isset($vars['api']['sendregistrar'])) {
            $sendregistrar = $vars['api']['sendregistrar'];
        }
        if (isset($vars['api']['sendemail'])) {
            $sendemail = $vars['api']['sendemail'];
        }
        if ($sendregistrar && $registrar) {
            $params = array();
            $params['domainid'] = $domainid;
            $moduleresult = $regtype == "Transfer" ? RegTransferDomain($params) : RegRegisterDomain($params);
            if (!$moduleresult['error']) {
                if ($sendemail) {
                    sendMessage($emailmessage, $domainid);
                }
            }
            $errors[] = $moduleresult['error'];
        }
        update_query("tbldomains", array("status" => "Active"), array("id" => $domainid, "status" => "Pending"));
        if ($sendemail) {
            sendMessage($emailmessage, $domainid);
        }
    }
    if (is_array($vars['renewals'])) {
        foreach ($vars['renewals'] as $domainid => $options) {
            if ($vars['renewals'][$domainid]['sendregistrar']) {
                $sendregistrar = "on";
            }
            if ($vars['renewals'][$domainid]['sendemail']) {
                $sendemail = "on";
            }
            if ($sendregistrar) {
                $params = array();
                $params['domainid'] = $domainid;
                $moduleresult = RegRenewDomain($params);
                if ($moduleresult['error']) {
                    $errors[] = $moduleresult['error'];
                    continue;
                }
                if ($sendemail) {
                    sendMessage("Domain Renewal Confirmation", $domainid);
                    continue;
                }
                continue;
            }
            if ($sendemail) {
                sendMessage("Domain Renewal Confirmation", $domainid);
                continue;
            }
        }
    }
    $result = select_query("tblorders", "userid,promovalue", array("id" => $orderid));
    $data = mysql_fetch_array($result);
    $userid = $data['userid'];
    $promovalue = $data['promovalue'];
    if (substr($promovalue, 0, 2) == "DR") {
        if ($vars['domains'][$domainid]['sendregistrar']) {
            $sendregistrar = "on";
        }
        if (isset($vars['api']['autosetup'])) {
            $sendregistrar = $vars['api']['autosetup'];
        }
        if ($sendregistrar) {
            $params = array();
            $params['domainid'] = $domainid;
            $moduleresult = RegRenewDomain($params);
            if ($moduleresult['error']) {
                $errors[] = $moduleresult['error'];
            } else {
                if ($sendemail) {
                    sendMessage("Domain Renewal Confirmation", $domainid);
                }
            }
        } else {
            if ($sendemail) {
                sendMessage("Domain Renewal Confirmation", $domainid);
            }
        }
    }
    update_query("tblupgrades", array("status" => "Completed"), array("orderid" => $orderid));
    if (!count($errors)) {
        update_query("tblorders", array("status" => "Active"), array("id" => $orderid));
        logActivity("Order Accepted - Order ID: " . $orderid, $userid);
    }
    return $errors;
}
Example #6
0
 }
 $paymentmethod = WHMCS_Gateways::makesafename($paymentmethod);
 if (!$paymentmethod) {
     exit("Unexpected payment method value. Exiting.");
 }
 $result = select_query("tblhosting", "tblhosting.id,tblproducts.servertype", array("tblhosting.orderid" => $orderid, "tblhosting.domainstatus" => "Pending", "tblproducts.autosetup" => "order"), "", "", "", "tblproducts ON tblproducts.id=tblhosting.packageid");
 while ($data = mysql_fetch_array($result)) {
     $id = $data['id'];
     $servertype = $data['servertype'];
     if (getNewClientAutoProvisionStatus($_SESSION['uid'])) {
         logActivity("Running Module Create on Order");
         if (!isValidforPath($servertype)) {
             exit("Invalid Server Module Name");
         }
         include_once ROOTDIR . ("/modules/servers/" . $servertype . "/" . $servertype . ".php");
         $moduleresult = ServerCreateAccount($id);
         if ($moduleresult == "success") {
             sendMessage("defaultnewacc", $id);
         }
     }
     logActivity("Module Create on Order Suppressed for New Client");
 }
 loadGatewayModule($paymentmethod);
 if ($invoiceid && $status == "Unpaid" && function_exists($paymentmethod . "_orderformcheckout")) {
     $params = getGatewayVariables($paymentmethod, $invoiceid, $total);
     $captureresult = call_user_func($paymentmethod . "_orderformcheckout", $params);
     $gatewayname = get_query_val("tblpaymentgateways", "value", array("gateway" => $paymentmethod, "setting" => "name"));
     logTransaction($gatewayname, $captureresult['rawdata'], ucfirst($captureresult['status']));
     if ($captureresult['status'] == "success") {
         addInvoicePayment($invoiceid, $captureresult['transid'], "", $captureresult['fee'], $paymentmethod);
         $_SESSION['orderdetails']['paymentcomplete'] = true;