Ejemplo n.º 1
0
 public function update()
 {
     if ($GLOBALS['cached'] == false || $this->_fileHandler->lastTimeModified() >= 30) {
         // updates every 30 seconds
         $poolData = curlCall($this->_apiURL . '/tmp_api?address=' . $this->_btcaddess);
         // Offline Check
         if (empty($poolData)) {
             return;
         }
         // Data Order
         $data['type'] = $this->_type;
         $data['sent'] = $poolData['balances']['sent'];
         $data['balance'] = $poolData['balances']['confirmed'];
         $data['unconfirmed_balance'] = number_format($poolData['balances']['unconverted'], 8);
         $data['hashrate'] = formatHashrate($poolData['hash_rate'] / 1000);
         $activeWorkers = 0;
         foreach ($poolData['worker_hashrates'] as $worker) {
             if ($worker['hashrate'] != 0) {
                 $activeWorkers++;
                 continue;
             }
         }
         $data['active_worker(s)'] = $activeWorkers;
         $data['url'] = $this->_apiURL;
         $this->_fileHandler->write(json_encode($data));
         return $data;
     }
     return json_decode($this->_fileHandler->read(), true);
 }
Ejemplo n.º 2
0
 public function update()
 {
     if ($GLOBALS['cached'] == false || $this->_fileHandler->lastTimeModified() >= 30) {
         // updates every 30 seconds
         $poolData = array();
         foreach ($this->_actions as $action) {
             $poolData[$action] = curlCall($this->_apiURL . '/' . $action);
         }
         // Offline Check
         if (empty($poolData[$this->_actions[0]])) {
             return;
         }
         // Data Order
         $data['type'] = $this->_type;
         $data['coin'] = $poolData['web/currency_info']['symbol'];
         $data['balance'] = number_format($poolData['current_payouts'][$this->_addess], 8);
         $data['user_hashrate'] = formatHashrate($poolData['local_stats']['miner_hash_rates'][$this->_addess] / 1000);
         $data['pool_hashrate'] = formatHashrate($poolData['global_stats']['pool_nonstale_hash_rate'] / 1000);
         $data['pool_uptime'] = formatTimeElapsed($poolData['local_stats']['uptime']);
         $data['pool_fee'] = $poolData['local_stats']['fee'] . '%';
         $data['peers_in'] = $poolData['local_stats']['peers']['incoming'];
         $data['peers_out'] = $poolData['local_stats']['peers']['outgoing'];
         $data['url'] = $this->_apiURL;
         $this->_fileHandler->write(json_encode($data));
         return $data;
     }
     return json_decode($this->_fileHandler->read(), true);
 }
Ejemplo n.º 3
0
 public function update()
 {
     if ($GLOBALS['cached'] == false || $this->_fileHandler->lastTimeModified() >= 30) {
         // updates every 30 seconds
         $poolData = array();
         $poolData = curlCall($this->_apiURL . '?accountId=' . $this->_userId);
         // Offline Check
         if (empty($poolData)) {
             return;
         }
         // Data Order
         $data['type'] = $this->_type;
         $data['sent'] = $poolData['miner']['totalEarned'];
         $data['unconfirmed_balance'] = $poolData['miner']['unconfirmedPayouts'];
         $data['user_capacity'] = formatCapacity($poolData['miner']['estimatedCapacity'] * 1000000);
         $data['pool_capacity'] = formatCapacity($poolData['pool']['estimatedCapacity'] * 1000000);
         $data['pool_miners'] = $poolData['pool']['totalMiners'];
         $data['current_block'] = $poolData['current']['block'];
         $data['nonces_submitted'] = $poolData['current']['noncesSubmitted'];
         $data['best_deadline'] = formatTimeElapsed($poolData['current']['bestDeadline']);
         $data['round_duration'] = formatTimeElapsed(time() - $poolData['current']['timeBlockStarted']);
         $data['pool_blocks_won'] = $poolData['pool']['blocksWon'];
         $data['url'] = "http://burst.ninja";
         $this->_fileHandler->write(json_encode($data));
         return $data;
     }
     return json_decode($this->_fileHandler->read(), true);
 }
Ejemplo n.º 4
0
 public function update()
 {
     if ($GLOBALS['cached'] == false || $this->_fileHandler->lastTimeModified() >= 30) {
         // updates every 30 seconds
         $poolData = array();
         $poolData['user'] = curlCall($this->_apiURL . '/index.php?k=api&json=y&username='******'&api=' . $this->_apiKey);
         $poolData['workers'] = curlCall($this->_apiURL . '/index.php?k=api&json=y&work=y&username='******'&api=' . $this->_apiKey);
         // Offline Check
         if (empty($poolData['user']) || empty($poolData['workers'])) {
             return;
         }
         // Data Order
         $data['type'] = $this->_type;
         $data['user_hashrate'] = formatHashrate($poolData['user']['u_hashrate5m'] / 1000);
         $data['pool_hashrate'] = formatHashrate($poolData['user']['p_hashrate5m'] / 1000);
         for ($i = 0; $poolData['workers']['rows'] > $i; $i++) {
             $data[$poolData['workers']['workername:' . $i]] = formatHashrate($poolData['workers']['w_hashrate5m:' . $i] / 1000);
         }
         $data['workers'] = $poolData['workers']['rows'];
         $data['round_duration'] = formatTimeElapsed(time() - $poolData['user']['lastblock']);
         $data['url'] = $this->_apiURL;
         $this->_fileHandler->write(json_encode($data));
         return $data;
     }
     return json_decode($this->_fileHandler->read(), true);
 }
