Ejemplo n.º 1
0
 /**
  * Adds the hooks used by the Integrator to the WHMCS framework
  * @access		public
  * @version		1.0.0
  * 
  * @static
  * @since		1.0.0
  */
 public static function addHooks()
 {
     $hooks = array('ClientAreaPage' => 'tpl_override_clientarea');
     // Add the hooks to the WHMCS framework
     foreach ($hooks as $point => $fnxn) {
         add_hook($point, 30, $fnxn);
     }
 }
 /**
  * Intializes the plugin bundles in the kernel
  * 
  * @return void
  */
 public function initializePlugins()
 {
     foreach ($this->getBundles() as $bundle) {
         if (!$bundle instanceof PluginInterface) {
             continue;
         }
         foreach ($bundle->getHooks() as $hook) {
             add_hook($hook->getTag(), $hook->getCallback(), $hook->getPriority(), $hook->getAcceptedArgs());
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     /** @var EventDispatcher $dispatcher */
     $dispatcher = $this->app->make("dispatcher");
     /** @var ExceptionHandler $exception */
     $exception = $this->app->make("exception_handler");
     foreach ($this->getHooks() as $hook => $expectedResult) {
         add_hook($hook, 1, function ($vars) use($hook, $expectedResult, $dispatcher, $exception) {
             // We don't want to show errors to the customer so let's catch them and add log entries instead
             try {
                 $result = $dispatcher->dispatch($hook, new WHMCSEvent($vars));
                 if ($result instanceof WHMCSEvent) {
                     $result = $result->getResult();
                 }
                 // @TODO check if dispatcher has returned correct data type using $expectedResult
                 return $result;
             } catch (\Exception $e) {
                 $exception->handle($e);
             }
         });
     }
 }
Ejemplo n.º 4
0
/*
Plugin Name: Faker data
Plugin URI: https://github.com/atmoner
Description: This is a faker data 
Version: 1.0
Author: Atmoner
Author URI: https://github.com/atmoner
*/
//set plugin id as file name of plugin
$plugin_id = basename(__FILE__);
//some plugin data
$data['name'] = "Faker data";
$data['author'] = "Atmoner";
$data['url'] = "https://github.com/atmoner";
//register plugin data
register_plugin($plugin_id, $data);
//plugin function
function fakerdata()
{
    global $hook;
}
function addnewadminmenu_faker()
{
    global $hook;
    $hook->add_admin_menu('addmensssu', 'Faker data', 'admincp/fakerdata', 5);
}
add_hook('admin_action', 'addnewadminmenu_faker');
add_hook('new_admin_page', 'fakerdata');
add_hook('install', 'installSql');
Ejemplo n.º 5
0
    $data = mysql_fetch_array($result);
    $opennetworkissues = $data[0];
    $jquerycode = 'jQuery.post("index.php", { getsystemoverview: 1 },
    function(data){
        jQuery("#systemoverviewstats").html(data);
        jQuery("#systemoverviewstats").slideDown();
        jQuery("#sysoverviewbanner").html("<div style=\\"margin:0 0 -5px 0;padding: 10px;background-color: #FBEEEB;border: 1px dashed #cc0000;font-weight: bold;color: #cc0000;font-size:14px;text-align: center;-moz-border-radius: 10px;-webkit-border-radius: 10px;-o-border-radius: 10px;border-radius: 10px;\\">' . $_ADMINLANG['global']['attentionitems'] . ': &nbsp; <a href=\\"supporttickets.php\\">' . $ticketsawaitingreply . ' ' . $_ADMINLANG['stats']['ticketsawaitingreply'] . '</a> &nbsp;-&nbsp; <a href=\\"cancelrequests.php\\">' . $cancellationrequests . ' ' . $_ADMINLANG['stats']['pendingcancellations'] . '</a> &nbsp;-&nbsp; <a href=\\"todolist.php\\">' . $todoitemsdue . ' ' . $_ADMINLANG['stats']['todoitemsdue'] . '</a> &nbsp;-&nbsp; <a href=\\"networkissues.php\\">' . $opennetworkissues . ' ' . $_ADMINLANG['stats']['opennetworkissues'] . '</a></div>");
});';
    return array('title' => $title, 'content' => $content, 'jquerycode' => $jquerycode);
}
function widget_system_overview_home_banner()
{
    return '<div id="sysoverviewbanner"><div style="margin:0;padding: 10px;background-color: #FBEEEB;border: 1px dashed #cc0000;font-weight: bold;color: #cc0000;font-size:14px;text-align: center;"><img src="images/loading.gif" /></div></div>';
}
add_hook("AdminHomeWidgets", 1, "widget_system_overview");
add_hook("AdminHomepage", 1, "widget_system_overview_home_banner");
/*
#systemoverviewstats div {
    float: left;
    margin: 3px;
    padding: 5px;
    width: 30%;
    line-height: 24px;
    min-width: 250px;
    border: 1px solid #d9d9d9;
    background-color: #f2f2f2;
    -moz-border-radius: 4px;
    -webkit-border-radius: 4px;
    -o-border-radius: 4px;
    border-radius: 4px;
    overflow: hidden;
Ejemplo n.º 6
0
<?php

if (!defined("WHMCS")) {
    die("This file cannot be accessed directly");
}
function widget_getting_started($vars)
{
    $title = "Getting Started with WHMCS";
    $content = '
<span style="font-weight:bold;font-size:14px;color:#29467C;">Welcome to WHMCS - The Complete Client Management, Billing & Support Solution!</span><br />
Here\'s our handy tips for getting up & running if this is your first time using WHMCS...<br />
<blockquote>
<b>Step 1:</b> Review & Configure <a href="configgeneral.php">General System Settings</a> including Company Name, URL, etc...<br />
<b>Step 2:</b> Activate & Configure <a href="configgateways.php">Payment Methods</a> you want to accept<br />
<b>Step 3:</b> Setup at least 1 <a href="configproducts.php">Product Group</a> & <a href="configproducts.php">Product/Service</a> in your system (<a href="http://docs.whmcs.com/Setting_Up_Your_First_Product">More Help</a>)<br />
</blockquote>
For more information please refer to our documentation @ <a href="http://docs.whmcs.com/" target="_blank">http://docs.whmcs.com/</a> for lots of useful information.
<div align="right" style="padding-top:5px;"><input type="submit" value="Dismiss Getting Started Guide" onclick="dismissgs()" /></div>
    ';
    $jscode = 'function dismissgs() {
    $("#getting_started").fadeOut();
    $.post("index.php", { dismissgs: 1 });
}';
    return array('title' => $title, 'content' => $content, 'jscode' => $jscode);
}
add_hook("AdminHomeWidgets", 1, "widget_getting_started");
Ejemplo n.º 7
0
 * To avoid naming collisions, it is imperative that all plugins incorporate a PHP class structure. 
 * Here is some example code that will allow you to set up a class structure.
 */
$plugin_id = basename(__FILE__);
$data['name'] = "Second plugin";
$data['author'] = "Eric Wang";
$data['url'] = "http://www.ericbess.com/";
//register plugin data
register_plugin($plugin_id, $data);
class plugin2
{
    function plg2()
    {
        echo 'Plugin2 hooks into TEST, priority = 2<br />';
    }
    function njeh()
    {
        echo "Plugin2 hooks into TEST1<br />";
    }
    function filter1($urls)
    {
        $return[] = "http://www.{$urls['0']}.com";
        $return[] = "http://www.{$urls['1']}.com";
        return $return;
    }
}
$plg2 = new plugin2();
add_hook('filter', array(&$plg2, 'filter1'), 2);
add_hook('test', array(&$plg2, 'plg2'), 2);
add_hook('test1', array(&$plg2, 'njeh'));
echo "<p>Plugin 2 LOADED!</p>";
    $string = str_replace("р", "r", $string);
    $string = str_replace("Р", "R", $string);
    $string = str_replace("с", "s", $string);
    $string = str_replace("С", "S", $string);
    $string = str_replace("т", "t", $string);
    $string = str_replace("Т", "T", $string);
    $string = str_replace("у", "u", $string);
    $string = str_replace("У", "U", $string);
    $string = str_replace("ф", "f", $string);
    $string = str_replace("Ф", "F", $string);
    $string = str_replace("х", "h", $string);
    $string = str_replace("Х", "H", $string);
    $string = str_replace("ц", "c", $string);
    $string = str_replace("Ц", "C", $string);
    $string = str_replace("ч", "ch", $string);
    $string = str_replace("Ч", "Ch", $string);
    $string = str_replace("ш", "sh", $string);
    $string = str_replace("Ш", "Sh", $string);
    $string = str_replace("щ", "sht", $string);
    $string = str_replace("Щ", "Sht", $string);
    $string = str_replace("ъ", "a", $string);
    $string = str_replace("Ъ", "A", $string);
    $string = str_replace("ь", "j", $string);
    $string = str_replace("ю", "yu", $string);
    $string = str_replace("Ю", "Yu", $string);
    $string = str_replace("я", "ya", $string);
    $string = str_replace("Я", "Ya", $string);
    return $string;
}
add_hook("Transliteration", 1, "hook_transliterate");
Ejemplo n.º 9
0
            $packageId = $package['PackageId'];
            // Get the associated WebsitePanel addon id
            $results = select_query('mod_wspaddons', 'wsp_id,is_ipaddress', array('whmcs_id' => $addonId));
            $addon = mysql_fetch_array($results);
            $addonPlanId = $addon['wsp_id'];
            $addonIsIpAddress = $addon['is_ipaddress'];
            // Add the Addon Plan to the customer's WebsitePanel package / hosting space
            $results = $wsp->addPackageAddonById($packageId, $addonPlanId);
            // Check the results to verify that the addon has been successfully allocated
            if ($results['Result'] > 0) {
                // If this addon is an IP address addon - attempt to randomly allocate an IP address to the customer's hosting space
                if ($addonIsIpAddress) {
                    $wsp->allocatePackageIPAddresses($packageId);
                }
                // Add log entry to client log
                logactivity("WebsitePanel Addon - Account {$username} addon successfully completed - Addon ID: {$addonId}", $userId);
            } else {
                // Add log entry to client log
                throw new Exception("Unknown", $results['Result']);
            }
        } catch (Exception $e) {
            // Error message to log / return
            $errorMessage = "websitepanel_addons_AddonActivation Fault: (Code: {$e->getCode()}, Message: {$e->getMessage()}, Service ID: {$serviceId})";
            // Log to WHMCS
            logactivity($errorMessage, $userId);
        }
    }
}
/* Addon Activation - WebsitePanel */
add_hook('AddonActivation', 1, 'websitepanel_addons_AddonActivation');
Ejemplo n.º 10
0
<?php

