1 class SiteController < ApplicationController
2 layout 'site', :except => [:key, :permalink]
3 layout false, :only => [:key, :permalink]
5 before_filter :authorize_web
6 before_filter :set_locale
7 before_filter :require_user, :only => [:edit]
8 before_filter :require_oauth, :only => [:index]
11 if params[:lat] && params[:lon]
12 params[:anchor] = "#{params.delete(:zoom) || 5}/#{params.delete(:lat)}/#{params.delete(:lon)}"
17 unless STATUS == :database_readonly or STATUS == :database_offline
18 session[:location] ||= OSM::IPLocation(request.env['REMOTE_ADDR'])
23 lon, lat, zoom = ShortLink::decode(params[:code])
24 new_params = params.except(:code, :lon, :lat, :zoom)
26 if new_params.has_key? :m
28 new_params[:mlat] = lat
29 new_params[:mlon] = lon
32 new_params[:controller] = 'site'
33 new_params[:action] = 'index'
34 new_params[:anchor] = "#{zoom}/#{lat}/#{lon}"
36 redirect_to new_params
40 expires_in 7.days, :public => true
44 editor = params[:editor] || @user.preferred_editor || DEFAULT_EDITOR
47 render :action => :index
52 bbox = Node.find(params[:node]).bbox.to_unscaled
53 @lat = bbox.centre_lat
54 @lon = bbox.centre_lon
56 bbox = Way.find(params[:way]).bbox.to_unscaled
57 @lat = bbox.centre_lat
58 @lon = bbox.centre_lon
60 trace = Trace.visible_to(@user).find(params[:gpx])
62 @lon = trace.longitude
67 @locale = params[:copyright_locale] || I18n.locale
71 render :text => RichText.new(params[:format], params[:text]).to_html
75 render "id", :layout => false