Ejemplo n.º 5
0
function pushover_ticket_reply($vars)
{
    $ticketid = $vars['ticketid'];
    $userid = $vars['userid'];
    $deptid = $vars['deptid'];
    $deptname = $vars['deptname'];
    $subject = $vars['subject'];
    $message = $vars['message'];
    $priority = $vars['priority'];
    // Convert HTML entities (single/double quote) back to single or double quote
    $message = htmlspecialchars_decode($message, ENT_QUOTES);
    $pushover_userkey = po_get_userkey();
    if (!$pushover_userkey) {
        return false;
    }
    $po_ticket_url = po_get_admin_ticket_url($ticketid);
    $pushover_api_url = 'https://api.pushover.net/1/messages.json';
    $pushover_app_token = 'a7HcPjJeGmAtyG4e6tCYqyXk5wc5Xj';
    $pushover_title = '[Ticket ID: ' . $ticketid . '] New Support Ticket Response';
    $pushover_url = $po_ticket_url;
    $pushover_url_title = "Open Admin Area to View Ticket";
    $pushover_message = $message;
    $pushover_post_fields = array('token' => $pushover_app_token, 'user' => $pushover_userkey, 'title' => $pushover_title, 'message' => $pushover_message, 'url' => $pushover_url, 'url_title' => $pushover_url_title, 'priority' => 1);
    // Convert to URL-Encoded string to post as application/x-www-form-urlencoded
    $pushover_encoded_post_fields = http_build_query($pushover_post_fields);
    $pushover_resp = curlCall($pushover_api_url, $pushover_encoded_post_fields, $pushover_options);
    $parsed_resp = json_decode($pushover_resp, true);
    if ($parsed_resp['status'] != 1) {
        logModuleCall('pushover', 'pushover_server_error', $pushover_post_fields, $pushover_resp);
    }
    logModuleCall('pushover', 'hook_ticket_open', $pushover_post_fields, $pushover_resp);
}
Ejemplo n.º 6
0
function widget_whmcs_news($vars)
{
    global $whmcs, $_ADMINLANG;
    $title = $_ADMINLANG['home']['whmcsnewsfeed'];
    if ($whmcs->get_req_var('getwhmcsnews')) {
        if (!function_exists("ticketAutoHyperlinks")) {
            require ROOTDIR . '/includes/ticketfunctions.php';
        }
        $feed = curlCall('http://www.whmcs.com/feeds/news.php', '');
        $feed = json_decode($feed, 1);
        echo '<div style="float:right;margin:15px 15px 10px 10px;padding:8px 20px;text-align:center;background-color:#FDF8E1;border:1px dashed #FADA5A;-moz-border-radius: 5px;-webkit-border-radius: 5px;-o-border-radius: 5px;border-radius: 5px;">Follow Us<br /><a href="http://twitter.com/whmcs" target="_blank" style="font-size:16px;color:#D9AE06;">@whmcs</a></div>';
        $i = 0;
        foreach ($feed as $news) {
            echo '<div style="padding-top:5px;font-size:14px;' . ($i == 0 ? 'border-top:1px dashed #ccc;' : '') . '">' . ($news['link'] ? '<a href="' . $news['link'] . '" target="_blank">' : '') . $news['headline'] . ($news['link'] ? '</a>' : '') . '</div>
<div style="padding:5px;">' . $news['text'] . '</div>
<div style="font-size:10px;font-weight:bold;padding-bottom:5px;border-bottom:1px dashed #ccc;">' . date("l, F jS, Y", strtotime($news['date'])) . '</div>
';
            $i++;
        }
        exit;
    }
    $content = '<div id="whmcsnewsfeed" style="max-height:130px;">' . $vars['loading'] . '</div>';
    $jquerycode = '$.post("index.php", { getwhmcsnews: 1 },
    function(data){
        jQuery("#whmcsnewsfeed").html(data);
    });';
    return array('title' => $title, 'content' => $content, 'jquerycode' => $jquerycode);
}
Ejemplo n.º 7
0
 public function update()
 {
     if ($GLOBALS['cached'] == false || $this->_fileHandler->lastTimeModified() >= 30) {
         // updates every 30 seconds
         $poolData['global'] = curlCall($this->_apiURL . '/api/pool/stats');
         $poolData['user'] = curlCall($this->_apiURL . '/api/users/' . $this->_userId . '?key=' . $this->_apiKey);
         // Offline Check
         if (empty($poolData['global']) || empty($poolData['user'])) {
             return;
         }
         // Payout Information
         $data['type'] = $this->_type;
         // Balances?
         $data['btc_balance'] = number_format($poolData['user']['balances']['BTC'], 8);
         $data['nmc_balance'] = number_format($poolData['user']['balances']['NMC'], 8);
         $data['user_hashrate'] = formatHashRate($poolData['user']['hash_rate'] * 1000);
         $data['network_hashrate'] = formatHashRate($poolData['global']['hash_rate'] * 1000000);
         $data['workers'] = $poolData['user']['active_workers'];
         $data['round_duration'] = formatTimeElapsed($poolData['user']['now'] - $poolData['user']['round_start']['BTC']);
         $data['username'] = $poolData['user']['name'];
         $data['url'] = $this->_apiURL;
         $this->_fileHandler->write(json_encode($data));
         return $data;
     }
     return json_decode($this->_fileHandler->read(), true);
 }
Ejemplo n.º 8
0
 public function update()
 {
     if ($GLOBALS['cached'] == false || $this->_fileHandler->lastTimeModified() >= 30) {
         // updates every 30 seconds
         $poolData = array();
         foreach ($this->_actions as $action) {
             $nonce = number_format(time() * mt_rand(), 0, '', '');
             $hmacSig = strtoupper(hash_hmac('sha256', $this->_userId . $this->_apiKey . $nonce, $this->_apiSecret));
             $postParams = http_build_query(array('key' => $this->_apiKey, 'nonce' => $nonce, 'signature' => $hmacSig));
             $poolData[$action] = curlCall($this->_apiURL . '/api/' . $action . '.htm', $postParams, 'application/x-www-form-urlencoded', array('key' => $this->_apiKey, 'sig' => $hmacSig));
             $poolData[$action] = $poolData[$action]['data'];
         }
         // Offline Check
         if (empty($poolData[$this->_actions[0]])) {
             return;
         }
         // Data Order
         $data['type'] = $this->_type;
         $data['sent'] = number_format($poolData['account']['paidOut'], 8);
         $data['balance'] = number_format($poolData['account']['balance'], 8);
         $data['current_earnings'] = number_format($poolData['account']['earnTotal'], 8);
         $data['pool_hashrate'] = formatHashrate($poolData['poolStats']['poolHashrate'] * 1000);
         // User Hashrate
         $data['user_hashrate_(1_day)'] = formatHashrate($poolData['hashrate']['last1d'] * 1000);
         $data['user_hashrate_(1_hour)'] = formatHashrate($poolData['hashrate']['last1h'] * 1000);
         $data['user_hashrate_(10_minutes)'] = formatHashrate($poolData['hashrate']['last10m'] * 1000);
         $data['eta_on_block'] = formatTimeElapsed($poolData['poolStats']['estimateTime']);
         $data['url'] = $this->_apiURL;
         $this->_fileHandler->write(json_encode($data));
         return $data;
     }
     return json_decode($this->_fileHandler->read(), true);
 }
