[DRE-commits] [tdiary] 01/06: Imported Upstream version 5.0.0

Youhei SASAKI uwabami-guest at moszumanska.debian.org
Sun Jun 26 08:41:12 UTC 2016


This is an automated email from the git hooks/post-receive script.

uwabami-guest pushed a commit to branch master
in repository tdiary.

commit 446665a090bd7a72c28fa688c4ec5993fd7a5171
Author: Youhei SASAKI <uwabami at gfd-dennou.org>
Date:   Sun Jun 26 17:16:01 2016 +0900

    Imported Upstream version 5.0.0
---
 .gitignore                                         |   1 +
 .travis.yml                                        |   8 +-
 ChangeLog                                          |  34 +
 Gemfile                                            |   2 +-
 Gemfile.lock                                       |  51 +-
 Procfile                                           |   2 +-
 README.md                                          |   8 +-
 app.json                                           |  33 +
 doc/HOWTO-make-plugin.md                           |   2 +-
 doc/HOWTO-testing-tDiary.md                        |   2 +-
 doc/HOWTO-use-plugin.md                            |   2 -
 doc/INSTALL-paas.md                                |   2 +-
 doc/INSTALL.md                                     |  19 -
 doc/README.en.md                                   |  18 +-
 doc/README.md                                      |   2 +-
 doc/UPGRADE.md                                     |  12 +-
 index.rb                                           |   2 +-
 js/image.js                                        |   6 +-
 lib/tdiary/application.rb                          |   6 +-
 lib/tdiary/base.rb                                 |   2 +-
 lib/tdiary/cli.rb                                  |   2 +-
 lib/tdiary/configuration.rb                        |   9 +-
 lib/tdiary/core_ext.rb                             |   9 +-
 lib/tdiary/plugin.rb                               |  14 +-
 lib/tdiary/plugin/00default.rb                     |  33 +-
 lib/tdiary/plugin/10spamfilter.rb                  |  10 +-
 lib/tdiary/plugin/en/10spamfilter.rb               |   2 -
 lib/tdiary/plugin/en/50sp.rb                       |   2 -
 lib/tdiary/plugin/ja/10spamfilter.rb               |   2 -
 lib/tdiary/plugin/ja/50sp.rb                       |   2 -
 lib/tdiary/style/wiki.rb                           |   6 +-
 .../paas/heroku => lib/tdiary}/tasks/mongodb.rake  |   0
 lib/tdiary/tasks/release.rake                      |   2 +-
 lib/tdiary/tasks/rspec.rake                        |   6 -
 lib/tdiary/version.rb                              |   2 +-
 misc/paas/cloudfoundry/tdiary.conf                 |   1 -
 misc/paas/heroku/Gemfile.local                     |   7 +-
 misc/paas/heroku/Gemfile.lock                      | 234 ++++++
 misc/paas/heroku/app.json                          |  19 -
 misc/paas/heroku/config.ru                         |   6 -
 misc/paas/heroku/misc/plugin/system_update.rb      |  55 ++
 misc/paas/heroku/tdiary.conf                       |   4 +-
 misc/paas/sqale/tdiary.conf                        |   1 -
 misc/plugin/amazon.rb                              | 178 ++---
 misc/plugin/amazon/README.en                       |  17 -
 misc/plugin/amazon/README.ja                       |  29 -
 misc/plugin/amazon/amazonimg.rb                    | 113 ---
 misc/plugin/amazon/large.png                       | Bin 20897 -> 0 bytes
 misc/plugin/amazon/medium.png                      | Bin 5307 -> 0 bytes
 misc/plugin/amazon/small.png                       | Bin 2024 -> 0 bytes
 misc/plugin/calendar2.rb                           |   6 +-
 misc/plugin/{category.rb => category-legacy.rb}    |   4 +-
 misc/plugin/category.rb                            | 803 ++++-----------------
 misc/plugin/category_autocomplete.rb               |   4 +-
 misc/plugin/comment_emoji_autocomplete.rb          |   4 +-
 misc/plugin/disp_referrer.rb                       | 122 +---
 misc/plugin/en/{category.rb => category-legacy.rb} |   2 +-
 misc/plugin/en/category.rb                         | 220 +-----
 misc/plugin/en/disp_referrer.rb                    |  10 +-
 misc/plugin/en/image.rb                            |   7 -
 misc/plugin/en/search_control.rb                   |   2 -
 misc/plugin/image.rb                               |  45 +-
 misc/plugin/ja/{category.rb => category-legacy.rb} |   2 +-
 misc/plugin/ja/category.rb                         | 226 +-----
 misc/plugin/ja/disp_referrer.rb                    |  13 +-
 misc/plugin/ja/search_control.rb                   |   2 -
 misc/plugin/ja/weather.rb                          |   3 +-
 misc/plugin/random_google.rb                       |  18 +-
 misc/plugin/recent_comment3.rb                     |   4 -
 misc/plugin/recent_rss.rb                          |   2 -
 misc/plugin/squeeze.rb                             | 272 -------
 misc/plugin/theme_online.rb                        |   4 +-
 misc/plugin/title_tag.rb                           |  13 +-
 spec/acceptance/append_comment_spec.rb             |   2 +-
 spec/acceptance/save_conf_plugin_spec.rb           |   4 +-
 spec/acceptance/save_conf_security_spec.rb         |   9 +-
 spec/acceptance/view_category_spec.rb              |   2 +-
 spec/acceptance_helper.rb                          |   6 +-
 spec/core/plugin_spec.rb                           |   9 +-
 spec/fixtures/tdiary.conf.gem                      |   1 -
 spec/fixtures/tdiary.conf.rack                     |   1 -
 spec/fixtures/tdiary.conf.secure                   | 204 ------
 spec/fixtures/tdiary.conf.webrick                  |   1 -
 spec/plugin/plugin_helper.rb                       |   2 +-
 tdiary.conf.beginner                               |   2 -
 tdiary.conf.sample                                 |   4 -
 tdiary.conf.sample-en                              |   3 -
 tdiary.gemspec                                     |   2 +-
 test/disp_referrer_test.rb                         |   1 -
 update.rb                                          |   2 +-
 90 files changed, 801 insertions(+), 2221 deletions(-)

