Пример #1
0
            # Check form submit & capture payment
            $cardInfo = array('email' => $invoiceData['clientsdetails']['email'], 'amount' => $post['amount'], 'currency' => $post["currency"], 'token' => $_POST['brick_token'], 'fingerprint' => $_POST['brick_fingerprint'], 'description' => $invoiceData['pagetitle']);
            $charge = new Paymentwall_Charge();
            $charge->create(array_merge($cardInfo, brick_get_user_profile_data($invoiceData)));
            $response = $charge->getPublicData();
            if ($charge->isSuccessful()) {
                if ($charge->isCaptured()) {
                    addInvoicePayment($_POST["invoiceid"], $charge->getId(), null, null, 'brick');
                } elseif ($charge->isUnderReview()) {
                    // decide on risk charge
                }
                logTransaction($gateway['name'], $cardInfo, "Successful");
                $smartyvalues["success"] = true;
            } else {
                $error = json_decode($response, true);
                $smartyvalues["processingerror"] = '<li>' . $error['error']['message'] . '</li>';
                logTransaction($gateway['name'], $cardInfo, "Unsuccessful");
            }
        }
    } else {
        // User is logged in but they shouldn't be here (i.e. they weren't here from an invoice)
        header("Location: " . $CONFIG['SystemURL'] . "/clientarea.php?action=details");
    }
} else {
    header("Location: " . $CONFIG['SystemURL'] . "/");
}
outputClientArea("/modules/gateways/paymentwall/templates/ccform.tpl");
function brick_get_user_profile_data($params)
{
    return array('customer[city]' => $params['clientsdetails']['city'], 'customer[state]' => $params['clientsdetails']['fullstate'], 'customer[address]' => $params['clientsdetails']['address1'], 'customer[country]' => $params['clientsdetails']['countrycode'], 'customer[zip]' => $params['clientsdetails']['postcode'], 'customer[username]' => $params['clientsdetails']['userid'] ? $params['clientsdetails']['userid'] : $params['clientsdetails']['email'], 'customer[firstname]' => $params['clientsdetails']['firstname'], 'customer[lastname]' => $params['clientsdetails']['lastname']);
}
Пример #2
0
    $lastupdate = fromMySQLDate($data['lastupdate'], true);
    if (!is_null($data['enddate'])) {
        $enddate = fromMySQLDate($data['enddate'], true);
    } else {
        $enddate = "";
    }
    $priority = $_LANG["networkissuespriority" . strtolower($data['priority'])];
    $status = $_LANG["networkissuesstatus" . str_replace(" ", "", strtolower($data['status']))];
    $type = $_LANG["networkissuestype" . strtolower($data['type'])];
    $affected = false;
    if ($data['server']) {
        if (in_array($data['server'], $users_servers)) {
            $affected = true;
        }
        $result2 = select_query("tblservers", "name", array("id" => $data['server']));
        $data2 = mysql_fetch_array($result2);
        $servername = $data2['name'];
    } else {
        $affected = false;
        $servername = "";
    }
    $issues[] = array("id" => $data['id'], "startdate" => $startdate, "enddate" => $enddate, "title" => $data['title'], "description" => $data['description'], "type" => $type, "affecting" => $data['affecting'], "server" => $servername, "priority" => $priority, "status" => $status, "lastupdate" => $lastupdate, "clientaffected" => $affected);
}
$smartyvalues['issues'] = $issues;
$smartyvalues['view'] = $view;
$smartyvalues = array_merge($smartyvalues, clientAreaTablePageNav($numitems));
$smartyvalues['noissuesmsg'] = sprintf($_LANG['networkstatusnone'], $_LANG["networkissuesstatus" . $view]);
if (!$fromserverstatus) {
    $templatefile = "networkissues";
    outputClientArea($templatefile);
}
Пример #3
0
<?php