Ejemplo n.º 9
0
 public function update()
 {
     if ($CACHED == false || $this->_fileHandler->lastTimeModified() >= 30) {
         // updates every 30 seconds
         $poolData = array();
         $poolData['global'] = curlCall($this->_apiURL . '/stats/json/' . $this->_apiKey);
         $poolData['user'] = curlCall($this->_apiURL . '/accounts/profile/json/' . $this->_apiKey);
         // Offline Check
         if (empty($poolData['global']) || empty($poolData['user'])) {
             return;
         }
         $data = array();
         $data['type'] = $this->_type;
         $data['confirmed_balance'] = $poolData['user']['confirmed_reward'];
         $data['unconfirmed_balance'] = $poolData['user']['unconfirmed_reward'];
         $data['estimated_balance'] = $poolData['user']['estimated_reward'];
         $data['pool_hashrate'] = formatHashrate($poolData['global']['ghashes_ps'] * 1000000);
         $data['user_hashrate'] = formatHashrate($poolData['user']['hashrate'] * 1000);
         $data['workers'] = count($poolData['user']['workers']);
         $roundDuration = 0;
         $roundDurationVal = explode(':', $poolData['global']['round_duration']);
         $roundDuration += intval($roundDurationVal[0] * 60 * 60);
         $roundDuration += intval($roundDurationVal[1] * 60);
         $roundDuration += intval($roundDurationVal[2]);
         $data['round_duration'] = formatTimeElapsed($roundDuration);
         $data['username'] = $poolData['user']['username'];
         $data['url'] = $this->_apiURL;
         $this->_fileHandler->write(json_encode($data));
         return $data;
     }
     return json_decode($this->_fileHandler->read(), true);
 }
Ejemplo n.º 10
0
function optimalpayments_capture($params)
{
    global $remote_ip;
    $url = "https://webservices.optimalpayments.com/creditcardWS/CreditCardServlet/v1";
    if ($params['testmode']) {
        $url = "https://webservices.test.optimalpayments.com/creditcardWS/CreditCardServlet/v1";
    }
    $cardtype = optimalpayments_cardtype($params['cardtype']);
    if ($params['country'] == "US") {
        $state = "<state>" . $params['clientdetails']['state'] . "</state>";
    } else {
        $state = "<region>" . $params['clientdetails']['state'] . "</region>";
    }
    $xml = "<ccAuthRequestV1 xmlns=\"http://www.optimalpayments.com/creditcard/xmlschema/v1\"\nxmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\nxsi:schemaLocation=\"http://www.optimalpayments.com/creditcard/xmlschema/v1\">\n<merchantAccount>\n<accountNum>" . $params['accountnumber'] . "</accountNum>\n<storeID>" . $params['merchantid'] . "</storeID>\n<storePwd>" . $params['merchantpw'] . "</storePwd>\n</merchantAccount>\n<merchantRefNum>" . $params['invoiceid'] . "</merchantRefNum>\n<amount>" . $params['amount'] . "</amount>\n<card>\n<cardNum>" . $params['cardnum'] . "</cardNum>\n<cardExpiry>\n<month>" . substr($params['cardexp'], 0, 2) . "</month>\n<year>20" . substr($params['cardexp'], 2, 2) . "</year>\n</cardExpiry>\n<cardType>" . $cardtype . "</cardType>\n";
    if ($params['cccvv']) {
        $xml .= "<cvdIndicator>1</cvdIndicator>\n<cvd>" . $params['cccvv'] . "</cvd>\n";
    } else {
        $xml .= "<cvdIndicator>0</cvdIndicator>\n";
    }
    $xml .= "</card>\n<billingDetails>\n<cardPayMethod>WEB</cardPayMethod>\n<firstName>" . $params['clientdetails']['firstname'] . "</firstName>\n<lastName>" . $params['clientdetails']['lastname'] . "</lastName>\n<street>" . $params['clientdetails']['address1'] . "</street>\n<city>" . $params['clientdetails']['city'] . "</city>\n" . $state . "\n<country>" . $params['clientdetails']['country'] . "</country>\n<zip>" . $params['clientdetails']['postcode'] . "</zip>\n<phone>" . $params['clientdetails']['phonenumber'] . "</phone>\n<email>" . $params['clientdetails']['email'] . "</email>\n</billingDetails>\n<recurring>\n<recurringIndicator>R</recurringIndicator>\n</recurring>\n<customerIP>" . $remote_ip . "</customerIP>\n</ccAuthRequestV1>";
    $query_str = "txnMode=ccPurchase&txnRequest=" . urlencode($xml);
    $data = curlCall($url, $query_str);
    $xmldata = XMLtoArray($data);
    $xmldata = $xmldata['CCTXNRESPONSEV1'];
    if ($xmldata['CODE'] == "0") {
        return array("status" => "success", "transid" => $xmldata['txnNumber'], "rawdata" => $xmldata);
    }
    return array("status" => "declined", "rawdata" => $xmldata);
}
Ejemplo n.º 11
0
function _quantumvault_http_post($host, $path, $data, $port = 80)
{
    $url = "https://secure.quantumgateway.com" . $path;
    $result = curlCall($url, $data);
    $response = explode("\n\n", $result, 2);
    $response[1] = $response[0];
    return $response;
}
 public function update()
 {
     if ($GLOBALS['cached'] == false || $this->_fileHandler->lastTimeModified() >= 30) {
         // updates every 30 seconds
         $poolData = array();
         foreach ($this->_actions as $action) {
             $poolData[$action] = curlCall($this->_apiURL . '/index.php?page=api&id=' . $this->_userId . '&api_key=' . $this->_apiKey . '&action=' . $action);
             if ($action == 'getpoolstatus') {
                 $poolData[$action] = $poolData[$action]['getpoolstatus']['data'];
             } else {
                 if ($action == 'getblockstats') {
                     $poolData[$action] = $poolData[$action]['getblockstats']['data'];
                 } else {
                     if ($action == 'getuserbalance') {
                         $poolData[$action] = $poolData[$action]['getuserbalance']['data'];
                     } else {
                         if ($action == 'getuserstatus') {
                             $poolData[$action] = $poolData[$action]['getuserstatus']['data'];
                         }
                     }
                 }
             }
         }
         // Offline Check
         if (empty($poolData[$this->_actions[0]])) {
             return;
         }
         // Data Order
         $data['type'] = $this->_type;
         $data['pending_payout'] = number_format($poolData['getuserbalance']['pending_payout'], 8);
         $data['payout_bonus'] = number_format($poolData['getuserbalance']['pending_bonus'], 8);
         $data['bonus_%'] = $poolData['getuserbalance']['pending_bonus_pct'] . '%';
         if ($poolData['getuserbalance']['merged_mining']) {
             foreach ($poolData['getuserbalance']['merged_mining'] as $coin) {
                 $data[$coin['coin'] . '_balance'] = number_format($coin['balance'], 8);
             }
         }
         $data['network_hashrate'] = formatHashrate($poolData['getpoolstatus']['nethashrate'] / 1000);
         $data['pool_hashrate'] = formatHashrate($poolData['getpoolstatus']['hashrate']);
         $data['user_hashrate'] = formatHashrate($poolData['getuserstatus']['hashrate']);
         $data['pool_workers'] = $poolData['getpoolstatus']['workers'];
         $data['efficiency'] = $poolData['getpoolstatus']['efficiency'] . '%';
         $data['accepted'] = $poolData['public']['shares_this_round'];
         $data['rejected'] = round($poolData['public']['shares_this_round'] - $poolData['public']['shares_this_round'] * ($poolData['getpoolstatus']['efficiency'] / 100));
         $data['difficulty'] = round($poolData['getpoolstatus']['networkdiff'], 5);
         $timeSinceLastBlock = formatTimeElapsed($poolData['getpoolstatus']['timesincelast']);
         $data['time_since_last_block'] = $timeSinceLastBlock;
         $data['%_of_expected'] = round($poolData['public']['shares_this_round'] / $poolData['getpoolstatus']['estshares'] * 100, 2) . '%';
         $data['current_block'] = $poolData['getpoolstatus']['currentnetworkblock'];
         $data['last_block'] = $poolData['getpoolstatus']['lastblock'];
         $data['username'] = $poolData['getuserstatus']['username'];
         $data['url'] = $this->_apiURL;
         $this->_fileHandler->write(json_encode($data));
         return $data;
     }
     return json_decode($this->_fileHandler->read(), true);
 }
