jpmobile 0.0.4 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. data/README.rdoc +227 -0
  2. data/Rakefile +6 -13
  3. data/lib/jpmobile/docomo_guid.rb +42 -0
  4. data/lib/jpmobile/filter.rb +1 -1
  5. data/lib/jpmobile/helpers.rb +2 -1
  6. data/lib/jpmobile/hook_action_controller.rb +12 -0
  7. data/lib/jpmobile/hook_action_view.rb +82 -72
  8. data/lib/jpmobile/{hook_abstract_request.rb → hook_request.rb} +1 -1
  9. data/lib/jpmobile/mobile/au.rb +9 -3
  10. data/lib/jpmobile/mobile/z_display_info_docomo.rb +10 -2
  11. data/lib/jpmobile/mobile/z_ip_addresses_au.rb +1 -26
  12. data/lib/jpmobile/mobile/z_ip_addresses_willcom.rb +2 -4
  13. data/lib/jpmobile/rack/auth.rb +55 -0
  14. data/lib/jpmobile/rack/combined_logger.rb +54 -0
  15. data/lib/jpmobile/rack/request.rb +7 -0
  16. data/lib/jpmobile/rack/trans_sid.rb +14 -0
  17. data/lib/jpmobile/trans_sid.rb +70 -62
  18. data/lib/jpmobile/version.rb +1 -1
  19. data/test/{au_test.rb → legacy/au_test.rb} +0 -0
  20. data/test/{autoload_test.rb → legacy/autoload_test.rb} +0 -0
  21. data/test/{docomo_test.rb → legacy/docomo_test.rb} +0 -0
  22. data/test/{emoticon_functional_test.rb → legacy/emoticon_functional_test.rb} +1 -1
  23. data/test/{emoticon_test.rb → legacy/emoticon_test.rb} +0 -0
  24. data/test/{filter_test.rb → legacy/filter_test.rb} +0 -0
  25. data/test/{helper.rb → legacy/helper.rb} +4 -5
  26. data/test/{helpers_test.rb → legacy/helpers_test.rb} +1 -1
  27. data/test/{softbank_test.rb → legacy/softbank_test.rb} +0 -0
  28. data/test/{willcom_test.rb → legacy/willcom_test.rb} +0 -0
  29. data/test/rails/overrides/app/controllers/application.rb +5 -0
  30. data/test/rails/overrides/app/controllers/docomo_guid_controller.rb +13 -0
  31. data/test/rails/overrides/app/controllers/filter_controller.rb +26 -0
  32. data/test/rails/overrides/app/controllers/mobile_spec_controller.rb +5 -0
  33. data/test/rails/overrides/app/controllers/template_path_controller.rb +6 -0
  34. data/test/rails/overrides/app/controllers/trans_sid_controller.rb +28 -0
  35. data/test/rails/overrides/app/views/filter/index.html.erb +0 -0
  36. data/test/rails/overrides/app/views/hankaku_filter/index.html.erb +0 -0
  37. data/test/rails/overrides/app/views/template_path/_partial.html.erb +1 -0
  38. data/test/rails/overrides/app/views/template_path/_partial_mobile.html.erb +1 -0
  39. data/test/rails/overrides/app/views/template_path/_partial_mobile_docomo.html.erb +1 -0
  40. data/test/rails/overrides/app/views/template_path/index.html.erb +1 -0
  41. data/test/rails/overrides/app/views/template_path/index_mobile.html.erb +1 -0
  42. data/test/rails/overrides/app/views/template_path/index_mobile_docomo.html.erb +1 -0
  43. data/test/rails/overrides/app/views/template_path/partial.html.erb +2 -0
  44. data/test/rails/overrides/lib/tasks/rspec.rake +165 -0
  45. data/test/rails/overrides/spec/controllers/docomo_guid_spec.rb +77 -0
  46. data/test/rails/overrides/spec/controllers/docomo_spec.rb +28 -0
  47. data/test/rails/overrides/spec/controllers/emobile_spec.rb +35 -0
  48. data/test/rails/overrides/spec/controllers/filter_spec.rb +157 -0
  49. data/test/rails/overrides/spec/controllers/pc_spec.rb +11 -0
  50. data/test/rails/overrides/spec/controllers/softbank_emulator_spec.rb +40 -0
  51. data/test/rails/overrides/spec/controllers/template_path_spec.rb +115 -0
  52. data/test/rails/overrides/spec/controllers/trans_sid_spec.rb +98 -0
  53. data/test/rails/overrides/spec/helpers/helpers_spec.rb +13 -0
  54. data/test/rails/overrides/spec/rcov.opts +2 -0
  55. data/test/rails/overrides/spec/rspec.rake +165 -0
  56. data/test/rails/overrides/spec/spec.opts +4 -0
  57. data/test/rails/overrides/spec/spec_helper.rb +47 -0
  58. data/test/rails/rails_root/README +256 -0
  59. data/test/rails/rails_root/Rakefile +10 -0
  60. data/test/rails/rails_root/app/controllers/application.rb +5 -0
  61. data/test/rails/rails_root/app/controllers/docomo_guid_controller.rb +13 -0
  62. data/test/rails/rails_root/app/controllers/filter_controller.rb +26 -0
  63. data/test/rails/rails_root/app/controllers/mobile_spec_controller.rb +5 -0
  64. data/test/rails/rails_root/app/controllers/template_path_controller.rb +6 -0
  65. data/test/rails/rails_root/app/controllers/trans_sid_controller.rb +26 -0
  66. data/test/rails/rails_root/app/helpers/application_helper.rb +3 -0
  67. data/test/rails/rails_root/app/views/template_path/index.html.erb +1 -0
  68. data/test/rails/rails_root/app/views/template_path/index_mobile.html.erb +1 -0
  69. data/test/rails/rails_root/app/views/template_path/index_mobile_docomo.html.erb +1 -0
  70. data/test/rails/rails_root/config/boot.rb +109 -0
  71. data/test/rails/rails_root/config/database.yml +22 -0
  72. data/test/rails/rails_root/config/environment.rb +75 -0
  73. data/test/rails/rails_root/config/environments/development.rb +17 -0
  74. data/test/rails/rails_root/config/environments/production.rb +24 -0
  75. data/test/rails/rails_root/config/environments/test.rb +22 -0
  76. data/test/rails/rails_root/config/initializers/inflections.rb +10 -0
  77. data/test/rails/rails_root/config/initializers/mime_types.rb +5 -0
  78. data/test/rails/rails_root/config/initializers/new_rails_defaults.rb +17 -0
  79. data/test/rails/rails_root/config/locales/en.yml +5 -0
  80. data/test/rails/rails_root/config/routes.rb +43 -0
  81. data/test/rails/rails_root/db/development.sqlite3 +0 -0
  82. data/test/rails/rails_root/db/schema.rb +14 -0
  83. data/test/rails/rails_root/db/test.sqlite3 +0 -0
  84. data/test/rails/rails_root/doc/README_FOR_APP +5 -0
  85. data/test/rails/rails_root/lib/tasks/rspec.rake +165 -0
  86. data/test/rails/rails_root/log/development.log +38 -0
  87. data/test/rails/rails_root/log/production.log +0 -0
  88. data/test/rails/rails_root/log/server.log +0 -0
  89. data/test/rails/rails_root/log/test.log +401 -0
  90. data/test/rails/rails_root/public/404.html +30 -0
  91. data/test/rails/rails_root/public/422.html +30 -0
  92. data/test/rails/rails_root/public/500.html +33 -0
  93. data/test/rails/rails_root/public/dispatch.cgi +10 -0
  94. data/test/rails/rails_root/public/dispatch.fcgi +24 -0
  95. data/test/rails/rails_root/public/dispatch.rb +10 -0
  96. data/test/rails/rails_root/public/favicon.ico +0 -0
  97. data/test/rails/rails_root/public/images/rails.png +0 -0
  98. data/test/rails/rails_root/public/index.html +274 -0
  99. data/test/rails/rails_root/public/javascripts/application.js +2 -0
  100. data/test/rails/rails_root/public/javascripts/controls.js +963 -0
  101. data/test/rails/rails_root/public/javascripts/dragdrop.js +973 -0
  102. data/test/rails/rails_root/public/javascripts/effects.js +1128 -0
  103. data/test/rails/rails_root/public/javascripts/prototype.js +4320 -0
  104. data/test/rails/rails_root/public/robots.txt +5 -0
  105. data/test/rails/rails_root/script/about +4 -0
  106. data/test/rails/rails_root/script/console +3 -0
  107. data/test/rails/rails_root/script/dbconsole +3 -0
  108. data/test/rails/rails_root/script/destroy +3 -0
  109. data/test/rails/rails_root/script/generate +3 -0
  110. data/test/rails/rails_root/script/performance/benchmarker +3 -0
  111. data/test/rails/rails_root/script/performance/profiler +3 -0
  112. data/test/rails/rails_root/script/performance/request +3 -0
  113. data/test/rails/rails_root/script/plugin +3 -0
  114. data/test/rails/rails_root/script/process/inspector +3 -0
  115. data/test/rails/rails_root/script/process/reaper +3 -0
  116. data/test/rails/rails_root/script/process/spawner +3 -0
  117. data/test/rails/rails_root/script/runner +3 -0
  118. data/test/rails/rails_root/script/server +3 -0
  119. data/test/rails/rails_root/spec/controllers/docomo_guid_spec.rb +77 -0
  120. data/test/rails/rails_root/spec/controllers/docomo_spec.rb +28 -0
  121. data/test/rails/rails_root/spec/controllers/emobile_spec.rb +35 -0
  122. data/test/rails/rails_root/spec/controllers/filter_spec.rb +157 -0
  123. data/test/rails/rails_root/spec/controllers/pc_spec.rb +11 -0
  124. data/test/rails/rails_root/spec/controllers/softbank_emulator_spec.rb +40 -0
  125. data/test/rails/rails_root/spec/controllers/template_path_spec.rb +85 -0
  126. data/test/rails/rails_root/spec/controllers/trans_sid_spec.rb +96 -0
  127. data/test/rails/rails_root/spec/helpers/helpers_spec.rb +13 -0
  128. data/test/rails/rails_root/spec/rcov.opts +2 -0
  129. data/test/rails/rails_root/spec/rspec.rake +165 -0
  130. data/test/rails/rails_root/spec/spec.opts +4 -0
  131. data/test/rails/rails_root/spec/spec_helper.rb +47 -0
  132. data/test/rails/rails_root/test/performance/browsing_test.rb +9 -0
  133. data/test/rails/rails_root/test/test_helper.rb +38 -0
  134. data/test/rails/rails_root/vendor/plugins/jpmobile/CHANGELOG +7 -0
  135. data/test/rails/rails_root/vendor/plugins/jpmobile/MIT-LICENSE +7 -0
  136. data/{README → test/rails/rails_root/vendor/plugins/jpmobile/README.rdoc} +15 -17
  137. data/test/rails/rails_root/vendor/plugins/jpmobile/Rakefile +116 -0
  138. data/test/rails/rails_root/vendor/plugins/jpmobile/init.rb +3 -0
  139. data/test/rails/rails_root/vendor/plugins/jpmobile/install.rb +1 -0
  140. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile.rb +42 -0
  141. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/datum_conv.rb +72 -0
  142. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/docomo_guid.rb +42 -0
  143. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/email.rb +19 -0
  144. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon.rb +123 -0
  145. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/au.rb +1287 -0
  146. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/conversion_table.rb +3908 -0
  147. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/docomo.rb +255 -0
  148. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/softbank.rb +477 -0
  149. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/z_combine.rb +20 -0
  150. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/filter.rb +173 -0
  151. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/helpers.rb +185 -0
  152. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_controller.rb +11 -0
  153. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_view.rb +142 -0
  154. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_request.rb +13 -0
  155. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/abstract_mobile.rb +73 -0
  156. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/au.rb +97 -0
  157. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/display.rb +33 -0
  158. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/docomo.rb +97 -0
  159. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/emobile.rb +17 -0
  160. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/softbank.rb +110 -0
  161. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/willcom.rb +39 -0
  162. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/z_display_info_docomo.rb +688 -0
  163. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/z_ip_addresses_au.rb +22 -0
  164. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/z_ip_addresses_docomo.rb +12 -0
  165. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/z_ip_addresses_emobile.rb +10 -0
  166. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/z_ip_addresses_softbank.rb +17 -0
  167. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/z_ip_addresses_willcom.rb +117 -0
  168. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/position.rb +67 -0
  169. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/request_with_mobile.rb +44 -0
  170. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/trans_sid.rb +105 -0
  171. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/util.rb +21 -0
  172. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/version.rb +9 -0
  173. data/test/rails/rails_root/vendor/plugins/jpmobile/spec/spec.opts +6 -0
  174. data/test/rails/rails_root/vendor/plugins/jpmobile/spec/spec_helper.rb +36 -0
  175. data/test/rails/rails_root/vendor/plugins/jpmobile/spec/unit/detect_by_email_spec.rb +31 -0
  176. data/test/rails/rails_root/vendor/plugins/jpmobile/spec/unit/detect_by_ua_spec.rb +42 -0
  177. data/test/rails/rails_root/vendor/plugins/jpmobile/spec/unit/is_carrier_spec.rb +93 -0
  178. data/test/rails/rails_root/vendor/plugins/jpmobile/spec/unit/spec_helper.rb +5 -0
  179. data/test/rails/rails_root/vendor/plugins/jpmobile/spec/unit/util_spec.rb +28 -0
  180. data/test/rails/rails_root/vendor/plugins/jpmobile/spec/unit/valid_ip_spec.rb +60 -0
  181. data/test/rails/rails_root/vendor/plugins/jpmobile/tasks/jpmobile_tasks.rake +59 -0
  182. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/emoji/genregexp.rb +47 -0
  183. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/generate_au_emoticon_table.rb +34 -0
  184. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/generate_docomo_emoticon_table.rb +34 -0
  185. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/generate_emoticon_conversion_table.rb +107 -0
  186. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/generate_softbank_emoticon_table.rb +32 -0
  187. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/list_gps_unsupported_au.rb +23 -0
  188. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/update_display_info_docomo.rb +45 -0
  189. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/update_ip_addresses_au.rb +29 -0
  190. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/update_ip_addresses_willcom.rb +17 -0
  191. data/tools/update_ip_addresses_au.rb +15 -5
  192. metadata +188 -22
