fusionpbx/resources/header.php

151 lines
4.7 KiB
PHP
Raw Permalink Normal View History

<?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>
2020-02-19 05:43:59 +01:00
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>
*/
2019-09-04 19:20:27 +02:00
2022-10-11 00:35:14 +02:00
//includes files
Use magic constant dir (#6711) * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ to load only functions.php * replace spaces with tab character * update dirname command to use levels instead of nesting * use magic constant __DIR__ * update dirname command to use levels instead of nesting * Update access_control_edit.php * Update access_control_import.php * Update access_controls.php * Update dnd.php * Update access_controls_reload.php * Update call_center_agents.php * Update call_center_agents.php * Update fax_queue.php * Update login.php * Update pdo.php * Update pdo_vm.php * Update switch.php * Update index.php * Update css.php * Update v_mailto.php * Update fax_to_email.php --------- Co-authored-by: FusionPBX <markjcrane@gmail.com>
2023-06-15 19:28:23 +02:00
require_once __DIR__ . "/require.php";
//if reloadxml then run the command
2020-02-19 05:43:59 +01:00
if (permission_exists('dialplan_edit') && isset($_SESSION["reload_xml"])) {
if (!empty($_SESSION["reload_xml"])) {
2023-05-10 01:11:55 +02:00
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;
}
}
}
2016-03-25 23:30:35 +01:00
//set the template base directory path
$template_base_path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes';
//check if the template exists if it is missing then use the default
if (!file_exists($template_base_path.'/'.$_SESSION['domain']['template']['name'].'/template.php')) {
$_SESSION['domain']['template']['name'] = 'default';
}
//start the output buffer
2016-03-25 23:30:35 +01:00
include $template_base_path.'/'.$_SESSION['domain']['template']['name'].'/config.php';
//start the output buffer
ob_start();
//get the content
if (isset($_GET["c"])) {
$content = $_GET["c"]; //link
}
else {
$content = '';
}
2012-10-11 03:04:47 +02:00
//connect to the database if not initialized
if (!($database instanceof database)) {
$database = new database();
}
//get the parent id
2019-08-29 01:53:34 +02:00
$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'] = $_SESSION['domain']['menu']['uuid'];
$parameters['menu_item_link'] = $_SERVER["SCRIPT_NAME"];
2019-09-04 19:11:04 +02:00
$_SESSION["menu_item_parent_uuid"] = $database->select($sql, $parameters, 'column');
unset($sql, $parameters);
//get the content
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/content/app_config.php")) {
$sql = "select * from v_rss ";
2019-08-29 01:53:34 +02:00
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and rss_category = 'content' ";
2019-08-29 01:53:34 +02:00
$sql .= "and rss_link = :content ";
$sql .= "and ( ";
$sql .= "length(rss_del_date) = 0 ";
$sql .= "or rss_del_date is null ";
$sql .= ") ";
$sql .= "order by rss_order asc ";
2019-08-29 01:53:34 +02:00
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['content'] = empty($content) ? $_SERVER["PHP_SELF"] : $content;
2019-08-29 01:53:34 +02:00
$content_result = $database->select($sql, $parameters, 'all');
if (is_array($content_result) && @sizeof($content_result) != 0) {
foreach($content_result as $content_row) {
$template_rss_sub_category = $content_row['rss_sub_category'];
if (empty($content_row['rss_group'])) {
2019-08-29 01:53:34 +02:00
//content is public
$content_from_db = &$content_row['rss_description'];
if (!empty($content_row['rss_title'])) {
$page["title"] = $content_row['rss_title'];
}
}
2019-08-29 01:53:34 +02:00
else {
if (if_group($content_row[rss_group])) { //viewable only to designated group
$content_from_db = &$content_row[rss_description];
if (!empty($content_row['rss_title'])) {
2019-08-29 01:53:34 +02:00
$page["title"] = $content_row['rss_title'];
}
}
}
}
2019-08-29 01:53:34 +02:00
}
unset($sql, $parameters, $content_result, $content_row);
}
2020-06-25 15:29:09 +02:00
//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;';
2023-05-10 01:11:55 +02:00
$button_icons = (!empty($_SESSION['theme']['button_icons']['text'])) ? $button_icons = $_SESSION['theme']['button_icons']['text'] : '';
2020-06-25 15:29:09 +02:00
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;
}
//start the output buffer
ob_start();
2015-01-18 08:54:19 +01:00
//for translate tool (if available)
2024-04-13 22:42:32 +02:00
if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/translate/translate_header.php")) {
2015-01-18 08:54:19 +01:00
require_once("app/translate/translate_header.php");
}
2016-03-25 23:30:35 +01:00
?>