Ejemplo n.º 13
0
function paymentexpress_link($params)
{
    $url = "https://sec.paymentexpress.com/pxpay/pxaccess.aspx";
    $xml = "<GenerateRequest>\n<PxPayUserId>" . $params['pxpayuserid'] . "</PxPayUserId>\n<PxPayKey>" . $params['pxpaykey'] . "</PxPayKey>\n<AmountInput>" . $params['amount'] . "</AmountInput>\n<CurrencyInput>" . $params['currency'] . "</CurrencyInput>\n<MerchantReference>" . $params['description'] . "</MerchantReference>\n<EmailAddress>" . $params['clientdetails']['email'] . "</EmailAddress>\n<TxnData1>" . $params['invoiceid'] . "</TxnData1>\n<TxnType>Purchase</TxnType>\n<TxnId>" . substr(time() . $params['invoiceid'], 0, 16) . "</TxnId>\n<BillingId></BillingId>\n<EnableAddBillCard>0</EnableAddBillCard>\n<UrlSuccess>" . $params['systemurl'] . "/modules/gateways/callback/paymentexpress.php</UrlSuccess>\n<UrlFail>" . $params['systemurl'] . "/clientarea.php</UrlFail>\n</GenerateRequest>";
    $data = curlCall($url, $xml);
    $xmlresponse = XMLtoArray($data);
    $uri = $xmlresponse['REQUEST']['URI'];
    $code = "<form method=\"post\" action=\"" . $uri . "\"><input type=\"submit\" value=\"" . $params['langpaynow'] . "\"></form>";
    return $code;
}
Ejemplo n.º 14
0
 public function update()
 {
     if ($GLOBALS['cached'] == false || $this->_fileHandler->lastTimeModified() >= 30) {
         // updates every 30 seconds
         $poolData = curlCall($this->_apiURL . '?api_key=' . $this->_apiKey);
         // Offline Check
         if (empty($poolData)) {
             return;
         }
         // Payout Information
         $data['type'] = $this->_type;
         $poolHashrate = 0;
         $userHashrate = 0;
         foreach ($poolData['currency'] as $coin => $values) {
             if ($values['confirmed_rewards'] != 0) {
                 $data[$coin . '_balance'] = number_format($values['confirmed_rewards'], 8);
             }
             if ($values['estimated_rewards'] != 0) {
                 $data[$coin . '_unconfirmed_balance'] = number_format($values['estimated_rewards'], 8);
             }
             // removed until we find a better way to display this information. Right now it's way too cluttered
             // if ($values['hashrate'] != '0') {
             //     $data[$coin.'_hashrate'] =  formatHashrate($values['hashrate']);
             // }
             if ($values['hashrate'] != 0) {
                 $userHashrate += $values['hashrate'];
             }
             $poolHashrate += $values['pool_hashrate'];
         }
         $data['pool_hashrate'] = $poolHashrate;
         $data['user_hashrate'] = $userHashrate;
         $userWorkers = array();
         foreach ($poolData['workers'] as $coin => $workers) {
             foreach ($workers as $name => $worker) {
                 if (!array_key_exists($name, $userWorkers)) {
                     $userWorkers[$name] = 0;
                 }
                 if ($worker['hashrate'] != 0) {
                     $userWorkers[$name] += $worker['hashrate'];
                 }
             }
         }
         foreach ($userWorkers as $name => $worker) {
             $name = explode('.', $name);
             $data['worker_' . $name[1]] = formatHashrate($worker);
         }
         $data['pool_hashrate'] = formatHashrate($data['pool_hashrate']);
         $data['user_hashrate'] = formatHashrate($data['user_hashrate']);
         $data['url_name'] = 'https://multipool.us';
         $data['url'] = 'https://multipool.us/';
         $this->_fileHandler->write(json_encode($data));
         return $data;
     }
     return json_decode($this->_fileHandler->read(), true);
 }
Ejemplo n.º 15
0
 public function update()
 {
     if ($GLOBALS['cached'] == false || $this->_fileHandler->lastTimeModified() >= 3600) {
         // updates every 60 minutes. How much are you being paid out that this must change? We take donations :)
         $addressBalance = curlCall($this->_apiURL);
         $data = array('label' => $this->_label, 'address' => $this->_address, 'balance' => (double) $addressBalance);
         $this->_fileHandler->write(json_encode($data));
         return $data;
     }
     return json_decode($this->_fileHandler->read(), true);
 }
