Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

pretty labels; filter out status 0,1

  • Loading branch information...
commit 17b822c2fe551436d82180e91778e944eb21b21c 1 parent bea3a6d
straup authored
2  www/.htaccess
View
@@ -101,6 +101,8 @@ RewriteRule ^user/([0-9]+)/checkin(/([0-9a-f]+))/?$ user_checkin.php?foursquare_
RewriteRule ^user/([0-9]+)/places(/page([0-9]+))?/?$ user_places.php?foursquare_id=$1&page=$3&%{QUERY_STRING} [L]
RewriteRule ^user/([0-9]+)/places/([0-9]+)(/page([0-9]+))?/?$ user_place.php?foursquare_id=$1&woeid=$2&page=$4&%{QUERY_STRING} [L]
+RewriteRule ^user/([0-9]+)/status/([0-9]+)(/page([0-9]+))?/?$ user_status.php?foursquare_id=$1&status_id=$2&page=$4&%{QUERY_STRING} [L]
+
RewriteRule ^user/([0-9]+)/history/nearby/?$ user_history_nearby.php?foursquare_id=$1&%{QUERY_STRING} [L]
RewriteRule ^user/([0-9]+)/history/export(\.([a-z]+))?/?$ user_history_export.php?foursquare_id=$1&format=$3&%{QUERY_STRING} [L]
24 www/include/lib_privatesquare_checkins.php
View
@@ -197,6 +197,13 @@ function privatesquare_checkins_localities_for_user(&$user, $more=array()){
#################################################################
+ # TO DO: venues for status (notes)
+ # this should probably be it's own function because while it
+ # maybe should group on venue_id the requirements for how things
+ # are sorted are different and it's quickly turning in to a mess
+ # of if/else statements. See also, comments below about filesorts
+ # (20120701/straup)
+
function privatesquare_checkins_venues_for_user(&$user, $more=array()){
$defaults = array(
@@ -214,13 +221,30 @@ function privatesquare_checkins_venues_for_user(&$user, $more=array()){
$sql = "SELECT venue_id, COUNT(id) AS count FROM PrivatesquareCheckins WHERE user_id='{$enc_user}'";
+ # TO DO: indexes so we can do status for user and city...
+
if (isset($more['locality'])){
$enc_loc = AddSlashes($more['locality']);
$sql .= " AND locality='{$enc_loc}'";
}
+ else if (isset($more['status_id'])){
+ $enc_status = AddSlashes($more['status_id']);
+ $sql .= " AND status_id='{$enc_status}'";
+ }
+
$sql .= " GROUP BY venue_id";
+ # SEE THIS? HEY YOU!!! THIS IS IMPORTANT.
+ # This will always cause MySQL to do a filesort.
+ # That is not a feature but for development and
+ # testing purposes we will live with it. For now.
+ # (20120701/straup)
+
+ if (isset($more['status_id'])){
+ $sql .= " ORDER BY created DESC";
+ }
+
$rsp = db_fetch_users($cluster_id, $sql);
$tmp = array();
35 www/templates/page_user_status.txt
View
@@ -0,0 +1,35 @@
+{capture assign="page_title"}{$owner.username} | status | {$str_status}{/capture}
+{include file="inc_head.txt"}
+
+<div id="displaymap" class="map" data-extent="{$geo_stats.bounding_box|@join:","|escape}" data-hash="false" data-interactive="false" data-provider="toner">
+{include file="inc_map_header_markers.txt markers=$venues}
+</div>
+
+<h3 class="header-right">{$str_status|escape}</h3>
+
+{foreach from=$venues item="row"}
+
+<div class="checkin" data-venue="{$row.venue_id|escape}">
+
+ <h3 class="header-left">
+ <a href="{$row|@urls_venue}">{$row.name|escape}</a>
+ <span class="header-loc">{* fix me: add date you said you wanted to go here *}</span>
+ </h3>
+
+ <div class="map" data-zoom="14" data-center="{$row.latitude|escape},{$row.longitude|escape}" data-hash="false" data-interactive="false" data-provider="toner">
+ <div class="marker marker-history" data-location="{$row.latitude|escape},{$row.longitude|escape}"><span class="marker-history-text">{$row.name|escape}</span></div>
+ </div>
+</div>
+
+{/foreach}
+
+{include file="inc_pagination.txt"}
+{include file="inc_export_links.txt"}
+
+<script type="text/javascript">
+$(document).ready(function(){literal}{{/literal}
+ privatesquare_htmapl();
+{literal}}{/literal});
+</script>
+
+{include file="inc_foot.txt"}
82 www/user_status.php
View
@@ -0,0 +1,82 @@
+<?php
+
+ include("include/init.php");
+
+ loadlib("privatesquare_checkins");
+ loadlib("privatesquare_checkins_utils");
+ loadlib("privatesquare_export");
+ loadlib("foursquare_users");
+
+ $fsq_id = get_int32("foursquare_id");
+
+ if (! $fsq_id){
+ error_404();
+ }
+
+ $status_id = get_int32("status_id");
+
+ if (! $status_id){
+ error_404();
+ }
+
+ $status_map = privatesquare_checkins_status_map();
+
+ if (! isset($status_map[$status_id])){
+ error_404();
+ }
+
+ # Dunno... this might change
+ # (20120701/straup)
+
+ if (in_array($status_id, array(0, 1))){
+ error_404();
+ }
+
+ $str_status = $status_map[$status_id];
+
+ $whereami = "user/{$fsq_id}/status/{$status_id}/";
+ login_ensure_loggedin($whereami);
+
+ $fsq_user = foursquare_users_get_by_foursquare_id($fsq_id);
+
+ if (! $fsq_user){
+ error_404();
+ }
+
+ $owner = users_get_by_id($fsq_user['user_id']);
+ $is_own = ($owner['id'] == $GLOBALS['cfg']['user']['id']) ? 1 : 0;
+
+ # for now...
+
+ if (! $is_own){
+ error_403();
+ }
+
+ $more = array(
+ 'status_id' => $status_id,
+ );
+
+ # TO DO: hooks for nearby or a WOE ID or nearby
+
+ if ($page = get_int32("page")){
+ $more['page'] = $page;
+ }
+
+ # see notes in lib_privatesquare_checkins
+
+ $rsp = privatesquare_checkins_venues_for_user($owner, $more);
+ $GLOBALS['smarty']->assign_by_ref("venues", $rsp['rows']);
+
+ $GLOBALS['smarty']->assign_by_ref("owner", $owner);
+ $GLOBALS['smarty']->assign_by_ref("status_map", $status_map);
+ $GLOBALS['smarty']->assign("str_status", $str_status);
+
+ $pagination_url = urls_places_for_user($owner) . "status/{$status_id}/";
+ $GLOBALS['smarty']->assign("pagination_url", $pagination_url);
+
+ $export_formats = privatesquare_export_valid_formats();
+ $GLOBALS['smarty']->assign("export_formats", array_keys($export_formats));
+
+ $GLOBALS['smarty']->display("page_user_status.txt");
+ exit();
+?>
Please sign in to comment.
Something went wrong with that request. Please try again.