示例#1
0
function update_gateway_fee2($vars)
{
    $paymentmethod = $vars['paymentmethod'];
    delete_query("tblinvoiceitems", "invoiceid='" . $vars[invoiceid] . "' and notes='gateway_fees'");
    $result = select_query("tbladdonmodules", "setting,value", "setting='fee_2_" . $vars['paymentmethod'] . "' or setting='fee_1_" . $vars[paymentmethod] . "'");
    while ($data = mysql_fetch_array($result)) {
        $params[$data[0]] = $data[1];
    }
    $fee1 = $params['fee_1_' . $paymentmethod];
    $fee2 = $params['fee_2_' . $paymentmethod];
    $total = InvoiceTotal($vars['invoiceid']);
    if ($total > 0) {
        $amountdue = $fee1 + $total * $fee2 / 100;
        if ($fee1 > 0 & $fee2 > 0) {
            $d = $fee1 . '+' . $fee2 . "%";
        } elseif ($fee2 > 0) {
            $d = $fee2 . "%";
        } elseif ($fee1 > 0) {
            $d = $fee1;
        }
    }
    if ($d) {
        insert_query("tblinvoiceitems", array("userid" => $_SESSION['uid'], "invoiceid" => $vars[invoiceid], "type" => "Fee", "notes" => "gateway_fees", "description" => getGatewayName2($vars['paymentmethod']) . " Fees ({$d})", "amount" => $amountdue, "taxed" => "0", "duedate" => "now()", "paymentmethod" => $vars[paymentmethod]));
    }
    updateInvoiceTotal($vars[invoiceid]);
}
示例#2
0
function getelement($default, $language)
{
    $key = md5($default);
    $result = select_query('tblconfiguration', '*', array('setting' => 'Language'));
    $res = mysql_fetch_assoc($result);
    $defaultlang = $res['value'];
    mysql_free_result($result);
    $result = select_query('mod_i18n_lang', '*', '1');
    while ($row = mysql_fetch_assoc($result)) {
        $langs[$row['lang']] = $row['enabled'];
    }
    mysql_free_result($result);
    if ($langs[$language] == 0) {
        return $default;
    } else {
        $result = select_query('mod_i18n_data', '*', array('id' => $key));
        if (mysql_num_rows($result) > 0) {
            $row = mysql_fetch_assoc($result);
            $translations = unserialize($row['data']);
            return $translations[$language];
        } else {
            $translations[$defaultlang] = $default;
            foreach ($langs as $lang => $enabled) {
                if ($enabled == 1) {
                    $translations[$lang] = $default;
                }
            }
            $newid = insert_query('mod_i18n_data', array('id' => $key, 'default' => $default, 'data' => serialize($translations), 'translated' => 0));
            return $default;
        }
    }
}
示例#3
0
function update_gateway_fee2($vars)
{
    $invoice = mysql_fetch_row(mysql_query("SELECT `userid` FROM `tblinvoices` WHERE `id`='" . $vars[invoiceid] . "'"));
    $user = mysql_fetch_row(mysql_query("SELECT `currency` FROM `tblclients` WHERE `id`='" . $invoice[0] . "'"));
    $currency = mysql_fetch_row(mysql_query("SELECT `code` FROM `tblcurrencies` WHERE `id`='" . $user[0] . "'"));
    $paymentmethod = $vars['paymentmethod'];
    delete_query("tblinvoiceitems", "invoiceid='" . $vars[invoiceid] . "' and notes='gateway_fees'");
    $result = select_query("tbladdonmodules", "setting,value", "setting='fee_2_" . $vars['paymentmethod'] . '_' . $currency[0] . "' or setting='fee_1_" . $vars[paymentmethod] . '_' . $currency[0] . "'");
    while ($data = mysql_fetch_array($result)) {
        $params[$data['setting']] = $data['value'];
    }
    $fee1 = $params['fee_1_' . $paymentmethod . '_' . $currency[0]];
    $fee2 = $params['fee_2_' . $paymentmethod . '_' . $currency[0]];
    $total = InvoiceTotal($vars['invoiceid']);
    if ($total > 0) {
        $amountdue = $fee1 + $total * $fee2 / 100;
        if ($fee1 > 0 & $fee2 > 0) {
            $d = $fee1 . '+' . $fee2 . "%";
        } elseif ($fee2 > 0) {
            $d = $fee2 . "%";
        } elseif ($fee1 > 0) {
            $d = $fee1;
        }
    }
    if ($d) {
        insert_query("tblinvoiceitems", array("userid" => $_SESSION['uid'], "invoiceid" => $vars[invoiceid], "type" => "Fee", "notes" => "gateway_fees", "description" => getGatewayName2($vars['paymentmethod']) . " комиссия ({$d}) в " . $currency[0], "amount" => $amountdue, "taxed" => "0", "duedate" => "now()", "paymentmethod" => $vars[paymentmethod]));
    }
    updateInvoiceTotal($vars[invoiceid]);
}
示例#4
0
function smarty_function_i18n($params, &$smarty)
{
    require_once $_SERVER['DOCUMENT_ROOT'] . "/init.php";
    $language = $params['lang'];
    $default = $params['default'];
    $key = md5($default);
    $result = select_query('tblconfiguration', '*', array('setting' => 'Language'));
    $res = mysql_fetch_assoc($result);
    $defaultlang = $res['value'];
    mysql_free_result($result);
    $result = select_query('mod_i18n_lang', '*', '1');
    while ($row = mysql_fetch_assoc($result)) {
        $langs[$row['lang']] = $row['enabled'];
    }
    mysql_free_result($result);
    if ($langs[$language] == 0) {
        return $default;
    } else {
        $result = select_query('mod_i18n_data', '*', array('id' => $key));
        if (mysql_num_rows($result) > 0) {
            $row = mysql_fetch_assoc($result);
            $translations = unserialize($row['data']);
            return $translations[$language];
        } else {
            $translations[$defaultlang] = $default;
            foreach ($langs as $lang => $enabled) {
                if ($enabled == 1) {
                    $translations[$lang] = $default;
                }
            }
            $newid = insert_query('mod_i18n_data', array('id' => $key, 'default' => $default, 'data' => serialize($translations), 'translated' => 0));
            return $default;
        }
    }
}
示例#5
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);
}
示例#6
0
 public function createOrder($userid, $paymentmethod, $contactid = "")
 {
     global $whmcs;
     $order_number = generateUniqueID();
     $this->orderid = insert_query("tblorders", array("ordernum" => $order_number, "userid" => $userid, "contactid" => $contactid, "date" => "now()", "status" => "Pending", "paymentmethod" => $paymentmethod, "ipaddress" => $whmcs->get_user_ip()));
     logActivity("New Order Created - Order ID: " . $orderid . " - User ID: " . $userid);
     return $this->orderid;
 }
 /**
  * Create & Assign a new payment ID to user 
  * 
  * @param   object      User
  * @return  string      payment id    
  */
 public function create_payment_id($user)
 {
     $res = false;
     // Keep generating payment id until successfully inserted.
     while (!$res) {
         $payment_id = random_str(64);
         $sql = insert_query('users_cn_payment_ids', array('asset_id' => $this->id, 'payment_id' => $payment_id, 'user_id' => $user->id(), 'date_created' => array('UTC_TIMESTAMP()')));
         $res = db()->query($sql);
     }
     return $payment_id;
 }
示例#8
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>
  ';
    }
}
示例#9
0
 public static function create($identity, $data = null)
 {
     $founder = $data['founder'] ? $data['founder'] : null;
     $desc = $data['description'] ? $data['description'] : '';
     $url = isset($data['clan_avatar_url']) ? $data['clan_avatar_url'] : null;
     $name = $identity;
     $new_clan_id = insert_query('insert into clan (clan_name, clan_avatar_url, clan_founder, description) values (:name, :url, :founder, :desc)', [':name' => $name, ':url' => $url, ':founder' => $founder, ':desc' => $desc], 'clan_clan_id_seq');
     if (!positive_int($new_clan_id)) {
         throw new \Exception('Clan not inserted into database properly!');
     }
     return ClanFactory::find($new_clan_id);
 }
