-
Notifications
You must be signed in to change notification settings - Fork 1
/
occupation.php
117 lines (96 loc) · 3.3 KB
/
occupation.php
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
<?php
require("config.php");
$mysqli = new mysqli($config['hostname'],$config['username'],$config['password'],$config['database']);
//This is where we will query the database and pull using the cities/states SELECT statement
// If the result returns true
if ($result = $mysqli->query("SELECT * FROM occupation WHERE short='{$_GET['short']}' AND verified='1'")) {
if($result->num_rows>0){
$occ = $result->fetch_object();
$title = $occ->title;
$twitter = $occ->twitter;
$blog = $occ->blog;
$lat = $occ->lat;
$lng = $occ->lng;
}else{
//handle occupation not found;
}
} else {
echo $mysqli->error;
}
$mysqli->close();
?><html>
<head>
<title><?php echo $title; ?> | occupy.it</title>
<base href="<?php echo $config['base']; ?>" />
<link rel="stylesheet" href="boilerplate.css" />
<link rel="stylesheet" href="style.css" />
<script type="text/javascript" src="jquery-1.6.min.js"></script>
<script type="text/javascript" src="jquery.livetwitter.min.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
(function ($) {
$.fn.loadRSS = function (url) {
var $domNode = this;
$domNode.empty().append("<div class='loading'><span>Loading...</span></div>");
$.get("xs.php?u="+url, function(data){
//Fairly messily done - attempts to guess RSS schema. Suggestions?
$domNode.empty();
var post_tag = ["item", "entry"]; var i = 0;
while( (i<post_tag.length)){
$articles = $(data).find(post_tag[i]);
if($articles.size()>0){
break;
}
i++;
}
$articles.each(function(){
$article = $(this);
var $content = $article.children("description");
if($content.size()==0){
$content = $article.children("content");
}
var $href = $article.children("link");
var href = ($href.text()=='')?$href.attr('href'):$href.text();
$domNode.append("<article><h2><a href='"+href+"'>"+$article.children('title').text()+"</a></h2>"+$content.text()+"</article>");
});
});
}
})(jQuery);
$(document).ready(function(){
$('#tweets').append("<div class='loading'><span>Loading...</span></div>").liveTwitter('<?php echo $twitter; ?>', {mode: 'user_timeline'});
$('#blog').loadRSS('<?php echo $blog; ?>');
var centre = new google.maps.LatLng(<?php echo $lat . ", " . $lng; ?>);
var map = new google.maps.Map(document.getElementById("occupation_map"), {
zoom: 15,
mapTypeControl: false,
streetViewControl: false,
overviewMapControl: false,
center: centre,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var marker = new google.maps.Marker({
position: centre,
map: map,
title: "<?php echo $title; ?>"
});
google.maps.event.addListener(marker, 'click', function() {
location.href = 'http://maps.google.co.uk/?q='+marker.getTitle()+'@'+centre.toUrlValue();
});
});
</script>
</head>
<body>
<aside>
<h2>Twitter</h2>
<div id="tweets"></div>
</aside>
<div id="content" class="with_aside">
<header>
<h1><?php echo $title; ?> <span>occupied</span></h1>
<div id="occupation_map"></div>
<div id="info"></div>
</header>
<section id="blog"></section>
</div>
</body>
</html>