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
|
#
# zh/00default.rb: Traditional-Chinese 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 << '(Append)'
when 'edit'
r << '(Edit)'
when 'preview'
r << '(Preview)'
when 'showcomment'
r << '(TSUKKOMI Status Change Completed)'
when 'conf'
r << '(Preferences)'
when 'saveconf'
r << '(Preferences Changed)'
when 'nyear'
years = @diaries.keys.map {|ymd| ymd.sub(/^\d{4}/, "")}
r << "(#{years[0].sub( /^(\d\d)/, '\1-')}[#{nyear_diary_label @date, years}])" if @date
end
r << '</title>'
end
#
# labels
#
def no_diary; "#{@date.strftime( @conf.date_format )} oѨSox"; end
def comment_today; "jT"; end
def comment_total( total ); "(`@: #{total} h)"; end
def comment_new; 'ojT'; end
def comment_description; 'woz糧媺jTAzg email }uxDHiHݨC'; end
def comment_description_short; 'ojT!!'; end
def comment_name_label; 'mW'; end
def comment_name_label_short; 'mW'; end
def comment_mail_label; 'qll'; end
def comment_mail_label_short; 'l'; end
def comment_body_label; 'jT'; end
def comment_body_label_short; 'jT'; end
def comment_submit_label; 'o'; end
def comment_submit_label_short; 'o'; end
def comment_date( time ); time.strftime( "(#{@date_format} %H:%M)" ); end
def referer_today; "嵲"; end
def trackback_today; "ޥ"; end
def trackback_total( total ); "(`@: #{total} h)"; end
def navi_index; ''; end
def navi_latest; '̷sx'; end
def navi_oldest; '¤x'; end
def navi_update; "sW"; end
def navi_edit; "s"; end
def navi_preference; "ﶵ]w"; end
def navi_prev_diary(date); "e@hx (#{date.strftime(@date_format)})"; end
def navi_next_diary(date); "U@hx (#{date.strftime(@date_format)})"; end
def navi_prev_nyear(date); "h~x (#{date.strftime('%m-%d')})"; end
def navi_next_nyear(date); "~x (#{date.strftime('%m-%d')})"; end
def submit_label
if @mode == 'form' or @cgi.valid?( 'appendpreview' ) then
'sW' #'Append'
else
'' #'Replace'
end
end
def preview_label; 'w'; end #'Preview'
def label_no_referer; "oOѥCX嵲C"; end
def label_referer_table; "Today's Link Conversion Rule"; end
def nyear_diary_label(date, years); "鱡h"; end
def nyear_diary_title(date, years); "Lhɦ"; end
#
# labels (for mobile)
#
def mobile_navi_latest; 'Latest'; end
def mobile_navi_update; 'Update'; end
def mobile_navi_preference; 'Prefs'; end
def mobile_navi_prev_diary; 'Prev'; end
def mobile_navi_next_diary; 'Next'; end
def mobile_label_hidden_diary; 'This day is HIDDEN.'; end
#
# category
#
def category_anchor(c); "[#{c}]"; end
#
# preferences
#
# basic (default)
add_conf_proc( 'default', ']w' ) do
saveconf_default
<<-HTML
<h3 class="subtitle">@</h3>
#{"<p>WzjWaI쪺ȱN|Φb HTML Y(header)̡C</p>" unless @conf.mobile_agent?}
<p><input name="author_name" value="#{CGI::escapeHTML @conf.author_name}" size="40"></p>
<h3 class="subtitle">qll</h3>
#{"<p>Jzqll}A쪺ȱNΦb HTML Y(header)̡C</p>" unless @conf.mobile_agent?}
<p><input name="author_mail" value="#{@conf.author_mail}" size="40"></p>
<h3 class="subtitle">z() URL</h3>
#{"<p>Yzۤv}AiHbUC</p>" unless @conf.mobile_agent?}
<p><input name="index_page" value="#{@conf.index_page}" size="50"></p>
<h3 class="subtitle">ɶtվ</h3>
#{"<p>YOzsFxAziHzL(쬰p)Ӱ۰ʽվɶtCҦpAzYQnwbMIҵoxQOQѪxAzNiHbo̶J -2CtDiary |ѦҦƭȨӧPwogxoC </p>" unless @conf.mobile_agent?}
<p><input name="hour_offset" value="#{@conf.hour_offset}" size="5"></p>
HTML
end
# header/footer (header)
add_conf_proc( 'header', 'ܻP}' ) do
saveconf_header
<<-HTML
<h3 class="subtitle">jD</h3>
#{"<p>oOzxjDAzJȷ|Φb HTML <title> طCSO`NAФŨϥ HTML (tags)C </p>" unless @conf.mobile_agent?}
<p><input name="html_title" value="#{ CGI::escapeHTML @conf.html_title }" size="50"></p>
<h3 class="subtitle"></h3>
#{"<p>oqrN|\mbCӭݡAziHϥ HTML ykCOФŲ \"<%=navi%>\"ҡA]N]t\"s\"(Update)\\sbuCvA \"<%=calendar%>\" ҥNCBz]iHۥѷft䥦 pluginC </p>" unless @conf.mobile_agent?}
<p><textarea name="header" cols="70" rows="10">#{ CGI::escapeHTML @conf.header }</textarea></p>
<h3 class="subtitle">}</h3>
#{"<p>oqrFmOmݥH~AlpPܡC </p>" unless @conf.mobile_agent?}
<p><textarea name="footer" cols="70" rows="10">#{ CGI::escapeHTML @conf.footer }</textarea></p>
HTML
end
# diaplay
add_conf_proc( 'display', '' ) do
saveconf_display
<<-HTML
<h3 class="subtitle">qI(anchor)NO</h3>
#{"<p>\"I\" Nqb䥦iHPzx۳sCqI|QmCӬq}YBAziHw \"<span class=\"sanchor\">_</span>\"AӹϧΤILA|ѧGDD]pӨMwC </p>" unless @conf.mobile_agent?}
<p><input name="section_anchor" value="#{ CGI::escapeHTML @conf.section_anchor }" size="40"></p>
<h3 class="subtitle">jTI(anchor)NO</h3>
#{"<p>jTI|mChjT}YBAziHw \"<span class=\"canchor\">_</span>\"C</p>" unless @conf.mobile_agent?}
<p><input name="comment_anchor" value="#{ CGI::escapeHTML @conf.comment_anchor }" size="40"></p>
<h3 class="subtitle">榡</h3>
#{"<p>榡A@zwUCo % ŸftrAզXNiN榡Ap \"%Y\"(~), \"%m\"()\"%b\"(²uܪk), \"%B\"(ܪk), \"%d\"(), \"%a\"(P²uܪk), \"%A\"(Pܪk)C</p>" unless @conf.mobile_agent?}
<p><input name="date_format" value="#{ CGI::escapeHTML @conf.date_format }" size="30"></p>
<h3 class="subtitle">u̷sxv̦hnqXXѥH</h3>
#{"<p>bu̷sxvAznܦh֤ѥxH </p>" unless @conf.mobile_agent?}
<p><input name="latest_limit" value="#{@conf.latest_limit}" size="2"> ѥ</p>
<h3 class="subtitle">鱡h</h4>
#{"<p>O_nqX \"鱡h\" (PP骺Lhx)H</p>" unless @conf.mobile_agent?}
<p><select name="show_nyear">
<option value="true"#{if @conf.show_nyear then " selected" end}>qI</option>
<option value="false"#{if not @conf.show_nyear then " selected" end}></option>
</select></p>
HTML
end
# themes
@theme_location_comment = "<p>ziHb <a href=\"http://www.tdiary.org/20021001.html\">Theme Gallery</a>(饻y) ohGDDI</p>"
add_conf_proc( 'theme', 'GDD' ) do
saveconf_theme
r = <<-HTML
<h3 class="subtitle">GDD</h3>
#{"<p>ܱzxQnGDDμ˦(CSS)ApGzܤF \"CSS specify\"AЦbk(U)̿J CSS Ҧb}C </p>" unless @conf.mobile_agent?}
<p>
<select name="theme">
<option value="">CSS Specify-></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
# comments
add_conf_proc( 'comment', 'jT' ) do
saveconf_comment
<<-HTML
<h3 class="subtitle">O_nqXjTH</h3>
#{"<p>nnqXṶ̵̄zjTH </p>" unless @conf.mobile_agent?}
<p><select name="show_comment">
<option value="true"#{if @conf.show_comment then " selected" end}>n</option>
<option value="false"#{if not @conf.show_comment then " selected" end}>n</option>
</select></p>
<h3 class="subtitle">nqXXgjTH</h3>
#{"<p>bu̷sxvΡuYxvҥܤUAzQnqXhֽgijTH ۹ӻAbugvҥܤUAҦjT|qXӡC </p>" unless @conf.mobile_agent?}
<p>qX <input name="comment_limit" value="#{ @conf.comment_limit }" size="3"> gjT</p>
HTML
end
# referer
add_conf_proc( 'referer', "嵲" ) do
saveconf_referer
<<-HTML
<h3 class="subtitle">O_qX嵲</h3>
#{"<p>ziHܬO_nqXu嵲vC </p>" unless @conf.mobile_agent?}
<p><select name="show_referer">
<option value="true"#{if @conf.show_referer then " selected" end}>n</option>
<option value="false"#{if not @conf.show_referer then " selected" end}>n</option>
</select></p>
<h3 class="subtitle">nqXh嵲</h3>
#{"<p>bu̷sxvΡuYxvҥܤUAzQnqXh֭ӥi嵲H ۹ӻAbugvҥܤUAҦ嵲jT|qXӡC </p>" unless @conf.mobile_agent?}
<p>qX <input name="referer_limit" value="#{@conf.referer_limit}" size="3"> 嵲</p>
<h3 class="subtitle">嵲OsҦ</h3>
#{"<p>ܦbgҥܤ嵲OsҦAoӿﶵγBb֡uLΪѷӡvC </p>" unless @conf.mobile_agent?}
<p><select name="referer_day_only">
<option value="true"#{if @conf.referer_day_only then " selected" end}>uNgҥܤ嵲s_</option>
<option value="false"#{if not @conf.referer_day_only then " selected" end}>NҦi嵲s_</option>
</select></p>
<h3 class="subtitle">uCJ嵲vC</h3>
#{"<p>bu嵲v̤nO_Ӫ嵲CХH regular expression Φ@@wCӤQO}C </p>" unless @conf.mobile_agent?}
<p>Ь<a href="#{@conf.update}?referer=no" target="referer">w]]w</a>C</p>
<p><textarea name="no_referer" cols="70" rows="10">#{@conf.no_referer2.join( "\n" )}</textarea></p>
<h3 class="subtitle">}rഫWh</h3>
#{"<p>Nu嵲vSw}ഫNqrAХH regular expression Φ@@wCӭnrഫ}C <p>" unless @conf.mobile_agent?}
<p>Ь<a href="#{@conf.update}?referer=table" target="referer">w]]w</a>.</p>
<p><textarea name="referer_table" cols="70" rows="10">#{@conf.referer_table2.collect{|a|a.join( " " )}.join( "\n" )}</textarea></p>
HTML
end
# comment mail
def comment_mail_mime( str )
[str.dup]
end
def comment_mail_conf_label; 'HHqzjT'; 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">O_QΫHqjTH</h3>
#{"<p>пܦbsjTɭnnHqllqzCаOoo\\ݭnzb tdiary.conf ]w SMTP AC</p>" unless @conf.mobile_agent?}
<p><select name="comment_mail.enable">
<option value="true"#{if @conf['comment_mail.enable'] then " selected" end}>Хζlq</option>
<option value="false"#{if not @conf['comment_mail.enable'] then " selected" end}>ΤF</option>
</select></p>
<h3 class="subtitle">}</h3>
#{"<p>ЫwnjTqqll}A@g@Ӧ}CpGǫSt~wAhqHN|Hzqll}C</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">HD</h3>
#{"<p>w@ӷ|\bqHuHDv}YBrCHD|O \"zwr:DATE-SERIAL NAME\" ˦C \"date\" OzxoAOpGztwF˦ADh|ܬ \"zwr-SERIAL NAME\" (ex: \"hoge:%Y-%m-%d\")</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/en/?#{@conf.style}Style">g</a>|
end
add_conf_proc( 'csrf_protection', 'CSRF Protection' ) do
err = saveconf_csrf_protection
errstr = ''
case err
when :param
errstr = '<p class="message">Invalid options specified. Configuration not saved.</p>'
when :key
errstr = '<p class="message">No key specified. Configuration not saved.</p>'
end
csrf_protection_method = @conf.options['csrf_protection_method'] || 1
csrf_protection_key = @conf.options['csrf_protection_key'] || ''
<<-HTML
#{errstr}
<p>This page configures a protection scheme to prevent "cross-site request forgery" (CSRF) attacks.</p>
<p>To make CSRF attack, a malicious person prepares a trap link in some web page and lets you visit that page.
When the trap link is invoked (either by Javascript or your mouse click), <i>your</i> web browser sends a forged request to tDiary.
Thus, neither encryption nor usual password protection can serve as a protection mechanism.
TDiary provies two methods -- "checking referer" and "checking CSRF key" -- to prevent such attacks.</p>
<div class="section">
<h3 class="subtitle">Checking Referer</h3>
<h4 class="subtitle">Checks for Referer values</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}Enabled (default)</input>
</p>
#{"<p>Configures Referer-based CSRF protection.
TDiary checks the Referer value sent from your web browser. If the post request comes from some outer page,
the request will be rejected. This setting can't be disabled through web-based configuration, for safety reasons.</p>
" unless @conf.mobile_agent?}
<h3 class="subtitle">Handling of Referer-disabled browsers</h3>
<p><input type="radio" name="check_referer" value="true" #{if [1,3].include?(csrf_protection_method) then " checked" end}>Reject (default)</input>
<input type="radio" name="check_referer" value="false" #{if [0,2].include?(csrf_protection_method) then " checked" end}>Accept</input>
</p>
#{"<p>Configures handling for requests without any Referer: value.
By default tDiary rejects such request for safety reasons.
If your browser is configured not to send Referer values, alter that setting to allow sending Referer, at least for
originating sites. If it is impossible, configure the key-based CSRF protection below, and
change this setting to \"Accept\".</p>
" unless @conf.mobile_agent?}
</div>
<div class="section">
<h3 class="subtitle">Checking CSRF key</h3>
<h4>Checks for CSRF protection key</h4>
<p><input type="radio" name="check_key" value="true" #{if [2,3].include?(csrf_protection_method) then " checked" end}>Enabled</input>
<input type="radio" name="check_key" value="false" #{if [0,1].include?(csrf_protection_method) then " checked" end}>Disabled (default)</input>
</p>
#{"<p>TDiary can add a secret key for every post form to prevent CSRF. As long as attackers do not know the secret key,
forged requests will not be granted. To enable this feature, you must specify the secret key below.
To allow Referer-disabled browsers, you must enable this setting.</p>" unless @conf.mobile_agent?}
<h4>CSRF protection key</h4>
<p><input type="text" name="key" value="#{CGI::escapeHTML csrf_protection_key}" size="20"></p>
#{"<p>A secret key used for key-based CSRF protection. Specify a secret string which is not easy to guess.
If this key is leaked, CSRF attacks can be exploited.
Do not use any passwords used in other places. You need not to remember this phrase to type in.</p>" unless @conf.mobile_agent?}
#{"<p class=\"message\">Caution:
Your browser seems not to be sending any Referers, although Referer-based protection is enabled.
<a href=\"#{@conf.update}?conf=csrf_protection\">Please open this page again via this link</a>.
If you see this message again, you must either change your browser setting (temporarily to change these settings, at least),
or edit \"tdiary.conf\" directly.</p>" if [1,3].include?(csrf_protection_method) && ! @cgi.referer && !@cgi.valid?('referer_exists')}
</div>
HTML
end
|