Template: Convert to Smarty syntax.
This commit is contained in:
parent
329afeb6b3
commit
0df02b95dd
|
|
@ -47,6 +47,7 @@ if (!class_exists('menu')) {
|
|||
private $location;
|
||||
public $menu_uuid;
|
||||
public $menu_language;
|
||||
public $text;
|
||||
|
||||
/**
|
||||
* called when the object is created
|
||||
|
|
@ -909,6 +910,257 @@ if (!class_exists('menu')) {
|
|||
}
|
||||
unset($sql, $parameters, $result, $row);
|
||||
}
|
||||
|
||||
/**
|
||||
* build the fixed, static or inline horizontal menu html
|
||||
*/
|
||||
public function menu_horizontal($menu_array) {
|
||||
|
||||
//determine menu behavior
|
||||
$menu_style = $_SESSION['theme']['menu_style']['text'] != '' ? $_SESSION['theme']['menu_style']['text'] : 'fixed';
|
||||
switch ($menu_style) {
|
||||
case 'inline':
|
||||
$menu_type = 'default';
|
||||
$menu_width = 'calc(100% - 20px)';
|
||||
$menu_brand = false;
|
||||
$menu_corners = null;
|
||||
break;
|
||||
case 'static':
|
||||
$menu_type = 'static-top';
|
||||
$menu_width = 'calc(100% - 40px)';
|
||||
$menu_brand = true;
|
||||
$menu_corners = "style='-webkit-border-radius: 0 0 4px 4px; -moz-border-radius: 0 0 4px 4px; border-radius: 0 0 4px 4px;'";
|
||||
break;
|
||||
case 'fixed':
|
||||
default:
|
||||
$menu_type = 'fixed-'.($_SESSION['theme']['menu_position']['text'] != '' ? $_SESSION['theme']['menu_position']['text'] : 'top');
|
||||
if (!http_user_agent('mobile')) {
|
||||
$menu_width = $_SESSION['theme']['menu_width_fixed']['text'] != '' ? $_SESSION['theme']['menu_width_fixed']['text'] : 'calc(90% - 20px)';
|
||||
}
|
||||
$menu_brand = true;
|
||||
$menu_corners = null;
|
||||
}
|
||||
|
||||
//begin navbar code
|
||||
$html = "<nav class='navbar navbar-expand-sm ".$menu_type."' ".$menu_corners.">\n";
|
||||
$html .= " <div class='container-fluid' style='width: ".$menu_width."; padding: 0;'>\n";
|
||||
$html .= " <div class='navbar-brand'>\n";
|
||||
|
||||
if ($menu_brand) {
|
||||
//define menu brand mark
|
||||
$menu_brand_text = ($_SESSION['theme']['menu_brand_text']['text'] != '') ? escape($_SESSION['theme']['menu_brand_text']['text']) : "FusionPBX";
|
||||
switch ($_SESSION['theme']['menu_brand_type']['text']) {
|
||||
case 'text':
|
||||
$html .= " <a class='navbar-brand-text' href='".PROJECT_PATH."/'>".$menu_brand_text."</a>\n";
|
||||
break;
|
||||
case 'image_text':
|
||||
$menu_brand_image = ($_SESSION['theme']['menu_brand_image']['text'] != '') ? escape($_SESSION['theme']['menu_brand_image']['text']) : PROJECT_PATH."/themes/default/images/logo.png";
|
||||
$html .= " <a href='".PROJECT_PATH."/'>";
|
||||
$html .= " <img id='menu_brand_image' class='navbar-logo' src='".$menu_brand_image."' title=\"".escape($menu_brand_text)."\">";
|
||||
if ($_SESSION['theme']['menu_brand_image_hover']['text'] != '') {
|
||||
$html .= "<img id='menu_brand_image_hover' class='navbar-logo' style='display: none;' src='".$_SESSION['theme']['menu_brand_image_hover']['text']."' title=\"".escape($menu_brand_text)."\">";
|
||||
}
|
||||
$html .= "</a>\n";
|
||||
$html .= " <a class='navbar-brand-text' href='".PROJECT_PATH."/'>".$menu_brand_text."</a>\n";
|
||||
break;
|
||||
case 'none':
|
||||
break;
|
||||
case 'image':
|
||||
default:
|
||||
$menu_brand_image = ($_SESSION['theme']['menu_brand_image']['text'] != '') ? escape($_SESSION['theme']['menu_brand_image']['text']) : PROJECT_PATH."/themes/default/images/logo.png";
|
||||
$html .= " <a href='".PROJECT_PATH."/'>";
|
||||
$html .= " <img id='menu_brand_image' class='navbar-logo' src='".$menu_brand_image."' title=\"".escape($menu_brand_text)."\">";
|
||||
if (isset($_SESSION['theme']['menu_brand_image_hover']['text']) && $_SESSION['theme']['menu_brand_image_hover']['text'] != '') {
|
||||
$html .= "<img id='menu_brand_image_hover' class='navbar-logo' style='display: none;' src='".$_SESSION['theme']['menu_brand_image_hover']['text']."' title=\"".escape($menu_brand_text)."\">";
|
||||
}
|
||||
$html .= "</a>\n";
|
||||
$html .= " <a style='margin: 0;'></a>\n";
|
||||
}
|
||||
}
|
||||
|
||||
$html .= " </div>\n";
|
||||
|
||||
$html .= " <button type='button' class='navbar-toggler' data-toggle='collapse' data-target='#main_navbar' aria-expanded='false' aria-controls='main_navbar' aria-label='Toggle Menu'>\n";
|
||||
$html .= " <span class='fas fa-bars'></span>\n";
|
||||
$html .= " </button>\n";
|
||||
|
||||
$html .= " <div class='collapse navbar-collapse' id='main_navbar'>\n";
|
||||
$html .= " <ul class='navbar-nav'>\n";
|
||||
|
||||
if (is_array($menu_array) && sizeof($menu_array) != 0) {
|
||||
foreach ($menu_array as $index_main => $menu_parent) {
|
||||
$mod_li = "nav-item";
|
||||
$mod_a_1 = "";
|
||||
$submenu = false;
|
||||
if (is_array($menu_parent['menu_items']) && sizeof($menu_parent['menu_items']) > 0) {
|
||||
$mod_li = "nav-item dropdown ";
|
||||
$mod_a_1 = "data-toggle='dropdown' ";
|
||||
$submenu = true;
|
||||
}
|
||||
$mod_a_2 = ($menu_parent['menu_item_link'] != '' && !$submenu) ? $menu_parent['menu_item_link'] : '#';
|
||||
$mod_a_3 = ($menu_parent['menu_item_category'] == 'external') ? "target='_blank' " : null;
|
||||
if (isset($_SESSION['theme']['menu_main_icons']['boolean']) && $_SESSION['theme']['menu_main_icons']['boolean'] == 'true') {
|
||||
if ($menu_parent['menu_item_icon'] != '' && substr_count($menu_parent['menu_item_icon'], 'fa-') > 0) {
|
||||
$menu_main_icon = "<span class='fas ".$menu_parent['menu_item_icon']."' title=\"".escape($menu_parent['menu_language_title'])."\"></span>\n";
|
||||
}
|
||||
else {
|
||||
$menu_main_icon = null;
|
||||
}
|
||||
$menu_main_item = "<span class='d-sm-none d-md-none d-lg-inline' style='margin-left: 5px;'>".$menu_parent['menu_language_title']."</span>\n";
|
||||
}
|
||||
else {
|
||||
$menu_main_item = $menu_parent['menu_language_title'];
|
||||
}
|
||||
$html .= " <li class='".$mod_li."'>\n";
|
||||
$html .= " <a class='nav-link' ".$mod_a_1." href='".$mod_a_2."' ".$mod_a_3.">\n";
|
||||
$html .= " ".$menu_main_icon.$menu_main_item;
|
||||
$html .= " </a>\n";
|
||||
if ($submenu) {
|
||||
$html .= " <ul class='dropdown-menu'>\n";
|
||||
foreach ($menu_parent['menu_items'] as $index_sub => $menu_sub) {
|
||||
$mod_a_2 = $menu_sub['menu_item_link'];
|
||||
if ($mod_a_2 == '') {
|
||||
$mod_a_2 = '#';
|
||||
}
|
||||
$mod_a_3 = ($menu_sub['menu_item_category'] == 'external') ? "target='_blank' " : null;
|
||||
if ($_SESSION['theme']['menu_sub_icons']['boolean'] != 'false') {
|
||||
if ($menu_sub['menu_item_icon'] != '' && substr_count($menu_sub['menu_item_icon'], 'fa-') > 0) {
|
||||
$menu_sub_icon = "<span class='fas ".escape($menu_sub['menu_item_icon'])."'></span>";
|
||||
}
|
||||
else {
|
||||
$menu_sub_icon = null;
|
||||
}
|
||||
}
|
||||
$html .= " <li class='nav-item'><a class='nav-link' href='".$mod_a_2."' ".$mod_a_3.">".($_SESSION['theme']['menu_sub_icons'] ? "<span class='fas fa-bar d-inline-block d-sm-none float-left' style='margin: 4px 10px 0 25px;'></span>" : null).escape($menu_sub['menu_language_title']).$menu_sub_icon."</a></li>\n";
|
||||
}
|
||||
$html .= " </ul>\n";
|
||||
}
|
||||
$html .= " </li>\n";
|
||||
}
|
||||
}
|
||||
$html .= " </ul>\n";
|
||||
|
||||
$html .= " <ul class='navbar-nav ml-auto'>\n";
|
||||
//domain name/selector
|
||||
if (isset($_SESSION['username']) && $_SESSION['username'] != '' && permission_exists('domain_select') && count($_SESSION['domains']) > 1 && $_SESSION['theme']['domain_visible']['text'] == 'true') {
|
||||
$html .= " <li class='nav-item'>\n";
|
||||
$html .= " <a class='nav-link domain_selector_domain' href='#' title='".$this->text['theme-label-open_selector']."'>".escape($_SESSION['domain_name'])."</a>";
|
||||
$html .= " </li>\n";
|
||||
}
|
||||
//logout icon
|
||||
if (isset($_SESSION['username']) && $_SESSION['username'] != '' && $_SESSION['theme']['logout_icon_visible']['text'] == "true") {
|
||||
$username_full = $_SESSION['username'].((count($_SESSION['domains']) > 1) ? "@".$_SESSION["user_context"] : null);
|
||||
$html .= " <li class='nav-item'>\n";
|
||||
$html .= " <a class='nav-link logout_icon' href='".PROJECT_PATH."/logout.php' title=\"".$text['theme-label-logout']."\" onclick=\"return confirm('".$this->text['theme-confirm-logout']."')\"><span class='fas fa-sign-out-alt'></span></a>";
|
||||
$html .= " </li>\n";
|
||||
unset($username_full);
|
||||
}
|
||||
$html .= " </ul>\n";
|
||||
|
||||
$html .= " </div>\n";
|
||||
$html .= " </div>\n";
|
||||
$html .= "</nav>\n";
|
||||
|
||||
return $html;
|
||||
unset($html);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* build the vertical side menu html
|
||||
*/
|
||||
public function menu_vertical($menu_array) {
|
||||
|
||||
//menu brand image and/or text
|
||||
if ($_SESSION['theme']['menu_brand_type']['text'] == 'none') {
|
||||
$html = " <div style='height: 75px;'>\n";
|
||||
$html .= "<a class='menu_side_item_main menu_side_contract' onclick='menu_side_contract();' style='display: none;'><i class='fas fa-chevron-left' style='z-index: 99800; padding-left: 3px;'></i></a>";
|
||||
$html .= "<a class='menu_side_item_main menu_side_expand' onclick='menu_side_expand();'><i class='fas fa-bars' style='z-index: 99800; padding-left: 3px;'></i></a>";
|
||||
$html .= "</div>\n";
|
||||
}
|
||||
else {
|
||||
$html = " <div id='menu_side_brand_container'>\n";
|
||||
//menu toggle buttons
|
||||
if ($_SESSION['theme']['menu_brand_type']['text'] != 'none') {
|
||||
$html .= " <div style='float: right; margin-right: -20px; margin-top: -20px;'>\n";
|
||||
$html .= " <a class='menu_side_item_main menu_side_contract' onclick='menu_side_contract();' style='display: none;'><i class='fas fa-chevron-left'></i></a>\n";
|
||||
$html .= " </div>\n";
|
||||
}
|
||||
//show the menu brand image and/or text
|
||||
$menu_brand_image_contracted = $_SESSION['theme']['menu_side_brand_image_contracted']['text'] != '' ? $_SESSION['theme']['menu_side_brand_image_contracted']['text'] : PROJECT_PATH."/themes/default/images/logo_side_contracted.png";
|
||||
$menu_brand_image_expanded = $_SESSION['theme']['menu_side_brand_image_expanded']['text'] != '' ? $_SESSION['theme']['menu_side_brand_image_expanded']['text'] : PROJECT_PATH."/themes/default/images/logo_side_expanded.png";
|
||||
$menu_brand_text = ($_SESSION['theme']['menu_brand_text']['text'] != '') ? escape($_SESSION['theme']['menu_brand_text']['text']) : "FusionPBX";
|
||||
if ($_SESSION['theme']['menu_brand_type']['text'] == 'image' || $_SESSION['theme']['menu_brand_type']['text'] == '') {
|
||||
$html .= " <a href='".PROJECT_PATH."/' style='text-decoration: none;'>";
|
||||
$html .= "<img id='menu_brand_image_contracted' style='width: 20px; margin-left: -2px; margin-top: -5px;' src='".escape($menu_brand_image_contracted)."' title=\"".escape($menu_brand_text)."\">";
|
||||
$html .= "<img id='menu_brand_image_expanded' style='display: none;' src='".escape($menu_brand_image_expanded)."' title=\"".escape($menu_brand_text)."\">";
|
||||
$html .= "</a>\n";
|
||||
}
|
||||
else if ($_SESSION['theme']['menu_brand_type']['text'] == 'image_text') {
|
||||
$html .= " <a href='".PROJECT_PATH."/' style='text-decoration: none;'>";
|
||||
$html .= "<img id='menu_brand_image_contracted' style='width: 20px; margin-left: -2px; margin-top: -5px;' src='".escape($menu_brand_image_contracted)."' title=\"".escape($menu_brand_text)."\">";
|
||||
$html .= "<span class='menu_brand_text' style='display: none;'>".$menu_brand_text."</span>";
|
||||
$html .= "</a>\n";
|
||||
}
|
||||
else if ($_SESSION['theme']['menu_brand_type']['text'] == 'text') {
|
||||
$html .= " <a class='menu_brand_text' style='display: none;' href='".PROJECT_PATH."/'>".$menu_brand_text."</a>\n";
|
||||
}
|
||||
$html .= " </div>\n";
|
||||
}
|
||||
//main menu items
|
||||
if (is_array($menu_array) && sizeof($menu_array) != 0) {
|
||||
foreach ($menu_array as $menu_index_main => $menu_item_main) {
|
||||
$html .= " <a class='menu_side_item_main' ".($menu_item_main['menu_item_link'] != '' ? "href='".$menu_item_main['menu_item_link']."'" : "onclick=\"menu_side_expand(); $('#sub_".$menu_item_main['menu_item_uuid']."').slideToggle(180, function() { if (!$(this).is(':hidden')) { $('.menu_side_sub').not($(this)).slideUp(180); } });\"")." title=\"".$menu_item_main['menu_language_title']."\">";
|
||||
if ($menu_item_main['menu_item_icon'] != '') {
|
||||
$html .= "<i class='fas ".$menu_item_main['menu_item_icon']." fa-fw' style='z-index: 99800; margin-right: 8px;'></i>";
|
||||
}
|
||||
$html .= "<span class='menu_side_item_title' style='display: none;'>".$menu_item_main['menu_language_title']."</span>";
|
||||
$html .= "</a>\n";
|
||||
//sub menu items
|
||||
if (is_array($menu_item_main['menu_items']) && sizeof($menu_item_main['menu_items']) != 0) {
|
||||
$html .= " <div id='sub_".$menu_item_main['menu_item_uuid']."' class='menu_side_sub' style='display: none;'>\n";
|
||||
foreach ($menu_item_main['menu_items'] as $menu_index_sub => $menu_item_sub) {
|
||||
$html .= " <a class='menu_side_item_sub' ".($menu_item_sub['menu_item_category'] == 'external' ? "target='_blank'" : null)." href='".$menu_item_sub['menu_item_link']."'>";
|
||||
$html .= "<span class='menu_side_item_title' style='display: none;'>".$menu_item_sub['menu_language_title']."</span>";
|
||||
$html .= "</a>\n";
|
||||
}
|
||||
$html .= " </div>\n";
|
||||
}
|
||||
}
|
||||
$html .= " <div style='height: 100px;'></div>\n";
|
||||
}
|
||||
$html .= "</div>\n";
|
||||
$html .= "<div id='content_container' style='padding: 0; width: calc(100% - ".(is_numeric($_SESSION['theme']['menu_side_width_contracted']['text']) ? $_SESSION['theme']['menu_side_width_contracted']['text'] : '55')."px); float: right; padding-top: 0px; text-align: center;'>\n";
|
||||
$html .= " <div id='content_header'>\n";
|
||||
//header: left
|
||||
$html .= "<div class='float-left'>\n";
|
||||
$html .= "</div>\n";
|
||||
//header: right
|
||||
$html .= "<span class='float-right' style='white-space: nowrap;'>";
|
||||
//current user
|
||||
$html .= "<span style='display: inline-block; padding-right: 20px; font-size: 85%;'>\n";
|
||||
$html .= "<strong>".$this->text['theme-label-user']."</strong>: ";
|
||||
$html .= "<a href='".PROJECT_PATH."/core/users/user_edit.php?id=user'>".$_SESSION['username']."</a>";
|
||||
$html .= "</span>\n";
|
||||
//domain name/selector (sm+)
|
||||
if (isset($_SESSION['username']) && $_SESSION['username'] != '' && permission_exists('domain_select') && count($_SESSION['domains']) > 1 && $_SESSION['theme']['domain_visible']['text'] == 'true') {
|
||||
$html .= "<span style='display: inline-block; padding-right: 10px; font-size: 85%;'>\n";
|
||||
$html .= "<strong>".$this->text['theme-label-domain']."</strong>: ";
|
||||
$html .= "<a href='#' id='header_domain_selector_domain' title='".$this->text['theme-label-open_selector']."'>".escape($_SESSION['domain_name'])."</a>";
|
||||
$html .= "</span>\n";
|
||||
}
|
||||
//logout icon
|
||||
if (isset($_SESSION['username']) && $_SESSION['username'] != '' && $_SESSION['theme']['logout_icon_visible']['text'] == "true") {
|
||||
$html .= "<a id='header_logout_icon' href='".PROJECT_PATH."/logout.php' title=\"".$this->text['theme-label-logout']."\" onclick=\"return confirm('".$this->text['theme-confirm-logout']."')\"><span class='fas fa-log-out'></span></a>";
|
||||
}
|
||||
$html .= "</span>";
|
||||
$html .= " </div>\n";
|
||||
|
||||
return $html;
|
||||
unset($html);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2019
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2020
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
*/
|
||||
|
||||
//includes
|
||||
include "root.php";
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
|
||||
//set variables if not set
|
||||
|
|
@ -68,49 +68,173 @@
|
|||
}
|
||||
}
|
||||
|
||||
//get the template
|
||||
ob_start();
|
||||
include($_SESSION["template_full_path"]);
|
||||
$template = ob_get_contents(); //get the output from the buffer
|
||||
ob_end_clean(); //clean the buffer
|
||||
|
||||
//prepare the template to display the output
|
||||
$custom_head = '';
|
||||
/************************************************************************************************************************************************
|
||||
* new template
|
||||
*/
|
||||
|
||||
if (isset($_SESSION["theme"]["title"]["text"])) {
|
||||
if (strlen($_SESSION["theme"]["title"]["text"]) > 0) {
|
||||
$document_title = (($document["title"] != '') ? $document["title"]." - " : null).$_SESSION["theme"]["title"]["text"];
|
||||
}
|
||||
else {
|
||||
$document_title = (($document["title"] != '') ? $document["title"]." " : null);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (isset($_SESSION["software_name"])) {
|
||||
$document_title = (($document["title"] != '') ? $document["title"]." - " : null).$_SESSION["software_name"];
|
||||
}
|
||||
else {
|
||||
$document_title = (($document["title"] != '') ? $document["title"]." " : null);
|
||||
}
|
||||
}
|
||||
$output = str_replace ("<!--{title}-->", $document_title, $template); //<!--{title}--> defined in each individual page
|
||||
$output = str_replace ("<!--{head}-->", $custom_head, $output); //<!--{head}--> defined in each individual page
|
||||
if (strlen($v_menu) > 0) {
|
||||
$output = str_replace ("<!--{menu}-->", $v_menu, $output); //defined in /resources/menu.php
|
||||
}
|
||||
else {
|
||||
$output = str_replace ("<!--{menu}-->", $_SESSION["menu"], $output); //defined in /resources/menu.php
|
||||
}
|
||||
$output = str_replace ("<!--{project_path}-->", PROJECT_PATH, $output); //defined in /resources/menu.php
|
||||
//initialize a template object
|
||||
$view = new template();
|
||||
$view->engine = 'smarty';
|
||||
$view->template_dir = $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH.'/themes/'.$_SESSION['domain']['template']['name'].'/';
|
||||
$view->cache_dir = $_SESSION['server']['temp']['dir'];
|
||||
$view->init();
|
||||
|
||||
$pos = strrpos($output, "<!--{body}-->");
|
||||
if ($pos === false) {
|
||||
$output = $body; //if tag not found just show the body
|
||||
}
|
||||
else {
|
||||
//replace the body
|
||||
$output = str_replace ("<!--{body}-->", $body, $output);
|
||||
}
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text_default = $language->get();
|
||||
$text_application = $language->get(null,'themes/default');
|
||||
$text = array_merge($text_default, $text_application);
|
||||
|
||||
//set template variables
|
||||
|
||||
//add translations
|
||||
foreach($text as $key => $value) {
|
||||
$array[str_replace('-', '_', $key)] = $value;
|
||||
}
|
||||
$view->assign('text', $array);
|
||||
//project path
|
||||
$view->assign('project_path', PROJECT_PATH);
|
||||
//domain menu
|
||||
$view->assign('domain_menu', escape($_SESSION['domain']['menu']['uuid']));
|
||||
//theme settings
|
||||
if (is_array($_SESSION['theme']) && @sizeof($_SESSION['theme']) != 0) {
|
||||
//load into array
|
||||
foreach ($_SESSION['theme'] as $subcategory => $setting) {
|
||||
if (isset($setting['text']) && $setting['text'] != '') {
|
||||
$settings['theme'][$subcategory] = escape($setting['text']);
|
||||
}
|
||||
else if (isset($setting['boolean'])) {
|
||||
$settings['theme'][$subcategory] = $setting['boolean'] == 'true' ? true : false;
|
||||
}
|
||||
else {
|
||||
$settings['theme'][$subcategory] = escape($setting);
|
||||
}
|
||||
}
|
||||
//pre-process some settings
|
||||
$settings['theme']['favicon'] = $settings['theme']['favicon'] != '' ? urlencode($settings['theme']['favicon']) : PROJECT_PATH.'/themes/default/favicon.ico';
|
||||
$settings['theme']['font_loader_version'] = $settings['theme']['font_loader_version'] != '' ? urlencode($settings['theme']['font_loader_version']) : '1';
|
||||
$settings['theme']['message_delay'] = is_numeric($settings['theme']['message_delay']) ? 1000 * (float) $settings['theme']['message_delay'] : 3000;
|
||||
$settings['theme']['menu_side_width_contracted'] = is_numeric($settings['theme']['menu_side_width_contracted']) ? $settings['theme']['menu_side_width_contracted'] : '60';
|
||||
$settings['theme']['menu_side_width_expanded'] = is_numeric($settings['theme']['menu_side_width_expanded']) ? $settings['theme']['menu_side_width_expanded'] : '225';
|
||||
$settings['theme']['menu_style'] = $settings['theme']['menu_style'] != '' ? $settings['theme']['menu_style'] : 'fixed';
|
||||
$settings['theme']['menu_position'] = $settings['theme']['menu_position'] != '' ? $settings['theme']['menu_position'] : 'top';
|
||||
$settings['theme']['footer'] = $settings['theme']['footer'] != '' ? $settings['theme']['footer'] : '© '.$text['theme-label-copyright'].' 2008 - '.date('Y')." <a href='http://www.fusionpbx.com' class='footer' target='_blank'>fusionpbx.com</a> ".$text['theme-label-all_rights_reserved'];
|
||||
$view->assign('settings', $settings);
|
||||
}
|
||||
//document title
|
||||
if (isset($_SESSION['theme']['title']['text']) && $_SESSION['theme']['title']['text'] != '') {
|
||||
$document_title = $_SESSION['theme']['title']['text'];
|
||||
}
|
||||
else if (isset($_SESSION['software_name'])) {
|
||||
$document_title = $_SESSION['software_name'];
|
||||
}
|
||||
$document_title = ($document['title'] != '' ? $document['title'].' - ' : null).$document_title;
|
||||
$view->assign('document_title', $document_title);
|
||||
//domain selector control
|
||||
$domain_selector_enabled = permission_exists('domain_select') && count($_SESSION['domains']) > 1 ? true : false;
|
||||
$view->assign('domain_selector_enabled', $domain_selector_enabled);
|
||||
//browser name
|
||||
$user_agent = http_user_agent();
|
||||
$browser_version = $user_agent['version'];
|
||||
$view->assign('browser_name', $user_agent['name']);
|
||||
$view->assign('browser_name_short', $user_agent['name_short']);
|
||||
//login state
|
||||
$authenticated = isset($_SESSION['username']) && $_SESSION['username'] != '' ? true : false;
|
||||
$view->assign('authenticated', $authenticated);
|
||||
//domains application path
|
||||
$view->assign('domains_app_path', PROJECT_PATH.(file_exists($_SERVER['DOCUMENT_ROOT'].'/app/domains/domains.php') ? '/app/domains/domains.php' : '/core/domains/domains.php'));
|
||||
//domain count
|
||||
$view->assign('domain_count', is_array($_SESSION['domains']) ? sizeof($_SESSION['domains']) : 0);
|
||||
//domain selector row background colors
|
||||
$view->assign('domain_selector_background_color_1', $_SESSION['theme']['domain_inactive_background_color'][0] != '' ? $_SESSION['theme']['domain_inactive_background_color'][0] : '#eaedf2');
|
||||
$view->assign('domain_selector_background_color_2', $_SESSION['theme']['domain_inactive_background_color'][1] != '' ? $_SESSION['theme']['domain_inactive_background_color'][1] : '#ffffff');
|
||||
//domain list
|
||||
$view->assign('domains', $_SESSION['domains']);
|
||||
//domain uuid
|
||||
$view->assign('domain_uuid', $_SESSION['domain_uuid']);
|
||||
//menu container
|
||||
//load menu array into the session
|
||||
if (!isset($_SESSION['menu']['array'])) {
|
||||
$menu = new menu;
|
||||
$menu->menu_uuid = $_SESSION['domain']['menu']['uuid'];
|
||||
$_SESSION['menu']['array'] = $menu->menu_array();
|
||||
unset($menu);
|
||||
}
|
||||
//build menu by style
|
||||
switch ($_SESSION['theme']['menu_style']['text']) {
|
||||
case 'side':
|
||||
$container_open = "<div id='menu_side_container'>\n";
|
||||
$menu = new menu;
|
||||
$menu->text = $text;
|
||||
$menu_html = $menu->menu_vertical($_SESSION['menu']['array']);
|
||||
unset($menu);
|
||||
break;
|
||||
case 'inline':
|
||||
$container_open = "<div class='container-fluid' style='padding: 0;' align='".($_SESSION['theme']['logo_align']['text'] != '' ? $_SESSION['theme']['logo_align']['text'] : 'left')."'>\n";
|
||||
if ($_SERVER['PHP_SELF'] != PROJECT_PATH.'/core/install/install.php') {
|
||||
$logo = "<a href='".PROJECT_PATH."/'><img src='".($_SESSION['theme']['logo']['text'] ?: PROJECT_PATH.'/themes/default/images/logo.png')."' style='padding: 15px 20px; ".($_SESSION['theme']['logo_style']['text'] ?: null)."'></a>";
|
||||
}
|
||||
$menu = new menu;
|
||||
$menu->text = $text;
|
||||
$menu_html = $menu->menu_horizontal($_SESSION['menu']['array']);
|
||||
unset($menu);
|
||||
break;
|
||||
case 'static':
|
||||
$container_open = "<div class='container-fluid' style='padding: 0;' align='center'>\n";
|
||||
$menu = new menu;
|
||||
$menu->text = $text;
|
||||
$menu_html = $menu->menu_horizontal($_SESSION['menu']['array']);
|
||||
unset($menu);
|
||||
break;
|
||||
case 'fixed':
|
||||
default:
|
||||
$menu = new menu;
|
||||
$menu->text = $text;
|
||||
$menu_html = $menu->menu_horizontal($_SESSION['menu']['array']);
|
||||
unset($menu);
|
||||
$container_open = "<div class='container-fluid' style='padding: 0;' align='center'>\n";
|
||||
break;
|
||||
}
|
||||
$view->assign('logo', $logo);
|
||||
$view->assign('menu', $menu_html);
|
||||
$view->assign('container_open', $container_open);
|
||||
$view->assign('container_close', '</div>');
|
||||
$view->assign('document_body', $body);
|
||||
$view->assign('current_year', date('Y'));
|
||||
//login logo
|
||||
//determine logo source
|
||||
if (isset($_SESSION['theme']['logo_login']['text']) && $_SESSION['theme']['logo_login']['text'] != '') {
|
||||
$login_logo_source = $_SESSION['theme']['logo_login']['text'];
|
||||
}
|
||||
else if (isset($_SESSION['theme']['logo']['text']) && $_SESSION['theme']['logo']['text'] != '') {
|
||||
$login_logo_source = $_SESSION['theme']['logo']['text'];
|
||||
}
|
||||
else {
|
||||
$login_logo_source = PROJECT_PATH.'/themes/default/images/logo_login.png';
|
||||
}
|
||||
//determine logo dimensions
|
||||
if (isset($_SESSION['theme']['login_logo_width']['text']) && $_SESSION['theme']['login_logo_width']['text'] != '') {
|
||||
$login_logo_width = $_SESSION['theme']['login_logo_width']['text'];
|
||||
}
|
||||
else {
|
||||
$login_logo_width = 'auto; max-width: 300px';
|
||||
}
|
||||
if (isset($_SESSION['theme']['login_logo_height']['text']) && $_SESSION['theme']['login_logo_height']['text'] != '') {
|
||||
$login_logo_height = $_SESSION['theme']['login_logo_height']['text'];
|
||||
}
|
||||
else {
|
||||
$login_logo_height = 'auto; max-height: 300px';
|
||||
}
|
||||
$view->assign('login_logo_source', $login_logo_source);
|
||||
$view->assign('login_logo_width', $login_logo_width);
|
||||
$view->assign('login_logo_height', $login_logo_height);
|
||||
|
||||
//render the view
|
||||
$output = $view->render('template.php');
|
||||
|
||||
//unset background image
|
||||
unset($_SESSION['background_image']);
|
||||
|
||||
//send the output to the browser
|
||||
echo $output;
|
||||
|
|
@ -119,4 +243,4 @@
|
|||
//$statsauth = "a3az349x2bf3fdfa8dbt7x34fas5X";
|
||||
//require_once "stats/stat_sadd.php";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
@ -376,7 +376,6 @@
|
|||
}
|
||||
|
||||
//add the footer
|
||||
$default_login = true;
|
||||
include "resources/footer.php";
|
||||
|
||||
?>
|
||||
|
|
@ -67,9 +67,6 @@
|
|||
}
|
||||
$autoload = new auto_loader();
|
||||
|
||||
//define variable(s)
|
||||
$default_login = false; //used in the themes
|
||||
|
||||
//additional includes
|
||||
require_once "resources/php.php";
|
||||
require_once "resources/functions.php";
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
<?php
|
||||
include "root.php";
|
||||
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
|
||||
header("Content-type: text/css; charset: UTF-8");
|
||||
|
||||
$default_login = ($_REQUEST['login'] == 'default') ? true : false;
|
||||
|
||||
//parse fonts (add surrounding single quotes to each font name)
|
||||
if (is_array($_SESSION['theme']) && sizeof($_SESSION['theme']) > 0) {
|
||||
foreach ($_SESSION['theme'] as $subcategory => $type) {
|
||||
|
|
@ -34,7 +33,7 @@ $default_login = ($_REQUEST['login'] == 'default') ? true : false;
|
|||
|
||||
//determine which background image/color settings to use (login or standard)
|
||||
$background_images_enabled = false;
|
||||
if ($default_login) {
|
||||
if (isset($_SESSION['username']) && $_SESSION['username'] != '') {
|
||||
//try using login background images/colors
|
||||
if (isset($_SESSION['theme']) && $_SESSION['theme']['login_background_image_enabled']['boolean'] == 'true' && is_array($_SESSION['theme']['login_background_image'])) {
|
||||
$background_images_enabled = true;
|
||||
|
|
@ -1092,8 +1091,7 @@ $default_login = ($_REQUEST['login'] == 'default') ? true : false;
|
|||
width: 100%;
|
||||
<?php
|
||||
if (
|
||||
(strlen($_SESSION["username"]) > 0 || !$default_login)
|
||||
&&
|
||||
isset($_SESSION['username']) && $_SESSION['username'] != '' &&
|
||||
(isset($background_images) || $background_colors[0] != '' || $background_colors[1] != '')
|
||||
) { ?>
|
||||
background: <?php echo ($_SESSION['theme']['body_color']['text'] != '') ? $_SESSION['theme']['body_color']['text'] : "#ffffff"; ?>;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue