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]
10 unless STATUS == :database_readonly or STATUS == :database_offline
11 session[:location] ||= OSM::IPLocation(request.env['REMOTE_ADDR'])
16 lon, lat, zoom = ShortLink::decode(params[:code])
17 new_params = params.clone
18 new_params.delete :code
19 if new_params.has_key? :m
21 new_params[:mlat] = lat
22 new_params[:mlon] = lon
24 new_params[:lat] = lat
25 new_params[:lon] = lon
27 new_params[:zoom] = zoom
28 new_params[:controller] = 'site'
29 new_params[:action] = 'index'
30 redirect_to new_params
34 expires_in 7.days, :public => true
38 editor = params[:editor] || @user.preferred_editor || DEFAULT_EDITOR
41 render :action => :index
46 bbox = Node.find(params[:node]).bbox.to_unscaled
47 @lat = bbox.centre_lat
48 @lon = bbox.centre_lon
50 bbox = Way.find(params[:way]).bbox.to_unscaled
51 @lat = bbox.centre_lat
52 @lon = bbox.centre_lon
54 trace = Trace.visible_to(@user).find(params[:gpx])
56 @lon = trace.longitude
61 @locale = params[:copyright_locale] || I18n.locale
65 render :text => RichText.new(params[:format], params[:text]).to_html