示例#10
0
function enomtruste_CreateAccount($params)
{
    updateService(array("username" => "", "password" => ""));
    $withseal = $params['configoption3'];
    $numyears = $params['configoption4'];
    $result = select_query("tblhosting", "billingcycle", array("id" => $params['serviceid']));
    $data = mysql_fetch_array($result);
    $billingcycle = $data[0];
    if ($billingcycle == "Biennially") {
        $numyears = "2";
    }
    if ($billingcycle == "Triennially") {
        $numyears = "3";
    }
    if ($params['configoptions']['Seal']) {
        $withseal = true;
    }
    if ($params['configoptions']['NumYears']) {
        $numyears = $params['configoptions']['NumYears'];
    }
    $apiproducttype = $withseal ? "TRUSTePrivacyPolicySeal" : "TRUSTePrivacyPolicy";
    $postfields = array();
    $postfields['command'] = "PurchaseServices";
    $postfields['Service'] = $apiproducttype;
    $postfields['NumYears'] = $numyears;
    $postfields['EmailNotify'] = "0";
    $xmldata = enomtruste_call($params, $postfields);
    if ($xmldata['INTERFACE-RESPONSE']['ERRCOUNT'] == 0) {
        $result = "success";
        if (!mysql_num_rows(full_query("SHOW TABLES LIKE 'mod_enomtruste'"))) {
            full_query("CREATE TABLE `mod_enomtruste` ( `serviceid` INT(10) NOT NULL , `subscrid` INT(10) NOT NULL )");
        }
        $subscrid = $xmldata['INTERFACE-RESPONSE']['SUBSCRIPTIONID'];
        insert_query("mod_enomtruste", array("serviceid" => $params['serviceid'], "subscrid" => $subscrid));
        $domain = $params['domain'];
        if (!$domain) {
            $domain = $params['customfields']["Domain Name"];
        }
        $postfields = array();
        $postfields['command'] = "PP_UpdateSubscriptionDetails";
        $postfields['SubscriptionID'] = $subscrid;
        $postfields['DomainName'] = $domain;
        $postfields['EmailAddress'] = $params['clientsdetails']['email'];
        $xmldata = enomtruste_call($params, $postfields);
    } else {
        $result = $xmldata['INTERFACE-RESPONSE']['ERRORS']['ERR1'];
        if (!$result) {
            $result = "An Unknown Error Occurred";
        }
    }
    return $result;
}
示例#11
0
function request_insert($index, $insert)
{
    $sql = insert_query($index, $insert);
    $conn = connect_db();
    try {
        $stmt = $conn->prepare($sql);
        $stmt->execute();
        return $stmt;
    } catch (PDOException $e) {
        echo "inserted failed" . $e->getMessage();
    }
    // end catch
}
示例#12
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';
     }
 }
示例#13
0
function globalsignssl_CreateAccount($params)
{
    $result = select_query("tblsslorders", "COUNT(*)", array("serviceid" => $params['serviceid']));
    $data = mysql_fetch_array($result);
    if ($data[0]) {
        return "An SSL Order already exists for this order";
    }
    updateService(array("username" => "", "password" => ""));
    $sslorderid = insert_query("tblsslorders", array("userid" => $params['clientsdetails']['userid'], "serviceid" => $params['serviceid'], "remoteid" => "", "module" => "globalsignssl", "certtype" => $params['configoption3'], "status" => "Awaiting Configuration"));
    global $CONFIG;
    $sslconfigurationlink = $CONFIG['SystemURL'] . "/configuressl.php?cert=" . md5($sslorderid);
    $sslconfigurationlink = "<a href=\"" . $sslconfigurationlink . "\">" . $sslconfigurationlink . "</a>";
    sendMessage("SSL Certificate Configuration Required", $params['serviceid'], array("ssl_configuration_link" => $sslconfigurationlink));
    return "success";
}
示例#14
0
/**
Proxy/VPN Detection Hook for WHMCS by KuJoe (JMD.cc)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**/
function chkProxyMM($vars)
{
    // Set me!
    $license_key = 'MAXMIND_LICENSE_KEY';
    # Set this to your MaxMind License Key (your account must have Proxy Detection queries).
    $email = '*****@*****.**';
    # This is the e-mail alerts will be sent to.
    // Optional
    $max_score = '1.7';
    # Likelihood of proxy (0.5 = 15%, 1.0 = 30%, 2.0 = 60%, 3.0+ = 90%)
    $error = '# You appear to be ordering from a proxy/VPN. Please logout of your proxy/VPN to continue ordering. If you believe that you received this error by mistake, please open a ticket with your IP address and we will investigate further. Thank you.';
    $subject = "chkProxy Error";
    // No need to edit anything below this.
    $ipaddress = $_SERVER['REMOTE_ADDR'];
    $result = select_query("mod_chkproxy_mm", "", array("ipaddr" => $ipaddress));
    if (mysql_num_rows($result) == 0) {
        $query = "https://minfraud.maxmind.com/app/ipauth_http?l=" . $license_key . "&i=" . $ipaddress;
        $query = file_get_contents($query);
        $score = substr($query, strpos($query, "=") + 1);
        if (is_numeric($score)) {
            insert_query("mod_chkproxy_mm", array("ipaddr" => $ipaddress, "proxyscore" => $score));
            if ($score >= $max_score) {
                global $errormessage;
                $errormessage .= $error;
            }
        } else {
            if ($score == 'MAX_REQUESTS_REACHED') {
                $maxmsg = "You do not have any MaxMind queries left (" . $score . "). The chkProxy script will no longer work and you will keep getting this e-mail until more queries are added.";
                mail($email, $subject, $maxmsg);
            } elseif ($score == 'LICENSE_REQUIRED') {
                $nolicmsg = "You do not have a valid MaxMind license (" . $score . "). Please verify your license key is correct or else the chkProxy script will not work and you will keep getting this e-mail.";
                mail($email, $subject, $nolicmsg);
            } else {
                $genmsg = "The return message received is new to us so please alert the chkProxy developer (http://jmd.cc) of this message received in the following link: https://minfraud.maxmind.com/app/ipauth_http?l=" . $license_key . "&i=" . $ipaddress;
                mail($email, $subject, $genmsg);
            }
        }
    } else {
        $data = mysql_fetch_assoc($result);
        if ($data['ignore'] == 0) {
            $score = $data['proxyscore'];
            if ($score >= $max_score) {
                global $errormessage;
                $errormessage .= $error;
            }
        }
    }
}
示例#15
0
/**
 *
 * @ WHMCS FULL DECODED & NULLED
 *
 * @ Version  : 5.2.15
 * @ Author   : MTIMER
 * @ Release on : 2013-12-24
 * @ Website  : http://www.mtimer.cn
 *
 **/
