|
@@ -177,7 +177,7 @@ function siteBuilder_CreateAccount($params) {
|
|
|
if($response['status'] != '200') {
|
|
if($response['status'] != '200') {
|
|
|
return 'Error: ' . $response['response']['error'];
|
|
return 'Error: ' . $response['response']['error'];
|
|
|
}
|
|
}
|
|
|
- /*
|
|
|
|
|
|
|
+ /* enable this block to get a default domain website without hostname (otherwise the customer is able to do that)
|
|
|
// create default domain site
|
|
// create default domain site
|
|
|
$response = $siteBuilder->init($params['username'], $params['domain'], $params['serverusername'], $params['serverpassword']);
|
|
$response = $siteBuilder->init($params['username'], $params['domain'], $params['serverusername'], $params['serverpassword']);
|
|
|
if($response['status'] != '200') {
|
|
if($response['status'] != '200') {
|
|
@@ -247,8 +247,13 @@ function siteBuilder_TerminateAccount($params) {
|
|
|
if($response['status'] != '200') {
|
|
if($response['status'] != '200') {
|
|
|
return 'Error: ' . $response['response'];
|
|
return 'Error: ' . $response['response'];
|
|
|
}
|
|
}
|
|
|
|
|
+ // remove sitebuilder session
|
|
|
|
|
+ $response = siteBuilderRemoveSession($params,$site);
|
|
|
|
|
+ if($response != 'success') {
|
|
|
|
|
+ return 'Error: ' . $response;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
+ }
|
|
|
// cleanup database
|
|
// cleanup database
|
|
|
try {
|
|
try {
|
|
|
Capsule::table('sitePro_site')
|
|
Capsule::table('sitePro_site')
|
|
@@ -722,65 +727,6 @@ function siteBuilder_delSite($params) {
|
|
|
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');
|
|
|
|
|
- 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 (!$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';
|
|
|
|
|
- }
|
|
|
|
|
- } catch (\Exception $e) {
|
|
|
|
|
- logModuleCall(
|
|
|
|
|
- 'siteBuilder',
|
|
|
|
|
- __FUNCTION__,
|
|
|
|
|
- $params,
|
|
|
|
|
- 'Error: Request error',
|
|
|
|
|
- $e->getMessage()
|
|
|
|
|
- );
|
|
|
|
|
- return 'Error: Request error';
|
|
|
|
|
- }
|
|
|
|
|
// update DB
|
|
// update DB
|
|
|
try {
|
|
try {
|
|
|
Capsule::table('sitePro_site')
|
|
Capsule::table('sitePro_site')
|
|
@@ -803,6 +749,10 @@ function siteBuilder_delSite($params) {
|
|
|
return $response;
|
|
return $response;
|
|
|
}
|
|
}
|
|
|
*/
|
|
*/
|
|
|
|
|
+ $response = siteBuilderRemoveSession($params,$site);
|
|
|
|
|
+ if($response != 'success') {
|
|
|
|
|
+ return 'Error: ' . $response;
|
|
|
|
|
+ }
|
|
|
return 'success';
|
|
return 'success';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -992,6 +942,78 @@ function siteBuilder_disableSite($params) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Helpers
|
|
// Helpers
|
|
|
|
|
+/**
|
|
|
|
|
+ * Update a DNS zone for a domain setting a new record for a domain or subdomain of a CWP7 account.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param array $params common module parameters
|
|
|
|
|
+ *
|
|
|
|
|
+ * @see https://developers.whmcs.com/provisioning-modules/supported-functions/
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return string "success" or an error message
|
|
|
|
|
+ */
|
|
|
|
|
+function siteBuilderRemoveSession($params, $site) {
|
|
|
|
|
+ // 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 (!$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';
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (\Exception $e) {
|
|
|
|
|
+ logModuleCall(
|
|
|
|
|
+ 'siteBuilder',
|
|
|
|
|
+ __FUNCTION__,
|
|
|
|
|
+ $params,
|
|
|
|
|
+ 'Error: Request error',
|
|
|
|
|
+ $e->getMessage()
|
|
|
|
|
+ );
|
|
|
|
|
+ return 'Error: Request error';
|
|
|
|
|
+ }
|
|
|
|
|
+ return 'success';
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 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.
|
|
|
*
|
|
*
|