Standardise on double quoted strings
This commit is contained in:
parent
5cbd4038ed
commit
dc2a2c8ebd
230 changed files with 1809 additions and 1812 deletions
|
@ -8,3 +8,6 @@ Style/FileName:
|
|||
- 'script/deliver-message'
|
||||
- 'script/locale/reload-languages'
|
||||
- 'script/update-spam-blocks'
|
||||
|
||||
Style/StringLiterals:
|
||||
EnforcedStyle: double_quotes
|
||||
|
|
|
@ -141,12 +141,6 @@ Style/RegexpLiteral:
|
|||
Style/RescueModifier:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 6639
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
Style/StringLiterals:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 8
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
|
|
84
Gemfile
84
Gemfile
|
@ -1,97 +1,97 @@
|
|||
source 'https://rubygems.org'
|
||||
source "https://rubygems.org"
|
||||
|
||||
# Require rails
|
||||
gem 'rails', '4.2.0'
|
||||
gem "rails", "4.2.0"
|
||||
|
||||
# Require things which have moved to gems in ruby 1.9
|
||||
gem 'bigdecimal', "~> 1.1.0", :platforms => :ruby_19
|
||||
gem "bigdecimal", "~> 1.1.0", :platforms => :ruby_19
|
||||
|
||||
# Require things which have moved to gems in ruby 2.0
|
||||
gem 'psych', :platforms => :ruby_20
|
||||
gem "psych", :platforms => :ruby_20
|
||||
|
||||
# Require json for multi_json
|
||||
gem 'json'
|
||||
gem "json"
|
||||
|
||||
# Use postgres as the database
|
||||
gem 'pg'
|
||||
gem "pg"
|
||||
|
||||
# Use SCSS for stylesheets
|
||||
gem 'sass-rails', '~> 5.0'
|
||||
gem "sass-rails", "~> 5.0"
|
||||
|
||||
# Use Uglifier as compressor for JavaScript assets
|
||||
gem 'uglifier', '>= 1.3.0'
|
||||
gem "uglifier", ">= 1.3.0"
|
||||
|
||||
# Use CoffeeScript for .js.coffee assets and views
|
||||
gem 'coffee-rails', '~> 4.1.0'
|
||||
gem "coffee-rails", "~> 4.1.0"
|
||||
|
||||
# Use jquery as the JavaScript library
|
||||
gem 'jquery-rails'
|
||||
gem "jquery-rails"
|
||||
|
||||
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
||||
# gem 'jbuilder', '~> 2.0'
|
||||
gem 'jsonify-rails'
|
||||
gem "jsonify-rails"
|
||||
|
||||
# Use R2 for RTL conversion
|
||||
gem 'r2'
|
||||
gem "r2"
|
||||
|
||||
# Use autoprefixer to generate CSS prefixes
|
||||
gem 'autoprefixer-rails'
|
||||
gem "autoprefixer-rails"
|
||||
|
||||
# Load rails plugins
|
||||
gem 'rails-i18n', "~> 4.0.0"
|
||||
gem 'dynamic_form'
|
||||
gem 'rinku', '>= 1.2.2', :require => 'rails_rinku'
|
||||
gem 'oauth-plugin', '>= 0.5.1'
|
||||
gem 'open_id_authentication', '>= 1.1.0'
|
||||
gem 'validates_email_format_of', '>= 1.5.1'
|
||||
gem 'composite_primary_keys', '~> 8.0.0'
|
||||
gem 'http_accept_language', '~> 2.0.0'
|
||||
gem 'paperclip', '~> 4.0'
|
||||
gem 'deadlock_retry', '>= 1.2.0'
|
||||
gem 'openstreetmap-i18n-js', '>= 3.0.0.rc5.3', :require => 'i18n-js'
|
||||
gem 'rack-cors'
|
||||
gem 'actionpack-page_caching'
|
||||
gem "rails-i18n", "~> 4.0.0"
|
||||
gem "dynamic_form"
|
||||
gem "rinku", ">= 1.2.2", :require => "rails_rinku"
|
||||
gem "oauth-plugin", ">= 0.5.1"
|
||||
gem "open_id_authentication", ">= 1.1.0"
|
||||
gem "validates_email_format_of", ">= 1.5.1"
|
||||
gem "composite_primary_keys", "~> 8.0.0"
|
||||
gem "http_accept_language", "~> 2.0.0"
|
||||
gem "paperclip", "~> 4.0"
|
||||
gem "deadlock_retry", ">= 1.2.0"
|
||||
gem "openstreetmap-i18n-js", ">= 3.0.0.rc5.3", :require => "i18n-js"
|
||||
gem "rack-cors"
|
||||
gem "actionpack-page_caching"
|
||||
|
||||
# We need ruby-openid 2.2.0 or later for ruby 1.9 support
|
||||
gem 'ruby-openid', '>= 2.2.0'
|
||||
gem "ruby-openid", ">= 2.2.0"
|
||||
|
||||
# Markdown formatting support
|
||||
gem 'redcarpet'
|
||||
gem "redcarpet"
|
||||
|
||||
# Character conversion support for ruby 1.8
|
||||
gem 'iconv', '= 0.1', :platforms => :ruby_18
|
||||
gem "iconv", "= 0.1", :platforms => :ruby_18
|
||||
|
||||
# Load libxml support for XML parsing and generation
|
||||
gem 'libxml-ruby', '>= 2.0.5', :require => 'libxml'
|
||||
gem "libxml-ruby", ">= 2.0.5", :require => "libxml"
|
||||
|
||||
# Use for HTML sanitisation
|
||||
gem 'sanitize'
|
||||
gem 'htmlentities'
|
||||
gem "sanitize"
|
||||
gem "htmlentities"
|
||||
|
||||
# Load SystemTimer for implementing request timeouts
|
||||
gem 'SystemTimer', '>= 1.1.3', :require => 'system_timer', :platforms => :ruby_18
|
||||
gem "SystemTimer", ">= 1.1.3", :require => "system_timer", :platforms => :ruby_18
|
||||
|
||||
# Load httpclient and soap4r for SOAP support for Quova GeoIP queries
|
||||
gem 'httpclient'
|
||||
gem 'soap4r-ruby1.9'
|
||||
gem "httpclient"
|
||||
gem "soap4r-ruby1.9"
|
||||
|
||||
# Load memcache client in case we are using it
|
||||
gem 'dalli'
|
||||
gem 'kgio'
|
||||
gem "dalli"
|
||||
gem "kgio"
|
||||
|
||||
# Gems useful for development
|
||||
group :development do
|
||||
gem 'vendorer'
|
||||
gem "vendorer"
|
||||
end
|
||||
|
||||
# Gems needed for running tests
|
||||
group :test do
|
||||
gem 'timecop'
|
||||
gem 'minitest', '~> 5.1', :platforms => [:ruby_19, :ruby_20]
|
||||
gem "timecop"
|
||||
gem "minitest", "~> 5.1", :platforms => [:ruby_19, :ruby_20]
|
||||
end
|
||||
|
||||
# Needed in development as well so rake can see konacha tasks
|
||||
group :development, :test do
|
||||
gem 'konacha'
|
||||
gem 'poltergeist'
|
||||
gem "konacha"
|
||||
gem "poltergeist"
|
||||
end
|
||||
|
|
2
Rakefile
2
Rakefile
|
@ -1,6 +1,6 @@
|
|||
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||
|
||||
require File.expand_path('../config/application', __FILE__)
|
||||
require File.expand_path("../config/application", __FILE__)
|
||||
|
||||
OpenStreetMap::Application.load_tasks
|
||||
|
|
|
@ -51,17 +51,17 @@ class AmfController < ApplicationController
|
|||
logger.info("Executing AMF #{message}(#{args.join(',')})")
|
||||
|
||||
case message
|
||||
when 'getpresets' then result = getpresets(*args)
|
||||
when 'whichways' then result = whichways(*args)
|
||||
when 'whichways_deleted' then result = whichways_deleted(*args)
|
||||
when 'getway' then result = getway(args[0].to_i)
|
||||
when 'getrelation' then result = getrelation(args[0].to_i)
|
||||
when 'getway_old' then result = getway_old(args[0].to_i, args[1])
|
||||
when 'getway_history' then result = getway_history(args[0].to_i)
|
||||
when 'getnode_history' then result = getnode_history(args[0].to_i)
|
||||
when 'findgpx' then result = findgpx(*args)
|
||||
when 'findrelations' then result = findrelations(*args)
|
||||
when 'getpoi' then result = getpoi(*args)
|
||||
when "getpresets" then result = getpresets(*args)
|
||||
when "whichways" then result = whichways(*args)
|
||||
when "whichways_deleted" then result = whichways_deleted(*args)
|
||||
when "getway" then result = getway(args[0].to_i)
|
||||
when "getrelation" then result = getrelation(args[0].to_i)
|
||||
when "getway_old" then result = getway_old(args[0].to_i, args[1])
|
||||
when "getway_history" then result = getway_history(args[0].to_i)
|
||||
when "getnode_history" then result = getnode_history(args[0].to_i)
|
||||
when "findgpx" then result = findgpx(*args)
|
||||
when "findrelations" then result = findrelations(*args)
|
||||
when "getpoi" then result = getpoi(*args)
|
||||
end
|
||||
|
||||
result
|
||||
|
@ -82,19 +82,19 @@ class AmfController < ApplicationController
|
|||
result = [-5, nil]
|
||||
else
|
||||
case message
|
||||
when 'putway' then
|
||||
when "putway" then
|
||||
orn = renumberednodes.dup
|
||||
result = putway(renumberednodes, *args)
|
||||
result[4] = renumberednodes.reject { |k, _v| orn.key?(k) }
|
||||
if result[0] == 0 && result[2] != result[3] then renumberedways[result[2]] = result[3] end
|
||||
when 'putrelation' then
|
||||
when "putrelation" then
|
||||
result = putrelation(renumberednodes, renumberedways, *args)
|
||||
when 'deleteway' then
|
||||
when "deleteway" then
|
||||
result = deleteway(*args)
|
||||
when 'putpoi' then
|
||||
when "putpoi" then
|
||||
result = putpoi(*args)
|
||||
if result[0] == 0 && result[2] != result[3] then renumberednodes[result[2]] = result[3] end
|
||||
when 'startchangeset' then
|
||||
when "startchangeset" then
|
||||
result = startchangeset(*args)
|
||||
end
|
||||
|
||||
|
@ -138,7 +138,7 @@ class AmfController < ApplicationController
|
|||
amf_handle_error("'startchangeset'", nil, nil) do
|
||||
user = getuser(usertoken)
|
||||
unless user then return -1, "You are not logged in, so Potlatch can't write any changes to the database." end
|
||||
if user.blocks.active.exists? then return -1, t('application.setup_user_auth.blocked') end
|
||||
if user.blocks.active.exists? then return -1, t("application.setup_user_auth.blocked") end
|
||||
if REQUIRE_TERMS_AGREED && user.terms_agreed.nil? then return -1, "You must accept the contributor terms before you can edit." end
|
||||
|
||||
if cstags
|
||||
|
@ -155,7 +155,7 @@ class AmfController < ApplicationController
|
|||
elsif closecomment.empty?
|
||||
cs.save!
|
||||
else
|
||||
cs.tags['comment'] = closecomment
|
||||
cs.tags["comment"] = closecomment
|
||||
# in case closecomment has chars not allowed in xml
|
||||
cs.tags = strip_non_xml_chars cs.tags
|
||||
cs.save_with_tags!
|
||||
|
@ -168,7 +168,7 @@ class AmfController < ApplicationController
|
|||
cs.tags = cstags
|
||||
cs.user_id = user.id
|
||||
unless closecomment.empty?
|
||||
cs.tags['comment'] = closecomment
|
||||
cs.tags["comment"] = closecomment
|
||||
# in case closecomment has chars not allowed in xml
|
||||
cs.tags = strip_non_xml_chars cs.tags
|
||||
end
|
||||
|
@ -176,9 +176,9 @@ class AmfController < ApplicationController
|
|||
cs.created_at = Time.now.getutc
|
||||
cs.closed_at = cs.created_at + Changeset::IDLE_TIMEOUT
|
||||
cs.save_with_tags!
|
||||
return [0, '', cs.id]
|
||||
return [0, "", cs.id]
|
||||
else
|
||||
return [0, '', nil]
|
||||
return [0, "", nil]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -215,12 +215,12 @@ class AmfController < ApplicationController
|
|||
|
||||
def getlocalized(lang)
|
||||
# What we end up actually using. Reported in Potlatch's created_by=* string
|
||||
loaded_lang = 'en'
|
||||
loaded_lang = "en"
|
||||
|
||||
# Load English defaults
|
||||
en = YAML.load(File.open("#{Rails.root}/config/potlatch/locales/en.yml"))["en"]
|
||||
|
||||
if lang == 'en'
|
||||
if lang == "en"
|
||||
return [loaded_lang, en]
|
||||
else
|
||||
# Use English as a fallback
|
||||
|
@ -288,7 +288,7 @@ class AmfController < ApplicationController
|
|||
relations = relations.collect { |relation| [relation.id, relation.version] }.uniq
|
||||
end
|
||||
|
||||
[0, '', ways, points, relations]
|
||||
[0, "", ways, points, relations]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -312,7 +312,7 @@ class AmfController < ApplicationController
|
|||
nodes_in_area = Node.bbox(bbox).joins(:ways_via_history).where(:current_ways => { :visible => false })
|
||||
way_ids = nodes_in_area.collect { |node| node.ways_via_history.invisible.collect(&:id) }.flatten.uniq
|
||||
|
||||
[0, '', way_ids]
|
||||
[0, "", way_ids]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -320,7 +320,7 @@ class AmfController < ApplicationController
|
|||
# Returns the way id, a Potlatch-style array of points, a hash of tags, the version number, and the user ID.
|
||||
|
||||
def getway(wayid) #:doc:
|
||||
amf_handle_error_with_timeout("'getway' #{wayid}", 'way', wayid) do
|
||||
amf_handle_error_with_timeout("'getway' #{wayid}", "way", wayid) do
|
||||
if POTLATCH_USE_SQL
|
||||
points = sql_get_nodes_in_way(wayid)
|
||||
tags = sql_get_tags_in_way(wayid)
|
||||
|
@ -333,11 +333,11 @@ class AmfController < ApplicationController
|
|||
way = Way.where(:id => wayid).first
|
||||
|
||||
# check case where way has been deleted or doesn't exist
|
||||
return [-4, 'way', wayid] if way.nil? || !way.visible
|
||||
return [-4, "way", wayid] if way.nil? || !way.visible
|
||||
|
||||
points = way.nodes.preload(:node_tags).collect do |node|
|
||||
nodetags = node.tags
|
||||
nodetags.delete('created_by')
|
||||
nodetags.delete("created_by")
|
||||
[node.lon, node.lat, node.id, nodetags, node.version]
|
||||
end
|
||||
tags = way.tags
|
||||
|
@ -345,7 +345,7 @@ class AmfController < ApplicationController
|
|||
uid = way.changeset.user.id
|
||||
end
|
||||
|
||||
[0, '', wayid, points, tags, version, uid]
|
||||
[0, "", wayid, points, tags, version, uid]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -365,8 +365,8 @@ class AmfController < ApplicationController
|
|||
# 5. is this the current, visible version? (boolean)
|
||||
|
||||
def getway_old(id, timestamp) #:doc:
|
||||
amf_handle_error_with_timeout("'getway_old' #{id}, #{timestamp}", 'way', id) do
|
||||
if timestamp == ''
|
||||
amf_handle_error_with_timeout("'getway_old' #{id}, #{timestamp}", "way", id) do
|
||||
if timestamp == ""
|
||||
# undelete
|
||||
old_way = OldWay.where(:visible => true, :way_id => id).unredacted.order("version DESC").first
|
||||
points = old_way.get_nodes_undelete unless old_way.nil?
|
||||
|
@ -392,8 +392,8 @@ class AmfController < ApplicationController
|
|||
return [-1, "Sorry, the server could not find a way at that time.", id]
|
||||
else
|
||||
curway = Way.find(id)
|
||||
old_way.tags['history'] = "Retrieved from v#{old_way.version}"
|
||||
return [0, '', id, points, old_way.tags, curway.version, (curway.version == old_way.version && curway.visible)]
|
||||
old_way.tags["history"] = "Retrieved from v#{old_way.version}"
|
||||
return [0, "", id, points, old_way.tags, curway.version, (curway.version == old_way.version && curway.visible)]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -434,9 +434,9 @@ class AmfController < ApplicationController
|
|||
revdates.collect! { |d| [(d + 1).strftime("%d %b %Y, %H:%M:%S")] + revusers[d.to_i] }
|
||||
revdates.uniq!
|
||||
|
||||
return ['way', wayid, revdates]
|
||||
return ["way", wayid, revdates]
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
return ['way', wayid, []]
|
||||
return ["way", wayid, []]
|
||||
end
|
||||
|
||||
# Find history of a node. Returns 'node', id, and an array of previous versions as above.
|
||||
|
@ -445,14 +445,14 @@ class AmfController < ApplicationController
|
|||
history = Node.find(nodeid).old_nodes.unredacted.reverse.collect do |old_node|
|
||||
[(old_node.timestamp + 1).strftime("%d %b %Y, %H:%M:%S")] + change_user(old_node)
|
||||
end
|
||||
return ['node', nodeid, history]
|
||||
return ["node", nodeid, history]
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
return ['node', nodeid, []]
|
||||
return ["node", nodeid, []]
|
||||
end
|
||||
|
||||
def change_user(obj)
|
||||
user_object = obj.changeset.user
|
||||
user = user_object.data_public? ? user_object.display_name : 'anonymous'
|
||||
user = user_object.data_public? ? user_object.display_name : "anonymous"
|
||||
uid = user_object.data_public? ? user_object.id : 0
|
||||
[user, uid]
|
||||
end
|
||||
|
@ -465,7 +465,7 @@ class AmfController < ApplicationController
|
|||
user = getuser(usertoken)
|
||||
|
||||
return -1, "You must be logged in to search for GPX traces." unless user
|
||||
return -1, t('application.setup_user_auth.blocked') if user.blocks.active.exists?
|
||||
return -1, t("application.setup_user_auth.blocked") if user.blocks.active.exists?
|
||||
|
||||
query = Trace.visible_to(user)
|
||||
if searchterm.to_i > 0
|
||||
|
@ -476,7 +476,7 @@ class AmfController < ApplicationController
|
|||
gpxs = query.collect do |gpx|
|
||||
[gpx.id, gpx.name, gpx.description]
|
||||
end
|
||||
[0, '', gpxs]
|
||||
[0, "", gpxs]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -490,11 +490,11 @@ class AmfController < ApplicationController
|
|||
# 5. version.
|
||||
|
||||
def getrelation(relid) #:doc:
|
||||
amf_handle_error("'getrelation' #{relid}", 'relation', relid) do
|
||||
amf_handle_error("'getrelation' #{relid}", "relation", relid) do
|
||||
rel = Relation.where(:id => relid).first
|
||||
|
||||
return [-4, 'relation', relid] if rel.nil? || !rel.visible
|
||||
[0, '', relid, rel.tags, rel.members, rel.version]
|
||||
return [-4, "relation", relid] if rel.nil? || !rel.visible
|
||||
[0, "", relid, rel.tags, rel.members, rel.version]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -526,10 +526,10 @@ class AmfController < ApplicationController
|
|||
# 3. version.
|
||||
|
||||
def putrelation(renumberednodes, renumberedways, usertoken, changeset_id, version, relid, tags, members, visible) #:doc:
|
||||
amf_handle_error("'putrelation' #{relid}", 'relation', relid) do
|
||||
amf_handle_error("'putrelation' #{relid}", "relation", relid) do
|
||||
user = getuser(usertoken)
|
||||
unless user then return -1, "You are not logged in, so the relation could not be saved." end
|
||||
if user.blocks.active.exists? then return -1, t('application.setup_user_auth.blocked') end
|
||||
if user.blocks.active.exists? then return -1, t("application.setup_user_auth.blocked") end
|
||||
if REQUIRE_TERMS_AGREED && user.terms_agreed.nil? then return -1, "You must accept the contributor terms before you can edit." end
|
||||
|
||||
unless tags_ok(tags) then return -1, "One of the tags is invalid. Linux users may need to upgrade to Flash Player 10.1." end
|
||||
|
@ -551,8 +551,8 @@ class AmfController < ApplicationController
|
|||
members.each do |m|
|
||||
mid = m[1].to_i
|
||||
if mid < 0
|
||||
mid = renumberednodes[mid] if m[0] == 'Node'
|
||||
mid = renumberedways[mid] if m[0] == 'Way'
|
||||
mid = renumberednodes[mid] if m[0] == "Node"
|
||||
mid = renumberedways[mid] if m[0] == "Way"
|
||||
end
|
||||
if mid
|
||||
typedmembers << [m[0], mid, m[2].delete("\000-\037\ufffe\uffff", "^\011\012\015")]
|
||||
|
@ -581,9 +581,9 @@ class AmfController < ApplicationController
|
|||
end # transaction
|
||||
|
||||
if relid <= 0
|
||||
return [0, '', relid, new_relation.id, new_relation.version]
|
||||
return [0, "", relid, new_relation.id, new_relation.version]
|
||||
else
|
||||
return [0, '', relid, relid, relation.version]
|
||||
return [0, "", relid, relid, relation.version]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -612,12 +612,12 @@ class AmfController < ApplicationController
|
|||
# 6. hash of node versions (node=>version)
|
||||
|
||||
def putway(renumberednodes, usertoken, changeset_id, wayversion, originalway, pointlist, attributes, nodes, deletednodes) #:doc:
|
||||
amf_handle_error("'putway' #{originalway}", 'way', originalway) do
|
||||
amf_handle_error("'putway' #{originalway}", "way", originalway) do
|
||||
# -- Initialise
|
||||
|
||||
user = getuser(usertoken)
|
||||
unless user then return -1, "You are not logged in, so the way could not be saved." end
|
||||
if user.blocks.active.exists? then return -1, t('application.setup_user_auth.blocked') end
|
||||
if user.blocks.active.exists? then return -1, t("application.setup_user_auth.blocked") end
|
||||
if REQUIRE_TERMS_AGREED && user.terms_agreed.nil? then return -1, "You must accept the contributor terms before you can edit." end
|
||||
|
||||
if pointlist.length < 2 then return -2, "Server error - way is only #{points.length} points long." end
|
||||
|
@ -654,7 +654,7 @@ class AmfController < ApplicationController
|
|||
unless tags_ok(node.tags) then return -1, "One of the tags is invalid. Linux users may need to upgrade to Flash Player 10.1." end
|
||||
node.tags = strip_non_xml_chars node.tags
|
||||
|
||||
node.tags.delete('created_by')
|
||||
node.tags.delete("created_by")
|
||||
node.version = version
|
||||
if id <= 0
|
||||
# We're creating the node
|
||||
|
@ -708,7 +708,7 @@ class AmfController < ApplicationController
|
|||
end
|
||||
end # transaction
|
||||
|
||||
[0, '', originalway, way.id, renumberednodes, way.version, nodeversions, deletednodes]
|
||||
[0, "", originalway, way.id, renumberednodes, way.version, nodeversions, deletednodes]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -722,10 +722,10 @@ class AmfController < ApplicationController
|
|||
# 4. version.
|
||||
|
||||
def putpoi(usertoken, changeset_id, version, id, lon, lat, tags, visible) #:doc:
|
||||
amf_handle_error("'putpoi' #{id}", 'node', id) do
|
||||
amf_handle_error("'putpoi' #{id}", "node", id) do
|
||||
user = getuser(usertoken)
|
||||
unless user then return -1, "You are not logged in, so the point could not be saved." end
|
||||
if user.blocks.active.exists? then return -1, t('application.setup_user_auth.blocked') end
|
||||
if user.blocks.active.exists? then return -1, t("application.setup_user_auth.blocked") end
|
||||
if REQUIRE_TERMS_AGREED && user.terms_agreed.nil? then return -1, "You must accept the contributor terms before you can edit." end
|
||||
|
||||
unless tags_ok(tags) then return -1, "One of the tags is invalid. Linux users may need to upgrade to Flash Player 10.1." end
|
||||
|
@ -766,9 +766,9 @@ class AmfController < ApplicationController
|
|||
end # transaction
|
||||
|
||||
if id <= 0
|
||||
return [0, '', id, new_node.id, new_node.version]
|
||||
return [0, "", id, new_node.id, new_node.version]
|
||||
else
|
||||
return [0, '', id, node.id, node.version]
|
||||
return [0, "", id, node.id, node.version]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -779,18 +779,18 @@ class AmfController < ApplicationController
|
|||
# Returns array of id, long, lat, hash of tags, (current) version.
|
||||
|
||||
def getpoi(id, timestamp) #:doc:
|
||||
amf_handle_error("'getpoi' #{id}", 'node', id) do
|
||||
amf_handle_error("'getpoi' #{id}", "node", id) do
|
||||
id = id.to_i
|
||||
n = Node.find(id)
|
||||
v = n.version
|
||||
unless timestamp == ''
|
||||
unless timestamp == ""
|
||||
n = OldNode.where("node_id = ? AND timestamp <= ?", id, timestamp).unredacted.order("timestamp DESC").first
|
||||
end
|
||||
|
||||
if n
|
||||
return [0, '', n.id, n.lon, n.lat, n.tags, v]
|
||||
return [0, "", n.id, n.lon, n.lat, n.tags, v]
|
||||
else
|
||||
return [-4, 'node', id]
|
||||
return [-4, "node", id]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -806,10 +806,10 @@ class AmfController < ApplicationController
|
|||
# Returns 0 (success), unchanged way id, new way version, new node versions.
|
||||
|
||||
def deleteway(usertoken, changeset_id, way_id, way_version, deletednodes) #:doc:
|
||||
amf_handle_error("'deleteway' #{way_id}", 'way', way_id) do
|
||||
amf_handle_error("'deleteway' #{way_id}", "way", way_id) do
|
||||
user = getuser(usertoken)
|
||||
unless user then return -1, "You are not logged in, so the way could not be deleted." end
|
||||
if user.blocks.active.exists? then return -1, t('application.setup_user_auth.blocked') end
|
||||
if user.blocks.active.exists? then return -1, t("application.setup_user_auth.blocked") end
|
||||
if REQUIRE_TERMS_AGREED && user.terms_agreed.nil? then return -1, "You must accept the contributor terms before you can edit." end
|
||||
|
||||
way_id = way_id.to_i
|
||||
|
@ -843,7 +843,7 @@ class AmfController < ApplicationController
|
|||
end
|
||||
end
|
||||
end # transaction
|
||||
[0, '', way_id, old_way.version, nodeversions]
|
||||
[0, "", way_id, old_way.version, nodeversions]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -906,7 +906,7 @@ class AmfController < ApplicationController
|
|||
AND current_ways.visible=TRUE
|
||||
AND #{OSM.sql_for_area(bbox, "current_nodes.")}
|
||||
EOF
|
||||
ActiveRecord::Base.connection.select_all(sql).collect { |a| [a['wayid'].to_i, a['version'].to_i] }
|
||||
ActiveRecord::Base.connection.select_all(sql).collect { |a| [a["wayid"].to_i, a["version"].to_i] }
|
||||
end
|
||||
|
||||
def sql_find_pois_in_area(bbox)
|
||||
|
@ -922,9 +922,9 @@ class AmfController < ApplicationController
|
|||
ActiveRecord::Base.connection.select_all(sql).each do |row|
|
||||
poitags = {}
|
||||
ActiveRecord::Base.connection.select_all("SELECT k,v FROM current_node_tags WHERE id=#{row['id']}").each do |n|
|
||||
poitags[n['k']] = n['v']
|
||||
poitags[n["k"]] = n["v"]
|
||||
end
|
||||
pois << [row['id'].to_i, row['lon'].to_f, row['lat'].to_f, poitags, row['version'].to_i]
|
||||
pois << [row["id"].to_i, row["lon"].to_f, row["lat"].to_f, poitags, row["version"].to_i]
|
||||
end
|
||||
pois
|
||||
end
|
||||
|
@ -949,7 +949,7 @@ class AmfController < ApplicationController
|
|||
AND crm.member_id IN (#{way_ids.join(',')})
|
||||
EOF
|
||||
end
|
||||
ActiveRecord::Base.connection.select_all(sql).collect { |a| [a['relid'].to_i, a['version'].to_i] }
|
||||
ActiveRecord::Base.connection.select_all(sql).collect { |a| [a["relid"].to_i, a["version"].to_i] }
|
||||
end
|
||||
|
||||
def sql_get_nodes_in_way(wayid)
|
||||
|
@ -965,10 +965,10 @@ class AmfController < ApplicationController
|
|||
ActiveRecord::Base.connection.select_all(sql).each do |row|
|
||||
nodetags = {}
|
||||
ActiveRecord::Base.connection.select_all("SELECT k,v FROM current_node_tags WHERE id=#{row['id']}").each do |n|
|
||||
nodetags[n['k']] = n['v']
|
||||
nodetags[n["k"]] = n["v"]
|
||||
end
|
||||
nodetags.delete('created_by')
|
||||
points << [row['lon'].to_f, row['lat'].to_f, row['id'].to_i, nodetags, row['version'].to_i]
|
||||
nodetags.delete("created_by")
|
||||
points << [row["lon"].to_f, row["lat"].to_f, row["id"].to_i, nodetags, row["version"].to_i]
|
||||
end
|
||||
points
|
||||
end
|
||||
|
@ -976,16 +976,16 @@ class AmfController < ApplicationController
|
|||
def sql_get_tags_in_way(wayid)
|
||||
tags = {}
|
||||
ActiveRecord::Base.connection.select_all("SELECT k,v FROM current_way_tags WHERE id=#{wayid.to_i}").each do |row|
|
||||
tags[row['k']] = row['v']
|
||||
tags[row["k"]] = row["v"]
|
||||
end
|
||||
tags
|
||||
end
|
||||
|
||||
def sql_get_way_version(wayid)
|
||||
ActiveRecord::Base.connection.select_one("SELECT version FROM current_ways WHERE id=#{wayid.to_i}")['version']
|
||||
ActiveRecord::Base.connection.select_one("SELECT version FROM current_ways WHERE id=#{wayid.to_i}")["version"]
|
||||
end
|
||||
|
||||
def sql_get_way_user(wayid)
|
||||
ActiveRecord::Base.connection.select_one("SELECT user FROM current_ways,changesets WHERE current_ways.id=#{wayid.to_i} AND current_ways.changeset=changesets.id")['user']
|
||||
ActiveRecord::Base.connection.select_one("SELECT user FROM current_ways,changesets WHERE current_ways.id=#{wayid.to_i} AND current_ways.changeset=changesets.id")["user"]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ class ApiController < ApplicationController
|
|||
# within the specified bounding box, and in the specified page.
|
||||
def trackpoints
|
||||
# retrieve the page number
|
||||
page = params['page'].to_s.to_i
|
||||
page = params["page"].to_s.to_i
|
||||
|
||||
unless page >= 0
|
||||
report_error("Page number must be greater than or equal to 0")
|
||||
|
@ -35,10 +35,10 @@ class ApiController < ApplicationController
|
|||
|
||||
doc = XML::Document.new
|
||||
doc.encoding = XML::Encoding::UTF_8
|
||||
root = XML::Node.new 'gpx'
|
||||
root['version'] = '1.0'
|
||||
root['creator'] = 'OpenStreetMap.org'
|
||||
root['xmlns'] = "http://www.topografix.com/GPX/1/0"
|
||||
root = XML::Node.new "gpx"
|
||||
root["version"] = "1.0"
|
||||
root["creator"] = "OpenStreetMap.org"
|
||||
root["xmlns"] = "http://www.topografix.com/GPX/1/0"
|
||||
|
||||
doc.root = root
|
||||
|
||||
|
@ -61,21 +61,21 @@ class ApiController < ApplicationController
|
|||
gpx_file = Trace.find(gpx_id)
|
||||
|
||||
if gpx_file.trackable?
|
||||
track = XML::Node.new 'trk'
|
||||
track = XML::Node.new "trk"
|
||||
doc.root << track
|
||||
timestamps = true
|
||||
|
||||
if gpx_file.identifiable?
|
||||
track << (XML::Node.new("name") << gpx_file.name)
|
||||
track << (XML::Node.new("desc") << gpx_file.description)
|
||||
track << (XML::Node.new("url") << url_for(:controller => 'trace', :action => 'view', :display_name => gpx_file.user.display_name, :id => gpx_file.id))
|
||||
track << (XML::Node.new("url") << url_for(:controller => "trace", :action => "view", :display_name => gpx_file.user.display_name, :id => gpx_file.id))
|
||||
end
|
||||
else
|
||||
# use the anonymous track segment if the user hasn't allowed
|
||||
# their GPX points to be tracked.
|
||||
timestamps = false
|
||||
if anon_track.nil?
|
||||
anon_track = XML::Node.new 'trk'
|
||||
anon_track = XML::Node.new "trk"
|
||||
doc.root << anon_track
|
||||
end
|
||||
track = anon_track
|
||||
|
@ -84,12 +84,12 @@ class ApiController < ApplicationController
|
|||
|
||||
if trackid != point.trackid
|
||||
if gpx_file.trackable?
|
||||
trkseg = XML::Node.new 'trkseg'
|
||||
trkseg = XML::Node.new "trkseg"
|
||||
track << trkseg
|
||||
trackid = point.trackid
|
||||
else
|
||||
if anon_trkseg.nil?
|
||||
anon_trkseg = XML::Node.new 'trkseg'
|
||||
anon_trkseg = XML::Node.new "trkseg"
|
||||
anon_track << anon_trkseg
|
||||
end
|
||||
trkseg = anon_trkseg
|
||||
|
@ -141,7 +141,7 @@ class ApiController < ApplicationController
|
|||
doc = OSM::API.new.get_xml_doc
|
||||
|
||||
# add bounds
|
||||
doc.root << bbox.add_bounds_to(XML::Node.new 'bounds')
|
||||
doc.root << bbox.add_bounds_to(XML::Node.new "bounds")
|
||||
|
||||
# get ways
|
||||
# find which ways are needed
|
||||
|
@ -210,13 +210,13 @@ class ApiController < ApplicationController
|
|||
# Get a list of the tiles that have changed within a specified time
|
||||
# period
|
||||
def changes
|
||||
zoom = (params[:zoom] || '12').to_i
|
||||
zoom = (params[:zoom] || "12").to_i
|
||||
|
||||
if params.include?(:start) && params.include?(:end)
|
||||
starttime = Time.parse(params[:start])
|
||||
endtime = Time.parse(params[:end])
|
||||
else
|
||||
hours = (params[:hours] || '1').to_i.hours
|
||||
hours = (params[:hours] || "1").to_i.hours
|
||||
endtime = Time.now.getutc
|
||||
starttime = endtime - hours
|
||||
end
|
||||
|
@ -228,7 +228,7 @@ class ApiController < ApplicationController
|
|||
tiles = Node.where(:timestamp => starttime..endtime).group("maptile_for_point(latitude, longitude, #{zoom})").count
|
||||
|
||||
doc = OSM::API.new.get_xml_doc
|
||||
changes = XML::Node.new 'changes'
|
||||
changes = XML::Node.new "changes"
|
||||
changes["starttime"] = starttime.xmlschema
|
||||
changes["endtime"] = endtime.xmlschema
|
||||
|
||||
|
@ -236,7 +236,7 @@ class ApiController < ApplicationController
|
|||
x = (tile.to_i >> zoom) & mask
|
||||
y = tile.to_i & mask
|
||||
|
||||
t = XML::Node.new 'tile'
|
||||
t = XML::Node.new "tile"
|
||||
t["x"] = x.to_s
|
||||
t["y"] = y.to_s
|
||||
t["z"] = zoom.to_s
|
||||
|
@ -261,37 +261,37 @@ class ApiController < ApplicationController
|
|||
def capabilities
|
||||
doc = OSM::API.new.get_xml_doc
|
||||
|
||||
api = XML::Node.new 'api'
|
||||
version = XML::Node.new 'version'
|
||||
version['minimum'] = "#{API_VERSION}"
|
||||
version['maximum'] = "#{API_VERSION}"
|
||||
api = XML::Node.new "api"
|
||||
version = XML::Node.new "version"
|
||||
version["minimum"] = "#{API_VERSION}"
|
||||
version["maximum"] = "#{API_VERSION}"
|
||||
api << version
|
||||
area = XML::Node.new 'area'
|
||||
area['maximum'] = MAX_REQUEST_AREA.to_s
|
||||
area = XML::Node.new "area"
|
||||
area["maximum"] = MAX_REQUEST_AREA.to_s
|
||||
api << area
|
||||
tracepoints = XML::Node.new 'tracepoints'
|
||||
tracepoints['per_page'] = TRACEPOINTS_PER_PAGE.to_s
|
||||
tracepoints = XML::Node.new "tracepoints"
|
||||
tracepoints["per_page"] = TRACEPOINTS_PER_PAGE.to_s
|
||||
api << tracepoints
|
||||
waynodes = XML::Node.new 'waynodes'
|
||||
waynodes['maximum'] = MAX_NUMBER_OF_WAY_NODES.to_s
|
||||
waynodes = XML::Node.new "waynodes"
|
||||
waynodes["maximum"] = MAX_NUMBER_OF_WAY_NODES.to_s
|
||||
api << waynodes
|
||||
changesets = XML::Node.new 'changesets'
|
||||
changesets['maximum_elements'] = Changeset::MAX_ELEMENTS.to_s
|
||||
changesets = XML::Node.new "changesets"
|
||||
changesets["maximum_elements"] = Changeset::MAX_ELEMENTS.to_s
|
||||
api << changesets
|
||||
timeout = XML::Node.new 'timeout'
|
||||
timeout['seconds'] = API_TIMEOUT.to_s
|
||||
timeout = XML::Node.new "timeout"
|
||||
timeout["seconds"] = API_TIMEOUT.to_s
|
||||
api << timeout
|
||||
status = XML::Node.new 'status'
|
||||
status['database'] = database_status.to_s
|
||||
status['api'] = api_status.to_s
|
||||
status['gpx'] = gpx_status.to_s
|
||||
status = XML::Node.new "status"
|
||||
status["database"] = database_status.to_s
|
||||
status["api"] = api_status.to_s
|
||||
status["gpx"] = gpx_status.to_s
|
||||
api << status
|
||||
doc.root << api
|
||||
policy = XML::Node.new 'policy'
|
||||
blacklist = XML::Node.new 'imagery'
|
||||
policy = XML::Node.new "policy"
|
||||
blacklist = XML::Node.new "imagery"
|
||||
IMAGERY_BLACKLIST.each do |url_regex|
|
||||
xnd = XML::Node.new 'blacklist'
|
||||
xnd['regex'] = url_regex.to_s
|
||||
xnd = XML::Node.new "blacklist"
|
||||
xnd["regex"] = url_regex.to_s
|
||||
blacklist << xnd
|
||||
end
|
||||
policy << blacklist
|
||||
|
|
|
@ -18,7 +18,7 @@ class ApplicationController < ActionController::Base
|
|||
# don't allow access to any auth-requiring part of the site unless
|
||||
# the new CTs have been seen (and accept/decline chosen).
|
||||
elsif !@user.terms_seen && flash[:skip_terms].nil?
|
||||
flash[:notice] = t 'user.terms.you need to accept or decline'
|
||||
flash[:notice] = t "user.terms.you need to accept or decline"
|
||||
if params[:referer]
|
||||
redirect_to :controller => "user", :action => "terms", :referer => params[:referer]
|
||||
else
|
||||
|
@ -39,7 +39,7 @@ class ApplicationController < ActionController::Base
|
|||
def require_user
|
||||
unless @user
|
||||
if request.get?
|
||||
redirect_to :controller => 'user', :action => 'login', :referer => request.fullpath
|
||||
redirect_to :controller => "user", :action => "login", :referer => request.fullpath
|
||||
else
|
||||
render :text => "", :status => :forbidden
|
||||
end
|
||||
|
@ -76,7 +76,7 @@ class ApplicationController < ActionController::Base
|
|||
redirect_to Hash[params].merge(:cookie_test => "true")
|
||||
return false
|
||||
else
|
||||
flash.now[:warning] = t 'application.require_cookies.cookies_needed'
|
||||
flash.now[:warning] = t "application.require_cookies.cookies_needed"
|
||||
end
|
||||
else
|
||||
session.delete(:cookie_test)
|
||||
|
@ -123,8 +123,8 @@ class ApplicationController < ActionController::Base
|
|||
def require_moderator
|
||||
unless @user.moderator?
|
||||
if request.get?
|
||||
flash[:error] = t('application.require_moderator.not_a_moderator')
|
||||
redirect_to :action => 'index'
|
||||
flash[:error] = t("application.require_moderator.not_a_moderator")
|
||||
redirect_to :action => "index"
|
||||
else
|
||||
render :text => "", :status => :forbidden
|
||||
end
|
||||
|
@ -142,7 +142,7 @@ class ApplicationController < ActionController::Base
|
|||
# authenticate per-scheme
|
||||
if username.nil?
|
||||
@user = nil # no authentication provided - perhaps first connect (client should retry after 401)
|
||||
elsif username == 'token'
|
||||
elsif username == "token"
|
||||
@user = User.authenticate(:token => passwd) # preferred - random token for user from db, passed in basic auth
|
||||
else
|
||||
@user = User.authenticate(:username => username, :password => passwd) # basic auth
|
||||
|
@ -154,7 +154,7 @@ class ApplicationController < ActionController::Base
|
|||
# check if the user has been banned
|
||||
if @user.blocks.active.exists?
|
||||
# NOTE: need slightly more helpful message than this.
|
||||
report_error t('application.setup_user_auth.blocked'), :forbidden
|
||||
report_error t("application.setup_user_auth.blocked"), :forbidden
|
||||
end
|
||||
|
||||
# if the user hasn't seen the contributor terms then don't
|
||||
|
@ -162,12 +162,12 @@ class ApplicationController < ActionController::Base
|
|||
# (but can decline) the CTs to continue.
|
||||
if REQUIRE_TERMS_SEEN && !@user.terms_seen && flash[:skip_terms].nil?
|
||||
set_locale
|
||||
report_error t('application.setup_user_auth.need_to_see_terms'), :forbidden
|
||||
report_error t("application.setup_user_auth.need_to_see_terms"), :forbidden
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def authorize(realm = 'Web Password', errormessage = "Couldn't authenticate you")
|
||||
def authorize(realm = "Web Password", errormessage = "Couldn't authenticate you")
|
||||
# make the @user object from any auth sources we have
|
||||
setup_user_auth
|
||||
|
||||
|
@ -201,7 +201,7 @@ class ApplicationController < ActionController::Base
|
|||
if request.xhr?
|
||||
report_error "Database offline for maintenance", :service_unavailable
|
||||
else
|
||||
redirect_to :controller => 'site', :action => 'offline'
|
||||
redirect_to :controller => "site", :action => "offline"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -212,7 +212,7 @@ class ApplicationController < ActionController::Base
|
|||
if request.xhr?
|
||||
report_error "Database offline for maintenance", :service_unavailable
|
||||
else
|
||||
redirect_to :controller => 'site', :action => 'offline'
|
||||
redirect_to :controller => "site", :action => "offline"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -273,10 +273,10 @@ class ApplicationController < ActionController::Base
|
|||
# message. For now, rails won't let us)
|
||||
def report_error(message, status = :bad_request)
|
||||
# Todo: some sort of escaping of problem characters in the message
|
||||
response.headers['Error'] = message
|
||||
response.headers["Error"] = message
|
||||
|
||||
if request.headers['X-Error-Format'] &&
|
||||
request.headers['X-Error-Format'].downcase == "xml"
|
||||
if request.headers["X-Error-Format"] &&
|
||||
request.headers["X-Error-Format"].downcase == "xml"
|
||||
result = OSM::API.new.get_xml_doc
|
||||
result.root.name = "osmError"
|
||||
result.root << (XML::Node.new("status") << "#{Rack::Utils.status_code(status)} #{Rack::Utils::HTTP_STATUS_CODES[status]}")
|
||||
|
@ -289,11 +289,11 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def set_locale
|
||||
response.header['Vary'] = 'Accept-Language'
|
||||
response.header["Vary"] = "Accept-Language"
|
||||
|
||||
if @user && !@user.languages.empty?
|
||||
http_accept_language.user_preferred_languages = @user.languages
|
||||
response.header['Vary'] = '*'
|
||||
response.header["Vary"] = "*"
|
||||
end
|
||||
|
||||
I18n.locale = select_locale
|
||||
|
@ -303,7 +303,7 @@ class ApplicationController < ActionController::Base
|
|||
@user.save
|
||||
end
|
||||
|
||||
response.headers['Content-Language'] = I18n.locale.to_s
|
||||
response.headers["Content-Language"] = I18n.locale.to_s
|
||||
end
|
||||
|
||||
def select_locale(locales = I18n.available_locales)
|
||||
|
@ -429,7 +429,7 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def map_layout
|
||||
request.xhr? ? 'xhr' : 'map'
|
||||
request.xhr? ? "xhr" : "map"
|
||||
end
|
||||
|
||||
def preferred_editor
|
||||
|
@ -441,8 +441,8 @@ class ApplicationController < ActionController::Base
|
|||
DEFAULT_EDITOR
|
||||
end
|
||||
|
||||
if request.env['HTTP_USER_AGENT'] =~ /MSIE|Trident/ && editor == 'id'
|
||||
editor = 'potlatch2'
|
||||
if request.env["HTTP_USER_AGENT"] =~ /MSIE|Trident/ && editor == "id"
|
||||
editor = "potlatch2"
|
||||
end
|
||||
|
||||
editor
|
||||
|
@ -454,16 +454,16 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
# extract authorisation credentials from headers, returns user = nil if none
|
||||
def get_auth_data
|
||||
if request.env.key? 'X-HTTP_AUTHORIZATION' # where mod_rewrite might have put it
|
||||
authdata = request.env['X-HTTP_AUTHORIZATION'].to_s.split
|
||||
elsif request.env.key? 'REDIRECT_X_HTTP_AUTHORIZATION' # mod_fcgi
|
||||
authdata = request.env['REDIRECT_X_HTTP_AUTHORIZATION'].to_s.split
|
||||
elsif request.env.key? 'HTTP_AUTHORIZATION' # regular location
|
||||
authdata = request.env['HTTP_AUTHORIZATION'].to_s.split
|
||||
if request.env.key? "X-HTTP_AUTHORIZATION" # where mod_rewrite might have put it
|
||||
authdata = request.env["X-HTTP_AUTHORIZATION"].to_s.split
|
||||
elsif request.env.key? "REDIRECT_X_HTTP_AUTHORIZATION" # mod_fcgi
|
||||
authdata = request.env["REDIRECT_X_HTTP_AUTHORIZATION"].to_s.split
|
||||
elsif request.env.key? "HTTP_AUTHORIZATION" # regular location
|
||||
authdata = request.env["HTTP_AUTHORIZATION"].to_s.split
|
||||
end
|
||||
# only basic authentication supported
|
||||
if authdata && authdata[0] == 'Basic'
|
||||
user, pass = Base64.decode64(authdata[1]).split(':', 2)
|
||||
if authdata && authdata[0] == "Basic"
|
||||
user, pass = Base64.decode64(authdata[1]).split(":", 2)
|
||||
end
|
||||
[user, pass]
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@ class BrowseController < ApplicationController
|
|||
def relation
|
||||
@type = "relation"
|
||||
@feature = Relation.find(params[:id])
|
||||
render 'feature'
|
||||
render "feature"
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render :action => "not_found", :status => :not_found
|
||||
end
|
||||
|
@ -18,7 +18,7 @@ class BrowseController < ApplicationController
|
|||
def relation_history
|
||||
@type = "relation"
|
||||
@feature = Relation.find(params[:id])
|
||||
render 'history'
|
||||
render "history"
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render :action => "not_found", :status => :not_found
|
||||
end
|
||||
|
@ -26,7 +26,7 @@ class BrowseController < ApplicationController
|
|||
def way
|
||||
@type = "way"
|
||||
@feature = Way.preload(:way_tags, :containing_relation_members, :changeset => :user, :nodes => [:node_tags, :ways => :way_tags]).find(params[:id])
|
||||
render 'feature'
|
||||
render "feature"
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render :action => "not_found", :status => :not_found
|
||||
end
|
||||
|
@ -34,7 +34,7 @@ class BrowseController < ApplicationController
|
|||
def way_history
|
||||
@type = "way"
|
||||
@feature = Way.preload(:way_tags, :old_ways => { :changeset => :user }).find(params[:id])
|
||||
render 'history'
|
||||
render "history"
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render :action => "not_found", :status => :not_found
|
||||
end
|
||||
|
@ -42,7 +42,7 @@ class BrowseController < ApplicationController
|
|||
def node
|
||||
@type = "node"
|
||||
@feature = Node.find(params[:id])
|
||||
render 'feature'
|
||||
render "feature"
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render :action => "not_found", :status => :not_found
|
||||
end
|
||||
|
@ -50,7 +50,7 @@ class BrowseController < ApplicationController
|
|||
def node_history
|
||||
@type = "node"
|
||||
@feature = Node.find(params[:id])
|
||||
render 'history'
|
||||
render "history"
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render :action => "not_found", :status => :not_found
|
||||
end
|
||||
|
@ -63,9 +63,9 @@ class BrowseController < ApplicationController
|
|||
else
|
||||
@comments = @changeset.comments.includes(:author)
|
||||
end
|
||||
@node_pages, @nodes = paginate(:old_nodes, :conditions => { :changeset_id => @changeset.id }, :per_page => 20, :parameter => 'node_page')
|
||||
@way_pages, @ways = paginate(:old_ways, :conditions => { :changeset_id => @changeset.id }, :per_page => 20, :parameter => 'way_page')
|
||||
@relation_pages, @relations = paginate(:old_relations, :conditions => { :changeset_id => @changeset.id }, :per_page => 20, :parameter => 'relation_page')
|
||||
@node_pages, @nodes = paginate(:old_nodes, :conditions => { :changeset_id => @changeset.id }, :per_page => 20, :parameter => "node_page")
|
||||
@way_pages, @ways = paginate(:old_ways, :conditions => { :changeset_id => @changeset.id }, :per_page => 20, :parameter => "way_page")
|
||||
@relation_pages, @relations = paginate(:old_relations, :conditions => { :changeset_id => @changeset.id }, :per_page => 20, :parameter => "relation_page")
|
||||
if @changeset.user.data_public?
|
||||
@next_by_user = @changeset.user.changesets.where("id > ?", @changeset.id).reorder(:id => :asc).first
|
||||
@prev_by_user = @changeset.user.changesets.where("id < ?", @changeset.id).reorder(:id => :desc).first
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# The ChangesetController is the RESTful interface to Changeset objects
|
||||
|
||||
class ChangesetController < ApplicationController
|
||||
layout 'site'
|
||||
require 'xml/libxml'
|
||||
layout "site"
|
||||
require "xml/libxml"
|
||||
|
||||
skip_before_filter :verify_authenticity_token, :except => [:list]
|
||||
before_filter :authorize_web, :only => [:list, :feed, :comments_feed]
|
||||
|
@ -85,8 +85,8 @@ class ChangesetController < ApplicationController
|
|||
# abuse, maybe should change to some other format?
|
||||
doc = XML::Parser.string(request.raw_post).parse
|
||||
doc.find("//osm/node").each do |n|
|
||||
lon << n['lon'].to_f * GeoRecord::SCALE
|
||||
lat << n['lat'].to_f * GeoRecord::SCALE
|
||||
lon << n["lon"].to_f * GeoRecord::SCALE
|
||||
lat << n["lat"].to_f * GeoRecord::SCALE
|
||||
end
|
||||
|
||||
# add the existing bounding box to the lon-lat array
|
||||
|
@ -204,17 +204,17 @@ class ChangesetController < ApplicationController
|
|||
# query changesets by bounding box, time, user or open/closed status.
|
||||
def query
|
||||
# find any bounding box
|
||||
bbox = BoundingBox.from_bbox_params(params) if params['bbox']
|
||||
bbox = BoundingBox.from_bbox_params(params) if params["bbox"]
|
||||
|
||||
# create the conditions that the user asked for. some or all of
|
||||
# these may be nil.
|
||||
changesets = Changeset.all
|
||||
changesets = conditions_bbox(changesets, bbox)
|
||||
changesets = conditions_user(changesets, params['user'], params['display_name'])
|
||||
changesets = conditions_time(changesets, params['time'])
|
||||
changesets = conditions_open(changesets, params['open'])
|
||||
changesets = conditions_closed(changesets, params['closed'])
|
||||
changesets = conditions_ids(changesets, params['changesets'])
|
||||
changesets = conditions_user(changesets, params["user"], params["display_name"])
|
||||
changesets = conditions_time(changesets, params["time"])
|
||||
changesets = conditions_open(changesets, params["open"])
|
||||
changesets = conditions_closed(changesets, params["closed"])
|
||||
changesets = conditions_ids(changesets, params["changesets"])
|
||||
|
||||
# create the results document
|
||||
results = OSM::API.new.get_xml_doc
|
||||
|
@ -509,7 +509,7 @@ class ChangesetController < ApplicationController
|
|||
else
|
||||
# if there is a range, i.e: comma separated, then the first is
|
||||
# low, second is high - same as with bounding boxes.
|
||||
if time.count(',') == 1
|
||||
if time.count(",") == 1
|
||||
# check that we actually have 2 elements in the array
|
||||
times = time.split(/,/)
|
||||
fail OSM::APIBadUserInput.new("bad time range") if times.size != 2
|
||||
|
@ -564,7 +564,7 @@ class ChangesetController < ApplicationController
|
|||
elsif ids.empty?
|
||||
fail OSM::APIBadUserInput.new("No changesets were given to search for")
|
||||
else
|
||||
ids = ids.split(',').collect(&:to_i)
|
||||
ids = ids.split(",").collect(&:to_i)
|
||||
return changesets.where(:id => ids)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class DiaryEntryController < ApplicationController
|
||||
layout 'site', :except => :rss
|
||||
layout "site", :except => :rss
|
||||
|
||||
before_filter :authorize_web
|
||||
before_filter :set_locale
|
||||
|
@ -10,7 +10,7 @@ class DiaryEntryController < ApplicationController
|
|||
before_filter :require_administrator, :only => [:hide, :hidecomment]
|
||||
|
||||
def new
|
||||
@title = t 'diary_entry.new.title'
|
||||
@title = t "diary_entry.new.title"
|
||||
|
||||
if params[:diary_entry]
|
||||
@diary_entry = DiaryEntry.new(entry_params)
|
||||
|
@ -24,27 +24,27 @@ class DiaryEntryController < ApplicationController
|
|||
else
|
||||
@user.preferences.create(:k => "diary.default_language", :v => @diary_entry.language_code)
|
||||
end
|
||||
redirect_to :controller => 'diary_entry', :action => 'list', :display_name => @user.display_name
|
||||
redirect_to :controller => "diary_entry", :action => "list", :display_name => @user.display_name
|
||||
else
|
||||
render :action => 'edit'
|
||||
render :action => "edit"
|
||||
end
|
||||
else
|
||||
default_lang = @user.preferences.where(:k => "diary.default_language").first
|
||||
lang_code = default_lang ? default_lang.v : @user.preferred_language
|
||||
@diary_entry = DiaryEntry.new(:language_code => lang_code)
|
||||
set_map_location
|
||||
render :action => 'edit'
|
||||
render :action => "edit"
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@title = t 'diary_entry.edit.title'
|
||||
@title = t "diary_entry.edit.title"
|
||||
@diary_entry = DiaryEntry.find(params[:id])
|
||||
|
||||
if @user != @diary_entry.user
|
||||
redirect_to :controller => 'diary_entry', :action => 'view', :id => params[:id]
|
||||
redirect_to :controller => "diary_entry", :action => "view", :id => params[:id]
|
||||
elsif params[:diary_entry] && @diary_entry.update_attributes(entry_params)
|
||||
redirect_to :controller => 'diary_entry', :action => 'view', :id => params[:id]
|
||||
redirect_to :controller => "diary_entry", :action => "view", :id => params[:id]
|
||||
end
|
||||
|
||||
set_map_location
|
||||
|
@ -61,9 +61,9 @@ class DiaryEntryController < ApplicationController
|
|||
Notifier.diary_comment_notification(@diary_comment).deliver_now
|
||||
end
|
||||
|
||||
redirect_to :controller => 'diary_entry', :action => 'view', :display_name => @entry.user.display_name, :id => @entry.id
|
||||
redirect_to :controller => "diary_entry", :action => "view", :display_name => @entry.user.display_name, :id => @entry.id
|
||||
else
|
||||
render :action => 'view'
|
||||
render :action => "view"
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render :action => "no_such_entry", :status => :not_found
|
||||
|
@ -74,7 +74,7 @@ class DiaryEntryController < ApplicationController
|
|||
@this_user = User.active.find_by_display_name(params[:display_name])
|
||||
|
||||
if @this_user
|
||||
@title = t 'diary_entry.list.user_title', :user => @this_user.display_name
|
||||
@title = t "diary_entry.list.user_title", :user => @this_user.display_name
|
||||
@entries = @this_user.diary_entries
|
||||
else
|
||||
render_unknown_user params[:display_name]
|
||||
|
@ -82,7 +82,7 @@ class DiaryEntryController < ApplicationController
|
|||
end
|
||||
elsif params[:friends]
|
||||
if @user
|
||||
@title = t 'diary_entry.list.title_friends'
|
||||
@title = t "diary_entry.list.title_friends"
|
||||
@entries = DiaryEntry.where(:user_id => @user.friend_users)
|
||||
else
|
||||
require_user
|
||||
|
@ -90,7 +90,7 @@ class DiaryEntryController < ApplicationController
|
|||
end
|
||||
elsif params[:nearby]
|
||||
if @user
|
||||
@title = t 'diary_entry.list.title_nearby'
|
||||
@title = t "diary_entry.list.title_nearby"
|
||||
@entries = DiaryEntry.where(:user_id => @user.nearby)
|
||||
else
|
||||
require_user
|
||||
|
@ -100,10 +100,10 @@ class DiaryEntryController < ApplicationController
|
|||
@entries = DiaryEntry.joins(:user).where(:users => { :status => %w(active confirmed) })
|
||||
|
||||
if params[:language]
|
||||
@title = t 'diary_entry.list.in_language_title', :language => Language.find(params[:language]).english_name
|
||||
@title = t "diary_entry.list.in_language_title", :language => Language.find(params[:language]).english_name
|
||||
@entries = @entries.where(:language_code => params[:language])
|
||||
else
|
||||
@title = t 'diary_entry.list.title'
|
||||
@title = t "diary_entry.list.title"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -123,8 +123,8 @@ class DiaryEntryController < ApplicationController
|
|||
|
||||
if user
|
||||
@entries = user.diary_entries
|
||||
@title = I18n.t('diary_entry.feed.user.title', :user => user.display_name)
|
||||
@description = I18n.t('diary_entry.feed.user.description', :user => user.display_name)
|
||||
@title = I18n.t("diary_entry.feed.user.title", :user => user.display_name)
|
||||
@description = I18n.t("diary_entry.feed.user.description", :user => user.display_name)
|
||||
@link = "http://#{SERVER_URL}/user/#{user.display_name}/diary"
|
||||
else
|
||||
render :text => "", :status => :not_found
|
||||
|
@ -135,12 +135,12 @@ class DiaryEntryController < ApplicationController
|
|||
|
||||
if params[:language]
|
||||
@entries = @entries.where(:language_code => params[:language])
|
||||
@title = I18n.t('diary_entry.feed.language.title', :language_name => Language.find(params[:language]).english_name)
|
||||
@description = I18n.t('diary_entry.feed.language.description', :language_name => Language.find(params[:language]).english_name)
|
||||
@title = I18n.t("diary_entry.feed.language.title", :language_name => Language.find(params[:language]).english_name)
|
||||
@description = I18n.t("diary_entry.feed.language.description", :language_name => Language.find(params[:language]).english_name)
|
||||
@link = "http://#{SERVER_URL}/diary/#{params[:language]}"
|
||||
else
|
||||
@title = I18n.t('diary_entry.feed.all.title')
|
||||
@description = I18n.t('diary_entry.feed.all.description')
|
||||
@title = I18n.t("diary_entry.feed.all.title")
|
||||
@description = I18n.t("diary_entry.feed.all.description")
|
||||
@link = "http://#{SERVER_URL}/diary"
|
||||
end
|
||||
end
|
||||
|
@ -151,10 +151,10 @@ class DiaryEntryController < ApplicationController
|
|||
def view
|
||||
@entry = @this_user.diary_entries.visible.where(:id => params[:id]).first
|
||||
if @entry
|
||||
@title = t 'diary_entry.view.title', :user => params[:display_name], :title => @entry.title
|
||||
@title = t "diary_entry.view.title", :user => params[:display_name], :title => @entry.title
|
||||
else
|
||||
@title = t 'diary_entry.no_such_entry.title', :id => params[:id]
|
||||
render :action => 'no_such_entry', :status => :not_found
|
||||
@title = t "diary_entry.no_such_entry.title", :id => params[:id]
|
||||
render :action => "no_such_entry", :status => :not_found
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -176,7 +176,7 @@ class DiaryEntryController < ApplicationController
|
|||
:user_id => @this_user,
|
||||
:visible => true
|
||||
},
|
||||
:order => 'created_at DESC',
|
||||
:order => "created_at DESC",
|
||||
:per_page => 20)
|
||||
@page = (params[:page] || 1).to_i
|
||||
end
|
||||
|
@ -200,8 +200,8 @@ class DiaryEntryController < ApplicationController
|
|||
# and return them to the user page.
|
||||
def require_administrator
|
||||
unless @user.administrator?
|
||||
flash[:error] = t('user.filter.not_an_administrator')
|
||||
redirect_to :controller => 'diary_entry', :action => 'view'
|
||||
flash[:error] = t("user.filter.not_an_administrator")
|
||||
redirect_to :controller => "diary_entry", :action => "view"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# coding: utf-8
|
||||
|
||||
class GeocoderController < ApplicationController
|
||||
require 'cgi'
|
||||
require 'uri'
|
||||
require 'net/http'
|
||||
require 'rexml/document'
|
||||
require "cgi"
|
||||
require "uri"
|
||||
require "net/http"
|
||||
require "rexml/document"
|
||||
|
||||
before_filter :authorize_web
|
||||
before_filter :set_locale
|
||||
|
@ -170,7 +170,7 @@ class GeocoderController < ApplicationController
|
|||
else
|
||||
prefix_name = t "geocoder.search_osm_nominatim.prefix.#{klass}.#{type}", :default => type.gsub("_", " ").capitalize
|
||||
end
|
||||
if klass == 'boundary' && type == 'administrative'
|
||||
if klass == "boundary" && type == "administrative"
|
||||
rank = (place.attributes["place_rank"].to_i + 1) / 2
|
||||
prefix_name = t "geocoder.search_osm_nominatim.admin_levels.level#{rank}", :default => prefix_name
|
||||
end
|
||||
|
@ -324,7 +324,7 @@ class GeocoderController < ApplicationController
|
|||
end
|
||||
|
||||
def escape_query(query)
|
||||
URI.escape(query, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]", false, 'N'))
|
||||
URI.escape(query, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]", false, "N"))
|
||||
end
|
||||
|
||||
def normalize_params
|
||||
|
@ -356,11 +356,11 @@ class GeocoderController < ApplicationController
|
|||
def nsew_to_decdeg(captures)
|
||||
begin
|
||||
Float(captures[0])
|
||||
captures[2].downcase != 's' ? lat = captures[0].to_f : lat = -(captures[0].to_f)
|
||||
captures[5].downcase != 'w' ? lon = captures[3].to_f : lon = -(captures[3].to_f)
|
||||
captures[2].downcase != "s" ? lat = captures[0].to_f : lat = -(captures[0].to_f)
|
||||
captures[5].downcase != "w" ? lon = captures[3].to_f : lon = -(captures[3].to_f)
|
||||
rescue
|
||||
captures[0].downcase != 's' ? lat = captures[1].to_f : lat = -(captures[1].to_f)
|
||||
captures[3].downcase != 'w' ? lon = captures[4].to_f : lon = -(captures[4].to_f)
|
||||
captures[0].downcase != "s" ? lat = captures[1].to_f : lat = -(captures[1].to_f)
|
||||
captures[3].downcase != "w" ? lon = captures[4].to_f : lon = -(captures[4].to_f)
|
||||
end
|
||||
{ :lat => lat, :lon => lon }
|
||||
end
|
||||
|
@ -368,11 +368,11 @@ class GeocoderController < ApplicationController
|
|||
def ddm_to_decdeg(captures)
|
||||
begin
|
||||
Float(captures[0])
|
||||
captures[3].downcase != 's' ? lat = captures[0].to_f + captures[1].to_f / 60 : lat = -(captures[0].to_f + captures[1].to_f / 60)
|
||||
captures[7].downcase != 'w' ? lon = captures[4].to_f + captures[5].to_f / 60 : lon = -(captures[4].to_f + captures[5].to_f / 60)
|
||||
captures[3].downcase != "s" ? lat = captures[0].to_f + captures[1].to_f / 60 : lat = -(captures[0].to_f + captures[1].to_f / 60)
|
||||
captures[7].downcase != "w" ? lon = captures[4].to_f + captures[5].to_f / 60 : lon = -(captures[4].to_f + captures[5].to_f / 60)
|
||||
rescue
|
||||
captures[0].downcase != 's' ? lat = captures[1].to_f + captures[2].to_f / 60 : lat = -(captures[1].to_f + captures[2].to_f / 60)
|
||||
captures[4].downcase != 'w' ? lon = captures[5].to_f + captures[6].to_f / 60 : lon = -(captures[5].to_f + captures[6].to_f / 60)
|
||||
captures[0].downcase != "s" ? lat = captures[1].to_f + captures[2].to_f / 60 : lat = -(captures[1].to_f + captures[2].to_f / 60)
|
||||
captures[4].downcase != "w" ? lon = captures[5].to_f + captures[6].to_f / 60 : lon = -(captures[5].to_f + captures[6].to_f / 60)
|
||||
end
|
||||
{ :lat => lat, :lon => lon }
|
||||
end
|
||||
|
@ -380,11 +380,11 @@ class GeocoderController < ApplicationController
|
|||
def dms_to_decdeg(captures)
|
||||
begin
|
||||
Float(captures[0])
|
||||
captures[4].downcase != 's' ? lat = captures[0].to_f + (captures[1].to_f + captures[2].to_f / 60) / 60 : lat = -(captures[0].to_f + (captures[1].to_f + captures[2].to_f / 60) / 60)
|
||||
captures[9].downcase != 'w' ? lon = captures[5].to_f + (captures[6].to_f + captures[7].to_f / 60) / 60 : lon = -(captures[5].to_f + (captures[6].to_f + captures[7].to_f / 60) / 60)
|
||||
captures[4].downcase != "s" ? lat = captures[0].to_f + (captures[1].to_f + captures[2].to_f / 60) / 60 : lat = -(captures[0].to_f + (captures[1].to_f + captures[2].to_f / 60) / 60)
|
||||
captures[9].downcase != "w" ? lon = captures[5].to_f + (captures[6].to_f + captures[7].to_f / 60) / 60 : lon = -(captures[5].to_f + (captures[6].to_f + captures[7].to_f / 60) / 60)
|
||||
rescue
|
||||
captures[0].downcase != 's' ? lat = captures[1].to_f + (captures[2].to_f + captures[3].to_f / 60) / 60 : lat = -(captures[1].to_f + (captures[2].to_f + captures[3].to_f / 60) / 60)
|
||||
captures[5].downcase != 'w' ? lon = captures[6].to_f + (captures[7].to_f + captures[8].to_f / 60) / 60 : lon = -(captures[6].to_f + (captures[7].to_f + captures[8].to_f / 60) / 60)
|
||||
captures[0].downcase != "s" ? lat = captures[1].to_f + (captures[2].to_f + captures[3].to_f / 60) / 60 : lat = -(captures[1].to_f + (captures[2].to_f + captures[3].to_f / 60) / 60)
|
||||
captures[5].downcase != "w" ? lon = captures[6].to_f + (captures[7].to_f + captures[8].to_f / 60) / 60 : lon = -(captures[6].to_f + (captures[7].to_f + captures[8].to_f / 60) / 60)
|
||||
end
|
||||
{ :lat => lat, :lon => lon }
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class MessageController < ApplicationController
|
||||
layout 'site'
|
||||
layout "site"
|
||||
|
||||
before_filter :authorize_web
|
||||
before_filter :set_locale
|
||||
|
@ -15,7 +15,7 @@ class MessageController < ApplicationController
|
|||
def new
|
||||
if params[:message]
|
||||
if @user.sent_messages.where("sent_on >= ?", Time.now.getutc - 1.hour).count >= MAX_MESSAGES_PER_HOUR
|
||||
flash[:error] = t 'message.new.limit_exceeded'
|
||||
flash[:error] = t "message.new.limit_exceeded"
|
||||
else
|
||||
@message = Message.new(message_params)
|
||||
@message.to_user_id = @this_user.id
|
||||
|
@ -23,15 +23,15 @@ class MessageController < ApplicationController
|
|||
@message.sent_on = Time.now.getutc
|
||||
|
||||
if @message.save
|
||||
flash[:notice] = t 'message.new.message_sent'
|
||||
flash[:notice] = t "message.new.message_sent"
|
||||
Notifier.message_notification(@message).deliver_now
|
||||
redirect_to :controller => 'message', :action => 'inbox', :display_name => @user.display_name
|
||||
redirect_to :controller => "message", :action => "inbox", :display_name => @user.display_name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@message ||= Message.new(:recipient => @this_user)
|
||||
@title = t 'message.new.title'
|
||||
@title = t "message.new.title"
|
||||
end
|
||||
|
||||
# Allow the user to reply to another message.
|
||||
|
@ -49,69 +49,69 @@ class MessageController < ApplicationController
|
|||
|
||||
@title = @message.title
|
||||
|
||||
render :action => 'new'
|
||||
render :action => "new"
|
||||
else
|
||||
flash[:notice] = t 'message.reply.wrong_user', :user => @user.display_name
|
||||
flash[:notice] = t "message.reply.wrong_user", :user => @user.display_name
|
||||
redirect_to :controller => "user", :action => "login", :referer => request.fullpath
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
@title = t 'message.no_such_message.title'
|
||||
render :action => 'no_such_message', :status => :not_found
|
||||
@title = t "message.no_such_message.title"
|
||||
render :action => "no_such_message", :status => :not_found
|
||||
end
|
||||
|
||||
# Show a message
|
||||
def read
|
||||
@title = t 'message.read.title'
|
||||
@title = t "message.read.title"
|
||||
@message = Message.find(params[:message_id])
|
||||
|
||||
if @message.to_user_id == @user.id || @message.from_user_id == @user.id
|
||||
@message.message_read = true if @message.to_user_id == @user.id
|
||||
@message.save
|
||||
else
|
||||
flash[:notice] = t 'message.read.wrong_user', :user => @user.display_name
|
||||
flash[:notice] = t "message.read.wrong_user", :user => @user.display_name
|
||||
redirect_to :controller => "user", :action => "login", :referer => request.fullpath
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
@title = t 'message.no_such_message.title'
|
||||
render :action => 'no_such_message', :status => :not_found
|
||||
@title = t "message.no_such_message.title"
|
||||
render :action => "no_such_message", :status => :not_found
|
||||
end
|
||||
|
||||
# Display the list of messages that have been sent to the user.
|
||||
def inbox
|
||||
@title = t 'message.inbox.title'
|
||||
@title = t "message.inbox.title"
|
||||
if @user && params[:display_name] == @user.display_name
|
||||
else
|
||||
redirect_to :controller => 'message', :action => 'inbox', :display_name => @user.display_name
|
||||
redirect_to :controller => "message", :action => "inbox", :display_name => @user.display_name
|
||||
end
|
||||
end
|
||||
|
||||
# Display the list of messages that the user has sent to other users.
|
||||
def outbox
|
||||
@title = t 'message.outbox.title'
|
||||
@title = t "message.outbox.title"
|
||||
if @user && params[:display_name] == @user.display_name
|
||||
else
|
||||
redirect_to :controller => 'message', :action => 'outbox', :display_name => @user.display_name
|
||||
redirect_to :controller => "message", :action => "outbox", :display_name => @user.display_name
|
||||
end
|
||||
end
|
||||
|
||||
# Set the message as being read or unread.
|
||||
def mark
|
||||
@message = Message.where("to_user_id = ? OR from_user_id = ?", @user.id, @user.id).find(params[:message_id])
|
||||
if params[:mark] == 'unread'
|
||||
if params[:mark] == "unread"
|
||||
message_read = false
|
||||
notice = t 'message.mark.as_unread'
|
||||
notice = t "message.mark.as_unread"
|
||||
else
|
||||
message_read = true
|
||||
notice = t 'message.mark.as_read'
|
||||
notice = t "message.mark.as_read"
|
||||
end
|
||||
@message.message_read = message_read
|
||||
if @message.save && !request.xhr?
|
||||
flash[:notice] = notice
|
||||
redirect_to :controller => 'message', :action => 'inbox', :display_name => @user.display_name
|
||||
redirect_to :controller => "message", :action => "inbox", :display_name => @user.display_name
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
@title = t 'message.no_such_message.title'
|
||||
render :action => 'no_such_message', :status => :not_found
|
||||
@title = t "message.no_such_message.title"
|
||||
render :action => "no_such_message", :status => :not_found
|
||||
end
|
||||
|
||||
# Delete the message.
|
||||
|
@ -120,17 +120,17 @@ class MessageController < ApplicationController
|
|||
@message.from_user_visible = false if @message.sender == @user
|
||||
@message.to_user_visible = false if @message.recipient == @user
|
||||
if @message.save && !request.xhr?
|
||||
flash[:notice] = t 'message.delete.deleted'
|
||||
flash[:notice] = t "message.delete.deleted"
|
||||
|
||||
if params[:referer]
|
||||
redirect_to params[:referer]
|
||||
else
|
||||
redirect_to :controller => 'message', :action => 'inbox', :display_name => @user.display_name
|
||||
redirect_to :controller => "message", :action => "inbox", :display_name => @user.display_name
|
||||
end
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
@title = t 'message.no_such_message.title'
|
||||
render :action => 'no_such_message', :status => :not_found
|
||||
@title = t "message.no_such_message.title"
|
||||
render :action => "no_such_message", :status => :not_found
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# The NodeController is the RESTful interface to Node objects
|
||||
|
||||
class NodeController < ApplicationController
|
||||
require 'xml/libxml'
|
||||
require "xml/libxml"
|
||||
|
||||
skip_before_filter :verify_authenticity_token
|
||||
before_filter :authorize, :only => [:create, :update, :delete]
|
||||
|
@ -64,11 +64,11 @@ class NodeController < ApplicationController
|
|||
|
||||
# Dump the details on many nodes whose ids are given in the "nodes" parameter.
|
||||
def nodes
|
||||
unless params['nodes']
|
||||
unless params["nodes"]
|
||||
fail OSM::APIBadUserInput.new("The parameter nodes is required, and must be of the form nodes=id[,id[,id...]]")
|
||||
end
|
||||
|
||||
ids = params['nodes'].split(',').collect(&:to_i)
|
||||
ids = params["nodes"].split(",").collect(&:to_i)
|
||||
|
||||
if ids.length == 0
|
||||
fail OSM::APIBadUserInput.new("No nodes were given to search for")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class NotesController < ApplicationController
|
||||
layout 'site', :only => [:mine]
|
||||
layout "site", :only => [:mine]
|
||||
|
||||
before_filter :check_api_readable
|
||||
before_filter :authorize_web, :only => [:mine]
|
||||
|
@ -279,17 +279,17 @@ class NotesController < ApplicationController
|
|||
def mine
|
||||
if params[:display_name]
|
||||
if @this_user = User.active.find_by_display_name(params[:display_name])
|
||||
@title = t 'note.mine.title', :user => @this_user.display_name
|
||||
@heading = t 'note.mine.heading', :user => @this_user.display_name
|
||||
@description = t 'note.mine.subheading', :user => render_to_string(:partial => "user", :object => @this_user)
|
||||
@title = t "note.mine.title", :user => @this_user.display_name
|
||||
@heading = t "note.mine.heading", :user => @this_user.display_name
|
||||
@description = t "note.mine.subheading", :user => render_to_string(:partial => "user", :object => @this_user)
|
||||
@page = (params[:page] || 1).to_i
|
||||
@page_size = 10
|
||||
@notes = @this_user.notes.order("updated_at DESC, id").uniq.offset((@page - 1) * @page_size).limit(@page_size).preload(:comments => :author).to_a
|
||||
else
|
||||
@title = t 'user.no_such_user.title'
|
||||
@title = t "user.no_such_user.title"
|
||||
@not_found_user = params[:display_name]
|
||||
|
||||
render :template => 'user/no_such_user', :status => :not_found
|
||||
render :template => "user/no_such_user", :status => :not_found
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class OauthClientsController < ApplicationController
|
||||
layout 'site'
|
||||
layout "site"
|
||||
|
||||
before_filter :authorize_web
|
||||
before_filter :set_locale
|
||||
|
@ -17,7 +17,7 @@ class OauthClientsController < ApplicationController
|
|||
def create
|
||||
@client_application = @user.client_applications.build(application_params)
|
||||
if @client_application.save
|
||||
flash[:notice] = t 'oauth_clients.create.flash'
|
||||
flash[:notice] = t "oauth_clients.create.flash"
|
||||
redirect_to :action => "show", :id => @client_application.id
|
||||
else
|
||||
render :action => "new"
|
||||
|
@ -41,7 +41,7 @@ class OauthClientsController < ApplicationController
|
|||
def update
|
||||
@client_application = @user.client_applications.find(params[:id])
|
||||
if @client_application.update_attributes(application_params)
|
||||
flash[:notice] = t 'oauth_clients.update.flash'
|
||||
flash[:notice] = t "oauth_clients.update.flash"
|
||||
redirect_to :action => "show", :id => @client_application.id
|
||||
else
|
||||
render :action => "edit"
|
||||
|
@ -54,7 +54,7 @@ class OauthClientsController < ApplicationController
|
|||
def destroy
|
||||
@client_application = @user.client_applications.find(params[:id])
|
||||
@client_application.destroy
|
||||
flash[:notice] = t 'oauth_clients.destroy.flash'
|
||||
flash[:notice] = t "oauth_clients.destroy.flash"
|
||||
redirect_to :action => "index"
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
@type = "client application"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
require 'oauth/controllers/provider_controller'
|
||||
require "oauth/controllers/provider_controller"
|
||||
|
||||
class OauthController < ApplicationController
|
||||
include OAuth::Controllers::ProviderController
|
||||
|
||||
layout 'site'
|
||||
layout "site"
|
||||
|
||||
def login_required
|
||||
authorize_web
|
||||
|
@ -30,7 +30,7 @@ class OauthController < ApplicationController
|
|||
@token = current_user.oauth_tokens.find_by_token params[:token]
|
||||
if @token
|
||||
@token.invalidate!
|
||||
flash[:notice] = t('oauth.revoke.flash', :application => @token.client_application.name)
|
||||
flash[:notice] = t("oauth.revoke.flash", :application => @token.client_application.name)
|
||||
end
|
||||
redirect_to oauth_clients_url(:display_name => @token.user.display_name)
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# into one place. as it turns out, the API methods for historical
|
||||
# nodes, ways and relations are basically identical.
|
||||
class OldController < ApplicationController
|
||||
require 'xml/libxml'
|
||||
require "xml/libxml"
|
||||
|
||||
skip_before_filter :verify_authenticity_token
|
||||
before_filter :setup_user_auth, :only => [:history, :version]
|
||||
|
@ -52,7 +52,7 @@ class OldController < ApplicationController
|
|||
end
|
||||
|
||||
def redact
|
||||
redaction_id = params['redaction']
|
||||
redaction_id = params["redaction"]
|
||||
if redaction_id.nil?
|
||||
# if no redaction ID was provided, then this is an unredact
|
||||
# operation.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class RedactionsController < ApplicationController
|
||||
layout 'site'
|
||||
layout "site"
|
||||
|
||||
before_filter :authorize_web
|
||||
before_filter :set_locale
|
||||
|
@ -25,10 +25,10 @@ class RedactionsController < ApplicationController
|
|||
# note that the description format will default to 'markdown'
|
||||
|
||||
if @redaction.save
|
||||
flash[:notice] = t('redaction.create.flash')
|
||||
flash[:notice] = t("redaction.create.flash")
|
||||
redirect_to @redaction
|
||||
else
|
||||
render :action => 'new'
|
||||
render :action => "new"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -44,10 +44,10 @@ class RedactionsController < ApplicationController
|
|||
@redaction.description = params[:redaction][:description]
|
||||
|
||||
if @redaction.save
|
||||
flash[:notice] = t('redaction.update.flash')
|
||||
flash[:notice] = t("redaction.update.flash")
|
||||
redirect_to @redaction
|
||||
else
|
||||
render :action => 'edit'
|
||||
render :action => "edit"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -56,14 +56,14 @@ class RedactionsController < ApplicationController
|
|||
@redaction.old_ways.empty? &&
|
||||
@redaction.old_relations.empty?
|
||||
if @redaction.destroy
|
||||
flash[:notice] = t('redaction.destroy.flash')
|
||||
flash[:notice] = t("redaction.destroy.flash")
|
||||
redirect_to :redactions
|
||||
else
|
||||
flash[:error] = t('redaction.destroy.error')
|
||||
flash[:error] = t("redaction.destroy.error")
|
||||
redirect_to @redaction
|
||||
end
|
||||
else
|
||||
flash[:error] = t('redaction.destroy.not_empty')
|
||||
flash[:error] = t("redaction.destroy.not_empty")
|
||||
redirect_to @redaction
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class RelationController < ApplicationController
|
||||
require 'xml/libxml'
|
||||
require "xml/libxml"
|
||||
|
||||
skip_before_filter :verify_authenticity_token
|
||||
before_filter :authorize, :only => [:create, :update, :delete]
|
||||
|
@ -76,9 +76,9 @@ class RelationController < ApplicationController
|
|||
# first find the ids of nodes, ways and relations referenced by this
|
||||
# relation - note that we exclude this relation just in case.
|
||||
|
||||
node_ids = relation.members.select { |m| m[0] == 'Node' }.map { |m| m[1] }
|
||||
way_ids = relation.members.select { |m| m[0] == 'Way' }.map { |m| m[1] }
|
||||
relation_ids = relation.members.select { |m| m[0] == 'Relation' && m[1] != relation.id }.map { |m| m[1] }
|
||||
node_ids = relation.members.select { |m| m[0] == "Node" }.map { |m| m[1] }
|
||||
way_ids = relation.members.select { |m| m[0] == "Way" }.map { |m| m[1] }
|
||||
relation_ids = relation.members.select { |m| m[0] == "Relation" && m[1] != relation.id }.map { |m| m[1] }
|
||||
|
||||
# next load the relations and the ways.
|
||||
|
||||
|
@ -133,11 +133,11 @@ class RelationController < ApplicationController
|
|||
end
|
||||
|
||||
def relations
|
||||
unless params['relations']
|
||||
unless params["relations"]
|
||||
fail OSM::APIBadUserInput.new("The parameter relations is required, and must be of the form relations=id[,id[,id...]]")
|
||||
end
|
||||
|
||||
ids = params['relations'].split(',').collect(&:to_i)
|
||||
ids = params["relations"].split(",").collect(&:to_i)
|
||||
|
||||
if ids.length == 0
|
||||
fail OSM::APIBadUserInput.new("No relations were given to search for")
|
||||
|
|
|
@ -22,24 +22,24 @@ class SearchController < ApplicationController
|
|||
end
|
||||
|
||||
def do_search(do_ways, do_nodes, do_relations)
|
||||
type = params['type']
|
||||
value = params['value']
|
||||
type = params["type"]
|
||||
value = params["value"]
|
||||
unless type || value
|
||||
name = params['name']
|
||||
name = params["name"]
|
||||
if name
|
||||
type = 'name'
|
||||
type = "name"
|
||||
value = name
|
||||
end
|
||||
end
|
||||
|
||||
if do_nodes
|
||||
response.headers['Error'] = "Searching of nodes is currently unavailable"
|
||||
response.headers["Error"] = "Searching of nodes is currently unavailable"
|
||||
render :text => "", :status => :service_unavailable
|
||||
return false
|
||||
end
|
||||
|
||||
unless value
|
||||
response.headers['Error'] = "Searching for a key without value is currently unavailable"
|
||||
response.headers["Error"] = "Searching for a key without value is currently unavailable"
|
||||
render :text => "", :status => :service_unavailable
|
||||
return false
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class SiteController < ApplicationController
|
||||
layout 'site'
|
||||
layout "site"
|
||||
layout :map_layout, :only => [:index, :export]
|
||||
|
||||
before_filter :authorize_web
|
||||
|
@ -11,7 +11,7 @@ class SiteController < ApplicationController
|
|||
|
||||
def index
|
||||
unless STATUS == :database_readonly || STATUS == :database_offline
|
||||
session[:location] ||= OSM.ip_location(request.env['REMOTE_ADDR'])
|
||||
session[:location] ||= OSM.ip_location(request.env["REMOTE_ADDR"])
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -26,24 +26,24 @@ class SiteController < ApplicationController
|
|||
end
|
||||
|
||||
if params.key? :node
|
||||
new_params[:controller] = 'browse'
|
||||
new_params[:action] = 'node'
|
||||
new_params[:controller] = "browse"
|
||||
new_params[:action] = "node"
|
||||
new_params[:id] = params[:node]
|
||||
elsif params.key? :way
|
||||
new_params[:controller] = 'browse'
|
||||
new_params[:action] = 'way'
|
||||
new_params[:controller] = "browse"
|
||||
new_params[:action] = "way"
|
||||
new_params[:id] = params[:way]
|
||||
elsif params.key? :relation
|
||||
new_params[:controller] = 'browse'
|
||||
new_params[:action] = 'relation'
|
||||
new_params[:controller] = "browse"
|
||||
new_params[:action] = "relation"
|
||||
new_params[:id] = params[:relation]
|
||||
elsif params.key? :changeset
|
||||
new_params[:controller] = 'browse'
|
||||
new_params[:action] = 'changeset'
|
||||
new_params[:controller] = "browse"
|
||||
new_params[:action] = "changeset"
|
||||
new_params[:id] = params[:changeset]
|
||||
else
|
||||
new_params[:controller] = 'site'
|
||||
new_params[:action] = 'index'
|
||||
new_params[:controller] = "site"
|
||||
new_params[:action] = "index"
|
||||
end
|
||||
|
||||
new_params[:anchor] = "map=#{zoom}/#{lat}/#{lon}"
|
||||
|
@ -143,12 +143,12 @@ class SiteController < ApplicationController
|
|||
|
||||
if params[:layers]
|
||||
anchor << "layers=#{params.delete(:layers)}"
|
||||
elsif params.delete(:notes) == 'yes'
|
||||
elsif params.delete(:notes) == "yes"
|
||||
anchor << "layers=N"
|
||||
end
|
||||
|
||||
if anchor.present?
|
||||
redirect_to Hash[params].merge(:anchor => anchor.join('&'))
|
||||
redirect_to Hash[params].merge(:anchor => anchor.join("&"))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,13 +15,13 @@ class SwfController < ApplicationController
|
|||
def trackpoints
|
||||
# - Initialise
|
||||
|
||||
baselong = params['baselong'].to_f
|
||||
basey = params['basey'].to_f
|
||||
masterscale = params['masterscale'].to_f
|
||||
baselong = params["baselong"].to_f
|
||||
basey = params["basey"].to_f
|
||||
masterscale = params["masterscale"].to_f
|
||||
|
||||
bbox = BoundingBox.new(params['xmin'], params['ymin'],
|
||||
params['xmax'], params['ymax'])
|
||||
start = params['start'].to_i
|
||||
bbox = BoundingBox.new(params["xmin"], params["ymin"],
|
||||
params["xmax"], params["ymax"])
|
||||
start = params["start"].to_i
|
||||
|
||||
# - Begin movie
|
||||
|
||||
|
@ -30,7 +30,7 @@ class SwfController < ApplicationController
|
|||
bounds_bottom = 0
|
||||
bounds_top = 240 * 20
|
||||
|
||||
m = ''
|
||||
m = ""
|
||||
m += swf_record(9, 255.chr + 155.chr + 155.chr) # Background
|
||||
absx = 0
|
||||
absy = 0
|
||||
|
@ -39,11 +39,11 @@ class SwfController < ApplicationController
|
|||
|
||||
# - Send SQL for GPS tracks
|
||||
|
||||
b = ''
|
||||
b = ""
|
||||
lasttime = 0
|
||||
lasttrack = lastfile = '-1'
|
||||
lasttrack = lastfile = "-1"
|
||||
|
||||
if params['token']
|
||||
if params["token"]
|
||||
user = User.authenticate(:token => params[:token])
|
||||
sql = "SELECT gps_points.latitude*0.0000001 AS lat,gps_points.longitude*0.0000001 AS lon,gpx_files.id AS fileid," + " EXTRACT(EPOCH FROM gps_points.timestamp) AS ts, gps_points.trackid AS trackid " + " FROM gpx_files,gps_points " + "WHERE gpx_files.id=gpx_id " + " AND gpx_files.user_id=#{user.id} " + " AND " + OSM.sql_for_area(bbox, "gps_points.") + " AND (gps_points.timestamp IS NOT NULL) " + "ORDER BY fileid DESC,ts " + "LIMIT 10000 OFFSET #{start}"
|
||||
else
|
||||
|
@ -55,23 +55,23 @@ class SwfController < ApplicationController
|
|||
|
||||
r = start_shape
|
||||
gpslist.each do |row|
|
||||
xs = (long2coord(row['lon'].to_f, baselong, masterscale) * 20).floor
|
||||
ys = (lat2coord(row['lat'].to_f, basey, masterscale) * 20).floor
|
||||
xs = (long2coord(row["lon"].to_f, baselong, masterscale) * 20).floor
|
||||
ys = (lat2coord(row["lat"].to_f, basey, masterscale) * 20).floor
|
||||
xl = [xs, xl].min
|
||||
xr = [xs, xr].max
|
||||
yb = [ys, yb].min
|
||||
yt = [ys, yt].max
|
||||
if row['ts'].to_i - lasttime > 180 || row['fileid'] != lastfile || row['trackid'] != lasttrack # or row['ts'].to_i==lasttime
|
||||
b += start_and_move(xs, ys, '01')
|
||||
if row["ts"].to_i - lasttime > 180 || row["fileid"] != lastfile || row["trackid"] != lasttrack # or row['ts'].to_i==lasttime
|
||||
b += start_and_move(xs, ys, "01")
|
||||
absx = xs.floor
|
||||
absy = ys.floor
|
||||
end
|
||||
b += draw_to(absx, absy, xs, ys)
|
||||
absx = xs.floor
|
||||
absy = ys.floor
|
||||
lasttime = row['ts'].to_i
|
||||
lastfile = row['fileid']
|
||||
lasttrack = row['trackid']
|
||||
lasttime = row["ts"].to_i
|
||||
lastfile = row["fileid"]
|
||||
lasttrack = row["trackid"]
|
||||
r += [b.slice!(0...80)].pack("B*") while b.length > 80
|
||||
end
|
||||
|
||||
|
@ -86,11 +86,11 @@ class SwfController < ApplicationController
|
|||
|
||||
# - Create Flash header and write to browser
|
||||
|
||||
m += swf_record(1, '') # Show frame
|
||||
m += swf_record(0, '') # End
|
||||
m += swf_record(1, "") # Show frame
|
||||
m += swf_record(0, "") # End
|
||||
|
||||
m = pack_rect(bounds_left, bounds_right, bounds_bottom, bounds_top) + 0.chr + 12.chr + pack_u16(1) + m
|
||||
m = 'FWS' + 6.chr + pack_u32(m.length + 8) + m
|
||||
m = "FWS" + 6.chr + pack_u32(m.length + 8) + m
|
||||
|
||||
render :text => m, :content_type => "application/x-shockwave-flash"
|
||||
end
|
||||
|
@ -113,11 +113,11 @@ class SwfController < ApplicationController
|
|||
end
|
||||
|
||||
def end_shape
|
||||
'000000'
|
||||
"000000"
|
||||
end
|
||||
|
||||
def start_and_move(x, y, col)
|
||||
d = '001001' # Line style change, moveTo
|
||||
d = "001001" # Line style change, moveTo
|
||||
l = [length_sb(x), length_sb(y)].max
|
||||
d += sprintf("%05b%0#{l}b%0#{l}b", l, x, y)
|
||||
d += col # Select line style
|
||||
|
@ -133,7 +133,7 @@ class SwfController < ApplicationController
|
|||
mstep = [dx.abs / 16383, dy.abs / 16383, 1].max.ceil
|
||||
xstep = dx / mstep
|
||||
ystep = dy / mstep
|
||||
d = ''
|
||||
d = ""
|
||||
1.upto(mstep).each do
|
||||
d += draw_section(x, y, x + xstep, y + ystep)
|
||||
x += xstep
|
||||
|
@ -143,12 +143,12 @@ class SwfController < ApplicationController
|
|||
end
|
||||
|
||||
def draw_section(x1, y1, x2, y2)
|
||||
d = '11' # TypeFlag, EdgeFlag
|
||||
d = "11" # TypeFlag, EdgeFlag
|
||||
dx = x2 - x1
|
||||
dy = y2 - y1
|
||||
l = [length_sb(dx), length_sb(dy)].max
|
||||
d += sprintf("%04b", l - 2)
|
||||
d += '1' # GeneralLine
|
||||
d += "1" # GeneralLine
|
||||
d += sprintf("%0#{l}b%0#{l}b", dx, dy)
|
||||
d
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class TraceController < ApplicationController
|
||||
layout 'site'
|
||||
layout "site"
|
||||
|
||||
skip_before_filter :verify_authenticity_token, :only => [:api_create, :api_read, :api_update, :api_delete, :api_data]
|
||||
before_filter :authorize_web
|
||||
|
@ -31,14 +31,14 @@ class TraceController < ApplicationController
|
|||
|
||||
# set title
|
||||
if target_user.nil?
|
||||
@title = t 'trace.list.public_traces'
|
||||
@title = t "trace.list.public_traces"
|
||||
elsif @user && @user == target_user
|
||||
@title = t 'trace.list.your_traces'
|
||||
@title = t "trace.list.your_traces"
|
||||
else
|
||||
@title = t 'trace.list.public_traces_from', :user => target_user.display_name
|
||||
@title = t "trace.list.public_traces_from", :user => target_user.display_name
|
||||
end
|
||||
|
||||
@title += t 'trace.list.tagged_with', :tags => params[:tag] if params[:tag]
|
||||
@title += t "trace.list.tagged_with", :tags => params[:tag] if params[:tag]
|
||||
|
||||
# four main cases:
|
||||
# 1 - all traces, logged in = all public traces + all user's (i.e + all mine)
|
||||
|
@ -94,14 +94,14 @@ class TraceController < ApplicationController
|
|||
|
||||
if @trace && @trace.visible? &&
|
||||
(@trace.public? || @trace.user == @user)
|
||||
@title = t 'trace.view.title', :name => @trace.name
|
||||
@title = t "trace.view.title", :name => @trace.name
|
||||
else
|
||||
flash[:error] = t 'trace.view.trace_not_found'
|
||||
redirect_to :controller => 'trace', :action => 'list'
|
||||
flash[:error] = t "trace.view.trace_not_found"
|
||||
redirect_to :controller => "trace", :action => "list"
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
flash[:error] = t 'trace.view.trace_not_found'
|
||||
redirect_to :controller => 'trace', :action => 'list'
|
||||
flash[:error] = t "trace.view.trace_not_found"
|
||||
redirect_to :controller => "trace", :action => "list"
|
||||
end
|
||||
|
||||
def create
|
||||
|
@ -118,10 +118,10 @@ class TraceController < ApplicationController
|
|||
|
||||
if @trace.id
|
||||
logger.info("id is #{@trace.id}")
|
||||
flash[:notice] = t 'trace.create.trace_uploaded'
|
||||
flash[:notice] = t "trace.create.trace_uploaded"
|
||||
|
||||
if @user.traces.where(:inserted => false).count > 4
|
||||
flash[:warning] = t 'trace.trace_header.traces_waiting', :count => @user.traces.where(:inserted => false).count
|
||||
flash[:warning] = t "trace.trace_header.traces_waiting", :count => @user.traces.where(:inserted => false).count
|
||||
end
|
||||
|
||||
redirect_to :action => :list, :display_name => @user.display_name
|
||||
|
@ -140,7 +140,7 @@ class TraceController < ApplicationController
|
|||
@trace = Trace.new(:visibility => default_visibility)
|
||||
end
|
||||
|
||||
@title = t 'trace.create.upload_trace'
|
||||
@title = t "trace.create.upload_trace"
|
||||
end
|
||||
|
||||
def data
|
||||
|
@ -150,11 +150,11 @@ class TraceController < ApplicationController
|
|||
if Acl.no_trace_download(request.remote_ip)
|
||||
render :text => "", :status => :forbidden
|
||||
elsif request.format == Mime::XML
|
||||
send_file(trace.xml_file, :filename => "#{trace.id}.xml", :type => request.format.to_s, :disposition => 'attachment')
|
||||
send_file(trace.xml_file, :filename => "#{trace.id}.xml", :type => request.format.to_s, :disposition => "attachment")
|
||||
elsif request.format == Mime::GPX
|
||||
send_file(trace.xml_file, :filename => "#{trace.id}.gpx", :type => request.format.to_s, :disposition => 'attachment')
|
||||
send_file(trace.xml_file, :filename => "#{trace.id}.gpx", :type => request.format.to_s, :disposition => "attachment")
|
||||
else
|
||||
send_file(trace.trace_name, :filename => "#{trace.id}#{trace.extension_name}", :type => trace.mime_type, :disposition => 'attachment')
|
||||
send_file(trace.trace_name, :filename => "#{trace.id}#{trace.extension_name}", :type => trace.mime_type, :disposition => "attachment")
|
||||
end
|
||||
else
|
||||
render :text => "", :status => :not_found
|
||||
|
@ -171,14 +171,14 @@ class TraceController < ApplicationController
|
|||
elsif @user.nil? || @trace.user != @user
|
||||
render :text => "", :status => :forbidden
|
||||
else
|
||||
@title = t 'trace.edit.title', :name => @trace.name
|
||||
@title = t "trace.edit.title", :name => @trace.name
|
||||
|
||||
if params[:trace]
|
||||
@trace.description = params[:trace][:description]
|
||||
@trace.tagstring = params[:trace][:tagstring]
|
||||
@trace.visibility = params[:trace][:visibility]
|
||||
if @trace.save
|
||||
redirect_to :action => 'view', :display_name => @user.display_name
|
||||
redirect_to :action => "view", :display_name => @user.display_name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -196,7 +196,7 @@ class TraceController < ApplicationController
|
|||
else
|
||||
trace.visible = false
|
||||
trace.save
|
||||
flash[:notice] = t 'trace.delete.scheduled_for_deletion'
|
||||
flash[:notice] = t "trace.delete.scheduled_for_deletion"
|
||||
redirect_to :action => :list, :display_name => @user.display_name
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
|
@ -222,7 +222,7 @@ class TraceController < ApplicationController
|
|||
if trace.inserted?
|
||||
if trace.public? || (@user && @user == trace.user)
|
||||
expires_in 7.days, :private => !trace.public?, :public => trace.public?
|
||||
send_file(trace.large_picture_name, :filename => "#{trace.id}.gif", :type => 'image/gif', :disposition => 'inline')
|
||||
send_file(trace.large_picture_name, :filename => "#{trace.id}.gif", :type => "image/gif", :disposition => "inline")
|
||||
else
|
||||
render :text => "", :status => :forbidden
|
||||
end
|
||||
|
@ -239,7 +239,7 @@ class TraceController < ApplicationController
|
|||
if trace.inserted?
|
||||
if trace.public? || (@user && @user == trace.user)
|
||||
expires_in 7.days, :private => !trace.public?, :public => trace.public?
|
||||
send_file(trace.icon_picture_name, :filename => "#{trace.id}_icon.gif", :type => 'image/gif', :disposition => 'inline')
|
||||
send_file(trace.icon_picture_name, :filename => "#{trace.id}_icon.gif", :type => "image/gif", :disposition => "inline")
|
||||
else
|
||||
render :text => "", :status => :forbidden
|
||||
end
|
||||
|
@ -299,9 +299,9 @@ class TraceController < ApplicationController
|
|||
|
||||
if trace.public? || trace.user == @user
|
||||
if request.format == Mime::XML || request.format == Mime::GPX
|
||||
send_file(trace.xml_file, :filename => "#{trace.id}.xml", :type => request.format.to_s, :disposition => 'attachment')
|
||||
send_file(trace.xml_file, :filename => "#{trace.id}.xml", :type => request.format.to_s, :disposition => "attachment")
|
||||
else
|
||||
send_file(trace.trace_name, :filename => "#{trace.id}#{trace.extension_name}", :type => trace.mime_type, :disposition => 'attachment')
|
||||
send_file(trace.trace_name, :filename => "#{trace.id}#{trace.extension_name}", :type => trace.mime_type, :disposition => "attachment")
|
||||
end
|
||||
else
|
||||
render :text => "", :status => :forbidden
|
||||
|
@ -340,7 +340,7 @@ class TraceController < ApplicationController
|
|||
|
||||
def do_create(file, tags, description, visibility)
|
||||
# Sanitise the user's filename
|
||||
name = file.original_filename.gsub(/[^a-zA-Z0-9.]/, '_')
|
||||
name = file.original_filename.gsub(/[^a-zA-Z0-9.]/, "_")
|
||||
|
||||
# Get a temporary filename...
|
||||
filename = "/tmp/#{rand}"
|
||||
|
@ -398,7 +398,7 @@ class TraceController < ApplicationController
|
|||
end
|
||||
|
||||
def offline_warning
|
||||
flash.now[:warning] = t 'trace.offline_warning.message' if STATUS == :gpx_offline
|
||||
flash.now[:warning] = t "trace.offline_warning.message" if STATUS == :gpx_offline
|
||||
end
|
||||
|
||||
def offline_redirect
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class UserBlocksController < ApplicationController
|
||||
layout 'site'
|
||||
layout "site"
|
||||
|
||||
before_filter :authorize_web
|
||||
before_filter :set_locale
|
||||
|
@ -44,7 +44,7 @@ class UserBlocksController < ApplicationController
|
|||
)
|
||||
|
||||
if @user_block.save
|
||||
flash[:notice] = t('user_block.create.flash', :name => @this_user.display_name)
|
||||
flash[:notice] = t("user_block.create.flash", :name => @this_user.display_name)
|
||||
redirect_to @user_block
|
||||
else
|
||||
render :action => "new"
|
||||
|
@ -57,14 +57,14 @@ class UserBlocksController < ApplicationController
|
|||
def update
|
||||
if @valid_params
|
||||
if @user_block.creator_id != @user.id
|
||||
flash[:error] = t('user_block.update.only_creator_can_edit')
|
||||
flash[:error] = t("user_block.update.only_creator_can_edit")
|
||||
redirect_to :action => "edit"
|
||||
elsif @user_block.update_attributes(
|
||||
:ends_at => Time.now.getutc + @block_period.hours,
|
||||
:reason => params[:user_block][:reason],
|
||||
:needs_view => params[:user_block][:needs_view]
|
||||
)
|
||||
flash[:notice] = t('user_block.update.success')
|
||||
flash[:notice] = t("user_block.update.success")
|
||||
redirect_to(@user_block)
|
||||
else
|
||||
render :action => "edit"
|
||||
|
@ -79,7 +79,7 @@ class UserBlocksController < ApplicationController
|
|||
def revoke
|
||||
if params[:confirm]
|
||||
if @user_block.revoke! @user
|
||||
flash[:notice] = t 'user_block.revoke.flash'
|
||||
flash[:notice] = t "user_block.revoke.flash"
|
||||
redirect_to(@user_block)
|
||||
end
|
||||
end
|
||||
|
@ -125,10 +125,10 @@ class UserBlocksController < ApplicationController
|
|||
@valid_params = false
|
||||
|
||||
if !UserBlock::PERIODS.include?(@block_period)
|
||||
flash[:error] = t('user_block.filter.block_period')
|
||||
flash[:error] = t("user_block.filter.block_period")
|
||||
|
||||
elsif @user_block && !@user_block.active?
|
||||
flash[:error] = t('user_block.filter.block_expired')
|
||||
flash[:error] = t("user_block.filter.block_expired")
|
||||
|
||||
else
|
||||
@valid_params = true
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class UserController < ApplicationController
|
||||
layout 'site', :except => [:api_details]
|
||||
layout "site", :except => [:api_details]
|
||||
|
||||
skip_before_filter :verify_authenticity_token, :only => [:api_read, :api_details, :api_gpx_files]
|
||||
before_filter :disable_terms_redirect, :only => [:terms, :save, :logout, :api_details]
|
||||
|
@ -26,7 +26,7 @@ class UserController < ApplicationController
|
|||
if request.xhr?
|
||||
render :partial => "terms"
|
||||
else
|
||||
@title = t 'user.terms.title'
|
||||
@title = t "user.terms.title"
|
||||
|
||||
if @user && @user.terms_agreed?
|
||||
# Already agreed to terms, so just show settings
|
||||
|
@ -38,14 +38,14 @@ class UserController < ApplicationController
|
|||
end
|
||||
|
||||
def save
|
||||
@title = t 'user.new.title'
|
||||
@title = t "user.new.title"
|
||||
|
||||
if params[:decline]
|
||||
if @user
|
||||
@user.terms_seen = true
|
||||
|
||||
if @user.save
|
||||
flash[:notice] = t 'user.new.terms declined', :url => t('user.new.terms declined url')
|
||||
flash[:notice] = t "user.new.terms declined", :url => t("user.new.terms declined url")
|
||||
end
|
||||
|
||||
if params[:referer]
|
||||
|
@ -54,7 +54,7 @@ class UserController < ApplicationController
|
|||
redirect_to :action => :account, :display_name => @user.display_name
|
||||
end
|
||||
else
|
||||
redirect_to t('user.terms.declined')
|
||||
redirect_to t("user.terms.declined")
|
||||
end
|
||||
elsif @user
|
||||
unless @user.terms_agreed?
|
||||
|
@ -62,7 +62,7 @@ class UserController < ApplicationController
|
|||
@user.terms_agreed = Time.now.getutc
|
||||
@user.terms_seen = true
|
||||
|
||||
flash[:notice] = t 'user.new.terms accepted' if @user.save
|
||||
flash[:notice] = t "user.new.terms accepted" if @user.save
|
||||
end
|
||||
|
||||
if params[:referer]
|
||||
|
@ -90,10 +90,10 @@ class UserController < ApplicationController
|
|||
begin
|
||||
uri = URI(session[:referer])
|
||||
/map=(.*)\/(.*)\/(.*)/.match(uri.fragment) do |m|
|
||||
editor = Rack::Utils.parse_query(uri.query).slice('editor')
|
||||
referer = welcome_path({ 'zoom' => m[1],
|
||||
'lat' => m[2],
|
||||
'lon' => m[3] }.merge(editor))
|
||||
editor = Rack::Utils.parse_query(uri.query).slice("editor")
|
||||
referer = welcome_path({ "zoom" => m[1],
|
||||
"lat" => m[2],
|
||||
"lon" => m[3] }.merge(editor))
|
||||
end
|
||||
rescue
|
||||
# Use default
|
||||
|
@ -105,17 +105,17 @@ class UserController < ApplicationController
|
|||
else
|
||||
session[:token] = @user.tokens.create.token
|
||||
Notifier.signup_confirm(@user, @user.tokens.create(:referer => referer)).deliver_now
|
||||
redirect_to :action => 'confirm', :display_name => @user.display_name
|
||||
redirect_to :action => "confirm", :display_name => @user.display_name
|
||||
end
|
||||
else
|
||||
render :action => 'new', :referer => params[:referer]
|
||||
render :action => "new", :referer => params[:referer]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def account
|
||||
@title = t 'user.account.title'
|
||||
@title = t "user.account.title"
|
||||
@tokens = @user.oauth_tokens.authorized
|
||||
|
||||
if params[:user] && params[:user][:display_name] && params[:user][:description]
|
||||
|
@ -144,12 +144,12 @@ class UserController < ApplicationController
|
|||
def go_public
|
||||
@user.data_public = true
|
||||
@user.save
|
||||
flash[:notice] = t 'user.go_public.flash success'
|
||||
redirect_to :controller => 'user', :action => 'account', :display_name => @user.display_name
|
||||
flash[:notice] = t "user.go_public.flash success"
|
||||
redirect_to :controller => "user", :action => "account", :display_name => @user.display_name
|
||||
end
|
||||
|
||||
def lost_password
|
||||
@title = t 'user.lost_password.title'
|
||||
@title = t "user.lost_password.title"
|
||||
|
||||
if params[:user] && params[:user][:email]
|
||||
user = User.visible.find_by_email(params[:user][:email])
|
||||
|
@ -163,16 +163,16 @@ class UserController < ApplicationController
|
|||
if user
|
||||
token = user.tokens.create
|
||||
Notifier.lost_password(user, token).deliver_now
|
||||
flash[:notice] = t 'user.lost_password.notice email on way'
|
||||
redirect_to :action => 'login'
|
||||
flash[:notice] = t "user.lost_password.notice email on way"
|
||||
redirect_to :action => "login"
|
||||
else
|
||||
flash.now[:error] = t 'user.lost_password.notice email cannot find'
|
||||
flash.now[:error] = t "user.lost_password.notice email cannot find"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def reset_password
|
||||
@title = t 'user.reset_password.title'
|
||||
@title = t "user.reset_password.title"
|
||||
|
||||
if params[:token]
|
||||
token = UserToken.find_by_token(params[:token])
|
||||
|
@ -188,13 +188,13 @@ class UserController < ApplicationController
|
|||
|
||||
if @user.save
|
||||
token.destroy
|
||||
flash[:notice] = t 'user.reset_password.flash changed'
|
||||
redirect_to :action => 'login'
|
||||
flash[:notice] = t "user.reset_password.flash changed"
|
||||
redirect_to :action => "login"
|
||||
end
|
||||
end
|
||||
else
|
||||
flash[:error] = t 'user.reset_password.flash token bad'
|
||||
redirect_to :action => 'lost_password'
|
||||
flash[:error] = t "user.reset_password.flash token bad"
|
||||
redirect_to :action => "lost_password"
|
||||
end
|
||||
else
|
||||
render :text => "", :status => :bad_request
|
||||
|
@ -202,7 +202,7 @@ class UserController < ApplicationController
|
|||
end
|
||||
|
||||
def new
|
||||
@title = t 'user.new.title'
|
||||
@title = t "user.new.title"
|
||||
@referer = params[:referer] || session[:referer]
|
||||
|
||||
if using_open_id?
|
||||
|
@ -216,10 +216,10 @@ class UserController < ApplicationController
|
|||
end
|
||||
|
||||
if @user.openid_url.nil? || @user.invalid?
|
||||
render :action => 'new'
|
||||
render :action => "new"
|
||||
else
|
||||
session[:new_user] = @user
|
||||
redirect_to :action => 'terms'
|
||||
redirect_to :action => "terms"
|
||||
end
|
||||
elsif @user
|
||||
# The user is logged in already, so don't show them the signup
|
||||
|
@ -227,7 +227,7 @@ class UserController < ApplicationController
|
|||
if @referer
|
||||
redirect_to @referer
|
||||
else
|
||||
redirect_to :controller => 'site', :action => 'index'
|
||||
redirect_to :controller => "site", :action => "index"
|
||||
end
|
||||
elsif params.key?(:openid)
|
||||
@user = User.new(:email => params[:email],
|
||||
|
@ -235,7 +235,7 @@ class UserController < ApplicationController
|
|||
:display_name => params[:nickname],
|
||||
:openid_url => params[:openid])
|
||||
|
||||
flash.now[:notice] = t 'user.new.openid association'
|
||||
flash.now[:notice] = t "user.new.openid association"
|
||||
else
|
||||
check_signup_allowed
|
||||
end
|
||||
|
@ -286,7 +286,7 @@ class UserController < ApplicationController
|
|||
end
|
||||
|
||||
def logout
|
||||
@title = t 'user.logout.title'
|
||||
@title = t "user.logout.title"
|
||||
|
||||
if params[:session] == request.session_options[:id]
|
||||
if session[:token]
|
||||
|
@ -299,7 +299,7 @@ class UserController < ApplicationController
|
|||
if params[:referer]
|
||||
redirect_to params[:referer]
|
||||
else
|
||||
redirect_to :controller => 'site', :action => 'index'
|
||||
redirect_to :controller => "site", :action => "index"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -308,11 +308,11 @@ class UserController < ApplicationController
|
|||
if request.post?
|
||||
token = UserToken.find_by_token(params[:confirm_string])
|
||||
if token && token.user.active?
|
||||
flash[:error] = t('user.confirm.already active')
|
||||
redirect_to :action => 'login'
|
||||
flash[:error] = t("user.confirm.already active")
|
||||
redirect_to :action => "login"
|
||||
elsif !token || token.expired?
|
||||
flash[:error] = t('user.confirm.unknown token')
|
||||
redirect_to :action => 'confirm'
|
||||
flash[:error] = t("user.confirm.unknown token")
|
||||
redirect_to :action => "confirm"
|
||||
else
|
||||
user = token.user
|
||||
user.status = "active"
|
||||
|
@ -329,7 +329,7 @@ class UserController < ApplicationController
|
|||
end
|
||||
|
||||
if token.nil? || token.user != user
|
||||
flash[:notice] = t('user.confirm.success')
|
||||
flash[:notice] = t("user.confirm.success")
|
||||
redirect_to :action => :login, :referer => referer
|
||||
else
|
||||
token.destroy
|
||||
|
@ -349,12 +349,12 @@ class UserController < ApplicationController
|
|||
def confirm_resend
|
||||
if user = User.find_by_display_name(params[:display_name])
|
||||
Notifier.signup_confirm(user, user.tokens.create).deliver_now
|
||||
flash[:notice] = t 'user.confirm_resend.success', :email => user.email
|
||||
flash[:notice] = t "user.confirm_resend.success", :email => user.email
|
||||
else
|
||||
flash[:notice] = t 'user.confirm_resend.failure', :name => params[:display_name]
|
||||
flash[:notice] = t "user.confirm_resend.failure", :name => params[:display_name]
|
||||
end
|
||||
|
||||
redirect_to :action => 'login'
|
||||
redirect_to :action => "login"
|
||||
end
|
||||
|
||||
def confirm_email
|
||||
|
@ -366,16 +366,16 @@ class UserController < ApplicationController
|
|||
@user.new_email = nil
|
||||
@user.email_valid = true
|
||||
if @user.save
|
||||
flash[:notice] = t 'user.confirm_email.success'
|
||||
flash[:notice] = t "user.confirm_email.success"
|
||||
else
|
||||
flash[:errors] = @user.errors
|
||||
end
|
||||
token.destroy
|
||||
session[:user] = @user.id
|
||||
redirect_to :action => 'account', :display_name => @user.display_name
|
||||
redirect_to :action => "account", :display_name => @user.display_name
|
||||
else
|
||||
flash[:error] = t 'user.confirm_email.failure'
|
||||
redirect_to :action => 'account', :display_name => @user.display_name
|
||||
flash[:error] = t "user.confirm_email.failure"
|
||||
redirect_to :action => "account", :display_name => @user.display_name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -417,20 +417,20 @@ class UserController < ApplicationController
|
|||
friend.user_id = @user.id
|
||||
friend.friend_user_id = @new_friend.id
|
||||
if @user.is_friends_with?(@new_friend)
|
||||
flash[:warning] = t 'user.make_friend.already_a_friend', :name => @new_friend.display_name
|
||||
flash[:warning] = t "user.make_friend.already_a_friend", :name => @new_friend.display_name
|
||||
else
|
||||
if friend.save
|
||||
flash[:notice] = t 'user.make_friend.success', :name => @new_friend.display_name
|
||||
flash[:notice] = t "user.make_friend.success", :name => @new_friend.display_name
|
||||
Notifier.friend_notification(friend).deliver_now
|
||||
else
|
||||
friend.add_error(t('user.make_friend.failed', :name => @new_friend.display_name))
|
||||
friend.add_error(t("user.make_friend.failed", :name => @new_friend.display_name))
|
||||
end
|
||||
end
|
||||
|
||||
if params[:referer]
|
||||
redirect_to params[:referer]
|
||||
else
|
||||
redirect_to :controller => 'user', :action => 'view'
|
||||
redirect_to :controller => "user", :action => "view"
|
||||
end
|
||||
end
|
||||
else
|
||||
|
@ -445,15 +445,15 @@ class UserController < ApplicationController
|
|||
if request.post?
|
||||
if @user.is_friends_with?(@friend)
|
||||
Friend.delete_all "user_id = #{@user.id} AND friend_user_id = #{@friend.id}"
|
||||
flash[:notice] = t 'user.remove_friend.success', :name => @friend.display_name
|
||||
flash[:notice] = t "user.remove_friend.success", :name => @friend.display_name
|
||||
else
|
||||
flash[:error] = t 'user.remove_friend.not_a_friend', :name => @friend.display_name
|
||||
flash[:error] = t "user.remove_friend.not_a_friend", :name => @friend.display_name
|
||||
end
|
||||
|
||||
if params[:referer]
|
||||
redirect_to params[:referer]
|
||||
else
|
||||
redirect_to :controller => 'user', :action => 'view'
|
||||
redirect_to :controller => "user", :action => "view"
|
||||
end
|
||||
end
|
||||
else
|
||||
|
@ -466,14 +466,14 @@ class UserController < ApplicationController
|
|||
def set_status
|
||||
@this_user.status = params[:status]
|
||||
@this_user.save
|
||||
redirect_to :controller => 'user', :action => 'view', :display_name => params[:display_name]
|
||||
redirect_to :controller => "user", :action => "view", :display_name => params[:display_name]
|
||||
end
|
||||
|
||||
##
|
||||
# delete a user, marking them as deleted and removing personal data
|
||||
def delete
|
||||
@this_user.delete
|
||||
redirect_to :controller => 'user', :action => 'view', :display_name => params[:display_name]
|
||||
redirect_to :controller => "user", :action => "view", :display_name => params[:display_name]
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -508,9 +508,9 @@ class UserController < ApplicationController
|
|||
elsif user = User.authenticate(:username => username, :password => password, :pending => true)
|
||||
unconfirmed_login(user)
|
||||
elsif User.authenticate(:username => username, :password => password, :suspended => true)
|
||||
failed_login t('user.login.account is suspended', :webmaster => "mailto:webmaster@openstreetmap.org")
|
||||
failed_login t("user.login.account is suspended", :webmaster => "mailto:webmaster@openstreetmap.org")
|
||||
else
|
||||
failed_login t('user.login.auth failure')
|
||||
failed_login t("user.login.auth failure")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -541,9 +541,9 @@ class UserController < ApplicationController
|
|||
when "active", "confirmed" then
|
||||
successful_login(user)
|
||||
when "suspended" then
|
||||
failed_login t('user.login.account is suspended', :webmaster => "mailto:webmaster@openstreetmap.org")
|
||||
failed_login t("user.login.account is suspended", :webmaster => "mailto:webmaster@openstreetmap.org")
|
||||
else
|
||||
failed_login t('user.login.auth failure')
|
||||
failed_login t("user.login.auth failure")
|
||||
end
|
||||
else
|
||||
# Guard against not getting any extension data
|
||||
|
@ -557,14 +557,14 @@ class UserController < ApplicationController
|
|||
nickname = sreg["nickname"] || ax["http://axschema.org/namePerson/friendly"].first
|
||||
email = sreg["email"] || ax["http://axschema.org/contact/email"].first
|
||||
|
||||
redirect_to :controller => 'user', :action => 'new', :nickname => nickname, :email => email, :openid => identity_url
|
||||
redirect_to :controller => "user", :action => "new", :nickname => nickname, :email => email, :openid => identity_url
|
||||
end
|
||||
elsif result.missing?
|
||||
failed_login t('user.login.openid missing provider')
|
||||
failed_login t("user.login.openid missing provider")
|
||||
elsif result.invalid?
|
||||
failed_login t('user.login.openid invalid')
|
||||
failed_login t("user.login.openid invalid")
|
||||
else
|
||||
failed_login t('user.login.auth failure')
|
||||
failed_login t("user.login.auth failure")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -595,11 +595,11 @@ class UserController < ApplicationController
|
|||
user.openid_url = identity_url
|
||||
yield user, verified_email
|
||||
elsif result.missing?
|
||||
flash.now[:error] = t 'user.login.openid missing provider'
|
||||
flash.now[:error] = t "user.login.openid missing provider"
|
||||
elsif result.invalid?
|
||||
flash.now[:error] = t 'user.login.openid invalid'
|
||||
flash.now[:error] = t "user.login.openid invalid"
|
||||
else
|
||||
flash.now[:error] = t 'user.login.auth failure'
|
||||
flash.now[:error] = t "user.login.auth failure"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -615,7 +615,7 @@ class UserController < ApplicationController
|
|||
# provider and, unlike yahoo.com, where it works automatically, Google
|
||||
# have hidden their OpenID endpoint somewhere obscure this making it
|
||||
# somewhat less user friendly.
|
||||
return 'https://www.google.com/accounts/o8/id'
|
||||
return "https://www.google.com/accounts/o8/id"
|
||||
else
|
||||
return openid_url
|
||||
end
|
||||
|
@ -660,7 +660,7 @@ class UserController < ApplicationController
|
|||
def failed_login(message)
|
||||
flash[:error] = message
|
||||
|
||||
redirect_to :action => 'login', :referer => session[:referer]
|
||||
redirect_to :action => "login", :referer => session[:referer]
|
||||
|
||||
session.delete(:remember_me)
|
||||
session.delete(:referer)
|
||||
|
@ -669,7 +669,7 @@ class UserController < ApplicationController
|
|||
##
|
||||
#
|
||||
def unconfirmed_login(user)
|
||||
redirect_to :action => 'confirm', :display_name => user.display_name
|
||||
redirect_to :action => "confirm", :display_name => user.display_name
|
||||
|
||||
session.delete(:remember_me)
|
||||
session.delete(:referer)
|
||||
|
@ -720,12 +720,12 @@ class UserController < ApplicationController
|
|||
set_locale
|
||||
|
||||
if user.new_email.blank? || user.new_email == user.email
|
||||
flash.now[:notice] = t 'user.account.flash update success'
|
||||
flash.now[:notice] = t "user.account.flash update success"
|
||||
else
|
||||
user.email = user.new_email
|
||||
|
||||
if user.valid?
|
||||
flash.now[:notice] = t 'user.account.flash update success confirm needed'
|
||||
flash.now[:notice] = t "user.account.flash update success confirm needed"
|
||||
|
||||
begin
|
||||
Notifier.email_confirm(user, user.tokens.create).deliver_now
|
||||
|
@ -747,15 +747,15 @@ class UserController < ApplicationController
|
|||
# and return them to the user page.
|
||||
def require_administrator
|
||||
if @user && !@user.administrator?
|
||||
flash[:error] = t('user.filter.not_an_administrator')
|
||||
flash[:error] = t("user.filter.not_an_administrator")
|
||||
|
||||
if params[:display_name]
|
||||
redirect_to :controller => 'user', :action => 'view', :display_name => params[:display_name]
|
||||
redirect_to :controller => "user", :action => "view", :display_name => params[:display_name]
|
||||
else
|
||||
redirect_to :controller => 'user', :action => 'login', :referer => request.fullpath
|
||||
redirect_to :controller => "user", :action => "login", :referer => request.fullpath
|
||||
end
|
||||
elsif !@user
|
||||
redirect_to :controller => 'user', :action => 'login', :referer => request.fullpath
|
||||
redirect_to :controller => "user", :action => "login", :referer => request.fullpath
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -778,7 +778,7 @@ class UserController < ApplicationController
|
|||
def lookup_user_by_name
|
||||
@this_user = User.find_by_display_name(params[:display_name])
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
redirect_to :controller => 'user', :action => 'view', :display_name => params[:display_name] unless @this_user
|
||||
redirect_to :controller => "user", :action => "view", :display_name => params[:display_name] unless @this_user
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -808,7 +808,7 @@ class UserController < ApplicationController
|
|||
if blocked = Acl.no_account_creation(request.remote_ip, domain)
|
||||
logger.info "Blocked signup from #{request.remote_ip} for #{email}"
|
||||
|
||||
render :action => 'blocked'
|
||||
render :action => "blocked"
|
||||
end
|
||||
|
||||
!blocked
|
||||
|
|
|
@ -13,7 +13,7 @@ class UserPreferenceController < ApplicationController
|
|||
|
||||
prefs = @user.preferences
|
||||
|
||||
el1 = XML::Node.new 'preferences'
|
||||
el1 = XML::Node.new "preferences"
|
||||
|
||||
prefs.each do |pref|
|
||||
el1 << pref.to_xml_node
|
||||
|
@ -41,7 +41,7 @@ class UserPreferenceController < ApplicationController
|
|||
|
||||
doc = XML::Parser.string(request.raw_post).parse
|
||||
|
||||
doc.find('//preferences/preference').each do |pt|
|
||||
doc.find("//preferences/preference").each do |pt|
|
||||
if preference = old_preferences.delete(pt["k"])
|
||||
preference.v = pt["v"]
|
||||
elsif new_preferences.include?(pt["k"])
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class UserRolesController < ApplicationController
|
||||
layout 'site'
|
||||
layout "site"
|
||||
|
||||
before_filter :authorize_web
|
||||
before_filter :require_user
|
||||
|
@ -11,12 +11,12 @@ class UserRolesController < ApplicationController
|
|||
|
||||
def grant
|
||||
@this_user.roles.create(:role => @role, :granter_id => @user.id)
|
||||
redirect_to :controller => 'user', :action => 'view', :display_name => @this_user.display_name
|
||||
redirect_to :controller => "user", :action => "view", :display_name => @this_user.display_name
|
||||
end
|
||||
|
||||
def revoke
|
||||
UserRole.delete_all(:user_id => @this_user.id, :role => @role)
|
||||
redirect_to :controller => 'user', :action => 'view', :display_name => @this_user.display_name
|
||||
redirect_to :controller => "user", :action => "view", :display_name => @this_user.display_name
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -26,8 +26,8 @@ class UserRolesController < ApplicationController
|
|||
# and return them to theuser page.
|
||||
def require_administrator
|
||||
unless @user.administrator?
|
||||
flash[:error] = t 'user_role.filter.not_an_administrator'
|
||||
redirect_to :controller => 'user', :action => 'view', :display_name => @this_user.display_name
|
||||
flash[:error] = t "user_role.filter.not_an_administrator"
|
||||
redirect_to :controller => "user", :action => "view", :display_name => @this_user.display_name
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -37,8 +37,8 @@ class UserRolesController < ApplicationController
|
|||
def require_valid_role
|
||||
@role = params[:role]
|
||||
unless UserRole::ALL_ROLES.include?(@role)
|
||||
flash[:error] = t('user_role.filter.not_a_role', :role => @role)
|
||||
redirect_to :controller => 'user', :action => 'view', :display_name => @this_user.display_name
|
||||
flash[:error] = t("user_role.filter.not_a_role", :role => @role)
|
||||
redirect_to :controller => "user", :action => "view", :display_name => @this_user.display_name
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -46,8 +46,8 @@ class UserRolesController < ApplicationController
|
|||
# checks that the user doesn't already have this role
|
||||
def not_in_role
|
||||
if @this_user.has_role? @role
|
||||
flash[:error] = t('user_role.filter.already_has_role', :role => @role)
|
||||
redirect_to :controller => 'user', :action => 'view', :display_name => @this_user.display_name
|
||||
flash[:error] = t("user_role.filter.already_has_role", :role => @role)
|
||||
redirect_to :controller => "user", :action => "view", :display_name => @this_user.display_name
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -55,8 +55,8 @@ class UserRolesController < ApplicationController
|
|||
# checks that the user already has this role
|
||||
def in_role
|
||||
unless @this_user.has_role? @role
|
||||
flash[:error] = t('user_role.filter.doesnt_have_role', :role => @role)
|
||||
redirect_to :controller => 'user', :action => 'view', :display_name => @this_user.display_name
|
||||
flash[:error] = t("user_role.filter.doesnt_have_role", :role => @role)
|
||||
redirect_to :controller => "user", :action => "view", :display_name => @this_user.display_name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class WayController < ApplicationController
|
||||
require 'xml/libxml'
|
||||
require "xml/libxml"
|
||||
|
||||
skip_before_filter :verify_authenticity_token
|
||||
before_filter :authorize, :only => [:create, :update, :delete]
|
||||
|
@ -84,11 +84,11 @@ class WayController < ApplicationController
|
|||
end
|
||||
|
||||
def ways
|
||||
unless params['ways']
|
||||
unless params["ways"]
|
||||
fail OSM::APIBadUserInput.new("The parameter ways is required, and must be of the form ways=id[,id[,id...]]")
|
||||
end
|
||||
|
||||
ids = params['ways'].split(',').collect(&:to_i)
|
||||
ids = params["ways"].split(",").collect(&:to_i)
|
||||
|
||||
if ids.length == 0
|
||||
fail OSM::APIBadUserInput.new("No ways were given to search for")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module ApplicationHelper
|
||||
require 'rexml/document'
|
||||
require "rexml/document"
|
||||
|
||||
def linkify(text)
|
||||
if text.html_safe?
|
||||
|
|
|
@ -5,9 +5,9 @@ module BrowseHelper
|
|||
else
|
||||
id = object.id
|
||||
end
|
||||
name = t 'printable_name.with_id', :id => id.to_s
|
||||
name = t "printable_name.with_id", :id => id.to_s
|
||||
if version
|
||||
name = t 'printable_name.with_version', :id => name, :version => object.version.to_s
|
||||
name = t "printable_name.with_version", :id => name, :version => object.version.to_s
|
||||
end
|
||||
|
||||
# don't look at object tags if redacted, so as to avoid giving
|
||||
|
@ -20,9 +20,9 @@ module BrowseHelper
|
|||
end
|
||||
|
||||
if object.tags.include? "name:#{locale}"
|
||||
name = t 'printable_name.with_name_html', :name => content_tag(:bdi, object.tags["name:#{locale}"].to_s), :id => content_tag(:bdi, name)
|
||||
elsif object.tags.include? 'name'
|
||||
name = t 'printable_name.with_name_html', :name => content_tag(:bdi, object.tags['name'].to_s), :id => content_tag(:bdi, name)
|
||||
name = t "printable_name.with_name_html", :name => content_tag(:bdi, object.tags["name:#{locale}"].to_s), :id => content_tag(:bdi, name)
|
||||
elsif object.tags.include? "name"
|
||||
name = t "printable_name.with_name_html", :name => content_tag(:bdi, object.tags["name"].to_s), :id => content_tag(:bdi, name)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -46,13 +46,13 @@ module BrowseHelper
|
|||
if object.redacted?
|
||||
""
|
||||
else
|
||||
h(icon_tags(object).map { |k, v| k + '=' + v }.to_sentence)
|
||||
h(icon_tags(object).map { |k, v| k + "=" + v }.to_sentence)
|
||||
end
|
||||
end
|
||||
|
||||
def format_key(key)
|
||||
if url = wiki_link("key", key)
|
||||
link_to h(key), url, :title => t('browse.tag_details.wiki_link.key', :key => key)
|
||||
link_to h(key), url, :title => t("browse.tag_details.wiki_link.key", :key => key)
|
||||
else
|
||||
h(key)
|
||||
end
|
||||
|
@ -60,13 +60,13 @@ module BrowseHelper
|
|||
|
||||
def format_value(key, value)
|
||||
if wp = wikipedia_link(key, value)
|
||||
link_to h(wp[:title]), wp[:url], :title => t('browse.tag_details.wikipedia_link', :page => wp[:title])
|
||||
link_to h(wp[:title]), wp[:url], :title => t("browse.tag_details.wikipedia_link", :page => wp[:title])
|
||||
elsif wdt = wikidata_link(key, value)
|
||||
link_to h(wdt[:title]), wdt[:url], :title => t('browse.tag_details.wikidata_link', :page => wdt[:title])
|
||||
link_to h(wdt[:title]), wdt[:url], :title => t("browse.tag_details.wikidata_link", :page => wdt[:title])
|
||||
elsif url = wiki_link("tag", "#{key}=#{value}")
|
||||
link_to h(value), url, :title => t('browse.tag_details.wiki_link.tag', :key => key, :value => value)
|
||||
link_to h(value), url, :title => t("browse.tag_details.wiki_link.tag", :key => key, :value => value)
|
||||
elsif url = telephone_link(key, value)
|
||||
link_to h(value), url, :title => t('browse.tag_details.telephone_link', :phone_number => value)
|
||||
link_to h(value), url, :title => t("browse.tag_details.telephone_link", :phone_number => value)
|
||||
else
|
||||
linkify h(value)
|
||||
end
|
||||
|
@ -123,7 +123,7 @@ module BrowseHelper
|
|||
lang = $1
|
||||
else
|
||||
# Value is <title> so default to English Wikipedia
|
||||
lang = 'en'
|
||||
lang = "en"
|
||||
end
|
||||
elsif key =~ /^wikipedia:(\S+)$/
|
||||
# Language is in the key, so assume value is the title
|
||||
|
@ -164,7 +164,7 @@ module BrowseHelper
|
|||
|
||||
# remove all whitespace instead of encoding it http://tools.ietf.org/html/rfc3966#section-5.1.1
|
||||
# "+1 (234) 567-8901 " -> "+1(234)567-8901"
|
||||
value_no_whitespace = value.gsub(/\s+/, '')
|
||||
value_no_whitespace = value.gsub(/\s+/, "")
|
||||
|
||||
"tel:#{value_no_whitespace}"
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module ChangesetHelper
|
|||
if changeset.user.data_public?
|
||||
link_to(changeset.user.display_name, user_path(changeset.user.display_name))
|
||||
else
|
||||
t('browse.anonymous')
|
||||
t("browse.anonymous")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ module GeocoderHelper
|
|||
end
|
||||
|
||||
result.each do |key, value|
|
||||
html_options[:data][key.to_s.tr('_', '-')] = value
|
||||
html_options[:data][key.to_s.tr("_", "-")] = value
|
||||
end
|
||||
|
||||
html = ""
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'htmlentities'
|
||||
require "htmlentities"
|
||||
|
||||
module TitleHelper
|
||||
@@coder = HTMLEntities.new
|
||||
|
@ -6,10 +6,10 @@ module TitleHelper
|
|||
def set_title(title = false)
|
||||
if title
|
||||
@title = @@coder.decode(title.gsub("<bdi>", "\u202a").gsub("</bdi>", "\u202c"))
|
||||
response.headers["X-Page-Title"] = t('layouts.project_name.title') + ' | ' + @title
|
||||
response.headers["X-Page-Title"] = t("layouts.project_name.title") + " | " + @title
|
||||
else
|
||||
@title = title
|
||||
response.headers["X-Page-Title"] = t('layouts.project_name.title')
|
||||
response.headers["X-Page-Title"] = t("layouts.project_name.title")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,16 +5,16 @@ module UserBlocksHelper
|
|||
def block_status(block)
|
||||
if block.active?
|
||||
if block.needs_view?
|
||||
I18n.t('user_block.helper.until_login')
|
||||
I18n.t("user_block.helper.until_login")
|
||||
else
|
||||
I18n.t('user_block.helper.time_future', :time => distance_of_time_in_words_to_now(block.ends_at))
|
||||
I18n.t("user_block.helper.time_future", :time => distance_of_time_in_words_to_now(block.ends_at))
|
||||
end
|
||||
else
|
||||
# the max of the last update time or the ends_at time is when this block finished
|
||||
# either because the user viewed the block (updated_at) or it expired or was
|
||||
# revoked (ends_at)
|
||||
last_time = [block.ends_at, block.updated_at].max
|
||||
I18n.t('user_block.helper.time_past', :time => distance_of_time_in_words_to_now(last_time))
|
||||
I18n.t("user_block.helper.time_past", :time => distance_of_time_in_words_to_now(last_time))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -45,7 +45,7 @@ module UserHelper
|
|||
# OpenID support
|
||||
|
||||
def openid_logo
|
||||
image_tag "openid_small.png", :alt => t('user.login.openid_logo_alt'), :class => "openid_logo"
|
||||
image_tag "openid_small.png", :alt => t("user.login.openid_logo_alt"), :class => "openid_logo"
|
||||
end
|
||||
|
||||
def openid_button(name, url)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class Changeset < ActiveRecord::Base
|
||||
require 'xml/libxml'
|
||||
require "xml/libxml"
|
||||
|
||||
belongs_to :user, :counter_cache => true
|
||||
|
||||
|
@ -13,7 +13,7 @@ class Changeset < ActiveRecord::Base
|
|||
has_many :old_relations
|
||||
|
||||
has_many :comments, -> { where(:visible => true).order(:created_at) }, :class_name => "ChangesetComment"
|
||||
has_and_belongs_to_many :subscribers, :class_name => 'User', :join_table => 'changesets_subscribers', :association_foreign_key => 'subscriber_id'
|
||||
has_and_belongs_to_many :subscribers, :class_name => "User", :join_table => "changesets_subscribers", :association_foreign_key => "subscriber_id"
|
||||
|
||||
validates_presence_of :id, :on => :update
|
||||
validates_presence_of :user_id, :created_at, :closed_at, :num_changes
|
||||
|
@ -57,7 +57,7 @@ class Changeset < ActiveRecord::Base
|
|||
p = XML::Parser.string(xml, :options => XML::Parser::Options::NOERROR)
|
||||
doc = p.parse
|
||||
|
||||
doc.find('//osm/changeset').each do |pt|
|
||||
doc.find("//osm/changeset").each do |pt|
|
||||
return Changeset.from_xml_node(pt, create)
|
||||
end
|
||||
fail OSM::APIBadXMLError.new("changeset", xml, "XML doesn't contain an osm/changeset element.")
|
||||
|
@ -76,10 +76,10 @@ class Changeset < ActiveRecord::Base
|
|||
cs.num_changes = 0
|
||||
end
|
||||
|
||||
pt.find('tag').each do |tag|
|
||||
fail OSM::APIBadXMLError.new("changeset", pt, "tag is missing key") if tag['k'].nil?
|
||||
fail OSM::APIBadXMLError.new("changeset", pt, "tag is missing value") if tag['v'].nil?
|
||||
cs.add_tag_keyval(tag['k'], tag['v'])
|
||||
pt.find("tag").each do |tag|
|
||||
fail OSM::APIBadXMLError.new("changeset", pt, "tag is missing key") if tag["k"].nil?
|
||||
fail OSM::APIBadXMLError.new("changeset", pt, "tag is missing value") if tag["v"].nil?
|
||||
cs.add_tag_keyval(tag["k"], tag["v"])
|
||||
end
|
||||
|
||||
cs
|
||||
|
@ -183,8 +183,8 @@ class Changeset < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def to_xml_node(user_display_name_cache = nil, include_discussion = false)
|
||||
el1 = XML::Node.new 'changeset'
|
||||
el1['id'] = id.to_s
|
||||
el1 = XML::Node.new "changeset"
|
||||
el1["id"] = id.to_s
|
||||
|
||||
user_display_name_cache = {} if user_display_name_cache.nil?
|
||||
|
||||
|
@ -196,32 +196,32 @@ class Changeset < ActiveRecord::Base
|
|||
user_display_name_cache[user_id] = nil
|
||||
end
|
||||
|
||||
el1['user'] = user_display_name_cache[user_id] unless user_display_name_cache[user_id].nil?
|
||||
el1['uid'] = user_id.to_s if user.data_public?
|
||||
el1["user"] = user_display_name_cache[user_id] unless user_display_name_cache[user_id].nil?
|
||||
el1["uid"] = user_id.to_s if user.data_public?
|
||||
|
||||
tags.each do |k, v|
|
||||
el2 = XML::Node.new('tag')
|
||||
el2['k'] = k.to_s
|
||||
el2['v'] = v.to_s
|
||||
el2 = XML::Node.new("tag")
|
||||
el2["k"] = k.to_s
|
||||
el2["v"] = v.to_s
|
||||
el1 << el2
|
||||
end
|
||||
|
||||
el1['created_at'] = created_at.xmlschema
|
||||
el1['closed_at'] = closed_at.xmlschema unless is_open?
|
||||
el1['open'] = is_open?.to_s
|
||||
el1["created_at"] = created_at.xmlschema
|
||||
el1["closed_at"] = closed_at.xmlschema unless is_open?
|
||||
el1["open"] = is_open?.to_s
|
||||
|
||||
bbox.to_unscaled.add_bounds_to(el1, '_') if bbox.complete?
|
||||
bbox.to_unscaled.add_bounds_to(el1, "_") if bbox.complete?
|
||||
|
||||
el1['comments_count'] = comments.count.to_s
|
||||
el1["comments_count"] = comments.count.to_s
|
||||
|
||||
if include_discussion
|
||||
el2 = XML::Node.new('discussion')
|
||||
el2 = XML::Node.new("discussion")
|
||||
comments.includes(:author).each do |comment|
|
||||
el3 = XML::Node.new('comment')
|
||||
el3['date'] = comment.created_at.xmlschema
|
||||
el3['uid'] = comment.author.id.to_s if comment.author.data_public?
|
||||
el3['user'] = comment.author.display_name.to_s if comment.author.data_public?
|
||||
el4 = XML::Node.new('text')
|
||||
el3 = XML::Node.new("comment")
|
||||
el3["date"] = comment.created_at.xmlschema
|
||||
el3["uid"] = comment.author.id.to_s if comment.author.data_public?
|
||||
el3["user"] = comment.author.display_name.to_s if comment.author.data_public?
|
||||
el4 = XML::Node.new("text")
|
||||
el4.content = comment.body.to_s
|
||||
el3 << el4
|
||||
el2 << el3
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'oauth'
|
||||
require "oauth"
|
||||
|
||||
class ClientApplication < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class DiaryEntry < ActiveRecord::Base
|
||||
belongs_to :user, :counter_cache => true
|
||||
belongs_to :language, :foreign_key => 'language_code'
|
||||
belongs_to :language, :foreign_key => "language_code"
|
||||
|
||||
has_many :comments, -> { order(:id).preload(:user) }, :class_name => "DiaryComment"
|
||||
has_many :visible_comments, -> { joins(:user).where(:visible => true, :users => { :status => %w(active confirmed) }).order(:id) }, :class_name => "DiaryComment"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class Language < ActiveRecord::Base
|
||||
self.primary_key = "code"
|
||||
|
||||
has_many :diary_entries, :foreign_key => 'language'
|
||||
has_many :diary_entries, :foreign_key => "language"
|
||||
|
||||
def self.load(file)
|
||||
Language.transaction do
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'validators'
|
||||
require "validators"
|
||||
|
||||
class Message < ActiveRecord::Base
|
||||
belongs_to :sender, :class_name => "User", :foreign_key => :from_user_id
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class Node < ActiveRecord::Base
|
||||
require 'xml/libxml'
|
||||
require "xml/libxml"
|
||||
|
||||
include GeoRecord
|
||||
include ConsistencyValidations
|
||||
|
@ -45,7 +45,7 @@ class Node < ActiveRecord::Base
|
|||
p = XML::Parser.string(xml)
|
||||
doc = p.parse
|
||||
|
||||
doc.find('//osm/node').each do |pt|
|
||||
doc.find("//osm/node").each do |pt|
|
||||
return Node.from_xml_node(pt, create)
|
||||
end
|
||||
fail OSM::APIBadXMLError.new("node", xml, "XML doesn't contain an osm/node element.")
|
||||
|
@ -56,22 +56,22 @@ class Node < ActiveRecord::Base
|
|||
def self.from_xml_node(pt, create = false)
|
||||
node = Node.new
|
||||
|
||||
fail OSM::APIBadXMLError.new("node", pt, "lat missing") if pt['lat'].nil?
|
||||
fail OSM::APIBadXMLError.new("node", pt, "lon missing") if pt['lon'].nil?
|
||||
node.lat = OSM.parse_float(pt['lat'], OSM::APIBadXMLError, "node", pt, "lat not a number")
|
||||
node.lon = OSM.parse_float(pt['lon'], OSM::APIBadXMLError, "node", pt, "lon not a number")
|
||||
fail OSM::APIBadXMLError.new("node", pt, "Changeset id is missing") if pt['changeset'].nil?
|
||||
node.changeset_id = pt['changeset'].to_i
|
||||
fail OSM::APIBadXMLError.new("node", pt, "lat missing") if pt["lat"].nil?
|
||||
fail OSM::APIBadXMLError.new("node", pt, "lon missing") if pt["lon"].nil?
|
||||
node.lat = OSM.parse_float(pt["lat"], OSM::APIBadXMLError, "node", pt, "lat not a number")
|
||||
node.lon = OSM.parse_float(pt["lon"], OSM::APIBadXMLError, "node", pt, "lon not a number")
|
||||
fail OSM::APIBadXMLError.new("node", pt, "Changeset id is missing") if pt["changeset"].nil?
|
||||
node.changeset_id = pt["changeset"].to_i
|
||||
|
||||
fail OSM::APIBadUserInput.new("The node is outside this world") unless node.in_world?
|
||||
|
||||
# version must be present unless creating
|
||||
fail OSM::APIBadXMLError.new("node", pt, "Version is required when updating") unless create || !pt['version'].nil?
|
||||
node.version = create ? 0 : pt['version'].to_i
|
||||
fail OSM::APIBadXMLError.new("node", pt, "Version is required when updating") unless create || !pt["version"].nil?
|
||||
node.version = create ? 0 : pt["version"].to_i
|
||||
|
||||
unless create
|
||||
fail OSM::APIBadXMLError.new("node", pt, "ID is required when updating.") if pt['id'].nil?
|
||||
node.id = pt['id'].to_i
|
||||
fail OSM::APIBadXMLError.new("node", pt, "ID is required when updating.") if pt["id"].nil?
|
||||
node.id = pt["id"].to_i
|
||||
# .to_i will return 0 if there is no number that can be parsed.
|
||||
# We want to make sure that there is no id with zero anyway
|
||||
fail OSM::APIBadUserInput.new("ID of node cannot be zero when updating.") if node.id == 0
|
||||
|
@ -86,10 +86,10 @@ class Node < ActiveRecord::Base
|
|||
node.tags = {}
|
||||
|
||||
# Add in any tags from the XML
|
||||
pt.find('tag').each do |tag|
|
||||
fail OSM::APIBadXMLError.new("node", pt, "tag is missing key") if tag['k'].nil?
|
||||
fail OSM::APIBadXMLError.new("node", pt, "tag is missing value") if tag['v'].nil?
|
||||
node.add_tag_key_val(tag['k'], tag['v'])
|
||||
pt.find("tag").each do |tag|
|
||||
fail OSM::APIBadXMLError.new("node", pt, "tag is missing key") if tag["k"].nil?
|
||||
fail OSM::APIBadXMLError.new("node", pt, "tag is missing value") if tag["v"].nil?
|
||||
node.add_tag_key_val(tag["k"], tag["v"])
|
||||
end
|
||||
|
||||
node
|
||||
|
@ -172,14 +172,14 @@ class Node < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def to_xml_node(changeset_cache = {}, user_display_name_cache = {})
|
||||
el = XML::Node.new 'node'
|
||||
el['id'] = id.to_s
|
||||
el = XML::Node.new "node"
|
||||
el["id"] = id.to_s
|
||||
|
||||
add_metadata_to_xml_node(el, self, changeset_cache, user_display_name_cache)
|
||||
|
||||
if self.visible?
|
||||
el['lat'] = lat.to_s
|
||||
el['lon'] = lon.to_s
|
||||
el["lat"] = lat.to_s
|
||||
el["lon"] = lon.to_s
|
||||
end
|
||||
|
||||
add_tags_to_xml_node(el, node_tags)
|
||||
|
|
|
@ -12,7 +12,7 @@ class Notifier < ActionMailer::Base
|
|||
:confirm_string => token.token)
|
||||
|
||||
mail :to => user.email,
|
||||
:subject => I18n.t('notifier.signup_confirm.subject')
|
||||
:subject => I18n.t("notifier.signup_confirm.subject")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -24,7 +24,7 @@ class Notifier < ActionMailer::Base
|
|||
:confirm_string => token.token)
|
||||
|
||||
mail :to => user.new_email,
|
||||
:subject => I18n.t('notifier.email_confirm.subject')
|
||||
:subject => I18n.t("notifier.email_confirm.subject")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -35,7 +35,7 @@ class Notifier < ActionMailer::Base
|
|||
:token => token.token)
|
||||
|
||||
mail :to => user.email,
|
||||
:subject => I18n.t('notifier.lost_password.subject')
|
||||
:subject => I18n.t("notifier.lost_password.subject")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -48,7 +48,7 @@ class Notifier < ActionMailer::Base
|
|||
@possible_points = possible_points
|
||||
|
||||
mail :to => trace.user.email,
|
||||
:subject => I18n.t('notifier.gpx_notification.success.subject')
|
||||
:subject => I18n.t("notifier.gpx_notification.success.subject")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -60,7 +60,7 @@ class Notifier < ActionMailer::Base
|
|||
@error = error
|
||||
|
||||
mail :to => trace.user.email,
|
||||
:subject => I18n.t('notifier.gpx_notification.failure.subject')
|
||||
:subject => I18n.t("notifier.gpx_notification.failure.subject")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -79,7 +79,7 @@ class Notifier < ActionMailer::Base
|
|||
|
||||
mail :from => from_address(message.sender.display_name, "m", message.id, message.digest),
|
||||
:to => message.recipient.email,
|
||||
:subject => I18n.t('notifier.message_notification.subject_header', :subject => message.title)
|
||||
:subject => I18n.t("notifier.message_notification.subject_header", :subject => message.title)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -109,7 +109,7 @@ class Notifier < ActionMailer::Base
|
|||
|
||||
mail :from => from_address(comment.user.display_name, "c", comment.id, comment.digest),
|
||||
:to => comment.diary_entry.user.email,
|
||||
:subject => I18n.t('notifier.diary_comment_notification.subject', :user => comment.user.display_name)
|
||||
:subject => I18n.t("notifier.diary_comment_notification.subject", :user => comment.user.display_name)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -118,7 +118,7 @@ class Notifier < ActionMailer::Base
|
|||
@friend = friend
|
||||
|
||||
mail :to => friend.befriendee.email,
|
||||
:subject => I18n.t('notifier.friend_notification.subject', :user => friend.befriender.display_name)
|
||||
:subject => I18n.t("notifier.friend_notification.subject", :user => friend.befriender.display_name)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -152,7 +152,7 @@ class Notifier < ActionMailer::Base
|
|||
@comment = comment.body
|
||||
@owner = recipient == comment.changeset.user
|
||||
@commenter = comment.author.display_name
|
||||
@changeset_comment = comment.changeset.tags['comment'].presence
|
||||
@changeset_comment = comment.changeset.tags["comment"].presence
|
||||
@time = comment.created_at
|
||||
@changeset_author = comment.changeset.user.display_name
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ class Oauth2Token < AccessToken
|
|||
attr_accessor :state
|
||||
|
||||
def as_json(_options = {})
|
||||
d = { :access_token => token, :token_type => 'bearer' }
|
||||
d = { :access_token => token, :token_type => "bearer" }
|
||||
d[:expires_in] = expires_in if expires_at
|
||||
d
|
||||
end
|
||||
|
|
|
@ -20,7 +20,7 @@ class OldNode < ActiveRecord::Base
|
|||
belongs_to :redaction
|
||||
belongs_to :current_node, :class_name => "Node", :foreign_key => "node_id"
|
||||
|
||||
has_many :old_tags, :class_name => 'OldNodeTag', :foreign_key => [:node_id, :version]
|
||||
has_many :old_tags, :class_name => "OldNodeTag", :foreign_key => [:node_id, :version]
|
||||
|
||||
def validate_position
|
||||
errors.add(:base, "Node is not in the world") unless in_world?
|
||||
|
@ -46,14 +46,14 @@ class OldNode < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def to_xml_node(changeset_cache = {}, user_display_name_cache = {})
|
||||
el = XML::Node.new 'node'
|
||||
el['id'] = node_id.to_s
|
||||
el = XML::Node.new "node"
|
||||
el["id"] = node_id.to_s
|
||||
|
||||
add_metadata_to_xml_node(el, self, changeset_cache, user_display_name_cache)
|
||||
|
||||
if self.visible?
|
||||
el['lat'] = lat.to_s
|
||||
el['lon'] = lon.to_s
|
||||
el["lat"] = lat.to_s
|
||||
el["lon"] = lon.to_s
|
||||
end
|
||||
|
||||
add_tags_to_xml_node(el, old_tags)
|
||||
|
|
|
@ -13,8 +13,8 @@ class OldRelation < ActiveRecord::Base
|
|||
belongs_to :redaction
|
||||
belongs_to :current_relation, :class_name => "Relation", :foreign_key => "relation_id"
|
||||
|
||||
has_many :old_members, -> { order(:sequence_id) }, :class_name => 'OldRelationMember', :foreign_key => [:relation_id, :version]
|
||||
has_many :old_tags, :class_name => 'OldRelationTag', :foreign_key => [:relation_id, :version]
|
||||
has_many :old_members, -> { order(:sequence_id) }, :class_name => "OldRelationMember", :foreign_key => [:relation_id, :version]
|
||||
has_many :old_tags, :class_name => "OldRelationTag", :foreign_key => [:relation_id, :version]
|
||||
|
||||
validates_associated :changeset
|
||||
|
||||
|
@ -73,16 +73,16 @@ class OldRelation < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def to_xml_node(changeset_cache = {}, user_display_name_cache = {})
|
||||
el = XML::Node.new 'relation'
|
||||
el['id'] = relation_id.to_s
|
||||
el = XML::Node.new "relation"
|
||||
el["id"] = relation_id.to_s
|
||||
|
||||
add_metadata_to_xml_node(el, self, changeset_cache, user_display_name_cache)
|
||||
|
||||
old_members.each do |member|
|
||||
member_el = XML::Node.new 'member'
|
||||
member_el['type'] = member.member_type.to_s.downcase
|
||||
member_el['ref'] = member.member_id.to_s # "id" is considered uncool here as it should be unique in XML
|
||||
member_el['role'] = member.member_role.to_s
|
||||
member_el = XML::Node.new "member"
|
||||
member_el["type"] = member.member_type.to_s.downcase
|
||||
member_el["ref"] = member.member_id.to_s # "id" is considered uncool here as it should be unique in XML
|
||||
member_el["role"] = member.member_role.to_s
|
||||
el << member_el
|
||||
end
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@ class OldWay < ActiveRecord::Base
|
|||
belongs_to :redaction
|
||||
belongs_to :current_way, :class_name => "Way", :foreign_key => "way_id"
|
||||
|
||||
has_many :old_nodes, :class_name => 'OldWayNode', :foreign_key => [:way_id, :version]
|
||||
has_many :old_tags, :class_name => 'OldWayTag', :foreign_key => [:way_id, :version]
|
||||
has_many :old_nodes, :class_name => "OldWayNode", :foreign_key => [:way_id, :version]
|
||||
has_many :old_tags, :class_name => "OldWayTag", :foreign_key => [:way_id, :version]
|
||||
|
||||
validates_associated :changeset
|
||||
|
||||
|
@ -65,14 +65,14 @@ class OldWay < ActiveRecord::Base
|
|||
attr_writer :tags
|
||||
|
||||
def to_xml_node(changeset_cache = {}, user_display_name_cache = {})
|
||||
el = XML::Node.new 'way'
|
||||
el['id'] = way_id.to_s
|
||||
el = XML::Node.new "way"
|
||||
el["id"] = way_id.to_s
|
||||
|
||||
add_metadata_to_xml_node(el, self, changeset_cache, user_display_name_cache)
|
||||
|
||||
old_nodes.each do |nd| # FIXME need to make sure they come back in the right order
|
||||
node_el = XML::Node.new 'nd'
|
||||
node_el['ref'] = nd.node_id.to_s
|
||||
node_el = XML::Node.new "nd"
|
||||
node_el["ref"] = nd.node_id.to_s
|
||||
el << node_el
|
||||
end
|
||||
|
||||
|
@ -98,7 +98,7 @@ class OldWay < ActiveRecord::Base
|
|||
def get_nodes_revert(timestamp)
|
||||
points = []
|
||||
nds.each do |n|
|
||||
oldnode = OldNode.where('node_id = ? AND timestamp <= ?', n, timestamp).unredacted.order("timestamp DESC").first
|
||||
oldnode = OldNode.where("node_id = ? AND timestamp <= ?", n, timestamp).unredacted.order("timestamp DESC").first
|
||||
curnode = Node.find(n)
|
||||
id = n
|
||||
reuse = curnode.visible
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class Relation < ActiveRecord::Base
|
||||
require 'xml/libxml'
|
||||
require "xml/libxml"
|
||||
|
||||
include ConsistencyValidations
|
||||
include NotRedactable
|
||||
|
@ -37,7 +37,7 @@ class Relation < ActiveRecord::Base
|
|||
p = XML::Parser.string(xml)
|
||||
doc = p.parse
|
||||
|
||||
doc.find('//osm/relation').each do |pt|
|
||||
doc.find("//osm/relation").each do |pt|
|
||||
return Relation.from_xml_node(pt, create)
|
||||
end
|
||||
fail OSM::APIBadXMLError.new("node", xml, "XML doesn't contain an osm/relation element.")
|
||||
|
@ -48,14 +48,14 @@ class Relation < ActiveRecord::Base
|
|||
def self.from_xml_node(pt, create = false)
|
||||
relation = Relation.new
|
||||
|
||||
fail OSM::APIBadXMLError.new("relation", pt, "Version is required when updating") unless create || !pt['version'].nil?
|
||||
relation.version = pt['version']
|
||||
fail OSM::APIBadXMLError.new("relation", pt, "Changeset id is missing") if pt['changeset'].nil?
|
||||
relation.changeset_id = pt['changeset']
|
||||
fail OSM::APIBadXMLError.new("relation", pt, "Version is required when updating") unless create || !pt["version"].nil?
|
||||
relation.version = pt["version"]
|
||||
fail OSM::APIBadXMLError.new("relation", pt, "Changeset id is missing") if pt["changeset"].nil?
|
||||
relation.changeset_id = pt["changeset"]
|
||||
|
||||
unless create
|
||||
fail OSM::APIBadXMLError.new("relation", pt, "ID is required when updating") if pt['id'].nil?
|
||||
relation.id = pt['id'].to_i
|
||||
fail OSM::APIBadXMLError.new("relation", pt, "ID is required when updating") if pt["id"].nil?
|
||||
relation.id = pt["id"].to_i
|
||||
# .to_i will return 0 if there is no number that can be parsed.
|
||||
# We want to make sure that there is no id with zero anyway
|
||||
fail OSM::APIBadUserInput.new("ID of relation cannot be zero when updating.") if relation.id == 0
|
||||
|
@ -70,10 +70,10 @@ class Relation < ActiveRecord::Base
|
|||
relation.tags = {}
|
||||
|
||||
# Add in any tags from the XML
|
||||
pt.find('tag').each do |tag|
|
||||
fail OSM::APIBadXMLError.new("relation", pt, "tag is missing key") if tag['k'].nil?
|
||||
fail OSM::APIBadXMLError.new("relation", pt, "tag is missing value") if tag['v'].nil?
|
||||
relation.add_tag_keyval(tag['k'], tag['v'])
|
||||
pt.find("tag").each do |tag|
|
||||
fail OSM::APIBadXMLError.new("relation", pt, "tag is missing key") if tag["k"].nil?
|
||||
fail OSM::APIBadXMLError.new("relation", pt, "tag is missing value") if tag["v"].nil?
|
||||
relation.add_tag_keyval(tag["k"], tag["v"])
|
||||
end
|
||||
|
||||
# need to initialise the relation members array explicitly, as if this
|
||||
|
@ -82,16 +82,16 @@ class Relation < ActiveRecord::Base
|
|||
# empty, as intended.
|
||||
relation.members = []
|
||||
|
||||
pt.find('member').each do |member|
|
||||
pt.find("member").each do |member|
|
||||
# member_type =
|
||||
logger.debug "each member"
|
||||
fail OSM::APIBadXMLError.new("relation", pt, "The #{member['type']} is not allowed only, #{TYPES.inspect} allowed") unless TYPES.include? member['type']
|
||||
fail OSM::APIBadXMLError.new("relation", pt, "The #{member['type']} is not allowed only, #{TYPES.inspect} allowed") unless TYPES.include? member["type"]
|
||||
logger.debug "after raise"
|
||||
# member_ref = member['ref']
|
||||
# member_role
|
||||
member['role'] ||= "" # Allow the upload to not include this, in which case we default to an empty string.
|
||||
logger.debug member['role']
|
||||
relation.add_member(member['type'].classify, member['ref'], member['role'])
|
||||
member["role"] ||= "" # Allow the upload to not include this, in which case we default to an empty string.
|
||||
logger.debug member["role"]
|
||||
relation.add_member(member["type"].classify, member["ref"], member["role"])
|
||||
end
|
||||
fail OSM::APIBadUserInput.new("Some bad xml in relation") if relation.nil?
|
||||
|
||||
|
@ -105,8 +105,8 @@ class Relation < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def to_xml_node(visible_members = nil, changeset_cache = {}, user_display_name_cache = {})
|
||||
el = XML::Node.new 'relation'
|
||||
el['id'] = id.to_s
|
||||
el = XML::Node.new "relation"
|
||||
el["id"] = id.to_s
|
||||
|
||||
add_metadata_to_xml_node(el, self, changeset_cache, user_display_name_cache)
|
||||
|
||||
|
@ -123,10 +123,10 @@ class Relation < ActiveRecord::Base
|
|||
|
||||
next unless p
|
||||
|
||||
member_el = XML::Node.new 'member'
|
||||
member_el['type'] = member.member_type.downcase
|
||||
member_el['ref'] = member.member_id.to_s
|
||||
member_el['role'] = member.member_role
|
||||
member_el = XML::Node.new "member"
|
||||
member_el["type"] = member.member_type.downcase
|
||||
member_el["ref"] = member.member_id.to_s
|
||||
member_el["role"] = member.member_role
|
||||
el << member_el
|
||||
end
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class RequestToken < OauthToken
|
|||
end
|
||||
|
||||
def oob?
|
||||
callback_url.nil? || callback_url.downcase == 'oob'
|
||||
callback_url.nil? || callback_url.downcase == "oob"
|
||||
end
|
||||
|
||||
def oauth10?
|
||||
|
|
|
@ -2,8 +2,8 @@ class Trace < ActiveRecord::Base
|
|||
self.table_name = "gpx_files"
|
||||
|
||||
belongs_to :user, :counter_cache => true
|
||||
has_many :tags, :class_name => 'Tracetag', :foreign_key => 'gpx_id', :dependent => :delete_all
|
||||
has_many :points, :class_name => 'Tracepoint', :foreign_key => 'gpx_id', :dependent => :delete_all
|
||||
has_many :tags, :class_name => "Tracetag", :foreign_key => "gpx_id", :dependent => :delete_all
|
||||
has_many :points, :class_name => "Tracepoint", :foreign_key => "gpx_id", :dependent => :delete_all
|
||||
|
||||
scope :visible, -> { where(:visible => true) }
|
||||
scope :visible_to, ->(u) { visible.where("visibility IN ('public', 'identifiable') OR user_id = ?", u) }
|
||||
|
@ -30,7 +30,7 @@ class Trace < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def tagstring=(s)
|
||||
if s.include? ','
|
||||
if s.include? ","
|
||||
self.tags = s.split(/\s*,\s*/).select { |tag| tag !~ /^\s*$/ }.collect {|tag|
|
||||
tt = Tracetag.new
|
||||
tt.tag = tag
|
||||
|
@ -151,22 +151,22 @@ class Trace < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def to_xml_node
|
||||
el1 = XML::Node.new 'gpx_file'
|
||||
el1['id'] = id.to_s
|
||||
el1['name'] = name.to_s
|
||||
el1['lat'] = latitude.to_s if inserted
|
||||
el1['lon'] = longitude.to_s if inserted
|
||||
el1['user'] = user.display_name
|
||||
el1['visibility'] = visibility
|
||||
el1['pending'] = (!inserted).to_s
|
||||
el1['timestamp'] = timestamp.xmlschema
|
||||
el1 = XML::Node.new "gpx_file"
|
||||
el1["id"] = id.to_s
|
||||
el1["name"] = name.to_s
|
||||
el1["lat"] = latitude.to_s if inserted
|
||||
el1["lon"] = longitude.to_s if inserted
|
||||
el1["user"] = user.display_name
|
||||
el1["visibility"] = visibility
|
||||
el1["pending"] = (!inserted).to_s
|
||||
el1["timestamp"] = timestamp.xmlschema
|
||||
|
||||
el2 = XML::Node.new 'description'
|
||||
el2 = XML::Node.new "description"
|
||||
el2 << description
|
||||
el1 << el2
|
||||
|
||||
tags.each do |tag|
|
||||
el2 = XML::Node.new('tag')
|
||||
el2 = XML::Node.new("tag")
|
||||
el2 << tag.tag
|
||||
el1 << el2
|
||||
end
|
||||
|
@ -179,7 +179,7 @@ class Trace < ActiveRecord::Base
|
|||
p = XML::Parser.string(xml)
|
||||
doc = p.parse
|
||||
|
||||
doc.find('//osm/gpx_file').each do |pt|
|
||||
doc.find("//osm/gpx_file").each do |pt|
|
||||
return Trace.from_xml_node(pt, create)
|
||||
end
|
||||
|
||||
|
@ -191,12 +191,12 @@ class Trace < ActiveRecord::Base
|
|||
def self.from_xml_node(pt, create = false)
|
||||
trace = Trace.new
|
||||
|
||||
fail OSM::APIBadXMLError.new("trace", pt, "visibility missing") if pt['visibility'].nil?
|
||||
trace.visibility = pt['visibility']
|
||||
fail OSM::APIBadXMLError.new("trace", pt, "visibility missing") if pt["visibility"].nil?
|
||||
trace.visibility = pt["visibility"]
|
||||
|
||||
unless create
|
||||
fail OSM::APIBadXMLError.new("trace", pt, "ID is required when updating.") if pt['id'].nil?
|
||||
trace.id = pt['id'].to_i
|
||||
fail OSM::APIBadXMLError.new("trace", pt, "ID is required when updating.") if pt["id"].nil?
|
||||
trace.id = pt["id"].to_i
|
||||
# .to_i will return 0 if there is no number that can be parsed.
|
||||
# We want to make sure that there is no id with zero anyway
|
||||
fail OSM::APIBadUserInput.new("ID of trace cannot be zero when updating.") if trace.id == 0
|
||||
|
@ -207,11 +207,11 @@ class Trace < ActiveRecord::Base
|
|||
# and set manually before the actual delete
|
||||
trace.visible = true
|
||||
|
||||
description = pt.find('description').first
|
||||
description = pt.find("description").first
|
||||
fail OSM::APIBadXMLError.new("trace", pt, "description missing") if description.nil?
|
||||
trace.description = description.content
|
||||
|
||||
pt.find('tag').each do |tag|
|
||||
pt.find("tag").each do |tag|
|
||||
trace.tags.build(:tag => tag.content)
|
||||
end
|
||||
|
||||
|
|
|
@ -9,12 +9,12 @@ class Tracepoint < ActiveRecord::Base
|
|||
validates_associated :trace
|
||||
validates_presence_of :timestamp
|
||||
|
||||
belongs_to :trace, :foreign_key => 'gpx_id'
|
||||
belongs_to :trace, :foreign_key => "gpx_id"
|
||||
|
||||
def to_xml_node(print_timestamp = false)
|
||||
el1 = XML::Node.new 'trkpt'
|
||||
el1['lat'] = lat.to_s
|
||||
el1['lon'] = lon.to_s
|
||||
el1 = XML::Node.new "trkpt"
|
||||
el1["lat"] = lat.to_s
|
||||
el1["lon"] = lon.to_s
|
||||
el1 << (XML::Node.new("time") << timestamp.xmlschema) if print_timestamp
|
||||
el1
|
||||
end
|
||||
|
|
|
@ -4,5 +4,5 @@ class Tracetag < ActiveRecord::Base
|
|||
validates_format_of :tag, :with => /\A[^\/;.,?]*\z/
|
||||
validates_length_of :tag, :within => 1..255
|
||||
|
||||
belongs_to :trace, :foreign_key => 'gpx_id'
|
||||
belongs_to :trace, :foreign_key => "gpx_id"
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class User < ActiveRecord::Base
|
||||
require 'xml/libxml'
|
||||
require "xml/libxml"
|
||||
|
||||
has_many :traces, -> { where(:visible => true) }
|
||||
has_many :diary_entries, -> { order(:created_at => :desc) }
|
||||
|
@ -13,7 +13,7 @@ class User < ActiveRecord::Base
|
|||
has_many :preferences, :class_name => "UserPreference"
|
||||
has_many :changesets, -> { order(:created_at => :desc) }
|
||||
has_many :changeset_comments, :foreign_key => :author_id
|
||||
has_and_belongs_to_many :changeset_subscriptions, :class_name => 'Changeset', :join_table => 'changesets_subscribers', :foreign_key => 'subscriber_id'
|
||||
has_and_belongs_to_many :changeset_subscriptions, :class_name => "Changeset", :join_table => "changesets_subscribers", :foreign_key => "subscriber_id"
|
||||
has_many :note_comments, :foreign_key => :author_id
|
||||
has_many :notes, :through => :note_comments
|
||||
|
||||
|
@ -100,14 +100,14 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def to_xml_node
|
||||
el1 = XML::Node.new 'user'
|
||||
el1['display_name'] = display_name.to_s
|
||||
el1['account_created'] = creation_time.xmlschema
|
||||
el1 = XML::Node.new "user"
|
||||
el1["display_name"] = display_name.to_s
|
||||
el1["account_created"] = creation_time.xmlschema
|
||||
if home_lat && home_lon
|
||||
home = XML::Node.new 'home'
|
||||
home['lat'] = home_lat.to_s
|
||||
home['lon'] = home_lon.to_s
|
||||
home['zoom'] = home_zoom.to_s
|
||||
home = XML::Node.new "home"
|
||||
home["lat"] = home_lat.to_s
|
||||
home["lon"] = home_lon.to_s
|
||||
home["zoom"] = home_zoom.to_s
|
||||
el1 << home
|
||||
end
|
||||
el1
|
||||
|
@ -167,13 +167,13 @@ class User < ActiveRecord::Base
|
|||
##
|
||||
# returns true if the user has the moderator role, false otherwise
|
||||
def moderator?
|
||||
has_role? 'moderator'
|
||||
has_role? "moderator"
|
||||
end
|
||||
|
||||
##
|
||||
# returns true if the user has the administrator role, false otherwise
|
||||
def administrator?
|
||||
has_role? 'administrator'
|
||||
has_role? "administrator"
|
||||
end
|
||||
|
||||
##
|
||||
|
|
|
@ -44,7 +44,7 @@ class UserBlock < ActiveRecord::Base
|
|||
# block. this should be caught and dealt with in the controller,
|
||||
# but i've also included it here just in case.
|
||||
def moderator_permissions
|
||||
errors.add(:base, I18n.t('user_block.model.non_moderator_update')) if creator_id_changed? && !creator.moderator?
|
||||
errors.add(:base, I18n.t('user_block.model.non_moderator_revoke')) unless revoker_id.nil? || revoker.moderator?
|
||||
errors.add(:base, I18n.t("user_block.model.non_moderator_update")) if creator_id_changed? && !creator.moderator?
|
||||
errors.add(:base, I18n.t("user_block.model.non_moderator_revoke")) unless revoker_id.nil? || revoker.moderator?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,9 +8,9 @@ class UserPreference < ActiveRecord::Base
|
|||
|
||||
# Turn this Node in to an XML Node without the <osm> wrapper.
|
||||
def to_xml_node
|
||||
el1 = XML::Node.new 'preference'
|
||||
el1['k'] = k
|
||||
el1['v'] = v
|
||||
el1 = XML::Node.new "preference"
|
||||
el1["k"] = k
|
||||
el1["v"] = v
|
||||
|
||||
el1
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class Way < ActiveRecord::Base
|
||||
require 'xml/libxml'
|
||||
require "xml/libxml"
|
||||
|
||||
include ConsistencyValidations
|
||||
include NotRedactable
|
||||
|
@ -35,7 +35,7 @@ class Way < ActiveRecord::Base
|
|||
p = XML::Parser.string(xml)
|
||||
doc = p.parse
|
||||
|
||||
doc.find('//osm/way').each do |pt|
|
||||
doc.find("//osm/way").each do |pt|
|
||||
return Way.from_xml_node(pt, create)
|
||||
end
|
||||
fail OSM::APIBadXMLError.new("node", xml, "XML doesn't contain an osm/way element.")
|
||||
|
@ -46,14 +46,14 @@ class Way < ActiveRecord::Base
|
|||
def self.from_xml_node(pt, create = false)
|
||||
way = Way.new
|
||||
|
||||
fail OSM::APIBadXMLError.new("way", pt, "Version is required when updating") unless create || !pt['version'].nil?
|
||||
way.version = pt['version']
|
||||
fail OSM::APIBadXMLError.new("way", pt, "Changeset id is missing") if pt['changeset'].nil?
|
||||
way.changeset_id = pt['changeset']
|
||||
fail OSM::APIBadXMLError.new("way", pt, "Version is required when updating") unless create || !pt["version"].nil?
|
||||
way.version = pt["version"]
|
||||
fail OSM::APIBadXMLError.new("way", pt, "Changeset id is missing") if pt["changeset"].nil?
|
||||
way.changeset_id = pt["changeset"]
|
||||
|
||||
unless create
|
||||
fail OSM::APIBadXMLError.new("way", pt, "ID is required when updating") if pt['id'].nil?
|
||||
way.id = pt['id'].to_i
|
||||
fail OSM::APIBadXMLError.new("way", pt, "ID is required when updating") if pt["id"].nil?
|
||||
way.id = pt["id"].to_i
|
||||
# .to_i will return 0 if there is no number that can be parsed.
|
||||
# We want to make sure that there is no id with zero anyway
|
||||
fail OSM::APIBadUserInput.new("ID of way cannot be zero when updating.") if way.id == 0
|
||||
|
@ -68,14 +68,14 @@ class Way < ActiveRecord::Base
|
|||
way.tags = {}
|
||||
|
||||
# Add in any tags from the XML
|
||||
pt.find('tag').each do |tag|
|
||||
fail OSM::APIBadXMLError.new("way", pt, "tag is missing key") if tag['k'].nil?
|
||||
fail OSM::APIBadXMLError.new("way", pt, "tag is missing value") if tag['v'].nil?
|
||||
way.add_tag_keyval(tag['k'], tag['v'])
|
||||
pt.find("tag").each do |tag|
|
||||
fail OSM::APIBadXMLError.new("way", pt, "tag is missing key") if tag["k"].nil?
|
||||
fail OSM::APIBadXMLError.new("way", pt, "tag is missing value") if tag["v"].nil?
|
||||
way.add_tag_keyval(tag["k"], tag["v"])
|
||||
end
|
||||
|
||||
pt.find('nd').each do |nd|
|
||||
way.add_nd_num(nd['ref'])
|
||||
pt.find("nd").each do |nd|
|
||||
way.add_nd_num(nd["ref"])
|
||||
end
|
||||
|
||||
way
|
||||
|
@ -99,8 +99,8 @@ class Way < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def to_xml_node(visible_nodes = nil, changeset_cache = {}, user_display_name_cache = {})
|
||||
el = XML::Node.new 'way'
|
||||
el['id'] = id.to_s
|
||||
el = XML::Node.new "way"
|
||||
el["id"] = id.to_s
|
||||
|
||||
add_metadata_to_xml_node(el, self, changeset_cache, user_display_name_cache)
|
||||
|
||||
|
@ -121,10 +121,10 @@ class Way < ActiveRecord::Base
|
|||
end
|
||||
|
||||
ordered_nodes.each do |nd_id|
|
||||
next unless nd_id && nd_id != '0'
|
||||
next unless nd_id && nd_id != "0"
|
||||
|
||||
node_el = XML::Node.new 'nd'
|
||||
node_el['ref'] = nd_id
|
||||
node_el = XML::Node.new "nd"
|
||||
node_el["ref"] = nd_id
|
||||
el << node_el
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require File.expand_path('../boot', __FILE__)
|
||||
require File.expand_path("../boot", __FILE__)
|
||||
|
||||
require File.expand_path('../preinitializer', __FILE__)
|
||||
require File.expand_path("../preinitializer", __FILE__)
|
||||
|
||||
if STATUS == :database_offline
|
||||
require "action_controller/railtie"
|
||||
|
@ -9,7 +9,7 @@ if STATUS == :database_offline
|
|||
require "sprockets/railtie"
|
||||
require "rails/test_unit/railtie"
|
||||
else
|
||||
require 'rails/all'
|
||||
require "rails/all"
|
||||
end
|
||||
|
||||
# Require the gems listed in Gemfile, including any gems
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
|
||||
|
||||
require 'bundler/setup' # Set up gems listed in the Gemfile.
|
||||
require "bundler/setup" # Set up gems listed in the Gemfile.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Load the Rails application.
|
||||
require File.expand_path('../application', __FILE__)
|
||||
require File.expand_path("../application", __FILE__)
|
||||
|
||||
# Initialize the Rails application.
|
||||
Rails.application.initialize!
|
||||
|
|
|
@ -22,7 +22,7 @@ OpenStreetMap::Application.configure do
|
|||
|
||||
# Disable serving static files from the `/public` folder by default since
|
||||
# Apache or NGINX already handles this.
|
||||
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
||||
config.serve_static_files = ENV["RAILS_SERVE_STATIC_FILES"].present?
|
||||
|
||||
# Compress JavaScripts and CSS.
|
||||
config.assets.js_compressor = :uglifier
|
||||
|
|
|
@ -14,7 +14,7 @@ OpenStreetMap::Application.configure do
|
|||
|
||||
# Configure static file server for tests with Cache-Control for performance.
|
||||
config.serve_static_files = true
|
||||
config.static_cache_control = 'public, max-age=3600'
|
||||
config.static_cache_control = "public, max-age=3600"
|
||||
|
||||
# Show full error reports and disable caching.
|
||||
config.consider_all_requests_local = true
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Configure ActionMailer SMTP settings
|
||||
ActionMailer::Base.smtp_settings = {
|
||||
:address => 'localhost',
|
||||
:address => "localhost",
|
||||
:port => 25,
|
||||
:domain => 'localhost',
|
||||
:domain => "localhost",
|
||||
:enable_starttls_auto => false
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Version of your assets, change this if you want to expire all your assets.
|
||||
Rails.application.config.assets.version = '1.0'
|
||||
Rails.application.config.assets.version = "1.0"
|
||||
|
||||
# Add additional assets to the asset load path
|
||||
# Rails.application.config.assets.paths << Emoji.images_path
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#++
|
||||
|
||||
require 'classic_pagination/pagination'
|
||||
require 'classic_pagination/pagination_helper'
|
||||
require "classic_pagination/pagination"
|
||||
require "classic_pagination/pagination_helper"
|
||||
|
||||
ActionController::Base.class_eval do
|
||||
include ActionController::Pagination
|
||||
|
|
|
@ -7,8 +7,8 @@ module OpenStreetMap
|
|||
class Cors < Rack::Cors
|
||||
def call(env)
|
||||
status, headers, body = super env
|
||||
if headers['Access-Control-Allow-Origin']
|
||||
headers['Cache-Control'] = 'no-cache'
|
||||
if headers["Access-Control-Allow-Origin"]
|
||||
headers["Cache-Control"] = "no-cache"
|
||||
end
|
||||
[status, headers, body]
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@ ActionView::Base.field_error_proc = proc do |html_tag, _instance|
|
|||
class_attr_index = html_tag.index 'class="'
|
||||
|
||||
if class_attr_index
|
||||
html_tag.insert class_attr_index + 7, 'field_with_errors '
|
||||
html_tag.insert class_attr_index + 7, "field_with_errors "
|
||||
else
|
||||
html_tag.insert html_tag.index(/\/?>/), ' class="field_with_errors"'
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Konacha.configure do |config|
|
||||
require 'capybara/poltergeist'
|
||||
require "capybara/poltergeist"
|
||||
config.spec_dir = "test/javascripts"
|
||||
config.driver = :poltergeist
|
||||
end if defined?(Konacha)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'oauth/rack/oauth_filter'
|
||||
require "oauth/rack/oauth_filter"
|
||||
|
||||
Rails.configuration.middleware.use OAuth::Rack::OAuthFilter
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
require 'output_compression/output_compression'
|
||||
require "output_compression/output_compression"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class R2Template < Tilt::Template
|
||||
self.default_mime_type = 'text/css'
|
||||
self.default_mime_type = "text/css"
|
||||
|
||||
def self.engine_initialized?
|
||||
defined? ::R2
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Sanitize::Config::OSM = Sanitize::Config::RELAXED.dup
|
||||
|
||||
Sanitize::Config::OSM[:elements] -= %w(div style)
|
||||
Sanitize::Config::OSM[:add_attributes] = { 'a' => { 'rel' => 'nofollow' } }
|
||||
Sanitize::Config::OSM[:add_attributes] = { "a" => { "rel" => "nofollow" } }
|
||||
Sanitize::Config::OSM[:remove_contents] = %w(script style)
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
if defined?(MEMCACHE_SERVERS)
|
||||
Rails.application.config.session_store :mem_cache_store, :memcache_server => MEMCACHE_SERVERS, :namespace => "rails:session", :key => "_osm_session"
|
||||
else
|
||||
Rails.application.config.session_store :cache_store, :key => '_osm_session'
|
||||
Rails.application.config.session_store :cache_store, :key => "_osm_session"
|
||||
end
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
require 'yaml'
|
||||
require "yaml"
|
||||
|
||||
if defined?(Rake.application) && Rake.application.top_level_tasks.grep(/^(default$|test(:|$))/).any?
|
||||
env = "test"
|
||||
else
|
||||
env = ENV['RAILS_ENV'] || 'development'
|
||||
env = ENV["RAILS_ENV"] || "development"
|
||||
end
|
||||
|
||||
config = YAML.load_file(File.expand_path(env == "test" ? "../example.application.yml" : "../application.yml", __FILE__))
|
||||
|
|
446
config/routes.rb
446
config/routes.rb
|
@ -1,287 +1,287 @@
|
|||
OpenStreetMap::Application.routes.draw do
|
||||
# API
|
||||
match 'api/capabilities' => 'api#capabilities', :via => :get
|
||||
match 'api/0.6/capabilities' => 'api#capabilities', :via => :get
|
||||
match 'api/0.6/permissions' => 'api#permissions', :via => :get
|
||||
match "api/capabilities" => "api#capabilities", :via => :get
|
||||
match "api/0.6/capabilities" => "api#capabilities", :via => :get
|
||||
match "api/0.6/permissions" => "api#permissions", :via => :get
|
||||
|
||||
match 'api/0.6/changeset/create' => 'changeset#create', :via => :put
|
||||
match 'api/0.6/changeset/:id/upload' => 'changeset#upload', :via => :post, :id => /\d+/
|
||||
match 'api/0.6/changeset/:id/download' => 'changeset#download', :via => :get, :as => :changeset_download, :id => /\d+/
|
||||
match 'api/0.6/changeset/:id/expand_bbox' => 'changeset#expand_bbox', :via => :post, :id => /\d+/
|
||||
match 'api/0.6/changeset/:id' => 'changeset#read', :via => :get, :as => :changeset_read, :id => /\d+/
|
||||
match 'api/0.6/changeset/:id/subscribe' => 'changeset#subscribe', :via => :post, :as => :changeset_subscribe, :id => /\d+/
|
||||
match 'api/0.6/changeset/:id/unsubscribe' => 'changeset#unsubscribe', :via => :post, :as => :changeset_unsubscribe, :id => /\d+/
|
||||
match 'api/0.6/changeset/:id' => 'changeset#update', :via => :put, :id => /\d+/
|
||||
match 'api/0.6/changeset/:id/close' => 'changeset#close', :via => :put, :id => /\d+/
|
||||
match 'api/0.6/changesets' => 'changeset#query', :via => :get
|
||||
post 'api/0.6/changeset/:id/comment' => 'changeset#comment', :as => :changeset_comment, :id => /\d+/
|
||||
post 'api/0.6/changeset/comment/:id/hide' => 'changeset#hide_comment', :as => :changeset_comment_hide, :id => /\d+/
|
||||
post 'api/0.6/changeset/comment/:id/unhide' => 'changeset#unhide_comment', :as => :changeset_comment_unhide, :id => /\d+/
|
||||
match "api/0.6/changeset/create" => "changeset#create", :via => :put
|
||||
match "api/0.6/changeset/:id/upload" => "changeset#upload", :via => :post, :id => /\d+/
|
||||
match "api/0.6/changeset/:id/download" => "changeset#download", :via => :get, :as => :changeset_download, :id => /\d+/
|
||||
match "api/0.6/changeset/:id/expand_bbox" => "changeset#expand_bbox", :via => :post, :id => /\d+/
|
||||
match "api/0.6/changeset/:id" => "changeset#read", :via => :get, :as => :changeset_read, :id => /\d+/
|
||||
match "api/0.6/changeset/:id/subscribe" => "changeset#subscribe", :via => :post, :as => :changeset_subscribe, :id => /\d+/
|
||||
match "api/0.6/changeset/:id/unsubscribe" => "changeset#unsubscribe", :via => :post, :as => :changeset_unsubscribe, :id => /\d+/
|
||||
match "api/0.6/changeset/:id" => "changeset#update", :via => :put, :id => /\d+/
|
||||
match "api/0.6/changeset/:id/close" => "changeset#close", :via => :put, :id => /\d+/
|
||||
match "api/0.6/changesets" => "changeset#query", :via => :get
|
||||
post "api/0.6/changeset/:id/comment" => "changeset#comment", :as => :changeset_comment, :id => /\d+/
|
||||
post "api/0.6/changeset/comment/:id/hide" => "changeset#hide_comment", :as => :changeset_comment_hide, :id => /\d+/
|
||||
post "api/0.6/changeset/comment/:id/unhide" => "changeset#unhide_comment", :as => :changeset_comment_unhide, :id => /\d+/
|
||||
|
||||
match 'api/0.6/node/create' => 'node#create', :via => :put
|
||||
match 'api/0.6/node/:id/ways' => 'way#ways_for_node', :via => :get, :id => /\d+/
|
||||
match 'api/0.6/node/:id/relations' => 'relation#relations_for_node', :via => :get, :id => /\d+/
|
||||
match 'api/0.6/node/:id/history' => 'old_node#history', :via => :get, :id => /\d+/
|
||||
match 'api/0.6/node/:id/:version/redact' => 'old_node#redact', :via => :post, :version => /\d+/, :id => /\d+/
|
||||
match 'api/0.6/node/:id/:version' => 'old_node#version', :via => :get, :id => /\d+/, :version => /\d+/
|
||||
match 'api/0.6/node/:id' => 'node#read', :via => :get, :id => /\d+/
|
||||
match 'api/0.6/node/:id' => 'node#update', :via => :put, :id => /\d+/
|
||||
match 'api/0.6/node/:id' => 'node#delete', :via => :delete, :id => /\d+/
|
||||
match 'api/0.6/nodes' => 'node#nodes', :via => :get
|
||||
match "api/0.6/node/create" => "node#create", :via => :put
|
||||
match "api/0.6/node/:id/ways" => "way#ways_for_node", :via => :get, :id => /\d+/
|
||||
match "api/0.6/node/:id/relations" => "relation#relations_for_node", :via => :get, :id => /\d+/
|
||||
match "api/0.6/node/:id/history" => "old_node#history", :via => :get, :id => /\d+/
|
||||
match "api/0.6/node/:id/:version/redact" => "old_node#redact", :via => :post, :version => /\d+/, :id => /\d+/
|
||||
match "api/0.6/node/:id/:version" => "old_node#version", :via => :get, :id => /\d+/, :version => /\d+/
|
||||
match "api/0.6/node/:id" => "node#read", :via => :get, :id => /\d+/
|
||||
match "api/0.6/node/:id" => "node#update", :via => :put, :id => /\d+/
|
||||
match "api/0.6/node/:id" => "node#delete", :via => :delete, :id => /\d+/
|
||||
match "api/0.6/nodes" => "node#nodes", :via => :get
|
||||
|
||||
match 'api/0.6/way/create' => 'way#create', :via => :put
|
||||
match 'api/0.6/way/:id/history' => 'old_way#history', :via => :get, :id => /\d+/
|
||||
match 'api/0.6/way/:id/full' => 'way#full', :via => :get, :id => /\d+/
|
||||
match 'api/0.6/way/:id/relations' => 'relation#relations_for_way', :via => :get, :id => /\d+/
|
||||
match 'api/0.6/way/:id/:version/redact' => 'old_way#redact', :via => :post, :version => /\d+/, :id => /\d+/
|
||||
match 'api/0.6/way/:id/:version' => 'old_way#version', :via => :get, :id => /\d+/, :version => /\d+/
|
||||
match 'api/0.6/way/:id' => 'way#read', :via => :get, :id => /\d+/
|
||||
match 'api/0.6/way/:id' => 'way#update', :via => :put, :id => /\d+/
|
||||
match 'api/0.6/way/:id' => 'way#delete', :via => :delete, :id => /\d+/
|
||||
match 'api/0.6/ways' => 'way#ways', :via => :get
|
||||
match "api/0.6/way/create" => "way#create", :via => :put
|
||||
match "api/0.6/way/:id/history" => "old_way#history", :via => :get, :id => /\d+/
|
||||
match "api/0.6/way/:id/full" => "way#full", :via => :get, :id => /\d+/
|
||||
match "api/0.6/way/:id/relations" => "relation#relations_for_way", :via => :get, :id => /\d+/
|
||||
match "api/0.6/way/:id/:version/redact" => "old_way#redact", :via => :post, :version => /\d+/, :id => /\d+/
|
||||
match "api/0.6/way/:id/:version" => "old_way#version", :via => :get, :id => /\d+/, :version => /\d+/
|
||||
match "api/0.6/way/:id" => "way#read", :via => :get, :id => /\d+/
|
||||
match "api/0.6/way/:id" => "way#update", :via => :put, :id => /\d+/
|
||||
match "api/0.6/way/:id" => "way#delete", :via => :delete, :id => /\d+/
|
||||
match "api/0.6/ways" => "way#ways", :via => :get
|
||||
|
||||
match 'api/0.6/relation/create' => 'relation#create', :via => :put
|
||||
match 'api/0.6/relation/:id/relations' => 'relation#relations_for_relation', :via => :get, :id => /\d+/
|
||||
match 'api/0.6/relation/:id/history' => 'old_relation#history', :via => :get, :id => /\d+/
|
||||
match 'api/0.6/relation/:id/full' => 'relation#full', :via => :get, :id => /\d+/
|
||||
match 'api/0.6/relation/:id/:version/redact' => 'old_relation#redact', :via => :post, :version => /\d+/, :id => /\d+/
|
||||
match 'api/0.6/relation/:id/:version' => 'old_relation#version', :via => :get, :id => /\d+/, :version => /\d+/
|
||||
match 'api/0.6/relation/:id' => 'relation#read', :via => :get, :id => /\d+/
|
||||
match 'api/0.6/relation/:id' => 'relation#update', :via => :put, :id => /\d+/
|
||||
match 'api/0.6/relation/:id' => 'relation#delete', :via => :delete, :id => /\d+/
|
||||
match 'api/0.6/relations' => 'relation#relations', :via => :get
|
||||
match "api/0.6/relation/create" => "relation#create", :via => :put
|
||||
match "api/0.6/relation/:id/relations" => "relation#relations_for_relation", :via => :get, :id => /\d+/
|
||||
match "api/0.6/relation/:id/history" => "old_relation#history", :via => :get, :id => /\d+/
|
||||
match "api/0.6/relation/:id/full" => "relation#full", :via => :get, :id => /\d+/
|
||||
match "api/0.6/relation/:id/:version/redact" => "old_relation#redact", :via => :post, :version => /\d+/, :id => /\d+/
|
||||
match "api/0.6/relation/:id/:version" => "old_relation#version", :via => :get, :id => /\d+/, :version => /\d+/
|
||||
match "api/0.6/relation/:id" => "relation#read", :via => :get, :id => /\d+/
|
||||
match "api/0.6/relation/:id" => "relation#update", :via => :put, :id => /\d+/
|
||||
match "api/0.6/relation/:id" => "relation#delete", :via => :delete, :id => /\d+/
|
||||
match "api/0.6/relations" => "relation#relations", :via => :get
|
||||
|
||||
match 'api/0.6/map' => 'api#map', :via => :get
|
||||
match "api/0.6/map" => "api#map", :via => :get
|
||||
|
||||
match 'api/0.6/trackpoints' => 'api#trackpoints', :via => :get
|
||||
match "api/0.6/trackpoints" => "api#trackpoints", :via => :get
|
||||
|
||||
match 'api/0.6/changes' => 'api#changes', :via => :get
|
||||
match "api/0.6/changes" => "api#changes", :via => :get
|
||||
|
||||
match 'api/0.6/search' => 'search#search_all', :via => :get
|
||||
match 'api/0.6/ways/search' => 'search#search_ways', :via => :get
|
||||
match 'api/0.6/relations/search' => 'search#search_relations', :via => :get
|
||||
match 'api/0.6/nodes/search' => 'search#search_nodes', :via => :get
|
||||
match "api/0.6/search" => "search#search_all", :via => :get
|
||||
match "api/0.6/ways/search" => "search#search_ways", :via => :get
|
||||
match "api/0.6/relations/search" => "search#search_relations", :via => :get
|
||||
match "api/0.6/nodes/search" => "search#search_nodes", :via => :get
|
||||
|
||||
match 'api/0.6/user/:id' => 'user#api_read', :via => :get, :id => /\d+/
|
||||
match 'api/0.6/user/details' => 'user#api_details', :via => :get
|
||||
match 'api/0.6/user/gpx_files' => 'user#api_gpx_files', :via => :get
|
||||
match "api/0.6/user/:id" => "user#api_read", :via => :get, :id => /\d+/
|
||||
match "api/0.6/user/details" => "user#api_details", :via => :get
|
||||
match "api/0.6/user/gpx_files" => "user#api_gpx_files", :via => :get
|
||||
|
||||
match 'api/0.6/user/preferences' => 'user_preference#read', :via => :get
|
||||
match 'api/0.6/user/preferences/:preference_key' => 'user_preference#read_one', :via => :get
|
||||
match 'api/0.6/user/preferences' => 'user_preference#update', :via => :put
|
||||
match 'api/0.6/user/preferences/:preference_key' => 'user_preference#update_one', :via => :put
|
||||
match 'api/0.6/user/preferences/:preference_key' => 'user_preference#delete_one', :via => :delete
|
||||
match "api/0.6/user/preferences" => "user_preference#read", :via => :get
|
||||
match "api/0.6/user/preferences/:preference_key" => "user_preference#read_one", :via => :get
|
||||
match "api/0.6/user/preferences" => "user_preference#update", :via => :put
|
||||
match "api/0.6/user/preferences/:preference_key" => "user_preference#update_one", :via => :put
|
||||
match "api/0.6/user/preferences/:preference_key" => "user_preference#delete_one", :via => :delete
|
||||
|
||||
match 'api/0.6/gpx/create' => 'trace#api_create', :via => :post
|
||||
match 'api/0.6/gpx/:id' => 'trace#api_read', :via => :get, :id => /\d+/
|
||||
match 'api/0.6/gpx/:id' => 'trace#api_update', :via => :put, :id => /\d+/
|
||||
match 'api/0.6/gpx/:id' => 'trace#api_delete', :via => :delete, :id => /\d+/
|
||||
match 'api/0.6/gpx/:id/details' => 'trace#api_read', :via => :get, :id => /\d+/
|
||||
match 'api/0.6/gpx/:id/data' => 'trace#api_data', :via => :get
|
||||
match "api/0.6/gpx/create" => "trace#api_create", :via => :post
|
||||
match "api/0.6/gpx/:id" => "trace#api_read", :via => :get, :id => /\d+/
|
||||
match "api/0.6/gpx/:id" => "trace#api_update", :via => :put, :id => /\d+/
|
||||
match "api/0.6/gpx/:id" => "trace#api_delete", :via => :delete, :id => /\d+/
|
||||
match "api/0.6/gpx/:id/details" => "trace#api_read", :via => :get, :id => /\d+/
|
||||
match "api/0.6/gpx/:id/data" => "trace#api_data", :via => :get
|
||||
|
||||
# AMF (ActionScript) API
|
||||
match 'api/0.6/amf/read' => 'amf#amf_read', :via => :post
|
||||
match 'api/0.6/amf/write' => 'amf#amf_write', :via => :post
|
||||
match 'api/0.6/swf/trackpoints' => 'swf#trackpoints', :via => :get
|
||||
match "api/0.6/amf/read" => "amf#amf_read", :via => :post
|
||||
match "api/0.6/amf/write" => "amf#amf_write", :via => :post
|
||||
match "api/0.6/swf/trackpoints" => "swf#trackpoints", :via => :get
|
||||
|
||||
# Map notes API
|
||||
scope "api/0.6" do
|
||||
resources :notes, :except => [:new, :edit, :update], :constraints => { :id => /\d+/ }, :defaults => { :format => "xml" } do
|
||||
collection do
|
||||
get 'search'
|
||||
get 'feed', :defaults => { :format => "rss" }
|
||||
get "search"
|
||||
get "feed", :defaults => { :format => "rss" }
|
||||
end
|
||||
|
||||
member do
|
||||
post 'comment'
|
||||
post 'close'
|
||||
post 'reopen'
|
||||
post "comment"
|
||||
post "close"
|
||||
post "reopen"
|
||||
end
|
||||
end
|
||||
|
||||
match 'notes/addPOIexec' => 'notes#create', :via => :post
|
||||
match 'notes/closePOIexec' => 'notes#close', :via => :post
|
||||
match 'notes/editPOIexec' => 'notes#comment', :via => :post
|
||||
match 'notes/getGPX' => 'notes#index', :via => :get, :format => "gpx"
|
||||
match 'notes/getRSSfeed' => 'notes#feed', :via => :get, :format => "rss"
|
||||
match "notes/addPOIexec" => "notes#create", :via => :post
|
||||
match "notes/closePOIexec" => "notes#close", :via => :post
|
||||
match "notes/editPOIexec" => "notes#comment", :via => :post
|
||||
match "notes/getGPX" => "notes#index", :via => :get, :format => "gpx"
|
||||
match "notes/getRSSfeed" => "notes#feed", :via => :get, :format => "rss"
|
||||
end
|
||||
|
||||
# Data browsing
|
||||
match '/way/:id' => 'browse#way', :via => :get, :id => /\d+/, :as => :way
|
||||
match '/way/:id/history' => 'browse#way_history', :via => :get, :id => /\d+/
|
||||
match '/node/:id' => 'browse#node', :via => :get, :id => /\d+/, :as => :node
|
||||
match '/node/:id/history' => 'browse#node_history', :via => :get, :id => /\d+/
|
||||
match '/relation/:id' => 'browse#relation', :via => :get, :id => /\d+/, :as => :relation
|
||||
match '/relation/:id/history' => 'browse#relation_history', :via => :get, :id => /\d+/
|
||||
match '/changeset/:id' => 'browse#changeset', :via => :get, :as => :changeset, :id => /\d+/
|
||||
match '/changeset/:id/comments/feed' => 'changeset#comments_feed', :via => :get, :as => :changeset_comments_feed, :id => /\d*/, :defaults => { :format => 'rss' }
|
||||
match '/note/:id' => 'browse#note', :via => :get, :id => /\d+/, :as => "browse_note"
|
||||
match '/note/new' => 'browse#new_note', :via => :get
|
||||
match '/user/:display_name/history' => 'changeset#list', :via => :get
|
||||
match '/user/:display_name/history/feed' => 'changeset#feed', :via => :get, :defaults => { :format => :atom }
|
||||
match '/user/:display_name/notes' => 'notes#mine', :via => :get
|
||||
match '/history/friends' => 'changeset#list', :via => :get, :friends => true, :as => "friend_changesets"
|
||||
match '/history/nearby' => 'changeset#list', :via => :get, :nearby => true, :as => "nearby_changesets"
|
||||
match "/way/:id" => "browse#way", :via => :get, :id => /\d+/, :as => :way
|
||||
match "/way/:id/history" => "browse#way_history", :via => :get, :id => /\d+/
|
||||
match "/node/:id" => "browse#node", :via => :get, :id => /\d+/, :as => :node
|
||||
match "/node/:id/history" => "browse#node_history", :via => :get, :id => /\d+/
|
||||
match "/relation/:id" => "browse#relation", :via => :get, :id => /\d+/, :as => :relation
|
||||
match "/relation/:id/history" => "browse#relation_history", :via => :get, :id => /\d+/
|
||||
match "/changeset/:id" => "browse#changeset", :via => :get, :as => :changeset, :id => /\d+/
|
||||
match "/changeset/:id/comments/feed" => "changeset#comments_feed", :via => :get, :as => :changeset_comments_feed, :id => /\d*/, :defaults => { :format => "rss" }
|
||||
match "/note/:id" => "browse#note", :via => :get, :id => /\d+/, :as => "browse_note"
|
||||
match "/note/new" => "browse#new_note", :via => :get
|
||||
match "/user/:display_name/history" => "changeset#list", :via => :get
|
||||
match "/user/:display_name/history/feed" => "changeset#feed", :via => :get, :defaults => { :format => :atom }
|
||||
match "/user/:display_name/notes" => "notes#mine", :via => :get
|
||||
match "/history/friends" => "changeset#list", :via => :get, :friends => true, :as => "friend_changesets"
|
||||
match "/history/nearby" => "changeset#list", :via => :get, :nearby => true, :as => "nearby_changesets"
|
||||
|
||||
get '/browse/way/:id', :to => redirect(:path => '/way/%{id}')
|
||||
get '/browse/way/:id/history', :to => redirect(:path => '/way/%{id}/history')
|
||||
get '/browse/node/:id', :to => redirect(:path => '/node/%{id}')
|
||||
get '/browse/node/:id/history', :to => redirect(:path => '/node/%{id}/history')
|
||||
get '/browse/relation/:id', :to => redirect(:path => '/relation/%{id}')
|
||||
get '/browse/relation/:id/history', :to => redirect(:path => '/relation/%{id}/history')
|
||||
get '/browse/changeset/:id', :to => redirect(:path => '/changeset/%{id}')
|
||||
get '/browse/note/:id', :to => redirect(:path => '/note/%{id}')
|
||||
get '/user/:display_name/edits', :to => redirect(:path => '/user/%{display_name}/history')
|
||||
get '/user/:display_name/edits/feed', :to => redirect(:path => '/user/%{display_name}/history/feed')
|
||||
get '/browse/friends', :to => redirect(:path => '/history/friends')
|
||||
get '/browse/nearby', :to => redirect(:path => '/history/nearby')
|
||||
get '/browse/changesets/feed', :to => redirect(:path => '/history/feed')
|
||||
get '/browse/changesets', :to => redirect(:path => '/history')
|
||||
get '/browse', :to => redirect(:path => '/history')
|
||||
get "/browse/way/:id", :to => redirect(:path => "/way/%{id}")
|
||||
get "/browse/way/:id/history", :to => redirect(:path => "/way/%{id}/history")
|
||||
get "/browse/node/:id", :to => redirect(:path => "/node/%{id}")
|
||||
get "/browse/node/:id/history", :to => redirect(:path => "/node/%{id}/history")
|
||||
get "/browse/relation/:id", :to => redirect(:path => "/relation/%{id}")
|
||||
get "/browse/relation/:id/history", :to => redirect(:path => "/relation/%{id}/history")
|
||||
get "/browse/changeset/:id", :to => redirect(:path => "/changeset/%{id}")
|
||||
get "/browse/note/:id", :to => redirect(:path => "/note/%{id}")
|
||||
get "/user/:display_name/edits", :to => redirect(:path => "/user/%{display_name}/history")
|
||||
get "/user/:display_name/edits/feed", :to => redirect(:path => "/user/%{display_name}/history/feed")
|
||||
get "/browse/friends", :to => redirect(:path => "/history/friends")
|
||||
get "/browse/nearby", :to => redirect(:path => "/history/nearby")
|
||||
get "/browse/changesets/feed", :to => redirect(:path => "/history/feed")
|
||||
get "/browse/changesets", :to => redirect(:path => "/history")
|
||||
get "/browse", :to => redirect(:path => "/history")
|
||||
|
||||
# web site
|
||||
root :to => 'site#index', :via => [:get, :post]
|
||||
match '/edit' => 'site#edit', :via => :get, :as => :edit
|
||||
match '/copyright/:copyright_locale' => 'site#copyright', :via => :get
|
||||
match '/copyright' => 'site#copyright', :via => :get
|
||||
match '/welcome' => 'site#welcome', :via => :get, :as => :welcome
|
||||
match '/fixthemap' => 'site#fixthemap', :via => :get, :as => :fixthemap
|
||||
match '/help' => 'site#help', :via => :get, :as => :help
|
||||
match '/about' => 'site#about', :via => :get, :as => :about
|
||||
match '/history' => 'changeset#list', :via => :get
|
||||
match '/history/feed' => 'changeset#feed', :via => :get, :defaults => { :format => :atom }
|
||||
match '/history/comments/feed' => 'changeset#comments_feed', :via => :get, :as => :changesets_comments_feed, :defaults => { :format => 'rss' }
|
||||
match '/export' => 'site#export', :via => :get
|
||||
match '/login' => 'user#login', :via => [:get, :post]
|
||||
match '/logout' => 'user#logout', :via => [:get, :post]
|
||||
match '/offline' => 'site#offline', :via => :get
|
||||
match '/key' => 'site#key', :via => :get
|
||||
match '/id' => 'site#id', :via => :get
|
||||
match '/query' => 'browse#query', :via => :get
|
||||
match '/user/new' => 'user#new', :via => :get
|
||||
match '/user/new' => 'user#create', :via => :post
|
||||
match '/user/terms' => 'user#terms', :via => :get
|
||||
match '/user/save' => 'user#save', :via => :post
|
||||
match '/user/:display_name/confirm/resend' => 'user#confirm_resend', :via => :get
|
||||
match '/user/:display_name/confirm' => 'user#confirm', :via => [:get, :post]
|
||||
match '/user/confirm' => 'user#confirm', :via => [:get, :post]
|
||||
match '/user/confirm-email' => 'user#confirm_email', :via => [:get, :post]
|
||||
match '/user/go_public' => 'user#go_public', :via => :post
|
||||
match '/user/reset-password' => 'user#reset_password', :via => [:get, :post]
|
||||
match '/user/forgot-password' => 'user#lost_password', :via => [:get, :post]
|
||||
match '/user/suspended' => 'user#suspended', :via => :get
|
||||
root :to => "site#index", :via => [:get, :post]
|
||||
match "/edit" => "site#edit", :via => :get, :as => :edit
|
||||
match "/copyright/:copyright_locale" => "site#copyright", :via => :get
|
||||
match "/copyright" => "site#copyright", :via => :get
|
||||
match "/welcome" => "site#welcome", :via => :get, :as => :welcome
|
||||
match "/fixthemap" => "site#fixthemap", :via => :get, :as => :fixthemap
|
||||
match "/help" => "site#help", :via => :get, :as => :help
|
||||
match "/about" => "site#about", :via => :get, :as => :about
|
||||
match "/history" => "changeset#list", :via => :get
|
||||
match "/history/feed" => "changeset#feed", :via => :get, :defaults => { :format => :atom }
|
||||
match "/history/comments/feed" => "changeset#comments_feed", :via => :get, :as => :changesets_comments_feed, :defaults => { :format => "rss" }
|
||||
match "/export" => "site#export", :via => :get
|
||||
match "/login" => "user#login", :via => [:get, :post]
|
||||
match "/logout" => "user#logout", :via => [:get, :post]
|
||||
match "/offline" => "site#offline", :via => :get
|
||||
match "/key" => "site#key", :via => :get
|
||||
match "/id" => "site#id", :via => :get
|
||||
match "/query" => "browse#query", :via => :get
|
||||
match "/user/new" => "user#new", :via => :get
|
||||
match "/user/new" => "user#create", :via => :post
|
||||
match "/user/terms" => "user#terms", :via => :get
|
||||
match "/user/save" => "user#save", :via => :post
|
||||
match "/user/:display_name/confirm/resend" => "user#confirm_resend", :via => :get
|
||||
match "/user/:display_name/confirm" => "user#confirm", :via => [:get, :post]
|
||||
match "/user/confirm" => "user#confirm", :via => [:get, :post]
|
||||
match "/user/confirm-email" => "user#confirm_email", :via => [:get, :post]
|
||||
match "/user/go_public" => "user#go_public", :via => :post
|
||||
match "/user/reset-password" => "user#reset_password", :via => [:get, :post]
|
||||
match "/user/forgot-password" => "user#lost_password", :via => [:get, :post]
|
||||
match "/user/suspended" => "user#suspended", :via => :get
|
||||
|
||||
get '/index.html', :to => redirect(:path => "/")
|
||||
get '/create-account.html', :to => redirect(:path => "/user/new")
|
||||
get '/forgot-password.html', :to => redirect(:path => "/user/forgot-password")
|
||||
get "/index.html", :to => redirect(:path => "/")
|
||||
get "/create-account.html", :to => redirect(:path => "/user/new")
|
||||
get "/forgot-password.html", :to => redirect(:path => "/user/forgot-password")
|
||||
|
||||
# permalink
|
||||
match '/go/:code' => 'site#permalink', :via => :get, :code => /[a-zA-Z0-9_@~]+[=-]*/
|
||||
match "/go/:code" => "site#permalink", :via => :get, :code => /[a-zA-Z0-9_@~]+[=-]*/
|
||||
|
||||
# rich text preview
|
||||
match '/preview/:format' => 'site#preview', :via => :post, :as => :preview
|
||||
match "/preview/:format" => "site#preview", :via => :post, :as => :preview
|
||||
|
||||
# traces
|
||||
match '/user/:display_name/traces/tag/:tag/page/:page' => 'trace#list', :via => :get
|
||||
match '/user/:display_name/traces/tag/:tag' => 'trace#list', :via => :get
|
||||
match '/user/:display_name/traces/page/:page' => 'trace#list', :via => :get
|
||||
match '/user/:display_name/traces' => 'trace#list', :via => :get
|
||||
match '/user/:display_name/traces/tag/:tag/rss' => 'trace#georss', :via => :get, :defaults => { :format => :rss }
|
||||
match '/user/:display_name/traces/rss' => 'trace#georss', :via => :get, :defaults => { :format => :rss }
|
||||
match '/user/:display_name/traces/:id' => 'trace#view', :via => :get
|
||||
match '/user/:display_name/traces/:id/picture' => 'trace#picture', :via => :get
|
||||
match '/user/:display_name/traces/:id/icon' => 'trace#icon', :via => :get
|
||||
match '/traces/tag/:tag/page/:page' => 'trace#list', :via => :get
|
||||
match '/traces/tag/:tag' => 'trace#list', :via => :get
|
||||
match '/traces/page/:page' => 'trace#list', :via => :get
|
||||
match '/traces' => 'trace#list', :via => :get
|
||||
match '/traces/tag/:tag/rss' => 'trace#georss', :via => :get, :defaults => { :format => :rss }
|
||||
match '/traces/rss' => 'trace#georss', :via => :get, :defaults => { :format => :rss }
|
||||
match '/traces/mine/tag/:tag/page/:page' => 'trace#mine', :via => :get
|
||||
match '/traces/mine/tag/:tag' => 'trace#mine', :via => :get
|
||||
match '/traces/mine/page/:page' => 'trace#mine', :via => :get
|
||||
match '/traces/mine' => 'trace#mine', :via => :get
|
||||
match '/trace/create' => 'trace#create', :via => [:get, :post]
|
||||
match '/trace/:id/data' => 'trace#data', :via => :get, :id => /\d+/, :as => "trace_data"
|
||||
match '/trace/:id/edit' => 'trace#edit', :via => [:get, :post, :patch], :id => /\d+/, :as => "trace_edit"
|
||||
match '/trace/:id/delete' => 'trace#delete', :via => :post, :id => /\d+/
|
||||
match "/user/:display_name/traces/tag/:tag/page/:page" => "trace#list", :via => :get
|
||||
match "/user/:display_name/traces/tag/:tag" => "trace#list", :via => :get
|
||||
match "/user/:display_name/traces/page/:page" => "trace#list", :via => :get
|
||||
match "/user/:display_name/traces" => "trace#list", :via => :get
|
||||
match "/user/:display_name/traces/tag/:tag/rss" => "trace#georss", :via => :get, :defaults => { :format => :rss }
|
||||
match "/user/:display_name/traces/rss" => "trace#georss", :via => :get, :defaults => { :format => :rss }
|
||||
match "/user/:display_name/traces/:id" => "trace#view", :via => :get
|
||||
match "/user/:display_name/traces/:id/picture" => "trace#picture", :via => :get
|
||||
match "/user/:display_name/traces/:id/icon" => "trace#icon", :via => :get
|
||||
match "/traces/tag/:tag/page/:page" => "trace#list", :via => :get
|
||||
match "/traces/tag/:tag" => "trace#list", :via => :get
|
||||
match "/traces/page/:page" => "trace#list", :via => :get
|
||||
match "/traces" => "trace#list", :via => :get
|
||||
match "/traces/tag/:tag/rss" => "trace#georss", :via => :get, :defaults => { :format => :rss }
|
||||
match "/traces/rss" => "trace#georss", :via => :get, :defaults => { :format => :rss }
|
||||
match "/traces/mine/tag/:tag/page/:page" => "trace#mine", :via => :get
|
||||
match "/traces/mine/tag/:tag" => "trace#mine", :via => :get
|
||||
match "/traces/mine/page/:page" => "trace#mine", :via => :get
|
||||
match "/traces/mine" => "trace#mine", :via => :get
|
||||
match "/trace/create" => "trace#create", :via => [:get, :post]
|
||||
match "/trace/:id/data" => "trace#data", :via => :get, :id => /\d+/, :as => "trace_data"
|
||||
match "/trace/:id/edit" => "trace#edit", :via => [:get, :post, :patch], :id => /\d+/, :as => "trace_edit"
|
||||
match "/trace/:id/delete" => "trace#delete", :via => :post, :id => /\d+/
|
||||
|
||||
# diary pages
|
||||
match '/diary/new' => 'diary_entry#new', :via => [:get, :post]
|
||||
match '/diary/friends' => 'diary_entry#list', :friends => true, :via => :get, :as => "friend_diaries"
|
||||
match '/diary/nearby' => 'diary_entry#list', :nearby => true, :via => :get, :as => "nearby_diaries"
|
||||
match '/user/:display_name/diary/rss' => 'diary_entry#rss', :via => :get, :defaults => { :format => :rss }
|
||||
match '/diary/:language/rss' => 'diary_entry#rss', :via => :get, :defaults => { :format => :rss }
|
||||
match '/diary/rss' => 'diary_entry#rss', :via => :get, :defaults => { :format => :rss }
|
||||
match '/user/:display_name/diary/comments/:page' => 'diary_entry#comments', :via => :get, :page => /\d+/
|
||||
match '/user/:display_name/diary/comments/' => 'diary_entry#comments', :via => :get
|
||||
match '/user/:display_name/diary' => 'diary_entry#list', :via => :get
|
||||
match '/diary/:language' => 'diary_entry#list', :via => :get
|
||||
match '/diary' => 'diary_entry#list', :via => :get
|
||||
match '/user/:display_name/diary/:id' => 'diary_entry#view', :via => :get, :id => /\d+/
|
||||
match '/user/:display_name/diary/:id/newcomment' => 'diary_entry#comment', :via => :post, :id => /\d+/
|
||||
match '/user/:display_name/diary/:id/edit' => 'diary_entry#edit', :via => [:get, :post], :id => /\d+/
|
||||
match '/user/:display_name/diary/:id/hide' => 'diary_entry#hide', :via => :post, :id => /\d+/, :as => :hide_diary_entry
|
||||
match '/user/:display_name/diary/:id/hidecomment/:comment' => 'diary_entry#hidecomment', :via => :post, :id => /\d+/, :comment => /\d+/, :as => :hide_diary_comment
|
||||
match "/diary/new" => "diary_entry#new", :via => [:get, :post]
|
||||
match "/diary/friends" => "diary_entry#list", :friends => true, :via => :get, :as => "friend_diaries"
|
||||
match "/diary/nearby" => "diary_entry#list", :nearby => true, :via => :get, :as => "nearby_diaries"
|
||||
match "/user/:display_name/diary/rss" => "diary_entry#rss", :via => :get, :defaults => { :format => :rss }
|
||||
match "/diary/:language/rss" => "diary_entry#rss", :via => :get, :defaults => { :format => :rss }
|
||||
match "/diary/rss" => "diary_entry#rss", :via => :get, :defaults => { :format => :rss }
|
||||
match "/user/:display_name/diary/comments/:page" => "diary_entry#comments", :via => :get, :page => /\d+/
|
||||
match "/user/:display_name/diary/comments/" => "diary_entry#comments", :via => :get
|
||||
match "/user/:display_name/diary" => "diary_entry#list", :via => :get
|
||||
match "/diary/:language" => "diary_entry#list", :via => :get
|
||||
match "/diary" => "diary_entry#list", :via => :get
|
||||
match "/user/:display_name/diary/:id" => "diary_entry#view", :via => :get, :id => /\d+/
|
||||
match "/user/:display_name/diary/:id/newcomment" => "diary_entry#comment", :via => :post, :id => /\d+/
|
||||
match "/user/:display_name/diary/:id/edit" => "diary_entry#edit", :via => [:get, :post], :id => /\d+/
|
||||
match "/user/:display_name/diary/:id/hide" => "diary_entry#hide", :via => :post, :id => /\d+/, :as => :hide_diary_entry
|
||||
match "/user/:display_name/diary/:id/hidecomment/:comment" => "diary_entry#hidecomment", :via => :post, :id => /\d+/, :comment => /\d+/, :as => :hide_diary_comment
|
||||
|
||||
# user pages
|
||||
match '/user/:display_name' => 'user#view', :via => :get, :as => "user"
|
||||
match '/user/:display_name/make_friend' => 'user#make_friend', :via => [:get, :post], :as => "make_friend"
|
||||
match '/user/:display_name/remove_friend' => 'user#remove_friend', :via => [:get, :post], :as => "remove_friend"
|
||||
match '/user/:display_name/account' => 'user#account', :via => [:get, :post]
|
||||
match '/user/:display_name/set_status' => 'user#set_status', :via => :get, :as => :set_status_user
|
||||
match '/user/:display_name/delete' => 'user#delete', :via => :get, :as => :delete_user
|
||||
match "/user/:display_name" => "user#view", :via => :get, :as => "user"
|
||||
match "/user/:display_name/make_friend" => "user#make_friend", :via => [:get, :post], :as => "make_friend"
|
||||
match "/user/:display_name/remove_friend" => "user#remove_friend", :via => [:get, :post], :as => "remove_friend"
|
||||
match "/user/:display_name/account" => "user#account", :via => [:get, :post]
|
||||
match "/user/:display_name/set_status" => "user#set_status", :via => :get, :as => :set_status_user
|
||||
match "/user/:display_name/delete" => "user#delete", :via => :get, :as => :delete_user
|
||||
|
||||
# user lists
|
||||
match '/users' => 'user#list', :via => [:get, :post]
|
||||
match '/users/:status' => 'user#list', :via => [:get, :post]
|
||||
match "/users" => "user#list", :via => [:get, :post]
|
||||
match "/users/:status" => "user#list", :via => [:get, :post]
|
||||
|
||||
# geocoder
|
||||
match '/search' => 'geocoder#search', :via => :get, :as => :search
|
||||
match '/geocoder/search_latlon' => 'geocoder#search_latlon', :via => :get
|
||||
match '/geocoder/search_us_postcode' => 'geocoder#search_us_postcode', :via => :get
|
||||
match '/geocoder/search_uk_postcode' => 'geocoder#search_uk_postcode', :via => :get
|
||||
match '/geocoder/search_ca_postcode' => 'geocoder#search_ca_postcode', :via => :get
|
||||
match '/geocoder/search_osm_nominatim' => 'geocoder#search_osm_nominatim', :via => :get
|
||||
match '/geocoder/search_geonames' => 'geocoder#search_geonames', :via => :get
|
||||
match '/geocoder/search_osm_nominatim_reverse' => 'geocoder#search_osm_nominatim_reverse', :via => :get
|
||||
match '/geocoder/search_geonames_reverse' => 'geocoder#search_geonames_reverse', :via => :get
|
||||
match "/search" => "geocoder#search", :via => :get, :as => :search
|
||||
match "/geocoder/search_latlon" => "geocoder#search_latlon", :via => :get
|
||||
match "/geocoder/search_us_postcode" => "geocoder#search_us_postcode", :via => :get
|
||||
match "/geocoder/search_uk_postcode" => "geocoder#search_uk_postcode", :via => :get
|
||||
match "/geocoder/search_ca_postcode" => "geocoder#search_ca_postcode", :via => :get
|
||||
match "/geocoder/search_osm_nominatim" => "geocoder#search_osm_nominatim", :via => :get
|
||||
match "/geocoder/search_geonames" => "geocoder#search_geonames", :via => :get
|
||||
match "/geocoder/search_osm_nominatim_reverse" => "geocoder#search_osm_nominatim_reverse", :via => :get
|
||||
match "/geocoder/search_geonames_reverse" => "geocoder#search_geonames_reverse", :via => :get
|
||||
|
||||
# directions
|
||||
match '/directions' => 'directions#search', :via => :get, :as => :directions
|
||||
match "/directions" => "directions#search", :via => :get, :as => :directions
|
||||
|
||||
# export
|
||||
match '/export/finish' => 'export#finish', :via => :post
|
||||
match '/export/embed' => 'export#embed', :via => :get
|
||||
match "/export/finish" => "export#finish", :via => :post
|
||||
match "/export/embed" => "export#embed", :via => :get
|
||||
|
||||
# messages
|
||||
match '/user/:display_name/inbox' => 'message#inbox', :via => :get, :as => "inbox"
|
||||
match '/user/:display_name/outbox' => 'message#outbox', :via => :get, :as => "outbox"
|
||||
match '/message/new/:display_name' => 'message#new', :via => [:get, :post], :as => "new_message"
|
||||
match '/message/read/:message_id' => 'message#read', :via => :get, :as => "read_message"
|
||||
match '/message/mark/:message_id' => 'message#mark', :via => :post, :as => "mark_message"
|
||||
match '/message/reply/:message_id' => 'message#reply', :via => [:get, :post], :as => "reply_message"
|
||||
match '/message/delete/:message_id' => 'message#delete', :via => :post, :as => "delete_message"
|
||||
match "/user/:display_name/inbox" => "message#inbox", :via => :get, :as => "inbox"
|
||||
match "/user/:display_name/outbox" => "message#outbox", :via => :get, :as => "outbox"
|
||||
match "/message/new/:display_name" => "message#new", :via => [:get, :post], :as => "new_message"
|
||||
match "/message/read/:message_id" => "message#read", :via => :get, :as => "read_message"
|
||||
match "/message/mark/:message_id" => "message#mark", :via => :post, :as => "mark_message"
|
||||
match "/message/reply/:message_id" => "message#reply", :via => [:get, :post], :as => "reply_message"
|
||||
match "/message/delete/:message_id" => "message#delete", :via => :post, :as => "delete_message"
|
||||
|
||||
# oauth admin pages (i.e: for setting up new clients, etc...)
|
||||
scope "/user/:display_name" do
|
||||
resources :oauth_clients
|
||||
end
|
||||
match '/oauth/revoke' => 'oauth#revoke', :via => [:get, :post]
|
||||
match '/oauth/authorize' => 'oauth#authorize', :via => [:get, :post], :as => :authorize
|
||||
match '/oauth/token' => 'oauth#token', :via => :get, :as => :token
|
||||
match '/oauth/request_token' => 'oauth#request_token', :via => [:get, :post], :as => :request_token
|
||||
match '/oauth/access_token' => 'oauth#access_token', :via => [:get, :post], :as => :access_token
|
||||
match '/oauth/test_request' => 'oauth#test_request', :via => :get, :as => :test_request
|
||||
match "/oauth/revoke" => "oauth#revoke", :via => [:get, :post]
|
||||
match "/oauth/authorize" => "oauth#authorize", :via => [:get, :post], :as => :authorize
|
||||
match "/oauth/token" => "oauth#token", :via => :get, :as => :token
|
||||
match "/oauth/request_token" => "oauth#request_token", :via => [:get, :post], :as => :request_token
|
||||
match "/oauth/access_token" => "oauth#access_token", :via => [:get, :post], :as => :access_token
|
||||
match "/oauth/test_request" => "oauth#test_request", :via => :get, :as => :test_request
|
||||
|
||||
# roles and banning pages
|
||||
match '/user/:display_name/role/:role/grant' => 'user_roles#grant', :via => :post, :as => "grant_role"
|
||||
match '/user/:display_name/role/:role/revoke' => 'user_roles#revoke', :via => :post, :as => "revoke_role"
|
||||
match '/user/:display_name/blocks' => 'user_blocks#blocks_on', :via => :get
|
||||
match '/user/:display_name/blocks_by' => 'user_blocks#blocks_by', :via => :get
|
||||
match '/blocks/new/:display_name' => 'user_blocks#new', :via => :get, :as => "new_user_block"
|
||||
match "/user/:display_name/role/:role/grant" => "user_roles#grant", :via => :post, :as => "grant_role"
|
||||
match "/user/:display_name/role/:role/revoke" => "user_roles#revoke", :via => :post, :as => "revoke_role"
|
||||
match "/user/:display_name/blocks" => "user_blocks#blocks_on", :via => :get
|
||||
match "/user/:display_name/blocks_by" => "user_blocks#blocks_by", :via => :get
|
||||
match "/blocks/new/:display_name" => "user_blocks#new", :via => :get, :as => "new_user_block"
|
||||
resources :user_blocks
|
||||
match '/blocks/:id/revoke' => 'user_blocks#revoke', :via => [:get, :post], :as => "revoke_user_block"
|
||||
match "/blocks/:id/revoke" => "user_blocks#revoke", :via => [:get, :post], :as => "revoke_user_block"
|
||||
|
||||
# redactions
|
||||
resources :redactions
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'migrate'
|
||||
require "migrate"
|
||||
|
||||
class CreateOsmDb < ActiveRecord::Migration
|
||||
def self.up
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'migrate'
|
||||
require "migrate"
|
||||
|
||||
class CleanupOsmDb < ActiveRecord::Migration
|
||||
def self.up
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'migrate'
|
||||
require "migrate"
|
||||
|
||||
class SqlSessionStoreSetup < ActiveRecord::Migration
|
||||
def self.up
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'migrate'
|
||||
require "migrate"
|
||||
|
||||
class UserEnhancements < ActiveRecord::Migration
|
||||
def self.up
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'migrate'
|
||||
require "migrate"
|
||||
|
||||
class TileTracepoints < ActiveRecord::Migration
|
||||
def self.up
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'migrate'
|
||||
require "migrate"
|
||||
|
||||
class TileNodes < ActiveRecord::Migration
|
||||
def self.upgrade_table(from_table, to_table, model)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'migrate'
|
||||
require "migrate"
|
||||
|
||||
class AddRelations < ActiveRecord::Migration
|
||||
def self.up
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'migrate'
|
||||
require "migrate"
|
||||
|
||||
class RemoveSegments < ActiveRecord::Migration
|
||||
def self.up
|
||||
|
@ -10,7 +10,7 @@ class RemoveSegments < ActiveRecord::Migration
|
|||
cmd = "db/migrate/008_remove_segments_helper"
|
||||
src = "#{cmd}.cc"
|
||||
if !File.exist?(cmd) || File.mtime(cmd) < File.mtime(src)
|
||||
system('c++ -O3 -Wall `mysql_config --cflags --libs` ' +
|
||||
system("c++ -O3 -Wall `mysql_config --cflags --libs` " +
|
||||
"#{src} -o #{cmd}") || fail
|
||||
end
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'migrate'
|
||||
require "migrate"
|
||||
|
||||
class DiaryComments < ActiveRecord::Migration
|
||||
def self.up
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'migrate'
|
||||
require "migrate"
|
||||
|
||||
class CreateAcls < ActiveRecord::Migration
|
||||
def self.up
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'migrate'
|
||||
require "migrate"
|
||||
|
||||
class PopulateNodeTagsAndRemove < ActiveRecord::Migration
|
||||
def self.up
|
||||
|
@ -10,7 +10,7 @@ class PopulateNodeTagsAndRemove < ActiveRecord::Migration
|
|||
cmd = "db/migrate/020_populate_node_tags_and_remove_helper"
|
||||
src = "#{cmd}.c"
|
||||
if !File.exist?(cmd) || File.mtime(cmd) < File.mtime(src)
|
||||
system('cc -O3 -Wall `mysql_config --cflags --libs` ' +
|
||||
system("cc -O3 -Wall `mysql_config --cflags --libs` " +
|
||||
"#{src} -o #{cmd}") || fail
|
||||
end
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'migrate'
|
||||
require "migrate"
|
||||
|
||||
class MoveToInnodb < ActiveRecord::Migration
|
||||
@@conv_tables = %w(nodes ways way_tags way_nodes current_way_tags relation_members relations relation_tags current_relation_tags)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'migrate'
|
||||
require "migrate"
|
||||
|
||||
class KeyConstraints < ActiveRecord::Migration
|
||||
def self.up
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'migrate'
|
||||
require "migrate"
|
||||
|
||||
class AddChangesets < ActiveRecord::Migration
|
||||
@@conv_user_tables = %w(current_nodes current_relations current_ways nodes relations ways)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'migrate'
|
||||
require "migrate"
|
||||
|
||||
class OrderRelationMembers < ActiveRecord::Migration
|
||||
def self.up
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'migrate'
|
||||
require "migrate"
|
||||
|
||||
class AddEndTimeToChangesets < ActiveRecord::Migration
|
||||
def self.up
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'migrate'
|
||||
require "migrate"
|
||||
|
||||
class AddMoreChangesetIndexes < ActiveRecord::Migration
|
||||
def self.up
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'migrate'
|
||||
require "migrate"
|
||||
|
||||
class AddUserForeignKeys < ActiveRecord::Migration
|
||||
def change
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'migrate'
|
||||
require "migrate"
|
||||
|
||||
class AddForeignKeys < ActiveRecord::Migration
|
||||
def self.up
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require 'migrate'
|
||||
require 'rexml/document'
|
||||
require "migrate"
|
||||
require "rexml/document"
|
||||
|
||||
class CreateCountries < ActiveRecord::Migration
|
||||
def self.up
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'migrate'
|
||||
require "migrate"
|
||||
|
||||
class CreateLanguages < ActiveRecord::Migration
|
||||
def change
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'migrate'
|
||||
require "migrate"
|
||||
|
||||
class ChangeUserLocale < ActiveRecord::Migration
|
||||
def self.up
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'migrate'
|
||||
require "migrate"
|
||||
|
||||
class AddMoreControlsToGpxFiles < ActiveRecord::Migration
|
||||
def self.up
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'migrate'
|
||||
require "migrate"
|
||||
|
||||
class AddForeignKeysToOauthTables < ActiveRecord::Migration
|
||||
def change
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'migrate'
|
||||
require "migrate"
|
||||
|
||||
class CreateUserRoles < ActiveRecord::Migration
|
||||
def self.up
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'migrate'
|
||||
require "migrate"
|
||||
|
||||
class CreateUserBlocks < ActiveRecord::Migration
|
||||
def change
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'migrate'
|
||||
require "migrate"
|
||||
|
||||
class AlterUserRolesAndBlocks < ActiveRecord::Migration
|
||||
def self.up
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue