Ejemplo n.º 1
1
function whmcsreseller_CreateAccount($params)
{
    $clientid = $params['clientsdetails']['userid'];
    $serviceid = $params['serviceid'];
    $pid = $params['pid'];
    switch ($params['configoption1']) {
        case "Branding":
            $lic_type = "branding";
            break;
        case "No Branding":
            $lic_type = "nobranding";
            break;
    }
    $query = "SELECT id, license FROM whmcsresellerlicenses WHERE user_id IS NULL AND type='{$lic_type}' LIMIT 1";
    $data = full_query($query);
    if (!mysql_num_rows($data)) {
        return "No licenses available to assign";
    }
    $r = mysql_fetch_array($data);
    $lic_id = $r[0];
    $lic_str = $r[1];
    $res = select_query("tblcustomfields", "*", array("relid" => $pid, "fieldname" => "License"));
    if (!mysql_num_rows($res)) {
        return "License field not created for product";
    } else {
        $row = mysql_fetch_assoc($res);
        $customfield = $row['id'];
    }
    update_query("whmcsresellerlicenses", array("user_id" => $clientid, "prod_id" => $serviceid), "id='{$lic_id}'");
    full_query("UPDATE tblcustomfieldsvalues SET value='{$lic_str}' WHERE fieldid='{$customfield}' AND relid='{$serviceid}'");
    return "success";
}
Ejemplo n.º 2
0
/**
 *
 * @ WHMCS FULL DECODED & NULLED
 *
 * @ Version  : 5.2.15
 * @ Author   : MTIMER
 * @ Release on : 2013-12-24
 * @ Website  : http://www.mtimer.cn
 *
 * */
function widget_staffboard_overview($vars)
{
    global $_ADMINLANG;
    $title = "Staff Noticeboard";
    $lastviews = get_query_val("tbladdonmodules", "value", array("module" => "staffboard", "setting" => "lastviewed"));
    if ($lastviews) {
        $lastviews = unserialize($lastviews);
        $new = false;
    } else {
        $lastviews = array();
        $new = true;
    }
    $lastviewed = $lastviews[$_SESSION['adminid']];
    $lastviews[$_SESSION['adminid']] = time();
    if ($new) {
        insert_query("tbladdonmodules", array("module" => "staffboard", "setting" => "lastviewed", "value" => serialize($lastviews)));
    } else {
        update_query("tbladdonmodules", array("value" => serialize($lastviews)), array("module" => "staffboard", "setting" => "lastviewed"));
    }
    $numchanged = get_query_val("mod_staffboard", "COUNT(id)", "date>='" . date("Y-m-d H:i:s", $lastviewed) . "'");
    $content = "\n<style>\n.staffboardchanges {\n    margin: 0 0 5px 0;\n    padding: 8px 25px;\n    font-size: 1.2em;\n    text-align: center;\n}\n.staffboardnotices {\n    max-height: 130px;\n    overflow: auto;\n    border-top: 1px solid #ccc;\n    border-bottom: 1px solid #ccc;\n}\n.staffboardnotices div {\n    padding: 5px 15px;\n    border-bottom: 2px solid #fff;\n}\n.staffboardnotices div.pink {\n    background-color: #F3CBF3;\n}\n.staffboardnotices div.yellow {\n    background-color: #FFFFC1;\n}\n.staffboardnotices div.purple {\n    background-color: #DCD7FE;\n}\n.staffboardnotices div.white {\n    background-color: #FAFAFA;\n}\n.staffboardnotices div.pink {\n    background-color: #F3CBF3;\n}\n.staffboardnotices div.blue {\n    background-color: #A6E3FC;\n}\n.staffboardnotices div.green {\n    background-color: #A5F88B;\n}\n</style>\n<div class=\"staffboardchanges\">There are <strong>" . $numchanged . "</strong> New or Updated Staff Notices Since your Last Visit - <a href=\"addonmodules.php?module=staffboard\">Visit Noticeboard &raquo;</a></div><div class=\"staffboardnotices\">";
    $result = select_query("mod_staffboard", "", "", "date", "DESC");
    while ($data = mysql_fetch_array($result)) {
        $content .= "<div class=\"" . $data['color'] . "\">" . fromMySQLDate($data['date'], 1) . " - " . (100 < strlen($data['note']) ? substr($data['note'], 0, 100) . "..." : $data['note']) . "</div>";
    }
    $content .= "</div>";
    return array("title" => $title, "content" => $content, "jquerycode" => $jquerycode);
}
Ejemplo n.º 3
0
/**
 *
 * @ WHMCS FULL DECODED & NULLED
 *
 * @ Version  : 5.2.15
 * @ Author   : MTIMER
 * @ Release on : 2013-12-24
 * @ Website  : http://www.mtimer.cn
 *
 **/
