1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348
|
#
# ja/00default.rb: Japanese resources of 00default.rb.
#
#
# header
#
def title_tag
r = "<title>#{CGI::escapeHTML( @html_title )}"
case @mode
when 'day', 'comment'
r << "(#{@date.strftime( '%Y-%m-%d' )})" if @date
when 'month'
r << "(#{@date.strftime( '%Y-%m' )})" if @date
when 'form'
r << '(ɵ)'
when 'edit'
r << '(Խ)'
when 'preview'
r << '(ץӥ塼)'
when 'showcomment'
r << '(ѹλ)'
when 'conf'
r << '()'
when 'saveconf'
r << '(괰λ)'
when 'nyear'
years = @diaries.keys.map {|ymd| ymd.sub(/^\d{4}/, "")}
r << "(#{@cgi.params['date'][0].sub( /^(\d\d)/, '\1-')}[#{nyear_diary_label @date, years}])" if @date
end
r << '</title>'
end
#
# TSUKKOMI mail
#
def comment_mail_mime( str )
require 'nkf'
NKF::nkf( "-j -m0 -f50", str ).collect do |s|
%Q|=?ISO-2022-JP?B?#{[s.chomp].pack( 'm' ).gsub( /\n/, '' )}?=|
end
end
def comment_mail_conf_label; 'ĥåߥ'; end
def comment_mail_basic_html
@conf['comment_mail.header'] = '' unless @conf['comment_mail.header']
@conf['comment_mail.receivers'] = '' unless @conf['comment_mail.receivers']
<<-HTML
<h3 class="subtitle">ĥåߥ</h3>
#{"<p>ĥåߤäˡ뤫ɤޤ</p>" unless @conf.mobile_agent?}
<p><select name="comment_mail.enable">
<option value="true"#{if @conf['comment_mail.enable'] then " selected" end}></option>
<option value="false"#{if not @conf['comment_mail.enable'] then " selected" end}>ʤ</option>
</select></p>
<h3 class="subtitle"></h3>
#{"<p>ꤷޤ1Ԥ1륢ɥ쥹ηǡʣǽǤΤʤˤϡʤΥ륢ɥ쥹ޤ</p>" unless @conf.mobile_agent?}
<p><textarea name="comment_mail.receivers" cols="40" rows="3">#{CGI::escapeHTML( @conf['comment_mail.receivers'].gsub( /[, ]+/, "\n") )}</textarea></p>
<h3 class="subtitle">إå</h3>
#{"<p>SubjectˤĤإåʸꤷޤʬʤ褦˻ꤷޤºݤSubjectˤϡֻʸ:-1פΤ褦ˡդȥֹ椬դޤʸˡ%³ѻä硢եեޥåȻʤޤĤޤաפʬϼưŪղäʤʤޤ(ֹղäޤ)</p>" unless @conf.mobile_agent?}
<p><input name="comment_mail.header" value="#{CGI::escapeHTML( @conf['comment_mail.header'])}"></p>
HTML
end
#
# link to HOWTO write diary
#
def style_howto
%Q|/<a href="http://docs.tdiary.org/ja/?#{@conf.style}%A5%B9%A5%BF%A5%A4%A5%EB"></a>|
end
#
# labels (normal)
#
def no_diary; "#{@date.strftime( @conf.date_format )}Ϥޤ"; end
def comment_today; 'Υĥå'; end
def comment_total( total ); "(#{total})"; end
def comment_new; 'ĥåߤ'; end
def comment_description; 'ĥåߡȤФɤ! E-mailɥ쥹ϸޤ'; end
def comment_description_short; 'ĥå!!'; end
def comment_name_label; '̾'; end
def comment_name_label_short; '̾'; end
def comment_mail_label; 'E-mail'; end
def comment_mail_label_short; 'Mail'; end
def comment_body_label; ''; end
def comment_body_label_short; 'ʸ'; end
def comment_submit_label; ''; end
def comment_submit_label_short; ''; end
def comment_date( time ); time.strftime( "(#{@date_format} %H:%M)" ); end
def referer_today; 'Υ'; end
def trackback_today; 'TrackBacks'; end
def trackback_total( total ); "(#{total})"; end
def navi_index; 'ȥå'; end
def navi_latest; 'ǿ'; end
def navi_oldest; 'Ǹ'; end
def navi_update; "ɵ"; end
def navi_edit; "Խ"; end
def navi_preference; ""; end
def navi_prev_diary(date); "(#{date.strftime(@date_format)})"; end
def navi_next_diary(date); "(#{date.strftime(@date_format)})"; end
def navi_prev_nyear(date); "(#{date.strftime('%m-%d')})"; end
def navi_next_nyear(date); "(#{date.strftime('%m-%d')})"; end
def submit_label
if @mode == 'form' or @cgi.valid?( 'appendpreview' ) then
'ɵ'
else
'Ͽ'
end
end
def preview_label; 'ץӥ塼'; end
def label_no_referer; 'Ͽꥹ'; end
def label_referer_table; 'ִꥹ'; end
def nyear_diary_label(date, years); "Ĺǯ"; end
def nyear_diary_title(date, years); "Ĺǯ"; end
#
# labels (for mobile)
#
def mobile_navi_latest; 'ǿ'; end
def mobile_navi_update; "ɵ"; end
def mobile_navi_preference; ""; end
def mobile_navi_prev_diary; ""; end
def mobile_navi_next_diary; ""; end
def mobile_label_hidden_diary; 'ϡɽۤǤ'; end
#
# category
#
def category_anchor(c); "[#{c}]"; end
#
# preferences (resources)
#
add_conf_proc( 'default', '' ) do
saveconf_default
<<-HTML
<h3 class="subtitle">̾</h3>
#{"<p>ʤ̾ꤷޤHTMLإåŸޤ</p>" unless @conf.mobile_agent?}
<p><input name="author_name" value="#{CGI::escapeHTML @conf.author_name}" size="40"></p>
<h3 class="subtitle">륢ɥ쥹</h3>
#{"<p>ʤΥ륢ɥ쥹ꤷޤHTMLإåŸޤ</p>" unless @conf.mobile_agent?}
<p><input name="author_mail" value="#{@conf.author_mail}" size="40"></p>
<h3 class="subtitle">ȥåץڡURL</h3>
#{"<p>̤ΥƥĤлꤷޤ¸ߤʤϲϤʤƤޤޤ</p>" unless @conf.mobile_agent?}
<p><input name="index_page" value="#{@conf.index_page}" size="50"></p>
<h3 class="subtitle">Ĵ</h3>
#{"<p>եդñ̤ĴǤޤ㤨и2ޤǤȤưˤϡ-2פΤ褦˻ꤹ뤳Ȥǡ2ʬ줿դ褦ˤʤޤޤդWebоλˤʤäƤΤǡΥФDZĤƤλĴˤѤǤޤ</p>" unless @conf.mobile_agent?}
<p><input name="hour_offset" value="#{@conf.hour_offset}" size="5"></p>
HTML
end
add_conf_proc( 'header', 'إåեå' ) do
saveconf_header
<<-HTML
<h3 class="subtitle">ȥ</h3>
#{"<p>HTML<title>椪ӡХüλȻ˻Ȥ륿ȥǤHTMLϻȤޤ</p>" unless @conf.mobile_agent?}
<p><input name="html_title" value="#{ CGI::escapeHTML @conf.html_title }" size="50"></p>
<h3 class="subtitle">إå</h3>
#{"<p>ƬʸϤꤷޤHTMLȤޤ<%=navi%>פǡʥӥܥǤޤ(줬ʤȹǤʤʤΤǺʤ褦ˤƤ)ޤ<%=calendar%>פǥǤޤ¾Ƽץ饰ҤǤޤ</p>" unless @conf.mobile_agent?}
<p><textarea name="header" cols="70" rows="10">#{ CGI::escapeHTML @conf.header }</textarea></p>
<h3 class="subtitle">եå</h3>
#{"<p>κǸʸϤꤷޤإåƱͤ˻Ǥޤ</p>" unless @conf.mobile_agent?}
<p><textarea name="footer" cols="70" rows="10">#{ CGI::escapeHTML @conf.footer }</textarea></p>
HTML
end
add_conf_proc( 'display', 'ɽ' ) do
saveconf_display
<<-HTML
<h3 class="subtitle"></h3>
#{"<p>ΥƬ(֥ȥιƬ)롢ѤΥʸꤷޤʤ<span class=\"sanchor\">_</span>פꤹȡơޤˤäƤϼưŪ˲Ĥ褦ˤʤޤ</p>" unless @conf.mobile_agent?}
<p><input name="section_anchor" value="#{ CGI::escapeHTML @conf.section_anchor }" size="40"></p>
<h3 class="subtitle">ĥåߥ</h3>
#{"<p>ɼԤΥĥåߤƬ롢ѤΥʸꤷޤʤ<span class=\"canchor\">_</span>פꤹȡơޤˤäƤϼưŪ˲Ĥ褦ˤʤޤ</p>" unless @conf.mobile_agent?}
<p><input name="comment_anchor" value="#{ CGI::escapeHTML @conf.comment_anchor }" size="40"></p>
<h3 class="subtitle">եեޥå</h3>
#{"<p>դɽʬ˻ȤեޥåȤꤷޤǤդʸȤޤ%פǻϤޤѻˤϼΤ褦üʰ̣ޤ%Y(ǯ)%m()%b(û̾)%B(Ĺ̾)%d()%a(û̾)%A(Ĺ̾)</p>" unless @conf.mobile_agent?}
<p><input name="date_format" value="#{ CGI::escapeHTML @conf.date_format }" size="30"></p>
<h3 class="subtitle">ǿɽκ</h3>
#{"<p>ǿɽȤˡΥڡ˲ʬɽ뤫ꤷޤ</p>" unless @conf.mobile_agent?}
<p><input name="latest_limit" value="#{ @conf.latest_limit }" size="2">ʬ</p>
<h3 class="subtitle">Ĺǯɽ</h3>
#{"<p>Ĺǯɽ뤿Υɽ뤫ɤꤷޤ</p>" unless @conf.mobile_agent?}
<p><select name="show_nyear">
<option value="true"#{if @conf.show_nyear then " selected" end}>ɽ</option>
<option value="false"#{if not @conf.show_nyear then " selected" end}>ɽ</option>
</select></p>
HTML
end
@theme_location_comment = "<p>ˤʤơޤ<a href=\"http://www.tdiary.org/20021001.html\">ơޡ</a>Ǥޤ</p>"
add_conf_proc( 'theme', 'ơ' ) do
saveconf_theme
r = <<-HTML
<h3 class="subtitle">ơޤλ</h3>
#{"<p>Υǥơޡ⤷CSSľϤǻꤷޤɥåץ˥塼CSSꢪפˤϡCSSURLϤƤ</p>" unless @conf.mobile_agent?}
<p>
<select name="theme">
<option value="">CSSꢪ</option>
HTML
@conf_theme_list.each do |theme|
r << %Q|<option value="#{theme[0]}"#{if theme[0] == @conf.theme then " selected" end}>#{theme[1]}</option>|
end
r << <<-HTML
</select>
<input name="css" size="50" value="#{ @conf.css }">
</p>
#{@theme_location_comment unless @conf.mobile_agent?}
HTML
end
add_conf_proc( 'comment', 'ĥå' ) do
saveconf_comment
<<-HTML
<h3 class="subtitle">ĥåߤɽ</h3>
#{"<p>ɼԤΥĥåߤɽ뤫ɤꤷޤ</p>" unless @conf.mobile_agent?}
<p><select name="show_comment">
<option value="true"#{if @conf.show_comment then " selected" end}>ɽ</option>
<option value="false"#{if not @conf.show_comment then " selected" end}>ɽ</option>
</select></p>
<h3 class="subtitle">ĥåߥꥹɽ</h3>
#{"<p>ǿ⤷Ϸɽɽ롢ĥåߤκꤷޤʤɽˤϤλˤ餺٤ƤΥĥåߤɽޤ</p>" unless @conf.mobile_agent?}
<p><input name="comment_limit" value="#{ @conf.comment_limit }" size="3"></p>
HTML
end
add_conf_proc( 'referer', '' ) do
saveconf_referer
<<-HTML
<h3 class="subtitle">ɽ</h3>
#{"<p>ꥹȤɽ뤫ɤꤷޤ</p>" unless @conf.mobile_agent?}
<p><select name="show_referer">
<option value="true"#{if @conf.show_referer then " selected" end}>ɽ</option>
<option value="false"#{if not @conf.show_referer then " selected" end}>ɽ</option>
</select></p>
<h3 class="subtitle">ꥹɽ</h3>
#{"<p>ǿ⤷Ϸɽɽ롢ꥹȤκꤷޤʤɽˤϤλˤ餺٤ƤΥɽޤ</p>" unless @conf.mobile_agent?}
<p><input name="referer_limit" value="#{@conf.referer_limit}" size="3"></p>
<h3 class="subtitle">εϿ</h3>
#{"<p>ջΥΥϿ뤫ɤꤷޤλȥƥʤξϿʤʤΤǡΥΥޤ</p>" unless @conf.mobile_agent?}
<p><select name="referer_day_only">
<option value="true"#{if @conf.referer_day_only then " selected" end}>ջΥΤߵϿ</option>
<option value="false"#{if not @conf.referer_day_only then " selected" end}>٤ƤΥǵϿ</option>
</select></p>
<h3 class="subtitle">Ͽꥹ</h3>
#{"<p>ꥹȤɲäʤURLꤷޤɽǻǤޤ11ԤϤƤ</p>" unless @conf.mobile_agent?}
<p><a href="#{@conf.update}?referer=no" target="referer">¸Ϥ</a></p>
<p><textarea name="no_referer" cols="70" rows="10">#{@conf.no_referer2.join( "\n" )}</textarea></p>
<h3 class="subtitle">ִꥹ</h3>
#{"<p>ꥹȤURLʸѴбɽǤޤ1ˤĤURLɽʸǶڤäƻꤷޤɽȤΤǡURL˸줿()פϡִʸǡ\\1פΤ褦ʡ\פѤǤޤ</p>" unless @conf.mobile_agent?}
<p><a href="#{@conf.update}?referer=table" target="referer">¸Ϥ</a></p>
<p><textarea name="referer_table" cols="70" rows="10">#{@conf.referer_table2.collect{|a|a.join( " " )}.join( "\n" )}</textarea></p>
HTML
end
add_conf_proc( 'csrf_protection', 'CSRF(ü)к' ) do
err = saveconf_csrf_protection
errstr = ''
case err
when :param
errstr = '<p class="message">Ȥ߹碌ǤѹޤǤ</p>'
when :key
errstr = '<p class="message">ǤѹޤǤ</p>'
end
csrf_protection_method = @conf.options['csrf_protection_method'] || 1
csrf_protection_key = @conf.options['csrf_protection_key'] || ''
<<-HTML
#{errstr}
<p>ȡꥯȥե(CSRF)кˡꤷޤ</p>
<p>CSRFϡդΤʹ֤Webڡ櫤ųݤޤ
櫤ųݤڡʤȡʤΥ֥饦
tDiary˵νФƤޤޤʤΥ֥饦
ФƤޤᡢŹ沽ѥݸǤкˤʤޤ
tDiaryǤϡμιФơRefereråפȡCSRFפȤ
2ɱҼʤѰդƤޤ</p>
<div class="section">
<h3 class="subtitle">Refereråˤɱ</h3>
<h4>Refererθ</h4>
<p>#{if [0,1,2,3].include?(csrf_protection_method) then
'<input type="checkbox" name="check_enabled2" value="true" checked disabled>
<input type="hidden" name="check_enabled" value="true">'
else
'<input type="checkbox" name="check_enabled" value="true">'
end}(ɸ)</input>
</p>
#{"<p>ʤΥ֥饦ФReferer()ޤ
ڡФ줿Ȥǧ뤳Ȥǡ
ڡɤޤʥڡФ硢
ꥯȤݤޤ
̤Ǥϡ̵ˤ뤳ȤϽޤ</p>
" unless @conf.mobile_agent?}
<h4>RefererФʤ֥饦</h4>
<p><input type="radio" name="check_referer" value="true" #{if [1,3].include?(csrf_protection_method) then " checked" end}>(ɸ)</input>
<input type="radio" name="check_referer" value="false" #{if [0,2].include?(csrf_protection_method) then " checked" end}>ʤ</input>
</p>
#{"<p>֥饦RefererƤʤäưꤷޤ</p>
<p>ɸǤϡRefererФʤ硢ʥꥯȤ
Ƚ̤Ǥʤᡢߡѹݤޤ
ʤΥ֥饦RefererФʤξ硢
꤬֤פˤʤäƤȡνݤƤޤޤ
֥饦ѹRefererФ褦ˤƤ
ɤƤRefererФ˽ʤ硢֤ʤפˤƤ
ξ硢RefererФʤäˤ⡢
ߡѹ褦ˤʤޤ
CSRFˤ빶ȶ̤ǤʤʤޤΤǡɬΡCSRFɻߥפ
ʻѤƲ</p>
</div>
" unless @conf.mobile_agent?}
<div class="section">
<h3 class="subtitle">CSRFɻߥˤɱ</h3>
<h4>CSRFɻߥθ</h4>
<p><input type="radio" name="check_key" value="true" #{if [2,3].include?(csrf_protection_method) then " checked" end}></input>
<input type="radio" name="check_key" value="false" #{if [0,1].include?(csrf_protection_method) then " checked" end}>ʤ(ɸ)</input>
</p>
#{"<p>ߥե˵ɻߤΤΥꤷCSRFɤޤ
ڡ̩ΥΤʤ¤ꡢ
ν뤳ȤǤʤʤޤ
θ֤פꤹ硢θꤷƲ
ξ֤ʤפˤ뤳ȤϤǤޤ</p>
<p>֤פˤ硢εбƤʤ
ץ饰ưʤʤ뤳Ȥޤ</p>
" unless @conf.mobile_agent?}
<h4>CSRF ɻߥ</h4>
<p><input type="text" name="key" value="#{CGI::escapeHTML csrf_protection_key}" size="30"></p>
#{"<p>ɻߥꤷޤ¬ˤŬʸꤷƲ
θ˱̤ȡCSRFǽޤ
¾ΥѥɤȶѤϤƤϤޤʤꤷʸʤФƤɬפϤޤ</p>" unless @conf.mobile_agent?}
#{"<p class=\"message\">:
ʤΥ֥饦ϸRefererФƤʤ褦Ǥ
<a href=\"#{@conf.update}?conf=csrf_protection\">Υ⤦
ΥڡƤߤƲ</a>
Ǥ⤳ΥåФǤϡѤ硢
ŪRefererФˤ뤫
ľtdiary.confԽƲ</p>
</div>" if [1,3].include?(csrf_protection_method) && ! @cgi.referer && !@cgi.valid?('referer_exists')}
HTML
end
|