fix listing of subdomains for customers, fixes #759
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -71,19 +71,24 @@ if ($page == 'overview') {
|
||||
if ($row['parentdomainid'] == '0' && $row['caneditdomain'] == '1') {
|
||||
$parentdomains_count ++;
|
||||
}
|
||||
$domain_array[$row['parentdomainid']][] = $row;
|
||||
$domain_array[$row['parentdomainname']][] = $row;
|
||||
}
|
||||
|
||||
if (isset($domain_array[0])) {
|
||||
foreach ($domain_array[0] as $pdomain) {
|
||||
// PARENTDOMAIN
|
||||
$row = \Froxlor\PhpHelper::htmlentitiesArray($pdomain);
|
||||
if (Settings::Get('system.awstats_enabled') == '1') {
|
||||
$statsapp = 'awstats';
|
||||
} else {
|
||||
$statsapp = 'webalizer';
|
||||
}
|
||||
eval("\$domains.=\"" . \Froxlor\UI\Template::getTemplate("domains/domains_delimiter") . "\";");
|
||||
foreach ($domain_array as $parentdomain => $sdomains) {
|
||||
// PARENTDOMAIN
|
||||
if (Settings::Get('system.awstats_enabled') == '1') {
|
||||
$statsapp = 'awstats';
|
||||
} else {
|
||||
$statsapp = 'webalizer';
|
||||
}
|
||||
$row = [
|
||||
'domain' => $idna_convert->decode($parentdomain)
|
||||
];
|
||||
eval("\$domains.=\"" . \Froxlor\UI\Template::getTemplate("domains/domains_delimiter") . "\";");
|
||||
|
||||
foreach ($sdomains as $domain) {
|
||||
$row = \Froxlor\PhpHelper::htmlentitiesArray($domain);
|
||||
|
||||
// show docroot nicely
|
||||
if (strpos($row['documentroot'], $userinfo['documentroot']) === 0) {
|
||||
$row['documentroot'] = \Froxlor\FileDir::makeCorrectDir(str_replace($userinfo['documentroot'], "/", $row['documentroot']));
|
||||
@@ -94,23 +99,6 @@ if ($page == 'overview') {
|
||||
$show_ssledit = true;
|
||||
}
|
||||
eval("\$domains.=\"" . \Froxlor\UI\Template::getTemplate("domains/domains_domain") . "\";");
|
||||
|
||||
// every domain below the parentdomain
|
||||
if (isset($domain_array[$pdomain['id']])) {
|
||||
$mydomains = $domain_array[$pdomain['id']];
|
||||
foreach ($mydomains as $row) {
|
||||
// show docroot nicely
|
||||
if (strpos($row['documentroot'], $userinfo['documentroot']) === 0) {
|
||||
$row['documentroot'] = \Froxlor\FileDir::makeCorrectDir(str_replace($userinfo['documentroot'], "/", $row['documentroot']));
|
||||
}
|
||||
// get ssl-ips if activated
|
||||
$show_ssledit = false;
|
||||
if (Settings::Get('system.use_ssl') == '1' && \Froxlor\Domain\Domain::domainHasSslIpPort($row['id']) && $row['caneditdomain'] == '1' && $row['letsencrypt'] == 0) {
|
||||
$show_ssledit = true;
|
||||
}
|
||||
eval("\$domains.=\"" . \Froxlor\UI\Template::getTemplate("domains/domains_domain") . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -331,15 +331,21 @@ abstract class ApiCommand extends ApiParameter
|
||||
*
|
||||
* @param array $sql_orderby
|
||||
* optional array with index = fieldname and value = ASC|DESC
|
||||
* @param boolean $append
|
||||
* optional append to ORDER BY clause rather then create new one, default false [internal]
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getOrderBy()
|
||||
protected function getOrderBy($append = false)
|
||||
{
|
||||
$orderby = $this->getParam('sql_orderby', true, array());
|
||||
$order = "";
|
||||
if (! empty($orderby)) {
|
||||
$order .= " ORDER BY ";
|
||||
if ($append) {
|
||||
$order .= ", ";
|
||||
} else {
|
||||
$order .= " ORDER BY ";
|
||||
}
|
||||
foreach ($orderby as $field => $by) {
|
||||
$sortfield = explode('.', $field);
|
||||
foreach ($sortfield as $id => $sfield) {
|
||||
|
||||
@@ -767,13 +767,14 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
|
||||
|
||||
// prepare select statement
|
||||
$domains_stmt = Database::prepare("
|
||||
SELECT " . implode(",", $select_fields) . ", `ad`.`id` AS `aliasdomainid`, `ad`.`domain` AS `aliasdomain`, `da`.`id` AS `domainaliasid`, `da`.`domain` AS `domainalias`
|
||||
SELECT " . implode(",", $select_fields) . ", IF(`d`.`parentdomainid` > 0, `pd`.`domain`, `d`.`domain`) AS `parentdomainname`, `ad`.`id` AS `aliasdomainid`, `ad`.`domain` AS `aliasdomain`, `da`.`id` AS `domainaliasid`, `da`.`domain` AS `domainalias`
|
||||
FROM `" . TABLE_PANEL_DOMAINS . "` `d`
|
||||
LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` `ad` ON `d`.`aliasdomain`=`ad`.`id`
|
||||
LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` `da` ON `da`.`aliasdomain`=`d`.`id`
|
||||
LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` `pd` ON `pd`.`id`=`d`.`parentdomainid`
|
||||
WHERE `d`.`customerid` IN (" . implode(', ', $customer_ids) . ")
|
||||
AND `d`.`email_only` = '0'
|
||||
AND `d`.`id` NOT IN (" . implode(', ', $customer_stdsubs) . ")" . $this->getSearchWhere($query_fields, true) . $this->getOrderBy() . $this->getLimit());
|
||||
AND `d`.`id` NOT IN (" . implode(', ', $customer_stdsubs) . ")" . $this->getSearchWhere($query_fields, true) . " ORDER BY `parentdomainname` " . $this->getOrderBy(true) . $this->getLimit());
|
||||
|
||||
$result = array();
|
||||
Database::pexecute($domains_stmt, $query_fields, true, true);
|
||||
|
||||
@@ -285,15 +285,22 @@ class Pagination
|
||||
$stop = $pages;
|
||||
}
|
||||
|
||||
$pagingcode = '<a href="' . htmlspecialchars($baseurl) . '&pageno=1">«</a> <a href="' . htmlspecialchars($baseurl) . '&pageno=' . ((intval($this->pageno) - 1) == 0 ? '1' : intval($this->pageno) - 1) . '"><</a> ';
|
||||
// check for possible sorting values and keep it
|
||||
$orderstr = '';
|
||||
foreach ($this->fields as $fieldname => $fieldcaption) {
|
||||
$fieldname = htmlspecialchars($fieldname);
|
||||
$orderstr .= '&sortfield=' . $fieldname . '&sortorder=' . $this->sortorder;
|
||||
}
|
||||
|
||||
$pagingcode = '<a href="' . htmlspecialchars($baseurl) . '&pageno=1' . $orderstr . '">«</a> <a href="' . htmlspecialchars($baseurl) . '&pageno=' . ((intval($this->pageno) - 1) == 0 ? '1' : intval($this->pageno) - 1) . $orderstr . '"><</a> ';
|
||||
for ($i = $start; $i <= $stop; $i ++) {
|
||||
if ($i != $this->pageno) {
|
||||
$pagingcode .= ' <a href="' . htmlspecialchars($baseurl) . '&pageno=' . $i . '">' . $i . '</a> ';
|
||||
$pagingcode .= ' <a href="' . htmlspecialchars($baseurl) . '&pageno=' . $i . $orderstr . '">' . $i . '</a> ';
|
||||
} else {
|
||||
$pagingcode .= ' <strong>' . $i . '</strong> ';
|
||||
}
|
||||
}
|
||||
$pagingcode .= ' <a href="' . htmlspecialchars($baseurl) . '&pageno=' . ((intval($this->pageno) + 1) > $pages ? $pages : intval($this->pageno) + 1) . '">></a> <a href="' . $baseurl . '&pageno=' . $pages . '">»</a>';
|
||||
$pagingcode .= ' <a href="' . htmlspecialchars($baseurl) . '&pageno=' . ((intval($this->pageno) + 1) > $pages ? $pages : intval($this->pageno) + 1) . $orderstr . '">></a> <a href="' . $baseurl . '&pageno=' . $pages . $orderstr . '">»</a>';
|
||||
} else {
|
||||
$pagingcode = '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user