Server_account does not have getEmail(). change it to Server_Client

This commit is contained in:
Vaidas Lungis committed 2015-03-03 15:08:15 +02:00
1 parent e8f8fd7439
commit ffa070777f
4 files changed
+52 -18

No files matched your search

+23 -1
View File
@@ -22,7 +22,15 @@ class Server_Account
private $password = NULL;
private $domain = NULL;
private $ip = NULL;
/**
* @var Server_Package
*/
private $package = NULL;
/**
* @var Server_Client
*/
private $client = NULL;
private $reseller = NULL;
private $suspended = NULL;
@@ -76,23 +84,37 @@ class Server_Account
return $this->ip;
}
/**
* @param Server_Client $param
* @return $this
*/
public function setClient(Server_Client $param)
{
$this->client = $param;
return $this;
}
/**
* @return Server_Client
*/
public function getClient()
{
return $this->client;
}
/**
* @param Server_Package $param
* @return $this
*/
public function setPackage(Server_Package $param)
{
$this->package = $param;
return $this;
}
/**
* @return Server_package
*/
public function getPackage()
{
return $this->package;
+3 -1
View File
@@ -104,13 +104,15 @@ class Server_Manager_Kloxo extends Server_Manager
$resourcePlan = $this->_getResourcePlan($p);
$dnsTemplate = $this->_getDnsTemplate($p);
$client = $a->getClient();
$params = array(
'action' => 'add',
'class' => 'client',
'name' => $a->getUsername(),
'v-plan_name' => $resourcePlan,
'v-type' => $a->getReseller() ? 'reseller' : 'customer',
'v-contactemail' => $a->getEmail(),
'v-contactemail' => $client->getEmail(),
'v-send_welcome_f' => 'off',
'v-domain_name' => $a->getDomain(),
'v-dnstemplate_name'=> $dnsTemplate,
+18 -12
View File
@@ -124,10 +124,11 @@ class Server_Manager_Plesk extends Server_Manager
}
$id = $this->_creatClient($a);
$client = $a->getClient();
if (!$id) {
throw new Server_Exception('Failed to create new account');
} else {
$a->setId((string)$id);
$client->setId((string)$id);
}
$this->_setPermissions($a);
@@ -238,10 +239,11 @@ class Server_Manager_Plesk extends Server_Manager
public function changeAccountPackage(Server_Account $a, Server_Package $p)
{
$id = $this->_modifyClient($a);
$client = $a->getClient();
if (!$id) {
throw new Server_Exception('Can\'t modify client');
} else {
$a->setId($id);
$client->setId($id);
}
$this->_setPermissions($a);
@@ -261,7 +263,7 @@ class Server_Manager_Plesk extends Server_Manager
public function changeAccountPassword(Server_Account $a, $new)
{
if ($a->reseller) {
if ($a->getReseller()) {
$type = 'reseller';
$genInfo = 'gen-info';
} else {
@@ -400,7 +402,7 @@ class Server_Manager_Plesk extends Server_Manager
'status' => 0, //active
'phone' => $client->getTelephone(),
'fax' => $client->getFax(),
'email' => $a->getEmail(),
'email' => $client->getEmail(),
'address' => $client->getAddress1(),
'city' => $client->getCity(),
'state' => $client->getState(),
@@ -465,10 +467,11 @@ class Server_Manager_Plesk extends Server_Manager
$type = 'client';
}
$client = $a->getClient();
$params = array(
'client' => array(
'ippool_add_ip' => array(
'client_id' => $a->getId(),
'client_id' => $client->getId(),
'ip_address' => $a->getIp(),
),
),
@@ -494,7 +497,7 @@ class Server_Manager_Plesk extends Server_Manager
}
private function _setLimits(Server_Account $a) {
if ($a->reseller) {
if ($a->getReseller()) {
$type = 'reseller';
} else {
$type = 'client';
@@ -569,7 +572,7 @@ class Server_Manager_Plesk extends Server_Manager
}
private function _setPermissions(Server_Account $a) {
if ($a->reseller) {
if ($a->getReseller()) {
$type = 'reseller';
} else {
$type = 'client';
@@ -628,7 +631,7 @@ class Server_Manager_Plesk extends Server_Manager
), //The manage_quota node is optional. It allows/disallows the client to change the hard disk limit. Data type: Boolean.
'11permission' => array(
'name' => 'manage_quota',
'value' => $a->reseller ? 'true' : 'false',
'value' => $a->getReseller() ? 'true' : 'false',
), //The manage_not_chroot_shell node is optional. It allows/disallows the client to manage shell without changing the mount point of the UNIX root. Data type: Boolean.
'12permission' => array(
'name' => 'manage_not_chroot_shell',
@@ -677,13 +680,14 @@ class Server_Manager_Plesk extends Server_Manager
private function _addDomain(Server_Account $a) {
$p = $a->getPackage();
$client = $a->getClient();
$params = array(
'domain' => array(
'add' => array(
'gen_setup' => array(
'name' => $a->getDomain(), //The name node is required. It holds the domain name. Data type: domainName (string, 1 to 255 characters long).
'status' => 0, //The status node is required. It holds the current status of the specified domain. Data type: objectStatus (bitmask, plesk_common.xsd). Allowed values: 0 (active) | 4 (under backup/restore) | 16 (disabled by Plesk Administrator) | 64 (disabled by Plesk Client) | 256 (expired).
'owner-id' => $a->getId(), //The client_id node is required. It holds the identifier of Plesk Client who owns this domain account. Data type: id_type (integer).
'owner-id' => $client->getId(), //The client_id node is required. It holds the identifier of Plesk Client who owns this domain account. Data type: id_type (integer).
'htype' => 'vrt_hst', //The htype node is required. It specifies the type of hosting set on the domain. Data type: DomainHType (string). Allowed values: vrt_hst | std_fwd | frm_fwd | none.
'ip_address' => $a->getIp(),
//'owner-login' => $a->getUsername(),
@@ -908,7 +912,7 @@ class Server_Manager_Plesk extends Server_Manager
'status' => 0, //active
'phone' => $client->getTelephone(),
'fax' => $client->getFax(),
'email' => $a->getEmail(),
'email' => $client->getEmail(),
'address' => $client->getAddress1(),
'city' => $client->getCity(),
'state' => $client->getState(),
@@ -941,6 +945,7 @@ class Server_Manager_Plesk extends Server_Manager
private function _modifyDomain(Server_Account $a) {
$p = $a->getPackage();
$client = $a->getClient();
$params = array(
'domain' => array(
'set' => array(
@@ -951,7 +956,7 @@ class Server_Manager_Plesk extends Server_Manager
'gen_setup' => array(
'name' => $a->getDomain(), //The name node is required. It holds the domain name. Data type: domainName (string, 1 to 255 characters long).
'status' => 0, //The status node is required. It holds the current status of the specified domain. Data type: objectStatus (bitmask, plesk_common.xsd). Allowed values: 0 (active) | 4 (under backup/restore) | 16 (disabled by Plesk Administrator) | 64 (disabled by Plesk Client) | 256 (expired).
'owner-id' => $a->getId(), //The client_id node is required. It holds the identifier of Plesk Client who owns this domain account. Data type: id_type (integer).
'owner-id' => $client->getId(), //The client_id node is required. It holds the identifier of Plesk Client who owns this domain account. Data type: id_type (integer).
'ip_address' => $a->getIp(), //The dns_ip_address node is optional. It holds the domain's IP address shown in the DNS record. Data type: ip_address (string, pattern: ([01]?\p{Nd}{1,2}|2([0-4]\p{Nd}|5[0-5]))(\.([01]?\p{Nd}{1,2}|2([0-4]\p{Nd}|5[0-5]))){3}).
),
'hosting' => array(
@@ -1004,10 +1009,11 @@ class Server_Manager_Plesk extends Server_Manager
}
private function _changeIpType(Server_Account $a) {
$client = $a->getClient();
$params = array(
'reseller' => array(
'ippool-set-ip' => array(
'reseller-id' => $a->getId(),
'reseller-id' => $client->getId(),
'filter' => array(
'ip-address' => $a->getIp(),
),
+8 -4
View File
@@ -283,10 +283,11 @@ class Server_Manager_Virtualmin extends Server_Manager
}
$p = $a->getPackage();
$client = $a->getClient();
$params = array(
'name' => $a->getUsername(),
'pass' => $a->getPassword(),
'email' => $a->getEmail(),
'email' => $client->getEmail(),
'max-doms' => ($p->getMaxDomains() == 'unlimited') ? 'UNLIMITED' : (int)$p->getMaxDomains(),
'max-aliasdoms' => ($p->getMaxDomains() == 'unlimited') ? 'UNLIMITED' : (int)$p->getMaxDomains(),
'max-realdoms' => ($p->getMaxDomains() == 'unlimited') ? 'UNLIMITED' : (int)$p->getMaxDomains(),
@@ -368,10 +369,11 @@ class Server_Manager_Virtualmin extends Server_Manager
private function _createUser(Server_Account $a)
{
$p = $a->getPackage();
$client = $a->getClient();
$params = array(
'domain' => $a->getDomain(),
'pass' => $a->getPassword(),
'email' => $a->getEmail(),
'email' => $client->getEmail(),
'user' => $a->getUsername(),
'dns' => '',
'web' => '',
@@ -527,10 +529,11 @@ class Server_Manager_Virtualmin extends Server_Manager
private function _modifyDomain(Server_Account $a)
{
$p = $a->getPackage();
$client = $a->getClient();
$params = array(
'domain' => $a->getDomain(),
'pass' => $a->getPassword(),
'email' => $a->getEmail(),
'email' => $client->getEmail(),
'quota' => ($p->getQuota() == 'unlimited') ? 'UNLIMITED' : (int)$p->getMaxQuota(),
'uquota' => ($p->getQuota() == 'unlimited') ? 'UNLIMITED' : (int)$p->getMaxQuota(),
'bw' => ($p->getBandwidth() == 'unlimited') ? 'UNLIMITED' : (int)$p->getBandwidth(),
@@ -658,10 +661,11 @@ class Server_Manager_Virtualmin extends Server_Manager
}
$p = $a->getPackage();
$client = $a->getClient();
$params = array(
'name' => $a->getUsername(),
'pass' => $a->getPassword(),
'email' => $a->getEmail(),
'email' => $client->getEmail(),
'max-doms' => ($p->getMaxDomains() == 'unlimited') ? 'UNLIMITED' : $p->getMaxDomains(),
'max-aliasdoms' => ($p->getMaxDomains() == 'unlimited') ? 'UNLIMITED' : $p->getMaxDomains(),
'max-realdoms' => ($p->getMaxDomains() == 'unlimited') ? 'UNLIMITED' : $p->getMaxDomains(),