tdiary 3.2.2.20130507

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (509) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +16 -0
  4. data/.travis.yml +29 -0
  5. data/Capfile +2 -0
  6. data/ChangeLog +3173 -0
  7. data/Gemfile +58 -0
  8. data/Gemfile.lock +201 -0
  9. data/LICENSE +340 -0
  10. data/Procfile +1 -0
  11. data/README.md +33 -0
  12. data/Rakefile +26 -0
  13. data/bin/tdiary +7 -0
  14. data/config.ru +61 -0
  15. data/data/.htaccess +2 -0
  16. data/doc/HOWTO-authenticate-in-rack.md +89 -0
  17. data/doc/HOWTO-make-io.md +305 -0
  18. data/doc/HOWTO-make-plugin.md +279 -0
  19. data/doc/HOWTO-make-theme.md +67 -0
  20. data/doc/HOWTO-testing-tDiary.md +44 -0
  21. data/doc/HOWTO-use-plugin.md +148 -0
  22. data/doc/HOWTO-write-tDiary.en.md +131 -0
  23. data/doc/HOWTO-write-tDiary.md +136 -0
  24. data/doc/INSTALL-paas.md +202 -0
  25. data/doc/INSTALL.md +160 -0
  26. data/doc/README.en.md +174 -0
  27. data/doc/README.md +56 -0
  28. data/doc/UPGRADE.md +164 -0
  29. data/doc/doc.css +115 -0
  30. data/dot.htaccess +27 -0
  31. data/index.fcgi +45 -0
  32. data/index.rb +57 -0
  33. data/js/00default.js +60 -0
  34. data/js/01conf.js +62 -0
  35. data/js/02edit.coffee +5 -0
  36. data/js/02edit.js +15 -0
  37. data/js/amazon.js +43 -0
  38. data/js/calendar3.js +130 -0
  39. data/js/caretposition.js +170 -0
  40. data/js/category.js +29 -0
  41. data/js/category_autocomplete.js +96 -0
  42. data/js/comment_ajax.js +27 -0
  43. data/js/draft.js +149 -0
  44. data/js/highlight.js +36 -0
  45. data/js/image.js +181 -0
  46. data/misc/convert2.rb +123 -0
  47. data/misc/filter/antispamservice.rb +101 -0
  48. data/misc/filter/limitdays.rb +40 -0
  49. data/misc/filter/linkcheck.rb +81 -0
  50. data/misc/filter/plugin/antispamservice.rb +82 -0
  51. data/misc/filter/plugin/en/antispamservice.rb +21 -0
  52. data/misc/filter/plugin/ja/antispamservice.rb +20 -0
  53. data/misc/lib/README +4 -0
  54. data/misc/lib/compatible.rb +1 -0
  55. data/misc/lib/fcgi_patch.rb +90 -0
  56. data/misc/migrate.rb +157 -0
  57. data/misc/paas/cloudfoundry/Gemfile +26 -0
  58. data/misc/paas/cloudfoundry/Gemfile.lock +85 -0
  59. data/misc/paas/heroku/Gemfile +22 -0
  60. data/misc/paas/heroku/Gemfile.lock +85 -0
  61. data/misc/paas/sqale/Gemfile +19 -0
  62. data/misc/paas/sqale/Gemfile.lock +85 -0
  63. data/misc/paas/sqale/Procfile +1 -0
  64. data/misc/paas/sqale/dot.env +1 -0
  65. data/misc/plugin/ChangeLog.DO_NOT_UPDATE +2333 -0
  66. data/misc/plugin/a.rb +211 -0
  67. data/misc/plugin/amazon.rb +403 -0
  68. data/misc/plugin/amazon/README.en +17 -0
  69. data/misc/plugin/amazon/README.ja +29 -0
  70. data/misc/plugin/amazon/amazonimg.rb +113 -0
  71. data/misc/plugin/amazon/large.png +0 -0
  72. data/misc/plugin/amazon/medium.png +0 -0
  73. data/misc/plugin/amazon/small.png +0 -0
  74. data/misc/plugin/append-css.rb +51 -0
  75. data/misc/plugin/bq.rb +48 -0
  76. data/misc/plugin/calendar2.rb +184 -0
  77. data/misc/plugin/calendar3.rb +256 -0
  78. data/misc/plugin/category.rb +779 -0
  79. data/misc/plugin/category_autocomplete.rb +33 -0
  80. data/misc/plugin/comment_ajax.rb +11 -0
  81. data/misc/plugin/comment_mail-qmail.rb +57 -0
  82. data/misc/plugin/comment_mail-sendmail.rb +56 -0
  83. data/misc/plugin/comment_mail-smtp.rb +59 -0
  84. data/misc/plugin/comment_rank.rb +36 -0
  85. data/misc/plugin/counter.rb +631 -0
  86. data/misc/plugin/daily_theme.rb +55 -0
  87. data/misc/plugin/disp_referrer.rb +1486 -0
  88. data/misc/plugin/doctype-html401tr.rb +16 -0
  89. data/misc/plugin/draft.rb +20 -0
  90. data/misc/plugin/dropdown_calendar.rb +32 -0
  91. data/misc/plugin/edit_today.rb +50 -0
  92. data/misc/plugin/en/a.rb +10 -0
  93. data/misc/plugin/en/amazon.rb +71 -0
  94. data/misc/plugin/en/append-css.rb +17 -0
  95. data/misc/plugin/en/bq.rb +12 -0
  96. data/misc/plugin/en/calendar2.rb +12 -0
  97. data/misc/plugin/en/category.rb +204 -0
  98. data/misc/plugin/en/counter.rb +48 -0
  99. data/misc/plugin/en/daily_theme.rb +14 -0
  100. data/misc/plugin/en/disp_referrer.rb +387 -0
  101. data/misc/plugin/en/dropdown_calendar.rb +14 -0
  102. data/misc/plugin/en/edit_today.rb +22 -0
  103. data/misc/plugin/en/hide-mail-field.rb +19 -0
  104. data/misc/plugin/en/highlight.rb +29 -0
  105. data/misc/plugin/en/image.rb +54 -0
  106. data/misc/plugin/en/kw.rb +22 -0
  107. data/misc/plugin/en/makerss.rb +47 -0
  108. data/misc/plugin/en/pb-show.rb +21 -0
  109. data/misc/plugin/en/ping.rb +16 -0
  110. data/misc/plugin/en/recent_comment.rb +44 -0
  111. data/misc/plugin/en/recent_comment3.rb +56 -0
  112. data/misc/plugin/en/recent_rss.rb +33 -0
  113. data/misc/plugin/en/referer_scheme.rb +48 -0
  114. data/misc/plugin/en/search_control.rb +74 -0
  115. data/misc/plugin/en/search_form.rb +22 -0
  116. data/misc/plugin/en/speed_comment.rb +19 -0
  117. data/misc/plugin/en/tb-show.rb +37 -0
  118. data/misc/plugin/en/todo.rb +43 -0
  119. data/misc/plugin/en/weather.rb +185 -0
  120. data/misc/plugin/en/xmlrpc.rb +14 -0
  121. data/misc/plugin/footnote.rb +92 -0
  122. data/misc/plugin/gradation.rb +39 -0
  123. data/misc/plugin/gradient.rb +36 -0
  124. data/misc/plugin/hide-mail-field.rb +50 -0
  125. data/misc/plugin/highlight.rb +22 -0
  126. data/misc/plugin/html_anchor.rb +34 -0
  127. data/misc/plugin/image.rb +290 -0
  128. data/misc/plugin/ja/amazon.rb +89 -0
  129. data/misc/plugin/ja/bq.rb +13 -0
  130. data/misc/plugin/ja/calendar2.rb +12 -0
  131. data/misc/plugin/ja/category.rb +212 -0
  132. data/misc/plugin/ja/daily_theme.rb +15 -0
  133. data/misc/plugin/ja/disp_referrer.rb +644 -0
  134. data/misc/plugin/ja/edit_today.rb +23 -0
  135. data/misc/plugin/ja/hide-mail-field.rb +20 -0
  136. data/misc/plugin/ja/highlight.rb +30 -0
  137. data/misc/plugin/ja/makerss.rb +44 -0
  138. data/misc/plugin/ja/my-sequel.rb +52 -0
  139. data/misc/plugin/ja/pb-show.rb +23 -0
  140. data/misc/plugin/ja/ping.rb +17 -0
  141. data/misc/plugin/ja/recent_comment.rb +45 -0
  142. data/misc/plugin/ja/recent_comment3.rb +57 -0
  143. data/misc/plugin/ja/recent_rss.rb +34 -0
  144. data/misc/plugin/ja/referer_scheme.rb +86 -0
  145. data/misc/plugin/ja/search_control.rb +75 -0
  146. data/misc/plugin/ja/search_form.rb +32 -0
  147. data/misc/plugin/ja/tb-show.rb +38 -0
  148. data/misc/plugin/ja/todo.rb +46 -0
  149. data/misc/plugin/ja/weather.rb +402 -0
  150. data/misc/plugin/ja/xmlrpc.rb +15 -0
  151. data/misc/plugin/kw.rb +150 -0
  152. data/misc/plugin/list.rb +40 -0
  153. data/misc/plugin/makelirs.rb +89 -0
  154. data/misc/plugin/makerss.rb +744 -0
  155. data/misc/plugin/my-ex.rb +68 -0
  156. data/misc/plugin/my-sequel.rb +539 -0
  157. data/misc/plugin/navi_user.rb +19 -0
  158. data/misc/plugin/number_anchor.rb +47 -0
  159. data/misc/plugin/pb-show.rb +165 -0
  160. data/misc/plugin/ping.rb +99 -0
  161. data/misc/plugin/pre_wrap.rb +19 -0
  162. data/misc/plugin/random_google.rb +165 -0
  163. data/misc/plugin/recent_comment.rb +82 -0
  164. data/misc/plugin/recent_comment3.rb +192 -0
  165. data/misc/plugin/recent_list.rb +91 -0
  166. data/misc/plugin/recent_namazu.rb +50 -0
  167. data/misc/plugin/recent_rss.rb +305 -0
  168. data/misc/plugin/referer-antibot.rb +53 -0
  169. data/misc/plugin/referer-utf8.rb +12 -0
  170. data/misc/plugin/referer_scheme.rb +87 -0
  171. data/misc/plugin/search_control.rb +227 -0
  172. data/misc/plugin/search_form.rb +53 -0
  173. data/misc/plugin/sn.rb +107 -0
  174. data/misc/plugin/speed_comment.rb +68 -0
  175. data/misc/plugin/squeeze.rb +272 -0
  176. data/misc/plugin/src.rb +30 -0
  177. data/misc/plugin/tb-show.rb +212 -0
  178. data/misc/plugin/title_list.rb +41 -0
  179. data/misc/plugin/title_tag.rb +80 -0
  180. data/misc/plugin/tlink.rb +163 -0
  181. data/misc/plugin/todo.rb +182 -0
  182. data/misc/plugin/weather.rb +505 -0
  183. data/misc/plugin/whatsnew.rb +100 -0
  184. data/misc/plugin/xmlrpc.rb +80 -0
  185. data/misc/plugin/xmlrpc/README +20 -0
  186. data/misc/plugin/xmlrpc/xmlrpc.rb +575 -0
  187. data/misc/style/emptdiary/README.rd +83 -0
  188. data/misc/style/emptdiary/README.rd.en +78 -0
  189. data/misc/style/emptdiary/emptdiary_style.rb +199 -0
  190. data/misc/style/etdiary/README.rd +83 -0
  191. data/misc/style/etdiary/etdiary_style.rb +446 -0
  192. data/misc/style/gfm/gfm_style.rb +194 -0
  193. data/misc/style/rd/README.rd +71 -0
  194. data/misc/style/rd/rd_style.rb +366 -0
  195. data/misc/style/wiki/README +116 -0
  196. data/misc/style/wiki/README.en +101 -0
  197. data/misc/style/wiki/wiki_parser.rb +273 -0
  198. data/misc/style/wiki/wiki_style.rb +478 -0
  199. data/misc/theme_convert/Readme.rd +21 -0
  200. data/misc/theme_convert/append.rcss +150 -0
  201. data/misc/theme_convert/theme_convert.rb +453 -0
  202. data/plugin/00default.rb +1015 -0
  203. data/plugin/05referer.rb +298 -0
  204. data/plugin/10spamfilter.rb +183 -0
  205. data/plugin/50sp.rb +146 -0
  206. data/plugin/60sf.rb +152 -0
  207. data/plugin/90migrate.rb +109 -0
  208. data/plugin/en/00default.rb +390 -0
  209. data/plugin/en/05referer.rb +49 -0
  210. data/plugin/en/10spamfilter.rb +81 -0
  211. data/plugin/en/50sp.rb +56 -0
  212. data/plugin/en/60sf.rb +60 -0
  213. data/plugin/ja/00default.rb +401 -0
  214. data/plugin/ja/05referer.rb +47 -0
  215. data/plugin/ja/10spamfilter.rb +79 -0
  216. data/plugin/ja/50sp.rb +66 -0
  217. data/plugin/ja/60sf.rb +73 -0
  218. data/public/.gitkeep +0 -0
  219. data/public/images/.gitkeep +0 -0
  220. data/public/javascripts/.gitkeep +0 -0
  221. data/public/stylesheets/.gitkeep +0 -0
  222. data/skel/category.rhtml +9 -0
  223. data/skel/conf.rhtml +23 -0
  224. data/skel/day.rhtml +33 -0
  225. data/skel/diary.rhtml +83 -0
  226. data/skel/footer.rhtml +8 -0
  227. data/skel/header.rhtml +10 -0
  228. data/skel/i.category.rhtml +6 -0
  229. data/skel/i.conf.rhtml +14 -0
  230. data/skel/i.day.rhtml +28 -0
  231. data/skel/i.diary.rhtml +17 -0
  232. data/skel/i.footer.rhtml +2 -0
  233. data/skel/i.header.rhtml +3 -0
  234. data/skel/i.latest.rhtml +24 -0
  235. data/skel/i.month.rhtml +39 -0
  236. data/skel/i.search.rhtml +5 -0
  237. data/skel/i.update.rhtml +40 -0
  238. data/skel/i.update.rhtml.en +40 -0
  239. data/skel/latest.rhtml +27 -0
  240. data/skel/mail.rtxt +18 -0
  241. data/skel/mail.rtxt.en +18 -0
  242. data/skel/month.rhtml +27 -0
  243. data/skel/plugin_error.rhtml +27 -0
  244. data/skel/preview.rhtml +85 -0
  245. data/skel/preview.rhtml.en +72 -0
  246. data/skel/referer.rhtml +24 -0
  247. data/skel/search.rhtml +14 -0
  248. data/skel/tdiary.rconf +76 -0
  249. data/skel/update.rhtml +103 -0
  250. data/skel/update.rhtml.en +83 -0
  251. data/spec/acceptance/append_comment_spec.rb +94 -0
  252. data/spec/acceptance/append_diary_spec.rb +98 -0
  253. data/spec/acceptance/bugfix/encoding_error_spec.rb +27 -0
  254. data/spec/acceptance/save_conf_comment_spec.rb +87 -0
  255. data/spec/acceptance/save_conf_default_spec.rb +169 -0
  256. data/spec/acceptance/save_conf_dnsbl_spec.rb +152 -0
  257. data/spec/acceptance/save_conf_filter_spec.rb +50 -0
  258. data/spec/acceptance/save_conf_plugin_spec.rb +69 -0
  259. data/spec/acceptance/save_conf_referer_spec.rb +60 -0
  260. data/spec/acceptance/save_conf_security_spec.rb +280 -0
  261. data/spec/acceptance/support/helpers.rb +49 -0
  262. data/spec/acceptance/support/paths.rb +7 -0
  263. data/spec/acceptance/update_diary_spec.rb +113 -0
  264. data/spec/acceptance/view_category_spec.rb +38 -0
  265. data/spec/acceptance/view_comment_spec.rb +67 -0
  266. data/spec/acceptance/view_diary_spec.rb +126 -0
  267. data/spec/acceptance/view_referer_spec.rb +31 -0
  268. data/spec/acceptance_helper.rb +101 -0
  269. data/spec/core/compatible_spec.rb +54 -0
  270. data/spec/core/core_ext_spec.rb +59 -0
  271. data/spec/core/plugin_spec.rb +389 -0
  272. data/spec/core/rack/assets/precompile_spec.rb +76 -0
  273. data/spec/core/rack/html_anchor_spec.rb +57 -0
  274. data/spec/core/rack/valid_request_path_spec.rb +67 -0
  275. data/spec/core/style/emptdiary_style_spec.rb +165 -0
  276. data/spec/core/style/etdiary_style_spec.rb +512 -0
  277. data/spec/core/style/gfm_style_spec.rb +334 -0
  278. data/spec/core/style/rd_style_spec.rb +202 -0
  279. data/spec/core/style/tdiary_style_spec.rb +240 -0
  280. data/spec/core/style/wiki_style_spec.rb +441 -0
  281. data/spec/fixtures/ascii8bit-pstore.db +0 -0
  282. data/spec/fixtures/invalid-sequence-volatile.tdr +9 -0
  283. data/spec/fixtures/just_installed.conf +1 -0
  284. data/spec/fixtures/plugin/ja/sample.rb +4 -0
  285. data/spec/fixtures/plugin/sample.rb +6 -0
  286. data/spec/fixtures/sample.rb +12 -0
  287. data/spec/fixtures/tdiary.conf.gem +212 -0
  288. data/spec/fixtures/tdiary.conf.rack +212 -0
  289. data/spec/fixtures/tdiary.conf.rdb +227 -0
  290. data/spec/fixtures/tdiary.conf.secure +204 -0
  291. data/spec/fixtures/tdiary.conf.webrick +212 -0
  292. data/spec/javascripts/00default_spec.js +35 -0
  293. data/spec/javascripts/fixtures/00default.html +1 -0
  294. data/spec/javascripts/support/jasmine.yml +76 -0
  295. data/spec/plugin/bq_spec.rb +24 -0
  296. data/spec/plugin/plugin_helper.rb +203 -0
  297. data/spec/spec_helper.rb +32 -0
  298. data/tdiary.conf.beginner +244 -0
  299. data/tdiary.conf.sample +345 -0
  300. data/tdiary.conf.sample-en +333 -0
  301. data/tdiary.gemspec +26 -0
  302. data/tdiary.rb +151 -0
  303. data/tdiary/admin.rb +236 -0
  304. data/tdiary/application.rb +57 -0
  305. data/tdiary/author_only_base.rb +171 -0
  306. data/tdiary/base.rb +220 -0
  307. data/tdiary/cli.rb +116 -0
  308. data/tdiary/comment.rb +40 -0
  309. data/tdiary/comment_manager.rb +94 -0
  310. data/tdiary/compatible.rb +72 -0
  311. data/tdiary/config.rb +270 -0
  312. data/tdiary/core_ext.rb +122 -0
  313. data/tdiary/deploy.rb +50 -0
  314. data/tdiary/dispatcher.rb +77 -0
  315. data/tdiary/dispatcher/index_main.rb +122 -0
  316. data/tdiary/dispatcher/update_main.rb +101 -0
  317. data/tdiary/environment.rb +15 -0
  318. data/tdiary/filter.rb +48 -0
  319. data/tdiary/filter/default.rb +54 -0
  320. data/tdiary/filter/spam.rb +304 -0
  321. data/tdiary/io/base.rb +70 -0
  322. data/tdiary/io/cache/file.rb +123 -0
  323. data/tdiary/io/cache/memcached.rb +88 -0
  324. data/tdiary/io/cache/redis.rb +100 -0
  325. data/tdiary/io/default.rb +297 -0
  326. data/tdiary/io/pstore.rb +252 -0
  327. data/tdiary/io/rdb.rb +213 -0
  328. data/tdiary/lang/en.rb +79 -0
  329. data/tdiary/lang/ja.rb +72 -0
  330. data/tdiary/plugin.rb +375 -0
  331. data/tdiary/rack/assets/precompile.rb +37 -0
  332. data/tdiary/rack/auth/basic.rb +38 -0
  333. data/tdiary/rack/auth/omniauth.rb +51 -0
  334. data/tdiary/rack/html_anchor.rb +31 -0
  335. data/tdiary/rack/valid_request_path.rb +36 -0
  336. data/tdiary/referer_manager.rb +80 -0
  337. data/tdiary/request.rb +217 -0
  338. data/tdiary/response.rb +29 -0
  339. data/tdiary/server.rb +85 -0
  340. data/tdiary/style.rb +194 -0
  341. data/tdiary/style/tdiary_style.rb +198 -0
  342. data/tdiary/style/wiki_style.rb +213 -0
  343. data/tdiary/tasks.rb +1 -0
  344. data/tdiary/tasks/assets.rake +31 -0
  345. data/tdiary/tasks/auth.rake +28 -0
  346. data/tdiary/tasks/db.rake +110 -0
  347. data/tdiary/tasks/doc.rake +31 -0
  348. data/tdiary/tasks/heroku.rake +37 -0
  349. data/tdiary/tasks/jasmine.rake +16 -0
  350. data/tdiary/tasks/rdoc.rake +24 -0
  351. data/tdiary/tasks/release.rake +122 -0
  352. data/tdiary/tasks/rspec.rake +51 -0
  353. data/tdiary/tasks/server.rake +33 -0
  354. data/tdiary/tasks/test.rake +17 -0
  355. data/tdiary/version.rb +3 -0
  356. data/tdiary/view.rb +468 -0
  357. data/tdiary/view_helper.rb +15 -0
  358. data/test/disp_referrer_test.rb +93 -0
  359. data/test/my-sequel_test.rb +238 -0
  360. data/test/test_helper.rb +7 -0
  361. data/test/test_plugin_helper.rb +64 -0
  362. data/test/test_plugin_helper_test.rb +28 -0
  363. data/test/weather_test.rb +33 -0
  364. data/theme/base.css +268 -0
  365. data/theme/conf.block.png +0 -0
  366. data/theme/conf.css +254 -0
  367. data/theme/default/README +11 -0
  368. data/theme/default/body.png +0 -0
  369. data/theme/default/default.css +743 -0
  370. data/theme/help.png +0 -0
  371. data/theme/loading.gif +0 -0
  372. data/theme/tdiary1/README +7 -0
  373. data/theme/tdiary1/tdiary1.css +394 -0
  374. data/theme/tdiary2/README +19 -0
  375. data/theme/tdiary2/tdiary2.css +624 -0
  376. data/update.fcgi +45 -0
  377. data/update.rb +57 -0
  378. data/vendor/hikidoc-0.0.6/COPYING +28 -0
  379. data/vendor/hikidoc-0.0.6/NEWS +30 -0
  380. data/vendor/hikidoc-0.0.6/NEWS.ja +30 -0
  381. data/vendor/hikidoc-0.0.6/README +86 -0
  382. data/vendor/hikidoc-0.0.6/README.ja +83 -0
  383. data/vendor/hikidoc-0.0.6/Rakefile +68 -0
  384. data/vendor/hikidoc-0.0.6/TextFormattingRules +320 -0
  385. data/vendor/hikidoc-0.0.6/TextFormattingRules.ja +318 -0
  386. data/vendor/hikidoc-0.0.6/bin/hikidoc +66 -0
  387. data/vendor/hikidoc-0.0.6/lib/hikidoc.rb +914 -0
  388. data/vendor/hikidoc-0.0.6/setup.rb +1360 -0
  389. data/vendor/hikidoc-0.0.6/test/run-test.rb +13 -0
  390. data/vendor/hikidoc-0.0.6/test/test_hikidoc.rb +506 -0
  391. data/vendor/imagesize-0.1.1/Manifest.txt +19 -0
  392. data/vendor/imagesize-0.1.1/README.txt +49 -0
  393. data/vendor/imagesize-0.1.1/lib/image_size.rb +305 -0
  394. data/vendor/imagesize-0.1.1/lib/image_size/version.rb +9 -0
  395. data/vendor/imagesize-0.1.1/setup.rb +1585 -0
  396. data/vendor/imagesize-0.1.1/test/2-4-7.png +0 -0
  397. data/vendor/imagesize-0.1.1/test/4_1_2.gif +0 -0
  398. data/vendor/imagesize-0.1.1/test/bmp.bmp +0 -0
  399. data/vendor/imagesize-0.1.1/test/cursor.xbm +6 -0
  400. data/vendor/imagesize-0.1.1/test/detect.swf +0 -0
  401. data/vendor/imagesize-0.1.1/test/pbm.pbm +0 -0
  402. data/vendor/imagesize-0.1.1/test/pcx.pcx +0 -0
  403. data/vendor/imagesize-0.1.1/test/pgm.pgm +5 -0
  404. data/vendor/imagesize-0.1.1/test/test.xpm +38 -0
  405. data/vendor/imagesize-0.1.1/test/test_helper.rb +2 -0
  406. data/vendor/imagesize-0.1.1/test/test_image_size.rb +71 -0
  407. data/vendor/imagesize-0.1.1/test/tiff.tiff +0 -0
  408. data/vendor/imagesize-0.1.1/test/tokyo_tower.jpg +0 -0
  409. data/vendor/imagesize-0.1.1/test/tower_e.gif.psd +0 -0
  410. data/vendor/jasmine-jquery-1.4.2/jasmine-jquery.js +548 -0
  411. data/vendor/jquery-1.8/jquery.js +9227 -0
  412. data/vendor/rdtool-0.6.38/COPYING.txt +339 -0
  413. data/vendor/rdtool-0.6.38/Gemfile +3 -0
  414. data/vendor/rdtool-0.6.38/HISTORY +318 -0
  415. data/vendor/rdtool-0.6.38/LGPL-2.1 +502 -0
  416. data/vendor/rdtool-0.6.38/LICENSE.txt +58 -0
  417. data/vendor/rdtool-0.6.38/README.html +66 -0
  418. data/vendor/rdtool-0.6.38/README.ja.html +73 -0
  419. data/vendor/rdtool-0.6.38/README.rd +76 -0
  420. data/vendor/rdtool-0.6.38/README.rd.ja +85 -0
  421. data/vendor/rdtool-0.6.38/Rakefile +152 -0
  422. data/vendor/rdtool-0.6.38/TODO +22 -0
  423. data/vendor/rdtool-0.6.38/bin/rd2 +283 -0
  424. data/vendor/rdtool-0.6.38/bin/rdswap.rb +207 -0
  425. data/vendor/rdtool-0.6.38/doc/rd-draft.html +456 -0
  426. data/vendor/rdtool-0.6.38/doc/rd-draft.ja.html +466 -0
  427. data/vendor/rdtool-0.6.38/doc/rd-draft.rd +479 -0
  428. data/vendor/rdtool-0.6.38/doc/rd-draft.rd.ja +487 -0
  429. data/vendor/rdtool-0.6.38/lib/rd/block-element.rb +114 -0
  430. data/vendor/rdtool-0.6.38/lib/rd/complex-list-item.rb +65 -0
  431. data/vendor/rdtool-0.6.38/lib/rd/desclist.rb +55 -0
  432. data/vendor/rdtool-0.6.38/lib/rd/document-struct.rb +46 -0
  433. data/vendor/rdtool-0.6.38/lib/rd/dot.rd2rc +18 -0
  434. data/vendor/rdtool-0.6.38/lib/rd/element.rb +160 -0
  435. data/vendor/rdtool-0.6.38/lib/rd/filter.rb +255 -0
  436. data/vendor/rdtool-0.6.38/lib/rd/head-filter.rb +14 -0
  437. data/vendor/rdtool-0.6.38/lib/rd/inline-element.rb +233 -0
  438. data/vendor/rdtool-0.6.38/lib/rd/labeled-element.rb +14 -0
  439. data/vendor/rdtool-0.6.38/lib/rd/list.rb +57 -0
  440. data/vendor/rdtool-0.6.38/lib/rd/loose-struct.rb +11 -0
  441. data/vendor/rdtool-0.6.38/lib/rd/methodlist.rb +57 -0
  442. data/vendor/rdtool-0.6.38/lib/rd/output-format-visitor.rb +30 -0
  443. data/vendor/rdtool-0.6.38/lib/rd/package.rb +4 -0
  444. data/vendor/rdtool-0.6.38/lib/rd/parser-util.rb +14 -0
  445. data/vendor/rdtool-0.6.38/lib/rd/post-install +1 -0
  446. data/vendor/rdtool-0.6.38/lib/rd/pre-setup.rb +18 -0
  447. data/vendor/rdtool-0.6.38/lib/rd/rbl-file.rb +69 -0
  448. data/vendor/rdtool-0.6.38/lib/rd/rbl-suite.rb +37 -0
  449. data/vendor/rdtool-0.6.38/lib/rd/rd-struct.rb +86 -0
  450. data/vendor/rdtool-0.6.38/lib/rd/rd2html-ext-lib.rb +266 -0
  451. data/vendor/rdtool-0.6.38/lib/rd/rd2html-ext-opt.rb +34 -0
  452. data/vendor/rdtool-0.6.38/lib/rd/rd2html-lib.rb +490 -0
  453. data/vendor/rdtool-0.6.38/lib/rd/rd2html-opt.rb +67 -0
  454. data/vendor/rdtool-0.6.38/lib/rd/rd2man-lib.rb +251 -0
  455. data/vendor/rdtool-0.6.38/lib/rd/rd2rdo-lib.rb +19 -0
  456. data/vendor/rdtool-0.6.38/lib/rd/rd2rmi-lib.rb +32 -0
  457. data/vendor/rdtool-0.6.38/lib/rd/rdblockparser.ry +518 -0
  458. data/vendor/rdtool-0.6.38/lib/rd/rdblockparser.tab.rb +1061 -0
  459. data/vendor/rdtool-0.6.38/lib/rd/rdfmt.rb +15 -0
  460. data/vendor/rdtool-0.6.38/lib/rd/rdinlineparser.ry +503 -0
  461. data/vendor/rdtool-0.6.38/lib/rd/rdinlineparser.tab.rb +1243 -0
  462. data/vendor/rdtool-0.6.38/lib/rd/rdvisitor.rb +214 -0
  463. data/vendor/rdtool-0.6.38/lib/rd/reference-resolver.rb +114 -0
  464. data/vendor/rdtool-0.6.38/lib/rd/search-file.rb +14 -0
  465. data/vendor/rdtool-0.6.38/lib/rd/tree.rb +103 -0
  466. data/vendor/rdtool-0.6.38/lib/rd/version.rb +41 -0
  467. data/vendor/rdtool-0.6.38/lib/rd/visitor.rb +86 -0
  468. data/vendor/rdtool-0.6.38/rdtool.gemspec +125 -0
  469. data/vendor/rdtool-0.6.38/setup.rb +1596 -0
  470. data/vendor/rdtool-0.6.38/test/data/includee1.html +1 -0
  471. data/vendor/rdtool-0.6.38/test/data/includee2.html +1 -0
  472. data/vendor/rdtool-0.6.38/test/data/includee3.nothtml +1 -0
  473. data/vendor/rdtool-0.6.38/test/data/includee4.xhtml +0 -0
  474. data/vendor/rdtool-0.6.38/test/data/label.rbl +2 -0
  475. data/vendor/rdtool-0.6.38/test/data/label2.rbl +2 -0
  476. data/vendor/rdtool-0.6.38/test/data/sub/includee2.html +1 -0
  477. data/vendor/rdtool-0.6.38/test/data/sub/includee4.html +0 -0
  478. data/vendor/rdtool-0.6.38/test/dummy-observer.rb +6 -0
  479. data/vendor/rdtool-0.6.38/test/dummy.rb +33 -0
  480. data/vendor/rdtool-0.6.38/test/temp-dir.rb +19 -0
  481. data/vendor/rdtool-0.6.38/test/test-block-parser.rb +46 -0
  482. data/vendor/rdtool-0.6.38/test/test-desclist-item.rb +219 -0
  483. data/vendor/rdtool-0.6.38/test/test-document-element.rb +46 -0
  484. data/vendor/rdtool-0.6.38/test/test-document-struct.rb +66 -0
  485. data/vendor/rdtool-0.6.38/test/test-element.rb +46 -0
  486. data/vendor/rdtool-0.6.38/test/test-headline.rb +80 -0
  487. data/vendor/rdtool-0.6.38/test/test-inline-parser.rb +46 -0
  488. data/vendor/rdtool-0.6.38/test/test-list-item.rb +54 -0
  489. data/vendor/rdtool-0.6.38/test/test-list.rb +53 -0
  490. data/vendor/rdtool-0.6.38/test/test-methodlist-item.rb +73 -0
  491. data/vendor/rdtool-0.6.38/test/test-nonterminal-element.rb +170 -0
  492. data/vendor/rdtool-0.6.38/test/test-nonterminal-inline.rb +33 -0
  493. data/vendor/rdtool-0.6.38/test/test-output-format-visitor.rb +48 -0
  494. data/vendor/rdtool-0.6.38/test/test-parser-util.rb +41 -0
  495. data/vendor/rdtool-0.6.38/test/test-rbl-file.rb +156 -0
  496. data/vendor/rdtool-0.6.38/test/test-rbl-suite.rb +43 -0
  497. data/vendor/rdtool-0.6.38/test/test-rd2html-lib.rb +496 -0
  498. data/vendor/rdtool-0.6.38/test/test-rdtree.rb +17 -0
  499. data/vendor/rdtool-0.6.38/test/test-rdvisitor.rb +29 -0
  500. data/vendor/rdtool-0.6.38/test/test-reference-resolver.rb +202 -0
  501. data/vendor/rdtool-0.6.38/test/test-reference.rb +132 -0
  502. data/vendor/rdtool-0.6.38/test/test-search-file.rb +22 -0
  503. data/vendor/rdtool-0.6.38/test/test-terminal-inline.rb +41 -0
  504. data/vendor/rdtool-0.6.38/test/test-textblock.rb +44 -0
  505. data/vendor/rdtool-0.6.38/test/test-tree.rb +82 -0
  506. data/vendor/rdtool-0.6.38/test/test-version.rb +57 -0
  507. data/vendor/rdtool-0.6.38/test/test-visitor.rb +230 -0
  508. data/vendor/rdtool-0.6.38/utils/rd-mode.el +464 -0
  509. metadata +666 -0
