From: TADA T. <nul...@cl...> - 2015-08-26 06:08:51
|
TADA Tadashi 2015-08-26 15:03:31 +0900 (Wed, 26 Aug 2015) New Revision: 405e36bbe74649674d3bbc4313b548add340f28f https://github.com/tdiary/tdiary-core/commit/405e36bbe74649674d3bbc4313b548add340f28f Message: remove code to depended mobile agent * mobile_agent? returns false always * remove code to switched by mobile_agent? * delete view/i.*.rhtml Removed files: views/i.category.rhtml views/i.conf.rhtml views/i.day.rhtml views/i.diary.rhtml views/i.footer.rhtml views/i.header.rhtml views/i.latest.rhtml views/i.month.rhtml views/i.search.rhtml views/i.update.rhtml views/i.update.rhtml.en Modified files: Gemfile.lock lib/tdiary/admin.rb lib/tdiary/configuration.rb lib/tdiary/core_ext.rb lib/tdiary/dispatcher/index_main.rb lib/tdiary/dispatcher/update_main.rb lib/tdiary/plugin/00default.rb lib/tdiary/plugin/en/00default.rb lib/tdiary/plugin/en/05referer.rb lib/tdiary/plugin/ja/00default.rb lib/tdiary/plugin/ja/05referer.rb lib/tdiary/view.rb misc/plugin/category.rb misc/plugin/category_autocomplete.rb misc/plugin/comment_emoji_autocomplete.rb misc/plugin/edit_today.rb misc/plugin/en/pb-show.rb misc/plugin/en/tb-show.rb misc/plugin/hide-mail-field.rb misc/plugin/ja/pb-show.rb misc/plugin/ja/tb-show.rb misc/plugin/my-ex.rb misc/plugin/my-sequel.rb misc/plugin/pb-show.rb misc/plugin/random_google.rb misc/plugin/speed_comment.rb misc/plugin/tb-show.rb misc/plugin/weather.rb spec/plugin/plugin_helper.rb Modified: Gemfile.lock (+8 -1) =================================================================== --- Gemfile.lock 2015-08-23 10:37:39 +0900 (58ae22b) +++ Gemfile.lock 2015-08-26 15:03:31 +0900 (cea1079) @@ -24,10 +24,12 @@ GEM simplecov (~> 0.9.1) term-ansicolor (~> 1.3) thor (~> 0.19.1) + daemons (1.2.2) diff-lcs (1.2.5) docile (1.1.5) domain_name (0.5.24) unf (>= 0.0.5, < 1.0.0) + eventmachine (1.0.7) execjs (2.5.2) fastimage (1.7.0) addressable (~> 2.3, >= 2.3.5) @@ -113,6 +115,10 @@ GEM therubyracer (0.12.2) libv8 (~> 3.16.14.0) ref + thin (1.6.3) + daemons (~> 1.0, >= 1.0.9) + eventmachine (~> 1.0) + rack (~> 1.0) thor (0.19.1) tins (1.5.4) unf (0.1.4) @@ -149,6 +155,7 @@ DEPENDENCIES sqlite3 test-unit therubyracer + thin BUNDLED WITH - 1.10.5 + 1.10.6 Modified: lib/tdiary/admin.rb (+0 -8) =================================================================== --- lib/tdiary/admin.rb 2015-08-23 10:37:39 +0900 (ff18aa6) +++ lib/tdiary/admin.rb 2015-08-26 15:03:31 +0900 (bfe4a69) @@ -73,10 +73,6 @@ module TDiary @title = @cgi.params['title'][0] @body = @cgi.params['body'][0] - if @cgi.mobile_agent? - @title.force_encoding(@conf.mobile_encoding) - @body.force_encoding(@conf.mobile_encoding) - end @title = @conf.to_native( @title ) @body = @conf.to_native( @body ) @old_date = @cgi.params['old'][0] @@ -113,10 +109,6 @@ module TDiary def initialize( cgi, rhtml, conf ) @title = cgi.params['title'][0] @body = cgi.params['body'][0] - if cgi.mobile_agent? - @title.force_encoding(conf.mobile_encoding) - @body.force_encoding(conf.mobile_encoding) - end @title = conf.to_native( @title ) @body = conf.to_native( @body ) @hide = cgi.params['hide'][0] == 'true' ? true : false Modified: lib/tdiary/configuration.rb (+2 -2) =================================================================== --- lib/tdiary/configuration.rb 2015-08-23 10:37:39 +0900 (0440678) +++ lib/tdiary/configuration.rb 2015-08-26 15:03:31 +0900 (700e987) @@ -40,9 +40,9 @@ module TDiary @options2.delete( key ) end - # backword compatibility, you can use @cgi.mobile_agent? + # backword compatibility, returns NOT mobile phone always def mobile_agent? - @request.mobile_agent? + false end # backword compatibility, you can use @cgi.smartphone? Modified: lib/tdiary/core_ext.rb (+2 -1) =================================================================== --- lib/tdiary/core_ext.rb 2015-08-23 10:37:39 +0900 (2e40309) +++ lib/tdiary/core_ext.rb 2015-08-26 15:03:31 +0900 (59d4aff) @@ -4,8 +4,9 @@ require 'gemoji' module TDiary module RequestExtension + # backword compatibility, returns NOT mobile phone always def mobile_agent? - self.user_agent =~ %r[(DoCoMo|J-PHONE|Vodafone|MOT-|UP\.Browser|DDIPOCKET|ASTEL|PDXGW|Palmscape|Xiino|sharp pda browser|Windows CE|L-mode|WILLCOM|SoftBank|Semulator|Vemulator|J-EMULATOR|emobile|mixi-mobile-converter)]i + false end def smartphone? Modified: lib/tdiary/dispatcher/index_main.rb (+10 -16) =================================================================== --- lib/tdiary/dispatcher/index_main.rb 2015-08-23 10:37:39 +0900 (557d4ea) +++ lib/tdiary/dispatcher/index_main.rb 2015-08-26 15:03:31 +0900 (2351ee3) @@ -34,24 +34,18 @@ module TDiary head['Cache-Control'] = 'no-cache' return TDiary::Response.new( '', 200, head ) else - if request.mobile_agent? - body = conf.to_mobile( tdiary.eval_rhtml( 'i.' ) ) - head['charset'] = conf.mobile_encoding - head['Content-Length'] = body.bytesize.to_s + require 'digest/md5' + body = tdiary.eval_rhtml + head['ETag'] = %Q["#{Digest::MD5.hexdigest( body )}"] + if ENV['HTTP_IF_NONE_MATCH'] == head['ETag'] and request.get? then + head['status'] = CGI::HTTP_STATUS['NOT_MODIFIED'] else - require 'digest/md5' - body = tdiary.eval_rhtml - head['ETag'] = %Q["#{Digest::MD5.hexdigest( body )}"] - if ENV['HTTP_IF_NONE_MATCH'] == head['ETag'] and request.get? then - head['status'] = CGI::HTTP_STATUS['NOT_MODIFIED'] - else - head['charset'] = conf.encoding - head['Content-Length'] = body.bytesize.to_s - end - head['Pragma'] = 'no-cache' - head['Cache-Control'] = 'no-cache' - head['X-Frame-Options'] = conf.x_frame_options if conf.x_frame_options + head['charset'] = conf.encoding + head['Content-Length'] = body.bytesize.to_s end + head['Pragma'] = 'no-cache' + head['Cache-Control'] = 'no-cache' + head['X-Frame-Options'] = conf.x_frame_options if conf.x_frame_options head['cookie'] = tdiary.cookies if tdiary.cookies.size > 0 TDiary::Response.new( body, ::TDiary::Dispatcher.extract_status_for_legacy_tdiary( head ), head ) end Modified: lib/tdiary/dispatcher/update_main.rb (+8 -18) =================================================================== --- lib/tdiary/dispatcher/update_main.rb 2015-08-23 10:37:39 +0900 (a8886d0) +++ lib/tdiary/dispatcher/update_main.rb 2015-08-26 15:03:31 +0900 (723e832) @@ -19,24 +19,14 @@ module TDiary @tdiary = create_tdiary begin head = {}; body = '' - if request.mobile_agent? - body = conf.to_mobile( tdiary.eval_rhtml( 'i.' ) ) - head = { - 'Content-Type' => 'text/html', - 'charset' => conf.mobile_encoding, - 'Content-Length' => body.bytesize.to_s, - 'Vary' => 'User-Agent' - } - else - body = tdiary.eval_rhtml - head = { - 'Content-Type' => 'text/html', - 'charset' => conf.encoding, - 'Content-Length' => body.bytesize.to_s, - 'Vary' => 'User-Agent', - 'X-Frame-Options' => 'SAMEORIGIN' - } - end + body = tdiary.eval_rhtml + head = { + 'Content-Type' => 'text/html', + 'charset' => conf.encoding, + 'Content-Length' => body.bytesize.to_s, + 'Vary' => 'User-Agent', + 'X-Frame-Options' => 'SAMEORIGIN' + } body = ( request.head? ? '' : body ) TDiary::Response.new( body, 200, head ) rescue TDiary::ForceRedirect Modified: lib/tdiary/plugin/00default.rb (+12 -21) =================================================================== --- lib/tdiary/plugin/00default.rb 2015-08-23 10:37:39 +0900 (089799d) +++ lib/tdiary/plugin/00default.rb 2015-08-26 15:03:31 +0900 (dde9227) @@ -224,7 +224,7 @@ add_header_proc do end def calc_links - if /day|edit/ =~ @mode or (@cgi.mobile_agent? and /latest|month|nyear/ =~ @mode) then + if /day|edit/ =~ @mode then today = @date.strftime('%Y%m%d') days = [] yms = [] @@ -261,11 +261,7 @@ def calc_links end def charset - if @cgi.mobile_agent? then - @conf.mobile_encoding - else - @conf.encoding - end + @conf.encoding end def last_modified_header @@ -468,7 +464,7 @@ add_title_proc do |date, title| end def nyear_link( date, title ) - if @conf.show_nyear and @mode != 'nyear' and !@cgi.mobile_agent? then + if @conf.show_nyear and @mode != 'nyear' then m = date.strftime( '%m' ) d = date.strftime( '%d' ) years = @years.find_all {|year, months| months.include? m} @@ -525,20 +521,15 @@ end def subtitle_link( date, index, subtitle ) r = '' - if @cgi.mobile_agent? then - r << %Q[<A NAME="p#{'%02d' % index}">*</A> ] - r << %Q|(#{h @author})| if @multi_user and @author and subtitle - else - if date then - r << "<a " - r << %Q[name="p#{'%02d' % index}" ] if @anchor_name - param = "#{date.strftime( '%Y%m%d' )}#p#{'%02d' % index}" - titleattr = (not subtitle or subtitle.empty?) ? '' : %Q[ title="#{remove_tag( apply_plugin( subtitle )).gsub( /"/, """ )}"] - r << %Q[href="#{h @conf.index}#{anchor param}"#{titleattr}>#{@conf.section_anchor}</a> ] - end - - r << %Q[(#{h @author}) ] if @multi_user and @author and subtitle + if date then + r << "<a " + r << %Q[name="p#{'%02d' % index}" ] if @anchor_name + param = "#{date.strftime( '%Y%m%d' )}#p#{'%02d' % index}" + titleattr = (not subtitle or subtitle.empty?) ? '' : %Q[ title="#{remove_tag( apply_plugin( subtitle )).gsub( /"/, """ )}"] + r << %Q[href="#{h @conf.index}#{anchor param}"#{titleattr}>#{@conf.section_anchor}</a> ] end + + r << %Q[(#{h @author}) ] if @multi_user and @author and subtitle r << make_category_link( subtitle ) end @@ -843,7 +834,7 @@ def conf_theme_list <input name="css" size="30" value="#{h @conf.css}"> </p> <p><img id="theme_thumbnail" src="http://www.tdiary.org/theme.image/#{img}.jpg" alt="#{@theme_thumbnail_label}"></p> - #{@theme_location_comment unless @cgi.mobile_agent?} + #{@theme_location_comment} HTML end Modified: lib/tdiary/plugin/en/00default.rb (+30 -32) =================================================================== --- lib/tdiary/plugin/en/00default.rb 2015-08-23 10:37:39 +0900 (f43dd06) +++ lib/tdiary/plugin/en/00default.rb 2015-08-26 15:03:31 +0900 (0e8dac4) @@ -130,40 +130,40 @@ add_conf_proc( 'default', 'Site information', 'basic' ) do @conf.banner ||= '' <<-HTML <h3 class="subtitle">Title</h3> - #{"<p>The title of your diary. This value is used in HTML <title> element and in mobile mode. Do not use HTML tags.</p>" unless @cgi.mobile_agent?} + <p>The title of your diary. This value is used in HTML <title> element. Do not use HTML tags.</p> <p><input name="html_title" value="#{h @conf.html_title}" size="50"></p> <h3 class="subtitle">Author</h3> - #{"<p>Specify your name. This value is into HTML header.</p>" unless @cgi.mobile_agent?} + <p>Specify your name. This value is into HTML header.</p> <p><input name="author_name" value="#{h @conf.author_name}" size="40"></p> <h3 class="subtitle">E-mail address</h3> - #{"<p>Specify your E-mail address. This value is into HTML header.</p>" unless @cgi.mobile_agent?} + <p>Specify your E-mail address. This value is into HTML header.</p> <p><input name="author_mail" value="#{h @conf.author_mail}" size="40"></p> <h3 class="subtitle">URL of index page</h3> - #{"<p>The URL of index of your website if you have.</p>" unless @cgi.mobile_agent?} + <p>The URL of index of your website if you have.</p> <p><input name="index_page" value="#{h @conf.index_page}" size="50"></p> <h3 class="subtitle">URL of Your Diary</h3> - #{"<p>Specify your diary's URL. This URL is used by some plugins for indicate your diary</p>" unless @cgi.mobile_agent?} + <p>Specify your diary's URL. This URL is used by some plugins for indicate your diary</p> #{"<p><strong>NOTICE!! The URL specified below is different from current URL of accessed now.</strong></p>" unless base_url == @cgi.base_url} <p><input name="base_url" value="#{h base_url}" size="70"></p> <h3 class="subtitle">Description</h3> - #{"<p>A brief description of your diary. Can be left blank.</p>" unless @cgi.mobile_agent?} + <p>A brief description of your diary. Can be left blank.</p> <p><input name="description" value="#{h @conf.description}" size="60"></p> <h3 class="subtitle">Site icon (favicon)</h3> - #{"<p>URL for the small icon (aka 'favicon') of your site. Can be left blank.</p>" unless @cgi.mobile_agent?} + <p>URL for the small icon (aka 'favicon') of your site. Can be left blank.</p> <p><input name="icon" value="#{h @conf.icon}" size="60"></p> <h3 class="subtitle">Site banner</h3> - #{"<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?} + <p>URL for the banner image of your site. makerss plugin will use this value to make RSS. Can be left blank.</p> <p><input name="banner" value="#{h @conf.banner}" size="60"></p> <h3 class="subtitle">Permit display in Frames</h3> - #{"<p>Permit display your diary included by frames.</p>" unless @cgi.mobile_agent?} + <p>Permit display your diary included by frames.</p> <p><select name="x_frame_options"> <option value=""#{" selected" unless @conf.x_frame_options}>Permit</option> <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 <<-HTML <h3 class="subtitle">Header</h3> - #{"<p>This text is inserted into top of each pages. You can use HTML tags. Do not remove \"<%=navi%>\", because it mean Navigation bar inclued \"Update\" button. And \"<%=calendar%>\" mean calendar. So you can specify other plugins also.</p>" unless @cgi.mobile_agent?} + <p>This text is inserted into top of each pages. You can use HTML tags. Do not remove "<%=navi%>", because it mean Navigation bar inclued "Update" button. And "<%=calendar%>" mean calendar. So you can specify other plugins also.</p> <p><textarea name="header" cols="60" rows="10">#{h @conf.header}</textarea></p> <h3 class="subtitle">Footer</h3> - #{"<p>This text is inserted into bottom of each pages. You can specify as same as Header.</p>" unless @cgi.mobile_agent?} + <p>This text is inserted into bottom of each pages. You can specify as same as Header.</p> <p><textarea name="footer" cols="60" rows="10">#{h @conf.footer}</textarea></p> HTML end @@ -192,19 +192,19 @@ add_conf_proc( 'display', 'Display', 'basic' ) do <<-HTML <h3 class="subtitle">Section anchor</h3> - #{"<p>\"Anchor\" guide to link from other website. Section anchors are insertd into begining of each section. So if you specify \"<span class=\"sanchor\">_</span>\", image anchor will be shown Image anchor by themes.</p>" unless @cgi.mobile_agent?} + <p>"Anchor" guide to link from other website. Section anchors are insertd into begining of each section. So if you specify "<span class="sanchor">_</span>", image anchor will be shown Image anchor by themes.</p> <p><input name="section_anchor" value="#{h @conf.section_anchor}" size="40"></p> <h3 class="subtitle">TSUKKOMI anchor</h3> - #{"<p>TSUKKOMI anchor is inserted into begining of each TSUKKOMIs. So You can specify \"<span class=\"canchor\">_</span>\" for Image anchor.</p>" unless @cgi.mobile_agent?} + <p>TSUKKOMI anchor is inserted into begining of each TSUKKOMIs. So You can specify "<span class="canchor">_</span>" for Image anchor.</p> <p><input name="comment_anchor" value="#{h @conf.comment_anchor}" size="40"></p> <h3 class="subtitle">Date format</h3> - #{"<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?} + <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> <p><input name="date_format" value="#{h @conf.date_format}" size="30"></p> <h3 class="subtitle">Max dates of Latest diaplay</h3> - #{"<p>In the Latest mode, you can specify the number of days in the page.</p>" unless @cgi.mobile_agent?} + <p>In the Latest mode, you can specify the number of days in the page.</p> <p><input name="latest_limit" value="#{h @conf.latest_limit}" size="2"> days in a page.</p> <h3 class="subtitle">My old days</h3> - #{"<p>Show the link of \"My old days\"</p>" unless @cgi.mobile_agent?} + <p>Show the link of "My old days"</p> <p><select name="show_nyear"> <option value="true"#{" selected" if @conf.show_nyear}>Show</option> <option value="false"#{" selected" unless @conf.show_nyear}>Hide</option> @@ -217,7 +217,7 @@ add_conf_proc( 'timezone', 'Time difference adjustment', 'update' ) do saveconf_timezone <<-HTML <h3 class="subtitle">Time difference adjustment</h3> - #{"<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?} + <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> <p><input name="hour_offset" value="#{h @conf.hour_offset}" size="5"></p> HTML end @@ -231,7 +231,7 @@ add_conf_proc( 'theme', 'Themes', 'theme' ) do r = <<-HTML <h3 class="subtitle">Theme</h3> - #{"<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?} + <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> <p> <select name="theme" id="theme_selection"> <option value="">CSS Specify-></option> @@ -245,16 +245,16 @@ add_conf_proc( 'comment', 'TSUKKOMI', 'tsukkomi' ) do <<-HTML <h3 class="subtitle">Show TSUKKOMI</h3> - #{"<p>Select show or hide TSUKKOMI from readers</p>" unless @cgi.mobile_agent?} + <p>Select show or hide TSUKKOMI from readers</p> <p><select name="show_comment"> <option value="true"#{" selected" if @conf.show_comment}>Show</option> <option value="false"#{" selected" unless @conf.show_comment}>Hide</option> </select></p> <h3 class="subtitle">Number of TSUKKOMI</h3> - #{"<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?} + <p>In Latest or Month mode, you can specify number of visible TSUKKOMIs. So in Dayly mode, all of TSUKKOMIs are shown.</p> <p><input name="comment_limit" value="#{h @conf.comment_limit}" size="3"> TSUKKOMIs</p> <h3 class="subtitle">Limit of TSUKKOMI per a day</h3> - #{"<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?} + <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> <p><input name="comment_limit_per_day" value="#{h @conf.comment_limit_per_day}" size="3"> TSUKKOMIs</p> HTML end @@ -273,19 +273,19 @@ def comment_mail_basic_html <<-HTML <h3 class="subtitle">Notify TSUKKOMI by E-mail</h3> - #{"<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?} + <p>Select notify or not when your diary gets a new TSUKKOMI. So TSUKKOMI mail need SMTP server settings in tdiary.conf.</p> <p><select name="comment_mail.enable"> <option value="true"#{" selected" if @conf['comment_mail.enable']}>Send Mail</option> <option value="false"#{" selected" unless @conf['comment_mail.enable']}>Don't Send</option> </select></p> <h3 class="subtitle">Receivers</h3> - #{"<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?} + <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> <p><textarea name="comment_mail.receivers" cols="40" rows="3">#{h( @conf['comment_mail.receivers'].gsub( /[, ]+/, "\n") )}</textarea></p> <h3 class="subtitle">Mail header</h3> - #{"<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?} + <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> <p><input name="comment_mail.header" value="#{h @conf['comment_mail.header']}"></p> <h3 class="subtitle">About hidden TSUKKOMI</h3> - #{"<p>Some TSUKKOMI are hidden by filters. You can decide which sending E-mail by hidden TSUKKOMI.</p>" unless @cgi.mobile_agent?} + <p>Some TSUKKOMI are hidden by filters. You can decide which sending E-mail by hidden TSUKKOMI.</p> <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> HTML end @@ -317,20 +317,18 @@ add_conf_proc( 'csrf_protection', 'CSRF Protection', 'security' ) do '<input type="checkbox" name="check_enabled" value="true">' end}Enabled (default) </p> - #{"<p>Configures Referer-based CSRF protection. + <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 @cgi.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 type="radio" name="check_referer" value="false" #{if [0,2].include?(csrf_protection_method) then " checked" end}>Accept </p> - #{"<p>Configures handling for requests without any Referer: value. + <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 @cgi.mobile_agent?} + change this setting to "Accept".</p> </div> <div class="section"> <h3 class="subtitle">Checking CSRF key</h3> @@ -338,9 +336,9 @@ add_conf_proc( 'csrf_protection', 'CSRF Protection', 'security' ) do <p><input type="radio" name="check_key" value="true" #{if [2,3].include?(csrf_protection_method) then " checked" end}>Enabled <input type="radio" name="check_key" value="false" #{if [0,1].include?(csrf_protection_method) then " checked" end}>Disabled (default) </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, + <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, tDiary will generate a key automatically. - To allow Referer-disabled browsers, you must enable this setting.</p>" unless @cgi.mobile_agent?} + To allow Referer-disabled browsers, you must enable this setting.</p> #{"<p class=\"message\">Caution: Your browser seems not to be sending any Referers, although Referer-based protection is enabled. <a href=\"#{h @conf.update}?conf=csrf_protection\">Please open this page again via this link</a>. Modified: lib/tdiary/plugin/en/05referer.rb (+4 -4) =================================================================== --- lib/tdiary/plugin/en/05referer.rb 2015-08-23 10:37:39 +0900 (3062123) +++ lib/tdiary/plugin/en/05referer.rb 2015-08-26 15:03:31 +0900 (384f0cb) @@ -18,21 +18,21 @@ add_conf_proc( 'referer', "Today's Link", 'referer' ) do <<-HTML <h3 class="subtitle">Show links</h3> - #{"<p>Select show or hide about Today's Link</p>" unless @cgi.mobile_agent?} + <p>Select show or hide about Today's Link</p> <p><select name="show_referer"> <option value="true"#{" selected" if @conf.show_referer}>Show</option> <option value="false"#{" selected" unless @conf.show_referer}>Hide</option> </select></p> <h3 class="subtitle">#{label_no_referer}</h3> - #{"<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?} + <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> <p>See <a href="#{h @conf.update}?referer=no" target="referer">Default configuration is here</a>.</p> <p><textarea name="no_referer" cols="60" rows="10">#{h @conf.no_referer2.join( "\n" )}</textarea></p> <h3 class="subtitle">#{label_only_volatile}</h3> - #{"<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?} + <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> <p>See <a href="#{h @conf.update}?referer=volatile" target="referer">Default configuration is here</a>.</p> <p><textarea name="only_volatile" cols="60" rows="10">#{h @conf.only_volatile2.join( "\n" )}</textarea></p> <h3 class="subtitle">#{label_referer_table}</h3> - #{"<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?} + <p>A table to convert URL to words in Today's Link. Specify it in regular expression, and a URL into a line.<p> <p>See <a href="#{h @conf.update}?referer=table" target="referer">Default configurations</a>.</p> <p><textarea name="referer_table" cols="60" rows="10">#{h @conf.referer_table2.collect{|a|a.join( " " )}.join( "\n" )}</textarea></p> HTML Modified: lib/tdiary/plugin/ja/00default.rb (+28 -31) =================================================================== --- lib/tdiary/plugin/ja/00default.rb 2015-08-23 10:37:39 +0900 (acffbfc) +++ lib/tdiary/plugin/ja/00default.rb 2015-08-26 15:03:31 +0900 (061882d) @@ -53,19 +53,19 @@ def comment_mail_basic_html <<-HTML <h3 class="subtitle">ツッコミメールを送る</h3> - #{"<p>ツッコミがあった時に、メールを送るかどうかを選択します。</p>" unless @cgi.mobile_agent?} + <p>ツッコミがあった時に、メールを送るかどうかを選択します。</p> <p><select name="comment_mail.enable"> <option value="true"#{" selected" if @conf['comment_mail.enable']}>送る</option> <option value="false"#{" selected" unless @conf['comment_mail.enable']}>送らない</option> </select></p> <h3 class="subtitle">送付先</h3> - #{"<p>メールの送付先を指定します。1行に1メールアドレスの形で、複数指定可能です。指定のない場合には、あなたのメールアドレスに送られます。</p>" unless @cgi.mobile_agent?} + <p>メールの送付先を指定します。1行に1メールアドレスの形で、複数指定可能です。指定のない場合には、あなたのメールアドレスに送られます。</p> <p><textarea name="comment_mail.receivers" cols="40" rows="3">#{h( @conf['comment_mail.receivers'].gsub( /[, ]+/, "\n") )}</textarea></p> <h3 class="subtitle">メールヘッダ</h3> - #{"<p>メールのSubjectにつけるヘッダ文字列を指定します。振り分け等に便利なように指定します。実際のSubjectには「指定文字列:日付-1」のように、日付とコメント番号が付きます。ただし指定文字列中に、%に続く英字があった場合、それを日付フォーマット指定を見なします。つまり「日付」の部分は自動的に付加されなくなります(コメント番号は付加されます)。</p>" unless @cgi.mobile_agent?} + <p>メールのSubjectにつけるヘッダ文字列を指定します。振り分け等に便利なように指定します。実際のSubjectには「指定文字列:日付-1」のように、日付とコメント番号が付きます。ただし指定文字列中に、%に続く英字があった場合、それを日付フォーマット指定を見なします。つまり「日付」の部分は自動的に付加されなくなります(コメント番号は付加されます)。</p> <p><input name="comment_mail.header" value="#{h @conf['comment_mail.header']}"></p> <h3 class="subtitle">非表示ツッコミの扱い</h3> - #{"<p>フィルタの結果、最初から非表示にされたツッコミが記録されることがあります。この非表示のツッコミが来たときにもメールを発信するかどうかを選択します。</p>" unless @cgi.mobile_agent?} + <p>フィルタの結果、最初から非表示にされたツッコミが記録されることがあります。この非表示のツッコミが来たときにもメールを発信するかどうかを選択します。</p> <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> HTML end @@ -164,40 +164,40 @@ add_conf_proc( 'default', 'サイトの情報', 'basic' ) do @conf.banner ||= '' <<-HTML <h3 class="subtitle">タイトル</h3> - #{"<p>HTMLの<title>タグ中および、モバイル端末からの参照時に使われるタイトルです。HTMLタグは使えません。</p>" unless @cgi.mobile_agent?} + <p>HTMLの<title>タグ中および、モバイル端末からの参照時に使われるタイトルです。HTMLタグは使えません。</p> <p><input name="html_title" value="#{h @conf.html_title}" size="50"></p> <h3 class="subtitle">著者名</h3> - #{"<p>あなたの名前を指定します。HTMLヘッダ中に展開されます。</p>" unless @cgi.mobile_agent?} + <p>あなたの名前を指定します。HTMLヘッダ中に展開されます。</p> <p><input name="author_name" value="#{h @conf.author_name}" size="40"></p> <h3 class="subtitle">メールアドレス</h3> - #{"<p>あなたのメールアドレスを指定します。HTMLヘッダ中に展開されます。</p>" unless @cgi.mobile_agent?} + <p>あなたのメールアドレスを指定します。HTMLヘッダ中に展開されます。</p> <p><input name="author_mail" value="#{h @conf.author_mail}" size="40"></p> <h3 class="subtitle">トップページURL</h3> - #{"<p>日記よりも上位のコンテンツがあれば指定します。存在しない場合は何も入力しなくてかまいません。</p>" unless @cgi.mobile_agent?} + <p>日記よりも上位のコンテンツがあれば指定します。存在しない場合は何も入力しなくてかまいません。</p> <p><input name="index_page" value="#{h @conf.index_page}" size="70"></p> <h3 class="subtitle">日記のURL</h3> - #{"<p>日記のURLを指定します。このURLは、さまざまなプラグインで日記を指し示すために利用されるので、正しく一意なものを指定しましょう。</p>" unless @cgi.mobile_agent?} + <p>日記のURLを指定します。このURLは、さまざまなプラグインで日記を指し示すために利用されるので、正しく一意なものを指定しましょう。</p> #{"<p><strong>指定してある値と、現在アクセス中のURLが異なります。注意してください。</strong></p>" unless base_url == @cgi.base_url} <p><input name="base_url" value="#{h base_url}" size="70"></p> <h3 class="subtitle">日記の説明</h3> - #{"<p>この日記の簡単な説明を指定します。HTMLヘッダ中に展開されます。何も入力しなくてもかまいません。</p>" unless @cgi.mobile_agent?} + <p>この日記の簡単な説明を指定します。HTMLヘッダ中に展開されます。何も入力しなくてもかまいません。</p> <p><input name="description" value="#{h @conf.description}" size="70"></p> <h3 class="subtitle">サイトアイコン(favicon)</h3> - #{"<p>この日記を表す小さなアイコン画像(favicon)があればそのURLを指定します。HTMLヘッダ中に展開されます。何も入力しなくてもかまいません。</p>" unless @cgi.mobile_agent?} + <p>この日記を表す小さなアイコン画像(favicon)があればそのURLを指定します。HTMLヘッダ中に展開されます。何も入力しなくてもかまいません。</p> <p><input name="icon" value="#{h @conf.icon}" size="70"></p> <h3 class="subtitle">バナー画像</h3> - #{"<p>この日記を表す画像(バナー)があればそのURLを指定します。makerssプラグインなどでRSSを出力する場合などに使われます。何も入力しなくてもかまいません。</p>" unless @cgi.mobile_agent?} + <p>この日記を表す画像(バナー)があればそのURLを指定します。makerssプラグインなどでRSSを出力する場合などに使われます。何も入力しなくてもかまいません。</p> <p><input name="banner" value="#{h @conf.banner}" size="70"></p> <h3 class="subtitle">フレーム内表示</h3> - #{"<p>日記全体をフレーム内にくるんで表示することを許可します。</p>" unless @cgi.mobile_agent?} + <p>日記全体をフレーム内にくるんで表示することを許可します。</p> <p><select name="x_frame_options"> <option value=""#{" selected" unless @conf.x_frame_options}>許可する</option> <option value="SAMEORIGIN"#{" selected" if @conf.x_frame_options == 'SAMEORIGIN'}>同一ドメインなら許可する</option> @@ -211,10 +211,10 @@ add_conf_proc( 'header', 'ヘッダ・フッタ', 'basic' ) do <<-HTML <h3 class="subtitle">ヘッダ</h3> - #{"<p>日記の先頭に挿入される文章を指定します。HTMLタグが使えます。「<%=navi%>」で、ナビゲーションボタンを挿入できます(これがないと更新ができなくなるので削除しないようにしてください)。また、「<%=calendar%>」でカレンダーを挿入できます。その他、各種プラグインを記述できます。</p>" unless @cgi.mobile_agent?} + <p>日記の先頭に挿入される文章を指定します。HTMLタグが使えます。「<%=navi%>」で、ナビゲーションボタンを挿入できます(これがないと更新ができなくなるので削除しないようにしてください)。また、「<%=calendar%>」でカレンダーを挿入できます。その他、各種プラグインを記述できます。</p> <p><textarea name="header" cols="70" rows="10">#{h @conf.header}</textarea></p> <h3 class="subtitle">フッタ</h3> - #{"<p>日記の最後に挿入される文章を指定します。ヘッダと同様に指定できます。</p>" unless @cgi.mobile_agent?} + <p>日記の最後に挿入される文章を指定します。ヘッダと同様に指定できます。</p> <p><textarea name="footer" cols="70" rows="10">#{h @conf.footer}</textarea></p> HTML end @@ -224,19 +224,19 @@ add_conf_proc( 'display', '表示一般', 'basic' ) do <<-HTML <h3 class="subtitle">セクションアンカー</h3> - #{"<p>日記のセクションの先頭(サブタイトルの行頭)に挿入される、リンク用のアンカー文字列を指定します。なお「<span class=\"sanchor\">_</span>」を指定すると、テーマによっては自動的に画像アンカーがつくようになります。</p>" unless @cgi.mobile_agent?} + <p>日記のセクションの先頭(サブタイトルの行頭)に挿入される、リンク用のアンカー文字列を指定します。なお「<span class="sanchor">_</span>」を指定すると、テーマによっては自動的に画像アンカーがつくようになります。</p> <p><input name="section_anchor" value="#{h @conf.section_anchor}" size="40"></p> <h3 class="subtitle">ツッコミアンカー</h3> - #{"<p>読者からのツッコミの先頭に挿入される、リンク用のアンカー文字列を指定します。なお「<span class=\"canchor\">_</span>」を指定すると、テーマによっては自動的に画像アンカーがつくようになります。</p>" unless @cgi.mobile_agent?} + <p>読者からのツッコミの先頭に挿入される、リンク用のアンカー文字列を指定します。なお「<span class="canchor">_</span>」を指定すると、テーマによっては自動的に画像アンカーがつくようになります。</p> <p><input name="comment_anchor" value="#{h @conf.comment_anchor}" size="40"></p> <h3 class="subtitle">日付フォーマット</h3> - #{"<p>日付の表示部分に使われるフォーマットを指定します。任意の文字が使えますが、「%」で始まる英字には次のような特殊な意味があります。「%Y」(西暦年)、「%m」(月数値)、「%b」(短月名)、「%B」(長月名)、「%d」(日)、「%a」(短曜日名)、「%A」(長曜日名)。</p>" unless @cgi.mobile_agent?} + <p>日付の表示部分に使われるフォーマットを指定します。任意の文字が使えますが、「%」で始まる英字には次のような特殊な意味があります。「%Y」(西暦年)、「%m」(月数値)、「%b」(短月名)、「%B」(長月名)、「%d」(日)、「%a」(短曜日名)、「%A」(長曜日名)。</p> <p><input name="date_format" value="#{h @conf.date_format}" size="30"></p> <h3 class="subtitle">最新表示の最大日数</h3> - #{"<p>最新の日記を表示するときに、そのページ内に何日分の日記を表示するかを指定します。</p>" unless @cgi.mobile_agent?} + <p>最新の日記を表示するときに、そのページ内に何日分の日記を表示するかを指定します。</p> <p>最大<input name="latest_limit" value="#{h @conf.latest_limit}" size="2">日分</p> <h3 class="subtitle">長年日記の表示</h3> - #{"<p>長年日記を表示するためのリンクを表示するかどうかを指定します。</p>" unless @cgi.mobile_agent?} + <p>長年日記を表示するためのリンクを表示するかどうかを指定します。</p> <p><select name="show_nyear"> <option value="true"#{" selected" if @conf.show_nyear}>表示</option> <option value="false"#{" selected" unless @conf.show_nyear}>非表示</option> @@ -249,7 +249,7 @@ add_conf_proc( 'timezone', '時差調整', 'update' ) do <<-HTML <h3 class="subtitle">時差調整</h3> - #{"<p>更新時、フォームに挿入される日付を時間単位で調整できます。例えば午前2時までは前日として扱いたい場合には「-2」のように指定することで、2時間分引かれた日付が挿入されるようになります。また、この日付はWebサーバ上の時刻になっているので、海外のサーバで運営している場合の時差調整にも利用できます。</p>" unless @cgi.mobile_agent?} + <p>更新時、フォームに挿入される日付を時間単位で調整できます。例えば午前2時までは前日として扱いたい場合には「-2」のように指定することで、2時間分引かれた日付が挿入されるようになります。また、この日付はWebサーバ上の時刻になっているので、海外のサーバで運営している場合の時差調整にも利用できます。</p> <p><input name="hour_offset" value="#{h @conf.hour_offset}" size="5"></p> HTML end @@ -262,7 +262,7 @@ add_conf_proc( 'theme', 'テーマ選択', 'theme' ) do r = <<-HTML <h3 class="subtitle">テーマの指定</h3> - #{"<p>日記のデザインをテーマ、もしくはCSSの直接入力で指定します。ドロップダウンメニューから「CSS指定→」を選択した場合には、右の欄にCSSのURLを入力してください。</p>" unless @cgi.mobile_agent?} + <p>日記のデザインをテーマ、もしくはCSSの直接入力で指定します。ドロップダウンメニューから「CSS指定→」を選択した場合には、右の欄にCSSのURLを入力してください。</p> <p> <select name="theme" id="theme_selection"> <option value="">CSS指定→</option> @@ -275,16 +275,16 @@ add_conf_proc( 'comment', 'ツッコミ', 'tsukkomi' ) do <<-HTML <h3 class="subtitle">ツッコミの表示</h3> - #{"<p>読者からのツッコミを表示するかどうかを指定します。</p>" unless @cgi.mobile_agent?} + <p>読者からのツッコミを表示するかどうかを指定します。</p> <p><select name="show_comment"> <option value="true"#{" selected" if @conf.show_comment}>表示</option> <option value="false"#{" selected" unless @conf.show_comment}>非表示</option> </select></p> <h3 class="subtitle">ツッコミリスト表示数</h3> - #{"<p>最新もしくは月別表示時に表示する、ツッコミの最大件数を指定します。なお、日別表示時にはここの指定にかかわらずすべてのツッコミが表示されます。</p>" unless @cgi.mobile_agent?} + <p>最新もしくは月別表示時に表示する、ツッコミの最大件数を指定します。なお、日別表示時にはここの指定にかかわらずすべてのツッコミが表示されます。</p> <p>最大<input name="comment_limit" value="#{h @conf.comment_limit}" size="3">件</p> <h3 class="subtitle">1日あたりのツッコミ最大数</h3> - #{"<p>1日に書き込めるツッコミの最大数を指定します。この数を超えると、ツッコミ用のフォームが非表示になります。なお、TrackBackプラグインを入れている場合には、ツッコミとTrackBackの合計がこの制限を受けます。</p>" unless @cgi.mobile_agent?} + <p>1日に書き込めるツッコミの最大数を指定します。この数を超えると、ツッコミ用のフォームが非表示になります。なお、TrackBackプラグインを入れている場合には、ツッコミとTrackBackの合計がこの制限を受けます。</p> <p>最大<input name="comment_limit_per_day" value="#{h @conf.comment_limit_per_day}" size="3">件</p> HTML end @@ -318,17 +318,16 @@ add_conf_proc( 'csrf_protection', 'CSRF(乗っ取り)対策', 'security' ) do '<input type="checkbox" name="check_enabled" value="true">' end}する(標準) </p> - #{"<p>あなたのブラウザが送出するReferer(リンク元情報)を検査します。 + <p>あなたのブラウザが送出するReferer(リンク元情報)を検査します。 書き込み要求が正しいページから送出されたことを確認することで、 偽ページからの要求を防ぎます。不正なページからの要求を検出した場合、 更新リクエストを拒否します。 この設定画面では、無効にすることは出来ません。</p> - " unless @cgi.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 type="radio" name="check_referer" value="false" #{if [0,2].include?(csrf_protection_method) then " checked" end}>しない </p> - #{"<p>ブラウザからRefererが送られてこなかった場合の動作を指定します。</p> + <p>ブラウザからRefererが送られてこなかった場合の動作を指定します。</p> <p>標準では、Refererが送出されない場合、不正なリクエストを 判別できないため、書き込み・設定変更を拒否します。 あなたのブラウザがRefererを送出しない設定の場合、 @@ -340,21 +339,19 @@ add_conf_proc( 'csrf_protection', 'CSRF(乗っ取り)対策', 'security' ) do CSRFによる攻撃と区別できなくなりますので、必ず次の「CSRF防止キー」の 設定と併用して下さい。</p> </div> - " unless @cgi.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 type="radio" name="check_key" value="false" #{if [0,1].include?(csrf_protection_method) then " checked" end}>しない(標準) </p> - #{"<p>書き込みフォームに偽装書き込み防止のためのキーを設定し、CSRFを防ぎます。 + <p>書き込みフォームに偽装書き込み防止のためのキーを設定し、CSRFを防ぎます。 偽ページが秘密のキーを知らない限り、 偽の書き込み要求を生成することができなくなります。 この検査を「する」にすると、システムが鍵を自動的に生成、設定します。 上の設定と両方「しない」にすることはできません。</p> <p>この設定を「する」にした場合、この機構に対応していない一部の プラグインが動作しなくなることがあります。</p> - " unless @cgi.mobile_agent?} #{"<p class=\"message\">注意: あなたのブラウザは現在Refererを送出していないようです。 <a href=\"#{h @conf.update}?conf=csrf_protection\">このリンクからもう一回 Modified: lib/tdiary/plugin/ja/05referer.rb (+4 -4) =================================================================== --- lib/tdiary/plugin/ja/05referer.rb 2015-08-23 10:37:39 +0900 (7f10169) +++ lib/tdiary/plugin/ja/05referer.rb 2015-08-26 15:03:31 +0900 (84a1c38) @@ -18,21 +18,21 @@ add_conf_proc( 'referer', 'リンク元', 'referer' ) do <<-HTML <h3 class="subtitle">リンク元の表示</h3> - #{"<p>リンク元リストを表示するかどうかを指定します。</p>" unless @cgi.mobile_agent?} + <p>リンク元リストを表示するかどうかを指定します。</p> <p><select name="show_referer"> <option value="true"#{" selected" if @conf.show_referer}>表示</option> <option value="false"#{" selected" unless @conf.show_referer}>非表示</option> </select></p> <h3 class="subtitle">#{label_no_referer}</h3> - #{"<p>リンク元リストに追加しないURLを指定します。正規表現で指定できます。1件1行で入力してください。</p>" unless @cgi.mobile_agent?} + <p>リンク元リストに追加しないURLを指定します。正規表現で指定できます。1件1行で入力してください。</p> <p>→<a href="#{h @conf.update}?referer=no" target="referer">既存設定はこちら</a></p> <p><textarea name="no_referer" cols="70" rows="10">#{h @conf.no_referer2.join( "\n" )}</textarea></p> <h3 class="subtitle">#{label_only_volatile}</h3> - #{"<p>「以前の日記へのリンク元」にのみ記録したいURLはこちらに記述します。「以前の日記へのリンク元」は、新しい日付の日記を書くと消去されます。正規表現で指定できます。1件1行で入力してください。</p>" unless @cgi.mobile_agent?} + <p>「以前の日記へのリンク元」にのみ記録したいURLはこちらに記述します。「以前の日記へのリンク元」は、新しい日付の日記を書くと消去されます。正規表現で指定できます。1件1行で入力してください。</p> <p>→<a href="#{h @conf.update}?referer=volatile" target="referer">既存設定はこちら</a></p> <p><textarea name="only_volatile" cols="70" rows="10">#{h @conf.only_volatile2.join( "\n" )}</textarea></p> <h3 class="subtitle">#{label_referer_table}</h3> - #{"<p>リンク元リストのURLを、特定の文字列に変換する対応表を指定できます。1件につき、URLと表示文字列を空白で区切って指定します。正規表現が使えるので、URL中に現れた「(〜)」は、置換文字列中で「\\\\1」のような「\\数字」で利用できます。</p>" unless @cgi.mobile_agent?} + <p>リンク元リストのURLを、特定の文字列に変換する対応表を指定できます。1件につき、URLと表示文字列を空白で区切って指定します。正規表現が使えるので、URL中に現れた「(〜)」は、置換文字列中で「\\\\1」のような「\\数字」で利用できます。</p> <p>→<a href="#{h @conf.update}?referer=table" target="referer">既存設定はこちら</a></p> <p><textarea name="referer_table" cols="70" rows="10">#{h @conf.referer_table2.collect{|a|a.join( " " )}.join( "\n" )}</textarea></p> HTML Modified: lib/tdiary/view.rb (+0 -4) =================================================================== --- lib/tdiary/view.rb 2015-08-23 10:37:39 +0900 (e7374d6) +++ lib/tdiary/view.rb 2015-08-26 15:03:31 +0900 (b043dfc) @@ -192,10 +192,6 @@ module TDiary @name = @cgi.params['name'][0] @mail = @cgi.params['mail'][0] @body = @cgi.params['body'][0] - if @cgi.mobile_agent? - @name.force_encoding(conf.mobile_encoding) - @body.force_encoding(conf.mobile_encoding) - end @name = @conf.to_native( @name ) @body = @conf.to_native( @body ) @comment = Comment::new( @name, @mail, @body ) Modified: misc/plugin/category.rb (+12 -20) =================================================================== --- misc/plugin/category.rb 2015-08-23 10:37:39 +0900 (5cb4ea5) +++ misc/plugin/category.rb 2015-08-26 15:03:31 +0900 (6994cbe) @@ -54,23 +54,18 @@ def category_anchor(category) else "" end - if @category_icon[category] and !@cgi.mobile_agent? + if @category_icon[category] %Q|<a href="#{h @index}?#{period_string}category=#{u category}" title="#{h category}"><img class="category" src="#{h @category_icon_url}#{h @category_icon[category]}" alt="#{h category}"></a>| else %Q|[<a href="#{h @index}?#{period_string}category=#{u category}" title="#{h category}">#{h category}</a>]| end end -def category_navi_anchor(info, label, mobile = false) - if mobile then - "|#{info.make_anchor(label)}" - else - ((!label.nil?) && label.empty?) ? '' : %Q[<span class="adminmenu">#{info.make_anchor(label)}</span>\n] - end +def category_navi_anchor(info, label) + ((!label.nil?) && label.empty?) ? '' : %Q[<span class="adminmenu">#{info.make_anchor(label)}</span>\n] end def category_navi - mobile = @cgi.mobile_agent? info = Category::Info.new(@cgi, @years, @conf) mode = info.mode @@ -79,23 +74,21 @@ def category_navi when :year, :half, :quarter, :month all_diary = Category::Info.new(@cgi, @years, @conf, year: -1, month: -1) all = Category::Info.new(@cgi, @years, @conf, category: ['ALL'], year: -1, month: -1) - result << category_navi_anchor(info.prev, @conf['category.prev_' + mode.to_s], mobile) - result << category_navi_anchor(info.next, @conf['category.next_' + mode.to_s], mobile) - unless mobile then - result << category_navi_anchor(all_diary, @conf['category.all_diary']) - result << category_navi_anchor(all, @conf['category.all']) - end + result << category_navi_anchor(info.prev, @conf['category.prev_' + mode.to_s]) + result << category_navi_anchor(info.next, @conf['category.next_' + mode.to_s]) + result << category_navi_anchor(all_diary, @conf['category.all_diary']) + result << category_navi_anchor(all, @conf['category.all']) when :all year = Category::Info.new(@cgi, @years, @conf, year: Time.now.year.to_s) half = Category::Info.new(@cgi, @years, @conf, year: Time.now.year.to_s, month: "#{((Time.now.month - 1) / 6 + 1)}H") quarter = Category::Info.new(@cgi, @years, @conf, year: Time.now.year.to_s, month: "#{((Time.now.month - 1) / 3 + 1)}Q") month = Category::Info.new(@cgi, @years, @conf, year: Time.now.year.to_s, month: '%02d' % Time.now.month) - result << category_navi_anchor(year, @conf['category.this_year'], mobile) - result << category_navi_anchor(half, @conf['category.this_half'], mobile) - result << category_navi_anchor(quarter, @conf['category.this_quarter'], mobile) - result << category_navi_anchor(month, @conf['category.this_month'], mobile) + result << category_navi_anchor(year, @conf['category.this_year']) + result << category_navi_anchor(half, @conf['category.this_half']) + result << category_navi_anchor(quarter, @conf['category.this_quarter']) + result << category_navi_anchor(month, @conf['category.this_month']) end - if !info.category.include?('ALL') and !mobile then + if !info.category.include?('ALL') then all_category = Category::Info.new(@cgi, @years, @conf, category: ['ALL']) result << category_navi_anchor(all_category, @conf['category.all_category']) end @@ -172,7 +165,6 @@ def category_dropdown_list(label = nil, multiple = nil) info = Category::Info.new(@cgi, @years, @conf) category = info.category if category.empty? - return '' if @cgi.mobile_agent? category = ['ALL'] end Modified: misc/plugin/category_autocomplete.rb (+1 -1) =================================================================== --- misc/plugin/category_autocomplete.rb 2015-08-23 10:37:39 +0900 (c30f7ea) +++ misc/plugin/category_autocomplete.rb 2015-08-26 15:03:31 +0900 (b5d05c8) @@ -7,7 +7,7 @@ # You can redistribute it and/or modify it under GPL2 or any later version. # -if !@cgi.mobile_agent? && /\A(?:form|preview|append|edit|update)\z/ =~ @mode +if /\A(?:form|preview|append|edit|update)\z/ =~ @mode add_header_proc do %Q|<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css"/>| end Modified: misc/plugin/comment_emoji_autocomplete.rb (+1 -2) =================================================================== --- misc/plugin/comment_emoji_autocomplete.rb 2015-08-23 10:37:39 +0900 (010a7eb) +++ misc/plugin/comment_emoji_autocomplete.rb 2015-08-26 15:03:31 +0900 (2b28796) @@ -7,7 +7,7 @@ # You can redistribute it and/or modify it under GPL2 or any later version. # -if !@cgi.mobile_agent? && /\A(?:day)\z/ =~ @mode +if /\A(?:day)\z/ =~ @mode add_header_proc do %Q|<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css"/>| end @@ -15,7 +15,6 @@ if !@cgi.mobile_agent? && /\A(?:day)\z/ =~ @mode enable_js('//ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js') enable_js('caretposition.js') enable_js('comment_emoji_autocomplete.js') - end # Local Variables: Modified: misc/plugin/edit_today.rb (+5 -9) =================================================================== --- misc/plugin/edit_today.rb 2015-08-23 10:37:39 +0900 (1b99299) +++ misc/plugin/edit_today.rb 2015-08-26 15:03:31 +0900 (905c22a) @@ -16,15 +16,11 @@ def edit_today_link( date, title ) unless /^(day|preview)$/ =~ @mode edit_today_init caption = @conf['edit_today.caption'] - unless @cgi.mobile_agent? - <<-HTML - #{title}\n<span class="edit-today"> - <a href="#{@update}?edit=true;#{date.strftime( 'year=%Y;month=%m;day=%d' )}" title="#{edit_today_edit_label( date )}" rel="nofollow">#{caption}</a> - </span> - HTML - else - title - end + <<-HTML + #{title}\n<span class="edit-today"> + <a href="#{@update}?edit=true;#{date.strftime( 'year=%Y;month=%m;day=%d' )}" title="#{edit_today_edit_label( date )}" rel="nofollow">#{caption}</a> + </span> + HTML else title end Modified: misc/plugin/en/pb-show.rb (+2 -2) =================================================================== --- misc/plugin/en/pb-show.rb 2015-08-23 10:37:39 +0900 (5e2883f) +++ misc/plugin/en/pb-show.rb 2015-08-26 15:03:31 +0900 (abbeeed) @@ -5,10 +5,10 @@ def pingback_total( total ); "(Total: #{total})"; end def pb_show_conf_html <<-"HTML" <h3 class="subtitle">Pingback anchor</h3> - #{"<p>Pingback anchor is inserted into begining of each Pingbacks from other weblogs. So You can specify '<span class=\"tanchor\">_</span>\">', image anchor will be shown Image anchor by themes.</p>" unless @cgi.mobile_agent?} + <p>Pingback anchor is inserted into begining of each Pingbacks from other weblogs. So You can specify '<span class="tanchor">_</span>">', image anchor will be shown Image anchor by themes.</p> <p><input name="trackback_anchor" value="#{ h(@conf['trackback_anchor'] || @conf.comment_anchor ) }" size="40"></p> <h3 class="subtitle">Number of Pingbacks</h3> - #{"<p>In Latest or Month mode, you can specify number of visible Pingbacks. So in Dayly mode, all of Pingbacks are shown.</p>" unless @cgi.mobile_agent?} + <p>In Latest or Month mode, you can specify number of visible Pingbacks. So in Dayly mode, all of Pingbacks are shown.</p> <p><input name="trackback_limit" value="#{ h( @conf['trackback_limit'] || @conf.comment_limit )}" size="3"> Pingbacks</p> HTML end Modified: misc/plugin/en/tb-show.rb (+4 -4) =================================================================== --- misc/plugin/en/tb-show.rb 2015-08-23 10:37:39 +0900 (567b372) +++ misc/plugin/en/tb-show.rb 2015-08-26 15:03:31 +0900 (c92aa85) @@ -4,10 +4,10 @@ def tb_show_conf_html <<-"HTML" <h3 class="subtitle">TrackBack anchor</h3> - #{"<p>TrackBack anchor is inserted into begining of each TrackBacks from other weblogs. So You can specify '<span class=\"tanchor\">_</span>\">', image anchor will be shown Image anchor by themes.</p>" unless @cgi.mobile_agent?} + <p>TrackBack anchor is inserted into begining of each TrackBacks from other weblogs. So You can specify '<span class="tanchor">_</span>">', image anchor will be shown Image anchor by themes.</p> <p><input name="trackback_anchor" value="#{ h(@conf['trackback_anchor'] || @conf.comment_anchor ) }" size="40"></p> <h3 class="subtitle">TrackBack display style</h3> - #{"<p>In Latest or Month mode, you can specify style of trackbacks displayed.</p>" unless @cgi.mobile_agent?} + <p>In Latest or Month mode, you can specify style of trackbacks displayed.</p> <p><select name="trackback_shortview_mode"> #{ [["num_in_reflist", "Show number of TrackBacks in referer list (always)"], ["num_in_reflist_if_exists", "Show number of TrackBacks in referer list (if exists)"], @@ -17,10 +17,10 @@ def tb_show_conf_html }.to_s } </select></p> <h3 class="subtitle">Number of TrackBacks</h3> - #{"<p>In Latest or Month mode, you can specify number of visible TrackBacks. So in Dayly mode, all of TrackBacks are shown.</p>" unless @cgi.mobile_agent?} + <p>In Latest or Month mode, you can specify number of visible TrackBacks. So in Dayly mode, all of TrackBacks are shown.</p> <p><input name="trackback_limit" value="#{ h( @conf['trackback_limit'] || @conf.comment_limit )}" size="3"> TrackBacks</p> <h3 class="subtitle">Show TrackBack URL</h3> - #{"<p>In Latest or Month mode, you can specify TrackBack URL will be shown or not in each days.</p>" unless @cgi.mobile_agent?} + <p>In Latest or Month mode, you can specify TrackBack URL will be shown or not in each days.</p> <p><select name="trackback_disp_pingurl"> <option value="true" #{'selected' if @conf['trackback_disp_pingurl']}>Show</options> <option value="false" #{'selected' if !@conf['trackback_disp_pingurl']}>Hide</options> Modified: misc/plugin/hide-mail-field.rb (+2 -2) =================================================================== --- misc/plugin/hide-mail-field.rb 2015-08-23 10:37:39 +0900 (c9216ca) +++ misc/plugin/hide-mail-field.rb 2015-08-26 15:03:31 +0900 (a367249) @@ -8,7 +8,7 @@ # Distributed under GPL2 or any later version. # add_header_proc do - if @mode == 'day' and not @cgi.mobile_agent? then + if @mode == 'day' <<-STYLE <style type="text/css"><!-- form.comment div.mail { display: none; } @@ -20,7 +20,7 @@ add_header_proc do end add_footer_proc do - if @mode == 'day' and not @cgi.mobile_agent? then + if @mode == 'day' <<-SCRIPT <script type="text/javascript"><!-- document.getElementsByName("mail")[0].value = ""; Modified: misc/plugin/ja/pb-show.rb (+2 -2) =================================================================== --- misc/plugin/ja/pb-show.rb 2015-08-23 10:37:39 +0900 (2a7d836) +++ misc/plugin/ja/pb-show.rb 2015-08-26 15:03:31 +0900 (900c73b) @@ -7,10 +7,10 @@ def pingback_total( total ); "(全#{total}件)"; end def pb_show_conf_html <<-"HTML" <h3 class="subtitle">Pingback アンカー</h3> - #{"<p>他のweblogからのPingbackの先頭に挿入される、リンク用のアンカー文字列を指定します。なお「<span class=\"tanchor\">_</span>」を指定すると、テーマによっては自動的に画像アンカーがつくようになります。</p>" unless @cgi.mobile_agent?} + <p>他のweblogからのPingbackの先頭に挿入される、リンク用のアンカー文字列を指定します。なお「<span class="tanchor">_</span>」を指定すると、テーマによっては自動的に画像アンカーがつくようになります。</p> <p><input name="pingback_anchor" value="#{ h(@conf['pingback_anchor'] || @conf.comment_anchor ) }" size="40"></p> <h3 class="subtitle">Pingback リスト表示数</h3> - #{"<p>最新もしくは月別表示時に表示する、Pingbackの最大件数を指定します。なお、日別表示時にはここの指定にかかわらず最大100件のPingbackが表示されます。</p>" unless @cgi.mobile_agent?} + <p>最新もしくは月別表示時に表示する、Pingbackの最大件数を指定します。なお、日別表示時にはここの指定にかかわらず最大100件のPingbackが表示されます。</p> <p>最大<input name="pingback_limit" value="#{ h(@conf['pingback_limit'] || @conf.comment_limit ) }" size="3">件</p> HTML end Modified: misc/plugin/ja/tb-show.rb (+4 -4) =================================================================== --- misc/plugin/ja/tb-show.rb 2015-08-23 10:37:39 +0900 (6e25187) +++ misc/plugin/ja/tb-show.rb 2015-08-26 15:03:31 +0900 (739c681) @@ -5,10 +5,10 @@ def tb_show_conf_html <<-"HTML" <h3 class="subtitle">TrackBack アンカー</h3> - #{"<p>他のweblogからのTrackBackの先頭に挿入される、リンク用のアンカー文字列を指定します。なお「<span class=\"tanchor\">_</span>」を指定すると、テーマによっては自動的に画像アンカーがつくようになります。</p>" unless @cgi.mobile_agent?} + <p>他のweblogからのTrackBackの先頭に挿入される、リンク用のアンカー文字列を指定します。なお「<span class="tanchor">_</span>」を指定すると、テーマによっては自動的に画像アンカーがつくようになります。</p> <p><input name="trackback_anchor" value="#{ h(@conf['trackback_anchor'] || @conf.comment_anchor ) }" size="40"></p> <h3 class="subtitle">TrackBack 表示方法</h3> - #{"<p>最新もしくは月別時の表示方法を指定します。</p>" unless @cgi.mobile_agent?} + <p>最新もしくは月別時の表示方法を指定します。</p> <p><select name="trackback_shortview_mode"> #{ [["num_in_reflist", "リンク元一欄に数を表示(常に)"], ["num_in_reflist_if_exists", @@ -19,10 +19,10 @@ def tb_show_conf_html }.to_s } </select></p> <h3 class="subtitle">TrackBack リスト表示数</h3> - #{"<p>最新もしくは月別表示時に表示する、TrackBackの最大件数を指定します。なお、日別表示時にはここの指定にかかわらず最大100件のTrackBackが表示されます。</p>" unless @cgi.mobile_agent?} + <p>最新もしくは月別表示時に表示する、TrackBackの最大件数を指定します。なお、日別表示時にはここの指定にかかわらず最大100件のTrackBackが表示されます。</p> <p>最大<input name="trackback_limit" value="#{ h( @conf['trackback_limit'] || @conf.comment_limit )}" size="3">件</p> <h3 class="subtitle">TrackBack URL の表示設定</h3> - #{"<p>最新もしくは月別表示時に TrackBackURL を表示するかどうかを指定します。</p>" unless @cgi.mobile_agent?} + <p>最新もしくは月別表示時に TrackBackURL を表示するかどうかを指定します。</p> <p><select name="trackback_disp_pingurl"> <option value="true" #{'selected' if @conf['trackback_disp_pingurl']}>表示</options> <option value="false" #{'selected' if !@conf['trackback_disp_pingurl']}>非表示</options> Modified: misc/plugin/my-ex.rb (+0 -4) =================================================================== --- misc/plugin/my-ex.rb 2015-08-23 10:37:39 +0900 (62bd83b) +++ misc/plugin/my-ex.rb 2015-08-26 15:03:31 +0900 (a70bf44) @@ -12,8 +12,6 @@ # Copyright (c) 2002 TADA Tadashi <sh...@sp...> # Distributed under the GPL2 or any later version. -unless @cgi.mobile_agent? - def my( a, str, title = nil ) date, frag = a.scan( /(\d{4}|\d{6}|\d{8}|\d{8}-\d+)[^\d]*(?:#?([pct]\d+))?$/ )[0] anc = frag ? "#{date}#{frag}" : date @@ -58,8 +56,6 @@ def my( a, str, title = nil ) end end -end - # Local Variables: # mode: ruby # indent-tabs-mode: t Modified: misc/plugin/my-sequel.rb (+10 -10) =================================================================== --- misc/plugin/my-sequel.rb 2015-08-23 10:37:39 +0900 (242ced0) +++ misc/plugin/my-sequel.rb 2015-08-26 15:03:31 +0900 (8136627) @@ -101,15 +101,15 @@ _END end # returns an HTML sniplet for configuration interface - def html(restore_default_label, mobile = false) + def html(restore_default_label) return @default_hash.keys.sort_by{|k| @default_hash[k][:index]}.map{|k| - idattr = mobile ? '' : %Q| id="#{h k.to_s}"| - idattr_reset = mobile ? '' : %Q| id="#{h k.to_s}.reset"| - uncheck = mobile ? '' : ' onfocus="uncheck(this)"' - restore = mobile ? '' : ' onchange="restore(this)" onclick="restore(this)"' + idattr = %Q| id="#{h k.to_s}"| + idattr_reset = %Q| id="#{h k.to_s}.reset"| + uncheck = ' onfocus="uncheck(this)"' + restore = ' onchange="restore(this)" onclick="restore(this)"' r = %Q|\t<h3 class="subtitle">#{h @default_hash[k][:title]}</h3>\n| description = @default_hash[k][:description] - r += %Q|\t<p>#{h description}</p>\n| if description and not mobile + r += %Q|\t<p>#{h description}</p>\n| if description unless @default_hash[k][:textarea] r += %Q|\t<p><input name="#{h k.to_s}"#{idattr} type="text" value="#{h(Conf.to_native(self[k]))}"#{uncheck}>| else @@ -443,7 +443,7 @@ _END #{@my_sequel_conf.handler_block} <h3>#{@my_sequel_plugin_name}</h3> #{@my_sequel_description} -#{@my_sequel_conf.html(@my_sequel_restore_default_label, @cgi.mobile_agent?).chomp} +#{@my_sequel_conf.html(@my_sequel_restore_default_label).chomp} _HTML end @@ -453,7 +453,7 @@ _HTML # activate this plugin if header procs are called # - This avoids being called from makerss.rb add_header_proc do - if not bot? and not @cgi.mobile_agent? then + unless bot? @my_sequel_active = true @my_sequel.restore(@diaries.keys) MySequel.css(@my_sequel_conf[:inner_css]) @@ -497,7 +497,7 @@ _HTML # show sequels when leaving a section add_section_leave_proc do r = '' - if @my_sequel_active and @my_sequel_date and @my_sequel_anchor and not bot? and not @cgi.mobile_agent? then + if @my_sequel_active and @my_sequel_date and @my_sequel_anchor and not bot? then r = @my_sequel.html(@my_sequel_anchor, @my_sequel_conf[:date_format], @my_sequel_conf[:label]){|src_anchor, anchor_str| my_sequel_orig_my(src_anchor, anchor_str) } @@ -510,7 +510,7 @@ _HTML add_body_leave_proc do r = '' if @my_sequel_active and @my_sequel_date then - if not bot? and not @cgi.mobile_agent? then + unless bot? r = @my_sequel.html(@my_sequel_anchor, @my_sequel_conf[:date_format], @my_sequel_conf[:label]){|src_anchor, anchor_str| my_sequel_orig_my(src_anchor, anchor_str) } Modified: misc/plugin/pb-show.rb (+0 -6) =================================================================== --- misc/plugin/pb-show.rb 2015-08-23 10:37:39 +0900 (7cceee3) +++ misc/plugin/pb-show.rb 2015-08-26 15:03:31 +0900 (81ffb21) @@ -19,9 +19,6 @@ # # -# running on only non mobile mode -unless @cgi.mobile_agent? then - # # hide Pingbacks in TSUKKOMI # @@ -128,9 +125,6 @@ def pingbacks_of_today_long( diary, limit = 100 ) r end -# running on only non mobile mode -end # unless mobile_agent? - # # show Pingback ping URL # Modified: misc/plugin/random_google.rb (+12 -12) =================================================================== --- misc/plugin/random_google.rb 2015-08-23 10:37:39 +0900 (9121597) +++ misc/plugin/random_google.rb 2015-08-26 15:03:31 +0900 (44ef256) @@ -57,7 +57,7 @@ def random_google_init end end -if /(latest|day)/ === @mode and !bot? and !@cgi.mobile_agent? +if /(latest|day)/ === @mode and !bot? add_body_enter_proc do |date| random_google_init @@ -108,7 +108,7 @@ add_conf_proc('RandomGoogle', '関連するかもしれないページ検索') d r = <<-HTML <h3 class="subtitle">キーワードの数</h3> - #{"<p>日記本文から抽出するキーワードの数</p>" unless @cgi.mobile_agent?} + <p>日記本文から抽出するキーワードの... [truncated message content] |