Skip to content
This repository was archived by the owner on Dec 4, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004

Copyright (C) 2004 Sam Hocevar
14 rue de Plaisance, 75014 Paris, France
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. You just DO WHAT THE FUCK YOU WANT TO.
25 changes: 25 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
1.0 - Initial relsese
1.1 - Remaked the Google Laitiude code
- minor changes to the index.php
- removed the shout form in check.php (the damm PHP Class does not work for shouting)
- Private check in works
-
1.2 - now can add venue
- fix POST error
- show checkin response
- add shout, but not work
- suppot twitter & facebook
1.3 - shout now work
1.4 - add login screen, and logout
- add 4sqr logo
1.5 - fixed Issue 6
- login screen add latidude_code, not need conf/conf.php
- Now latidude_code with minus sign (some latidude_code of user no with minus sign)

2.0 - update to 4sq API V2, using foursquare-async, https://github.com/jmathai/foursquare-async
- rewrite code
- support upload photo
2.1 - fix Issue 12
- Search Venues: add favorites, trending,and nearby types
- Google Places Searches

1 change: 1 addition & 0 deletions THANKSTO
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Thanks to Lucky Strike and Coke developers
43 changes: 43 additions & 0 deletions add.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
<meta name="robots" content="noindex">
</head>
<body>
<div align="center"><img src="logo.png" /><br />
<?php
require_once 'kernel/EpiCurl.php';
require_once 'kernel/EpiFoursquare.php';
require_once 'config.php';
$fsObjUnAuth = new EpiFoursquare($clientId, $clientSecret, $_COOKIE['access_token']);