data/plugin/50sp.rb ADDED
@@ -0,0 +1,146 @@
1
+ # -*- coding: utf-8; -*-
2
+ # 50sp.rb - select-plugins plugin
3
+
4
+ SP_PREFIX = 'sp'
5
+ @sp_path = [( @conf["#{SP_PREFIX}.path"] || "#{TDiary::PATH}/misc/plugin" )].flatten
6
+ @sp_path = @sp_path.collect do |path|
7
+ /\/$/ =~ path ? path.chop : path
8
+ end
9
+ @sp_path << "#{TDiary::PATH}/misc/plugin" if @sp_path.include?('misc/plugin')
10
+
11
+ # get plugin option
12
+ def sp_option( key )
13
+ @conf["#{SP_PREFIX}.#{key}"]
14
+ end
15
+
16
+ # hash of paths from array of dirs
17
+ def sp_hash_from_dirs( dirs )
18
+ r = Hash.new
19
+ dirs.each do |dir|
20
+ Dir::glob( "#{dir}/*.rb" ).each do |path|
21
+ filename = File.basename( path )
22
+ unless r[ filename ] then
23
+ r[ filename ] = path
24
+ end
25
+ end
26
+ end
27
+ r
28
+ end
29
+
30
+ # url of the document
31
+ def sp_doc_url( file )
32
+ "http://docs.tdiary.org/#{@conf.lang}/?#{CGI::escape( file )}"
33
+ end
34
+
35
+ # <li> list of plugins
36
+ def sp_li_plugins( paths, is_checked )
37
+ r = ''
38
+ paths.collect { |path| File.basename( path ) }.sort.each do |file|
39
+ r += <<-_HTML
40
+ <li><input name="#{SP_PREFIX}.#{h file}" type="checkbox" value="t"#{'checked' if is_checked}><a href="#{h sp_doc_url( file )}">#{h file}</a>
41
+ _HTML
42
+ end
43
+ r
44
+ end
45
+
46
+ # lists of plugins
47
+ def sp_list_plugins( sp_opt )
48
+ r = ''
49
+ if ( sp_opt && !sp_opt.empty? ) then
50
+ # categorize the available plugins
51
+ used = Array.new
52
+ notused = Array.new
53
+ unknown = Array.new
54
+ # File.basenmame needed to read option from 01sp.rb <= 1.10
55
+ selected_array = sp_option( 'selected' ) ? sp_option( 'selected').split( /\n/ ).collect{ |p| File.basename( p ) } : []
56
+ notselected_array = sp_option( 'notselected' ) ? sp_option( 'notselected').split( /\n/ ).collect{ |p| File.basename( p ) } : []
57
+ sp_opt.keys.each do |path|
58
+ if selected_array.include?( path ) then
59
+ used << path
60
+ elsif notselected_array.include?( path ) then
61
+ notused << path
62
+ else
63
+ unknown << path
64
+ end
65
+ end
66
+
67
+ # list up
68
+ r += @sp_label_please_select
69
+ unless unknown.empty? then
70
+ r += @sp_label_new
71
+ r += "<ul>\n"
72
+ r += sp_li_plugins( unknown, sp_option( 'usenew' ) )
73
+ r += "</ul>\n"
74
+ end
75
+ # selected plugins
76
+ unless used.empty? then
77
+ r += @sp_label_used
78
+ r += "<ul>\n"
79
+ r += sp_li_plugins( used, true )
80
+ r += "</ul>\n"
81
+ end
82
+ # not selected plugins
83
+ unless notused.empty? then
84
+ r += @sp_label_notused
85
+ r += "<ul>\n"
86
+ r += sp_li_plugins( notused, false )
87
+ r += "</ul>\n"
88
+ end
89
+ else
90
+ r += @sp_label_noplugin
91
+ end
92
+ r
93
+ end
94
+
95
+ # things needed to configure this plugin
96
+ if SP_PREFIX == (@cgi.params['conf'] && @cgi.params['conf'][0]) then
97
+ # list of plugins
98
+ @sp_opt = sp_hash_from_dirs( @sp_path )
99
+
100
+ # update options
101
+ # we have to do this when we are eval'ed to update the config menu
102
+ if /saveconf/ =~ @mode then
103
+ @conf["#{SP_PREFIX}.selected"] = ''
104
+ @conf["#{SP_PREFIX}.notselected"] = ''
105
+ @sp_opt.each_key do |file|
106
+ if 't' == @cgi.params["#{SP_PREFIX}.#{file}"][0] then
107
+ @conf["#{SP_PREFIX}.selected"] << "#{file}\n"
108
+ else
109
+ @conf["#{SP_PREFIX}.notselected"] << "#{file}\n"
110
+ end
111
+ end
112
+ end
113
+ end
114
+
115
+ # configuration menu
116
+ # options are updated when we are eval'ed
117
+ add_conf_proc( SP_PREFIX, @sp_label, 'basic' ) do
118
+ r = @sp_label_description + sp_list_plugins( @sp_opt )
119
+ end
120
+
121
+ # Finally, we can eval the selected plugins as tdiary.rb does
122
+ if sp_option( 'selected' ) then
123
+ sp_option( 'selected' ).untaint.split( /\n/ ).collect{ |p| File.basename( p ) }.sort.each do |filename|
124
+ @sp_path.each do |dir|
125
+ path = "#{dir}/#{filename}"
126
+ if File.readable?( path ) then
127
+ begin
128
+ load_plugin( path )
129
+ @plugin_files << path
130
+ rescue ArgumentError
131
+ next
132
+ rescue Exception
133
+ raise PluginError::new( "Plugin error in '#{path}'.\n#{$!}" )
134
+ end
135
+ break
136
+ end
137
+ end
138
+ end
139
+ end
140
+
141
+ # Local Variables:
142
+ # mode: ruby
143
+ # indent-tabs-mode: t
144
+ # tab-width: 3
145
+ # ruby-indent-level: 3
146
+ # End:
data/plugin/60sf.rb ADDED
@@ -0,0 +1,152 @@
1
+ # -*- coding: utf-8; -*-
2
+ # 60sf.rb - select-filters plugin
3
+ # This file is based on 50sp.rb Revision: 1.5
4
+ # Modified by KURODA Hiraku.
5
+
6
+ SF_PREFIX = 'sf'
7
+ @sf_path = [( @conf["#{SF_PREFIX}.path"] || "#{TDiary::PATH}/misc/filter" )].flatten
8
+ @sf_path = @sf_path.collect do |path|
9
+ /\/$/ =~ path ? path.chop : path
10
+ end
11
+
12
+ # get plugin option
13
+ def sf_option( key )
14
+ @conf["#{SF_PREFIX}.#{key}"]
15
+ end
16
+
17
+ # hash of paths from array of dirs
18
+ def sf_hash_from_dirs( dirs )
19
+ r = Hash.new
20
+ dirs.each do |dir|
21
+ Dir::glob( "#{dir}/*.rb" ).each do |path|
22
+ filename = File.basename( path )
23
+ unless r[ filename ] then
24
+ r[ filename ] = path
25
+ end
26
+ end
27
+ end
28
+ r
29
+ end
30
+
31
+ # url of the document
32
+ def sf_doc_url( file )
33
+ "http://docs.tdiary.org/#{@conf.lang}/?#{CGI::escape( file )}"
34
+ end
35
+
36
+ # <li> list of plugins
37
+ def sf_li_plugins( paths, is_checked )
38
+ r = ''
39
+ paths.collect { |path| File.basename( path ) }.sort.each do |file|
40
+ r += <<-_HTML
41
+ <li><input name="#{SF_PREFIX}.#{h file}" type="checkbox" value="t"#{'checked' if is_checked}><a href="#{h sf_doc_url( file )}">#{h file}</a>
42
+ _HTML
43
+ end
44
+ r
45
+ end
46
+
47
+ # lists of plugins
48
+ def sf_list_plugins( sf_opt )
49
+ r = ''
50
+ if ( sf_opt && !sf_opt.empty? ) then
51
+ # categorize the available plugins
52
+ used = Array.new
53
+ notused = Array.new
54
+ unknown = Array.new
55
+ # File.basenmame needed to read option from 01sp.rb <= 1.10
56
+ selected_array = sf_option( 'selected' ) ? sf_option( 'selected').split( /\n/ ).collect{ |p| File.basename( p ) } : []
57
+ notselected_array = sf_option( 'notselected' ) ? sf_option( 'notselected').split( /\n/ ).collect{ |p| File.basename( p ) } : []
58
+ sf_opt.keys.each do |path|
59
+ if selected_array.include?( path ) then
60
+ used << path
61
+ elsif notselected_array.include?( path ) then
62
+ notused << path
63
+ else
64
+ unknown << path
65
+ end
66
+ end
67
+
68
+ # list up
69
+ r += @sf_label_please_select
70
+ unless unknown.empty? then
71
+ r += @sf_label_new
72
+ r += "<ul>\n"
73
+ r += sf_li_plugins( unknown, sf_option( 'usenew' ) )
74
+ r += "</ul>\n"
75
+ end
76
+ # selected plugins
77
+ unless used.empty? then
78
+ r += @sf_label_used
79
+ r += "<ul>\n"
80
+ r += sf_li_plugins( used, true )
81
+ r += "</ul>\n"
82
+ end
83
+ # not selected plugins
84
+ unless notused.empty? then
85
+ r += @sf_label_notused
86
+ r += "<ul>\n"
87
+ r += sf_li_plugins( notused, false )
88
+ r += "</ul>\n"
89
+ end
90
+ else
91
+ r += @sf_label_noplugin
92
+ end
93
+ r
94
+ end
95
+
96
+ # things needed to configure this plugin
97
+ if SF_PREFIX == (@cgi.params['conf'] && @cgi.params['conf'][0]) then
98
+ # list of plugins
99
+ @sf_opt = sf_hash_from_dirs( @sf_path )
100
+
101
+ # update options
102
+ # we have to do this when we are eval'ed to update the config menu
103
+ if /saveconf/ =~ @mode then
104
+ @conf["#{SF_PREFIX}.selected"] = ''
105
+ @conf["#{SF_PREFIX}.notselected"] = ''
106
+ @sf_opt.each_key do |file|
107
+ if 't' == @cgi.params["#{SF_PREFIX}.#{file}"][0] then
108
+ @conf["#{SF_PREFIX}.selected"] << "#{file}\n"
109
+ else
110
+ @conf["#{SF_PREFIX}.notselected"] << "#{file}\n"
111
+ end
112
+ end
113
+ end
114
+ end
115
+
116
+ # configuration menu
117
+ # options are updated when we are eval'ed
118
+ add_conf_proc( SF_PREFIX, @sf_label, 'security' ) do
119
+ r = @sf_label_description + sf_list_plugins( @sf_opt )
120
+ end
121
+
122
+ # Finally, we can eval the selected plugins as tdiary.rb does
123
+ if sf_option( 'selected' ) && !@sf_filters then
124
+ @sf_filters = []
125
+ sf_option( 'selected' ).untaint.split( /\n/ ).collect{ |p| File.basename( p ) }.sort.each do |filename|
126
+ @sf_path.each do |dir|
127
+ path = "#{dir}/#{filename}"
128
+ if File.readable?( path ) then
129
+ begin
130
+ require path
131
+ @sf_filters << TDiary::Filter::const_get("#{File::basename(filename, ".rb").capitalize}Filter")::new(@cgi, @conf)
132
+ plugin_path = "#{dir}/plugin/#{filename}"
133
+ load_plugin(plugin_path) if File.readable?(plugin_path)
134
+ rescue Exception
135
+ raise PluginError::new( "Plugin error in '#{path}'.\n#{$!}" )
136
+ end
137
+ break
138
+ end
139
+ end
140
+ end
141
+ end
142
+
143
+ def sf_filters
144
+ @sf_filters||[]
145
+ end
146
+
147
+ # Local Variables:
148
+ # mode: ruby
149
+ # indent-tabs-mode: t
150
+ # tab-width: 3
151
+ # ruby-indent-level: 3
152
+ # End:
@@ -0,0 +1,109 @@
1
+ # -*- coding: utf-8; -*-
2
+ #
3
+ # 90migrate.rb: tDiary plugin for migration 2.2 to 2.3.
4
+ #
5
+
6
+ if !@conf.tdiary_version && @conf.io_class.to_s == 'TDiary::DefaultIO'
7
+ def convert_pstore( file )
8
+ require "pstore"
9
+
10
+ db = PStore.new( file )
11
+ begin
12
+ roots = db.transaction{ db.roots }
13
+ rescue ArgumentError
14
+ if /\Aundefined class\/module (.+?)(::)?\z/ =~ $!.message
15
+ klass = $1
16
+ if /EmptdiaryString\z/ =~ klass
17
+ eval( "class #{klass} < String; end" )
18
+ else
19
+ eval( "class #{klass}; end" )
20
+ end
21
+ retry
22
+ end
23
+ end
24
+ db.transaction do
25
+ roots.each do |root|
26
+ convert_element( db[root] )
27
+ end
28
+ end
29
+ end
30
+
31
+ def convert_element( data )
32
+ case data
33
+ when Hash, Array
34
+ data.each_with_index do |e, i|
35
+ if String === e
36
+ data[i] = @conf.migrate_to_utf8( e )
37
+ else
38
+ convert_element( e )
39
+ end
40
+ end
41
+ else
42
+ data.instance_variables.each do |e|
43
+ var = data.instance_variable_get( e )
44
+ if String === var
45
+ data.instance_variable_set( e, @conf.migrate_to_utf8( var ) )
46
+ else
47
+ convert_element( var )
48
+ end
49
+ end
50
+ end
51
+ end
52
+
53
+ require "fileutils"
54
+
55
+ # convert tdiary.conf in @conf.data_path
56
+ begin
57
+ conf_path = "#{@conf.data_path}tdiary.conf"
58
+ conf = File::open( conf_path ){|f| @conf.migrate_to_utf8( f.read ) }
59
+ conf.gsub!(/(\\[0-9]{3})+/) do |str|
60
+ @conf.migrate_to_utf8( eval( %Q["#{$&}"] ) ).dump[1...-1]
61
+ end
62
+ rescue
63
+ end
64
+ File::open( conf_path, 'w' ) do |o|
65
+ o.puts %Q!tdiary_version = "#{TDIARY_VERSION}"!
66
+ o.print( conf ) if conf
67
+ end
68
+ @conf.tdiary_version = TDIARY_VERSION
69
+
70
+ # convert pstore cache files of plugins
71
+ dir = @cache_path || "#{@conf.data_path}cache"
72
+ %w(makerss.cache recent_comments recent_trackbacks tlink/tlink.dat whatsnew-list blog_category).each do |e|
73
+ convert_pstore( "#{dir}/#{e}" ) if File.exist?( "#{dir}/#{e}" )
74
+ end
75
+ Dir["#{dir}/disp_referrer2.d/*"].each do |file|
76
+ convert_pstore( file )
77
+ end
78
+ Dir["#{@conf.data_path}category/*"].each do |file|
79
+ convert_pstore( file )
80
+ end
81
+
82
+ # rename category cache files
83
+ Dir["#{@conf.data_path}category/*"].each do |file|
84
+ dirname, basename = File.split( file )
85
+ new_basename = u( @conf.migrate_to_utf8( CGI::unescape( basename ) ) )
86
+ FileUtils.mv( file, File.join( dirname, new_basename ) ) unless basename == new_basename
87
+ end
88
+
89
+ # other files
90
+ a_dat = @conf['a.path'] || "#{dir}/a.dat"
91
+ if File.exist?( a_dat ) then
92
+ t = File::open( a_dat ){|f| f.read}
93
+ File::open( a_dat, 'wb' ){|f| f.write( @conf.migrate_to_utf8( t ) )}
94
+ end
95
+
96
+ # remove ruby/erb cache files
97
+ Dir["#{dir}/*.rb"].each{|f| FileUtils.rm_f( f )}
98
+ Dir["#{dir}/*.parser"].each{|f| FileUtils.rm_f( f )}
99
+
100
+ # redirect to top page
101
+ raise ::TDiary::ForceRedirect, base_url
102
+ end
103
+
104
+ # Local Variables:
105
+ # mode: ruby
106
+ # indent-tabs-mode: t
107
+ # tab-width: 3
108
+ # ruby-indent-level: 3
109
+ # End:
@@ -0,0 +1,390 @@
1
+ # -*- coding: utf-8; -*-
2
+ #
3
+ # en/00default.rb: English resources of 00default.rb.
4
+ #
5
+ # Copyright (C) 2001-2005, TADA Tadashi <t@tdtds.jp>
6
+ # You can redistribute it and/or modify it under GPL2.
7
+ #
8
+
9
+ #
10
+ # header
11
+ #
12
+ def title_tag
13
+ r = "<title>#{h @conf.html_title}"
14
+ case @mode
15
+ when 'day', 'comment'
16
+ r << "(#{@date.strftime( '%Y-%m-%d' )})" if @date
17
+ when 'month'
18
+ r << "(#{@date.strftime( '%Y-%m' )})" if @date
19
+ when 'form'
20
+ r << '(Append)'
21
+ when 'edit'
22
+ r << '(Edit)'
23
+ when 'preview'
24
+ r << '(Preview)'
25
+ when 'showcomment'
26
+ r << '(TSUKKOMI Status Change Completed)'
27
+ when 'conf'
28
+ r << '(Preferences)'
29
+ when 'saveconf'
30
+ r << '(Preferences Changed)'
31
+ when 'nyear'
32
+ years = @diaries.keys.map {|ymd| ymd.sub(/^\d{4}/, "")}
33
+ r << "(#{years[0].sub( /^(\d\d)/, '\1-')}[#{nyear_diary_label @date, years}])" if @date
34
+ end
35
+ r << '</title>'
36
+ end
37
+
38
+
39
+ #
40
+ # link to HOWTO write diary
41
+ #
42
+ def style_howto
43
+ %Q|/<a href="http://docs.tdiary.org/en/?#{h @conf.style}Style">How to write</a>|
44
+ end
45
+
46
+ #
47
+ # labels
48
+ #
49
+ def no_diary; "No diary on #{@date.strftime( @conf.date_format )}"; end
50
+ def comment_today; "Today's TSUKKOMI"; end
51
+ def comment_total( total ); "(Total: #{total})"; end
52
+ def comment_new; 'Add a TSUKKOMI'; end
53
+ def comment_description_default; 'Add a TSUKKOMI or Comment please. E-mail address will be shown to only me.'; end
54
+ def comment_limit_label; 'You cannot make more TSUKKOMI because it has over limit.'; end
55
+ def comment_description_short; 'TSUKKOMI!!'; end
56
+ def comment_name_label; 'Name'; end
57
+ def comment_name_label_short; 'Name'; end
58
+ def comment_mail_label; 'E-mail'; end
59
+ def comment_mail_label_short; 'Mail'; end
60
+ def comment_body_label; 'Comment'; end
61
+ def comment_body_label_short; 'Comment'; end
62
+ def comment_submit_label; 'Submit'; end
63
+ def comment_submit_label_short; 'Submit'; end
64
+ def comment_date( time ); time.strftime( "(#{@conf.date_format} %H:%M)" ); end
65
+ def trackback_today; "Today's TrackBacks"; end
66
+ def trackback_total( total ); "(Total: #{total})"; end
67
+
68
+ def navi_index; 'Top'; end
69
+ def navi_latest; 'Latest'; end
70
+ def navi_oldest; 'Oldest'; end
71
+ def navi_update; "Append"; end
72
+ def navi_edit; "Edit"; end
73
+ def navi_preference; "Preference"; end
74
+ def navi_prev_diary(date); "Prev(#{date.strftime(@conf.date_format)})"; end
75
+ def navi_next_diary(date); "Next(#{date.strftime(@conf.date_format)})"; end
76
+ def navi_prev_month; "Prev month"; end
77
+ def navi_next_month; "Next month"; end
78
+ def navi_prev_nyear(date); "Prev(#{date.strftime('%m-%d')})"; end
79
+ def navi_next_nyear(date); "Next(#{date.strftime('%m-%d')})"; end
80
+ def navi_prev_ndays; "#{@conf.latest_limit} days before"; end
81
+ def navi_next_ndays; "#{@conf.latest_limit} days after"; end
82
+
83
+ def submit_label
84
+ if @mode == 'form' or @cgi.valid?( 'appendpreview' ) then
85
+ 'Append'
86
+ else
87
+ 'Replace'
88
+ end
89
+ end
90
+ def preview_label; 'Preview'; end
91
+
92
+ def nyear_diary_label(date, years); "my old days"; end
93
+ def nyear_diary_title(date, years); "same days in past"; end
94
+
95
+
96
+ #
97
+ # labels (for mobile)
98
+ #
99
+ def mobile_navi_latest; 'Latest'; end
100
+ def mobile_navi_update; 'Update'; end
101
+ def mobile_navi_edit; "Edit"; end
102
+ def mobile_navi_preference; 'Prefs'; end
103
+ def mobile_navi_prev_diary; 'Prev'; end
104
+ def mobile_navi_next_diary; 'Next'; end
105
+ def mobile_label_hidden_diary; 'This day is HIDDEN.'; end
106
+
107
+ #
108
+ # category
109
+ #
110
+ def category_anchor(c); "[#{c}]"; end
111
+
112
+ #
113
+ # preferences
114
+ #
115
+ @conf_saving = 'Saving...'
116
+
117
+ # genre labels
118
+ @conf_genre_label['basic'] = 'Basic'
119
+ @conf_genre_label['theme'] = 'Themes'
120
+ @conf_genre_label['tsukkomi'] = 'TSUKKOMI'
121
+ @conf_genre_label['referer'] = 'Referrer'
122
+ @conf_genre_label['security'] = 'Security'
123
+ @conf_genre_label['etc'] = 'etc'
124
+
125
+ # basic (default)
126
+ add_conf_proc( 'default', 'Site information', 'basic' ) do
127
+ saveconf_default
128
+ @conf.description ||= ''
129
+ @conf.icon ||= ''
130
+ @conf.banner ||= ''
131
+ <<-HTML
132
+ <h3 class="subtitle">Title</h3>
133
+ #{"<p>The title of your diary. This value is used in HTML &lt;title&gt; element and in mobile mode. Do not use HTML tags.</p>" unless @cgi.mobile_agent?}
134
+ <p><input name="html_title" value="#{h @conf.html_title}" size="50"></p>
135
+
136
+ <h3 class="subtitle">Author</h3>
137
+ #{"<p>Specify your name. This value is into HTML header.</p>" unless @cgi.mobile_agent?}
138
+ <p><input name="author_name" value="#{h @conf.author_name}" size="40"></p>
139
+
140
+ <h3 class="subtitle">E-mail address</h3>
141
+ #{"<p>Specify your E-mail address. This value is into HTML header.</p>" unless @cgi.mobile_agent?}
142
+ <p><input name="author_mail" value="#{h @conf.author_mail}" size="40"></p>
143
+
144
+ <h3 class="subtitle">URL of index page</h3>
145
+ #{"<p>The URL of index of your website if you have.</p>" unless @cgi.mobile_agent?}
146
+ <p><input name="index_page" value="#{h @conf.index_page}" size="50"></p>
147
+
148
+ <h3 class="subtitle">URL of Your Diary</h3>
149
+ #{"<p>Specify your diary's URL. This URL is used by some plugins for indicate your diary</p>" unless @cgi.mobile_agent?}
150
+ #{"<p><strong>NOTICE!! The URL specified below is different from current URL of accessed now.</strong></p>" unless base_url == @cgi.base_url}
151
+ <p><input name="base_url" value="#{h base_url}" size="70"></p>
152
+
153
+ <h3 class="subtitle">Description</h3>
154
+ #{"<p>A brief description of your diary. Can be left blank.</p>" unless @cgi.mobile_agent?}
155
+ <p><input name="description" value="#{h @conf.description}" size="60"></p>
156
+
157
+ <h3 class="subtitle">Site icon (favicon)</h3>
158
+ #{"<p>URL for the small icon (aka 'favicon') of your site. Can be left blank.</p>" unless @cgi.mobile_agent?}
159
+ <p><input name="icon" value="#{h @conf.icon}" size="60"></p>
160
+
161
+ <h3 class="subtitle">Site banner</h3>
162
+ #{"<p>URL for the banner image of your site. makerss plugin will use this value to make RSS. Can be left blank.</p>" unless @cgi.mobile_agent?}
163
+ <p><input name="banner" value="#{h @conf.banner}" size="60"></p>
164
+
165
+ <h3 class="subtitle">Permit display in Frames</h3>
166
+ #{"<p>Permit display your diary included by frames.</p>" unless @cgi.mobile_agent?}
167
+ <p><select name="x_frame_options">
168
+ <option value=""#{" selected" unless @conf.x_frame_options}>Permit</option>
169
+ <option value="SAMEORIGIN"#{" selected" if @conf.x_frame_options == 'SAMEORIGIN'}>Permit in same domain</option>
170
+ <option value="DENY"#{" selected" if @conf.x_frame_options == 'DENY'}>Deny</option>
171
+ </select></p>
172
+ HTML
173
+ end
174
+
175
+ # header/footer (header)
176
+ add_conf_proc( 'header', 'Header/Footer', 'basic' ) do
177
+ saveconf_header
178
+
179
+ <<-HTML
180
+ <h3 class="subtitle">Header</h3>
181
+ #{"<p>This text is inserted into top of each pages. You can use HTML tags. Do not remove \"&lt;%=navi%&gt;\", because it mean Navigation bar inclued \"Update\" button. And \"&lt;%=calendar%&gt;\" mean calendar. So you can specify other plugins also.</p>" unless @cgi.mobile_agent?}
182
+ <p><textarea name="header" cols="60" rows="10">#{h @conf.header}</textarea></p>
183
+ <h3 class="subtitle">Footer</h3>
184
+ #{"<p>This text is inserted into bottom of each pages. You can specify as same as Header.</p>" unless @cgi.mobile_agent?}
185
+ <p><textarea name="footer" cols="60" rows="10">#{h @conf.footer}</textarea></p>
186
+ HTML
187
+ end
188
+
189
+ # diaplay
190
+ add_conf_proc( 'display', 'Display', 'basic' ) do
191
+ saveconf_display
192
+
193
+ <<-HTML
194
+ <h3 class="subtitle">Section anchor</h3>
195
+ #{"<p>\"Anchor\" guide to link from other website. Section anchors are insertd into begining of each section. So if you specify \"&lt;span class=\"sanchor\"&gt;_&lt;/span&gt;\", image anchor will be shown Image anchor by themes.</p>" unless @cgi.mobile_agent?}
196
+ <p><input name="section_anchor" value="#{h @conf.section_anchor}" size="40"></p>
197
+ <h3 class="subtitle">TSUKKOMI anchor</h3>
198
+ #{"<p>TSUKKOMI anchor is inserted into begining of each TSUKKOMIs. So You can specify \"&lt;span class=\"canchor\"&gt;_&lt;/span&gt;\" for Image anchor.</p>" unless @cgi.mobile_agent?}
199
+ <p><input name="comment_anchor" value="#{h @conf.comment_anchor}" size="40"></p>
200
+ <h3 class="subtitle">Date format</h3>
201
+ #{"<p>Format of date. If you specify a charactor after %, it mean special about date formatting: \"%Y\"(Year), \"%m\"(Month), \"%b\"(Short name of month), \"%B\"(Long name of month), \"%d\"(Day), \"%a\"(Short name of day of week), \"%A\"(Long name of day of week).</p>" unless @cgi.mobile_agent?}
202
+ <p><input name="date_format" value="#{h @conf.date_format}" size="30"></p>
203
+ <h3 class="subtitle">Max dates of Latest diaplay</h3>
204
+ #{"<p>In the Latest mode, you can specify the number of days in the page.</p>" unless @cgi.mobile_agent?}
205
+ <p><input name="latest_limit" value="#{h @conf.latest_limit}" size="2"> days in a page.</p>
206
+ <h3 class="subtitle">My old days</h3>
207
+ #{"<p>Show the link of \"My old days\"</p>" unless @cgi.mobile_agent?}
208
+ <p><select name="show_nyear">
209
+ <option value="true"#{" selected" if @conf.show_nyear}>Show</option>
210
+ <option value="false"#{" selected" unless @conf.show_nyear}>Hide</option>
211
+ </select></p>
212
+ HTML
213
+ end
214
+
215
+ # timezone
216
+ add_conf_proc( 'timezone', 'Time difference adjustment', 'update' ) do
217
+ saveconf_timezone
218
+ <<-HTML
219
+ <h3 class="subtitle">Time difference adjustment</h3>
220
+ #{"<p>When updating diary, you can adjust date which is automatically inserted into the form. The unit is hour. For example, if you want to handle the time until 2 a.m. as the previous day, you set this to -2. tDiary inserts the date which is older by 2 hours than the actual time. </p>" unless @cgi.mobile_agent?}
221
+ <p><input name="hour_offset" value="#{h @conf.hour_offset}" size="5"></p>
222
+ HTML
223
+ end
224
+
225
+ # themes
226
+ @theme_location_comment = "<p>You can get many themes from <a href=\"http://www.tdiary.org/20021001.html\">Theme Gallery</a>(Japanese).</p>"
227
+ @theme_thumbnail_label = "Thumbnail"
228
+
229
+ add_conf_proc( 'theme', 'Themes', 'theme' ) do
230
+ saveconf_theme
231
+
232
+ r = <<-HTML
233
+ <h3 class="subtitle">Theme</h3>
234
+ #{"<p>Specify the design of your diary using Theme or CSS. When you select \"CSS specify\", input URL of CSS into the field right side.</p>" unless @cgi.mobile_agent?}
235
+ <p>
236
+ <select name="theme" onChange="changeTheme( theme_thumbnail, this )">
237
+ <option value="">CSS Specify-&gt;</option>
238
+ HTML
239
+ r << conf_theme_list
240
+ end
241
+
242
+ # comments
243
+ add_conf_proc( 'comment', 'TSUKKOMI', 'tsukkomi' ) do
244
+ saveconf_comment
245
+
246
+ <<-HTML
247
+ <h3 class="subtitle">Show TSUKKOMI</h3>
248
+ #{"<p>Select show or hide TSUKKOMI from readers</p>" unless @cgi.mobile_agent?}
249
+ <p><select name="show_comment">
250
+ <option value="true"#{" selected" if @conf.show_comment}>Show</option>
251
+ <option value="false"#{" selected" unless @conf.show_comment}>Hide</option>
252
+ </select></p>
253
+ <h3 class="subtitle">Number of TSUKKOMI</h3>
254
+ #{"<p>In Latest or Month mode, you can specify number of visible TSUKKOMIs. So in Dayly mode, all of TSUKKOMIs are shown.</p>" unless @cgi.mobile_agent?}
255
+ <p><input name="comment_limit" value="#{h @conf.comment_limit}" size="3"> TSUKKOMIs</p>
256
+ <h3 class="subtitle">Limit of TSUKKOMI per a day</h3>
257
+ #{"<p>When numbers of TSUKKOMI over this value in a day, nobody can make new TSUKKOMI. If you use TrackBack plugin, this value means sum of TSUKKOMIs and TrackBacks.</p>" unless @cgi.mobile_agent?}
258
+ <p><input name="comment_limit_per_day" value="#{h @conf.comment_limit_per_day}" size="3"> TSUKKOMIs</p>
259
+ HTML
260
+ end
261
+
262
+ # comment mail
263
+ def comment_mail_mime( str )
264
+ [str.dup]
265
+ end
266
+
267
+ def comment_mail_conf_label; 'TSUKKOMI Mail'; end
268
+
269
+ def comment_mail_basic_html
270
+ @conf['comment_mail.header'] = '' unless @conf['comment_mail.header']
271
+ @conf['comment_mail.receivers'] = '' unless @conf['comment_mail.receivers']
272
+ @conf['comment_mail.sendhidden'] = false unless @conf['comment_mail.sendhidden']
273
+
274
+ <<-HTML
275
+ <h3 class="subtitle">Notify TSUKKOMI by E-mail</h3>
276
+ #{"<p>Select notify or not when your diary gets a new TSUKKOMI. So TSUKKOMI mail need SMTP server settings in tdiary.conf.</p>" unless @cgi.mobile_agent?}
277
+ <p><select name="comment_mail.enable">
278
+ <option value="true"#{" selected" if @conf['comment_mail.enable']}>Send Mail</option>
279
+ <option value="false"#{" selected" unless @conf['comment_mail.enable']}>Don't Send</option>
280
+ </select></p>
281
+ <h3 class="subtitle">Receivers</h3>
282
+ #{"<p>Sepecify receivers of TSUKKOMI mail, 1 address per 1 line. If you dose not specify, TSUKKOMI mails will be sent to your address.</p>" unless @cgi.mobile_agent?}
283
+ <p><textarea name="comment_mail.receivers" cols="40" rows="3">#{h( @conf['comment_mail.receivers'].gsub( /[, ]+/, "\n") )}</textarea></p>
284
+ <h3 class="subtitle">Mail header</h3>
285
+ #{"<p>Specify a string insert to beginning of mail subject. The subject have a style of \"your_specified_string:DATE-SERIAL NAME\". \"date\" is formatted as same as diary's date you specified. But when you specify another date style in this string, subject style is changed to \"your_specified_string-SERIAL NAME\" (ex: \"hoge:%Y-%m-%d\")</p>" unless @cgi.mobile_agent?}
286
+ <p><input name="comment_mail.header" value="#{h @conf['comment_mail.header']}"></p>
287
+ <h3 class="subtitle">About hidden TSUKKOMI</h3>
288
+ #{"<p>Some TSUKKOMI are hidden by filters. You can decide which sending E-mail by hidden TSUKKOMI.</p>" unless @cgi.mobile_agent?}
289
+ <p><label for="comment_mail.sendhidden"><input type="checkbox" id="comment_mail.sendhidden" name="comment_mail.sendhidden" value="#{" checked" if @conf['comment_mail.sendhidden']}">Send mail by hidden TSUKKOMI</label></p>
290
+ HTML
291
+ end
292
+
293
+ add_conf_proc( 'csrf_protection', 'CSRF Protection', 'security' ) do
294
+ err = saveconf_csrf_protection
295
+ errstr = ''
296
+ case err
297
+ when :param
298
+ errstr = '<p class="message">Invalid options specified. Configuration not saved.</p>'
299
+ when :key
300
+ errstr = '<p class="message">No key specified. Configuration not saved.</p>'
301
+ end
302
+ csrf_protection_method = @conf.options['csrf_protection_method'] || 1
303
+ csrf_protection_key = @conf.options['csrf_protection_key'] || ''
304
+ <<-HTML
305
+ #{errstr}
306
+ <p>This page configures a protection scheme to prevent "cross-site request forgery" (CSRF) attacks.</p>
307
+ <p>To make CSRF attack, a malicious person prepares a trap link in some web page and lets you visit that page.
308
+ When the trap link is invoked (either by Javascript or your mouse click), <i>your</i> web browser sends a forged request to tDiary.
309
+ Thus, neither encryption nor usual password protection can serve as a protection mechanism.
310
+ TDiary provies two methods -- "checking referer" and "checking CSRF key" -- to prevent such attacks.</p>
311
+ <div class="section">
312
+ <h3 class="subtitle">Checking Referer</h3>
313
+ <h4 class="subtitle">Checks for Referer values</h4>
314
+ <p>#{if [0,1,2,3].include?(csrf_protection_method) then
315
+ '<input type="checkbox" name="check_enabled2" value="true" checked disabled>
316
+ <input type="hidden" name="check_enabled" value="true">'
317
+ else
318
+ '<input type="checkbox" name="check_enabled" value="true">'
319
+ end}Enabled (default)
320
+ </p>
321
+ #{"<p>Configures Referer-based CSRF protection.
322
+ TDiary checks the Referer value sent from your web browser. If the post request comes from some outer page,
323
+ the request will be rejected. This setting can't be disabled through web-based configuration, for safety reasons.</p>
324
+ " unless @cgi.mobile_agent?}
325
+ <h3 class="subtitle">Handling of Referer-disabled browsers</h3>
326
+ <p><input type="radio" name="check_referer" value="true" #{if [1,3].include?(csrf_protection_method) then " checked" end}>Reject (default)
327
+ <input type="radio" name="check_referer" value="false" #{if [0,2].include?(csrf_protection_method) then " checked" end}>Accept
328
+ </p>
329
+ #{"<p>Configures handling for requests without any Referer: value.
330
+ By default tDiary rejects such request for safety reasons.
331
+ If your browser is configured not to send Referer values, alter that setting to allow sending Referer, at least for
332
+ originating sites. If it is impossible, configure the key-based CSRF protection below, and
333
+ change this setting to \"Accept\".</p>
334
+ " unless @cgi.mobile_agent?}
335
+ </div>
336
+ <div class="section">
337
+ <h3 class="subtitle">Checking CSRF key</h3>
338
+ <h4>Checks for CSRF protection key</h4>
339
+ <p><input type="radio" name="check_key" value="true" #{if [2,3].include?(csrf_protection_method) then " checked" end}>Enabled
340
+ <input type="radio" name="check_key" value="false" #{if [0,1].include?(csrf_protection_method) then " checked" end}>Disabled (default)
341
+ </p>
342
+ #{"<p>tDiary can add a secret key for every post form to prevent CSRF. As long as attackers do not know the secret key,
343
+ forged requests will not be granted. To enable this feature, tDiary will generate a key automatically.
344
+ To allow Referer-disabled browsers, you must enable this setting.</p>" unless @cgi.mobile_agent?}
345
+ #{"<p class=\"message\">Caution:
346
+ Your browser seems not to be sending any Referers, although Referer-based protection is enabled.
347
+ <a href=\"#{h @conf.update}?conf=csrf_protection\">Please open this page again via this link</a>.
348
+ If you see this message again, you must either change your browser setting (temporarily to change these settings, at least),
349
+ or edit \"tdiary.conf\" directly.</p>" if [1,3].include?(csrf_protection_method) && ! @cgi.referer && !@cgi.valid?('referer_exists')}
350
+ </div>
351
+ HTML
352
+ end
353
+
354
+ add_conf_proc( 'logger', 'Log Level', 'basic' ) do
355
+ saveconf_logger
356
+
357
+ r = <<-HTML
358
+ <h3 class="subtitle">Log Level</h3>
359
+ <p>Select log level of tDiary's output. If you selected spam filter's log level is enabled then select INFO or DEBUG.</p>
360
+ <p><select name="log_level">
361
+ HTML
362
+ r << conf_logger_list
363
+ end
364
+
365
+ add_conf_proc( 'recommendfilter', 'Recommend filter', 'basic' ) do
366
+ saveconf_recommendfilter
367
+
368
+ <<-HTML
369
+ <h3>Recommend filter</h3>
370
+ <p>Spam filtering for tDiary recommended to change the settings. Now, caution that all change what is settings.</p>
371
+ <p>
372
+ <input type="checkbox" id="recommend.filter" name="recommend.filter" value="true">
373
+ <label for="recommend.filter">Enabled recommend filter</label>
374
+ </p>
375
+ HTML
376
+ end
377
+
378
+ #
379
+ # old ruby alert
380
+ #
381
+ def old_ruby_alert_message
382
+ "The ruby #{RUBY_VERSION} will be unsupported by tDiary next release."
383
+ end
384
+
385
+ # Local Variables:
386
+ # mode: ruby
387
+ # indent-tabs-mode: t
388
+ # tab-width: 3
389
+ # ruby-indent-level: 3
390
+ # End: