本文整理汇总了PHP中logModuleCall函数的典型用法代码示例。如果您正苦于以下问题:PHP logModuleCall函数的具体用法?PHP logModuleCall怎么用?PHP logModuleCall使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了logModuleCall函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _doSirportlyAPICall
function _doSirportlyAPICall($method, $postfields = array(), $jsonDecode = true)
{
## Include the configuration
include "config.php";
## Tidy up the URL
$apiUrl = rtrim($baseUrl, '/') . "/api/v2/";
## Specify default params
$default_params = array('brand' => $BrandId);
## Merge the postfields
$postfields = array_merge($default_params, $postfields);
## Set the required headers
$headers = array('X-Auth-Token: ' . $apiToken, 'X-Auth-Secret: ' . $apiSecret);
## Make the API request
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiUrl . $method);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
## Decode the response
if ($jsonDecode) {
$return = json_decode($result, true);
} else {
$return = $result;
}
## Log the API call
logModuleCall('Sirportly', $method, $postfields, $result, $return);
## Return the decoded response
return $return;
}
示例2: pushover_ticket_reply
function pushover_ticket_reply($vars)
{
$ticketid = $vars['ticketid'];
$userid = $vars['userid'];
$deptid = $vars['deptid'];
$deptname = $vars['deptname'];
$subject = $vars['subject'];
$message = $vars['message'];
$priority = $vars['priority'];
// Convert HTML entities (single/double quote) back to single or double quote
$message = htmlspecialchars_decode($message, ENT_QUOTES);
$pushover_userkey = po_get_userkey();
if (!$pushover_userkey) {
return false;
}
$po_ticket_url = po_get_admin_ticket_url($ticketid);
$pushover_api_url = 'https://api.pushover.net/1/messages.json';
$pushover_app_token = 'a7HcPjJeGmAtyG4e6tCYqyXk5wc5Xj';
$pushover_title = '[Ticket ID: ' . $ticketid . '] New Support Ticket Response';
$pushover_url = $po_ticket_url;
$pushover_url_title = "Open Admin Area to View Ticket";
$pushover_message = $message;
$pushover_post_fields = array('token' => $pushover_app_token, 'user' => $pushover_userkey, 'title' => $pushover_title, 'message' => $pushover_message, 'url' => $pushover_url, 'url_title' => $pushover_url_title, 'priority' => 1);
// Convert to URL-Encoded string to post as application/x-www-form-urlencoded
$pushover_encoded_post_fields = http_build_query($pushover_post_fields);
$pushover_resp = curlCall($pushover_api_url, $pushover_encoded_post_fields, $pushover_options);
$parsed_resp = json_decode($pushover_resp, true);
if ($parsed_resp['status'] != 1) {
logModuleCall('pushover', 'pushover_server_error', $pushover_post_fields, $pushover_resp);
}
logModuleCall('pushover', 'hook_ticket_open', $pushover_post_fields, $pushover_resp);
}
示例3: api
/**
* Makes and API call to orderbox and Logs in WHMCS module if $module_name and $action_name are specified
*
* @param type $method http method to make api request
* @param type $path api path request
* @param type $params array of parameters for api request
* @param type $response_headers raw response of the api call
* @param type $module_name moduel name to be logged
* @param type $action_name moduel action to be logged
* @return type
*/
public function api($method, $path, $params = array(), &$response_headers = array(), $module_name = '', $action_name = '')
{
$url = $this->api_baseurl . ltrim($path, '/');
$query_params = empty($params) ? $this->auth_params : array_merge($params, $this->auth_params);
$query = $this->orderbox_http_build_query($query_params);
if ('POST' == $method) {
$get_fields = '';
$post_fields = empty($query_params) ? '' : $this->orderbox_http_build_query($query_params);
$request_headers = array("Content-Type: application/x-www-form-urlencoded; charset=utf-8");
} else {
$get_fields = $query;
$post_fields = '';
$request_headers = array();
}
try {
$response_json = $this->http_api_request($method, $url, $get_fields, $post_fields, $request_headers, $response_headers);
} catch (Exception $e) {
return "Exception oboxapi : " . $e->getMessage();
}
$response = json_decode($response_json, true);
if ($this->log_flag && function_exists('logModuleCall') && (!empty($module_name) || !empty($action_name))) {
logModuleCall($module_name, $action_name, array_merge(array('api' => $path), $params), $response_headers, $response);
}
return $response;
}
示例4: execute
protected function execute($postParams, $existingSession = true)
{
if ($existingSession) {
if (self::$sessionId === false) {
$api = new TPPW_AuthAPI($this->params);
$acountId = $this->params['AccountNo'];
$userId = $this->params['Login'];
$password = $this->params['Password'];
$results = $api->authenticate($acountId, $userId, $password);
if (!$results->isSuccess()) {
return $results;
}
self::$sessionId = $results->getResponse();
}
$postParams['SessionID'] = self::$sessionId;
}
$postParams = array_merge(TPPW_APIUtils::$API_COMMON_PARAMS, $postParams);
$postFields = '';
foreach ($postParams as $key => $values) {
if (is_array($values)) {
foreach ($values as $value) {
$postFields .= $key . '=' . urlencode($value) . '&';
}
} else {
$postFields .= $key . '=' . urlencode($values) . '&';
}
}
$conn = curl_init();
curl_setopt($conn, CURLOPT_URL, $this->url);
curl_setopt($conn, CURLOPT_POST, 1);
curl_setopt($conn, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($conn, CURLOPT_HEADER, false);
curl_setopt($conn, CURLOPT_RETURNTRANSFER, true);
curl_setopt($conn, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($conn, CURLOPT_SSL_VERIFYHOST, false);
$response = curl_exec($conn);
$error = curl_error($conn);
$errorNum = curl_errno($conn);
$stats = curl_getinfo($conn);
curl_close($conn);
$message = "<p><strong>API Query:</strong> <pre>{$this->url}?{$postFields}</pre></p>";
$message .= "<p><strong>Response:</strong> <pre>{$response}</pre></p>";
$message .= "<p><strong>Stats:</strong> <pre>" . print_r($stats, true) . "</pre></p>";
if (function_exists('logModuleCall')) {
logModuleCall(TPPW_APIUtils::$MODULE_NAME, $this->url, $postFields, $response);
}
if ($this->params['Debug']) {
logactivity($message);
}
if ($errorNum) {
return new TPPW_APIResult("ERR-CURL: {$errorNum}, {$error}");
}
return new TPPW_APIResult($response);
}
示例5: purchaseorder_link
function purchaseorder_link($params)
{
global $CONFIG;
$code = "";
$cart_action = filter_input(INPUT_GET, 'a', FILTER_SANITIZE_STRING);
$actual_auto_activate_value = array();
$actual_verified_account_value = array();
$sysurl = $CONFIG['SystemSSLURL'] ? $CONFIG['SystemSSLURL'] : $CONFIG['SystemURL'];
$invoiceid = $params['invoiceid'];
if ($params['enableautoactivatefield'] == 'on' && !empty($params['autoactivatefield'])) {
$auto_activate_field_label = $params['autoactivatefield'];
$auto_activate_query = select_query('tblcustomfields', 'id', array('fieldname' => $auto_activate_field_label));
$auto_activate_id = mysql_fetch_array($auto_activate_query);
}
if (!empty($params['verifiedaccountfield'])) {
$verified_account_field_label = $params['verifiedaccountfield'];
$verified_account_query = select_query('tblcustomfields', 'id', array('fieldname' => $verified_account_field_label));
$verified_account_id = mysql_fetch_array($verified_account_query);
}
// echo "AUTO ACTIVATE ID =" . $auto_activate_id;
// echo "VERIFIED ACCOUNT ID =" . $verified_account_id;
foreach ($params['clientdetails']['customfields'] as $customfield) {
if ($customfield['id'] == $auto_activate_id[0]) {
$actual_auto_activate_value = $customfield['value'];
}
if ($customfield['id'] == $verified_account_id[0]) {
$actual_verified_account_value = $customfield['value'];
}
}
$orderid_req = select_query('tblorders', 'id', array('invoiceid' => $invoiceid));
$orderid_data = mysql_fetch_array($orderid_req);
if (!empty($orderid_data['id'])) {
$orderid = $orderid_data['id'];
}
// Make sure you set the custom field value above
if ($actual_verified_account_value == 'on') {
$code .= html_entity_decode($params['approvedforpo']);
} else {
$code .= html_entity_decode($params['notapprovedforpo']);
}
if ($actual_auto_activate_value == 'on' && !empty($orderid) && $cart_action != 'complete') {
purchaseorder_accept_order($orderid);
logModuleCall('autoactivate', 'activate', 'accepting order...', $orderid);
}
// Required to redirect after checking out
$code .= "<form method=\"POST\" action=\"{$sysurl}/viewinvoice.php?id={$invoiceid}\">";
return $code;
}
示例6: rrpproxy_call
function rrpproxy_call($params, $request)
{
$url = "https://api.rrpproxy.net/api/call.cgi?";
if ($params['TestMode']) {
$url = "https://api-ote.rrpproxy.net/api/call.cgi?";
}
if (is_array($request)) {
$query_string = "";
foreach ($request as $k => $v) {
$query_string .= $k . "=" . urlencode($v) . "&";
}
} else {
$query_string = $request;
}
$url .= "s_login=" . urlencode($params['Username']) . "&s_pw=" . urlencode($params['Password']) . "&" . $query_string;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$retval = curl_exec($ch);
if (curl_errno($ch)) {
$retval = "CURL Error: " . curl_errno($ch) . " - " . curl_error($ch);
}
curl_close($ch);
$lines = explode("\n", $retval);
foreach ($lines as $tempvalue) {
$tempvalue = explode("=", $tempvalue);
$result[trim($tempvalue[0])] = trim($tempvalue[1]);
}
if (substr($retval, 0, 4) == "CURL") {
$result['code'] = "999";
$result['description'] = $retval;
} else {
if (!$retval) {
$result['code'] = "998";
$result['description'] = "An unhandled exception occurred";
}
}
$action = explode("&", $query_string);
$action = $action[0];
$action = str_replace("command=", "", $action);
logModuleCall("rrpproxy", $action, $url, $retval, $result, array($params['Username'], $params['Password']));
return $result;
}
示例7: call
public function call($action, $format = true)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->url . "/api/" . $action . ($format ? "/format/json/" : ""));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERPWD, $this->user . ":" . $this->pass);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$this->response = json_decode(curl_exec($ch), true);
$this->http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$this->curl_error = curl_error($ch);
if ($this->response['messages']['error'][0]) {
$this->error = $this->response['messages']['error'][0];
}
if ($this->debug) {
logModuleCall('spamexpertsresller', $action, $this->url . "/api/" . $action . ($format ? "/format/json/" : ""), print_r($this->response, true));
}
curl_close($ch);
}
示例8: tunai_link
function tunai_link($params)
{
# Gateway Specific Variables
$merchantid = $params['merchantid'];
$accesskey = $params['accesskey'];
$secretkey = $params['secretkey'];
# Invoice Variables
$invoiceid = $params['invoiceid'];
$description = $params["description"];
$amount = $params['amount'];
# Format: ##.##
$currency = $params['currency'];
# Currency Code
# Client Variables
$firstname = $params['clientdetails']['firstname'];
$lastname = $params['clientdetails']['lastname'];
$email = $params['clientdetails']['email'];
$address1 = $params['clientdetails']['address1'];
$address2 = $params['clientdetails']['address2'];
$city = $params['clientdetails']['city'];
$state = $params['clientdetails']['state'];
$postcode = $params['clientdetails']['postcode'];
$country = $params['clientdetails']['country'];
$phone = $params['clientdetails']['phonenumber'];
# System Variables
$companyname = $params['companyname'];
$systemurl = $params['systemurl'];
$currency = $params['currency'];
$log_enable = $params['log_enable'];
# Invoice Items
$command = "getinvoice";
$adminuser = $params['api_username'];
$values["invoiceid"] = $invoiceid;
$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);
if ($log_enable == true) {
logModuleCall('tunai', 'getinvoice', $values, $results, $ressultarray, '');
}
$item_details = array();
$itemid = 0;
if ($results["result"] == "success") {
$invoiceitems = $results['items']['item'];
for ($i = 0; $i < count($invoiceitems); $i++) {
$invoiceitem = $invoiceitems[$i];
$itemdescription = $invoiceitem['description'];
$itemdescription = preg_replace("/\r|\n/", ",", $itemdescription);
if (strlen($itemdescription) > 50) {
$itemdescription = substr($itemdescription, 0, 50);
}
$itemid++;
$data = array('itemId' => strval($itemid), 'price' => $invoiceitem['amount'], 'quantity' => 1, 'description' => $itemdescription);
$item_details[] = $data;
}
# PPn
$tax = $results['tax'];
if ($tax > 0) {
$itemid++;
$data = array('itemId' => strval($itemid), 'price' => $tax, 'quantity' => 1, 'description' => 'Pajak');
$item_details[] = $data;
}
# credit
$credit = $results['credit'];
if ($credit > 0) {
$itemid++;
$data = array('itemId' => strval($itemid), 'price' => $credit * -1, 'quantity' => 1, 'description' => 'Saldo');
$item_details[] = $data;
}
}
if ($log_enable == true) {
logModuleCall('tunai', 'itemdetails', $values, $results, $item_details, '');
}
$customer = array("name" => $firstname . " " . $lastname, "address" => $address1 . "\r\n" . $address2, "phone" => $phone, "city" => $city, "province" => $state, "zipcode" => $postcode, "country" => $country, "mobilephone" => "", "identity" => "");
$data = array("refId" => strval($invoiceid), "expired" => (string) time() + 24 * 60 * 60 . '000', "amount" => $amount, "customer" => $customer, "items" => $item_details);
$invoice = new Invoice($accesskey, $secretkey);
$response = $invoice->getByRefOrCreate($data);
$json = $response->getBody();
if ($log_enable == true) {
logModuleCall('tunai', 'getByRefOrCreate', $data, $json, $ressultarray, '');
}
$statusCode = $response->getStatusCode();
$obj = json_decode($json);
if ($statusCode == 200) {
$code = '<img src="//files.tunai.id/images/tunai-button-white.png" alt="tunai" /><p>Kode Pembayaran: <strong>' . $obj->token . '</strong><br />Total: Rp ' . $obj->amount . ' </p><form method="post" action="https://pay.tunai.id/' . $obj->token . '"><input type="submit" value="Bayar ke Agen" /></form>';
return $code;
}
return '<b>' . $obj->message . '</b>';
}
示例9: resellerclubsdhostingin_UnsuspendAccount
function resellerclubsdhostingin_UnsuspendAccount($params)
{
global $orderbox;
try {
$plan_pieces = _get_plan_details($params['configoption1']);
if ('windows' == $plan_pieces['type']) {
$api_path_orderid_from_domain = '/singledomainhosting/windows/in/orderid.json';
} else {
$api_path_orderid_from_domain = '/singledomainhosting/linux/in/orderid.json';
}
$order_id_result = $orderbox->api('GET', $api_path_orderid_from_domain, array('domain-name' => $params['domain']), $response, 'resellerclubsdhostingin', 'unsuspend');
if (is_array($order_id_result) && array_key_exists('status', $order_id_result) && strtolower($order_id_result['status']) == 'error') {
return $order_id_result['message'];
} else {
$order_id = $order_id_result;
$order_unsuspend_result = $orderbox->api('POST', '/orders/unsuspend.json', array('order-id' => $order_id), $response, 'resellerclubsdhostingin', 'unsuspend');
if (is_array($order_unsuspend_result) && array_key_exists('status', $order_unsuspend_result)) {
$status = strtolower($order_unsuspend_result['status']);
if ($status == 'success') {
return 'success';
} else {
return $order_unsuspend_result['message'];
}
}
}
} catch (Exception $e) {
logModuleCall('resellerclubsdhostingin', 'unsuspend', 'unknown', 'Exception : ' . $e->getMessage());
return "Order unsuspend error - " . $e->getMessage();
}
}
示例10: budgetvm_ClientArea
//.........这里部分代码省略.........
if ($type->result == "dedicated") {
$status = new BudgetVM_Api($params['serverpassword']);
$budgetvm->status = $status->call("v2", "device", "reload", "put", $var)->result;
} else {
$budgetvm->status = NULL;
}
$profiles = new BudgetVM_Api($params['serverpassword']);
$budgetvm->profiles = $profiles->call("v2", "device", "reload", "get", $var)->result;
$serviceAction = 'get_usage';
$templateFile = 'templates/reinstall.tpl';
} elseif ($requestedAction == 'ipmi') {
if ($_SERVER['REQUEST_METHOD'] == "POST") {
if ($type->result == "dedicated") {
if ($_POST['ipmi_reset'] == true) {
$reset_ipmi = new BudgetVM_Api($params['serverpassword']);
$budgetvm->return = $reset_ipmi->call("v2", "device", "console", "delete", $var);
} elseif ($_POST['ipmi_launch'] == true) {
$launch_ipmi = new BudgetVM_Api($params['serverpassword']);
$budgetvm->return = $launch_ipmi->call("v2", "device", "console", "get", $var);
if ($budgetvm->return->success == true) {
$launch_ipmi->ipmiLaunch(base64_decode($budgetvm->return->result));
$budgetvm->return->result = "KVM Launched, File download started.";
}
} elseif ($_POST['image_unmount'] == true) {
$unmount_image = new BudgetVM_Api($params['serverpassword']);
$budgetvm->return = $unmount_image->call("v2", "device", "iso", "delete", $var);
} elseif ($_POST['image_mount'] == true) {
$mount_image = new BudgetVM_Api($params['serverpassword']);
$var->post->image = $_POST['profile'];
$budgetvm->return = $mount_image->call("v2", "device", "iso", "post", $var);
$mount_image = new BudgetVM_Api($params['serverpassword']);
$budgetvm->return = $mount_image->call("v2", "device", "iso", "put", $var);
}
} else {
if ($_POST['ipmi_vm_launch'] == true) {
$ipmi_vm_launch = new BudgetVM_Api($params['serverpassword']);
$budgetvm->return = $ipmi_vm_launch->call("v2", "device", "console", "get", $var);
if ($budgetvm->return->success == true) {
$message = "<h4>Management Console</h4>";
$message .= "Username: " . $budgetvm->return->result->user . "</br>" . PHP_EOL;
$message .= "Password: " . $budgetvm->return->result->pass . "</br>" . PHP_EOL;
$message .= "Host: <a href='" . $budgetvm->return->result->host . "' target='_blank'>" . $budgetvm->return->result->host . "</a>" . PHP_EOL;
$budgetvm->return->result = $message;
}
}
}
} else {
$budgetvm->return = NULL;
}
$images = new BudgetVM_Api($params['serverpassword']);
$budgetvm->images = $images->call("v2", "device", "iso", "get", NULL);
$status = new BudgetVM_Api($params['serverpassword']);
$budgetvm->status = $status->call("v2", "device", "iso", "get", $var);
$serviceAction = 'get_usage';
$templateFile = 'templates/ipmi.tpl';
} else {
// Service Overview
if ($type->success == true) {
$budgetvm->type = $type->result;
if ($type->result == "dedicated") {
$device = new BudgetVM_Api($params['serverpassword']);
$device = $device->call("v2", "device", "hardware", "get", $var);
$network = new BudgetVM_Api($params['serverpassword']);
$network = $network->call("v2", "network", "netblock", "get", $var);
if ($network->result == true) {
$budgetvm->network = $network->result;
}
} else {
$device = new BudgetVM_Api($params['serverpassword']);
$device = $device->call("v2", "device", "stats", "get", $var);
}
if ($device->success == true) {
$budgetvm->device = $device->result;
}
}
$var->post->start = strtotime("last Month");
$var->post->end = strtotime("now");
$bandwidth = new BudgetVM_Api($params['serverpassword']);
$budgetvm->bandwidth = $bandwidth->call("v2", "network", "bandwidth", "post", $var);
$status = new BudgetVM_Api($params['serverpassword']);
$status = $status->call("v2", "device", "power", "get", $var);
if ($status->success == true && $status->success == true) {
$budgetvm->status = $status->result;
} else {
$budgetvm->status = "Uknown";
}
$serviceAction = 'get_stats';
$templateFile = 'templates/overview.tpl';
}
try {
// Call the service's function based on the request action, using the
// values provided by WHMCS in `$params`.
return array('tabOverviewReplacementTemplate' => $templateFile, 'templateVariables' => array('budgetvm' => $budgetvm));
} catch (Exception $e) {
// Record the error in WHMCS's module log.
logModuleCall('provisioningmodule', __FUNCTION__, $params, $e->getMessage(), $e->getTraceAsString());
// In an error condition, display an error page.
return array('tabOverviewReplacementTemplate' => 'error.tpl', 'templateVariables' => array('usefulErrorHelper' => $e->getMessage()));
}
}
示例11: namecheap_DeleteNameserver
function namecheap_DeleteNameserver($params)
{
require_once dirname(__FILE__) . "/namecheapapi.php";
$testmode = (bool) $params['TestMode'];
$username = $testmode ? $params['SandboxUsername'] : $params['Username'];
$password = $testmode ? $params['SandboxPassword'] : $params['Password'];
$tld = $params['tld'];
$sld = $params['sld'];
$oIDNA = new NamecheapRegistrarIDNA($sld, $tld);
$sld = $oIDNA->getEncodedSld();
$response = '';
$result = $request_params = $values = array();
try {
$request_params = array('SLD' => $sld, 'TLD' => $tld, 'Nameserver' => $params['nameserver']);
$api = new NamecheapRegistrarApi($username, $password, $testmode);
$response = $api->request("namecheap.domains.ns.delete", $request_params);
$result = $api->parseResponse($response);
} catch (Exception $e) {
$values['error'] = "An error occurred: " . $e->getMessage();
logModuleCall('namecheap', 'DeleteNameserver', array('command' => "namecheap.domains.ns.delete") + $request_params, $response, $result, array($password));
}
return $values;
}
示例12: dottk_put
function dottk_put($xml, $callmethod, $params)
{
global $DOTTKAPI_user;
global $DOTTKAPI_phrase;
$xurl = "https://secure.dot.tk/partners/partnerapi.tk";
$DOTTKAPI_xmlout = 4;
$headers = array("Accept: application/x-www-form-urlencoded", "Content-Type: application/x-www-form-urlencoded");
$session = curl_init();
curl_setopt($session, CURLOPT_URL, $xurl);
curl_setopt($session, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($session, CURLOPT_POSTFIELDS, $xml);
curl_setopt($session, CURLOPT_HTTPHEADER, $headers);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
curl_setopt($session, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($session, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($session);
$action = explode("&", $xml);
$action = explode("=", $action[0]);
$action = end($action);
logModuleCall("dottk", $action, $xml, $response, "", array(urlencode($params['Password']), urlencode($params['Email'])));
if (curl_errno($session)) {
$response['curlerror'] = "CURL Error: " . curl_errno($session) . " - " . curl_error($session);
curl_close($session);
return $response;
}
curl_close($session);
if ($DOTTKAPI_xmlout == 0) {
$xmlarray = XMLtoARRAY($response);
return $xmlarray;
}
return $response;
}
示例13: virtualmin_req
function virtualmin_req($params, $postfields, $rawdata = false)
{
$http = $params['serversecure'] ? "https" : "http";
$domain = $params['serverhostname'] ? $params['serverhostname'] : $params['serverip'];
$url = "" . $http . "://" . $domain . "/virtual-server/remote.cgi?" . $fieldstring;
$fieldstring = "";
foreach ($postfields as $k => $v) {
$fieldstring .= "" . $k . "=" . urlencode($v) . "&";
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fieldstring);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERPWD, $params['serverusername'] . ":" . $params['serverpassword']);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
$data = curl_exec($ch);
if (curl_errno($ch)) {
$data = "Curl Error: " . curl_errno($ch) . " - " . curl_error($ch);
}
curl_close($ch);
logModuleCall("virtualmin", $postfields['program'], $postfields, $data);
if (strpos($data, "Unauthorized") == true) {
return "Server Login Invalid";
}
if ($rawdata) {
return $data;
}
$exitstatuspos = strpos($data, "Exit status:");
$exitstatus = trim(substr($data, $exitstatuspos + 12));
if ($exitstatus == "0") {
$result = "success";
} else {
$dataarray = explode("\n", $data);
$result = $dataarray[0];
}
return $result;
}
示例14: opensrspro_logModuleCall
function opensrspro_logModuleCall($function, $callArray, $resultFullRaw, $return, $params)
{
$module = 'OpenSRSPro';
$action = substr($function, 0, 11) == 'opensrspro_' ? substr($function, 11) : $function;
$requeststring = $callArray;
$responsedata = $resultFullRaw;
//$processeddata = $return;
$replacevars = array($params["TestUsername"], $params["TestAPIKey"], $params["ProdUsername"], $params["ProdAPIKey"]);
logModuleCall($module, $action, $requeststring, $responsedata, $return, $replacevars);
}
示例15: provisioningmodule_ClientArea
/**
* Client area output logic handling.
*
* This function is used to define module specific client area output. It should
* return an array consisting of a template file and optional additional
* template variables to make available to that template.
*
* The template file you return can be one of two types:
*
* * tabOverviewModuleOutputTemplate - The output of the template provided here
* will be displayed as part of the default product/service client area
* product overview page.
*
* * tabOverviewReplacementTemplate - Alternatively using this option allows you
* to entirely take control of the product/service overview page within the
* client area.
*
* Whichever option you choose, extra template variables are defined in the same
* way. This demonstrates the use of the full replacement.
*
* Please Note: Using tabOverviewReplacementTemplate means you should display
* the standard information such as pricing and billing details in your custom
* template or they will not be visible to the end user.
*
* @param array $params common module parameters
*
* @see http://docs.whmcs.com/Provisioning_Module_SDK_Parameters
*
* @return array
*/
function provisioningmodule_ClientArea(array $params)
{
// Determine the requested action and set service call parameters based on
// the action.
$requestedAction = isset($_REQUEST['customAction']) ? $_REQUEST['customAction'] : '';
if ($requestedAction == 'manage') {
$serviceAction = 'get_usage';
$templateFile = 'templates/manage.tpl';
} else {
$serviceAction = 'get_stats';
$templateFile = 'templates/overview.tpl';
}
try {
// Call the service's function based on the request action, using the
// values provided by WHMCS in `$params`.
$response = array();
$extraVariable1 = 'abc';
$extraVariable2 = '123';
return array('tabOverviewReplacementTemplate' => $templateFile, 'templateVariables' => array('extraVariable1' => $extraVariable1, 'extraVariable2' => $extraVariable2));
} catch (Exception $e) {
// Record the error in WHMCS's module log.
logModuleCall('provisioningmodule', __FUNCTION__, $params, $e->getMessage(), $e->getTraceAsString());
// In an error condition, display an error page.
return array('tabOverviewReplacementTemplate' => 'error.tpl', 'templateVariables' => array('usefulErrorHelper' => $e->getMessage()));
}
}