From 56ec2b3b2051c945ec23a9149e85e098e6625d90 Mon Sep 17 00:00:00 2001 From: Christopher York Date: Sat, 29 Dec 2012 23:45:50 -0600 Subject: [PATCH] Fixed: Do not run WebsitePanel hooks / addons when not enabled or fully configured --- .../includes/hooks/websitepanel_addons.php | 5 +++++ .../includes/hooks/websitepanel_sync.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/WebsitePanel.WHMCSModule/includes/hooks/websitepanel_addons.php b/WebsitePanel.WHMCSModule/includes/hooks/websitepanel_addons.php index 25de3672..4666d0e4 100644 --- a/WebsitePanel.WHMCSModule/includes/hooks/websitepanel_addons.php +++ b/WebsitePanel.WHMCSModule/includes/hooks/websitepanel_addons.php @@ -54,6 +54,11 @@ function websitepanel_addons_AddonActivation($params) // Retrieve the WebsitePanel Addons module settings $modSettings = websitepanel_addons_GetSettings(); + if (empty($modSettings['username']) || empty($modSettings['password'])) || empty($modSettings['serverhost'])) || empty($modSettings['serverport']))) + { + // The module is disabled or has not yet been configured - stop + return; + } // Get the associated WebsitePanel username from WHMCS $results = select_query('tblhosting', 'username', array('id' => $params['serviceid'])); diff --git a/WebsitePanel.WHMCSModule/includes/hooks/websitepanel_sync.php b/WebsitePanel.WHMCSModule/includes/hooks/websitepanel_sync.php index bf3582ac..1487b98e 100644 --- a/WebsitePanel.WHMCSModule/includes/hooks/websitepanel_sync.php +++ b/WebsitePanel.WHMCSModule/includes/hooks/websitepanel_sync.php @@ -53,6 +53,11 @@ function websitepanel_sync_ClientEdit($params) // Retrieve the WebsitePanel Addons module settings $modSettings = websitepanel_sync_GetSettings(); + if (empty($modSettings['username']) || empty($modSettings['password'])) || empty($modSettings['serverhost'])) || empty($modSettings['serverport']))) + { + // The module is disabled or has not yet been configured - stop + return; + } // Create the WebsitePanel object instance $wsp = new WebsitePanel($modSettings['username'], $modSettings['password'], $modSettings['serverhost'], $modSettings['serverport'], (($modSettings['serversecured']) == 'on' ? TRUE : FALSE));