Ejemplo n.º 16
0
function noti_output($vars)
{
    global $customadminpath, $CONFIG;
    $access_token = select_query('tblnoti', '', array('adminid' => $_SESSION['adminid']));
    if ($_GET['return'] == '1' && $_SESSION['request_token']) {
        $response = curlCall("http://notiapp.com/api/v1/get_access_token", array('app' => $vars['key'], 'request_token' => $_SESSION['request_token']));
        $result = json_decode($response, true);
        insert_query("tblnoti", array("adminid" => $_SESSION['adminid'], "access_token" => $result['access_token']));
        $_SESSION['request_token'] = "";
        curlCall("http://notiapp.com/api/v1/add", array('app' => $vars['key'], 'user' => $result['access_token'], "notification[title]" => "WHMCS is ready to go!", "notification[text]" => "You will now receive WHMCS notifications directly to your desktop", "notification[sound]" => "alert1"));
        header("Location: addonmodules.php?module=noti");
    } elseif ($_GET['setup'] == '1' && !mysql_num_rows($access_token)) {
        $response = curlCall("http://notiapp.com/api/v1/request_access", array('app' => $vars['key'], 'redirect_url' => $CONFIG['SystemURL'] . "/" . $customadminpath . "/addonmodules.php?module=noti&return=1"));
        $result = json_decode($response, true);
        if ($result['request_token'] && $result['redirect_url']) {
            $_SESSION['request_token'] = $result['request_token'];
            header("Location: " . $result['redirect_url']);
        } else {
            echo "<div class='errorbox'><strong>Incorrect API Key</strong></br>Incorrect Noti API Key specified.</div>";
        }
    } elseif ($_GET['disable'] == '1' && mysql_num_rows($access_token)) {
        full_query("DELETE FROM `tblnoti` WHERE `adminid` = '" . $_SESSION['adminid'] . "'");
        echo "<div class='infobox'><strong>Successfully Disabled Noti</strong></br>You have successfully disabled Noti.</div>";
    } elseif (mysql_num_rows($access_token) && $_POST) {
        update_query('tblnoti', array('permissions' => serialize($_POST['notification'])), array('adminid' => $_SESSION['adminid']));
        echo "<div class='infobox'><strong>Updated Notifications</strong></br>You have successfully updated your notification preferences.</div>";
    }
    $access_token = select_query('tblnoti', '', array('adminid' => $_SESSION['adminid']));
    $result = mysql_fetch_array($access_token, MYSQL_ASSOC);
    $permissions = unserialize($result['permissions']);
    if (!mysql_num_rows($access_token)) {
        echo "<p><a href='addonmodules.php?module=noti&setup=1'>Setup Noti</a></p>";
    } else {
        echo "<p><a href='addonmodules.php?module=noti&disable=1'>Disable Noti</a></p>";
        echo '<form method="POST"><table class="form" width="100%" border="0" cellspacing="2" cellpadding="3">
    <tr>
      <td class="fieldlabel" width="200px">Notifications</td>
      <td class="fieldarea">
      <table width="100%">
        <tr>
           <td valign="top">
             <input type="checkbox" name="notification[new_client]" value="1" id="notifications_new_client" ' . ($permissions['new_client'] == "1" ? "checked" : "") . '> <label for="notifications_new_client">New Clients</label><br>
             <input type="checkbox" name="notification[new_invoice]" value="1" id="notifications_new_invoice" ' . ($permissions['new_invoice'] == "1" ? "checked" : "") . '> <label for="notifications_new_invoice">Paid Invoices</label><br>
             <input type="checkbox" name="notification[new_ticket]" value="1" id="notifications_new_ticket" ' . ($permissions['new_ticket'] == "1" ? "checked" : "") . '> <label for="notifications_new_ticket">New Support Ticket</label><br>
           </td>
         </tr>
         
    </table>
  </table>
  
  <p align="center"><input type="submit" value="Save Changes" class="button"></p></form>
  ';
    }
}
Ejemplo n.º 17
0
 public function update()
 {
     if ($GLOBALS['cached'] == false || $this->_fileHandler->lastTimeModified() >= 3600) {
         // updates every 60 minutes. How much are you being paid out that this must change? We take donations :)
         $data = curlCall($this->_apiURL, http_build_query(array('account' => $this->_address)), 'application/x-www-form-urlencoded');
         $data = array('label' => $this->_label, 'address' => $this->_address, 'balance' => (double) $data['balanceNQT'] / 100000000);
         $this->_fileHandler->write(json_encode($data));
         return $data;
     }
     return json_decode($this->_fileHandler->read(), true);
 }
Ejemplo n.º 18
0
function noti_TicketUserReply($vars)
{
    global $customadminpath, $CONFIG;
    $application_key = mysql_fetch_array(select_query('tbladdonmodules', 'value', array('module' => 'noti', 'setting' => 'key')), MYSQL_ASSOC);
    $administrators = full_query("SELECT `access_token` FROM `tblnoti` WHERE `permissions` LIKE '%new_invoice%'");
    while ($administrator = mysql_fetch_array($administrators, MYSQL_ASSOC)) {
        $noti[] = $administrator['access_token'];
    }
    $noti = implode($noti, ',');
    curlCall("http://notiapp.com/api/v1/bulk", array('app' => $application_key['value'], 'users' => $noti, 'notification[title]' => 'A ticket has been updated', 'notification[text]' => $vars['subject'] . ' (in ' . $vars['deptname'] . ')', 'notification[sound]' => 'subtle1', 'notification[url]' => $CONFIG['SystemURL'] . '/' . $customadminpath . '/supporttickets.php?action=viewticket&id=' . $vars['ticketid']));
}
Ejemplo n.º 19
0
 public function convert($to, $from)
 {
     $fileHandler = new FileHandler('fiat/bitcoinindex/' . strtolower($to) . '_' . strtolower($from) . '.json');
     if ($GLOBALS['cached'] == false || $fileHandler->lastTimeModified() >= 3600) {
         // updates every 1 minute
         $data = array();
         $data = curlCall($this->_url . '/v0.1/conversions/' . strtolower($from) . '/' . strtolower($to));
         // /v0.1/conversions/:from/:to
         $fileHandler->write(json_encode($data));
         return $data;
     }
     return json_decode($fileHandler->read(), true);
 }
Ejemplo n.º 20
0
function ippay_refund($params)
{
    global $remote_ip;
    $url = $params['testmode'] ? "https://testgtwy.ippay.com/ippay" : "https://gtwy.ippay.com/ippay";
    $transid = $params['invoiceid'] . date("YmdHis");
    $transid = substr($transid, 0, 18);
    $transid = str_pad($transid, 18, "0", STR_PAD_LEFT);
    $xmldata = "<JetPay>\n    <TransactionType>CREDIT</TransactionType>\n    <TerminalID>" . $params['terminalid'] . "</TerminalID>\n    <TransactionID>" . $transid . "</TransactionID>\n    <CardNum>" . $params['cardnum'] . "</CardNum>\n    <CardExpMonth>" . substr($params['cardexp'], 0, 2) . "</CardExpMonth>\n    <CardExpYear>" . substr($params['cardexp'], 2, 2) . "</CardExpYear>\n    <TotalAmount>" . $params['amount'] * 100 . "</TotalAmount>\n    </JetPay>";
    $response = curlCall($url, $xmldata);
    $response = XMLtoArray($response);
    $response = $response['JETPAYRESPONSE'];
    if ($response['ACTIONCODE'] == "000") {
        return array("status" => "success", "transid" => $response['TRANSACTIONID'], "rawdata" => $response);
    }
    return array("status" => "error", "rawdata" => $response);
}
Ejemplo n.º 21
0
 public function update()
 {
     if ($GLOBALS['cached'] == false || $this->_fileHandler->lastTimeModified() >= 30) {
         // updates every 30 seconds
         $poolData = array();
         foreach ($this->_actions as $action) {
             $poolData[$action] = curlCall($this->_apiURL . '/api/' . $action);
         }
         // Offline Check
         if (empty($poolData[$this->_actions[0]])) {
             return;
         }
         // Data Order
         $data['type'] = $this->_type;
         $data['total_paid'] = !empty($poolData[$this->_apiKey]['total_paid']) ? $poolData[$this->_apiKey]['total_paid'] / 100000000 : 0;
         $data['balance'] = !empty($poolData[$this->_apiKey]['balance']) ? $poolData[$this->_apiKey]['balance'] / 100000000 : 0;
         $data['unconfirmed_balance'] = !empty($poolData[$this->_apiKey]['unconfirmed_balance']) ? $poolData[$this->_apiKey]['unconfirmed_balance'] / 100000000 : 0;
         $data['estimated_round_payout'] = !empty($poolData[$this->_apiKey]['est_round_payout']) ? number_format($poolData[$this->_apiKey]['est_round_payout'], 8) : 0;
         $data['pool_hashrate'] = formatHashrate($poolData['pool_stats']['hashrate']);
         $data['user_hashrate'] = formatHashrate($poolData[$this->_apiKey]['last_10_hashrate'] * 1000);
         $data['pool_workers'] = $poolData['pool_stats']['workers'];
         $data['accepted'] = 0;
         $data['rejected'] = 0;
         $data['efficiency'] = 0;
         $data['active_worker(s)'] = 0;
         foreach ($poolData[$this->_apiKey]['workers'] as $worker) {
             if ($worker['online']) {
                 $data['efficiency'] += $worker['efficiency'];
                 $data['accepted'] += $worker['accepted'];
                 $data['rejected'] += $worker['rejected'];
                 $data['active_worker(s)']++;
             }
         }
         if ($data['active_worker(s)'] > 0) {
             $data['efficiency'] = number_format($data['efficiency'] / $data['active_worker(s)'], 2);
         } else {
             $data['efficiency'] = 0.0;
         }
         $data['efficiency'] .= '%';
         $data['time_since_last_block'] = gmdate('H\\H i\\M s\\S', $poolData['pool_stats']['round_duration']);
         $data['last_block_found'] = $poolData['pool_stats']['last_block_found'];
         $data['url'] = $this->_apiURL;
         $this->_fileHandler->write(json_encode($data));
         return $data;
     }
     return json_decode($this->_fileHandler->read(), true);
 }