function doUnsubscribe($email, $key)
{
    global $whmcs;
    global $_LANG;
    $whmcs->get_hash();
    if (!$email) {
        return $_LANG['pwresetemailrequired'];
    }
    $result = select_query("tblclients", "id,email,emailoptout", array("email" => $email));
    $data = mysql_fetch_array($result);
    $userid = $data['id'];
    $email = $data['email'];
    $emailoptout = $data['emailoptout'];
    $newkey = sha1($email . $userid . $cc_encryption_hash);
    if ($newkey == $key) {
        if (!$userid) {
            return $_LANG['unsubscribehashinvalid'];
        }
        if ($emailoptout == 1) {
            return $_LANG['alreadyunsubscribed'];
        }
        update_query("tblclients", array("emailoptout" => "1"), array("id" => $userid));
        sendMessage("Unsubscribe Confirmation", $userid);
        logActivity("Unsubscribed From Marketing Emails - User ID:" . $userid, $userid);
        return null;
    }
    return $_LANG['unsubscribehashinvalid'];
}
Ejemplo n.º 4
0
function paymentwallbrick_capture($params)
{
    if (!class_exists("Paymentwall_Config")) {
        require_once dirname(__FILE__) . "/paymentwallbrick/lib/paymentwall.php";
    }
    if ($params["test_mode"] == "on") {
        Paymentwall_Config::getInstance()->set(array('api_type' => Paymentwall_Config::API_GOODS, 'public_key' => $params['test_public_key'], 'private_key' => $params['test_private_key']));
    } else {
        Paymentwall_Config::getInstance()->set(array('api_type' => Paymentwall_Config::API_GOODS, 'public_key' => $params['public_key'], 'private_key' => $params['private_key']));
    }
    $email = $params['clientdetails']['email'];
    $charge = new Paymentwall_Charge();
    if (isset($_POST['brick_token'])) {
        $charge->create(array('email' => $email, 'currency' => $params['currency'], 'capture' => true, 'amount' => $params['amount'], 'fingerprint' => $_POST['brick_fingerprint'], 'token' => $_POST['brick_token'], 'plan' => $params["invoiceid"], 'description' => "Payment of Invoice #" . $params['invoiceid']));
        update_query("tblclients", array("cardtype" => $charge->card->type, "gatewayid" => $charge->card->token, "cardlastfour" => $charge->card->last4), array("id" => $params['clientdetails']['id']));
    } else {
        $charge->create(array('token' => $params['gatewayid'], 'email' => $email, 'currency' => $params['currency'], 'capture' => true, 'amount' => $params['amount'], 'plan' => $params["invoiceid"], 'description' => "Payment of Invoice #" . $params['invoiceid']));
    }
    if ($charge->isSuccessful()) {
        if ($charge->isCaptured()) {
            return array('status' => 'success', 'transid' => $charge->id);
        } elseif ($charge->isUnderReview()) {
            $_SESSION['paywall_pending_review'] = true;
            $_SESSION['paymentwall_errors'] = "Your payment is currently under review, you will be notified via email within two minutes if your transaction is approved.";
            return array('status' => 'error', 'rawdata' => $errors['error']['message']);
        }
    } else {
        $response = $charge->getPublicData();
        $errors = json_decode($response, true);
        $_SESSION['paymentwall_errors'] = $errors['error']['message'];
        return array('status' => 'error', 'rawdata' => $errors['error']['message']);
    }
}
Ejemplo n.º 5
0
/**
* FUNCTION kwspamexperts_CreateAccount
* Create Account
* @param array $params
* @return string
*/
function kwspamexperts_CreateAccount($params)
{
    $api = new kwspamexperts_api($params);
    $domain = !empty($params["customfields"]["Domain"]) ? $params["customfields"]["Domain"] : $params['domain'];
    $password = !empty($params['password']) ? $params["password"] : createServerPassword();
    $email = !empty($params["customfields"]["Email"]) ? $params["customfields"]["Email"] : $params['clientsdetails']['email'];
    $archiving = (int) (!empty($params["configoptions"]["archiving"]) && $params["configoptions"]["archiving"]);
    // update password
    update_query("tblhosting", array("password" => encrypt($password)), array("id" => $params['serviceid']));
    // add domain
    if (empty($domain)) {
        return "Domain cannot be empty. Please enter domain name in Domain field.";
    }
    $api->call("domain/add/domain/" . $domain . "/");
    if ($api->isError()) {
        return $api->error();
    }
    // add email
    $api->call("domainuser/add/domain/" . $domain . "/password/" . $password . "/email/" . $email . "/");
    if ($api->isError()) {
        return $api->error();
    }
    $outgoing = $params["configoption1"] != 'Incoming' ? 1 : 0;
    $incoming = $params["configoption1"] != 'Outgoing' ? 1 : 0;
    $api->call("domain/setproducts/domain/" . $domain . "/incoming/" . $incoming . "/outgoing/" . $outgoing . "/archiving/{$archiving}/");
    if ($api->isError()) {
        return $api->error();
    }
    $res = kwspamexperts_ChangePackage($params);
    if (!$res) {
        return $res;
    }
    return "success";
}
Ejemplo n.º 6
0
    public static function save($account)
    {
        $params = [':identity' => $account->getIdentity(), ':active_email' => $account->getActiveEmail(), ':type' => $account->getType(), ':oauth_provider' => $account->getOauthProvider(), ':oauth_id' => (string) $account->getOauthId($account->getOauthProvider()), ':account_id' => $account->getId()];
        $updated = update_query('update accounts set 
				account_identity = :identity, active_email = :active_email, type = :type, oauth_provider = :oauth_provider,
				oauth_id = :oauth_id				
				where account_id = :account_id', $params);
        return $updated;
    }
Ejemplo n.º 7
0
function insert_ratings()
{
    $user_id = $_POST["user_id"];
    $help_request_id = $_POST["help_request_id"];
    $comments = $_POST["comments"];
    $rating = $_POST["rating"];
    $query = "INSERT  into ratings (user_id,help_request_id,comments,rating) values ({$user_id},{$help_request_id},'{$comments}', {$rating}) ";
    return update_query($query);
}
Ejemplo n.º 8
0
function gamecp_CreateAccount($params)
{
    $serviceid = $params['serviceid'];
    $pid = $params['pid'];
    $producttype = $params['producttype'];
    $domain = $params['domain'];
    $username = $params['username'];
    $password = $params['password'];
    $clientsdetails = $params['clientsdetails'];
    $customfields = $params['customfields'];
    $configoptions = $params['configoptions'];
    $configoption1 = $params['configoption1'];
    $configoption2 = $params['configoption2'];
    $configoption3 = $params['configoption3'];
    $configoption4 = $params['configoption4'];
    $server = $params['server'];
    $serverid = $params['serverid'];
    $serverip = $params['serverip'];
    $serverusername = $params['serverusername'];
    $serverpassword = $params['serverpassword'];
    $serveraccesshash = $params['serveraccesshash'];
    $serversecure = $params['serversecure'];
    if (!$username) {
        $username = strtolower($customfields['field_name']);
    }
    $username = preg_replace("/[^a-z0123456789]/", "", $username);
    update_query("tblhosting", array("username" => $username), array("id" => $params['serviceid']));
    $args = array("plugin_gamecp_GameCP_URL" => $params['configoption1'], "plugin_gamecp_Connector_Passphrase" => $params['configoption2'], "debugging" => "off");
    $unfio = array("action" => "userinfo", "function" => "userinfo", "customerid" => $clientsdetails['userid']);
    $userinfo = curl2gcp($args, $unfio);
    preg_match_all('/USER: (?P<name>\\w+) ::/', $userinfo, $matches);
    if ($matches['name'][0] && $matches['name'][0] != $username) {
        update_query("tblhosting", array("username" => $matches['name'][0]), array("id" => $params['serviceid']));
        $customfields['field_name'] = $matches['name'][0];
    }
    preg_match_all('/PASS: (?P<pass>\\w+) ::/', $userinfo, $pwmatch);
    if ($pwmatch['pass'][0]) {
        update_query("tblhosting", array("password" => encrypt($pwmatch['pass'][0])), array("id" => $params['serviceid']));
        $params['password'] = $pwmatch['pass'][0];
    }
    $urlvars = array("action" => "create", "function" => "createacct", "username" => $customfields['field_name'], "password" => $params['password'], "customerid" => $clientsdetails['userid'], "packageid" => $params['serviceid'], "email_server" => $params['configoption8'], "start_server" => $params['configoption9'], "mark_ip_used" => $params['configoption10'], "emailaddr" => $clientsdetails['email'], "firstname" => $clientsdetails['firstname'], "lastname" => $clientsdetails['lastname'], "address" => $clientsdetails['address1'], "city" => $clientsdetails['city'], "state" => $clientsdetails['state'], "country" => $clientsdetails['country'], "zipcode" => $clientsdetails['postcode'], "phonenum" => $clientsdetails['phonenumber'], "game_id" => $params['configoption3'], "max_players" => $configoptions['field_players'], "pub_priv" => $params['configoption4'], "login_path" => $params['configoption5'], "sv_location" => $customfields['field_location'], "website" => $customfields['field_website'], "hostname" => $customfields['field_hostname'], "motd" => $customfields['field_motd'], "rcon_password" => $customfields['field_rconpw'], "priv_password" => $customfields['field_serverpw'], "addons" => serialize($configoptions));
    $args = array("plugin_gamecp_GameCP_URL" => $params['configoption1'], "plugin_gamecp_Connector_Passphrase" => $params['configoption2'], "debugging" => $params['configoption7']);
    $r_result = curl2gcp($args, $urlvars);
    preg_match_all('/USER: (?P<name>\\w+) ::/', $r_result, $matches);
    if ($matches['name'][0] && $matches['name'][0] != $username) {
        update_query("tblhosting", array("username" => $matches['name'][0]), array("id" => $params['serviceid']));
        $customfields['field_name'] = $matches['name'][0];
    }
    $result = checkStatus($r_result);
    if ($result == "completed") {
        $result = "success";
    } else {
        logModuleCall("gamecp", "create", $_REQUEST, $result);
        $result = "There was an error, please check Utilities, Logs,  Module Debug Log for more details.";
    }
    return $result;
}
Ejemplo n.º 9
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.º 10
0
function bluepayremote_capture($params)
{
    update_query("tblclients", array("cardtype" => "", "cardnum" => "", "expdate" => "", "issuenumber" => "", "startdate" => ""), array("id" => $params['clientdetails']['userid']));
    $url = "https://secure.bluepay.com/interfaces/bp20post";
    $postfields = array();
    $postfields['ACCOUNT_ID'] = $params['bpaccountid'];
    $postfields['USER_ID'] = $params['bpuserid'];
    $postfields['TRANS_TYPE'] = "SALE";
    $postfields['PAYMENT_TYPE'] = "CREDIT";
    $postfields['MODE'] = $params['testmode'] ? "TEST" : "LIVE";
    $postfields['AMOUNT'] = $params['amount'];
    $postfields['INVOICE_ID'] = $params['invoiceid'];
    $postfields['NAME1'] = $params['clientdetails']['firstname'];
    $postfields['NAME2'] = $params['clientdetails']['lastname'];
    $postfields['COMPANY_NAME'] = $params['clientdetails']['companyname'];
    $postfields['ADDR1'] = $params['clientdetails']['address1'];
    $postfields['ADDR2'] = $params['clientdetails']['address2'];
    $postfields['CITY'] = $params['clientdetails']['city'];
    $postfields['STATE'] = $params['clientdetails']['state'];
    $postfields['ZIP'] = $params['clientdetails']['postcode'];
    $postfields['COUNTRY'] = $params['clientdetails']['country'];
    $postfields['PHONE'] = $params['clientdetails']['phonenumber'];
    $postfields['EMAIL'] = $params['clientdetails']['email'];
    if ($params['gatewayid'] && !$params['cardnum']) {
        $postfields['MASTER_ID'] = $params['gatewayid'];
        $postfields['TAMPER_PROOF_SEAL'] = md5($params['bpsecretkey'] . $params['bpaccountid'] . $postfields['TRANS_TYPE'] . $postfields['AMOUNT'] . $postfields['MASTER_ID'] . $postfields['NAME1'] . $postfields['PAYMENT_ACCOUNT']);
        $data = curlCall($url, $postfields);
        $result = explode("&", $data);
        foreach ($result as $res) {
            $res = explode("=", $res);
            $resultarray[$res[0]] = $res[1];
        }
        if ($resultarray['STATUS'] == "1") {
            return array("status" => "success", "transid" => $resultarray['TRANS_ID'], "rawdata" => $resultarray);
        }
        return array("status" => "error", "rawdata" => $resultarray);
    }
    $postfields['PAYMENT_ACCOUNT'] = $params['cardnum'];
    $postfields['CARD_CVV2'] = $params['cccvv'];
    $postfields['CARD_EXPIRE'] = $params['cardexp'];
    $postfields['TAMPER_PROOF_SEAL'] = md5($params['bpsecretkey'] . $params['bpaccountid'] . $postfields['TRANS_TYPE'] . $postfields['AMOUNT'] . $postfields['MASTER_ID'] . $postfields['NAME1'] . $postfields['PAYMENT_ACCOUNT']);
    $data = curlCall($url, $postfields);
    $result = explode("&", $data);
    foreach ($result as $res) {
        $res = explode("=", $res);
        $resultarray[$res[0]] = $res[1];
    }
    if ($resultarray['STATUS'] == "1") {
        update_query("tblclients", array("gatewayid" => $resultarray['TRANS_ID']), array("id" => $params['clientdetails']['userid']));
        return array("status" => "success", "transid" => $resultarray['TRANS_ID'], "rawdata" => $resultarray);
    }
    return array("status" => "error", "rawdata" => $resultarray);
}
Ejemplo n.º 11
0
function request_update($index, $update)
{
    $sql = update_query($index, $update);
    $conn = connect_db();
    try {
        $stmt = $conn->prepare($sql);
        $stmt->execute();
        return $stmt;
    } catch (PDOException $e) {
        echo $sql . "<br>" . $e->getMessage();
    }
    // end catch
}
Ejemplo n.º 12
0
function monitis_addon_config()
{
    $configarray = array("name" => "Monitis monitoring", "description" => "Monitis addon for monitoring automation for you and your clients. www.monitis.com", "version" => "1.0", "author" => "Monitis", "logo" => '../modules/addons/monitis_addon/static/img/logo-big.png', "language" => "english", "fields" => array("adminuser" => array("FriendlyName" => "WHMCS Admin", "Type" => "text", "Size" => "25", "Description" => "Username or ID of the admin user under which to execute the WHMCS API call", "Default" => "")));
    if (isset($_REQUEST) && isset($_REQUEST['action']) && $_REQUEST['action'] == 'save') {
        //&& isset($_REQUEST['msave_monitis_addon']) && $_REQUEST['msave_monitis_addon'] == 'Save Changes') {
        $adminuser = $_REQUEST['fields']['monitis_addon']['adminuser'];
        MonitisConf::$adminName = MonitisHelper::checkAdminName();
        $update = array('admin_name' => MonitisConf::$adminName);
        $where = array('client_id' => MONITIS_CLIENT_ID);
        update_query('mod_monitis_setting', $update, $where);
    }
    return $configarray;
}
Ejemplo n.º 13
0
 public function updateAddonSettings($addonId, $settings, $type)
 {
     $addon = monitisSqlHelper::objQuery('SELECT * FROM mod_monitis_addon WHERE addon_id=' . $addonId);
     if ($addon && count($addon) > 0) {
         $value = array('settings' => $settings, 'type' => $type);
         $where = array('addon_id' => $addonId);
         update_query('mod_monitis_addon', $value, $where);
         return 'update';
     } else {
         $value = array('addon_id' => $addonId, 'type' => $type, 'settings' => $settings, 'status' => 'active');
         insert_query('mod_monitis_addon', $value);
         return 'create';
     }
 }
Ejemplo n.º 14
0
/**
* FUNCTION spamexpertsreseller_CreateAccount
* Create Reseller Account
* @param array $params
* @return string
*/
function spamexpertsreseller_CreateAccount($params)
{
    include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'class.connection.php';
    $api = new spamexperts_api($params);
    $domain = !empty($params["customfields"]["Domain"]) ? $params["customfields"]["Domain"] : $params['domain'];
    $password = !empty($params['password']) ? $params["password"] : createServerPassword();
    $email = !empty($params["customfields"]["Email"]) ? $params["customfields"]["Email"] : $params['clientsdetails']['email'];
    $username = !empty($params['username']) ? $params['username'] : uniqid();
    $api->call('/reseller/add/username/' . $username . '/password/' . $password . '/email/' . urlencode($email) . '/domainslimit/' . $params['configoption4'] . '/api_usage/' . ($params['configoption5'] == 'on' ? 1 : 0));
    if ($api->isSuccess()) {
        // update password & username
        update_query("tblhosting", array("password" => encrypt($password), "username" => $username), array("id" => $params['serviceid']));
        return "success";
    } else {
        return $api->error();
    }
}
Ejemplo n.º 15
0
/**
 *
 * @ WHMCS FULL DECODED & NULLED
 *
 * @ Version  : 5.2.15
 * @ Author   : MTIMER
 * @ Release on : 2013-12-24
 * @ Website  : http://www.mtimer.cn
 *
 * */
function payza_config()
{
    $configarray = array("FriendlyName" => array("Type" => "System", "Value" => "Payza (Formerly Alertpay)"), "email" => array("FriendlyName" => "Login ID", "Type" => "text", "Size" => "20"), "securitycode" => array("FriendlyName" => "Security Code", "Type" => "text", "Size" => "40"), "apipassword" => array("FriendlyName" => "API Password", "Type" => "text", "Size" => "20", "Description" => "Only required for automated refunds"), "testmode" => array("FriendlyName" => "Test Mode", "Type" => "yesno", "Description" => "Tick this to test"));
    update_query("tblaccounts", array("gateway" => "payza"), array("gateway" => "alertpay"));
    update_query("tblclients", array("defaultgateway" => "payza"), array("defaultgateway" => "alertpay"));
    update_query("tbldomains", array("paymentmethod" => "payza"), array("paymentmethod" => "alertpay"));
    update_query("tblhosting", array("paymentmethod" => "payza"), array("paymentmethod" => "alertpay"));
    update_query("tblhostingaddons", array("paymentmethod" => "payza"), array("paymentmethod" => "alertpay"));
    update_query("tblinvoiceitems", array("paymentmethod" => "payza"), array("paymentmethod" => "alertpay"));
    update_query("tblinvoices", array("paymentmethod" => "payza"), array("paymentmethod" => "alertpay"));
    update_query("tblorders", array("paymentmethod" => "payza"), array("paymentmethod" => "alertpay"));
    full_query("UPDATE tblproductgroups SET disabledgateways = REPLACE(disabledgateways, 'alertpay', 'payza')");
    update_query("tblpaymentgateways", array("gateway" => "payza"), array("gateway" => "alertpay", "setting" => "email"));
    update_query("tblpaymentgateways", array("gateway" => "payza"), array("gateway" => "alertpay", "setting" => "securitycode"));
    update_query("tblpaymentgateways", array("gateway" => "payza"), array("gateway" => "alertpay", "setting" => "apipassword"));
    update_query("tblpaymentgateways", array("gateway" => "payza"), array("gateway" => "alertpay", "setting" => "testmode"));
    delete_query("tblpaymentgateways", array("gateway" => "alertpay"));
    return $configarray;
}
Ejemplo n.º 16
0
function authorizecim_capture($params)
{
    if ($params['testmode']) {
        $url = "https://apitest.authorize.net/xml/v1/request.api";
    } else {
        $url = "https://api.authorize.net/xml/v1/request.api";
    }
    $gatewayids = explode(",", $params['gatewayid']);
    if (!$gatewayids[0]) {
        return array("status" => "error", "rawdata" => "No Client Profile ID Found");
    }
    if (!$gatewayids[1]) {
        return array("status" => "error", "rawdata" => "No Client Payment Profile ID Found");
    }
    $storednameaddresshash = $gatewayids[2];
    $nameaddresshash = md5($params['clientdetails']['firstname'] . $params['clientdetails']['lastname'] . $params['clientdetails']['address1'] . $params['clientdetails']['city'] . $params['clientdetails']['state'] . $params['clientdetails']['postcode'] . $params['clientdetails']['country']);
    if ($nameaddresshash != $storednameaddresshash) {
        $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<getCustomerPaymentProfileRequest xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\">\n<merchantAuthentication>\n<name>" . $params['loginid'] . "</name>\n<transactionKey>" . $params['transkey'] . "</transactionKey>\n</merchantAuthentication>\n<customerProfileId>" . $gatewayids[0] . "</customerProfileId>\n<customerPaymentProfileId>" . $gatewayids[1] . "</customerPaymentProfileId>\n</getCustomerPaymentProfileRequest>";
        $data = curlCall($url, $xml, array("HEADER" => array("Content-Type: text/xml")));
        $xmldata = XMLtoArray($data);
        $cardnum = $xmldata['GETCUSTOMERPAYMENTPROFILERESPONSE']['PAYMENTPROFILE']['PAYMENT']['CREDITCARD']['CARDNUMBER'];
        $expdate = $xmldata['GETCUSTOMERPAYMENTPROFILERESPONSE']['PAYMENTPROFILE']['PAYMENT']['CREDITCARD']['EXPIRATIONDATE'];
        $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<updateCustomerPaymentProfileRequest xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\">\n<merchantAuthentication>\n<name>" . $params['loginid'] . "</name>\n<transactionKey>" . $params['transkey'] . "</transactionKey>\n</merchantAuthentication>\n<customerProfileId>" . $gatewayids[0] . "</customerProfileId>\n<paymentProfile>\n<billTo>\n<firstName><![CDATA[" . $params['clientdetails']['firstname'] . "]]></firstName>\n<lastName><![CDATA[" . $params['clientdetails']['lastname'] . "]]></lastName>\n<company><![CDATA[" . $params['clientdetails']['companyname'] . "]]></company>\n<address><![CDATA[" . $params['clientdetails']['address1'] . "]]></address>\n<city><![CDATA[" . $params['clientdetails']['city'] . "]]></city>\n<state><![CDATA[" . $params['clientdetails']['state'] . "]]></state>\n<zip><![CDATA[" . $params['clientdetails']['postcode'] . "]]></zip>\n<country><![CDATA[" . $params['clientdetails']['country'] . "]]></country>\n<phoneNumber>" . $params['clientdetails']['phonenumber'] . "</phoneNumber>\n<faxNumber></faxNumber>\n</billTo>\n<payment>\n<creditCard>\n<cardNumber>" . $cardnum . "</cardNumber>\n<expirationDate>" . $expdate . "</expirationDate>\n</creditCard>\n</payment>\n<customerPaymentProfileId>" . $gatewayids[1] . "</customerPaymentProfileId>\n</paymentProfile>\n</updateCustomerPaymentProfileRequest>";
        $data = curlCall($url, $xml, array("HEADER" => array("Content-Type: text/xml")));
        logTransaction("Authorize.net CIM Remote Storage", $data, "Address Update");
        $gatewayids[2] = $nameaddresshash;
        update_query("tblclients", array("gatewayid" => implode(",", $gatewayids)), array("id" => $params['clientdetails']['userid']));
    }
    $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<createCustomerProfileTransactionRequest xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\">\n<merchantAuthentication>\n<name>" . $params['loginid'] . "</name>\n<transactionKey>" . $params['transkey'] . "</transactionKey>\n</merchantAuthentication>\n<transaction>\n<profileTransAuthCapture>\n<amount>" . $params['amount'] . "</amount>\n<customerProfileId>" . $gatewayids[0] . "</customerProfileId>\n<customerPaymentProfileId>" . $gatewayids[1] . "</customerPaymentProfileId>\n<order>\n<invoiceNumber>" . $params['invoiceid'] . "</invoiceNumber>\n</order>\n<recurringBilling>false</recurringBilling>\n";
    if ($params['cccvv']) {
        $xml .= "<cardCode>" . $params['cccvv'] . "</cardCode>\n";
    }
    $xml .= "</profileTransAuthCapture>\n</transaction>\n<extraOptions><![CDATA[x_customer_ip=" . $remote_ip . "]]></extraOptions>\n</createCustomerProfileTransactionRequest>";
    $data = curlCall($url, $xml, array("HEADER" => array("Content-Type: text/xml")));
    $xmldata = XMLtoArray($data);
    if ($xmldata['CREATECUSTOMERPROFILETRANSACTIONRESPONSE']['MESSAGES']['RESULTCODE'] == "Ok") {
        $transid = $xmldata['CREATECUSTOMERPROFILETRANSACTIONRESPONSE']['DIRECTRESPONSE'];
        $transid = explode(",", $transid);
        $transid = $transid[6];
        return array("status" => "success", "transid" => $transid, "rawdata" => $data);
    }
    return array("status" => "error", "rawdata" => $data);
}
Ejemplo n.º 17
0
function hostguard_terminateaccount($params)
{
    $function = 'server/destroy';
    $fields = array('ctid' => $params['customfields']['ctid'], 'vserverid' => $params['customfields']['vserverid']);
    if (intval($fields['ctid']) != 0) {
        unset($fields['vserverid']);
    } else {
        unset($fields['ctid']);
    }
    $result = hostguard_makecall($params, $function, $fields);
    if ($result['destroyed'] == true) {
        $result = "success";
        $query = select_query('tblcustomfields', 'id', array('relid' => $params['pid'], 'fieldname' => 'vserverid'));
        $field = mysql_fetch_assoc($query);
        update_query('tblcustomfieldsvalues', array('value' => ''), array('fieldid' => $field['id'], 'relid' => $params['serviceid']));
        update_query('tblhosting', array('dedicatedip' => '', 'username' => ''), array('id' => $params['serviceid']));
    } else {
        $result = "Could not terminate VPS...";
    }
    return $result;
}
Ejemplo n.º 18
0
function paypalexpress_orderformcheckout($params)
{
    $orderid = get_query_val("tblorders", "id", array("invoiceid" => $params['invoiceid']));
    update_query("tblhosting", array("paymentmethod" => "paypal"), array("orderid" => $orderid, "paymentmethod" => "paypalexpress"));
    update_query("tblhostingaddons", array("paymentmethod" => "paypal"), array("orderid" => $orderid, "paymentmethod" => "paypalexpress"));
    update_query("tbldomains", array("paymentmethod" => "paypal"), array("orderid" => $orderid, "paymentmethod" => "paypalexpress"));
    $finalPaymentAmount = $_SESSION['Payment_Amount'];
    $postfields = array();
    $postfields['TOKEN'] = $_SESSION['paypalexpress']['token'];
    $postfields['PAYERID'] = $_SESSION['paypalexpress']['payerid'];
    $postfields['PAYMENTREQUEST_0_PAYMENTACTION'] = "SALE";
    $postfields['PAYMENTREQUEST_0_AMT'] = $params['amount'];
    $postfields['PAYMENTREQUEST_0_CURRENCYCODE'] = $params['currency'];
    $postfields['IPADDRESS'] = $_SERVER['SERVER_NAME'];
    $results = paypalexpress_api_call($params, "DoExpressCheckoutPayment", $postfields);
    $ack = strtoupper($results['ACK']);
    if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") {
        $transactionId = $results['PAYMENTINFO_0_TRANSACTIONID'];
        $transactionType = $results['PAYMENTINFO_0_TRANSACTIONTYPE'];
        $paymentType = $results['PAYMENTINFO_0_PAYMENTTYPE'];
        $orderTime = $results['PAYMENTINFO_0_ORDERTIME'];
        $amt = $results['PAYMENTINFO_0_AMT'];
        $currencyCode = $results['PAYMENTINFO_0_CURRENCYCODE'];
        $feeAmt = $results['PAYMENTINFO_0_FEEAMT'];
        $settleAmt = $results['PAYMENTINFO_0_SETTLEAMT'];
        $taxAmt = $results['PAYMENTINFO_0_TAXAMT'];
        $exchangeRate = $results['PAYMENTINFO_0_EXCHANGERATE'];
        $paymentStatus = $results['PAYMENTINFO_0_PAYMENTSTATUS'];
        if ($paymentStatus == "Completed") {
            return array("status" => "success", "transid" => $transactionId, "fee" => $feeAmt, "rawdata" => $results);
        }
        if ($paymentStatus == "Pending") {
            return array("status" => "payment pending", "rawdata" => $results);
        }
        return array("status" => "invalid status", "rawdata" => $results);
    }
    return array("status" => "error", "rawdata" => $results);
}
Ejemplo n.º 19
0
function runFraudCheck($orderid, $fraudmodule, $userid = "", $ip = "")
{
    if (!isValidforPath($fraudmodule)) {
        exit("Invalid Fraud Module Name");
    }
    if (!function_exists("doFraudCheck")) {
        include ROOTDIR . ("/modules/fraud/" . $fraudmodule . "/" . $fraudmodule . ".php");
    }
    $params = getFraudParams($fraudmodule, $userid, $ip);
    $results = doFraudCheck($params);
    $fraudoutput = "";
    if ($results) {
        foreach ($results as $key => $value) {
            if ($key != "userinput" && $key != "title" && $key != "description" && $key != "error") {
                $fraudoutput .= "" . $key . " => " . $value . "\r\n";
                continue;
            }
        }
    }
    update_query("tblorders", array("fraudmodule" => $fraudmodule, "fraudoutput" => $fraudoutput), array("id" => $orderid));
    $results['fraudoutput'] = $fraudoutput;
    return $results;
}
Ejemplo n.º 20
0
function fluidvm_CreateAccount($params)
{
    if (isset($params['customfields']['Username'])) {
        $params['username'] = $params['customfields']['Username'];
    }
    $vhostname = "";
    if (isset($params['customfields']['Hostname'])) {
        $vhostname = $params['customfields']['Hostname'];
        if ($params['domain']) {
            $vhostname .= "." . $params['domain'];
        }
        update_query("tblhosting", array("domain" => $vhostname), array("id" => $params['serviceid']));
        $vhostname = "&v-hostname=" . $vhostname;
    }
    if (isset($params['configoptions']["Operating System"])) {
        $params['configoption3'] = $params['configoptions']["Operating System"];
    }
    if ($params['serveraccesshash']) {
        $params['configoption4'] = $params['serveraccesshash'];
    }
    if (substr($params['username'], 0 - 3) != ".vm") {
        $params->username .= ".vm";
        update_query("tblhosting", array("username" => $params['username']), array("id" => (int) $params['serviceid']));
    }
    $result = fluidvm_get_via_json($params['serversecure'], $params['serverip'], $params['serverusername'], $params['serverpassword'], "8888", "action=simplelist&resource=resourceplan");
    $list = $result->result;
    if ($list) {
        foreach ($list as $key => $value) {
            $plansarray[strtolower($value)] = $key;
        }
    }
    if (!$params['configoption6']) {
        $vhostname .= "&v-send_welcome_f=on";
    }
    $result = fluidvm_get_via_json($params['serversecure'], $params['serverip'], $params['serverusername'], $params['serverpassword'], "8888", "action=add&class=vps&v-type=" . $params['configoption1'] . "&name=" . $params['username'] . "&v-num_ipaddress_f=" . $params['configoption5'] . "&v-contactemail=" . $params['clientsdetails']['email'] . "&v-password="******"&v-ostemplate=" . $params['configoption3'] . "&v-syncserver=" . $params['configoption4'] . "&v-plan_name=" . $plansarray[strtolower($params['configoption2'])] . $vhostname);
    if (fluidvm_if_error($result)) {
        return $result->message;
    }
    $result = fluidvm_get_via_json($params['serversecure'], $params['serverip'], $params['serverusername'], $params['serverpassword'], "8888", "action=getproperty&class=vps&name=" . $params['username'] . "&v-coma_vmipaddress_a=");
    $ipaddresses = $result->result->cadbahhgeh;
    update_query("tblhosting", array("dedicatedip" => $ipaddresses), array("id" => $params['serviceid']));
    return "success";
}
Ejemplo n.º 21
0
 public function promoteMember($ninja_id)
 {
     $query = 'UPDATE clan_player SET member_level = (member_level + 1) WHERE _player_id = :pid';
     $args = [':pid' => $ninja_id];
     return (bool) update_query($query, $args);
 }
