# The base set of sensible PHP options. You could put these in your
# php.ini file too, but having them in your Apache config puts
# everything in one place. Magic quotes off because they are stupid.
# Register globals off for the same reason. Track errors is so that
# we can at least get at the error messages we hide using @func().
# last_modified is a bad idea if we have any dynamic content. Short
# tags make for a few saved bytes of cruft and are fine unless you're
# running another XML preprocessor over your code (wtf?).
# Expermental: Will add notes about this if it actually works; if not
# it never happened...
<IfModule mod_php5.c>
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value magic_quotes_runtime 0
php_value track_errors 1
php_value last_modified off
php_value short_open_tag on
php_flag display_errors on
# this sets all current and future error flags on, except for E_NOTICE
# which can go fuck itself. we have some separate code for checking the
# one notice we do care about.
php_value error_reporting 2147483639
</IfModule>
#
# Hey! Everything in here is better suited to httpd.conf, since
# we get a performance boost if we can turn off AllowOverride and
# not have to stat the webroot for every request. On the other
# hand, this means we never have to touch apache once it's up.
# Flexibility over performance.
#
# In an ideal world, you'd stick it in here on dev and your build
# system would bundle the changes into (a file included in) httpd.conf
# for your production deployment. Yeah. Do that.
#
# ETags are a bad idea if you have multiple web servers. We'll do
# more explicit caching with Expires headers anyway.
FileETag none
# The base set of sensible PHP options have moved; they now live in www/php.ini.
# Some basic pointers to php files
DirectoryIndex index.php
ErrorDocument 404 /404.php
ErrorDocument 403 /403.php
# Get mod_rewrite fired up
RewriteEngine on
# See also: the 'php-ini' command in the root Makefile
RewriteRule ^php.ini - [R=404,L]
# Images
RewriteRule ^favicon.ico images/favicon.ico [L]
RewriteRule ^apple-touch-icon.png images/apple-touch-icon.png [L]
# Login stuff
RewriteRule ^signout/?$ signout.php [L]
RewriteRule ^checkcookie/?$ checkcookie.php [L]
RewriteRule ^auth/?$ auth_callback_foursquare_oauth.php?%{QUERY_STRING} [L]
RewriteRule ^signin/?$ signin_foursquare_oauth.php?%{QUERY_STRING} [L]
RewriteRule ^signup/email/?$ signup_email.php?%{QUERY_STRING} [L]
RewriteRule ^signin/email/?$ signin_email.php?%{QUERY_STRING} [L]
# Password retrieval stuff
# RewriteRule ^forgot/?$ forgot.php [L]
# RewriteRule ^reset/([a-zA-Z0-9]+)/?$ reset.php?reset=$1 [L,QSA]
# Account stuff
RewriteRule ^account/?$ account.php [L]
# RewriteRule ^account/password/?$ account_password.php [L]
# RewriteRule ^account/delete/?$ account_delete.php [L]
RewriteRule ^account/bergcloud/?$ account_bergcloud.php [L]
RewriteRule ^account/foursquare/sync/?$ account_foursquare_sync.php?%{QUERY_STRING} [L]
# API
RewriteRule ^api/?$ api_rest.php [L]
RewriteRule ^api/methods/?$ api_methods.php [L]
RewriteRule ^api/methods/(.*)/?$ api_method.php?method=$1&%{QUERY_STRING} [L]
RewriteRule ^api/rest/(.*)/?$ api_rest.php?method=$1&%{QUERY_STRING} [L]
# foursquare stuff
RewriteRule ^me(/(.*))?/?$ me.php?path=$2&%{QUERY_STRING} [L]
RewriteRule ^want(/([a-f0-9]+))?/?$ venue_i_want_to_go_there.php?venue_id=$2&%{QUERY_STRING} [L]
RewriteRule ^venues?/([a-z]+)(/page([0-9]+))?/?$ venues_provider.php?provider=$1&page=$3&%{QUERY_STRING} [L]
RewriteRule ^privatesquare/create/?$ privatesquare_create.php?%{QUERY_STRING} [L]
RewriteRule ^privatesquare/venues(/page([0-9]+))?/?$ privatesquare_venues.php?page=$2&%{QUERY_STRING} [L]
RewriteRule ^venue/([0-9]+)/?$ venue.php?venue_id=$1&%{QUERY_STRING} [L]
RewriteRule ^venue/([a-z]+)/([a-f0-9]+)/?$ venue.php?provider=$1&venue_id=$2&%{QUERY_STRING} [L]
RewriteRule ^venue/([0-9]+)/visits(/page([0-9]+))?/?$ venue_visits.php?venue_id=$1&page=$3&%{QUERY_STRING} [L]
RewriteRule ^venue/([a-z]+)/([a-f0-9]+)/visits(/page([0-9]+))?/?$ venue_visits.php?provider=$1&venue_id=$2&page=$4&%{QUERY_STRING} [L]
RewriteRule ^user/([0-9]+)/checkin(/([0-9a-f]+))/?$ user_checkin.php?foursquare_id=$1&checkin_id=$3&%{QUERY_STRING} [L]
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]+)/atlas/?$ user_atlas_of_desire.php?foursquare_id=$1&%{QUERY_STRING} [L]
RewriteRule ^user/([0-9]+)/atlas/(([0-9]+)|([a-z]+))/nearby(/page([0-9]+))?/?$ user_atlas_nearby.php?foursquare_id=$1&status_id=$3&status_label=$4&page=$6&%{QUERY_STRING} [L]
RewriteRule ^user/([0-9]+)/atlas/(([0-9]+)|([a-z]+))/([0-9]+)(/page([0-9]+))?/?$ user_atlas.php?foursquare_id=$1&status_id=$3&status_label=$4&woeid=$5&page=$7&%{QUERY_STRING} [L]
RewriteRule ^user/([0-9]+)/atlas/(([0-9]+)|([a-z]+))(/page([0-9]+))?/?$ user_atlas.php?foursquare_id=$1&status_id=$3&status_label=$4&page=$6&%{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]
RewriteRule ^user/([0-9]+)/history/([a-zA-Z]+)(/page([0-9]+))?/?$ user_history_dow.php?foursquare_id=$1&dow=$2&page=$4&%{QUERY_STRING} [L]
RewriteRule ^user/([0-9]+)/history(/page([0-9]+))?/?$ user_history.php?foursquare_id=$1&page=$3&%{QUERY_STRING} [L]
RewriteRule ^user/([0-9]+)/history/([0-9-;:T]+)(/page([0-9]+))?/?$ user_history.php?foursquare_id=$1&when=$2&page=$4&%{QUERY_STRING} [L]
RewriteRule ^user/([0-9]+)/pending/?$ user_pending_checkins.php?foursquare_id=$1&%{QUERY_STRING} [L]
# TBD... (20140119/straup)
# RewriteRule ^user/([0-9]+)/trips/geocode/?$ user_trips_add_geocode.php?%{QUERY_STRING} [L]
RewriteRule ^user/([0-9]+)/trips/add/?$ user_trips_add.php?foursquare_id=$1&%{QUERY_STRING} [L]
RewriteRule ^user/([0-9]+)/trips(/page([0-9]+))?/?$ user_trips.php?foursquare_id=$1&%{QUERY_STRING} [L]
RewriteRule ^user/([0-9]+)/trips/past(/page([0-9]+))?/?$ user_trips_past.php?foursquare_id=$1&page=$3&%{QUERY_STRING} [L]
RewriteRule ^user/([0-9]+)/trips/archives/?$ user_trips_archives.php?foursquare_id=$1&%{QUERY_STRING} [L]
RewriteRule ^user/([0-9]+)/trips/archives/([0-9]+)(/page([0-9]+))?/?$ user_trips_archive.php?foursquare_id=$1&year=$2&page=$4&%{QUERY_STRING} [L]
RewriteRule ^user/([0-9]+)/trips/archives/([0-9]+)/([0-9]+)(/page([0-9]+))?/?$ user_trips_archive.php?foursquare_id=$1&year=$2&month=$3&page=$5&%{QUERY_STRING} [L]
RewriteRule ^user/([0-9]+)/trips/archives/([0-9]+)/places/([0-9]+)(/page([0-9]+))?/?$ user_trips_archive_place.php?foursquare_id=$1&year=$2&woeid=$3&page=$5&%{QUERY_STRING} [L]
RewriteRule ^user/([0-9]+)/trips/places(/page([0-9]+))?/?$ user_trips_places.php?foursquare_id=$1&%{QUERY_STRING} [L]
RewriteRule ^user/([0-9]+)/trips/places/([0-9]+)(/page([0-9]+))?/?$ user_trips_place.php?foursquare_id=$1&woeid=$2&page=$4&%{QUERY_STRING} [L]
RewriteRule ^user/([0-9]+)/trips/([0-9]+)/?$ user_trip.php?foursquare_id=$1&trip_id=$2&%{QUERY_STRING} [L]
RewriteRule ^user/([0-9]+)/trips/([0-9]+)/checkins(/page([0-9]+))?/?$ user_trip_checkins.php?foursquare_id=$1&trip_id=$2&page=$4&%{QUERY_STRING} [L]
RewriteRule ^user/([0-9]+)/trips/calendars(/page([0-9]+))?/?$ user_trips_calendars.php?foursquare_id=$1&page=$3&%{QUERY_STRING} [L]
RewriteRule ^user/([0-9]+)/trips/calendars/add/?$ user_trips_calendars_add.php?foursquare_id=$1&%{QUERY_STRING} [L]
RewriteRule ^user/([0-9]+)/trips/calendars/([0-9]+)/?$ user_trips_calendar.php?foursquare_id=$1&id=$2&%{QUERY_STRING} [L]
RewriteRule ^user/([0-9]+)/trips/calendars/([0-9]+)/share/?$ user_trips_calendar_share.php?foursquare_id=$1&id=$2&%{QUERY_STRING} [L]
# Include user ID at all? (20140305/straup)
# See also: Github issue #42 (20140420/straup)
RewriteRule ^user/([0-9]+)/trips/calendars.ics$ user_trips_calendar_ics.php?foursquare_id=$1&%{QUERY_STRING} [L]
RewriteRule ^calendars/?$ user_trips_calendar_ics.php?%{QUERY_STRING} [L]
# See this. It's the *last* rule because it basically catches everything
RewriteRule ^4sq/?$ index.php?provider=foursquare&%{QUERY_STRING} [L]
RewriteRule ^([a-z]+)/$ index.php?provider=$1&%{QUERY_STRING} [L]