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
8//set the doctype
9	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";
10
11//get the php self path and set a variable with only the directory path
12	$php_self_array = explode ("/", $_SERVER['PHP_SELF']);
13	$php_self_dir = '';
14	foreach ($php_self_array as &$value) {
15		if (substr($value, -4) != ".php") {
16			$php_self_dir .= $value."/";
17		}
18	}
19	unset($php_self_array);
20	if (strlen(PROJECT_PATH) > 0) {
21		$php_self_dir = substr($php_self_dir, strlen(PROJECT_PATH), strlen($php_self_dir));
22	}
23?>
24<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
25<head>
26<meta charset="utf-8">
27<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
28<meta http-equiv="X-UA-Compatible" content="IE=edge">
29<meta name="viewport" content="width=device-width, initial-scale=1">
30
31<link rel="stylesheet" type="text/css" href="<!--{project_path}-->/resources/bootstrap/css/bootstrap.min.css">
32<link rel="stylesheet" type="text/css" href="<!--{project_path}-->/resources/bootstrap/css/bootstrap-datetimepicker.min.css" />
33<link rel="stylesheet" type="text/css" href="<!--{project_path}-->/resources/bootstrap/css/bootstrap-colorpicker.min.css">
34<link rel="stylesheet" type="text/css" href="<!--{project_path}-->/themes/<?php echo $_SESSION['domain']['template']['name']; ?>/css.php<?php echo ($default_login) ? '?login=default' : null; ?>">
35<?php
36//load custom css
37	if ($_SESSION['theme']['custom_css']['text'] != '') {
38		echo "<link rel='stylesheet' type='text/css' href='".$_SESSION['theme']['custom_css']['text']."'>\n\n";
39	}
40
41//set fav icon
42	$favicon = (isset($_SESSION['theme']['favicon']['text'])) ? $_SESSION['theme']['favicon']['text'] : '<!--{project_path}-->/themes/default/favicon.ico';
43	echo "<link rel='icon' href='".$favicon."'>\n";
44?>
45
46<title><!--{title}--></title>
47
48<script language="JavaScript" type="text/javascript" src="<!--{project_path}-->/resources/jquery/jquery-1.11.1.js"></script>
49<script language="JavaScript" type="text/javascript" src="<!--{project_path}-->/resources/jquery/jquery.autosize.input.js"></script>
50<script language="JavaScript" type="text/javascript" src="<!--{project_path}-->/resources/momentjs/moment.js"></script>
51<script language="JavaScript" type="text/javascript" src="<!--{project_path}-->/resources/bootstrap/js/bootstrap.min.js"></script>
52<script language="JavaScript" type="text/javascript" src="<!--{project_path}-->/resources/bootstrap/js/bootstrap-datetimepicker.min.js"></script>
53<script language="JavaScript" type="text/javascript" src="<!--{project_path}-->/resources/bootstrap/js/bootstrap-colorpicker.js"></script>
54<script language="JavaScript" type="text/javascript" src="<!--{project_path}-->/resources/bootstrap/js/bootstrap-pwstrength.min.js"></script>
55<?php
56//web font loader
57	if ($_SESSION['theme']['font_loader']['text'] == 'true') {
58		if ($_SESSION['theme']['font_retrieval']['text'] != 'asynchronous') {
59			$font_loader_version = ($_SESSION['theme']['font_loader_version']['text'] != '') ? $_SESSION['theme']['font_loader_version']['text'] : 1;
60			echo "<script language='JavaScript' type='text/javascript' src='//ajax.googleapis.com/ajax/libs/webfont/".$font_loader_version."/webfont.js'></script>\n";
61		}
62		echo "<script language='JavaScript' type='text/javascript' src='<!--{project_path}-->/resources/fonts/web_font_loader.php?v=".$font_loader_version."'></script>\n";
63	}
64?>
65<script language="JavaScript" type="text/javascript">
66
67	//display message bar via js
68		function display_message(msg, mood, delay) {
69			mood = (typeof mood !== 'undefined') ? mood : 'default';
70			delay = (typeof delay !== 'undefined') ? delay : <?php echo (1000 * (float) $_SESSION['theme']['message_delay']['text']); ?>;
71			if (msg !== '') {
72				var message_text = $(document.createElement('div'));
73				message_text.addClass('message_text message_mood_'+mood);
74				message_text.html(msg);
75				message_text.click(function() {
76					var object = $(this);
77					object.clearQueue().finish();
78					object.animate({height: '0', 'font-size': '0', 'border-bottom-width': '0'}, 1000).animate({opacity: 0});
79				} );
80				$("#messages_container").append(message_text);
81				message_text.animate({opacity: 1}, 'fast').delay(delay).animate({height: '0', 'font-size': '0', 'border-bottom-width': '0'}, 1000).animate({opacity: 0});
82			}
83		}
84
85	$(document).ready(function() {
86
87<?php	echo messages::html(true, "		");?>
88
89		//hide message bar on hover
90			$("#message_text").mouseover(function() { $(this).hide(); $("#message_container").hide(); });
91
92		<?php
93		if (permission_exists("domain_select") && count($_SESSION['domains']) > 1) {
94			?>
95
96			//domain selector controls
97				$(".domain_selector_domain").click(function() { show_domains(); });
98				$("#domains_hide").click(function() { hide_domains(); });
99
100				function show_domains() {
101					$('#domains_visible').val(1);
102					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+)
103					if (scrollbar_width > 0) {
104						$("body").css({'margin-right':scrollbar_width, 'overflow':'hidden'}); //disable body scroll bars
105						$(".navbar").css('margin-right',scrollbar_width); //adjust navbar margin to compensate
106						$("#domains_container").css('right',-scrollbar_width); //domain container right position to compensate
107					}
108					$(document).scrollTop(0);
109					$("#domains_container").show();
110					$("#domains_block").animate({marginRight: '+=300'}, 400, function() {
111						$("#domain_filter").focus();
112					});
113				}
114
115				function hide_domains() {
116					$('#domains_visible').val(0);
117					$(document).ready(function() {
118						$("#domains_block").animate({marginRight: '-=300'}, 400, function() {
119							$("#domain_filter").val('');
120							domain_search($("#domain_filter").val());
121							$(".navbar").css('margin-right','0'); //restore navbar margin
122							$("#domains_container").css('right','0'); //domain container right position
123							$("#domains_container").hide();
124							$("body").css({'margin-right':'0','overflow':'auto'}); //enable body scroll bars
125						});
126					});
127				}
128
129			<?php
130			key_press('escape', 'up', 'document', null, null, "if ($('#domains_visible').val() == 0) { show_domains(); } else { hide_domains(); }", false);
131		}
132		?>
133
134		//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
135			$('.tr_hover tr').each(function(i,e) {
136			  $(e).children('td:not(.list_control_icon,.list_control_icons,.tr_link_void)').click(function() {
137				 var href = $(this).closest("tr").attr("href");
138				 if (href) { window.location = href; }
139			  });
140			});
141
142		//apply the auto-size jquery script to all text inputs
143			$("input[type=text].txt,input[type=number].txt,input[type=password].txt,input[type=text].formfld,input[type=number].formfld,input[type=password].formfld").not('.datetimepicker,.datepicker').autosizeInput();
144
145		//apply bootstrap-datetime plugin
146			$(function() {
147				$('.datetimepicker').datetimepicker({
148					format: 'YYYY-MM-DD HH:mm',
149					showTodayButton: true,
150					showClear: true,
151					showClose: true,
152				});
153				$('.datepicker').datetimepicker({
154					format: 'YYYY-MM-DD',
155					showTodayButton: true,
156					showClear: true,
157					showClose: true,
158				});
159			});
160
161		//apply bootstrap-colorpicker plugin
162			$(function(){
163				$('.colorpicker').colorpicker({
164					align: 'left',
165					customClass: 'colorpicker-2x',
166					sliders: {
167						saturation: {
168							maxLeft: 200,
169							maxTop: 200
170						},
171						hue: {
172							maxTop: 200
173						},
174						alpha: {
175							maxTop: 200
176						}
177					}
178				});
179			});
180
181		//apply password strength plugin
182			$('#password').pwstrength({
183				common: {
184					minChar: 8,
185					usernameField: '#username',
186				},
187				/* rules: { },  */
188				ui: {
189					//				very weak weak		normal	   medium	  strong	 very strong
190					colorClasses: ["danger", "warning", "warning", "warning", "success", "success"],
191					progressBarMinPercentage: 15,
192					showVerdicts: false,
193					viewports: {
194						progress: "#pwstrength_progress"
195					}
196				}
197			});
198
199		<?php if ($_SESSION['theme']['menu_brand_image']['text'] != '' && $_SESSION['theme']['menu_brand_image_hover']['text'] != '') { ?>
200			//crossfade menu brand images (if hover version set)
201				$(function(){
202					$('#menu_brand_image').mouseover(function(){
203						$(this).fadeOut('fast', function(){
204							$('#menu_brand_image_hover').fadeIn('fast');
205						});
206					});
207					$('#menu_brand_image_hover').mouseout(function(){
208						$(this).fadeOut('fast', function(){
209							$('#menu_brand_image').fadeIn('fast');
210						});
211					});
212				});
213		<?php } ?>
214
215	});
216
217	//audio playback functions
218		var recording_audio;
219		var audio_clock;
220
221		function recording_play(recording_id) {
222			if (document.getElementById('recording_progress_bar_'+recording_id)) {
223				document.getElementById('recording_progress_bar_'+recording_id).style.display='';
224			}
225			recording_audio = document.getElementById('recording_audio_'+recording_id);
226
227			if (recording_audio.paused) {
228				recording_audio.volume = 1;
229				recording_audio.play();
230				document.getElementById('recording_button_'+recording_id).innerHTML = "<?php echo str_replace("class='list_control_icon'", "class='list_control_icon' style='opacity: 1;'", $v_link_label_pause); ?>";
231				audio_clock = setInterval(function () { update_progress(recording_id); }, 20);
232
233				$("[id*=recording_button]").not("[id*=recording_button_"+recording_id+"]").html("<?php echo $v_link_label_play; ?>");
234				$("[id*=recording_progress_bar]").not("[id*=recording_progress_bar_"+recording_id+"]").css('display', 'none');
235
236				$('audio').each(function(){
237					if ($(this).get(0) != recording_audio) {
238						$(this).get(0).pause(); // Stop playing
239						$(this).get(0).currentTime = 0; // Reset time
240					}
241				});
242			}
243			else {
244				recording_audio.pause();
245				document.getElementById('recording_button_'+recording_id).innerHTML = "<?php echo $v_link_label_play; ?>";
246				clearInterval(audio_clock);
247			}
248		}
249
250		function recording_stop(recording_id) {
251			recording_reset(recording_id);
252			clearInterval(audio_clock);
253		}
254
255		function recording_reset(recording_id) {
256			recording_audio = document.getElementById('recording_audio_'+recording_id);
257			recording_audio.pause();
258			recording_audio.currentTime = 0;
259			if (document.getElementById('recording_progress_bar_'+recording_id)) {
260				document.getElementById('recording_progress_bar_'+recording_id).style.display='none';
261			}
262			document.getElementById('recording_button_'+recording_id).innerHTML = "<?php echo $v_link_label_play; ?>";
263			clearInterval(audio_clock);
264		}
265
266		function update_progress(recording_id) {
267			recording_audio = document.getElementById('recording_audio_'+recording_id);
268			var recording_progress = document.getElementById('recording_progress_'+recording_id);
269			var value = 0;
270			if (recording_audio.currentTime > 0) {
271				value = (100 / recording_audio.duration) * recording_audio.currentTime;
272			}
273			recording_progress.style.marginLeft = value + "%";
274			if (parseInt(recording_audio.duration) > 30) { //seconds
275				clearInterval(audio_clock);
276			}
277		}
278
279</script>
280
281<!--{head}-->
282
283</head>
284
285<?php
286//add multilingual support
287	$language = new text;
288	$text = $language->get(null,'themes/default');
289?>
290
291<body onload="<?php echo $onload;?>">
292
293	<div id='messages_container'></div>
294
295	<?php
296	//logged in show the domains block
297	if (strlen($_SESSION["username"]) > 0 && permission_exists("domain_select") && count($_SESSION['domains']) > 1) {
298		?>
299		<div id="domains_container">
300			<input type="hidden" id="domains_visible" value="0">
301			<div id="domains_block">
302				<div id="domains_header">
303					<input id="domains_hide" type="button" class="btn" style="float: right" value="<?php echo $text['theme-button-close']; ?>">
304					<?php
305					if (file_exists($_SERVER["DOCUMENT_ROOT"]."/app/domains/domains.php")) {
306						$href = '/app/domains/domains.php';
307					}
308					else {
309						$href = '/core/domain_settings/domains.php';
310					}
311					echo "<a href=\"".$href."\"><b style=\"color: #000;\">".$text['theme-title-domains']."</b></a> (".sizeof($_SESSION['domains']).")";
312					?>
313					<br><br>
314					<input type="text" id="domain_filter" class="formfld" style="margin-left: 0; min-width: 100%; width: 100%;" placeholder="<?php echo $text['theme-label-search']; ?>" onkeyup="domain_search(this.value);">
315				</div>
316				<div id="domains_list">
317					<?php
318					$bgcolor1 = "#eaedf2";
319					$bgcolor2 = "#fff";
320					foreach($_SESSION['domains'] as $domain) {
321						$bgcolor = ($bgcolor == $bgcolor1) ? $bgcolor2 : $bgcolor1;
322						$bgcolor = ($domain['domain_uuid'] == $_SESSION['domain_uuid']) ? "#eeffee" : $bgcolor;
323						echo "<div id=\"".$domain['domain_name']."\" class='domains_list_item' style='background-color: ".$bgcolor."' onclick=\"document.location.href='".PROJECT_PATH."/core/domain_settings/domains.php?domain_uuid=".$domain['domain_uuid']."&domain_change=true';\">";
324						echo "<a href='".PROJECT_PATH."/core/domain_settings/domains.php?domain_uuid=".$domain['domain_uuid']."&domain_change=true' ".(($domain['domain_uuid'] == $_SESSION['domain_uuid']) ? "style='font-weight: bold;'" : null).">".$domain['domain_name']."</a>\n";
325						if ($domain['domain_description'] != '') {
326							echo "<span class=\"domain_list_item_description\"> - ".$domain['domain_description']."</span>\n";
327						}
328						echo "</div>\n";
329						$ary_domain_names[] = $domain['domain_name'];
330						$ary_domain_descs[] = str_replace('"','\"',$domain['domain_description']);
331					}
332					?>
333				</div>
334
335				<script>
336					var domain_names = new Array("<?php echo implode('","', $ary_domain_names)?>");
337					var domain_descs = new Array("<?php echo implode('","', $ary_domain_descs)?>");
338
339					function domain_search(criteria) {
340						for (var x = 0; x < domain_names.length; x++) {
341							if (domain_names[x].toLowerCase().match(criteria.toLowerCase()) || domain_descs[x].toLowerCase().match(criteria.toLowerCase())) {
342								document.getElementById(domain_names[x]).style.display = '';
343							}
344							else {
345								document.getElementById(domain_names[x]).style.display = 'none';
346							}
347						}
348					}
349				</script>
350
351			</div>
352		</div>
353		<?php
354	}
355
356
357	// qr code container for contacts
358	echo "<div id='qr_code_container' style='display: none;' onclick='$(this).fadeOut(400);'>";
359	echo "	<table cellpadding='0' cellspacing='0' border='0' width='100%' height='100%'><tr><td align='center' valign='middle'>";
360	echo "		<span id='qr_code' onclick=\"$('#qr_code_container').fadeOut(400);\"></span>";
361	echo "	</td></tr></table>";
362	echo "</div>";
363
364
365	if (!$default_login) {
366
367		//*************** BOOTSTRAP MENU ********************************
368		function show_menu($menu_array, $menu_style, $menu_position) {
369			global $text;
370
371			//determine menu behavior
372				switch ($menu_style) {
373					case 'inline':
374						$menu_type = 'default';
375						$menu_width = 'calc(100% - 20px)';
376						$menu_brand = false;
377						$menu_corners = null;
378						break;
379					case 'static':
380						$menu_type = 'static-top';
381						$menu_width = 'calc(100% - 40px)';
382						$menu_brand = true;
383						$menu_corners = "style='-webkit-border-radius: 0 0 4px 4px; -moz-border-radius: 0 0 4px 4px; border-radius: 0 0 4px 4px;'";
384						break;
385					case 'fixed':
386					default:
387						$menu_position = ($menu_position != '') ? $menu_position : 'top';
388						$menu_type = 'fixed-'.$menu_position;
389						$menu_width = 'calc(90% - 20px)';
390						$menu_brand = true;
391						$menu_corners = null;
392				}
393			?>
394
395			<nav class="navbar navbar-inverse navbar-<?php echo $menu_type; ?>" <?php echo $menu_corners; ?>>
396				<div class="container-fluid" style='width: <?php echo $menu_width; ?>; padding: 0;'>
397					<div class="navbar-header">
398						<button type="button" class="navbar-toggle collapsed" <?php echo ($menu_style == 'fixed') ? "style='margin-right: -2%;'" : null; ?> data-toggle="collapse" data-target="#main_navbar" aria-expanded="false" aria-controls="navbar">
399							<span class="sr-only">Toggle navigation</span>
400							<span class="icon-bar" style='margin-top: 1px;'></span>
401							<span class="icon-bar"></span>
402							<span class="icon-bar"></span>
403						</button>
404						<?php
405						if ($menu_brand) {
406							//define menu brand link
407								if (strlen(PROJECT_PATH) > 0) {
408									$menu_brand_link = PROJECT_PATH;
409								}
410								else if (!$default_login) {
411									$menu_brand_link = '/';
412								}
413							//define menu brand mark
414								$menu_brand_text = ($_SESSION['theme']['menu_brand_text']['text'] != '') ? $_SESSION['theme']['menu_brand_text']['text'] : "FusionPBX";
415								if ($_SESSION['theme']['menu_brand_type']['text'] == 'image' || $_SESSION['theme']['menu_brand_type']['text'] == '') {
416									$menu_brand_image = ($_SESSION['theme']['menu_brand_image']['text'] != '') ? $_SESSION['theme']['menu_brand_image']['text'] : PROJECT_PATH."/themes/default/images/logo.png";
417									echo "<a href='".$menu_brand_link."'>";
418									echo "<img id='menu_brand_image' class='navbar-logo' ".(($menu_style == 'fixed') ? "style='margin-right: -2%;'" : null)." src='".$menu_brand_image."' title=\"".$menu_brand_text."\">";
419									if ($_SESSION['theme']['menu_brand_image_hover']['text'] != '') {
420										echo "<img id='menu_brand_image_hover' class='navbar-logo' style='display: none;' src='".$_SESSION['theme']['menu_brand_image_hover']['text']."' title=\"".$menu_brand_text."\">";
421									}
422									echo "</a>";
423								}
424								else if ($_SESSION['theme']['menu_brand_type']['text'] == 'text') {
425									echo "<div class='pull-left'><a class='navbar-brand' href=\"".$menu_brand_link."\">".$menu_brand_text."</a></div>\n";
426								}
427						}
428						//domain name/selector (xs)
429							if ($_SESSION["username"] != '' && permission_exists("domain_select") && count($_SESSION['domains']) > 1) {
430								echo "<span class='pull-right visible-xs'><a href='#' class='domain_selector_domain' title='".$text['theme-label-open_selector']."'>".$_SESSION['domain_name']."</a></span>\n";
431							}
432						?>
433					</div>
434					<div class="collapse navbar-collapse" id="main_navbar">
435						<ul class="nav navbar-nav">
436							<?php
437							foreach ($menu_array as $index_main => $menu_parent) {
438								$mod_li = "";
439								$mod_a_1 = "";
440								$submenu = false;
441								if (is_array($menu_parent['menu_items']) && sizeof($menu_parent['menu_items']) > 0) {
442									$mod_li = "class='dropdown' ";
443									$mod_a_1 = "class='dropdown-toggle text-left' data-toggle='dropdown' ";
444									$submenu = true;
445								}
446								$mod_a_2 = ($menu_parent['menu_item_link'] != '' && !$submenu) ? $menu_parent['menu_item_link'] : '#';
447								$mod_a_3 = ($menu_parent['menu_item_category'] == 'external') ? "target='_blank' " : null;
448								if ($_SESSION['theme']['menu_main_icons']['boolean'] != 'false') {
449									if ($menu_parent['menu_item_icon'] != '' && substr_count($menu_parent['menu_item_icon'], 'glyphicon-') > 0) {
450										$menu_main_icon = "<span class='glyphicon ".$menu_parent['menu_item_icon']."' title=\"".$menu_parent['menu_language_title']."\"></span>";
451									}
452									else {
453										$menu_main_icon = null;
454									}
455									$menu_main_item = "<span class='hidden-sm' style='margin-left: 5px;'>".$menu_parent['menu_language_title']."</span>";
456								}
457								else {
458									$menu_main_item = $menu_parent['menu_language_title'];
459								}
460								echo "<li ".$mod_li.">\n";
461								echo "<a ".$mod_a_1." href='".$mod_a_2."' ".$mod_a_3.">".$menu_main_icon.$menu_main_item."</a>\n";
462								if ($submenu) {
463									echo "<ul class='dropdown-menu'>\n";
464									foreach ($menu_parent['menu_items'] as $index_sub => $menu_sub) {
465										$mod_a_2 = $menu_sub['menu_item_link'];
466										if ($mod_a_2 == '') {
467											$mod_a_2 = '#';
468										}
469										else if (($menu_sub['menu_item_category'] == 'internal') || (($menu_sub['menu_item_category'] == 'external') && substr($mod_a_2,0,1) == '/')) {
470											// accomodate adminer auto-login, if enabled
471												if (substr($mod_a_2,0,22) == '/app/adminer/index.php') {
472													global $db_type;
473													$mod_a_2 .= '?'.(($db_type == 'mysql') ? 'server' : $db_type).'&db=fusionpbx&ns=public';
474													$mod_a_2 .= ($_SESSION['adminer']['auto_login']['boolean'] == 'true') ? "&username=auto" : null;
475												}
476											$mod_a_2 = PROJECT_PATH.$mod_a_2;
477										}
478										$mod_a_3 = ($menu_sub['menu_item_category'] == 'external') ? "target='_blank' " : null;
479										if ($_SESSION['theme']['menu_sub_icons']['boolean'] != 'false') {
480											if ($menu_sub['menu_item_icon'] != '' && substr_count($menu_sub['menu_item_icon'], 'glyphicon-') > 0) {
481												$menu_sub_icon = "<span class='glyphicon ".$menu_sub['menu_item_icon']."'></span>";
482											}
483											else {
484												$menu_sub_icon = null;
485											}
486										}
487										echo "<li><a href='".$mod_a_2."' ".$mod_a_3.">".(($_SESSION['theme']['menu_sub_icons']) ? "<span class='glyphicon glyphicon-minus visible-xs pull-left' style='margin: 4px 10px 0 25px;'></span>" : null).$menu_sub['menu_language_title'].$menu_sub_icon."</a></li>\n";
488									}
489									echo "</ul>\n";
490								}
491								echo "</li>\n";
492							}
493							?>
494						</ul>
495						<?php
496						echo "<span class='pull-right hidden-xs' style='white-space: nowrap;'>";
497						//domain name/selector (sm+)
498							if ($_SESSION["username"] != '' && permission_exists("domain_select") && count($_SESSION['domains']) > 1 && $_SESSION['theme']['domain_visible']['text'] == 'true') {
499								echo "<a href='#' class='domain_selector_domain' title='".$text['theme-label-open_selector']."'>".$_SESSION['domain_name']."</a>";
500							}
501						//logout icon
502							if ($_SESSION['username'] != '' && $_SESSION['theme']['logout_icon_visible']['text'] == "true") {
503								$username_full = $_SESSION['username'].((count($_SESSION['domains']) > 1) ? "@".$_SESSION["user_context"] : null);
504								echo "<a href='".PROJECT_PATH."/logout.php' class='logout_icon' title=\"".$text['theme-label-logout']."\" onclick=\"return confirm('".$text['theme-confirm-logout']."')\"><span class='glyphicon glyphicon-log-out'></span></a>";
505								unset($username_full);
506							}
507						echo "</span>";
508						?>
509					</div>
510				</div>
511			</nav>
512
513			<?php
514		}
515
516
517		//determine menu configuration
518			$menu = new menu;
519			$menu->db = $db;
520			$menu->menu_uuid = $_SESSION['domain']['menu']['uuid'];
521			$menu_array = $menu->menu_array();
522			unset($menu);
523
524			$menu_style = ($_SESSION['theme']['menu_style']['text'] != '') ? $_SESSION['theme']['menu_style']['text'] : 'fixed';
525			$menu_position = ($_SESSION['theme']['menu_position']['text']) ? $_SESSION['theme']['menu_position']['text'] : 'top';
526			$open_container = "<div class='container-fluid' style='padding: 0;' align='center'>";
527
528			switch ($menu_style) {
529				case 'inline':
530					$logo_align = ($_SESSION['theme']['logo_align']['text'] != '') ? $_SESSION['theme']['logo_align']['text'] : 'left';
531					$logo_style = ($_SESSION['theme']['logo_style']['text'] != '') ? $_SESSION['theme']['logo_style']['text'] : '';
532					echo str_replace("center", $logo_align, $open_container);
533					if ($_SERVER['PHP_SELF'] != PROJECT_PATH."/core/install/install.php") {
534						$logo = ($_SESSION['theme']['logo']['text'] != '') ? $_SESSION['theme']['logo']['text'] : PROJECT_PATH."/themes/default/images/logo.png";
535						echo "<a href='".((PROJECT_PATH != '') ? PROJECT_PATH : '/')."'><img src='".$logo."' style='padding: 15px 20px;$logo_style'></a>";
536					}
537
538					show_menu($menu_array, $menu_style, $menu_position);
539					break;
540				case 'static':
541					echo $open_container;
542					show_menu($menu_array, $menu_style, $menu_position);
543					break;
544				case 'fixed':
545					show_menu($menu_array, $menu_style, $menu_position);
546					echo $open_container;
547			}
548			?>
549
550			<div id='main_content'>
551				<!--{body}-->
552			</div>
553			<div id='footer'>
554				<span class='footer'><?php echo (isset($_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>
555			</div>
556		</div>
557
558		<?php
559		// note: div above matches $open_container
560	}
561
562	// default login being used
563	else {
564		$logo = (isset($_SESSION['theme']['logo']['text'])) ? $_SESSION['theme']['logo']['text'] : PROJECT_PATH."/themes/default/images/logo.png";
565		?>
566		<div id='default_login'>
567			<a href='<?php echo PROJECT_PATH; ?>/'><img id='login_logo' src='<?php echo $logo; ?>'></a><br />
568			<!--{body}-->
569		</div>
570		<div id='footer_login'>
571			<span class='footer'><?php echo (isset($_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>
572		</div>
573		<?php
574		unset($_SESSION['background_image']);
575	}
576	?>
577
578</body>
579</html>
580