function whmcsreseller_CreateAccount($params)
{
    $clientid = $params['clientsdetails']['userid'];
    $serviceid = $params['serviceid'];
    $pid = $params['pid'];
    switch ($params['configoption1']) {
        case "Branding":
            $lic_type = "branding";
            break;
        case "No Branding":
            $lic_type = "nobranding";
            break;
    }
    $query = "SELECT id, license FROM whmcsresellerlicenses WHERE user_id IS NULL AND type='{$lic_type}' LIMIT 1";
    $data = full_query($query);
    if (!mysql_num_rows($data)) {
        return "No licenses available to assign";
    }
    $r = mysql_fetch_array($data);
    $lic_id = $r[0];
    $lic_str = $r[1];
    $res = select_query("tblcustomfields", "*", array("relid" => $pid, "fieldname" => "License"));
    if (!mysql_num_rows($res)) {
        return "License field not created for product";
    } else {
        $row = mysql_fetch_assoc($res);
        $customfield = $row['id'];
    }
    update_query("whmcsresellerlicenses", array("user_id" => $clientid, "prod_id" => $serviceid), "id='{$lic_id}'");
    full_query("UPDATE tblcustomfieldsvalues SET value='{$lic_str}' WHERE fieldid='{$customfield}' AND relid='{$serviceid}'");
    return "success";
}
Beispiel #2
0
/**
 *
 * @ WHMCS FULL DECODED & NULLED
 *
 * @ Version  : 5.2.15
 * @ Author   : MTIMER
 * @ Release on : 2013-12-24
 * @ Website  : http://www.mtimer.cn
 *
 **/
function vpsnet_ConfigOptions()
{
    if (!mysql_num_rows(full_query("SHOW TABLES LIKE 'mod_vpsnet'"))) {
        $query = "CREATE TABLE `mod_vpsnet` (`relid` INTEGER UNSIGNED NOT NULL,`setting` VARCHAR(45) NOT NULL,`value` VARCHAR(45) NOT NULL,PRIMARY KEY (`relid`,`setting`));";
        full_query($query);
    }
    $creds = vpsnet_GetCredentials();
    if (!$creds['id']) {
        return array("Error" => array("Type" => "x", "Description" => "No VPS.Net Server Config found in Setup > Servers"));
    }
    $verifyauth = vpsnet_call($params, "", "", "GET", "profile");
    if ($verifyauth['success'] != "1") {
        foreach ($verifyauth['errors'] as $errormsg) {
            $verifyautherror .= $errormsg;
        }
        if ($verifyautherror) {
            return array("Error" => array("Type" => "x", "Description" => $verifyautherror));
        }
        return array("Error" => array("Type" => "FailedAuth", "Description" => "Unable to authenticate with Username and Access Hash. Please check Server Config found in Setup > Servers"));
    }
    $resources = vpsnet_call($params, $action, $id, $reqtype = "", $type = "available_clouds");
    $cloudtemplate = ",";
    foreach ($resources['response'] as $resource) {
        $cloudid = $resource['cloud']['id'];
        $cloudlabel = $resource['cloud']['label'];
        foreach ($resource['cloud']['system_templates'] as $system_template) {
            $templateid = $system_template['id'];
            $templatelabel = $system_template['label'];
            $cloudtemplate .= "" . $cloudid . "+" . $templateid . "|" . $cloudlabel . ":" . $templatelabel . ",";
        }
    }
    $cloudtemplate = substr($cloudtemplate, 0, 0 - 1);
    $configarray = array("Number of Nodes" => array("Type" => "text", "Size" => "5"), "Cloud/Template" => array("Type" => "dropdown", "Options" => $cloudtemplate), "Enable Backups" => array("Type" => "yesno", "Description" => "Tick to enable backups"), "Rsync Backups" => array("Type" => "yesno", "Description" => "Tick to enable"), "R1Soft Backups" => array("Type" => "yesno", "Description" => "Tick to enable"), "" => array("Type" => "x", "Description" => ""));
    return $configarray;
}
Beispiel #3
0
/**
 *
 * @ WHMCS FULL DECODED & NULLED
 *
 * @ Version  : 5.2.15
 * @ Author   : MTIMER
 * @ Release on : 2013-12-24
 * @ Website  : http://www.mtimer.cn
 *
 * */
