Remove unnecessary if statement (#7264)
This commit is contained in:
parent
e416e74c30
commit
036731202e
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
The Initial Developer of the Original Code is
|
The Initial Developer of the Original Code is
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
Portions created by the Initial Developer are Copyright (C) 2018 - 2022
|
Portions created by the Initial Developer are Copyright (C) 2018-2025
|
||||||
the Initial Developer. All Rights Reserved.
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
|
|
@ -39,52 +39,50 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
//change the domain
|
//change the domain
|
||||||
if (!empty($_GET["domain_uuid"]) && is_uuid($_GET["domain_uuid"]) && $_GET["domain_change"] == "true") {
|
if (!empty($_GET["domain_uuid"]) && is_uuid($_GET["domain_uuid"]) && $_GET["domain_change"] == "true" && permission_exists('domain_select')) {
|
||||||
if (permission_exists('domain_select')) {
|
|
||||||
|
|
||||||
//update the domain session variables
|
//update the domain session variables
|
||||||
$domain_uuid = $_GET["domain_uuid"];
|
$domain_uuid = $_GET["domain_uuid"];
|
||||||
|
|
||||||
//get the domain details
|
//get the domain details
|
||||||
$sql = "select * from v_domains ";
|
$sql = "select * from v_domains ";
|
||||||
$sql .= "order by domain_name asc ";
|
$sql .= "order by domain_name asc ";
|
||||||
$domains = $database->select($sql, null, 'all');
|
$domains = $database->select($sql, null, 'all');
|
||||||
if (!empty($domains)) {
|
if (!empty($domains)) {
|
||||||
foreach($domains as $row) {
|
foreach($domains as $row) {
|
||||||
$_SESSION['domains'][$row['domain_uuid']] = $row;
|
$_SESSION['domains'][$row['domain_uuid']] = $row;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
unset($sql, $domains);
|
}
|
||||||
|
unset($sql, $domains);
|
||||||
|
|
||||||
//validate the domain change
|
//validate the domain change
|
||||||
if (empty($_SESSION['domains'][$domain_uuid])) {
|
if (empty($_SESSION['domains'][$domain_uuid])) {
|
||||||
die("invalid domain");
|
die("invalid domain");
|
||||||
}
|
}
|
||||||
|
|
||||||
//update the domain session variables
|
|
||||||
$_SESSION["previous_domain_uuid"] = $_SESSION['domain_uuid'];
|
|
||||||
$_SESSION['domain_uuid'] = $domain_uuid;
|
|
||||||
$_SESSION["domain_name"] = $_SESSION['domains'][$domain_uuid]['domain_name'];
|
|
||||||
$_SESSION['domain']['template']['name'] = $_SESSION['domains'][$domain_uuid]['template_name'] ?? null;
|
|
||||||
$_SESSION["context"] = $_SESSION["domain_name"];
|
|
||||||
|
|
||||||
//clear the extension array so that it is regenerated for the selected domain
|
//update the domain session variables
|
||||||
unset($_SESSION['extension_array']);
|
$_SESSION["previous_domain_uuid"] = $_SESSION['domain_uuid'];
|
||||||
|
$_SESSION['domain_uuid'] = $domain_uuid;
|
||||||
|
$_SESSION["domain_name"] = $_SESSION['domains'][$domain_uuid]['domain_name'];
|
||||||
|
$_SESSION['domain']['template']['name'] = $_SESSION['domains'][$domain_uuid]['template_name'] ?? null;
|
||||||
|
$_SESSION["context"] = $_SESSION["domain_name"];
|
||||||
|
|
||||||
//set the setting arrays
|
//clear the extension array so that it is regenerated for the selected domain
|
||||||
$domain = new domains();
|
unset($_SESSION['extension_array']);
|
||||||
$domain->set();
|
|
||||||
|
|
||||||
//redirect the user
|
//set the setting arrays
|
||||||
if (!empty($_SESSION["login"]["destination"])) {
|
$domain = new domains();
|
||||||
// to default, or domain specific, login destination
|
$domain->set();
|
||||||
header("Location: ".PROJECT_PATH.$_SESSION["login"]["destination"]["text"]);
|
|
||||||
}
|
//redirect the user
|
||||||
else {
|
if (!empty($_SESSION["login"]["destination"])) {
|
||||||
header("Location: ".PROJECT_PATH."/core/dashboard/");
|
// to default, or domain specific, login destination
|
||||||
}
|
header("Location: ".PROJECT_PATH.$_SESSION["login"]["destination"]["text"]);
|
||||||
exit;
|
}
|
||||||
}
|
else {
|
||||||
|
header("Location: ".PROJECT_PATH."/core/dashboard/");
|
||||||
|
}
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
//check permission
|
//check permission
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue