tdiary 3.2.2.20130507
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +16 -0
- data/.travis.yml +29 -0
- data/Capfile +2 -0
- data/ChangeLog +3173 -0
- data/Gemfile +58 -0
- data/Gemfile.lock +201 -0
- data/LICENSE +340 -0
- data/Procfile +1 -0
- data/README.md +33 -0
- data/Rakefile +26 -0
- data/bin/tdiary +7 -0
- data/config.ru +61 -0
- data/data/.htaccess +2 -0
- data/doc/HOWTO-authenticate-in-rack.md +89 -0
- data/doc/HOWTO-make-io.md +305 -0
- data/doc/HOWTO-make-plugin.md +279 -0
- data/doc/HOWTO-make-theme.md +67 -0
- data/doc/HOWTO-testing-tDiary.md +44 -0
- data/doc/HOWTO-use-plugin.md +148 -0
- data/doc/HOWTO-write-tDiary.en.md +131 -0
- data/doc/HOWTO-write-tDiary.md +136 -0
- data/doc/INSTALL-paas.md +202 -0
- data/doc/INSTALL.md +160 -0
- data/doc/README.en.md +174 -0
- data/doc/README.md +56 -0
- data/doc/UPGRADE.md +164 -0
- data/doc/doc.css +115 -0
- data/dot.htaccess +27 -0
- data/index.fcgi +45 -0
- data/index.rb +57 -0
- data/js/00default.js +60 -0
- data/js/01conf.js +62 -0
- data/js/02edit.coffee +5 -0
- data/js/02edit.js +15 -0
- data/js/amazon.js +43 -0
- data/js/calendar3.js +130 -0
- data/js/caretposition.js +170 -0
- data/js/category.js +29 -0
- data/js/category_autocomplete.js +96 -0
- data/js/comment_ajax.js +27 -0
- data/js/draft.js +149 -0
- data/js/highlight.js +36 -0
- data/js/image.js +181 -0
- data/misc/convert2.rb +123 -0
- data/misc/filter/antispamservice.rb +101 -0
- data/misc/filter/limitdays.rb +40 -0
- data/misc/filter/linkcheck.rb +81 -0
- data/misc/filter/plugin/antispamservice.rb +82 -0
- data/misc/filter/plugin/en/antispamservice.rb +21 -0
- data/misc/filter/plugin/ja/antispamservice.rb +20 -0
- data/misc/lib/README +4 -0
- data/misc/lib/compatible.rb +1 -0
- data/misc/lib/fcgi_patch.rb +90 -0
- data/misc/migrate.rb +157 -0
- data/misc/paas/cloudfoundry/Gemfile +26 -0
- data/misc/paas/cloudfoundry/Gemfile.lock +85 -0
- data/misc/paas/heroku/Gemfile +22 -0
- data/misc/paas/heroku/Gemfile.lock +85 -0
- data/misc/paas/sqale/Gemfile +19 -0
- data/misc/paas/sqale/Gemfile.lock +85 -0
- data/misc/paas/sqale/Procfile +1 -0
- data/misc/paas/sqale/dot.env +1 -0
- data/misc/plugin/ChangeLog.DO_NOT_UPDATE +2333 -0
- data/misc/plugin/a.rb +211 -0
- data/misc/plugin/amazon.rb +403 -0
- data/misc/plugin/amazon/README.en +17 -0
- data/misc/plugin/amazon/README.ja +29 -0
- data/misc/plugin/amazon/amazonimg.rb +113 -0
- data/misc/plugin/amazon/large.png +0 -0
- data/misc/plugin/amazon/medium.png +0 -0
- data/misc/plugin/amazon/small.png +0 -0
- data/misc/plugin/append-css.rb +51 -0
- data/misc/plugin/bq.rb +48 -0
- data/misc/plugin/calendar2.rb +184 -0
- data/misc/plugin/calendar3.rb +256 -0
- data/misc/plugin/category.rb +779 -0
- data/misc/plugin/category_autocomplete.rb +33 -0
- data/misc/plugin/comment_ajax.rb +11 -0
- data/misc/plugin/comment_mail-qmail.rb +57 -0
- data/misc/plugin/comment_mail-sendmail.rb +56 -0
- data/misc/plugin/comment_mail-smtp.rb +59 -0
- data/misc/plugin/comment_rank.rb +36 -0
- data/misc/plugin/counter.rb +631 -0
- data/misc/plugin/daily_theme.rb +55 -0
- data/misc/plugin/disp_referrer.rb +1486 -0
- data/misc/plugin/doctype-html401tr.rb +16 -0
- data/misc/plugin/draft.rb +20 -0
- data/misc/plugin/dropdown_calendar.rb +32 -0
- data/misc/plugin/edit_today.rb +50 -0
- data/misc/plugin/en/a.rb +10 -0
- data/misc/plugin/en/amazon.rb +71 -0
- data/misc/plugin/en/append-css.rb +17 -0
- data/misc/plugin/en/bq.rb +12 -0
- data/misc/plugin/en/calendar2.rb +12 -0
- data/misc/plugin/en/category.rb +204 -0
- data/misc/plugin/en/counter.rb +48 -0
- data/misc/plugin/en/daily_theme.rb +14 -0
- data/misc/plugin/en/disp_referrer.rb +387 -0
- data/misc/plugin/en/dropdown_calendar.rb +14 -0
- data/misc/plugin/en/edit_today.rb +22 -0
- data/misc/plugin/en/hide-mail-field.rb +19 -0
- data/misc/plugin/en/highlight.rb +29 -0
- data/misc/plugin/en/image.rb +54 -0
- data/misc/plugin/en/kw.rb +22 -0
- data/misc/plugin/en/makerss.rb +47 -0
- data/misc/plugin/en/pb-show.rb +21 -0
- data/misc/plugin/en/ping.rb +16 -0
- data/misc/plugin/en/recent_comment.rb +44 -0
- data/misc/plugin/en/recent_comment3.rb +56 -0
- data/misc/plugin/en/recent_rss.rb +33 -0
- data/misc/plugin/en/referer_scheme.rb +48 -0
- data/misc/plugin/en/search_control.rb +74 -0
- data/misc/plugin/en/search_form.rb +22 -0
- data/misc/plugin/en/speed_comment.rb +19 -0
- data/misc/plugin/en/tb-show.rb +37 -0
- data/misc/plugin/en/todo.rb +43 -0
- data/misc/plugin/en/weather.rb +185 -0
- data/misc/plugin/en/xmlrpc.rb +14 -0
- data/misc/plugin/footnote.rb +92 -0
- data/misc/plugin/gradation.rb +39 -0
- data/misc/plugin/gradient.rb +36 -0
- data/misc/plugin/hide-mail-field.rb +50 -0
- data/misc/plugin/highlight.rb +22 -0
- data/misc/plugin/html_anchor.rb +34 -0
- data/misc/plugin/image.rb +290 -0
- data/misc/plugin/ja/amazon.rb +89 -0
- data/misc/plugin/ja/bq.rb +13 -0
- data/misc/plugin/ja/calendar2.rb +12 -0
- data/misc/plugin/ja/category.rb +212 -0
- data/misc/plugin/ja/daily_theme.rb +15 -0
- data/misc/plugin/ja/disp_referrer.rb +644 -0
- data/misc/plugin/ja/edit_today.rb +23 -0
- data/misc/plugin/ja/hide-mail-field.rb +20 -0
- data/misc/plugin/ja/highlight.rb +30 -0
- data/misc/plugin/ja/makerss.rb +44 -0
- data/misc/plugin/ja/my-sequel.rb +52 -0
- data/misc/plugin/ja/pb-show.rb +23 -0
- data/misc/plugin/ja/ping.rb +17 -0
- data/misc/plugin/ja/recent_comment.rb +45 -0
- data/misc/plugin/ja/recent_comment3.rb +57 -0
- data/misc/plugin/ja/recent_rss.rb +34 -0
- data/misc/plugin/ja/referer_scheme.rb +86 -0
- data/misc/plugin/ja/search_control.rb +75 -0
- data/misc/plugin/ja/search_form.rb +32 -0
- data/misc/plugin/ja/tb-show.rb +38 -0
- data/misc/plugin/ja/todo.rb +46 -0
- data/misc/plugin/ja/weather.rb +402 -0
- data/misc/plugin/ja/xmlrpc.rb +15 -0
- data/misc/plugin/kw.rb +150 -0
- data/misc/plugin/list.rb +40 -0
- data/misc/plugin/makelirs.rb +89 -0
- data/misc/plugin/makerss.rb +744 -0
- data/misc/plugin/my-ex.rb +68 -0
- data/misc/plugin/my-sequel.rb +539 -0
- data/misc/plugin/navi_user.rb +19 -0
- data/misc/plugin/number_anchor.rb +47 -0
- data/misc/plugin/pb-show.rb +165 -0
- data/misc/plugin/ping.rb +99 -0
- data/misc/plugin/pre_wrap.rb +19 -0
- data/misc/plugin/random_google.rb +165 -0
- data/misc/plugin/recent_comment.rb +82 -0
- data/misc/plugin/recent_comment3.rb +192 -0
- data/misc/plugin/recent_list.rb +91 -0
- data/misc/plugin/recent_namazu.rb +50 -0
- data/misc/plugin/recent_rss.rb +305 -0
- data/misc/plugin/referer-antibot.rb +53 -0
- data/misc/plugin/referer-utf8.rb +12 -0
- data/misc/plugin/referer_scheme.rb +87 -0
- data/misc/plugin/search_control.rb +227 -0
- data/misc/plugin/search_form.rb +53 -0
- data/misc/plugin/sn.rb +107 -0
- data/misc/plugin/speed_comment.rb +68 -0
- data/misc/plugin/squeeze.rb +272 -0
- data/misc/plugin/src.rb +30 -0
- data/misc/plugin/tb-show.rb +212 -0
- data/misc/plugin/title_list.rb +41 -0
- data/misc/plugin/title_tag.rb +80 -0
- data/misc/plugin/tlink.rb +163 -0
- data/misc/plugin/todo.rb +182 -0
- data/misc/plugin/weather.rb +505 -0
- data/misc/plugin/whatsnew.rb +100 -0
- data/misc/plugin/xmlrpc.rb +80 -0
- data/misc/plugin/xmlrpc/README +20 -0
- data/misc/plugin/xmlrpc/xmlrpc.rb +575 -0
- data/misc/style/emptdiary/README.rd +83 -0
- data/misc/style/emptdiary/README.rd.en +78 -0
- data/misc/style/emptdiary/emptdiary_style.rb +199 -0
- data/misc/style/etdiary/README.rd +83 -0
- data/misc/style/etdiary/etdiary_style.rb +446 -0
- data/misc/style/gfm/gfm_style.rb +194 -0
- data/misc/style/rd/README.rd +71 -0
- data/misc/style/rd/rd_style.rb +366 -0
- data/misc/style/wiki/README +116 -0
- data/misc/style/wiki/README.en +101 -0
- data/misc/style/wiki/wiki_parser.rb +273 -0
- data/misc/style/wiki/wiki_style.rb +478 -0
- data/misc/theme_convert/Readme.rd +21 -0
- data/misc/theme_convert/append.rcss +150 -0
- data/misc/theme_convert/theme_convert.rb +453 -0
- data/plugin/00default.rb +1015 -0
- data/plugin/05referer.rb +298 -0
- data/plugin/10spamfilter.rb +183 -0
- data/plugin/50sp.rb +146 -0
- data/plugin/60sf.rb +152 -0
- data/plugin/90migrate.rb +109 -0
- data/plugin/en/00default.rb +390 -0
- data/plugin/en/05referer.rb +49 -0
- data/plugin/en/10spamfilter.rb +81 -0
- data/plugin/en/50sp.rb +56 -0
- data/plugin/en/60sf.rb +60 -0
- data/plugin/ja/00default.rb +401 -0
- data/plugin/ja/05referer.rb +47 -0
- data/plugin/ja/10spamfilter.rb +79 -0
- data/plugin/ja/50sp.rb +66 -0
- data/plugin/ja/60sf.rb +73 -0
- data/public/.gitkeep +0 -0
- data/public/images/.gitkeep +0 -0
- data/public/javascripts/.gitkeep +0 -0
- data/public/stylesheets/.gitkeep +0 -0
- data/skel/category.rhtml +9 -0
- data/skel/conf.rhtml +23 -0
- data/skel/day.rhtml +33 -0
- data/skel/diary.rhtml +83 -0
- data/skel/footer.rhtml +8 -0
- data/skel/header.rhtml +10 -0
- data/skel/i.category.rhtml +6 -0
- data/skel/i.conf.rhtml +14 -0
- data/skel/i.day.rhtml +28 -0
- data/skel/i.diary.rhtml +17 -0
- data/skel/i.footer.rhtml +2 -0
- data/skel/i.header.rhtml +3 -0
- data/skel/i.latest.rhtml +24 -0
- data/skel/i.month.rhtml +39 -0
- data/skel/i.search.rhtml +5 -0
- data/skel/i.update.rhtml +40 -0
- data/skel/i.update.rhtml.en +40 -0
- data/skel/latest.rhtml +27 -0
- data/skel/mail.rtxt +18 -0
- data/skel/mail.rtxt.en +18 -0
- data/skel/month.rhtml +27 -0
- data/skel/plugin_error.rhtml +27 -0
- data/skel/preview.rhtml +85 -0
- data/skel/preview.rhtml.en +72 -0
- data/skel/referer.rhtml +24 -0
- data/skel/search.rhtml +14 -0
- data/skel/tdiary.rconf +76 -0
- data/skel/update.rhtml +103 -0
- data/skel/update.rhtml.en +83 -0
- data/spec/acceptance/append_comment_spec.rb +94 -0
- data/spec/acceptance/append_diary_spec.rb +98 -0
- data/spec/acceptance/bugfix/encoding_error_spec.rb +27 -0
- data/spec/acceptance/save_conf_comment_spec.rb +87 -0
- data/spec/acceptance/save_conf_default_spec.rb +169 -0
- data/spec/acceptance/save_conf_dnsbl_spec.rb +152 -0
- data/spec/acceptance/save_conf_filter_spec.rb +50 -0
- data/spec/acceptance/save_conf_plugin_spec.rb +69 -0
- data/spec/acceptance/save_conf_referer_spec.rb +60 -0
- data/spec/acceptance/save_conf_security_spec.rb +280 -0
- data/spec/acceptance/support/helpers.rb +49 -0
- data/spec/acceptance/support/paths.rb +7 -0
- data/spec/acceptance/update_diary_spec.rb +113 -0
- data/spec/acceptance/view_category_spec.rb +38 -0
- data/spec/acceptance/view_comment_spec.rb +67 -0
- data/spec/acceptance/view_diary_spec.rb +126 -0
- data/spec/acceptance/view_referer_spec.rb +31 -0
- data/spec/acceptance_helper.rb +101 -0
- data/spec/core/compatible_spec.rb +54 -0
- data/spec/core/core_ext_spec.rb +59 -0
- data/spec/core/plugin_spec.rb +389 -0
- data/spec/core/rack/assets/precompile_spec.rb +76 -0
- data/spec/core/rack/html_anchor_spec.rb +57 -0
- data/spec/core/rack/valid_request_path_spec.rb +67 -0
- data/spec/core/style/emptdiary_style_spec.rb +165 -0
- data/spec/core/style/etdiary_style_spec.rb +512 -0
- data/spec/core/style/gfm_style_spec.rb +334 -0
- data/spec/core/style/rd_style_spec.rb +202 -0
- data/spec/core/style/tdiary_style_spec.rb +240 -0
- data/spec/core/style/wiki_style_spec.rb +441 -0
- data/spec/fixtures/ascii8bit-pstore.db +0 -0
- data/spec/fixtures/invalid-sequence-volatile.tdr +9 -0
- data/spec/fixtures/just_installed.conf +1 -0
- data/spec/fixtures/plugin/ja/sample.rb +4 -0
- data/spec/fixtures/plugin/sample.rb +6 -0
- data/spec/fixtures/sample.rb +12 -0
- data/spec/fixtures/tdiary.conf.gem +212 -0
- data/spec/fixtures/tdiary.conf.rack +212 -0
- data/spec/fixtures/tdiary.conf.rdb +227 -0
- data/spec/fixtures/tdiary.conf.secure +204 -0
- data/spec/fixtures/tdiary.conf.webrick +212 -0
- data/spec/javascripts/00default_spec.js +35 -0
- data/spec/javascripts/fixtures/00default.html +1 -0
- data/spec/javascripts/support/jasmine.yml +76 -0
- data/spec/plugin/bq_spec.rb +24 -0
- data/spec/plugin/plugin_helper.rb +203 -0
- data/spec/spec_helper.rb +32 -0
- data/tdiary.conf.beginner +244 -0
- data/tdiary.conf.sample +345 -0
- data/tdiary.conf.sample-en +333 -0
- data/tdiary.gemspec +26 -0
- data/tdiary.rb +151 -0
- data/tdiary/admin.rb +236 -0
- data/tdiary/application.rb +57 -0
- data/tdiary/author_only_base.rb +171 -0
- data/tdiary/base.rb +220 -0
- data/tdiary/cli.rb +116 -0
- data/tdiary/comment.rb +40 -0
- data/tdiary/comment_manager.rb +94 -0
- data/tdiary/compatible.rb +72 -0
- data/tdiary/config.rb +270 -0
- data/tdiary/core_ext.rb +122 -0
- data/tdiary/deploy.rb +50 -0
- data/tdiary/dispatcher.rb +77 -0
- data/tdiary/dispatcher/index_main.rb +122 -0
- data/tdiary/dispatcher/update_main.rb +101 -0
- data/tdiary/environment.rb +15 -0
- data/tdiary/filter.rb +48 -0
- data/tdiary/filter/default.rb +54 -0
- data/tdiary/filter/spam.rb +304 -0
- data/tdiary/io/base.rb +70 -0
- data/tdiary/io/cache/file.rb +123 -0
- data/tdiary/io/cache/memcached.rb +88 -0
- data/tdiary/io/cache/redis.rb +100 -0
- data/tdiary/io/default.rb +297 -0
- data/tdiary/io/pstore.rb +252 -0
- data/tdiary/io/rdb.rb +213 -0
- data/tdiary/lang/en.rb +79 -0
- data/tdiary/lang/ja.rb +72 -0
- data/tdiary/plugin.rb +375 -0
- data/tdiary/rack/assets/precompile.rb +37 -0
- data/tdiary/rack/auth/basic.rb +38 -0
- data/tdiary/rack/auth/omniauth.rb +51 -0
- data/tdiary/rack/html_anchor.rb +31 -0
- data/tdiary/rack/valid_request_path.rb +36 -0
- data/tdiary/referer_manager.rb +80 -0
- data/tdiary/request.rb +217 -0
- data/tdiary/response.rb +29 -0
- data/tdiary/server.rb +85 -0
- data/tdiary/style.rb +194 -0
- data/tdiary/style/tdiary_style.rb +198 -0
- data/tdiary/style/wiki_style.rb +213 -0
- data/tdiary/tasks.rb +1 -0
- data/tdiary/tasks/assets.rake +31 -0
- data/tdiary/tasks/auth.rake +28 -0
- data/tdiary/tasks/db.rake +110 -0
- data/tdiary/tasks/doc.rake +31 -0
- data/tdiary/tasks/heroku.rake +37 -0
- data/tdiary/tasks/jasmine.rake +16 -0
- data/tdiary/tasks/rdoc.rake +24 -0
- data/tdiary/tasks/release.rake +122 -0
- data/tdiary/tasks/rspec.rake +51 -0
- data/tdiary/tasks/server.rake +33 -0
- data/tdiary/tasks/test.rake +17 -0
- data/tdiary/version.rb +3 -0
- data/tdiary/view.rb +468 -0
- data/tdiary/view_helper.rb +15 -0
- data/test/disp_referrer_test.rb +93 -0
- data/test/my-sequel_test.rb +238 -0
- data/test/test_helper.rb +7 -0
- data/test/test_plugin_helper.rb +64 -0
- data/test/test_plugin_helper_test.rb +28 -0
- data/test/weather_test.rb +33 -0
- data/theme/base.css +268 -0
- data/theme/conf.block.png +0 -0
- data/theme/conf.css +254 -0
- data/theme/default/README +11 -0
- data/theme/default/body.png +0 -0
- data/theme/default/default.css +743 -0
- data/theme/help.png +0 -0
- data/theme/loading.gif +0 -0
- data/theme/tdiary1/README +7 -0
- data/theme/tdiary1/tdiary1.css +394 -0
- data/theme/tdiary2/README +19 -0
- data/theme/tdiary2/tdiary2.css +624 -0
- data/update.fcgi +45 -0
- data/update.rb +57 -0
- data/vendor/hikidoc-0.0.6/COPYING +28 -0
- data/vendor/hikidoc-0.0.6/NEWS +30 -0
- data/vendor/hikidoc-0.0.6/NEWS.ja +30 -0
- data/vendor/hikidoc-0.0.6/README +86 -0
- data/vendor/hikidoc-0.0.6/README.ja +83 -0
- data/vendor/hikidoc-0.0.6/Rakefile +68 -0
- data/vendor/hikidoc-0.0.6/TextFormattingRules +320 -0
- data/vendor/hikidoc-0.0.6/TextFormattingRules.ja +318 -0
- data/vendor/hikidoc-0.0.6/bin/hikidoc +66 -0
- data/vendor/hikidoc-0.0.6/lib/hikidoc.rb +914 -0
- data/vendor/hikidoc-0.0.6/setup.rb +1360 -0
- data/vendor/hikidoc-0.0.6/test/run-test.rb +13 -0
- data/vendor/hikidoc-0.0.6/test/test_hikidoc.rb +506 -0
- data/vendor/imagesize-0.1.1/Manifest.txt +19 -0
- data/vendor/imagesize-0.1.1/README.txt +49 -0
- data/vendor/imagesize-0.1.1/lib/image_size.rb +305 -0
- data/vendor/imagesize-0.1.1/lib/image_size/version.rb +9 -0
- data/vendor/imagesize-0.1.1/setup.rb +1585 -0
- data/vendor/imagesize-0.1.1/test/2-4-7.png +0 -0
- data/vendor/imagesize-0.1.1/test/4_1_2.gif +0 -0
- data/vendor/imagesize-0.1.1/test/bmp.bmp +0 -0
- data/vendor/imagesize-0.1.1/test/cursor.xbm +6 -0
- data/vendor/imagesize-0.1.1/test/detect.swf +0 -0
- data/vendor/imagesize-0.1.1/test/pbm.pbm +0 -0
- data/vendor/imagesize-0.1.1/test/pcx.pcx +0 -0
- data/vendor/imagesize-0.1.1/test/pgm.pgm +5 -0
- data/vendor/imagesize-0.1.1/test/test.xpm +38 -0
- data/vendor/imagesize-0.1.1/test/test_helper.rb +2 -0
- data/vendor/imagesize-0.1.1/test/test_image_size.rb +71 -0
- data/vendor/imagesize-0.1.1/test/tiff.tiff +0 -0
- data/vendor/imagesize-0.1.1/test/tokyo_tower.jpg +0 -0
- data/vendor/imagesize-0.1.1/test/tower_e.gif.psd +0 -0
- data/vendor/jasmine-jquery-1.4.2/jasmine-jquery.js +548 -0
- data/vendor/jquery-1.8/jquery.js +9227 -0
- data/vendor/rdtool-0.6.38/COPYING.txt +339 -0
- data/vendor/rdtool-0.6.38/Gemfile +3 -0
- data/vendor/rdtool-0.6.38/HISTORY +318 -0
- data/vendor/rdtool-0.6.38/LGPL-2.1 +502 -0
- data/vendor/rdtool-0.6.38/LICENSE.txt +58 -0
- data/vendor/rdtool-0.6.38/README.html +66 -0
- data/vendor/rdtool-0.6.38/README.ja.html +73 -0
- data/vendor/rdtool-0.6.38/README.rd +76 -0
- data/vendor/rdtool-0.6.38/README.rd.ja +85 -0
- data/vendor/rdtool-0.6.38/Rakefile +152 -0
- data/vendor/rdtool-0.6.38/TODO +22 -0
- data/vendor/rdtool-0.6.38/bin/rd2 +283 -0
- data/vendor/rdtool-0.6.38/bin/rdswap.rb +207 -0
- data/vendor/rdtool-0.6.38/doc/rd-draft.html +456 -0
- data/vendor/rdtool-0.6.38/doc/rd-draft.ja.html +466 -0
- data/vendor/rdtool-0.6.38/doc/rd-draft.rd +479 -0
- data/vendor/rdtool-0.6.38/doc/rd-draft.rd.ja +487 -0
- data/vendor/rdtool-0.6.38/lib/rd/block-element.rb +114 -0
- data/vendor/rdtool-0.6.38/lib/rd/complex-list-item.rb +65 -0
- data/vendor/rdtool-0.6.38/lib/rd/desclist.rb +55 -0
- data/vendor/rdtool-0.6.38/lib/rd/document-struct.rb +46 -0
- data/vendor/rdtool-0.6.38/lib/rd/dot.rd2rc +18 -0
- data/vendor/rdtool-0.6.38/lib/rd/element.rb +160 -0
- data/vendor/rdtool-0.6.38/lib/rd/filter.rb +255 -0
- data/vendor/rdtool-0.6.38/lib/rd/head-filter.rb +14 -0
- data/vendor/rdtool-0.6.38/lib/rd/inline-element.rb +233 -0
- data/vendor/rdtool-0.6.38/lib/rd/labeled-element.rb +14 -0
- data/vendor/rdtool-0.6.38/lib/rd/list.rb +57 -0
- data/vendor/rdtool-0.6.38/lib/rd/loose-struct.rb +11 -0
- data/vendor/rdtool-0.6.38/lib/rd/methodlist.rb +57 -0
- data/vendor/rdtool-0.6.38/lib/rd/output-format-visitor.rb +30 -0
- data/vendor/rdtool-0.6.38/lib/rd/package.rb +4 -0
- data/vendor/rdtool-0.6.38/lib/rd/parser-util.rb +14 -0
- data/vendor/rdtool-0.6.38/lib/rd/post-install +1 -0
- data/vendor/rdtool-0.6.38/lib/rd/pre-setup.rb +18 -0
- data/vendor/rdtool-0.6.38/lib/rd/rbl-file.rb +69 -0
- data/vendor/rdtool-0.6.38/lib/rd/rbl-suite.rb +37 -0
- data/vendor/rdtool-0.6.38/lib/rd/rd-struct.rb +86 -0
- data/vendor/rdtool-0.6.38/lib/rd/rd2html-ext-lib.rb +266 -0
- data/vendor/rdtool-0.6.38/lib/rd/rd2html-ext-opt.rb +34 -0
- data/vendor/rdtool-0.6.38/lib/rd/rd2html-lib.rb +490 -0
- data/vendor/rdtool-0.6.38/lib/rd/rd2html-opt.rb +67 -0
- data/vendor/rdtool-0.6.38/lib/rd/rd2man-lib.rb +251 -0
- data/vendor/rdtool-0.6.38/lib/rd/rd2rdo-lib.rb +19 -0
- data/vendor/rdtool-0.6.38/lib/rd/rd2rmi-lib.rb +32 -0
- data/vendor/rdtool-0.6.38/lib/rd/rdblockparser.ry +518 -0
- data/vendor/rdtool-0.6.38/lib/rd/rdblockparser.tab.rb +1061 -0
- data/vendor/rdtool-0.6.38/lib/rd/rdfmt.rb +15 -0
- data/vendor/rdtool-0.6.38/lib/rd/rdinlineparser.ry +503 -0
- data/vendor/rdtool-0.6.38/lib/rd/rdinlineparser.tab.rb +1243 -0
- data/vendor/rdtool-0.6.38/lib/rd/rdvisitor.rb +214 -0
- data/vendor/rdtool-0.6.38/lib/rd/reference-resolver.rb +114 -0
- data/vendor/rdtool-0.6.38/lib/rd/search-file.rb +14 -0
- data/vendor/rdtool-0.6.38/lib/rd/tree.rb +103 -0
- data/vendor/rdtool-0.6.38/lib/rd/version.rb +41 -0
- data/vendor/rdtool-0.6.38/lib/rd/visitor.rb +86 -0
- data/vendor/rdtool-0.6.38/rdtool.gemspec +125 -0
- data/vendor/rdtool-0.6.38/setup.rb +1596 -0
- data/vendor/rdtool-0.6.38/test/data/includee1.html +1 -0
- data/vendor/rdtool-0.6.38/test/data/includee2.html +1 -0
- data/vendor/rdtool-0.6.38/test/data/includee3.nothtml +1 -0
- data/vendor/rdtool-0.6.38/test/data/includee4.xhtml +0 -0
- data/vendor/rdtool-0.6.38/test/data/label.rbl +2 -0
- data/vendor/rdtool-0.6.38/test/data/label2.rbl +2 -0
- data/vendor/rdtool-0.6.38/test/data/sub/includee2.html +1 -0
- data/vendor/rdtool-0.6.38/test/data/sub/includee4.html +0 -0
- data/vendor/rdtool-0.6.38/test/dummy-observer.rb +6 -0
- data/vendor/rdtool-0.6.38/test/dummy.rb +33 -0
- data/vendor/rdtool-0.6.38/test/temp-dir.rb +19 -0
- data/vendor/rdtool-0.6.38/test/test-block-parser.rb +46 -0
- data/vendor/rdtool-0.6.38/test/test-desclist-item.rb +219 -0
- data/vendor/rdtool-0.6.38/test/test-document-element.rb +46 -0
- data/vendor/rdtool-0.6.38/test/test-document-struct.rb +66 -0
- data/vendor/rdtool-0.6.38/test/test-element.rb +46 -0
- data/vendor/rdtool-0.6.38/test/test-headline.rb +80 -0
- data/vendor/rdtool-0.6.38/test/test-inline-parser.rb +46 -0
- data/vendor/rdtool-0.6.38/test/test-list-item.rb +54 -0
- data/vendor/rdtool-0.6.38/test/test-list.rb +53 -0
- data/vendor/rdtool-0.6.38/test/test-methodlist-item.rb +73 -0
- data/vendor/rdtool-0.6.38/test/test-nonterminal-element.rb +170 -0
- data/vendor/rdtool-0.6.38/test/test-nonterminal-inline.rb +33 -0
- data/vendor/rdtool-0.6.38/test/test-output-format-visitor.rb +48 -0
- data/vendor/rdtool-0.6.38/test/test-parser-util.rb +41 -0
- data/vendor/rdtool-0.6.38/test/test-rbl-file.rb +156 -0
- data/vendor/rdtool-0.6.38/test/test-rbl-suite.rb +43 -0
- data/vendor/rdtool-0.6.38/test/test-rd2html-lib.rb +496 -0
- data/vendor/rdtool-0.6.38/test/test-rdtree.rb +17 -0
- data/vendor/rdtool-0.6.38/test/test-rdvisitor.rb +29 -0
- data/vendor/rdtool-0.6.38/test/test-reference-resolver.rb +202 -0
- data/vendor/rdtool-0.6.38/test/test-reference.rb +132 -0
- data/vendor/rdtool-0.6.38/test/test-search-file.rb +22 -0
- data/vendor/rdtool-0.6.38/test/test-terminal-inline.rb +41 -0
- data/vendor/rdtool-0.6.38/test/test-textblock.rb +44 -0
- data/vendor/rdtool-0.6.38/test/test-tree.rb +82 -0
- data/vendor/rdtool-0.6.38/test/test-version.rb +57 -0
- data/vendor/rdtool-0.6.38/test/test-visitor.rb +230 -0
- data/vendor/rdtool-0.6.38/utils/rd-mode.el +464 -0
- metadata +666 -0
@@ -0,0 +1,33 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# category_autocomplete.rb : Support the automatic input of the category
|
4
|
+
# using jQuery UI autocomplete.
|
5
|
+
#
|
6
|
+
# Copyright (C) 2010-2012, tamoot <tamoot+tdiary@gmail.com>
|
7
|
+
# You can redistribute it and/or modify it under GPL2.
|
8
|
+
#
|
9
|
+
|
10
|
+
if !@cgi.mobile_agent? && /\A(?:form|preview|append|edit|update)\z/ =~ @mode
|
11
|
+
add_header_proc do
|
12
|
+
%Q|<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css"/>|
|
13
|
+
end
|
14
|
+
|
15
|
+
enable_js('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js')
|
16
|
+
enable_js('caretposition.js')
|
17
|
+
enable_js('category_autocomplete.js')
|
18
|
+
|
19
|
+
if @categories.size > 0
|
20
|
+
categories_json = @categories.map{ |c| "\"#{c}\"" }
|
21
|
+
add_js_setting('$tDiary.plugin.category_autocomplete')
|
22
|
+
add_js_setting('$tDiary.plugin.category_autocomplete.candidates',
|
23
|
+
"[#{categories_json.join(",")}]")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Local Variables:
|
28
|
+
# mode: ruby
|
29
|
+
# indent-tabs-mode: t
|
30
|
+
# tab-width: 3
|
31
|
+
# ruby-indent-level: 3
|
32
|
+
# End:
|
33
|
+
# vim: ts=3
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# comment_mail_qmail.rb
|
3
|
+
#
|
4
|
+
# qmailを使ってツッコミをメールで知らせる
|
5
|
+
# 入れるだけで動作する。
|
6
|
+
#
|
7
|
+
# Options:
|
8
|
+
# 設定画面から指定できるもの(ツッコミメール系プラグイン共通):
|
9
|
+
# @options['comment_mail.enable']
|
10
|
+
# メールを送るかどうかを指定する。true(送る)かfalse(送らない)。
|
11
|
+
# 無指定時はfalse。
|
12
|
+
# @options['comment_mail.header']
|
13
|
+
# メールのSubjectに使う文字列。振り分け等に便利なように指定する。
|
14
|
+
# 実際のSubjectは「指定文字列:日付-1」のように、日付とコメント番号が
|
15
|
+
# 付く。ただし指定文字列中に、%に続く英字があった場合、それを
|
16
|
+
# 日付フォーマット指定を見なす。つまり「日付」の部分は
|
17
|
+
# 自動的に付加されなくなる(コメント番号は付加される)。
|
18
|
+
# 無指定時には空文字。
|
19
|
+
# @options['comment_mail.receivers']
|
20
|
+
# メールを送るアドレス文字列。カンマで区切って複数指定できる。
|
21
|
+
# 無指定時には日記筆者のアドレスになる。
|
22
|
+
#
|
23
|
+
# tdiary.confでのみ指定できるもの:
|
24
|
+
# @options['comment_mail.qmail']
|
25
|
+
# qmail_injectコマンドのパスを指定する。
|
26
|
+
# 無指定時には「'/var/qmail/bin/qmail-inject'」。
|
27
|
+
#
|
28
|
+
# Copyright (c) 2003 TADA Tadashi <sho@spc.gr.jp>
|
29
|
+
# You can distribute this file under the GPL.
|
30
|
+
#
|
31
|
+
def comment_mail( text, to )
|
32
|
+
begin
|
33
|
+
qmail = @conf['comment_mail.qmail'] || '/var/qmail/bin/qmail-inject'
|
34
|
+
open( %Q[|'#{qmail.gsub(/'/, '')}' -f '#{@conf.author_mail.gsub( /'/, '' ).untaint}' '#{to.map{|x|x.gsub(/'/,'')}.join("' '")}'], 'w' ) do |o|
|
35
|
+
o.write( text )
|
36
|
+
end
|
37
|
+
rescue
|
38
|
+
$stderr.puts $!
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
add_update_proc do
|
43
|
+
comment_mail_send if @mode == 'comment'
|
44
|
+
end
|
45
|
+
|
46
|
+
add_conf_proc( 'comment_mail', comment_mail_conf_label, 'tsukkomi' ) do
|
47
|
+
comment_mail_basic_setting
|
48
|
+
comment_mail_basic_html
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
# Local Variables:
|
53
|
+
# mode: ruby
|
54
|
+
# indent-tabs-mode: t
|
55
|
+
# tab-width: 3
|
56
|
+
# ruby-indent-level: 3
|
57
|
+
# End:
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# comment_mail_sendmail.rb
|
3
|
+
#
|
4
|
+
# sendmailを使ってツッコミをメールで知らせる
|
5
|
+
# 入れるだけで動作する。
|
6
|
+
#
|
7
|
+
# Options:
|
8
|
+
# 設定画面から指定できるもの(ツッコミメール系プラグイン共通):
|
9
|
+
# @options['comment_mail.enable']
|
10
|
+
# メールを送るかどうかを指定する。true(送る)かfalse(送らない)。
|
11
|
+
# 無指定時はfalse。
|
12
|
+
# @options['comment_mail.header']
|
13
|
+
# メールのSubjectに使う文字列。振り分け等に便利なように指定する。
|
14
|
+
# 実際のSubjectは「指定文字列:日付-1」のように、日付とコメント番号が
|
15
|
+
# 付く。ただし指定文字列中に、%に続く英字があった場合、それを
|
16
|
+
# 日付フォーマット指定を見なす。つまり「日付」の部分は
|
17
|
+
# 自動的に付加されなくなる(コメント番号は付加される)。
|
18
|
+
# 無指定時には空文字。
|
19
|
+
# @options['comment_mail.receivers']
|
20
|
+
# メールを送るアドレス文字列。カンマで区切って複数指定できる。
|
21
|
+
# 無指定時には日記筆者のアドレスになる。
|
22
|
+
#
|
23
|
+
# tdiary.confでのみ指定できるもの:
|
24
|
+
# @options['comment_mail.sendmail']
|
25
|
+
# sendmailコマンドのパスを指定する。
|
26
|
+
# 無指定時には「'/usr/sbin/sendmail'」。
|
27
|
+
#
|
28
|
+
# Copyright (c) 2003 TADA Tadashi <sho@spc.gr.jp>
|
29
|
+
# You can distribute this file under the GPL.
|
30
|
+
#
|
31
|
+
def comment_mail( text, to )
|
32
|
+
begin
|
33
|
+
sendmail = @conf['comment_mail.sendmail'] || '/usr/sbin/sendmail'
|
34
|
+
open( %Q[|'#{sendmail.gsub(/'/, '')}' '#{to.map{|x|x.gsub(/'/, '')}.join("' '")}'], 'w' ) do |o|
|
35
|
+
o.write( text )
|
36
|
+
end
|
37
|
+
rescue
|
38
|
+
$stderr.puts $!
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
add_update_proc do
|
43
|
+
comment_mail_send if @mode == 'comment'
|
44
|
+
end
|
45
|
+
|
46
|
+
add_conf_proc( 'comment_mail', comment_mail_conf_label, 'tsukkomi' ) do
|
47
|
+
comment_mail_basic_setting
|
48
|
+
comment_mail_basic_html
|
49
|
+
end
|
50
|
+
|
51
|
+
# Local Variables:
|
52
|
+
# mode: ruby
|
53
|
+
# indent-tabs-mode: t
|
54
|
+
# tab-width: 3
|
55
|
+
# ruby-indent-level: 3
|
56
|
+
# End:
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# comment_mail-smtp.rb
|
3
|
+
#
|
4
|
+
# SMTPプロトコルを使ってツッコミをメールで知らせる
|
5
|
+
# 入れるだけで動作する
|
6
|
+
#
|
7
|
+
# Options:
|
8
|
+
# 設定画面から指定できるもの(ツッコミメール系プラグイン共通):
|
9
|
+
# @options['comment_mail.enable']
|
10
|
+
# メールを送るかどうかを指定する。true(送る)かfalse(送らない)。
|
11
|
+
# 無指定時はfalse。
|
12
|
+
# @options['comment_mail.header']
|
13
|
+
# メールのSubjectに使う文字列。振り分け等に便利なように指定する。
|
14
|
+
# 実際のSubjectは「指定文字列:日付-1」のように、日付とコメント番号が
|
15
|
+
# 付く。ただし指定文字列中に、%に続く英字があった場合、それを
|
16
|
+
# 日付フォーマット指定を見なす。つまり「日付」の部分は
|
17
|
+
# 自動的に付加されなくなる(コメント番号は付加される)。
|
18
|
+
# 無指定時には空文字。
|
19
|
+
# @options['comment_mail.receivers']
|
20
|
+
# メールを送るアドレス文字列。カンマで区切って複数指定できる。
|
21
|
+
# 無指定時には日記筆者のアドレスになる。
|
22
|
+
#
|
23
|
+
# tdiary.confでのみ指定できるもの:
|
24
|
+
# @options['comment_mail.smtp_host']
|
25
|
+
# @options['comment_mail.smtp_port']
|
26
|
+
# それぞれ、メール送信に使うSMTPサーバのホスト名とポート番号。
|
27
|
+
# 無指定時はそれぞれ「'localhost'」と「25」。
|
28
|
+
#
|
29
|
+
# Copyright (c) 2003 TADA Tadashi <sho@spc.gr.jp>
|
30
|
+
# You can distribute this file under the GPL.
|
31
|
+
#
|
32
|
+
def comment_mail( text, to )
|
33
|
+
begin
|
34
|
+
require 'net/smtp'
|
35
|
+
host = @conf['comment_mail.smtp_host'] || 'localhost'
|
36
|
+
port = @conf['comment_mail.smtp_port'] || 25
|
37
|
+
Net::SMTP.start( host, port ) do |smtp|
|
38
|
+
smtp.send_mail( text.force_encoding( 'US-ASCII' ), @conf.author_mail.untaint, to )
|
39
|
+
end
|
40
|
+
rescue
|
41
|
+
$stderr.puts $!
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
add_update_proc do
|
46
|
+
comment_mail_send if @mode == 'comment'
|
47
|
+
end
|
48
|
+
|
49
|
+
add_conf_proc( 'comment_mail', comment_mail_conf_label, 'tsukkomi' ) do
|
50
|
+
comment_mail_basic_setting
|
51
|
+
comment_mail_basic_html
|
52
|
+
end
|
53
|
+
|
54
|
+
# Local Variables:
|
55
|
+
# mode: ruby
|
56
|
+
# indent-tabs-mode: t
|
57
|
+
# tab-width: 3
|
58
|
+
# ruby-indent-level: 3
|
59
|
+
# End:
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# comment_rank.rb
|
3
|
+
#
|
4
|
+
# comment_rank: ツッコミの数でランキング
|
5
|
+
# パラメタ:
|
6
|
+
# max: 最大表示数(未指定時:5)
|
7
|
+
# sep: セパレータ(未指定時:空白)
|
8
|
+
# except: 無視する名前(いくつもある場合は,で区切って並べる)
|
9
|
+
#
|
10
|
+
# Copyright (c) 2002 TADA Tadashi <sho@spc.gr.jp>
|
11
|
+
# You can distribute this file under the GPL2.
|
12
|
+
#
|
13
|
+
#
|
14
|
+
def comment_rank( max = 5, sep = ' ', *except )
|
15
|
+
name = Hash::new(0)
|
16
|
+
@diaries.each_value do |diary|
|
17
|
+
diary.each_comment do |comment|
|
18
|
+
next if except.include?(comment.name)
|
19
|
+
name[comment.name] += 1
|
20
|
+
end
|
21
|
+
end
|
22
|
+
result = []
|
23
|
+
name.sort{|a,b| (a[1])<=>(b[1])}.reverse.each_with_index do |ary,idx|
|
24
|
+
break if idx >= max
|
25
|
+
result << "<strong>#{idx+1}.</strong>#{h ary[0]}(#{ary[1].to_s})"
|
26
|
+
end
|
27
|
+
result.join( sep )
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
# Local Variables:
|
32
|
+
# mode: ruby
|
33
|
+
# indent-tabs-mode: t
|
34
|
+
# tab-width: 3
|
35
|
+
# ruby-indent-level: 3
|
36
|
+
# End:
|
@@ -0,0 +1,631 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# counter.rb
|
3
|
+
#
|
4
|
+
# Access counter plugin.
|
5
|
+
#
|
6
|
+
# 1. Usage
|
7
|
+
# counter(figure, filetype = ""): Show number of all visitors.
|
8
|
+
# counter_today(figure, filetype = ""): Show number of visitors for today.
|
9
|
+
# counter_today(figure, filetype = ""): Show number of visitors for yesterday.
|
10
|
+
# filetype: jpg, gif, png ... .
|
11
|
+
#
|
12
|
+
# kiriban?: Return true when the number is a kiriban.
|
13
|
+
# kiriban_today?: Return true when the number is a kiriban(for today's couner).
|
14
|
+
#
|
15
|
+
# counter
|
16
|
+
# counter 3
|
17
|
+
# coutner 3, "jpg"
|
18
|
+
# counter_today 4, "jpg"
|
19
|
+
# counter_yesterday
|
20
|
+
#
|
21
|
+
# 2. Documents
|
22
|
+
# See URLs below for more details.
|
23
|
+
# http://ponx.s5.xrea.com/hiki/counter.rb.html (English)
|
24
|
+
# http://ponx.s5.xrea.com/hiki/ja/counter.rb.html (Japanese)
|
25
|
+
#
|
26
|
+
# Copyright (c) 2002-2006 Masao Mutoh
|
27
|
+
# You can redistribute it and/or modify it under GPL2.
|
28
|
+
#
|
29
|
+
=begin ChangeLog
|
30
|
+
2006-02-14 Masao Mutoh
|
31
|
+
* Add some user-agents.
|
32
|
+
* 2.0.2
|
33
|
+
|
34
|
+
2006-02-14 mitty
|
35
|
+
* Fixed a problem when counter2_access.dat is broken.
|
36
|
+
|
37
|
+
2006-02-07 Masao Mutoh
|
38
|
+
* Revert the log file name from counter2.log to counter.log.
|
39
|
+
Reported by Ken-ichi Mito.
|
40
|
+
* 2.0.1
|
41
|
+
|
42
|
+
2006-01-20 Masao Mutoh
|
43
|
+
* Improves the speed and stability.
|
44
|
+
- Separate data to counterdata and accessdata.
|
45
|
+
- counterdata is the target of backup, but accessdata doesn't do backup.
|
46
|
+
- change a key of an Array of String to a hash.
|
47
|
+
- Removed "counter.daily_backup" option. Now daily_backup is applied
|
48
|
+
everyday unless this setting.
|
49
|
+
- Add a new "counter.max_keep_access_num" option which you can set the max
|
50
|
+
number to keep users in the accessdata file to avoid to become
|
51
|
+
too large the accessdata file.
|
52
|
+
* Follow tDiary framework.
|
53
|
+
- Add configuration page.
|
54
|
+
* Misc
|
55
|
+
- Removed "counter.deny_remote_addrs" option.
|
56
|
+
|
57
|
+
2004-10-01 Masao Mutoh
|
58
|
+
* Improved process against bots. @options["bot"] is now supported.
|
59
|
+
|
60
|
+
2003-11-15 Masao Mutoh
|
61
|
+
* translate documents to English.
|
62
|
+
|
63
|
+
2003-02-15 Masao Mutoh
|
64
|
+
* counter.datが大きくなる不具合の修正
|
65
|
+
* version 1.6.3
|
66
|
+
|
67
|
+
2002-11-26 Junichiro Kita <kita@kitaj.no-ip.com>
|
68
|
+
* remove 'cgi.cookies = nil' in TDiaryCounter::main
|
69
|
+
|
70
|
+
2002-11-19 TADA Tadashi <sho@spc.gr.jp>
|
71
|
+
* for squeeze.rb error more.
|
72
|
+
* version 1.6.2
|
73
|
+
|
74
|
+
2002-11-13 TADA Tadashi <sho@spc.gr.jp>
|
75
|
+
* for squeeze.rb error.
|
76
|
+
|
77
|
+
2002-10-12 Masao Mutoh
|
78
|
+
* 初めて使うときに動作しなくなっていた不具合の修正。
|
79
|
+
* 1日1回保持しているユーザ情報をクリーンアップするようにした。
|
80
|
+
* version 1.6.1
|
81
|
+
|
82
|
+
2002-08-30 Masao Mutoh
|
83
|
+
* データファイルが読み込めなくなったとき、1つ前のバックアップデータ
|
84
|
+
を用いて復旧するようにした(その際に、1つ前のバックアップデータは
|
85
|
+
counter.dat.?.bakという名前でバックアップされる)。さらに1つ前の
|
86
|
+
バックアップデータからも復旧できなかった場合は全てのカウンタ値を
|
87
|
+
0にしてエラー画面が表示されないようにした。
|
88
|
+
* version 1.6.0
|
89
|
+
|
90
|
+
2002-07-23 Masao Mutoh
|
91
|
+
* バックアップファイルのファイル名のsuffixを曜日(0-6の数値)にした。
|
92
|
+
従って、1週間毎に古いファイルは上書きされるのでファイルの数は
|
93
|
+
最大7つとなる。数字が新しいものが最新というわけではないので注意。
|
94
|
+
(proposed by Junichiro KITA <kita@kitaj.no-ip.com>)
|
95
|
+
* version 1.5.1
|
96
|
+
|
97
|
+
2002-07-19 Masao Mutoh
|
98
|
+
* 日々単位でデータをバックアップするようにした。
|
99
|
+
@options["counter.dairy_backup"]で指定。falseを指定しない限り
|
100
|
+
バックアップする。
|
101
|
+
* Date#==メソッドでnilを渡さないように修正
|
102
|
+
* require 'pstore'追加(tDiary version 1.5.x系対応)
|
103
|
+
* logのフォーマット変更(全て・今日・昨日のデータを出力)
|
104
|
+
* @options["counter.deny_same_src_interval"]のデフォルト値を2時間
|
105
|
+
に変更した。
|
106
|
+
* version 1.5.0
|
107
|
+
|
108
|
+
2002-05-19 Masao Mutoh
|
109
|
+
* Cookieを使うことのできない同一クライアントからの連続アクセスを、
|
110
|
+
カウントアップしないようにした。
|
111
|
+
* @options["counter.deny_same_src_interval"]追加。連続GETの間隔を指定。
|
112
|
+
デフォルトで0.1時間(6分)。
|
113
|
+
* version 1.4.0
|
114
|
+
|
115
|
+
2002-05-11 Masao Mutoh
|
116
|
+
* 初期値を与えない場合は5桁としていたが、「前0をなくす」に変更した。
|
117
|
+
また、前0を無くす場合は0を指定しても良い。
|
118
|
+
* version 1.3.0
|
119
|
+
|
120
|
+
2002-05-05 Masao Mutoh
|
121
|
+
* @debug = true 削除 :->
|
122
|
+
* コメント変更
|
123
|
+
* version 1.2.1
|
124
|
+
|
125
|
+
2002-05-04 Masao Mutoh
|
126
|
+
* tlinkプラグインからのアクセスをカウントしてしまう不具合の修正
|
127
|
+
* @options["counter.deny_user_agents"]追加
|
128
|
+
* @options["counter.deny_remote_addrs"]追加
|
129
|
+
* @options["counter.init_num"]追加。キリ番機能との関係で、counter
|
130
|
+
* メソッドの引数のinit_numはobsoleteとします。
|
131
|
+
* @options["counter.kiriban"], @options["counter.kiriban_today"]追加
|
132
|
+
* キリ番機能追加(kiriban?,kiriban_today?メソッド追加)
|
133
|
+
* version 1.2.0
|
134
|
+
|
135
|
+
2002-04-27 Masao Mutoh
|
136
|
+
* add_header_procを使わないようにした
|
137
|
+
* @options["counter.timer"]が有効にならない不具合の修正
|
138
|
+
* @options["counter.log"]追加。trueを指定するとcounter.dat
|
139
|
+
と同じディレクトリにcounter.logというファイルを作成し
|
140
|
+
1日前のアクセス数を記録するようにした
|
141
|
+
* cookieの値としてバージョン番号を入れるようにした
|
142
|
+
* version 1.1.0
|
143
|
+
|
144
|
+
2002-04-25 Masao Mutoh
|
145
|
+
* HEADでアクセスがあった場合に再びカウントされるように
|
146
|
+
なってしまっていた不具合の修正(by NT<nt@24i.net>)
|
147
|
+
* version 1.0.4
|
148
|
+
|
149
|
+
2002-04-24 Masao Mutoh
|
150
|
+
* ツッコミを入れたときにエラーが発生する不具合の修正
|
151
|
+
* version 1.0.3
|
152
|
+
|
153
|
+
2002-04-23 Masao Mutoh
|
154
|
+
* データファイルを削除後、クッキーが有効期間中の端末から
|
155
|
+
アクセスした場合に@todayが0になる不具合の修正
|
156
|
+
* コメント入れたときに数字が表示されない不具合の修正
|
157
|
+
* HEADでアクセスがあった場合はカウントしないようにした
|
158
|
+
(reported by NT<nt@24i.net>, suggested a solution
|
159
|
+
by TADA Tadashi <sho@spc.gr.jp>)
|
160
|
+
* version 1.0.2
|
161
|
+
|
162
|
+
2002-04-21 Masao Mutoh
|
163
|
+
* CSSで_を使っているところを-に直した(reported by NT<nt@24i.net>)
|
164
|
+
* TDiaryCountData#upで@allが+1されない不具合の修正
|
165
|
+
* version 1.0.1
|
166
|
+
|
167
|
+
2002-04-14 Masao Mutoh
|
168
|
+
* version 1.0.0
|
169
|
+
=end
|
170
|
+
|
171
|
+
@counter_default_user_agents = "feed|tlink|WWWOFFLE|^WWWC|^Wget|WWWD|fetch|Antenna|antenna|Infoseek SideWinderBlogRanking|^ichiro|CaptainNAMAAN|Download Ninja|ping.blogger.jp|ia_archiver|Nutch|^Mediapartners.Google|lwp.trivial|nomadscafe_ra|rawler|KMHTTP|Tarantula|Pockey|Microsoft URL Control|Livedoor SF|^Blogline|Yahoo|^Y.J|Ask Jeeves|^Commerobo|^livedoorCheckers|^voyager|^findlinks|^\-$|FunWebProducts|^Headline|lmspider|^FreshReader|^FyberSpider|^Hatena|^intraVnews|^Nandemorss|^Nutch|^1.0$|^Blogshares|Crawl|MSNPTC|MS Search|^Pompos|^Portsurvey|^RSS_READER|^gooRSSreader|^kinja|^larbin|^research\-spider|bot|^HTTP$|SBIder|StackRambler|Wavefire|samidare|MarkAgent|^Java|NewsWire|libwww|ping.blo.gs|wish.lim|Mozilla.4.76|rAntenna|PEAR|Blogslive|edgeio.retriever|^Jakarta"
|
172
|
+
|
173
|
+
#not bot: RssBar, AppleSyndication
|
174
|
+
|
175
|
+
def counter_allow?
|
176
|
+
return false if bot?
|
177
|
+
if @options
|
178
|
+
if @options["counter.deny_user_agents"]
|
179
|
+
if @options["counter.deny_user_agents"].kind_of? Array
|
180
|
+
@options["counter.deny_user_agents"] = @options["counter.deny_user_agents"].uniq.join('|')
|
181
|
+
elsif @options["counter.deny_user_agents"].size > 1
|
182
|
+
agents = Regexp.new("(#{@counter_default_user_agents}|#{@options["counter.deny_user_agents"]})", true)
|
183
|
+
else
|
184
|
+
agents = Regexp.new("(#{@counter_default_user_agents})", true)
|
185
|
+
end
|
186
|
+
else
|
187
|
+
agents = Regexp.new("(#{@counter_default_user_agents})", true)
|
188
|
+
end
|
189
|
+
return false if agents =~ @cgi.user_agent
|
190
|
+
end
|
191
|
+
true
|
192
|
+
end
|
193
|
+
|
194
|
+
if @cgi.request_method == 'GET' and counter_allow?
|
195
|
+
require 'date'
|
196
|
+
require 'pstore'
|
197
|
+
require 'fileutils'
|
198
|
+
|
199
|
+
eval(<<TOPLEVEL_CLASS, TOPLEVEL_BINDING)
|
200
|
+
class TDiaryAccessData
|
201
|
+
attr_accessor :ignore_cookie #means ALWAYS ignore a cookie.
|
202
|
+
def previous_access_time(time, remote_addr, user_agent, interval, maxaccessnum)
|
203
|
+
@time = time
|
204
|
+
@users = Hash.new unless @users
|
205
|
+
key = (remote_addr + user_agent).hash
|
206
|
+
ret = @users[key]
|
207
|
+
remove_olddata(interval)
|
208
|
+
|
209
|
+
@users[key] = @time if @users.size < maxaccessnum
|
210
|
+
ret
|
211
|
+
end
|
212
|
+
|
213
|
+
def remove_olddata(interval)
|
214
|
+
@users.reject!{|key, val|
|
215
|
+
@time - val > interval * 3600
|
216
|
+
}
|
217
|
+
end
|
218
|
+
end
|
219
|
+
class TDiaryCountData
|
220
|
+
attr_reader :today, :yesterday, :all, :newestday
|
221
|
+
|
222
|
+
def initialize(path, all = 0, today = 0, yesterday = 0)
|
223
|
+
@path = path
|
224
|
+
@newestday = Date.today
|
225
|
+
@all, @today, @yesterday = all, today, yesterday
|
226
|
+
end
|
227
|
+
|
228
|
+
def up(now, cache_path, cgi, _log)
|
229
|
+
if @newestday
|
230
|
+
if now == @newestday
|
231
|
+
@today += 1
|
232
|
+
else
|
233
|
+
log if _log
|
234
|
+
@yesterday = ((now - 1) == @newestday) ? @today : 0
|
235
|
+
@today = 1
|
236
|
+
@newestday = now
|
237
|
+
time = Time.now
|
238
|
+
end
|
239
|
+
else
|
240
|
+
@yesterday = 0
|
241
|
+
@today = 1
|
242
|
+
@newestday = now
|
243
|
+
end
|
244
|
+
@all += 1
|
245
|
+
save
|
246
|
+
end
|
247
|
+
|
248
|
+
def load
|
249
|
+
begin
|
250
|
+
open(File.join(@path, "counter2.dat"), "r") do |io|
|
251
|
+
eval(io.read)
|
252
|
+
end
|
253
|
+
rescue Exception
|
254
|
+
back = (Dir.glob(File.join(@path, "counter2.dat.?")).sort{|a,b|
|
255
|
+
File.mtime(a) <=> File.mtime(b)}.reverse)[0]
|
256
|
+
open(back, "r") do |io|
|
257
|
+
begin
|
258
|
+
eval(io.read)
|
259
|
+
rescue Exception
|
260
|
+
end
|
261
|
+
end
|
262
|
+
save
|
263
|
+
end
|
264
|
+
self
|
265
|
+
end
|
266
|
+
|
267
|
+
def save(file = "counter2.dat")
|
268
|
+
open(File.join(@path, file), "w") do |io|
|
269
|
+
io.print "@newestday = Date.parse('" + @newestday.to_s + "'); "
|
270
|
+
io.print "@all = " + @all.to_s + "; "
|
271
|
+
io.print "@today = " + @today.to_s + "; "
|
272
|
+
io.print "@yesterday = " + @yesterday.to_s
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
def log
|
277
|
+
if @newestday
|
278
|
+
open(File.join(@path, "counter.log"), "a") do |io|
|
279
|
+
io.print @newestday, " : ", @all, ",", @today, ",", @yesterday, "\n"
|
280
|
+
end
|
281
|
+
save("counter2.dat." + @newestday.wday.to_s)
|
282
|
+
end
|
283
|
+
end
|
284
|
+
end
|
285
|
+
TOPLEVEL_CLASS
|
286
|
+
|
287
|
+
module TDiaryCounter
|
288
|
+
extend ERB::Util
|
289
|
+
@version = "2.0.2"
|
290
|
+
|
291
|
+
def run(cache_path, cgi, options)
|
292
|
+
timer = options["counter.timer"] if options
|
293
|
+
timer = 12 unless timer # 12 hour
|
294
|
+
@init_num = options["counter.init_num"] if options
|
295
|
+
@init_num = 0 unless @init_num
|
296
|
+
dir = File.join(cache_path, "counter")
|
297
|
+
path = File.join(dir, "counter2_access.dat")
|
298
|
+
today = Date.today
|
299
|
+
Dir.mkdir(dir, 0700) unless FileTest.exist?(dir)
|
300
|
+
|
301
|
+
cookie = nil
|
302
|
+
begin
|
303
|
+
cookie = main(cache_path, cgi, options, timer, dir, path, today)
|
304
|
+
rescue => e
|
305
|
+
@cnt = TDiaryCountData.new(dir).load
|
306
|
+
if e.message =~ /marshal|dump|load|referred|depth|io needed|size/i
|
307
|
+
begin
|
308
|
+
File.unlink path
|
309
|
+
rescue
|
310
|
+
end
|
311
|
+
end
|
312
|
+
end
|
313
|
+
cookie
|
314
|
+
end
|
315
|
+
|
316
|
+
def main(cache_path, cgi, options, timer, dir, path, today)
|
317
|
+
cookie = nil
|
318
|
+
if FileTest.exist?(File.join(dir, "counter.dat"))
|
319
|
+
db = PStore.new(File.join(dir, "counter.dat"))
|
320
|
+
db.transaction do
|
321
|
+
old = db["countdata"]
|
322
|
+
TDiaryCountData.new(dir, old.all, old.today, old.yesterday).save
|
323
|
+
end
|
324
|
+
FileUtils.mv(File.join(dir, "counter.dat"), File.join(dir, "counter.dat.old"))
|
325
|
+
end
|
326
|
+
db = PStore.new(path)
|
327
|
+
db.transaction do
|
328
|
+
begin
|
329
|
+
@access = db["accessdata"]
|
330
|
+
rescue PStore::Error
|
331
|
+
end
|
332
|
+
unless @access
|
333
|
+
@access = TDiaryAccessData.new
|
334
|
+
end
|
335
|
+
|
336
|
+
begin
|
337
|
+
@cnt = TDiaryCountData.new(dir).load
|
338
|
+
rescue Exception
|
339
|
+
@cnt = TDiaryCountData.new(dir)
|
340
|
+
end
|
341
|
+
|
342
|
+
changed = false
|
343
|
+
if new_user?(cgi, options)
|
344
|
+
@cnt.up(today, dir, cgi, (options and options["counter.log"]))
|
345
|
+
cookie = CGI::Cookie.new({"name" => "tdiary_counter",
|
346
|
+
"value" => @version,
|
347
|
+
"expires" => Time.now + timer * 3600})
|
348
|
+
changed = true
|
349
|
+
end
|
350
|
+
|
351
|
+
if options["counter.kiriban"]
|
352
|
+
if options["counter.kiriban"].kind_of? String
|
353
|
+
if options["counter.kiriban"] == ""
|
354
|
+
options["counter.kiriban"] = [-1]
|
355
|
+
elsif options["counter.kiriban"].include?(",")
|
356
|
+
options["counter.kiriban"] =
|
357
|
+
options["counter.kiriban"].split(",").collect{|i| i.to_i}
|
358
|
+
else
|
359
|
+
options["counter.kiriban"] = [options["counter.kiriban"].to_i]
|
360
|
+
end
|
361
|
+
end
|
362
|
+
@kiriban = options["counter.kiriban"].include?(@cnt.all + @init_num)
|
363
|
+
end
|
364
|
+
|
365
|
+
if ! @kiriban and options["counter.kiriban_today"]
|
366
|
+
if options["counter.kiriban_today"].kind_of? String
|
367
|
+
if options["counter.kiriban_today"] == ""
|
368
|
+
options["counter.kiriban_today"] = [-1]
|
369
|
+
elsif options["counter.kiriban_today"].include?(",")
|
370
|
+
options["counter.kiriban_today"] =
|
371
|
+
options["counter.kiriban_today"].split(",").collect{|i| i.to_i}
|
372
|
+
else
|
373
|
+
options["counter.kiriban_today"] = [options["counter.kiriban_today"].to_i]
|
374
|
+
end
|
375
|
+
end
|
376
|
+
@kiriban_today = options["counter.kiriban_today"].include?(@cnt.today)
|
377
|
+
end
|
378
|
+
|
379
|
+
if @access.ignore_cookie
|
380
|
+
@access.ignore_cookie = false
|
381
|
+
changed = true
|
382
|
+
end
|
383
|
+
|
384
|
+
#when it is kiriban time, ignore the cookie next access time.
|
385
|
+
if @kiriban or @kiriban_today
|
386
|
+
@access.ignore_cookie = true
|
387
|
+
changed = true
|
388
|
+
end
|
389
|
+
|
390
|
+
if changed
|
391
|
+
db["accessdata"] = @access
|
392
|
+
end
|
393
|
+
end
|
394
|
+
cookie
|
395
|
+
end
|
396
|
+
|
397
|
+
def new_user_without_cookie?(cgi, options)
|
398
|
+
if options
|
399
|
+
interval = options["counter.deny_same_src_interval"]
|
400
|
+
maxaccessnum = options["counter.max_keep_access_num"]
|
401
|
+
end
|
402
|
+
interval = 2 unless interval # 2 hour.
|
403
|
+
maxaccessnum = 10000 unless maxaccessnum # 2 hour.
|
404
|
+
current_time = Time.now
|
405
|
+
previous_access_time = @access.previous_access_time(current_time, cgi.remote_addr,
|
406
|
+
cgi.user_agent, interval, maxaccessnum)
|
407
|
+
if previous_access_time
|
408
|
+
ret = current_time - previous_access_time > interval * 3600
|
409
|
+
else
|
410
|
+
ret = true
|
411
|
+
end
|
412
|
+
ret
|
413
|
+
end
|
414
|
+
|
415
|
+
def new_user?(cgi, options)
|
416
|
+
return true if @access.ignore_cookie
|
417
|
+
if cgi.cookies
|
418
|
+
if cgi.cookies.keys.include?("tdiary_counter")
|
419
|
+
ret = false
|
420
|
+
else
|
421
|
+
ret = new_user_without_cookie?(cgi, options)
|
422
|
+
end
|
423
|
+
else
|
424
|
+
ret = new_user_without_cookie?(cgi, options)
|
425
|
+
end
|
426
|
+
ret
|
427
|
+
end
|
428
|
+
|
429
|
+
def format(classtype, theme_url, cnt, figure = 0, filetype = "", init_num = 0, &proc)
|
430
|
+
str = "%0#{figure}d" % (cnt + init_num)
|
431
|
+
result = %Q[<span class="counter#{classtype}">]
|
432
|
+
depth = 0
|
433
|
+
str.scan(/./).each do |num|
|
434
|
+
if block_given?
|
435
|
+
result << %Q[<img src="#{h theme_url}/#{yield(num)}" alt="#{num}" />]
|
436
|
+
elsif filetype == ""
|
437
|
+
result << %Q[<span class="counter-#{depth}"><span class="counter-num-#{num}">#{num}</span></span>]
|
438
|
+
else
|
439
|
+
result << %Q[<img src="#{h theme_url}/#{num}.#{filetype}" alt="#{num}" />]
|
440
|
+
end
|
441
|
+
depth += 1
|
442
|
+
end
|
443
|
+
result << "</span>"
|
444
|
+
end
|
445
|
+
|
446
|
+
def called?; @called; end
|
447
|
+
def called; @called = true; end
|
448
|
+
def all; @cnt.all + @init_num; end
|
449
|
+
def today; @cnt.today; end
|
450
|
+
def yesterday; @cnt.yesterday; end
|
451
|
+
def kiriban?; @kiriban; end
|
452
|
+
def kiriban_today?; @kiriban_today; end
|
453
|
+
|
454
|
+
module_function :new_user?, :new_user_without_cookie?, :all, :today, :yesterday, :format,
|
455
|
+
:main, :run, :kiriban?, :kiriban_today?
|
456
|
+
end
|
457
|
+
|
458
|
+
#init_num is deprecated.
|
459
|
+
#please replace it to @options["counter.init_num"]
|
460
|
+
def counter(figure = 0, filetype = "", init_num = 0, &proc)
|
461
|
+
TDiaryCounter.format("", theme_url, TDiaryCounter.all, figure, filetype, init_num, &proc)
|
462
|
+
end
|
463
|
+
|
464
|
+
def counter_today(figure = 0, filetype = "", &proc)
|
465
|
+
TDiaryCounter.format("-today", theme_url, TDiaryCounter.today, figure, filetype, 0, &proc)
|
466
|
+
end
|
467
|
+
|
468
|
+
def counter_yesterday(figure = 0, filetype = "", &proc)
|
469
|
+
TDiaryCounter.format("-yesterday", theme_url, TDiaryCounter.yesterday, figure, filetype, 0, &proc)
|
470
|
+
end
|
471
|
+
|
472
|
+
def kiriban?
|
473
|
+
TDiaryCounter.kiriban?
|
474
|
+
end
|
475
|
+
|
476
|
+
def kiriban_today?
|
477
|
+
TDiaryCounter.kiriban_today?
|
478
|
+
end
|
479
|
+
|
480
|
+
tdiary_counter_cookie = TDiaryCounter.run(@cache_path, @cgi, @options)
|
481
|
+
if tdiary_counter_cookie
|
482
|
+
if defined?(add_cookie)
|
483
|
+
add_cookie(tdiary_counter_cookie)
|
484
|
+
else
|
485
|
+
@cookie = tdiary_counter_cookie if tdiary_counter_cookie
|
486
|
+
end
|
487
|
+
end
|
488
|
+
|
489
|
+
def kiriban
|
490
|
+
if kiriban?
|
491
|
+
msg = @options["counter.kiriban_msg"] ? @options["counter.kiriban_msg"] : ""
|
492
|
+
ERB.new(msg.untaint).result(binding)
|
493
|
+
elsif kiriban_today?
|
494
|
+
msg = @options["counter.kiriban_today_msg"] ? @options["counter.kiriban_today_msg"] : ""
|
495
|
+
ERB.new(msg.untaint).result(binding)
|
496
|
+
else
|
497
|
+
msg = @options["counter.kiriban_nomatch_msg"] ? @options["counter.kiriban_nomatch_msg"] : ""
|
498
|
+
end
|
499
|
+
end
|
500
|
+
end
|
501
|
+
|
502
|
+
@counter_conf_counter ||= "アクセスカウンタ"
|
503
|
+
@counter_conf_init_head ||= "初期値の指定"
|
504
|
+
@counter_conf_init_desc ||= "「全て」表示の際のカウンタの初期値を指定できます。他のアクセスカウンタからの乗り換える時などに使用すると良いでしょう。デフォルトは0です。"
|
505
|
+
@counter_conf_init_label ||= " 初期値:"
|
506
|
+
@counter_conf_log_head ||= "ログの取得"
|
507
|
+
@counter_conf_log_desc ||= " 日別のアクセス数をログファイルに残したい場合に指定します。デフォルトは「残す」です。基本的には残すようにしましょう。<br/>ログファイルは、"#{@cache_path}/counter/counter.log" に保存されます。"
|
508
|
+
@counter_conf_log_true ||= "残す"
|
509
|
+
@counter_conf_log_false ||= "残さない"
|
510
|
+
@counter_conf_timer_head ||= "訪問間隔の指定"
|
511
|
+
@counter_conf_timer_desc ||= "指定した期間、繰り返し訪問してくるユーザをカウントアップしないようになっています(Cookieを使っています)。デフォルトは12(時間)です。"
|
512
|
+
@counter_conf_timer_label ||= "訪問間隔:"
|
513
|
+
@counter_conf_timer_unit ||= "時間"
|
514
|
+
@counter_conf_deny_same_src_interval_head ||= "カウントアップしない連続アクセス間隔の指定"
|
515
|
+
@counter_conf_deny_same_src_interval_desc ||= "前出の「訪問間隔の指定」では、Cookie機能を持たないクライアントからのアクセスがあると、アクセスがあるたびにカウントアップしてしまいます。こちらの機能は、同一IPアドレス/クライアントアプリケーションからの連続アクセスをカウントアップしないようにします。デフォルトは4時間です。"
|
516
|
+
@counter_conf_deny_same_src_interval_label ||= "カウントアップしない連続アクセス間隔:"
|
517
|
+
@counter_conf_deny_same_src_interval_unit ||= "時間"
|
518
|
+
@counter_conf_max_keep_access_num_head ||= "最大保持アクセス数の指定"
|
519
|
+
@counter_conf_max_keep_access_num_desc ||= "前出の「カウントアップしない連続アクセス間隔の指定」で内部的に保持するクライアントユーザ数を指定します。数が多いほど処理に時間がかかるようになるため、小さい方が望ましいです。デフォルトは10000件です。"
|
520
|
+
@counter_conf_max_keep_access_num_label ||= "最大保持アクセス数:"
|
521
|
+
@counter_conf_max_keep_access_num_unit ||= "件"
|
522
|
+
@counter_conf_deny_user_agents_head ||= "カウントアップしないユーザエージェント"
|
523
|
+
@counter_conf_deny_user_agents_desc ||= "カウントしないユーザーエージェントを指定します。ロボットなどを指定すると良いでしょう。各エージェントを'|'(パイプ)で区切って並べてください(正規表現を使うことができます)。<pre>例:Googlebot|Bulkfeeds</pre><p>指定しない場合でも以下のユーザーエージェントからのアクセスはカウントされません。</p>"
|
524
|
+
@counter_conf_deny_user_agents_label ||= "カウントしないユーザーエージェント:"
|
525
|
+
@counter_conf_kiriban_head ||= "キリ番の指定"
|
526
|
+
@counter_conf_kiriban_desc ||= "「全て」「今日」のキリ番を指定します。複数指定する場合は','(カンマ)を使ってください(例:100,123,300)。"
|
527
|
+
@counter_conf_kiriban_label_all ||= "「全て」のキリ番:"
|
528
|
+
@counter_conf_kiriban_label_today ||= "「今日」のキリ番:"
|
529
|
+
@counter_conf_kiriban_messages_head ||= "kiribanプラグインで出力されるメッセージの指定"
|
530
|
+
@counter_conf_kiriban_messages_desc ||= "ヘッダやサイドメニュー等に、<%= kiriban %>という形でキリ番プラグインを記述しておくと、キリ番になったときに(あるいはキリ番で無いときに)ここで記述する内容を表示します。ヘッダ同様、HTML形式です。"
|
531
|
+
@counter_conf_kiriban_messages_label_all ||= "「全て」のキリ番メッセージ:"
|
532
|
+
@counter_conf_kiriban_messages_label_today ||= "「今日」のキリ番メッセージ:"
|
533
|
+
@counter_conf_kiriban_messages_label_nomatch ||= "キリ番では無いときのメッセージ:"
|
534
|
+
|
535
|
+
def print_conf_html
|
536
|
+
@conf["counter.init_num"] ||= 0
|
537
|
+
@conf["counter.log"] ||= true
|
538
|
+
@conf["counter.timer"] ||= 12
|
539
|
+
@conf["counter.deny_same_src_interval"] ||= 4
|
540
|
+
@conf["counter.deny_user_agents"] ||= ""
|
541
|
+
@conf["counter.max_keep_access_num"] ||= 10000
|
542
|
+
|
543
|
+
@conf["counter.kiriban"] ||= ""
|
544
|
+
if @conf["counter.kiriban"].kind_of? Array
|
545
|
+
@conf["counter.kiriban"] = @conf["counter.kiriban"].join(", ")
|
546
|
+
end
|
547
|
+
@conf["counter.kiriban_today"] ||= ""
|
548
|
+
if @conf["counter.kiriban_today"].kind_of? Array
|
549
|
+
@conf["counter.kiriban_today"] = @conf["counter.kiriban_today"].join(", ")
|
550
|
+
end
|
551
|
+
|
552
|
+
@conf["counter.kiriban_msg"] ||= ""
|
553
|
+
@conf["counter.kiriban_today_msg"] ||= ""
|
554
|
+
@conf["counter.kiriban_nomatch_msg"] ||= ""
|
555
|
+
|
556
|
+
if @mode == 'saveconf' then
|
557
|
+
@conf["counter.init_num"] = @cgi.params['counter.init_num'][0].to_i
|
558
|
+
@conf["counter.log"] = @cgi.params['counter.log'][0] == "true"
|
559
|
+
@conf["counter.timer"] = @cgi.params['counter.timer'][0].to_i
|
560
|
+
@conf["counter.deny_same_src_interval"] = @cgi.params['counter.deny_same_src_interval'][0].to_i
|
561
|
+
@conf["counter.deny_user_agents"] = @cgi.params['counter.deny_user_agents'][0]
|
562
|
+
@conf["counter.max_keep_access_num"] ||= @cgi.params["counter.max_keep_access_num"][0].to_i
|
563
|
+
@conf["counter.kiriban"] = @cgi.params["counter.kiriban"][0]
|
564
|
+
@conf["counter.kiriban_today"] = @cgi.params["counter.kiriban_today"][0]
|
565
|
+
@conf["counter.kiriban_msg"] = @conf.to_native(@cgi.params["counter.kiriban_msg"][0]).gsub(/\r\n/, "\n" ).gsub(/\r/, '').sub(/\n+\z/, '')
|
566
|
+
@conf["counter.kiriban_today_msg"] = @conf.to_native(@cgi.params["counter.kiriban_today_msg"][0]).gsub(/\r\n/, "\n").gsub(/\r/, '').sub(/\n+\z/, '')
|
567
|
+
@conf["counter.kiriban_nomatch_msg"] = @conf.to_native(@cgi.params["counter.kiriban_nomatch_msg"][0]).gsub(/\r\n/, "\n").gsub(/\r/, '').sub(/\n+\z/, '')
|
568
|
+
end
|
569
|
+
|
570
|
+
<<-HTML
|
571
|
+
<h3 class="subtitle">#{@counter_conf_init_head}</h3>
|
572
|
+
<p>#{@counter_conf_init_desc}</p>
|
573
|
+
<p>#{@counter_conf_init_label}<input name="counter.init_num" value="#{h @conf["counter.init_num"]}" size="5"></p>
|
574
|
+
|
575
|
+
<h3 class="subtitle">#{@counter_conf_log_head}</h3>
|
576
|
+
<p>#{@counter_conf_log_desc}</p>
|
577
|
+
<p>
|
578
|
+
<select name="counter.log">
|
579
|
+
<option value="true"#{" selected" if @conf["counter.log"]}>#{@counter_conf_log_true}</option>
|
580
|
+
<option value="false"#{" selected" if ! @conf["counter.log"]}>#{@counter_conf_log_false}</option>
|
581
|
+
</select></li>
|
582
|
+
</p>
|
583
|
+
|
584
|
+
<h3 class="subtitle">#{@counter_conf_timer_head}</h3>
|
585
|
+
<p>#{@counter_conf_timer_desc}</p>
|
586
|
+
<p>#{@counter_conf_timer_label}<input name="counter.timer" value="#{h @conf["counter.timer"]}" size="2">#{@counter_conf_timer_unit}</p>
|
587
|
+
|
588
|
+
<h3 class="subtitle">#{@counter_conf_deny_same_src_interval_head}</h3>
|
589
|
+
<p>#{@counter_conf_deny_same_src_interval_desc}</p>
|
590
|
+
<p>#{@counter_conf_deny_same_src_interval_label}<input name="counter.deny_same_src_interval" value="#{h @conf["counter.deny_same_src_interval"]}" size="2">#{@counter_conf_deny_same_src_interval_unit}</p>
|
591
|
+
|
592
|
+
<h3 class="subtitle">#{@counter_conf_max_keep_access_num_head}</h3>
|
593
|
+
<p>#{@counter_conf_max_keep_access_num_desc}</p>
|
594
|
+
<p>#{@counter_conf_max_keep_access_num_label}<input name="counter.max_keep_access_num" value="#{h @conf["counter.max_keep_access_num"]}" size="7">#{@counter_conf_max_keep_access_num_unit}</p>
|
595
|
+
|
596
|
+
<h3 class="subtitle">#{@counter_conf_deny_user_agents_head}</h3>
|
597
|
+
<p>#{@counter_conf_deny_user_agents_desc}</p>
|
598
|
+
<blockquote>#{(@conf["bot"]||[]).join(", ")}, #{@counter_default_user_agents.gsub(/\|/, ", ")}</blockquote>
|
599
|
+
<dl><li>#{@counter_conf_deny_user_agents_label}<br/><textarea name="counter.deny_user_agents" cols="70" rows="3">#{@conf["counter.deny_user_agents"]}</textarea></li></dl>
|
600
|
+
|
601
|
+
<h3 class="subtitle">#{@counter_conf_kiriban_head}</h3>
|
602
|
+
<p>#{@counter_conf_kiriban_desc}</p>
|
603
|
+
<p><dl>
|
604
|
+
<li>#{@counter_conf_kiriban_label_all}<input name="counter.kiriban" value="#{h @conf["counter.kiriban"]}" size="60"></li>
|
605
|
+
<li>#{@counter_conf_kiriban_label_today}<input name="counter.kiriban_today" value="#{h @conf["counter.kiriban_today"]}" size="60"></li>
|
606
|
+
</dl></p>
|
607
|
+
<h3 class="subtitle">#{@counter_conf_kiriban_messages_head}</h3>
|
608
|
+
<p>#{@counter_conf_kiriban_messages_desc}</p>
|
609
|
+
<p><dl>
|
610
|
+
<li>#{@counter_conf_kiriban_messages_label_all}<br/>
|
611
|
+
<textarea name="counter.kiriban_msg" cols="70" rows="10">#{CGI.escapeHTML(@conf["counter.kiriban_msg"])}</textarea></li>
|
612
|
+
<li>#{@counter_conf_kiriban_messages_label_today}<br/>
|
613
|
+
<textarea name="counter.kiriban_today_msg" cols="70" rows="10">#{CGI.escapeHTML(@conf["counter.kiriban_today_msg"])}</textarea></li>
|
614
|
+
<li>#{@counter_conf_kiriban_messages_label_nomatch}<br/>
|
615
|
+
<textarea name="counter.kiriban_nomatch_msg" cols="70" rows="10">#{CGI.escapeHTML(@conf["counter.kiriban_nomatch_msg"])}</textarea></li>
|
616
|
+
</dl>
|
617
|
+
</p>
|
618
|
+
HTML
|
619
|
+
end
|
620
|
+
|
621
|
+
# Configure
|
622
|
+
add_conf_proc('counter', @counter_conf_counter) do
|
623
|
+
print_conf_html
|
624
|
+
end
|
625
|
+
|
626
|
+
# Local Variables:
|
627
|
+
# mode: ruby
|
628
|
+
# indent-tabs-mode: t
|
629
|
+
# tab-width: 3
|
630
|
+
# ruby-indent-level: 3
|
631
|
+
# End:
|