tdiary 4.1.3 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +24 -25
  3. data/js/amazon.js +5 -35
  4. data/js/amazon_bitly.js +43 -0
  5. data/lib/tdiary/admin.rb +0 -8
  6. data/lib/tdiary/configuration.rb +5 -5
  7. data/lib/tdiary/core_ext.rb +5 -3
  8. data/lib/tdiary/dispatcher/index_main.rb +10 -16
  9. data/lib/tdiary/dispatcher/update_main.rb +8 -18
  10. data/lib/tdiary/filter/spam.rb +2 -2
  11. data/lib/tdiary/plugin/00default.rb +13 -37
  12. data/lib/tdiary/plugin/en/00default.rb +30 -32
  13. data/lib/tdiary/plugin/en/05referer.rb +4 -4
  14. data/lib/tdiary/plugin/ja/00default.rb +28 -31
  15. data/lib/tdiary/plugin/ja/05referer.rb +4 -4
  16. data/lib/tdiary/version.rb +1 -1
  17. data/lib/tdiary/view.rb +0 -4
  18. data/misc/plugin/amazon.rb +4 -2
  19. data/misc/plugin/amazon/amazonimg.rb +1 -1
  20. data/misc/plugin/category.rb +12 -20
  21. data/misc/plugin/category_autocomplete.rb +1 -1
  22. data/misc/plugin/comment_emoji_autocomplete.rb +1 -2
  23. data/misc/plugin/edit_today.rb +5 -9
  24. data/misc/plugin/en/pb-show.rb +2 -2
  25. data/misc/plugin/en/tb-show.rb +4 -4
  26. data/misc/plugin/hide-mail-field.rb +2 -2
  27. data/misc/plugin/image.rb +1 -3
  28. data/misc/plugin/ja/pb-show.rb +2 -2
  29. data/misc/plugin/ja/tb-show.rb +4 -4
  30. data/misc/plugin/my-ex.rb +0 -4
  31. data/misc/plugin/my-sequel.rb +10 -10
  32. data/misc/plugin/pb-show.rb +0 -6
  33. data/misc/plugin/ping.rb +1 -1
  34. data/misc/plugin/random_google.rb +12 -12
  35. data/misc/plugin/recent_rss.rb +3 -2
  36. data/misc/plugin/speed_comment.rb +1 -1
  37. data/misc/plugin/tb-show.rb +0 -6
  38. data/misc/plugin/weather.rb +3 -7
  39. data/spec/acceptance/save_conf_dnsbl_spec.rb +2 -2
  40. data/spec/core/core_ext_spec.rb +7 -0
  41. data/spec/plugin/plugin_helper.rb +3 -9
  42. metadata +4 -14
  43. data/views/i.category.rhtml +0 -6
  44. data/views/i.conf.rhtml +0 -14
  45. data/views/i.day.rhtml +0 -28
  46. data/views/i.diary.rhtml +0 -17
  47. data/views/i.footer.rhtml +0 -2
  48. data/views/i.header.rhtml +0 -3
  49. data/views/i.latest.rhtml +0 -24
  50. data/views/i.month.rhtml +0 -39
  51. data/views/i.search.rhtml +0 -5
  52. data/views/i.update.rhtml +0 -40
  53. data/views/i.update.rhtml.en +0 -40
@@ -130,40 +130,40 @@ add_conf_proc( 'default', 'Site information', 'basic' ) do
130
130
  @conf.banner ||= ''
131
131
  <<-HTML
132
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?}
133
+ <p>The title of your diary. This value is used in HTML &lt;title&gt; element. Do not use HTML tags.</p>
134
134
  <p><input name="html_title" value="#{h @conf.html_title}" size="50"></p>
135
135
 
136
136
  <h3 class="subtitle">Author</h3>
137
- #{"<p>Specify your name. This value is into HTML header.</p>" unless @cgi.mobile_agent?}
137
+ <p>Specify your name. This value is into HTML header.</p>
138
138
  <p><input name="author_name" value="#{h @conf.author_name}" size="40"></p>
139
139
 
140
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?}
141
+ <p>Specify your E-mail address. This value is into HTML header.</p>
142
142
  <p><input name="author_mail" value="#{h @conf.author_mail}" size="40"></p>
143
143
 
144
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?}
145
+ <p>The URL of index of your website if you have.</p>
146
146
  <p><input name="index_page" value="#{h @conf.index_page}" size="50"></p>
147
147
 
148
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?}
149
+ <p>Specify your diary's URL. This URL is used by some plugins for indicate your diary</p>
150
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
151
  <p><input name="base_url" value="#{h base_url}" size="70"></p>
152
152
 
153
153
  <h3 class="subtitle">Description</h3>
154
- #{"<p>A brief description of your diary. Can be left blank.</p>" unless @cgi.mobile_agent?}
154
+ <p>A brief description of your diary. Can be left blank.</p>
155
155
  <p><input name="description" value="#{h @conf.description}" size="60"></p>
156
156
 
157
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?}
158
+ <p>URL for the small icon (aka 'favicon') of your site. Can be left blank.</p>
159
159
  <p><input name="icon" value="#{h @conf.icon}" size="60"></p>
160
160
 
