Project

General

Profile

Feature #2648 ยป head.inc

modified head.inc to include "PlayBook" in $lowres_ua check - Pho Bia, 09/30/2012 09:44 PM

 
1
<?php
2
/*
3
	pfSense_MODULE:	header
4
*/
5

    
6
/* 
7
 *   if user has selected a custom template, use it.
8
 *   otherwise default to pfsense tempalte
9
 */
10
if (($g["disablethemeselection"] === true) && !empty($g["default_theme"]) && (is_dir($g["www_path"].'/themes/'.$g["default_theme"])))
11
	$g['theme'] = $g["default_theme"];
12
elseif($config['theme'] <> "" && (is_dir($g["www_path"].'/themes/'.$config['theme'])))
13
	$g['theme'] = $config['theme'];
14
else
15
	$g['theme'] = "pfsense";
16

    
17
/*
18
 *  If this device is an apple ipod/iphone
19
 *  switch the theme to one that works with it.
20
 */
21
$lowres_ua = array("iPhone", "iPod", "iPad", "Android", "BlackBerry", "Opera Mini", "Opera Mobi", "PlayBook");
22
foreach($lowres_ua as $useragent)
23
	if(strstr($_SERVER['HTTP_USER_AGENT'], $useragent))
24
		$g['theme'] = empty($g['theme_lowres']) ? "pfsense" : $g['theme_lowres'];
25

    
26
$pagetitle = gentitle( $pgtitle );
27

    
28
?>
29
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
30
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
31
<html>
32
<head>
33
	<title><?php echo($config['system']['hostname'] . "." . $config['system']['domain'] . " - " . $pagetitle); ?></title>
34
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
35
	<link rel="apple-touch-icon" href="/themes/<?php echo $g['theme']; ?>/apple-touch-icon.png"/>
36
        <?php if (strpos($_SERVER["SCRIPT_FILENAME"], "wizard.php") !== false &&
37
                  file_exists("{$g['www_path']}/themes/{$g['theme']}/wizard.css")): ?>
38
					<?php echo "<style type=\"text/css\" src=\"/themes/{$g['theme']}/wizard.css\"></style>"; ?>
39
        <?php else: ?>
40
        	<link rel="stylesheet" href="/themes/<?php echo $g['theme']; ?>/all.css" media="all" />
41
        <?php endif; ?>
42
		<link rel="stylesheet" type="text/css" href="/niftycssCode.css">
43
		<link rel="stylesheet" type="text/css" href="/niftycssprintCode.css" media="print">
44
		<link rel="stylesheet" type="text/css" href="/themes/<?=$g['theme']?>/new_tab_menu.css" media="all">
45
		<script type="text/javascript" src="/javascript/niftyjsCode.js"></script>
46
		<script type="text/javascript">
47
			var theme = "<?php echo $g['theme']; ?>";
48
		</script>
49
		<?php echo "\t<script type=\"text/javascript\" src=\"/themes/{$g['theme']}/loader.js\"></script>\n"; ?>
50
<?php
51
		if($_GET['enablefirebuglite']) {
52
			echo "\t<script type=\"text/javascript\" src=\"/javascript/pi.js\"></script>\n";
53
			echo "\t<script type=\"text/javascript\" src=\"/javascript/firebug-lite.js\"></script>\n";
54
		}
55
		echo "\t<script type=\"text/javascript\" src=\"/javascript/scriptaculous/prototype.js\"></script>\n";
56
		echo "\t<script type=\"text/javascript\" src=\"/javascript/scriptaculous/scriptaculous.js\"></script>\n";
57
		echo "\t<script type=\"text/javascript\" src=\"/javascript/scriptaculous/effects.js\"></script>\n";
58
		echo "\t<script type=\"text/javascript\" src=\"/javascript/scriptaculous/dragdrop.js\"></script>\n";
59
		if(file_exists("{$g['www_path']}/javascript/global.js"))
60
			echo "\t<script type=\"text/javascript\" src=\"/javascript/global.js\"></script>\n";
61
	/*
62
	 *	Find all javascript files that need to be included
63
	 *	for this page ... from the arrays ... :)
64
	 *	Coded by: Erik Kristensen
65
	 */
66

    
67
	$dir  = trim(basename($_SERVER["SCRIPT_FILENAME"], '.php'));
68
	$path = "{$g['www_path']}/javascript/" . $dir . "/";
69
	if (is_dir($path)) {
70
		if ($dh = opendir($path)) {
71
			while (($file = readdir($dh)) !== false) {
72
		   		if (is_dir($file)) 
73
					continue;
74
				echo "\t<script type=\"text/javascript\" src=\"/javascript/{$dir}/{$file}\"></script>\n";
75
			}
76
			closedir($dh);
77
		}
78
	}
79

    
80
if (!isset($closehead))
81
	echo "</head>";
82

    
83
/*  If this page is being remotely managed then do not allow the loading of the contents. */
84
if($config['remote_managed_pages']['item']) {
85
	foreach($config['remote_managed_pages']['item'] as $rmp) {
86
		if($rmp == $_SERVER['SCRIPT_NAME']) {
87
			include("fbegin.inc");
88
			print_info_box_np("This page is currently being managed by a remote machine.");
89
			include("fend.inc");
90
			exit;
91
		}
92
	}	
93
}
94

    
95
?>
    (1-1/1)