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 unless STATUS == :database_readonly or STATUS == :database_offline
12 session[:location] ||= OSM::IPLocation(request.env['REMOTE_ADDR'])
17 lon, lat, zoom = ShortLink::decode(params[:code])
18 new_params = params.clone
19 new_params.delete :code
20 if new_params.has_key? :m
22 new_params[:mlat] = lat
23 new_params[:mlon] = lon
25 new_params[:lat] = lat
26 new_params[:lon] = lon
28 new_params[:zoom] = zoom
29 new_params[:controller] = 'site'
30 new_params[:action] = 'index'
31 redirect_to new_params
35 expires_in 7.days, :public => true
39 editor = params[:editor] || @user.preferred_editor || DEFAULT_EDITOR
42 render :action => :index
47 bbox = Node.find(params[:node]).bbox.to_unscaled
48 @lat = bbox.centre_lat
49 @lon = bbox.centre_lon
51 bbox = Way.find(params[:way]).bbox.to_unscaled
52 @lat = bbox.centre_lat
53 @lon = bbox.centre_lon
55 trace = Trace.visible_to(@user).find(params[:gpx])
57 @lon = trace.longitude
62 @locale = params[:copyright_locale] || I18n.locale
66 render :text => RichText.new(params[:format], params[:text]).to_html