Committer: gprochaev
merged with 'fotki' branchU trunk/cgi-bin/Apache/LiveJournal.pm U trunk/cgi-bin/LJ/URI.pm U trunk/cgi-bin/ljlib.pl U trunk/cgi-bin/weblib.pl U trunk/htdocs/js/entry.js U trunk/htdocs/stc/lj_base.css
Modified: trunk/cgi-bin/Apache/LiveJournal.pm =================================================================== --- trunk/cgi-bin/Apache/LiveJournal.pm 2011-08-05 06:27:24 UTC (rev 19609) +++ trunk/cgi-bin/Apache/LiveJournal.pm 2011-08-05 06:30:18 UTC (rev 19610) @@ -706,6 +706,55 @@ return $bml_handler->("$LJ::HOME/htdocs/$file"); } + if ($opts->{'mode'} eq "ljphotoalbums" && $opts->{'user'} ne 'pics') { + my $burl = LJ::remote_bounce_url(); + return remote_domsess_bounce() if LJ::remote_bounce_url(); + LJ::Request->notes("_journal" => $opts->{'user'}); + + my $u = LJ::load_user($opts->{user}); + if ($u) { + LJ::Request->notes("journalid" => $u->{userid}); + } else { + 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); + + my %post_params = LJ::Request->post_params; + if (!$remote && !LJ::Auth->check_sessionless_auth_token ( + $LJ::DOMAIN_WEB."/pics/upload", + auth_token => $post_params{'form_auth'}, + user => $opts->{user}) + ) { + LJ::Request->pnotes ('error' => 'members'); + LJ::Request->pnotes ('remote' => LJ::load_user($opts->{'user'})); + return LJ::Request::FORBIDDEN; + } + + LJ::set_remote ($u) unless $remote; + $remote = LJ::get_remote(); + unless ($remote && $remote->is_mutual_friend($comm)) { + LJ::Request->pnotes ('error' => 'members'); + LJ::Request->pnotes ('remote' => LJ::get_remote()); + return LJ::Request::FORBIDDEN; + } + ## + + unless ($u->is_person) { + LJ::Request->pnotes ('error' => 'e404'); + LJ::Request->pnotes ('remote' => LJ::get_remote()); + return LJ::Request::FORBIDDEN; + } + + # handle normal URI mappings + if (my $bml_file = $LJ::URI_MAP{"/pics"}) { + return LJ::URI->bml_handler($bml_file); + } + } + if ($opts->{'mode'} eq "wishlist") { return $bml_handler->("$LJ::HOME/htdocs/wishlist.bml"); } @@ -771,6 +820,12 @@ return redir(LJ::Session->setdomsess_handler()); } + if (LJ::Request->uri eq '/crossdomain.xml') { + LJ::Request->handler("perl-script"); + LJ::Request->set_handlers(PerlHandler => \&crossdomain_content); + return LJ::Request::OK; + } + if ($uuri =~ m#^/(\d+)\.html$#) { # my $u = LJ::load_user($user); @@ -788,8 +843,10 @@ $mode = "entry"; } - } - elsif ( $uuri =~ m|^/(\d\d\d\d)(?:/(\d\d)(?:/(\d\d))?)?(/?)$| ) { + } elsif ($uuri =~ m#^/pics#) { + $mode = "ljphotoalbums"; + + } elsif ($uuri =~ m#^/(\d\d\d\d)(?:/(\d\d)(?:/(\d\d))?)?(/?)$#) { my ($year, $mon, $day, $slash) = ($1, $2, $3, $4); unless ( $slash ) { Modified: trunk/cgi-bin/LJ/URI.pm =================================================================== --- trunk/cgi-bin/LJ/URI.pm 2011-08-05 06:27:24 UTC (rev 19609) +++ trunk/cgi-bin/LJ/URI.pm 2011-08-05 06:30:18 UTC (rev 19610) @@ -29,6 +29,9 @@ return LJ::URI->bml_handler($bml_handler_path) if $bml_handler_path; } + ## URI "/pics" can be handle only under user domains + return undef if $uri =~ /^\/pics/; + # handle normal URI mappings if (my $bml_file = $LJ::URI_MAP{$uri}) { return LJ::URI->bml_handler($bml_file); Modified: trunk/cgi-bin/ljlib.pl =================================================================== --- trunk/cgi-bin/ljlib.pl 2011-08-05 06:27:24 UTC (rev 19609) +++ trunk/cgi-bin/ljlib.pl 2011-08-05 06:30:18 UTC (rev 19610) @@ -105,6 +105,7 @@ "comet_history", "pingrel", "eventrates", "eventratescounters", "friending_actions_q", + "fotki_albums", "fotki_photos", "fotki_tags", "fotki_tags_map", ); # keep track of what db locks we have out @@ -292,6 +293,7 @@ "captcha_audio" => 3, "captcha_image" => 4, "fotobilder" => 5, + "photoalbums" => 6, }->{$name}; # FIXME: add hook support, so sites can't define their own # general code gets priority on numbers, say, 1-200, so verify Modified: trunk/cgi-bin/weblib.pl =================================================================== --- trunk/cgi-bin/weblib.pl 2011-08-05 06:27:24 UTC (rev 19609) +++ trunk/cgi-bin/weblib.pl 2011-08-05 06:30:18 UTC (rev 19610) @@ -2228,6 +2228,8 @@ push @classes, "index-page"; } elsif ($uri =~ m!^/shop(/.*)?$!) { push @classes, "shop-page"; + } elsif ($uri =~ m!^/pics(/.*)?$!) { + push @classes, "framework-page"; } elsif ($uri =~ m!^/browse(/.*)?$!) { push @classes, "catalogue-page"; } elsif ($uri =~ m!^/games(/.*)?$! || $host eq "$LJ::USERAPPS_SUBDOMAIN.$LJ::DOMAIN") { Modified: trunk/htdocs/js/entry.js =================================================================== --- trunk/htdocs/js/entry.js 2011-08-05 06:27:24 UTC (rev 19609) +++ trunk/htdocs/js/entry.js 2011-08-05 06:30:18 UTC (rev 19610) @@ -972,16 +972,19 @@ InOb.handleInsertImage = function (){ // if PhotoHosting enabled - show new popup - if(window.ljphotoEnabled){ - jQuery('#content').photouploader('option', 'type', 'upload') - .bind('htmlready', function (event, htmlOutput){ - jQuery('#draft').val(jQuery('#draft').val() + htmlOutput); - }).photouploader('show'); - } else { - onInsertObject('/imgupload.bml'); - } - return true; + if (window.ljphotoEnabled) { + jQuery('#updateForm') + .photouploader('option', 'type', 'upload') + .bind('htmlready', function (event, htmlOutput) { + jQuery('#draft').val(jQuery('#draft').val() + htmlOutput); + }) + .photouploader('show'); + } else { + onInsertObject('/imgupload.bml'); + } + return true; }; + InOb.handleInsertVideo = function(){ var videoUrl = prompt('Please enter a video URL:'); var draft = $('draft'); Modified: trunk/htdocs/stc/lj_base.css =================================================================== --- trunk/htdocs/stc/lj_base.css 2011-08-05 06:27:24 UTC (rev 19609) +++ trunk/htdocs/stc/lj_base.css 2011-08-05 06:30:18 UTC (rev 19610) @@ -2294,7 +2294,7 @@ /* Must be removed after implementation of Framework! */ .b-popup { position: absolute; - font-size:12px; + font-size: 12px; z-index: 4000; background-color:transparent; } @@ -2983,7 +2983,7 @@ --------------------------- */ /* Must be removed after implementation of Framework! */ .b-fader { - position: absolute; + position: fixed; top: 0; left: 0; width: 100%;