define("CLIENTAREA", true);
define("FORCESSL", true);
include "init.php";
$whmcs->load_function('clientarea');
$pagetitle = $_LANG['clientareatitle'] . " - Pay via Paymentwall";
initialiseClientArea($pagetitle, '', 'Pay via Paymentwall');
$whmcsVer = substr($CONFIG['Version'], 0, 1);
$smartyvalues["whmcsVer"] = $whmcsVer;
# Check login status
if ($_SESSION['uid'] && isset($_POST['data']) && ($iframe = decrypt($_POST['data']))) {
    if ($iframe) {
        $smartyvalues['iframe'] = $iframe;
    } else {
        // User is logged in but they shouldn't be here (i.e. they weren't here from an invoice)
        header("Location: " . $CONFIG['SystemURL'] . "/clientarea.php?action=details");
    }
} else {
    header("Location: " . $CONFIG['SystemURL'] . "/");
}
outputClientArea('/modules/gateways/paymentwall/templates/widget.tpl');
        $newPayment['date'] = fromMySQLDate($pastPayment['date']);
        $newPayment['description'] = substr($pastPayment['description'], strlen($gpSettings['SystemName']) + 7);
        $newPayment['amount'] = formatCurrency($pastPayment['amount']);
        $pastPayments[] = $newPayment;
    }
}
$smartyvalues['pastPayments'] = $pastPayments;
$smartyvalues["grouppayActive"] = $gpSettings['Enabled'] == "on";
$smartyvalues["hidePublicPayments"] = $gpSettings['HidePublicPayments'] == "on";
$smartyvalues["SystemName"] = $gpSettings['SystemName'];
$smartyvalues["fromPaypal"] = $fromPaypal;
$smartyvalues["minPayment"] = $gpSettings['MinPayment'];
//New in 1.07
$smartyvalues["hashLink"] = $CONFIG['SystemURL'] . (substr($CONFIG['SystemURL'], -1) == "/" ? "" : "/") . "grouppay.php?hash=" . ($_SESSION['uid'] ? gp_HashUserId($_SESSION['uid']) : "");
$currency = getCurrency($clientId);
//Invoice Total
$amtDue = 0;
$dbAmtDue = full_query("SELECT SUM(`total`) FROM `tblinvoices` WHERE `userid` = '{$clientId}' AND `status` = 'Unpaid'");
if ($dbAmtDue) {
    $amtDueRow = mysql_fetch_array($dbAmtDue);
    $amtDue = isset($amtDueRow[0]) ? $amtDueRow[0] : 0;
}
$smartyvalues["invAmountDue"] = $amtDue;
$smartyvalues["verifyAmtScript"] = "\n<!-- Group Pay " . $gpSettings['Version'] . " -->\n<script>\nfunction checkAmt(limit){\n\tif(!(/[0-9]*\\.?[0-9]+/.test(document.getElementsByName('amount')[0].value))){\n\t\talert('Please Enter Valid Amount');\n\t\treturn false;\n\t}else{\n\t\tif(parseFloat(document.getElementsByName('amount')[0].value) < parseFloat(limit)){\n\t\t\talert('Please enter an amount higher than the minimum payment of \$'+limit);\n\t\t\treturn false;\n\t\t}\n\t}\n}\n</script>";
//Start the form
$smartyvalues["gpFormStart"] = "\n<!-- Begin Paypal Form -->\n<form id=\"paypalForm\" action=\"" . $paypal_url . "\" onsubmit=\"return checkAmt(" . $gpSettings['MinPayment'] . ")\" method=\"post\">\n<input type=\"hidden\" name=\"cmd\" value=\"_xclick\">\n<input type=\"hidden\" name=\"custom\" value=\"{$userHash}\">\n<input type=\"hidden\" name=\"no_note\" value=\"1\">\n<input type=\"hidden\" name=\"item_name\" value=\"" . $CONFIG['CompanyName'] . " - " . $gpSettings['SystemName'] . " - " . $clientInfo['firstname'] . " " . $clientInfo['lastname'] . ($clientInfo['company'] ? "(" . $clientInfo['company'] . ")" : "") . "\">\n<input type=\"hidden\" name=\"currency_code\" value=\"" . $currency['code'] . "\">\n<input type=\"hidden\" name=\"return\" value=\"" . $CONFIG['SystemURL'] . (substr($CONFIG['SystemURL'], -1) == "/" ? "" : "/") . "grouppay.php?fromPaypal=true\">\n<input type=\"hidden\" name=\"cancel_return\" value=\"" . $CONFIG['SystemURL'] . (substr($CONFIG['SystemURL'], -1) == "/" ? "" : "/") . "grouppay.php?hash={$userHash}\">\n<input type=\"hidden\" name=\"notify_url\" value=\"" . $CONFIG['SystemURL'] . "/modules/addons/group_pay/grouppay_callback.php\">\n<input type=\"hidden\" name=\"no_shipping\" value=\"1\">\n<input type=\"hidden\" name=\"business\" value=\"{$gpPayPalEmail}\">\n\n";
//end the form
$smartyvalues["gpFormEnd"] = "\n<input type=\"image\" class=\"gppaypalimage\" style=\"height:40px; width:145px; border:none; \" src=\"https://www.paypalobjects.com/en_US/i/btn/btn_xpressCheckout.gif\" border=\"0\" name=\"submit\" alt=\"Make payments with PayPal - it's fast, free and secure!\">\n</form>";
//Spit it out
outputClientArea("grouppay");
Пример #5
0
                 $smartyvalues['pid'] = $data['id'];
                 $smartyvalues['prodname'] = $data['name'];
                 break;
             }
         }
         $result = select_query("tbladdons", "id,name,downloads", array("downloads" => array("sqltype" => "NEQ", "value" => "")));
         while ($data = mysql_fetch_array($result)) {
             $downloads = $data['downloads'];
             $downloads = explode(",", $downloads);
             if (in_array($id, $downloads)) {
                 $smartyvalues['aid'] = $data['id'];
                 $smartyvalues['addonname'] = $data['name'];
                 break;
             }
         }
         outputClientArea("downloaddenied");
     } else {
         echo $_LANG['downloadpurchaserequired'];
     }
     exit;
 }
 $result = select_query("tblproducts", "tblproducts.configoption7", array("tblhosting.id" => $serviceid, "tblproducts.servertype" => "licensing"), "", "", "", "tblhosting ON tblhosting.packageid=tblproducts.id");
 $data = mysql_fetch_array($result);
 $supportpackage = $data['configoption7'];
 $addonid = explode("|", $supportpackage);
 $addonid = $addonid[0];
 if ($addonid) {
     $result = select_query("tbladdons", "name", array("id" => $addonid));
     $data = mysql_fetch_array($result);
     $addonname = $data['name'];
     $where = "tblhosting.userid='" . (int) $_SESSION['uid'] . "' AND tblhostingaddons.status='Active' AND (tblhostingaddons.name='" . mysql_real_escape_string($addonname) . "' OR tblhostingaddons.addonid='" . (int) $addonid . "')";
Пример #6
0
/**
 * Show Client area
 *
 * @param string $templatefile template name
 * @param array $values smarty values
 */
function show_template($templatefile, $values)
{
    global $_LANG, $breadcrumbnav, $smartyvalues, $CONFIG;
    $pagetitle = $_LANG["clientareatitle"];
    $pageicon = "images/support/clientarea.gif";
    initialiseClientArea($pagetitle, $pageicon, $breadcrumbnav);
    $smartyvalues = $values;
    if ($CONFIG['SystemSSLURL']) {
        $smartyvalues['systemurl'] = $CONFIG['SystemSSLURL'] . '/';
    } else {
        if ($CONFIG['SystemURL'] != 'http://www.yourdomain.com/whmcs') {
            /* Do not change this URL!!! - Otherwise WHMCS Failed ! */
            $smartyvalues['systemurl'] = $CONFIG['SystemURL'] . '/';
        }
    }
    outputClientArea($templatefile);
}
Пример #7
0
        }
        redir("id=" . $invoiceid);
    }
    $smartyvalues['manualapplycredit'] = true;
    $smartyvalues['totalcredit'] = formatCurrency($creditbal) . generate_token("form");
    if (!$creditamount) {
        $creditamount = $balance <= $creditbal ? $balance : $creditbal;
    }
    $smartyvalues['creditamount'] = $creditamount;
}
$outputvars = $invoice->getOutput();
$smartyvalues = array_merge($smartyvalues, $outputvars);
$invoiceitems = $invoice->getLineItems();
$smartyvalues['invoiceitems'] = $invoiceitems;
$transactions = $invoice->getTransactions();
$smartyvalues['transactions'] = $transactions;
$paymentbutton = $invoice->getData("status") == "Unpaid" && 0 < $invoice->getData("balance") ? $invoice->getPaymentLink() : "";
$smartyvalues['paymentbutton'] = $paymentbutton;
$smartyvalues['offlinepaid'] = $whmcs->get_req_var("offlinepaid");
if ($whmcs->get_config("AllowCustomerChangeInvoiceGateway")) {
    $smartyvalues['allowchangegateway'] = true;
    $gateways = new WHMCS_Gateways();
    $availablegateways = $gateways->getAvailableGateways($invoiceid);
    $frm = new WHMCS_Form();
    $gatewaydropdown = generate_token("form") . $frm->dropdown("gateway", $availablegateways, $invoice->getData("paymentmodule"), "submit()");
    $smartyvalues['gatewaydropdown'] = $gatewaydropdown;
} else {
    $smartyvalues['allowchangegateway'] = false;
}
outputClientArea("viewinvoice", true);
Пример #8
0
function checkContactPermission($reqperm, $noredirect = "")
{
    if (!isset($_SESSION['cid'])) {
        return true;
    }
    $result = select_query("tblcontacts", "permissions", array("id" => $_SESSION['cid'], "userid" => $_SESSION['uid']));
    $data = mysql_fetch_array($result);
    $permissions = $data['permissions'];
    $permissions = explode(",", $permissions);
    if (!in_array($reqperm, $permissions)) {
        global $ca;
        global $_LANG;
        global $smartyvalues;
        if ($noredirect) {
            return false;
        }
        foreach ($permissions as $key => $permission) {
            $permissions[$key] = $_LANG["subaccountperms" . $permission];
        }
        if (is_object($ca)) {
            $ca->assign("allowedpermissions", $permissions);
            $ca->assign("requiredpermission", $reqperm);
            $ca->setTemplate("contactaccessdenied");
            $ca->output();
            exit;
        }
        $smartyvalues['allowedpermissions'] = $permissions;
        $smartyvalues['requiredpermission'] = $reqperm;
        $templatefile = "contactaccessdenied";
        outputClientArea($templatefile);
        exit;
    }
    return true;
}
Пример #9
0
            redir("id=" . $invoiceid, "viewinvoice.php");
        }
        if ($CONFIG['AutoRedirectoInvoice'] == "gateway") {
            if (in_array($paymentmethod, array("mailin", "banktransfer"))) {
                redir("id=" . $invoiceid, "viewinvoice.php");
            }
            $params = getGatewayVariables($paymentmethod, $invoiceid, $total);
            $paymentbutton = call_user_func($paymentmethod . "_link", $params);
            unset($orderform);
            $templatefile = "forwardpage";
            $smarty->assign("message", $_LANG['forwardingtogateway']);
            $smarty->assign("code", $paymentbutton);
            $smarty->assign("invoiceid", $invoiceid);
            outputClientArea($templatefile);
            exit;
        }
    }
    $amount = get_query_val("tblorders", "amount", array("userid" => $_SESSION['uid'], "id" => $orderid));
    $templatefile = "complete";
    $smartyvalues = array_merge($smartyvalues, array("orderid" => $orderid, "ordernumber" => $_SESSION['orderdetails']['OrderNumber'], "invoiceid" => $invoiceid, "ispaid" => $_SESSION['orderdetails']['paymentcomplete'], "amount" => $amount, "paymentmethod" => $paymentmethod, "clientdetails" => getClientsDetails($_SESSION['uid'])));
    $addons_html = run_hook("ShoppingCartCheckoutCompletePage", $smartyvalues);
    $smartyvalues['addons_html'] = $addons_html;
}
if (!$templatefile) {
    redir();
    exit;
}
$nowrapper = isset($_REQUEST['ajax']) ? true : false;
$smartyvalues['carttpl'] = $orderfrm->getTemplate();
outputClientArea($templatefile, $nowrapper);