template.php 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992
  1. <?php
  2. //get the browser version
  3. $user_agent = http_user_agent();
  4. $browser_version = $user_agent['version'];
  5. $browser_name = $user_agent['name'];
  6. $browser_version_array = explode('.', $browser_version);
  7. //set the doctype
  8. echo ($browser_name != "Internet Explorer") ? "<!DOCTYPE html>\n" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
  9. //get the php self path and set a variable with only the directory path
  10. $php_self_array = explode ("/", $_SERVER['PHP_SELF']);
  11. $php_self_dir = '';
  12. foreach ($php_self_array as &$value) {
  13. if (substr($value, -4) != ".php") {
  14. $php_self_dir .= $value."/";
  15. }
  16. }
  17. unset($php_self_array);
  18. if (strlen(PROJECT_PATH) > 0) {
  19. $php_self_dir = substr($php_self_dir, strlen(PROJECT_PATH), strlen($php_self_dir));
  20. }
  21. echo "<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>\n";
  22. echo "<head>\n";
  23. echo "<meta charset='utf-8'>\n";
  24. echo "<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>\n";
  25. echo "<meta http-equiv='X-UA-Compatible' content='IE=edge'>\n";
  26. echo "<meta name='viewport' content='width=device-width, initial-scale=1'>\n";
  27. echo "<link rel='stylesheet' type='text/css' href='<!--{project_path}-->/resources/bootstrap/css/bootstrap.min.css'>\n";
  28. echo "<link rel='stylesheet' type='text/css' href='<!--{project_path}-->/resources/bootstrap/css/bootstrap-tempusdominus.css'>\n";
  29. echo "<link rel='stylesheet' type='text/css' href='<!--{project_path}-->/resources/bootstrap/css/bootstrap-colorpicker.min.css'>\n";
  30. echo "<link rel='stylesheet' type='text/css' href='<!--{project_path}-->/themes/".escape($_SESSION['domain']['template']['name'])."/css.php".($default_login ? '?login=default' : null)."'>\n";
  31. echo "<link rel='stylesheet' type='text/css' href='<!--{project_path}-->/resources/fontawesome/css/all.css'>\n";
  32. //link to custom css file
  33. if ($_SESSION['theme']['custom_css']['text'] != '') {
  34. echo "<link rel='stylesheet' type='text/css' href='".$_SESSION['theme']['custom_css']['text']."'>\n\n";
  35. }
  36. //output custom css
  37. if ($_SESSION['theme']['custom_css_code']['text'] != '') {
  38. echo "<style>\n";
  39. echo $_SESSION['theme']['custom_css_code']['text'];
  40. echo "</style>\n\n";
  41. }
  42. //set fav icon
  43. $favicon = (isset($_SESSION['theme']['favicon']['text'])) ? $_SESSION['theme']['favicon']['text'] : '<!--{project_path}-->/themes/default/favicon.ico';
  44. echo "<link rel='icon' href='".$favicon."'>\n";
  45. echo "<title><!--{title}--></title>\n";
  46. echo "<script language='JavaScript' type='text/javascript' src='<!--{project_path}-->/resources/jquery/jquery-3.4.1.min.js'></script>\n";
  47. echo "<script language='JavaScript' type='text/javascript' src='<!--{project_path}-->/resources/jquery/jquery.autosize.input.js'></script>\n";
  48. echo "<script language='JavaScript' type='text/javascript' src='<!--{project_path}-->/resources/momentjs/moment-with-locales.min.js'></script>\n";
  49. echo "<script language='JavaScript' type='text/javascript' src='<!--{project_path}-->/resources/bootstrap/js/bootstrap.min.js'></script>\n";
  50. echo "<script language='JavaScript' type='text/javascript' src='<!--{project_path}-->/resources/bootstrap/js/bootstrap-tempusdominus.min.js'></script>\n";
  51. echo "<script language='JavaScript' type='text/javascript' src='<!--{project_path}-->/resources/bootstrap/js/bootstrap-colorpicker.js'></script>\n";
  52. echo "<script language='JavaScript' type='text/javascript' src='<!--{project_path}-->/resources/bootstrap/js/bootstrap-pwstrength.min.js'></script>\n";
  53. echo "<script language='JavaScript' type='text/javascript'>window.FontAwesomeConfig = { autoReplaceSvg: false }</script>\n";
  54. echo "<script language='JavaScript' type='text/javascript' src='<!--{project_path}-->/resources/fontawesome/js/all.js' defer></script>\n";
  55. //web font loader
  56. if ($_SESSION['theme']['font_loader']['text'] == 'true') {
  57. if ($_SESSION['theme']['font_retrieval']['text'] != 'asynchronous') {
  58. $font_loader_version = ($_SESSION['theme']['font_loader_version']['text'] != '') ? escape($_SESSION['theme']['font_loader_version']['text']) : 1;
  59. echo "<script language='JavaScript' type='text/javascript' src='//ajax.googleapis.com/ajax/libs/webfont/".escape($font_loader_version)."/webfont.js'></script>\n";
  60. }
  61. echo "<script language='JavaScript' type='text/javascript' src='<!--{project_path}-->/resources/fonts/web_font_loader.php?v=".escape($font_loader_version)."'></script>\n";
  62. }
  63. ?>
  64. <script language="JavaScript" type="text/javascript">
  65. //display message bar via js
  66. function display_message(msg, mood, delay) {
  67. mood = (typeof mood !== 'undefined') ? mood : 'default';
  68. delay = (typeof delay !== 'undefined') ? delay : <?php echo (1000 * (float) $_SESSION['theme']['message_delay']['text']); ?>;
  69. if (msg !== '') {
  70. var message_text = $(document.createElement('div'));
  71. message_text.addClass('message_text message_mood_'+mood);
  72. message_text.html(msg);
  73. message_text.on('click', function() {
  74. var object = $(this);
  75. object.clearQueue().finish();
  76. $("#message_container div").remove();
  77. $("#message_container").css({opacity: 0, 'height': 0}).css({'height': 'auto'});
  78. } );
  79. $("#message_container").append(message_text);
  80. message_text.css({'height': 'auto'}).animate({opacity: 1}, 250, function(){
  81. $("#message_container").delay(delay).animate({opacity: 0, 'height': 0}, 500, function() {
  82. $("#message_container div").remove();
  83. $("#message_container").animate({opacity: 1}, 300).css({'height': 'auto'});
  84. });
  85. });
  86. }
  87. }
  88. <?php if ($_SESSION['theme']['menu_style']['text'] == 'side') { ?>
  89. //toggle side menu visibility (if enabled)
  90. var menu_side_state = 'contracted';
  91. function menu_side_contract() {
  92. $('.menu_side_sub').slideUp(180);
  93. $('.menu_side_item_title').hide();
  94. <?php if ($_SESSION['theme']['menu_brand_type']['text'] == 'image' || $_SESSION['theme']['menu_brand_type']['text'] == '') { ?>
  95. $('#menu_brand_image_expanded').fadeOut(180, function() {
  96. $('#menu_brand_image_contracted').fadeIn(180);
  97. });
  98. <?php } else if ($_SESSION['theme']['menu_brand_type']['text'] == 'image_text') { ?>
  99. $('.menu_brand_text').hide();
  100. $('#menu_brand_image_contracted').animate({ width: '20px', 'margin-left': '-2px' }, 250);
  101. <?php } else if ($_SESSION['theme']['menu_brand_type']['text'] == 'text') { ?>
  102. $('.menu_brand_text').fadeOut(180);
  103. <?php } ?>
  104. $('#menu_side_container').animate({ width: '<?php echo is_numeric($_SESSION['theme']['menu_side_width_contracted']['text']) ? $_SESSION['theme']['menu_side_width_contracted']['text'] : '60'; ?>px' }, 250);
  105. $('#content_container').animate({ width: $(window).width() - <?php echo is_numeric($_SESSION['theme']['menu_side_width_contracted']['text']) ? $_SESSION['theme']['menu_side_width_contracted']['text'] : '60'; ?> }, 250, function() {
  106. menu_side_state = 'contracted';
  107. });
  108. $('.menu_side_contract').hide();
  109. $('.menu_side_expand').show();
  110. }
  111. function menu_side_expand() {
  112. <?php if ($_SESSION['theme']['menu_brand_type']['text'] == 'image_text') { ?>
  113. $('#menu_brand_image_contracted').animate({ width: '30px', 'margin-left': '0' }, 250);
  114. <?php } else if ($_SESSION['theme']['menu_brand_type']['text'] == 'image' || $_SESSION['theme']['menu_brand_type']['text'] == '') { ?>
  115. $('#menu_brand_image_contracted').fadeOut(180);
  116. <?php } ?>
  117. $('#menu_side_container').animate({ width: '<?php echo is_numeric($_SESSION['theme']['menu_side_width_expanded']['text']) ? $_SESSION['theme']['menu_side_width_expanded']['text'] : '225'; ?>px' }, 250);
  118. $('#content_container').animate({ width: $(window).width() - <?php echo is_numeric($_SESSION['theme']['menu_side_width_expanded']['text']) ? $_SESSION['theme']['menu_side_width_expanded']['text'] : '225'; ?> }, 250, function() {
  119. $('.menu_brand_text').fadeIn(180);
  120. $('.menu_side_item_title').fadeIn(180);
  121. <?php if ($_SESSION['theme']['menu_brand_type']['text'] != 'none') { ?>
  122. $('.menu_side_contract').fadeIn(180);
  123. <?php } ?>
  124. <?php if ($_SESSION['theme']['menu_brand_type']['text'] == 'image' || $_SESSION['theme']['menu_brand_type']['text'] == '') { ?>
  125. $('#menu_brand_image_expanded').fadeIn(180);
  126. <?php } ?>
  127. menu_side_state = 'expanded';
  128. });
  129. <?php if ($_SESSION['theme']['menu_brand_type']['text'] == 'none') { ?>
  130. $('.menu_side_contract').show();
  131. <?php } ?>
  132. $('.menu_side_expand').hide();
  133. }
  134. <?php } ?>
  135. $(document).ready(function() {
  136. <?php echo message::html(true, " "); ?>
  137. //hide message bar on hover
  138. $("#message_container").on('mouseenter',function() {
  139. $("#message_container div").remove();
  140. $("#message_container").css({opacity: 0, 'height': 0}).css({'height': 'auto'});
  141. });
  142. <?php
  143. if (permission_exists("domain_select") && count($_SESSION['domains']) > 1) {
  144. ?>
  145. //domain selector controls
  146. $(".domain_selector_domain").on('click', function() { show_domains(); });
  147. $("#header_domain_selector_domain").on('click', function() { show_domains(); });
  148. $("#domains_hide").on('click', function() { hide_domains(); });
  149. function show_domains() {
  150. $('#domains_visible').val(1);
  151. var scrollbar_width = (window.innerWidth - $(window).width()); //gold: only solution that worked with body { overflow:auto } (add -ms-overflow-style: scrollbar; to <body> style for ie 10+)
  152. if (scrollbar_width > 0) {
  153. $("body").css({'margin-right':scrollbar_width, 'overflow':'hidden'}); //disable body scroll bars
  154. $(".navbar").css('margin-right',scrollbar_width); //adjust navbar margin to compensate
  155. $("#domains_container").css('right',-scrollbar_width); //domain container right position to compensate
  156. }
  157. $(document).scrollTop(0);
  158. $("#domains_container").show();
  159. $("#domains_block").animate({marginRight: '+=300'}, 400, function() {
  160. $("#domain_filter").trigger('focus');
  161. });
  162. }
  163. function hide_domains() {
  164. $('#domains_visible').val(0);
  165. $(document).ready(function() {
  166. $("#domains_block").animate({marginRight: '-=300'}, 400, function() {
  167. $("#domain_filter").val('');
  168. domain_search($("#domain_filter").val());
  169. $(".navbar").css('margin-right','0'); //restore navbar margin
  170. $("#domains_container").css('right','0'); //domain container right position
  171. $("#domains_container").hide();
  172. $("body").css({'margin-right':'0','overflow':'auto'}); //enable body scroll bars
  173. });
  174. });
  175. }
  176. <?php
  177. key_press('escape', 'up', 'document', null, null, "if ($('#domains_visible').val() == 0) { show_domains(); } else { hide_domains(); }", false);
  178. }
  179. ?>
  180. //link table rows (except the last - the list_control_icons cell) on a table with a class of 'tr_hover', according to the href attribute of the <tr> tag
  181. $('.tr_hover tr,.list tr').each(function(i,e) {
  182. $(e).children('td:not(.list_control_icon,.list_control_icons,.tr_link_void,.list-row > .no-link,.list-row > .checkbox,.list-row > .button,.list-row > .action-button)').on('click', function() {
  183. var href = $(this).closest("tr").attr("href");
  184. var target = $(this).closest('tr').attr('target');
  185. if (href) {
  186. if (target) { window.open(href, target); }
  187. else { window.location = href; }
  188. }
  189. });
  190. });
  191. //autosize jquery autosize plugin on applicable input fields
  192. $("input[type=text].txt.auto-size,input[type=number].txt.auto-size,input[type=password].txt.auto-size,input[type=text].formfld.auto-size,input[type=number].formfld.auto-size,input[type=password].formfld.auto-size").autosizeInput();
  193. //initialize bootstrap tempusdominus (calendar/datetime picker) plugin
  194. $(function() {
  195. //set defaults
  196. $.fn.datetimepicker.Constructor.Default = $.extend({}, $.fn.datetimepicker.Constructor.Default, {
  197. buttons: {
  198. showToday: true,
  199. showClear: true,
  200. showClose: true,
  201. },
  202. icons: {
  203. time: 'fas fa-clock',
  204. date: 'fas fa-calendar-alt',
  205. up: 'fas fa-arrow-up',
  206. down: 'fas fa-arrow-down',
  207. previous: 'fas fa-chevron-left',
  208. next: 'fas fa-chevron-right',
  209. today: 'fas fa-calendar-check',
  210. clear: 'fas fa-trash',
  211. close: 'fas fa-times',
  212. }
  213. });
  214. //define formatting of individual classes
  215. $('.datepicker').datetimepicker({ format: 'YYYY-MM-DD', });
  216. $('.datetimepicker').datetimepicker({ format: 'YYYY-MM-DD HH:mm', });
  217. $('.datetimesecpicker').datetimepicker({ format: 'YYYY-MM-DD HH:mm:ss', });
  218. });
  219. //apply bootstrap colorpicker plugin
  220. $(function(){
  221. $('.colorpicker').colorpicker({
  222. align: 'left',
  223. customClass: 'colorpicker-2x',
  224. sliders: {
  225. saturation: {
  226. maxLeft: 200,
  227. maxTop: 200
  228. },
  229. hue: {
  230. maxTop: 200
  231. },
  232. alpha: {
  233. maxTop: 200
  234. }
  235. }
  236. });
  237. });
  238. //apply bootstrap password strength plugin
  239. $('#password').pwstrength({
  240. common: {
  241. minChar: 8,
  242. usernameField: '#username',
  243. },
  244. /* rules: { }, */
  245. ui: {
  246. // very weak weak normal medium strong very strong
  247. colorClasses: ["danger", "warning", "warning", "warning", "success", "success"],
  248. progressBarMinPercentage: 15,
  249. showVerdicts: false,
  250. viewports: {
  251. progress: "#pwstrength_progress"
  252. }
  253. }
  254. });
  255. <?php if ($_SESSION['theme']['menu_brand_image']['text'] != '' && $_SESSION['theme']['menu_brand_image_hover']['text'] != '' && $_SESSION['theme']['menu_style']['text'] != 'side') { ?>
  256. //crossfade menu brand images (if hover version set)
  257. $(function(){
  258. $('#menu_brand_image').on('mouseover',function(){
  259. $(this).fadeOut('fast', function(){
  260. $('#menu_brand_image_hover').fadeIn('fast');
  261. });
  262. });
  263. $('#menu_brand_image_hover').on('mouseout',function(){
  264. $(this).fadeOut('fast', function(){
  265. $('#menu_brand_image').fadeIn('fast');
  266. });
  267. });
  268. });
  269. <?php } ?>
  270. //generate resizeEnd event after window resize event finishes (used when side menu and on messages app)
  271. $(window).on('resize', function() {
  272. if (this.resizeTO) { clearTimeout(this.resizeTO); }
  273. this.resizeTO = setTimeout(function() { $(this).trigger('resizeEnd'); }, 180);
  274. });
  275. <?php if ($_SESSION['theme']['menu_style']['text'] == 'side') { ?>
  276. //side menu: adjust content container width after window resize
  277. $(window).on('resizeEnd', function() {
  278. $('#content_container').animate({ width: $(window).width() - $('#menu_side_container').width() }, 200);
  279. });
  280. <?php } ?>
  281. });
  282. //audio playback functions
  283. var recording_audio;
  284. var audio_clock;
  285. function recording_play(recording_id) {
  286. if (document.getElementById('recording_progress_bar_'+recording_id)) {
  287. document.getElementById('recording_progress_bar_'+recording_id).style.display='';
  288. }
  289. recording_audio = document.getElementById('recording_audio_'+recording_id);
  290. if (recording_audio.paused) {
  291. recording_audio.volume = 1;
  292. recording_audio.play();
  293. document.getElementById('recording_button_'+recording_id).innerHTML = "<span class='<?php echo $_SESSION['theme']['button_icon_pause']['text']; ?> fa-fw'></span>";
  294. audio_clock = setInterval(function () { update_progress(recording_id); }, 20);
  295. $("[id*=recording_button]").not("[id*=recording_button_"+recording_id+"]").html("<span class='<?php echo $_SESSION['theme']['button_icon_play']['text']; ?> fa-fw'></span>");
  296. $("[id*=recording_progress_bar]").not("[id*=recording_progress_bar_"+recording_id+"]").css('display', 'none');
  297. $('audio').each(function(){$('#menu_side_container').width()
  298. if ($(this).get(0) != recording_audio) {
  299. $(this).get(0).pause(); // Stop playing
  300. $(this).get(0).currentTime = 0; // Reset time
  301. }
  302. });
  303. }
  304. else {
  305. recording_audio.pause();
  306. document.getElementById('recording_button_'+recording_id).innerHTML = "<span class='<?php echo $_SESSION['theme']['button_icon_play']['text']; ?> fa-fw'></span>";
  307. clearInterval(audio_clock);
  308. }
  309. }
  310. function recording_stop(recording_id) {
  311. recording_reset(recording_id);
  312. clearInterval(audio_clock);
  313. }
  314. function recording_reset(recording_id) {
  315. recording_audio = document.getElementById('recording_audio_'+recording_id);
  316. recording_audio.pause();
  317. recording_audio.currentTime = 0;
  318. if (document.getElementById('recording_progress_bar_'+recording_id)) {
  319. document.getElementById('recording_progress_bar_'+recording_id).style.display='none';
  320. }
  321. document.getElementById('recording_button_'+recording_id).innerHTML = "<span class='<?php echo $_SESSION['theme']['button_icon_play']['text']; ?> fa-fw'></span>";
  322. clearInterval(audio_clock);
  323. }
  324. function update_progress(recording_id) {
  325. recording_audio = document.getElementById('recording_audio_'+recording_id);
  326. var recording_progress = document.getElementById('recording_progress_'+recording_id);
  327. var value = 0;
  328. if (recording_audio.currentTime > 0) {
  329. value = (100 / recording_audio.duration) * recording_audio.currentTime;
  330. }
  331. recording_progress.style.marginLeft = value + "%";
  332. if (parseInt(recording_audio.duration) > 30) { //seconds
  333. clearInterval(audio_clock);
  334. }
  335. }
  336. //handle action bar style on scroll
  337. window.addEventListener('scroll', function(){
  338. action_bar_scroll('action_bar', 20);
  339. }, false);
  340. function action_bar_scroll(action_bar_id, scroll_position, function_sticky, function_inline) {
  341. if (document.getElementById(action_bar_id)) {
  342. //sticky
  343. if (this.scrollY > scroll_position) {
  344. document.getElementById(action_bar_id).classList.add('scroll');
  345. if (typeof function_sticky === 'function') { function_sticky(); }
  346. }
  347. //inline
  348. if (this.scrollY < scroll_position) {
  349. document.getElementById(action_bar_id).classList.remove('scroll');
  350. if (typeof function_inline === 'function') { function_inline(); }
  351. }
  352. }
  353. }
  354. //enable button class button
  355. function button_enable(button_id) {
  356. button = document.getElementById(button_id);
  357. button.disabled = false;
  358. button.classList.remove('disabled');
  359. if (button.parentElement.nodeName == 'A') {
  360. anchor = button.parentElement;
  361. anchor.classList.remove('disabled');
  362. anchor.setAttribute('onclick','');
  363. }
  364. }
  365. //disable button class button
  366. function button_disable(button_id) {
  367. button = document.getElementById(button_id);
  368. button.disabled = true;
  369. button.classList.add('disabled');
  370. if (button.parentElement.nodeName == 'A') {
  371. anchor = button.parentElement;
  372. anchor.classList.add('disabled');
  373. anchor.setAttribute('onclick','return false;');
  374. }
  375. }
  376. //list functions
  377. function list_all_toggle(modifier) {
  378. var checkboxes = (modifier !== undefined) ? document.getElementsByClassName('checkbox_'+modifier) : document.querySelectorAll("input[type='checkbox']");
  379. var checkbox_checked = document.getElementById('checkbox_all' + (modifier !== undefined ? '_'+modifier : '')).checked;
  380. for (var i = 0, max = checkboxes.length; i < max; i++) {
  381. checkboxes[i].checked = checkbox_checked;
  382. }
  383. if (document.getElementById('btn_check_all') && document.getElementById('btn_check_none')) {
  384. if (checkbox_checked) {
  385. document.getElementById('btn_check_all').style.display = 'none';
  386. document.getElementById('btn_check_none').style.display = '';
  387. }
  388. else {
  389. document.getElementById('btn_check_all').style.display = '';
  390. document.getElementById('btn_check_none').style.display = 'none';
  391. }
  392. }
  393. }
  394. function list_all_check() {
  395. var inputs = document.getElementsByTagName('input');
  396. document.getElementById('checkbox_all').checked;
  397. for (var i = 0, max = inputs.length; i < max; i++) {
  398. if (inputs[i].type === 'checkbox') {
  399. inputs[i].checked = true;
  400. }
  401. }
  402. }
  403. function list_self_check(checkbox_id) {
  404. var inputs = document.getElementsByTagName('input');
  405. for (var i = 0, max = inputs.length; i < max; i++) {
  406. if (inputs[i].type === 'checkbox') {
  407. inputs[i].checked = false;
  408. }
  409. }
  410. document.getElementById(checkbox_id).checked = true;
  411. }
  412. function list_action_set(action) {
  413. document.getElementById('action').value = action;
  414. }
  415. function list_form_submit(form_id) {
  416. document.getElementById(form_id).submit();
  417. }
  418. function list_search_reset() {
  419. document.getElementById('btn_reset').style.display = 'none';
  420. document.getElementById('btn_search').style.display = '';
  421. }
  422. function edit_all_toggle(modifier) {
  423. var checkboxes = document.getElementsByClassName('checkbox_'+modifier);
  424. var checkbox_checked = document.getElementById('checkbox_all_'+modifier).checked;
  425. if (checkboxes.length > 0) {
  426. for (var i = 0; i < checkboxes.length; ++i) {
  427. checkboxes[i].checked = checkbox_checked;
  428. }
  429. if (document.getElementById('btn_delete')) {
  430. document.getElementById('btn_delete').value = checkbox_checked ? '' : 'delete';
  431. }
  432. }
  433. }
  434. function edit_delete_action(modifier) {
  435. var checkboxes = document.getElementsByClassName('chk_delete');
  436. if (document.getElementById('btn_delete') && checkboxes.length > 0) {
  437. var checkbox_checked = false;
  438. for (var i = 0; i < checkboxes.length; ++i) {
  439. if (checkboxes[i].checked) {
  440. checkbox_checked = true;
  441. }
  442. else {
  443. if (document.getElementById('checkbox_all'+(modifier !== undefined ? '_'+modifier : ''))) {
  444. document.getElementById('checkbox_all'+(modifier !== undefined ? '_'+modifier : '')).checked = false;
  445. }
  446. }
  447. }
  448. document.getElementById('btn_delete').value = checkbox_checked ? '' : 'delete';
  449. }
  450. }
  451. function swap_display(a_id, b_id, display_value) {
  452. display_value = display_value !== undefined ? display_value : 'inline-block';
  453. a = document.getElementById(a_id);
  454. b = document.getElementById(b_id);
  455. if (window.getComputedStyle(a).display === 'none') {
  456. a.style.display = display_value;
  457. b.style.display = 'none';
  458. }
  459. else {
  460. a.style.display = 'none';
  461. b.style.display = display_value;
  462. }
  463. }
  464. function modal_close() {
  465. document.location.href='#';
  466. }
  467. function hide_password_fields() {
  468. var password_fields = document.querySelectorAll("input[type='password']");
  469. for (var p = 0, max = password_fields.length; p < max; p++) {
  470. password_fields[p].style.visibility = 'hidden';
  471. password_fields[p].type = 'text';
  472. }
  473. }
  474. window.addEventListener('beforeunload', function(e){
  475. hide_password_fields();
  476. e.returnValue = ''; //required by chrome
  477. });
  478. </script>
  479. <?php
  480. echo "<!--{head}-->\n";
  481. echo "</head>\n";
  482. //add multilingual support
  483. $language = new text;
  484. $text = $language->get(null,'themes/default');
  485. echo "<body onload=\"".$onload."\">\n";
  486. echo " <div id='message_container'></div>\n";
  487. //logged in, show the domains block
  488. if (strlen($_SESSION["username"]) > 0 && permission_exists("domain_select") && count($_SESSION['domains']) > 1) {
  489. echo "<div id='domains_container'>\n";
  490. echo " <input type='hidden' id='domains_visible' value='0'>\n";
  491. echo " <div id='domains_block'>\n";
  492. echo " <div id='domains_header'>\n";
  493. echo " <input id='domains_hide' type='button' class='btn' style='float: right' value=\"".$text['theme-button-close']."\">\n";
  494. if (file_exists($_SERVER["DOCUMENT_ROOT"]."/app/domains/domains.php")) {
  495. $domain_path = PROJECT_PATH.'/app/domains/domains.php';
  496. }
  497. else {
  498. $domain_path = PROJECT_PATH.'/core/domains/domains.php';
  499. }
  500. echo " <a href=\"".$domain_path."\"><b style=\"color: #000;\">".$text['theme-title-domains']."</b></a> (".sizeof($_SESSION['domains']).")";
  501. echo " <br><br>\n";
  502. echo " <input type='text' id='domain_filter' class='formfld' style='margin-left: 0; min-width: 100%; width: 100%;' placeholder=\"".$text['theme-label-search']."\" onkeyup='domain_search(this.value)'>\n";
  503. echo " </div>\n";
  504. echo " <div id='domains_list'>\n";
  505. //alternating background colors of inactive domains
  506. if ($_SESSION['theme']['domain_inactive_background_color'][0] != '') {
  507. $bgcolor1 = $_SESSION['theme']['domain_inactive_background_color'][0];
  508. }
  509. else {
  510. $bgcolor1 = "#eaedf2";
  511. }
  512. if ($_SESSION['theme']['domain_inactive_background_color'][1] != '') {
  513. $bgcolor2 = $_SESSION['theme']['domain_inactive_background_color'][1];
  514. }
  515. else {
  516. $bgcolor2 = "#fff";
  517. }
  518. foreach($_SESSION['domains'] as $domain) {
  519. //active domain color
  520. $bgcolor = ($bgcolor == $bgcolor1) ? $bgcolor2 : $bgcolor1;
  521. if ($_SESSION['theme']['domain_active_background_color']['text'] != '') {
  522. $bgcolor = ($domain['domain_uuid'] == $_SESSION['domain_uuid']) ? escape($_SESSION['theme']['domain_active_background_color']['text']) : $bgcolor;
  523. }
  524. else {
  525. $bgcolor = ($domain['domain_uuid'] == $_SESSION['domain_uuid']) ? "#eeffee" : $bgcolor;
  526. }
  527. //active domain's text hover color
  528. if ($_SESSION['theme']['domain_active_text_color_hover']['text'] != '' && $domain['domain_uuid'] == $_SESSION['domain_uuid']) {
  529. echo "<div id=\"".$domain['domain_name']."\" class='domains_list_item_active' style='background-color: ".$bgcolor."' onclick=\"document.location.href='".escape($domain_path)."?domain_uuid=".escape($domain['domain_uuid'])."&domain_change=true';\">";
  530. }
  531. else if ($_SESSION['theme']['domain_inactive_text_color_hover']['text'] != '' && $domain['domain_uuid'] != $_SESSION['domain_uuid']) {
  532. echo "<div id=\"".$domain['domain_name']."\" class='domains_list_item_inactive' style='background-color: ".$bgcolor."' onclick=\"document.location.href='".escape($domain_path)."?domain_uuid=".escape($domain['domain_uuid'])."&domain_change=true';\">";
  533. }
  534. else {
  535. echo "<div id=\"".$domain['domain_name']."\" class='domains_list_item' style='background-color: ".$bgcolor."' onclick=\"document.location.href='".escape($domain_path)."?domain_uuid=".escape($domain['domain_uuid'])."&domain_change=true';\">";
  536. }
  537. echo "<a href='".escape($domain_path)."?domain_uuid=".escape($domain['domain_uuid'])."&domain_change=true' ".(($domain['domain_uuid'] == $_SESSION['domain_uuid']) ? "style='font-weight: bold;'" : null).">".escape($domain['domain_name'])."</a>\n";
  538. if ($domain['domain_description'] != '') {
  539. //active domain description text color
  540. if ($_SESSION['theme']['domain_active_desc_text_color']['text'] != '' && $domain['domain_uuid'] == $_SESSION['domain_uuid']) {
  541. echo "<span class='domain_active_list_item_description' title=\"".escape($domain['domain_description'])."\"> - ".escape($domain['domain_description'])."</span>\n";
  542. }
  543. //inactive domains description text color
  544. else if ($_SESSION['theme']['domain_inactive_desc_text_color']['text'] != '' && $domain['domain_uuid'] != $_SESSION['domain_uuid']) {
  545. echo "<span class='domain_inactive_list_item_description' title=\"".escape($domain['domain_description'])."\"> - ".escape($domain['domain_description'])."</span>\n";
  546. }
  547. //default domain description text color
  548. else {
  549. echo "<span class='domain_list_item_description' title=\"".escape($domain['domain_description'])."\"> - ".escape($domain['domain_description'])."</span>\n";
  550. }
  551. }
  552. echo "</div>\n";
  553. $ary_domain_names[] = $domain['domain_name'];
  554. $ary_domain_descs[] = str_replace('"','\"',$domain['domain_description']);
  555. }
  556. echo " </div>\n";
  557. echo " <script>\n";
  558. echo " var domain_names = new Array(\"".implode('","', $ary_domain_names)."\");\n";
  559. echo " var domain_descs = new Array(\"".implode('","', $ary_domain_descs)."\");\n";
  560. echo " function domain_search(criteria) {\n";
  561. echo " for (var x = 0; x < domain_names.length; x++) {\n";
  562. echo " if (domain_names[x].toLowerCase().match(criteria.toLowerCase()) || domain_descs[x].toLowerCase().match(criteria.toLowerCase())) {\n";
  563. echo " document.getElementById(domain_names[x]).style.display = '';\n";
  564. echo " }\n";
  565. echo " else {\n";
  566. echo " document.getElementById(domain_names[x]).style.display = 'none';\n";
  567. echo " }\n";
  568. echo " }\n";
  569. echo " }\n";
  570. echo " </script>\n";
  571. echo " </div>\n";
  572. echo "</div>\n";
  573. }
  574. // qr code container for contacts
  575. echo "<div id='qr_code_container' style='display: none;' onclick='$(this).fadeOut(400);'>\n";
  576. echo " <table cellpadding='0' cellspacing='0' border='0' width='100%' height='100%'><tr><td align='center' valign='middle'>\n";
  577. echo " <span id='qr_code' onclick=\"$('#qr_code_container').fadeOut(400);\"></span>\n";
  578. echo " </td></tr></table>\n";
  579. echo "</div>\n";
  580. if (!$default_login) {
  581. //top fixed, static or inline boostrap menu
  582. function show_menu($menu_array, $menu_style, $menu_position) {
  583. global $text;
  584. //determine menu behavior
  585. switch ($menu_style) {
  586. case 'inline':
  587. $menu_type = 'default';
  588. $menu_width = 'calc(100% - 20px)';
  589. $menu_brand = false;
  590. $menu_corners = null;
  591. break;
  592. case 'static':
  593. $menu_type = 'static-top';
  594. $menu_width = 'calc(100% - 40px)';
  595. $menu_brand = true;
  596. $menu_corners = "style='-webkit-border-radius: 0 0 4px 4px; -moz-border-radius: 0 0 4px 4px; border-radius: 0 0 4px 4px;'";
  597. break;
  598. case 'fixed':
  599. default:
  600. $menu_position = ($menu_position != '') ? $menu_position : 'top';
  601. $menu_type = 'fixed-'.$menu_position;
  602. if (!http_user_agent('mobile')) {
  603. $menu_width = $_SESSION['theme']['menu_width_fixed']['text'] != '' ? $_SESSION['theme']['menu_width_fixed']['text'] : 'calc(90% - 20px)';
  604. }
  605. $menu_brand = true;
  606. $menu_corners = null;
  607. }
  608. //begin navbar code
  609. echo "<nav class='navbar navbar-expand-sm ".$menu_type."' ".$menu_corners.">\n";
  610. echo " <div class='container-fluid' style='width: ".$menu_width."; padding: 0;'>\n";
  611. echo " <div class='navbar-brand'>\n";
  612. if ($menu_brand) {
  613. //define menu brand link
  614. if (strlen(PROJECT_PATH) > 0) {
  615. $menu_brand_link = PROJECT_PATH;
  616. }
  617. else if (!$default_login) {
  618. $menu_brand_link = '/';
  619. }
  620. //define menu brand mark
  621. $menu_brand_text = ($_SESSION['theme']['menu_brand_text']['text'] != '') ? escape($_SESSION['theme']['menu_brand_text']['text']) : "FusionPBX";
  622. switch ($_SESSION['theme']['menu_brand_type']['text']) {
  623. case 'text':
  624. echo " <a class='navbar-brand-text' href=\"".$menu_brand_link."\">".$menu_brand_text."</a>\n";
  625. break;
  626. case 'image_text':
  627. $menu_brand_image = ($_SESSION['theme']['menu_brand_image']['text'] != '') ? escape($_SESSION['theme']['menu_brand_image']['text']) : PROJECT_PATH."/themes/default/images/logo.png";
  628. echo " <a href='".$menu_brand_link."'>";
  629. echo " <img id='menu_brand_image' class='navbar-logo' src='".$menu_brand_image."' title=\"".escape($menu_brand_text)."\">";
  630. if ($_SESSION['theme']['menu_brand_image_hover']['text'] != '') {
  631. echo "<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)."\">";
  632. }
  633. echo "</a>\n";
  634. echo " <a class='navbar-brand-text' href=\"".$menu_brand_link."\">".$menu_brand_text."</a>\n";
  635. break;
  636. case 'none':
  637. break;
  638. case 'image':
  639. default:
  640. $menu_brand_image = ($_SESSION['theme']['menu_brand_image']['text'] != '') ? escape($_SESSION['theme']['menu_brand_image']['text']) : PROJECT_PATH."/themes/default/images/logo.png";
  641. echo " <a href='".$menu_brand_link."'>";
  642. echo " <img id='menu_brand_image' class='navbar-logo' src='".$menu_brand_image."' title=\"".escape($menu_brand_text)."\">";
  643. if (isset($_SESSION['theme']['menu_brand_image_hover']['text']) && $_SESSION['theme']['menu_brand_image_hover']['text'] != '') {
  644. echo "<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)."\">";
  645. }
  646. echo "</a>\n";
  647. echo " <a style='margin: 0;'></a>\n";
  648. }
  649. }
  650. echo " </div>\n";
  651. echo " <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";
  652. echo " <span class='fas fa-bars'></span>\n";
  653. echo " </button>\n";
  654. echo " <div class='collapse navbar-collapse' id='main_navbar'>\n";
  655. echo " <ul class='navbar-nav'>\n";
  656. foreach ($menu_array as $index_main => $menu_parent) {
  657. $mod_li = "nav-item";
  658. $mod_a_1 = "";
  659. $submenu = false;
  660. if (is_array($menu_parent['menu_items']) && sizeof($menu_parent['menu_items']) > 0) {
  661. $mod_li = "nav-item dropdown ";
  662. $mod_a_1 = "data-toggle='dropdown' ";
  663. $submenu = true;
  664. }
  665. $mod_a_2 = ($menu_parent['menu_item_link'] != '' && !$submenu) ? $menu_parent['menu_item_link'] : '#';
  666. $mod_a_3 = ($menu_parent['menu_item_category'] == 'external') ? "target='_blank' " : null;
  667. if (isset($_SESSION['theme']['menu_main_icons']['boolean']) && $_SESSION['theme']['menu_main_icons']['boolean'] == 'true') {
  668. if ($menu_parent['menu_item_icon'] != '' && substr_count($menu_parent['menu_item_icon'], 'fa-') > 0) {
  669. $menu_main_icon = "<span class='fas ".$menu_parent['menu_item_icon']."' title=\"".escape($menu_parent['menu_language_title'])."\"></span>\n";
  670. }
  671. else {
  672. $menu_main_icon = null;
  673. }
  674. $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";
  675. }
  676. else {
  677. $menu_main_item = $menu_parent['menu_language_title'];
  678. }
  679. echo " <li class='".$mod_li."'>\n";
  680. echo " <a class='nav-link' ".$mod_a_1." href='".$mod_a_2."' ".$mod_a_3.">\n";
  681. echo " ".$menu_main_icon.$menu_main_item;
  682. echo " </a>\n";
  683. if ($submenu) {
  684. echo " <ul class='dropdown-menu'>\n";
  685. foreach ($menu_parent['menu_items'] as $index_sub => $menu_sub) {
  686. $mod_a_2 = $menu_sub['menu_item_link'];
  687. if ($mod_a_2 == '') {
  688. $mod_a_2 = '#';
  689. }
  690. $mod_a_3 = ($menu_sub['menu_item_category'] == 'external') ? "target='_blank' " : null;
  691. if ($_SESSION['theme']['menu_sub_icons']['boolean'] != 'false') {
  692. if ($menu_sub['menu_item_icon'] != '' && substr_count($menu_sub['menu_item_icon'], 'fa-') > 0) {
  693. $menu_sub_icon = "<span class='fas ".escape($menu_sub['menu_item_icon'])."'></span>";
  694. }
  695. else {
  696. $menu_sub_icon = null;
  697. }
  698. }
  699. echo " <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";
  700. }
  701. echo " </ul>\n";
  702. }
  703. echo " </li>\n";
  704. }
  705. echo " </ul>\n";
  706. echo " <ul class='navbar-nav ml-auto'>\n";
  707. //domain name/selector
  708. if ($_SESSION["username"] != '' && permission_exists("domain_select") && count($_SESSION['domains']) > 1 && $_SESSION['theme']['domain_visible']['text'] == 'true') {
  709. echo " <li class='nav-item'>\n";
  710. echo " <a class='nav-link domain_selector_domain' href='#' title='".$text['theme-label-open_selector']."'>".escape($_SESSION['domain_name'])."</a>";
  711. echo " </li>\n";
  712. }
  713. //logout icon
  714. if ($_SESSION['username'] != '' && $_SESSION['theme']['logout_icon_visible']['text'] == "true") {
  715. $username_full = $_SESSION['username'].((count($_SESSION['domains']) > 1) ? "@".$_SESSION["user_context"] : null);
  716. echo " <li class='nav-item'>\n";
  717. echo " <a class='nav-link logout_icon' href='".PROJECT_PATH."/logout.php' title=\"".$text['theme-label-logout']."\" onclick=\"return confirm('".$text['theme-confirm-logout']."')\"><span class='fas fa-sign-out-alt'></span></a>";
  718. echo " </li>\n";
  719. unset($username_full);
  720. }
  721. echo " </ul>\n";
  722. echo " </div>\n";
  723. echo " </div>\n";
  724. echo "</nav>\n";
  725. }
  726. //get the menu array and save it to the session
  727. if (!isset($_SESSION['menu']['array'])) {
  728. $menu = new menu;
  729. $menu->menu_uuid = $_SESSION['domain']['menu']['uuid'];
  730. $_SESSION['menu']['array'] = $menu->menu_array();
  731. unset($menu);
  732. }
  733. //get the menu style and position
  734. $menu_style = ($_SESSION['theme']['menu_style']['text'] != '') ? $_SESSION['theme']['menu_style']['text'] : 'fixed';
  735. $menu_position = ($_SESSION['theme']['menu_position']['text'] != '') ? $_SESSION['theme']['menu_position']['text'] : 'top';
  736. //show the menu style
  737. switch ($menu_style) {
  738. case 'inline':
  739. $logo_align = ($_SESSION['theme']['logo_align']['text'] != '') ? $_SESSION['theme']['logo_align']['text'] : 'left';
  740. $logo_style = ($_SESSION['theme']['logo_style']['text'] != '') ? $_SESSION['theme']['logo_style']['text'] : null;
  741. echo "<div class='container-fluid' style='padding: 0;' align='".$logo_align."'>\n";
  742. if ($_SERVER['PHP_SELF'] != PROJECT_PATH."/core/install/install.php") {
  743. $logo = ($_SESSION['theme']['logo']['text'] != '') ? $_SESSION['theme']['logo']['text'] : PROJECT_PATH."/themes/default/images/logo.png";
  744. echo "<a href='".((PROJECT_PATH != '') ? PROJECT_PATH : '/')."'><img src='".$logo."' style='padding: 15px 20px; ".$logo_style."'></a>";
  745. }
  746. show_menu($_SESSION['menu']['array'], $menu_style, $menu_position);
  747. break;
  748. case 'static':
  749. echo "<div class='container-fluid' style='padding: 0;' align='center'>\n";
  750. show_menu($_SESSION['menu']['array'], $menu_style, $menu_position);
  751. break;
  752. case 'fixed':
  753. show_menu($_SESSION['menu']['array'], $menu_style, $menu_position);
  754. echo "<div class='container-fluid' style='padding: 0;' align='center'>\n";
  755. break;
  756. case 'side':
  757. echo "<div id='menu_side_container'>\n";
  758. //menu brand image and/or text
  759. if ($_SESSION['theme']['menu_brand_type']['text'] == 'none') {
  760. echo " <div style='height: 75px;'>\n";
  761. echo "<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>";
  762. echo "<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>";
  763. echo "</div>\n";
  764. }
  765. else {
  766. echo " <div id='menu_side_brand_container'>\n";
  767. //menu toggle buttons
  768. if ($_SESSION['theme']['menu_brand_type']['text'] != 'none') {
  769. echo " <div style='float: right; margin-right: -20px; margin-top: -20px;'>\n";
  770. echo " <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";
  771. echo " </div>\n";
  772. }
  773. //define the menu brand link
  774. if (strlen(PROJECT_PATH) > 0) {
  775. $menu_brand_link = PROJECT_PATH;
  776. }
  777. else if (!$default_login) {
  778. $menu_brand_link = '/';
  779. }
  780. //show the menu brand image and/or text
  781. $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";
  782. $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";
  783. $menu_brand_text = ($_SESSION['theme']['menu_brand_text']['text'] != '') ? escape($_SESSION['theme']['menu_brand_text']['text']) : "FusionPBX";
  784. if ($_SESSION['theme']['menu_brand_type']['text'] == 'image' || $_SESSION['theme']['menu_brand_type']['text'] == '') {
  785. echo " <a href='".$menu_brand_link."' style='text-decoration: none;'>";
  786. echo "<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)."\">";
  787. echo "<img id='menu_brand_image_expanded' style='display: none;' src='".escape($menu_brand_image_expanded)."' title=\"".escape($menu_brand_text)."\">";
  788. echo "</a>\n";
  789. }
  790. else if ($_SESSION['theme']['menu_brand_type']['text'] == 'image_text') {
  791. echo " <a href='".$menu_brand_link."' style='text-decoration: none;'>";
  792. echo "<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)."\">";
  793. echo "<span class='menu_brand_text' style='display: none;'>".$menu_brand_text."</span>";
  794. echo "</a>\n";
  795. }
  796. else if ($_SESSION['theme']['menu_brand_type']['text'] == 'text') {
  797. echo " <a class='menu_brand_text' style='display: none;' href=\"".$menu_brand_link."\">".$menu_brand_text."</a>\n";
  798. }
  799. echo " </div>\n";
  800. }
  801. //main menu items
  802. if (is_array($_SESSION['menu']['array']) && sizeof($_SESSION['menu']['array']) != 0) {
  803. foreach ($_SESSION['menu']['array'] as $menu_index_main => $menu_item_main) {
  804. echo " <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']."\">";
  805. if ($menu_item_main['menu_item_icon'] != '') {
  806. echo "<i class='fas ".$menu_item_main['menu_item_icon']." fa-fw' style='z-index: 99800; margin-right: 8px;'></i>";
  807. }
  808. echo "<span class='menu_side_item_title' style='display: none;'>".$menu_item_main['menu_language_title']."</span>";
  809. echo "</a>\n";
  810. //sub menu items
  811. if (is_array($menu_item_main['menu_items']) && sizeof($menu_item_main['menu_items']) != 0) {
  812. echo " <div id='sub_".$menu_item_main['menu_item_uuid']."' class='menu_side_sub' style='display: none;'>\n";
  813. foreach ($menu_item_main['menu_items'] as $menu_index_sub => $menu_item_sub) {
  814. echo " <a class='menu_side_item_sub' ".($menu_item_sub['menu_item_category'] == 'external' ? "target='_blank'" : null)." href='".$menu_item_sub['menu_item_link']."'>";
  815. echo "<span class='menu_side_item_title' style='display: none;'>".$menu_item_sub['menu_language_title']."</span>";
  816. echo "</a>\n";
  817. }
  818. echo " </div>\n";
  819. }
  820. }
  821. echo " <div style='height: 100px;'></div>\n";
  822. }
  823. echo "</div>\n";
  824. echo "<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";
  825. echo " <div id='content_header'>\n";
  826. //header: left
  827. echo "<div class='float-left'>\n";
  828. echo "</div>\n";
  829. //header: right
  830. echo "<span class='float-right' style='white-space: nowrap;'>";
  831. //current user
  832. echo "<span style='display: inline-block; padding-right: 20px; font-size: 85%;'>\n";
  833. echo "<strong>".$text['theme-label-user']."</strong>: ";
  834. echo "<a href='".PROJECT_PATH."/core/users/user_edit.php?id=user'>".$_SESSION['username']."</a>";
  835. echo "</span>\n";
  836. //domain name/selector (sm+)
  837. if ($_SESSION["username"] != '' && permission_exists("domain_select") && count($_SESSION['domains']) > 1 && $_SESSION['theme']['domain_visible']['text'] == 'true') {
  838. echo "<span style='display: inline-block; padding-right: 10px; font-size: 85%;'>\n";
  839. echo "<strong>".$text['theme-label-domain']."</strong>: ";
  840. echo "<a href='#' id='header_domain_selector_domain' title='".$text['theme-label-open_selector']."'>".escape($_SESSION['domain_name'])."</a>";
  841. echo "</span>\n";
  842. }
  843. //logout icon
  844. if ($_SESSION['username'] != '' && $_SESSION['theme']['logout_icon_visible']['text'] == "true") {
  845. echo "<a id='header_logout_icon' href='".PROJECT_PATH."/logout.php' title=\"".$text['theme-label-logout']."\" onclick=\"return confirm('".$text['theme-confirm-logout']."')\"><span class='fas fa-log-out'></span></a>";
  846. }
  847. echo "</span>";
  848. echo " </div>\n";
  849. break;
  850. }
  851. echo "<div id='main_content'>\n";
  852. echo " <!--{body}-->\n";
  853. echo "</div>\n";
  854. echo "<div id='footer'>\n";
  855. echo " <span class='footer'>".(isset($_SESSION['theme']['footer']['text']) && $_SESSION['theme']['footer']['text'] != '' ? $_SESSION['theme']['footer']['text'] : "&copy; ".$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'])."</span>\n";
  856. echo "</div>\n";
  857. echo "</div>\n"; //initial div from switch statement above
  858. }
  859. else {
  860. //default login being used
  861. if ($_SESSION['theme']['logo_login']['text'] != '') {
  862. $logo = $_SESSION['theme']['logo_login']['text'];
  863. }
  864. else if ($_SESSION['theme']['logo']['text'] != '') {
  865. $logo = $_SESSION['theme']['logo']['text'];
  866. }
  867. else {
  868. $logo = PROJECT_PATH."/themes/default/images/logo_login.png";
  869. }
  870. //set the login logo width and height
  871. if (isset($_SESSION['theme']['login_logo_width']['text'])) {
  872. $login_logo_width = $_SESSION['theme']['login_logo_width']['text'];
  873. }
  874. else {
  875. $login_logo_width = 'auto; max-width: 300px';
  876. }
  877. if (isset($_SESSION['theme']['login_logo_height']['text'])) {
  878. $login_logo_height = $_SESSION['theme']['login_logo_height']['text'];
  879. }
  880. else {
  881. $login_logo_height = 'auto; max-height: 300px';
  882. }
  883. echo "<div id='default_login'>\n";
  884. echo " <a href='".PROJECT_PATH."/'><img id='login_logo' style='width: ".$login_logo_width."; height: ".$login_logo_height.";' src='".escape($logo)."'></a><br />\n";
  885. echo " <!--{body}-->\n";
  886. echo "</div>\n";
  887. echo "<div id='footer_login'>\n";
  888. echo " <span class='footer'>".($_SESSION['theme']['footer']['text'] != '' ? $_SESSION['theme']['footer']['text'] : "&copy; ".$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'])."</span>\n";
  889. echo "</div>\n";
  890. unset($_SESSION['background_image']);
  891. }
  892. echo "</body>\n";
  893. echo "</html>\n";
  894. ?>