$name = $_POST['name'];
$address = $_POST['address'];
$crossstreet = $_POST['crossstreet'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$phone = $_POST['phone'];
$geolat = $_POST['geolat'];
$geolong = $_POST['geolong'];
$venues = $fsObjUnAuth->post("/venues/add", array(
'name' => "{$name}", 'address' => "{$address}", 'crossStreet' => "{$crossstreet}", 'city'=>"{$city}", 'state'=>"{$state}", 'zip'=>"{$zip}", 'phone'=>"{$phone}", 'll' => "{$geolat},{$geolong}"
));
?>
<div align='center'>
Add new venue <strong> <? echo "$name" ?> </strong>, OK!<br >
<?php
$array = array($address,$city,$state);

$adds = implode(", ", $array);

echo "$adds <br >";
$id=$venues->response->venue->id;
echo "<a href='check.php?id=$id&name=$name&add=$address&city=$city&state=$state'><b>Check in!</b></a><br />" ;
?>
<hr />
<small>Power by 4sqr.</small>
</div>
</body>
</html>
91 changes: 91 additions & 0 deletions check.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?php
require_once 'config.php';
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
<meta name="robots" content="noindex">
</head>
<body>
<div align="center"><img src="logo.png" /><br />
<?php

$new = $_GET['new'];
$ref= $_GET['ref'];
include "kernel/latitude.php";
if ($new ==1){
if ($ref ==Null){
echo "<div align='center'>";
echo "<form action='add.php' method='POST'>";
echo"<b>Add venue:<b><br>";
echo"<b>name:</b> <input size='30' name='name' value=''><br>";
echo "address: <input size='30' name='address' value=''><br>";
echo "crossstreet: <input size='30' name='crossstreet' value=''><br>";
echo "city: <input size='30' name='city' value=''><br>";
echo "state: <input size='30' name='state' value=''><br>";
echo "zip: <input size='30' name='zip' value=''><br>";
echo "phone: <input size='30' name='phone' value=''><br>";
echo "<input type='hidden' name='geolat' value='$latitude'>";
echo "<input type='hidden' name='geolong' value='$longitude'>";
echo "<input type='submit' value='Add'>";
}
else {
$name=$placedetails["result"]["name"];
$address=$placedetails["result"]["formatted_address"];
if ($placedetails["result"]["address_components"] !=Null) {
foreach ($placedetails["result"]["address_components"] as $address_components) {
if ($address_components["types"][0]=="postal_code"){
$zip=$address_components["long_name"];
}
}
}
$phone=$placedetails["result"]["formatted_phone_number"];
echo "<div align='center'>";
echo "<form action='add.php' method='POST'>";
echo"<b>Add venue:<b><br>";
echo"<b>name:</b> <input size='30' name='name' value='$name'><br>";
echo "address: <input size='30' name='address' value='$address'><br>";
echo "crossstreet: <input size='30' name='crossstreet' value=''><br>";
echo "city: <input size='30' name='city' value=''><br>";
echo "state: <input size='30' name='state' value=''><br>";
echo "zip: <input size='30' name='zip' value='$zip'><br>";
echo "phone: <input size='30' name='phone' value='$phone'><br>";
echo "<input type='hidden' name='geolat' value='$latitude'>";
echo "<input type='hidden' name='geolong' value='$longitude'>";
echo "<input type='submit' value='Add'>";
}
}


else {
$id = $_GET['id'];
$name = $_GET['name'];
$add = $_GET['add'];
$city = $_GET['city'];
$state = $_GET['state'];
echo "<div align='center'>";
echo "Check in @ <strong> $name </strong><br >";
$array = array($add,$city,$state);

$adds = implode(", ", $array);

echo "$adds <br >";
echo "<form action='checkin.php' method='POST' enctype=\"multipart/form-data\">";

echo "<input type='hidden' name='id' value='$id'>";
echo "<input type='hidden' name='name' value='$name'>";
echo "<input type='hidden' name='latitude' value='$latitude'>";
echo "<input type='hidden' name='longitude' value='$longitude'>";
echo "shout:<input size='30' name='shout' value=''><br>";
echo "private: <input type='checkbox' name='privat' value='0' /><br>";
echo "twitter: <input type='checkbox' name='twitter' checked value='1' /><br>";
echo "Facebook: <input type='checkbox' name='facebook' checked value='1' /><br>";
echo "Photo: <input type='file' accept=\"image/jpeg\" name='photo' /><br />";
echo "<input type='submit' value='Check in!'></form>";
}
?>
<hr />
<small>Power by 4sqr.</small>
</div>
</body>
</html>
106 changes: 106 additions & 0 deletions checkin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
<meta name="robots" content="noindex">
</head>
<body>
<div align="center"><img src="logo.png" /><br />
<?php
require_once 'kernel/EpiCurl.php';
require_once 'kernel/EpiFoursquare.php';
require_once 'config.php';
$fsObjUnAuth = new EpiFoursquare($clientId, $clientSecret, $_COOKIE['access_token']);

$id = $_POST['id'];
$shout = $_POST['shout'];
$name = $_POST['name'];
$geolat = $_POST['latitude'];
$geolong = $_POST['longitude'];
$privat = 'public';

if ($_FILES['photo']['name'] == NULL){
if ($_POST['privat']== NULL){
$privat = 'public';
if ($_POST['facebook']== 1)
$privat = $privat.' ,facebook';
if ($_POST['twitter']== 1)
$privat = $privat.' ,twitter';
}
else {
$privat = 'private';
}
}

$checkin = $fsObjUnAuth->post('/checkins/add',array(
'venueId' => "{$id}", 'venue' => "{$name}", 'shout'=>"{$shout}", 'broadcast' => "{$privat}", 'll' => "{$geolat},{$geolong}"
));

if ($_FILES['photo']['name'] !=NULL){

if (($_POST['twitter']== 1) && ($_POST['facebook']== 0)){
$privat = 'twitter';
}
elseif (($_POST['twitter']== 0) && ($_POST['facebook']== 1)) {
$privat = 'facebook';
}
elseif (($_POST['twitter']== 1) && ($_POST['facebook']== 1)) {
$privat = 'twitter,facebook';
}
else {
$privat = '';
}
$postVars = array();
$postVars['checkinId'] = $checkin->response->checkin->id;
$postVars['ll'] = "{$geolat},{$geolong}";
$postVars['broadcast'] = "{$privat}";
$postVars['photo'] = '@'.$_FILES['photo']['tmp_name'];

$pcheckin = $fsObjUnAuth->post('/photos/add', $postVars, $up=1);
}
?>
<center>

<?php

$add = $checkin->response->checkin->venue ->location->address;

$notification=$checkin ->notifications;
foreach ($notification as $notifications){
if ($notifications -> type == "message"){
$message = $notifications->item->message;
echo "$message<br>";
echo "$add <br>";
if ($shout != NULL){
echo "$shout <br>";
}
}
if ($notifications -> type == "mayorship"){
$mayor = $notifications->item->message;
echo "$mayor <br>";
}

if ($notifications -> type == "score"){
$score = $notifications->item->scores;
if ($score != NULL){
foreach ($score as $s){
$points = $s->points;
$smessage = $s->message;

echo "$smessage (+$points) pts<br>";
}
}
$total = $notifications->item->total;
echo "Total: $total pts<br>";
}
}
if ($_FILES['photo']['name'] !=NULL){
$myphoto=$pcheckin->response->photo->sizes->items[2]->url;
echo "Photo upload done!<br />";
echo "<img src=\"{$myphoto}\" />";
}
?>
<hr />
<small>Power by 4sqr.</small>
</center>
</body>
</html>
8 changes: 8 additions & 0 deletions config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
// registering your application: https://foursquare.com/oauth/
$clientId = ''; //Your CLIENT ID
$clientSecret = ''; //CLIENT SECRET
$redirectUri = ''; //CALLBACK URL, is http://path/index.php, path is your URL
$latidude_code = ''; //* google latitude user id... you can find it at http://www.google.com/latitude/apps/badge
$placeskey = ''; //* Google Places API key... you must require it, see https://code.google.com/apis/maps/documentation/places/#Limits
?>
88 changes: 88 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?php
ob_start();
require_once 'kernel/EpiCurl.php';
require_once 'kernel/EpiFoursquare.php';
include 'config.php';
$fsObjUnAuth = new EpiFoursquare($clientId, $clientSecret);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
<meta name="robots" content="noindex">
</head>
<body>
<div align="center"><img src="logo.png" /><br />
<?php
if (!isset($_GET['code']) && !isset($_COOKIE['access_token'])){
$authorizeUrl = $fsObjUnAuth->getAuthorizeUrl($redirectUri);
?>
<a href="<?php echo $authorizeUrl; ?>"><img src="signinwith-foursquare.png" /></a>
<?php } else {
if(!isset($_COOKIE['access_token'])) {
$token = $fsObjUnAuth->getAccessToken($_GET['code'], $redirectUri);
setcookie('access_token', $token->access_token, time()+(100*24*3600));
$_COOKIE['access_token'] = $token->access_token;
} ?>
<?php
require_once "kernel/latitude.php";
$fsObjUnAuth->setAccessToken($_COOKIE['access_token']);
$venues = $fsObjUnAuth->get('/venues/search', array('ll' => "{$latitude},{$longitude}", 'limit' => 50));
foreach ($venues->response->groups as $groups) {
if ($groups->type =='favorites'){
echo $groups->name.'<br />';
foreach ($groups->items as $venue) {
$name = $venue->name;
$id = $venue->id;
$dist = $venue->location->distance;
$add = $venue->location->address;
$city = $venue->location->city;
$state = $venue->location->state;
echo "<a href='check.php?id=$id&name=$name&add=$add&city=$city&state=$state'>$name</a> - $dist m<br />" ;
}
}
elseif ($groups->type =='trending'){
echo $groups->name.'<br />';
foreach ($groups->items as $venue) {
$name = $venue->name;
$id = $venue->id;
$dist = $venue->location->distance;
$add = $venue->location->address;
$city = $venue->location->city;
$state = $venue->location->state;
echo "<a href='check.php?id=$id&name=$name&add=$add&city=$city&state=$state'>$name</a> - $dist m<br />" ;
}
}
elseif ($groups->type =='nearby') {
echo $groups->name.'<br />';
foreach ($groups->items as $venue) {
$name = $venue->name;
$id = $venue->id;
$dist = $venue->location->distance;
$add = $venue->location->address;
$city = $venue->location->city;
$state = $venue->location->state;
echo "<a href='check.php?id=$id&name=$name&add=$add&city=$city&state=$state'>$name</a> - $dist m<br />" ;
}
}
else {
foreach ($groups->items as $venue) {
$name = $venue->name;
$id = $venue->id;
$dist = $venue->location->distance;
$add = $venue->location->address;
$city = $venue->location->city;
$state = $venue->location->state;
echo "<a href='check.php?id=$id&name=$name&add=$add&city=$city&state=$state'>$name</a> - $dist m<br />" ;
}
}
}
echo "<hr /><a href='places.php'>Place Searches</a><br />";
echo "<a href='check.php?new=1'>Add venue</a><br />";
echo "<a href=\"http://maps.google.com/?q=$latitude,$longitude\">I at here!</a><br />";
echo "<a href='logout.php'>Logout</a><br />";
} ?>
<hr />
<small>Power by 4sqr.</small>
</div>
</body>
</html>
Loading