Committer: sbelyaev
LJSUP-12374: External domain redirerects to lj user domanU trunk/cgi-bin/Apache/LiveJournal.pm
Modified: trunk/cgi-bin/Apache/LiveJournal.pm =================================================================== --- trunk/cgi-bin/Apache/LiveJournal.pm 2012-05-29 08:00:32 UTC (rev 22087) +++ trunk/cgi-bin/Apache/LiveJournal.pm 2012-05-29 08:06:28 UTC (rev 22088) @@ -1204,10 +1204,15 @@ && $host =~ /[^\d\.]/ ) { my $u = LJ::User->new_from_external_domain($host); + my $ru_lj_user; + if ($host =~ /(.*?)\.?(?:xn--80adlbihqogw6a|xn--f1aa)\.xn--p1ai/) { + $ru_lj_user = $1; + } + unless ($u) { - if ($host =~ /(.*?)\.?(?:xn--80adlbbiisqhy9a|xn--f1aa)\.xn--p1ai/) { - if ($1 && !$LJ::DOMAIN_JOURNALS_RU_MAINPAGE{$1}) { + if ($ru_lj_user) { + if (!$LJ::DOMAIN_JOURNALS_RU_MAINPAGE{$ru_lj_user}) { LJ::Request->pnotes ('error' => 'baddomainru'); LJ::Request->pnotes ('domainname' => $host); LJ::Request->pnotes ('uri_domain_shop' => "$LJ::SITEROOT/shop/domain_ru.bml"); @@ -1227,7 +1232,7 @@ my $check_host = lc($host); $check_host =~ s/^www\.//; - if ($LJ::DOMAIN_JOURNALS_REVERSE{$check_host} || $LJ::DOMAIN_JOURNALS{$u->user}) { + if (!$ru_lj_user || $LJ::DOMAIN_JOURNALS_REVERSE{$check_host} || $LJ::DOMAIN_JOURNALS{$u->user}) { my $view = $determine_view->($u->user, "other:$host$hostport", $uri); return $view if defined $view; } else {