Update header.php

Fix indentation and create a new database object only if it is not defined.
This commit is contained in:
FusionPBX 2024-08-02 11:35:05 -06:00 committed by GitHub
parent b93d3e8050
commit 0c157bd7ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 13 additions and 11 deletions

View File

@ -34,15 +34,14 @@
//show the apply settings prompt //show the apply settings prompt
} }
else { else {
//create the event socket connection
$esl = event_socket::create();
//reload the access control list this also runs reloadxml //reload the access control list this also runs reloadxml
$response = event_socket::api('reloadxml'); $response = event_socket::api('reloadxml');
$_SESSION["reload_xml"] = ''; $_SESSION["reload_xml"] = '';
unset($_SESSION["reload_xml"]); unset($_SESSION["reload_xml"]);
usleep(500); usleep(500);
//clear the apply settings reminder //clear the apply settings reminder
$_SESSION["reload_xml"] = false; $_SESSION["reload_xml"] = false;
} }
} }
} }
@ -61,7 +60,7 @@
//start the output buffer //start the output buffer
ob_start(); ob_start();
// get the content //get the content
if (isset($_GET["c"])) { if (isset($_GET["c"])) {
$content = $_GET["c"]; //link $content = $_GET["c"]; //link
} }
@ -69,13 +68,17 @@
$content = ''; $content = '';
} }
//connect to the database if not initialized
if (!($database instanceof database)) {
$database = new database();
}
//get the parent id //get the parent id
$sql = "select menu_item_parent_uuid from v_menu_items "; $sql = "select menu_item_parent_uuid from v_menu_items ";
$sql .= "where menu_uuid = :menu_uuid "; $sql .= "where menu_uuid = :menu_uuid ";
$sql .= "and menu_item_link = :menu_item_link "; $sql .= "and menu_item_link = :menu_item_link ";
$parameters['menu_uuid'] = $_SESSION['domain']['menu']['uuid']; $parameters['menu_uuid'] = $_SESSION['domain']['menu']['uuid'];
$parameters['menu_item_link'] = $_SERVER["SCRIPT_NAME"]; $parameters['menu_item_link'] = $_SERVER["SCRIPT_NAME"];
$database = new database;
$_SESSION["menu_item_parent_uuid"] = $database->select($sql, $parameters, 'column'); $_SESSION["menu_item_parent_uuid"] = $database->select($sql, $parameters, 'column');
unset($sql, $parameters); unset($sql, $parameters);
@ -92,7 +95,6 @@
$sql .= "order by rss_order asc "; $sql .= "order by rss_order asc ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['content'] = empty($content) ? $_SERVER["PHP_SELF"] : $content; $parameters['content'] = empty($content) ? $_SERVER["PHP_SELF"] : $content;
$database = new database;
$content_result = $database->select($sql, $parameters, 'all'); $content_result = $database->select($sql, $parameters, 'all');
if (is_array($content_result) && @sizeof($content_result) != 0) { if (is_array($content_result) && @sizeof($content_result) != 0) {
foreach($content_result as $content_row) { foreach($content_result as $content_row) {
@ -145,4 +147,4 @@
require_once("app/translate/translate_header.php"); require_once("app/translate/translate_header.php");
} }
?> ?>