161
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?}
162
+ <p>URL for the banner image of your site. makerss plugin will use this value to make RSS. Can be left blank.</p>
163
163
  <p><input name="banner" value="#{h @conf.banner}" size="60"></p>
164
164
 
165
165
  <h3 class="subtitle">Permit display in Frames</h3>
166
- #{"<p>Permit display your diary included by frames.</p>" unless @cgi.mobile_agent?}
166
+ <p>Permit display your diary included by frames.</p>
167
167
  <p><select name="x_frame_options">
168
168
  <option value=""#{" selected" unless @conf.x_frame_options}>Permit</option>
169
169
  <option value="SAMEORIGIN"#{" selected" if @conf.x_frame_options == 'SAMEORIGIN'}>Permit in same domain</option>
@@ -178,10 +178,10 @@ add_conf_proc( 'header', 'Header/Footer', 'basic' ) do
178
178
 
179
179
  <<-HTML
180
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?}
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>
182
182
  <p><textarea name="header" cols="60" rows="10">#{h @conf.header}</textarea></p>
183
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?}
184
+ <p>This text is inserted into bottom of each pages. You can specify as same as Header.</p>
185
185
  <p><textarea name="footer" cols="60" rows="10">#{h @conf.footer}</textarea></p>
186
186
  HTML
187
187
  end
@@ -192,19 +192,19 @@ add_conf_proc( 'display', 'Display', 'basic' ) do
192
192
 
193
193
  <<-HTML
194
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?}
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>
196
196
  <p><input name="section_anchor" value="#{h @conf.section_anchor}" size="40"></p>
197
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?}
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>
199
199
  <p><input name="comment_anchor" value="#{h @conf.comment_anchor}" size="40"></p>
200
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?}
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>
202
202
  <p><input name="date_format" value="#{h @conf.date_format}" size="30"></p>
203
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?}
204
+ <p>In the Latest mode, you can specify the number of days in the page.</p>
205
205
  <p><input name="latest_limit" value="#{h @conf.latest_limit}" size="2"> days in a page.</p>
206
206
  <h3 class="subtitle">My old days</h3>
207
- #{"<p>Show the link of \"My old days\"</p>" unless @cgi.mobile_agent?}
207
+ <p>Show the link of "My old days"</p>
208
208
  <p><select name="show_nyear">
209
209
  <option value="true"#{" selected" if @conf.show_nyear}>Show</option>
210
210
  <option value="false"#{" selected" unless @conf.show_nyear}>Hide</option>
@@ -217,7 +217,7 @@ add_conf_proc( 'timezone', 'Time difference adjustment', 'update' ) do
217
217
  saveconf_timezone
218
218
  <<-HTML
219
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?}
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>
221
221
  <p><input name="hour_offset" value="#{h @conf.hour_offset}" size="5"></p>
222
222
  HTML
223
223
  end
@@ -231,7 +231,7 @@ add_conf_proc( 'theme', 'Themes', 'theme' ) do
231
231
 
232
232
  r = <<-HTML
233
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?}
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>
235
235
  <p>
236
236
  <select name="theme" id="theme_selection">
237
237
  <option value="">CSS Specify-&gt;</option>
@@ -245,16 +245,16 @@ add_conf_proc( 'comment', 'TSUKKOMI', 'tsukkomi' ) do
245
245
 
246
246
  <<-HTML
247
247
  <h3 class="subtitle">Show TSUKKOMI</h3>
248
- #{"<p>Select show or hide TSUKKOMI from readers</p>" unless @cgi.mobile_agent?}
248
+ <p>Select show or hide TSUKKOMI from readers</p>
249
249
  <p><select name="show_comment">
250
250
  <option value="true"#{" selected" if @conf.show_comment}>Show</option>
251
251
  <option value="false"#{" selected" unless @conf.show_comment}>Hide</option>
252
252
  </select></p>
253
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?}
254
+ <p>In Latest or Month mode, you can specify number of visible TSUKKOMIs. So in Dayly mode, all of TSUKKOMIs are shown.</p>
255
255
  <p><input name="comment_limit" value="#{h @conf.comment_limit}" size="3"> TSUKKOMIs</p>
256
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?}
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>
258
258
  <p><input name="comment_limit_per_day" value="#{h @conf.comment_limit_per_day}" size="3"> TSUKKOMIs</p>
259
259
  HTML
260
260
  end
@@ -273,19 +273,19 @@ def comment_mail_basic_html
273
273
 
274
274
  <<-HTML
275
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?}
276
+ <p>Select notify or not when your diary gets a new TSUKKOMI. So TSUKKOMI mail need SMTP server settings in tdiary.conf.</p>
277
277
  <p><select name="comment_mail.enable">
278
278
  <option value="true"#{" selected" if @conf['comment_mail.enable']}>Send Mail</option>
279
279
  <option value="false"#{" selected" unless @conf['comment_mail.enable']}>Don't Send</option>
280
280
  </select></p>
281
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?}
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>
283
283
  <p><textarea name="comment_mail.receivers" cols="40" rows="3">#{h( @conf['comment_mail.receivers'].gsub( /[, ]+/, "\n") )}</textarea></p>
284
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?}
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>
286
286
  <p><input name="comment_mail.header" value="#{h @conf['comment_mail.header']}"></p>
287
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?}
288
+ <p>Some TSUKKOMI are hidden by filters. You can decide which sending E-mail by hidden TSUKKOMI.</p>
289
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
290
  HTML