/* Hook to remove "Featured Advertiser" entries in WaPo.
 */
function wapo_ads($nodename, &$retval, &$context)
{
    # If the title is "Featured Advertiser", mark it as read.
    if (isset($retval['title']) && $retval['title'] == "Featured Advertiser") {
        $retval['is_read'] = true;
    }
    # Mark sports articles as read.
    if (isset($retval['wp:web-link']) && preg_match(',^http://www.washingtonpost.com/sports/,', $retval['wp:web-link'])) {
        $retval['is_read'] = true;
    }
    return true;
}
add_hook("item", "wapo_ads");
# Register hook
Ejemplo n.º 11
0
<?php

/*
	Affiliate Coupons 1.2 - WHMCS Module
	Written by: Frank Laszlo <*****@*****.**>
*/
function verify_affiliate_coupon($vars)
{
    if (isset($_SESSION['cart']['promo'])) {
        $promocode = $_SESSION['cart']['promo'];
        $data = select_query('tblpromotions', 'id', array("code" => "{$promocode}"));
        if (mysql_num_rows($data)) {
            $row = mysql_fetch_array($data);
            $couponid = $row[0];
            $pdata = select_query('tblaffcoupons', 'aff_id', array("coupon" => $couponid));
            if (mysql_num_rows($pdata)) {
                $prow = mysql_fetch_array($pdata);
                $affid = $prow[0];
                $_COOKIE['WHMCSAffiliateID'] = $affid;
            }
        }
    }
}
add_hook("PreShoppingCartCheckout", 1, "verify_affiliate_coupon", "");
Ejemplo n.º 12
0
<?php

