mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Add new class methods and use them
This commit is contained in:
@@ -279,84 +279,4 @@ if ($db_type == "odbc") {
|
||||
}
|
||||
} //end if db_type pgsql
|
||||
|
||||
//get the domain list
|
||||
if (empty($_SESSION['domains']) or empty($_SESSION["domain_uuid"])) {
|
||||
|
||||
//get the domain
|
||||
$domain_array = explode(":", $_SERVER["HTTP_HOST"] ?? '');
|
||||
|
||||
//get the domains from the database
|
||||
$database = new database;
|
||||
if ($database->table_exists('v_domains')) {
|
||||
$sql = "select * from v_domains order by domain_name asc;";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach($result as $row) {
|
||||
$domain_names[] = $row['domain_name'];
|
||||
}
|
||||
unset($prep_statement);
|
||||
}
|
||||
|
||||
//build the domains array in the correct order
|
||||
if (is_array($domain_names)) {
|
||||
foreach ($domain_names as $dn) {
|
||||
foreach ($result as $row) {
|
||||
if ($row['domain_name'] == $dn) {
|
||||
$domains[] = $row;
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($result);
|
||||
}
|
||||
|
||||
if (is_array($domains)) {
|
||||
foreach($domains as $row) {
|
||||
if (!isset($_SESSION['username'])) {
|
||||
if (count($domains) == 1) {
|
||||
$_SESSION["domain_uuid"] = $row["domain_uuid"];
|
||||
$_SESSION["domain_name"] = $row['domain_name'];
|
||||
}
|
||||
else {
|
||||
if ($row['domain_name'] == $domain_array[0] || $row['domain_name'] == 'www.'.$domain_array[0]) {
|
||||
$_SESSION["domain_uuid"] = $row["domain_uuid"];
|
||||
$_SESSION["domain_name"] = $row["domain_name"];
|
||||
}
|
||||
}
|
||||
}
|
||||
$_SESSION['domains'][$row['domain_uuid']] = $row;
|
||||
}
|
||||
unset($domains, $prep_statement);
|
||||
}
|
||||
}
|
||||
|
||||
//get the software name
|
||||
if (!isset($_SESSION["software_name"])) {
|
||||
$database = new database;
|
||||
if ($database->table_exists('v_software')) {
|
||||
$sql = "select * from v_software ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
$_SESSION["software_name"] = $row['software_name'];
|
||||
}
|
||||
unset($prep_statement, $result);
|
||||
}
|
||||
}
|
||||
|
||||
//set the setting arrays
|
||||
if (!isset($_SESSION['domain']['menu'])) {
|
||||
$domain = new domains();
|
||||
$domain->set();
|
||||
}
|
||||
|
||||
//set the domain_uuid variable from the session
|
||||
if (!empty($_SESSION["domain_uuid"])) {
|
||||
$domain_uuid = $_SESSION["domain_uuid"];
|
||||
}
|
||||
else {
|
||||
$domain_uuid = uuid();
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user