Skip to content

Commit

Permalink
Fixed #1095: Bug - IP usage interface is broken
Browse files Browse the repository at this point in the history
  • Loading branch information
nuxwin committed Jun 14, 2014
1 parent 24182e5 commit f77690a
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 144 deletions.
11 changes: 7 additions & 4 deletions CHANGELOG
Expand Up @@ -19,6 +19,9 @@ INSTALLER
Fixed: Bind9 cannot start if the resolvconf package is not configured yet (Debian Squeeze)
Fixed: Installer hangs while packages installation (Debian Jessie)

TICKETS
Fixed #1095: Bug - IP usage interface is broken

------------------------------------------------------------------------------------------------------------------------
1.1.11
------------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -61,9 +64,9 @@ INSTALLER
Fixed: Unable to set DATABASE_USER_HOST (setup dialog is never displayed)

TICKETS
Fixed: #0549: Bug - Apache - IPv6 addresses must be enclosed in square brackets
Fixed: #1091: Defect - OpenVZ - simfs (proxy-filesystem) - Immutable flags - No support detection
Fixed: #1092: Defect - Dovecot - SQL - The value of the connect parameter must be within double-quote
Fixed #0549: Bug - Apache - IPv6 addresses must be enclosed in square brackets
Fixed #1091: Defect - OpenVZ - simfs (proxy-filesystem) - Immutable flags - No support detection
Fixed #1092: Defect - Dovecot - SQL - The value of the connect parameter must be within double-quote

------------------------------------------------------------------------------------------------------------------------
1.1.9
Expand Down Expand Up @@ -102,7 +105,7 @@ GUI
RELEASE i-MSCP 1.1.7

TICKETS
Fixed: #1090: Bug - Unable to update to 1.1.6 version - Wrong update query
Fixed #1090: Bug - Unable to update to 1.1.6 version - Wrong update query

------------------------------------------------------------------------------------------------------------------------
1.1.6
Expand Down
126 changes: 55 additions & 71 deletions gui/public/admin/ip_usage.php
Expand Up @@ -52,28 +52,10 @@ function listIPDomains($tpl)
INNER JOIN
admin as t3 ON(t3.admin_id = t2.created_by)
WHERE
t1.domain_ip_id = ?
',
$ip['ip_id']
);

$domainsCount = $stmt2->rowCount();

while ($data = $stmt2->fetchRow(PDO::FETCH_ASSOC)) {
$tpl->assign(
array(
'DOMAIN_NAME' => idn_to_utf8(tohtml($data['domain_name'])),
'RESELLER_NAME' => tohtml($data['admin_name'])
)
);

$tpl->parse('DOMAIN_ROW', '.domain_row');
}

$stmt3 = exec_query(
'
t1.domain_ip_id = :ip_id
UNION
SELECT
t1.alias_name, t4.admin_name
t1.alias_name AS domain_name, t4.admin_name
FROM
domain_aliasses AS t1
INNER JOIN
Expand All @@ -83,34 +65,37 @@ function listIPDomains($tpl)
INNER JOIN
admin AS t4 ON(t4.admin_id = t3.created_by)
WHERE
alias_ip_id = ?
alias_ip_id = :ip_id
',
$ip['ip_id']
array('ip_id' => $ip['ip_id'])
);

$aliasesCount = $stmt3->rowCount();
$domainsCount = $stmt2->rowCount();

$tpl->assign(
array(
'IP' => tohtml($ip['ip_number']),
'RECORD_COUNT' => tr('Total Domains') . ': ' . ($domainsCount)
)
);

if ($aliasesCount) {
while ($data = $stmt3->fetchRow(PDO::FETCH_ASSOC)) {
if ($domainsCount) {
while ($data = $stmt2->fetchRow(PDO::FETCH_ASSOC)) {
$tpl->assign(
array(
'DOMAIN_NAME' => tohtml(idn_to_utf8($data['alias_name'])),
'DOMAIN_NAME' => tohtml(idn_to_utf8($data['domain_name'])),
'RESELLER_NAME' => tohtml($data['admin_name'])
)
);

$tpl->parse('DOMAIN_ROW', '.domain_row');
}
} else {
$tpl->assign('DOMAIN_NAME', tr('No used yet'));
$tpl->parse('DOMAIN_ROW', 'domain_row');
}

$tpl->assign(
array(
'IP' => tohtml($ip['ip_number']),
'RECORD_COUNT' => tr('Total Domains') . ': ' . ($domainsCount + $aliasesCount)
)
);

$tpl->parse('IP_ROW', '.ip_row');
$tpl->assign('DOMAIN_ROW', '');
}
}

