本文整理汇总了PHP中localAPI函数的典型用法代码示例。如果您正苦于以下问题:PHP localAPI函数的具体用法?PHP localAPI怎么用?PHP localAPI使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了localAPI函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_oms_credit_time
/**
* Smarty {oms_credit_time} function plugin
*
* Type: function<br>
* Name: oms_credit_time<br>
* Date: April 12, 2013<br>
* Purpose: Providing buyer with the info about how long will a certain credit have him running for the defined bundles.
* @version 1.0
* @param array
* @param Smarty
* @return Integer logged in user credit amount
*/
function smarty_function_oms_credit_time($params, &$smarty)
{
$eurPerHour = empty($params['eurPerHour']) ? 0 : $params['eurPerHour'];
$credit = empty($params['credit']) ? null : $params['credit'];
$digits = empty($params['digits']) ? 1 : $params['digits'];
if ($credit) {
return round($credit / $eurPerHour, $digits);
} else {
if ($_SESSION['uid']) {
$clientCredit = 0;
$command = "getcredits";
$adminuser = "admin";
$values["clientid"] = $_SESSION['uid'];
$clientData = localAPI($command, $values, $adminuser);
if ($clientData['result'] == "success") {
foreach ($clientData['credits'] as $creditArr) {
foreach ($creditArr as $credit) {
$clientCredit += $credit['amount'];
}
}
}
return round($clientCredit / $eurPerHour, $digits);
}
}
return 0;
}
示例2: get_client_name
function get_client_name($clientid)
{
$client = "";
$command = "getclientsdetails";
$adminuser = "ilham";
$values["clientid"] = $clientid;
$values["pid"] = $pid;
$results = localAPI($command, $values, $adminuser);
$parser = xml_parser_create();
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parse_into_struct($parser, $results, $values, $tags);
xml_parser_free($parser);
$data = array();
if ($results["result"] == "success") {
$client = $results["firstname"] . " " . $results["lastname"];
$client = trim($client);
$company = $results["companyname"];
if ($company != "") {
$client .= " (" . $company . ")";
}
} else {
$client = "Error";
}
return $client;
}
示例3: handle
/**
* @param \Exception $e
*/
public function handle(\Exception $e)
{
$admin = Admin::firstOrNew(array('roleid' => 1));
if ($admin->exists) {
localAPI('logactivity', array('description' => $e->getMessage()), $admin->username);
}
}
示例4: purchaseorder_accept_order
function purchaseorder_accept_order($orderid)
{
$command = "acceptorder";
$values["orderid"] = $orderid;
$values["autosetup"] = TRUE;
$values["sendregistrar"] = TRUE;
$values["sendemail"] = TRUE;
$results = localAPI($command, $values);
logModuleCall('purchaseorder', 'activate', $values, $results);
}
示例5: send_unsuspension_email
function send_unsuspension_email($var)
{
$server = $var["params"]["domain"];
lg_info("Sent unsuspension mail to " . $var["params"]["clientsdetails"]);
$command = "sendemail";
$adminuser = "admin";
$values["customtype"] = "product";
$values["customsubject"] = "Service reactivated successfully";
$values["custommessage"] = "Dear Customer,\n\nyour server {$server} has just been reactivated successfully.\n\nRegards,\nYour Support Team";
$values["id"] = $var["params"]["serviceid"];
$results = localAPI($command, $values, $adminuser);
}
示例6: get_ticket_info
function get_ticket_info($id)
{
$command = 'getticket';
$values = array('ticketid' => $id);
$results = localAPI($command, $values, get_options()['admin_user']);
if ($results['result'] != 'success') {
write_log('An Error Occurred: ' . $results['message']);
return false;
} else {
return $results;
}
}
示例7: getCreditForUserId
function getCreditForUserId($userId)
{
$clientCredit = 0;
$command = "getcredits";
$adminuser = "admin";
$values["clientid"] = $userId;
$clientData = localAPI($command, $values, $adminuser);
if ($clientData['result'] == "success") {
foreach ($clientData['credits'] as $creditArr) {
foreach ($creditArr as $credit) {
$clientCredit += $credit['amount'];
}
}
}
return $clientCredit;
}
示例8: add_oms_user_promotion
function add_oms_user_promotion($vars)
{
global $whmcs_admin_user;
// Get promo code (this is just very wrong on all levels)
$sql = "SELECT id FROM tblcustomfields WHERE fieldname='promotion'";
$result = mysql_query($sql);
if (!$result) {
logActivity("Error: failed to retrieve promotion field index from database (user ID: {$vars['userid']}), MySQL error: " . mysql_error());
return;
}
$resultArr = mysql_fetch_assoc($result);
$promotionFieldIndex = (int) $resultArr['id'];
$promoCode = $_POST['customfield'][$promotionFieldIndex];
if (!$promoCode) {
logActivity("No promo code provided (user ID: {$vars['userid']}, promotion field ID: {$promotionFieldIndex})...");
return;
}
// Get promotion
$values = array('code' => $promoCode);
$result = localAPI("getpromotions", $values, $whmcs_admin_user);
if ($result['result'] != "success") {
logActivity("Failed to retrieve promotions (user ID: {$vars['userid']}), API call result: " . print_r($result, true));
return;
}
if ($result['totalresults'] < 1) {
logActivity("No promotions found (user ID: {$vars['userid']})");
return;
}
$promotion = $result['promotions']['promotion'][0];
// TODO: What if multiple promotions are found for one code?
if (!$promotion) {
logActivity("API error: promotion count > 1 reported but no promotions returned (user ID: {$vars['userid']})");
return;
}
logActivity("Promotion found (user ID: {$vars['userid']}, promo code: {$promoCode})");
// TODO: check $promotion['uses'] < $promotion['maxuses']
// TODO: check time() < strtotime($promotion['expirationdate'])
// Add credit to client
$values = array('amount' => $promotion['value'], 'clientid' => $vars['userid'], 'description' => "Promotion code: {$promoCode}");
$result = localAPI("addcredit", $values, $whmcs_admin_user);
if ($result['result'] != "success") {
logActivity("Failed to add credit from promotion (user ID: {$vars['userid']}, promo code: {$promoCode}), API call result: " . print_r($result, true));
return;
}
}
示例9: GoCardlessCaptureCron
/**
* GoCardless WHMCS module HOOKS - aka GoCardless Direct Debit Helper
*
* This file needs to be moved to the /includes/hooks directory within
* the WHMCS install. This file works around the limitation in WHMCS
* to request Direct Debit payments in time and stop sending payment
* failure emails.
*
* @author: York UK Hosting <github@yorkukhosting.com>
* @version: 1.1.0-YUH
* @github: http://github.com/yorkukhosting/gocardless-whmcs/
*
*/
function GoCardlessCaptureCron()
{
/*
* Triggers the capture of the Debit Card payment X days before the
* due to date. Modify the +X days and adminuser paramters as
* necessary
*/
$duedate = date('Y-m-d', strtotime("+10 days"));
$result = full_query("Select id,duedate,paymentmethod,status FROM tblinvoices WHERE duedate <= '" . $duedate . "' AND status='Unpaid' and paymentmethod='gocardless'");
while ($data = mysql_fetch_array($result)) {
$invoiceid = $data['id'];
$result_gocardless = select_query("mod_gocardless", "invoiceid", array("invoiceid" => $invoiceid));
$result_data = mysql_fetch_array($result_gocardless);
if ($result_data['invoiceid'] != $invoiceid) {
$command = "capturepayment";
$adminuser = "admin";
$values["invoiceid"] = $invoiceid;
$capture_results = localAPI($command, $values, $adminuser);
}
}
}
示例10: allProducts
public function allProducts()
{
$command = "getproducts";
$adminuser = MonitisHelper::getAdminName();
$values = array();
$results = localAPI($command, $values, $adminuser);
if ($results && $results['result'] == "success") {
$products = $results['products']['product'];
$otherProducts = array();
if ($products) {
$activeProducts = $this->monitisProducts();
for ($i = 0; $i < count($products); $i++) {
if (strtolower($products[$i]['type']) == 'other') {
$product = $products[$i];
$fields = $this->getCustomfields($product['customfields']['customfield']);
$isMonitisProduct = false;
if ($fields) {
$isMonitisProduct = true;
$website_id = $fields['website']['id'];
$monType_id = $fields['monitortype']['id'];
$monTypes = $this->getFieldById($monType_id);
$types = $monTypes['fieldoptions'];
$monitisProduct = MonitisHelper::in_array($activeProducts, 'product_id', $product['pid']);
$settings = null;
if ($monitisProduct && $monitisProduct['settings']) {
$settings = $monitisProduct['settings'];
}
$product['monitisProduct'] = array('product_id' => $product['pid'], 'website_id' => $fields['website']['id'], 'monType_id' => $fields['monitortype']['id'], 'types' => $types, 'settings' => $settings);
}
$otherProducts[] = $product;
}
}
}
return $otherProducts;
}
return null;
}
示例11: TinyTunnel_Tom
/**
Open Ticket on ordering selected products for WHMCS
Version 1.0 by TinyTunnel_Tom (ThomasGlassUK.com)
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 productOpenTicket($vars)
{
//Configuration
$products = array('1', '3');
//Array of product IDs for this hook
$adminuser = 'admin';
//Set admin user to preform action (required for internal WHMCS API)
$departmentid = '1';
//Set support department to open ticket
$subject = "Ticket Subject";
//Subject for ticket
$message = "Ticket Message";
//Message in ticket
$priority = "LOW";
//Priority for ticket
//The rest is magic
$orderid = $vars['orderid'];
//Get OrderID from WHMCS
$result = select_query('tblhosting', '', array("orderid" => $orderid));
//Find the product from the order
$data = mysql_fetch_assoc($result);
foreach ($products as $pid) {
if ($data['packageid'] == $pid) {
$command = "openticket";
//WHMCS Internal API command
$values = array('clientid' => $data['userid'], 'deptid' => $departmentid, 'subject' => $subject, 'message' => $message, 'priority' => $priority, 'admin' => '1');
//WHMCS Internal API values
$results = localAPI($command, $values, $adminuser);
//Run command to open ticket
if ($results['result'] != "success") {
logActivity('An Error Occurred: ' . $results['message']);
//Something went wrong check WHMCS logs
}
}
}
}
示例12: feathur_CreateAccount
function feathur_CreateAccount($sData)
{
$sConfig = feathur_GeneralConfig();
$sPost = array("email" => $sConfig["email"], "password" => $sConfig["password"], "action" => "createvps", "useremail" => $sData["clientsdetails"]["email"], "username" => $sData["clientsdetails"]["firstname"], "server" => $sData["configoption1"], "ram" => $sData["configoption2"], "swap" => $sData["configoption3"], "disk" => $sData["configoption4"], "cpuunits" => $sData["configoption5"], "cpulimit" => $sData["configoption6"], "bandwidthlimit" => $sData["configoption7"], "inodes" => $sData["configoption8"], "numproc" => $sData["configoption9"], "numiptent" => $sData["configoption10"], "ipaddresses" => $sData["configoption11"], "nameserver" => $sData["configoption12"], "hostname" => preg_replace('/[^A-Za-z0-9-.]/', '', $sData["domain"]));
$sSetupVPS = feathur_RemoteConnect($sPost, $sConfig["master"]);
if ($sSetupVPS["type"] == 'success') {
$sCustomField = mysql_fetch_array(mysql_query("SELECT * FROM tblcustomfields WHERE relid='{$sData["pid"]}' && fieldname='feathurvpsid'"));
$sCommand = "updateclientproduct";
$sPostFields["serviceid"] = $sData["serviceid"];
$sPostFields["serviceusername"] = $sData["clientsdetails"]["email"];
$sPostFields["servicepassword"] = "";
$sCustomFields = array($sCustomField["id"] => $sSetupVPS["vps"]);
$sPostFields["customfields"] = base64_encode(serialize($sCustomFields));
$sAPIPost = localAPI($sCommand, $sPostFields, $sConfig["whmcs_admin_user"]);
if ($sAPIPost["result"] == success) {
$sResult = "success";
} else {
$sResult = $sAPIPost["message"];
}
} else {
$sResult = $sSetupVPS["result"];
}
return $sResult;
}
示例13: getUsersOrders
function getUsersOrders($userId)
{
$command = "getorders";
$adminuser = "admin";
$values["userid"] = $userId;
// without this all record are returned
$results = localAPI($command, $values, $adminuser);
if ($results['result'] == "success") {
if ($results['orders']['order']) {
return $results['orders']['order'];
}
} else {
if ($results['result'] == "error") {
logActivity("Error getting orders for userId:" . $userId . ". Error:" . $clientData['message']);
} else {
logActivity("getUsersOrders: no success or error.");
}
}
return null;
}
示例14: userProducts
static function userProducts($userid)
{
$products = null;
$adminuser = MonitisHelper::getAdminName();
$values = array("clientid" => $userid);
$prdcts = localAPI("getclientsproducts", $values, $adminuser);
if ($prdcts && $prdcts['result'] == 'success' && $prdcts['products']['product']) {
$products = $prdcts['products']['product'];
}
return $products;
}
示例15: select_query
<?php
# require whmcs functions
require "../../../dbconnect.php";
require "../../../includes/functions.php";
# find first administrator
$administrator = select_query('tbladmins');
$administrator = mysql_fetch_array($administrator, MYSQL_ASSOC);
# try and process the login
$login = localAPI('validatelogin', array('email' => $_REQUEST['username'], 'password2' => $_REQUEST['password']), $administrator['id']);
# couldn't process the login, so forbid access
if ($login['result'] != 'success') {
header('HTTP/1.0 403 Forbidden');
return;
}
# check to see if login was a client or a contact
if ($login['contactid']) {
$user = full_query("SELECT CONCAT(`firstname`, ' ', `lastname`), `permissions`, `email` FROM `tblcontacts` WHERE `id` = '" . $login['contactid'] . "'");
$user = mysql_fetch_array($user, MYSQL_BOTH);
$permissions = explode(',', $user['permissions']);
if (!in_array('tickets', $permissions)) {
header('HTTP/1.0 403 Forbidden');
return;
}
} else {
$user = full_query("SELECT CONCAT(`firstname`, ' ', `lastname`), `email` FROM `tblclients` WHERE `id` = '" . $login['userid'] . "'");
$user = mysql_fetch_array($user, MYSQL_BOTH);
}
# output the JSON
echo json_encode(array('name' => $user['0'], 'email' => $user['email'], 'reference' => $user['email']));