Ejemplo n.º 22
0
        echo "<tr><td class=\"fieldlabel\">" . $aInt->lang("gateways", "currencyconvert") . "</td><td class=\"fieldarea\"><select name=\"field[convertto]\"><option value=\"\">" . $aInt->lang("global", "none") . "</option>";
        foreach ($currenciesarray as $currencydata) {
            echo "<option value=\"" . $currencydata['id'] . "\"";
            if ($currencydata['id'] == $GatewayValues[$module]['convertto']) {
                echo " selected";
            }
            echo ">" . $currencydata['code'] . "</option>";
        }
        echo "</select></td></tr>";
    }
    echo "<tr><td class=\"fieldlabel\"></td><td class=\"fieldarea\"><input type=\"submit\" value=\"";
    echo $aInt->lang("global", "savechanges");
    echo "\">";
    if ($GatewayConfig[$module]['UsageNotes']['Value']) {
        echo " (" . $GatewayConfig[$module]['UsageNotes']['Value'] . ")";
    }
    echo "</td></tr>\n</table>\n\n<br />\n\n</form>\n\n";
    if ($count != $order) {
        update_query("tblpaymentgateways", array("order" => $count), array("setting" => "name", "gateway" => $module));
    }
    ++$count;
    $newgateways .= "<option value=\"" . $module . "\">" . $GatewayConfig[$module]['FriendlyName']['Value'] . "</option>";
}
echo $aInt->jqueryDialog("deactivategw", $aInt->lang("gateways", "deactivatemodule"), "<p>" . $aInt->lang("gateways", "deactivatemoduleinfo") . ("</p><form method=\"post\" action=\"configgateways.php?action=deactivate\" id=\"deactivategwfrm\"><input type=\"hidden\" name=\"gateway\" value=\"\" id=\"deactivategwfield\"><input type=\"hidden\" name=\"friendlygateway\" value=\"\" id=\"friendlygatewayname\"><div align=\"center\"><select id=\"newgateway\" name=\"newgateway\">" . $newgateways . "</select></div></form>"), array($aInt->lang("gateways", "deactivate") => "\$('#deactivategwfrm').submit();", $aInt->lang("supportreq", "cancel") => "\$('#newgateway').append(\"<option value='\"+\$(\"#deactivategwfield\").val()+\"'>\"+\$(\"#friendlygatewayname\").val()+\"</option>\"); \$('#deactivategw').dialog('close');"));
$jscode .= "\nfunction deactivateGW(module,friendlyname) {\n    \$(\"#deactivategwfield\").val(module);\n    \$(\"#friendlygatewayname\").val(friendlyname);\n    \$(\"#newgateway option[value='\"+module+\"']\").remove();\n    showDialog(\"deactivategw\");\n}";
$content = ob_get_contents();
ob_end_clean();
$aInt->content = $content;
$aInt->jquerycode = $jquerycode;
$aInt->jscode = $jscode;
$aInt->display();
Ejemplo n.º 23
0
    }
    if ($street_site != $site["street_site"]) {
        $update = $update . ", street_site='" . mysqli_real_escape_string($cxn, $street_site) . "' ";
    }
    if ($city_site != $site["city_site"]) {
        $update = $update . ", city_site='" . mysqli_real_escape_string($cxn, $city_site) . "' ";
    }
    if ($state_site != $site["state_site"]) {
        $update = $update . ", state_site='" . mysqli_real_escape_string($cxn, $state_site) . "' ";
    }
    if ($zip_site != $site["zip_site"]) {
        $update = $update . ", zip_site='" . mysqli_real_escape_string($cxn, $zip_site) . "' ";
    }
    if ($active_site != $site["active_site"]) {
        $update = $update . ", active_site={$active_site} ";
    }
    $update = $update . ", verified_site=curdate() WHERE id_site=" . $id_site;
    /* Testing code
        echo "<p>Query is " . $update . "<p>";
        echo "Value of $active_site is ".$active_site
                ." and from post is ".$_POST["active_site"]
                ." and from query is ".$site["active_site"]."<p>";
    
        */
    $result = update_query($cxn, $update);
    if ($result !== 1) {
        echo "Error updating record: " . mysqli_error($cxn);
    }
}
mysqli_close($cxn);
/* close the db connection */
Ejemplo n.º 24
0
function sagepaytokens_capture($params)
{
    global $remote_ip;
    $subdomain = $params['testmode'] ? "test" : "live";
    if ($params['cardnum']) {
        $url = "https://" . $subdomain . ".sagepay.com/gateway/service/directtoken.vsp";
        $fields = array();
        $fields['VPSProtocol'] = "2.23";
        $fields['TxType'] = "TOKEN";
        $fields['Vendor'] = $params['vendorid'];
        $fields['Currency'] = $params['currency'];
        $fields['CardHolder'] = $params['clientdetails']['firstname'] . " " . $params['clientdetails']['lastname'];
        $fields['CardNumber'] = $params['cardnum'];
        if ($params['cardstart']) {
            $fields['StartDate'] = $params['cardstart'];
        }
        $fields['ExpiryDate'] = $params['cardexp'];
        if ($params['cardissuenum']) {
            $fields['IssueNumber'] = $params['cardissuenum'];
        }
        if ($_REQUEST['cccvv']) {
            $fields['CV2'] = $params['cccvv'];
        }
        $fields['CardType'] = sagepaytokens_getcardtype($params['cardtype']);
        $results = sagepaytokens_call($url, $fields);
        if ($results['Status'] == "OK") {
            $params['gatewayid'] = $results['Token'];
            update_query("tblclients", array("gatewayid" => $results['Token'], "cardnum" => ""), array("id" => $params['clientdetails']['userid']));
        }
    }
    $url = "https://" . $subdomain . ".sagepay.com/gateway/service/vspdirect-register.vsp";
    $fields = array();
    $fields['VPSProtocol'] = "2.23";
    $fields['TxType'] = "PAYMENT";
    $fields['Vendor'] = $params['vendorid'];
    $fields['VendorTxCode'] = $params['invoiceid'] . "-" . date("YmdHis");
    $fields['Amount'] = $params['amount'];
    $fields['Currency'] = $params['currency'];
    $fields['Description'] = $params['companyname'] . " - Invoice #" . $params['invoiceid'];
    $fields['Token'] = $params['gatewayid'];
    $fields['StoreToken'] = "1";
    if ($params['cccvv']) {
        $fields['CV2'] = $params['cccvv'];
    }
    $fields['BillingSurname'] = $params['clientdetails']['lastname'];
    $fields['BillingFirstnames'] = $params['clientdetails']['firstname'];
    $fields['BillingAddress1'] = $params['clientdetails']['address1'];
    $fields['BillingAddress2'] = $params['clientdetails']['address2'];
    $fields['BillingCity'] = $params['clientdetails']['city'];
    if ($params['clientdetails']['country'] == "US") {
        $fields['BillingState'] = $params['clientdetails']['state'];
    }
    $fields['BillingPostCode'] = $params['clientdetails']['postcode'];
    $fields['BillingCountry'] = $params['clientdetails']['country'];
    $fields['BillingPhone'] = $params['clientdetails']['phonenumber'];
    $fields['ClientIPAddress'] = $remote_ip;
    $fields['CardType'] = sagepaytokens_getcardtype($params['cardtype']);
    $fields['ApplyAVSCV2'] = "2";
    $fields['Apply3DSecure'] = "2";
    $fields['AccountType'] = "C";
    if ($params['cardtype'] == "Maestro" || $params['cardtype'] == "Solo") {
        $fields['AccountType'] = "M";
    }
    if ($params['cardtype'] == "American Express" || $params['cardtype'] == "Laser") {
        $fields['AccountType'] = "E";
    }
    $results = sagepaytokens_call($url, $fields);
    if ($results['Status'] == "OK") {
        return array("status" => "success", "rawdata" => $results, "transid" => $results['VPSTxId']);
    }
    return array("status" => "error", "rawdata" => $results);
}
Ejemplo n.º 25
0
function closeTicket($id)
{
    global $whmcs;
    $status = get_query_val("tbltickets", "status", array("id" => $id));
    if ($status == "Closed") {
        return false;
    }
    if (defined("CLIENTAREA")) {
        addTicketLog($id, "Closed by Client");
    } else {
        if (defined("ADMINAREA")) {
            addTicketLog($id, "Status changed to Closed");
        } else {
            addTicketLog($id, "Ticket Auto Closed For Inactivity");
        }
    }
    update_query("tbltickets", array("status" => "Closed"), array("id" => $id));
    if ($whmcs->get_config("TicketFeedback")) {
        $feedbackcheck = get_query_val("tblticketfeedback", "id", array("ticketid" => $id));
        if (!$feedbackcheck) {
            sendMessage("Support Ticket Feedback Request", $id);
        }
    }
    run_hook("TicketClose", array("ticketid" => $id));
    return true;
}
Ejemplo n.º 26
0
/**
 ** WHMCS method to capture payments
 ** This method is triggered by WHMCS in an attempt to capture a PreAuth payment
 **
 ** @param array $params Array of paramaters parsed by WHMCS
 **/