Expand All @@ -125,41 +110,40 @@ function listIPDomains($tpl)

check_login('admin');

if (!systemHasCustomers()) {
if (systemHasCustomers()) {
$tpl = new iMSCP_pTemplate();

$tpl->define_dynamic(
array(
'layout' => 'shared/layouts/ui.tpl',
'page' => 'admin/ip_usage.tpl',
'ip_row' => 'page',
'domain_row' => 'ip_row'
)
);

$tpl->assign(
array(
'TR_PAGE_TITLE' => tr('Admin / Statistics / IP Usage'),
'ISP_LOGO' => layout_getUserLogo(),
'TR_SERVER_STATISTICS' => tr('Server statistics'),
'TR_IP_ADMIN_USAGE_STATISTICS' => tr('Admin/IP usage statistics'),
'TR_DOMAIN_NAME' => tr('Domain Name'),
'TR_RESELLER_NAME' => tr('Reseller Name')
)
);

generateNavigation($tpl);
listIPDomains($tpl);
generatePageMessage($tpl);

$tpl->parse('LAYOUT_CONTENT', 'page');

iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onAdminScriptEnd, array('templateEngine' => $tpl));

$tpl->prnt();

unsetMessages();
} else {
showBadRequestErrorPage();
}

$tpl = new iMSCP_pTemplate();

$tpl->define_dynamic(
array(
'layout' => 'shared/layouts/ui.tpl',
'page' => 'admin/ip_usage.tpl',
'ip_usage_statistics' => 'page',
'ip_row' => 'ip_usage_statistics',
'domain_row' => 'ip_row'
)
);

$tpl->assign(
array(
'TR_PAGE_TITLE' => tr('Admin / Statistics / IP Usage'),
'ISP_LOGO' => layout_getUserLogo(),
'TR_SERVER_STATISTICS' => tr('Server statistics'),
'TR_IP_ADMIN_USAGE_STATISTICS' => tr('Admin/IP usage statistics'),
'TR_DOMAIN_NAME' => tr('Domain Name'),
'TR_RESELLER_NAME' => tr('Reseller Name')
)
);

generateNavigation($tpl);
listIPDomains($tpl);
generatePageMessage($tpl);

$tpl->parse('LAYOUT_CONTENT', 'page');

iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onAdminScriptEnd, array('templateEngine' => $tpl));

$tpl->prnt();

unsetMessages();
120 changes: 55 additions & 65 deletions gui/public/reseller/ip_usage.php
Expand Up @@ -55,58 +55,48 @@ function listIPDomains($tpl)
INNER JOIN
admin ON(admin_id = domain_admin_id)
WHERE
domain_ip_id = ?
domain_ip_id = :ip_id
AND
created_by = ?
',
array($ip['ip_id'], $resellerId)
);

$domainsCount = $stmt2->rowCount();

while ($data = $stmt2->fetchRow(PDO::FETCH_ASSOC)) {
$tpl->assign('DOMAIN_NAME', idn_to_utf8(tohtml($data['domain_name'])));
$tpl->parse('DOMAIN_ROW', '.domain_row');
}

$stmt3 = exec_query(
'
created_by = :reseller_id
UNION
SELECT
alias_name
alias_name AS domain_name
FROM
domain_aliasses
INNER JOIN
domain USING(domain_id)
INNER JOIN
admin ON(admin_id = domain_admin_id)
WHERE
alias_ip_id = ?
alias_ip_id = :ip_id
AND
created_by = ?
created_by = :reseller_id
',
array($ip['ip_id'], $resellerId)
array('ip_id' => $ip['ip_id'], 'reseller_id' => $resellerId)
);

$aliasesCount = $stmt3->rowCount();

if ($aliasesCount) {
while ($data = $stmt3->fetchRow(PDO::FETCH_ASSOC)) {
$tpl->assign('DOMAIN_NAME', tohtml(idn_to_utf8($data['alias_name'])));
$tpl->parse('DOMAIN_ROW', '.domain_row');
}
}
$domainsCount = $stmt2->rowCount();

$tpl->assign(
array(
'IP' => tohtml($ip['ip_number']),
'RECORD_COUNT' => tr('Total Domains') . ': ' . ($domainsCount + $aliasesCount)
'RECORD_COUNT' => tr('Total Domains') . ': ' . ($domainsCount)
)
);

