Skip to content

Commit

Permalink
Review: Customer domain management interface +++
Browse files Browse the repository at this point in the history
  • Loading branch information
nuxwin committed Mar 29, 2018
1 parent 0164588 commit 704be51
Show file tree
Hide file tree
Showing 7 changed files with 331 additions and 430 deletions.
2 changes: 1 addition & 1 deletion gui/public/client/alias_add.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function send_alias_order_email($aliasName)
]);

if (!$ret) {
write_log(sprintf("Couldn't send alias order to %s", $row['admin_name']), E_USER_ERROR);
write_log(sprintf("Couldn't send alias order email to %s", $row['admin_name']), E_USER_ERROR);
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,14 @@

check_login('user');
Registry::get('iMSCP_Application')->getEventsManager()->dispatch(iMSCP_Events::onClientScriptStart);

if (!customerHasFeature('domain_aliases') || !isset($_GET['del_id'])) {
showBadRequestErrorPage();
}
customerHasFeature('domain_aliases') && isset($_GET['id']) or showBadRequestErrorPage();

$stmt = exec_query('DELETE FROM domain_aliasses WHERE alias_id = ? AND domain_id = ? AND alias_status = ?', [
intval($_GET['del_id']), get_user_domain_id($_SESSION['user_id']), 'ordered'
intval($_GET['id']), get_user_domain_id($_SESSION['user_id']), 'ordered'
]);

if ($stmt->rowCount()) {
set_page_message(tr('Order successfully deleted.'), 'success');
set_page_message(tr('Order successfully canceled.'), 'success');
redirectTo('domains_manage.php');
}

Expand Down
13 changes: 5 additions & 8 deletions gui/public/client/cert_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ function client_addSslCert($domainId, $domainType)
write_log(sprintf('%s updated an SSL certificate for the %s domain', $_SESSION['user_logged'], $domainName), E_USER_NOTICE);
}

redirectTo("cert_view.php?domain_id=$domainId&domain_type=$domainType");
redirectTo("cert_view.php?id=$domainId&type=$domainType");
} catch (iMSCP_Exception $e) {
$db->rollBack();
write_log("Couldn't add/update SSL certificate in database", E_USER_ERROR);
Expand Down Expand Up @@ -597,6 +597,7 @@ function client_generatePage(TemplateEngine $tpl, $domainId, $domainType)

check_login('user');
Registry::get('iMSCP_Application')->getEventsManager()->dispatch(Events::onClientScriptStart);
isset($_GET['id']) && isset($_GET['type']) && in_array($_GET['type'], ['dmn', 'als', 'sub', 'alssub']) or showBadRequestErrorPage();

$tpl = new TemplateEngine();
$tpl->define([
Expand All @@ -607,14 +608,10 @@ function client_generatePage(TemplateEngine $tpl, $domainId, $domainType)
'ssl_certificate_actions' => 'page'
]);

if (!isset($_GET['domain_id']) || !isset($_GET['domain_type']) ||
!in_array($_GET['domain_type'], ['dmn', 'als', 'sub', 'alssub'])
) {
showBadRequestErrorPage();
}

$domainId = intval($_GET['domain_id']);
$domainType = clean_input($_GET['domain_type']);

$domainId = intval($_GET['id']);
$domainType = clean_input($_GET['type']);

if (customerHasFeature('ssl')
&& !empty($_POST)
Expand Down
Loading

0 comments on commit 704be51

Please sign in to comment.