/* webbug_hook
 * Remove web bugs: images with width=1 and height=1 or less.
 */
function webbug_hook($nodename, &$retval, &$context)
{
    if (!is_string($retval)) {
        return;
    }
    $retval = preg_replace('{<img(\\s+\\w+=\\"[^\\"]*\\")* (height="[01]" width="[01]"|width="[01]" height="[01]")(\\s+\\w+=\\"[^\\"]*\\")*\\s*/>\\r?\\n?}', '', $retval);
    # Same thing, but with single quotes instead of double
    $retval = preg_replace('{<img(\\s+\\w+=\'[^\']*\')* (height=\'[01]\' width=\'[01]\'|width=\'[01]\' height=\'[01]\').*?/>\\r?\\n?}', '', $retval);
}
add_hook("summary", "webbug_hook");
add_hook("body", "webbug_hook");
<?php

if (!defined('WHMCS')) {
    die('This file cannot be accessed directly');
}
/**
 * This file is part of the whmcs-registrars-coza library.
 *
 * (c) Gunter Grodotzki <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE file
 * that was distributed with this source code.
 */
add_hook('AdminHomeWidgets', 1, 'widget_coza_balance');
function widget_coza_balance($vars)
{
    require_once ROOTDIR . '/includes/registrarfunctions.php';
    require_once ROOTDIR . '/includes/classes/AfriCC/autoload.php';
    require_once ROOTDIR . '/modules/registrars/coza/Factory.php';
    $params = getRegistrarConfigOptions('coza');
    $title = 'CO.ZA Balance';
    $content = '<p align ="center" class="textblack"><strong>%s</strong></p>';
    $epp_client = \COZA\Factory::build($params);
    try {
        $epp_client->connect();
        $frame = new \AfriCC\EPP\Extension\COZA\Info\CozaContact();
        $frame->setId(!empty($params['OTE']) && $params['OTE'] === 'on' ? $params['TestUsername'] : $params['Username']);
        $frame->requestBalance();
        $response = $epp_client->request($frame);
        if (!$response instanceof \AfriCC\EPP\Frame\Response) {
            unset($epp_client);
Ejemplo n.º 14
0
            $_COOKIE['piv_name'] = $reg_user['name'];
            $_COOKIE['piv_url'] = $reg_user['url'];
        }
    }
    if (count($_COOKIE) > 0) {
        $cookie = @fill_comment_form($_COOKIE['piv_name'], $_COOKIE['piv_email'], $_COOKIE['piv_url'], $_COOKIE['piv_rememberinfo'], $_COOKIE['piv_comment']);
        $cookie = i18n_str_to_utf8($cookie);
        $output = str_replace("</body>", $cookie . "</body>", $output);
    }
    add_hook("display_entry", "post");
    execute_hook("display_entry", "post", $db->entry, $output, $dummy_variable);
    echo $output;
} else {
    if (isset($Pivot_Vars['f_title'])) {
        // This shows the entry in preview mode.
        define('PREVIEW', TRUE);
        $db = new db();
        $entry = get_entry_from_post();
        $entry['status'] = 'publish';
        $entry = $db->set_entry($entry);
        execute_hook("display_entry", "pre");
        $output = parse_entry($entry['code'], "");
        add_hook("display_entry", "post");
        execute_hook("display_entry", "post", $output);
        echo $output;
    } else {
        add_hook("display_entry", "post");
        execute_hook("display_entry", "post", $output);
        echo $output;
    }
}
Ejemplo n.º 15
0
    if ($CONFIG['TaxType'] == "Inclusive") {
        $subtotal = $subtotal - $tax - $tax2;
    } else {
        $total = $subtotal + $tax + $tax2;
    }
    if (0 < $credit) {
        if ($total < $credit) {
            $total = 0;
            $remainingcredit = $total - $credit;
        } else {
            $total -= $credit;
        }
    }
    $subtotal = format_as_currency($subtotal);
    $tax = format_as_currency($tax);
    $total = format_as_currency($total);
    return $total;
}
function getGatewayName2($modulename)
{
    $result = select_query("tblpaymentgateways", "value", array("gateway" => $modulename, "setting" => "name"));
    $data = mysql_fetch_array($result);
    return $data["value"];
}
add_hook("InvoiceChangeGateway", 1, "update_gateway_fee2");
add_hook("InvoiceCreated", 1, "update_gateway_fee1");
add_hook("AdminInvoicesControlsOutput", 2, "update_gateway_fee3");
add_hook("AdminInvoicesControlsOutput", 1, "update_gateway_fee1");
add_hook("InvoiceCreationAdminArea", 1, "update_gateway_fee1");
add_hook("InvoiceCreationAdminArea", 2, "update_gateway_fee3");
Ejemplo n.º 16
0
<?php

