wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[livejournal] r19631: LJSUP-8713. Add disable flag for a new l...

Committer: wisest-owl
LJSUP-8713. Add disable flag for a new lj photo hosting

U   trunk/cgi-bin/Apache/LiveJournal.pm
U   trunk/htdocs/update.bml
Modified: trunk/cgi-bin/Apache/LiveJournal.pm
===================================================================
--- trunk/cgi-bin/Apache/LiveJournal.pm	2011-08-08 07:28:54 UTC (rev 19630)
+++ trunk/cgi-bin/Apache/LiveJournal.pm	2011-08-08 08:01:48 UTC (rev 19631)
@@ -721,6 +721,12 @@
                 return LJ::Request::NOT_FOUND;
             }
 
+            if ($LJ::DISABLED{'new_ljphoto'}) {
+                LJ::Request->pnotes ('error' => 'baduser');
+                LJ::Request->pnotes ('remote' => LJ::get_remote());
+                return LJ::Request::NOT_FOUND;
+            }
+
             ## For beta-testers only.
             my $comm = LJ::load_user($LJ::LJPHOTO_ALLOW_FROM_COMMUNITY);
 
@@ -1397,6 +1403,7 @@
 <!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
 <cross-domain-policy>
     <site-control permitted-cross-domain-policies="master-only"/>
+    <allow-access-from domain="*.lj-11-m.bulyon.local"/>
     <allow-access-from domain="*.livejournal.com"/>
     <allow-access-from domain="*.livejournal.ru"/>
     <allow-access-from domain="*.i-jet.ru"/>

Modified: trunk/htdocs/update.bml
===================================================================
--- trunk/htdocs/update.bml	2011-08-08 07:28:54 UTC (rev 19630)
+++ trunk/htdocs/update.bml	2011-08-08 08:01:48 UTC (rev 19631)
@@ -370,37 +370,38 @@
 	
         ## Show a new photoalbums interface only for logged-in users
         my $remote = LJ::get_remote ();
-        if ($remote) {
+        my $comm = LJ::load_user($LJ::LJPHOTO_ALLOW_FROM_COMMUNITY);
+        my $ljphoto_enabled = !$LJ::DISABLED{'new_ljphoto'} && $remote && $remote->is_mutual_friend($comm) ? 1 : 0;
+        if ($remote && $ljphoto_enabled) {
             # in case of insert one photo or photo album
             my $insert_photos = [];
-            if ($remote) {
-                my $albums_id = $POST{'albums_id'} || $GET{'albums_id'};
-                my $photos_id = $POST{'photos_id'} || $GET{'photos_id'};
 
-                my @photos = grep { $_ } map {
-                    my $photo = LJ::Fotki::Photo->new ( url_id => $_, userid => $remote->userid );
-                    $photo;
-                } split (/,/, $photos_id);
+            my $albums_id = $POST{'albums_id'} || $GET{'albums_id'};
+            my $photos_id = $POST{'photos_id'} || $GET{'photos_id'};
 
-                foreach my $album_id (split /,/, $albums_id) {
-                    my $album = LJ::Fotki::Album->new ( url_id => $album_id, userid => $remote->userid );
-                    next unless $album;
-                    push @photos, @{$album->get_all_photos() || []};
-                }
+            my @photos = grep { $_ } map {
+                my $photo = LJ::Fotki::Photo->new ( url_id => $_, userid => $remote->userid );
+                $photo;
+            } split (/,/, $photos_id);
 
-                $insert_photos = [ grep { $_ } map {
-                        my $photo = $_;
-
-                        my $res = $photo->is_valid ? {
-                            photo_desc  => $photo->desc,
-                            photo_title => $photo->title,
-                            photo_url   => @photos > 1 ? $photo->u100_url : $photo->u600_url,
-                            photo_id    => $photo->url_id,
-                        } : undef;
-                        $res;
-                    } @photos ];
+            foreach my $album_id (split /,/, $albums_id) {
+                my $album = LJ::Fotki::Album->new ( url_id => $album_id, userid => $remote->userid );
+                next unless $album;
+                push @photos, @{$album->get_all_photos() || []};
             }
 
+            $insert_photos = [ grep { $_ } map {
+                    my $photo = $_;
+
+                    my $res = $photo->is_valid ? {
+                        photo_desc  => $photo->desc,
+                        photo_title => $photo->title,
+                        photo_url   => @photos > 1 ? $photo->u100_url : $photo->u600_url,
+                        photo_id    => $photo->url_id,
+                    } : undef;
+                    $res;
+                } @photos ];
+
             my $photo_sizes = LJ::JSON->to_json ( LJ::Fotki::Photo->get_photo_sizes() );
             my $album_list = [];
             my $album_list_json = '';
@@ -422,8 +423,6 @@
 
             my $auth_token = LJ::Auth->sessionless_auth_token ($LJ::DOMAIN_WEB."/pics/upload", user => $remote ? $remote->user : undef);
             my $user_groups = LJ::JSON->to_json (LJ::Widget::Fotki::Photo->get_user_groups ($remote));
-    		my $comm = LJ::load_user($LJ::LJPHOTO_ALLOW_FROM_COMMUNITY);
-    		my $ljphoto_enabled = $remote && $remote->is_mutual_friend($comm) ? 1 : 0;
             LJ::need_res('stc/pics/pics.css', 'js/swfupload/swfupload.js', 'js/swfupload/swfupload.queue.js', 'js/jquery/jquery.lj.photouploader.js');
 		
             $$body .= <<JS;

Tags: bml, livejournal, pm, wisest-owl
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