Пример #1
0
        $groupid = $data['groupid'];
        $currency = $data['currency'];
        $signups = $data['signups'];
        $currency = getCurrency("", $currency);
        $balance = formatCurrency($balance);
        $withdrawn = formatCurrency($withdrawn);
        $date = fromMySQLDate($date);
        $tabledata[] = array("<input type=\"checkbox\" name=\"selectedclients[]\" value=\"" . $id . "\" class=\"checkall\" />", "<a href=\"affiliates.php?action=edit&id=" . $id . "\">" . $id . "</a>", $date, $aInt->outputClientLink($userid, $firstname, $lastname, $companyname, $groupid), $visitors, $signups, $balance, $withdrawn, "<a href=\"" . $PHP_SELF . "?action=edit&id=" . $id . "\"><img src=\"images/edit.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"" . $aInt->lang("global", "edit") . "\"></a>", "<a href=\"#\" onClick=\"doDelete('" . $id . "');return false\"><img src=\"images/delete.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"" . $aInt->lang("global", "delete") . "\"></a>");
    }
    $tableformurl = "sendmessage.php?type=affiliate&multiple=true";
    $tableformbuttons = "<input type=\"submit\" value=\"" . $aInt->lang("global", "sendmessage") . "\" class=\"button\">";
    echo $aInt->sortableTable(array("checkall", array("id", $aInt->lang("fields", "id")), array("date", $aInt->lang("affiliates", "signupdate")), array("clientname", $aInt->lang("fields", "clientname")), array("visitors", $aInt->lang("affiliates", "visitorsref")), $aInt->lang("affiliates", "signups"), array("balance", $aInt->lang("fields", "balance")), array("withdrawn", $aInt->lang("affiliates", "withdrawn")), "", ""), $tabledata, $tableformurl, $tableformbuttons);
} else {
    if ($action == "edit") {
        if ($pay == "true") {
            $error = AffiliatePayment($affaccid, "");
            if ($error) {
                infoBox($aInt->lang("affiliates", "paymentfailed"), $error);
            } else {
                infoBox($aInt->lang("affiliates", "paymentsuccess"), $aInt->lang("affiliates", "paymentsuccessdetail"));
            }
        }
        echo $infobox;
        $result = select_query("tblaffiliates", "", array("id" => $id));
        $data = mysql_fetch_array($result);
        $id = $data['id'];
        if (!$id) {
            $aInt->gracefulExit("Invalid Affiliate ID. Please Try Again...");
        }
        $date = $data['date'];
        $clientid = $data['clientid'];
Пример #2
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));
        }
    }
}