if (!defined('EXEC_TIME')) {
    die('Access restricted');
}
add_hook('index/invoke_module', '*help_invoke');
function help_invoke()
{
    list($action) = GET('action');
    if ($action == 'about') {
        help_invoke_about();
    } elseif ($action == 'code') {
        echo exec_tpl('help/cutecode');
    } else {
        help_invoke_main();
    }
}
// Since 2.0
function help_invoke_about()
{
    global $reg_site_key;
    // Try license key
    if (file_exists(SERVDIR . "/cdata/reg.php")) {
        include SERVDIR . "/cdata/reg.php";
    }
    $registered = file_exists(SERVDIR . '/cdata/reg.php');
    // ---
    cn_assign('registered, reg_site_key', $registered, $reg_site_key);
    echoheader('', 'Help/About Cutenews');
    echo exec_tpl('help/about');
    echofooter();
Ejemplo n.º 17
0
/*
Plugin Name: Captcha
Description: Prevents bots.. duh :P
Version: 1.0
Author: Nijiko
Author URI: http://ninkobb.com
*/
/**
 * Add hook to check the session
 */
add_hook('registration_form', 'insert_captcha', array());
/**
 * Add hook to check the session
 */
add_hook('registration_check', 'check_captcha', array());
/**
 * Installs captcha no sql needed!
 */
function install_captcha()
{
}
/**
 * Uninstalls captcha.. no sql needed!
 */
function uninstall_captcha()
{
}
/**
 * Creates the captcha and saves it in captcha/
 * @global array
Ejemplo n.º 18
0
 *
 * @param Item $basePanel collection of homepage panels
 */
function populateLoadAverageInHomepagePanels(Item $basePanel)
{
    $servicesPanel = $basePanel->getChild('Active Products/Services');
    // If this is not populated at all we need to skip adding items.
    if (is_null($servicesPanel)) {
        return;
    }
    foreach ($servicesPanel->getChildren() as $serviceLink) {
        parse_str(parse_url($serviceLink->getUri(), PHP_URL_QUERY));
        /** @var int $id Created by parse_str() */
        /** @var Service $service */
        // See http://docs.whmcs.com/classes/classes/WHMCS.Service.Service.html for details on this model
        $service = Service::findOrFail($id);
        $loadAverage = getLoadAverageFromService($service);
        if ($loadAverage) {
            $label = $serviceLink->getLabel();
            $label .= "<br>Load average - One: {$loadAverage->one} ";
            $label .= "Five: {$loadAverage->five} ";
            $label .= "Fifteen: {$loadAverage->fifteen}";
            $serviceLink->setLabel($label);
        }
    }
}
// This registers our hooks to the relevant hook points
add_hook('ClientAreaProductDetailsPreModuleTemplate', 1, 'populateLoadAverageInProductDetailsPage');
add_hook('ClientAreaProductDetailsOutput', 1, 'populateLoadAverageInProductDetailsOutput');
add_hook('ClientAreaHomepagePanels', 1, 'populateLoadAverageInHomepagePanels');
Ejemplo n.º 19
0
<?php

function addFRbutton($vars)
{
    $uid = $vars['userid'];
    $result = select_query("tblclients", "", array("id" => $uid));
    $data = mysql_fetch_array($result);
    $lname = $data['lastname'];
    echo '<div style="float:right;"><form action="./addonmodules.php?module=fraudrecord&page=\'1\'" method="post"><input type="hidden" name="search_frc_text" value="' . $lname . '"><input type="submit" name="search_frc_button" value="Search FraudRecord Module" style="margin-left:10px;"/></form></div>';
}
add_hook("AdminAreaClientSummaryPage", 1, "addFRbutton");
Ejemplo n.º 20
0
}
function widget_whmcs_news($vars)
{
    global $whmcs, $_ADMINLANG;
    $title = $_ADMINLANG['home']['whmcsnewsfeed'];
    if ($whmcs->get_req_var('getwhmcsnews')) {
        if (!function_exists("ticketAutoHyperlinks")) {
            require ROOTDIR . '/includes/ticketfunctions.php';
        }
        $feed = curlCall('http://www.whmcs.com/feeds/news.php', '');
        $feed = json_decode($feed, 1);
        echo '<div style="float:right;margin:15px 15px 10px 10px;padding:8px 20px;text-align:center;background-color:#FDF8E1;border:1px dashed #FADA5A;-moz-border-radius: 5px;-webkit-border-radius: 5px;-o-border-radius: 5px;border-radius: 5px;">Follow Us<br /><a href="http://twitter.com/whmcs" target="_blank" style="font-size:16px;color:#D9AE06;">@whmcs</a></div>';
        $i = 0;
        foreach ($feed as $news) {
            echo '<div style="padding-top:5px;font-size:14px;' . ($i == 0 ? 'border-top:1px dashed #ccc;' : '') . '">' . ($news['link'] ? '<a href="' . $news['link'] . '" target="_blank">' : '') . $news['headline'] . ($news['link'] ? '</a>' : '') . '</div>
<div style="padding:5px;">' . $news['text'] . '</div>
<div style="font-size:10px;font-weight:bold;padding-bottom:5px;border-bottom:1px dashed #ccc;">' . date("l, F jS, Y", strtotime($news['date'])) . '</div>
';
            $i++;
        }
        exit;
    }
    $content = '<div id="whmcsnewsfeed" style="max-height:130px;">' . $vars['loading'] . '</div>';
    $jquerycode = '$.post("index.php", { getwhmcsnews: 1 },
    function(data){
        jQuery("#whmcsnewsfeed").html(data);
    });';
    return array('title' => $title, 'content' => $content, 'jquerycode' => $jquerycode);
}
add_hook("AdminHomeWidgets", 1, "widget_whmcs_news");
Ejemplo n.º 21
0
/*
Plugin Name: Faker data
Plugin URI: https://github.com/atmoner
Description: This is a faker data 
Version: 1.0
Author: Atmoner
Author URI: https://github.com/atmoner
*/
//set plugin id as file name of plugin
$plugin_id = basename(__FILE__);
//some plugin data
$data['name'] = "Faker data";
$data['author'] = "Atmoner";
$data['url'] = "https://github.com/atmoner";
//register plugin data
register_plugin($plugin_id, $data);
//plugin function
function fakerdata()
{
    global $hook;
    $hook->add_admin_page('fakerdata', 'plugins/fakerdata/php/admin/fakerdata.php', 'plugins/fakerdata/html/admin/fakerdata.html');
}
function addnewadminmenu_faker()
{
    global $hook;
    $hook->add_admin_menu('addmensssu', 'Faker data', 'admincp/fakerdata', 5);
}
add_hook('admin_action', 'addnewadminmenu_faker');
add_hook('new_admin_page', 'fakerdata');
Ejemplo n.º 22
0
        chart.draw(data, options);
      }
      google.setOnLoadCallback(drawTicketChart2);
      function drawTicketChart2() {
        var data = new google.visualization.DataTable();
        data.addColumn('string', 'Status');
        data.addColumn('number', 'Ticket Count');
        data.addRows([
          {$chartdata2}
        ]);

        var options = {
          chartArea: {left:0,top:20,width:"100%",height:"160"},
          title: 'Awaiting Reply by Status'
        };

        var chart = new google.visualization.PieChart(document.getElementById('ticketsoverview2'));
        chart.draw(data, options);
      }

    </script>

    <div id="ticketsoverview1" style="float:left;width: 50%; height: 200px;"></div>
    <div id="ticketsoverview2" style="float:right;width: 50%; height: 200px;"></div>

