leave default-values for adding std-subdomain when adding customer from the parameters-array; do not require ipandports parameter when adding domain but rather default to system.defaultip if no ipandport is given

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2018-02-21 10:57:46 +01:00
parent aef528bea1
commit 26b9c030b5
2 changed files with 7 additions and 22 deletions

View File

@@ -97,9 +97,9 @@ class Domains extends ApiCommand implements ResourceEntity
// parameters
$p_domain = $this->getParam('domain');
$customerid = intval($this->getParam('customerid'));
$p_ipandports = $this->getParam('ipandport');
// optional parameters
$p_ipandports = $this->getParam('ipandport', true, explode(',', Settings::Get('system.defaultip')));
$adminid = intval($this->getParam('adminid', true, $this->getUserDetail('adminid')));
$subcanemaildomain = $this->getParam('subcanemaildomain', true, 0);
$isemaildomain = $this->getParam('isemaildomain', true, 0);
@@ -310,7 +310,11 @@ class Domains extends ApiCommand implements ResourceEntity
$additional_ip_condition = '';
$aip_param = array();
}
if (empty($p_ipandports)) {
throw new Exception("No IPs given, unable to add domain (no default IPs set?", 406);
}
$ipandports = array();
if (! empty($p_ipandport) && ! is_array($p_ipandports)) {
$p_ipandports = unserialize($p_ipandports);