291
291
  end
@@ -317,20 +317,18 @@ add_conf_proc( 'csrf_protection', 'CSRF Protection', 'security' ) do
317
317
  '<input type="checkbox" name="check_enabled" value="true">'
318
318
  end}Enabled (default)
319
319
  </p>
320
- #{"<p>Configures Referer-based CSRF protection.
320
+ <p>Configures Referer-based CSRF protection.
321
321
  TDiary checks the Referer value sent from your web browser. If the post request comes from some outer page,
322
322
  the request will be rejected. This setting can't be disabled through web-based configuration, for safety reasons.</p>
323
- " unless @cgi.mobile_agent?}
324
323
  <h3 class="subtitle">Handling of Referer-disabled browsers</h3>
325
324
  <p><input type="radio" name="check_referer" value="true" #{if [1,3].include?(csrf_protection_method) then " checked" end}>Reject (default)
326
325
  <input type="radio" name="check_referer" value="false" #{if [0,2].include?(csrf_protection_method) then " checked" end}>Accept
327
326
  </p>
328
- #{"<p>Configures handling for requests without any Referer: value.
327
+ <p>Configures handling for requests without any Referer: value.
329
328
  By default tDiary rejects such request for safety reasons.
330
329
  If your browser is configured not to send Referer values, alter that setting to allow sending Referer, at least for
331
330
  originating sites. If it is impossible, configure the key-based CSRF protection below, and
332
- change this setting to \"Accept\".</p>
333
- " unless @cgi.mobile_agent?}
331
+ change this setting to "Accept".</p>
334
332
  </div>
335
333
  <div class="section">
336
334
  <h3 class="subtitle">Checking CSRF key</h3>
@@ -338,9 +336,9 @@ add_conf_proc( 'csrf_protection', 'CSRF Protection', 'security' ) do
338
336
  <p><input type="radio" name="check_key" value="true" #{if [2,3].include?(csrf_protection_method) then " checked" end}>Enabled
339
337
  <input type="radio" name="check_key" value="false" #{if [0,1].include?(csrf_protection_method) then " checked" end}>Disabled (default)
340
338
  </p>
341
- #{"<p>tDiary can add a secret key for every post form to prevent CSRF. As long as attackers do not know the secret key,
339
+ <p>tDiary can add a secret key for every post form to prevent CSRF. As long as attackers do not know the secret key,
342
340
  forged requests will not be granted. To enable this feature, tDiary will generate a key automatically.
343
- To allow Referer-disabled browsers, you must enable this setting.</p>" unless @cgi.mobile_agent?}
341
+ To allow Referer-disabled browsers, you must enable this setting.</p>
344
342
  #{"<p class=\"message\">Caution:
345
343
  Your browser seems not to be sending any Referers, although Referer-based protection is enabled.
346
344
  <a href=\"#{h @conf.update}?conf=csrf_protection\">Please open this page again via this link</a>.
@@ -18,21 +18,21 @@ add_conf_proc( 'referer', "Today's Link", 'referer' ) do
18
18
 
19
19
  <<-HTML
20
20
  <h3 class="subtitle">Show links</h3>
21
- #{"<p>Select show or hide about Today's Link</p>" unless @cgi.mobile_agent?}
21
+ <p>Select show or hide about Today's Link</p>
22
22
  <p><select name="show_referer">
23
23
  <option value="true"#{" selected" if @conf.show_referer}>Show</option>
24
24
  <option value="false"#{" selected" unless @conf.show_referer}>Hide</option>
25
25
  </select></p>
26
26
  <h3 class="subtitle">#{label_no_referer}</h3>
27
- #{"<p>List of excluding URL that is not recorded to Today's Link. Specify it in regular expression, and a URL into a line.</p>" unless @cgi.mobile_agent?}
27
+ <p>List of excluding URL that is not recorded to Today's Link. Specify it in regular expression, and a URL into a line.</p>
28
28
  <p>See <a href="#{h @conf.update}?referer=no" target="referer">Default configuration is here</a>.</p>
29
29
  <p><textarea name="no_referer" cols="60" rows="10">#{h @conf.no_referer2.join( "\n" )}</textarea></p>
30
30
  <h3 class="subtitle">#{label_only_volatile}</h3>
31
- #{"<p>List of URLs recorded to only volatile lists. This list will be clear when update diary in new day. Specify it in regular expression, and a URL into a line.</p>" unless @cgi.mobile_agent?}
31
+ <p>List of URLs recorded to only volatile lists. This list will be clear when update diary in new day. Specify it in regular expression, and a URL into a line.</p>
32
32
  <p>See <a href="#{h @conf.update}?referer=volatile" target="referer">Default configuration is here</a>.</p>
33
33
  <p><textarea name="only_volatile" cols="60" rows="10">#{h @conf.only_volatile2.join( "\n" )}</textarea></p>
34
34
  <h3 class="subtitle">#{label_referer_table}</h3>
35
- #{"<p>A table to convert URL to words in Today's Link. Specify it in regular expression, and a URL into a line.<p>" unless @cgi.mobile_agent?}
35
+ <p>A table to convert URL to words in Today's Link. Specify it in regular expression, and a URL into a line.<p>
36
36
  <p>See <a href="#{h @conf.update}?referer=table" target="referer">Default configurations</a>.</p>
37
37
  <p><textarea name="referer_table" cols="60" rows="10">#{h @conf.referer_table2.collect{|a|a.join( " " )}.join( "\n" )}</textarea></p>
38
38
  HTML
@@ -53,19 +53,19 @@ def comment_mail_basic_html
53
53
 
54
54
  <<-HTML
55
55
  <h3 class="subtitle">ツッコミメールを送る</h3>
56
- #{"<p>ツッコミがあった時に、メールを送るかどうかを選択します。</p>" unless @cgi.mobile_agent?}
56
+ <p>ツッコミがあった時に、メールを送るかどうかを選択します。</p>
57
57
  <p><select name="comment_mail.enable">
58
58
  <option value="true"#{" selected" if @conf['comment_mail.enable']}>送る</option>
59
59
  <option value="false"#{" selected" unless @conf['comment_mail.enable']}>送らない</option>
60
60
  </select></p>
61
61
  <h3 class="subtitle">送付先</h3>
62
- #{"<p>メールの送付先を指定します。1行に1メールアドレスの形で、複数指定可能です。指定のない場合には、あなたのメールアドレスに送られます。</p>" unless @cgi.mobile_agent?}
62
+ <p>メールの送付先を指定します。1行に1メールアドレスの形で、複数指定可能です。指定のない場合には、あなたのメールアドレスに送られます。</p>
63
63
  <p><textarea name="comment_mail.receivers" cols="40" rows="3">#{h( @conf['comment_mail.receivers'].gsub( /[, ]+/, "\n") )}</textarea></p>
64
64
  <h3 class="subtitle">メールヘッダ</h3>
65
- #{"<p>メールのSubjectにつけるヘッダ文字列を指定します。振り分け等に便利なように指定します。実際のSubjectには「指定文字列:日付-1」のように、日付とコメント番号が付きます。ただし指定文字列中に、%に続く英字があった場合、それを日付フォーマット指定を見なします。つまり「日付」の部分は自動的に付加されなくなります(コメント番号は付加されます)。</p>" unless @cgi.mobile_agent?}
65
+ <p>メールのSubjectにつけるヘッダ文字列を指定します。振り分け等に便利なように指定します。実際のSubjectには「指定文字列:日付-1」のように、日付とコメント番号が付きます。ただし指定文字列中に、%に続く英字があった場合、それを日付フォーマット指定を見なします。つまり「日付」の部分は自動的に付加されなくなります(コメント番号は付加されます)。</p>
66
66
  <p><input name="comment_mail.header" value="#{h @conf['comment_mail.header']}"></p>
67
67
  <h3 class="subtitle">非表示ツッコミの扱い</h3>
68
- #{"<p>フィルタの結果、最初から非表示にされたツッコミが記録されることがあります。この非表示のツッコミが来たときにもメールを発信するかどうかを選択します。</p>" unless @cgi.mobile_agent?}
68
+ <p>フィルタの結果、最初から非表示にされたツッコミが記録されることがあります。この非表示のツッコミが来たときにもメールを発信するかどうかを選択します。</p>
69
69
  <p><label for="comment_mail.sendhidden"><input type="checkbox" id="comment_mail.sendhidden" name="comment_mail.sendhidden" value="true"#{" checked" if @conf['comment_mail.sendhidden']}>非表示のツッコミでもメールを送る</label></p>
70
70
  HTML
71
71
  end
@@ -164,40 +164,40 @@ add_conf_proc( 'default', 'サイトの情報', 'basic' ) do
164
164
  @conf.banner ||= ''
165
165
  <<-HTML
166
166
  <h3 class="subtitle">タイトル</h3>
167
- #{"<p>HTMLの&lt;title&gt;タグ中および、モバイル端末からの参照時に使われるタイトルです。HTMLタグは使えません。</p>" unless @cgi.mobile_agent?}
167
+ <p>HTMLの&lt;title&gt;タグ中および、モバイル端末からの参照時に使われるタイトルです。HTMLタグは使えません。</p>
168
168
  <p><input name="html_title" value="#{h @conf.html_title}" size="50"></p>
169
169
 
170
170
  <h3 class="subtitle">著者名</h3>
171
- #{"<p>あなたの名前を指定します。HTMLヘッダ中に展開されます。</p>" unless @cgi.mobile_agent?}
171
+ <p>あなたの名前を指定します。HTMLヘッダ中に展開されます。</p>
172
172
  <p><input name="author_name" value="#{h @conf.author_name}" size="40"></p>
173
173
 
174
174
  <h3 class="subtitle">メールアドレス</h3>
175
- #{"<p>あなたのメールアドレスを指定します。HTMLヘッダ中に展開されます。</p>" unless @cgi.mobile_agent?}
175
+ <p>あなたのメールアドレスを指定します。HTMLヘッダ中に展開されます。</p>
176
176
  <p><input name="author_mail" value="#{h @conf.author_mail}" size="40"></p>
177
177
 
178
178
  <h3 class="subtitle">トップページURL</h3>
179
- #{"<p>日記よりも上位のコンテンツがあれば指定します。存在しない場合は何も入力しなくてかまいません。</p>" unless @cgi.mobile_agent?}
179
+ <p>日記よりも上位のコンテンツがあれば指定します。存在しない場合は何も入力しなくてかまいません。</p>
180
180
  <p><input name="index_page" value="#{h @conf.index_page}" size="70"></p>