function onlinenic_getConfigArray()
{
    $query = "CREATE TABLE IF NOT EXISTS `mod_onlinenic` (`id` int(10) NOT NULL auto_increment,`domain` VARCHAR(255) NOT NULL,`lockstatus` BOOL NOT NULL DEFAULT '0',PRIMARY KEY  (`id`),KEY `domainid` (`domain`))";
    $result = full_query($query);
    $configarray = array("FriendlyName" => array("Type" => "System", "Value" => "OnlineNIC"), "Username" => array("Type" => "text", "Size" => "20", "Description" => "Onlinenic ID"), "Password" => array("Type" => "password", "Size" => "20", "Description" => "Password"), "TestMode" => array("Type" => "yesno"), "SyncNextDueDate" => array("Type" => "yesno", "Description", "Tick this box if you want the expiry date sync script to update the expiry and next due dates (cron must be configured)"));
    return $configarray;
}
Beispiel #4
0
 public function getAvailableGateways($invoiceid = "")
 {
     $validgateways = array();
     $result = full_query("SELECT DISTINCT gateway, (SELECT value FROM tblpaymentgateways g2 WHERE g1.gateway=g2.gateway AND setting='name' LIMIT 1) AS `name`, (SELECT `order` FROM tblpaymentgateways g2 WHERE g1.gateway=g2.gateway AND setting='name' LIMIT 1) AS `order` FROM `tblpaymentgateways` g1 WHERE setting='visible' AND value='on' ORDER BY `order` ASC");
     while ($data = mysql_fetch_array($result)) {
         $validgateways[$data[0]] = $data[1];
     }
     if ($invoiceid) {
         $disabledgateways = array();
         $result = select_query("tblinvoiceitems", "", array("type" => "Hosting", "invoiceid" => $invoiceid));
         while ($data = mysql_fetch_assoc($result)) {
             $relid = $data['relid'];
             if ($relid) {
                 $result2 = full_query("SELECT pg.disabledgateways AS disabled FROM tblhosting h LEFT JOIN tblproducts p on h.packageid = p.id LEFT JOIN tblproductgroups pg on p.gid = pg.id where h.id = " . (int) $relid);
                 $data2 = mysql_fetch_assoc($result2);
                 $gateways = explode(",", $data2['disabled']);
                 foreach ($gateways as $gateway) {
                     if (array_key_exists($gateway, $validgateways)) {
                         unset($validgateways[$gateway]);
                         continue;
                     }
                 }
             }
         }
     }
     return $validgateways;
 }
 public function getClients($criteria = array())
 {
     $filters = $this->buildCriteria($criteria);
     $where = count($filters) ? " WHERE " . implode(" AND ", $filters) : "";
     $result = full_query("SELECT COUNT(*) FROM tbldomains t " . $where);
     $data = mysql_fetch_array($result);
     $this->getPageObj()->setNumResults($data[0]);
     $clients = array();
     $query = "\n\t\t\tSELECT \tt.*, i.subtotal, i.tax, i.status, o.nameservers, o.transfersecret,\n    \t\t\tm.domain AS coza_domain, m.id_doc_storage_name, m.id_doc_type, m.le_doc_storage_name, \n    \t\t\tm.le_doc_type, m.su_doc_storage_name, m.su_doc_type, m.domain_approval_date, m.domain_status\n    \t\tFROM tbldomains t \n    \t\tLEFT JOIN mod_domaincloudregistrar m ON t.domain = m.domain \n    \t\tLEFT JOIN tblorders o ON t.orderid = o.id\n            LEFT JOIN tblinvoices i ON o.invoiceid = i.id" . $where . " ORDER BY " . $this->getPageObj()->getOrderBy() . " " . $this->getPageObj()->getSortDirection() . " LIMIT " . $this->getQueryLimit();
     $result = full_query($query);
     while ($data = mysql_fetch_array($result)) {
         $id = $data['id'];
         $userid = $data['userid'];
         $domain = $data['domain'];
         $id_doc_storage_name = $data['id_doc_storage_name'];
         $le_doc_storage_name = $data['le_doc_storage_name'];
         $su_doc_storage_name = $data['su_doc_storage_name'];
         $registrationdate = $data['registrationdate'];
         $domain_approval_date = $data['domain_approval_date'];
         $status = $data['status'];
         $domain_status = $data['domain_status'];
         $clients[] = array("id" => $id, "userid" => $userid, "domain" => $domain, "id_doc_storage_name" => $id_doc_storage_name, "le_doc_storage_name" => $le_doc_storage_name, "su_doc_storage_name" => $su_doc_storage_name, "registrationdate" => $registrationdate, "domain_approval_date" => $domain_approval_date, "domain_status" => $domain_status, "status" => $status);
     }
     return $clients;
 }
function purchaseorder_get_custom_fields()
{
    $options = '';
    $request = full_query("SELECT GROUP_CONCAT(fieldname) FROM tblcustomfields where type='client' GROUP BY type");
    $values = mysql_fetch_array($request);
    return $values[0];
}
Beispiel #7
0
 public function getClients($criteria = array())
 {
     global $disable_clients_list_services_summary;
     $clientgroups = $this->getGroups();
     $filters = $this->buildCriteria($criteria);
     $where = count($filters) ? " WHERE " . implode(" AND ", $filters) : "";
     $customfieldjoin = $this->customfieldsfilter ? " INNER JOIN tblcustomfieldsvalues ON tblcustomfieldsvalues.relid=tblclients.id" : "";
     $result = full_query("SELECT COUNT(*) FROM tblclients" . $customfieldjoin . $where);
     $data = mysql_fetch_array($result);
     $this->getPageObj()->setNumResults($data[0]);
     $clients = array();
     $query = "SELECT id,firstname,lastname,companyname,email,datecreated,groupid,status FROM tblclients" . $customfieldjoin . $where . " ORDER BY " . $this->getPageObj()->getOrderBy() . " " . $this->getPageObj()->getSortDirection() . " LIMIT " . $this->getQueryLimit();
     $result = full_query($query);
     while ($data = mysql_fetch_array($result)) {
         $id = $data['id'];
         $firstname = $data['firstname'];
         $lastname = $data['lastname'];
         $companyname = $data['companyname'];
         $email = $data['email'];
         $datecreated = $data['datecreated'];
         $groupid = $data['groupid'];
         $status = $data['status'];
         $datecreated = fromMySQLDate($datecreated);
         $groupcolor = isset($clientgroups[$groupid]['colour']) ? $clientgroups[$groupid]['colour'] . "\"" : "";
         $services = $totalservices = "-";
         if (!$disable_clients_list_services_summary) {
             $result2 = full_query("SELECT (SELECT COUNT(*) FROM tblhosting WHERE userid=tblclients.id AND domainstatus IN ('Active','Suspended'))+(SELECT COUNT(*) FROM tblhostingaddons WHERE hostingid IN (SELECT id FROM tblhosting WHERE userid=tblclients.id) AND status IN ('Active','Suspended'))+(SELECT COUNT(*) FROM tbldomains WHERE userid=tblclients.id AND status IN ('Active')) AS services,(SELECT COUNT(*) FROM tblhosting WHERE userid=tblclients.id)+(SELECT COUNT(*) FROM tblhostingaddons WHERE hostingid IN (SELECT id FROM tblhosting WHERE userid=tblclients.id))+(SELECT COUNT(*) FROM tbldomains WHERE userid=tblclients.id) AS totalservices FROM tblclients WHERE tblclients.id=" . (int) $id . " LIMIT 1");
             $data = mysql_fetch_array($result2);
             $services = $data['services'];
             $totalservices = $data['totalservices'];
         }
         $clients[] = array("id" => $id, "firstname" => $firstname, "lastname" => $lastname, "companyname" => $companyname, "groupid" => $groupid, "groupcolor" => $groupcolor, "email" => $email, "services" => $services, "totalservices" => $totalservices, "datecreated" => $datecreated, "status" => $status);
     }
     return $clients;
 }
