download_xml: "Download XML"
view_history: "view history"
edit: "edit"
+ bug:
+ open_title: "Unresolved issue: {{bug_name}}"
+ closed_title: "Resolved issue: {{bug_name}}"
+ created_at: "Created at:"
+ edited_at: "Edited at:"
+ closed_at: "Closed at:"
+ opened_by: "Opened by:"
+ description: "Description:"
+ comment_by: "Comment by: "
+ comment: "Comment:"
+ date: "Date:"
changeset:
changeset_paging_nav:
showing_page: "Showing page {{page}}"
lost password link: "Lost your password?"
login_button: "Login"
account not active: "Sorry, your account is not active yet.<br />Please click on the link in the account confirmation email to activate your account."
+ account suspended: Sorry, your account has been suspended due to suspicious activity.<br />Please contact the <a href="mailto:webmaster@openstreetmap.org">webmaster</a> if you wish to discuss this.
auth failure: "Sorry, could not log in with those details."
logout:
title: "Logout"
ago: "({{time_in_words_ago}} ago)"
email address: "Email address:"
created from: "Created from:"
+ status: "Status:"
+ spam score: "Spam Score:"
description: Description
user location: User location
if set location: "If you set your location, a pretty map and stuff will appear here. You can set your home location on your {{settings_link}} page."
create_block: "block this user"
activate_user: "activate this user"
deactivate_user: "deactivate this user"
+ confirm_user: "confirm this user"
hide_user: "hide this user"
unhide_user: "unhide this user"
delete_user: "delete this user"
not_a_friend: "{{name}} is not one of your friends."
filter:
not_an_administrator: "You need to be an administrator to perform that action."
+ list:
+ title: Users
+ heading: Users
+ showing:
+ one: Showing page {{page}} ({{first_item}} of {{items}})
+ other: Showing page {{page}} ({{first_item}}-{{last_item}} of {{items}})
+ summary: "{{name}} created from {{ip_address}} on {{date}}"
+ summary_no_ip: "{{name}} created on {{date}}"
+ confirm: Confirm Selected Users
+ hide: Hide Selected Users
+ empty: No matching users found
+ suspended:
+ title: Account Suspended
+ heading: Account Suspended
+ body: |
+ <p>
+ Sorry, your account has been automatically suspended due to
+ suspicious activity.
+ </p>
+ <p>
+ This decision will be reviewed by an administrator shortly, or
+ you may contact the <a href="mailto:{{webmaster}}">webmaster</a> if
+ you wish to discuss this.
+ </p>
user_role:
filter:
not_an_administrator: "Only administrators can perform user role management, and you are not an administrator."
back: "View all blocks"
revoker: "Revoker:"
needs_view: "The user needs to log in before this block will be cleared."
+ bugs:
+ rss:
+ description_area: "A list of bugs, reported, commented on or closed in your area [({{min_lat}}|{{min_lon}}) -- ({{max_lat}}|{{max_lon}})]"
+ description_item: "An rss feed for bug {{id}}"
+ closed: "closed bug (near {{place}})"
+ new: "new bug (near {{place}})"
+ comment: "new comment (near {{place}})"
+ user:
+ title_user: "Bugs submitted or commented on by {{user}}"
+ heading_user: "{{user}}'s bugs"
+ description_user: "Bugs submitted or commented on by {{user}}"
+ id: "Id"
+ last_changed: "Last changed"
+
javascripts:
map:
base:
map.connect "api/#{API_VERSION}/amf/read", :controller =>'amf', :action =>'amf_read'
map.connect "api/#{API_VERSION}/amf/write", :controller =>'amf', :action =>'amf_write'
map.connect "api/#{API_VERSION}/swf/trackpoints", :controller =>'swf', :action =>'trackpoints'
+
+ # Map Bugs API
+ map.connect "api/#{API_VERSION}/bugs/getBugs", :controller =>'map_bugs', :action =>'get_bugs'
+ map.connect "api/#{API_VERSION}/bugs/addPOIexec", :controller =>'map_bugs', :action =>'add_bug'
+ map.connect "api/#{API_VERSION}/bugs/closePOIexec", :controller =>'map_bugs', :action =>'close_bug'
+ map.connect "api/#{API_VERSION}/bugs/editPOIexec", :controller =>'map_bugs', :action =>'edit_bug'
+ map.connect "api/#{API_VERSION}/bugs/getGPX", :controller =>'map_bugs', :action =>'gpx_bugs'
+ map.connect "api/#{API_VERSION}/bugs/getRSSfeed", :controller =>'map_bugs', :action =>'rss'
+
+ map.connect "api/#{API_VERSION}/bugs", :controller => 'map_bugs', :action => 'get_bugs'
+ map.connect "api/#{API_VERSION}/bugs/search", :controller => 'map_bugs', :action => 'search'
+ map.connect "api/#{API_VERSION}/bugs/rss", :controller =>'map_bugs', :action =>'rss'
+ map.connect "api/#{API_VERSION}/bug/create", :controller => 'map_bugs', :action => 'add_bug'
+ map.connect "api/#{API_VERSION}/bug/:id/comment", :controller => 'map_bugs', :action => 'edit_bug', :id => /\d+/
+ map.connect "api/#{API_VERSION}/bug/:id/close", :controller => 'map_bugs', :action => 'close_bug', :id => /\d+/
+ map.connect "api/#{API_VERSION}/bug/:id", :controller => 'map_bugs', :action => 'read', :id => /\d+/, :conditions => { :method => :get }
+ map.connect "api/#{API_VERSION}/bug/:id", :controller => 'map_bugs', :action => 'delete', :id => /\d+/, :conditions => { :method => :delete }
+
+ map.connect '/user/:display_name/bugs', :controller => 'map_bugs', :action => 'my_bugs'
+
+
# Data browsing
map.connect '/browse', :controller => 'changeset', :action => 'list'
map.changeset '/browse/changeset/:id', :controller => 'browse', :action => 'changeset', :id => /\d+/
map.connect '/browse/changesets', :controller => 'changeset', :action => 'list'
map.connect '/browse/changesets/feed', :controller => 'changeset', :action => 'list', :format => :atom
+ map.connect '/browse/bug/:id', :controller => 'browse', :action => 'bug', :id => /\d+/
# web site
map.root :controller => 'site', :action => 'index'
map.connect '/user/go_public', :controller => 'user', :action => 'go_public'
map.connect '/user/reset-password', :controller => 'user', :action => 'reset_password'
map.connect '/user/forgot-password', :controller => 'user', :action => 'lost_password'
+ map.connect '/user/suspended', :controller => 'user', :action => 'suspended'
map.connect '/index.html', :controller => 'site', :action => 'index'
map.connect '/edit.html', :controller => 'site', :action => 'edit'
map.connect '/user/:display_name/diary/:id/hide', :controller => 'diary_entry', :action => 'hide', :id => /\d+/
map.connect '/user/:display_name/diary/:id/hidecomment/:comment', :controller => 'diary_entry', :action => 'hidecomment', :id => /\d+/, :comment => /\d+/
map.connect '/user/:display_name/account', :controller => 'user', :action => 'account'
- map.connect '/user/:display_name/activate', :controller => 'user', :action => 'activate'
- map.connect '/user/:display_name/deactivate', :controller => 'user', :action => 'deactivate'
- map.connect '/user/:display_name/hide', :controller => 'user', :action => 'hide'
- map.connect '/user/:display_name/unhide', :controller => 'user', :action => 'unhide'
+ map.connect '/user/:display_name/set_status', :controller => 'user', :action => 'set_status'
map.connect '/user/:display_name/delete', :controller => 'user', :action => 'delete'
map.connect '/diary/new', :controller => 'diary_entry', :action => 'new'
map.connect '/diary', :controller => 'diary_entry', :action => 'list'
map.connect '/diary/:language', :controller => 'diary_entry', :action => 'list'
map.connect '/diary/:language/rss', :controller => 'diary_entry', :action => 'rss'
-
+ # user lists
+ map.connect '/users', :controller => 'user', :action => 'list'
+ map.connect '/users/:status', :controller => 'user', :action => 'list'
+
# test pages
map.connect '/test/populate/:table/:from/:count', :controller => 'test', :action => 'populate'
map.connect '/test/populate/:table/:count', :controller => 'test', :action => 'populate', :from => 1
require 'xml/libxml'
require 'digest/md5'
require 'RMagick'
+ require 'nokogiri'
# The base class for API Errors.
class APIError < RuntimeError
# Return an SQL fragment to select a given area of the globe
def self.sql_for_area(minlat, minlon, maxlat, maxlon, prefix = nil)
- tilesql = QuadTile.sql_for_area(minlat, minlon, maxlat, maxlon, prefix)
+ tilesql = QuadTile.sql_for_area(minlat, minlon, maxlat, maxlon, prefix)
minlat = (minlat * 10000000).round
minlon = (minlon * 10000000).round
maxlat = (maxlat * 10000000).round
return "#{tilesql} AND #{prefix}latitude BETWEEN #{minlat} AND #{maxlat} AND #{prefix}longitude BETWEEN #{minlon} AND #{maxlon}"
end
+ # Return an SQL fragment to select a given area of the globe without using the quadtile index
+ def self.sql_for_area_no_quadtile(minlat, minlon, maxlat, maxlon, prefix = nil, without_quadtile = :false)
+ minlat = (minlat * 10000000).round
+ minlon = (minlon * 10000000).round
+ maxlat = (maxlat * 10000000).round
+ maxlon = (maxlon * 10000000).round
+
+ return "#{prefix}latitude BETWEEN #{minlat} AND #{maxlat} AND #{prefix}longitude BETWEEN #{minlon} AND #{maxlon}"
+ end
+
+ # Return a spam score for a chunk of text
+ def self.spam_score(text)
+ link_count = 0
+ link_size = 0
+ doc = Nokogiri::HTML(text)
+
+ if doc.content.length > 0
+ doc.xpath("//a").each do |link|
+ link_count += 1
+ link_size += link.content.length
+ end
+
+ link_proportion = link_size.to_f / doc.content.length.to_f
+ else
+ link_proportion = 0
+ end
+
+ return [link_proportion - 0.2, 0.0].max * 200 + link_count * 20
+ end
end