Project

General

Profile

Download (3.11 KB) Statistics
| Branch: | Tag: | Revision:
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($config['theme'] <> "")
11
	$g['theme'] = $config['theme'];
12
else
13
	$g['theme'] = "pfsense";
14

    
15
/*
16
 *  If this device is an apple ipod/iphone
17
 *  switch the theme to one that works with it.
18
 */
19
$apple_ua = array("iPhone","iPod");
20
foreach($apple_ua as $useragent)
21
	if(strstr($_SERVER['HTTP_USER_AGENT'], $useragent))
22
		$g['theme'] = "pfsense";
23

    
24
$pagetitle = gentitle( $pgtitle );
25

    
26
?>
27
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
28
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
29
<html>
30
<head>
31
	<title><?=$pagetitle;?></title>
32
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
33
	<link rel=”apple-touch-icon” href=”/themes/<?php echo $g['theme']; ?>/apple-touch-icon.png/>
34
        <?php if (strpos($_SERVER["SCRIPT_FILENAME"], "wizard.php") !== false &&
35
                  file_exists("{$g['www_path']}/themes/{$g['theme']}/wizard.css")): ?>
36
					<?php outputCSSFileInline("{$g['www_path']}/themes/{$g['theme']}/wizard.css"); ?>
37
        <?php else: ?>
38
        	<link rel="stylesheet" href="/themes/<?php echo $g['theme']; ?>/all.css" media="all" />
39
        <?php endif; ?>
40
		<?php 
41
			if(file_exists("{$g['www_path']}/niftycssCode.css")) 
42
				outputCSSFileInline("{$g['www_path']}/niftycssCode.css"); 
43
			if(file_exists("{$g['www_path']}/niftycssprintCode.css")) 
44
				outputCSSPrintFileInline("{$g['www_path']}/niftycssprintCode.css");
45
			if(file_exists("{$g['www_path']}/javascript/niftyjsCode.js")) 
46
				outputJavaScriptFileInline("{$g['www_path']}/javascript/niftyjsCode.js"); 
47
		?>
48
		<script type="text/javascript">
49
			var theme = "<?php echo $g['theme']; ?>";
50
		</script>
51
		<?php outputJavaScriptFileInline("{$g['www_path']}/themes/{$g['theme']}/loader.js"); ?>
52
<?php
53
		if($_GET['enablefirebuglite']) {
54
			outputJavaScriptFileInline("{$g['www_path']}/javascript/pi.js");
55
			outputJavaScriptFileInline("{$g['www_path']}/javascript/firebug-lite.js");
56
		}
57
		outputJavaScriptFileInline("{$g['www_path']}/javascript/scriptaculous/prototype.js");
58
		outputJavaScriptFileInline("{$g['www_path']}/javascript/scriptaculous/scriptaculous.js");
59
		outputJavaScriptFileInline("{$g['www_path']}/javascript/scriptaculous/effects.js");
60
		outputJavaScriptFileInline("{$g['www_path']}/javascript/scriptaculous/dragdrop.js");
61
		if(file_exists("{$g['www_path']}/javascript/global.js"))
62
			outputJavaScriptFileInline("{$g['www_path']}/javascript/global.js");
63

    
64
	/*
65
	 *	Find all javascript files that need to be included
66
	 *	for this page ... from the arrays ... :)
67
	 *	Coded by: Erik Kristensen
68
	 */
69

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

    
83
if (!isset($closehead))
84
	echo "</head>";
85
?>
(76-76/218)