LJSUP-17669: Login.bml form refactoring
[livejournal.git] / cgi-bin / ljdefaults.pl
blob6127a68e5986fa01b9f1da451f45b240a05df9ec
1 package LJ;
2 use strict;
4 # Do not edit this file. You should edit ljconfig.pl, which you should have at
5 # cgi-bin/ljconfig.pl. If you don't, copy it from doc/ljconfig.pl.txt to cgi-bin
6 # and edit it there. This file only provides backup default values for upgrading.
10 package LJ;
11 use Sys::Hostname ();
13 $LJ::DEFAULT_STYLE ||= {
14 'core' => 'core1',
15 'layout' => 'generator/layout',
16 'i18n' => 'generator/en',
19 $LJ::HOME = $ENV{'LJHOME'};
20 $LJ::HTDOCS = "$LJ::HOME/htdocs";
21 $LJ::SSLDOCS ||= "$LJ::HOME/ssldocs";
22 $LJ::BIN = "$LJ::HOME/bin";
24 $LJ::SERVER_NAME ||= Sys::Hostname::hostname();
26 $LJ::UNICODE = 1 unless defined $LJ::UNICODE;
28 @LJ::LANGS = ("en") unless @LJ::LANGS;
29 $LJ::DEFAULT_LANG ||= $LJ::LANGS[0];
31 $LJ::SITENAME ||= "NameNotConfigured.com";
32 unless ($LJ::SITENAMESHORT) {
33 $LJ::SITENAMESHORT = $LJ::SITENAME;
34 $LJ::SITENAMESHORT =~ s/\..*//; # remove .net/.com/etc
36 $LJ::SITENAMEABBREV ||= "[??]";
38 $LJ::MSG_READONLY_USER ||= "Database temporarily in read-only mode during maintenance.";
40 $LJ::DOMAIN_WEB ||= "www.$LJ::DOMAIN";
41 $LJ::SITEROOT ||= "http://$LJ::DOMAIN_WEB";
42 $LJ::IMGPREFIX ||= "$LJ::SITEROOT/img";
43 $LJ::STATPREFIX ||= "$LJ::SITEROOT/stc";
44 $LJ::WSTATPREFIX ||= "$LJ::SITEROOT/stc";
45 $LJ::JSPREFIX ||= "$LJ::SITEROOT/js";
46 $LJ::USERPIC_ROOT ||= "$LJ::SITEROOT/userpic";
47 $LJ::PALIMGROOT ||= "$LJ::SITEROOT/palimg";
49 # path to sendmail and any necessary options
50 $LJ::SENDMAIL ||= "/usr/sbin/sendmail -t -oi";
52 # protocol, mailserver hostname, and preferential weight.
53 # qmtp, smtp, dmtp, and sendmail are the currently supported protocols.
54 @LJ::MAIL_TRANSPORTS = ( [ 'sendmail', $LJ::SENDMAIL, 1 ] ) unless @LJ::MAIL_TRANSPORTS;
56 # roles that slow support queries should use in order of precedence
57 @LJ::SUPPORT_SLOW_ROLES = ('slow') unless @LJ::SUPPORT_SLOW_ROLES;
59 # where we set the cookies (note the period before the domain)
60 $LJ::COOKIE_DOMAIN ||= ".$LJ::DOMAIN";
61 $LJ::COOKIE_PATH ||= "/";
62 @LJ::COOKIE_DOMAIN_RESET = ("", "$LJ::DOMAIN", ".$LJ::DOMAIN") unless @LJ::COOKIE_DOMAIN_RESET;
64 $LJ::MAX_SCROLLBACK_LASTN ||= 100;
65 $LJ::MAX_SCROLLBACK_FRIENDS ||= 1000;
66 $LJ::MAX_USERPIC_KEYWORDS ||= 10;
68 $LJ::AUTOSAVE_DRAFT_INTERVAL ||= 3;
70 # this option can be a boolean or a URL, but internally we want a URL
71 # (which can also be a boolean)
72 if ($LJ::OPENID_SERVER && $LJ::OPENID_SERVER eq 1) {
73 $LJ::OPENID_SERVER = "$LJ::SITEROOT/openid/server.bml";
76 # set default capability limits if the site maintainer hasn't.
78 my %defcap = (
79 'checkfriends' => 1,
80 'checkfriends_interval' => 60,
81 'friendsviewupdate' => 30,
82 'makepoll' => 1,
83 'maxfriends' => 500,
84 'moodthemecreate' => 1,
85 'styles' => 1,
86 's2styles' => 1,
87 's2props' => 1,
88 's2viewentry' => 1,
89 's2viewreply' => 1,
90 's2stylesmax' => 10,
91 's2layersmax' => 50,
92 'textmessage' => 1,
93 'todomax' => 100,
94 'todosec' => 1,
95 'userdomain' => 0,
96 'domainmap' => 0,
97 'useremail' => 0,
98 'userpics' => 5,
99 'findsim' => 1,
100 'full_rss' => 1,
101 'can_post' => 1,
102 'get_comments' => 1,
103 'leave_comments' => 1,
104 'mod_queue' => 250,
105 'mod_queue_per_poster' => 1,
106 'weblogscom' => 0,
107 'hide_email_after' => 0,
108 'userlinks' => 5,
109 'maxcomments' => 10000,
110 'maxcomments-before-captcha' => 5000,
111 'rateperiod-lostinfo' => 24*60, # 24 hours
112 'rateallowed-lostinfo' => 5,
113 'tools_recent_comments_display' => 50,
114 'rateperiod-invitefriend' => 60, # 1 hour
115 'rateallowed-invitefriend' => 20,
116 'subscriptions' => 25,
117 'usermessage_length' => 5000,
119 foreach my $k (keys %defcap) {
120 next if (defined $LJ::CAP_DEF{$k});
121 $LJ::CAP_DEF{$k} = $defcap{$k};
125 # FIXME: should forcibly limit userlinks to 255 (tinyint)
127 # set default userprop limits if site maintainer hasn't
129 my %defuser = (
130 's1_lastn_style' => 'lastn/Generator',
131 's1_friends_style' => 'friends/Generator',
132 's1_calendar_style' => 'calendar/Generator',
133 's1_day_style' => 'day/Generator',
135 foreach my $k (keys %defuser) {
136 next if (defined $LJ::USERPROP_DEF{$k});
137 $LJ::USERPROP_DEF{$k} = $defuser{$k};
141 # Send community invites from the admin address unless otherwise specified
142 $LJ::COMMUNITY_EMAIL ||= $LJ::ADMIN_EMAIL;
144 # The list of content types that we consider valid for gzip compression.
145 %LJ::GZIP_OKAY = (
146 'text/html' => 1, # regular web pages; XHTML 1.0 "may" be this
147 'text/xml' => 1, # regular XML files
148 'application/xml' => 1, # XHTML 1.1 "may" be this
149 'application/xhtml+xml' => 1, # XHTML 1.1 "should" be this
150 'application/rdf+xml' => 1, # FOAF should be this
151 'application/json' => 1,
152 'application/javascript' => 1,
153 ) unless %LJ::GZIP_OKAY;
155 # maximum FOAF friends to return (so the server doesn't get overloaded)
156 $LJ::MAX_FOAF_FRIENDS ||= 1000;
158 # maximum number of friendofs to load/memcache (affects userinfo.bml display)
159 $LJ::MAX_FRIENDOF_LOAD ||= 5000;
161 # whether to proactively delete any comments associated with an entry when we assign
162 # a new jitemid (see the big comment above LJ::Protocol::new_entry_cleanup_hack)
163 $LJ::NEW_ENTRY_CLEANUP_HACK ||= 0;
165 # block size is used in stats generation code that gets n rows from the db at a time
166 $LJ::STATS_BLOCK_SIZE ||= 10_000;
168 # Maximum number of comments to display on Recent Comments page
169 $LJ::TOOLS_RECENT_COMMENTS_MAX ||= 50;
171 # Default to allow all reproxying.
172 %LJ::REPROXY_DISABLE = () unless %LJ::REPROXY_DISABLE;
174 # Default error message for age verification needed
175 $LJ::UNDERAGE_ERROR ||= "Sorry, your account needs to be <a href='$LJ::SITEROOT/agecheck/'>age verified</a> before you can leave any comments.";
177 # Terms of Service revision requirements
178 foreach (
179 [ rev => '0.0' ],
180 [ title => 'Terms of Service agreement required' ],
181 [ html => '' ],
182 [ text => '' ]
185 $LJ::REQUIRED_TOS{$_->[0]} = $_->[1]
186 unless defined $LJ::REQUIRED_TOS{$_->[0]};
189 # setup default minimal style information
190 $LJ::MINIMAL_USERAGENT{$_} ||= 1 foreach qw(Links Lynx w BlackBerry WebTV); # w is for w3m
191 $LJ::MINIMAL_BML_SCHEME ||= 'lynx';
192 $LJ::MINIMAL_STYLE{'core'} ||= 'core1';
194 $LJ::S2COMPILED_MIGRATION_DONE ||= 0; # turn on after s2compiled2 migration
196 # max limit of schools attended
197 $LJ::SCHOOLSMAX ||= {
198 'P' => 25,
199 'I' => 25,
200 'S' => 25,
201 'C' => 50,
204 # max content length we should read via ATOM api
205 # 25MB
206 $LJ::MAX_ATOM_UPLOAD ||= 26214400;
208 $LJ::CAPTCHA_AUDIO_MAKE ||= 100;
209 $LJ::CAPTCHA_AUDIO_PREGEN ||= 100;
210 $LJ::CAPTCHA_IMAGE_PREGEN ||= 500;
211 $LJ::CAPTCHA_IMAGE_RAW ||= "$LJ::HOME/htdocs/img/captcha";
213 $LJ::DEFAULT_EDITOR ||= 'rich';
215 # Portal boxes
216 unless(scalar(@LJ::PORTAL_BOXES)) {
217 @LJ::PORTAL_BOXES = (
218 'Birthdays',
219 'UpdateJournal',
220 'TextMessage',
221 'PopWithFriends',
222 'Friends',
223 'Manage',
224 'RecentComments',
225 'NewUser',
226 'FriendsPage',
227 'FAQ',
228 'Debug',
229 'Note',
230 'RandomUser',
231 'Tags',
232 'Reader',
236 unless(scalar(@LJ::PORTAL_BOXES_HIDDEN)) {
237 @LJ::PORTAL_BOXES_HIDDEN = (
238 'Debug',
242 unless (keys %LJ::PORTAL_DEFAULTBOXSTATES) {
243 %LJ::PORTAL_DEFAULTBOXSTATES = (
244 'Birthdays' => {
245 'added' => 1,
246 'sort' => 4,
247 'col' => 'R',
249 'FriendsPage' => {
250 'added' => 1,
251 'sort' => 6,
252 'col' => 'L',
254 'FAQ' => {
255 'added' => 1,
256 'sort' => 8,
257 'col' => 'R',
259 'Friends' => {
260 'added' => 1,
261 'sort' => 10,
262 'col' => 'R',
264 'Manage' => {
265 'added' => 1,
266 'sort' => 12,
267 'col' => 'L',
269 'PopWithFriends' => {
270 'added' => 0,
271 'col' => 'R',
273 'RecentComments' => {
274 'added' => 1,
275 'sort' => 10,
276 'col' => 'L',
278 'UpdateJournal' => {
279 'added' => 1,
280 'sort' => 4,
281 'col' => 'L',
283 'NewUser' => {
284 'added' => 1,
285 'sort' => 2,
286 'col' => 'L',
288 'TextMessage' => {
289 'added' => 1,
290 'sort' => 12,
291 'col' => 'R',
293 'Frank' => {
294 'notunique' => 1,
296 'Note' => {
297 'notunique' => 1,
299 'Reader' => {
300 'notunique' => 1,
305 unless (@LJ::EVENT_TYPES) {
306 @LJ::EVENT_TYPES = qw (
307 Befriended
308 Birthday
309 JournalNewComment
310 JournalNewEntry
311 UserNewComment
312 UserNewEntry
313 CommunityInvite
314 CommunityJoinRequest
315 OfficialPost
316 InvitedFriendJoins
317 NewUserpic
318 PollVote
319 UserExpunged
321 foreach my $evt (@LJ::EVENT_TYPES) {
322 $evt = "LJ::Event::$evt";
326 unless (@LJ::NOTIFY_TYPES) {
327 @LJ::NOTIFY_TYPES = (
328 'Email',
330 foreach my $evt (@LJ::NOTIFY_TYPES) {
331 $evt = "LJ::NotificationMethod::$evt";
334 unless (%LJ::BLOBINFO) {
335 %LJ::BLOBINFO = (
336 clusters => {
337 1 => "$LJ::HOME/var/blobs/",
342 unless (scalar @LJ::PROTECTED_USERNAMES) {
343 @LJ::PROTECTED_USERNAMES = ("^ex_", "^ext_", "^s_", "^_", '_$', '__');
346 $LJ::USERPROP_DEF{'blob_clusterid'} ||= 1;
348 # setup default limits for mogilefs classes
349 if (%LJ::MOGILEFS_CONFIG) {
350 my %classes = (userpics => 3,
351 captcha => 2,
352 temp => 2,
354 $LJ::MOGILEFS_CONFIG{classes} ||= {};
355 foreach my $class (keys %classes) {
356 $LJ::MOGILEFS_CONFIG{classes}{$class} ||= $classes{$class};
360 # sms defaults
361 $LJ::SMS_DOMAIN ||= $LJ::DOMAIN;
362 $LJ::SMS_TITLE ||= "$LJ::SITENAMESHORT SMS";
364 # random user defaults to a week
365 $LJ::RANDOM_USER_PERIOD = 7;
367 # how far in advance to send out birthday notifications
368 $LJ::BIRTHDAY_NOTIFS_ADVANCE ||= 2*24*60*60;
370 # "RPC" URI mappings
371 # add default URI handler mappings
372 my %ajaxmapping = (
373 delcomment => "delcomment.bml",
374 talkscreen => "talkscreen.bml",
375 spamcomment => "spamcomment.bml",
376 talkmulti => "talkmulti.bml",
377 controlstrip => "tools/endpoints/controlstrip.bml",
378 ctxpopup => "tools/endpoints/ctxpopup.bml",
379 changerelation => "tools/endpoints/changerelation.bml",
380 userpicselect => "tools/endpoints/getuserpics.bml",
381 esn_inbox => "tools/endpoints/esn_inbox.bml",
382 esn_subs => "tools/endpoints/esn_subs.bml",
383 trans_save => "tools/endpoints/trans_save.bml",
384 dirsearch => "tools/endpoints/directorysearch.bml",
385 poll => "tools/endpoints/poll.bml",
386 jobstatus => "tools/endpoints/jobstatus.bml",
387 widget => "tools/endpoints/widget.bml",
388 multisearch => "tools/endpoints/multisearch.bml",
389 give_tokens => "give_tokens.bml",
392 foreach my $src (keys %ajaxmapping) {
393 $LJ::AJAX_URI_MAP{$src} ||= $ajaxmapping{$src};
395 $LJ::AJAX_URI_MAP{load_state_codes} = 'tools/endpoints/load_state_codes.bml';
396 $LJ::AJAX_URI_MAP{profileexpandcollapse} = 'tools/endpoints/profileexpandcollapse.bml';
397 $LJ::AJAX_URI_MAP{dismisspagenotice} = 'tools/endpoints/dismisspagenotice.bml';
399 # List all countries that have states listed in 'codes' table in DB
400 # These countries will be displayed with drop-down menu on Profile edit page
401 # 'type' is used as 'type' attribute value in 'codes' table
402 # 'save_region_code' specifies what to save in 'state' userprop -
403 # '1' mean save short region code and '0' - save full region name
404 %LJ::COUNTRIES_WITH_REGIONS = (
405 'US' => { type => 'state', save_region_code => 1, },
406 'RU' => { type => 'stateru', save_region_code => 1, },
407 #'AU' => { type => 'stateau', save_region_code => 0, },
408 #'CA' => { type => 'stateca', save_region_code => 0, },
409 #'DE' => { type => 'statede', save_region_code => 0, },
412 %LJ::VALID_PAGE_NOTICES = (
413 profile_design => 1,
414 settings_design => 1,
417 @LJ::IDENTITY_TYPES = qw( openid ) unless @LJ::IDENTITY_TYPES;
419 unless (@LJ::TALK_METHODS_ORDER) {
420 @LJ::TALK_METHODS_ORDER = qw(
421 Anonymous
422 OpenID
423 User
427 if ($LJ::IS_DEV_SERVER) {
428 $LJ::CAPTCHA_MOGILEFS = 1 unless defined $LJ::CAPTCHA_MOGILEFS;
429 $LJ::USERPIC_MOGILEFS = 1 unless defined $LJ::USERPIC_MOGILEFS;
430 $LJ::PHONEPOST_MOGILEFS = 1 unless defined $LJ::PHONEPOST_MOGILEFS;
431 $LJ::TRUST_X_HEADERS = 1 unless defined $LJ::TRUST_X_HEADERS;
432 $LJ::NO_PASSWORD_CHECK = 1 unless defined $LJ::NO_PASSWORD_CHECK;
434 unless (@LJ::CLUSTERS) {
435 @LJ::CLUSTERS = ( 1, 2 );
438 unless ( defined $LJ::DEFAULT_CLUSTER ) {
439 $LJ::DEFAULT_CLUSTER = [ 1, 2 ];
442 unless (%LJ::DBINFO) {
443 %LJ::DBINFO = (
444 'master' => {
445 'host' => 'localhost',
446 'user' => 'lj',
447 'pass' => 'ljpass',
448 'dbname' => 'livejournal',
449 'role' => { 'master' => 1, 'slow' => 1 }
452 'c1' => {
453 'host' => 'localhost',
454 'user' => 'lj',
455 'pass' => 'ljpass',
456 'dbname' => 'lj_c1',
457 'role' => { 'cluster1' => 1 },
460 'c2' => {
461 'host' => 'localhost',
462 'user' => 'lj',
463 'pass' => 'ljpass',
464 'dbname' => 'lj_c2',
465 'role' => { 'cluster2' => 1 },
470 # theschwartz config for dev servers
471 # for production config, see cvs/ljconfs/site/etc/ljconfig.pl
472 my $mast = $LJ::DBINFO{'master'};
473 my $dbname = $mast->{'dbname'} || 'livejournal';
474 my $dbhost = $mast->{'host'} || 'localhost';
475 unless (%LJ::THESCHWARTZ_DBS) {
476 %LJ::THESCHWARTZ_DBS = (
477 'dev' => {
478 'dsn' => "dbi:mysql:$dbname;host=$dbhost",
479 'user' => $mast->{'user'},
480 'pass' => $mast->{'pass'},
481 'prefix' => 'sch_',
485 unless (%LJ::THESCHWARTZ_DBS_ROLES) {
486 %LJ::THESCHWARTZ_DBS_ROLES = (
487 'default' => [ 'dev' ],
488 'worker' => [ 'dev' ],
489 'mass' => [ 'dev' ],
493 unless (%LJ::MOGILEFS_CONFIG) {
494 %LJ::MOGILEFS_CONFIG = (
495 domain => 'danga.com::lj',
496 hosts => [ '127.0.0.1:7001' ],
497 classes => {
498 'userpics' => 3,
499 'captcha' => 2,
500 'phoneposts' => 3,
501 'file' => 1,
502 'photo' => 2,
503 'temp' => 1,
508 @LJ::MEMCACHE_SERVERS = qw( 127.0.0.1:11211 )
509 unless @LJ::MEMCACHE_SERVERS;
511 @LJ::GEARMAN_SERVERS = qw( 127.0.0.1:8000 )
512 unless @LJ::GEARMAN_SERVERS;
515 # cluster 0 is no longer supported
516 $LJ::DEFAULT_CLUSTER ||= 1;
517 @LJ::CLUSTERS = (1) unless @LJ::CLUSTERS;
520 # no dependencies.
521 # <LJDEP>
522 # </LJDEP>
524 return 1;