function adminipwhitelist_activate()
{
    $query = array();
    $query[0] = "CREATE TABLE `tbladminwhitelist` (\r\n\t\t\t`id` int(11) NOT NULL auto_increment,\r\n\t\t\t`label` varchar(64) NOT NULL,\r\n\t\t\t`ip` varchar(16) NOT NULL,\r\n\t\t\t`timestamp` datetime NOT NULL,\r\n\t\t\tPRIMARY KEY  (`id`));";
    foreach ($query as $q) {
        $r = full_query($q);
    }
}
Beispiel #9
0
function pushover_deactivate()
{
    # Remove Custom DB Table
    $query = "DROP TABLE `mod_pushover`";
    $result = full_query($query);
    # Return Result
    return array('status' => 'success', 'description' => 'WHMCS Pushover Notifications Deactivated.');
}
Beispiel #10
0
function licensing_deactivate()
{
    $query = "DROP TABLE `mod_licensing`";
    full_query($query);
    $query = "DROP TABLE `mod_licensinglog`";
    full_query($query);
    $query = "DROP TABLE `mod_licensingbans`";
    full_query($query);
}
function mailchimp_activate()
{
    $query = array();
    $query[0] = "CREATE TABLE `tblmailchimpconf` (\r\n\t\t\t`id` int(11) NOT NULL auto_increment,\r\n\t\t\t`name` varchar(32) NOT NULL,\r\n\t\t\t`value` varchar(1024) default NULL,\r\n\t\t\tPRIMARY KEY  (`id`));";
    $query[1] = "INSERT INTO `tblmailchimpconf` (`id`, `name`, `value`) VALUES\r\n\t\t\t(1, 'apikey', NULL),\r\n\t\t\t(3, 'clientfield', NULL)";
    foreach ($query as $q) {
        $r = full_query($q);
    }
}
Beispiel #12
0
/**
 *
 * @ WHMCS FULL DECODED & NULLED
 *
 * @ Version  : 5.2.15
 * @ Author   : MTIMER
 * @ Release on : 2013-12-24
 * @ Website  : http://www.mtimer.cn
 *
 * */
function hook_licensing_addon_log_prune($vars)
{
    $logprune = get_query_val("tbladdonmodules", "value", array("module" => "licensing", "setting" => "logprune"));
    if (is_numeric($logprune)) {
        full_query("DELETE FROM mod_licensinglog WHERE datetime<='" . date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - $logprune, date("Y"))) . "'");
    }
    full_query("DELETE FROM mod_licensing WHERE serviceid NOT IN (SELECT id FROM tblhosting)");
    full_query("OPTIMIZE TABLE mod_licensinglog");
}
Beispiel #13
0
function mcs_deactivate()
{
    # Remove Custom DB Table
    $query = "DROP TABLE `tblmcsapikey`";
    $result = full_query($query);
    # Return Result
    return array('status' => 'success', 'description' => 'If successful, you can return a message to show the user here');
    return array('status' => 'error', 'description' => 'If an error occurs you can return an error message for display here');
    return array('status' => 'info', 'description' => 'If you want to give an info message to a user you can return it here');
}
/**
 * Returns the WebsitePanel Sync configuration options
 *
 * @param $vars array WHMCS parameters
 * @access public
 * @return array
 */