function affiliateActivate($userid)
{
    global $CONFIG;
    $result = select_query("tblclients", "currency", array("id" => $userid));
    $data = mysql_fetch_array($result);
    $clientcurrency = $data['currency'];
    $bonusdeposit = convertCurrency($CONFIG['AffiliateBonusDeposit'], 1, $clientcurrency);
    $result = select_query("tblaffiliates", "id", array("clientid" => $userid));
    $data = mysql_fetch_array($result);
    $affiliateid = $data['id'];
    if (!$affiliateid) {
        $affiliateid = insert_query("tblaffiliates", array("date" => "now()", "clientid" => $userid, "balance" => $bonusdeposit));
    }
    logActivity("Activated Affiliate Account - Affiliate ID: " . $affiliateid . " - User ID: " . $userid, $userid);
    run_hook("AffiliateActivation", array("affid" => $affiliateid, "userid" => $userid));
}
示例#16
0
function cleantalk_activate()
{
    $ct_plans_query = full_query("SELECT * from tbladdons where lower(name) like '%leantalk%'");
    if (mysql_num_rows($ct_plans_query) == 0) {
        $addon_type = array("name" => 'CleanTalk free', "description" => 'Protect your website against spam bots.', "billingcycle" => "Free", "showorder" => "on", "welcomeemail" => 0, "weight" => 1, "autoactivate" => "on");
        $addon_pricing = array("type" => "addon", "currency" => 1);
        $addonid = insert_query("tbladdons", $addon_type);
        $plan_pricing = $addon_pricing;
        $plan_pricing['relid'] = $addonid;
        $pricingid = insert_query("tblpricing", $plan_pricing);
    }
    # Return Result
    return array('status' => 'success', 'description' => 'This is an demo module only. In a real module you might instruct a user how to get started with it here...');
    return array('status' => 'error', 'description' => 'You can use the error status return to indicate there was a problem activating the module');
    return array('status' => 'info', 'description' => 'You can use the info status return to display a message to the user');
}
示例#17
0
function enomnewtlds_activate($vars)
{
    global $enomnewtlds_DefaultEnvironment;
    global $enomnewtlds_DBName;
    $LANG = $vars['_lang'];
    $sql = enomnewtlds_DB_GetCreateTable();
    $retval = full_query($sql);
    if (!$retval) {
        return array("status" => "error", "description" => $LANG['activate_failed1'] . $enomnewtlds_DBName . " : " . mysql_error());
    }
    $companyname = "";
    $domain = "";
    $date = enomnewtlds_Helper_GetDateTime();
    $data = enomnewtlds_DB_GetDefaults();
    $domain = enomnewtlds_Helper_GetWatchlistUrl($data['companyurl']);
    insert_query($enomnewtlds_DBName, array("enabled" => "1", "configured" => "0", "environment" => $enomnewtlds_DefaultEnvironment, "companyname" => $data['companyname'], "companyurl" => $domain, "supportemail" => $data['supportemail'], "enableddate" => $date));
    enomnewtlds_DB_GetCreateHookTable();
    return array("status" => "success", "description" => $LANG['activate_success1']);
}
/**
Proxy/VPN Detection Hook for WHMCS by KuJoe (JMD.cc)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**/
function chkProxyGII($vars)
{
    // Set me!
    $email = '*****@*****.**';
    # This is the e-mail alerts will be sent to.
    // Optional
    $max_score = '0.95';
    # Likelihood of proxy (0.25 = 25%, 0.50 = 50%, 0.75 = 75%, 1.0 = 100%)
    $error = '# You appear to be ordering from a proxy/VPN. Please logout of your proxy/VPN to continue ordering. If you believe that you received this error by mistake, please open a ticket with your IP address and we will investigate further. Thank you.';
    $subject = "chkProxy Error";
    // No need to edit anything below this.
    $ipaddress = $_SERVER['REMOTE_ADDR'];
    $result = select_query("mod_chkproxy_gii", "", array("ipaddr" => $ipaddress));
    if (mysql_num_rows($result) == 0) {
        $query = "http://check.getipintel.net/check.php?ip=" . $ipaddress . "&contact=" . $email;
        $score = file_get_contents($query);
        if (is_numeric($score)) {
            insert_query("mod_chkproxy_gii", array("ipaddr" => $ipaddress, "proxyscore" => $score));
            if ($score >= $max_score) {
                global $errormessage;
                if (empty($errormessage)) {
                    $errormessage .= $error;
                }
            }
        } else {
            $genmsg = "The return message received is new to us so please alert the chkProxy developer (http://jmd.cc) of this message received in the following link: http://check.getipintel.net/check.php?ip=" . $ipaddress . "&contact=" . $email;
            mail($email, $subject, $genmsg);
        }
    } else {
        $data = mysql_fetch_assoc($result);
        if ($data['ignore'] == 0) {
            $score = $data['proxyscore'];
            if ($score >= $max_score) {
                global $errormessage;
                if (empty($errormessage)) {
                    $errormessage .= $error;
                }
            }
        }
    }
}
示例#19
0
function online_SuspendAccount($params)
{
    //This is the code for the "suspend" button command
    $server = $params["server"];
    //Check if the service is linked to a server
    $serverid = $params["serverusername"];
    //Get the server ID from the username field
    $token = $params["serveraccesshash"];
    //This is online.net's API private token for the user owning the dedicated server, retrieve it from server access hash field
    if ($server) {
        $rescueinfo = json_decode(call_online_api($token, 'GET', '/server/rescue_images/' . $params["serverusername"]), true);
        call_online_api($token, 'POST', '/server/boot/rescue/' . $params["serverusername"], null, array('image' => $rescueinfo[0]));
        //Boots into rescue mode
    }
    //Add an entry to the todo list field to notify the administrators (optional and can be removed)
    $table = "tbltodolist";
    $values = array("title" => "ONLINE.NET - Service Suspension", "description" => "Service ID # " . $params["serviceid"] . " was suspended.", "status" => "Pending", "date" => date('Y/m/d'));
    $newid = insert_query($table, $values);
    //End add an entry
    return "success";
    //Mission complete
}
示例#20
0
}
if ($action == "save" && in_array($module, $includedmodules)) {
    check_token("WHMCS.admin.default");
    $GatewayConfig[$module]['visible'] = array("Type" => "yesno");
    $GatewayConfig[$module]['name'] = array("Type" => "text");
    $GatewayConfig[$module]['convertto'] = array("Type" => "text");
    foreach ($GatewayConfig[$module] as $confname => $values) {
        if ($values['Type'] != "System") {
            $result = select_query("tblpaymentgateways", "COUNT(*)", array("gateway" => $module, "setting" => $confname));
            $data = mysql_fetch_array($result);
            $count = $data[0];
            if ($count) {
                update_query("tblpaymentgateways", array("value" => html_entity_decode(trim($field[$confname]))), array("gateway" => $module, "setting" => $confname));
                continue;
            }
            insert_query("tblpaymentgateways", array("gateway" => $module, "setting" => $confname, "value" => html_entity_decode(trim($field[$confname]))));
            continue;
        }
    }
    redir("updated=true");
}
if ($action == "moveup") {
    check_token("WHMCS.admin.default");
    $result = select_query("tblpaymentgateways", "", array("`order`" => $order));
    $data = mysql_fetch_array($result);
    $gateway = $data['gateway'];
    $order1 = $order - 1;
    update_query("tblpaymentgateways", array("order" => $order), array("`order`" => $order1));
    update_query("tblpaymentgateways", array("order" => $order1), array("gateway" => $gateway));
    redir();
}
示例#21
0
 public function associateDrives($whmcsDrives, $agentInfo, $serverID)
 {
     $result = array("status" => "warning", "msg" => "No agent or agent is stopped");
     if ($agentInfo && isset($agentInfo['drives'])) {
         $agentId = $agentInfo['agentId'];
         $monDrives = $agentInfo['drives'];
         $whmcs_drives = null;
         if ($whmcsDrives) {
             $whmcs_drives = array();
             for ($i = 0; $i < count($whmcsDrives); $i++) {
                 $mon = MonitisHelper::in_array($monDrives, 'id', $whmcsDrives[$i]['monitor_id']);
                 if ($mon) {
                     $whmcs_drives[] = $whmcsDrives[$i];
                 } else {
                     monitisSqlHelper::altQuery('DELETE FROM ' . MONITIS_INTERNAL_TABLE . ' WHERE monitor_id=' . $whmcsDrives[$i]['monitor_id']);
                 }
             }
         }
         $ids = array();
         for ($i = 0; $i < count($monDrives); $i++) {
             $drive = $monDrives[$i];
             if (isset($drive['id'])) {
                 if (!$whmcs_drives || !MonitisHelper::in_array($whmcs_drives, 'monitor_id', $drive['id'])) {
                     $ids[] = $drive['id'];
                 }
             }
         }
         $cnt = count($ids);
         if ($ids && $cnt > 0) {
             for ($i = 0; $i < $cnt; $i++) {
                 $monitorID = $ids[$i];
                 $pubKey = MonitisApi::monitorPublicKey(array('moduleType' => 'drive', 'monitorId' => $monitorID));
                 $values = array('server_id' => $serverID, 'available' => MonitisConf::$settings['drive']['available'], 'agent_id' => $agentId, 'monitor_id' => $monitorID, 'monitor_type' => 'drive', 'client_id' => MONITIS_CLIENT_ID, "publickey" => $pubKey);
                 insert_query('mod_monitis_int_monitors', $values);
             }
             $result["status"] = 'ok';
             $result["msg"] = 'Add ' . $cnt . ' drive(s)';
         } else {
             $result["status"] = 'warning';
             $result["msg"] = 'No drive monitor for add';
         }
     }
     return $result;
 }
                }
            }
            $appliestotmp = $_POST['appliesto'];
            foreach ($appliestotmp as $v) {
                if ($aappliesto) {
                    $aappliesto = $aappliesto . ",{$v}";
                } else {
                    $aappliesto = $v;
                }
            }
            $expirationdate = $_POST['expirationdate'];
            $maxuses = $_POST['maxuses'];
            $applyonce = $_POST['applyonce'];
            $newsignups = $_POST['newsignups'];
            $existingclient = $_POST['existingclient'];
            $r = insert_query("tblaffcouponsconf", array("type" => $type, "recurring" => $recurring, "value" => $value, "cycles" => $acycles, "appliesto" => $aappliesto, "expirationdate" => $expirationdate, "maxuses" => $maxuses, "applyonce" => $applyonce, "newsignups" => $newsignups, "existingclient" => $existingclient, "label" => $label));
            break;
    }
}
$products = array();
$result = select_query("tblproducts", "tblproducts.id,tblproducts.name,tblproductgroups.name AS groupname", "", "tblproductgroups`.`order` ASC,`tblproducts`.`order` ASC,`name", "ASC", "", "tblproductgroups ON tblproducts.gid=tblproductgroups.id");
while ($data = mysql_fetch_array($result)) {
    $pid = $data["id"];
    $group = $data["groupname"];
    $prodname = $data["name"];
    $products[$pid]['group'] = $group;
    $products[$pid]['name'] = $prodname;
}
print "<style type=\"text/css\">\n\t\t#AddForm label.error {\n\t\t\tbackground:url(\"images/icons/accessdenied.png\") no-repeat 0px 0px;\n\t\t\tpadding-left: 16px;\n\t\t\tpadding-bottom: 2px;\n\t\t\tfont-weight: bold;\n\t\t\tcolor: #EA5200;\n\t\t}\n\t\t</style>\n        <script src=\"https://ajax.aspnetcdn.com/ajax/jquery.validate/1.5.5/jquery.validate.min.js\" type=\"text/javascript\"></script>\n\t\t<script type=\"text/javascript\">\n\t\t\$().ready(function() {\n\t\t\t\$(\"#AddForm\").validate({\n\t\t\t\trules: {\n\t\t\t\t\tlabel: { required: true },\n\t\t\t\t\tvalue: { required: true, number: true },\n\t\t\t\t\t\"appliesto[]\": { required: true },\n\t\t\t\t\tmaxuses: { required: true, number: true }\n\t\t\t\t},\n\t\t\t\terrorPlacement: function(error, element) {\n\t\t\t\t\terror.appendTo( element.parent().next() );\n\t\t\t\t},\n\t\t\t\tsuccess: function(label) {\n\t\t\t\t\tlabel.html(\" \").addClass(\"error\");\n\t\t\t\t},\n\t\t\t\tsubmitHandler: function() {\n\t\t\t\t\t\$(form).submit();\n\t\t\t\t}\n\t\t\t});\n\t\t\t\$(\".affdatepick\").datepicker({\n\t\t\t\tdateFormat: \"yy-mm-dd\",\n\t\t\t\tshowOn: \"button\",\n\t\t\t\tbuttonImage: \"images/showcalendar.gif\",\n\t\t\t\tbuttonImageOnly: true,\n\t\t\t\tshowButtonPanel: true\n\t\t\t});\n\t\t});\n\t\t</script>\t\n\t\t<h3>Add New Coupon Parameters</h3>\n\t\t<form id=\"AddForm\" method=\"POST\" action=\"{$modulelink}&cmd=add\">\n\t\t<table class=\"form\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\" width=\"100%\">\n\t\t<tr><td width=\"25%\" class=\"fieldlabel\">Label:</td><td class=\"fieldarea\"><input type=\"text\" name=\"label\" size=\"25\">(i.e. \"25% Recurring\")</td><td></td></tr>\n\t\t<tr><td class=\"fieldlabel\">Type:</td><td class=\"fieldarea\">\n\t\t<select name=\"type\">\n\t\t<option value=\"Percentage\">Percentage</option>\n\t\t<option value=\"Fixed Amount\">Fixed Amount</option>\n\t\t<option value=\"Free Setup\">Free Setup</option>\n\t\t</select></td><td></td></tr>\n\t\t<tr><td class=\"fieldlabel\">Value:</td><td class=\"fieldarea\"><input type=\"text\" name=\"value\" size=\"25\"></td><td></td></tr>\n\t\t<tr><td class=\"fieldlabel\">Recurring:</td><td class=\"fieldarea\">\n\t\t<select name=\"recurring\">\n\t\t<option value=\"0\">No</option>\n\t\t<option value=\"1\">Yes</option>\n\t\t</select></td><td></td></tr>\n\t\t<tr><td class=\"fieldlabel\">Valid Cycles</td><td class=\"fieldarea\">\n\t\t<select multiple name=\"cycles[]\" size=\"5\">\n\t\t<option value=\"\" selected>Any Payment Term</option>\n\t\t<option value=\"One Time\">One Time</option>\n\t\t<option value=\"Monthly\">Monthly</option>\n\t\t<option value=\"Quarterly\">Quarterly</option>\n\t\t<option value=\"Semi-Annually\">Semi-Annually</option>\n\t\t<option value=\"Annually\">Annually</option>\n\t\t<option value=\"Biennially\">Biennially</option>\n\t\t<option value=\"Triennially\">Triennially</option>\n\t\t</select></td><td></td></tr>\n\t\t<tr><td class=\"fieldlabel\">Applies To:</td><td class=\"fieldarea\">\n\t\t<select multiple name=\"appliesto[]\" size=\"5\">";
foreach ($products as $k => $v) {
    $pid = $k;
示例#23
0
function processPipedTicket($to, $name, $email, $subject, $message, $attachment)
{
    global $whmcs;
    global $CONFIG;
    global $supportticketpipe;
    global $pipenonregisteredreplyonly;
    $supportticketpipe = true;
    $decodestring = $subject . "##||-MESSAGESPLIT-||##" . $message;
    $decodestring = pipeDecodeString($decodestring);
    $decodestring = explode("##||-MESSAGESPLIT-||##", $decodestring);
    $subject = $decodestring[0];
    $message = $decodestring[1];
    $raw_message = $message;
    $result = select_query("tblticketspamfilters", "", "");
    while ($data = mysql_fetch_array($result)) {
        $id = $data['id'];
        $type = $data['type'];
        $content = $data['content'];
        if ($type == "sender") {
            if (strtolower($content) == strtolower($email)) {
                $mailstatus = "Blocked Sender";
            }
        }
        if ($type == "subject") {
            if (strpos("x" . strtolower($subject), strtolower($content))) {
                $mailstatus = "Blocked Subject";
            }
        }
        if ($type == "phrase") {
            if (strpos("x" . strtolower($message), strtolower($content))) {
                $mailstatus = "Blocked Phrase";
            }
        }
    }
    run_hook("TicketPiping", array());
    if (!$mailstatus) {
        $pos = strpos($subject, "[Ticket ID: ");
        if ($pos === false) {
        } else {
            $tid = substr($subject, $pos + 12);
            $tid = substr($tid, 0, strpos($tid, "]"));
            $result = select_query("tbltickets", "", array("tid" => $tid));
            $data = mysql_fetch_array($result);
            $tid = $data['id'];
        }
        $to = trim($to);
        $toemails = explode(",", $to);
        $deptid = "";
        foreach ($toemails as $toemail) {
            if (!$deptid) {
                $result = select_query("tblticketdepartments", "", array("email" => trim(strtolower($toemail))));
                $data = mysql_fetch_array($result);
                $deptid = $data['id'];
                $to = $data['email'];
                $deptclientsonly = $data['clientsonly'];
                $deptpiperepliesonly = $data['piperepliesonly'];
                continue;
            }
        }
        if (!$deptid) {
            $result = select_query("tblticketdepartments", "", array("hidden" => ""), "order", "ASC", "1");
            $data = mysql_fetch_array($result);
            $deptid = $data['id'];
            $to = $data['email'];
            $deptclientsonly = $data['clientsonly'];
            $deptpiperepliesonly = $data['piperepliesonly'];
        }
        if (!$deptid) {
            $mailstatus = "Department Not Found";
        } else {
            if ($to == $email) {
                $mailstatus = "Blocked Potential Email Loop";
            } else {
                $messagebackup = $message;
                $result = select_query("tblticketbreaklines", "", "", "id", "ASC");
                while ($data = mysql_fetch_array($result)) {
                    $breakpos = strpos($message, $data['breakline']);
                    if ($breakpos) {
                        $message = substr($message, 0, $breakpos);
                    }
                }
                if (!$message) {
                    $message = $messagebackup;
                }
                $message = trim($message);
                $result = select_query("tbladmins", "id", array("email" => $email));
                $data = mysql_fetch_array($result);
                $adminid = $data['id'];
                if ($adminid) {
                    if ($tid) {
                        $_SESSION['adminid'] = $adminid;
                        AddReply($tid, "", "", $message, true, $attachment);
                        $_SESSION['adminid'] = "";
                        $mailstatus = "Ticket Reply Imported Successfully";
                    } else {
                        $mailstatus = "Ticket ID Not Found";
                    }
                } else {
                    $result = select_query("tblclients", "id", array("email" => $email));
                    $data = mysql_fetch_array($result);
                    $userid = $data['id'];
                    if (!$userid) {
                        $result = select_query("tblcontacts", "id,userid", array("email" => $email));
                        $data = mysql_fetch_array($result);
                        $userid = $data['userid'];
                        $contactid = $data['id'];
                        if ($userid) {
                            $ccemail = $email;
                        }
                    }
                    if ($deptclientsonly == "on" && !$userid) {
                        $mailstatus = "Unregistered Email Address";
                        $result = select_query("tblticketdepartments", "", array("id" => $deptid));
                        $data = mysql_fetch_array($result);
                        $noautoresponder = $data['noautoresponder'];
                        if (!$noautoresponder) {
                            sendMessage("Bounce Message", "", array($name, $email));
                        }
                    } else {
                        if ($userid == "") {
                            $from['name'] = $name;
                            $from['email'] = $email;
                        }
                        $filterdate = date("YmdHis", mktime(date("H"), date("i") - 15, date("s"), date("m"), date("d"), date("Y")));
                        $query = "SELECT count(*) FROM tbltickets WHERE date>'" . $filterdate . "' AND (email='" . mysql_real_escape_string($email) . "'";
                        if ($userid) {
                            $query .= " OR userid=" . (int) $userid;
                        }
                        $query .= ")";
                        $result = full_query($query);
                        $data = mysql_fetch_array($result);
                        $numtickets = $data[0];
                        if (10 < $numtickets) {
                            $mailstatus = "Exceeded Limit of 10 Tickets within 15 Minutes";
                        } else {
                            run_hook("TransliterateTicketText", array("subject" => $subject, "message" => $message));
                            if ($tid) {
                                AddReply($tid, $userid, $contactid, htmlspecialchars_array($message), "", $attachment, htmlspecialchars_array($from));
                                $mailstatus = "Ticket Reply Imported Successfully";
                            } else {
                                if ($pipenonregisteredreplyonly && !$userid) {
                                    $mailstatus = "Blocked Ticket Opening from Unregistered User";
                                } else {
                                    if ($deptpiperepliesonly) {
                                        $mailstatus = "Only Replies Allowed by Email";
                                    } else {
                                        openNewTicket(htmlspecialchars_array($userid), htmlspecialchars_array($contactid), htmlspecialchars_array($deptid), htmlspecialchars_array($subject), htmlspecialchars_array($message), "Medium", $attachment, htmlspecialchars_array($from), "", htmlspecialchars_array($ccemail));
                                        $mailstatus = "Ticket Imported Successfully";
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    } else {
        if ($attachment) {
            global $attachments_dir;
            $attachment = explode("|", $attachment);
            foreach ($attachment as $file) {
                deleteFile($attachments_dir, $file);
            }
        }
    }
    if ($mailstatus == "") {
        $mailstatus = "Ticket Import Failed";
    }
    $table = "tblticketmaillog";
    $array = "";
    $array = array("date" => "now()", "to" => $to, "name" => $name, "email" => $email, "subject" => $subject, "message" => $message, "status" => $mailstatus);
    insert_query($table, htmlspecialchars_array($array));
}
示例#24
0
            echo ">" . $value . "</td>";
            if ($i == "2") {
                echo "</tr><tr>";
                $i = 0;
                continue;
            }
        }
    }
    exit;
}
if ($action == "affassign") {
    if ($orderid && $affid) {
        $result = select_query("tblhosting", "id", array("orderid" => $orderid));
        while ($data = mysql_fetch_array($result)) {
            $serviceid = $data['id'];
            insert_query("tblaffiliatesaccounts", array("affiliateid" => $affid, "relid" => $serviceid));
        }
        exit;
    }
    echo $aInt->lang("orders", "chooseaffiliate") . "<br /><select name=\"affid\" id=\"affid\" style=\"width:270px;\">";
    $result = select_query("tblaffiliates", "tblaffiliates.id,tblclients.firstname,tblclients.lastname", "", "firstname", "ASC", "", "tblclients ON tblclients.id=tblaffiliates.clientid");
    while ($data = mysql_fetch_array($result)) {
        $aff_id = $data['id'];
        $firstname = $data['firstname'];
        $lastname = $data['lastname'];
        echo "<option value=\"" . $aff_id . "\">" . $firstname . " " . $lastname . "</option>";
    }
    echo "</select>";
    exit;
}
if ($action == "ajaxchangeorderstatus") {
 $ch = curl_init();
 $data = wr_dologin($ch, $myemail, $mypass);
 if (!$data) {
     $r = wr_get_licenses($ch);
 } else {
     $msg = 'Error logging in to WHMCS.COM client area';
     break;
 }
 curl_close($ch);
 $imp_count = 0;
 foreach ($r as $k => $v) {
     $myid = $v['id'];
     $mylic = $v['license'];
     $data = select_query("whmcsresellerlicenses", "id", array("license_id" => $myid));
     if (!mysql_num_rows($data)) {
         insert_query("whmcsresellerlicenses", array("license_id" => $myid, "license" => $mylic));
         $imp_count++;
     }
 }
 $ch = curl_init();
 $content = wr_dologin($ch, $myemail, $mypass);
 if (!$content) {
     $data = mysql_query("SELECT * FROM whmcsresellerlicenses");
     while ($r = mysql_fetch_array($data)) {
         $lic_id = $r['license_id'];
         $lic_info = wr_get_lic_info($ch, $lic_id);
         $lic_status = $lic_info['status'];
         $lic_domains = $lic_info['domains'];
         $lic_ips = $lic_info['ips'];
         $lic_path = $lic_info['directory'];
         $lic_type = $lic_info['type'];
示例#26
0
    $duedate = toMySQLDate($duedate);
    getUsersLang($userid);
    if ($id) {
        if ($hours != 0) {
            if (strpos($description, " " . $_LANG['billableitemshours'] . " @ ")) {
                $description = substr($description, 0, strrpos($description, " - ")) . " - " . $hours . " " . $_LANG['billableitemshours'] . " @ " . $amount . "/" . $_LANG['billableitemshour'];
            }
            $amount = $amount * $hours;
        }
        update_query("tblbillableitems", array("userid" => $userid, "description" => $description, "hours" => $hours, "amount" => $amount, "recur" => $recur, "recurcycle" => $recurcycle, "recurfor" => $recurfor, "invoiceaction" => $invoiceaction, "duedate" => $duedate, "invoicecount" => $invoicecount), array("id" => $id));
    } else {
        if ($hours != 0) {
            $description .= " - " . $hours . " " . $_LANG['billableitemshours'] . " @ " . $amount . "/" . $_LANG['billableitemshour'];
            $amount = $amount * $hours;
        }
        $id = insert_query("tblbillableitems", array("userid" => $userid, "description" => $description, "hours" => $hours, "amount" => $amount, "recur" => $recur, "recurcycle" => $recurcycle, "recurfor" => $recurfor, "invoiceaction" => $invoiceaction, "duedate" => $duedate));
    }
    redir();
}
if ($action == "delete") {
    check_token("WHMCS.admin.default");
    delete_query("tblbillableitems", array("id" => $id));
    redir();
}
ob_start();
if (!$action) {
    if ($invoice && is_array($bitem)) {
        foreach ($bitem as $id => $v) {
            update_query("tblbillableitems", array("invoiceaction" => "1"), array("id" => $id));
        }
        infoBox($aInt->lang("billableitems", "invoiceitems"), $aInt->lang("billableitems", "itemswillinvoice"));
示例#27
0
}
$amount = $_REQUEST['amt'];
$callbackvars2 = explode("&amp;", $callbackvars);
foreach ($callbackvars2 as $value) {
    $values[] = explode("=", $value);
}
if ($code == "5") {
    logTransaction("Pay Offline", $orgipn, "Pending");
    exit;
}
if ($transid) {
    checkCbTransID($transid);
}
if ($code == "0") {
    $invoiceid = $values[0][1];
    if ($invoiceid) {
        checkCbInvoiceID($invoiceid, "PayOffline");
        addInvoicePayment($invoiceid, $transid, $amount, "", "payoffline");
        logTransaction("Pay Offline", $_REQUEST, "Successful");
        return 1;
    }
    $userid = $values[2][1];
    $userid = get_query_val("tblclients", "id", array("id" => $userid));
    if (!$userid) {
        logTransaction("Pay Offline", $_REQUEST, "Invoice Not Found");
        return 1;
    }
    insert_query("tblcredit", array("clientid" => $userid, "date" => "now()", "description" => "Pay Offline Transaction ID " . $transid, "amount" => $amount));
    update_query("tblclients", array("credit" => "+=" . $amount), array("id" => $userid));
    logTransaction("Pay Offline", $_REQUEST, "Credit Added");
}
示例#28
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']));
    }
}
示例#29
0
    unset($_POST['save']);
    if ($module) {
        delete_query("tblregistrars", array("registrar" => $module));
        foreach ($_POST as $key => $value) {
            insert_query("tblregistrars", array("registrar" => $module, "setting" => $key, "value" => encrypt(html_entity_decode(trim($value)))));
        }
    }
    redir("saved=true#" . $module);
    exit;
}
if ($action == "activate") {
    check_token("WHMCS.admin.default");
    $module = $_GET['module'];
    if ($module) {
        delete_query("tblregistrars", array("registrar" => $module));
        insert_query("tblregistrars", array("registrar" => $module, "setting" => "Username", "value" => ""));
    }
    redir("activated=true#" . $module);
    exit;
}
if ($action == "deactivate") {
    check_token("WHMCS.admin.default");
    $module = $_GET['module'];
    if ($module) {
        delete_query("tblregistrars", array("registrar" => $module));
    }
    redir("deactivated=true");
    exit;
}
ob_start();
if ($saved) {
示例#30
0
function twilio_output($vars)
{
    $modulelink = $vars['modulelink'];
    global $attachments_dir;
    if (isset($_POST)) {
        switch ($_POST['_a']) {
            case "modconfig":
                $POST = $_POST;
                unset($POST['token']);
                unset($POST['_a']);
                foreach ($POST as $keyname => $value) {
                    $currentval = get_query_val('mod_twilio_config', 'val', 'setting="' . $keyname . '"');
                    if ($currentval != $value) {
                        update_query('mod_twilio_config', array('val' => $value), array('setting' => $keyname));
                    }
                }
                $msg = 'The configuration settings have been successfully saved.';
                break;
            case "modnumbers":
                foreach ($_POST['numberid'] as $nid) {
                    $number = $_POST['number'][$nid];
                    $order = $_POST['order'][$nid];
                    $timeout = $_POST['timeout'][$nid];
                    $delete = $_POST['delete'][$nid];
                    if ($nid != 'NEW') {
                        if ($delete == '1') {
                            delete_query('mod_twilio_numbers', array('id' => $nid));
                        } else {
                            update_query('mod_twilio_numbers', array('number' => $number, 'timeout' => $timeout, 'order' => $order), array('id' => $nid));
                        }
                    } else {
                        if ($number != '') {
                            insert_query('mod_twilio_numbers', array('number' => $number, 'timeout' => $timeout, 'order' => $order));
                        }
                    }
                }
                $msg = 'Your numbers have been successfully modified.';
                break;
            case "uploadaudio":
                if (isset($_FILES)) {
                    $destdir = $attachments_dir . '/twilio';
                    if (!file_exists($destdir)) {
                        mkdir($destdir);
                    }
                    foreach ($_FILES as $keyname => $val) {
                        if ($val['name'] != '') {
                            $curerr = 0;
                            // Check file size
                            if ((int) $val['size'] > 2048000) {
                                $error .= '<br />' . $val['name'] . ' is too large.';
                                $curerr = 1;
                                // Check file type
                            } elseif ($val['type'] != 'audio/mp3' && $val['type'] != 'audio/mpeg') {
                                $error .= '<br />' . $val['name'] . ' is not a valid MP3 file.';
                                $curerr = 1;
                            } else {
                                // File is good
                                $file = $destdir . '/' . $keyname . '.mp3';
                                if (file_exists($file)) {
                                    unlink($file);
                                }
                                if (move_uploaded_file($val['tmp_name'], $file)) {
                                    update_query('mod_twilio_config', array('val' => $file), array('setting' => $keyname));
                                } else {
                                    $error .= '<br />There was an error uploading ' . $val['name'] . '. Please check your error logs.';
                                    $curerr = 1;
                                }
                            }
                            if (!$curerr) {
                                $msg .= '<br />' . $val['name'] . ' has been successfully uploaded.';
                            }
                        }
                    }
                }
                break;
        }
    }
    // Get configured numbers
    $numbers = array();
    $d = select_query('mod_twilio_numbers', '*', array(), 'order', 'ASC');
    while ($res = mysql_fetch_assoc($d)) {
        $numbers[] = array('id' => $res['id'], 'number' => $res['number'], 'timeout' => $res['timeout'], 'order' => $res['order']);
    }
    // Get config values
    $config = array();
    $d = select_query('mod_twilio_config', '*', array());
    while ($res = mysql_fetch_assoc($d)) {
        $setting = $res['setting'];
        $value = $res['val'];
        $config[$setting] = $value;
    }
    // Return to last page
    if (isset($_REQUEST['last'])) {
        $last = $_REQUEST['last'];
    } else {
        $last = '0';
    }
    // Get server.js daemon status
    $timeout = '5.00';
    if ($fp = fsockopen($_SERVER['HTTP_HOST'], $config['client_port'], $errno, $errstr, (double) $timeout)) {
        $client_status = '<em>Current Status:</em> <span style="color: green; font-weight: bold;">Online</span>';
    } else {
        $client_status = '<em>Current Status:</em> <span style="color: red; font-weight: bold;">Unreachable</span>';
    }
    if ($fp = fsockopen('localhost', $config['server_port'], $errno, $errstr, (double) $timeout)) {
        $server_status = '<em>Current Status:</em> <span style="color: green; font-weight: bold;">Online</span>';
    } else {
        $server_status = '<em>Current Status:</em> <span style="color: red; font-weight: bold;">Online</span>';
    }
    print '<script>
			$(document).ready(function(){
				$(".tabbox").css("display","none");
				var selectedTab;
				$(".tab").click(function(){
					var elid = $(this).attr("id");
					$(".tab").removeClass("tabselected");
					$("#"+elid).addClass("tabselected");
					if (elid != selectedTab) {
						$(".tabbox").slideUp();
						$("#"+elid+"box").slideDown();
						selectedTab = elid;
					}
					$("#tab").val(elid.substr(3));
				});

				selectedTab = "tab' . $last . '";
				$("#tab' . $last . '").addClass("tabselected");
				$("#tab' . $last . 'box").css("display", "");
			});
			</script>
			<div id="content_padded">';
    if ($msg) {
        print '<div class="infobox">' . $msg . '</div>';
    }
    if ($error) {
        print '<div class="errorbox">' . $error . '</div>';
    }
    print '<div id="tabs">
				<ul>
					<li id="tab0" class="tab"><a href="javascript:;">Configurations</a></li>
					<li id="tab1" class="tab"><a href="javascript:;">Phone Numbers</a></li>
					<li id="tab2" class="tab"><a href="javascript:;">Upload Audio Files</a></li>
				</ul>
			</div>
			
			<div id="tab0box" class="tabbox">
				<div id="tab_content">
					<h3>Module Configurations</h3>
					<p align="left">
						<strong>Instructions:</strong> Please configure ALL of the options below. Leaving options unset will likely cause unexpected errors to occur.<br /><br />
						<strong>Audio Mode:</strong> This option chooses whether or not you\'d like to use the built in text to speech engine, or record your own message. If you select Audio File, please ensure you have uploaded the coresponding audio file in the "Upload Audio Files" tab.<br />
						<strong>Text:</strong> If you selected Text to Speech in the previous option, this will be what is read to your callers.<br />
						<strong>Invalid Input Audio Mode:</strong> Much like the Audio Mode above, this option lets you select how you wish to let the caller know their input was not recognized.<br />
						<strong>Invalid Input Text:</strong> This will be what is read to the caller if you selected the Text to Speech option above.
					</p>
					<br />
					<br />
					<form method="POST" action="' . $modulelink . '&last=0">
						<input type="hidden" name="_a" value="modconfig" />
						<table class="form" border="0" cellpadding="3" cellspacing="1" width="75%" align="center">
						<!-- " -->
							<tr>
								<td colspan="2" align="center">
									<h4>Global Configurations</h4>
									These are the global configurations for the module.
								</td>
							</tr>
							<tr>
								<td class="fieldlabel"><strong>Client Port</strong></td>
								<td class="fieldarea">
									<input type="text" size="10" name="client_port" value="' . $config['client_port'] . '" /> Client Port configured in server.js
									<div style="float: right; padding-right: 10px;">' . $client_status . '</div>
								</td>
							</tr>
							<tr>
								<td class="fieldlabel"><strong>Server Port</strong></td>
								<td class="fieldarea">
									<input type="text" size="10" name="server_port" value="' . $config['server_port'] . '" /> Server Port configured in server.js
									<div style="float: right; padding-right: 10px;">' . $server_status . '</div>
								</td>
							</tr>
							<tr>
								<td class="fieldlabel"><strong>Gather Timeout</strong></td>
								<td class="fieldarea"><input type="text" size="10" name="gather_timeout" value="' . $config['gather_timeout'] . '" /> Amount of time to wait for caller input</td>
							</tr>
							<tr>
								<td class="fieldlabel"><strong>Voicemail Email Address</strong></td>
								<td class="fieldarea"><input type="text" size="30" name="voicemail_email" value="' . $config['voicemail_email'] . '" /> Email Address to send voicemails to</td>
							</tr>
							<tr>
								<td class="fieldlabel"><strong>Voicemail Audio Mode</strong></td>
								<td class="fieldarea">';
    echo twilio_modeselect('voicemail_mode', $config);
    print '						</td>
							</tr>
							<tr>
								<td class="fieldlabel"><strong>Voicemail Text</strong></td>
								<td class="fieldarea"><textarea name="voicemail_text" rows="10" cols="80">' . $config['voicemail_text'] . '</textarea></td>
							</tr>
							<tr>
								<td class="fieldlabel"><strong>Invalid Input Audio Mode</strong></td>
								<td class="fieldarea">';
    echo twilio_modeselect('invalid_request_mode', $config);
    print '						</td>
							</tr>
							<tr>
								<td class="fieldlabel"><strong>Invalid Input Text</strong></td>
								<td class="fieldarea"><textarea name="invalid_request_text" rows="10" cols="80">' . $config['invalid_request_text'] . '</textarea></td>
							</tr>
						</table>
						<table class="form" border="0" cellpadding="3" cellspacing="1" width="75%" align="center">
						<!-- " -->
							<tr>
								<td colspan="2" align="center">
									<h4>Introduction</h4>
									These settings are relevent to when the caller first calls into the phone system. It should say something along the lines of: <br /><em>"Thank you for calling Widgets Incorporated. Please press 1 if this call is regarding an existing support ticket, please press 2 for all other inqueries."</em>
								</td>
							</tr>
							<tr>
								<td class="fieldlabel"><strong>Audio Mode</strong></td>
								<td class="fieldarea">';
    echo twilio_modeselect('intro_mode', $config);
    print '						</td>
							</tr>
							<tr>
								<td class="fieldlabel"><strong>Text</strong></td>
								<td class="fieldarea"><textarea name="intro_text" rows="10" cols="80">' . $config['intro_text'] . '</textarea></td>
							</tr>
						</table>
						<table class="form" border="0" cellpadding="3" cellspacing="1" width="75%" align="center">
						<!-- " -->
							<tr>
								<td colspan="2" align="center">
									<h4>Step 1 (Ticket)</h4>
									These settings are relevent to when the caller selects option 1 from the introduction. It should say something along the lines of: <br /><em>"Please enter your ticket ID number, followed by the pound sign."</em>
								</td>
							</tr>
							<tr>
								<td class="fieldlabel"><strong>Audio Mode</strong></td>
								<td class="fieldarea">';
    echo twilio_modeselect('step1_ticket_mode', $config);
    print '						</td>
							</tr>
							<tr>
								<td class="fieldlabel"><strong>Text</strong></td>
								<td class="fieldarea"><textarea name="step1_ticket_text" rows="10" cols="80">' . $config['step1_ticket_text'] . '</textarea></td>
							</tr>
						</table>
						<table class="form" border="0" cellpadding="3" cellspacing="1" width="75%" align="center">
						<!-- " -->
							<tr>
								<td colspan="2" align="center">
									<h4>Step 1 (Client)</h4>
									These settings are relevent to when the caller selects option 2 from the introduction. It should say something along the lines of: <br /><em>"Please enter your client ID number, followed by the pound sign."</em>
								</td>
							</tr>
							<tr>
								<td class="fieldlabel"><strong>Audio Mode</strong></td>
								<td class="fieldarea">';
    echo twilio_modeselect('step1_client_mode', $config);
    print '						</td>
							</tr>
							<tr>
								<td class="fieldlabel"><strong>Text</strong></td>
								<td class="fieldarea"><textarea name="step1_client_text" rows="10" cols="80">' . $config['step1_client_text'] . '</textarea></td>
							</tr>
						</table>
						<table class="form" border="0" cellpadding="3" cellspacing="1" width="75%" align="center">
						<!-- " -->
							<tr>
								<td colspan="2" align="center">
									<h4>Step 2 (Ticket)</h4>
									These settings are relevent to when the caller enters his or her ticket ID number.<br />You can use custom variables here to insert client details into your message. Please see the <a href="#variables">table</a> at the bottom of this page.
								</td>
							</tr>
							<tr>
								<td class="fieldlabel"><strong>Audio Mode</strong></td>
								<td class="fieldarea">';
    echo twilio_modeselect('step2_ticket_mode', $config);
    print '						</td>
							</tr>
							<tr>
								<td class="fieldlabel"><strong>Text</strong></td>
								<td class="fieldarea"><textarea name="step2_ticket_text" rows="10" cols="80">' . $config['step2_ticket_text'] . '</textarea></td>
							</tr>
							<tr>
								<td class="fieldlabel"><strong>Invalid Input Audio Mode</strong></td>
								<td class="fieldarea">';
    echo twilio_modeselect('step2_ticket_sorry_mode', $config);
    print '					</tr>
							<tr>
								<td class="fieldlabel"><strong>Invalid Input Text</strong></td>
								<td class="fieldarea"><textarea name="step2_ticket_sorry_text" rows="10" cols="80">' . $config['step2_ticket_sorry_text'] . '</textarea></td>
							</tr>
						</table>
						<table class="form" border="0" cellpadding="3" cellspacing="1" width="75%" align="center">
						<!-- " -->
							<tr>
								<td colspan="2" align="center">
									<h4>Step 2 (Client)</h4>
									These settings are relevent to when the caller enters his or her client ID number.<br />You can use custom variables here to insert client details into your message. Please see the <a href="#variables">table</a> at the bottom of this page.
								</td>
							</tr>
							<tr>
								<td class="fieldlabel"><strong>Audio Mode</strong></td>
								<td class="fieldarea">';
    echo twilio_modeselect('step2_client_mode', $config);
    print '						</td>
							</tr>
							<tr>
								<td class="fieldlabel"><strong>Text</strong></td>
								<td class="fieldarea"><textarea name="step2_client_text" rows="10" cols="80">' . $config['step2_client_text'] . '</textarea></td>
							</tr>
							<tr>
								<td class="fieldlabel"><strong>Invalid Input Audio Mode</strong></td>
								<td class="fieldarea">';
    echo twilio_modeselect('step2_client_sorry_mode', $config);
    print '					</tr>
							<tr>
								<td class="fieldlabel"><strong>Invalid Input Text</strong></td>
								<td class="fieldarea"><textarea name="step2_client_sorry_text" rows="10" cols="80">' . $config['step2_client_sorry_text'] . '</textarea></td>
							</tr>
						</table>
						<p align="center"><input type="submit" value="Save Changes" /></p>
					</form>
					<br />
					<a name="variables"></a><h3>Step 2 Variables</h3>
					<div class="tablebg" align="center">
						<table class="datatable" cellspacing="1" cellpadding="1" width="50%">
							<tr><th>Variable</th><th>Provides</th></tr>
							
							<tr><td align="center">%FIRSTNAME%</td><td align="center">Clients Firstname</td></tr>
							<tr><td align="center">%LASTNAME%</td><td align="center">Clients Lastname</td></tr>
							<tr><td align="center">%COMPANY%</td><td align="center">Clients Company Name</td></tr>
							<tr><td align="center">%EMAIL%</td><td align="center">Clients Email</td></tr>
							<tr><td align="center">%ADDRESS1%</td><td align="center">Clients Address Line 1</td></tr>
							<tr><td align="center">%ADDRESS2%</td><td align="center">Clients Address Line 2</td></tr>
							<tr><td align="center">%CITY%</td><td align="center">Clients City</td></tr>
							<tr><td align="center">%STATE%</td><td align="center">Clients State</td></tr>
							<tr><td align="center">%POSTCODE%</td><td align="center">Clients Postcode</td></tr>
							<tr><td align="center">%PHONE%</td><td align="center">Clients Phone Number</td></tr>
							<tr><td align="center">%STATUS%</td><td align="center">Clients Account Status</td></tr>
							<tr><td align="center">%TICKET_TITLE%</td><td align="center">Tickets Title Text (only applicable for ticket mode)</td></tr>
							<tr><td align="center">%TICKET_URGENCY%</td><td align="center">Tickets Urgency (only applicable for ticket mode)</td></tr>
							<tr><td align="center">%TICKET_STATUS%</td><td align="center">Tickets Status (only applicable for ticket mode)</td></tr>
						</table>
					</div>
				</div>
			</div>
			<div id="tab1box" class="tabbox">
				<div id="tab_content">
					<h3>Phone Numbers</h3>
					<p align="left">
						<strong>Instructions:</strong> Enter the phone numbers below you wish to dial after the user has called the Twilio number. These will typically be support operators phone numbers.<br /><br />
					</p>
					<p align="left">
						<strong>Phone Number:</strong> Format: +12223334444. This is the number the user will be redirected to after following the phone prompts.<br />
						<strong>Timeout:</strong> This is the amount of time (in seconds) to wait before moving on to the next number. If the number has voicemail, its important that this number is lower than the amount of time before the user is redirected to VM.<br />
						<strong>Order:</strong> This is the order in which the numbers are dialed. Lower numbers are dialed first. Leaving this blank will default to "0" and therefore be called first.<br />
						<strong>Delete:</strong> Check this box to delete an existing number.<br />
					</p>
					<br />
					<form method="POST" action="' . $modulelink . '&last=1">
						<input type="hidden" name="_a" value="modnumbers" />
						<div class="tablebg" align="center">
							<table class="datatable" cellspacing="1" cellpadding="1" width="400">
								<tr>
									<th>Phone Number</th>
									<th>Timeout</th>
									<th>Order</th>
									<th>Delete</th>
								</tr>';
    foreach ($numbers as $key => $val) {
        $nid = $val['id'];
        print '					<tr>
									<td align="center"><input type="text" size="40" name="number[' . $nid . ']" value="' . $val['number'] . '" /></td>
									<td align="center"><input type="text" size="10" name="timeout[' . $nid . ']" value="' . $val['timeout'] . '" /></td>
									<td align="center"><input type="text" size="10" name="order[' . $nid . ']" value="' . $val['order'] . '" /></td>
									<td align="center">
										<input type="checkbox" name="delete[' . $nid . ']" value="1" />
										<input type="hidden" name="numberid[' . $nid . ']" value="' . $nid . '" />
									</td>
								</tr>';
    }
    print '						<tr>
									<td align="center"><input type="text" size="40" name="number[\'NEW\']" value="" /></td>
									<td align="center"><input type="text" size="10" name="timeout[\'NEW\']" value="" /></td>
									<td align="center"><input type="text" size="10" name="order[\'NEW\']" value="" /></td>
									<td><input type="hidden" name="numberid[\'NEW\']" value="NEW" /></td>
								</tr>
							</table>
						</div>
						<input type="submit" value="Save Changes" name="save" />
					</form>
				</div>
			</div>
			<div id="tab2box" class="tabbox">
				<div id="tab_content">
					<h3>Upload Audio Files</h3>
					<p align="left">
						<strong>Instructions:</strong> These files are used in place of the default Twilio text-to-speech engine. You can record your own voice, or hire a professional to record them for you.
					</p>
					<p align="left">
						<strong>Notes:</strong>
						<ul align="left">
							<li>- These files will ONLY be used if you have selected "Audio File" from the selection on the Configuration page.</li>
							<li>- Keep in mind that these files will have to be downloaded from your server, to Twilio, then streamed to the caller. Large files will likely cause delay in the system.</li>
							<li>- The max file size is set to 2MB, however, it is recommended that you keep the file sizes as small as possible. 72Kbps mono recordings will likely yield the best results.</li>
							<li>- ONLY MP3 files are supported. If you have your audio in another format, you\'ll need to convert it to MP3 before uploading.</li>
						</ul>
					</p>
					<br />
					<form method="POST" action="' . $modulelink . '&last=2" enctype="multipart/form-data">
						<input type="hidden" name="_a" value="uploadaudio" />
						<table class="form" width="50%" border="0" cellspacing="2" cellpadding="3" align="center">
							<tr>
								<td class="fieldlabel"><strong>Introduction</strong></td>
								<td class="fieldarea"><input type="file" name="intro_file" /></td>
								<td class="fieldarea" align="center"><a href="../modules/addons/twilio/calls/get_audio.php?f=intro_file" target="_blank"><img src="../modules/addons/twilio/images/play.png" /></a></td>
							</tr>
							<tr>
								<td class="fieldlabel"><strong>Step 1 (Client)</strong></td>
								<td class="fieldarea"><input type="file" name="step1_client_file" /></td>
								<td class="fieldarea" align="center"><a href="../modules/addons/twilio/calls/get_audio.php?f=step1_client_file" target="_blank"><img src="../modules/addons/twilio/images/play.png" /></a></td>
							</tr>
							<tr>
								<td class="fieldlabel"><strong>Step 1 (Ticket)</strong></td>
								<td class="fieldarea"><input type="file" name="step1_ticket_file" /></td>
								<td class="fieldarea" align="center"><a href="../modules/addons/twilio/calls/get_audio.php?f=step1_ticket_file" target="_blank"><img src="../modules/addons/twilio/images/play.png" /></a></td>
							</tr>
							<tr>
								<td class="fieldlabel"><strong>Step 2 (Client)</strong></td>
								<td class="fieldarea"><input type="file" name="step2_client_file" /></td>
								<td class="fieldarea" align="center"><a href="../modules/addons/twilio/calls/get_audio.php?f=step2_client_file" target="_blank"><img src="../modules/addons/twilio/images/play.png" /></a></td>
							</tr>
							<tr>
								<td class="fieldlabel"><strong>Step 2 (Client) - Invalid Input</strong></td>
								<td class="fieldarea"><input type="file" name="step2_client_sorry_file" /></td>
								<td class="fieldarea" align="center"><a href="../modules/addons/twilio/calls/get_audio.php?f=step2_client_sorry_file" target="_blank"><img src="../modules/addons/twilio/images/play.png" /></a></td>
							</tr>
							<tr>
								<td class="fieldlabel"><strong>Step 2 (Ticket)</strong></td>
								<td class="fieldarea"><input type="file" name="step2_ticket_file" /></td>
								<td class="fieldarea" align="center"><a href="../modules/addons/twilio/calls/get_audio.php?f=step2_ticket_file" target="_blank"><img src="../modules/addons/twilio/images/play.png" /></a></td>
							</tr>
							<tr>
								<td class="fieldlabel"><strong>Step 2 (Ticket) - Invalid Input</strong></td>
								<td class="fieldarea"><input type="file" name="step2_ticket_sorry_file" /></td>
								<td class="fieldarea" align="center"><a href="../modules/addons/twilio/calls/get_audio.php?f=step2_ticket_sorry_file" target="_blank"><img src="../modules/addons/twilio/images/play.png" /></a></td>
							</tr>
							<tr>
								<td class="fieldlabel"><strong>General Invalid Input</strong></td>
								<td class="fieldarea"><input type="file" name="invalid_request_file" /></td>
								<td class="fieldarea" align="center"><a href="../modules/addons/twilio/calls/get_audio.php?f=invalid_request_file" target="_blank"><img src="../modules/addons/twilio/images/play.png" /></a></td>
							</tr>
							<tr>
								<td class="fieldlabel"><strong>Voicemail</strong></td>
								<td class="fieldarea"><input type="file" name="voicemail_file" /></td>
								<td class="fieldarea" align="center"><a href="../modules/addons/twilio/calls/get_audio.php?f=voicemail_file" target="_blank"><img src="../modules/addons/twilio/images/play.png" /></a></td>
							</tr>
						</table>
						<p align="center">
							<input type="submit" value="Upload Files" />
						</p>
					</form>
					
				</div>
			</div>
		</div>';
}