Ejemplo n.º 22
0
/**
 *
 * @ WHMCS FULL DECODED & NULLED
 *
 * @ Version  : 5.2.15
 * @ Author   : MTIMER
 * @ Release on : 2013-12-24
 * @ Website  : http://www.mtimer.cn
 *
 **/
function currencyUpdateRates()
{
    global $cron;
    $stuff = curlCall("http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml", array());
    $stuff = explode("\r\n", $stuff);
    $exchrate = array();
    $exchrate['EUR'] = 1;
    foreach ($stuff as $line) {
        $line = trim($line);
        $matchstr = "currency='";
        $pos1 = strpos($line, $matchstr);
        if ($pos1) {
            $currencysymbol = substr($line, $pos1 + strlen($matchstr), 3);
            $matchstr = "rate='";
            $pos2 = strpos($line, $matchstr);
            $ratestr = substr($line, $pos2 + strlen($matchstr));
            $pos3 = strpos($ratestr, "'");
            $rate = substr($ratestr, 0, $pos3);
            $exchrate[$currencysymbol] = $rate;
            continue;
        }
    }
    $result = select_query("tblcurrencies", "", array("`default`" => "1"));
    $data = mysql_fetch_array($result);
    $currencycode = $data['code'];
    $baserate = $exchrate[$currencycode];
    $return = "";
    $result = select_query("tblcurrencies", "", array("`default`" => array("sqltype" => "NEQ", "value" => "1")), "code", "ASC");
    while ($data = mysql_fetch_array($result)) {
        $id = $data['id'];
        $code = $data['code'];
        $coderate = $exchrate[$code];
        $exchangerate = round(1 / ($baserate / $coderate), 5);
        if (0 < $exchangerate) {
            update_query("tblcurrencies", array("rate" => $exchangerate), array("id" => $id));
            if (is_object($cron)) {
                $cron->logActivity("Updated " . $code . " Exchange Rate to " . $exchangerate, true);
            }
            $return .= "Updated " . $code . " Exchange Rate to " . $exchangerate . "<br />";
        }
        if (is_object($cron)) {
            $cron->logActivity("Update Failed for " . $code . " Exchange Rate", true);
        }
        $return .= "Update Failed for " . $code . " Exchange Rate<br />";
    }
    return $return;
}
Ejemplo n.º 23
0
 public function update()
 {
     if ($GLOBALS['cached'] == false || $this->_fileHandler->lastTimeModified() >= 30) {
         // updates every 30 seconds
         $poolData = array();
         $poolData = curlCall($this->_apiURL . '/api/stats');
         // Offline Check
         if (empty($poolData)) {
             return;
         }
         if (empty($this->_coin)) {
             $this->findCoin($poolData);
         }
         $poolData = $poolData['pools'][$this->_coin];
         $totalValidShares = 0;
         $totalInValidShares = 0;
         foreach ($poolData['workers'] as $address => $values) {
             $totalValidShares += $values['shares'];
             $totalInValidShares += $values['invalidshares'];
         }
         $totalShares = $totalValidShares + $totalInValidShares;
         // Data Order
         $data['type'] = $this->_type;
         $data['algorithm'] = $poolData['algorithm'];
         $data['coin'] = $poolData['name'] . ' (' . $poolData['symbol'] . ')';
         $data['pool_hashrate'] = $poolData['hashrateString'];
         $data['pool_valid_shares'] = $totalValidShares;
         $data['pool_invalid_shares'] = $totalInValidShares;
         $data['pool_workers'] = $poolData['workerCount'];
         $data['user_hashrate'] = $poolData['workers'][$this->_address]['hashrateString'];
         $data['user_valid_shares'] = $poolData['workers'][$this->_address]['shares'];
         $data['user_invalid_shares'] = $poolData['workers'][$this->_address]['invalidshares'];
         $userTotalShares = $poolData['workers'][$this->_address]['shares'] + $poolData['workers'][$this->_address]['invalidshares'];
         $data['round_share_%'] = round($userTotalShares / $totalShares * 100, 4);
         $data['blocks_pool_found'] = $poolData['poolStats']['validBlocks'];
         $data['blocks_confirmed'] = $poolData['blocks']['confirmed'];
         $data['blocks_pending'] = $poolData['blocks']['pending'];
         if ($poolData['blocks']['orphaned'] != 0) {
             $data['blocks_orphaned'] = $poolData['blocks']['orphaned'];
         }
         $data['url'] = $this->_apiURL;
         $this->_fileHandler->write(json_encode($data));
         return $data;
     }
     return json_decode($this->_fileHandler->read(), true);
 }