if ($domainsCount) {
while ($data = $stmt2->fetchRow(PDO::FETCH_ASSOC)) {
$tpl->assign('DOMAIN_NAME', tohtml(idn_to_utf8($data['domain_name'])));
$tpl->parse('DOMAIN_ROW', '.domain_row');
}
} else {
$tpl->assign('DOMAIN_NAME', tr('No used yet'));
$tpl->parse('DOMAIN_ROW', 'domain_row');
}

$tpl->parse('IP_ROW', '.ip_row');
$tpl->assign('DOMAIN_ROW', '');
}


}

/***********************************************************************************************************************
Expand All @@ -120,48 +110,48 @@ function listIPDomains($tpl)

check_login('reseller');

if (!resellerHasCustomers()) {
showBadRequestErrorPage();
}
if (resellerHasCustomers()) {

/** @var $cfg iMSCP_Config_Handler_File */
$cfg = iMSCP_Registry::get('config');
/** @var $cfg iMSCP_Config_Handler_File */
$cfg = iMSCP_Registry::get('config');

/** @var $tpl iMSCP_pTemplate */
$tpl = new iMSCP_pTemplate();
/** @var $tpl iMSCP_pTemplate */
$tpl = new iMSCP_pTemplate();

$tpl->define_dynamic(
array(
'layout' => 'shared/layouts/ui.tpl',
'page' => 'reseller/ip_usage.tpl',
'page_message' => 'layout',
'ip_usage_statistics' => 'page',
'ip_row' => 'ip_usage_statistics',
'domain_row' => 'ip_row'
)
);
$tpl->define_dynamic(
array(
'layout' => 'shared/layouts/ui.tpl',
'page' => 'reseller/ip_usage.tpl',
'page_message' => 'layout',
'ip_row' => 'page',
'domain_row' => 'ip_row'
)
);

$reseller_id = $_SESSION['user_id'];
$reseller_id = $_SESSION['user_id'];

$tpl->assign(
array(
'TR_PAGE_TITLE' => tr('Reseller / Statistics / IP Usage'),
'ISP_LOGO' => layout_getUserLogo(),
'TR_DOMAIN_STATISTICS' => tr('Domain statistics'),
'TR_IP_RESELLER_USAGE_STATISTICS' => tr('Reseller/IP usage statistics'),
'TR_DOMAIN_NAME' => tr('Domain Name'),
'DATATABLE_TRANSLATIONS' => getDataTablesPluginTranslations()
)
);
$tpl->assign(
array(
'TR_PAGE_TITLE' => tr('Reseller / Statistics / IP Usage'),
'ISP_LOGO' => layout_getUserLogo(),
'TR_DOMAIN_STATISTICS' => tr('Domain statistics'),
'TR_IP_RESELLER_USAGE_STATISTICS' => tr('Reseller/IP usage statistics'),
'TR_DOMAIN_NAME' => tr('Domain Name'),
'DATATABLE_TRANSLATIONS' => getDataTablesPluginTranslations()
)
);

generateNavigation($tpl);
generatePageMessage($tpl);
listIPDomains($tpl);
generateNavigation($tpl);
generatePageMessage($tpl);
listIPDomains($tpl);

$tpl->parse('LAYOUT_CONTENT', 'page');
$tpl->parse('LAYOUT_CONTENT', 'page');

iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onResellerScriptEnd, array('templateEngine' => $tpl));
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onResellerScriptEnd, array('templateEngine' => $tpl));

$tpl->prnt();
$tpl->prnt();

unsetMessages();
unsetMessages();
} else {
showBadRequestErrorPage();
}
2 changes: 0 additions & 2 deletions gui/themes/default/admin/ip_usage.tpl
@@ -1,5 +1,4 @@

<!-- BDP: ip_usage_statistics -->
<!-- BDP: ip_row -->
<table class="firstColFixed">
<thead>
Expand All @@ -26,4 +25,3 @@
</tbody>
</table>
<!-- EDP: ip_row -->
<!-- EDP: ip_usage_statistics -->
2 changes: 0 additions & 2 deletions gui/themes/default/reseller/ip_usage.tpl
@@ -1,5 +1,4 @@

<!-- BDP: ip_usage_statistics -->
<!-- BDP: ip_row -->
<table>
<thead>
Expand All @@ -21,4 +20,3 @@
</tbody>
</table>
<!-- EDP: ip_row -->
<!-- EDP: ip_usage_statistics -->

0 comments on commit f77690a

Please sign in to comment.