summaryrefslogtreecommitdiffstats
path: root/includes/header.php
blob: 887aa415935b2f662b446a1f805ef3ca65e78721 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php
$accepted = isset($_SESSION['accepted']) && $_SESSION['accepted'] == 1;
function htmlHeader($css = array(), $title = 'Pathery', $desc = '') {
	global $accepted;
	?>
<!DOCTYPE html>
<html xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<title><? echo $title; ?></title>

	<link href="css/page.css" rel="stylesheet" type="text/css" />
	<link href="css/maps.css" rel="stylesheet" type="text/css" />
<?php
	foreach ($css as $c) {
		echo "	<link href=\"css/$c.css\" rel=\"stylesheet\" type=\"text/css\" />\n";
	}
	if ($desc !== '') 
		echo "	<meta name='Description' content='$desc'>";
?>
	<script src="js/ajax.js" async="async"></script>
	<script src="js/mapspecs.js"></script>

    <script>
	(function(d,c){var a,b,g,e;a=d.createElement("script");a.type="text/javascript";a.async=!0;a.src=("https:"===d.location.protocol?"https:":"http:")+'//api.mixpanel.com/site_media/js/api/mixpanel.2.js';b=d.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b);c._i=[];c.init=function(a,d,f){var b=c;"undefined"!==typeof f?b=c[f]=[]:f="mixpanel";g="disable track track_pageview track_links track_forms register register_once unregister identify name_tag set_config".split(" ");
	for(e=0;e<g.length;e++)(function(a){b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments,0)))}})(g[e]);c._i.push([a,d,f])};window.mixpanel=c})(document,[]);
	mixpanel.init("24743c6567f831ddfcbbbd3f397e11e4");
<?php
	if ($accepted) {
		if ($_SESSION['displayName'] != 'noname')
			echo 'mixpanel.name_tag(' . json_encode($_SESSION['displayName']) . ');';
		if ($_SERVER['HTTP_HOST'] == 'www.pathery.com')
			echo 'mixpanel.identify(' . json_encode($_SESSION['userID']) . ');';
	}
?>
    </script>
	 
<script>
function showSignin() {
	if (document.getElementById('oid_hidden') !== undefined) {
		document.getElementById('oid_hidden').id = 'oid_wrapper';
	}
}
function hideSignin() {
	if (document.getElementById('oid_wrapper') !== undefined) {
		document.getElementById('oid_wrapper').id = 'oid_hidden';
	}
}
</script>
	 
</head>
	<?php
}

function htmlFooter() {
	?>
    <script>
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-371072-3']);
    _gaq.push(['_trackPageview']);

	WebFontConfig = {
		google: {
			families: ['Cantarell:400,700:latin']
		}
	};

	(function() {
		var proto = document.location.protocol,
		    s = document.getElementsByTagName('script')[0].parentNode;

		var wf = document.createElement('script');
		wf.src = ('https:' == proto ? 'https' : 'http') + '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
		wf.type = 'text/javascript';
		wf.async = 'true';
		s.appendChild(wf, s);


		var ga = document.createElement('script');
		ga.type = 'text/javascript';
		ga.async = true;
        ga.src = ('https:' == proto ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
		s.parentNode.appendChild(ga, s);
    })();
	</script>

</body>
</html>
<?
}

function topbar($links) {
	global $accepted;
	echo '<div id="topbar">';

	$page = isset($_GET['page']) ? $_GET['page'] : 'home';
	foreach ($links as $key => $value) {
		if ($page == $key)
			$selected = " selected";
		else
			$selected = "";
		echo "<a href='$key' class='nav$selected'>$value</a>";
	}

	echo "<div id='user'>";
	if ($accepted) {
		echo "Logged in as <a href='cp' title='change name'>$_SESSION[displayName]</a><br>";
		if ($_SESSION['displayName'] == 'noname')
			echo "<a href='cp' title='change name'>Update your name</a> | ";
		echo "<a href='logout'>Logout</a>";
	} else {
		?>
<a href='javascript:showSignin();'>Sign in</a>
<div class="wrapper" id="oid_hidden" >
	<h2>Sign in</h2>
	<div id="oid_box">
		<h2 style="color:#333;">Do you have an account here?</h2>
		<a href="login?op=google"><img id="oid_btn" src="images/btns/signin_Google.png" alt="Sign in with Google" /></a>
		<a href="login?op=yahoo"><img id="oid_btn" src="images/btns/signin_Yahoo.png" alt="Sign in with Yahoo" /></a>
		<a id="oid_learn" href="http://openid.net/get-an-openid/what-is-openid/"  target="_blank" >Learn more about OpenID</a>
		<a id="oid_cancel" href="javascript:hideSignin();">X</a>
	</div>
</div>
		<?
	}
	echo "</div>";

	echo "</div>";
}

?>