Ejemplo n.º 24
0
 public function update()
 {
     if ($GLOBALS['cached'] == false || $this->_fileHandler->lastTimeModified() >= 30) {
         // updates every 30 seconds
         $poolData = array();
         foreach ($this->_actions as $action) {
             if ($action == 'livedata') {
                 $poolData[$action] = curlCall($this->_apiURL . '/instant.php/livedata.json');
                 continue;
             }
             $actionParam = $action;
             if ($action == 'getuserhashrate' || $action == 'getuserstat') {
                 if ($action == 'getuserhashrate') {
                     $actionParam = 'gethashrate';
                 }
                 $actionParam .= '&username='******'/api.php?cmd=' . $actionParam);
         }
         // Offline Check
         if (empty($poolData[$this->_actions[0]])) {
             return;
         }
         // Data Order
         $data['type'] = $this->_type;
         $data['sent'] = number_format($poolData['getuserstat']['output']['everpaid'] * 1.0E-8, 8);
         $data['balance'] = number_format($poolData['getuserstat']['output']['lbal'] * 1.0E-8, 8);
         $data['unconfirmed_balance'] = number_format(($poolData['getuserstat']['output']['bal'] - $poolData['getuserstat']['output']['lbal']) * 1.0E-8, 8);
         $data['total_balance'] = number_format($data['balance'] + $data['unconfirmed_balance'], 8);
         $data['pool_hashrate_(64 seconds)'] = $poolData['gethashrate']['output']['av64']['pretty'];
         $data['user_hashrate_(3_hours)'] = $poolData['getuserhashrate']['output']['av10800']['pretty'];
         $data['user_hashrate_(22.5_minutes)'] = $poolData['getuserhashrate']['output']['av1350']['pretty'];
         $data['user_hashrate_(128_seconds)'] = $poolData['getuserhashrate']['output']['av128']['pretty'];
         $data['round_duration'] = formatTimeElapsed($poolData['livedata']['roundduration']);
         $data['round_luck'] = round(round($poolData['livedata']['network_difficulty'] * 1000 / $poolData['livedata']['roundsharecount'], 2) / 10, 2) . '%';
         $data['last_block'] = $poolData['livedata']['lastblockheight'];
         $data['last_block_url'] = $this->_apiURL . '/blocks.php';
         $data['url_name'] = 'http://eligius.st';
         $data['url'] = $this->_apiURL . '/userstats.php/' . $this->_btcaddess;
         $this->_fileHandler->write(json_encode($data));
         return $data;
     }
     return json_decode($this->_fileHandler->read(), true);
 }
Ejemplo n.º 25
0
/**
 *
 * @ WHMCS FULL DECODED & NULLED
 *
 * @ Version  : 5.2.15
 * @ Author   : MTIMER
 * @ Release on : 2013-12-24
 * @ Website  : http://www.mtimer.cn
 *
 * */
function widget_paypal_addon($vars)
{
    $title = "PayPal Overview";
    $params = array();
    $result = select_query("tbladdonmodules", "setting,value", array("module" => "paypal_addon"));
    while ($data = mysql_fetch_array($result)) {
        $params[$data[0]] = $data[1];
    }
    $content = "";
    $adminroleid = get_query_val("tbladmins", "roleid", array("id" => $_SESSION['adminid']));
    if ($params["showbalance" . $adminroleid]) {
        $url = "https://api-3t.paypal.com/nvp";
        $postfields = $resultsarray = array();
        $postfields['USER'] = $params['username'];
        $postfields['PWD'] = $params['password'];
        $postfields['SIGNATURE'] = $params['signature'];
        $postfields['METHOD'] = "GetBalance";
        $postfields['RETURNALLCURRENCIES'] = "1";
        $postfields['VERSION'] = "56.0";
        $result = curlCall($url, $postfields);
        $resultsarray2 = explode("&", $result);
        foreach ($resultsarray2 as $line) {
            $line = explode("=", $line);
            $resultsarray[$line[0]] = urldecode($line[1]);
        }
        $paypalbal = array();
        if (strtolower($resultsarray['ACK']) != "success") {
            $paypalbal[] = "Error: " . $resultsarray['L_LONGMESSAGE0'];
        } else {
            $i = 0;
            while ($i <= 20) {
                if (isset($resultsarray["L_AMT" . $i])) {
                    $paypalbal[] = number_format($resultsarray["L_AMT" . $i], 2, ".", ",") . " " . $resultsarray["L_CURRENCYCODE" . $i];
                }
                ++$i;
            }
        }
        $content .= "<div style=\"margin:10px;padding:10px;background-color:#EFFAE4;text-align:center;font-size:16px;color:#000;\">PayPal Balance: <b>" . implode(" ~ ", $paypalbal) . "</b></div>";
    }
    $content .= "<form method=\"post\" action=\"addonmodules.php?module=paypal_addon\">\n<div align=\"center\" style=\"margin:10px;font-size:16px;\">Lookup PayPal Transaction ID: <input type=\"text\" name=\"transid\" size=\"30\" value=\"" . $_POST['transid'] . "\" style=\"font-size:16px;\" /> <input type=\"submit\" name=\"search\" value=\"Go\" /></div>\n<div align=\"right\"><a href=\"addonmodules.php?module=paypal_addon\">Advanced Search &raquo;</a></div>\n</form>";
    return array("title" => $title, "content" => $content);
}
Ejemplo n.º 26
0
function cyberbit_capture($params)
{
    if ($params['testmode']) {
        $url = "https://test.cyberbit.dk/author.php";
    } else {
        $url = "https://merch.pmtngin.com/author.php";
    }
    $postfields = array();
    $postfields['Version'] = "2";
    $postfields['Secret'] = $params['transsecret'];
    $postfields['MerchantId'] = $params['merchantid'];
    $postfields['RecurringRefId'] = $params['gatewayid'];
    $postfields['InternalOrderId'] = time() . "-" . $params['invoiceid'];
    $result = curlCall($url, $postfields);
    $xmldata = XMLtoArray($result);
    if ($xmldata['ECCPRO']['STATUSCODE'] == "000") {
        return array("status" => "success", "transid" => $xmldata['ECCPRO']['RESPONSE']['ORDERID'], "rawdata" => $xmldata['ECCPRO']['RESPONSE']);
    }
    return array("status" => "declined", "rawdata" => $xmldata['ECCPRO']['RESPONSE']);
}
Ejemplo n.º 27
0
 public function update()
 {
     if ($GLOBALS['cached'] == false || $this->_fileHandler->lastTimeModified() >= 30) {
         // updates every 30 seconds
         $poolData = array();
         foreach ($this->_actions as $action) {
             $poolData[$action] = curlCall($this->_apiURL . '/api.php?key=' . $this->_apiKey . '&action=' . $action);
         }
         // Offline Check
         if (empty($poolData[$this->_actions[0]])) {
             return;
         }
         // Data Order
         $data['type'] = $this->_type;
         $data['total_sent'] = $poolData['userstats']['data']['user']['total_payout'];
         $data['balance'] = $poolData['userstats']['data']['user']['confirmed_rewards'];
         $data['unconfirmed_balance'] = $poolData['userstats']['data']['user']['unconfirmed_rewards'];
         $data['estimated_rewards'] = $poolData['userstats']['data']['user']['estimated_rewards'];
         $data['pool_hashrate'] = $poolData['poolstats']['hashrate'];
         $data['user_hashrate'] = 0;
         $speedMultiplier = array('GH/s' => 1000, 'TH/s' => 1000000);
         foreach ($poolData['userstats']['workers'] as $worker) {
             if (!empty($worker['hash_rate'])) {
                 $hashrate = strtok($worker['hash_rate'], ' ');
                 $hashspeed = substr(strrchr($worker['hash_rate'], ' '), 1);
                 $data['user_hashrate'] += $hashrate * $speedMultiplier[$hashspeed];
             }
         }
         $data['user_hashrate'] = formatHashRate($data['user_hashrate'] * 1000);
         $data['pool_workers'] = $poolData['poolstats']['active_workers'];
         // how to get active user workers and total hashrate?
         $data['time_since_last_block'] = $poolData['poolstats']['round_duration'];
         // Would love to format this one day
         //            $data['time_since_last_block'] = formatTimeElapsed(); // how to format? 00:52:44
         $data['url'] = $this->_apiURL;
         $this->_fileHandler->write(json_encode($data));
         return $data;
     }
     return json_decode($this->_fileHandler->read(), true);
 }
