Первый фоллен на хелле (wildkin) wrote in changelog,
Первый фоллен на хелле
wildkin
changelog

[livejournal] r16108: 1) use LJ::Request instead of Apache(->r...

Committer: dnikolaev
1) use LJ::Request instead of Apache(->request).
2) BML code blocks do not receive now request object in first parameter. Apache::BML::bml_block changed.
3) All LJ methods and subroutines in BMLs, which was calling with parameter $r or hashref like { r => ... }, now calls with 'UNUSED' string.
4) LJ::Request::meets_conditions created.
5) TODO: LJ::Request::err_header_out must be created.

U   branches/modernize2/backup/htdocs/create.bml
U   branches/modernize2/cgi-bin/LJ/Request/Apache.pm
U   branches/modernize2/cgi-bin/bml/scheme/lynx.look
U   branches/modernize2/htdocs/admin/qotd/responses.bml
U   branches/modernize2/htdocs/captcha/audio.bml
U   branches/modernize2/htdocs/captcha/image.bml
U   branches/modernize2/htdocs/customize/advanced/layersource.bml
U   branches/modernize2/htdocs/editjournal.bml
U   branches/modernize2/htdocs/editpics.bml
U   branches/modernize2/htdocs/export_comments.bml
U   branches/modernize2/htdocs/export_do.bml
U   branches/modernize2/htdocs/extcss/index.bml
U   branches/modernize2/htdocs/friends/add.bml
U   branches/modernize2/htdocs/imgupload.bml
U   branches/modernize2/htdocs/imguploadrte.bml
U   branches/modernize2/htdocs/inbox/compose.bml
U   branches/modernize2/htdocs/login.bml
U   branches/modernize2/htdocs/logout.bml
U   branches/modernize2/htdocs/preview/entry.bml
U   branches/modernize2/htdocs/support/append_request.bml
U   branches/modernize2/htdocs/support/faqbrowse.bml
U   branches/modernize2/htdocs/support/help.bml
U   branches/modernize2/htdocs/talkpost.bml
U   branches/modernize2/htdocs/talkpost_do.bml
U   branches/modernize2/htdocs/talkread.bml
U   branches/modernize2/htdocs/talkread_s1short.bml
U   branches/modernize2/htdocs/tools/embedcontent.bml
U   branches/modernize2/htdocs/update.bml
U   branches/modernize2/htdocs/userinfo.bml
U   branches/modernize2/htdocs/userinfo2.bml
U   branches/modernize2/htdocs/userinfo3.bml
U   branches/modernize2/htdocs/userinfo_2008.bml
U   branches/modernize2/htdocs/view/index.bml
Modified: branches/modernize2/backup/htdocs/create.bml
===================================================================
--- branches/modernize2/backup/htdocs/create.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/backup/htdocs/create.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -235,7 +235,7 @@
      if ($LJ::COPPA_CHECK) {
          my $uniq;
          if ($LJ::UNIQ_COOKIES) {
-             $uniq = Apache->request->notes('uniq');
+             $uniq = LJ::Request->notes('uniq');
              if ($uniq) {
                  my $timeof = $dbh->selectrow_array('SELECT timeof FROM underage WHERE uniq = ?', undef, $uniq);
                  $is_underage = 1 if $timeof && $timeof > 0;

Modified: branches/modernize2/cgi-bin/LJ/Request/Apache.pm
===================================================================
--- branches/modernize2/cgi-bin/LJ/Request/Apache.pm	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/cgi-bin/LJ/Request/Apache.pm	2010-01-20 08:17:38 UTC (rev 16108)
@@ -74,6 +74,12 @@
     return $instance->{apr}->request_time();
 }
 
+sub LJ::Request::meets_conditions {
+    my $class = shift;
+    die "Request is not provided to LJ::Request" unless $instance;
+    return $instance->{apr}->meets_conditions();
+}
+
 sub LJ::Request::read {
     my $class = shift;
     die "Request is not provided to LJ::Request" unless $instance;

Modified: branches/modernize2/cgi-bin/bml/scheme/lynx.look
===================================================================
--- branches/modernize2/cgi-bin/bml/scheme/lynx.look	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/cgi-bin/bml/scheme/lynx.look	2010-01-20 08:17:38 UTC (rev 16108)
@@ -33,7 +33,7 @@
     #Comments q { padding-left: 2.5em; font-style: italic; }
 </style>
 <title><?_code {
-    my $elhash = $_[2];
+    my $elhash = $_[1];
     return $elhash->{'WINDOWTITLE'} || $elhash->{'TITLE'};
 } _code?></title>
 <?_code return LJ::run_hook("insert_after_bml_title"); _code?>

Modified: branches/modernize2/htdocs/admin/qotd/responses.bml
===================================================================
--- branches/modernize2/htdocs/admin/qotd/responses.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/admin/qotd/responses.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -6,10 +6,6 @@
     use vars qw(%GET %POST $title $headextra @errors @warnings);
     use Class::Autouse qw( LJ::QotD );
 
-    # sometimes need an Apache::Request object
-    my $req = shift;
-    my $r = $req->{'r'};
-
     my $remote = LJ::get_remote();
 
     $title = "Writer's Block Report";
@@ -66,10 +62,10 @@
 
     BML::finish_suppress_all();
     my $filename = "writersblockreport-$qid.csv";
-    $r->content_type("application/x-csv");
-    $r->header_out("Content-disposition" => "attachment; filename=\"$filename\"");
-    $r->send_http_header;
-    $r->print($out);
+    LJ::Request->content_type("application/x-csv");
+    LJ::Request->header_out("Content-disposition" => "attachment; filename=\"$filename\"");
+    LJ::Request->send_http_header();
+    LJ::Request->print($out);
 
     return;
 

Modified: branches/modernize2/htdocs/captcha/audio.bml
===================================================================
--- branches/modernize2/htdocs/captcha/audio.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/captcha/audio.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -18,9 +18,9 @@
         return "Error: unable to handle array without reproxy\n" unless $can_reproxy;
         return "Error: captcha not available (no paths)\n" unless scalar @$wav;
         if ($wav->[0] =~ m!http://!) {
-            Apache->request->header_out('X-REPROXY-URL', join(' ', @$wav));
+            LJ::Request->header_out('X-REPROXY-URL', join(' ', @$wav));
         } else {
-            Apache->request->header_out('X-REPROXY-FILE', $wav->[0]);
+            LJ::Request->header_out('X-REPROXY-FILE', $wav->[0]);
         }
         BML::set_content_type("audio/x-wav");
         

Modified: branches/modernize2/htdocs/captcha/image.bml
===================================================================
--- branches/modernize2/htdocs/captcha/image.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/captcha/image.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -17,9 +17,9 @@
         return "Error: unable to handle array without reproxy\n" unless $can_reproxy;
         return "Error: captcha not available (no paths)\n" unless scalar @$png;
         if ($png->[0] =~ m!http://!) {
-            Apache->request->header_out('X-REPROXY-URL', join(' ', @$png));
+            LJ::Request->header_out('X-REPROXY-URL', join(' ', @$png));
         } else {
-            Apache->request->header_out('X-REPROXY-FILE', $png->[0]);
+            LJ::Request->header_out('X-REPROXY-FILE', $png->[0]);
         }
         BML::set_content_type("image/png");
         

Modified: branches/modernize2/htdocs/customize/advanced/layersource.bml
===================================================================
--- branches/modernize2/htdocs/customize/advanced/layersource.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/customize/advanced/layersource.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -75,7 +75,7 @@
     my $ua = BML::get_client_header("User-Agent");
     if ($ua && $ua =~ /\bMSIE\b/) {
         my $filename = "s2source-$id.txt";
-        Apache->request->header_out('Content-Disposition' => "attachment; filename=$filename");
+        LJ::Request->header_out('Content-Disposition' => "attachment; filename=$filename");
     }
 
     BML::noparse();

Modified: branches/modernize2/htdocs/editjournal.bml
===================================================================
--- branches/modernize2/htdocs/editjournal.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/editjournal.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -7,8 +7,8 @@
     use vars qw(%GET %POST);
     BML::decl_params(_default => qr/./);
 
-    my $head     = \$_[1]->{'head'};
-    my $bodyopts = \$_[1]->{'bodyopts'};
+    my $head     = \$_[0]->{'head'};
+    my $bodyopts = \$_[0]->{'bodyopts'};
 
     LJ::set_active_crumb('editentries');
 
@@ -376,7 +376,7 @@
             my $escaped_qotd_text = LJ::ejs($qotd_text);
 
             # javascript to initialize entry form since we've just called into entry_form
-            # -- shove into \$head which is a reference into $_[1]->{head} and will
+            # -- shove into \$head which is a reference into $_[0]->{head} and will
             #    be placed in the correct BML head portion later
             # -- this is a hack, should be done by weblib and pushed into \$$head above
             #    in a way which is compatible with both this page and update.bml
@@ -556,11 +556,11 @@
 _code?>
 <=body
 
-bodyopts=><?_code return $_[1]->{'bodyopts'}; _code?>
+bodyopts=><?_code return $_[0]->{'bodyopts'}; _code?>
 head<=
 
 <?entryformcss?>
-<?_code return $_[1]->{'head'}; _code?>
+<?_code return $_[0]->{'head'}; _code?>
 <?_code return $LJ::COMMON_CODE{'autoradio_check'}; _code?>
 
 <?_code

Modified: branches/modernize2/htdocs/editpics.bml
===================================================================
--- branches/modernize2/htdocs/editpics.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/editpics.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -8,7 +8,7 @@
     BML::set_language_scope("/editpics.bml");
 
     my $suffix = "";
-    if (Apache->request->uri =~ /editpics-beta/) {
+    if (LJ::Request->uri =~ /editpics-beta/) {
         $suffix = "-beta";
     }
 
@@ -196,8 +196,7 @@
         ### no post data, so we'll parse the multipart data
         unless (%POST) {
 
-            my $r = Apache->request;
-            my $size = $r->header_in("Content-length");
+            my $size = LJ::Request->header_in("Content-length");
             unless ($size) {
                 return $err->("No content-length header: can't upload");
             }
@@ -216,7 +215,8 @@
 
                 # pretend to tell apache that we care about parsing the data, but we really don't
                 my $bogus = sub {return 1;};
-                BML::parse_multipart_interactive($r, \$error, {
+                BML::parse_multipart_interactive(
+                    \$error, {
                     newheaders => $bogus,
                     data       => $bogus,
                     enddata    => $bogus,
@@ -386,7 +386,8 @@
                       # parse multipart-mime submission, one chunk at a time,
                       # calling our hooks as we go to put uploads in temporary
                       # MogileFS filehandles
-                      $res = eval { BML::parse_multipart_interactive($r, \$error, {
+                      $res = eval { BML::parse_multipart_interactive(
+                          \$error, {
                           newheaders => $hook_newheaders,
                           data       => $hook_data,
                           enddata    => $hook_enddata,

Modified: branches/modernize2/htdocs/export_comments.bml
===================================================================
--- branches/modernize2/htdocs/export_comments.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/export_comments.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -3,9 +3,6 @@
     use strict;
     use vars qw(%GET);
     
-    my $req = shift;
-    my $r = $req->{'r'};
-
     my $remote = LJ::get_remote();
     return "<?needlogin?>" unless $remote;
 
@@ -34,9 +31,9 @@
     BML::suppress_content();
 
     # print top
-    $r->content_type("text/xml; charset=utf-8");
-    $r->send_http_header();
-    $r->print("<?xml version=\"1.0\" encoding='utf-8'?>\n<livejournal>\n");
+    LJ::Request->content_type("text/xml; charset=utf-8");
+    LJ::Request->send_http_header();
+    LJ::Request->print("<?xml version=\"1.0\" encoding='utf-8'?>\n<livejournal>\n");
 
     # startid specified?
     my $maxitems = $mode eq 'comment_meta' ? 10000 : 1000;
@@ -78,30 +75,30 @@
                                         "WHERE journalid = ? AND nodetype = 'L'",
                                         undef, $u->{userid});
         $max += 0;
-        $r->print("<maxid>$max</maxid>\n");
+        LJ::Request->print("<maxid>$max</maxid>\n");
         my $nextid = $startid + $gather;
-        $r->print("<nextid>$nextid</nextid>\n") unless ($nextid > $max);
+        LJ::Request->print("<nextid>$nextid</nextid>\n") unless ($nextid > $max);
         # load posterids
         my $us = LJ::load_userids(keys %posterids);
 
         # now spit out the metadata
-        $r->print("<comments>\n");
+        LJ::Request->print("<comments>\n");
         while (my ($id, $data) = each %comments) {
             my $ret = "<comment id='$id'";
             $ret .= " posterid='$data->{posterid}'" if $data->{posterid};
             $ret .= " state='$data->{state}'" if $data->{state} ne 'A';
             $ret .= " />\n";
-            $r->print($ret);
+            LJ::Request->print($ret);
         }
-        $r->print("</comments>\n<usermaps>\n");
+        LJ::Request->print("</comments>\n<usermaps>\n");
 
         # now spit out usermap
         my $ret = '';
         while (my ($id, $user) = each %$us) {
             $ret .= "<usermap id='$id' user='$user->{user}' />\n";
         }
-        $r->print($ret);
-        $r->print("</usermaps>\n");
+        LJ::Request->print($ret);
+        LJ::Request->print("</usermaps>\n");
 
     # comment data also presented in glorious XML:
     } elsif ($mode eq 'comment_body') {
@@ -118,7 +115,7 @@
         }
 
         # now start spitting out data
-        $r->print("<comments>\n");
+        LJ::Request->print("<comments>\n");
         foreach my $id (@ids) {
             # get text for this comment
             my $data = $comments{$id};
@@ -155,13 +152,13 @@
                 }
                 $ret .= "</comment>\n";
             }
-            $r->print($ret);
+            LJ::Request->print($ret);
         }
-        $r->print("</comments>\n");
+        LJ::Request->print("</comments>\n");
     }
 
     # all done
-    $r->print("</livejournal>\n");
+    LJ::Request->print("</livejournal>\n");
 }
 _code?><?_c <LJDEP>
 </LJDEP> _c?>

Modified: branches/modernize2/htdocs/export_do.bml
===================================================================
--- branches/modernize2/htdocs/export_do.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/export_do.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -2,9 +2,6 @@
 
         LJ::set_active_crumb('export');
 
-        my $req = shift;
-        my $r = $req->{'r'};
-
         my $remote = LJ::get_remote();
         return "<?needlogin?>"
             unless $remote;
@@ -66,21 +63,21 @@
 
         if ($POST{'format'} eq "csv") {
             $opts->{'format'} = "csv";
-            $r->content_type("text/plain");
+            LJ::Request->content_type("text/plain");
             my $filename = "$u->{user}-$year-$month.csv";
-            $r->header_out('Content-Disposition' => "attachment; filename=$filename");
-            $r->send_http_header();
+            LJ::Request->header_out('Content-Disposition' => "attachment; filename=$filename");
+            LJ::Request->send_http_header();
             if ($POST{'header'}) {
-                $r->print(join(",",@fields) . "\n");
+                LJ::Request->print(join(",",@fields) . "\n");
             }
         }
         if ($POST{'format'} eq "xml") {
             $opts->{'format'} = "xml";
             my $lenc = lc($encoding);
-            $r->content_type("text/xml; charset=$lenc");
-            $r->send_http_header();
-            $r->print("<?xml version=\"1.0\" encoding='$lenc'?>\n");
-            $r->print("<livejournal>\n");
+            LJ::Request->content_type("text/xml; charset=$lenc");
+            LJ::Request->send_http_header();
+            LJ::Request->print("<?xml version=\"1.0\" encoding='$lenc'?>\n");
+            LJ::Request->print("<livejournal>\n");
         }
 
         $opts->{'fields'} = \@fields;
@@ -91,7 +88,7 @@
         $sth = $dbcr->prepare("SELECT jitemid, anum, eventtime, logtime, security, allowmask FROM log2 ".
                               "WHERE journalid=$u->{'userid'} AND year=$year AND month=$month");
         $sth->execute;
-        if ($dbcr->err) { $r->print($dbcr->errstr); return; }
+        if ($dbcr->err) { LJ::Request->print($dbcr->errstr); return; }
         my @buffer;
         while ($_ = $sth->fetchrow_hashref) {
             $_->{'ritemid'} = $_->{'jitemid'} || $_->{'itemid'};
@@ -106,7 +103,7 @@
         load_and_dump_buffer($u, \@buffer, $opts);
 
         if ($opts->{'format'} eq "xml") {
-            $r->print("</livejournal>\n");
+            LJ::Request->print("</livejournal>\n");
         }
         return;
 
@@ -157,7 +154,7 @@
                                                           -charset=>$opts->{'encoding'}});
                 }
 
-                $r->print($entry);
+                LJ::Request->print($entry);
             }
         }
 

Modified: branches/modernize2/htdocs/extcss/index.bml
===================================================================
--- branches/modernize2/htdocs/extcss/index.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/extcss/index.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -15,7 +15,7 @@
     BML::set_content_type("text/css");
 
     # don't allow access via www.
-    my $host = lc(Apache->request->header_in("Host"));
+    my $host = lc(LJ::Request->header_in("Host"));
     $host =~ s/:.*//;
     if ($LJ::ONLY_USER_VHOSTS && ($host eq $LJ::DOMAIN ||
                                   $host eq $LJ::DOMAIN_WEB)) {

Modified: branches/modernize2/htdocs/friends/add.bml
===================================================================
--- branches/modernize2/htdocs/friends/add.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/friends/add.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -11,7 +11,7 @@
     return $ad_box . $str;
  };
 
- my $head     = \$_[1]->{'head'};
+ my $head     = \$_[0]->{'head'};
 
  my $remote = LJ::get_remote();
  my $user = $POST{'user'} || $GET{'user'};
@@ -504,7 +504,7 @@
 title=><?_code return $title; _code?>
 windowtitle=><?_code return $windowtitle; _code?>
 head<=
-<?_code return $_[1]->{'head'}; _code?>
+<?_code return $_[0]->{'head'}; _code?>
 <=head
 body=><?_code return $body; _code?>
 page?><?_c <LJDEP>

Modified: branches/modernize2/htdocs/imgupload.bml
===================================================================
--- branches/modernize2/htdocs/imgupload.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/imgupload.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -3,11 +3,11 @@
     use strict;
     use vars qw(%GET);
 
-    # $_[1] is a pre-request scratch area
+    # $_[0] is a pre-request scratch area
     # put variables here so that we can access them later
     # outside of this _code block
-    my $head = \$_[1]->{'head'};
-    my $body = \$_[1]->{'body'};
+    my $head = \$_[0]->{'head'};
+    my $body = \$_[0]->{'body'};
 
     my $u = LJ::User->remote;
 
@@ -178,9 +178,9 @@
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
 <head>
 <title>Insert Image</title>
-<?_code return $_[1]->{'head'}; _code?>
+<?_code return $_[0]->{'head'}; _code?>
 </head>
 <body>
-<?_code return $_[1]->{'body'}; _code?>
+<?_code return $_[0]->{'body'}; _code?>
 </body>
 </html>

Modified: branches/modernize2/htdocs/imguploadrte.bml
===================================================================
--- branches/modernize2/htdocs/imguploadrte.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/imguploadrte.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -3,11 +3,11 @@
     use strict;
     use vars qw(%GET);
 
-    # $_[1] is a pre-request scratch area
+    # $_[0] is a pre-request scratch area
     # put variables here so that we can access them later
     # outside of this _code block
-    my $head = \$_[1]->{'head'};
-    my $body = \$_[1]->{'body'};
+    my $head = \$_[0]->{'head'};
+    my $body = \$_[0]->{'body'};
     my $u = LJ::User->remote;
 
     LJ::need_res("stc/display_none.css",
@@ -275,9 +275,9 @@
 _code?>
 <html>
 <head>
-<?_code return $_[1]->{'head'}; _code?>
+<?_code return $_[0]->{'head'}; _code?>
 </head>
 <body>
-<?_code return $_[1]->{'body'}; _code?>
+<?_code return $_[0]->{'body'}; _code?>
 </body>
 </html>

Modified: branches/modernize2/htdocs/inbox/compose.bml
===================================================================
--- branches/modernize2/htdocs/inbox/compose.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/inbox/compose.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -19,10 +19,10 @@
     return "<?p " . BML::ml('protocol.not_validated', { sitename => $LJ::SITENAMESHORT, siteroot => $LJ::SITEROOT }) . " p?>"
         unless $remote->is_validated;
 
-    # $_[1] is a pre-request scratch area
+    # $_[0] is a pre-request scratch area
     # put variables here so that we can access them later
     # outside of this _code block
-    my $head     = \$_[1]->{'head'};
+    my $head     = \$_[0]->{'head'};
 
     my $body = '';
 
@@ -264,7 +264,7 @@
 <?_code
     use strict;
 
-    my $ret = $_[1]->{'head'};
+    my $ret = $_[0]->{'head'};
 
     return $ret;
 _code?>

Modified: branches/modernize2/htdocs/login.bml
===================================================================
--- branches/modernize2/htdocs/login.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/login.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -379,7 +379,7 @@
             {
                 return BML::redirect("$POST{'ref'}");
             } elsif ($GET{'ret'} == 1 && $referer && $referer =~ /\Q$LJ::DOMAIN\E/) {
-                my $uniq = Apache->request->notes('uniq');
+                my $uniq = LJ::Request->notes('uniq');
                 if ($uniq) {
                     LJ::MemCache::set("loginout:$uniq", 1, time() + 15);
                 }

Modified: branches/modernize2/htdocs/logout.bml
===================================================================
--- branches/modernize2/htdocs/logout.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/logout.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -50,7 +50,7 @@
             # Redirect within the site if ret=1
             my $referer = BML::get_client_header('Referer');
             if ($GET{'ret'} == 1 && $referer && $referer =~ /\Q$LJ::DOMAIN\E/) {
-                my $uniq = Apache->request->notes('uniq');
+                my $uniq = LJ::Request->notes('uniq');
                 if ($uniq) {
                     LJ::MemCache::set("loginout:$uniq", 1, time() + 15);
                 }

Modified: branches/modernize2/htdocs/preview/entry.bml
===================================================================
--- branches/modernize2/htdocs/preview/entry.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/preview/entry.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -41,9 +41,8 @@
     LJ::EmbedModule->expand_entry($u, \$event, preview => 1,);
 
     if ($u && $up) {
-        my $r = Apache->request;
-        $r->notes("_journal", $u->{user});
-        $r->notes("journalid", $u->{userid});
+        LJ::Request->notes("_journal", $u->{user});
+        LJ::Request->notes("journalid", $u->{userid});
 
         ### Load necessary props
         my @needed_props = ("stylesys", "s2_style", "url", "urlname",
@@ -202,12 +201,12 @@
     } else {
         $LJ::S2::ret_ref = \$ret;
         my $opts;
-        my $r = Apache->request; $opts->{'r'} = $r;
+        $opts->{'r'} = 'UNUSED';
 
         $u->{'_s2styleid'} = $styleid + 0;
         $u->{'_journalbase'} = LJ::journal_base($u->{'user'});
 
-        my $ctx = LJ::S2::s2_context($r, $styleid);
+        my $ctx = LJ::S2::s2_context('UNUSED', $styleid);
         $LJ::S2::CURR_CTX = $ctx;
 
         my $p = LJ::S2::Page($u, $opts);
@@ -305,7 +304,7 @@
             '_url_of' => sub { return "#"; },
         });
 
-        LJ::S2::s2_run($r, $ctx, $opts, "EntryPage::print()", $p);
+        LJ::S2::s2_run('UNUSED', $ctx, $opts, "EntryPage::print()", $p);
         # prevent BML tags interpretation inside post body
         $ret =~ s/<\?/&lt;?/g;
         $ret =~ s/\?>/?&gt;/g;

Modified: branches/modernize2/htdocs/support/append_request.bml
===================================================================
--- branches/modernize2/htdocs/support/append_request.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/support/append_request.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -10,9 +10,6 @@
 
     LJ::set_active_crumb('supportappend');
 
-    my $apache_req = shift;
-    my $r = $apache_req->{'r'};
-
     my $status = "";
 
     my $spid = $FORM{'spid'}+0;
@@ -209,7 +206,7 @@
             'body' => "(Bouncing mail to '" . join(', ', @emails) . "' and closing)\n\n" . $FORM{'body'},
             'posterid' => $remote,
             'type' => 'internal',
-            'uniq' => $r->notes('uniq'),
+            'uniq' => LJ::Request->notes('uniq'),
             'remote' => $remote,
         });
 
@@ -399,7 +396,7 @@
         'body' => $status . $FORM{'body'},
         'type' => $type,
         'faqid' => $faqid,
-        'uniq' => $r->notes('uniq'),
+        'uniq' => LJ::Request->notes('uniq'),
         'remote' => $remote,
         'tier' => $tier,
     });

Modified: branches/modernize2/htdocs/support/faqbrowse.bml
===================================================================
--- branches/modernize2/htdocs/support/faqbrowse.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/support/faqbrowse.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -35,8 +35,8 @@
     }
     
     # make title and body references to BML scratch area
-    my $title = \$_[1]->{'title'};
-    my $body = \$_[1]->{'body'};
+    my $title = \$_[0]->{'title'};
+    my $body = \$_[0]->{'body'};
     $$body = '';
     $$title = '';
 
@@ -237,13 +237,13 @@
      $$body .= BML::ml('.backsupport2', { 'aopts' => 'href="/support/"' });
 
      # we're dynamic, set title as crumb title
-     LJ::set_dynamic_crumb($_[1]->{'title'}, 'faq');
+     LJ::set_dynamic_crumb($_[0]->{'title'}, 'faq');
 
-     return $_[1]->{'body'};
+     return $_[0]->{'body'};
 }
 _code?>
 <=body
-title=><?_code return $_[1]->{'title'}; _code?>
+title=><?_code return $_[0]->{'title'}; _code?>
 page?><?_c <LJDEP>
 link: htdocs/support/index.bml, htdocs/support/faq.bml
 </LJDEP> _c?>

Modified: branches/modernize2/htdocs/support/help.bml
===================================================================
--- branches/modernize2/htdocs/support/help.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/support/help.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -52,14 +52,15 @@
 
  my ($ret, $sth);
  my $dbr = LJ::get_db_reader();
- my $r = Apache->request;
 
  my $remote = LJ::get_remote();
  LJ::Support::init_remote($remote);
 
  return $ML{'.interim'} if
     (!$remote || !$remote->{'_priv'}) &&
-    ($r->header_in("Referer") eq "$LJ::SITEROOT/support/" || $r->header_in("Referer") eq "$LJ::SITEROOT/support/index.bml" || $r->header_in("Referer") eq "$LJ::SITEROOT/support/submit.bml");
+    (LJ::Request->header_in("Referer") eq "$LJ::SITEROOT/support/" ||
+     LJ::Request->header_in("Referer") eq "$LJ::SITEROOT/support/index.bml" ||
+     LJ::Request->header_in("Referer") eq "$LJ::SITEROOT/support/submit.bml");
 
  my $cats = LJ::Support::load_cats();
 

Modified: branches/modernize2/htdocs/talkpost.bml
===================================================================
--- branches/modernize2/htdocs/talkpost.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/talkpost.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -18,15 +18,14 @@
 
     my $pics = LJ::Talk::get_subjecticons();
 
-    my $r = Apache->request;
-    $r->notes("codepath" => "bml.talkpost");
+    LJ::Request->notes("codepath" => "bml.talkpost");
 
     my $uri = BML::get_uri();
 
     my $editid = $FORM{edit} ? $FORM{edit} : 0;
     my $comment;
     if ($editid) {
-        $comment = LJ::Comment->new(LJ::load_user($r->notes("_journal")), dtalkid => $editid);
+        $comment = LJ::Comment->new(LJ::load_user(LJ::Request->notes("_journal")), dtalkid => $editid);
         return $errtxt unless $comment->remote_can_edit(\$errtxt);
 
         my $parent = $comment->parent;
@@ -41,7 +40,7 @@
 
     if ($uri =~ m!/(\d+)\.html$!) {
         $FORM{'itemid'} = $1 unless $FORM{'replyto'} > 0;
-        $FORM{'journal'} = $r->notes("_journal");
+        $FORM{'journal'} = LJ::Request->notes("_journal");
         BML::set_language_scope("/talkpost.bml");
     }
 
@@ -51,7 +50,7 @@
     my $u = $init->{'journalu'};
     return $ML{'talk.error.nojournal'} unless $u;
 
-    $r->notes("journalid" => $u->{'userid'});
+    LJ::Request->notes("journalid" => $u->{'userid'});
     return $LJ::MSG_READONLY_USER if LJ::get_cap($u, "readonly");
 
     my $dbcr = LJ::get_cluster_def_reader($u);

Modified: branches/modernize2/htdocs/talkpost_do.bml
===================================================================
--- branches/modernize2/htdocs/talkpost_do.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/talkpost_do.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -22,9 +22,6 @@
         return "" if $tempbody =~ /$LJ::TALK_ABORT_REGEXP/ || $POST{'body'} =~ /$LJ::TALK_ABORT_REGEXP/;
     }
 
-    my $req = shift;
-    my $r = $req->{'r'};
-
     foreach my $re (@LJ::TALKSPAM) {
         return if ($POST{'body'} =~ /$re/);
     }

Modified: branches/modernize2/htdocs/talkread.bml
===================================================================
--- branches/modernize2/htdocs/talkread.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/talkread.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -9,12 +9,12 @@
  use LJ::LastFM;
  
  # make refs to both title and head, that work in cached or non-cached contexts
- # $_[0] is the BML $req object, $_[1] is a pre-request scratch area.
+ # $_[0] is a pre-request scratch area.
  $r_head = "";
  $r_title = "";
- my $head = $_[1] ? \$_[1]->{'head'} : \$r_head;
- my $title = $_[1] ? \$_[1]->{'title'} : \$r_title;
- my $bodyopts = $_[1] ? \$_[1]->{'bodyopts'} : \$r_bodyopts;
+ my $head = $_[0] ? \$_[0]->{'head'} : \$r_head;
+ my $title = $_[0] ? \$_[0]->{'title'} : \$r_title;
+ my $bodyopts = $_[0] ? \$_[0]->{'bodyopts'} : \$r_bodyopts;
 
  return LJ::server_down_html() if $LJ::SERVER_DOWN;
 
@@ -28,8 +28,7 @@
      $GET{'thread'} =~ s/^3D//;
  }
 
- my $r = Apache->request;
- $r->notes("codepath" => "bml.talkread");
+ LJ::Request->notes("codepath" => "bml.talkread");
 
  my $uri = BML::get_uri();
  my $itemid;
@@ -38,7 +37,7 @@
  if ($uri =~ m!/(\d+)\.html$!) {
      $itemid = $1;
      $GET{'itemid'} = $itemid;
-     $GET{'journal'} = $r->notes("_journal");
+     $GET{'journal'} = LJ::Request->notes("_journal");
      BML::set_language_scope("/talkread.bml");
  } else {
      $old_url = 1;
@@ -92,7 +91,7 @@
  # now check for init->error, since we know the account wasn't renamed
  return "<?h1 $ML{'Error'} h1?><?p $init->{'error'} p?>" if $init->{'error'};
 
- $r->notes("journalid" => $u->{'userid'});
+ LJ::Request->notes("journalid" => $u->{'userid'});
 
  my $thread = $init->{'thread'};
  my $dthread = $init->{'dthread'};
@@ -897,9 +896,9 @@
 
 _code?>
 <=body
-windowtitle=><?_code return $_[1] ? $_[1]->{'title'} : $r_title _code?>
-head=><?_code return $_[1] ? $_[1]->{'head'} : $r_head _code?>
-bodyopts=><?_code return $_[1]->{'bodyopts'}; _code?>
+windowtitle=><?_code return $_[0] ? $_[0]->{'title'} : $r_title _code?>
+head=><?_code return $_[0] ? $_[0]->{'head'} : $r_head _code?>
+bodyopts=><?_code return $_[0]->{'bodyopts'}; _code?>
 page?><?_c <LJDEP>
 link: htdocs/talkpost.bml, htdocs/talkread.bml, htdocs/delcomment.bml
 img: htdocs/img/dot.gif, htdocs/img/delcomment.gif

Modified: branches/modernize2/htdocs/talkread_s1short.bml
===================================================================
--- branches/modernize2/htdocs/talkread_s1short.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/talkread_s1short.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -9,11 +9,10 @@
     LJ::set_active_journal($ju);
 
     my $remote = LJ::get_remote();
-    my $r = Apache->request;
 
     # call s2 entry point to talkread in s1shortcomings
     my $styleid = 's1short'; # special virtual styleid
-    my $ctx = LJ::S2::s2_context($r, $styleid);
+    my $ctx = LJ::S2::s2_context('UNUSED', $styleid);
 
     my $entry = LJ::Entry->new($ju, ditemid => 1891);
 
@@ -23,7 +22,7 @@
 
         my $s2_ret = '';
         $LJ::S2::ret_ref = \$s2_ret;
-        eval { LJ::S2::s2_run($r, $ctx, undef, $func, @args); };
+        eval { LJ::S2::s2_run('UNUSED', $ctx, undef, $func, @args); };
         return LJ::error_list($@) if $@;
         return $s2_ret;
     };
@@ -37,7 +36,7 @@
     if ($view eq 'month') {
         $pageClass = "MonthPage";
         my $opts = {
-            r => $r,
+            r => 'UNUSED',
             ctx => $ctx,
             pathextra => "/2006/10",
         };
@@ -48,7 +47,7 @@
     } elsif ($view eq 'entry') {
         $pageClass = "EntryPage";
         my $opts = {
-            r => $r,
+            r => 'UNUSED',
             ctx => $ctx,
             ljentry => $entry,
         };
@@ -56,7 +55,7 @@
     } elsif ($view eq 'tags') {
         $pageClass = "TagsPage";
         my $opts = {
-            r => $r,
+            r => 'UNUSED',
             ctx => $ctx,
         };
         $page = LJ::S2::TagsPage($ju, $remote, $opts);

Modified: branches/modernize2/htdocs/tools/embedcontent.bml
===================================================================
--- branches/modernize2/htdocs/tools/embedcontent.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/tools/embedcontent.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -6,9 +6,8 @@
     use LJ::EmbedModule;
 
     # this can only be accessed from the embed module subdomain
-    my $r = Apache->request;
     return "This page cannot be viewed from $LJ::DOMAIN"
-        unless $r->header_in("Host") =~ /.*$LJ::EMBED_MODULE_DOMAIN$/i;
+        unless LJ::Request->header_in("Host") =~ /.*$LJ::EMBED_MODULE_DOMAIN$/i;
 
     # we should have three GET params: journalid, moduleid, auth_token
     my $journalid = $GET{journalid}+0 or return "No journalid specified";

Modified: branches/modernize2/htdocs/update.bml
===================================================================
--- branches/modernize2/htdocs/update.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/update.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -4,14 +4,14 @@
     use vars qw(%GET %POST %ML);
     BML::decl_params(_default => qr/./);
 
-    # $_[1] is a pre-request scratch area
+    # $_[0] is a pre-request scratch area
     # put variables here so that we can access them later
     # outside of this _code block
-    my $title    = \$_[1]->{'title'};
-    my $head     = \$_[1]->{'head'};
-    my $body     = \$_[1]->{'body'};
-    my $bodyopts = \$_[1]->{'bodyopts'};
-    my $onload   = \$_[1]->{'onload'};
+    my $title    = \$_[0]->{'title'};
+    my $head     = \$_[0]->{'head'};
+    my $body     = \$_[0]->{'body'};
+    my $bodyopts = \$_[0]->{'bodyopts'};
+    my $onload   = \$_[0]->{'onload'};
 
     $$title = $ML{'.title2'};
 
@@ -509,9 +509,9 @@
 }
 
 _code?><?page
-title=>   <?_code return $_[1]->{'title'}; _code?>
-body=>    <?_code return $_[1]->{'body'}; _code?>
-bodyopts=><?_code return $_[1]->{'bodyopts'}; _code?>
+title=>   <?_code return $_[0]->{'title'}; _code?>
+body=>    <?_code return $_[0]->{'body'}; _code?>
+bodyopts=><?_code return $_[0]->{'bodyopts'}; _code?>
 head<=
 
 <?entryformcss?>
@@ -519,7 +519,7 @@
 {
     use strict;
 
-    my $ret = $_[1]->{'head'};
+    my $ret = $_[0]->{'head'};
 
     LJ::need_res(qw(
                     js/core.js
@@ -569,7 +569,7 @@
 
         function init_update_bml() {
             setTimeout(function(){ $initDraft }, 0)
-            $_[1]->{'onload'}
+            $_[0]->{'onload'}
             $pageload
         }
 

Modified: branches/modernize2/htdocs/userinfo.bml
===================================================================
--- branches/modernize2/htdocs/userinfo.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/userinfo.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -5,8 +5,7 @@
 
     BML::set_language_scope('/userinfo.bml');
 
-    my $r = Apache->request;
-    $r->notes("codepath" => "bml.userinfo");
+    LJ::Request->notes("codepath" => "bml.userinfo");
 
     $bml_okay = 1;
     $title = $ML{'.title'};
@@ -37,7 +36,7 @@
     # if new-style URLs, get the GET{user} arg from the request notes,
     # which was set by LiveJournal.pm
     unless ($GET{'user'}) {
-        $GET{'user'} = $r->notes("_journal");
+        $GET{'user'} = LJ::Request->notes("_journal");
     }
 
     my $remote = LJ::get_remote();

Modified: branches/modernize2/htdocs/userinfo2.bml
===================================================================
--- branches/modernize2/htdocs/userinfo2.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/userinfo2.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -27,8 +27,7 @@
  # if new-style URLs, get the GET{user} arg from the request notes,
  # which was set by LiveJournal.pm
  unless ($GET{'user'}) {
-     my $r = Apache->request;
-     $GET{'user'} = $r->notes("_journal");
+     $GET{'user'} = LJ::Request->notes("_journal");
  }
 
  my $remote = LJ::get_remote();

Modified: branches/modernize2/htdocs/userinfo3.bml
===================================================================
--- branches/modernize2/htdocs/userinfo3.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/userinfo3.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -27,8 +27,7 @@
  # if new-style URLs, get the GET{user} arg from the request notes,
  # which was set by LiveJournal.pm
  unless ($GET{'user'}) {
-     my $r = Apache->request;
-     $GET{'user'} = $r->notes("_journal");
+     $GET{'user'} = LJ::Request->notes("_journal");
  }
 
  my $remote = LJ::get_remote();

Modified: branches/modernize2/htdocs/userinfo_2008.bml
===================================================================
--- branches/modernize2/htdocs/userinfo_2008.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/userinfo_2008.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -5,8 +5,7 @@
 
     BML::set_language_scope('/userinfo.bml');
 
-    my $r = Apache->request;
-    $r->notes("codepath" => "bml.userinfo");
+    LJ::Request->notes("codepath" => "bml.userinfo");
 
     $bml_okay = 1;
     $title = $ML{'.title'};
@@ -29,7 +28,7 @@
     # if new-style URLs, get the GET{user} arg from the request notes,
     # which was set by LiveJournal.pm
     unless ($GET{'user'}) {
-        $GET{'user'} = $r->notes("_journal");
+        $GET{'user'} = LJ::Request->notes("_journal");
     }
 
     my $remote = LJ::get_remote();

Modified: branches/modernize2/htdocs/view/index.bml
===================================================================
--- branches/modernize2/htdocs/view/index.bml	2010-01-19 12:02:28 UTC (rev 16107)
+++ branches/modernize2/htdocs/view/index.bml	2010-01-20 08:17:38 UTC (rev 16108)
@@ -8,14 +8,13 @@
  $body = "";
 
 my $uri = BML::get_uri();
-my $r = Apache->request;
 if ($uri =~ m!/(\d\d\d\d)/(\d\d)/?$!) {
-    $FORM{'user'} = $r->notes('_journal');
+    $FORM{'user'} = LJ::Request->notes('_journal');
     $FORM{'type'} = "month";
     $FORM{'y'} =  $1;
     $FORM{'m'} = $2 + 0;
 }
-$r->notes("codepath" => "bml.view.index");
+LJ::Request->notes("codepath" => "bml.view.index");
 
  my $view = $FORM{'type'};
  my $user = $FORM{'user'};

Tags: bml, livejournal, look, pm, wildkin
Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments