forked from tdiary/tdiary-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tdiary.rb
126 lines (109 loc) · 3.76 KB
/
tdiary.rb
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
# -*- coding: utf-8; -*-
=begin
== NAME
tDiary: the "tsukkomi-able" web diary system.
Copyright (C) 2001-2013, TADA Tadashi <[email protected]>
You can redistribute it and/or modify it under GPL2.
=end
TDIARY_VERSION = '3.2.1.20130211'
$:.unshift File.join(File::dirname(__FILE__), '/misc/lib').untaint
Dir["#{File::dirname(__FILE__) + '/vendor/*/lib'}"].each {|dir| $:.unshift dir.untaint }
require 'cgi'
require 'uri'
require 'fileutils'
require 'pstore'
require 'json'
require 'erb'
require 'tdiary/compatible'
require 'tdiary/core_ext'
#
# module TDiary
#
module TDiary
PATH = File::dirname( __FILE__ ).untaint
# tDiary configuration class, initialize tdiary.conf and stored configuration.
autoload :Config, 'tdiary/config'
# tDiary plugin class, loading all Plugin and eval plugins in view context.
autoload :Plugin, 'tdiary/plugin'
# CGI standalone server
autoload :Server, 'tdiary/server'
# Rack Application, TODO: integrate Server and Application
autoload :Application, 'tdiary/application'
# Diary model class
autoload :DiaryBase, 'tdiary/style'
autoload :SectionBase, 'tdiary/style'
autoload :CategorizableDiary, 'tdiary/style'
autoload :UncategorizableDiary, 'tdiary/style'
autoload :Comment, 'tdiary/comment'
autoload :Filter, 'tdiary/filter'
autoload :CommentManager, 'tdiary/comment_manager'
autoload :RefererManager, 'tdiary/referer_manager'
# Routing and Dispatch
autoload :Dispatcher, 'tdiary/dispatcher'
# Rack Request and Reponse, If you don't use Rack, adopt Rack interface.
autoload :Request, 'tdiary/request'
autoload :Response, 'tdiary/response'
# ViewController created by Dispatcher
autoload :TDiaryBase, 'tdiary/base'
autoload :TDiaryCategoryView, 'tdiary/base'
autoload :TDiarySearch, 'tdiary/base'
autoload :TDiaryPluginView, 'tdiary/base'
autoload :TDiaryAuthorOnlyBase, 'tdiary/author_only_base'
autoload :TDiaryFormPlugin, 'tdiary/author_only_base'
autoload :TDiaryConf, 'tdiary/author_only_base'
autoload :TDiarySaveConf, 'tdiary/author_only_base'
autoload :TDiaryAdmin, 'tdiary/admin'
autoload :TDiaryForm, 'tdiary/admin'
autoload :TDiaryEdit, 'tdiary/admin'
autoload :TDiaryPreview, 'tdiary/admin'
autoload :TDiaryUpdate, 'tdiary/admin'
autoload :TDiaryAppend, 'tdiary/admin'
autoload :TDiaryReplace, 'tdiary/admin'
autoload :TDiaryShowComment, 'tdiary/admin'
autoload :TDiaryView, 'tdiary/view'
autoload :TDiaryDay, 'tdiary/view'
autoload :TDiaryComment, 'tdiary/view'
autoload :TDiaryMonthBase, 'tdiary/view'
autoload :TDiaryMonth, 'tdiary/view'
autoload :TDiaryNYear, 'tdiary/view'
autoload :TDiaryMonthWithoutFilter, 'tdiary/view'
autoload :TDiaryLatest, 'tdiary/view'
#
# exception classes
#
class TDiaryError < StandardError; end
class PermissionError < TDiaryError; end
class PluginError < TDiaryError; end
class BadStyleError < TDiaryError; end
class NotFound < TDiaryError; end
# class ForceRedirect
# force redirect to another page
#
class ForceRedirect < StandardError
attr_reader :path
def initialize( path )
@path = path
end
end
class << self
def logger
@@logger
end
def logger=(obj)
@@logger = obj
end
def root
File.expand_path('..', __FILE__)
end
def document_root
defined?( Rack ) ? "#{root}/public" : '.'
end
end
end
# Local Variables:
# mode: ruby
# indent-tabs-mode: t
# tab-width: 3
# ruby-indent-level: 3
# End:
# vim: ts=3