EOF;
    }
    return array('title' => $title, 'content' => $content);
}
add_hook("AdminHomeWidgets", 1, "widget_supporttickets_overview");
Ejemplo n.º 23
0
<?php

if (!defined("WHMCS")) {
    die("This file cannot be accessed directly");
}
function widget_admin_activity($vars)
{
    global $_ADMINLANG;
    $title = $_ADMINLANG['home']['recentadminactivity'];
    $content = '<table width="75%" bgcolor="#cccccc" cellspacing="1" align="center">
<tr bgcolor="#efefef" style="text-align:center;font-weight:bold;"><td>' . $_ADMINLANG['fields']['admin'] . '</td><td>' . $_ADMINLANG['fields']['ipaddress'] . '</td><td>' . $_ADMINLANG['system']['lastaccess'] . '</td></tr>';
    $result = select_query("tbladminlog", "", "", "lastvisit", "DESC", "0,5");
    while ($data = mysql_fetch_array($result)) {
        $content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td>' . $data["adminusername"] . '</a></td><td><a href="http://www.geoiptool.com/en/?IP=' . $data["ipaddress"] . '" target="_blank">' . $data["ipaddress"] . '</a></td><td>' . fromMySQLDate($data["lastvisit"], true) . '</td></tr>';
    }
    $content .= '</table>';
    return array('title' => $title, 'content' => $content);
}
add_hook("AdminHomeWidgets", 1, "widget_admin_activity");
Ejemplo n.º 24
0
<?php

