Jelajahi Sumber

new AccountController

andre 7 bulan lalu
induk
melakukan
17cb1b54c2
2 mengubah file dengan 82 tambahan dan 6 penghapusan
  1. 78 2
      api/sitebuilder.php
  2. 4 4
      siteBuilder.php

+ 78 - 2
api/sitebuilder.php

@@ -78,6 +78,54 @@ class ApiClient {
         return $this->sendRequest('POST', $url, $data);
     }
  
+    /**
+     * Removes the development site for the customer
+     *
+     * @param username:        The username under which the domain is deployed
+     * @param domain:          The Domain to migrate
+     * @param adminName:       The Super-Admin User of the CRM System (usually the e-mail of the customer
+     * @param adminPassword:   A self randomly generated password
+     *
+     * @return                  a json with ['status' => $httpCode,'response' => ['success' => 'Text']];
+     *                          or a json with ['status' => $httpCode,'response' => ['error' => 'Error-Description']];
+     *
+     * Attention: The given parameters username, adminName and adminPassword must be
+     *            stored locally for the Single Sign on from whcms plugin
+     *
+     */
+    public function undeployDev($username, $domain, $adminName, $adminPassword) {
+        $url = "$this->apiUrl/undeploydev/$username/$domain";
+        $data = [
+            'admin_name' => $adminName,
+            'admin_password' => $adminPassword
+        ];
+        return $this->sendRequest('POST', $url, $data);
+    }
+ 
+    /**
+     * Removes the productive site for the customer
+     *
+     * @param username:        The username under which the domain is deployed
+     * @param domain:          The Domain to migrate
+     * @param adminName:       The Super-Admin User of the CRM System (usually the e-mail of the customer
+     * @param adminPassword:   A self randomly generated password
+     *
+     * @return                  a json with ['status' => $httpCode,'response' => ['success' => 'Text']];
+     *                          or a json with ['status' => $httpCode,'response' => ['error' => 'Error-Description']];
+     *
+     * Attention: The given parameters username, adminName and adminPassword must be
+     *            stored locally for the Single Sign on from whcms plugin
+     *
+     */
+    public function undeployProd($username, $domain, $adminName, $adminPassword) {
+        $url = "$this->apiUrl/undeployprod/$username/$domain";
+        $data = [
+            'admin_name' => $adminName,
+            'admin_password' => $adminPassword
+        ];
+        return $this->sendRequest('POST', $url, $data);
+    }
+ 
     /**
      * Migrate dev site to prod site
      *
@@ -116,10 +164,24 @@ class ApiClient {
     }
   
     /**
-     * Deletes the prod & dev webpages
+     * Creates a user and placeholder webpage
      *
      * @param username:        The username under which the domain is deployed
-     * @param domain:          The Domain to migrate
+     * @param domain:          The Domain to delete
+     *
+     * @return                  a json with ['status' => $httpCode,'response' => ['success' => 'Text']];
+     *                          or a json with ['status' => $httpCode,'response' => ['error' => 'Error-Description']];
+     */
+    public function create($domain,$username) {
+        $url = "$this->apiUrl/create/$username/$domain";
+        return $this->sendRequest('GET', $url);
+    }
+  
+    /**
+     * Removes a user and placeholder webpage
+     *
+     * @param username:        The username under which the domain is deployed
+     * @param domain:          The Domain to delete
      *
      * @return                  a json with ['status' => $httpCode,'response' => ['success' => 'Text']];
      *                          or a json with ['status' => $httpCode,'response' => ['error' => 'Error-Description']];
@@ -129,6 +191,20 @@ class ApiClient {
         return $this->sendRequest('GET', $url);
     }
   
+    /**
+     * Deletes the webpage (dev & prod)
+     *
+     * @param username:        The username under which the domain is deployed
+     * @param domain:          The Domain to delete
+     *
+     * @return                  a json with ['status' => $httpCode,'response' => ['success' => 'Text']];
+     *                          or a json with ['status' => $httpCode,'response' => ['error' => 'Error-Description']];
+     */
+    public function delete($domain,$username) {
+        $url = "$this->apiUrl/delete/$username/$domain";
+        return $this->sendRequest('GET', $url);
+    }
+  
     /**
      * Enables the prod webpage
      *

+ 4 - 4
siteBuilder.php

@@ -548,11 +548,11 @@ function siteBuilder_editSite($params) {
  *
  * @return array template information
  */
-function siteBuilder_delDomainConfirm($params) {
+function siteBuilder_delSiteConfirm($params) {
 	return array(
-		'templatefile' => 'siteBuilder_del_domain_confirm',
+		'templatefile' => 'siteBuilder_del_site_confirm',
 		'vars' => array(
-			'deldomain' => $_POST['d'],
+			'delsite' => $_POST['s'],
 		),
     );
 }
@@ -566,7 +566,7 @@ function siteBuilder_delDomainConfirm($params) {
  *
  * @return string "success" or an error message
  */
-function siteBuilder_delDomain($params) {
+function siteBuilder_delSite($params) {
 	if(!filter_var($_POST['d'], FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)){
 		return 'Error: invalid domain name';
 	}