#
# tDiary configuration file $Revision: 1.18 $
#

#-------
# The items which you can't configure with browser
#-------

# Language setting
#   If you use tDiary in English mode, you have to set @lang to 'en'.
#   Or 'zh' for Traditional-Chinese.
@lang = 'en'
# @lang = 'zh'

# The directory where the diary's data are stored.(must)
#   tDiary stores your diary's data in this directory. You usually 
#   assign this item to the directory which can't be accessed through WWW. 
#   This directory's permission is set so that WWW server can 
#   write files in it.
@data_path = '/home/foo/diary'

# The format of the diary(optional)
#   If you change the format of the diary from the default, 
#   you must add some items to your configuration file.
#   In default, tDiary uses tDiary2 format.
#   What you must configure depends on the format of diary.
#   Please see the document of the program which enable tDiary to 
#   use other format.
#   If "#" of the two lines below are removed, tDiary uses tDiary1 format.
#require 'tdiary/pstoreio'
#@io_class = TDiary::PStoreIO

# Script names for reading or updating your diary(optional)
#   You can set @index and @update to the script filenames for 
#   reading or updating your diary. Normally, these variables have 
#   the default value("./" and "update.rb"). But, if you specify these 
#   variables, you can use tDiary in case that you can't use "DirectoryIndex"
#   or you want to use frame. 
#@index = './'
#@update = 'update.rb'

# Multi-user mode(optional)
#   You use @multi_user when your diary is written by plural persons. 
#   If you set this variable to "true", the multi-user mode is enabled and
#   tDiary change its behavior. In the beginning of the sub-title, writer's name
#   is inserted. The style is like "[user name] sub-title".
#   The editing in multi-uses mode is dangerous. If plural persons
#   write diary at the same time, the change which is saved precedently 
#   is ignored. You must be careful when you use multi-user mode.
#   The words, "user name", is the name which is used when you login with browser. 
#   Don't forget to add necessary user names to "Require User" of .htaccess.
@multi_user = false

# path of plugins. (optional)
#   In default, plugins are find from "plugin" directory under install
#   path. But, when @plugin_path is set, tDiary will load plugins
#   from it.
#@plugin_path = 'path of plugins'

# path of cache files. (optional)
#   tDiary makes some cache files under @data_path/cache. You may specify
#   any directory for cache files by this variable.
#@cache_path = 'path of cache files'

# options for plugins. (optional)
#   Some plugins can receive options from tdiary.conf.
#     ex: a option "foo" of plugin "sample".
#         @options[sample.foo] = 'foobar'

# apply plugins after 1st applyeds plugin (true/false)
@options['apply_plugin'] = true

# User-Agent list that is considered as bot.
@options['bot'] = [
	'^(Naverbot|Cowbot)-',
	'^BlogLines/',
	'^blogmap',
	'^FAST-WebCrawler/',
	'^Hatena Antenna/',
	'MI[CK]AN/',
	'^msnbot/',
	'^NG/',
	'^Openbot/',
	'^samidare',
	'^TAMATEBAKO/',
	'^TomSoftAntenna'
]

# Control Links saving [true or false] (optional)
#   Specify which saving only day mode (default). It means reducing 'referer
#   noise' by access from 'Link page'. If this value to false, Today's Link
#   begin to save links to top page of your diary.
@referer_day_only = true


#-------
# Items which you can configure with browser
# 
# If necessary, you change these items. 
# Once you do setting with browser, 
# these items' value is not reflected even if you edit "tdiary.conf" directly.  
#-------

# your name and mail address
#   you set @author_name to your name and @author_mail to your mail 
#   address. These values are embedded in the HTML header of your diary.
@author_name = 'Your name'
@author_mail = 'foo@example.net'

# your top-page
#   if your website has contents other than diary, you 
#   set @index_page to URL of your other website page, for example,
#   the front page of your diary or the top-page of your website.
#   This is embedded in the HTML header and at the beginning of 
#   your diary page.
@index_page = 'http://www.example.net/~foo/'

# The title 
#   This is the title of your diary.
#   This must not have the HTML tag.
@html_title = 'foobar diary'

# Diary header
#   You specify sentences which are embedded at the beginning 
#   of your diary. Please change sentences enclosed by "HEADER".
#   Because this value is embedded as it is, you can use HTML tag. You 
#   can also use eRuby tag. You feel inconvenient if "%calendar" and "%navi" 
#   are not in the diary header.
#   
#   <%=calendar%>
#       This is replaced with a calendar. This calendar has the links to 
#       other monthly page.
#   <%=navi%>
#       This is replaced with menus through which you can update your diary,
#       do setting and so on.
#
@header = <<HEADER
<%= navi %>
<h1>Foo's diary</h1>
<%=calendar%>
HEADER

# Diary footer
#   Like the diary header, you can set @footer to sentences which
#   are inserted into the end of your diary page.
#   Please change sentences enclosed by "FOOTER".
@footer = <<FOOTER
<%= navi %>
<p>If you want to delete this message, you move to "preferences" page and 
edit the footer.</p>

<p style="font-size: x-large;">
It is better to read 
<a href="doc/README.en.html">README</a> 
and 
<a href="doc/HOWTO-write-tDiary.en.html">How to write diary</a>
before you write diary. 
</p>
FOOTER

# The format of date
#   You can set @date_format to the format of date. The default value 
#   is "YYYY-MM-DD". You can use all the parameters of Ruby's Time::strftime.
#   The words which are often used are "%Y"(dominical year), "%m"(month),
#   "%b"(abbreviated month name), "%B"(full month name), "%d"(day), 
#   "%a"(abbreviated weekday name) and "%A"(full weekday name).
@date_format = '%Y-%m-%d [%a]'

# The anchor of the section and TSUKKOMI
#   You specify words which are used as the section anchor(@section_anchor)
#   and the TSUKKOMI anchor(@comment_anchor).
#   These are enclosed by <a href="...">...</a> in your diary page.
#   If you use span tag whose attribute is sanchor(section anchor) or canchor
#   (TSUKKOMI anchor), the image is shown at the anchor in some themes. 
@section_anchor = '<span class="sanchor">_</span>'
@comment_anchor = '<span class="canchor">_</span>'

# How many daily diaries do "Latest" page have?
#   You decide how many daily diaries are shown in "Latest" page.
#   If the number of the diaries doesn't attain the specified number, 
#   diaries in the previous month are also shown.
@latest_limit = 10

# Theme(theme name or URL of the CSS) 
#   You specify a theme or URL of the CSS. This determines
#   the style of your diary. @theme has the default cascading 
#   style sheet. You can change this value and the look of your diary.
#   In the theme directory, there are some themes. If you are interested in  
#   other themes, you try them by changing this value. 
#
#   Of course, you can write your own CSS file. In that case, 
#   you set @theme to "" and @css to the URL of your CSS file.
@theme = 'default'
@css = ''

# Show TSUKKOMI(true or false)
#   You can decide whether today's TSUKKOMI is shown or not. 
#   If you set @show_comment to false, you can hide the TSUKKOMIs and
#   readers of your diary can't read them. The diary author can 
#   read them in the "Update" page if you specify date.
@show_comment = true

# How many TSUKKOMIs are shown in "Latest" page and "Daily" page?
#   If today's TSUKKOMI is shown, you specify how many TSUKKOMIs are
#   shown at most in "Latest" page and "Daily" page.
@comment_limit = 3

# TSUKKOMI limit per a day
#   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.
@comment_limit_per_day = 100

# Show today's links(true or false)
#   You can decide whether today's links are shown or not. The link
#   is the URL from which your diary visitor jump to your diary.
#   By this, you can find the page which has the link to your diary.
#   This makes it easy for you to communicate with people through diary.
#   In default, tDiary shows this information to diary readers. If you 
#   don't want diary readers to know it, you set @show_referer to false.
#   Even if this value is set to false, the author can know it in "Update" page 
#   if you specify the date.
@show_referer = true

# Time difference adjustment 
#   This item adjusts the date which is automatically inserted into 
#   the page of "update" form. The unit is hour, and you can 
#   use demical number. 
#
#   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. 
@hour_offset = 0

#-----
# The items to which you can add values with browser
# 
# Though you can set the standard values here, you can't do so
# with browser.
#-----

# URLs which are excluded from today's link (Regular Expression)
#   You set a list of URLs which are not recorded as today's links to @no_referer 
#   If all the access are recorded, today's links have some noisy URLs. 
#   Because the purpose of today's links is to find URL which is linked to 
#   your diary, these noisy accesses are annoying; a search engine's access, 
#   an access from your website and a website fetcher's access. 
#   They are excluded if you set their URLs to @no_referer.
#   It is better to add your diary's URL to @no_referer. 
#   The value must be the Array of Ruby and Array's contents are String 
#   of Ruby. Though these Strings are converted to Regular Expression
#   of Ruby when compared, you can't use Regexp of Ruby.
@no_referer = [
	'^' + Regexp.quote( base_url ),  # Your diary
	'^http://localhost[:/]',
	'^http://192.168.',
	'^http://172.1[6789]',
	'^http://172.2[0-9]',
	'^http://172.3[01]',
	'^http://10.',
]

# URLs which are only recorded into Today's Link (Regular Expression)
#   @only_volatile is an array of URLs to record into only Today's Link.
#   When a referer match to this list, it will be recoreded to volatile
#   list. This list will be cleared when you make new text in new day.
#   Specify @only_volatile same style of @no_referer.
@only_volatile = [
]

# The rules which convert the specified URL to the word (Regular Expression)
#   @referer_table is configured so that readable URLs are shown in  
#   today's links when you read "daily" page. You add an array of 
#   a URL which will be converted to Regexp and a word which tDiary 
#   replaced the URL with to @referer_table. If a part of URL is 
#   enclosed by parentheses, "\1", "\2", ... in the word are replaced with 
#   the enclosed parts of URL. 
#
#   By the rules below, tDiary replaces URLs from google with "google...".
@referer_table = [
	['^http://www.google.com/search.*?q=([^&]*).*', 'google(\1)'],

	# 
	# You must add a new rule above here. 
	#  
	# This rule abbreviates URLs which are not converted by the rules 
	# above and have more than 50 characters. 
	#
	['^(.{50}).*$', '\1...'],
]

# Cross-Site Request Forgery (CSRF) protection settings
#
# CSRF protection always checks request method and
# right referer value.
# Additional, you can specify protection method below:
#   1: Checking existens right referer value (no using protection key)
#   2: Checking protection key (allow null referer)
#   3: Checking both 1. and 2.
#
# If you use browsers don't send referer, set protection key
# and set this value to 2. When browsers don't send referer and set this
# value 1 or 3, you cannot update diary or change setting of tDiary.
#
# If you use normal browsers (these will send referer), set this value
# to 1 or 3. When you set to 3, you must set protection key.
#
# And if you set 2 or 3, a few plugins will not work good.
#
@options['csrf_protection_method'] = 1

# CSRF protection key
# You can set any string. If this key will be stolen, your diary will be
# attacked by CSRF.
# When csrf_protection_method is 1, this key is not used.
# When csrf_protection_method is 2 or 3 and key is null, you cannot change
# setting of tDiary.
@options['csrf_protection_key'] = ''

# Regexp of right referer checking
# tDiary add a URL of @update automatically. But if you want to use
# other URL (ex. your own portal site), specify this value.
# When this value has nil or null string, it has no match.
@options['csrf_protection_allowed_referer_regexp_for_update'] = ''

#----
# CGI configuration file(must)
#   If you enforce security, you set @secure to true. This 
#   restricts dangerous operation, for example, variables and file loading.
#----
@secure = false
load_cgi_conf

