本文整理汇总了PHP中run_hook函数的典型用法代码示例。如果您正苦于以下问题:PHP run_hook函数的具体用法?PHP run_hook怎么用?PHP run_hook使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run_hook函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: editor_page_admin_CSS
function editor_page_admin_CSS()
{
//Allow module to manipulate css
$page_theme = THEME;
run_hook('site_theme', array(&$page_theme));
global $lang;
?>
<form method="post" action="">
<label class="kop2" for="cont1"><?php
echo $lang['editor']['content_css'];
?>
</label>
<br />
<textarea name="cont1" id="cont1" cols="90" rows="20"><?php
echo read_style($page_theme);
?>
</textarea>
<br />
<input type="submit" name="Submit" value="<?php
echo $lang['general']['save'];
?>
" />
<input type="button" name="Cancel" value="<?php
echo $lang['general']['cancel'];
?>
" onclick="javascript: window.location='admin.php?module=editor';" />
</form>
<?php
//Save style.
if (isset($_POST['Submit'])) {
$cont1 = $_POST['cont1'];
save_style($page_theme, $cont1);
redirect('admin.php?module=editor', 0);
}
}
示例3: pla_rdelete
function pla_rdelete($ldapserver, $dn)
{
$children = $ldapserver->getContainerContents($dn);
if (!is_array($children) || count($children) == 0) {
printf('<nobr>' . _('Deleting %s') . '...', htmlspecialchars($dn));
flush();
if (run_hook('pre_entry_delete', array('server_id' => $ldapserver->server_id, 'dn' => $dn))) {
if ($ldapserver->delete($dn)) {
run_hook('post_entry_delete', array('server_id' => $ldapserver->server_id, 'dn' => $dn));
printf(' <span style="color:green">%s</span></nobr><br />', _('Success'));
return true;
} else {
pla_error(sprintf(_('Failed to delete entry %s'), htmlspecialchars($dn)), $ldapserver->error(), $ldapserver->errno());
}
}
} else {
foreach ($children as $child_dn) {
pla_rdelete($ldapserver, $child_dn);
}
printf('<nobr>' . _('Deleting %s') . '...', htmlspecialchars($dn));
flush();
if (run_hook('pre_entry_delete', array('server_id' => $ldapserver->server_id, 'dn' => $dn))) {
if ($ldapserver->delete($dn)) {
run_hook('post_entry_delete', array('server_id' => $ldapserver->server_id, 'dn' => $dn));
printf(' <span style="color:green">%s</span></nobr><br />', _('Success'));
return true;
} else {
pla_error(sprintf(_('Failed to delete entry %s'), htmlspecialchars($dn)), $ldapserver->error(), $ldapserver->errno());
}
}
}
}
示例4: run_validate_hook
function run_validate_hook(&$validate, $hook_name, $args)
{
$hookerrors = run_hook($hook_name, $args);
$errormessage = "";
if (count($hookerrors)) {
foreach ($hookerrors as $hookerrors2) {
if (is_array($hookerrors2)) {
$validate->addErrors($hookerrors2);
continue;
}
$validate->addError($hookerrors2);
}
}
}
示例5: 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));
}
示例6: copy_dn
function copy_dn($ldapserver_src, $ldapserver_dst, $dn_src, $dn_dst)
{
if (DEBUG_ENABLED) {
debug_log('copy_dn: Entered with (%s,%s,%s,%s)', 17, $ldapserver_src->server_id, $ldapserver_dst->server_id, $dn_src, $dn_dst);
}
$new_entry = $ldapserver_src->getDNAttrs($dn_src);
# modify the prefix-value (ie "bob" in cn=bob) to match the destination DN's value.
$rdn_attr = substr($dn_dst, 0, strpos($dn_dst, '='));
$rdn_value = get_rdn($dn_dst);
$rdn_value = substr($rdn_value, strpos($rdn_value, '=') + 1);
$new_entry[$rdn_attr] = $rdn_value;
# don't need a dn attribute in the new entry
unset($new_entry['dn']);
# Check the user-defined custom call back first
if (run_hook('pre_entry_create', array('server_id' => $ldapserver_dst->server_id, 'dn' => $dn_dst, 'attrs' => $new_entry))) {
$add_result = $ldapserver_dst->add($dn_dst, $new_entry);
if (!$add_result) {
run_hook('post_entry_create', array('server_id' => $ldapserver_dst->server_id, 'dn' => $dn_dst, 'attrs' => $new_entry));
echo '</small><br /><br />';
pla_error(_('Failed to copy DN: ') . $dn_dst, $ldapserver_dst->error(), $ldapserver_dst->errno());
}
return $add_result;
} else {
return false;
}
}
示例7: define
define('MODULE_SETTINGS_DIR', 'data/settings/modules/' . $_GET['module']);
}
if (file_exists(PAGE_DIR)) {
$homepage = read_dir_contents(PAGE_DIR, 'files');
if ($homepage != false) {
sort($homepage, SORT_NUMERIC);
$homepage = get_page_seoname($homepage[0]);
} else {
$homepage = '404';
}
$page_url_prefix = '?file=';
run_hook('page_url_prefix', array(&$page_url_prefix));
define('PAGE_URL_PREFIX', $page_url_prefix);
unset($page_url_prefix);
$homepage = SITE_URI . '/' . PAGE_URL_PREFIX . $homepage;
run_hook('const_home_page', array(&$homepage));
define('HOME_PAGE', $homepage);
unset($homepage);
}
//Some GET-variables for general use.
if (isset($_GET['var1'])) {
$var1 = $_GET['var1'];
}
if (isset($_GET['var2'])) {
$var2 = $_GET['var2'];
}
if (isset($_GET['var3'])) {
$var3 = $_GET['var3'];
}
if (isset($_GET['var4'])) {
$var4 = $_GET['var4'];
示例8: disableAutoRenew
function disableAutoRenew($domainid)
{
update_query("tbldomains", array("donotrenew" => "on"), array("id" => $domainid));
$domainname = get_query_val("tbldomains", "domain", array("id" => $domainid));
if ($_SESSION['adminid']) {
logActivity("Admin Disabled Domain Auto Renew - Domain ID: " . $domainid . " - Domain: " . $domainname);
} else {
logActivity("Client Disabled Domain Auto Renew - Domain ID: " . $domainid . " - Domain: " . $domainname);
}
$result = select_query("tblinvoiceitems", "tblinvoiceitems.id,tblinvoiceitems.invoiceid", array("type" => "Domain", "relid" => $domainid, "status" => "Unpaid", "tblinvoices.userid" => $_SESSION['uid']), "", "", "", "tblinvoices ON tblinvoices.id=tblinvoiceitems.invoiceid");
while ($data = mysql_fetch_array($result)) {
$itemid = $data['id'];
$invoiceid = $data['invoiceid'];
$result2 = select_query("tblinvoiceitems", "COUNT(*)", array("invoiceid" => $invoiceid));
$data = mysql_fetch_array($result2);
$itemcount = $data[0];
$otheritemcount = 0;
if (1 < $itemcount) {
$otheritemcount = get_query_val("tblinvoiceitems", "COUNT(*)", "invoiceid=" . (int) $invoiceid . (" AND id!=" . $itemid . " AND type NOT IN ('PromoHosting','PromoDomain','GroupDiscount')"));
}
if ($itemcount == 1 || $otheritemcount == 0) {
update_query("tblinvoices", array("status" => "Cancelled"), array("id" => $invoiceid));
logActivity("Cancelled Previous Domain Renewal Invoice - Invoice ID: " . $invoiceid . " - Domain: " . $domainname);
run_hook("InvoiceCancelled", array("invoiceid" => $invoiceid));
}
delete_query("tblinvoiceitems", array("id" => $itemid));
updateInvoiceTotal($invoiceid);
logActivity("Removed Previous Domain Renewal Line Item - Invoice ID: " . $invoiceid . " - Domain: " . $domainname);
}
}
示例9: date
}
echo '>' . date($option) . '</option>' . "\n";
}
unset($option);
echo '</select>
</td>
<td><label for="post_time"> ' . $lang['blog']['post_time'] . '</label></td>
</tr>
</table><br />';
}
function blog_admin_module_settings_afterpost()
{
global $lang;
//truncate_posts should be numeric.
if (!is_numeric($_POST['truncate_posts']) || !is_numeric($_POST['posts_per_page'])) {
return show_error($lang['blog']['numeric_error'], 1, true);
}
if (empty($_POST['posts_per_page'])) {
return show_error($lang['blog']['posts_per_page_error'], 1, true);
} else {
//Compose settings array
$settings = array('allow_reactions' => isset($_POST['allow_reactions']) ? 'true' : 'false', 'truncate_posts' => $_POST['truncate_posts'], 'posts_per_page' => $_POST['posts_per_page'], 'post_date' => $_POST['post_date'], 'post_time' => $_POST['post_time']);
//Save settings
module_save_settings('blog', $settings);
}
}
//Add hook for SEO capabilities.
$blog_url_prefix = '&module=blog&page=viewpost&post=';
run_hook('blog_url_prefix', array(&$blog_url_prefix));
define('BLOG_URL_PREFIX', $blog_url_prefix);
unset($blog_url_prefix);
示例10: defined
/*
* This file is part of pluck, the easy content management system
* Copyright (c) pluck team
* http://www.pluck-cms.org
* Pluck is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* See docs/COPYING for the complete license.
*/
//Make sure the file isn't accessed directly.
defined('IN_PLUCK') or exit('Access denied!');
?>
<p>
<strong><?php
echo $lang['options']['message'];
?>
</strong>
</p>
<?php
run_hook('admin_options_before');
showmenudiv($lang['settings']['title'], $lang['options']['settings_descr'], 'data/image/settings.png', '?action=settings');
showmenudiv($lang['modules_manage']['title'], $lang['options']['modules_descr'], 'data/image/modules.png', '?action=managemodules');
showmenudiv($lang['modules_settings']['title'], $lang['options']['modules_sett_descr'], 'data/image/settings2.png', '?action=modulesettings');
showmenudiv($lang['theme']['title'], $lang['options']['themes_descr'], 'data/image/themes.png', '?action=theme');
showmenudiv($lang['language']['title'], $lang['options']['lang_descr'], 'data/image/language.png', '?action=language');
showmenudiv($lang['changepass']['title'], $lang['options']['pass_descr'], 'data/image/password.png', '?action=changepass');
run_hook('admin_options_after');
示例11: defined
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* See docs/COPYING for the complete license.
*/
//Make sure the file isn't accessed directly.
defined('IN_PLUCK') or exit('Access denied!');
?>
<p>
<strong><?php
echo $lang['page']['message'];
?>
</strong>
</p>
<?php
//Run hook.
run_hook('admin_pages_before');
//New page button.
showmenudiv($lang['page']['new'], null, 'data/image/newpage.png', '?action=editpage');
//Manage images button.
showmenudiv($lang['images']['title'], null, 'data/image/image.png', '?action=images');
//Manage files button.
showmenudiv($lang['files']['title'], null, 'data/image/file.png', '?action=files');
//Show pages.
$pages = get_pages();
if ($pages) {
foreach ($pages as $page) {
show_page_box($page);
}
unset($page);
}
示例12: array
$array = array("firstname" => $firstname, "lastname" => $lastname, "companyname" => $companyname, "email" => $email, "address1" => $address1, "address2" => $address2, "city" => $city, "state" => $state, "postcode" => $postcode, "country" => $country, "phonenumber" => $phonenumber, "subaccount" => $subaccount, "permissions" => $permissions, "domainemails" => $domainemails, "generalemails" => $generalemails, "invoiceemails" => $invoiceemails, "productemails" => $productemails, "supportemails" => $supportemails, "affiliateemails" => $affiliateemails);
if ($password && $password != $aInt->lang("fields", "entertochange")) {
$array['password'] = generateClientPW($password);
}
$where = array("id" => $contactid);
update_query($table, $array, $where);
run_hook("ContactEdit", array_merge(array("userid" => $userid, "contactid" => $contactid, "olddata" => $oldcontactdata), $array));
}
redir("userid=" . $userid . "&contactid=" . $contactid);
exit;
}
if ($action == "delete") {
check_token("WHMCS.admin.default");
delete_query("tblcontacts", array("id" => $contactid, "userid" => $userid));
update_query("tblclients", array("billingcid" => ""), array("id" => $userid, "billingcid" => $contactid));
run_hook("ContactDelete", array("userid" => $userid, "contactid" => $contactid));
redir("userid=" . $userid);
exit;
}
ob_start();
if ($error) {
infoBox($aInt->lang("global", "validationerror"), $error);
echo $infobox;
}
echo "\n<form action=\"";
echo $_SERVER['PHP_SELF'];
echo "\" method=\"get\">\n<input type=\"hidden\" name=\"userid\" value=\"";
echo $userid;
echo "\">\n";
echo $aInt->lang("clientsummary", "contacts");
echo ": ";
示例13: gp_LogGatewayTrans
gp_LogGatewayTrans("PayPal", $ipnValid[1], "Invalid IPN");
exit;
}
// Check that the payment status is completed
if ($ipnValid[1]['payment_status'] !== "Completed") {
gp_LogGatewayTrans("PayPal", $ipnValid[1], $ipnValid[1]['payment_status']);
exit;
}
//Check that we havn't credited for it already
$query = 'SELECT * FROM tblaccounts WHERE transid=\'' . $ipnValid[1]['txn_id'] . '\'';
if (mysql_num_rows(mysql_query($query))) {
exit;
}
$gpSettings = gp_LoadSettings();
//Begin to credit the client
//TODO: Uncomment
//$clientId = 1;
$clientId = gp_LoadUserFromHash($ipnValid[1]['custom']);
gp_LogGatewayTrans("PayPal", $ipnValid[1], "Successful");
if ($clientId) {
//Apply the Credit
// Get the clients currency and apply the rate
$currency = getCurrency($clientId);
//Write the Transactions
mysql_query("INSERT INTO `tblaccounts` (userid,gateway,`date`,description,amountin,fees,transid,invoiceid,`rate`)\n \t\t\t\t\t\t values ({$clientId},'paypal',now(),'" . $gpSettings['SystemName'] . " Credit'," . $ipnValid[1]['mc_gross'] . "," . $ipnValid[1]['mc_fee'] . ",'" . $ipnValid[1]['txn_id'] . "',0,'" . $currency['rate'] . "')");
//Increase the credit balance
mysql_query("UPDATE `tblclients` set credit = credit + " . $ipnValid[1]['mc_gross'] . " where id = {$clientId}");
//Add it to the credit log
mysql_query("INSERT INTO `tblcredit` (clientid,date,description,amount)\n\t\t\t\t\t values ({$clientId},now(),'" . $gpSettings['SystemName'] . " Credit " . $ipnValid[1]['payer_email'] . "'," . $ipnValid[1]['mc_gross'] . ")");
run_hook("groupPay_paymentComplete", array("clientId" => $clientId, "paypalInfo" => $ipnValid[1]));
}
示例14: select_query
$result = select_query("tblservers", "active,type", array("id" => $id));
$data = mysql_fetch_array($result);
if ($type == $data['type']) {
$active = $data['active'];
} else {
$active = "";
}
update_query("tblservers", array("name" => $name, "type" => $type, "ipaddress" => trim($ipaddress), "assignedips" => trim($assignedips), "hostname" => trim($hostname), "monthlycost" => trim($monthlycost), "noc" => $noc, "statusaddress" => trim($statusaddress), "nameserver1" => trim($nameserver1), "nameserver1ip" => trim($nameserver1ip), "nameserver2" => trim($nameserver2), "nameserver2ip" => trim($nameserver2ip), "nameserver3" => trim($nameserver3), "nameserver3ip" => trim($nameserver3ip), "nameserver4" => trim($nameserver4), "nameserver4ip" => trim($nameserver4ip), "nameserver5" => trim($nameserver5), "nameserver5ip" => trim($nameserver5ip), "maxaccounts" => trim($maxaccounts), "username" => trim($username), "password" => encrypt(trim($password)), "accesshash" => trim($accesshash), "secure" => $secure, "disabled" => $disabled, "active" => $active), array("id" => $id));
run_hook("ServerEdit", array("serverid" => $id));
redir("savesuccess=true");
} else {
$result = select_query("tblservers", "id", array("type" => $type, "active" => "1"));
$data = mysql_fetch_array($result);
$active = $data['id'] ? "" : "1";
$newid = insert_query("tblservers", array("name" => $name, "type" => $type, "ipaddress" => trim($ipaddress), "assignedips" => trim($assignedips), "hostname" => trim($hostname), "monthlycost" => trim($monthlycost), "noc" => $noc, "statusaddress" => trim($statusaddress), "nameserver1" => trim($nameserver1), "nameserver1ip" => trim($nameserver1ip), "nameserver2" => trim($nameserver2), "nameserver2ip" => trim($nameserver2ip), "nameserver3" => trim($nameserver3), "nameserver3ip" => trim($nameserver3ip), "nameserver4" => trim($nameserver4), "nameserver4ip" => trim($nameserver4ip), "nameserver5" => trim($nameserver5), "nameserver5ip" => trim($nameserver5ip), "maxaccounts" => trim($maxaccounts), "username" => trim($username), "password" => encrypt(trim($password)), "accesshash" => trim($accesshash), "secure" => $secure, "active" => $active, "disabled" => $disabled));
run_hook("ServerAdd", array("serverid" => $newid));
redir("createsuccess=true");
}
exit;
}
if ($action == "savegroup") {
check_token("WHMCS.admin.default");
if ($id) {
update_query("tblservergroups", array("name" => $name, "filltype" => $filltype), array("id" => $id));
delete_query("tblservergroupsrel", array("groupid" => $id));
} else {
$id = insert_query("tblservergroups", array("name" => $name, "filltype" => $filltype));
}
if ($selectedservers) {
foreach ($selectedservers as $serverid) {
insert_query("tblservergroupsrel", array("groupid" => $id, "serverid" => $serverid));
示例15: deleteContact
public function deleteContact($contactid)
{
delete_query("tblcontacts", array("userid" => $this->userid, "id" => $contactid));
update_query("tblclients", array("billingcid" => ""), array("billingcid" => $contactid, "id" => $this->userid));
run_hook("ContactDelete", array("userid" => $this->userid, "contactid" => $contactid));
return true;
}