function gocardless_capture($params)
{
    # create GoCardless DB if it hasn't already been created
    gocardless_createdb();
    # grab the gateway information from WHMCS
    $gateway = getGatewayVariables('gocardless');
    # Send the relevant API information to the GoCardless class for future processing
    gocardless_set_account_details($params);
    # check against the database if the bill relevant to this invoice has already been created
    $existing_payment_query = select_query('mod_gocardless', 'resource_id', array('invoiceid' => $params['invoiceid']));
    $existing_payment = mysql_fetch_assoc($existing_payment_query);
    # check if any rows have been returned or if the returned result is empty.
    # If no rows were returned, the bill has not already been made for this invoice
    # If a row was returned but the resource ID is empty, the bill has not been completed
    # we have already raised a bill with GoCardless (in theory)
    if (!mysql_num_rows($existing_payment_query) || empty($existing_payment['resource_id'])) {
        #MOD-START
        #Use PreAuth table
        $userid_query = select_query('tblinvoices', 'userid', array('id' => $params['invoiceid']));
        $userid_result = mysql_fetch_array($userid_query);
        if (!empty($userid_result['userid'])) {
            $userid = $userid_result['userid'];
            $preauth_query = select_query('mod_gocardless_preauth', 'subscriptionid', array('userid' => $userid));
            $preauth_result = mysql_fetch_array($preauth_query);
            if (!empty($preauth_result['subscriptionid'])) {
                $preauthid = $preauth_result['subscriptionid'];
            }
        }
        #MOD-END
        # now we are out of the loop, check if we have been able to get the PreAuth ID
        if (isset($preauthid)) {
            # we have found the PreAuth ID, so get it from GoCardless and process a new bill
            $pre_auth = GoCardless_PreAuthorization::find($preauthid);
            # check the preauth returned something
            if ($pre_auth) {
                # Create a bill with the $pre_auth object
                try {
                    $bill = $pre_auth->create_bill(array('amount' => $params['amount'], 'name' => "Invoice #" . $params['invoiceid']));
                } catch (Exception $e) {
                    # we failed to create a new bill, lets update mod_gocardless to alert the admin why payment hasnt been received,
                    # log this in the transaction log and exit out
                    update_query('mod_gocardless', array('payment_failed' => 1), array('invoiceid' => $params['invoiceid']));
                    logTransaction($params['paymentmethod'], "Failed to create GoCardless bill against pre-authorization " . $preauthid . " for invoice " . $params['invoiceid'] . ": " . print_r($e, true) . print_r($bill, true), 'Failed');
                    return array('status' => 'error', 'rawdata' => $e);
                }
                # check that the bill has been created
                if ($bill->id) {
                    # check if the bill already exists in the database, if it does we will just update the record
                    # if not, we will create a new record and record the transaction
                    if (!mysql_num_rows($existing_payment_query)) {
                        # Add the bill ID to the table and mark the transaction as pending
                        insert_query('mod_gocardless', array('invoiceid' => $params['invoiceid'], 'billcreated' => 1, 'resource_id' => $bill->id, 'preauth_id' => $pre_auth->id));
                        if ($gateway['instantpaid'] == on) {
                            # The Instant Activation option is on, so add to the Gateway Log and log a transaction on the invoice
                            addInvoicePayment($params['invoiceid'], $bill->id, $bill->amount, $bill->gocardless_fees, $gateway['paymentmethod']);
                            logTransaction($gateway['paymentmethod'], 'Bill of ' . $bill->amount . ' raised and logged for invoice ' . $params['invoiceid'] . ' with GoCardless ID ' . $bill->id, 'Successful');
                            return array('status' => 'success', 'rawdata' => print_r($bill, true));
                        } else {
                            # Instant Activation is off, so just add to the gateway log and wait before marking as paid until web hook arrives
                            logTransaction($gateway['paymentmethod'], 'Bill of ' . $bill->amount . ' raised for invoice ' . $params['invoiceid'] . ' with GoCardless ID ' . $bill->id, 'Successful');
                            return array('status' => 'pending', 'rawdata' => print_r($bill, true));
                        }
                    } else {
                        # update the table with the bill ID
                        update_query('mod_gocardless', array('billcreated' => 1, 'resource_id' => $bill->id), array('invoiceid' => $params['invoiceid']));
                    }
                }
            } else {
                # PreAuth could not be verified
                logTransaction($gateway['paymentmethod'], 'The pre-authorization specified for invoice ' . $params['invoiceid'] . ' (' . $preauthid . ') does not seem to exist - something has gone wrong, or the customer needs to set up their Direct Debit again.', 'Incomplete');
                return array('status' => 'error', 'rawdata' => array('message' => 'The pre-authorization ID was found for invoice ' . $params['invoiceid'] . ' but it could not be fetched.'));
            }
        } else {
            # we couldn't find the PreAuthID meaning at this point all we can do is give up!
            # the client will have to setup a new preauth to begin recurring payments again
            # or pay using an alternative method
            logTransaction($gateway['paymentmethod'], 'No pre-authorization found when trying to raise payment for invoice ' . $params['invoiceid'] . ' - something has gone wrong, or the customer needs to set up their Direct Debit again.', 'Incomplete');
            return array('status' => 'error', 'rawdata' => array('message' => 'No pre-authorisation ID found in WHMCS for invoice ' . $params['invoiceid']));
        }
    } else {
        # WHMCS is trying to collect the bill but one has already been created - this happens because the bill is not mark as 'paid'
        # until a web hook is received by default, so WHMCS thinks it still needs to collect.
        # logTransaction('GoCardless', 'Bill already created - awaiting update via web hook...' . "\nBill ID: " . $existing_payment['resource_id'], 'Pending');
        # return array('status' => 'Bill already created - awaiting update via web hook...', 'rawdata' =>
        #    array('message' => 'Bill already created - awaiting update via web hook...'));
        return array('status' => 'pending', 'rawdata' => array('message' => 'The bill has already been created for invoice ' . $params['invoiceid']));
    }
}
Ejemplo n.º 27
0
        $apiresults = array("result" => "error", "message" => "Admin ID Not Found");
        return null;
    }
}
$projectid = $_REQUEST['projectid'];
$adminid = isset($_REQUEST['adminid']) ? $data_adminid['id'] : 0;
$task = $_REQUEST['task'];
$notes = $_REQUEST['notes'];
$duedate = $_REQUEST['duedate'];
$completed = isset($_REQUEST['completed']) ? 1 : 0;
$updateqry = array();
if ($projectid) {
    $updateqry['projectid'] = $projectid;
}
if ($task) {
    $updateqry['task'] = $task;
}
if ($notes) {
    $updateqry['notes'] = $notes;
}
if ($duedate) {
    $updateqry['duedate'] = $duedate;
}
if ($adminid) {
    $updateqry['adminid'] = $adminid;
}
if ($completed) {
    $updateqry['completed'] = $completed;
}
update_query("mod_projecttasks", $updateqry, array("id" => $taskid));
$apiresults = array("result" => "success", "message" => "Task has been updated");
Ejemplo n.º 28
0
function interworx_UsageUpdate($params)
{
    $key = $params['serveraccesshash'];
    $api_controller = "/nodeworx/siteworx";
    $action = "listBandwidthAndStorage";
    $input = array();
    $client = new soapclient("https://" . $params['serverip'] . ":2443/nodeworx/soap?wsdl");
    $result = $client->route($key, $api_controller, $action, $input);
    logModuleCall("interworx", $action, $input, $result);
    $domainsdata = $result['payload'];
    foreach ($domainsdata as $data) {
        $domain = $data['domain'];
        $bandwidth_used = $data['bandwidth_used'];
        $bandwidth = $data['bandwidth'];
        $storage_used = $data['storage_used'];
        $storage = $data['storage'];
        update_query("tblhosting", array("diskusage" => $storage_used, "disklimit" => $storage, "bwusage" => $bandwidth_used, "bwlimit" => $bandwidth, "lastupdate" => "now()"), array("domain" => $domain, "server" => $params['serverid']));
    }
}
Ejemplo n.º 29
0
$id = get_query_val("tbltodolist", "id", array("id" => $itemid));
if (!$itemid) {
    $apiresults = array("result" => "error", "message" => "TODO Item ID Not Found");
    return null;
}
$adminid = get_query_val("tbladmins", "id", array("id" => $adminid));
if (!$adminid) {
    $apiresults = array("result" => "error", "message" => "Admin ID Not Found");
    return null;
}
$todoarray = array();
if ($date) {
    $todoarray['date'] = toMySQLDate($date);
}
if ($title) {
    $todoarray['title'] = $title;
}
if ($description) {
    $todoarray['description'] = $description;
}
if ($adminid) {
    $todoarray['admin'] = $adminid;
}
if ($status) {
    $todoarray['status'] = $status;
}
if ($duedate) {
    $todoarray['duedate'] = toMySQLDate($duedate);
}
update_query("tbltodolist", $todoarray, array("id" => $itemid));
$apiresults = array("result" => "success", "itemid" => $itemid);
Ejemplo n.º 30
0
                 if ($error == "refundfailed") {
                     infoBox($aInt->lang("orders", "statusrefundfailed"), $aInt->lang("orders", "statusrefundfailedmsg"), "error");
                 } else {
                     if ($error == "manual") {
                         infoBox($aInt->lang("orders", "statusrefundfailed"), $aInt->lang("orders", "statusrefundnoauto"), "error");
                     } else {
                         infoBox($aInt->lang("orders", "statusrefundsuccess"), $aInt->lang("orders", "statusrefundsuccessmsg"), "success");
                     }
                 }
             }
         }
     }
 }
 if ($whmcs->get_req_var("updatenotes")) {
     check_token("WHMCS.admin.default");
     update_query("tblorders", array("notes" => $notes), array("id" => $id));
     exit;
 }
 echo $infobox;
 $gatewaysarray = getGatewaysArray();
 require ROOTDIR . "/includes/countries.php";
 $result = select_query("tblorders", "tblorders.*,tblclients.firstname,tblclients.lastname,tblclients.email,tblclients.companyname,tblclients.address1,tblclients.address2,tblclients.city,tblclients.state,tblclients.postcode,tblclients.country,tblclients.groupid,(SELECT status FROM tblinvoices WHERE id=tblorders.invoiceid) AS invoicestatus", array("tblorders.id" => $id), "", "", "", "tblclients ON tblclients.id=tblorders.userid");
 $data = mysql_fetch_array($result);
 $id = $data['id'];
 if (!$id) {
     exit("Order not found... Exiting...");
 }
 $ordernum = $data['ordernum'];
 $userid = $data['userid'];
 $date = $data['date'];
 $amount = $data['amount'];