diff --git a/.gitignore b/.gitignore
index c551452..94420c3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,6 +14,7 @@ vendor/bundle/
 spec/reports
 doc/*.html
 .rspec
+.ruby-version
 /Gemfile.local
 spec/javascripts/lib
 node_modules
diff --git a/.travis.yml b/.travis.yml
index e0b1d42..e1242fa 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,7 +5,6 @@ sudo: false
 services: memcache
 
 rvm:
-  - 2.0.0
   - 2.1
   - 2.2
   - 2.3.0
@@ -25,12 +24,15 @@ before_install:
 before_script:
   - npm install
 
-script: if [ $TEST_MODE = "gem" ] ; then bundle exec tdiary test ; else bundle exec rake spec jasmine:ci test ; fi
+script: if [ $TEST_MODE = "gem" ] ; then bundle exec tdiary test ; else bundle exec rake spec test ; fi
 
 env:
   - TEST_MODE=rack
-  - TEST_MODE=secure
   - TEST_MODE=gem
 
+matrix:
+  allow_failures:
+    - rvm: ruby-head
+
 notifications:
   irc: "irc.freenode.org#tdiary"
diff --git a/ChangeLog b/ChangeLog
index f1802fc..84d7f06 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,37 @@
+2016-03-29  MATSUOKA Kohei <kohei at machu.jp>
+	* release 5.0.0
+
+2016-03-22  TADA Tadashi <t at tdtds.jp>
+	* index.rb, update.rb: set magic comment ascii-8bit to show all error messages
+
+2016-03-16  TADA Tadashi <t at tdtds.jp>
+	* rename category_legacy.rb to category-legacy.rb
+
+2016-03-10  TADA Tadashi <t at tdtds.jp>
+	* style/wiki.rb: untaint plugin code when syntax checking
+
+2016-03-09  TADA Tadashi <t at tdtds.jp>
+	* replace category.rb plugin by contrib/category-lite.rb plugin
+	* kill secure mode (ignore @secure variable in tdiary.conf and more)
+
+2016-01-26  TADA Tadashi <t at tdtds.jp>
+	* title_tag.rb: print only diary name when diary has no subtitles
+
+2016-01-19  TADA Tadashi <t at tdtds.jp>
+	* delete config.ru for Heroku (use default one)
+
+2016-01-08  TADA Tadashi <t at tdtds.jp>
+	* title_tag.rb: support category-lite plugin
+
+2016-01-05  TADA Tadashi <t at tdtds.jp>
+	* system_update.rb, README.md: enable deploy master branch to heroku
+
+2016-01-05  MATSUOKA Kohei <kohei at machu.jp>
+	* support heroku on master branch
+
+2015-12-31  TADA Tadashi <t at tdtds.jp>
+	* application.rb: fix error when @index or @update specified with URL in tdiary.conf
+
 2015-12-29  MATSUOKA Kohei <kohei at machu.jp>
 	* release 4.2.1
 
diff --git a/Gemfile b/Gemfile
index ef4363d..62d015e 100644
--- a/Gemfile
+++ b/Gemfile
@@ -6,11 +6,11 @@ gem 'hikidoc'
 gem 'fastimage'
 gem 'emot'
 gem 'mail'
+gem 'rake'
 
 group :development do
   gem 'pit', require: false
   gem 'racksh', require: false
-  gem 'rake'
   gem 'redcarpet'
 
   group :test do
diff --git a/Gemfile.lock b/Gemfile.lock
index 049640e..dfbd0c4 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,18 +1,19 @@
 GEM
   remote: https://rubygems.org/
   specs:
-    addressable (2.4.0)
-    byebug (8.2.1)
-    capybara (2.5.0)
+    addressable (2.3.8)
+    byebug (8.2.2)
+    capybara (2.6.2)
+      addressable
       mime-types (>= 1.16)
       nokogiri (>= 1.3.3)
       rack (>= 1.0.0)
       rack-test (>= 0.5.4)
       xpath (~> 2.0)
-    childprocess (0.5.8)
+    childprocess (0.5.9)
       ffi (~> 1.0, >= 1.0.11)
-    coderay (1.1.0)
-    concurrent-ruby (1.0.0)
+    coderay (1.1.1)
+    concurrent-ruby (1.0.1)
     coveralls (0.7.12)
       multi_json (~> 1.10)
       rest-client (>= 1.6.8, < 2)
@@ -21,12 +22,12 @@ GEM
       thor (~> 0.19.1)
     diff-lcs (1.2.5)
     docile (1.1.5)
-    domain_name (0.5.25)
+    domain_name (0.5.20160310)
       unf (>= 0.0.5, < 1.0.0)
     emot (0.0.4)
       thor
-    fastimage (1.8.1)
-      addressable (~> 2.3, >= 2.3.5)
+    fastimage (1.9.0)
+      addressable (~> 2.3.5)
     ffi (1.9.10)
     hikidoc (0.1.0)
     http-cookie (1.0.2)
@@ -42,15 +43,15 @@ GEM
     mail (2.6.3)
       mime-types (>= 1.16, < 3)
     method_source (0.8.2)
-    mime-types (2.99)
+    mime-types (2.99.1)
     mini_portile2 (2.0.0)
     multi_json (1.11.2)
     netrc (0.11.0)
-    nokogiri (1.6.7.1)
+    nokogiri (1.6.7.2)
       mini_portile2 (~> 2.0.0.rc2)
-    phantomjs (1.9.8.0)
+    phantomjs (2.1.1.0)
     pit (0.0.7)
-    power_assert (0.2.6)
+    power_assert (0.2.7)
     pry (0.10.3)
       coderay (~> 1.1.0)
       method_source (~> 0.8.1)
@@ -64,8 +65,8 @@ GEM
     racksh (1.0.0)
       rack (>= 1.0)
       rack-test (>= 0.5)
-    rake (10.4.2)
-    redcarpet (3.3.3)
+    rake (11.1.1)
+    redcarpet (3.3.4)
     rest-client (1.8.0)
       http-cookie (>= 1.0.2, < 2.0)
       mime-types (>= 1.16, < 3.0)
@@ -74,22 +75,21 @@ GEM
       rspec-core (~> 3.4.0)
       rspec-expectations (~> 3.4.0)
       rspec-mocks (~> 3.4.0)
-    rspec-core (3.4.1)
+    rspec-core (3.4.4)
       rspec-support (~> 3.4.0)
     rspec-expectations (3.4.0)
       diff-lcs (>= 1.2.0, < 2.0)
       rspec-support (~> 3.4.0)
-    rspec-mocks (3.4.0)
+    rspec-mocks (3.4.1)
       diff-lcs (>= 1.2.0, < 2.0)
       rspec-support (~> 3.4.0)
     rspec-support (3.4.1)
-    rubyzip (1.1.7)
-    selenium-webdriver (2.48.1)
+    rubyzip (1.2.0)
+    selenium-webdriver (2.53.0)
       childprocess (~> 0.5)
-      multi_json (~> 1.0)
       rubyzip (~> 1.0)
       websocket (~> 1.0)
-    sequel (4.29.0)
+    sequel (4.32.0)
     simplecov (0.9.2)
       docile (~> 1.1.0)
       multi_json (~> 1.0)
@@ -102,13 +102,13 @@ GEM
     sqlite3 (1.3.11)
     term-ansicolor (1.3.2)
       tins (~> 1.0)
-    test-unit (3.1.5)
+    test-unit (3.1.8)
       power_assert
     thor (0.19.1)
-    tins (1.8.1)
+    tins (1.9.0)
     unf (0.1.4)
       unf_ext
-    unf_ext (0.0.7.1)
+    unf_ext (0.0.7.2)
     websocket (1.2.2)
     xpath (2.0.0)
       nokogiri (~> 1.3)
@@ -138,3 +138,6 @@ DEPENDENCIES
   sprockets
   sqlite3
   test-unit
+
+BUNDLED WITH
+   1.11.2
diff --git a/Procfile b/Procfile
index 58361e4..4fd3163 100644
--- a/Procfile
+++ b/Procfile
@@ -1 +1 @@
-web: bundle exec thin start -p $PORT
+web: bundle exec puma -p $PORT
diff --git a/README.md b/README.md
index 256c2a6..c8e19c8 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 # tDiary
 
-[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://www.heroku.com/deploy?template=https://github.com/tdiary/tdiary-core/tree/heroku)
+[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://www.heroku.com/deploy?template=https://github.com/tdiary/tdiary-core)
 
 [![Gem Version](https://badge.fury.io/rb/tdiary.png)](https://rubygems.org/gems/tdiary) [![Build Status](https://secure.travis-ci.org/tdiary/tdiary-core.png)](https://travis-ci.org/tdiary/tdiary-core) [![Coverage Status](https://coveralls.io/repos/tdiary/tdiary-core/badge.png?branch=master)](https://coveralls.io/r/tdiary/tdiary-core) [![Dependency Status](https://gemnasium.com/tdiary/tdiary-core.png)](https://gemnasium.com/tdiary/tdiary-core) [![Code Climate](https://codeclimate.com/gith [...]
 
@@ -16,11 +16,11 @@ tDiaryには以下のような特徴があります。
 
 ### 長く日記を続けられます
 
-日記は大切な自分史です。安心して長く日記を書き続けられるように、tDiaryは最低でも25年間はプロジェクトを維持することを目標に開発を続けています。2011年現在で10周年になるので、あと15年間はtDiaryで日記を書き続けることができます。
+日記は大切な自分史です。安心して長く日記を書き続けられるように、tDiaryは最低でも25年間はプロジェクトを維持することを目標に開発を続けています。2016年現在で15周年になるので、あと10年間はtDiaryで日記を書き続けることができます。
 
 ### レンタルサーバーユーザにやさしい
 
-必要なのはRuby(2.0.0以降に対応)だけ。単独でCGIとして動作し、基本機能はデータベースや追加のライブラリを必要としません。
+必要なのはRuby(2.1.0以降に対応)だけ。単独でCGIとして動作し、基本機能はデータベースや追加のライブラリを必要としません。
 
 ### プラグインで拡張できます
 
@@ -32,4 +32,4 @@ tDiaryには以下のような特徴があります。
 
 ### その他
 
-インストールにはドキュメント(doc/INSTALL.html)を参照して下さい。動作にはruby(2.0.0以降)と、CGIもしくはRackをサポートするWebサーバが必要です。
+インストールにはドキュメント(doc/INSTALL.html)を参照して下さい。動作にはruby(2.1.0以降)と、CGIもしくはRackをサポートするWebサーバが必要です。
diff --git a/app.json b/app.json
new file mode 100644
index 0000000..e28d34b
--- /dev/null
+++ b/app.json
@@ -0,0 +1,33 @@
+{
+  "name": "tDiary",
+  "website": "http://www.tdiary.org/",
+  "repository": "https://github.com/tdiary/tdiary-core",
+  "addons": [
+    "sendgrid",
+    "memcachier",
+    "mongolab"
+  ],
+  "scripts": {
+    "postdeploy": "bundle exec rake mongodb:index"
+  },
+  "env": {
+    "TWITTER_KEY": {
+      "required": true
+    },
+    "TWITTER_SECRET": {
+      "required": true
+    },
+    "TWITTER_NAME": {
+      "required": true
+    },
+    "RACK_ENV": "production"
+  },
+  "buildpacks": [
+    {
+      "url": "https://github.com/tdiary/heroku-buildpack-tdiary"
+    },
+    {
+      "url": "https://github.com/heroku/heroku-buildpack-ruby"
+    }
+  ]
+}
diff --git a/doc/HOWTO-make-plugin.md b/doc/HOWTO-make-plugin.md
index a64012c..9115839 100644
--- a/doc/HOWTO-make-plugin.md
+++ b/doc/HOWTO-make-plugin.md
@@ -215,7 +215,7 @@ end
 
 @modeが'saveconf'の時のみ、@cgi経由で渡された設定を保存します。保存先は@conf[]にオプション用のキーワードを指定して代入します。これは従来tdiary.confにて、@optionsとして指定したものと同じです。なお、conf\_procで保存できるオプションは、文字列(String)、整数(Fixnum)、真偽値(TrueClass/FalseClass)、nil(NilClass)で表現されるオブジェクトだけです。
 
-conf\_procを使って設定を保存すると、その後はtdiary.confによる@optionsは効かなくなるので注意が必要です。また、@conf.secureに応じて設定できる項目が変化するようにしておけば、レンタルの場合に不必要な項目をユーザが変更できなくすることも可能です。
+conf\_procを使って設定を保存すると、その後はtdiary.confによる@optionsは効かなくなるので注意が必要です。
 
 プラグインが生成するHTML
 --------------
diff --git a/doc/HOWTO-testing-tDiary.md b/doc/HOWTO-testing-tDiary.md
index 376b5f5..573ea2e 100644
--- a/doc/HOWTO-testing-tDiary.md
+++ b/doc/HOWTO-testing-tDiary.md
@@ -18,7 +18,7 @@ tDiary-3.0.1.20101011 以降のバージョンでは tDiary を test するた
 
 tDiary でテストを実行するためには以下の環境を用意する必要があります。
 
-  - Ruby 2.0.0 以降
+  - Ruby 2.1.0 以降
   - Bundler 1.3.5 以降
 
 動かし方
diff --git a/doc/HOWTO-use-plugin.md b/doc/HOWTO-use-plugin.md
index 1473d1c..0a3adcc 100644
--- a/doc/HOWTO-use-plugin.md
+++ b/doc/HOWTO-use-plugin.md
@@ -127,8 +127,6 @@ navi\_userプラグインと反対に、管理用に必要なボタン「更新
 <%=insert 'menu.html'%>
 ```
 
-このプラグインは、ファイルにアクセスするため、tdiary.confで@secureがfalseに設定されていないと利用できません。
-
 ### myプラグイン
 
 日記本文中で、自分の日記内へのリンクを簡単に作成します。[...](〜)とやってもよいのですが、こちらの方がサーバの引っ越しやmod\_rewriteを利用してURLを変更した場合などに強くできます。
diff --git a/doc/INSTALL-paas.md b/doc/INSTALL-paas.md
index e3a2172..52de144 100644
--- a/doc/INSTALL-paas.md
+++ b/doc/INSTALL-paas.md
@@ -32,7 +32,7 @@ Heroku の New App ページになったら、下記の情報を入力して、D
 tDiary を sqale で動作させるためには以下のツールが必要となります。
 
   - [git](http://git-scm.com)
-  - Ruby 2.0.0 以降
+  - Ruby 2.1.0 以降
   - RubyGems 1.3.7 以降
   - Bundler 1.0.0 以降
 
diff --git a/doc/INSTALL.md b/doc/INSTALL.md
index fcb65d2..ed6964c 100644
--- a/doc/INSTALL.md
+++ b/doc/INSTALL.md
@@ -67,25 +67,6 @@ tdiary.confに記述しておくことで、CGIの設定画面からは編集で
 
 tdiary.confの設定が終わったら、http://www.hoge.example.org/~foo/diary/にアクセスしてみましょう。からっぽの日記ページが出れば設定は正しいです。不幸にして「Internal Server Error」が出てしまったら、Apacheのエラーログを参照して間違った設定を修正してください。
 
-### セキュリティ
-
-tdiary.confには、tDiaryの設定をCGIから行う場合のセキュリティレベルを調整する変数があります。自分が管理するWebサーバで、自分だけが使う場合にはあまり気にしなくても良いですが、知人に貸したり、tDiaryを使った日記サービスを提供するような場合には、ユーザにできることを制限したい場合が少なくありません。
-
-そこで、tdiary.conf中でセキュリティの設定を行います。通常、tdiary.confの末尾には以下の2行が書かれています。
-
-```
- at secure = false
-load_cgi_conf
-```
-
- at secureは、セキュリティ設定を指定する変数です。この値がfalseの場合、セキュリティチェックはいっさいかかりません。ユーザはCGI設定で好き放題ができます。それでは危険という状況下でtDiaryを運営する場合には、@secureの値をtrueにします。そうすると、CGI設定中における危険な変数操作やファイル操作が禁止されます。
-
-また、@secureの値は、日記の表示時に後述するプラグインを実行する場合にも影響を及ぼします。これにより、@secureがtrueの場合には、いくつかのプラグインが利用できなくなります。
-
-load\_cgi\_confはその位置でCGIによる設定を読み込む指令です。つまり、@secureでセキュリティレベルを設定したあとでファイルを読み込むようになっています。
-
-なお、両者の指定位置は独立しているので、両者の位置を組み合わせることで様々な設定を行うことが可能です。また、@secureを指定しない場合のデフォルト値はtrueです。
-
 tDiaryの実行
 ------------
 
diff --git a/doc/README.en.md b/doc/README.en.md
index b316c69..b40a0b0 100644
--- a/doc/README.en.md
+++ b/doc/README.en.md
@@ -36,7 +36,7 @@ You can choice a grammar of writing your diary by 'Style' feature. Some style fi
 
 ### Written in Ruby
 
-Important :-). tDiary requires Ruby-2.0.0 or later.
+Important :-). tDiary requires Ruby 2.1.0 or later.
 
 ### Others
 
@@ -110,22 +110,6 @@ If you run tDiary in the environment where you can't use the suffix, ".rb", as C
 
 After you finish configuration, access "http://www.hoge.example.org/~foo/diary/". If you can see an empty page, tDiary works well. Unfortunately, if you encounter "Internal Server Error", you must change configuration. The error-log of Apache is useful in order to investigate the cause.
 
-Security
---------
-
-"tdiary.conf" has the item which change the security level. If you use tDiary on your own server, you may not care about security. But, if you lend tDiary or provide the service of web-log, you need restriction.
-
-In these cases, you set the security level in "tdiary.conf". Normally, these two lines exists at the end of "tdiary.conf".
-
-```
- at secure = false load_cgi_conf
-```
-By changing @secure, you set the security level. If this is false, no security check is carried out. If no security check is executed, users can change tDiary indulgently. When you run tDiary under the dangerous circumstance, you set @secure to true. If you do it, the dangerous operation, for example, file operation or variable assignment, is prohibited when "tdiary.conf" is loaded. The "@secure" affects plugins. If security check is carried out, you can't use some plugins.
-
-"load\_cgi\_conf" is the function which loads the tDiary's configuration file of CGI. In this example, the CGI configuration file is loaded after the security level is configured.
-
-Because you can change the positions of "load\_cgi\_conf" and @secure independently, you can do detailed configuration. If you omit @secure, @secure is set to the default value, true.
-
 run tDiary
 ----------
 
diff --git a/doc/README.md b/doc/README.md
index 6972aaf..ab8a857 100644
--- a/doc/README.md
+++ b/doc/README.md
@@ -36,7 +36,7 @@ iモードに限らず、ほとんどの携帯電話やPalm・ザウルスなど
 
 ### Rubyで書かれている
 
-重要なポイントでしょう:-)??ruby 2.0.0以上が必要です。
+重要なポイントでしょう:-) ruby 2.1.0以上が必要です。
 
 セクション(段落)アンカーや過去の日記の参照など、一般的なWeb日記システムの持つ機能は基本的にサポートしています。
 
diff --git a/doc/UPGRADE.md b/doc/UPGRADE.md
index b589dfc..2033418 100644
--- a/doc/UPGRADE.md
+++ b/doc/UPGRADE.md
@@ -4,7 +4,17 @@
 このドキュメントについて
 --
 
-tDiaryは、バージョン番号の2桁目が偶数のもの(1.0.x、1.2.x...)がリリースバージョン、奇数のもの(0.9.xx、1.1.x...)が開発バージョンとなっています。このドキュメントでは、リリースバージョン間の変更点について解説します。開発バージョンを使っている場合は、ChangeLogファイルを参照してください。
+tDiaryは、バージョン番号が「X.Y.Z」の形式のものがリリースバージョン、その後ろに「.YYYYMMDD」形式で日付が入っているものが開発バージョンとなっています。このドキュメントでは、リリースバージョン間の変更点について解説します。開発バージョンを使っている場合は、ChangeLogファイルを参照してください。
+
+4.0と5.0の違い
+-----
+
+5.0での大きな変更点は、secure modeがなくなったことです。secure modeを実現するために利用していたRubyの機能が、サポートしているruby 2.1以降で使えなくなったためです。このため、従来secure modeで利用していたtDiaryをruby 2.1以降で利用する場合は、以下のような手段で別途安全を確保する必要があります。
+
+ - suexecやそれに類した環境でCGIをそれぞれのユーザ権限で動作させる
+ - jailやそれに類した環境でWebサーバをそれぞれのユーザ権限で動作させる
+ - Dockerやそれに類した環境でコンテナ自体を分離する
+ - 日記ごとに別のサーバを用意する
 
 2.2と3.0の違い
 -----
diff --git a/index.rb b/index.rb
index de7326d..d4c9fa6 100755
--- a/index.rb
+++ b/index.rb
@@ -1,5 +1,5 @@
 #!/usr/bin/env ruby
-# -*- coding: utf-8; -*-
+# -*- coding: ascii-8bit; -*-
 #
 # index.rb
 #
diff --git a/js/image.js b/js/image.js
index ab6828b..d9a90ee 100644
--- a/js/image.js
+++ b/js/image.js
@@ -12,12 +12,12 @@ function insertImage(text){
 
 $(function(){
 	$('.image-img')
-	.live('hover', function(){
+	.on('hover', function(){
 		$(this).css('cursor', 'pointer');
 	}, function(){
 		$(this).css('cursor', 'default');
 	})
-	.live('click', function(){
+	.on('click', function(){
 		var idx = this.id.replace('image-index-', '');
 		var w = $('#image-info-' + idx + ' .image-width').text();
 		var h = $('#image-info-' + idx + ' .image-height').text();
@@ -107,7 +107,7 @@ $(function(){
 	};
 
 	$('#plugin-image-delimage')
-	.live('submit', function(e){
+	.on('submit', function(e){
 		e.preventDefault();
 		
 		var ids = $.map($('#image-table input[name="plugin_image_id"]:checked'), function(i){
diff --git a/lib/tdiary/application.rb b/lib/tdiary/application.rb
index dea40a8..306be0e 100644
--- a/lib/tdiary/application.rb
+++ b/lib/tdiary/application.rb
@@ -68,19 +68,19 @@ module TDiary
 			end
 		end
 
-	protected
 		def assets_paths
 			TDiary::Extensions::constants.map {|extension|
 				TDiary::Extensions::const_get( extension ).assets_path
 			}.flatten.uniq
 		end
 
+	protected
 		def index_path
-			(Pathname.new('/') + TDiary.configuration.index).to_s
+			(Pathname.new('/') + URI(TDiary.configuration.index).path).to_s
 		end
 
 		def update_path
-			(Pathname.new('/') + TDiary.configuration.update).to_s
+			(Pathname.new('/') + URI(TDiary.configuration.update).path).to_s
 		end
 
 		def assets_path
diff --git a/lib/tdiary/base.rb b/lib/tdiary/base.rb
index a6f8842..3c5a894 100644
--- a/lib/tdiary/base.rb
+++ b/lib/tdiary/base.rb
@@ -63,7 +63,7 @@ module TDiary
 				@io.store_cache( r, prefix ) unless @diaries.empty?
 			end
 
-			r = @plugin.eval_src( r.untaint, @conf.secure ) if @plugin
+			r = @plugin.eval_src( r.untaint ) if @plugin
 
 			@cookies += @plugin.cookies
 
diff --git a/lib/tdiary/cli.rb b/lib/tdiary/cli.rb
index 25589ed..7d2c230 100644
--- a/lib/tdiary/cli.rb
+++ b/lib/tdiary/cli.rb
@@ -60,7 +60,7 @@ module TDiary
 		def assets_copy
 			require 'tdiary'
 			assets_path = File.join(TDiary.server_root, 'public/assets')
-			TDiary::Application.config.assets_paths.each do |path|
+			TDiary::Application.new.assets_paths.each do |path|
 				Dir.glob(File.join(path, '*')).each do |entity|
 					if File.directory?(entity)
 						directory entity, File.join(assets_path, File.basename(entity))
diff --git a/lib/tdiary/configuration.rb b/lib/tdiary/configuration.rb
index c361ffb..40d8f78 100644
--- a/lib/tdiary/configuration.rb
+++ b/lib/tdiary/configuration.rb
@@ -17,8 +17,8 @@ module TDiary
 
 		def save
 			result = ERB.new(File.read("#{File.dirname(__FILE__)}/../../views/tdiary.rconf").untaint).result(binding)
-			result.untaint unless @secure
-			Safe::safe( @secure ? 4 : 1 ) do
+			result.untaint
+			Safe::safe do
 				eval( result, binding, "(TDiary::Configuration#save)", 1 )
 			end
 			@io_class.save_cgi_conf(self, result)
@@ -114,11 +114,11 @@ module TDiary
 			end
 
 			cgi_conf = @io_class.load_cgi_conf(self)
-			cgi_conf.untaint unless @secure
+			cgi_conf.untaint
 
 			b = binding.taint
 			eval( def_vars1, b )
-			Safe::safe( @secure ? 4 : 1 ) do
+			Safe::safe do
 				begin
 					eval( cgi_conf, b, "(TDiary::Configuration#load_cgi_conf)", 1 )
 				rescue SyntaxError
@@ -137,7 +137,6 @@ module TDiary
 
 		# loading tdiary.conf in current directory
 		def configure_attrs
-			@secure = true unless @secure
 			@options = {}
 
 			eval( File::open( 'tdiary.conf' ) {|f| f.read }.untaint, nil, "(tdiary.conf)", 1 )
diff --git a/lib/tdiary/core_ext.rb b/lib/tdiary/core_ext.rb
index b1b2087..86f3003 100644
--- a/lib/tdiary/core_ext.rb
+++ b/lib/tdiary/core_ext.rb
@@ -65,6 +65,7 @@ class CGI
 	end
 
 	def https?
+		return true if env_table['HTTP_X_FORWARDED_PROTO'] == 'https'
 		return false if env_table['HTTPS'].nil? or /off/i =~ env_table['HTTPS'] or env_table['HTTPS'] == ''
 		true
 	end
@@ -111,14 +112,12 @@ class RackCGI < CGI; end
 == Safe module
 =end
 module Safe
-	def safe( level = 4 )
+	def safe
 		result = nil
-		if $SAFE < level then
+		if $SAFE < 1 then
 			Proc.new {
 				begin
-					$SAFE = level
-				rescue ArgumentError
-					# $SAFE=4 was removed from Ruby 2.1.0.
+					$SAFE = 1
 				ensure
 					result = yield
 				end
diff --git a/lib/tdiary/plugin.rb b/lib/tdiary/plugin.rb
index 91e4b07..2762202 100644
--- a/lib/tdiary/plugin.rb
+++ b/lib/tdiary/plugin.rb
@@ -92,7 +92,7 @@ module TDiary
 			end
 		end
 
-		def eval_src( src, secure )
+		def eval_src( src )
 			self.taint
 			@conf.taint
 			@title_procs.taint
@@ -103,7 +103,7 @@ module TDiary
 			@comment_leave_procs.taint
 			@subtitle_procs.taint
 			@section_leave_procs.taint
-			ret = Safe::safe( secure ? 4 : 1 ) do
+			ret = Safe::safe do
 				eval( src, binding, "(TDiary::Plugin#eval_src)", 1 )
 			end
 			@conf.io_class.plugin_close(@storage)
@@ -312,11 +312,7 @@ module TDiary
 		end
 
 		def add_cookie( cookie )
-			begin
-				@cookies << cookie
-			rescue SecurityError
-				raise SecurityError, "can't use cookies in plugin when secure mode"
-			end
+			@cookies << cookie
 		end
 
 		def enable_js( script )
@@ -356,8 +352,8 @@ module TDiary
 			return '' unless str
 			r = str.dup
 			if @conf.options['apply_plugin'] and r.index( '<%' ) then
-				r = r.untaint if $SAFE < 3
-				Safe::safe( @conf.secure ? 4 : 1 ) do
+				r = r.untaint
+				Safe::safe do
 					begin
 						r = ERB::new( r ).result( binding )
 					rescue Exception
diff --git a/lib/tdiary/plugin/00default.rb b/lib/tdiary/plugin/00default.rb
index 0481460..ee89b97 100644
--- a/lib/tdiary/plugin/00default.rb
+++ b/lib/tdiary/plugin/00default.rb
@@ -181,7 +181,7 @@ def calendar
 end
 
 #
-# insert file. only enable unless @secure.
+# insert file
 #
 def insert( file )
 	begin
@@ -195,7 +195,7 @@ end
 # define DOCTYPE
 #
 def doctype
-	%Q[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">]
+	%Q|<!DOCTYPE html>|
 end
 
 #
@@ -204,20 +204,18 @@ end
 add_header_proc do
 	calc_links
 	<<-HEADER
-	<meta http-equiv="Content-Type" content="text/html; charset=#{h charset}">
+	<meta charset="#{h charset}">
 	<meta name="generator" content="tDiary #{h TDIARY_VERSION}">
 	<meta name="viewport" content="width=device-width,initial-scale=1">
-	#{last_modified_header}
-	#{content_script_type}
 	#{author_name_tag}
 	#{author_mail_tag}
 	#{index_page_tag}
 	#{icon_tag}
 	#{default_ogp}
 	#{description_tag}
+	#{css_tag.chomp}
 	#{jquery_tag.chomp}
 	#{script_tag.chomp}
-	#{css_tag.chomp}
 	#{title_tag.chomp}
 	#{robot_control.chomp}
 	HEADER
@@ -265,15 +263,11 @@ def charset
 end
 
 def last_modified_header
-	if @last_modified then
-		%Q|<meta http-equiv="Last-Modified" content="#{CGI::rfc1123_date( @last_modified )}">|
-	else
-		''
-	end
+	''
 end
 
 def content_script_type
-	%Q[<meta http-equiv="Content-Script-Type" content="text/javascript; charset=#{h charset}">]
+	''
 end
 
 def author_name_tag
@@ -358,7 +352,7 @@ def description_tag
 end
 
 def jquery_tag
-	%Q[<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js" type="text/javascript"></script>]
+	%Q[<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>]
 end
 
 enable_js( '00default.js' )
@@ -381,13 +375,13 @@ def script_tag
 	query = script_tag_query_string
 	html = @javascripts.sort.map {|script|
 		if URI(script).scheme or script =~ %r|\A//|
-			%Q|<script src="#{script}" type="text/javascript"></script>|
+			%Q|<script src="#{script}"></script>|
 		else
-			%Q|<script src="#{js_url}/#{script}#{query}" type="text/javascript"></script>|
+			%Q|<script src="#{js_url}/#{script}#{query}"></script>|
 		end
 	}.join( "\n\t" )
 	html << "\n" << <<-HEAD
-		<script type="text/javascript"><!--
+		<script><!--
 		#{@javascript_setting.map{|a| "#{a[0]} = #{a[1]};"}.join("\n\t\t")}
 		//-->
 		</script>
@@ -413,9 +407,8 @@ def css_tag
 	end
 	title = File::basename( css, '.css' )
 	<<-CSS
-<meta http-equiv="content-style-type" content="text/css">
-	<link rel="stylesheet" href="#{h theme_url}/base.css" type="text/css" media="all">
-	<link rel="stylesheet" href="#{h css}" title="#{h title}" type="text/css" media="all">
+<link rel="stylesheet" href="#{h theme_url}/base.css" media="all">
+	<link rel="stylesheet" href="#{h css}" title="#{h title}" media="all">
 	CSS
 end
 
@@ -613,7 +606,7 @@ add_footer_proc do
 	elsif hide_comment_day_limit
 		r = ''
 		r << <<-JS
-			<script type="text/javascript"><!--
+			<script><!--
 			document.getElementById('comment-form-section').innerHTML = '#{comment_form_text.gsub( /[\r\n]/, '' ).gsub( /<\//, '<\\/' )}';
 			//--></script>
 		JS
diff --git a/lib/tdiary/plugin/10spamfilter.rb b/lib/tdiary/plugin/10spamfilter.rb
index e9782c7..2de3ae8 100644
--- a/lib/tdiary/plugin/10spamfilter.rb
+++ b/lib/tdiary/plugin/10spamfilter.rb
@@ -68,12 +68,10 @@ add_conf_proc( 'spamfilter', @spamfilter_label_conf, 'security' ) do
 		  @conf['spamfilter.filter_mode'] = true
 		end
 
-		unless @conf.secure then
-			if @cgi.params['filter.debug_mode'] && @cgi.params['filter.debug_mode'][0]
-				@conf['filter.debug_mode'] = @cgi.params['filter.debug_mode'][0].to_i
-			else
-				@conf['filter.debug_mode'] = 0
-			end
+		if @cgi.params['filter.debug_mode'] && @cgi.params['filter.debug_mode'][0]
+			@conf['filter.debug_mode'] = @cgi.params['filter.debug_mode'][0].to_i
+		else
+			@conf['filter.debug_mode'] = 0
 		end
 
 		if @cgi.params['spamfilter.date_limit'] &&
diff --git a/lib/tdiary/plugin/en/10spamfilter.rb b/lib/tdiary/plugin/en/10spamfilter.rb
index add2caa..cf71038 100644
--- a/lib/tdiary/plugin/en/10spamfilter.rb
+++ b/lib/tdiary/plugin/en/10spamfilter.rb
@@ -44,7 +44,6 @@ def spamfilter_conf_html
 	<p>Show messeges and spam conditions for your subscribers.<br><textarea name="comment_description" cols="70" rows="5">#{h comment_description}</textarea></p>
 	HTML
 
-	unless @conf.secure then
 	r << <<-HTML
 	<h3>for Debug</h3>
 	<p>Debug mode.<br>
@@ -54,7 +53,6 @@ def spamfilter_conf_html
 			<option value="2"#{" selected" if @conf['filter.debug_mode'] == 2}>Full</option>
 		</select></p>
 	HTML
-	end
 
 	r
 end
diff --git a/lib/tdiary/plugin/en/50sp.rb b/lib/tdiary/plugin/en/50sp.rb
index dfea16b..1ee9323 100644
--- a/lib/tdiary/plugin/en/50sp.rb
+++ b/lib/tdiary/plugin/en/50sp.rb
@@ -20,8 +20,6 @@ and add the following line:
 to indicate the directory you have put the optional plugins. It can be
 an absolute path.
 
-You can use this plugin in a secure diary.
-
 == Options
 :@conf.options['sp.path']
 	Directory name where the optional plugins are, relative from the
diff --git a/lib/tdiary/plugin/ja/10spamfilter.rb b/lib/tdiary/plugin/ja/10spamfilter.rb
index 935136c..444c5dd 100644
--- a/lib/tdiary/plugin/ja/10spamfilter.rb
+++ b/lib/tdiary/plugin/ja/10spamfilter.rb
@@ -42,7 +42,6 @@ def spamfilter_conf_html
 	<textarea name="comment_description" cols="70" rows="5">#{h comment_description}</textarea></p>
 	HTML
 
-	unless @conf.secure then
 	r << <<-HTML
 	<h3>フィルタのログ</h3>
 	<p>フィルタのログを
@@ -52,7 +51,6 @@ def spamfilter_conf_html
 			<option value="2"#{" selected" if @conf['filter.debug_mode'] == 2}>すべて記録する</option>
 		</select></p>
 	HTML
-	end
 
 	r
 end
diff --git a/lib/tdiary/plugin/ja/50sp.rb b/lib/tdiary/plugin/ja/50sp.rb
index ab67fe7..20d110f 100644
--- a/lib/tdiary/plugin/ja/50sp.rb
+++ b/lib/tdiary/plugin/ja/50sp.rb
@@ -25,8 +25,6 @@ pluginディレクトリの下にselectableというディレクトリを作っ
 などと、選択できるプラグインのあるディレクトリをtdiary.rbのあるディレク
 トリからの相対パスか絶対パスで指定してください。
 
-secure==trueな日記でも使えます。
-
 == オプション
 :@conf.options['sp.path']
   'plugin/selectable'などと、選択できるプラグインのあるディレクトリを、
diff --git a/lib/tdiary/style/wiki.rb b/lib/tdiary/style/wiki.rb
index 1f123e3..056e802 100644
--- a/lib/tdiary/style/wiki.rb
+++ b/lib/tdiary/style/wiki.rb
@@ -73,11 +73,9 @@ module TDiary
 			def valid_plugin_syntax?(code)
 				lambda {
 					begin
-						$SAFE = 4
-					rescue ArgumentError
-						# $SAFE=4 was removed from Ruby 2.1.0.
+						$SAFE = 1
 					ensure
-						eval( "BEGIN {return true}\n#{code}", nil, "(plugin)", 0 )
+						eval( "BEGIN {return true}\n#{code.dup.untaint}", nil, "(plugin)", 0 )
 					end
 				}.call
 			rescue SyntaxError
diff --git a/misc/paas/heroku/tasks/mongodb.rake b/lib/tdiary/tasks/mongodb.rake
similarity index 100%
rename from misc/paas/heroku/tasks/mongodb.rake
rename to lib/tdiary/tasks/mongodb.rake
diff --git a/lib/tdiary/tasks/release.rake b/lib/tdiary/tasks/release.rake
index 24cb230..130f658 100644
--- a/lib/tdiary/tasks/release.rake
+++ b/lib/tdiary/tasks/release.rake
@@ -48,7 +48,7 @@ def make_tarball( repo, version = nil )
 			end
 
 			Dir.chdir '.bundle/ruby' do
-				versions = %w(2.0.0, 2.1.0, 2.2.0, 2.3.0)
+				versions = %w(2.1.0 2.2.0 2.3.0)
 				current = `ls`.chomp
 				versions.each {|version|
 					FileUtils.cp_r current, version unless current == version
diff --git a/lib/tdiary/tasks/rspec.rake b/lib/tdiary/tasks/rspec.rake
index 2c0d09e..02da79a 100644
--- a/lib/tdiary/tasks/rspec.rake
+++ b/lib/tdiary/tasks/rspec.rake
@@ -20,12 +20,6 @@ if defined? RSpec
 				ENV['TEST_MODE'] = 'webrick'
 				Rake::Task["spec:acceptance"].invoke
 			end
-
-			desc 'Run the code examples in spec/acceptance with secure mode'
-			task :secure do
-				ENV['TEST_MODE'] = 'secure'
-				Rake::Task["spec:acceptance"].invoke
-			end
 		end
 
 		desc 'Displayed code coverage with SimpleCov'
diff --git a/lib/tdiary/version.rb b/lib/tdiary/version.rb
index 241ecca..4d9ae6e 100644
--- a/lib/tdiary/version.rb
+++ b/lib/tdiary/version.rb
@@ -1,3 +1,3 @@
 module TDiary
-	VERSION = '4.2.1'
+	VERSION = '5.0.0'
 end
diff --git a/misc/paas/cloudfoundry/tdiary.conf b/misc/paas/cloudfoundry/tdiary.conf
index faa041a..0dc5e76 100644
--- a/misc/paas/cloudfoundry/tdiary.conf
+++ b/misc/paas/cloudfoundry/tdiary.conf
@@ -83,6 +83,5 @@ FOOTER
 @referer_day_only = true
 @hour_offset = 9
 @show_nyear = true
- at secure = false
 
 load_cgi_conf
diff --git a/misc/paas/heroku/Gemfile.local b/misc/paas/heroku/Gemfile.local
index 1bbfecd..8f6f396 100644
--- a/misc/paas/heroku/Gemfile.local
+++ b/misc/paas/heroku/Gemfile.local
@@ -1,8 +1,11 @@
-ruby '2.2.0'
-gem 'thin', require: false
+ruby '2.3.0'
+gem 'puma', require: false
 gem 'tdiary-io-mongodb', github: 'tdiary/tdiary-io-mongodb'
 gem 'tdiary-contrib', github: 'tdiary/tdiary-contrib'
+gem 'tdiary-style-gfm'
+gem 'tdiary-style-rd'
 gem 'omniauth'
 gem 'omniauth-twitter'
 gem 'dalli'
 gem 'memcachier'
+gem 'octokit'
diff --git a/misc/paas/heroku/Gemfile.lock b/misc/paas/heroku/Gemfile.lock
new file mode 100644
index 0000000..3e3b8a7
--- /dev/null
+++ b/misc/paas/heroku/Gemfile.lock
@@ -0,0 +1,234 @@
+GIT
+  remote: git://github.com/tdiary/tdiary-contrib.git
+  revision: ca551db6757529dd58cfd876d959d441cb46108f
+  specs:
+    tdiary-contrib (4.2.1)
+      ruby-pushbullet
+      tdiary
+
+GIT
+  remote: git://github.com/tdiary/tdiary-io-mongodb.git
+  revision: e19079a329e4eb38a3e3e4848216dfcb028280ff
+  specs:
+    tdiary-io-mongodb (4.2.0.1)
+      hikidoc
+      mongoid (~> 5.0)
+
+GEM
+  remote: https://rubygems.org/
+  specs:
+    activemodel (4.2.6)
+      activesupport (= 4.2.6)
+      builder (~> 3.1)
+    activesupport (4.2.6)
+      i18n (~> 0.7)
+      json (~> 1.7, >= 1.7.7)
+      minitest (~> 5.1)
+      thread_safe (~> 0.3, >= 0.3.4)
+      tzinfo (~> 1.1)
+    addressable (2.3.8)
+    bson (4.0.4)
+    builder (3.2.2)
+    byebug (8.2.2)
+    capybara (2.6.2)
+      addressable
+      mime-types (>= 1.16)
+      nokogiri (>= 1.3.3)
+      rack (>= 1.0.0)
+      rack-test (>= 0.5.4)
+      xpath (~> 2.0)
+    childprocess (0.5.9)
+      ffi (~> 1.0, >= 1.0.11)
+    coderay (1.1.1)
+    concurrent-ruby (1.0.1)
+    coveralls (0.7.12)
+      multi_json (~> 1.10)
+      rest-client (>= 1.6.8, < 2)
+      simplecov (~> 0.9.1)
+      term-ansicolor (~> 1.3)
+      thor (~> 0.19.1)
+    dalli (2.7.6)
+    diff-lcs (1.2.5)
+    docile (1.1.5)
+    domain_name (0.5.20160310)
+      unf (>= 0.0.5, < 1.0.0)
+    emot (0.0.4)
+      thor
+    faraday (0.9.2)
+      multipart-post (>= 1.2, < 3)
+    fastimage (1.9.0)
+      addressable (~> 2.3.5)
+    ffi (1.9.10)
+    github-markdown (0.6.9)
+    hashie (3.4.3)
+    hikidoc (0.1.0)
+    http-cookie (1.0.2)
+      domain_name (~> 0.5)
+    i18n (0.7.0)
+    jasmine (2.4.0)
+      jasmine-core (~> 2.4)
+      phantomjs
+      rack (>= 1.2.1)
+      rake
+    jasmine-core (2.4.1)
+    json (1.8.3)
+    launchy (2.4.3)
+      addressable (~> 2.3)
+    mail (2.6.3)
+      mime-types (>= 1.16, < 3)
+    memcachier (0.0.2)
+    method_source (0.8.2)
+    mime-types (2.99.1)
+    mini_portile2 (2.0.0)
+    minitest (5.8.4)
+    mongo (2.2.4)
+      bson (~> 4.0)
+    mongoid (5.1.1)
+      activemodel (~> 4.0)
+      mongo (~> 2.1)
+      origin (~> 2.2)
+      tzinfo (>= 0.3.37)
+    multi_json (1.11.2)
+    multipart-post (2.0.0)
+    netrc (0.11.0)
+    nokogiri (1.6.7.2)
+      mini_portile2 (~> 2.0.0.rc2)
+    oauth (0.5.1)
+    octokit (4.3.0)
+      sawyer (~> 0.7.0, >= 0.5.3)
+    omniauth (1.3.1)
+      hashie (>= 1.2, < 4)
+      rack (>= 1.0, < 3)
+    omniauth-oauth (1.1.0)
+      oauth
+      omniauth (~> 1.0)
+    omniauth-twitter (1.2.1)
+      json (~> 1.3)
+      omniauth-oauth (~> 1.1)
+    origin (2.2.0)
+    phantomjs (2.1.1.0)
+    pit (0.0.7)
+    power_assert (0.2.7)
+    pry (0.10.3)
+      coderay (~> 1.1.0)
+      method_source (~> 0.8.1)
+      slop (~> 3.4)
+    pry-byebug (3.3.0)
+      byebug (~> 8.0)
+      pry (~> 0.10)
+    puma (3.2.0)
+    rack (1.6.4)
+    rack-test (0.6.3)
+      rack (>= 1.0)
+    racksh (1.0.0)
+      rack (>= 1.0)
+      rack-test (>= 0.5)
+    rake (11.1.1)
+    rdtool (0.6.38)
+    redcarpet (3.3.4)
+    rest-client (1.8.0)
+      http-cookie (>= 1.0.2, < 2.0)
+      mime-types (>= 1.16, < 3.0)
+      netrc (~> 0.7)
+    rouge (1.10.1)
+    rspec (3.4.0)
+      rspec-core (~> 3.4.0)
+      rspec-expectations (~> 3.4.0)
+      rspec-mocks (~> 3.4.0)
+    rspec-core (3.4.4)
+      rspec-support (~> 3.4.0)
+    rspec-expectations (3.4.0)
+      diff-lcs (>= 1.2.0, < 2.0)
+      rspec-support (~> 3.4.0)
+    rspec-mocks (3.4.1)
+      diff-lcs (>= 1.2.0, < 2.0)
+      rspec-support (~> 3.4.0)
+    rspec-support (3.4.1)
+    ruby-pushbullet (0.1.4)
+      json
+      rest-client (~> 1.8.0)
+    rubyzip (1.2.0)
+    sawyer (0.7.0)
+      addressable (>= 2.3.5, < 2.5)
+      faraday (~> 0.8, < 0.10)
+    selenium-webdriver (2.53.0)
+      childprocess (~> 0.5)
+      rubyzip (~> 1.0)
+      websocket (~> 1.0)
+    sequel (4.32.0)
+    simplecov (0.9.2)
+      docile (~> 1.1.0)
+      multi_json (~> 1.0)
+      simplecov-html (~> 0.9.0)
+    simplecov-html (0.9.0)
+    slop (3.6.0)
+    sprockets (3.5.2)
+      concurrent-ruby (~> 1.0)
+      rack (> 1, < 3)
+    sqlite3 (1.3.11)
+    tdiary (4.2.1)
+      bundler (~> 1.3)
+      thor (~> 0.18)
+    tdiary-style-gfm (0.3.0)
+      emot
+      github-markdown
+      rouge
+      twitter-text
+    tdiary-style-rd (0.0.3)
+      rdtool
+    term-ansicolor (1.3.2)
+      tins (~> 1.0)
+    test-unit (3.1.8)
+      power_assert
+    thor (0.19.1)
+    thread_safe (0.3.5)
+    tins (1.9.0)
+    twitter-text (1.13.4)
+      unf (~> 0.1.0)
+    tzinfo (1.2.2)
+      thread_safe (~> 0.1)
+    unf (0.1.4)
+      unf_ext
+    unf_ext (0.0.7.2)
+    websocket (1.2.2)
+    xpath (2.0.0)
+      nokogiri (~> 1.3)
+
+PLATFORMS
+  ruby
+
+DEPENDENCIES
+  capybara
+  coveralls (~> 0.7.12)
+  dalli
+  emot
+  fastimage
+  hikidoc
+  jasmine
+  launchy
+  mail
+  memcachier
+  octokit
+  omniauth
+  omniauth-twitter
+  pit
+  pry-byebug
+  puma
+  rack
+  racksh
+  rake
+  redcarpet
+  rspec
+  selenium-webdriver
+  sequel
+  simplecov
+  sprockets
+  sqlite3
+  tdiary-contrib!
+  tdiary-io-mongodb!
+  tdiary-style-gfm
+  tdiary-style-rd
+  test-unit
+
+BUNDLED WITH
+   1.11.2
diff --git a/misc/paas/heroku/app.json b/misc/paas/heroku/app.json
deleted file mode 100644
index f75ea81..0000000
--- a/misc/paas/heroku/app.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
-  "name": "tDiary",
-  "website": "http://www.tdiary.org/",
-  "repository": "https://github.com/tdiary/tdiary-core/tree/heroku",
-  "addons": [
-    "sendgrid",
-    "memcachier",
-    "mongolab"
-  ],
-  "scripts": {
-    "postdeploy": "bundle exec rake mongodb:index"
-  },
-  "env": {
-    "TWITTER_KEY": "",
-    "TWITTER_SECRET": "",
-	 "TWITTER_NAME": "",
-    "RACK_ENV": "production"
-  }
-}
diff --git a/misc/paas/heroku/config.ru b/misc/paas/heroku/config.ru
deleted file mode 100644
index 52de4de..0000000
--- a/misc/paas/heroku/config.ru
+++ /dev/null
@@ -1,6 +0,0 @@
-$:.unshift( File.join(File::dirname( __FILE__ ), 'lib' ).untaint )
-require 'tdiary/application'
-
-use ::Rack::Reloader unless ENV['RACK_ENV'] == 'production'
-base_dir = '/'
-run TDiary::Application.new( base_dir )
diff --git a/misc/paas/heroku/misc/plugin/system_update.rb b/misc/paas/heroku/misc/plugin/system_update.rb
new file mode 100644
index 0000000..c787220
--- /dev/null
+++ b/misc/paas/heroku/misc/plugin/system_update.rb
@@ -0,0 +1,55 @@
+#
+# system update plugin: automatic update tDiary usging GitHub and Heroku
+#
+# Copyright (C) 2015 by TADA Tadashi <t at tdtds.jp>
+# You can redistribute it and/or modify it under GPL2 or any later version.
+#
+
+def system_update
+	token = @conf['system_update.token'] || ''
+	user  = @conf['system_update.user'] || ''
+	raise StandardError.new('no token or user') if token.empty? || user.empty?
+
+	begin
+		@logger.info 'starting syatem update...'
+		client = Octokit::Client.new(access_token: token)
+		title = "system update on #{Time.now}"
+		body = 'update by system_update plugin'
+		pull_request = client.create_pull_request("#{user}/tdiary-core", 'master', 'tdiary:master', title, body)
+		client.merge_pull_request("#{user}/tdiary-core", pull_request[:number])
+		@logger.info 'syatem update finished'
+	rescue Octokit::UnprocessableEntity
+		@logger.info(@error = 'no commits in upstream')
+	end
+end
+
+add_conf_proc('system_update', 'システム更新', 'basic') do
+	if @mode == 'saveconf' then
+		@conf['system_update.token'] = @cgi.params['system_update.token'][0]
+		@conf['system_update.user']  = @cgi.params['system_update.user'][0]
+
+		begin
+			system_update if @cgi.valid?('system_update.run')
+		rescue
+			@logger.error(@error = $!.message)
+		end
+	end
+
+	r = <<-HTML
+		<h3 class="subtitle">tDiaryシステムの更新</h3>
+		<p>GitHubとHerokuの連携機能を使って、tDaiaryシステムの更新を行います。あらかじめ<a href="https://github.com/tdiary/tdiary-core">tDiaryの公式リポジトリ</a>を自分のアカウントにforkし、そのリポジトリをHerokuのGitHub Deployに指定しておく必要があります。更新はmasterブランチを使って行われます。</p>
+		<p>GitHub access token (40文字): <input type="text" id="system_update.token" name="system_update.token" size="40" value="#{h @conf['system_update.token']}"></p>
+		<p>GitHub user name: <input type="text" id="system_update.user" name="system_update.user" size="20" value="#{h @conf['system_update.user']}"></p>
+		<hr>
+		<p><label for="system_update.run">
+			<input type="checkbox" id="system_update.run" name="system_update.run" value="1">システムを更新する</input> <strong>#{h @error}</strong>
+		</label></p>
+	HTML
+end
+
+# Local Variables:
+# mode: ruby
+# indent-tabs-mode: t
+# tab-width: 3
+# ruby-indent-level: 3
+# End:
diff --git a/misc/paas/heroku/tdiary.conf b/misc/paas/heroku/tdiary.conf
index 552936b..186ade3 100644
--- a/misc/paas/heroku/tdiary.conf
+++ b/misc/paas/heroku/tdiary.conf
@@ -25,7 +25,7 @@ require 'tempfile'
 
 @options['apply_plugin'] = true
 @options['sp.path'] = ['misc/plugin']
- at options['sp.selected'] = %w(amazon.rb append-css.rb calendar2.rb comment_ajax.rb comment_mail-smtp.rb dropdown_calendar.rb footnote.rb highlight.rb html_anchor.rb jdate.rb makerss.rb kw.rb my-ex.rb theme_online.rb ).join("\n")
+ at options['sp.selected'] = %w(amazon.rb append-css.rb calendar2.rb comment_ajax.rb comment_mail-smtp.rb dropdown_calendar.rb footnote.rb highlight.rb html_anchor.rb jdate.rb makerss.rb kw.rb my-ex.rb select-style.rb theme_online.rb ).join("\n")
 
 @options['dropdown_calendar.label'] = ''
 
@@ -77,6 +77,6 @@ FOOTER
 @referer_day_only = true
 @hour_offset = 9
 @show_nyear = true
- at secure = false
 
 load_cgi_conf
+ at style = @options2['style'] if @options2 && @options2['style']
diff --git a/misc/paas/sqale/tdiary.conf b/misc/paas/sqale/tdiary.conf
index fba8ab6..81e3d11 100644
--- a/misc/paas/sqale/tdiary.conf
+++ b/misc/paas/sqale/tdiary.conf
@@ -81,6 +81,5 @@ FOOTER
 @referer_day_only = true
 @hour_offset = 9
 @show_nyear = true
- at secure = false
 
 load_cgi_conf
diff --git a/misc/plugin/amazon.rb b/misc/plugin/amazon.rb
index 9786f18..84baab9 100644
--- a/misc/plugin/amazon.rb
+++ b/misc/plugin/amazon.rb
@@ -124,6 +124,7 @@ def amazon_image( item )
 		end
 		img = item.elements.to_a("#{size}Image")[0] || item.elements.to_a("ImageSets/ImageSet/#{size}Image")[0]
 		image[:src] = img.elements['URL'].text
+		image[:src].gsub!(/http:\/\/ecx\.images-amazon\.com/, 'https://images-na.ssl-images-amazon.com')
 		image[:height] = img.elements['Height'].text
 		image[:width] = img.elements['Width'].text
 	rescue
@@ -225,33 +226,6 @@ def amazon_to_html( item, with_image = true, label = nil, pos = 'amazon' )
 	%Q|<a href="#{h url}">#{img}#{h label}</a>|
 end
 
-def amazon_secure_html( asin, with_image, label, pos, country )
-	with_image = false if @mode == 'categoryview'
-	label = asin unless label
-
-	image = ''
-	if with_image and @conf['amazon.secure-cgi'] then
-		image = <<-HTML
-		<img class="#{h pos}"
-		src="#{h @conf['amazon.secure-cgi']}?asin=#{u asin};size=#{u @conf['amazon.imgsize']};country=#{u country}"
-		alt="">
-		HTML
-	end
-	image.gsub!( /\t/, '' )
-
-	if with_image and @conf['amazon.hidename'] || pos != 'amazon' then
-		label = ''
-	end
-
-	@conf["amazon.aid.#{@amazon_default_country}"] = @conf['amazon.aid'] unless @conf['amazon.aid'].to_s.empty?
-	aid = @conf["amazon.aid.#{country}"] || ''
-	amazon_url = @amazon_url_hash[country]
-	url =  "#{amazon_url}/#{u asin}"
-	url << "/#{u aid}" unless aid.empty?
-	url << "/ref=nosim/"
-	%Q|<a href="#{h url}">#{image}#{h label}</a>|
-end
-
 def amazon_get( asin, with_image = true, label = nil, pos = 'amazon' )
 	asin = asin.to_s.strip # delete white spaces
 	asin.sub!(/\A([a-z]+):/, '')
@@ -264,66 +238,56 @@ def amazon_get( asin, with_image = true, label = nil, pos = 'amazon' )
 		id_type = 'ASIN'
 	end
 
-	if @conf.secure then
-		amazon_secure_html( asin, with_image, label, pos, country )
-	else
+	begin
+		cache = "#{@cache_path}/amazon"
+		Dir::mkdir( cache ) unless File::directory?( cache )
 		begin
-			cache = "#{@cache_path}/amazon"
-			Dir::mkdir( cache ) unless File::directory?( cache )
-			begin
-				xml = File::read( "#{cache}/#{country}#{asin}.xml" )
-			rescue Errno::ENOENT
-				xml =  amazon_call_ecs( asin, id_type, country )
-				File::open( "#{cache}/#{country}#{asin}.xml", 'wb' ) {|f| f.write( xml )}
-			end
-			doc = REXML::Document::new( REXML::Source::new( xml ) ).root
-			item = doc.elements.to_a( '*/Item' )[0]
-			if pos == 'detail' then
-				amazon_detail_html( item )
+			xml = File::read( "#{cache}/#{country}#{asin}.xml" )
+		rescue Errno::ENOENT
+			xml = amazon_call_ecs( asin, id_type, country )
+			File::open( "#{cache}/#{country}#{asin}.xml", 'wb' ) {|f| f.write( xml )}
+		end
+		doc = REXML::Document::new( REXML::Source::new( xml ) ).root
+		item = doc.elements.to_a( '*/Item' )[0]
+		if pos == 'detail' then
+			amazon_detail_html( item )
+		else
+			amazon_to_html( item, with_image, label, pos )
+		end
+	rescue Timeout::Error
+		@logger.error "amazon.rb: Amazon API Timeouted."
+		message = asin
+		if @mode == 'preview' then
+			message << %Q|<span class="message">(Amazon API Timeouted))</span>|
+		end
+		message
+	rescue NoMethodError
+		message = label || asin
+		if @mode == 'preview' then
+			if item == nil then
+				m = doc.elements.to_a( 'Items/Request/Errors/Error/Message' )[0].text
+				message << %Q|<span class="message">(#{h @conf.to_native( m, 'utf-8' )})</span>|
 			else
-				amazon_to_html( item, with_image, label, pos )
-			end
-		rescue Timeout::Error
-			@logger.error "amazon.rb: Amazon API Timeouted."
-			message = asin
-			if @mode == 'preview' then
-				message << %Q|<span class="message">(Amazon API Timeouted))</span>|
-			end
-			message
-		rescue NoMethodError
-			message = label || asin
-			if @mode == 'preview' then
-				if item == nil then
-					m = doc.elements.to_a( 'Items/Request/Errors/Error/Message' )[0].text
-					message << %Q|<span class="message">(#{h @conf.to_native( m, 'utf-8' )})</span>|
-				else
-					message << %Q|<span class="message">(#{h $!}\n#{h $@.join( ' / ' )})</span>|
-				end
+				message << %Q|<span class="message">(#{h $!}\n#{h $@.join( ' / ' )})</span>|
 			end
-			message
 		end
+		message
 	end
 end
 
-unless @conf.secure and not @conf['amazon.secure-cgi'] then
-	add_conf_proc( 'amazon', @amazon_label_conf ) do
-		amazon_conf_proc
-	end
+add_conf_proc( 'amazon', @amazon_label_conf ) do
+	amazon_conf_proc
 end
 
 def amazon_conf_proc
 	if @mode == 'saveconf' then
-		unless @conf.secure and not @conf['amazon.secure-cgi'] then
-			@conf['amazon.imgsize'] = @cgi.params['amazon.imgsize'][0].to_i
-			@conf['amazon.hidename'] = (@cgi.params['amazon.hidename'][0] == 'true')
-			@conf['amazon.bitly'] = (@cgi.params['amazon.bitly'][0] == 'true')
-			unless @conf.secure then
-				@conf['amazon.nodefault'] = (@cgi.params['amazon.nodefault'][0] == 'true')
-				if @cgi.params['amazon.clearcache'][0] == 'true' then
-					Dir["#{@cache_path}/amazon/*"].each do |cache|
-						File::delete( cache.untaint )
-					end
-				end
+		@conf['amazon.imgsize'] = @cgi.params['amazon.imgsize'][0].to_i
+		@conf['amazon.hidename'] = (@cgi.params['amazon.hidename'][0] == 'true')
+		@conf['amazon.bitly'] = (@cgi.params['amazon.bitly'][0] == 'true')
+		@conf['amazon.nodefault'] = (@cgi.params['amazon.nodefault'][0] == 'true')
+		if @cgi.params['amazon.clearcache'][0] == 'true' then
+			Dir["#{@cache_path}/amazon/*"].each do |cache|
+				File::delete( cache.untaint )
 			end
 		end
 		unless @conf['amazon.hideconf'] then
@@ -332,43 +296,41 @@ def amazon_conf_proc
 	end
 
 	result = ''
-	unless @conf.secure and not @conf['amazon.secure-cgi'] then
+
+	result << <<-HTML
+		<h3>#{@amazon_label_imgsize}</h3>
+		<p><select name="amazon.imgsize">
+			<option value="0"#{" selected" if @conf['amazon.imgsize'] == 0}>#{@amazon_label_large}</option>
+			<option value="1"#{" selected" if @conf['amazon.imgsize'] == 1}>#{@amazon_label_regular}</option>
+			<option value="2"#{" selected" if @conf['amazon.imgsize'] == 2}>#{@amazon_label_small}</option>
+		</select></p>
+		<h3>#{@amazon_label_title}</h3>
+		<p><select name="amazon.hidename">
+			<option value="true"#{" selected" if @conf['amazon.hidename']}>#{@amazon_label_hide}</option>
+			<option value="false"#{" selected" unless @conf['amazon.hidename']}>#{@amazon_label_show}</option>
+		</select></p>
+	HTML
+
+	if @options['bitly.login'] and @options['bitly.key'] then
 		result << <<-HTML
-			<h3>#{@amazon_label_imgsize}</h3>
-			<p><select name="amazon.imgsize">
-				<option value="0"#{" selected" if @conf['amazon.imgsize'] == 0}>#{@amazon_label_large}</option>
-				<option value="1"#{" selected" if @conf['amazon.imgsize'] == 1}>#{@amazon_label_regular}</option>
-				<option value="2"#{" selected" if @conf['amazon.imgsize'] == 2}>#{@amazon_label_small}</option>
-			</select></p>
-			<h3>#{@amazon_label_title}</h3>
-			<p><select name="amazon.hidename">
-				<option value="true"#{" selected" if @conf['amazon.hidename']}>#{@amazon_label_hide}</option>
-				<option value="false"#{" selected" unless @conf['amazon.hidename']}>#{@amazon_label_show}</option>
+			<h3>#{@amazon_label_bitly}</h3>
+			<p><select name="amazon.bitly">
+				<option value="true"#{" selected" if @conf['amazon.bitly']}>#{@amazon_label_bitly_enabled}</option>
+				<option value="false"#{" selected" unless @conf['amazon.bitly']}>#{@amazon_label_bitly_disabled}</option>
 			</select></p>
 		HTML
+	end
 
-		if @options['bitly.login'] and @options['bitly.key'] then
-			result << <<-HTML
-				<h3>#{@amazon_label_bitly}</h3>
-				<p><select name="amazon.bitly">
-					<option value="true"#{" selected" if @conf['amazon.bitly']}>#{@amazon_label_bitly_enabled}</option>
-					<option value="false"#{" selected" unless @conf['amazon.bitly']}>#{@amazon_label_bitly_disabled}</option>
-				</select></p>
-			HTML
-		end
+	result << <<-HTML
+		<h3>#{@amazon_label_notfound}</h3>
+		<p><select name="amazon.nodefault">
+			<option value="true"#{" selected" if @conf['amazon.nodefault']}>#{@amazon_label_usetitle}</option>
+			<option value="false"#{" selected" unless @conf['amazon.nodefault']}>#{@amazon_label_usedefault}</option>
+		</select></p>
+		<h3>#{@amazon_label_clearcache}</h3>
+		<p><label for="amazon.clearcache"><input type="checkbox" id="amazon.clearcache" name="amazon.clearcache" value="true">#{@amazon_label_clearcache_desc}</label></p>
+	HTML
 
-		unless @conf.secure then
-			result << <<-HTML
-				<h3>#{@amazon_label_notfound}</h3>
-				<p><select name="amazon.nodefault">
-					<option value="true"#{" selected" if @conf['amazon.nodefault']}>#{@amazon_label_usetitle}</option>
-					<option value="false"#{" selected" unless @conf['amazon.nodefault']}>#{@amazon_label_usedefault}</option>
-				</select></p>
-				<h3>#{@amazon_label_clearcache}</h3>
-				<p><label for="amazon.clearcache"><input type="checkbox" id="amazon.clearcache" name="amazon.clearcache" value="true">#{@amazon_label_clearcache_desc}</label></p>
-			HTML
-		end
-	end
 	unless @conf['amazon.hideconf'] then
 		result << <<-HTML
 			<h3>#{@amazon_label_aid}</h3>
diff --git a/misc/plugin/amazon/README.en b/misc/plugin/amazon/README.en
deleted file mode 100644
index b6c1641..0000000
--- a/misc/plugin/amazon/README.en
+++ /dev/null
@@ -1,17 +0,0 @@
-amazonimg.rb
-
-This CGI script is getting image URLs of items in Amazon by ASIN.
-On tDiary running on secure mode, you cannot use amazon.rb plugin.
-But if use this script, you can get images.
-
-How to use:
-
-* modify settings of amazonimg.rb. see header of this script.
-   * You MUST set @cache_path. Make executable by Web server.
-   * If you have Amazon Associate ID, set @amazon_aid.
-   * and see comments other variables.
-
-* Copy amazonimg.rb under place to be able to run by CGI.
-
-* add script URL to @options['amazon.secure-cgi'] in your tdiary.conf
-  it running on secure mode (@secure = true).
diff --git a/misc/plugin/amazon/README.ja b/misc/plugin/amazon/README.ja
deleted file mode 100644
index 340c03e..0000000
--- a/misc/plugin/amazon/README.ja
+++ /dev/null
@@ -1,29 +0,0 @@
-amazonimg.rb
-
-セキュアモードでは、isbnプラグインしか使えないamazon.rbですが、
-以下の条件を満たした場合にはisbn_image系プラグインを使えるように
-なります。
-
-  * 第二引数の「label」を常に指定する
-  * tdiary.confの@options['amazon.secure-cgi']を指定する
-
-2番目のamazon.secure-cgiに指定するためのCGIスクリプトが、この
-amazonimg.rbです。amazonimg.rbは、指定されたASINを元に書影のURLを
-取得してリダイレクトするスクリプトです。amazon.rbはamazonimg.rbへ
-のURLをimgタグに埋め込むことで、日記に書影を埋め込みます。
-
-使い方は以下の通りです:
-
-  * amazonimg.rbの冒頭部分にある各種設定を、環境に合わせて変更します
-     * 特に@cache_pathは必須です。Webサーバから書き込める権限に
-       したディレクトリを指定します
-     * Amazonアソシエイトを契約している場合には、@amazon_aidも指定し
-       てください
-     * そのほかの設定はコメントを参照してください
-
-  * amazonimg.rbをCGIとして実行できる場所にコピーし、Webサーバから実
-    行可能にします
-
-  * セキュアモードで運営しているtDiaryのtdiary.confに、上で設置した
-    amazonimg.rbを示すURLを@options['amazon.secure-cgi']に指定します
-
diff --git a/misc/plugin/amazon/amazonimg.rb b/misc/plugin/amazon/amazonimg.rb
deleted file mode 100755
index a774d42..0000000
--- a/misc/plugin/amazon/amazonimg.rb
+++ /dev/null
@@ -1,113 +0,0 @@
-#!/usr/bin/env ruby
-
-# amazonimg.rb : CGI script for tDiary amazon plugin in secure mode.
-#
-# set URL of this script to @options['amazon.secure-cgi'] into tdiary.conf.
-#
-# Copyright (C) 2005 TADA Tadashi <sho at spc.gr.jp>
-# You can redistribute it and/or modify it under GPL2 or any later version.
-#
-
-### modify settings below ###
- at cache_path = 'SPECIFY YOUR CACHE PATH'  # directory for saving cache files
- at proxy = nil                             # URL of HTTP proxy server if you need
- at amazon_aid = 'cshs-22'                  # Amazon Association ID
- at amazon_url = 'http://www.amazon.co.jp/exec/obidos/ASIN'
-                                         # URL of items in amazon
- at amazon_ecs_url = 'http://honnomemo.appspot.com/rpaproxy/jp/'
-                                         # URL of Amazon ECS service
-#############################
-
-#--- for test settings ---
-#@cache_path = '/tmp/amazon_test_cache'
-#@proxy = 'http://localhost:10080'
-#-------------------------
-
-### do not change these variables ###
- at amazon_subscription_id = '1CVA98NEF1G753PFESR2'
- at amazon_require_version = '2005-07-26'
-#####################################
-
- at amazon_url_hash = {
-  'us' => 'http://www.amazon.com/exec/obidos/ASIN',
-  'jp' => 'http://www.amazon.co.jp/exec/obidos/ASIN',
-  'fr' => 'http://www.amazon.fr/exec/obidos/ASIN',
-  'uk' => 'http://www.amazon.co.uk/exec/obidos/ASIN',
-  'de' => 'http://www.amazon.de/exec/obidos/ASIN',
-  'ca' => 'http://www.amazon.ca/exec/obidos/ASIN',
-  nil   => @amazon_url
-}
-
- at amazon_ecs_url_hash = {
-  'us' => 'http://honnomemo.appspot.com/rpaproxy/us/',
-  'jp' => 'http://honnomemo.appspot.com/rpaproxy/jp/',
-  'fr' => 'http://honnomemo.appspot.com/rpaproxy/fr/',
-  'uk' => 'http://honnomemo.appspot.com/rpaproxy/uk/',
-  'de' => 'http://honnomemo.appspot.com/rpaproxy/de/',
-  'ca' => 'http://honnomemo.appspot.com/rpaproxy/ca/',
-  nil   => @amazon_ecs_url
-}
-
-require 'cgi'
-require 'open-uri'
-require 'timeout'
-autoload :REXML, 'rexml/document'
-
-def amazon_call_ecs( asin, country = nil )
-	aid = @amazon_aid || 'cshs-22'
-
-	url =  @amazon_ecs_url_hash[country].dup
-	url << "?Service=AWSECommerceService"
-	url << "&SubscriptionId=#{@amazon_subscription_id}"
-	url << "&AssociateTag=#{aid}"
-	url << "&Operation=ItemLookup"
-	url << "&ItemId=#{asin}"
-	url << "&ResponseGroup=Medium"
-	url << "&Version=#{@amazon_require_version}"
-
-	Timeout::timeout( 10 ) do
-		open( url, proxy: @proxy ) {|f| f.read}
-	end
-end
-
-def amazon_redirect( cgi, asin, size, country = nil )
-	begin
-		xml = File::read( "#{@cache_path}/#{country}#{asin}.xml" )
-	rescue Errno::ENOENT
-		xml =  amazon_call_ecs( asin, country )
-		Dir::mkdir( @cache_path ) unless File::directory?( @cache_path )
-		File::open( "#{@cache_path}/#{country}#{asin}.xml", 'wb' ) {|f| f.write( xml )}
-	end
-	doc = REXML::Document::new( xml ).root
-	item = doc.elements.to_a( '*/Item' )[0]
-	s = case size
-		when 0; 'Large'
-		when 2; 'Small'
-		else  ; 'Medium'
-	end
-	begin
-		img_url = item.elements.to_a( "#{s}Image/URL" )[0].text
-	rescue
-		img_url = "http://www.tdiary.org/images/amazondefaults/#{s.downcase}.png"
-	end
-	print cgi.header( {'Location' => img_url} )
-end
-
-cgi = CGI::new
-asin, = cgi.params['asin']
-size, = cgi.params['size']
-country, = cgi.params['country']
-if asin && /\A[0-9A-Z]{10}\z/ =~ asin then
-	size = '1' if !size or size.length == 0
-	country = nil unless /\A[a-z]+\z/ =~ country
-	amazon_redirect( cgi, asin.untaint, size.to_i, country.untaint )
-else
-	puts "Content-Type: text/plain\n\nBAD REQUEST\nasin:#{CGI::escapeHTML(asin)}\nsize:#{CGI::escapeHTML(size)}"
-end
-
-# Local Variables:
-# mode: ruby
-# indent-tabs-mode: t
-# tab-width: 3
-# ruby-indent-level: 3
-# End:
diff --git a/misc/plugin/amazon/large.png b/misc/plugin/amazon/large.png
deleted file mode 100644
index d38c2f9..0000000
Binary files a/misc/plugin/amazon/large.png and /dev/null differ
diff --git a/misc/plugin/amazon/medium.png b/misc/plugin/amazon/medium.png
deleted file mode 100644
index 5cbd17d..0000000
Binary files a/misc/plugin/amazon/medium.png and /dev/null differ
diff --git a/misc/plugin/amazon/small.png b/misc/plugin/amazon/small.png
deleted file mode 100644
index 7308207..0000000
Binary files a/misc/plugin/amazon/small.png and /dev/null differ
diff --git a/misc/plugin/calendar2.rb b/misc/plugin/calendar2.rb
index 76dda5f..45f4d08 100644
--- a/misc/plugin/calendar2.rb
+++ b/misc/plugin/calendar2.rb
@@ -10,7 +10,7 @@
 #
 #   options:
 #     calendar2.show_image: true or false. show a image that makes by image.rb
-#                  on each date. default is falase, and use only non secure mode.
+#                  on each date. default is falase.
 #                  and if you want to change image size, add CSS to your theme.
 #                  for example (25x25 pixel image):
 #
@@ -105,7 +105,7 @@ def calendar2(days_format = nil, navi_format = nil, show_todo = nil)
 	p_c_n = calendar2_prev_current_next
 
 	result = <<CALENDAR_HEAD
-<table class="calendar" summary="calendar">
+<table class="calendar" title="calendar">
 <tr>
  <td class="image" colspan="7"></td>
 </tr>
@@ -160,7 +160,7 @@ CALENDAR_HEAD
 							subtitles << h( %Q|#{idx}. #{@conf.shorten(apply_plugin( text, true ))}| )
 							idx.succ!
 						end
-						day_img = ((@calendar2_show_image and !@conf.secure) ? calender2_make_image(@diaries[date], date) : day.to_s)
+						day_img = ((@calendar2_show_image) ? calender2_make_image(@diaries[date], date) : day.to_s)
 						day_img = day.to_s if day_img == nil
             %Q|<a href="#{h @index}#{anchor date}" title="#{subtitles.join("
")}">#{day_img}</a>|
 					end
diff --git a/misc/plugin/category.rb b/misc/plugin/category-legacy.rb
similarity index 99%
copy from misc/plugin/category.rb
copy to misc/plugin/category-legacy.rb
index b25b063..bd5d791 100644
--- a/misc/plugin/category.rb
+++ b/misc/plugin/category-legacy.rb
@@ -1,4 +1,6 @@
-# category.rb
+#
+# category-legacy.rb : tDiary plugin for show category pages
+#                      legacy version for ruby 2.0 or later
 #
 # Copyright (c) 2003 Junichiro KITA <kita at kitaj.no-ip.com>
 # Distributed under the GPL2 or any later version.
diff --git a/misc/plugin/category.rb b/misc/plugin/category.rb
index b25b063..c730e39 100644
--- a/misc/plugin/category.rb
+++ b/misc/plugin/category.rb
@@ -1,736 +1,229 @@
-# category.rb
 #
-# Copyright (c) 2003 Junichiro KITA <kita at kitaj.no-ip.com>
-# Distributed under the GPL2 or any later version.
-#
-
+# category.rb : tDiary plugin for show category pages
 #
-# initialize
+# Copyright (C) 2016 TADA Tadashi
+# Distributed under the GPL2 or any later version.
 #
-def category_init
-	@conf['category.header1'] ||= %Q[<div class="adminmenu">\n<p>\n<%= category_navi %>\n</p>\n</div>\n]
-	@conf['category.header2'] ||= %Q[<p>Categories |\n<%= category_list %>\n</p>\n]
-	@conf['category.edit_support'] = @conf['category.edit_support'].to_i rescue 1
-end
-category_init
-
-def category_icon_location_init
-	@category_icon_dir = (@conf['category.icon_dir'] || './icons/').sub(%r|/*$|, '/')
-	@category_icon_url = (@conf['category.icon_url'] || './icons/').sub(%r|/*$|, '/')
-end
-
-def category_icon_init
-	category_icon_location_init
-	@conf['category.icon'] ||= ''
 
-	@category_icon = {}
-	@conf['category.icon'].split(/\n/).each do |l|
-		c, i = l.split
-		next if c.nil? or i.nil?
-		@category_icon[c] = i if File.exist?("#{@category_icon_dir}#{i}".untaint)
-	end
-end
-category_icon_init
 
-#
-# plugin methods
-#
-def category_form
-	# don't you need this method any more?
-end
+# read cache here so that you can use category with secure mode.
+ at conf['category.header1'] = ''
+ at conf['category.header2'] = '<%= category_dropdown_list %>'
+ at category_icon = {}
+ at categories = transaction('category'){|db|db.keys}.sort_by{|c|c.downcase}
 
-def category_anchor(category)
-	period = @conf['category.period'] || 'quarter'
-	period_string =
-		case period
-		when "month"
-			"year=#{@date.year};month=#{'%02d' % @date.month};"
-		when "quarter"
-			"year=#{@date.year};month=#{(@date.month - 1) / 3 + 1}Q;"
-		when "half"
-			"year=#{@date.year};month=#{(@date.month - 1) / 6 + 1}H;"
-		when "year"
-			"year=#{@date.year};"
-		else
-			""
+module Category
+	class Info
+		def initialize(cgi, _, conf)
+			@cgi, @conf = cgi, conf
 		end
-	if @category_icon[category]
-		%Q|<a href="#{h @index}?#{period_string}category=#{u category}" title="#{h category}"><img class="category" src="#{h @category_icon_url}#{h @category_icon[category]}" alt="#{h category}"></a>|
-	else
-		%Q|[<a href="#{h @index}?#{period_string}category=#{u category}" title="#{h category}">#{h category}</a>]|
-	end
-end
 
-def category_navi_anchor(info, label)
-	((!label.nil?) && label.empty?) ? '' : %Q[<span class="adminmenu">#{info.make_anchor(label)}</span>\n]
-end
-
-def category_navi
-	info = Category::Info.new(@cgi, @years, @conf)
-	mode = info.mode
-
-	result = ''
-	case mode
-	when :year, :half, :quarter, :month
-		all_diary = Category::Info.new(@cgi, @years, @conf, year: -1, month: -1)
-		all = Category::Info.new(@cgi, @years, @conf, category: ['ALL'], year: -1, month: -1)
-		result << category_navi_anchor(info.prev, @conf['category.prev_' + mode.to_s])
-		result << category_navi_anchor(info.next, @conf['category.next_' + mode.to_s])
-		result << category_navi_anchor(all_diary, @conf['category.all_diary'])
-		result << category_navi_anchor(all, @conf['category.all'])
-	when :all
-		year = Category::Info.new(@cgi, @years, @conf, year: Time.now.year.to_s)
-		half = Category::Info.new(@cgi, @years, @conf, year: Time.now.year.to_s, month: "#{((Time.now.month - 1) / 6 + 1)}H")
-		quarter = Category::Info.new(@cgi, @years, @conf, year: Time.now.year.to_s, month: "#{((Time.now.month - 1) / 3 + 1)}Q")
-		month = Category::Info.new(@cgi, @years, @conf, year: Time.now.year.to_s, month: '%02d' % Time.now.month)
-		result << category_navi_anchor(year, @conf['category.this_year'])
-		result << category_navi_anchor(half, @conf['category.this_half'])
-		result << category_navi_anchor(quarter, @conf['category.this_quarter'])
-		result << category_navi_anchor(month, @conf['category.this_month'])
-	end
-	if !info.category.include?('ALL') then
-		all_category = Category::Info.new(@cgi, @years, @conf, category: ['ALL'])
-		result << category_navi_anchor(all_category, @conf['category.all_category'])
-	end
-	result
-end
-
-def category_list_sections
-	info = Category::Info.new(@cgi, @years, @conf)
-	r = ''
-
-	raise ::TDiary::NotFound if @categorized.empty? and bot?
-
-	@categorized.to_a.sort_by{|e| e[0].downcase}.each do |c, v|
-		info.category = [c]
-		if @category_icon[c]
-			img = %Q|<img class="category" src="#{h @category_icon_url}#{h @category_icon[c]}" alt="#{h c}">|
-		else
-			img = ''
+		def category
+			@name || (@name = @conf.to_native(@cgi.params['category'][0], @conf.encoding_old))
 		end
-		r << <<HTML
-<div class="category day">
-	<h2><span class="title">#{img}#{info.make_anchor}</span></h2>
-	<div class="body">
-		<ul class="category">
-HTML
-		v.to_a.sort_by{|e| e[0]}.each do |ymd, ary|
-			text = Time.local(ymd[0,4], ymd[4,2], ymd[6,2]).strftime(@conf.date_format)
-			ary.sort.each do |idx, title, excerpt|
-				r << %Q|\t\t\t<li><a href="#{h @index}#{anchor "#{ymd}#p#{'%02d' % idx}"}" title="#{h excerpt}">#{text}#p#{'%02d' % idx}</a> #{apply_plugin(title)}</li>\n|
-			end
-		end
-		r << <<HTML
-		</ul>
-	</div>
-</div>
-HTML
 	end
-	r
 end
 
-def category_list_sections_mobile
-	info = Category::Info.new(@cgi, @years, @conf)
-	r = ''
-
-	raise ::TDiary::NotFound if @categorized.empty? and bot?
-
-	@categorized.to_a.sort_by{|e| e[0].downcase}.each do |c, v|
-		info.category = [c]
-		r << "<H2>#{info.make_anchor}</H2>"
-		r << "<UL>"
-		v.to_a.sort_by{|e| e[0]}.each do |ymd, ary|
-			text = Time.local(ymd[0,4], ymd[4,2], ymd[6,2]).strftime(@conf.date_format)
-			ary.sort.each do |idx, title, excerpt|
-				r << %Q|<LI><A HREF="#{h @index}#{anchor "#{ymd}#p#{'%02d' % idx}"}">#{text}#p#{'%02d' % idx}</A> #{apply_plugin(title)}</LI>\n|
-			end
-		end
-		r << "</UL>"
-	end
-	r
+def category_title
+	info = Category::Info.new(@cgi, nil, @conf)
+	"[#{info.category}]"
 end
 
-def category_list
-	info = Category::Info.new(@cgi, @years, @conf)
-	@categories.map do |c|
-		info.category = [c]
-		info.make_anchor
-	end.join(" | \n")
+def category_anchor(category)
+	%Q|[<a href="#{h @index}?category=#{u category}" title="#{h category}">#{h category}</a>]|
 end
 
-def category_dropdown_list(label = nil, multiple = nil)
-	label ||= 'Categorize!'
-	multiple ||= false
+def category_dropdown_list(label = nil, _ = nil)
+	label ||= 'show category list'
 
-	info = Category::Info.new(@cgi, @years, @conf)
+	info = Category::Info.new(@cgi, _, @conf)
 	category = info.category
-	if category.empty?
-		category = ['ALL']
-	end
+	category = [] if category.empty?
 
 	options = ''
-	(['ALL'] + @categories).each do |c|
-		options << %Q|\t\t<option value="#{h c}"#{" selected" if category.include?(c)}>#{h c}</option>\n|
+	@categories.each do |c|
+		options << %Q|<option value="#{h c}"#{" selected" if category.include?(c)}>#{h c}</option>\n|
 	end
 
-	params = ''
-	params << %Q[<input type="hidden" name="year" value="#{h info.year}">] if info.year
-	params << %Q[<input type="hidden" name="month" value="#{h info.month}">] if info.month
-
-	<<HTML
-<form method="get" action="#{h @index}"><div>
-	<select name="category"#{" multiple" if multiple}>
-#{options}
-	</select>
-	#{params}
-	<input type="submit" value="#{label}">
-</div></form>
-HTML
+	<<-HTML
+		<form method="get" action="#{h @index}"><div>
+			<select name="category">
+		#{options}
+			</select>
+			<input type="submit" value="#{label}">
+		</div></form>
+	HTML
 end
 
-
-#
-# misc
-#
-
-def category_icon_save
-	@conf['category.icon'] = @category_icon.map {|c, i| "#{c} #{i}"}.join("\n")
-end
-
-
-module Category
-
-#
-# Info
-#
-class Info
-	include ERB::Util
-
-	def initialize(cgi, years, conf, args = {})
-		@cgi = cgi
-		@years = years
-		@conf = conf
-		@category = args[:category] || @cgi.params['category'].map do |c|
-			@conf.to_native(c, @conf.encoding_old)
-		end
-		@year = args[:year] || @cgi.params['year'][0]
-		@month = args[:month] || @cgi.params['month'][0]
-		@mode = :all
-		set_mode
-	end
-
-protected
-	attr_writer :year
-	attr_writer :month
-public
-	attr :category, true
-	attr_reader :year
-	attr_reader :month
-	attr_reader :mode
-
-	def prev
-		pp = self.dup
-
-		case mode
-		when :half
-			h = @month.to_i
-			if h == 1
-				pp.month = "2H"
-				pp.year = (@year.to_i - 1).to_s if @year
-			else
-				pp.month = "1H"
-			end
-		when :quarter
-			q = @month.to_i
-			if q == 1
-				pp.month = "4Q"
-				pp.year = (@year.to_i - 1).to_s if @year
-			else
-				pp.month = "#{q - 1}Q"
-			end
-		when :month
-			m = @month.to_i
-			if m == 1
-				pp.month = "12"
-				pp.year = (@year.to_i - 1).to_s if @year
-			else
-				pp.month = '%02d' % (m - 1)
-			end
-		when :year
-			pp.year = (@year.to_i - 1).to_s
-		end
-		pp
-	end
-
-	def next
-		pp = self.dup
-
-		case mode
-		when :half
-			h = @month.to_i
-			if h == 2
-				pp.month = "1H"
-				pp.year = (@year.to_i + 1).to_s if @year
-			else
-				pp.month = "2H"
-			end
-		when :quarter
-			q = @month.to_i
-			if q == 4
-				pp.month = "1Q"
-				pp.year = (@year.to_i + 1).to_s if @year
-			else
-				pp.month = "#{q + 1}Q"
-			end
-		when :month
-			m = @month.to_i
-			if m == 12
-				pp.month = "01"
-				pp.year = (@year.to_i + 1).to_s if @year
-			else
-				pp.month = '%02d' % (m + 1)
+def category_transaction(categories)
+	transaction('category') do |db|
+		(categories || db.keys).each do |category|
+			Hash[*JSON.load(db.get(category) || '{}').sort_by{|d,_|d}.flatten(1)].each do |ymd, diaries|
+				yield db, category, ymd, diaries
 			end
-		when :year
-			pp.year = (@year.to_i + 1).to_s
 		end
-		pp
-	end
-
-	def make_anchor(label = nil)
-		a = @category.map {|c| "category=#{u c}"}.join(';')
-		a << ";year=#{@year}" if @year
-		a << ";month=#{@month}" if @month
-		if label
-			case mode
-			when :year
-				label = label.gsub(/\$1/, @year)
-			when :month, :quarter, :half
-				label = label.gsub(/\$2/, @month)
-				label = label.gsub(/\$1/, @year || '*')
-			end
-		else
-			label = @category.to_a.join(':')
-		end
-		%Q|<a href="#{h @conf.index}?#{h a}">#{h label}</a>|
-	end
-
-	#
-	# return ym_spec
-	#
-	# {"yyyy" => ["mm", ...], ...}
-	#
-	# date spec:
-	#  (1) none               -> all diary
-	#  (2) month=xH           -> all diary in xH of all year
-	#  (3) year=YYYY;month=xH -> all diary in YYYY/xH
-	#  (4) month=xQ           -> all diary in xQ of all year
-	#  (5) year=YYYY;month=xQ -> all diary in YYYY/xQ
-	#  (6) month=MM           -> all diary in MM of all year
-	#  (7) year=YYYY;month=MM -> all diary in YYYY/MM
-	#  (8) year=YYYY          -> all diary in YYYY
-	#
-	def years
-		if @mode == :all
-			return @years
-		end
-
-		months = case @mode
-		when :half
-			[('01'..'06'), ('07'..'12')][@month.to_i - 1].to_a
-		when :quarter
-			[['01', '02', '03'], ['04', '05', '06'], ['07', '08', '09'], ['10', '11', '12']][@month.to_i - 1]
-		when :month
-			[@month]
-		else
-			('01'..'12').to_a
-		end
-
-		r = {}
-		(@year ? [@year] : @years.keys).each do |y|
-			r[y] = months
-		end
-		r
-	end
-
-	#
-	# date spec:
-	#  (1) none                -> all
-	#  (2) month=xH            -> half
-	#  (3) year=YYYY;month=xH  -> half
-	#  (4) month=xQ            -> quarter
-	#  (5) year=YYYY;month=xQ  -> quarter
-	#  (6) month=MM            -> month
-	#  (7) year=YYYY;month=MM  -> month
-	#  (8) year=YYYY           -> year
-	#
-	def set_mode
-		if @year.nil? and @month.nil?
-			@mode = :all
-		end
-
-		if /\d{4}/ === @year.to_s
-			@mode = :year
-		else
-			@year = nil
-		end
-
-		if /[12]H/ === @month.to_s
-			@mode = :half
-		elsif /[1-4]Q/ === @month.to_s
-			@mode = :quarter
-		elsif (1..12).include?(@month.to_i)
-			@mode = :month
-		else
-			@month = nil
-		end
-
 	end
 end
 
-#
-# Cache
-#
-class Cache
-	include ERB::Util
-
-	def initialize(conf, bind)
-		@conf = conf
-		@binding = bind                           # ...... very ugly
-		@plugin = @binding.eval('self')
-		@categories = nil
-	end
-
-	def get(db, cat)
-		JSON.load(db.get(cat) || '{}')
-	end
-
-	def set(db, cat, data)
-		db.set(cat, data.to_json)
-	end
-
-	def add_categories(list)
-		return if list.nil? or list.empty?
-		replace_categories(restore_categories + list)
-	end
-
-	def replace_categories(list)
-		@categories = list
-	end
-
-	def restore_categories
-		return @categories if @categories
-		@plugin.__send__(:transaction, 'category') do |db|
-			@categories = db.keys
-		end
-		return @categories
-	end
-
-	#
-	# cache each section of diary
-	# used in update_proc
-	#
-	def replace_sections(diary)
-		return if diary.nil? or !diary.categorizable?
-
-		categorized = categorize_diary(diary)
-		categories = restore_categories
-		deleted = []
-		ymd = diary.date.strftime('%Y%m%d')
+def category_list_sections
+	info = Category::Info.new(@cgi, nil, @conf)
 
-		@plugin.__send__(:transaction, 'category') do |db|
-			categories.each do |c|
-				cat = get(db, c) || {}
-				if diary.visible? and categorized[c]
-					cat.update(categorized[c])
-					set(db, c, cat)
-				else
-					# diary is invisible or sections of this category is deleted
-					cat.delete(ymd)
-					if cat.empty?
-						db.delete(c)
-						deleted << c
-					else
-						set(db, c, cat)
+	r = ''
+	r << <<-HTML
+		<div class="category day">
+			<h2>
+				<span class="title">
+					<a href="#{h @conf.index}?category=#{u info.category}">#{h info.category}</a>
+				</span>
+			</h2>
+			<div class="body">
+				<ul class="category">
+	HTML
+	category_transaction([info.category]) do |db, category, ymd, diaries|
+		date = Time.local(*ymd.scan(/(.{4})(..)(..)/)[0]).strftime(@conf.date_format)
+		diaries.sort_by{|i|i[0]}.each do |idx, title, excerpt|
+			r << <<-HTML
+				<li>
+					<a href="#{h @index}#{anchor "#{ymd}#p#{'%02d' % idx}"}" title="#{h excerpt}">
+						#{date}#p#{'%02d' % idx}
+					</a>
+					#{apply_plugin(title)}
+				</li>
+			HTML
+		end
+	end
+	r << <<-HTML
+				</ul>
+			</div>
+		</div>
+	HTML
+	return r
+end
+
+def category_serialize(diary)
+	data = {}
+	ymd = diary.date.strftime('%Y%m%d')
+
+	idx = 1
+	diary.each_section do |s|
+		s.categories.each do |c|
+			data[c] ||= {}
+			data[c][ymd] ||= []
+			body = <<-EVAL.gsub(/^\t+/, '')
+				text = apply_plugin(<<'BODY', true)
+				#{s.body_to_html}
+				BODY
+			EVAL
+			shorten = begin
+				@conf.shorten(eval(body.untaint))
+			rescue NameError
+				""
+			end
+			data[c][ymd] << [idx, s.stripped_subtitle_to_html, shorten]
+		end
+		idx +=1
+	end
+	data
+end
+
+def category_rebuild(years)
+	transaction('category') do |db|
+		cache = Hash.new{{}}
+		@years.each do |y, ms|
+			ms.each do |m|
+				m = DiaryContainer::find_by_month(@conf, "#{y}#{m}")
+				m.diaries.each do |ymd, diary|
+					next if !diary.visible? or !diary.categorizable?
+					serialize = category_serialize(diary)
+					serialize.keys.each do |category|
+						cache[category] = cache[category].merge!(serialize[category])
 					end
 				end
 			end
-
-			if !deleted.empty?
-				replace_categories(categories - deleted)
-			end
 		end
-	end
-
-	#
-	# (re)create category cache
-	#
-	def recreate(years)
-		list = []
-		@plugin.__send__(:transaction, 'category') do |db|
-			db.keys.each {|key|db.delete(key)}
-
-			years.each do |y, ms|
-				ms.each do |m|
-					m = DiaryContainer::find_by_month(@conf, "#{y}#{m}")
-					m.diaries.each do |ymd, diary|
-						next if !diary.visible? or !diary.categorizable?
-						categorized = categorize_diary(diary)
-						categorized.keys.each do |c|
-							cat = get(db, c) || {}
-							set(db, c, cat.update(categorized[c]))
-						end
-						diary.each_section do |s|
-							list |= s.categories unless s.categories.empty?
-						end
-					end
-				end
-			end
+		db.keys.each {|key| db.delete(key)}
+		cache.each do |category, diaries|
+			db.set(category, diaries.to_json)
 		end
-
-		replace_categories(list)
 	end
+end
 
-	#
-	# categorize sections of category of years
-	#
-	# {"category" => {"yyyymmdd" => [[idx, title, excerpt], ...], ...}, ...}
-	#
-	def categorize(category, years)
-		categories = category - ['ALL']
-		if categories.empty?
-			categories = restore_categories
-		else
-			categories &= restore_categories
-		end
-
-		categorized = {}
-		begin
-			categorized.clear
-			categories.each do |c|
-				@plugin.__send__(:transaction, 'category') do |db|
-					categorized[c] = get(db, c)
-				end
-				categorized[c].keys.each do |ymd|
-					y, m = ymd[0,4], ymd[4,2]
-					if years[y].nil? or !years[y].include?(m)
-						categorized[c].delete(ymd)
+add_update_proc do
+	if /^(append|replace)$/ =~ @mode
+		ymd = @date.strftime('%Y%m%d')
+		diary = @diaries[ymd]
+		serialize = category_serialize(diary)
+
+		transaction('category') do |db|
+			(db.keys + serialize.keys).uniq.each do |category|
+				data = JSON.load(db.get(category) || '{}')
+				if diary.visible? and serialize[category]
+					data.update(serialize[category])
+					db.set(category, data.to_json)
+				else
+					data.delete(ymd)
+					if data.empty?
+						db.delete(category)
+					else
+						db.set(category, data.to_json)
 					end
 				end
-				categorized.delete(c) if categorized[c].empty?
 			end
-		rescue NoMethodError	# when categorized[c] is nil
-			recreate(years)
-			retry
-		end
-
-		categorized
-	end
-
-private
-	def cache_file(category = nil)
-		if category
-			"#{@dir}/#{u( category ).gsub(/%20/,'+')}".untaint
-		else
-			"#{@dir}/category_list"
 		end
 	end
-
-	#
-	# categorize sections of diary
-	#
-	# {"category" => {"yyyymmdd" => [[idx, title, excerpt], ...]}}
-	#
-	def categorize_diary(diary)
-		categorized = {}
-		ymd = diary.date.strftime('%Y%m%d')
-
-		idx = 1
-		diary.each_section do |s|
-			s.categories.each do |c|
-				categorized[c] = {} if categorized[c].nil?
-				categorized[c][ymd] = [] if categorized[c][ymd].nil?
-				body = <<EVAL
-text = apply_plugin(<<'BODY', true)
-#{s.body_to_html}
-BODY
-EVAL
-				shorten = begin
-					@conf.shorten(eval(body.untaint, @binding))
-				rescue NameError
-					""
-				end
-				categorized[c][ymd] << [idx, s.stripped_subtitle_to_html, shorten]
-			end
-			idx +=1
-		end
-
-		categorized
-	end
 end
 
-end # module Category
-
-# read cache here so that you can use category with secure mode.
- at category_cache = Category::Cache.new(@conf, binding)
-
 #
-# display categories on update form
+# edit support: insert category to editing diary using JavaScript
 #
-def category_edit_support_flatlist
+def category_edit_support_flatlist(categories)
 	ret = ''
 	ret << '<div class="field title">'
 	ret << "#{@category_conf_label}:\n"
-	@categories.each do |c|
+	categories.each do |c|
 		ret << %Q!| <span class="category-item">#{h c}</span>\n!
 	end
 	ret << "|\n</div>\n<br>\n"
 	ret
 end
 
-def category_edit_support_dropdown
+def category_edit_support_dropdown(categories)
 	ret = ''
 	ret << '<div class="field title">'
 	ret << %Q|#{@category_conf_label}: <select id="category-candidate" name="category-candidate">\n|
-	@categories.each do |c|
+	categories.each do |c|
 		ret << %Q!<option>#{h c}</option>\n!
 	end
 	ret << "|\n</select>\n</div>\n<br>\n"
 	ret
 end
 
-if @conf['category.edit_support'] != 0 then
+if @mode =~ /^(form|edit)$/ and @conf['category.edit_support'] != 0
 	enable_js( 'category.js' )
 	add_edit_proc do |date|
 		ret = ''
-		unless @categories.size == 0 then
-			ret << if @conf['category.edit_support'] == 2 then
-				category_edit_support_dropdown
-			else
-				category_edit_support_flatlist
+		transaction('category') do |db|
+			categories = db.keys
+			unless categories.size == 0 then
+				if @conf['category.edit_support'] == 2 then
+					ret << category_edit_support_dropdown(categories)
+				else
+					ret << category_edit_support_flatlist(categories)
+				end
 			end
 		end
+		ret
 	end
 end
 
-
-#
-# when update diary, update cache
-#
-add_update_proc do
-	if /^(append|replace)$/ =~ @mode
-		cache = @category_cache
-		list = []
-		diary = @diaries[@date.strftime('%Y%m%d')]
-		diary.each_section do |s|
-			list |= s.categories
-		end
-		cache.add_categories(list)
-		cache.replace_sections(diary)
-	end
-end
-
-
-#
-# configuration
-#
-def category_icon_find_icons
-   return if @category_all_icon
-	@category_all_icon = []
-	%w(png jpg gif bmp).each do |e|
-		@category_all_icon += Dir.glob("#{@category_icon_dir}*.#{e}".untaint).map {|i| File.basename(i)}
-	end
-	@category_all_icon.sort!
-end
-
-def category_icon_select(category)
-	options = %Q|<\t<option value="none">#{@category_icon_none_label}</option>\n|
-	@category_all_icon.each do |i|
-		options << %Q|\t<option value="#{h i}"#{" selected" if @category_icon[category] == i}>#{h i}</option>\n|
-	end
-	<<HTML
-<select name="category.icon.#{h category}">
-#{options}
-</select>
-HTML
-end
-
-def category_icon_sample
-	@category_all_icon.map do |i|
-		%Q|<img src="#{h @category_icon_url}#{h i}" alt="#{h i}" title="#{h i}">\n|
-	end.join("/\n")
-end
-
 if @mode == 'conf' || @mode == 'saveconf'
-	add_conf_proc( 'category', @category_conf_label, 'basic' ) do
+	add_conf_proc('category', @category_conf_label, 'basic') do
 		if @mode == 'saveconf'
-			if @cgi.valid?( 'category_initialize' )
-				@category_cache.recreate(@years)
-			end
-
-			[
-				'category.header1',
-				'category.header2',
-			].each do |name|
-				@conf[name] = @conf.to_native( @cgi.params[name][0] )
-			end
-			[
-				'category.prev_year',
-				'category.next_year',
-				'category.prev_half',
-				'category.next_half',
-				'category.prev_quarter',
-				'category.next_quarter',
-				'category.prev_month',
-				'category.next_month',
-				'category.this_year',
-				'category.this_half',
-				'category.this_quarter',
-				'category.this_month',
-				'category.all_diary',
-				'category.all_category',
-				'category.all',
-			].each do |name|
-				@conf[name] = @conf.to_native( @cgi.params[name][0] )
-			end
-			if ["month", "quarter", "half", "year", "all"].index(@cgi.params["category.period"][0])
-				@conf["category.period"] = @cgi.params["category.period"][0]
-			end
+			category_rebuild(@years) if @cgi.valid?('category_initialize')
 			@conf['category.edit_support'] = (@cgi.params['category.edit_support'][0] || '1').to_i
 		end
 		category_conf_html
 	end
-
-	category_icon_find_icons if @cgi.params['conf'][0] == 'category_icon'
-	add_conf_proc( 'category_icon', @category_icon_conf_label, 'basic' ) do
-		if @mode == 'saveconf'
-			unless @conf.secure
-				[
-					'category.icon_dir',
-					'category.icon_url',
-				].each do |name|
-					@conf[name] = @cgi.params[name][0].sub(%r|/*$|, '/')
-				end
-				category_icon_location_init
-			end
-			@cgi.params.keys.each do |key|
-				next unless /\Acategory\.icon\..*\z/ === key
-				category = key.sub(/\Acategory\.icon\./, '')
-				if @cgi.params[key][0] == 'none'
-					@category_icon.delete(category)
-				else
-					@category_icon[category] = @cgi.params[key][0]
-				end
-			end
-			category_icon_save
-		end
-		category_icon_conf_html
-	end
-end
-
- at categories = @category_cache.restore_categories.sort_by{|e| e.downcase}
-if @mode == 'categoryview'
-	info = Category::Info.new(@cgi, @years, @conf)
-	@categorized = @category_cache.categorize(info.category, info.years)
 end
 
 # Local Variables:
diff --git a/misc/plugin/category_autocomplete.rb b/misc/plugin/category_autocomplete.rb
index b5d05c8..4dc0507 100644
--- a/misc/plugin/category_autocomplete.rb
+++ b/misc/plugin/category_autocomplete.rb
@@ -9,10 +9,10 @@
 
 if /\A(?:form|preview|append|edit|update)\z/ =~ @mode
 	add_header_proc do
-		%Q|<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css"/>|
+		%Q|<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.min.css"/>|
 	end
 
-	enable_js('//ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js')
+	enable_js('//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js')
 	enable_js('caretposition.js')
 	enable_js('category_autocomplete.js')
 
diff --git a/misc/plugin/comment_emoji_autocomplete.rb b/misc/plugin/comment_emoji_autocomplete.rb
index 2b28796..a148302 100644
--- a/misc/plugin/comment_emoji_autocomplete.rb
+++ b/misc/plugin/comment_emoji_autocomplete.rb
@@ -9,10 +9,10 @@
 
 if /\A(?:day)\z/ =~ @mode
 	add_header_proc do
-		%Q|<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css"/>|
+		%Q|<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.min.css"/>|
 	end
 
-	enable_js('//ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js')
+	enable_js('//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js')
 	enable_js('caretposition.js')
 	enable_js('comment_emoji_autocomplete.js')
 end
diff --git a/misc/plugin/disp_referrer.rb b/misc/plugin/disp_referrer.rb
index 011ccd5..d295ca0 100644
--- a/misc/plugin/disp_referrer.rb
+++ b/misc/plugin/disp_referrer.rb
@@ -75,7 +75,6 @@ See ChangeLog for changes after this.
 Dispref2plugin = self
 Dispref2plugin_cache_path = @cache_path
 Dispref2plugin_cache_dir = @cache_dir
-Dispref2plugin_secure = @conf.secure
 
 # cache format
 Root_DispRef2URL = 'dispref2url' # root for DispRef2URLs
@@ -140,90 +139,13 @@ DispRef2Storeのパスの管理をします。
       本物のPSToreが使える時はtrue、そうでない時はfalseを返します。
 =end
 
-unless @conf and @conf.secure then
-	class DispRef2CachePath
-		def initialize( setup )
-			@setup = setup
-		end
-		def cache( date )
-			return File.join( @setup['cache_dir'], 'volatile.tdr2.cache' ) unless date
-			begin
-				Dir.mkdir( @setup['cache_dir'].untaint )
-			rescue Errno::EEXIST
-			end
-			File.join( @setup['cache_dir'], date.strftime( '%Y%m.tdr2.cache' ) )
-		end
-		def caches( include_backup = true )
-			if include_backup then
-				r = Dir.glob( File.join( @setup['cache_dir'], '??????.tdr2.cache*' ) )
-			else
-				r = Dir.glob( File.join( @setup['cache_dir'], '??????.tdr2.cache' ) )
-			end
-			r.collect{ |p| p.untaint }
-		end
-		def size
-			r = 0
-			caches.each do |path|
-				r += File.size( path )
-			end
-			r
-		end
-		def clear
-			# current version
-			caches.each do |path|
-				begin
-					File.unlink( path )
-				rescue Errno::ENOENT
-				end
-			end
-			# older version
-			if @setup['cache_path'] then
-				[ @setup['cache_path'], @setup['cache_path']+'~' ].each do |f|
-					File.unlink( f ) if FileTest::exist?( f )
-				end
-			end
-		end
-		def shrink
-			return if @setup['cache_max_size'] <= 0
-			size = 0
-			begin
-				caches.sort{ |a,b| File.atime( b ) <=> File.atime( a ) }.each do |path|
-					if size < @setup['cache_max_size'] then
-						size += File.size( path )
-					else
-						File.unlink( path )
-					end
-				end
-			rescue Errno::ENOENT
-			end
-		end
-	end
-
-	require 'pstore'
-	class DispRef2PStore < PStore
-		def real?
-			true
-		end
-		def transaction( read_only = false )
-			begin
-				super
-			rescue TypeError
-				File.unlink( self.path )
-				super
-			rescue ArgumentError
-				super()
-			end
-		end
-	end
-else
-	class DispRef2PStore < DispRef2DummyPStore
-		def real?
-			false
-		end
-	end
-	class DispRef2CachePath < DispRef2CachePathDummy
+class DispRef2PStore < DispRef2DummyPStore
+	def real?
+		false
 	end
 end
+class DispRef2CachePath < DispRef2CachePathDummy
+end
 
 =begin
 === Tdiary::Plugin::DispRef2String
@@ -480,7 +402,7 @@ class DispRef2Setup < Hash
 			# キャッシュの合計量の制限(バイト)です。時々越えます。
 			# 0未満なら制限しません。
 		'no_cache' => false,
-			# trueの場合、@secure=falseな日記でもキャッシュを使いません。
+			# trueの場合キャッシュを使いません。
 		'normal-unknown.title' => '\Ahttps?:\/\/',
 			# 置換された「その他」のリンク元のタイトル、あるいは置換されていな
 			# いリンク元のタイトルにマッチします。
@@ -491,7 +413,7 @@ class DispRef2Setup < Hash
 			# \n区切で並べます
 	}
 
-	attr_reader :is_long, :referer_table, :no_referer, :secure, :years, :conf
+	attr_reader :is_long, :referer_table, :no_referer, :years, :conf
 
 	def initialize( conf, limit = 100, is_long = true, years = nil, mode = nil )
 		super()
@@ -508,9 +430,6 @@ class DispRef2Setup < Hash
 		@referer_table = conf.referer_table
 		@no_referer = conf.no_referer
 
-		# security
-		@secure = Dispref2plugin_secure
-
 		# options from tDiary
 		update!
 	end
@@ -787,7 +706,7 @@ class DispRef2URL
 						break
 					end
 				else
-					name.untaint unless setup.secure
+					name.untaint
 					if title.gsub!( /#{url}/iu ) { eval name } then
 						matched = true
 						break
@@ -1163,7 +1082,7 @@ class DispRef2SetupIF
 		else
 			@current_mode = Options
 		end
-		if not @setup.secure and not @setup['no_cache'] then
+		unless @setup['no_cache'] then
 			@cache = @setup.cache_path
 		else
 			@cache = nil
@@ -1183,7 +1102,7 @@ class DispRef2SetupIF
 		end
 
 		# clear cache
-		if @mode == 'saveconf' and not @setup.secure then
+		if @mode == 'saveconf' then
 			if not @setup['no_cache'] then
 				unless @cache then
 					@need_cache_update = true
@@ -1416,27 +1335,8 @@ def referer_of_today_long( diary, limit = 100 )
 	r
 end
 
-# for newest diary
-#alias dispref2_original_referer_of_today_short referer_of_today_short
-#def referer_of_today_short( diary, limit = 10 )
-#	return '' if bot?
-#	return dispref2_original_referer_of_today_short( diary, limit ) if @options.has_key?( 'disp_referrer2.short.only_normal' ) and not @options['disp_referrer2.short.only_normal']
-#	setup = DispRef2Setup.new( @conf, limit, false, nil, @mode )
-#	DispRef2Refs.new( diary, setup ).to_short_html
-#end
-
 # we have to know the unknown urls at this moment in a secure diary
-if @conf.secure and (\
-	( @cgi.params['dr2.change_mode'] \
-		and DispRef2SetupIF::RefList == @cgi.params['dr2.new_mode'][0] ) \
-		or ( @cgi.params['dr2.current_mode'] \
-		and DispRef2SetupIF::RefList == @cgi.params['dr2.current_mode'][0] ) )
-then
-	setup = DispRef2Setup.new( @conf, 100, true, @mode )
-	DispRef2Latest_cache = DispRef2Latest.new( @cgi, 'latest.rhtml', @conf, setup )
-else
-	DispRef2Latest_cache = nil
-end
+DispRef2Latest_cache = nil
 
 # Local Variables:
 # mode: ruby
diff --git a/misc/plugin/en/category.rb b/misc/plugin/en/category-legacy.rb
similarity index 99%
copy from misc/plugin/en/category.rb
copy to misc/plugin/en/category-legacy.rb
index 819c319..3167ac9 100644
--- a/misc/plugin/en/category.rb
+++ b/misc/plugin/en/category-legacy.rb
@@ -1,4 +1,4 @@
-# ja/category.rb
+# en/category-legacy.rb
 #
 # Copyright (c) 2004 Junichiro KITA <kita at kitaj.no-ip.com>
 # Distributed under the GPL2 or any later version.
diff --git a/misc/plugin/en/category.rb b/misc/plugin/en/category.rb
index 819c319..63aab8b 100644
--- a/misc/plugin/en/category.rb
+++ b/misc/plugin/en/category.rb
@@ -1,198 +1,40 @@
-# ja/category.rb
+# -*- coding: utf-8 -*-
 #
-# Copyright (c) 2004 Junichiro KITA <kita at kitaj.no-ip.com>
+# en/category.rb : tDiary plugin for show category pages
+#
+# Copyright (C) 2016 TADA Tadashi
 # Distributed under the GPL2 or any later version.
 #
 
-def category_title
-	info = Category::Info.new(@cgi, @years, @conf)
-	mode = info.mode
-	case mode
-	when :year
-		period = "#{info.year}"
-	when :half
-		period = (info.month.to_i == 1 ? "1st half" : "2nd half")
-		period = "#{info.year} #{period}" if info.year
-	when :quarter
-		period = info.month
-		period = "#{info.year}/#{period}" if info.year
-	when :month
-		period = info.month.to_i
-		period = "#{info.year}/#{period}" if info.year
-	end
-	period = " (#{period})" if period
-
-	"[#{info.category.join('|')}#{period}]"
-end
-
-def category_init_local
-	@conf['category.prev_year'] ||= '<< ($1)'
-	@conf['category.next_year'] ||= '($1) >>'
-	@conf['category.prev_half'] ||= '<< ($1-$2)'
-	@conf['category.next_half'] ||= '($1-$2) >>'
-	@conf['category.prev_quarter'] ||= '<< ($1-$2)'
-	@conf['category.next_quarter'] ||= '($1-$2) >>'
-	@conf['category.prev_month'] ||= '<< ($1-$2)'
-	@conf['category.next_month'] ||= '($1-$2) >>'
-	@conf['category.this_year'] ||= 'this year'
-	@conf['category.this_half'] ||= 'this half'
-	@conf['category.this_quarter'] ||= 'this quarter'
-	@conf['category.this_month'] ||= 'this month'
-	@conf['category.all_diary'] ||= 'all diary'
-	@conf['category.all_category'] ||= 'all category'
-	@conf['category.all'] ||= 'all diary/all category'
-end
-category_init_local
-
 @category_conf_label = 'Category'
-def category_conf_html
-	r = <<HTML
-<h3 class="subtitle">Create category index</h3>
-<p>
-To use the category feature, you should create category index.
-Check the box below to create category index.
-</p>
-<p><label for="category_initialize">
-<input type="checkbox" id="category_initialize" name="category_initialize" value="1">Rebuild category Index
-</label></p>
-<p>
-It takes several or several tens of second to create it.
-</p>
-
-<h3 class="subtitle">Edit Support</h3>
-<p>
-Category names can be shown under the 'Article' form.
-</p>
-<p>
-<select name="category.edit_support">
-<option value="1"#{" selected" if @conf['category.edit_support'] == 1}>Flat List</option>
-<option value="2"#{" selected" if @conf['category.edit_support'] == 2}>Dropdown List/option>
-<option value="0"#{" selected" if @conf['category.edit_support'] == 0}>Hide</option>
-</select>
-</p>
 
-<h3 class="subtitle">Default period</h3>
-<p>
-Specify the default display period for category view.
-</p>
-<p><select name="category.period">
-HTML
-	[
-		['month', 'month', false],
-		['quarter', 'quarter', true],
-		['half-year', 'half', false],
-		['year', 'year', false],
-		['all', 'all', false],
-	].each do |text, value, default|
-		selected = @conf["category.period"] ? @conf["category.period"] == value : default
-		r << <<HTML
-<option value="#{value}"#{" selected" if selected}>#{text}</option>
-HTML
-	end
-	r << <<HTML
-</select></p>
-
-<h3 class="subtitle">Header</h3>
-<p>
-This text is inserted into top of category view.
-"<%= category_navi %>" genaretes navigation buttons for category,
-and "<%= category_list %>" lists all category names.
-You can use plugins and write any HTML tags.
-</p>
-
-<h4>Header 1</h4>
-<p>Inserted under the navigtion buttons.</p>
-<p><textarea name="category.header1" cols="60" rows="8">#{h @conf['category.header1']}</textarea></p>
-
-<h4>Header 2</h4>
-<p>Inserted under the <H1>.</p>
-<p><textarea name="category.header2" cols="60" rows="8">#{h @conf['category.header2']}</textarea></p>
-
-<h3 class="subtitle">Button labels</h3>
-<p>
-Specify button labels.
-$1 and $2 in labels are replaced with year and month.
-</p>
-<table border="0">
-<tr><th>button name</th><th>label</th><th>sample</th></tr>
-HTML
-	[
-		['previous year', 'category.prev_year'],
-		['next year', 'category.next_year'],
-		['previous half', 'category.prev_half'],
-		['next half', 'category.next_half'],
-		['previous quarter', 'category.prev_quarter'],
-		['next quarter', 'category.next_quarter'],
-		['previous month', 'category.prev_month'],
-		['next month', 'category.next_month'],
-		['this year', 'category.this_year'],
-		['this half', 'category.this_half'],
-		['this quarter', 'category.this_quarter'],
-		['this month', 'category.this_month'],
-		['all diary', 'category.all_diary'],
-		['all category', 'category.all_category'],
-		['all diary/all category', 'category.all'],
-	].each do |button, name|
-		r << <<HTML
-<tr>
-	<td>#{button}</td>
-	<td><input type="text" name="#{name}" value="#{h @conf[name]}" size="30"></td>
-	<td><p><span class="adminmenu"><a>#{h @conf[name].sub(/\$1/, "2007").sub(/\$2/, "2")}</a></span></p></td>
-</tr>
-HTML
-	end
-	r << <<HTML
-</table>
-HTML
-end
-
- at category_icon_none_label = 'no icon'
- at category_icon_conf_label = 'Category Icons'
-def category_icon_conf_html
-	r = ''
-	unless @conf.secure
-		r << <<HTML
-<h3 class="subtitle">Location of category icons</h3>
-<p>
-Specify the directory and url of category icons.
-</p>
-<p>
-<dl>
-<dt>Directory:</dt>
-<dd><input name="category.icon_dir" value="#{h @category_icon_dir}" size="30"></dd>
-<dt>URL:</dt>
-<dd><input name="category.icon_url" value="#{h @category_icon_url}" size="30"></dd>
-</dl>
-</p>
-<hr>
-HTML
-   end
-
-	str = ''
-	@categories.each do |c|
-		str << %Q|\t<tr>\n\t\t<td>#{c}</td>\n\t\t<td>\n|
-		str << category_icon_select(c)
-		str << %Q|<img src="#{h @category_icon_url}#{h @category_icon[c]}">| if @category_icon[c]
-		str << %Q|</td>\n\t</tr>\n|
-	end
-	<<HTML
-<h3 class="subtitle">Category Icons</h3>
-<p>
-<table>
-	<tr><th>Category</th><th>Icon</th></tr>
-#{str}
-</table>
-</p>
-<hr>
-<h3 class="subtitle">Sample icons</h3>
-<p>
-You can take your choice from these icons.
-Move mouse pointer on an icon, the icon's name will pop up.
-</p>
-<p>
-#{category_icon_sample}
-</p>
-HTML
+def category_conf_html
+	r = <<-HTML
+		<h3 class="subtitle">Build category index</h3>
+		<p>
+		To use the category feature, you should build category index.
+		Check the box below and press OK to build category index.
+		</p>
+		<p><label for="category_initialize">
+		<input type="checkbox" id="category_initialize" name="category_initialize" value="1">Build category index
+		</label></p>
+		<p>
+		It takes several or several tens of second to create it. But your diaries are many or the server has low spec, it will be timeout. Rebuild index on off-line again.
+		</p>
+
+		<h3 class="subtitle">Edit Support</h3>
+		<p>
+		Category names can be shown under the 'Article' form.
+		</p>
+		<p>
+		<select name="category.edit_support">
+		<option value="1"#{" selected" if @conf['category.edit_support'] == 1}>Flat List</option>
+		<option value="2"#{" selected" if @conf['category.edit_support'] == 2}>Dropdown List/option>
+		<option value="0"#{" selected" if @conf['category.edit_support'] == 0}>Hide</option>
+		</select>
+		</p>
+	HTML
+	r
 end
 
 # Local Variables:
diff --git a/misc/plugin/en/disp_referrer.rb b/misc/plugin/en/disp_referrer.rb
index 3fa311c..6792618 100644
--- a/misc/plugin/en/disp_referrer.rb
+++ b/misc/plugin/en/disp_referrer.rb
@@ -151,7 +151,6 @@ class DispRef2SetupIF
 				the search engine names.
 			</table>
 		_HTML
-		unless @setup.secure then
 		r << <<-_HTML
 			<h3>Cache</h3>
 			<p>It isn't available to turn on this option with tDiary2 file format(DefaultIO).</p>
@@ -171,19 +170,14 @@ class DispRef2SetupIF
 			</table>
 			<p>Cache size limit is an approximation. There is a chance that the cache size is bigger than the configured value. Setting the limit to zero disalbes limitation. K or M can be suffixed meaning Kbytes or Mbytes.</p>
 		_HTML
-		end # unless @setup.secure
 		r
 	end
 
 	# shows URL list to be added to the referer_table or no_referer
 	def show_unknown_list
-		if @setup.secure then
+		urls = DispRef2Cache.new( @setup ).urls( DispRef2URL::Unknown ).keys
+		if urls.size == 0 then
 			urls = DispRef2Latest.new( @cgi, 'latest.rhtml', @conf, @setup ).unknown_urls
-		else
-			urls = DispRef2Cache.new( @setup ).urls( DispRef2URL::Unknown ).keys
-			if urls.size == 0 then
-				urls = DispRef2Latest.new( @cgi, 'latest.rhtml', @conf, @setup ).unknown_urls
-			end
 		end
 		urls.reject!{ |url| DispRef2String::url_match?( url, @setup['reflist.ignore_urls'] ) }
 		r = <<-_HTML
diff --git a/misc/plugin/en/image.rb b/misc/plugin/en/image.rb
index 8582a1e..b155df8 100644
--- a/misc/plugin/en/image.rb
+++ b/misc/plugin/en/image.rb
@@ -25,15 +25,8 @@
 #     You have to set parmission to writable by web server.
 #  @options['image.url']
 #     URL of the image directory. Default is './images/'.
-#  @options['image.maxnum']
-#     Max of number of images per a day. Default is 1.
-#     This option is effective in @secure = true.
-#  @options['image.maxsize']
-#     Max size of an image. Default is 10000 bytes.
-#     This option is effective in @secure = true.
 #  @options['image.maxwidth']
 #     Max display width of image without specified 'size' parameter.
-#     It will ignore when @secure = true.
 #
 def image_error_num( max ); "You can add images upto #{h max} par a day."; end
 def image_error_size( max ); "You can add images upto #{h max} bytes par an image."; end
diff --git a/misc/plugin/en/search_control.rb b/misc/plugin/en/search_control.rb
index 0c064ae..a92352a 100644
--- a/misc/plugin/en/search_control.rb
+++ b/misc/plugin/en/search_control.rb
@@ -17,8 +17,6 @@ only index one-day view.
 To this plugin to take effect, we have to wish that the crawlers regards
 the meta-tag.
 
-This plugin also works in a diary with @secure = true.
-
 == License
 Copyright (C) 2003, 2004 zunda <zunda at freeshell.org>
 
diff --git a/misc/plugin/image.rb b/misc/plugin/image.rb
index c99e1d6..9b48d0a 100644
--- a/misc/plugin/image.rb
+++ b/misc/plugin/image.rb
@@ -34,16 +34,9 @@
 #     Webサーバの権限で書き込めるようにしておく必要があります。
 #  @options['image.url']
 #     画像ファイルを保存するディレクトリのURL。無指定時は'./images/'
-#  @options['image.maxnum']
-#     1日あたりの最大画像数。無指定時は1
-#     ただし@secure = true時のみ有効
-#  @options['image.maxsize']
-#     1枚あたりの最大画像バイト数。無指定時は10000
-#     ただし@secure = true時のみ有効
 #  @options['image.maxwidth']
 #     sizeを指定しなかった場合に指定できる画像の最大表示幅。無指定時はnil
 #     表示のたびにファイルアクセスが入るので、重くなるかも?
-#     @secure = true時は無効
 #
 # ライセンスについて:
 # Copyright (c) 2002,2003 Daisuke Kato <dai at kato-agri.com>
@@ -66,13 +59,8 @@ unless @resource_loaded then
 end
 
 def image( id, alt = 'image', thumbnail = nil, size = nil, place = 'photo' )
-	if @conf.secure then
-		image = "#{@image_date}_#{id}.jpg"
-		image_t = "#{@image_date}_#{thumbnail}.jpg" if thumbnail
-	else
-   	image = image_list( @image_date )[id.to_i]
-   	image_t = image_list( @image_date )[thumbnail.to_i] if thumbnail
-	end
+  	image = image_list( @image_date )[id.to_i]
+  	image_t = image_list( @image_date )[thumbnail.to_i] if thumbnail
 	if size
 		if size.kind_of?(Array)
 			if size.length > 1
@@ -83,7 +71,7 @@ def image( id, alt = 'image', thumbnail = nil, size = nil, place = 'photo' )
 		else
 			size = %Q| width="#{size.to_i}"|
 		end
-	elsif @image_maxwidth and not @conf.secure then
+	elsif @image_maxwidth then
 		_, w, _ = image_info( "#{@image_dir}/#{image}".untaint )
 		if w > @image_maxwidth then
 			size = %Q[ width="#{h @image_maxwidth}"]
@@ -107,11 +95,7 @@ def image_right( id, alt = "image", thumbnail = nil, width = nil )
 end
 
 def image_link( id, desc )
-	if @conf.secure then
-		image = "#{@image_date}_#{id}.jpg"
-	else
-   	image = image_list( @image_date )[id.to_i]
-	end
+  	image = image_list( @image_date )[id.to_i]
    %Q[<a href="#{h @image_url}/#{h image}">#{desc}</a>]
 end
 
@@ -143,15 +127,10 @@ def image_info( f )
 end
 
 def image_ext
-	if @conf.secure then
-		'jpg'
-	else
-		'jpg|jpeg|gif|png'
-	end
+	'jpg|jpeg|gif|png'
 end
 
 def image_list( date )
-	return @image_list if @conf.secure and @image_list
 	list = []
 	reg = /#{date}_(\d+)\.(#{image_ext})$/
 	begin
@@ -169,7 +148,6 @@ if /^(form|edit|formplugin|showcomment)$/ =~ @mode then
 	add_js_setting( '$tDiary.plugin.image' )
 	add_js_setting( '$tDiary.plugin.image.alt', %Q|'#{image_label_description}'| )
 	add_js_setting( '$tDiary.plugin.image.drop_here', %Q|'#{image_label_drop_here}'| )
-	@image_list = image_list( @date.strftime( '%Y%m%d' ) ) if @conf.secure
 end
 
 if /^formplugin$/ =~ @mode then
@@ -190,16 +168,11 @@ if /^formplugin$/ =~ @mode then
 					rescue NameError
 						size = file.stat.size
 					end
-					if @conf.secure then
-						raise image_error_num( maxnum ) if images.compact.length >= maxnum
-						raise image_error_size( maxsize ) if size > maxsize
-					end
 					output = "#{@image_dir}/#{date}_#{images.length}.#{extension}".untaint
 					File::umask( 022 )
 					File::open( output, "wb" ) do |f|
 						f.print file.read
 					end
-					images << File::basename( output ) # for secure mode
 				end
 			end
 	   elsif @cgi.params['plugin_image_delimage'][0]
@@ -208,7 +181,6 @@ if /^formplugin$/ =~ @mode then
 	         if File::file?( file ) && File::exist?( file )
 	            File::delete( file )
 	         end
-	         images[id.to_i] = nil # for secure mode
 	      end
 	   end
 	rescue
@@ -232,11 +204,7 @@ add_form_proc do |date|
 		tmp = ''
 	   images.each_with_index do |img,id|
 			next unless img
-			if @conf.secure then
-				img_w, img_h = nil, nil
-			else
-				_, img_w, img_h = image_info(File.join(@image_dir,img).untaint)
-			end
+			_, img_w, img_h = image_info(File.join(@image_dir,img).untaint)
 			r << %Q[<td><img id="image-index-#{id}" class="image-img form" src="#{h @image_url}/#{h img}" alt="#{id}" width="#{h( (img_w && img_w > 160) ? 160 : (img_w ? img_w : 160) )}"></td>]
 			img_info = ''
 			if img_w && img_h
@@ -265,7 +233,6 @@ add_form_proc do |date|
 		r << %Q[<p class="message">#{@image_message}</p>]
 	end
    r << %Q[<form class="update" method="post" enctype="multipart/form-data" action="#{h @update}"><div>
-	#{@conf.secure ? image_label_only_jpeg : ''}
 	#{csrf_protection}
    <input type="hidden" name="plugin_image_addimage" value="true">
    <input type="hidden" name="date" value="#{date.strftime( '%Y%m%d' )}">
diff --git a/misc/plugin/ja/category.rb b/misc/plugin/ja/category-legacy.rb
similarity index 99%
copy from misc/plugin/ja/category.rb
copy to misc/plugin/ja/category-legacy.rb
index 9a5e5b6..daaf86d 100644
--- a/misc/plugin/ja/category.rb
+++ b/misc/plugin/ja/category-legacy.rb
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-# ja/category.rb
+# ja/category-legacy.rb
 #
 # Copyright (c) 2004 Junichiro KITA <kita at kitaj.no-ip.com>
 # Distributed under the GPL2 or any later version.
diff --git a/misc/plugin/ja/category.rb b/misc/plugin/ja/category.rb
index 9a5e5b6..3d5007b 100644
--- a/misc/plugin/ja/category.rb
+++ b/misc/plugin/ja/category.rb
@@ -1,205 +1,41 @@
 # -*- coding: utf-8 -*-
-# ja/category.rb
 #
-# Copyright (c) 2004 Junichiro KITA <kita at kitaj.no-ip.com>
+# ja/category.rb : tDiary plugin for show category pages
+#
+# Copyright (C) 2016 TADA Tadashi
 # Distributed under the GPL2 or any later version.
 #
 
-def category_title
-	info = Category::Info.new(@cgi, @years, @conf)
-	mode = info.mode
-	case mode
-	when :year
-		period = "#{info.year}年"
-	when :half
-		period = (info.month.to_i == 1 ? "上半期" : "下半期")
-		period = "#{info.year}年 #{period}" if info.year
-	when :quarter
-		period = "第#{info.month.to_i}四半期"
-		period = "#{info.year}年 #{period}" if info.year
-	when :month
-		period = "#{info.month.to_i}月"
-		period = "#{info.year}年 #{period}" if info.year
-	end
-	period = " (#{period})" if period
-
-	"[#{info.category.join('|')}#{period}]"
-end
-
-def category_init_local
-	@conf['category.prev_year'] ||= '<< ($1)'
-	@conf['category.next_year'] ||= '($1) >>'
-	@conf['category.prev_half'] ||= '<< ($1-$2)'
-	@conf['category.next_half'] ||= '($1-$2) >>'
-	@conf['category.prev_quarter'] ||= '<< ($1-$2)'
-	@conf['category.next_quarter'] ||= '($1-$2) >>'
-	@conf['category.prev_month'] ||= '<< ($1-$2)'
-	@conf['category.next_month'] ||= '($1-$2) >>'
-	@conf['category.this_year'] ||= '年'
-	@conf['category.this_half'] ||= '半期'
-	@conf['category.this_quarter'] ||= '四半期'
-	@conf['category.this_month'] ||= '月'
-	@conf['category.all_diary'] ||= '全期間'
-	@conf['category.all_category'] ||= '全カテゴリ'
-	@conf['category.all'] ||= '全期間/全カテゴリ'
-end
-category_init_local
-
 @category_conf_label = 'カテゴリ'
-def category_conf_html
-	r = <<HTML
-<h3 class="subtitle">カテゴリインデックスの作成</h3>
-<p>
-カテゴリの機能を利用するにはカテゴリインデックスをあらかじめ作成しておく必要があります。
-カテゴリインデックスを作成するには
-以下のチェックを入れてからOKボタンを押してください。
-</p>
-<p><label for="category_initialize">
-<input type="checkbox" id="category_initialize" name="category_initialize" value="1">カテゴリインデックスの作成
-</label></p>
-<p>
-日記の量やサーバの性能にもよりますが、数秒から数十秒でインデックスの作成は終了します。
-</p>
-
-<h3 class="subtitle">日記編集サポート</h3>
-<p>
-日記編集画面の「本文」の下にカテゴリ名を一覧表示することができます。
-カテゴリ名をクリックすると「本文」にそのカテゴリ名が挿入されます(要JavaScript)。
-</p>
-<p>
-<select name="category.edit_support">
-<option value="1"#{" selected" if @conf['category.edit_support'] == 1}>一覧表示</option>
-<option value="2"#{" selected" if @conf['category.edit_support'] == 2}>ドロップダウンリスト</option>
-<option value="0"#{" selected" if @conf['category.edit_support'] == 0}>表示しない</option>
-</select>
-</p>
 
-<h3 class="subtitle">表示期間の初期状態</h3>
-<p>
-カテゴリ表示画面を表示した時の、最初の表示期間を指定します。
-</p>
-<p>
-<select name="category.period">
-HTML
-	[
-		['月', 'month', false],
-		['四半期', 'quarter', true],
-		['半期', 'half', false],
-		['年', 'year', false],
-		['全日記', 'all', false],
-	].each do |text, value, default|
-		selected = @conf["category.period"] ? @conf["category.period"] == value : default
-		r << <<HTML
-<option value="#{value}"#{" selected" if selected}>#{text}</option>
-HTML
-	end
-	r << <<HTML
-</select>
-</p>
-
-<h3 class="subtitle">ヘッダ</h3>
-<p>
-画面上部に表示する文章を指定します。
-「<%= category_navi %>」で、カテゴリに特化したナビゲーションボタンを表示することができます。
-また「<%= category_list%>」でカテゴリ名一覧を表示することができます。
-その他,各種プラグインやHTMLを記述できます。
-</p>
-
-<h4>ヘッダ1</h4>
-<p>ナビゲーションボタンのすぐ下に表示されます。</p>
-<p><textarea name="category.header1" cols="60" rows="5">#{h @conf['category.header1']}</textarea></p>
-
-<h4>ヘッダ2</h4>
-<p>H1のすぐ下に表示されます。</p>
-<p><textarea name="category.header2" cols="60" rows="5">#{h @conf['category.header2']}</textarea></p>
-
-<h3 class="subtitle">ボタンラベル</h3>
-<p>
-ナビゲーションボタンのラベルを指定します。
-ラベル中の$1と$2は,それぞれ「年」「月」を表す数値で置換されます。
-</p>
-<table border="0">
-<tr><th>ボタン名</th><th>ラベル</th><th>サンプル</th></tr>
-HTML
-	[
-		['前年', 'category.prev_year'],
-		['翌年', 'category.next_year'],
-		['前の半年', 'category.prev_half'],
-		['次の半年', 'category.next_half'],
-		['前四半期', 'category.prev_quarter'],
-		['次四半期', 'category.next_quarter'],
-		['先月', 'category.prev_month'],
-		['翌月', 'category.next_month'],
-		['今年', 'category.this_year'],
-		['現半期', 'category.this_half'],
-		['現四半期', 'category.this_quarter'],
-		['今月', 'category.this_month'],
-		['全日記', 'category.all_diary'],
-		['全カテゴリ', 'category.all_category'],
-		['全日記/全カテゴリ', 'category.all'],
-	].each do |button, name|
-		r << <<HTML
-<tr>
-	<td>#{button}</td>
-	<td><input type="text" name="#{name}" value="#{h @conf[name]}" size="30"></td>
-	<td><p><span class="adminmenu"><a>#{h @conf[name].sub(/\$1/, "2007").sub(/\$2/, "2")}</a></span></p></td>
-</tr>
-HTML
-	end
-	r << <<HTML
-</table>
-HTML
-end
-
- at category_icon_none_label = 'アイコンなし'
- at category_icon_conf_label = 'カテゴリアイコン'
-def category_icon_conf_html
-	r = ''
-	unless @conf.secure
-		r << <<HTML
-<h3 class="subtitle">カテゴリアイコンの置き場所</h3>
-<p>
-カテゴリアイコン用の画像が保存されているディレクトリとそのURLを指定します。
-</p>
-<p>
-<dl>
-<dt>ディレクトリ:</dt>
-<dd><input name="category.icon_dir" value="#{h @category_icon_dir}" size="30"></dd>
-<dt>URL:</dt>
-<dd><input name="category.icon_url" value="#{h @category_icon_url}" size="30"></dd>
-</dl>
-</p>
-<hr>
-HTML
-	end
-
-	str = ''
-	@categories.each do |c|
-		str << %Q|\t<tr>\n\t\t<td>#{c}</td>\n\t\t<td>\n|
-		str << category_icon_select(c)
-		str << %Q|<img src="#{h @category_icon_url}#{h @category_icon[c]}">| if @category_icon[c]
-		str << %Q|</td>\n\t</tr>\n|
-	end
-	r << <<HTML
-<h3 class="subtitle">カテゴリアイコン</h3>
-<p>
-各カテゴリのアイコンをドロップダウンリストから選択します。
-<p>
-<table>
-	<tr><th>カテゴリ</th><th>アイコン</th></tr>
-#{str}
-</table>
-</p>
-<hr>
-<h3 class="subtitle">アイコンサンプル</h3>
-<p>
-選択可能なアイコン一覧です.
-アイコンにマウスカーソルを合わせるとアイコンのファイル名がポップアップ表示されます。
-</p>
-<p>
-#{category_icon_sample}
-</p>
-HTML
+def category_conf_html
+	r = <<-HTML
+		<h3 class="subtitle">カテゴリインデックスの作成</h3>
+		<p>
+		カテゴリの機能を利用するにはカテゴリインデックスをあらかじめ作成しておく必要があります。
+		カテゴリインデックスを作成するには
+		以下のチェックを入れてからOKボタンを押してください。
+		</p>
+		<p><label for="category_initialize">
+		<input type="checkbox" id="category_initialize" name="category_initialize" value="1">カテゴリインデックスの作成
+		</label></p>
+		<p>
+		数秒から数十秒でインデックスの作成は終了しますが、日記の量が多い場合やサーバの性能が低い場合はタイムアウトしてしまう場合があります。この場合はオフラインで作成して下さい。
+		</p>
+
+		<h3 class="subtitle">日記編集サポート</h3>
+		<p>
+		日記編集画面の「本文」の下にカテゴリ名を一覧表示することができます。
+		カテゴリ名をクリックすると「本文」にそのカテゴリ名が挿入されます(要JavaScript)。
+		</p>
+		<p>
+			<select name="category.edit_support">
+				<option value="1"#{" selected" if @conf['category.edit_support'] == 1}>一覧表示</option>
+				<option value="2"#{" selected" if @conf['category.edit_support'] == 2}>ドロップダウンリスト</option>
+				<option value="0"#{" selected" if @conf['category.edit_support'] == 0}>表示しない</option>
+			</select>
+		</p>
+	HTML
 	r
 end
 
diff --git a/misc/plugin/ja/disp_referrer.rb b/misc/plugin/ja/disp_referrer.rb
index 80c7a82..3d37981 100644
--- a/misc/plugin/ja/disp_referrer.rb
+++ b/misc/plugin/ja/disp_referrer.rb
@@ -98,8 +98,6 @@ tdiary-1.5.3-20030509以降で使えます。これ以前のtDiary-1.5では、
 00default.rbにbot?メソッドが定義されていないため、検索エンジンのクロール
 に対してリンク元が表示されてしまいます。
 
-secureモードでも使えますがキャッシュによる高速化ができません。
-
 mod_rubyでの動作は今のところ確認していません。
 
 === インストール方法
@@ -143,7 +141,6 @@ mod_rubyでの動作は今のところ確認していません。
 皆様に感謝いたします。
 
 == Todos
-* secure=trueでリンク元置換リストのテキストフィールドでリターンを押した際の動作
 * parse_as_search高速化: hostnameのキャッシュ?
 
 == 著作権について
@@ -295,7 +292,6 @@ class DispRef2SetupIF
 				<td><label for="dr2.search.expand.false"><input id="dr2.search.expand.false" name="dr2.search.expand" value="false" type="radio"#{' checked'if not @setup['search.expand']}>表示しない</label>。
 			</table>
 		_HTML
-		unless @setup.secure then
 		r << <<-_HTML
 			<h3>キャッシュ</h3>
 			<p>キャッシュ機能は、tDiary2形式(DefaultIO)使用時は利用できません。</p>
@@ -315,19 +311,14 @@ class DispRef2SetupIF
 			</table>
 			<p>キャッシュの大きさの制限は目安です。これよりも大きくなる場合もあります。キャッシュの大きさの制限を0にすると、キャッシュの大きさを制限しなくなります。最後にKやMをつけると、キロバイト、メガバイト単位になります。</p>
 		_HTML
-		end # unless @setup.secure
 		r
 	end
 
 	# shows URL list to be added to the referer_table or no_referer
 	def show_unknown_list
-		if @setup.secure then
+		urls = DispRef2Cache.new( @setup ).urls( DispRef2URL::Unknown ).keys
+		if urls.size == 0 then
 			urls = DispRef2Latest.new( @cgi, 'latest.rhtml', @conf, @setup ).unknown_urls
-		else
-			urls = DispRef2Cache.new( @setup ).urls( DispRef2URL::Unknown ).keys
-			if urls.size == 0 then
-				urls = DispRef2Latest.new( @cgi, 'latest.rhtml', @conf, @setup ).unknown_urls
-			end
 		end
 		urls.reject!{ |url| DispRef2String::url_match?( url, @setup['reflist.ignore_urls'] ) }
 		r = <<-_HTML
diff --git a/misc/plugin/ja/search_control.rb b/misc/plugin/ja/search_control.rb
index d94885b..8a1c5ce 100644
--- a/misc/plugin/ja/search_control.rb
+++ b/misc/plugin/ja/search_control.rb
@@ -18,8 +18,6 @@
 実際に効果があるかどうかは、検索エンジンのロボットがメタタグを解釈して
 くれるかどうかにかかっています。
 
-secure==trueな日記でも使えます。
-
 == License
 Copyright (C) 2003, 2004 zunda <zunda at freeshell.org>
 
diff --git a/misc/plugin/ja/weather.rb b/misc/plugin/ja/weather.rb
index e3cca47..1174941 100644
--- a/misc/plugin/ja/weather.rb
+++ b/misc/plugin/ja/weather.rb
@@ -48,8 +48,7 @@ tdiary.confを編集する場合には、@options['weather.url']に設定して
 などとしておけばいいでしょう。
 
 日記に使用しているWWWサーバーからサーバーの権限でWWWページの閲覧ができる
-必要があります。環境変数TZを変更する場合がありますので、secureモードでは
-使えません。mod_rubyでの動作は今のところ確認していません。
+必要があります。mod_rubyでの動作は今のところ確認していません。
 
 デフォルトでは、携帯端末から閲覧された場合には天気を表示しないようになっ
 ています。携帯からでも天気を表示したい場合には、設定画面から設定するか、
diff --git a/misc/plugin/random_google.rb b/misc/plugin/random_google.rb
index 44ef256..386e46d 100644
--- a/misc/plugin/random_google.rb
+++ b/misc/plugin/random_google.rb
@@ -49,12 +49,8 @@ def random_google_init
 	@conf['random_google.popup'] ||= '本日のお題: $1'
 	@conf['random_google.append'] ||= ''
 	@conf['random_google.exception'] ||= ''
-	if @conf.secure
-		@conf['random_google.analyzer'] = "internal"
-	else
-		@conf['random_google.analyzer'] ||= "internal"
-		@conf['random_google.analyzer_path'] ||= ""
-	end
+	@conf['random_google.analyzer'] ||= "internal"
+	@conf['random_google.analyzer_path'] ||= ""
 end
 
 if /(latest|day)/ === @mode and !bot?
@@ -93,12 +89,8 @@ def saveconf_random_google
 		@conf['random_google.popup'] = @cgi.params['random_google_popup'][0]
 		@conf['random_google.append'] = @cgi.params['random_google_append'][0]
 		@conf['random_google.exception'] = @cgi.params['random_google_exception'][0]
-		if @conf.secure
-			@conf['random_google.analyzer'] = "internal"
-		else
-			@conf['random_google.analyzer'] = @cgi.params['random_google_analyzer'][0]
-			@conf['random_google.analyzer_path'] = @cgi.params['random_google_analyzer_path'][0]
-		end
+		@conf['random_google.analyzer'] = @cgi.params['random_google_analyzer'][0]
+		@conf['random_google.analyzer_path'] = @cgi.params['random_google_analyzer_path'][0]
 	end
 end
 
@@ -134,7 +126,6 @@ add_conf_proc('RandomGoogle', '関連するかもしれないページ検索') d
 	<p><input name="random_google_exception" size="70" value="#{h @conf['random_google.exception']}"></p>
 	HTML
 
-	unless @conf.secure
 		r << <<-HTML
 	<h3 class="subtitle">形態素解析器の利用</h3>
 	<p>キーワードの抽出に形態素解析器を利用するかどうかを指定します.形態素解析器を使用しない場合は/([亜-瑤]{2,}|[ァ-ヶー]{2,}|[0-9A-Za-z]{2,})/という正規表現でキーワードを抽出しますが,あまり精度はよくありません.</p>
@@ -152,7 +143,6 @@ add_conf_proc('RandomGoogle', '関連するかもしれないページ検索') d
 	<p>例)</p><pre>/usr/local/bin/chasen</pre>
 	<p><input name="random_google_analyzer_path" size="70" value="#{h @conf['random_google.analyzer_path']}"></p>
 	HTML
-	end
 	r
 end
 
diff --git a/misc/plugin/recent_comment3.rb b/misc/plugin/recent_comment3.rb
index e81eb9b..07533a1 100644
--- a/misc/plugin/recent_comment3.rb
+++ b/misc/plugin/recent_comment3.rb
@@ -2,8 +2,6 @@
 #
 # recent_comment3: 最近のツッコミをリストアップする
 #
-#   @secure = true な環境では動作しません.
-#
 # Copyright (c) 2002 Junichiro KITA <kita at kitaj.no-ip.com>
 # Distributed under the GPL2 or any later version.
 #
@@ -41,8 +39,6 @@ def recent_comment3_init
 end
 
 def recent_comment3(ob_max = 'OBSOLUTE' ,sep = 'OBSOLUTE',ob_date_format = 'OBSOLUTE',*ob_except )
-	return 'DO NOT USE IN SECURE MODE' if @conf.secure
-
 	migrate_old_data
 	recent_comment3_init
 
diff --git a/misc/plugin/recent_rss.rb b/misc/plugin/recent_rss.rb
index ce3b8c0..e438144 100644
--- a/misc/plugin/recent_rss.rb
+++ b/misc/plugin/recent_rss.rb
@@ -28,8 +28,6 @@ RECENT_RSS_HTTP_HEADER = {
 }
 
 def recent_rss( url, max = 5, cache_time = 3600, show_modified = true )
-	return 'DO NOT USE IN SECURE MODE' if @conf.secure
-
 	url.untaint
 
 	cache_file = "#{@cache_path}/recent_rss.#{CGI.escape(url)}"
diff --git a/misc/plugin/squeeze.rb b/misc/plugin/squeeze.rb
deleted file mode 100755
index a13c084..0000000
--- a/misc/plugin/squeeze.rb
+++ /dev/null
@@ -1,272 +0,0 @@
-#!/usr/bin/env ruby
-
-# squeeze.rb
-#
-# Create daily HTML file from tDiary database.
-#
-# See URLs below for more details.
-#   http://ponx.s5.xrea.com/hiki/squeeze.rb.html (English)
-#   http://ponx.s5.xrea.com/hiki/ja/squeeze.rb.html (Japanese)
-#
-# Copyright (C) 2002 MUTOH Masao <mutoh at highway.ne.jp>
-# You can redistribute it and/or modify it under GPL2 or any later version.
-#
-# The original version of this file was distributed with squeeze
-# TADA Tadashi <sho at spc.gr.jp> with GPL2 or any later version.
-#
-unless $tdiary_squeeze_loaded
-$tdiary_squeeze_loaded ||= true
-
-mode = defined?(TDiary) ? "PLUGIN" : ENV["REQUEST_METHOD"]? "CGI" : "CMD"
-
-if mode == "CMD" || mode == "CGI"
-	output_path = "./html/"
-	tdiary_path = "."
-	tdiary_conf = "."
-	suffix = ''
-	all_data = false
-	overwrite = false
-	compat = false
-	$stdout.sync = true
-
-	if mode == "CMD"
-		def usage
-			puts "squeeze $Revision: 1.25 $"
-			puts " making html files from tDiary's database."
-			puts " usage: ruby squeeze.rb [-p <tDiary path>] [-c <tdiary.conf path>] [-a] [-s] [-x suffix] <dest path>"
-			exit
-		end
-
-		require 'getoptlong'
-		parser = GetoptLong::new
-		parser.set_options(['--path', '-p', GetoptLong::REQUIRED_ARGUMENT],
-											 ['--conf', '-c', GetoptLong::REQUIRED_ARGUMENT],
-											 ['--suffix', '-x', GetoptLong::REQUIRED_ARGUMENT],
-											 ['--all', '-a', GetoptLong::NO_ARGUMENT],
-											 ['--overwrite', '-o', GetoptLong::NO_ARGUMENT],
-											 ['--squeeze', '-s', GetoptLong::NO_ARGUMENT])
-		begin
-			parser.each do |opt, arg|
-				case opt
-				when '--path'
-					tdiary_path = arg.dup.untaint
-				when '--conf'
-					tdiary_conf = arg
-				when '--suffix'
-					suffix = arg
-				when '--all'
-					all_data = true
-				when '--overwrite'
-					overwrite = true
-				when '--squeeze'
-					compat = true
-				end
-			end
-		rescue
-			usage
-			exit( 1 )
-		end
-		output_path = ARGV.shift
-		usage unless output_path
-		output_path = File::expand_path(output_path)
-		output_path += '/' if /\/$/ !~ output_path
-
-		tdiary_conf = tdiary_path unless tdiary_conf
-		Dir::chdir( tdiary_conf )
-		ARGV << '' # dummy argument against cgi.rb offline mode.
-		$:.unshift tdiary_path
-	else
-		@options = Hash.new
-		File::readlines("tdiary.conf").each {|item|
-			if item =~ /@options/
-				begin
-					eval(item)
-				rescue SyntaxError
-				end
-			end
-		}
-		output_path = @options['squeeze.output_path'] || @options['yasqueeze.output_path']
-		suffix = @options['squeeze.suffix'] || ''
-		all_data = @options['squeeze.all_data'] || @options['yasqueeze.all_data']
-		overwrite = @options['squeeze.overwrite']
-		compat = @options['squeeze.compat_path'] || @options['yasqueeze.compat_path']
-
-		if FileTest::symlink?( __FILE__ ) then
-			org_path = File::dirname( File::readlink( __FILE__ ) )
-		else
-			org_path = File::dirname( __FILE__ )
-		end
-		$:.unshift( org_path.untaint )
-	end
-
-	begin
-		require "tdiary"
-	rescue LoadError
-		$stderr.print "squeeze.rb: cannot load tdiary.rb. <#{tdiary_path}/tdiary>\n"
-		exit( 1 )
-	end
-end
-
-#
-# Dairy Squeeze
-#
-module ::TDiary
-	class YATDiarySqueeze < TDiaryBase
-		def initialize(diary, dest, all_data, overwrite, compat, conf, suffix)
-			@ignore_parser_cache = true
-
-			cgi = CGI::new
-			def cgi.referer; nil; end
-			def cgi.user_agent; 'bot'; end
-			super( cgi, 'day.rhtml', conf )
-			@diary = diary
-			@date = diary.date
-			@diaries = {@date.strftime('%Y%m%d') => @diary} if @diaries.size == 0
-			@dest = dest
-			@all_data = all_data
-			@overwrite = overwrite
-			@compat = compat
-			@suffix = suffix
-		end
-
-		def execute
-			if @compat
-				dir = @dest
-				name = @diary.date.strftime('%Y%m%d')
-			else
-				dir = @dest + "/" + @diary.date.strftime('%Y')
-				name = @diary.date.strftime('%m%d')
-				Dir.mkdir(dir, 0755) unless File.directory?(dir)
-			end
-			filename = dir + "/" + name + @suffix
-			if FileTest.exist?( filename ) and @overwrite
-				File::delete( filename )
-			end
-			if @diary.visible? or @all_data
-				if not FileTest::exist?(filename) or
-						File::mtime(filename) != @diary.last_modified
-					File::open(filename, 'w'){|f| f.write(eval_rhtml)}
-					File::utime(@diary.last_modified, @diary.last_modified, filename)
-				end
-			else
-				if FileTest.exist?(filename) and ! @all_data
-					name = "remove #{name}"
-					File::delete(filename)
-				else
-					name = ""
-				end
-			end
-			name
-		end
-
-		protected
-		def mode
-			'day'
-		end
-
-		def cookie_name; ''; end
-		def cookie_mail; ''; end
-	end
-end
-
-#
-# Main
-#
-module ::TDiary
-	class YATDiarySqueezeMain < TDiaryBase
-		def initialize(dest, all_data, overwrite, compat, conf, suffix)
-			@ignore_parser_cache = true
-
-			cgi = CGI::new
-			def cgi.referer; nil; end
-			super( cgi, 'day.rhtml', conf )
-			calendar
-			@years.keys.sort.each do |year|
-				print "(#{year.to_s}/) "
-				@years[year.to_s].sort.each do |month|
-					diaries2 = nil
-					@io.transaction(Time::local(year.to_i, month.to_i)) do |diaries|
-						diaries2 = diaries
-						DIRTY_NONE
-					end
-					diaries2.sort.each do |day, diary|
-						print YATDiarySqueeze.new(diary, dest, all_data, overwrite, compat, conf, suffix).execute + " "
-					end
-				end
-			end
-		end
-	end
-end
-
-squeeze_navi_on_footer = '<div class="adminmenu"><%= navi_user %></div>'
-
-if mode == "CGI" || mode == "CMD"
-	if mode == "CGI"
-		print %Q[Content-type:text/html\n\n
-			<html>
-			<head>
-				<title>Squeeze for tDiary</title>
-				<link href="./theme/default/default.css" type="text/css" rel="stylesheet"/>
-			</head>
-			<body><div style="text-align:center">
-			<h1>Squeeze for tDiary</h1>
-			<p>$Revision: 1.25 $</p>
-			<p>Copyright (C) 2002 MUTOH Masao<mutoh at highway.ne.jp></p></div>
-			<br><br>Start!</p><hr>
-		]
-	end
-
-	begin
-		require 'cgi'
-		cgi = CGI.new
-		def cgi.user_agent; 'bot'; end
-		conf = TDiary::Config::new(cgi)
-		conf.header = ''
-		conf.footer = squeeze_navi_on_footer
-		conf.show_comment = true
-		conf.hide_comment_form = true
-		output_path = "#{conf.data_path}/cache/html" unless output_path
-		Dir.mkdir(output_path, 0755) unless File.directory?(output_path)
-		::TDiary::YATDiarySqueezeMain.new(output_path, all_data, overwrite, compat, conf, suffix)
-	rescue
-		print $!, "\n"
-		$@.each do |v|
-			print v, "\n"
-		end
-		exit( 1 )
-	end
-
-	if mode == "CGI"
-		print "<hr><p>End!</p></body></html>\n"
-	else
-		print "\n\n"
-	end
-else
-	add_update_proc do
-		conf = @conf.clone
-		conf.header = ''
-		conf.footer = squeeze_navi_on_footer
-		conf.show_comment = true
-		conf.hide_comment_form = true
-
-		diary = @diaries[@date.strftime('%Y%m%d')]
-		dir = @options['squeeze.output_path'] || @options['yasqueeze.output_path']
-		dir = @cache_path + "/html" unless dir
-		Dir.mkdir(dir, 0755) unless File.directory?(dir)
-		::TDiary::YATDiarySqueeze.new(diary, dir,
-					    @options['squeeze.all_data'] || @options['yasqueeze.all_data'],
-					    @options['squeeze.overwrite'],
-					    @options['squeeze.compat_path'] || @options['yasqueeze.compat_path'],
-					    conf,
-					    @options['squeeze.suffix'] || ''
-					    ).execute
-	end
-end
-end
-
-# Local Variables:
-# mode: ruby
-# indent-tabs-mode: t
-# tab-width: 3
-# ruby-indent-level: 3
-# End:
diff --git a/misc/plugin/theme_online.rb b/misc/plugin/theme_online.rb
index 3525b43..f2c9447 100644
--- a/misc/plugin/theme_online.rb
+++ b/misc/plugin/theme_online.rb
@@ -10,7 +10,7 @@ require 'json'
 require 'open-uri'
 
 def theme_list_online(list)
-	url = @options['theme_online.url'] || 'http://theme.tdiary.org/'
+	url = @options['theme_online.url'] || '//tdiary.github.io/tdiary-theme/'
 	url = "http:#{url}" if url =~ %r|\A//|
 	begin
 		online_list = JSON.load(open(File.join(url, 'themes.json'), &:read))['themes']
@@ -26,6 +26,6 @@ def theme_list_online(list)
 end
 
 def theme_url_online(theme)
-	url = @options['theme_online.url'] || 'http://theme.tdiary.org/'
+	url = @options['theme_online.url'] || '//tdiary.github.io/tdiary-theme/'
 	File.join(url, "#{h theme}/#{h theme}.css")
 end
diff --git a/misc/plugin/title_tag.rb b/misc/plugin/title_tag.rb
index fe1aa10..2dd0eda 100644
--- a/misc/plugin/title_tag.rb
+++ b/misc/plugin/title_tag.rb
@@ -57,12 +57,17 @@ def title_tag
 			day_title << apply_plugin(diary.title, true) << ':'
 		end
 		t2 = ''
-		if @plugin_files.grep(/\/category.rb$/).empty? then
-			t2 << diary.all_subtitles_to_html.join(', ')
+		if @plugin_files.grep(/\/category.*\.rb$/).empty? then
+			t2 << diary.all_subtitles_to_html.delete_if{|s|s.size == 0}.join(', ')
 		else
-			t2 << diary.all_stripped_subtitles_to_html.join(', ')
+			t2 << diary.all_stripped_subtitles_to_html.delete_if{|s|s.size == 0}.join(', ')
+		end
+		sub_part = "#{h day_title} #{@conf.shorten(apply_plugin(t2, true))}"
+		if sub_part.size <= 1
+			return "<title>#{h( site_title )}</title>"
+		else
+			return "<title>#{sub_part} - #{h( site_title )}</title>"
 		end
-		return "<title>#{h day_title} #{@conf.shorten(apply_plugin(t2, true))} - #{h( site_title )}</title>"
 	elsif @mode == 'categoryview' then
 		return @conf.shorten("<title>#{h( @html_title )}#{h( category_title() )}</title>")
 	else
diff --git a/spec/acceptance/append_comment_spec.rb b/spec/acceptance/append_comment_spec.rb
index 76f9d74..0171b38 100644
--- a/spec/acceptance/append_comment_spec.rb
+++ b/spec/acceptance/append_comment_spec.rb
@@ -66,7 +66,7 @@ BODY
 		}
 	end
 
-	scenario 'recent_comment3.rb', :exclude_secure do
+	scenario 'recent_comment3.rb' do
 		append_default_diary
 		visit '/'
 		click_link 'ツッコミを入れる'
diff --git a/spec/acceptance/save_conf_plugin_spec.rb b/spec/acceptance/save_conf_plugin_spec.rb
index b079159..54f59de 100644
--- a/spec/acceptance/save_conf_plugin_spec.rb
+++ b/spec/acceptance/save_conf_plugin_spec.rb
@@ -56,8 +56,8 @@ feature 'プラグイン選択設定の利用' do
 
 		expect(page.body).to be_include('caretposition.js')
 		expect(page.body).to be_include('category_autocomplete.js')
-		expect(page.body).to be_include('//ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js')
-		expect(page.body).not_to be_include('//ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js?')
+		expect(page.body).to be_include('//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js')
+		expect(page.body).not_to be_include('//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js?')
 	end
 end
 # Local Variables:
diff --git a/spec/acceptance/save_conf_security_spec.rb b/spec/acceptance/save_conf_security_spec.rb
index 976cb84..1f5b65c 100644
--- a/spec/acceptance/save_conf_security_spec.rb
+++ b/spec/acceptance/save_conf_security_spec.rb
@@ -249,14 +249,7 @@ BODY
 		expect(page).to have_content 'これはツッコミの注意文です'
 	end
 
-	scenario 'スパムフィルターのログ記録の設定ができない', :exclude_no_secure do
-		append_default_diary
-
-		visit '/update.rb?conf=spamfilter'
-		expect(page).not_to have_field 'filter.debug_mode'
-	end
-
-	scenario 'スパムフィルターのログ記録の設定が保存される', :exclude_secure do
+	scenario 'スパムフィルターのログ記録の設定が保存される' do
 		append_default_diary
 
 		visit '/update.rb?conf=spamfilter'
diff --git a/spec/acceptance/view_category_spec.rb b/spec/acceptance/view_category_spec.rb
index 125335c..a6fa62e 100644
--- a/spec/acceptance/view_category_spec.rb
+++ b/spec/acceptance/view_category_spec.rb
@@ -25,7 +25,7 @@ BODY
 
 		visit '/'
 		page.find('a', text: "category").click
-		expect(page).to have_content 'Categories'
+		expect(page).to have_content '[category]'
 	end
 end
 
diff --git a/spec/acceptance_helper.rb b/spec/acceptance_helper.rb
index a36fffa..2233e6d 100644
--- a/spec/acceptance_helper.rb
+++ b/spec/acceptance_helper.rb
@@ -53,11 +53,9 @@ RSpec.configure do |config|
 
 	excludes = case ENV['TEST_MODE']
 				  when 'webrick'
-					  [:exclude_selenium, :exclude_no_secure]
-				  when 'secure'
-					  [:exclude_rack, :exclude_secure]
+					  [:exclude_selenium]
 				  else # rack
-					  [:exclude_rack, :exclude_no_secure]
+					  [:exclude_rack]
 				  end
 	excludes.each do |exclude|
 		config.filter_run_excluding exclude
diff --git a/spec/core/plugin_spec.rb b/spec/core/plugin_spec.rb
index efa97ea..a6c4a89 100644
--- a/spec/core/plugin_spec.rb
+++ b/spec/core/plugin_spec.rb
@@ -42,19 +42,12 @@ describe TDiary::Plugin do
 			@src = ERB::new('hello <%= sample %><%= undefined_method %>').src
 			@plugin.instance_variable_set(:@debug, false)
 		end
-		subject { @plugin.eval_src(@src, false) }
+		subject { @plugin.eval_src(@src) }
 
 		it 'Pluginオブジェクト内でソースが実行されること' do
 			is_expected.to eq 'hello sample plugin'
 		end
 
-		context 'secureモード指定の場合' do
-			it 'Safeモード4で実行されること' do
-				expect(Safe).to receive(:safe).with(4)
-				@plugin.eval_src(@src, true)
-			end
-		end
-
 		context 'debugモードがONの場合' do
 			before { @plugin.instance_variable_set(:@debug, true) }
 
diff --git a/spec/fixtures/tdiary.conf.gem b/spec/fixtures/tdiary.conf.gem
index 059c7bf..7600c22 100644
--- a/spec/fixtures/tdiary.conf.gem
+++ b/spec/fixtures/tdiary.conf.gem
@@ -208,5 +208,4 @@ FOOTER
 	['^http://([^\.]*)\.tdiary\.net/.*', 'tDiary.Net[\1]'],
 ]
 
- at secure = false
 load_cgi_conf
diff --git a/spec/fixtures/tdiary.conf.rack b/spec/fixtures/tdiary.conf.rack
index 059c7bf..7600c22 100644
--- a/spec/fixtures/tdiary.conf.rack
+++ b/spec/fixtures/tdiary.conf.rack
@@ -208,5 +208,4 @@ FOOTER
 	['^http://([^\.]*)\.tdiary\.net/.*', 'tDiary.Net[\1]'],
 ]
 
- at secure = false
 load_cgi_conf
diff --git a/spec/fixtures/tdiary.conf.secure b/spec/fixtures/tdiary.conf.secure
deleted file mode 100644
index 0dc4d90..0000000
--- a/spec/fixtures/tdiary.conf.secure
+++ /dev/null
@@ -1,204 +0,0 @@
- at data_path = File.expand_path("tmp/data", File.dirname(__FILE__))
-
- at style = 'Wiki'
- at index = './'
- at update = 'update.rb'
-
- at options['apply_plugin'] = true
- at options['sp.path'] = [
-	'misc/plugin'
-]
-
- at accesskey_enabled = false
- at options['bot'] = [
-	'^BlogLines/',
-	'^blogmap',
-	'MI[CK]AN/',
-	'^NG/',
-	'^samidare',
-	'^TAMATEBAKO/'
-]
-
- at options['sp.selected'] =
-"amazon.rb
-append-css.rb
-calendar2.rb
-category.rb
-comment_mail-smtp.rb
-disp_referrer.rb
-dropdown_calendar.rb
-footnote.rb
-highlight.rb
-image.rb
-jdate.rb
-kw.rb
-makerss.rb
-my-ex.rb
-"
-
- at options['dropdown_calendar.label'] = ''
- at options['makerss.file'] = 'index.rdf'
- at options['makerss.no_comments.file'] = 'no_comments.rdf'
-
- at options['spamfilter.bad_comment_patts'] = "(href=|casino|gambling|betting|fastsearch\\.eu\\.com|ganzao|poker|holdem|hold.em|roulette|drug|tramadol|viagra|fioricet|oxycontin|biaxin|aldara|business cards|home depot|slot.?machine|insurance|getblog2|video-game|Good site|internet-all\\.com|deai|tdfms|comu2|omaha)\r\n"
- at options['spamfilter.bad_ip_addrs'] = ""
- at options['spamfilter.bad_mail_patts'] = "(mu at alloha\\.info|mumu2004 at mail\\.com|zhongleibo|dfd at 12\\.com|anonimous|aol\\.|yahoo\\.|google\\.|hotmail\\.|msn\\.|leroy\\.|ablare\\.|gmx\\.|lorazepam|\\.co$)"
- at options['spamfilter.bad_uri_patts'] = ""
- at options['spamfilter.bad_uri_patts_for_mails'] = false
- at options['spamfilter.debug_file'] = ""
- at options['spamfilter.debug_mode'] = false
- at options['spamfilter.filter_mode'] = true
- at options['spamfilter.max_uris'] = "2"
- at options['spamfilter.resolv_check'] = false
- at options['spamfilter.resolv_check_mode'] = false
- at options['spamlookup.domain.list'] = "bsb.spamlookup.net\r\nsc.surbl.org\r\nrbl.bulkfeeds.jp"
- at options['spamlookup.safe_domain.list'] = "search.yahoo.co.jp\r\nwww.google.com\r\nwww.google.co.jp\r\nsearch.msn.co.jp"
-
-
- at html_title = %Q[【日記のタイトル】(→<a href="#{@update}?conf=default">サイトの情報</a>で変更しましょう)]
-
- at header = <<HEADER
-<%= navi %>
-<h1><%= @html_title %></h1>
-<div class="main">
-HEADER
-
- at footer = <<FOOTER
-</div>
-<div class="sidebar">
-<div style="text-align: center">
-	<%=calendar2%>
-	<%=calendar%>
-</div>
-</div>
-FOOTER
-
- at date_format = '%Y年%m月%d日'
-
- at section_anchor = '<span class="sanchor">_</span>'
- at comment_anchor = '<span class="canchor">_</span>'
-
- at latest_limit = 10
-
- at theme = 'default'
-
- at show_comment = true
- at comment_limit = 3
-
- at show_referer = true
- at referer_day_only = true
-
- at hour_offset = 0
-
- at show_nyear = true
-
- at no_referer = [
-	# '^' + Regexp.quote( base_url ),  # 自分の日記
-	'^http://localhost[:/]',
-	'^http://192\.168\.',
-	'^http://172\.1[6789]',
-	'^http://172\.2[0-9]',
-	'^http://172\.3[01]',
-	'^http://10\.',
-	'^http:/+$',
-	'^http://[^/]+$',
-	'search\\?q=cache:',
-	'^http://cache\.yahoofs\.jp/',
-	'^http://[^\.]+\.alexa\.com/',
-	'^http://www\.hotbot\.com/',
-	'^http://gw\.mobile\.goo\.ne\.jp/',
-	'^http://haro\.jp/rss/',
-	'^https?://(www.)?bloglines.com[/:]',
-	'^http://del\.icio\.us/',
-	'^http://d\.hatena\.ne\.jp/.*/\?of=\d+$',
-	'^http://feedbringer\.net/',
-	'^http://reader\.www\.infoseek\.co\.jp/',
-	'^http://feedpath\.jp/feedreader/',
-	'^http://webryreader\.biglobe\.ne\.jp/',
-	'^http://www\.easythumbs\.com',
-	'^http://www\.shinobi\.jp/',
-	'^http://freerss\.net/',
-	'^http://g\.msn\.com/',
-	'^http://myweb-bookmarks\.com/',
-	'^http://reader\.livedoor\.com/',
-	'^http://wrs\.search\.yahoo\.co\.jp/',
-	'^http://www\.google\.com/reader/',
-	'^http://my\.yahoo\.co\.jp/',
-	'^http://data\.click\.rss\.drecom\.jp/',
-	'^http://i-know\.jp/',
-	'^http://r\.hatena\.ne\.jp/',
-	'^http://reader\.freerss\.net/',
-	'^http://reader\.goo\.ne\.jp/',
-	'^https://enter\.nifty\.com/my/',
-	'/feedshow(cat|cat|all|guide)?\.php',
-]
-
- at no_referer2 = [
-	'(sex|pussy|porn|xxx|rape|nudity|x-pictures|x-stories|pics--movies|teen|shemale|scat|pissing|pantyhose|mature|incest|hentai|bdsm|taboo|bestiality|violence|tits|cocks|peeing|anal|lesbian|shaved|www89.com|casino|poker|gambl|diet|discount|holdem|texas|viagra|betting|insurance|pharmac|phentermin|mortgage|loan|credit-card|hotel|credit|debt|get-sport|available-sport|sport-2u|-doctor|feelor\.com|adoptingcenter|domainthriftstore|payday|rrso|novacspacetravel|pills|radcraft\.com|partyshopcentral| [...]
-]
-
- at only_volatile = [
-]
-
- at only_volatile2 = [
-	'^http://(www|images|translate)\.google\.[^/]+/',
-	'^http://([a-z]+\.)?(search|google|websearch|srd)\.yahoo\.[^/]+/',
-	'^http://(\w+\.)?search\.msn\.[^/]+/',
-	'^http://g\.msn\.com/',
-	'^http://([^\.]+\.)?goo\.ne\.jp/',
-	'^http://(www\.)?infoseek\.[^/]+/[OI]?Titles',
-	'^http://search\.fresheye\.com/',
-	'^http://[^\.]+\.excite\.[^/]+/search',
-	'^http://ask\.jp/',
-	'^http://www\.tocc\.co\.jp/search/',
-	'^http://[^\.]*\.lycos\.[a-z\.]+/',
-	'\.search\.biglobe\.ne\.jp/',
-	'^https?://(search|enter)\.nifty\.com/',
-	'^http://search\.jp\.aol\.com/',
-	'^http://www\.looksmart\.com/',
-	'^http://[^.]*\.naver\.co\.jp/',
-	'^http://allabout\.co\.jp/.*?/extsearch',
-	'^http://www\.isao\.net/search/',
-	'^http://(search-intl|search)\.netscape\.com/',
-	'^http://www\.wisenut\.com/',
-	'^http://www\.search\.com/',
-	'^http://(www|labs)\.ceek\.jp/',
-	'^http://seek\.3721\.com/',
-	'^http://search\.jword\.jp/',
-	'^http://www\.alltheweb\.com/',
-	'searchscout\.com/',
-	'^http://(sf|search)\.livedoor\.com/',
-	'^http://www\.myblog\.jp/',
-	'^http://mixi\.jp/',
-	'^http://aolsearch\.jp\.aol\.com/',
-	'^http://cgi\.search\.biglobe\.ne\.jp/cgi-bin/search2-b',
-	'^http://excite\.co\.jp/search',
-	'^http://so-net\.search\.goo\.ne\.jp/',
-	'^http://www.altavista.com',
-	'^http://1470\.net/mm/',
-	'^http://www\.rojo\.com/',
-	'^http://[br]\.hatena\.ne\.jp/',
-	'^http://r\.zeromemory\.info/',
-	'^http://newsing\.jp/',
-	'^http://clip\.nifty\.com/',
-	'^http://www\.flog\.jp/',
-	'^http://www\.technorati\.jp/',
-	'^http://netnavigate\.net/',
-	'^http://www\.netvibes\.com/',
-]
-
- at referer_table = [
-	['^(.{50}).*$', '\1...'],
-]
-
- at referer_table2 = [
-	['^http://www\.tdiary\.net/.*', 'tDiary.Net'],
-	['^http://sho\.tdiary\.net/(\d{4})(\d\d)(\d\d)\.html', 'ただのにっき(\1-\2-\3)'],
-	['^http://sho\.tdiary\.net/(\d{4})(\d\d)\.html', 'ただのにっき(\1-\2)'],
-	['^http://([^\.]*)\.tdiary\.net/(\d{4})(\d\d)(\d\d)\.html', 'tDiary.Net[\1](\2-\3-\4)'],
-	['^http://([^\.]*)\.tdiary\.net/(\d{4})(\d\d)\.html', 'tDiary.Net[\1](\2-\3)'],
-	['^http://([^\.]*)\.tdiary\.net/.*', 'tDiary.Net[\1]'],
-]
-
- at secure = true
-load_cgi_conf
diff --git a/spec/fixtures/tdiary.conf.webrick b/spec/fixtures/tdiary.conf.webrick
index 987ba19..a9b72e5 100644
--- a/spec/fixtures/tdiary.conf.webrick
+++ b/spec/fixtures/tdiary.conf.webrick
@@ -208,5 +208,4 @@ FOOTER
 	['^http://([^\.]*)\.tdiary\.net/.*', 'tDiary.Net[\1]'],
 ]
 
- at secure = false
 load_cgi_conf
diff --git a/spec/plugin/plugin_helper.rb b/spec/plugin/plugin_helper.rb
index 094e976..65f10ac 100644
--- a/spec/plugin/plugin_helper.rb
+++ b/spec/plugin/plugin_helper.rb
@@ -90,7 +90,7 @@ class PluginFake
 
 		attr_accessor :index, :update, :author_name, :author_mail, :index_page,
 			:html_title, :theme, :css, :date_format, :referer_table, :options, :cgi,
-			:plugin_path, :lang, :style, :secure,
+			:plugin_path, :lang, :style,
 			:io_class
 
 		def initialize
diff --git a/tdiary.conf.beginner b/tdiary.conf.beginner
index b7670ff..3536719 100644
--- a/tdiary.conf.beginner
+++ b/tdiary.conf.beginner
@@ -236,8 +236,6 @@ FOOTER
 	['^http://([^\.]*)\.tdiary\.net/.*', 'tDiary.Net[\1]'],
 ]
 
- at secure = false
-
 #
 # この下の行を削除してはいけません
 #
diff --git a/tdiary.conf.sample b/tdiary.conf.sample
index c11dc70..a142848 100644
--- a/tdiary.conf.sample
+++ b/tdiary.conf.sample
@@ -336,10 +336,6 @@ FOOTER
 
 #----
 # CGIによる設定ファイルを読む指定【必須】
-#   セキュリティを強化したい場合(tDiaryで日記サービスを提供するなど)に
-#   は、@secureをtrueにして下さい。危険な変数操作や、ファイルの読み込み
-#   が制限されます。
 #----
- at secure = false
 load_cgi_conf
 
diff --git a/tdiary.conf.sample-en b/tdiary.conf.sample-en
index 39b845c..c8268a0 100644
--- a/tdiary.conf.sample-en
+++ b/tdiary.conf.sample-en
@@ -325,9 +325,6 @@ FOOTER
 
 #----
 # CGI configuration file(must)
-#   If you enforce security, you set @secure to true. This 
-#   restricts dangerous operation, for example, variables and file loading.
 #----
- at secure = false
 load_cgi_conf
 
diff --git a/tdiary.gemspec b/tdiary.gemspec
index abd9033..fdc80d4 100644
--- a/tdiary.gemspec
+++ b/tdiary.gemspec
@@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
   spec.executables   = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
   spec.require_paths = ["lib"]
 
-  spec.required_ruby_version = '>= 2.0.0'
+  spec.required_ruby_version = '>= 2.1.0'
 
   spec.add_dependency 'thor', '~> 0.18'
   spec.add_dependency "bundler", "~> 1.3"
diff --git a/test/disp_referrer_test.rb b/test/disp_referrer_test.rb
index 6627d4c..9705e20 100644
--- a/test/disp_referrer_test.rb
+++ b/test/disp_referrer_test.rb
@@ -18,7 +18,6 @@ require 'uri'
 
 # Stub for @conf
 class DispReferrerStubConf
-	def secure; false; end
 	def options; {}; end
 	def referer_table; []; end
 	def no_referer; []; end
diff --git a/update.rb b/update.rb
index 94befdd..41e0404 100755
--- a/update.rb
+++ b/update.rb
@@ -1,5 +1,5 @@
 #!/usr/bin/env ruby
-# -*- coding: utf-8; -*-
+# -*- coding: ascii-8bit; -*-
 #
 # update.rb
 #

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/tdiary.git



More information about the Pkg-ruby-extras-commits mailing list