Ejemplo n.º 28
0
function quantumgateway_refund($params)
{
    if (!$params['cardlastfour']) {
        $url = "https://secure.quantumgateway.com/cgi/xml_requester.php";
        $prexml = "<QGWRequest>\n<Authentication>\n<GatewayLogin>" . $params['loginid'] . "</GatewayLogin>\n<GatewayKey>" . $params['transkey'] . "</GatewayKey>\n</Authentication>\n<Request>\n<RequestType>ShowTransactionDetails</RequestType>\n<TransactionID>" . $params['transid'] . "</TransactionID>\n</Request>\n</QGWRequest>";
        $predata = curlCall($url, "xml=" . $prexml);
        $preresults = XMLtoArray($predata);
        if ($preresults['QGWREQUEST']['RESULT']['PAYMENTTYPE'] == "CC") {
            $params['cardlastfour'] = $preresults['QGWREQUEST']['RESULT']['CREDITCARDNUMBER'];
        } else {
            return array("status" => "error", "rawdata" => "Original Payment not made by CC " . $predata);
        }
    }
    $url = "https://secure.quantumgateway.com/cgi/xml_requester.php";
    $xml = "<QGWRequest>\n<Authentication>\n<GatewayLogin>" . $params['loginid'] . "</GatewayLogin>\n<GatewayKey>" . $params['transkey'] . "</GatewayKey>\n</Authentication>\n<Request>\n<RequestType>ProcessSingleTransaction</RequestType>\n<ProcessType>RETURN</ProcessType>\n<PaymentType>CC</PaymentType>\n<Amount>" . $params['amount'] . "</Amount>\n<TransactionID>" . $params['transid'] . "</TransactionID>\n<CreditCardNumber>" . $params['cardlastfour'] . "</CreditCardNumber>\n</Request>\n</QGWRequest>";
    $data = curlCall($url, "xml=" . $xml);
    $results = XMLtoArray($data);
    if ($results['QGWREQUEST']['RESULT']['STATUS'] == "APPROVED") {
        return array("status" => "success", "transid" => $results['QGWREQUEST']['RESULT']['TRANSACTIONID'], "rawdata" => $results['QGWREQUEST']['RESULT']);
    }
    return array("status" => "error", "rawdata" => $data);
}
Ejemplo n.º 29
0
function ewayuk_link($params)
{
    $query = "";
    $gatewaytestmode = $params['testmode'];
    if ($gatewaytestmode == "on") {
        $query .= "CustomerID=87654321";
        $query .= "&UserName=TestAccount";
    } else {
        $query .= "CustomerID=" . $params['customerid'];
        $query .= "&UserName="******"&MerchantInvoice=" . $params['invoiceid'];
    $query .= "&MerchantReference=" . $params['invoiceid'];
    $query .= "&Amount=" . urlencode($params['amount']);
    $query .= "&Currency=" . $params['currency'];
    $query .= "&CustomerFirstName=" . $params['clientdetails']['firstname'];
    $query .= "&CustomerLastName=" . $params['clientdetails']['lastname'];
    $query .= "&CustomerAddress=" . $params['clientdetails']['address1'] . " " . $params['clientdetails']['address2'];
    $query .= "&CustomerCity=" . $params['clientdetails']['city'];
    $query .= "&CustomerState=" . $params['clientdetails']['state'];
    $query .= "&CustomerPostCode=" . $params['clientdetails']['postcode'];
    $query .= "&CustomerCountry=" . $params['clientdetails']['country'];
    $query .= "&CustomerEmail=" . $params['clientdetails']['email'];
    $query .= "&CustomerPhone=" . $params['clientdetails']['phonenumber'];
    $query .= "&CancelUrl=" . urlencode($params['systemurl'] . "/viewinvoice.php?id=" . $params['invoiceid']);
    $query .= "&ReturnUrl=" . urlencode($params['systemurl'] . "/modules/gateways/callback/ewayuk.php");
    $query = str_replace(" ", "%20", $query);
    $posturl = "https://payment.ewaygateway.com/Request/?" . $query;
    $response = curlCall($posturl, "");
    $responsemode = strtolower(ewayuk_fetch_data($response, "<Result>", "</Result>"));
    if ($responsemode == "true") {
        $redirecturl = ewayuk_fetch_data($response, "<Uri>", "</Uri>");
        $code = "<input type=\"button\" value=\"" . $params['langpaynow'] . "\" onclick=\"window.location='" . $redirecturl . "'\" />\n</form>";
        return $code;
    }
    logTransaction("eWay UK", $response, "Error");
    return "An Error Occurred. Please try again later or submit a ticket if the error persists.";
}
Ejemplo n.º 30
0
 public function update()
 {
     if ($GLOBALS['cached'] == false || $this->_fileHandler->lastTimeModified() >= 30) {
         // updates every 30 seconds
         $poolData['pool'] = curlCall($this->_apiURL . '/api.php');
         $poolData['user'] = curlCall($this->_apiURL . '/api.php?user='******'pool']) || empty($poolData['user'])) {
             return;
         }
         // Data Order
         $data['type'] = $this->_type;
         $data['total_paid'] = number_format($poolData['user']['totalPaid'], 8);
         $data['balance'] = number_format($poolData['user']['pending'], 8);
         $data['profitability_(BTC/MHs/day)'] = number_format($poolData['user']['lastProf'], 8);
         $data['pool_hashrate'] = formatHashrate($poolData['pool']['poolhashrate'] * 1000);
         $data['user_hashrate'] = formatHashrate($poolData['user']['hashrate'] * 1000);
         $data['url'] = $this->_apiURL;
         $this->_fileHandler->write(json_encode($data));
         return $data;
     }
     return json_decode($this->_fileHandler->read(), true);
 }