From f1f28cd746f834bb48e63914dedc08bcb6b9b6af Mon Sep 17 00:00:00 2001 From: Deon George Date: Mon, 23 Jul 2012 22:21:13 +1000 Subject: [PATCH] Added disable mail --- modules/host/classes/controller/task/host.php | 41 ++++++++++++++----- modules/host/classes/host/plugin/plesk/10.php | 29 +++++++++++++ 2 files changed, 60 insertions(+), 10 deletions(-) diff --git a/modules/host/classes/controller/task/host.php b/modules/host/classes/controller/task/host.php index 26c6906a..891eab1d 100644 --- a/modules/host/classes/controller/task/host.php +++ b/modules/host/classes/controller/task/host.php @@ -21,12 +21,14 @@ class Controller_Task_Host extends Controller_Task { case 'getclient': case 'getdomain': case 'getdns': + case 'getmail': case 'getreseller': case 'gettraffic': case 'migrate': case 'provision': - case 'resetpw': + case 'setdisablemail': case 'setexpire': + case 'setpasswd': $this->so = ORM::factory('service',$this->request->param('id')); if (! $this->so->loaded()) @@ -101,6 +103,16 @@ class Controller_Task_Host extends Controller_Task { echo (string)$result->_object; } + /** + * Get Mail Details from Host Server + */ + public function action_getmail() { + $result = $this->hpo->cmd_getmail($this->so); + + echo (string)$result->_xml; + echo (string)$result->_object; + } + /** * Get Reseller */ @@ -257,16 +269,13 @@ class Controller_Task_Host extends Controller_Task { print_r((string)$result); } - public function action_resetpw() { - $pw = PWGen::get(TRUE); + /** + * Provision a Hosting Service + */ + public function action_setdisablemail() { + $result = $this->hpo->cmd_disablemail($this->so); - $spho = $this->so->plugin(); - $spho->host_password = $pw; - - if (! ($result = $this->hpo->setpasswd($this->so,$pw)) OR ! $result->loaded() OR ! $spho->save()) - throw new Kohana_Exception('Unable to set password.'); - - echo _('Password Reset Success'); + echo (string)$result->_object; } public function action_setexpire() { @@ -277,5 +286,17 @@ class Controller_Task_Host extends Controller_Task { } else echo (string)$result->_object; } + + public function action_setpasswd() { + $pw = PWGen::get(TRUE); + + $spho = $this->so->plugin(); + $spho->host_password = $pw; + + if (! ($result = $this->hpo->setpasswd($this->so,$pw)) OR ! $result->loaded() OR ! $spho->save()) + throw new Kohana_Exception('Unable to set password.'); + + echo _('Password Reset Success'); + } } ?> diff --git a/modules/host/classes/host/plugin/plesk/10.php b/modules/host/classes/host/plugin/plesk/10.php index 86251f40..40e4772a 100644 --- a/modules/host/classes/host/plugin/plesk/10.php +++ b/modules/host/classes/host/plugin/plesk/10.php @@ -70,6 +70,21 @@ class Host_Plugin_Plesk_10 extends Host_Plugin_Plesk { return $this->server_command($this->xml); } + /** + * Get Mail Configuration + */ + public function cmd_getmail(Model_Service $so) { + $do = clone $this->cmd_getdomain($so); + + $this->init(); + $domain = $this->packet->add_node('mail'); + $get = $domain->add_node('get_prefs'); + $filter = $get->add_node('filter'); + $filter->add_node('site-id',$do->id->value()); + + return $this->server_command($this->xml); + } + /** * Get a Domain Configuration */ @@ -118,6 +133,20 @@ class Host_Plugin_Plesk_10 extends Host_Plugin_Plesk { throw new Kohana_Exception('Not Implemented'); } + /** + * Disable Mail + */ + public function cmd_disablemail(Model_Service $so) { + $do = clone $this->cmd_getdomain($so); + + $this->init(); + $domain = $this->packet->add_node('mail'); + $disable = $domain->add_node('disable'); + $disable->add_node('site-id',$do->id->value()); + + return $this->server_command($this->xml); + } + /** * Provision a hosting service * @todo To implement