function websitepanel_sync_upgrade($vars)
{
    // Module version
    $version = $vars['version'];
    // Remove the WebsitePanel credentials
    if ($version < 1.2) {
        full_query("DELETE FROM `tbladdonmodules` WHERE `module` = 'websitepanel_sync' AND `setting` = 'username'");
        full_query("DELETE FROM `tbladdonmodules` WHERE `module` = 'websitepanel_sync' AND `setting` = 'password'");
    }
}
function customercreatedby_deactivate()
{
    # Remove Custom DB Table
    $query = "ALTER TABLE `tblclients` DROP `created_by_admin_id`";
    $result = full_query($query);
    # Return Result
    return array('status' => 'success', 'description' => 'Successfully deactivated this add-on');
    return array('status' => 'error', 'description' => 'Something went wrong!');
    return array('status' => 'info', 'description' => 'Removing this addon');
}
Beispiel #16
0
function sso_login($vars)
{
    if (!isset($_SESSION['adminid']) && isset($vars['userid']) && ($userId = $vars['userid'])) {
        $sql = "SELECT * FROM `tblclients` WHERE `id`='" . $userId . "'";
        if (($result = full_query($sql)) && ($data = mysql_fetch_array($result))) {
            $sso = new sso_connect();
            $result = $sso->connect('login', array('firstname' => $data['firstname'], 'lastname' => $data['lastname'], 'email' => $data['email']));
        }
    }
}
Beispiel #17
0
/**
 *
 * @ WHMCS FULL DECODED & NULLED
 *
 * @ Version  : 5.2.15
 * @ Author   : MTIMER
 * @ Release on : 2013-12-24
 * @ Website  : http://www.mtimer.cn
 *
 * */
function globalsignssl_ConfigOptions()
{
    $result = select_query("tblemailtemplates", "COUNT(*)", array("name" => "SSL Certificate Configuration Required"));
    $data = mysql_fetch_array($result);
    if (!$data[0]) {
        full_query("INSERT INTO `tblemailtemplates` (`type` ,`name` ,`subject` ,`message` ,`fromname` ,`fromemail` ,`disabled` ,`custom` ,`language` ,`copyto` ,`plaintext` )VALUES ('product', 'SSL Certificate Configuration Required', 'SSL Certificate Configuration Required', '<p>Dear {\$client_name},</p><p>Thank you for your order for an SSL Certificate. Before you can use your certificate, it requires configuration which can be done at the URL below.</p><p>{\$ssl_configuration_link}</p><p>Instructions are provided throughout the process but if you experience any problems or have any questions, please open a ticket for assistance.</p><p>{\$signature}</p>', '', '', '', '', '', '', '0')");
    }
    $configarray = array("Username" => array("Type" => "text", "Size" => "25"), "Password" => array("Type" => "password", "Size" => "25", "Description" => "Do not have a GlobalSign SSL account? Visit www.globalsign.com/partners/ssl-resell/ to get an account"), "SSL Certificate Type" => array("Type" => "dropdown", "Options" => "AlphaSSL,DomainSSL,OrganizationSSL,ExtendedSSL"), "Base Option" => array("Type" => "dropdown", "Options" => "Standard SSL,Wildcard SSL"), "Validity Period" => array("Type" => "dropdown", "Options" => "1,2,3,4,5", "Description" => "Years"), "Test Mode" => array("Type" => "yesno"), "" => array("Type" => "na", "Description" => "Don't have a GlobalSign SSL account? Visit <a href=\"http://www.globalsign.com/partners/whmcs/\" target=\"_blank\">www.globalsign.com/partners/whmcs/</a> to signup free."));
    return $configarray;
}
Beispiel #18
0
function twilio_activate()
{
    $query[0] = "CREATE TABLE IF NOT EXISTS `mod_twilio_numbers` (\n\t\t\t\t\t`id` int(11) NOT NULL auto_increment,\n\t\t\t\t\t`number` varchar(32) NOT NULL,\n\t\t\t\t\t`timeout` int(11) NOT NULL,\n\t\t\t\t\t`order` int(11) NOT NULL,\n\t\t\t\t\tPRIMARY KEY  (`id`))";
    $query[1] = "CREATE TABLE IF NOT EXISTS `mod_twilio_config` (\n\t\t\t\t\t`id` INT NOT NULL auto_increment,\n\t\t\t\t\t`setting` VARCHAR( 64 ) NOT NULL,\n\t\t\t\t\t`val` TEXT default NULL,\n\t\t\t\t\tPRIMARY KEY (`id`))";
    $query[2] = "INSERT INTO `mod_twilio_config` (`id`, `setting`, `val`) VALUES\n\t\t\t\t\t(1, 'intro_mode', 'text'),\n\t\t\t\t\t(2, 'intro_text', 'Please press 1 to speak with a representative regarding an existing ticket, press 2 for all other inquiries.'),\n\t\t\t\t\t(3, 'intro_file', ''),\n\t\t\t\t\t(4, 'step1_client_mode', 'text'),\n\t\t\t\t\t(5, 'step1_client_text', 'Please enter your client ID number, followed by the pound sign.'),\n\t\t\t\t\t(6, 'step1_client_file', ''),\n\t\t\t\t\t(7, 'step1_ticket_mode', 'text'),\n\t\t\t\t\t(8, 'step1_ticket_text', 'Please enter your ticket ID number, followed by the pound sign.'),\n\t\t\t\t\t(9, 'step1_ticket_file', ''),\n\t\t\t\t\t(10, 'step2_client_mode', 'text'),\n\t\t\t\t\t(11, 'step2_client_text', 'Hello, %FIRSTNAME% %LASTNAME%. You will be connected with one of our operators shortly.'),\n\t\t\t\t\t(12, 'step2_client_file', ''),\n\t\t\t\t\t(13, 'step2_client_sorry_mode', 'text'),\n\t\t\t\t\t(14, 'step2_client_sorry_text', 'Sorry, I could not locate your account.'),\n\t\t\t\t\t(15, 'step2_client_sorry_file', ''),\n\t\t\t\t\t(16, 'step2_ticket_mode', 'text'),\n\t\t\t\t\t(17, 'step2_ticket_text', 'Hello, %FIRSTNAME% %LASTNAME%. You will be connected with one of our operators shortly.'),\n\t\t\t\t\t(18, 'step2_ticket_file', ''),\n\t\t\t\t\t(19, 'step2_ticket_sorry_mode', 'text'),\n\t\t\t\t\t(20, 'step2_ticket_sorry_text', 'Sorry, I could not locate the ticket you requested.'),\n\t\t\t\t\t(21, 'step2_ticket_sorry_file', ''),\n\t\t\t\t\t(22, 'invalid_request_mode', 'text'),\n\t\t\t\t\t(23, 'invalid_request_text', 'Sorry, I did not understand your request.'),\n\t\t\t\t\t(24, 'invalid_request_file', ''),\n\t\t\t\t\t(25, 'voicemail_email', ''),\n\t\t\t\t\t(26, 'voicemail_mode', 'text'),\n\t\t\t\t\t(27, 'voicemail_text', 'Please leave a message after the beep.'),\n\t\t\t\t\t(28, 'voicemail_file', ''),\n\t\t\t\t\t(29, 'gather_timeout', '30'),\n\t\t\t\t\t(30, 'client_port', '9090'),\n\t\t\t\t\t(31, 'server_port', '9999');";
    foreach ($query as $q) {
        full_query($q);
    }
    return array('status' => 'success');
}
Beispiel #19
0
/**
 * Handles activating and adding client addons to WebsitePanel
 * 
 * @access public
 * @param array $params WHMCS parameters
 * @throws Exception
 */
