diff --git a/xmlapi.php b/xmlapi.php index 51b65dc..db3afd9 100644 --- a/xmlapi.php +++ b/xmlapi.php @@ -2446,6 +2446,12 @@ public function listaddondomains($username, $domain = null) return $this->api2_query($username, 'Park', 'listaddondomains'); } + // This API function displays a list of all domains related to this account. + public function listalldomains($username) + { + return $this->api2_query($username, 'DomainInfo', 'list_domains'); + } + // This API function displays a list of all selected stats for a specific user. public function stat($username, $args = null) { @@ -2467,4 +2473,50 @@ public function stat($username, $args = null) return $this->api2_query($username, 'StatsBar', 'stat', $values); } + // This API function add as addon a domain onto this user's account + public function addaddon($username, $newdomain, $subdomain, $ftpPass, $dir = null) + { + if ( (!isset($username)) && (!isset($newdomain)) ) { + error_log("addaddon requires that a username, new domain, subdomain and ftp password are passed to it"); + + return false; + } + + if(empty($dir)) { + $dir = "public_html/" . $newdomain; + } + + $args = array( + 'newdomain' => $newdomain, + 'dir' => $dir, + 'subdomain' => $subdomain, + 'pass' => $ftpPass + ); + + return $this->api2_query($username, "AddonDomain", "addaddondomain", $args); + } + + // This API function remove an addon domain from this user's account + public function deladdon($username, $newdomain, $subdomain, $maindomain = null) + { + if ( (!isset($username)) && (!isset($newdomain)) ) { + error_log("deladdon requires that a username, new domain and subdomain are passed to it"); + + return false; + } + + if(!$maindomain) { + $alldomains = $this->listalldomains($username); + $maindomain = $alldomains['main_domain']; + } + + // follow the pattern for subdomain: subdomain_maindomain.com + $args = array( + 'newdomain' => $newdomain, + 'subdomain' => $subdomain . '_' . $maindomain + ); + + return $this->api2_query($username, "AddonDomain", "deladdondomain", $args); + } + }