store ace-string of domain besides idn-converted string to have correct sorting in the frontend; fixes #809
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -39,7 +39,7 @@ if ($page == 'domains' || $page == 'overview') {
|
|||||||
|
|
||||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_domains");
|
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_domains");
|
||||||
$fields = array(
|
$fields = array(
|
||||||
'd.domain' => $lng['domains']['domainname'],
|
'd.domain_ace' => $lng['domains']['domainname'],
|
||||||
'c.name' => $lng['customer']['name'],
|
'c.name' => $lng['customer']['name'],
|
||||||
'c.firstname' => $lng['customer']['firstname'],
|
'c.firstname' => $lng['customer']['firstname'],
|
||||||
'c.company' => $lng['customer']['company'],
|
'c.company' => $lng['customer']['company'],
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ if ($page == 'overview') {
|
|||||||
if ($action == '') {
|
if ($action == '') {
|
||||||
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_domains::domains");
|
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_domains::domains");
|
||||||
$fields = array(
|
$fields = array(
|
||||||
'd.domain' => $lng['domains']['domainname'],
|
'd.domain_ace' => $lng['domains']['domainname'],
|
||||||
'd.aliasdomain' => $lng['domains']['aliasdomain']
|
'd.aliasdomain' => $lng['domains']['aliasdomain']
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ if ($page == 'overview') {
|
|||||||
if ($action == '') {
|
if ($action == '') {
|
||||||
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_email::emails");
|
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_email::emails");
|
||||||
$fields = array(
|
$fields = array(
|
||||||
'd.domain' => $lng['domains']['domainname'],
|
'd.domain_ace' => $lng['domains']['domainname'],
|
||||||
'm.email_full' => $lng['emails']['emailaddress'],
|
'm.email_full' => $lng['emails']['emailaddress'],
|
||||||
'm.destination' => $lng['emails']['forwarders']
|
'm.destination' => $lng['emails']['forwarders']
|
||||||
);
|
);
|
||||||
@@ -76,7 +76,7 @@ if ($page == 'overview') {
|
|||||||
$emails[$row['domain']][$row['email_full']] = $row;
|
$emails[$row['domain']][$row['email_full']] = $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($paging->sortfield == 'd.domain' && $paging->sortorder == 'desc') {
|
if ($paging->sortfield == 'd.domain_ace' && $paging->sortorder == 'desc') {
|
||||||
krsort($emails);
|
krsort($emails);
|
||||||
} else {
|
} else {
|
||||||
ksort($emails);
|
ksort($emails);
|
||||||
@@ -195,7 +195,7 @@ if ($page == 'overview') {
|
|||||||
$result_stmt = Database::prepare("SELECT `id`, `domain`, `customerid` FROM `" . TABLE_PANEL_DOMAINS . "`
|
$result_stmt = Database::prepare("SELECT `id`, `domain`, `customerid` FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||||
WHERE `customerid`= :cid
|
WHERE `customerid`= :cid
|
||||||
AND `isemaildomain`='1'
|
AND `isemaildomain`='1'
|
||||||
ORDER BY `domain` ASC");
|
ORDER BY `domain_ace` ASC");
|
||||||
Database::pexecute($result_stmt, array(
|
Database::pexecute($result_stmt, array(
|
||||||
"cid" => $userinfo['customerid']
|
"cid" => $userinfo['customerid']
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -224,6 +224,7 @@ DROP TABLE IF EXISTS `panel_domains`;
|
|||||||
CREATE TABLE `panel_domains` (
|
CREATE TABLE `panel_domains` (
|
||||||
`id` int(11) unsigned NOT NULL auto_increment,
|
`id` int(11) unsigned NOT NULL auto_increment,
|
||||||
`domain` varchar(255) NOT NULL default '',
|
`domain` varchar(255) NOT NULL default '',
|
||||||
|
`domain_ace` varchar(255) NOT NULL default '',
|
||||||
`adminid` int(11) unsigned NOT NULL default '0',
|
`adminid` int(11) unsigned NOT NULL default '0',
|
||||||
`customerid` int(11) unsigned NOT NULL default '0',
|
`customerid` int(11) unsigned NOT NULL default '0',
|
||||||
`aliasdomain` int(11) unsigned NULL,
|
`aliasdomain` int(11) unsigned NULL,
|
||||||
@@ -704,7 +705,7 @@ opcache.interned_strings_buffer'),
|
|||||||
('panel', 'customer_hide_options', ''),
|
('panel', 'customer_hide_options', ''),
|
||||||
('panel', 'is_configured', '0'),
|
('panel', 'is_configured', '0'),
|
||||||
('panel', 'version', '0.10.13'),
|
('panel', 'version', '0.10.13'),
|
||||||
('panel', 'db_version', '201912313');
|
('panel', 'db_version', '202002290');
|
||||||
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `panel_tasks`;
|
DROP TABLE IF EXISTS `panel_tasks`;
|
||||||
|
|||||||
@@ -546,7 +546,7 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.10.10')) {
|
|||||||
if (\Froxlor\Froxlor::isDatabaseVersion('201912311')) {
|
if (\Froxlor\Froxlor::isDatabaseVersion('201912311')) {
|
||||||
showUpdateStep("Migrate logfiles_format setting");
|
showUpdateStep("Migrate logfiles_format setting");
|
||||||
$current_format = Settings::Set('system.logfiles_format');
|
$current_format = Settings::Set('system.logfiles_format');
|
||||||
if (!empty($current_format)) {
|
if (! empty($current_format)) {
|
||||||
Settings::Set('system.logfiles_format', '"' . Settings::Get('system.logfiles_format') . '"');
|
Settings::Set('system.logfiles_format', '"' . Settings::Get('system.logfiles_format') . '"');
|
||||||
lastStepStatus(0);
|
lastStepStatus(0);
|
||||||
} else {
|
} else {
|
||||||
@@ -571,3 +571,24 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.10.12')) {
|
|||||||
showUpdateStep("Updating from 0.10.12 to 0.10.13", false);
|
showUpdateStep("Updating from 0.10.12 to 0.10.13", false);
|
||||||
\Froxlor\Froxlor::updateToVersion('0.10.13');
|
\Froxlor\Froxlor::updateToVersion('0.10.13');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (\Froxlor\Froxlor::isDatabaseVersion('201912313')) {
|
||||||
|
showUpdateStep("Adding new field to domains table");
|
||||||
|
Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD `domain_ace` varchar(255) NOT NULL default '' AFTER `domain`;");
|
||||||
|
lastStepStatus(0);
|
||||||
|
|
||||||
|
showUpdateStep("Updating domain entries");
|
||||||
|
$upd_stmt = Database::prepare("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `domain_ace` = :ace WHERE `id` = :domainid");
|
||||||
|
$sel_stmt = Database::prepare("SELECT id, domain FROM `" . TABLE_PANEL_DOMAINS . "` ORDER BY id ASC");
|
||||||
|
Database::pexecute($sel_stmt);
|
||||||
|
$idna_convert = new \Froxlor\Idna\IdnaWrapper();
|
||||||
|
while ($domain = $sel_stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||||
|
Database::pexecute($upd_stmt, [
|
||||||
|
'ace' => $idna_convert->decode($domain['domain']),
|
||||||
|
'domainid' => $domain['id']
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
lastStepStatus(0);
|
||||||
|
|
||||||
|
\Froxlor\Froxlor::updateToDbVersion('202002290');
|
||||||
|
}
|
||||||
|
|||||||
@@ -684,6 +684,7 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
|
|||||||
|
|
||||||
$ins_data = array(
|
$ins_data = array(
|
||||||
'domain' => $domain,
|
'domain' => $domain,
|
||||||
|
'domain_ace' => $idna_convert->decode($domain),
|
||||||
'customerid' => $customerid,
|
'customerid' => $customerid,
|
||||||
'adminid' => $adminid,
|
'adminid' => $adminid,
|
||||||
'documentroot' => $documentroot,
|
'documentroot' => $documentroot,
|
||||||
@@ -732,6 +733,7 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
|
|||||||
$ins_stmt = Database::prepare("
|
$ins_stmt = Database::prepare("
|
||||||
INSERT INTO `" . TABLE_PANEL_DOMAINS . "` SET
|
INSERT INTO `" . TABLE_PANEL_DOMAINS . "` SET
|
||||||
`domain` = :domain,
|
`domain` = :domain,
|
||||||
|
`domain_ace` = :domain_ace,
|
||||||
`customerid` = :customerid,
|
`customerid` = :customerid,
|
||||||
`adminid` = :adminid,
|
`adminid` = :adminid,
|
||||||
`documentroot` = :documentroot,
|
`documentroot` = :documentroot,
|
||||||
|
|||||||
@@ -256,6 +256,7 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
|
|||||||
`customerid` = :customerid,
|
`customerid` = :customerid,
|
||||||
`adminid` = :adminid,
|
`adminid` = :adminid,
|
||||||
`domain` = :domain,
|
`domain` = :domain,
|
||||||
|
`domain_ace` = :domain_ace,
|
||||||
`documentroot` = :documentroot,
|
`documentroot` = :documentroot,
|
||||||
`aliasdomain` = :aliasdomain,
|
`aliasdomain` = :aliasdomain,
|
||||||
`parentdomainid` = :parentdomainid,
|
`parentdomainid` = :parentdomainid,
|
||||||
@@ -287,6 +288,7 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
|
|||||||
"customerid" => $customer['customerid'],
|
"customerid" => $customer['customerid'],
|
||||||
"adminid" => $customer['adminid'],
|
"adminid" => $customer['adminid'],
|
||||||
"domain" => $completedomain,
|
"domain" => $completedomain,
|
||||||
|
"domain_ace" => $idna_convert->decode($completedomain),
|
||||||
"documentroot" => $path,
|
"documentroot" => $path,
|
||||||
"aliasdomain" => $aliasdomain != 0 ? $aliasdomain : null,
|
"aliasdomain" => $aliasdomain != 0 ? $aliasdomain : null,
|
||||||
"parentdomainid" => $domain_check['id'],
|
"parentdomainid" => $domain_check['id'],
|
||||||
@@ -765,6 +767,7 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
|
|||||||
'`d`.`id`',
|
'`d`.`id`',
|
||||||
'`d`.`customerid`',
|
'`d`.`customerid`',
|
||||||
'`d`.`domain`',
|
'`d`.`domain`',
|
||||||
|
'`d`.`domain_ace`',
|
||||||
'`d`.`documentroot`',
|
'`d`.`documentroot`',
|
||||||
'`d`.`isbinddomain`',
|
'`d`.`isbinddomain`',
|
||||||
'`d`.`isemaildomain`',
|
'`d`.`isemaildomain`',
|
||||||
@@ -780,7 +783,7 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
|
|||||||
|
|
||||||
// prepare select statement
|
// prepare select statement
|
||||||
$domains_stmt = Database::prepare("
|
$domains_stmt = Database::prepare("
|
||||||
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`
|
SELECT " . implode(",", $select_fields) . ", IF(`d`.`parentdomainid` > 0, `pd`.`domain_ace`, `d`.`domain_ace`) AS `parentdomainname`, `ad`.`id` AS `aliasdomainid`, `ad`.`domain` AS `aliasdomain`, `da`.`id` AS `domainaliasid`, `da`.`domain` AS `domainalias`
|
||||||
FROM `" . TABLE_PANEL_DOMAINS . "` `d`
|
FROM `" . TABLE_PANEL_DOMAINS . "` `d`
|
||||||
LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` `ad` ON `d`.`aliasdomain`=`ad`.`id`
|
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 . "` `da` ON `da`.`aliasdomain`=`d`.`id`
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ final class Froxlor
|
|||||||
const VERSION = '0.10.13';
|
const VERSION = '0.10.13';
|
||||||
|
|
||||||
// Database version (YYYYMMDDC where C is a daily counter)
|
// Database version (YYYYMMDDC where C is a daily counter)
|
||||||
const DBVERSION = '201912313';
|
const DBVERSION = '202002290';
|
||||||
|
|
||||||
// Distribution branding-tag (used for Debian etc.)
|
// Distribution branding-tag (used for Debian etc.)
|
||||||
const BRANDING = '';
|
const BRANDING = '';
|
||||||
|
|||||||
2
templates/Sparkle/admin/domains/domains.tpl
vendored
2
templates/Sparkle/admin/domains/domains.tpl
vendored
@@ -30,7 +30,7 @@
|
|||||||
<table class="full hl">
|
<table class="full hl">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{$lng['domains']['domainname']} {$arrowcode['d.domain']}</th>
|
<th>{$lng['domains']['domainname']} {$arrowcode['d.domain_ace']}</th>
|
||||||
<th>{$lng['admin']['ipsandports']['ip']}</th>
|
<th>{$lng['admin']['ipsandports']['ip']}</th>
|
||||||
<th>{$lng['admin']['customer']} {$arrowcode['c.loginname']}</th>
|
<th>{$lng['admin']['customer']} {$arrowcode['c.loginname']}</th>
|
||||||
<th>{$lng['panel']['options']}</th>
|
<th>{$lng['panel']['options']}</th>
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
<table class="full hl">
|
<table class="full hl">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{$lng['domains']['domainname']} {$arrowcode['d.domain']}</th>
|
<th>{$lng['domains']['domainname']} {$arrowcode['d.domain_ace']}</th>
|
||||||
<th>{$lng['panel']['path']}</th>
|
<th>{$lng['panel']['path']}</th>
|
||||||
<th>{$lng['panel']['options']}</th>
|
<th>{$lng['panel']['options']}</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class CertificatesTest extends TestCase
|
|||||||
'ssl_key_file' => $certdata['key']
|
'ssl_key_file' => $certdata['key']
|
||||||
))->add();
|
))->add();
|
||||||
$result = json_decode($json_result, true)['data'];
|
$result = json_decode($json_result, true)['data'];
|
||||||
$this->assertEquals(5, $result['domainid']);
|
$this->assertEquals(6, $result['domainid']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAdminCertificatesList()
|
public function testAdminCertificatesList()
|
||||||
@@ -148,7 +148,7 @@ class CertificatesTest extends TestCase
|
|||||||
'ssl_key_file' => $certdata['key']
|
'ssl_key_file' => $certdata['key']
|
||||||
))->update();
|
))->update();
|
||||||
$result = json_decode($json_result, true)['data'];
|
$result = json_decode($json_result, true)['data'];
|
||||||
$this->assertEquals(5, $result['domainid']);
|
$this->assertEquals(6, $result['domainid']);
|
||||||
$this->assertEquals(str_replace("\n", "", $certdata['cert']), str_replace("\n", "", $result['ssl_cert_file']));
|
$this->assertEquals(str_replace("\n", "", $certdata['cert']), str_replace("\n", "", $result['ssl_cert_file']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -347,4 +347,27 @@ class DomainsTest extends TestCase
|
|||||||
$this->expectExceptionMessage("Not allowed to execute given command.");
|
$this->expectExceptionMessage("Not allowed to execute given command.");
|
||||||
$json_result = Domains::getLocal($customer_userdata)->listingCount();
|
$json_result = Domains::getLocal($customer_userdata)->listingCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testAdminIdnDomainsAdd()
|
||||||
|
{
|
||||||
|
global $admin_userdata;
|
||||||
|
// get customer
|
||||||
|
$json_result = Customers::getLocal($admin_userdata, array(
|
||||||
|
'loginname' => 'test1'
|
||||||
|
))->get();
|
||||||
|
$customer_userdata = json_decode($json_result, true)['data'];
|
||||||
|
$data = [
|
||||||
|
'domain' => 'täst.local',
|
||||||
|
'customerid' => $customer_userdata['customerid']
|
||||||
|
];
|
||||||
|
$json_result = Domains::getLocal($admin_userdata, $data)->add();
|
||||||
|
$result = json_decode($json_result, true)['data'];
|
||||||
|
$this->assertEquals($customer_userdata['documentroot'] . 'xn--tst-qla.local/', $result['documentroot']);
|
||||||
|
$this->assertEquals('xn--tst-qla.local', $result['domain']);
|
||||||
|
$this->assertEquals('täst.local', $result['domain_ace']);
|
||||||
|
|
||||||
|
Domains::getLocal($admin_userdata, [
|
||||||
|
'domainname' => 'täst.local'
|
||||||
|
])->delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user