]> git.openstreetmap.org Git - rails.git/blobdiff - app/helpers/application_helper.rb
Combine the address and netmask for an ACL in one column
[rails.git] / app / helpers / application_helper.rb
index e285215b8d85a01c81bc7eabb93d58ba233ff774..c7187c31d62e932e94047f52ec222c4d9d221b3c 100644 (file)
@@ -2,7 +2,7 @@ module ApplicationHelper
   require 'rexml/document'
 
   def sanitize(text)
-    Sanitize.clean(text, Sanitize::Config::OSM)
+    Sanitize.clean(text, Sanitize::Config::OSM).html_safe
   end
 
   def htmlize(text)
@@ -10,11 +10,15 @@ module ApplicationHelper
   end
 
   def linkify(text)
-    return auto_link(text, :link => :urls, :html => { :rel => "nofollow" })
+    if text.html_safe?
+      Rinku.auto_link(text, :urls, tag_options(:rel => "nofollow")).html_safe
+    else
+      Rinku.auto_link(text, :urls, tag_options(:rel => "nofollow"))
+    end
   end
 
   def html_escape_unicode(text)
-    chars = ActiveSupport::Multibyte::Chars.u_unpack(text).map do |c|
+    chars = ActiveSupport::Multibyte::Unicode.u_unpack(text).map do |c|
       c < 127 ? c.chr : "&##{c.to_s};"
     end
 
@@ -85,7 +89,7 @@ module ApplicationHelper
     url = "http://nominatim.openstreetmap.org/reverse?lat=#{lat}&lon=#{lon}&zoom=#{zoom}&accept-language=#{language}"
 
     begin
-      response = Timeout::timeout(4) do
+      response = OSM::Timer.timeout(4) do
         REXML::Document.new(Net::HTTP.get(URI.parse(url)))
       end
     rescue Exception