|
@@ -405,11 +405,13 @@ function siteBuilder_ClientArea($params) {
|
|
|
$siteBuilder = new ApiClient(getSiteBuilderApiURL($params), $params['serveraccesshash']);
|
|
$siteBuilder = new ApiClient(getSiteBuilderApiURL($params), $params['serveraccesshash']);
|
|
|
$clientInfo = array('moduleclientarea' => '1');
|
|
$clientInfo = array('moduleclientarea' => '1');
|
|
|
$clientInfo['domain'] = $params['domain'];
|
|
$clientInfo['domain'] = $params['domain'];
|
|
|
|
|
+ // Client status
|
|
|
$accEnabled = Capsule::table('sitePro_acc')
|
|
$accEnabled = Capsule::table('sitePro_acc')
|
|
|
->where('pid', $params['serviceid'])
|
|
->where('pid', $params['serviceid'])
|
|
|
->value('enabled');
|
|
->value('enabled');
|
|
|
$clientInfo['account'] = ['enabled' => $accEnabled];
|
|
$clientInfo['account'] = ['enabled' => $accEnabled];
|
|
|
$clientInfo['sites'] = [];
|
|
$clientInfo['sites'] = [];
|
|
|
|
|
+ // Client sites
|
|
|
$sites = getSites($params['serviceid']);
|
|
$sites = getSites($params['serviceid']);
|
|
|
foreach($sites as $site){
|
|
foreach($sites as $site){
|
|
|
$response = $siteBuilder->getSSLDays($params['username'], $site);
|
|
$response = $siteBuilder->getSSLDays($params['username'], $site);
|
|
@@ -422,6 +424,7 @@ function siteBuilder_ClientArea($params) {
|
|
|
}
|
|
}
|
|
|
array_push($clientInfo['sites'],['name' => $site, 'sslSite' => $sslSite, 'enabled' => $enabled]);
|
|
array_push($clientInfo['sites'],['name' => $site, 'sslSite' => $sslSite, 'enabled' => $enabled]);
|
|
|
}
|
|
}
|
|
|
|
|
+ // Client Quota
|
|
|
$response = $siteBuilder->getQuota($params['username']);
|
|
$response = $siteBuilder->getQuota($params['username']);
|
|
|
if($response['status'] != '200') {
|
|
if($response['status'] != '200') {
|
|
|
logModuleCall(
|
|
logModuleCall(
|
|
@@ -434,6 +437,7 @@ function siteBuilder_ClientArea($params) {
|
|
|
}
|
|
}
|
|
|
$clientInfo['quota'] = round($response['response']['quota'][0]['blocks']/1024);
|
|
$clientInfo['quota'] = round($response['response']['quota'][0]['blocks']/1024);
|
|
|
$clientInfo['limit'] = round($response['response']['quota'][0]['hard']/1024);
|
|
$clientInfo['limit'] = round($response['response']['quota'][0]['hard']/1024);
|
|
|
|
|
+ // return template vars
|
|
|
return array(
|
|
return array(
|
|
|
'tabOverviewReplacementTemplate' => 'clientarea',
|
|
'tabOverviewReplacementTemplate' => 'clientarea',
|
|
|
'vars' => $clientInfo,
|
|
'vars' => $clientInfo,
|
|
@@ -458,6 +462,7 @@ function siteBuilder_ClientArea($params) {
|
|
|
*/
|
|
*/
|
|
|
function siteBuilder_ChangePackage($params) {
|
|
function siteBuilder_ChangePackage($params) {
|
|
|
$siteBuilder = new ApiClient(getSiteBuilderApiURL($params), $params['serveraccesshash']);
|
|
$siteBuilder = new ApiClient(getSiteBuilderApiURL($params), $params['serveraccesshash']);
|
|
|
|
|
+ // configoption3 contains quota in MB
|
|
|
$response = $siteBuilder->setQuota($params['username'], $params['configoption3'], $params['serverusername'], $params['serverpassword']);
|
|
$response = $siteBuilder->setQuota($params['username'], $params['configoption3'], $params['serverusername'], $params['serverpassword']);
|
|
|
if($response['status'] != '200') {
|
|
if($response['status'] != '200') {
|
|
|
return 'Error: ' . $response['response']['error'];
|
|
return 'Error: ' . $response['response']['error'];
|
|
@@ -589,7 +594,7 @@ function siteBuilder_addSite($params) {
|
|
|
}
|
|
}
|
|
|
*/
|
|
*/
|
|
|
$siteBuilder = new ApiClient(getSiteBuilderApiURL($params), $params['serveraccesshash']);
|
|
$siteBuilder = new ApiClient(getSiteBuilderApiURL($params), $params['serveraccesshash']);
|
|
|
- // init prod
|
|
|
|
|
|
|
+ // set up webconfig
|
|
|
$response = $siteBuilder->init($params['username'], $site, $params['serverusername'], $params['serverpassword']);
|
|
$response = $siteBuilder->init($params['username'], $site, $params['serverusername'], $params['serverpassword']);
|
|
|
if($response['status'] != '200') {
|
|
if($response['status'] != '200') {
|
|
|
return 'Error: ' . $response['response']['error'];
|
|
return 'Error: ' . $response['response']['error'];
|
|
@@ -617,6 +622,15 @@ function siteBuilder_addSite($params) {
|
|
|
return 'success';
|
|
return 'success';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * Creates a sitePro editor session and redirect on success
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param array $params common module parameters
|
|
|
|
|
+ *
|
|
|
|
|
+ * @see https://developers.whmcs.com/provisioning-modules/supported-functions/
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return string "success" or an error message
|
|
|
|
|
+ */
|
|
|
function siteBuilder_editSite($params) {
|
|
function siteBuilder_editSite($params) {
|
|
|
if(!filter_var($_POST['s'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
|
|
if(!filter_var($_POST['s'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
|
|
|
return 'Error: invalid site name';
|
|
return 'Error: invalid site name';
|
|
@@ -691,7 +705,7 @@ function siteBuilder_editSite($params) {
|
|
|
*
|
|
*
|
|
|
* @return array template information
|
|
* @return array template information
|
|
|
*/
|
|
*/
|
|
|
-function siteBuilder_delSiteConfirm($params) {
|
|
|
|
|
|
|
+function siteBuilder_delSiteConfirm() {
|
|
|
return array(
|
|
return array(
|
|
|
'templatefile' => 'siteBuilder_del_site_confirm',
|
|
'templatefile' => 'siteBuilder_del_site_confirm',
|
|
|
'vars' => array(
|
|
'vars' => array(
|
|
@@ -701,7 +715,7 @@ function siteBuilder_delSiteConfirm($params) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * Removes a domain from a siteBuilder account.
|
|
|
|
|
|
|
+ * Removes a site from a siteBuilder account.
|
|
|
*
|
|
*
|
|
|
* @param array $params common module parameters
|
|
* @param array $params common module parameters
|
|
|
*
|
|
*
|
|
@@ -722,19 +736,16 @@ function siteBuilder_delSite($params) {
|
|
|
}
|
|
}
|
|
|
// remove builder session
|
|
// remove builder session
|
|
|
$api = new SiteProApiClient('https://builder.thurdata.ch/api/', 'apikey0', '993yVHwC05TLsx2JI2XFlAhkkPUxR6JbQUYbI.a5HiRtmNV9');
|
|
$api = new SiteProApiClient('https://builder.thurdata.ch/api/', 'apikey0', '993yVHwC05TLsx2JI2XFlAhkkPUxR6JbQUYbI.a5HiRtmNV9');
|
|
|
- // use this for enterprise licenses and change 'your-bulder-domain.com' to your builder domain
|
|
|
|
|
- //$api = new SiteProApiClient('http://your-bulder-domain.com/api/', 'your_api_username', 'your_api_password');
|
|
|
|
|
-
|
|
|
|
|
try {
|
|
try {
|
|
|
// this call is used to open builder, so you need to set correct parameters to represent users website you want to open
|
|
// this call is used to open builder, so you need to set correct parameters to represent users website you want to open
|
|
|
// this data usually comes from your user/hosting manager system
|
|
// this data usually comes from your user/hosting manager system
|
|
|
$res = $api->remoteCall('requestLogin', array(
|
|
$res = $api->remoteCall('requestLogin', array(
|
|
|
- 'type' => 'internal', // (required) 'internal'
|
|
|
|
|
- 'domain' => $site, // (required) domain of the user website you want to edit
|
|
|
|
|
- 'lang' => 'de', // (optional) 2-letter language code, set language code you whant builder to open in
|
|
|
|
|
|
|
+ 'type' => 'internal', // (required) 'internal'
|
|
|
|
|
+ 'domain' => $site, // (required) domain of the user website you want to edit
|
|
|
|
|
+ 'lang' => 'de', // (optional) 2-letter language code, set language code you whant builder to open in
|
|
|
'apiUrl' => getSiteBuilderApiURL($params) . 'deploy/' . $params['username'] . '/' . $site, // (required) API endpoint URL
|
|
'apiUrl' => getSiteBuilderApiURL($params) . 'deploy/' . $params['username'] . '/' . $site, // (required) API endpoint URL
|
|
|
- 'resellerClientAccountId' => $params['serviceid'], // (required) ID of website/user in your system
|
|
|
|
|
- 'username' => $params['serverusername'], // (optional) authorization username to be used with API endpoint
|
|
|
|
|
|
|
+ 'resellerClientAccountId' => $params['serviceid'], // (required) ID of website/user in your system
|
|
|
|
|
+ 'username' => $params['serverusername'], // (optional) authorization username to be used with API endpoint
|
|
|
'password' => 'your-secure-password', // (optional) authorization password to be used with API endpoint
|
|
'password' => 'your-secure-password', // (optional) authorization password to be used with API endpoint
|
|
|
));
|
|
));
|
|
|
if (!$res || !is_object($res)) {
|
|
if (!$res || !is_object($res)) {
|
|
@@ -792,10 +803,10 @@ function siteBuilder_delSite($params) {
|
|
|
'siteBuilder',
|
|
'siteBuilder',
|
|
|
__FUNCTION__,
|
|
__FUNCTION__,
|
|
|
$params,
|
|
$params,
|
|
|
- 'Error: could remove site from database',
|
|
|
|
|
|
|
+ 'Error: could not remove site from database',
|
|
|
$e->getMessage()
|
|
$e->getMessage()
|
|
|
);
|
|
);
|
|
|
- return 'Error: could remove site from database';
|
|
|
|
|
|
|
+ return 'Error: could not remove site from database';
|
|
|
}
|
|
}
|
|
|
// unset DNS
|
|
// unset DNS
|
|
|
/* disabled on dev, has to be already set in test env
|
|
/* disabled on dev, has to be already set in test env
|
|
@@ -808,7 +819,7 @@ function siteBuilder_delSite($params) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * Opens a form to delete a domain from a siteBuilder account.
|
|
|
|
|
|
|
+ * Opens a form to re-init a website.
|
|
|
*
|
|
*
|
|
|
* @param array $params common module parameters
|
|
* @param array $params common module parameters
|
|
|
*
|
|
*
|
|
@@ -826,7 +837,7 @@ function siteBuilder_revSiteConfirm($params) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * Revert all Changes of the development Site.
|
|
|
|
|
|
|
+ * Revert all Changes (re-init) of the Site.
|
|
|
*
|
|
*
|
|
|
* @param array $params common module parameters
|
|
* @param array $params common module parameters
|
|
|
*
|
|
*
|
|
@@ -841,75 +852,82 @@ function siteBuilder_revSite($params) {
|
|
|
|
|
|
|
|
$site = $_POST['s'];
|
|
$site = $_POST['s'];
|
|
|
$siteBuilder = new ApiClient(getSiteBuilderApiURL($params), $params['serveraccesshash']);
|
|
$siteBuilder = new ApiClient(getSiteBuilderApiURL($params), $params['serveraccesshash']);
|
|
|
|
|
+ // re-init site on webhost
|
|
|
$response = $siteBuilder->revert($params['username'], $site, $params['serverusername'], $params['serverpassword']);
|
|
$response = $siteBuilder->revert($params['username'], $site, $params['serverusername'], $params['serverpassword']);
|
|
|
if($response['status'] != '200') {
|
|
if($response['status'] != '200') {
|
|
|
return 'Error: ' . $response['response']['error'];
|
|
return 'Error: ' . $response['response']['error'];
|
|
|
}
|
|
}
|
|
|
- // remove builder session
|
|
|
|
|
- $api = new SiteProApiClient('https://builder.thurdata.ch/api/', 'apikey0', '993yVHwC05TLsx2JI2XFlAhkkPUxR6JbQUYbI.a5HiRtmNV9');
|
|
|
|
|
- // use this for enterprise licenses and change 'your-bulder-domain.com' to your builder domain
|
|
|
|
|
- //$api = new SiteProApiClient('http://your-bulder-domain.com/api/', 'your_api_username', 'your_api_password');
|
|
|
|
|
-
|
|
|
|
|
- try {
|
|
|
|
|
- // this call is used to open builder, so you need to set correct parameters to represent users website you want to open
|
|
|
|
|
- // this data usually comes from your user/hosting manager system
|
|
|
|
|
- $res = $api->remoteCall('requestLogin', array(
|
|
|
|
|
- 'type' => 'internal', // (required) 'internal'
|
|
|
|
|
- 'domain' => $site, // (required) domain of the user website you want to edit
|
|
|
|
|
- 'lang' => 'de', // (optional) 2-letter language code, set language code you whant builder to open in
|
|
|
|
|
- 'apiUrl' => getSiteBuilderApiURL($params) . 'deploy/' . $params['username'] . '/' . $site, // (required) API endpoint URL
|
|
|
|
|
- 'resellerClientAccountId' => $params['serviceid'], // (required) ID of website/user in your system
|
|
|
|
|
- 'username' => $params['serverusername'], // (optional) authorization username to be used with API endpoint
|
|
|
|
|
- 'password' => 'your-secure-password', // (optional) authorization password to be used with API endpoint
|
|
|
|
|
|
|
+ // remove builder session
|
|
|
|
|
+ $api = new SiteProApiClient('https://builder.thurdata.ch/api/', 'apikey0', '993yVHwC05TLsx2JI2XFlAhkkPUxR6JbQUYbI.a5HiRtmNV9');
|
|
|
|
|
+ try {
|
|
|
|
|
+ // this call is used to open builder, so you need to set correct parameters to represent users website you want to open
|
|
|
|
|
+ // this data usually comes from your user/hosting manager system
|
|
|
|
|
+ $res = $api->remoteCall('requestLogin', array(
|
|
|
|
|
+ 'type' => 'internal', // (required) 'internal'
|
|
|
|
|
+ 'domain' => $site, // (required) domain of the user website you want to edit
|
|
|
|
|
+ 'lang' => 'de', // (optional) 2-letter language code, set language code you whant builder to open in
|
|
|
|
|
+ 'apiUrl' => getSiteBuilderApiURL($params) . 'deploy/' . $params['username'] . '/' . $site, // (required) API endpoint URL
|
|
|
|
|
+ 'resellerClientAccountId' => $params['serviceid'], // (required) ID of website/user in your system
|
|
|
|
|
+ 'username' => $params['serverusername'], // (optional) authorization username to be used with API endpoint
|
|
|
|
|
+ 'password' => 'your-secure-password', // (optional) authorization password to be used with API endpoint
|
|
|
|
|
+ ));
|
|
|
|
|
+ if (!$res || !is_object($res)) {
|
|
|
|
|
+ logModuleCall(
|
|
|
|
|
+ 'siteBuilder',
|
|
|
|
|
+ __FUNCTION__,
|
|
|
|
|
+ $params,
|
|
|
|
|
+ 'Error: Response format error',
|
|
|
|
|
+ $res
|
|
|
|
|
+ );
|
|
|
|
|
+ return 'Error: Response format error';
|
|
|
|
|
+ } else if (isset($res->url) && $res->url) {
|
|
|
|
|
+ $result = $api->remoteCall('delete-site', array(
|
|
|
|
|
+ 'domain' => $site
|
|
|
));
|
|
));
|
|
|
- if (!$res || !is_object($res)) {
|
|
|
|
|
|
|
+ if (!$result || !is_object($result)) {
|
|
|
logModuleCall(
|
|
logModuleCall(
|
|
|
'siteBuilder',
|
|
'siteBuilder',
|
|
|
__FUNCTION__,
|
|
__FUNCTION__,
|
|
|
$params,
|
|
$params,
|
|
|
'Error: Response format error',
|
|
'Error: Response format error',
|
|
|
- $res
|
|
|
|
|
|
|
+ $result
|
|
|
);
|
|
);
|
|
|
return 'Error: Response format error';
|
|
return 'Error: Response format error';
|
|
|
- } else if (isset($res->url) && $res->url) {
|
|
|
|
|
- $result = $api->remoteCall('delete-site', array(
|
|
|
|
|
- 'domain' => $site
|
|
|
|
|
- ));
|
|
|
|
|
- if (!$result || !is_object($result)) {
|
|
|
|
|
- logModuleCall(
|
|
|
|
|
- 'siteBuilder',
|
|
|
|
|
- __FUNCTION__,
|
|
|
|
|
- $params,
|
|
|
|
|
- 'Error: Response format error',
|
|
|
|
|
- $result
|
|
|
|
|
- );
|
|
|
|
|
- return 'Error: Response format error';
|
|
|
|
|
- } else if (isset($result->ok) && $res->ok) {
|
|
|
|
|
- return 'success';
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- logModuleCall(
|
|
|
|
|
- 'siteBuilder',
|
|
|
|
|
- __FUNCTION__,
|
|
|
|
|
- $params,
|
|
|
|
|
- 'Error: Unknown error',
|
|
|
|
|
- $res
|
|
|
|
|
- );
|
|
|
|
|
- return 'Error: Unknown error';
|
|
|
|
|
|
|
+ } else if (isset($result->ok) && $res->ok) {
|
|
|
|
|
+ return 'success';
|
|
|
}
|
|
}
|
|
|
- } catch (\Exception $e) {
|
|
|
|
|
|
|
+ } else {
|
|
|
logModuleCall(
|
|
logModuleCall(
|
|
|
'siteBuilder',
|
|
'siteBuilder',
|
|
|
__FUNCTION__,
|
|
__FUNCTION__,
|
|
|
$params,
|
|
$params,
|
|
|
- 'Error: Request error',
|
|
|
|
|
- $e->getMessage()
|
|
|
|
|
|
|
+ 'Error: Unknown error',
|
|
|
|
|
+ $res
|
|
|
);
|
|
);
|
|
|
- return 'Error: Request error';
|
|
|
|
|
|
|
+ return 'Error: Unknown error';
|
|
|
}
|
|
}
|
|
|
|
|
+ } catch (\Exception $e) {
|
|
|
|
|
+ logModuleCall(
|
|
|
|
|
+ 'siteBuilder',
|
|
|
|
|
+ __FUNCTION__,
|
|
|
|
|
+ $params,
|
|
|
|
|
+ 'Error: Request error',
|
|
|
|
|
+ $e->getMessage()
|
|
|
|
|
+ );
|
|
|
|
|
+ return 'Error: Request error';
|
|
|
|
|
+ }
|
|
|
return 'success';
|
|
return 'success';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * Enables a website.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param array $params common module parameters
|
|
|
|
|
+ *
|
|
|
|
|
+ * @see https://developers.whmcs.com/provisioning-modules/supported-functions/
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return string "success" or an error message
|
|
|
|
|
+ */
|
|
|
function siteBuilder_enableSite($params) {
|
|
function siteBuilder_enableSite($params) {
|
|
|
if(!filter_var($_POST['s'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
|
|
if(!filter_var($_POST['s'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
|
|
|
return 'Error: invalid site name';
|
|
return 'Error: invalid site name';
|
|
@@ -943,6 +961,15 @@ function siteBuilder_enableSite($params) {
|
|
|
return 'success';
|
|
return 'success';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * Disables a website.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param array $params common module parameters
|
|
|
|
|
+ *
|
|
|
|
|
+ * @see https://developers.whmcs.com/provisioning-modules/supported-functions/
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return string "success" or an error message
|
|
|
|
|
+ */
|
|
|
function siteBuilder_disableSite($params) {
|
|
function siteBuilder_disableSite($params) {
|
|
|
if(!filter_var($_POST['s'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
|
|
if(!filter_var($_POST['s'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
|
|
|
return 'Error: invalid site name';
|
|
return 'Error: invalid site name';
|
|
@@ -951,15 +978,6 @@ function siteBuilder_disableSite($params) {
|
|
|
$siteBuilder = new ApiClient(getSiteBuilderApiURL($params), $params['serveraccesshash']);
|
|
$siteBuilder = new ApiClient(getSiteBuilderApiURL($params), $params['serveraccesshash']);
|
|
|
// disable
|
|
// disable
|
|
|
$response = $siteBuilder->disable($params['username'], $site, $params['serverusername'], $params['serverpassword']);
|
|
$response = $siteBuilder->disable($params['username'], $site, $params['serverusername'], $params['serverpassword']);
|
|
|
-
|
|
|
|
|
- logModuleCall(
|
|
|
|
|
- 'siteBuilder',
|
|
|
|
|
- __FUNCTION__,
|
|
|
|
|
- $params,
|
|
|
|
|
- 'Debug',
|
|
|
|
|
- $response
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
if($response['status'] != '200') {
|
|
if($response['status'] != '200') {
|
|
|
return 'Error: ' . $response['response']['error'];
|
|
return 'Error: ' . $response['response']['error'];
|
|
|
}
|
|
}
|
|
@@ -984,6 +1002,7 @@ function siteBuilder_disableSite($params) {
|
|
|
}
|
|
}
|
|
|
return 'success';
|
|
return 'success';
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
// Helpers
|
|
// Helpers
|
|
|
/**
|
|
/**
|
|
|
* Update a DNS zone for a domain setting a new record for a domain or subdomain of a CWP7 account.
|
|
* Update a DNS zone for a domain setting a new record for a domain or subdomain of a CWP7 account.
|
|
@@ -1081,8 +1100,8 @@ function siteBuilderunsetDNS($params, $site) {
|
|
|
* Returns API Url .
|
|
* Returns API Url .
|
|
|
*
|
|
*
|
|
|
* @param string $params common module parameters
|
|
* @param string $params common module parameters
|
|
|
- * @param string $user
|
|
|
|
|
- * @param string $params common module parameters
|
|
|
|
|
|
|
+ *
|
|
|
|
|
+ * @see https://developers.whmcs.com/provisioning-modules/supported-functions/
|
|
|
*
|
|
*
|
|
|
* @return string $apiUrl
|
|
* @return string $apiUrl
|
|
|
*/
|
|
*/
|
|
@@ -1092,6 +1111,15 @@ function getSiteBuilderApiURL($params) {
|
|
|
return $httpPrefix . $params['serverhostname'] . $serverPort;
|
|
return $httpPrefix . $params['serverhostname'] . $serverPort;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * Returns all sitenames of an account.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param string $params common module parameters
|
|
|
|
|
+ *
|
|
|
|
|
+ * @see https://developers.whmcs.com/provisioning-modules/supported-functions/
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return array $sites array of sitenames
|
|
|
|
|
+ */
|
|
|
function getSites($serviceID) {
|
|
function getSites($serviceID) {
|
|
|
$sitesObj = Capsule::table('sitePro_site')
|
|
$sitesObj = Capsule::table('sitePro_site')
|
|
|
->where('relid', $serviceID)
|
|
->where('relid', $serviceID)
|
|
@@ -1103,6 +1131,15 @@ function getSites($serviceID) {
|
|
|
return $sites;
|
|
return $sites;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * Returns all names of enabled sites of an account.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param string $params common module parameters
|
|
|
|
|
+ *
|
|
|
|
|
+ * @see https://developers.whmcs.com/provisioning-modules/supported-functions/
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return array $sites array of sitenames
|
|
|
|
|
+ */
|
|
|
function getSitesEnabled($serviceID) {
|
|
function getSitesEnabled($serviceID) {
|
|
|
$sitesObj = Capsule::table('sitePro_site')
|
|
$sitesObj = Capsule::table('sitePro_site')
|
|
|
->where('relid', $serviceID)
|
|
->where('relid', $serviceID)
|
|
@@ -1115,20 +1152,16 @@ function getSitesEnabled($serviceID) {
|
|
|
return $sites;
|
|
return $sites;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * Creates tables for account & site management if not exists
|
|
|
|
|
+ */
|
|
|
function siteBuilderCreateTables() {
|
|
function siteBuilderCreateTables() {
|
|
|
// Create a new table.
|
|
// Create a new table.
|
|
|
if (!Capsule::schema()->hasTable('sitePro_acc')) {
|
|
if (!Capsule::schema()->hasTable('sitePro_acc')) {
|
|
|
try {
|
|
try {
|
|
|
Capsule::schema()->create(
|
|
Capsule::schema()->create(
|
|
|
'sitePro_acc',
|
|
'sitePro_acc',
|
|
|
- function ($table) { logModuleCall(
|
|
|
|
|
- 'siteBuilder',
|
|
|
|
|
- __FUNCTION__,
|
|
|
|
|
- $params,
|
|
|
|
|
- 'Debug',
|
|
|
|
|
- $site
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
|
|
+ function ($table) {
|
|
|
/** @var \Illuminate\Database\Schema\Blueprint $table */
|
|
/** @var \Illuminate\Database\Schema\Blueprint $table */
|
|
|
$table->increments('id');
|
|
$table->increments('id');
|
|
|
$table->string('account');
|
|
$table->string('account');
|