Added disable mail

This commit is contained in:
Deon George 2012-07-23 22:21:13 +10:00
parent 25602454b7
commit f1f28cd746
2 changed files with 60 additions and 10 deletions

View File

@ -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');
}
}
?>

View File

@ -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