if (!defined("WHMCS")) {
    die("This file cannot be accessed directly");
}
include_once dirname(__FILE__) . '/inc/oms_utils.php';
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);
}
add_hook("ClientChangePassword", 1, "modify_oms_passwd");
Ejemplo n.º 25
0
    $ret = $op->upgradeServer($params['server_id'], $post);
    return 'success';
}
add_hook("AfterConfigOptionsUpgrade", 1, 'hook_oneportalcloud_ChangePackage');
function hook_oneportalcloud_ChangePassword($params)
{
    if (isset($_POST['ac'])) {
        return 'success';
    }
    $params = $params['params'];
    if ($params['moduletype'] != 'oneportalcloud') {
        return 'success';
    }
    $op = new OnePortalCloud($params['configoption1'], $params['configoption2'], $params['configoption3']);
    $server_id = $params['customfields']['Server ID'];
    if (empty($server_id)) {
        return 'Unable to determine Server ID to suspend';
    }
    if (substr(strtoupper($server_id), 0, 3) != 'LSN') {
        $server_id = 'LSN-' . $server_id;
    }
    $ret = $op->changePassword($server_id, $params['password']);
    if (!$ret->error) {
        $res = 'success';
    } else {
        $res = $ret->error;
    }
    return $res;
}
add_hook("AfterModuleChangePassword", 1, 'hook_oneportalcloud_ChangePassword');
Ejemplo n.º 26
0
    $title = $_ADMINLANG['utilities']['activitylog'];
    $content = '';
    $patterns = $replacements = array();
    $patterns[] = '/User ID: (.*?) /';
    $patterns[] = '/Service ID: (.*?) /';
    $patterns[] = '/Domain ID: (.*?) /';
    $patterns[] = '/Invoice ID: (.*?) /';
    $patterns[] = '/Order ID: (.*?) /';
    $patterns[] = '/Transaction ID: (.*?) /';
    $replacements[] = '<a href="clientssummary.php?userid=$1">User ID: $1</a> ';
    $replacements[] = '<a href="clientshosting.php?id=$1">Service ID: $1</a> ';
    $replacements[] = '<a href="clientsdomains.php?id=$1">Domain ID: $1</a> ';
    $replacements[] = '<a href="invoices.php?action=edit&id=$1">Invoice ID: $1</a> ';
    $replacements[] = '<a href="orders.php?action=view&id=$1">Order ID: $1</a> ';
    $replacements[] = '<a href="transactions.php?action=edit&id=$1">Transaction ID: $1</a> ';
    $result = select_query("tblactivitylog", "", "", "id", "DESC", "0,10");
    while ($data = mysql_fetch_array($result)) {
        $description = $data["description"] . ' ';
        $description = whmcsHtmlspecialchars($description);
        $description = preg_replace($patterns, $replacements, $description);
        $content .= $description . '<br /><span style="font-size:11px;">&nbsp; - ' . fromMySQLDate($data["date"], true) . ' - ' . $data['user'] . ' - ' . $data['ipaddr'] . '</span><br />';
    }
    if (!$content) {
        $content = '<div align="center">No Activity Recorded Yet</div>';
    } else {
        $content .= '<div align="right"><a href="systemactivitylog.php">' . $_ADMINLANG['home']['viewall'] . ' &raquo;</a></div>';
    }
    return array('title' => $title, 'content' => $content);
}
add_hook("AdminHomeWidgets", 1, "widget_activity_log");
Ejemplo n.º 27
0
            Capsule::table('tblproducts')->where('id', $vars['pid'])->update(['configoption2' => $_POST[$moduleName]['BillingType'], 'configoption3' => $_POST[$moduleName]['SuspendDays'], 'configoption5' => $_POST[$moduleName]['DueDays'], 'configoption6' => $_POST[$moduleName]['TerminateDays'], 'configoption7' => $_POST[$moduleName]['OrganizationType'], 'configoption24' => json_encode($settings)]);
        }
        # reset server cache
        if (!empty($_POST[$moduleName . '_ResetServerCache'])) {
            try {
                Capsule::table($moduleName . '_Cache')->where('type', 'serverData')->where('itemID', $serverID)->delete();
            } catch (\Exception $e) {
                logactivity('SQL ERROR: ' . $e->getMessage());
            }
        }
        # create custom field
        if ($_POST[$moduleName]['OrganizationType'] == 2) {
            $exist = Capsule::table('tblcustomfields')->where('type', 'product')->where('fieldname', 'Organization Name')->where('relid', $vars['pid'])->first();
            if (!$exist) {
                Capsule::table('tblcustomfields')->insert(['type' => 'product', 'fieldtype' => 'text', 'required' => 'on', 'showorder' => 'on', 'fieldname' => 'Organization Name', 'relid' => $vars['pid']]);
            }
        }
    }
    return true;
}
function ServiceDeleteHook_OnAppvCD($vars)
{
    Capsule::table(OnAppvCDModule::MODULE_NAME . '_Users')->where('WHMCSUserID', $vars['userid'])->where('serviceID', $vars['serviceid'])->delete();
}
add_hook('InvoicePaid', 1, 'InvoicePaidHook_OnAppvCD');
add_hook('ProductEdit', 1, 'ProductEditHook_OnAppvCD');
add_hook('ServiceDelete', 1, 'ServiceDeleteHook_OnAppvCD');
add_hook('DailyCronJob', 1, 'AutoSuspendHook_OnAppvCD');
add_hook('DailyCronJob', 2, 'AutoTerminateHook_OnAppvCD');
add_hook('DailyCronJob', 3, 'TerminateTrialHook_OnAppvCD');
Ejemplo n.º 28
0
<?php

