LJSUP-17669: Login.bml form refactoring
[livejournal.git] / cgi-bin / lj-bml-blocks.pl
blob5ecdb877f215af39215f655658dbcf97134d19c2
1 package LJ;
2 use strict;
4 use lib "$ENV{LJHOME}/cgi-bin";
5 use LJ::Config;
6 LJ::Config->load;
8 BML::register_block("DOMAIN", "S", $LJ::DOMAIN);
10 BML::register_block("SITEROOT", "S", $LJ::SITEROOT);
11 BML::register_block("SITENAME", "S", $LJ::SITENAME);
12 BML::register_block("ADMIN_EMAIL", "S", $LJ::ADMIN_EMAIL);
13 BML::register_block("SUPPORT_EMAIL", "S", $LJ::SUPPORT_EMAIL);
14 BML::register_block("CHALRESPJS", "", $LJ::COMMON_CODE{'chalresp_js'});
16 BML::register_block("IMGPREFIX", "S", sub {
17 return $LJ::IS_SSL ? $LJ::SSLIMGPREFIX : $LJ::IMGPREFIX;
18 });
20 BML::register_block("STATPREFIX", "S", sub {
21 return $LJ::IS_SSL ? $LJ::SSLSTATPREFIX : $LJ::STATPREFIX;
22 });
24 BML::register_block("JSPREFIX", "S", sub {
25 return $LJ::IS_SSL ? $LJ::SSLJSPREFIX : $LJ::JSPREFIX;
26 });
28 # dynamic blocks to implement calling our ljuser function to generate HTML
29 # <?ljuser banana ljuser?>
30 # <?ljcomm banana ljcomm?>
31 # <?ljuserf banana ljuserf?>
32 BML::register_block("LJUSER", "DS", sub { LJ::ljuser($_[0]->{DATA}); });
33 BML::register_block("LJCOMM", "DS", sub { LJ::ljuser($_[0]->{DATA}); });
34 BML::register_block("LJUSERF", "DS", sub { LJ::ljuser($_[0]->{DATA}, { full => 1 }); });
36 # dynamic needlogin block, needs to be dynamic so we can get at the full URLs and
37 # so we can translate it
38 BML::register_block("NEEDLOGIN", "", \&LJ::needlogin_redirect);
41 my $dl = "<a href=\"$LJ::SITEROOT/files/%%DATA%%\">HTTP</a>";
42 BML::register_block("DL", "DR", $dl);
45 if ($LJ::UNICODE) {
46 BML::register_block("METACTYPE", "S", '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">')
47 } else {
48 BML::register_block("METACTYPE", "S", '<meta http-equiv="Content-Type" content="text/html">')