function websitepanel_addons_AddonActivation($params)
{
    // WHMCS server parameters & package parameters
    $userId = $params['userid'];
    $serviceId = $params['serviceid'];
    $addonId = $params['addonid'];
    $result = full_query("SELECT h.username AS username, s.ipaddress AS serverip, s.hostname AS serverhostname, s.secure AS serversecure, s.username AS serverusername, s.password AS serverpassword, p.configoption6 AS configoption6, h.id AS serviceid FROM `tblhosting` AS h, `tblservers` AS s, `tblproducts` AS p, `mod_wspaddons` AS w WHERE h.packageid = p.id AND w.whmcs_id = {$addonId} AND h.id = {$serviceId} AND h.server = s.id AND s.type = 'websitepanel'");
    if (mysql_num_rows($result) > 0) {
        // Get the results of the query
        $row = mysql_fetch_assoc($result);
        // Start processing the users addon
        $username = $row['username'];
        $serverUsername = $row['serverusername'];
        $serverPassword = decrypt($row['serverpassword']);
        $serverPort = $row['configoption6'];
        $serverHost = empty($row['serverhostname']) ? $row['serverip'] : $row['serverhostname'];
        $serverSecure = $row['serversecure'] == 'on' ? TRUE : FALSE;
        try {
            // Create the WebsitePanel Enterprise Server Client object instance
            $wsp = new websitepanel_EnterpriseServer($serverUsername, $serverPassword, $serverHost, $serverPort, $serverSecure);
            // Get the user's details from WebsitePanel - We need the UserId
            $user = $wsp->getUserByUsername($username);
            if (empty($user)) {
                throw new Exception("User {$username} does not exist - Cannot allocate addon for unknown user");
            }
            // Get the user's package details from WebsitePanel - We need the PackageId
            $package = $wsp->getUserPackages($user['UserId']);
            $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);
        }
    }
}
Beispiel #20
0
function csv_output($query)
{
    global $fields;
    $result = full_query($query);
    while ($data = mysql_fetch_array($result)) {
        foreach ($fields as $field) {
            echo csv_clean($data[$field]) . ",";
        }
        echo "\r\n";
    }
}
Beispiel #21
0
function noti_output($vars)
{
    global $customadminpath, $CONFIG;
    $access_token = select_query('tblnoti', '', array('adminid' => $_SESSION['adminid']));
    if ($_GET['return'] == '1' && $_SESSION['request_token']) {
        $response = curlCall("http://notiapp.com/api/v1/get_access_token", array('app' => $vars['key'], 'request_token' => $_SESSION['request_token']));
        $result = json_decode($response, true);
        insert_query("tblnoti", array("adminid" => $_SESSION['adminid'], "access_token" => $result['access_token']));
        $_SESSION['request_token'] = "";
        curlCall("http://notiapp.com/api/v1/add", array('app' => $vars['key'], 'user' => $result['access_token'], "notification[title]" => "WHMCS is ready to go!", "notification[text]" => "You will now receive WHMCS notifications directly to your desktop", "notification[sound]" => "alert1"));
        header("Location: addonmodules.php?module=noti");
    } elseif ($_GET['setup'] == '1' && !mysql_num_rows($access_token)) {
        $response = curlCall("http://notiapp.com/api/v1/request_access", array('app' => $vars['key'], 'redirect_url' => $CONFIG['SystemURL'] . "/" . $customadminpath . "/addonmodules.php?module=noti&return=1"));
        $result = json_decode($response, true);
        if ($result['request_token'] && $result['redirect_url']) {
            $_SESSION['request_token'] = $result['request_token'];
            header("Location: " . $result['redirect_url']);
        } else {
            echo "<div class='errorbox'><strong>Incorrect API Key</strong></br>Incorrect Noti API Key specified.</div>";
        }
    } elseif ($_GET['disable'] == '1' && mysql_num_rows($access_token)) {
        full_query("DELETE FROM `tblnoti` WHERE `adminid` = '" . $_SESSION['adminid'] . "'");
        echo "<div class='infobox'><strong>Successfully Disabled Noti</strong></br>You have successfully disabled Noti.</div>";
    } elseif (mysql_num_rows($access_token) && $_POST) {
        update_query('tblnoti', array('permissions' => serialize($_POST['notification'])), array('adminid' => $_SESSION['adminid']));
        echo "<div class='infobox'><strong>Updated Notifications</strong></br>You have successfully updated your notification preferences.</div>";
    }
    $access_token = select_query('tblnoti', '', array('adminid' => $_SESSION['adminid']));
    $result = mysql_fetch_array($access_token, MYSQL_ASSOC);
    $permissions = unserialize($result['permissions']);
    if (!mysql_num_rows($access_token)) {
        echo "<p><a href='addonmodules.php?module=noti&setup=1'>Setup Noti</a></p>";
    } else {
        echo "<p><a href='addonmodules.php?module=noti&disable=1'>Disable Noti</a></p>";
        echo '<form method="POST"><table class="form" width="100%" border="0" cellspacing="2" cellpadding="3">
    <tr>
      <td class="fieldlabel" width="200px">Notifications</td>
      <td class="fieldarea">
      <table width="100%">
        <tr>
           <td valign="top">
             <input type="checkbox" name="notification[new_client]" value="1" id="notifications_new_client" ' . ($permissions['new_client'] == "1" ? "checked" : "") . '> <label for="notifications_new_client">New Clients</label><br>
             <input type="checkbox" name="notification[new_invoice]" value="1" id="notifications_new_invoice" ' . ($permissions['new_invoice'] == "1" ? "checked" : "") . '> <label for="notifications_new_invoice">Paid Invoices</label><br>
             <input type="checkbox" name="notification[new_ticket]" value="1" id="notifications_new_ticket" ' . ($permissions['new_ticket'] == "1" ? "checked" : "") . '> <label for="notifications_new_ticket">New Support Ticket</label><br>
           </td>
         </tr>
         
    </table>
  </table>
  
  <p align="center"><input type="submit" value="Save Changes" class="button"></p></form>
  ';
    }
}
Beispiel #22
0
function noti_TicketUserReply($vars)
{
    global $customadminpath, $CONFIG;
    $application_key = mysql_fetch_array(select_query('tbladdonmodules', 'value', array('module' => 'noti', 'setting' => 'key')), MYSQL_ASSOC);
    $administrators = full_query("SELECT `access_token` FROM `tblnoti` WHERE `permissions` LIKE '%new_invoice%'");
    while ($administrator = mysql_fetch_array($administrators, MYSQL_ASSOC)) {
        $noti[] = $administrator['access_token'];
    }
    $noti = implode($noti, ',');
    curlCall("http://notiapp.com/api/v1/bulk", array('app' => $application_key['value'], 'users' => $noti, 'notification[title]' => 'A ticket has been updated', 'notification[text]' => $vars['subject'] . ' (in ' . $vars['deptname'] . ')', 'notification[sound]' => 'subtle1', 'notification[url]' => $CONFIG['SystemURL'] . '/' . $customadminpath . '/supporttickets.php?action=viewticket&id=' . $vars['ticketid']));
}
Beispiel #23
0
function mcp_checkTableCreation()
{
    $result = full_query("show tables like 'whmcs_castcontrol'");
    if (mysql_num_rows($result) == 0) {
        $sql = "CREATE TABLE IF NOT EXISTS `whmcs_castcontrol` (" . "  `customer_id` int(11) NOT NULL," . "  `reference` varchar(50) NOT NULL," . "  PRIMARY KEY  (`customer_id`)" . ")";
        full_query($sql);
        if ($error = mysql_error()) {
            echo $sql . "::" . mysql_error();
        }
        mcp_firstrun();
    }
}
Beispiel #24
0
function enomtruste_CreateAccount($params)
{
    updateService(array("username" => "", "password" => ""));
    $withseal = $params['configoption3'];
    $numyears = $params['configoption4'];
    $result = select_query("tblhosting", "billingcycle", array("id" => $params['serviceid']));
    $data = mysql_fetch_array($result);
    $billingcycle = $data[0];
    if ($billingcycle == "Biennially") {
        $numyears = "2";
    }
    if ($billingcycle == "Triennially") {
        $numyears = "3";
    }
    if ($params['configoptions']['Seal']) {
        $withseal = true;
    }
    if ($params['configoptions']['NumYears']) {
        $numyears = $params['configoptions']['NumYears'];
    }
    $apiproducttype = $withseal ? "TRUSTePrivacyPolicySeal" : "TRUSTePrivacyPolicy";
    $postfields = array();
    $postfields['command'] = "PurchaseServices";
    $postfields['Service'] = $apiproducttype;
    $postfields['NumYears'] = $numyears;
    $postfields['EmailNotify'] = "0";
    $xmldata = enomtruste_call($params, $postfields);
    if ($xmldata['INTERFACE-RESPONSE']['ERRCOUNT'] == 0) {
        $result = "success";
        if (!mysql_num_rows(full_query("SHOW TABLES LIKE 'mod_enomtruste'"))) {
            full_query("CREATE TABLE `mod_enomtruste` ( `serviceid` INT(10) NOT NULL , `subscrid` INT(10) NOT NULL )");
        }
        $subscrid = $xmldata['INTERFACE-RESPONSE']['SUBSCRIPTIONID'];
        insert_query("mod_enomtruste", array("serviceid" => $params['serviceid'], "subscrid" => $subscrid));
        $domain = $params['domain'];
        if (!$domain) {
            $domain = $params['customfields']["Domain Name"];
        }
        $postfields = array();
        $postfields['command'] = "PP_UpdateSubscriptionDetails";
        $postfields['SubscriptionID'] = $subscrid;
        $postfields['DomainName'] = $domain;
        $postfields['EmailAddress'] = $params['clientsdetails']['email'];
        $xmldata = enomtruste_call($params, $postfields);
    } else {
        $result = $xmldata['INTERFACE-RESPONSE']['ERRORS']['ERR1'];
        if (!$result) {
            $result = "An Unknown Error Occurred";
        }
    }
    return $result;
}
Beispiel #25
0
function fbpromo_get_addon($setting)
{
    $sql = "SELECT `value` FROM `tbladdonmodules` WHERE `module`='fbpromo' and `setting`='" . $setting . "'";
    $result = full_query($sql);
    if ($data = mysql_fetch_array($result)) {
        if (count($data) > 0) {
            return $data["value"];
        } else {
            return false;
        }
    }
    return false;
}
Beispiel #26
0
function addonexample_upgrade($vars)
{
    $version = $vars['version'];
    # Run SQL Updates for V1.0 to V1.1
    if ($version < 1.1) {
        $query = "ALTER `mod_addonexample` ADD `demo2` TEXT NOT NULL ";
        $result = full_query($query);
    }
    # Run SQL Updates for V1.1 to V1.2
    if ($version < 1.2) {
        $query = "ALTER `mod_addonexample` ADD `demo3` TEXT NOT NULL ";
        $result = full_query($query);
    }
}
function project_management_upgrade()
{
    if ($version < 1.1) {
        $result = full_query("ALTER TABLE `mod_project`  ADD `invoiceids` TEXT NOT NULL AFTER `ticketids`");
        $result = full_query("ALTER TABLE `mod_projecttasks`  ADD `duedate` DATE NOT NULL AFTER `created`");
        $result = full_query("ALTER TABLE `mod_projecttasks`  ADD `notes` TEXT NOT NULL AFTER `task`");
        $result = full_query("ALTER TABLE `mod_projecttasks`  ADD `adminid` INT(11) NOT NULL AFTER `notes`");
        $result = full_query("ALTER TABLE `mod_projecttasks`  ADD `billed` INT(1) NOT NULL AFTER `completed`");
        $result = full_query("ALTER TABLE `mod_projecttasks`  ADD `order` INT(3) NOT NULL AFTER `billed`");
        $result = full_query("ALTER TABLE `mod_projecttimes`  ADD `donotbill` INT(1) NOT NULL");
        $query = "CREATE TABLE IF NOT EXISTS `mod_projecttasktpls` (`id` int(10) NOT NULL AUTO_INCREMENT, `name` text NOT NULL, `tasks` text NOT NULL, PRIMARY KEY (`id`))";
        $result = full_query($query);
    }
}
Beispiel #28
0
function widget_supporttickets_overview($vars)
{
    global $chart;
    $title = "Support Tickets Overview";
    $activestatuses = $replystatuses = array();
    $result = select_query("tblticketstatuses", "title,showactive,showawaiting", "showactive=1");
    while ($data = mysql_fetch_array($result)) {
        if ($data['showactive']) {
            $activestatuses[] = $data['title'];
        }
        if ($data['showawaiting']) {
            $replystatuses[] = $data['title'];
        }
    }
    $ticketcount = 0;
    $awaitingReplyByDept = array();
    if (count($replystatuses) > 0) {
        $query = "SELECT name,(SELECT COUNT(*) FROM tbltickets WHERE tbltickets.did=tblticketdepartments.id AND tbltickets.status IN (" . db_build_in_array($replystatuses) . ")) FROM tblticketdepartments ORDER BY `order` ASC";
        $result = full_query($query);
        while ($data = mysql_fetch_array($result)) {
            $awaitingReplyByDept[] = array('c' => array(array('v' => addcslashes(Sanitize::decode($data[0]), '"')), array('v' => $data[1], 'f' => $data[1])));
            $ticketcount += $data[1];
        }
    }
    $awaitingReplyByStatus = array();
    $query = "SELECT tblticketstatuses.title,(SELECT COUNT(*) FROM tbltickets WHERE tbltickets.status=tblticketstatuses.title) FROM tblticketstatuses WHERE showawaiting=1 ORDER BY sortorder ASC";
    $result = full_query($query);
    while ($data = mysql_fetch_array($result)) {
        $awaitingReplyByStatus[] = array('c' => array(array('v' => addcslashes(Sanitize::decode($data[0]), '"')), array('v' => $data[1], 'f' => $data[1])));
        $ticketcount += $data[1];
    }
    if (!$ticketcount) {
        $content = <<<EOT
<br />
<div align="center">
    There are <strong>0</strong> Tickets Currently Awaiting a Reply
</div>
<br />
EOT;
    } else {
        // Awaiting Reply by Department
        $chartData = array('cols' => array(array('label' => 'Department', 'type' => 'string'), array('label' => 'Ticket Count', 'type' => 'number')), 'rows' => $awaitingReplyByDept);
        $content = '<div id="ticketOverviewDepartments">' . $chart->drawChart('Pie', $chartData, array('title' => 'Awaiting Reply by Department', 'legendpos' => 'right'), '250px') . '</div>';
        // Awaiting Reply by Status
        $chartData = array('cols' => array(array('label' => 'Status', 'type' => 'string'), array('label' => 'Ticket Count', 'type' => 'number')), 'rows' => $awaitingReplyByStatus);
        $content .= '<div id="ticketOverviewStatuses">' . $chart->drawChart('Pie', $chartData, array('title' => 'Awaiting Reply by Status', 'legendpos' => 'right'), '250px') . '</div>';
    }
    return array('title' => $title, 'content' => $content);
}
Beispiel #29
-1
function namecheap_ssl_activate()
{
    // 1. Create configuration email template
    $result = select_query("tblemailtemplates", "COUNT(*)", array("name" => "SSL Certificate Configuration Required"));
    $data = mysql_fetch_array($result);
    if (!$data[0]) {
        full_query("INSERT INTO `tblemailtemplates` (`type` ,`name` ,`subject` ,`message` ,`fromname` ,`fromemail` ,`disabled` ,`custom` ,`language` ,`copyto` ,`plaintext` )VALUES ('product', 'SSL Certificate Configuration Required', 'SSL Certificate Configuration Required', '<p>Dear {\$client_name},</p><p>Thank you for your order for an SSL Certificate. Before you can use your certificate, it requires configuration which can be done at the URL below.</p><p>{\$ssl_configuration_link}</p><p>Instructions are provided throughout the process but if you experience any problems or have any questions, please open a ticket for assistance.</p><p>{\$signature}</p>', '', '', '', '', '', '', '0')");
    }
    // 2.Create auxiliary module table
    $queryString = " CREATE TABLE IF NOT EXISTS `mod_namecheapssl` (\r\n                                      `id` INT AUTO_INCREMENT ,\r\n                                      `user_id` INT ,\r\n                                      `certificate_id` INT ,\r\n                                      `type` VARCHAR( 255 ) ,\r\n                                      `status` VARCHAR( 255 ) ,\r\n                                      `creation_date` VARCHAR( 10 ) ,\r\n                                      `period` INT( 1 ) ,\r\n                                      `expiry_date` VARCHAR( 10 ) ,\r\n                                      `domain` VARCHAR( 255 ),\r\n                                      `parse_csr` TEXT,\r\n                                      `admin_email` VARCHAR( 255 ),\r\n                                      PRIMARY KEY ( `id` )\r\n                        ) ENGINE = MYISAM ";
    mysql_query($queryString);
    // 2. Create auxiliary module log table
    mysql_query("CREATE TABLE IF NOT EXISTS `mod_namecheapssl_log` (\r\n\t`id` INT(10) NOT NULL AUTO_INCREMENT,\r\n\t`date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',\r\n\t`action` VARCHAR(255) NOT NULL DEFAULT '',\r\n\t`description` TEXT NOT NULL,\r\n\t`user` TEXT NOT NULL,\r\n\t`userid` INT(10) NOT NULL,\r\n\t`ipaddr` TEXT NOT NULL,\r\n\tPRIMARY KEY (`id`)\r\n        )\r\n        COLLATE='utf8_general_ci'\r\n        ENGINE=MyISAM");
    // 2. Update existing auxiliary table: add reissue functionality
    $r = mysql_query("SHOW COLUMNS FROM `mod_namecheapssl` LIKE 'reissue'");
    if (0 == mysql_num_rows($r)) {
        mysql_query("ALTER TABLE `mod_namecheapssl` ADD COLUMN `reissue` TINYINT(1) NULL DEFAULT '0' AFTER `admin_email`");
    }
    // 3. Add reissue invitation letter
    $r = mysql_query("SELECT id FROM tblemailtemplates WHERE name='SSL Certificate Reissue Invitation'");
    if (0 == mysql_num_rows($r)) {
        mysql_query("INSERT INTO `tblemailtemplates` (`type` ,`name` ,`subject` ,`message` ,`fromname` ,`fromemail` ,`disabled` ,`custom` ,`language` ,`copyto` ,`plaintext` )VALUES ('product', \r\n            'SSL Certificate Reissue Invitation', \r\n            'SSL Certificate Reissue Invitation',\r\n            '<p>Dear {\$client_name},</p><p>A reissue request has been initiated by an administrator for the following: {\$ssl_certificate_id}. In order to reissue the certificate please go through a configuration process at the URL below.</p><p>{\$ssl_configuration_link}</p><p>Instructions are provided throughout the process but if you experience any problems or have any questions, please open a ticket for assistance.</p><p>{\$signature}</p>',\r\n            '', '', '', '', '', '', '0')");
    }
    namecheap_ssl_check_upgrades();
    return array('status' => 'success', 'description' => '');
    # Return Result
    // return array('status'=>'success','description'=>'This is an demo module only. In a real module you might instruct a user how to get started with it here...');
    // return array('status'=>'error','description'=>'You can use the error status return to indicate there was a problem activating the module');
}
 public function __construct($domainid = "")
 {
     if (!empty($domainid)) {
         $query = full_query("\n            SELECT t.*, m.domain AS coza_domain, m.id_doc_storage_name, m.le_doc_storage_name, m.su_doc_storage_name, m.domain_approval_date, m.domain_status\n                FROM tbldomains t\n                LEFT JOIN mod_domaincloudregistrar m ON t.id = m.domainid\n                WHERE t.id = " . $domainid . "\n            ");
         $this->rows = mysql_fetch_array($query);
     }
 }