| 1 | # Movable Type (r) Open Source (C) 2001-2008 Six Apart, Ltd. |
|---|
| 2 | # This program is distributed under the terms of the |
|---|
| 3 | # GNU General Public License, version 2. |
|---|
| 4 | # |
|---|
| 5 | # $Id$ |
|---|
| 6 | |
|---|
| 7 | package MT::Core; |
|---|
| 8 | |
|---|
| 9 | use strict; |
|---|
| 10 | use MT; |
|---|
| 11 | use base 'MT::Component'; |
|---|
| 12 | |
|---|
| 13 | # This is just to make our localization scanner happy |
|---|
| 14 | sub trans { |
|---|
| 15 | return shift; |
|---|
| 16 | } |
|---|
| 17 | |
|---|
| 18 | sub name { |
|---|
| 19 | return "Core"; |
|---|
| 20 | } |
|---|
| 21 | |
|---|
| 22 | my $core_registry; |
|---|
| 23 | |
|---|
| 24 | BEGIN { |
|---|
| 25 | $core_registry = { |
|---|
| 26 | version => MT->VERSION, |
|---|
| 27 | schema_version => MT->schema_version, |
|---|
| 28 | object_drivers => { |
|---|
| 29 | 'mysql' => { |
|---|
| 30 | label => 'MySQL Database', |
|---|
| 31 | dbd_package => 'DBD::mysql', |
|---|
| 32 | config_package => 'DBI::mysql', |
|---|
| 33 | }, |
|---|
| 34 | 'postgres' => { |
|---|
| 35 | label => 'PostgreSQL Database', |
|---|
| 36 | dbd_package => 'DBD::Pg', |
|---|
| 37 | dbd_version => '1.32', |
|---|
| 38 | config_package => 'DBI::postgres', |
|---|
| 39 | }, |
|---|
| 40 | 'sqlite' => { |
|---|
| 41 | label => 'SQLite Database', |
|---|
| 42 | dbd_package => 'DBD::SQLite', |
|---|
| 43 | config_package => 'DBI::sqlite', |
|---|
| 44 | }, |
|---|
| 45 | 'sqlite2' => { |
|---|
| 46 | label => 'SQLite Database (v2)', |
|---|
| 47 | dbd_package => 'DBD::SQLite2', |
|---|
| 48 | config_package => 'DBI::sqlite', |
|---|
| 49 | }, |
|---|
| 50 | }, |
|---|
| 51 | object_types => { |
|---|
| 52 | 'entry' => 'MT::Entry', |
|---|
| 53 | 'author' => 'MT::Author', |
|---|
| 54 | 'asset' => 'MT::Asset', |
|---|
| 55 | 'file' => 'MT::Asset', |
|---|
| 56 | 'asset.image' => 'MT::Asset::Image', |
|---|
| 57 | 'image' => 'MT::Asset::Image', |
|---|
| 58 | 'asset.audio' => 'MT::Asset::Audio', |
|---|
| 59 | 'audio' => 'MT::Asset::Audio', |
|---|
| 60 | 'asset.video' => 'MT::Asset::Video', |
|---|
| 61 | 'video' => 'MT::Asset::Video', |
|---|
| 62 | 'entry.page' => 'MT::Page', |
|---|
| 63 | 'page' => 'MT::Page', |
|---|
| 64 | 'category.folder' => 'MT::Folder', |
|---|
| 65 | 'folder' => 'MT::Folder', |
|---|
| 66 | 'category' => 'MT::Category', |
|---|
| 67 | 'user' => 'MT::Author', |
|---|
| 68 | 'commenter' => 'MT::Author', |
|---|
| 69 | 'blog' => 'MT::Blog', |
|---|
| 70 | 'template' => 'MT::Template', |
|---|
| 71 | 'comment' => 'MT::Comment', |
|---|
| 72 | 'notification' => 'MT::Notification', |
|---|
| 73 | 'templatemap' => 'MT::TemplateMap', |
|---|
| 74 | 'banlist' => 'MT::IPBanList', |
|---|
| 75 | 'tbping' => 'MT::TBPing', |
|---|
| 76 | 'ping' => 'MT::TBPing', |
|---|
| 77 | 'ping_cat' => 'MT::TBPing', |
|---|
| 78 | 'log' => 'MT::Log', |
|---|
| 79 | 'log.ping' => 'MT::Log::TBPing', |
|---|
| 80 | 'log.entry' => 'MT::Log::Entry', |
|---|
| 81 | 'log.comment' => 'MT::Log::Comment', |
|---|
| 82 | 'log.system' => 'MT::Log', |
|---|
| 83 | 'tag' => 'MT::Tag', |
|---|
| 84 | 'role' => 'MT::Role', |
|---|
| 85 | 'association' => 'MT::Association', |
|---|
| 86 | 'permission' => 'MT::Permission', |
|---|
| 87 | 'fileinfo' => 'MT::FileInfo', |
|---|
| 88 | 'placement' => 'MT::Placement', |
|---|
| 89 | 'plugindata' => 'MT::PluginData', |
|---|
| 90 | 'session' => 'MT::Session', |
|---|
| 91 | 'trackback' => 'MT::Trackback', |
|---|
| 92 | 'config' => 'MT::Config', |
|---|
| 93 | 'objecttag' => 'MT::ObjectTag', |
|---|
| 94 | 'objectscore' => 'MT::ObjectScore', |
|---|
| 95 | 'objectasset' => 'MT::ObjectAsset', |
|---|
| 96 | |
|---|
| 97 | # TheSchwartz tables |
|---|
| 98 | 'ts_job' => 'MT::TheSchwartz::Job', |
|---|
| 99 | 'ts_error' => 'MT::TheSchwartz::Error', |
|---|
| 100 | 'ts_exitstatus' => 'MT::TheSchwartz::ExitStatus', |
|---|
| 101 | 'ts_funcmap' => 'MT::TheSchwartz::FuncMap', |
|---|
| 102 | }, |
|---|
| 103 | permissions => { |
|---|
| 104 | 'system.administer' => { |
|---|
| 105 | label => trans("System Administrator"), |
|---|
| 106 | group => 'sys_admin', |
|---|
| 107 | order => 0, |
|---|
| 108 | }, |
|---|
| 109 | 'system.create_blog' => { |
|---|
| 110 | label => trans("Create Blogs"), |
|---|
| 111 | group => 'sys_admin', |
|---|
| 112 | order => 100, |
|---|
| 113 | }, |
|---|
| 114 | 'system.manage_plugins' => { |
|---|
| 115 | label => trans('Manage Plugins'), |
|---|
| 116 | group => 'sys_admin', |
|---|
| 117 | order => 200, |
|---|
| 118 | }, |
|---|
| 119 | 'system.edit_templates' => { |
|---|
| 120 | label => trans('Manage Templates'), |
|---|
| 121 | group => 'sys_admin', |
|---|
| 122 | order => 250, |
|---|
| 123 | }, |
|---|
| 124 | 'system.view_log' => { |
|---|
| 125 | label => trans("View System Activity Log"), |
|---|
| 126 | group => 'sys_admin', |
|---|
| 127 | order => 300, |
|---|
| 128 | }, |
|---|
| 129 | |
|---|
| 130 | 'blog.administer_blog' => { |
|---|
| 131 | label => trans("Blog Administrator"), |
|---|
| 132 | group => 'blog_admin', |
|---|
| 133 | order => 0, |
|---|
| 134 | }, |
|---|
| 135 | 'blog.edit_config' => { |
|---|
| 136 | label => trans("Configure Blog"), |
|---|
| 137 | group => 'blog_admin', |
|---|
| 138 | order => 100, |
|---|
| 139 | }, |
|---|
| 140 | 'blog.set_publish_paths' => { |
|---|
| 141 | label => trans('Set Publishing Paths'), |
|---|
| 142 | group => 'blog_admin', |
|---|
| 143 | order => 200, |
|---|
| 144 | }, |
|---|
| 145 | 'blog.edit_categories' => { |
|---|
| 146 | label => trans('Manage Categories'), |
|---|
| 147 | group => 'blog_admin', |
|---|
| 148 | order => 300, |
|---|
| 149 | }, |
|---|
| 150 | 'blog.edit_tags' => { |
|---|
| 151 | label => trans('Manage Tags'), |
|---|
| 152 | group => 'blog_admin', |
|---|
| 153 | order => 400, |
|---|
| 154 | }, |
|---|
| 155 | 'blog.edit_notifications' => { |
|---|
| 156 | label => trans('Manage Address Book'), |
|---|
| 157 | group => 'blog_admin', |
|---|
| 158 | order => 500, |
|---|
| 159 | }, |
|---|
| 160 | 'blog.view_blog_log' => { |
|---|
| 161 | label => trans('View Activity Log'), |
|---|
| 162 | group => 'blog_admin', |
|---|
| 163 | order => 600, |
|---|
| 164 | }, |
|---|
| 165 | |
|---|
| 166 | 'blog.create_post' => { |
|---|
| 167 | label => trans('Create Entries'), |
|---|
| 168 | group => 'auth_pub', |
|---|
| 169 | order => 100, |
|---|
| 170 | }, |
|---|
| 171 | 'blog.publish_post' => { |
|---|
| 172 | label => trans('Publish Entries'), |
|---|
| 173 | group => 'auth_pub', |
|---|
| 174 | order => 200, |
|---|
| 175 | }, |
|---|
| 176 | 'blog.send_notifications' => { |
|---|
| 177 | label => trans('Send Notifications'), |
|---|
| 178 | group => 'auth_pub', |
|---|
| 179 | order => 300, |
|---|
| 180 | }, |
|---|
| 181 | 'blog.edit_all_posts' => { |
|---|
| 182 | label => trans('Edit All Entries'), |
|---|
| 183 | group => 'auth_pub', |
|---|
| 184 | order => 400, |
|---|
| 185 | }, |
|---|
| 186 | 'blog.manage_pages' => { |
|---|
| 187 | label => trans('Manage Pages'), |
|---|
| 188 | group => 'auth_pub', |
|---|
| 189 | order => 500, |
|---|
| 190 | }, |
|---|
| 191 | 'blog.rebuild' => { |
|---|
| 192 | label => trans('Publish Blog'), |
|---|
| 193 | group => 'auth_pub', |
|---|
| 194 | order => 600, |
|---|
| 195 | }, |
|---|
| 196 | |
|---|
| 197 | 'blog.edit_templates' => { |
|---|
| 198 | label => trans('Manage Templates'), |
|---|
| 199 | group => 'blog_design', |
|---|
| 200 | order => 100, |
|---|
| 201 | }, |
|---|
| 202 | |
|---|
| 203 | 'blog.upload' => { |
|---|
| 204 | label => trans("Upload File"), |
|---|
| 205 | group => 'blog_upload', |
|---|
| 206 | order => 100, |
|---|
| 207 | }, |
|---|
| 208 | 'blog.save_image_defaults' => { |
|---|
| 209 | label => trans('Save Image Defaults'), |
|---|
| 210 | group => 'blog_upload', |
|---|
| 211 | order => 200, |
|---|
| 212 | }, |
|---|
| 213 | 'blog.edit_assets' => { |
|---|
| 214 | label => trans('Manage Assets'), |
|---|
| 215 | group => 'blog_upload', |
|---|
| 216 | order => 300, |
|---|
| 217 | }, |
|---|
| 218 | |
|---|
| 219 | 'blog.comment' => { |
|---|
| 220 | label => trans("Post Comments"), |
|---|
| 221 | group => 'blog_comment', |
|---|
| 222 | order => 100, |
|---|
| 223 | }, |
|---|
| 224 | 'blog.manage_feedback' => { |
|---|
| 225 | label => trans('Manage Feedback'), |
|---|
| 226 | group => 'blog_comment', |
|---|
| 227 | order => 200, |
|---|
| 228 | }, |
|---|
| 229 | }, |
|---|
| 230 | config_settings => { |
|---|
| 231 | 'AtomApp' => { |
|---|
| 232 | type => 'HASH', |
|---|
| 233 | default => { |
|---|
| 234 | weblog => 'MT::AtomServer::Weblog::Legacy', |
|---|
| 235 | '1.0' => 'MT::AtomServer::Weblog', |
|---|
| 236 | }, |
|---|
| 237 | }, |
|---|
| 238 | 'SchemaVersion' => undef, |
|---|
| 239 | 'MTVersion' => undef, |
|---|
| 240 | 'NotifyUpgrade' => { default => 1 }, |
|---|
| 241 | 'Database' => undef, |
|---|
| 242 | 'DBHost' => undef, |
|---|
| 243 | 'DBSocket' => undef, |
|---|
| 244 | 'DBPort' => undef, |
|---|
| 245 | 'DBUser' => undef, |
|---|
| 246 | 'DBPassword' => undef, |
|---|
| 247 | 'DefaultLanguage' => { |
|---|
| 248 | default => 'en_US', |
|---|
| 249 | }, |
|---|
| 250 | 'LocalPreviews' => { default => 0 }, |
|---|
| 251 | 'DefaultSiteRoot' => { default => '', }, |
|---|
| 252 | 'DefaultSiteURL' => { default => '', }, |
|---|
| 253 | 'DefaultCommenterAuth' => { default => 'MovableType,LiveJournal,Vox' }, |
|---|
| 254 | 'TemplatePath' => { |
|---|
| 255 | default => 'tmpl', |
|---|
| 256 | path => 1, |
|---|
| 257 | }, |
|---|
| 258 | 'WeblogTemplatesPath' => { |
|---|
| 259 | default => 'default_templates', |
|---|
| 260 | path => 1, |
|---|
| 261 | }, |
|---|
| 262 | 'AltTemplatePath' => { |
|---|
| 263 | default => 'alt-tmpl', |
|---|
| 264 | path => 1, |
|---|
| 265 | }, |
|---|
| 266 | 'CSSPath' => { default => 'css', }, |
|---|
| 267 | 'ImportPath' => { |
|---|
| 268 | default => 'import', |
|---|
| 269 | path => 1, |
|---|
| 270 | }, |
|---|
| 271 | 'PluginPath' => { |
|---|
| 272 | default => 'plugins', |
|---|
| 273 | path => 1, |
|---|
| 274 | type => 'ARRAY', |
|---|
| 275 | }, |
|---|
| 276 | 'EnableArchivePaths' => { default => 0, }, |
|---|
| 277 | 'SearchTemplatePath' => { |
|---|
| 278 | default => 'search_templates', |
|---|
| 279 | path => 1, |
|---|
| 280 | }, |
|---|
| 281 | 'ObjectDriver' => undef, |
|---|
| 282 | 'AllowedTextFilters' => undef, |
|---|
| 283 | 'Serializer' => { default => 'MT', }, |
|---|
| 284 | 'SendMailPath' => { default => '/usr/lib/sendmail', }, |
|---|
| 285 | 'RsyncPath' => undef, |
|---|
| 286 | 'TimeOffset' => { default => 0, }, |
|---|
| 287 | 'WSSETimeout' => { default => 120, }, |
|---|
| 288 | 'StaticWebPath' => { default => '', }, |
|---|
| 289 | 'StaticFilePath' => undef, |
|---|
| 290 | 'CGIPath' => { default => '/cgi-bin/', }, |
|---|
| 291 | 'AdminCGIPath' => undef, |
|---|
| 292 | 'CookieDomain' => undef, |
|---|
| 293 | 'CookiePath' => undef, |
|---|
| 294 | 'MailEncoding' => { |
|---|
| 295 | default => 'ISO-8859-1', |
|---|
| 296 | }, |
|---|
| 297 | 'MailTransfer' => { default => 'sendmail' }, |
|---|
| 298 | 'SMTPServer' => { default => 'localhost', }, |
|---|
| 299 | 'DebugEmailAddress' => undef, |
|---|
| 300 | 'WeblogsPingURL' => { default => 'http://rpc.weblogs.com/RPC2', }, |
|---|
| 301 | 'BlogsPingURL' => { default => 'http://ping.blo.gs/', }, |
|---|
| 302 | 'MTPingURL' => { default => 'http://www.movabletype.org/update/', }, |
|---|
| 303 | 'TechnoratiPingURL' => |
|---|
| 304 | { default => 'http://rpc.technorati.com/rpc/ping', }, |
|---|
| 305 | 'GooglePingURL' => |
|---|
| 306 | { default => 'http://blogsearch.google.com/ping/RPC2', }, |
|---|
| 307 | 'CGIMaxUpload' => { default => 20_480_000 }, |
|---|
| 308 | 'DBUmask' => { default => '0111', }, |
|---|
| 309 | 'HTMLUmask' => { default => '0111', }, |
|---|
| 310 | 'UploadUmask' => { default => '0111', }, |
|---|
| 311 | 'DirUmask' => { default => '0000', }, |
|---|
| 312 | 'HTMLPerms' => { default => '0666', }, |
|---|
| 313 | 'UploadPerms' => { default => '0666', }, |
|---|
| 314 | 'NoTempFiles' => { default => 0, }, |
|---|
| 315 | 'TempDir' => { default => '/tmp', }, |
|---|
| 316 | 'RichTextEditor' => { default => 'archetype', }, |
|---|
| 317 | 'EntriesPerRebuild' => { default => 40, }, |
|---|
| 318 | 'UseNFSSafeLocking' => { default => 0, }, |
|---|
| 319 | 'NoLocking' => { default => 0, }, |
|---|
| 320 | 'NoHTMLEntities' => { default => 1, }, |
|---|
| 321 | 'NoCDATA' => { default => 0, }, |
|---|
| 322 | 'NoPlacementCache' => { default => 0, }, |
|---|
| 323 | 'NoPublishMeansDraft' => { default => 0, }, |
|---|
| 324 | 'IgnoreISOTimezones' => { default => 0, }, |
|---|
| 325 | 'PingTimeout' => { default => 60, }, |
|---|
| 326 | 'HTTPTimeout' => { default => 60 }, |
|---|
| 327 | 'PingInterface' => undef, |
|---|
| 328 | 'HTTPInterface' => undef, |
|---|
| 329 | 'PingProxy' => undef, |
|---|
| 330 | 'HTTPProxy' => undef, |
|---|
| 331 | 'PingNoProxy' => { default => 'localhost', }, |
|---|
| 332 | 'HTTPNoProxy' => { default => 'localhost', }, |
|---|
| 333 | 'ImageDriver' => { default => 'ImageMagick', }, |
|---|
| 334 | 'NetPBMPath' => undef, |
|---|
| 335 | 'AdminScript' => { default => 'mt.cgi', }, |
|---|
| 336 | 'ActivityFeedScript' => { default => 'mt-feed.cgi', }, |
|---|
| 337 | 'ActivityFeedItemLimit' => { default => 50, }, |
|---|
| 338 | 'CommentScript' => { default => 'mt-comments.cgi', }, |
|---|
| 339 | 'TrackbackScript' => { default => 'mt-tb.cgi', }, |
|---|
| 340 | 'SearchScript' => { default => 'mt-search.cgi', }, |
|---|
| 341 | 'XMLRPCScript' => { default => 'mt-xmlrpc.cgi', }, |
|---|
| 342 | 'ViewScript' => { default => 'mt-view.cgi', }, |
|---|
| 343 | 'AtomScript' => { default => 'mt-atom.cgi', }, |
|---|
| 344 | 'UpgradeScript' => { default => 'mt-upgrade.cgi', }, |
|---|
| 345 | 'CheckScript' => { default => 'mt-check.cgi', }, |
|---|
| 346 | 'NotifyScript' => { default => 'mt-add-notify.cgi', }, |
|---|
| 347 | 'PublishCharset' => { |
|---|
| 348 | default => 'utf-8', |
|---|
| 349 | }, |
|---|
| 350 | 'SafeMode' => { default => 1, }, |
|---|
| 351 | 'GlobalSanitizeSpec' => { |
|---|
| 352 | default => 'a href,b,i,br/,p,strong,em,ul,ol,li,blockquote,pre', |
|---|
| 353 | }, |
|---|
| 354 | 'GenerateTrackBackRSS' => { default => 0, }, |
|---|
| 355 | |
|---|
| 356 | ## Search settings, copied from Jay's mt-search and integrated |
|---|
| 357 | ## into default config. |
|---|
| 358 | 'NoOverride' => { default => '', }, |
|---|
| 359 | 'RegexSearch' => { default => 0, }, |
|---|
| 360 | 'CaseSearch' => { default => 0, }, |
|---|
| 361 | 'ResultDisplay' => { default => 'descend', }, |
|---|
| 362 | 'ExcerptWords' => { default => 40, }, |
|---|
| 363 | 'SearchElement' => { default => 'entries', }, |
|---|
| 364 | 'ExcludeBlogs' => undef, |
|---|
| 365 | 'IncludeBlogs' => undef, |
|---|
| 366 | 'DefaultTemplate' => { default => 'default.tmpl', }, |
|---|
| 367 | 'Type' => { default => 'straight', }, |
|---|
| 368 | 'MaxResults' => { default => '100', }, |
|---|
| 369 | 'SearchCutoff' => { default => '9999999', }, |
|---|
| 370 | 'CommentSearchCutoff' => { default => '30', }, |
|---|
| 371 | 'AltTemplate' => { |
|---|
| 372 | type => 'ARRAY', |
|---|
| 373 | default => 'feed results_feed.tmpl', |
|---|
| 374 | }, |
|---|
| 375 | 'SearchSortBy' => undef, |
|---|
| 376 | 'SearchSortOrder' => { default => 'ascend', }, |
|---|
| 377 | 'RegKeyURL' => |
|---|
| 378 | { default => 'http://www.typekey.com/extras/regkeys.txt', }, |
|---|
| 379 | 'IdentitySystem' => |
|---|
| 380 | { default => 'http://www.typekey.com/t/typekey', }, |
|---|
| 381 | 'SignOnURL' => |
|---|
| 382 | { default => 'https://www.typekey.com/t/typekey/login?', }, |
|---|
| 383 | 'SignOffURL' => |
|---|
| 384 | { default => 'https://www.typekey.com/t/typekey/logout?', }, |
|---|
| 385 | 'IdentityURL' => { default => "http://profile.typekey.com/", }, |
|---|
| 386 | 'DynamicComments' => { default => 0, }, |
|---|
| 387 | 'SignOnPublicKey' => { default => '', }, |
|---|
| 388 | 'ThrottleSeconds' => { default => 20, }, |
|---|
| 389 | 'SearchThrottleIPWhitelist' => undef, |
|---|
| 390 | 'OneHourMaxPings' => { default => 10, }, |
|---|
| 391 | 'OneDayMaxPings' => { default => 50, }, |
|---|
| 392 | 'SupportURL' => { |
|---|
| 393 | default => 'http://www.sixapart.com/movabletype/support/', |
|---|
| 394 | }, |
|---|
| 395 | 'NewsURL' => { |
|---|
| 396 | default => 'http://www.sixapart.com/movabletype/news/', |
|---|
| 397 | }, |
|---|
| 398 | 'NewsboxURL' => { |
|---|
| 399 | default => 'http://www.sixapart.com/movabletype/news/mt4_news_widget.html', |
|---|
| 400 | }, |
|---|
| 401 | # 'MTNewsURL' => { |
|---|
| 402 | # default => 'http://www.sixapart.com/movabletype/news/mt4_news_widget.html', |
|---|
| 403 | # }, |
|---|
| 404 | 'LearningNewsURL' => { |
|---|
| 405 | default => 'http://learning.movabletype.org/newsbox.html', |
|---|
| 406 | }, |
|---|
| 407 | # 'HackingNewsURL' => { |
|---|
| 408 | # default => 'http://hacking.movabletype.org/newsbox.html', |
|---|
| 409 | # }, |
|---|
| 410 | 'EmailAddressMain' => undef, |
|---|
| 411 | 'EmailReplyTo' => undef, |
|---|
| 412 | 'EmailNotificationBcc' => { default => 1, }, |
|---|
| 413 | 'CommentSessionTimeout' => { default => 60 * 60 * 24 * 3, }, |
|---|
| 414 | 'UserSessionTimeout' => { default => 60 * 60 * 4, }, |
|---|
| 415 | 'LaunchBackgroundTasks' => { default => 0 }, |
|---|
| 416 | 'TypeKeyVersion' => { default => '1.1' }, |
|---|
| 417 | 'TransparentProxyIPs' => { default => 0, }, |
|---|
| 418 | 'DebugMode' => { default => 0, }, |
|---|
| 419 | 'ShowIPInformation' => { default => 0, }, |
|---|
| 420 | 'AllowComments' => { default => 1, }, |
|---|
| 421 | 'AllowPings' => { default => 1, }, |
|---|
| 422 | 'HelpURL' => undef, |
|---|
| 423 | #'HelpURL' => { |
|---|
| 424 | # default => 'http://www.sixapart.com/movabletype/docs/4.0/', |
|---|
| 425 | #}, |
|---|
| 426 | 'UsePlugins' => { default => 1, }, |
|---|
| 427 | 'PluginSwitch' => { type => 'HASH', }, |
|---|
| 428 | 'PluginSchemaVersion' => { type => 'HASH', }, |
|---|
| 429 | 'OutboundTrackbackLimit' => { default => 'any', }, |
|---|
| 430 | 'OutboundTrackbackDomains' => { type => 'ARRAY', }, |
|---|
| 431 | 'IndexBasename' => { default => 'index', }, |
|---|
| 432 | 'LogExportEncoding' => { |
|---|
| 433 | default => 'utf-8', |
|---|
| 434 | }, |
|---|
| 435 | 'ActivityFeedsRunTasks' => { default => 1, }, |
|---|
| 436 | 'ExportEncoding' => { |
|---|
| 437 | default => 'utf-8', |
|---|
| 438 | }, |
|---|
| 439 | 'SQLSetNames' => undef, |
|---|
| 440 | 'UseSQLite2' => { default => 0, }, |
|---|
| 441 | 'UseJcodeModule' => { default => 0, }, |
|---|
| 442 | 'DefaultTimezone' => { |
|---|
| 443 | default => '0', |
|---|
| 444 | }, |
|---|
| 445 | 'CategoryNameNodash' => { |
|---|
| 446 | default => '0', |
|---|
| 447 | }, |
|---|
| 448 | 'DefaultListPrefs' => { |
|---|
| 449 | type => 'HASH', |
|---|
| 450 | }, |
|---|
| 451 | 'DefaultEntryPrefs' => { |
|---|
| 452 | type => 'HASH', |
|---|
| 453 | default => { |
|---|
| 454 | type => 'Default', # Default|All|Custom |
|---|
| 455 | button => 'Below', # Above|Below|Both |
|---|
| 456 | height => 162, # textarea height |
|---|
| 457 | }, |
|---|
| 458 | }, |
|---|
| 459 | 'DeleteFilesAtRebuild' => { default => 1, }, |
|---|
| 460 | 'MaxTagAutoCompletionItems' => { default => 10000, }, |
|---|
| 461 | 'NewUserAutoProvisioning' => |
|---|
| 462 | { handler => \&NewUserAutoProvisioning, }, |
|---|
| 463 | 'NewUserTemplateBlogId' => undef, |
|---|
| 464 | 'DefaultUserLanguage' => undef, |
|---|
| 465 | 'DefaultUserTagDelimiter' => { |
|---|
| 466 | handler => \&DefaultUserTagDelimiter, |
|---|
| 467 | default => 'comma', |
|---|
| 468 | }, |
|---|
| 469 | 'AuthenticationModule' => { default => 'MT', }, |
|---|
| 470 | 'AuthLoginURL' => undef, |
|---|
| 471 | 'AuthLogoutURL' => undef, |
|---|
| 472 | 'DefaultAssignments' => undef, |
|---|
| 473 | 'AutoSaveFrequency' => { default => 5 }, |
|---|
| 474 | 'FuturePostFrequency' => { default => 1 }, |
|---|
| 475 | 'AssetCacheDir' => { default => 'assets_c', }, |
|---|
| 476 | 'MemcachedServers' => { type => 'ARRAY', }, |
|---|
| 477 | 'MemcachedNamespace' => undef, |
|---|
| 478 | 'MemcachedDriver' => { default => 'Cache::Memcached' }, |
|---|
| 479 | 'CommenterRegistration' => { |
|---|
| 480 | type => 'HASH', |
|---|
| 481 | default => { |
|---|
| 482 | Allow => '1', |
|---|
| 483 | Notify => q(), |
|---|
| 484 | }, |
|---|
| 485 | }, |
|---|
| 486 | 'CaptchaSourceImageBase' => undef, |
|---|
| 487 | 'SecretToken' => { handler => \&SecretToken, }, |
|---|
| 488 | ## NaughtyWordChars settings |
|---|
| 489 | 'NwcSmartReplace' => { default => 0, }, |
|---|
| 490 | 'NwcReplaceField' => |
|---|
| 491 | { default => 'title,text,text_more,keywords,excerpt,tags', }, |
|---|
| 492 | 'DisableNotificationPings' => { default => 0 }, |
|---|
| 493 | 'SyncTarget' => { type => 'ARRAY' }, |
|---|
| 494 | 'RsyncOptions' => undef, |
|---|
| 495 | 'UserpicAllowRect' => { default => 0 }, |
|---|
| 496 | 'UserpicMaxUpload' => { default => 0 }, |
|---|
| 497 | 'UserpicThumbnailSize' => { default => 100 }, |
|---|
| 498 | |
|---|
| 499 | 'PerformanceLogging' => { default => 0 }, |
|---|
| 500 | 'PerformanceLoggingThreshold' => { default => 0.1 }, |
|---|
| 501 | 'PerformanceLoggingPath' => { handler => \&PerformanceLoggingPath }, |
|---|
| 502 | 'ProcessMemoryCommand' => { handler => \&ProcessMemoryCommand }, |
|---|
| 503 | }, |
|---|
| 504 | upgrade_functions => \&load_upgrade_fns, |
|---|
| 505 | applications => { |
|---|
| 506 | 'xmlrpc' => { handler => 'MT::XMLRPCServer', }, |
|---|
| 507 | 'atom' => { handler => 'MT::AtomServer', }, |
|---|
| 508 | 'feeds' => { handler => 'MT::App::ActivityFeeds', }, |
|---|
| 509 | 'view' => { handler => 'MT::App::Viewer', }, |
|---|
| 510 | 'notify' => { handler => 'MT::App::NotifyList', }, |
|---|
| 511 | 'tb' => { handler => 'MT::App::Trackback', }, |
|---|
| 512 | 'upgrade' => { handler => 'MT::App::Upgrade', }, |
|---|
| 513 | 'wizard' => { handler => 'MT::App::Wizard', }, |
|---|
| 514 | 'comments' => { handler => 'MT::App::Comments', }, |
|---|
| 515 | 'search' => { |
|---|
| 516 | handler => 'MT::App::Search', |
|---|
| 517 | tags => sub { MT->app->load_core_tags }, |
|---|
| 518 | }, |
|---|
| 519 | 'cms' => { |
|---|
| 520 | handler => 'MT::App::CMS', |
|---|
| 521 | cgi_base => 'mt', |
|---|
| 522 | page_actions => sub { MT->app->core_page_actions(@_) }, |
|---|
| 523 | list_actions => sub { MT->app->core_list_actions(@_) }, |
|---|
| 524 | list_filters => sub { MT->app->core_list_filters(@_) }, |
|---|
| 525 | search_apis => sub { MT->app->core_search_apis(@_) }, |
|---|
| 526 | menus => sub { MT->app->core_menus() }, |
|---|
| 527 | methods => sub { MT->app->core_methods() }, |
|---|
| 528 | widgets => sub { MT->app->core_widgets() }, |
|---|
| 529 | blog_stats_tabs => sub { MT->app->core_blog_stats_tabs() }, |
|---|
| 530 | import_formats => sub { |
|---|
| 531 | require MT::Import; |
|---|
| 532 | return MT::Import->core_import_formats(); |
|---|
| 533 | }, |
|---|
| 534 | }, |
|---|
| 535 | }, |
|---|
| 536 | archive_types => \&load_archive_types, |
|---|
| 537 | tags => \&load_core_tags, |
|---|
| 538 | text_filters => { |
|---|
| 539 | '__default__' => { |
|---|
| 540 | label => 'Convert Line Breaks', |
|---|
| 541 | handler => 'MT::Util::html_text_transform', |
|---|
| 542 | }, |
|---|
| 543 | 'richtext' => { |
|---|
| 544 | label => 'Rich Text', |
|---|
| 545 | handler => 'MT::Util::rich_text_transform', |
|---|
| 546 | condition => sub { |
|---|
| 547 | my ($type) = @_; |
|---|
| 548 | return 1 if $type && ($type ne 'comment'); |
|---|
| 549 | }, |
|---|
| 550 | }, |
|---|
| 551 | }, |
|---|
| 552 | richtext_editors => { |
|---|
| 553 | 'archetype' => { |
|---|
| 554 | label => 'Movable Type Default', |
|---|
| 555 | template => 'archetype_editor.tmpl', |
|---|
| 556 | }, |
|---|
| 557 | }, |
|---|
| 558 | ping_servers => { |
|---|
| 559 | 'weblogs' => { |
|---|
| 560 | label => 'weblogs.com', |
|---|
| 561 | url => 'http://rpc.weblogs.com/RPC2', |
|---|
| 562 | }, |
|---|
| 563 | 'technorati' => { |
|---|
| 564 | label => 'technorati.com', |
|---|
| 565 | url => 'http://rpc.technorati.com/rpc/ping', |
|---|
| 566 | }, |
|---|
| 567 | 'google' => { |
|---|
| 568 | label => 'google.com', |
|---|
| 569 | url => 'http://blogsearch.google.com/ping/RPC2', |
|---|
| 570 | }, |
|---|
| 571 | }, |
|---|
| 572 | commenter_authenticators => \&load_core_commenter_auth, |
|---|
| 573 | captcha_providers => \&load_captcha_providers, |
|---|
| 574 | tasks => \&load_core_tasks, |
|---|
| 575 | default_templates => \&load_default_templates, |
|---|
| 576 | template_sets => { |
|---|
| 577 | mt_blog => { |
|---|
| 578 | label => "Classic Blog", |
|---|
| 579 | order => 100, |
|---|
| 580 | # means, load from 'default_templates' registry |
|---|
| 581 | # which we've established for core templates with |
|---|
| 582 | # the MT 4.0 registry |
|---|
| 583 | templates => '*', |
|---|
| 584 | }, |
|---|
| 585 | }, |
|---|
| 586 | junk_filters => \&load_junk_filters, |
|---|
| 587 | task_workers => { |
|---|
| 588 | 'mt_rebuild' => { |
|---|
| 589 | label => "Publishes content.", |
|---|
| 590 | class => 'MT::Worker::Publish', |
|---|
| 591 | }, |
|---|
| 592 | 'mt_sync' => { |
|---|
| 593 | label => "Synchronizes content to other server(s).", |
|---|
| 594 | class => 'MT::Worker::Sync', |
|---|
| 595 | }, |
|---|
| 596 | }, |
|---|
| 597 | archivers => { |
|---|
| 598 | 'zip' => { |
|---|
| 599 | class => 'MT::Util::Archive::Zip', |
|---|
| 600 | label => 'zip', |
|---|
| 601 | }, |
|---|
| 602 | 'tgz' => { |
|---|
| 603 | class => 'MT::Util::Archive::Tgz', |
|---|
| 604 | label => 'tar.gz', |
|---|
| 605 | }, |
|---|
| 606 | }, |
|---|
| 607 | template_snippets => { |
|---|
| 608 | 'insert_entries' => { |
|---|
| 609 | trigger => 'entries', |
|---|
| 610 | label => 'Entries List', |
|---|
| 611 | content => qq{<mt:Entries lastn="10">\n \$0\n</mt:Entries>\n}, |
|---|
| 612 | }, |
|---|
| 613 | 'blog_url' => { |
|---|
| 614 | trigger => 'blogurl', |
|---|
| 615 | label => 'Blog URL', |
|---|
| 616 | content => '<$mt:BlogURL$>$0', |
|---|
| 617 | }, |
|---|
| 618 | 'blog_id' => { |
|---|
| 619 | trigger => 'blogid', |
|---|
| 620 | label => 'Blog ID', |
|---|
| 621 | content => '<$mt:BlogID$>$0', |
|---|
| 622 | }, |
|---|
| 623 | 'blog_name' => { |
|---|
| 624 | trigger => 'blogname', |
|---|
| 625 | label => 'Blog Name', |
|---|
| 626 | content => '<$mt:BlogName$>$0', |
|---|
| 627 | }, |
|---|
| 628 | 'entry_body' => { |
|---|
| 629 | trigger => 'entrybody', |
|---|
| 630 | label => 'Entry Body', |
|---|
| 631 | content => '<$mt:EntryBody$>$0', |
|---|
| 632 | }, |
|---|
| 633 | 'entry_excerpt' => { |
|---|
| 634 | trigger => 'entryexcerpt', |
|---|
| 635 | label => 'Entry Excerpt', |
|---|
| 636 | content => '<$mt:EntryExcerpt$>$0', |
|---|
| 637 | }, |
|---|
| 638 | 'entry_link' => { |
|---|
| 639 | trigger => 'entrylink', |
|---|
| 640 | label => 'Entry Link', |
|---|
| 641 | content => '<$mt:EntryLink$>$0', |
|---|
| 642 | }, |
|---|
| 643 | 'entry_more' => { |
|---|
| 644 | trigger => 'entrymore', |
|---|
| 645 | label => 'Entry Extended Text', |
|---|
| 646 | content => '<$mt:EntryMore$>$0', |
|---|
| 647 | }, |
|---|
| 648 | 'entry_title' => { |
|---|
| 649 | trigger => 'entrytitle', |
|---|
| 650 | label => 'Entry Title', |
|---|
| 651 | content => '<$mt:EntryTitle$>$0', |
|---|
| 652 | }, |
|---|
| 653 | 'if' => { |
|---|
| 654 | trigger => 'mtif', |
|---|
| 655 | label => 'If Block', |
|---|
| 656 | content => qq{<mt:if name="variable">\n \$0\n</mt:if>\n}, |
|---|
| 657 | }, |
|---|
| 658 | 'if_else' => { |
|---|
| 659 | trigger => 'mtife', |
|---|
| 660 | label => 'If/Else Block', |
|---|
| 661 | content => qq{<mt:if name="variable">\n \$0\n<mt:else>\n\n</mt:if>\n}, |
|---|
| 662 | }, |
|---|
| 663 | 'include_module' => { |
|---|
| 664 | trigger => 'module', |
|---|
| 665 | label => 'Include Template Module', |
|---|
| 666 | content => '<$mt:Include module="$0"$>', |
|---|
| 667 | }, |
|---|
| 668 | 'include_file' => { |
|---|
| 669 | trigger => 'file', |
|---|
| 670 | label => 'Include Template File', |
|---|
| 671 | content => '<$mt:Include file="$0"$>', |
|---|
| 672 | }, |
|---|
| 673 | 'getvar' => { |
|---|
| 674 | trigger => 'get', |
|---|
| 675 | label => 'Get Variable', |
|---|
| 676 | content => '<$mt:var name="$0"$>', |
|---|
| 677 | }, |
|---|
| 678 | 'setvar' => { |
|---|
| 679 | trigger => 'set', |
|---|
| 680 | label => 'Set Variable', |
|---|
| 681 | content => '<$mt:var name="$0" value="value"$>', |
|---|
| 682 | }, |
|---|
| 683 | 'setvarblock' => { |
|---|
| 684 | trigger => 'setb', |
|---|
| 685 | label => 'Set Variable Block', |
|---|
| 686 | content => qq{<mt:SetVarBlock name="variable">\n \$0\n</mt:SetVarBlock>\n}, |
|---|
| 687 | }, |
|---|
| 688 | }, |
|---|
| 689 | }; |
|---|
| 690 | } |
|---|
| 691 | |
|---|
| 692 | sub id { |
|---|
| 693 | return 'core'; |
|---|
| 694 | } |
|---|
| 695 | |
|---|
| 696 | sub load_junk_filters { |
|---|
| 697 | require MT::JunkFilter; |
|---|
| 698 | return MT::JunkFilter->core_filters; |
|---|
| 699 | } |
|---|
| 700 | |
|---|
| 701 | sub load_core_tasks { |
|---|
| 702 | my $cfg = MT->config; |
|---|
| 703 | return { |
|---|
| 704 | 'FuturePost' => { |
|---|
| 705 | label => 'Publish Scheduled Entries', |
|---|
| 706 | frequency => $cfg->FuturePostFrequency * 60, # once per minute |
|---|
| 707 | code => sub { |
|---|
| 708 | MT->instance->publisher->publish_future_posts; |
|---|
| 709 | } |
|---|
| 710 | }, |
|---|
| 711 | 'JunkExpiration' => { |
|---|
| 712 | label => 'Junk Folder Expiration', |
|---|
| 713 | frequency => 12 * 60 * 60, # no more than every 12 hours |
|---|
| 714 | code => sub { |
|---|
| 715 | require MT::JunkFilter; |
|---|
| 716 | MT::JunkFilter->task_expire_junk; |
|---|
| 717 | }, |
|---|
| 718 | }, |
|---|
| 719 | 'CleanTemporaryFiles' => { |
|---|
| 720 | label => 'Remove Temporary Files', |
|---|
| 721 | frequency => 60 * 60, # once per hour |
|---|
| 722 | code => sub { |
|---|
| 723 | MT::Core->remove_temporary_files; |
|---|
| 724 | }, |
|---|
| 725 | }, |
|---|
| 726 | 'RemoveExpiredUserSessions' => { |
|---|
| 727 | label => 'Remove Expired User Sessions', |
|---|
| 728 | frequency => 60 * 60 * 24, # once a day |
|---|
| 729 | code => sub { |
|---|
| 730 | MT::Core->remove_expired_sessions; |
|---|
| 731 | }, |
|---|
| 732 | }, |
|---|
| 733 | }; |
|---|
| 734 | } |
|---|
| 735 | |
|---|
| 736 | sub remove_temporary_files { |
|---|
| 737 | require MT::Session; |
|---|
| 738 | |
|---|
| 739 | my @files = MT::Session->load( |
|---|
| 740 | { kind => 'TF', start => [ undef, time - 60 * 60 ] }, |
|---|
| 741 | { range => { start => 1 } } ); |
|---|
| 742 | my $fmgr = MT::FileMgr->new('Local'); |
|---|
| 743 | foreach my $f (@files) { |
|---|
| 744 | if ($fmgr->delete($f->name)) { |
|---|
| 745 | $f->remove; |
|---|
| 746 | } |
|---|
| 747 | } |
|---|
| 748 | # This is a silent task; no need to log removal of temporary files |
|---|
| 749 | return ''; |
|---|
| 750 | } |
|---|
| 751 | |
|---|
| 752 | sub remove_expired_sessions { |
|---|
| 753 | require MT::Session; |
|---|
| 754 | |
|---|
| 755 | my $expired = MT->config->UserSessionTimeout; |
|---|
| 756 | my @sesss = MT::Session->load( |
|---|
| 757 | { kind => 'US', start => [ undef, time - $expired ] }, |
|---|
| 758 | { range => { start => 1 } } ); |
|---|
| 759 | foreach my $s (@sesss) { |
|---|
| 760 | $s->remove if !$s->get('remember'); |
|---|
| 761 | } |
|---|
| 762 | return ''; |
|---|
| 763 | } |
|---|
| 764 | |
|---|
| 765 | sub load_default_templates { |
|---|
| 766 | require MT::DefaultTemplates; |
|---|
| 767 | return MT::DefaultTemplates->core_default_templates; |
|---|
| 768 | } |
|---|
| 769 | |
|---|
| 770 | sub load_captcha_providers { |
|---|
| 771 | return MT->core_captcha_providers; |
|---|
| 772 | } |
|---|
| 773 | |
|---|
| 774 | sub load_core_commenter_auth { |
|---|
| 775 | return MT->core_commenter_authenticators; |
|---|
| 776 | } |
|---|
| 777 | |
|---|
| 778 | sub load_core_tags { |
|---|
| 779 | require MT::Template::ContextHandlers; |
|---|
| 780 | return MT::Template::Context::core_tags(); |
|---|
| 781 | } |
|---|
| 782 | |
|---|
| 783 | sub load_upgrade_fns { |
|---|
| 784 | require MT::Upgrade; |
|---|
| 785 | return MT::Upgrade->core_upgrade_functions; |
|---|
| 786 | } |
|---|
| 787 | |
|---|
| 788 | sub l10n_class { 'MT::L10N' } |
|---|
| 789 | |
|---|
| 790 | sub init_registry { |
|---|
| 791 | my $c = shift; |
|---|
| 792 | return $c->{registry} = $core_registry; |
|---|
| 793 | } |
|---|
| 794 | |
|---|
| 795 | # Config handlers for these settings... |
|---|
| 796 | |
|---|
| 797 | sub load_archive_types { |
|---|
| 798 | require MT::WeblogPublisher; |
|---|
| 799 | return MT::WeblogPublisher->core_archive_types; |
|---|
| 800 | } |
|---|
| 801 | |
|---|
| 802 | sub PerformanceLoggingPath { |
|---|
| 803 | my $cfg = shift; |
|---|
| 804 | $cfg->set_internal( 'PerformanceLoggingPath', @_ ) if @_; |
|---|
| 805 | my $path = $cfg->get_internal('PerformanceLoggingPath'); |
|---|
| 806 | unless (defined $path) { |
|---|
| 807 | require File::Spec; |
|---|
| 808 | $path = File::Spec->catdir( MT->instance->static_file_path, |
|---|
| 809 | 'support', 'logs'); |
|---|
| 810 | $cfg->set_internal('PerformanceLoggingPath', $path); |
|---|
| 811 | } |
|---|
| 812 | return $path; |
|---|
| 813 | } |
|---|
| 814 | |
|---|
| 815 | sub ProcessMemoryCommand { |
|---|
| 816 | my $cfg = shift; |
|---|
| 817 | $cfg->set_internal( 'ProcessMemoryCommand', @_ ) if @_; |
|---|
| 818 | my $cmd = $cfg->get_internal('ProcessMemoryCommand'); |
|---|
| 819 | unless (defined $cmd) { |
|---|
| 820 | my $os = $^O; |
|---|
| 821 | if ($os eq 'darwin') { |
|---|
| 822 | $cmd = 'ps $$ -o rss='; |
|---|
| 823 | } |
|---|
| 824 | elsif ($os eq 'linux') { |
|---|
| 825 | $cmd = 'ps -p $$ -o rss='; |
|---|
| 826 | } |
|---|
| 827 | elsif ($os eq 'MSWin32') { |
|---|
| 828 | $cmd = { command => q{tasklist /FI "PID eq $$" /FO TABLE /NH}, |
|---|
| 829 | regex => qr/([\d,]+) K/ }; |
|---|
| 830 | } |
|---|
| 831 | } |
|---|
| 832 | return $cmd; |
|---|
| 833 | } |
|---|
| 834 | |
|---|
| 835 | sub SecretToken { |
|---|
| 836 | my $cfg = shift; |
|---|
| 837 | $cfg->set_internal( 'SecretToken', @_ ) if @_; |
|---|
| 838 | my $secret = $cfg->get_internal('SecretToken'); |
|---|
| 839 | unless ($secret) { |
|---|
| 840 | my @alpha = ( 'a' .. 'z', 'A' .. 'Z', 0 .. 9 ); |
|---|
| 841 | $secret = join '', map $alpha[ rand @alpha ], 1 .. 40; |
|---|
| 842 | $secret = $cfg->set_internal( 'SecretToken', $secret, 1 ); |
|---|
| 843 | $cfg->save_config(); |
|---|
| 844 | } |
|---|
| 845 | return $secret; |
|---|
| 846 | } |
|---|
| 847 | |
|---|
| 848 | sub DefaultUserTagDelimiter { |
|---|
| 849 | my $mgr = shift; |
|---|
| 850 | return $mgr->set_internal( 'DefaultUserTagDelimiter', @_ ) if @_; |
|---|
| 851 | my $delim = $mgr->get_internal('DefaultUserTagDelimiter'); |
|---|
| 852 | if ( lc $delim eq 'comma' ) { |
|---|
| 853 | return ord(','); |
|---|
| 854 | } |
|---|
| 855 | elsif ( lc $delim eq 'space' ) { |
|---|
| 856 | return ord(' '); |
|---|
| 857 | } |
|---|
| 858 | else { |
|---|
| 859 | return ord(','); |
|---|
| 860 | } |
|---|
| 861 | } |
|---|
| 862 | |
|---|
| 863 | sub NewUserAutoProvisioning { |
|---|
| 864 | my $mgr = shift; |
|---|
| 865 | return $mgr->set_internal( 'NewUserAutoProvisioning', @_ ) if @_; |
|---|
| 866 | return 0 unless $mgr->DefaultSiteRoot && $mgr->DefaultSiteURL; |
|---|
| 867 | $mgr->get_internal('NewUserAutoProvisioning'); |
|---|
| 868 | } |
|---|
| 869 | |
|---|
| 870 | 1; |
|---|