if (!defined("WHMCS")) {
    die("This file cannot be accessed directly");
}
function widget_my_notes($vars)
{
    $title = "My Notes";
    $mynotes = get_query_val("tbladmins", "notes", array("id" => $vars['adminid']));
    $content = '
<script>
function widgetnotessave() {
    $.post("index.php", { action: "savenotes", notes: $("#widgetnotesbox").val(), token: "' . generate_token('plain') . '" });
    $("#widgetnotesconfirm").slideDown().delay(2000).slideUp();
}
</script>
<div align="center">
<div id="widgetnotesconfirm" style="display:none;margin:0 0 5px 0;padding:5px 20px;background-color:#DBF3BA;font-weight:bold;color:#6A942C;">Notes Saved Successfully!</div>
<textarea id="widgetnotesbox" style="width:95%;height:100px;">' . $mynotes . '</textarea>
<input type="button" value="Save Notes" onclick="widgetnotessave()" />
</div>
    ';
    return array('title' => $title, 'content' => $content);
}
add_hook("AdminHomeWidgets", 1, "widget_my_notes");
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Formatting Phone Number
 *
 * @package    Infinys
 * @copyright  Copyright (c) PT Infinys System Indonesia 2015
 */
if (!defined("WHMCS")) {
    die("This file cannot be accessed directly");
}
function formatphonefordomainku($vars)
{
    $domain = $vars['domain'];
    $result = select_query("tbldomains", "registrar", array("domain" => $domain));
    $data = mysql_fetch_array($result);
    $registrar = $data['registrar'];
    if ($registrar == "domainku") {
        global $params;
        $phonenumber = $params['phonenumber'];
        $phonecc = $params['phonecc'];
        $params['phonenumber'] = '+' . $phonecc . '.' . ltrim($phonenumber, '0');
        $adminphonenumber = $params['adminphonenumber'];
        if ($adminphonenumber) {
            $params['adminphonenumber'] = '+' . $phonecc . '.' . ltrim($adminphonenumber, '0');
        }
    }
}
add_hook("PreDomainRegister", 10, "formatphonefordomainku");
Ejemplo n.º 30
-1
function hook_clientarea_tickets()
{
    $moduleDetails = FetchSupportModule();
    if ($moduleDetails['value'] == 'kayako') {
        add_hook('ClientAreaPage', 1, 'hook_clientarea_details');
    }
}