181
181
 
182
182
  <h3 class="subtitle">日記のURL</h3>
183
- #{"<p>日記のURLを指定します。このURLは、さまざまなプラグインで日記を指し示すために利用されるので、正しく一意なものを指定しましょう。</p>" unless @cgi.mobile_agent?}
183
+ <p>日記のURLを指定します。このURLは、さまざまなプラグインで日記を指し示すために利用されるので、正しく一意なものを指定しましょう。</p>
184
184
  #{"<p><strong>指定してある値と、現在アクセス中のURLが異なります。注意してください。</strong></p>" unless base_url == @cgi.base_url}
185
185
  <p><input name="base_url" value="#{h base_url}" size="70"></p>
186
186
 
187
187
  <h3 class="subtitle">日記の説明</h3>
188
- #{"<p>この日記の簡単な説明を指定します。HTMLヘッダ中に展開されます。何も入力しなくてもかまいません。</p>" unless @cgi.mobile_agent?}
188
+ <p>この日記の簡単な説明を指定します。HTMLヘッダ中に展開されます。何も入力しなくてもかまいません。</p>
189
189
  <p><input name="description" value="#{h @conf.description}" size="70"></p>
190
190
 
191
191
  <h3 class="subtitle">サイトアイコン(favicon)</h3>
192
- #{"<p>この日記を表す小さなアイコン画像(favicon)があればそのURLを指定します。HTMLヘッダ中に展開されます。何も入力しなくてもかまいません。</p>" unless @cgi.mobile_agent?}
192
+ <p>この日記を表す小さなアイコン画像(favicon)があればそのURLを指定します。HTMLヘッダ中に展開されます。何も入力しなくてもかまいません。</p>
193
193
  <p><input name="icon" value="#{h @conf.icon}" size="70"></p>
194
194
 
195
195
  <h3 class="subtitle">バナー画像</h3>
196
- #{"<p>この日記を表す画像(バナー)があればそのURLを指定します。makerssプラグインなどでRSSを出力する場合などに使われます。何も入力しなくてもかまいません。</p>" unless @cgi.mobile_agent?}
196
+ <p>この日記を表す画像(バナー)があればそのURLを指定します。makerssプラグインなどでRSSを出力する場合などに使われます。何も入力しなくてもかまいません。</p>
197
197
  <p><input name="banner" value="#{h @conf.banner}" size="70"></p>
198
198
 
199
199
  <h3 class="subtitle">フレーム内表示</h3>
200
- #{"<p>日記全体をフレーム内にくるんで表示することを許可します。</p>" unless @cgi.mobile_agent?}
200
+ <p>日記全体をフレーム内にくるんで表示することを許可します。</p>
201
201
  <p><select name="x_frame_options">
202
202
  <option value=""#{" selected" unless @conf.x_frame_options}>許可する</option>
203
203
  <option value="SAMEORIGIN"#{" selected" if @conf.x_frame_options == 'SAMEORIGIN'}>同一ドメインなら許可する</option>
@@ -211,10 +211,10 @@ add_conf_proc( 'header', 'ヘッダ・フッタ', 'basic' ) do
211
211
 
212
212
  <<-HTML
213
213
  <h3 class="subtitle">ヘッダ</h3>
214
- #{"<p>日記の先頭に挿入される文章を指定します。HTMLタグが使えます。「&lt;%=navi%&gt;」で、ナビゲーションボタンを挿入できます(これがないと更新ができなくなるので削除しないようにしてください)。また、「&lt;%=calendar%&gt;」でカレンダーを挿入できます。その他、各種プラグインを記述できます。</p>" unless @cgi.mobile_agent?}
214
+ <p>日記の先頭に挿入される文章を指定します。HTMLタグが使えます。「&lt;%=navi%&gt;」で、ナビゲーションボタンを挿入できます(これがないと更新ができなくなるので削除しないようにしてください)。また、「&lt;%=calendar%&gt;」でカレンダーを挿入できます。その他、各種プラグインを記述できます。</p>
215
215
  <p><textarea name="header" cols="70" rows="10">#{h @conf.header}</textarea></p>
216
216
  <h3 class="subtitle">フッタ</h3>
217
- #{"<p>日記の最後に挿入される文章を指定します。ヘッダと同様に指定できます。</p>" unless @cgi.mobile_agent?}
217
+ <p>日記の最後に挿入される文章を指定します。ヘッダと同様に指定できます。</p>
218
218
  <p><textarea name="footer" cols="70" rows="10">#{h @conf.footer}</textarea></p>
219
219
  HTML
220
220
  end
@@ -224,19 +224,19 @@ add_conf_proc( 'display', '表示一般', 'basic' ) do
224
224
 
225
225
  <<-HTML
226
226
  <h3 class="subtitle">セクションアンカー</h3>