@@ -0,0 +1,22 @@
1
+ Jpmobile::Mobile::Au::IP_ADDRESSES =
2
+ ["210.230.128.224/28",
3
+ "121.111.227.160/27",
4
+ "61.117.1.0/28",
5
+ "219.108.158.0/27",
6
+ "219.125.146.0/28",
7
+ "61.117.2.32/29",
8
+ "61.117.2.40/29",
9
+ "219.108.158.40/29",
10
+ "219.125.148.0/25",
11
+ "222.5.63.0/25",
12
+ "222.5.63.128/25",
13
+ "222.5.62.128/25",
14
+ "59.135.38.128/25",
15
+ "219.108.157.0/25",
16
+ "219.125.145.0/25",
17
+ "121.111.231.0/25",
18
+ "121.111.227.0/25",
19
+ "118.152.214.192/26",
20
+ "118.159.131.0/25",
21
+ "118.159.133.0/25",
22
+ "118.159.132.160/27"].map {|ip| IPAddr.new(ip) }
@@ -0,0 +1,12 @@
1
+ # = IPアドレス帯域テーブル(手動更新分)
2
+ # == DoCoMo
3
+ # http://www.nttdocomo.co.jp/service/imode/make/content/ip/index.html
4
+ # 2008/09現在
5
+ Jpmobile::Mobile::Docomo::IP_ADDRESSES = %w(
6
+ 210.153.84.0/24
7
+ 210.136.161.0/24
8
+ 210.153.86.0/24
9
+ 124.146.174.0/24
10
+ 124.146.175.0/24
11
+ ).map {|ip| IPAddr.new(ip) }
12
+
@@ -0,0 +1,10 @@
1
+ # = IPアドレス帯域テーブル(手動更新分)
2
+ # == EMOBILE
3
+ # http://developer.emnet.ne.jp/ipaddress.html
4
+ # 2008/02/26現在
5
+
6
+ #:enddoc:
7
+
8
+ Jpmobile::Mobile::Emobile::IP_ADDRESSES = %w(
9
+ 117.55.1.224/27
10
+ ).map {|ip| IPAddr.new(ip) }
@@ -0,0 +1,17 @@
1
+ # = IPアドレス帯域テーブル(手動更新分)
2
+ # == SoftBank
3
+ # http://developers.softbankmobile.co.jp/dp/tech_svc/web/ip.php
4
+ # 2007/10/09現在
5
+ Jpmobile::Mobile::Softbank::IP_ADDRESSES = %w(
6
+ 123.108.236.0/24
7
+ 123.108.237.0/27
8
+ 202.179.204.0/24
9
+ 202.253.96.224/27
10
+ 210.146.7.192/26
11
+ 210.146.60.192/26
12
+ 210.151.9.128/26
13
+ 210.169.130.112/28
14
+ 210.175.1.128/25
15
+ 210.228.189.0/24
16
+ 211.8.159.128/25
17
+ ).map {|ip| IPAddr.new(ip) }
@@ -0,0 +1,117 @@
1
+ Jpmobile::Mobile::Willcom::IP_ADDRESSES =
2
+ ["61.198.128.0/24",
3
+ "61.198.129.0/24",
4
+ "61.198.130.0/24",
5
+ "61.198.131.0/24",
6
+ "61.198.132.0/24",
7
+ "61.198.133.0/24",
8
+ "61.198.134.0/24",
9
+ "61.198.135.0/24",
10
+ "61.198.136.0/24",
11
+ "61.198.137.0/24",
12
+ "61.198.138.100/32",
13
+ "61.198.138.101/32",
14
+ "61.198.138.102/32",
15
+ "61.198.138.103/32",
16
+ "61.198.139.0/29",
17
+ "61.198.139.128/27",
18
+ "61.198.139.160/28",
19
+ "61.198.140.0/24",
20
+ "61.198.141.0/24",
21
+ "61.198.142.0/24",
22
+ "61.198.143.0/24",
23
+ "61.198.160.0/24",
24
+ "61.198.161.0/24",
25
+ "61.198.162.0/24",
26
+ "61.198.163.0/24",
27
+ "61.198.164.0/24",
28
+ "61.198.165.0/24",
29
+ "61.198.166.0/24",
30
+ "61.198.168.0/24",
31
+ "61.198.169.0/24",
32
+ "61.198.170.0/24",
33
+ "61.198.171.0/24",
34
+ "61.198.172.0/24",
35
+ "61.198.173.0/24",
36
+ "61.198.174.0/24",
37
+ "61.198.175.0/24",
38
+ "61.198.248.0/24",
39
+ "61.198.249.0/24",
40
+ "61.198.250.0/24",
41
+ "61.198.251.0/24",
42
+ "61.198.252.0/24",
43
+ "61.198.253.0/24",
44
+ "61.198.254.0/24",
45
+ "61.198.255.0/24",
46
+ "61.204.0.0/24",
47
+ "61.204.2.0/24",
48
+ "61.204.3.0/25",
49
+ "61.204.3.128/25",
50
+ "61.204.4.0/24",
51
+ "61.204.5.0/24",
52
+ "61.204.6.0/25",
53
+ "61.204.6.128/25",
54
+ "61.204.7.0/25",
55
+ "61.204.92.0/24",
56
+ "61.204.93.0/24",
57
+ "61.204.94.0/24",
58
+ "61.204.95.0/24",
59
+ "125.28.0.0/24",
60
+ "125.28.1.0/24",
61
+ "125.28.11.0/24",
62
+ "125.28.12.0/24",
63
+ "125.28.13.0/24",
64
+ "125.28.14.0/24",
65
+ "125.28.15.0/24",
66
+ "125.28.16.0/24",
67
+ "125.28.17.0/24",
68
+ "125.28.2.0/24",
69
+ "125.28.3.0/24",
70
+ "125.28.4.0/24",
71
+ "125.28.5.0/24",
72
+ "125.28.6.0/24",
73
+ "125.28.7.0/24",
74
+ "125.28.8.0/24",
75
+ "210.168.246.0/24",
76
+ "210.168.247.0/24",
77
+ "210.169.92.0/24",
78
+ "210.169.93.0/24",
79
+ "210.169.94.0/24",
80
+ "210.169.95.0/24",
81
+ "210.169.96.0/24",
82
+ "210.169.97.0/24",
83
+ "210.169.98.0/24",
84
+ "210.169.99.0/24",
85
+ "211.126.192.128/25",
86
+ "211.18.232.0/24",
87
+ "211.18.233.0/24",
88
+ "211.18.234.0/24",
89
+ "211.18.235.0/24",
90
+ "211.18.236.0/24",
91
+ "211.18.237.0/24",
92
+ "211.18.238.0/24",
93
+ "211.18.239.0/24",
94
+ "219.108.10.0/24",
95
+ "219.108.11.0/24",
96
+ "219.108.12.0/24",
97
+ "219.108.13.0/24",
98
+ "219.108.14.0/24",
99
+ "219.108.15.0/24",
100
+ "219.108.4.0/24",
101
+ "219.108.5.0/24",
102
+ "219.108.6.0/24",
103
+ "219.108.7.0/24",
104
+ "219.108.8.0/24",
105
+ "219.108.9.0/24",
106
+ "221.119.0.0/24",
107
+ "221.119.1.0/24",
108
+ "221.119.2.0/24",
109
+ "221.119.3.0/24",
110
+ "221.119.4.0/24",
111
+ "221.119.5.0/24",
112
+ "221.119.6.0/24",
113
+ "221.119.7.0/24",
114
+ "221.119.8.0/24",
115
+ "221.119.9.0/24",
116
+ "219.108.2.0/24",
117
+ "219.108.3.0/24"].map {|ip| IPAddr.new(ip) }
@@ -0,0 +1,67 @@
1
+ #= 位置情報
2
+
3
+ # plugins/以下にgeokitがインストールされている場合は読み込む
4
+ begin
5
+ require RAILS_ROOT + '/vendor/plugins/geokit/lib/geo_kit/mappable'
6
+ rescue MissingSourceFile, NameError
7
+ end
8
+
9
+ module Jpmobile
10
+ # 位置情報
11
+ class Position
12
+ if Object.const_defined?("GeoKit")
13
+ # GeoKitが読み込まれている場合はMappableにする
14
+ include ::GeoKit::Mappable
15
+ def self.acts_as_mappable; end
16
+ def self.distance_column_name; end
17
+ def self.lat_column_name; :lat; end
18
+ def self.lng_column_name; :lng; end
19
+ end
20
+ def initialize
21
+ @lat = nil
22
+ @lon = nil
23
+ @options = {}
24
+ end
25
+ # 度分秒を度に変換する。
26
+ def self.dms2deg(d,m,s)
27
+ return d.to_i + m.to_i.to_f/60 + s.to_f/3600
28
+ end
29
+ # 日本測地系から世界測地系に変換する。
30
+ def tokyo2wgs84!
31
+ @lat, @lon = DatumConv.tky2jgd(@lat,@lon)
32
+ end
33
+ # 文字列で緯度経度を返す。
34
+ def to_s
35
+ sprintf("%s%f%s%f", @lat>0 ? 'N' : 'S', @lat, @lon>0 ? 'E' : 'W', @lon)
36
+ end
37
+
38
+ # 緯度経度をカンマ区切りで返す
39
+ def ll
40
+ "#{lat},#{lng}"
41
+ end
42
+
43
+ # 緯度
44
+ attr_accessor :lat
45
+
46
+ # 経度
47
+ attr_accessor :lon
48
+
49
+ # 経度
50
+ def lng
51
+ lon
52
+ end
53
+
54
+ # 経度を設定
55
+ def lng=(l)
56
+ lon = l
57
+ end
58
+
59
+ # 緯度と経度が一致している場合に +true+
60
+ def ==(x)
61
+ x.lat == lat && x.lon == lon
62
+ end
63
+
64
+ # その他の情報
65
+ attr_accessor :options
66
+ end
67
+ end
@@ -0,0 +1,44 @@
1
+ # jpmobile の各機能を提供するモジュール
2
+ # envメソッドと、parameter あるいは params メソッドが実装されている必要がある。
3
+ # 今のところはRack::RequestとActionController::AbstractRequestに対応しているはず。
4
+
5
+ module Jpmobile
6
+ module RequestWithMobile
7
+ # 環境変数 HTTP_USER_AGENT を返す。
8
+ def user_agent
9
+ env['HTTP_USER_AGENT']
10
+ end
11
+
12
+ # for reverse proxy.
13
+ def remote_addr
14
+ if respond_to? :remote_ip
15
+ return __send__(:remote_ip)
16
+ else
17
+ return ( env["HTTP_X_FORWARDED_FOR"] ? env["HTTP_X_FORWARDED_FOR"].split(',').pop : env["REMOTE_ADDR"] )
18
+ end
19
+ end
20
+
21
+ # 環境変数 HTTP_USER_AGENT を設定する。
22
+ def user_agent=(str)
23
+ self.env["HTTP_USER_AGENT"] = str
24
+ end
25
+
26
+ # 携帯電話からであれば +true+を、そうでなければ +false+ を返す。
27
+ def mobile?
28
+ mobile != nil
29
+ end
30
+
31
+ # 携帯電話の機種に応じて Mobile::xxx を返す。
32
+ # 携帯電話でない場合はnilを返す。
33
+ def mobile
34
+ return @__mobile if @__mobile
35
+
36
+ Jpmobile::Mobile.carriers.each do |const|
37
+ c = Jpmobile::Mobile.const_get(const)
38
+ return @__mobile = c.new(self) if c::USER_AGENT_REGEXP && user_agent =~ c::USER_AGENT_REGEXP
39
+ end
40
+ nil
41
+ end
42
+ end
43
+ end
44
+
@@ -0,0 +1,105 @@
1
+ # = セッションIDの付与
2
+ #
3
+ # based on http://moriq.tdiary.net/20070209.html#p01
4
+ # by moriq <moriq@moriq.com>
5
+ #
6
+ # cookie support detection inspired by takai http://recompile.net/
7
+ #
8
+ # Rails 2.0.2 support is based on the code contributed
9
+ # by masuidrive <masuidrive (at) masuidrive.jp>
10
+
11
+ # FastCGI環境では(どういうわけか) cgi.query_string でクエリ文字列を取得できないので
12
+ # ENV['QUERY_STRING'] に代入しておく。
13
+ module ActionController
14
+ class CgiRequest
15
+ alias_method :initialize_without_ext, :initialize
16
+ def initialize(cgi, options = {})
17
+ initialize_without_ext(cgi, options)
18
+ ENV['QUERY_STRING'] = query_string
19
+ end
20
+ end
21
+ end
22
+
23
+ class ActionController::Base #:nodoc:
24
+ class_inheritable_accessor :trans_sid_mode
25
+ def transit_sid_mode(*args)
26
+ STDERR.puts "Method transit_sid is now deprecated. Use trans_sid instead."
27
+ trans_sid_mode(*args)
28
+ end
29
+ class << self
30
+ def trans_sid(mode=:mobile)
31
+ include Jpmobile::TransSid
32
+ self.trans_sid_mode = mode
33
+ unless mode == :none
34
+ # CSRF対策への対策
35
+ session :cookie_only => false
36
+ # url/postからsession_keyを取得できるようhookを追加する
37
+ unless ::CGI::Session.private_method_defined?(:initialize_without_session_key_fixation)
38
+ ::CGI::Session.class_eval do
39
+ alias_method :initialize_without_session_key_fixation, :initialize
40
+ def initialize(cgi, options = {})
41
+ key = options['session_key']
42
+ if cgi.cookies[key].empty?
43
+ session_id = (CGI.parse(cgi.env_table['RAW_POST_DATA'])[key] rescue nil) ||
44
+ (CGI.parse(ENV['QUERY_STRING'] || cgi.query_string)[key] rescue nil)
45
+ cgi.params[key] = session_id unless session_id.blank?
46
+ end
47
+ initialize_without_session_key_fixation(cgi, options)
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ def transit_sid(*args)
54
+ STDERR.puts "Method transit_sid is now deprecated. Use trans_sid instead."
55
+ trans_sid(*args)
56
+ end
57
+ end
58
+ end
59
+
60
+ module Jpmobile::TransSid #:nodoc:
61
+ def self.included(controller)
62
+ controller.after_filter(:append_session_id_parameter)
63
+ end
64
+
65
+ protected
66
+ # URLにsession_idを追加する。
67
+ def default_url_options(options=nil)
68
+ result = super || {}
69
+ return result unless request # for test process
70
+ return result unless apply_trans_sid?
71
+ return result.merge({ session_key => session.session_id })
72
+ end
73
+
74
+ private
75
+ # session_keyを返す。
76
+ def session_key
77
+ if session_enabled?
78
+ session_key = request.session_options[:session_key] || '_session_id'
79
+ end
80
+ end
81
+ # session_idを埋め込むためのhidden fieldを出力する。
82
+ def sid_hidden_field_tag
83
+ "<input type=\"hidden\" name=\"#{CGI::escapeHTML session_key}\" value=\"#{CGI::escapeHTML session.session_id}\" />"
84
+ end
85
+ # formにsession_idを追加する。
86
+ def append_session_id_parameter
87
+ return unless request # for test process
88
+ return unless apply_trans_sid?
89
+ response.body.gsub!(%r{(</form>)}i, sid_hidden_field_tag+'\1')
90
+ end
91
+ # trans_sidを適用すべきかを返す。
92
+ def apply_trans_sid?
93
+ return false unless session_enabled?
94
+ return false if trans_sid_mode == :none
95
+ return true if trans_sid_mode == :always
96
+ if trans_sid_mode == :mobile
97
+ if request.mobile?
98
+ return !request.mobile.supports_cookie?
99
+ else
100
+ return false
101
+ end
102
+ end
103
+ return false
104
+ end
105
+ end
@@ -0,0 +1,21 @@
1
+ require 'tempfile'
2
+ module Jpmobile
3
+ module Util
4
+ module_function
5
+ def deep_apply(obj, &proc)
6
+ case obj
7
+ when Hash
8
+ obj.each_pair do |key, value|
9
+ obj[key] = deep_apply(value, &proc)
10
+ end
11
+ when Array
12
+ obj.collect!{|value| deep_apply(value, &proc)}
13
+ when NilClass, TrueClass, FalseClass, Tempfile, StringIO
14
+ return obj
15
+ else
16
+ obj = obj.to_param if obj.respond_to?(:to_param)
17
+ proc.call(obj)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,9 @@
1
+ module Jpmobile #:nodoc:
2
+ module VERSION #:nodoc:
3
+ MAJOR = 0
4
+ MINOR = 0
5
+ TINY = 4
6
+
7
+ STRING = [MAJOR, MINOR, TINY].join('.')
8
+ end
9
+ end
@@ -0,0 +1,6 @@
1
+ --colour
2
+ --format
3
+ progress
4
+ --loadby
5
+ mtime
6
+ --reverse