tiny fixes in Domains.add and Domains.update
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -182,16 +182,10 @@ class Domains extends ApiCommand implements ResourceEntity
|
|||||||
), '', true);
|
), '', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$customer_stmt = Database::prepare("
|
$json_result = Customers::getLocal($this->getUserData(), array(
|
||||||
SELECT * FROM `" . TABLE_PANEL_CUSTOMERS . "`
|
'id' => $customerid
|
||||||
WHERE `customerid` = :customerid " . ($this->getUserDetail('customers_see_all') ? '' : " AND `adminid` = :adminid"));
|
))->get();
|
||||||
$params = array(
|
$customer = json_decode($json_result, true)['data'];
|
||||||
'customerid' => $customerid
|
|
||||||
);
|
|
||||||
if ($this->getUserDetail('customers_see_all') == '0') {
|
|
||||||
$params['adminid'] = $this->getUserDetail('adminid');
|
|
||||||
}
|
|
||||||
$customer = Database::pexecute_first($customer_stmt, $params, true, true);
|
|
||||||
|
|
||||||
if (empty($customer) || $customer['customerid'] != $customerid) {
|
if (empty($customer) || $customer['customerid'] != $customerid) {
|
||||||
standard_error('customerdoesntexist', '', true);
|
standard_error('customerdoesntexist', '', true);
|
||||||
@@ -860,13 +854,8 @@ class Domains extends ApiCommand implements ResourceEntity
|
|||||||
$params['adminid'] = $this->getUserDetail('adminid');
|
$params['adminid'] = $this->getUserDetail('adminid');
|
||||||
}
|
}
|
||||||
|
|
||||||
// get domains customer
|
$result = Database::pexecute_first($customer_stmt, $params, true, true);
|
||||||
$json_result = Customers::getLocal($this->getUserData(), array(
|
if (empty($result) || $result['customerid'] != $customerid) {
|
||||||
'id' => $result['customerid']
|
|
||||||
))->get();
|
|
||||||
$customer = json_decode($json_result, true)['data'];
|
|
||||||
|
|
||||||
if (empty($customer) || $customer['customerid'] != $customerid) {
|
|
||||||
standard_error('customerdoesntexist', '', true);
|
standard_error('customerdoesntexist', '', true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -943,9 +932,9 @@ class Domains extends ApiCommand implements ResourceEntity
|
|||||||
// If path is empty and 'Use domain name as default value for DocumentRoot path' is enabled in settings,
|
// If path is empty and 'Use domain name as default value for DocumentRoot path' is enabled in settings,
|
||||||
// set default path to subdomain or domain name
|
// set default path to subdomain or domain name
|
||||||
if (Settings::Get('system.documentroot_use_default_value') == 1) {
|
if (Settings::Get('system.documentroot_use_default_value') == 1) {
|
||||||
$documentroot = makeCorrectDir($customer['documentroot'] . '/' . $result['domain']);
|
$documentroot = makeCorrectDir($result['documentroot'] . '/' . $result['domain']);
|
||||||
} else {
|
} else {
|
||||||
$documentroot = $customer['documentroot'];
|
$documentroot = $result['documentroot'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user