227
- #{"<p>日記のセクションの先頭(サブタイトルの行頭)に挿入される、リンク用のアンカー文字列を指定します。なお「&lt;span class=\"sanchor\"&gt;_&lt;/span&gt;」を指定すると、テーマによっては自動的に画像アンカーがつくようになります。</p>" unless @cgi.mobile_agent?}
227
+ <p>日記のセクションの先頭(サブタイトルの行頭)に挿入される、リンク用のアンカー文字列を指定します。なお「&lt;span class="sanchor"&gt;_&lt;/span&gt;」を指定すると、テーマによっては自動的に画像アンカーがつくようになります。</p>
228
228
  <p><input name="section_anchor" value="#{h @conf.section_anchor}" size="40"></p>
229
229
  <h3 class="subtitle">ツッコミアンカー</h3>
230
- #{"<p>読者からのツッコミの先頭に挿入される、リンク用のアンカー文字列を指定します。なお「&lt;span class=\"canchor\"&gt;_&lt;/span&gt;」を指定すると、テーマによっては自動的に画像アンカーがつくようになります。</p>" unless @cgi.mobile_agent?}
230
+ <p>読者からのツッコミの先頭に挿入される、リンク用のアンカー文字列を指定します。なお「&lt;span class="canchor"&gt;_&lt;/span&gt;」を指定すると、テーマによっては自動的に画像アンカーがつくようになります。</p>
231
231
  <p><input name="comment_anchor" value="#{h @conf.comment_anchor}" size="40"></p>
232
232
  <h3 class="subtitle">日付フォーマット</h3>
233
- #{"<p>日付の表示部分に使われるフォーマットを指定します。任意の文字が使えますが、「%」で始まる英字には次のような特殊な意味があります。「%Y」(西暦年)、「%m」(月数値)、「%b」(短月名)、「%B」(長月名)、「%d」(日)、「%a」(短曜日名)、「%A」(長曜日名)。</p>" unless @cgi.mobile_agent?}
233
+ <p>日付の表示部分に使われるフォーマットを指定します。任意の文字が使えますが、「%」で始まる英字には次のような特殊な意味があります。「%Y」(西暦年)、「%m」(月数値)、「%b」(短月名)、「%B」(長月名)、「%d」(日)、「%a」(短曜日名)、「%A」(長曜日名)。</p>
234
234
  <p><input name="date_format" value="#{h @conf.date_format}" size="30"></p>
235
235
  <h3 class="subtitle">最新表示の最大日数</h3>
236
- #{"<p>最新の日記を表示するときに、そのページ内に何日分の日記を表示するかを指定します。</p>" unless @cgi.mobile_agent?}
236
+ <p>最新の日記を表示するときに、そのページ内に何日分の日記を表示するかを指定します。</p>
237
237
  <p>最大<input name="latest_limit" value="#{h @conf.latest_limit}" size="2">日分</p>
238
238
  <h3 class="subtitle">長年日記の表示</h3>
239
- #{"<p>長年日記を表示するためのリンクを表示するかどうかを指定します。</p>" unless @cgi.mobile_agent?}
239
+ <p>長年日記を表示するためのリンクを表示するかどうかを指定します。</p>
240
240
  <p><select name="show_nyear">
241
241
  <option value="true"#{" selected" if @conf.show_nyear}>表示</option>
242
242
  <option value="false"#{" selected" unless @conf.show_nyear}>非表示</option>
@@ -249,7 +249,7 @@ add_conf_proc( 'timezone', '時差調整', 'update' ) do
249
249
 
250
250
  <<-HTML
251
251
  <h3 class="subtitle">時差調整</h3>
252
- #{"<p>更新時、フォームに挿入される日付を時間単位で調整できます。例えば午前2時までは前日として扱いたい場合には「-2」のように指定することで、2時間分引かれた日付が挿入されるようになります。また、この日付はWebサーバ上の時刻になっているので、海外のサーバで運営している場合の時差調整にも利用できます。</p>" unless @cgi.mobile_agent?}
252
+ <p>更新時、フォームに挿入される日付を時間単位で調整できます。例えば午前2時までは前日として扱いたい場合には「-2」のように指定することで、2時間分引かれた日付が挿入されるようになります。また、この日付はWebサーバ上の時刻になっているので、海外のサーバで運営している場合の時差調整にも利用できます。</p>
253
253
  <p><input name="hour_offset" value="#{h @conf.hour_offset}" size="5"></p>
254
254
  HTML
255
255
  end
@@ -262,7 +262,7 @@ add_conf_proc( 'theme', 'テーマ選択', 'theme' ) do
262
262
 
263
263
  r = <<-HTML
264
264
  <h3 class="subtitle">テーマの指定</h3>
265
- #{"<p>日記のデザインをテーマ、もしくはCSSの直接入力で指定します。ドロップダウンメニューから「CSS指定→」を選択した場合には、右の欄にCSSのURLを入力してください。</p>" unless @cgi.mobile_agent?}
265
+ <p>日記のデザインをテーマ、もしくはCSSの直接入力で指定します。ドロップダウンメニューから「CSS指定→」を選択した場合には、右の欄にCSSのURLを入力してください。</p>
266
266
  <p>
267
267
  <select name="theme" id="theme_selection">
268
268
  <option value="">CSS指定→</option>
@@ -275,16 +275,16 @@ add_conf_proc( 'comment', 'ツッコミ', 'tsukkomi' ) do
275
275
 
276
276
  <<-HTML
277
277
  <h3 class="subtitle">ツッコミの表示</h3>
