Files
fusionpbx/resources/header.php
FusionPBX 6b063f2c28 Replace the DOCUMENT_ROOT and PROJECT_ROOT variables
Use the __DIR__ constant and dirname as needed
2025-12-08 14:12:19 -07:00

119 lines
3.3 KiB
PHP

<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2020
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes files
require_once __DIR__ . "/require.php";
//set the domains session
if (!isset($_SESSION['domains'])) {
$domain = new domains();
$domain->session();
$domain->set();
}
//if reloadxml then run the command
if (permission_exists('dialplan_edit') && isset($_SESSION["reload_xml"])) {
if (!empty($_SESSION["reload_xml"])) {
if (isset($_SESSION['apply_settings']) && $_SESSION['apply_settings'] == "true") {
//show the apply settings prompt
}
else {
//reload the access control list this also runs reloadxml
$response = event_socket::api('reloadxml');
$_SESSION["reload_xml"] = '';
unset($_SESSION["reload_xml"]);
usleep(500);
//clear the apply settings reminder
$_SESSION["reload_xml"] = false;
}
}
}
//set the template base directory path
$template_base_path = dirname(__DIR__, 1).'/themes';
//start the output buffer
include $template_base_path.'/'.$settings->get('domain', 'template', 'default').'/config.php';
//start the output buffer
ob_start();
//get the content
if (isset($_GET["c"])) {
$content = $_GET["c"]; //link
}
else {
$content = '';
}
//get the parent id
$sql = "select menu_item_parent_uuid from v_menu_items ";
$sql .= "where menu_uuid = :menu_uuid ";
$sql .= "and menu_item_link = :menu_item_link ";
$parameters['menu_uuid'] = $settings->get('domain', 'menu');
$parameters['menu_item_link'] = $_SERVER["SCRIPT_NAME"];
$_SESSION["menu_item_parent_uuid"] = $database->select($sql, $parameters, 'column');
unset($sql, $parameters);
//button css class and styles
$button_icon_class = '';
$button_icon_style = 'padding: 3px;';
$button_label_class = 'button-label';
$button_label_style = 'padding-left: 5px; padding-right: 3px;';
$button_icons = (!empty($settings->get('theme', 'button_icons'))) ? $button_icons = $settings->get('theme', 'button_icons') : '';
switch ($button_icons) {
case 'auto':
$button_label_class .= ' hide-md-dn';
break;
case 'only':
$button_label_style .= ' display: none;';
break;
case 'never':
$button_icon_class .= ' display: none;';
break;
case 'always':
break;
}
//get the input toggle style options: select, switch_round, switch_square
if (substr($settings->get('theme', 'input_toggle_style', 'switch_round'), 0, 6) == 'switch') {
$input_toggle_style_switch = true;
}
else {
$input_toggle_style_switch = false;
}
//start the output buffer
ob_start();
//for translate tool (if available)
if (file_exists(dirname(__DIR__, 1)."/app/translate/translate_header.php")) {
require_once("app/translate/translate_header.php");
}
?>