本文整理汇总了PHP中logActivity函数的典型用法代码示例。如果您正苦于以下问题:PHP logActivity函数的具体用法?PHP logActivity怎么用?PHP logActivity使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了logActivity函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: log
function log($msg)
{
if (is_array($msg)) {
$msg = print_r($msg, true);
}
logActivity($msg);
}
开发者ID:carriercomm,项目名称:sso-whmcs,代码行数:7,代码来源:connect.class.php
示例2: stop_users_vms
function stop_users_vms()
{
logActivity("Starting to stop vms for users.");
//Find all users whos credit is low
$table = "tblclients";
$fields = "*";
$result = select_query($table, $fields);
if ($result) {
while ($data = mysql_fetch_array($result)) {
$userid = $data['id'];
$balanceLimit = get_balance_limit($userid);
if (!$balanceLimit || !is_numeric($balanceLimit)) {
$balanceLimit = 0;
}
logActivity("Balance limit for user " . $userid . ": " . $balanceLimit);
if (getCreditForUserId($userid) + $balanceLimit < 0) {
logActivity("Stopping vms for user: " . $userid);
$command = '/bin/stopvms?arg=-u&arg=' . $userid . '&asynchronous';
$res = oms_command($command);
if ($res != -1) {
logActivity("Stopped vms for user: " . $userid . ". Result:" . $res);
} else {
logActivity("Stoping vms failed for user: " . $userid);
}
}
}
}
logActivity("Stopping vms for users ended.");
}
开发者ID:carriercomm,项目名称:opennode-whmcs,代码行数:29,代码来源:hook_oms_dailycronjob.php
示例3: doUnsubscribe
/**
*
* @ WHMCS FULL DECODED & NULLED
*
* @ Version : 5.2.15
* @ Author : MTIMER
* @ Release on : 2013-12-24
* @ Website : http://www.mtimer.cn
*
**/
function doUnsubscribe($email, $key)
{
global $whmcs;
global $_LANG;
$whmcs->get_hash();
if (!$email) {
return $_LANG['pwresetemailrequired'];
}
$result = select_query("tblclients", "id,email,emailoptout", array("email" => $email));
$data = mysql_fetch_array($result);
$userid = $data['id'];
$email = $data['email'];
$emailoptout = $data['emailoptout'];
$newkey = sha1($email . $userid . $cc_encryption_hash);
if ($newkey == $key) {
if (!$userid) {
return $_LANG['unsubscribehashinvalid'];
}
if ($emailoptout == 1) {
return $_LANG['alreadyunsubscribed'];
}
update_query("tblclients", array("emailoptout" => "1"), array("id" => $userid));
sendMessage("Unsubscribe Confirmation", $userid);
logActivity("Unsubscribed From Marketing Emails - User ID:" . $userid, $userid);
return null;
}
return $_LANG['unsubscribehashinvalid'];
}
开发者ID:billyprice1,项目名称:whmcs,代码行数:38,代码来源:unsubscribe.php
示例4: getActiveFraudModule
function getActiveFraudModule()
{
global $CONFIG;
$result = select_query("tblfraud", "fraud", array("setting" => "Enable", "value" => "on"));
$data = mysql_fetch_array($result);
$fraud = $data['fraud'];
$orderid = $_SESSION['orderdetails']['OrderID'];
if ($CONFIG['SkipFraudForExisting']) {
$result = select_query("tblorders", "COUNT(*)", array("status" => "Active", "userid" => $_SESSION['uid']));
$data = mysql_fetch_array($result);
if ($data[0]) {
$fraudmodule = "";
logActivity("Order ID " . $orderid . " Skipped Fraud Check due to Already Active Orders");
}
}
$hookresponses = run_hook("RunFraudCheck", array("orderid" => $orderid, "userid" => $_SESSION['uid']));
foreach ($hookresponses as $hookresponse) {
if ($hookresponse) {
$fraud = "";
logActivity("Order ID " . $orderid . " Skipped Fraud Check due to Custom Hook");
continue;
}
}
return $fraud;
}
开发者ID:billyprice1,项目名称:whmcs,代码行数:25,代码来源:fraudfunctions.php
示例5: modify_oms_passwd
function modify_oms_passwd($vars)
{
$userid = $vars['userid'];
$password = $vars['password'];
$command = '/bin/passwd?arg=-u&arg=' . $userid . '&arg=' . $password;
$result = oms_command($command);
logActivity('Modified password of the OMS user ' . $username . ', result: ' . $result);
}
开发者ID:carriercomm,项目名称:opennode-whmcs,代码行数:8,代码来源:hook_oms_passwd.php
示例6: createOrder
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;
}
开发者ID:billyprice1,项目名称:whmcs,代码行数:8,代码来源:class.order.php
示例7: process
public function process()
{
$event = Events::getById($this->getElementValue('id'));
Events::setSignupStatus($this->user->getId(), $event['id'], 'SIGNEDUP');
Events::appendSignupComment($this->user->getId(), $event['id'], 'Forced signup.', Session::getUser()->getUsername());
logActivity('Forced signup of:' . $this->getElementValue('username') . ' to event: ' . $event['id'] . ' (' . $event['name'] . ')');
redirect('viewEvent.php?id=' . $event['id'], 'They have been signed up.');
}
开发者ID:CWFranklin,项目名称:lan-party-site,代码行数:8,代码来源:FormForceSignup.php
示例8: process
public function process()
{
$eventId = $this->getElementValue('event');
$userId = $this->userId;
$seatId = $this->getElementValue('seat');
setSeatForUser($eventId, $userId, $seatId);
logActivity('Moved user ' . $this->getElementValue('username') . ' to seat ' . $seatId);
}
开发者ID:CWFranklin,项目名称:lan-party-site,代码行数:8,代码来源:FormSeatingPlanMoveUser.php
示例9: smarty_function_oms_bundle_products
/**
* Smarty {oms_bundle_products} function plugin
*
* Type: function<br>
* Name: oms_bundle_products<br>
* Date: April 12, 2013<br>
* Purpose: Provides OMS bundles with product items sum and with product items names if not defined manually.
* @version 1.0
* @param array
* @param Smarty
* @return Integer logged in user credit amount
*/
function smarty_function_oms_bundle_products($params, &$smarty)
{
$bundleId = empty($params['bundleId']) ? null : $params['bundleId'];
$groupId = empty($params['groupId']) ? null : $params['groupId'];
$smarty->assign('productSum', 0);
if ($bundleId && $bundleId) {
//Query for bundles
$table = "tblbundles";
$fields = "*";
$where = array("gid" => $groupId, "id" => $bundleId);
$sort = "id";
$sortorder = "ASC";
$result = select_query($table, $fields, $where, $sort, $sortorder);
if ($result) {
$productIds = array();
while ($data = mysql_fetch_array($result)) {
$itemdata = $data['itemdata'];
//find product ids from string
$ptn = "*\"pid\";[a-z]:[0-9]+:\"[0-9]+\"*";
preg_match_all($ptn, $itemdata, $matches);
foreach ($matches[0] as $match) {
$ptnNr = "/[0-9]+\$/";
$str = str_replace("\"", "", $match);
preg_match($ptnNr, $str, $matchNr);
if ($matchNr) {
$productIds[$matchNr[0]]++;
} else {
logActivity("Error parsing itemdata to get product id.");
}
}
}
$productsNames = array();
$sum = 0;
foreach ($productIds as $id => $count) {
//print_r("Product with id:".$id.", count:".$count);
//Query for products
$sql = "SELECT DISTINCT * FROM tblproducts product JOIN tblpricing price ON product.id = price.relid WHERE price.type='product' AND product.id = '" . $id . "'";
$query = mysql_query($sql);
$product = mysql_fetch_array($query);
if ($product) {
$sum += $product['monthly'] * $count;
$productsNames[] = ($count > 1 ? $count . " x " : '') . $product['name'];
} else {
logActivity("Error getting product");
}
}
$smarty->assign('productSum', $sum);
$smarty->assign('productNames', $productsNames);
//print_r("<PRE>");
//print_r($productIds);
//print_r("</PRE>");
} else {
logActivity("Error getting bundles products");
}
}
}
开发者ID:carriercomm,项目名称:opennode-whmcs,代码行数:68,代码来源:function.oms_bundle_products.php
示例10: process
public function process()
{
global $db;
$sql = 'INSERT INTO events (name, date, duration, venue) VALUES (:title, :start, :duration, :venue)';
$stmt = $db->prepare($sql);
$stmt->bindValue(':title', $this->getElementValue('title'));
$stmt->bindValue(':start', $this->getElementValue('start'));
$stmt->bindValue(':duration', $this->getElementValue('duration'));
$stmt->bindValue(':venue', $this->getElementValue('venue'));
$stmt->execute();
logActivity('Event created: ' . $db->lastInsertId() . ' / ' . $this->getElementValue('title'));
}
开发者ID:CWFranklin,项目名称:lan-party-site,代码行数:12,代码来源:FormEventCreate.php
示例11: processNew
public function processNew()
{
global $db;
$sql = 'INSERT INTO page_content (page, content, updatedBy) VALUES (:title, :content, :userId) ';
$stmt = $db->prepare($sql);
$stmt->bindValue(':title', $this->getElementValue('title'));
$stmt->bindValue(':content', $this->getElementValue('content'));
$stmt->bindValue(':userId', Session::getUser()->getId());
$stmt->execute();
logActivity('Content created: ' . $this->getElementValue('title'));
return true;
}
开发者ID:CWFranklin,项目名称:lan-party-site,代码行数:12,代码来源:FormContentEdit.php
示例12: slack_post
function slack_post($text)
{
$json = file_get_contents(dirname(__FILE__) . "/slack.json");
$config = json_decode($json, true);
$url = $config['hook_url'];
$payload = array("text" => $text, "username" => $config["username"], "icon_emoji" => $config["emoji"], "channel" => $config["channel"]);
$data = "payload=" . json_encode($payload);
logActivity("Send slack notification:" . $text);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
}
开发者ID:hxinen,项目名称:whmcs-hook-slack,代码行数:14,代码来源:slack.php
示例13: setUserInSeat
function setUserInSeat($eventId, $seatId, $userId = null)
{
if (empty($userId)) {
$userId = Session::getUser()->getId();
}
logActivity('_u_' . ' selected seat ' . $seatId . ' for event _e_', null, array('user' => $userId, 'event' => $eventId));
$sql = 'INSERT INTO seatingplan_seat_selections (seat, event, user) VALUES (:seat, :event, :user1) ON DUPLICATE KEY UPDATE user = :user2';
$stmt = DatabaseFactory::getInstance()->prepare($sql);
$stmt->bindValue(':seat', $seatId);
$stmt->bindValue(':event', $eventId);
$stmt->bindValue(':user1', $userId);
$stmt->bindValue(':user2', $userId);
$stmt->execute();
}
开发者ID:CWFranklin,项目名称:lan-party-site,代码行数:14,代码来源:functions.seatingPlan.php
示例14: populateLoadAverageInProductDetailsPage
/**
* Add information about the system's load average to the template
*
* @param array $params The current template variables to display
* @return array key value pairs of variables to add to the template
*/
function populateLoadAverageInProductDetailsPage($params)
{
$serviceId = $params['serviceid'];
// See http://docs.whmcs.com/classes/classes/WHMCS.Service.Service.html for details on this model
/** @var Service $service */
try {
$service = Service::findOrFail($serviceId);
} catch (Exception $e) {
logActivity('Exception caught when trying to load the Service Model:' . $e->getMessage());
return null;
}
$loadAverage = getLoadAverageFromService($service);
// Simple conversion from SimpleXMLElement to array
return array('loadAverage' => (array) $loadAverage);
}
开发者ID:n8whnp,项目名称:cPconf-2015,代码行数:21,代码来源:populateCpanelDetails.php
示例15: affiliateActivate
/**
*
* @ 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));
}
开发者ID:billyprice1,项目名称:whmcs,代码行数:26,代码来源:affiliatefunctions.php
示例16: updateCustomer
/**
* Updates a customer at Acumulus
* @param $vars : $vars from the hook for API credentials
* @param $clientid : clientid to update
* @param null $customerid : customerid at Acumulus to update
* @throws Exception
* @return $customerid : new/updated customerid at Acumulus
*/
function updateCustomer($vars, $clientid, $customerid = null)
{
global $whmcs;
$whmcs->load_function('invoice');
$clientQuery = mysql_query('SELECT tblclients.*, tblcustomfieldsvalues.value AS vatnumber FROM tblclients LEFT JOIN tblcustomfieldsvalues ON tblclients.id = tblcustomfieldsvalues.relid AND tblcustomfieldsvalues.fieldid = (SELECT id FROM tblcustomfields WHERE type = "client" AND fieldname = "' . $vars['vat_field'] . '" LIMIT 1) WHERE tblclients.id = ' . $clientid . ' LIMIT 1');
if (mysql_num_rows($clientQuery) != 1) {
throw new Exception('Failed to receive client ' . $clientid);
}
$clientFetch = mysql_fetch_assoc($clientQuery);
$api = new api($vars['code'], $vars['username'], $vars['password']);
$api->setCategory('contacts')->setAction('contact_manage');
if (isset($vars['debug']) && $vars['debug'] == 'on') {
$api->enableDebug($vars['debug_email']);
}
if ($clientFetch['acumulusid'] != null) {
$api->setParam('contact/contactid', $clientFetch['acumulusid']);
}
if ($customerid != null) {
$api->setParam('contact/contactid', $customerid);
}
if ($clientFetch['country'] == 'NL') {
$api->setParam('contact/contactlocationcode', 1);
} elseif (inEurope($clientFetch['country'])) {
$api->setParam('contact/contactlocationcode', 2);
} else {
$api->setParam('contact/contactlocationcode', 3);
}
$taxData = getTaxRate(1, $clientQuery['state'], $clientQuery['country']);
$api->setParams(array('contact' => array('contactemail' => $clientFetch['email'], 'contacttype' => 1, 'overwriteifexists' => 1, 'contactname1' => ucfirst($clientFetch['firstname']) . ' ' . $clientFetch['lastname'], 'contactname2' => '', 'contactperson' => '', 'contactsalutation' => '', 'contactaddress1' => $clientFetch['address1'], 'contactaddress2' => $clientFetch['address2'], 'contactpostalcode' => $clientFetch['postcode'], 'contactcity' => $clientFetch['city'], 'contactcountrycode' => inEurope($clientFetch['country']) ? $clientFetch['country'] : '', 'contactvatnumber' => $clientFetch['vatnumber'], 'contactvatratebase' => $clientFetch['taxexempt'] == 'on' ? -1 : round($taxData['rate']), 'contacttelephone' => $clientFetch['phonenumber'], 'contactfax' => '', 'contactsepaincassostatus' => 'FRST', 'contactinvoicetemplateid' => '', 'contactstatus' => 1)));
if (!empty($clientFetch['companyname'])) {
$api->setParams(array('contact' => array('contactname1' => $clientFetch['companyname'], 'contactperson' => ucfirst($clientFetch['firstname']) . ' ' . $clientFetch['lastname'])));
}
$api->execute();
$response = $api->getResponse();
if ($api->hasErrors()) {
$errors = '';
foreach ($api->getErrors() as $error) {
$errors = $error['code'] . ' - ' . $error['message'] . ', ';
}
logActivity('Acumulus API error(s): ' . substr($errors, 0, -2));
return false;
} else {
mysql_query('UPDATE tblclients SET acumulusid = ' . $response['contact']['contactid'] . ' WHERE id = ' . $clientid . ' LIMIT 1');
return $response['contact']['contactid'];
}
}
开发者ID:0100Dev,项目名称:WHMCS-Acumulus,代码行数:54,代码来源:general.php
示例17: 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;
}
}
开发者ID:carriercomm,项目名称:opennode-whmcs,代码行数:45,代码来源:hook_oms_userpromotion.php
示例18: cpanelextender_addFtpAccount
function cpanelextender_addFtpAccount($serviceId, $ftpUsername, $ftpPassword)
{
try {
$service = Service::findOrFail($serviceId);
} catch (Exception $e) {
logActivity('Exception caught when trying to load the Service Model:' . $e->getMessage());
return json_encode(array('message' => 'Unable to load service model for: ' . $serviceId, 'success' => 0));
}
$cPServer = cpanelextender_getCpanelAPIFromService($service);
$cPServer->set_output('json');
$args = array('user' => $ftpUsername, 'pass' => $ftpPassword);
$result = $cPServer->api2_query($service->username, 'Ftp', 'addftp', $args);
$result = json_decode($result, true);
$result = $result['cpanelresult'];
if (array_key_exists('error', $result)) {
$result['return']['reason'] = $result['error'];
}
$result['return']['result'] = $result['data'][0]['result'];
return json_encode($result['return']);
}
开发者ID:n8whnp,项目名称:cPconf-2015,代码行数:20,代码来源:cpanelextender.php
示例19: hook_coza_client_update
/**
* @link http://docs.whmcs.com/Hooks:ClientEdit
* @param array $vars
*/
function hook_coza_client_update($vars)
{
$params = getRegistrarConfigOptions('coza');
$contact = getClientsDetails($vars['userid'], 0);
$epp_client = \COZA\Factory::build($params);
try {
$epp_client->connect();
try {
\COZA\Factory::updateContactIfExists($epp_client, \COZA\Factory::getContactHandle($params, (int) $vars['userid']), $contact);
} catch (Exception $e) {
unset($epp_client);
logActivity($e->getMessage(), $vars['userid']);
return;
}
unset($epp_client);
return;
} catch (Exception $e) {
unset($epp_client);
logActivity('COZA/ContactUpdate: ' . $e->getMessage(), $vars['userid']);
return;
}
}
开发者ID:Bugsy0001,项目名称:whmcs-registrars-cocca,代码行数:26,代码来源:hooks.php
示例20: addOmsUsageClientAreaPage
/**
* Function that gets OMC VM data to display on template
*/
public static function addOmsUsageClientAreaPage($vars)
{
global $oms_usage_db, $product_core_name, $product_disk_name, $product_memory_name;
$userId = $_SESSION['uid'];
if (!is_numeric($userId)) {
return array();
}
//Get products prices
$hours_per_month = 720;
$p_core = getProductPriceByName($product_core_name) / $hours_per_month;
$p_disk = getProductPriceByName($product_disk_name) / $hours_per_month;
$p_memory = getProductPriceByName($product_memory_name) / $hours_per_month;
//logActivity("Using product prices for calculations: Cores:" . $p_core . ". Disk:" . $p_disk . ".Memory:" . $p_memory);
if (!$p_core || !$p_disk || !$p_memory) {
logActivity("Error: Product prices not set.");
return;
}
$username = $userId;
// XXX a temporary solution due to the removal of usernames
$balance_limit = get_balance_limit($userId);
$table = $oms_usage_db . ".CONF_CHANGES";
$sql = "select * from " . $table . " WHERE username='" . $username . "' ORDER BY timestamp DESC LIMIT 1";
$result = mysql_query($sql);
if ($result) {
$data = mysql_fetch_array($result);
if ($data) {
$id = $data['id'];
$mbsInGb = 1024;
$data['disk'] = $data['disk'] / $mbsInGb;
$amount = $data['cores'] * $p_core + $data['disk'] * $p_disk + $data['memory'] * $p_memory;
$data['vm_cost'] = \Opennode\Whmcs\Service\OmsReductionService::applyTax($userId, $amount);
}
}
$data['currentcredit'] = getCreditForUserId($userId) + $balance_limit;
return array('omsdata' => $data);
}
开发者ID:carriercomm,项目名称:opennode-whmcs,代码行数:39,代码来源:HookService.php
注:本文中的logActivity函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论