278
- #{"<p>読者からのツッコミを表示するかどうかを指定します。</p>" unless @cgi.mobile_agent?}
278
+ <p>読者からのツッコミを表示するかどうかを指定します。</p>
279
279
  <p><select name="show_comment">
280
280
  <option value="true"#{" selected" if @conf.show_comment}>表示</option>
281
281
  <option value="false"#{" selected" unless @conf.show_comment}>非表示</option>
282
282
  </select></p>
283
283
  <h3 class="subtitle">ツッコミリスト表示数</h3>
284
- #{"<p>最新もしくは月別表示時に表示する、ツッコミの最大件数を指定します。なお、日別表示時にはここの指定にかかわらずすべてのツッコミが表示されます。</p>" unless @cgi.mobile_agent?}
284
+ <p>最新もしくは月別表示時に表示する、ツッコミの最大件数を指定します。なお、日別表示時にはここの指定にかかわらずすべてのツッコミが表示されます。</p>
285
285
  <p>最大<input name="comment_limit" value="#{h @conf.comment_limit}" size="3">件</p>
286
286
  <h3 class="subtitle">1日あたりのツッコミ最大数</h3>
287
- #{"<p>1日に書き込めるツッコミの最大数を指定します。この数を超えると、ツッコミ用のフォームが非表示になります。なお、TrackBackプラグインを入れている場合には、ツッコミとTrackBackの合計がこの制限を受けます。</p>" unless @cgi.mobile_agent?}
287
+ <p>1日に書き込めるツッコミの最大数を指定します。この数を超えると、ツッコミ用のフォームが非表示になります。なお、TrackBackプラグインを入れている場合には、ツッコミとTrackBackの合計がこの制限を受けます。</p>
288
288
  <p>最大<input name="comment_limit_per_day" value="#{h @conf.comment_limit_per_day}" size="3">件</p>
289
289
  HTML
290
290
  end
@@ -318,17 +318,16 @@ add_conf_proc( 'csrf_protection', 'CSRF(乗っ取り)対策', 'security' ) do
318
318
  '<input type="checkbox" name="check_enabled" value="true">'
319
319
  end}する(標準)
320
320
  </p>
321
- #{"<p>あなたのブラウザが送出するReferer(リンク元情報)を検査します。
321
+ <p>あなたのブラウザが送出するReferer(リンク元情報)を検査します。
322
322
  書き込み要求が正しいページから送出されたことを確認することで、
323
323
  偽ページからの要求を防ぎます。不正なページからの要求を検出した場合、
324
324
  更新リクエストを拒否します。
325
325
  この設定画面では、無効にすることは出来ません。</p>
326
- " unless @cgi.mobile_agent?}
327
326
  <h4>Refererを送出しないブラウザを拒否</h4>
328
327
  <p><input type="radio" name="check_referer" value="true" #{if [1,3].include?(csrf_protection_method) then " checked" end}>する(標準)
329
328
  <input type="radio" name="check_referer" value="false" #{if [0,2].include?(csrf_protection_method) then " checked" end}>しない
330
329
  </p>
331
- #{"<p>ブラウザからRefererが送られてこなかった場合の動作を指定します。</p>
330
+ <p>ブラウザからRefererが送られてこなかった場合の動作を指定します。</p>
332
331
  <p>標準では、Refererが送出されない場合、不正なリクエストを
333
332
  判別できないため、書き込み・設定変更を拒否します。
334
333
  あなたのブラウザがRefererを送出しない設定の場合、
@@ -340,21 +339,19 @@ add_conf_proc( 'csrf_protection', 'CSRF(乗っ取り)対策', 'security' ) do
340
339
  CSRFによる攻撃と区別できなくなりますので、必ず次の「CSRF防止キー」の
341
340
  設定と併用して下さい。</p>
342
341
  </div>
343
- " unless @cgi.mobile_agent?}
344
342
  <div class="section">
345
343
  <h3 class="subtitle">CSRF防止キーによる防衛</h3>
346
344
  <h4>CSRF防止キーの検査</h4>
347
345
  <p><input type="radio" name="check_key" value="true" #{if [2,3].include?(csrf_protection_method) then " checked" end}>する
348
346
  <input type="radio" name="check_key" value="false" #{if [0,1].include?(csrf_protection_method) then " checked" end}>しない(標準)
349
347
  </p>
350
- #{"<p>書き込みフォームに偽装書き込み防止のためのキーを設定し、CSRFを防ぎます。
348
+ <p>書き込みフォームに偽装書き込み防止のためのキーを設定し、CSRFを防ぎます。
351
349
  偽ページが秘密のキーを知らない限り、
352
350
  偽の書き込み要求を生成することができなくなります。
353
351
  この検査を「する」にすると、システムが鍵を自動的に生成、設定します。
354
352
  上の設定と両方「しない」にすることはできません。</p>
355
353
  <p>この設定を「する」にした場合、この機構に対応していない一部の
356
354
  プラグインが動作しなくなることがあります。</p>
357
- " unless @cgi.mobile_agent?}
358
355
  #{"<p class=\"message\">注意:
359
356
  あなたのブラウザは現在Refererを送出していないようです。
360
357
  <a href=\"#{h @conf.update}?conf=csrf_protection\">このリンクからもう一回
@@ -18,21 +18,21 @@ add_conf_proc( 'referer', 'リンク元', 'referer' ) do
18
18
 
