]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/swf_controller.rb
Only apply data browser CSS rules in the data browser
[rails.git] / app / controllers / swf_controller.rb
index 8d907d850b37bddbe4cf044391486d8a73cb062c..a683e2177322d6ad199e6ed7d674d364de1698bb 100644 (file)
@@ -1,6 +1,6 @@
 class SwfController < ApplicationController
-  skip_before_filter :verify_authenticity_token
-  before_filter :check_api_readable
+  skip_before_action :verify_authenticity_token
+  before_action :check_api_readable
 
   # to log:
   # RAILS_DEFAULT_LOGGER.error("Args: #{args[0]}, #{args[1]}, #{args[2]}, #{args[3]}")
@@ -45,9 +45,9 @@ class SwfController < ApplicationController
 
     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}"
+      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
-      sql = "SELECT latitude*0.0000001 AS lat,longitude*0.0000001 AS lon,gpx_id AS fileid," +                       "      EXTRACT(EPOCH FROM timestamp) AS ts, gps_points.trackid AS trackid " +                               " FROM gps_points " +                           "WHERE " + OSM.sql_for_area(bbox, "gps_points.") +                              "  AND (gps_points.timestamp IS NOT NULL) " +                           "ORDER BY fileid DESC,ts " +                            "LIMIT 10000 OFFSET #{start}"
+      sql = "SELECT latitude*0.0000001 AS lat,longitude*0.0000001 AS lon,gpx_id AS fileid," + "      EXTRACT(EPOCH FROM timestamp) AS ts, gps_points.trackid AS trackid " +                             " FROM gps_points " +                           "WHERE " + OSM.sql_for_area(bbox, "gps_points.") +                              "  AND (gps_points.timestamp IS NOT NULL) " +                           "ORDER BY fileid DESC,ts " +                            "LIMIT 10000 OFFSET #{start}"
     end
     gpslist = ActiveRecord::Base.connection.select_all sql
 
@@ -213,8 +213,4 @@ class SwfController < ApplicationController
   def lat2y(a)
     180 / Math::PI * Math.log(Math.tan(Math::PI / 4 + a * (Math::PI / 180) / 2))
   end
-
-  def sqlescape(a)
-    a.gsub("'", "''").gsub(92.chr, 92.chr + 92.chr)
-  end
 end