19
19
  <<-HTML
20
20
  <h3 class="subtitle">リンク元の表示</h3>
21
- #{"<p>リンク元リストを表示するかどうかを指定します。</p>" unless @cgi.mobile_agent?}
21
+ <p>リンク元リストを表示するかどうかを指定します。</p>
22
22
  <p><select name="show_referer">
23
23
  <option value="true"#{" selected" if @conf.show_referer}>表示</option>
24
24
  <option value="false"#{" selected" unless @conf.show_referer}>非表示</option>
25
25
  </select></p>
26
26
  <h3 class="subtitle">#{label_no_referer}</h3>
27
- #{"<p>リンク元リストに追加しないURLを指定します。正規表現で指定できます。1件1行で入力してください。</p>" unless @cgi.mobile_agent?}
27
+ <p>リンク元リストに追加しないURLを指定します。正規表現で指定できます。1件1行で入力してください。</p>
28
28
  <p>→<a href="#{h @conf.update}?referer=no" target="referer">既存設定はこちら</a></p>
29
29
  <p><textarea name="no_referer" cols="70" rows="10">#{h @conf.no_referer2.join( "\n" )}</textarea></p>
30
30
  <h3 class="subtitle">#{label_only_volatile}</h3>
31
- #{"<p>「以前の日記へのリンク元」にのみ記録したいURLはこちらに記述します。「以前の日記へのリンク元」は、新しい日付の日記を書くと消去されます。正規表現で指定できます。1件1行で入力してください。</p>" unless @cgi.mobile_agent?}
31
+ <p>「以前の日記へのリンク元」にのみ記録したいURLはこちらに記述します。「以前の日記へのリンク元」は、新しい日付の日記を書くと消去されます。正規表現で指定できます。1件1行で入力してください。</p>
32
32
  <p>→<a href="#{h @conf.update}?referer=volatile" target="referer">既存設定はこちら</a></p>
33
33
  <p><textarea name="only_volatile" cols="70" rows="10">#{h @conf.only_volatile2.join( "\n" )}</textarea></p>
34
34
  <h3 class="subtitle">#{label_referer_table}</h3>
35
- #{"<p>リンク元リストのURLを、特定の文字列に変換する対応表を指定できます。1件につき、URLと表示文字列を空白で区切って指定します。正規表現が使えるので、URL中に現れた「(〜)」は、置換文字列中で「\\\\1」のような「\\数字」で利用できます。</p>" unless @cgi.mobile_agent?}
35
+ <p>リンク元リストのURLを、特定の文字列に変換する対応表を指定できます。1件につき、URLと表示文字列を空白で区切って指定します。正規表現が使えるので、URL中に現れた「(〜)」は、置換文字列中で「\\\\1」のような「\\数字」で利用できます。</p>
36
36
  <p>→<a href="#{h @conf.update}?referer=table" target="referer">既存設定はこちら</a></p>
37
37
  <p><textarea name="referer_table" cols="70" rows="10">#{h @conf.referer_table2.collect{|a|a.join( " " )}.join( "\n" )}</textarea></p>
38
38
  HTML
@@ -1,3 +1,3 @@
1
1
  module TDiary
2
- VERSION = '4.1.3'
2
+ VERSION = '4.2.0'
3
3
  end
data/lib/tdiary/view.rb CHANGED
@@ -192,10 +192,6 @@ module TDiary
192
192
  @name = @cgi.params['name'][0]
193
193
  @mail = @cgi.params['mail'][0]
194
194
  @body = @cgi.params['body'][0]
195
- if @cgi.mobile_agent?
196
- @name.force_encoding(conf.mobile_encoding)
197
- @body.force_encoding(conf.mobile_encoding)
198
- end
199
195
  @name = @conf.to_native( @name )
200
196
  @body = @conf.to_native( @body )
201
197
  @comment = Comment::new( @name, @mail, @body )
@@ -39,8 +39,10 @@ autoload :REXML, 'rexml/document'
39
39
  'us' => 'http://rpaproxy.tdiary.org/rpaproxy/us/',
40
40
  }
41
41
 
42
+ enable_js( 'amazon.js' )
43
+
42
44
  if @conf['amazon.bitly'] and @conf['bitly.login'] and @conf['bitly.key'] then
43
- enable_js( 'amazon.js' )
45
+ enable_js( 'amazon_bitly.js' )
44
46
  add_js_setting( '$tDiary.plugin.bitly' )
45
47
  add_js_setting( '$tDiary.plugin.bitly.login', "'#{@conf['bitly.login']}'" )
46
48
  add_js_setting( '$tDiary.plugin.bitly.apiKey', "'#{@conf['bitly.key']}'" )
@@ -210,7 +212,7 @@ def amazon_to_html( item, with_image = true, label = nil, pos = 'amazon' )
210
212
  unless image[:src] then
211
213
  img = ''
212
214
  else
213
- size = @cgi.smartphone? ? '' : %Q|height="#{h image[:height]}" width="#{h image[:width]}"|
215
+ size = %Q|height="#{h image[:height]}" width="#{h image[:width]}"|
214
216
  img = <<-HTML
215
217
  <img class="#{h pos}" src="#{h image[:src]}"
216
218
  #{size} alt="#{h alt}">