Committer: ailyin
LJSUP-14607 (Opportunity to show error page instead of pages, defined by URL)U trunk/cgi-bin/Apache/LiveJournal.pm U trunk/cgi-bin/LJ/Console/Command/SetBadpassword.pm U trunk/cgi-bin/LJ/Console/Command/Suspend.pm U trunk/cgi-bin/LJ/Console/Command/Unsuspend.pm
Modified: trunk/cgi-bin/Apache/LiveJournal.pm =================================================================== --- trunk/cgi-bin/Apache/LiveJournal.pm 2012-12-14 08:35:23 UTC (rev 23468) +++ trunk/cgi-bin/Apache/LiveJournal.pm 2012-12-14 08:42:54 UTC (rev 23469) @@ -433,6 +433,19 @@ } } + my $middleware_response; + LJ::run_hooks( 'middleware_handler', \$middleware_response ); + if ($middleware_response) { + LJ::Request->handler('perl-script'); + LJ::Request->set_handlers( 'PerlHandler' => sub { + my $result = eval { $middleware_response->output; 1 }; + warn $@ unless $result; + return LJ::Request::DONE; + } ); + + return LJ::Request::OK; + } + # process controller # if defined if ( my $controller = LJ::Request->notes('controller') ) { Modified: trunk/cgi-bin/LJ/Console/Command/SetBadpassword.pm =================================================================== --- trunk/cgi-bin/LJ/Console/Command/SetBadpassword.pm 2012-12-14 08:35:23 UTC (rev 23468) +++ trunk/cgi-bin/LJ/Console/Command/SetBadpassword.pm 2012-12-14 08:42:54 UTC (rev 23469) @@ -18,7 +18,7 @@ sub can_execute { my $remote = LJ::get_remote(); - return LJ::check_priv($remote, "suspend"); + return LJ::check_priv( $remote, 'suspend', '' ); } sub execute { Modified: trunk/cgi-bin/LJ/Console/Command/Suspend.pm =================================================================== --- trunk/cgi-bin/LJ/Console/Command/Suspend.pm 2012-12-14 08:35:23 UTC (rev 23468) +++ trunk/cgi-bin/LJ/Console/Command/Suspend.pm 2012-12-14 08:42:54 UTC (rev 23469) @@ -19,7 +19,7 @@ sub can_execute { my $remote = LJ::get_remote(); - return LJ::check_priv($remote, "suspend") || $LJ::IS_DEV_SERVER; + return LJ::check_priv( $remote, 'suspend', '' ) || $LJ::IS_DEV_SERVER; } sub execute { Modified: trunk/cgi-bin/LJ/Console/Command/Unsuspend.pm =================================================================== --- trunk/cgi-bin/LJ/Console/Command/Unsuspend.pm 2012-12-14 08:35:23 UTC (rev 23468) +++ trunk/cgi-bin/LJ/Console/Command/Unsuspend.pm 2012-12-14 08:42:54 UTC (rev 23469) @@ -18,7 +18,7 @@ sub can_execute { my $remote = LJ::get_remote(); - return LJ::check_priv($remote, "suspend") + return LJ::check_priv( $remote, 'suspend', '' ) || LJ::check_priv($remote, "unsuspend") || $LJ::IS_DEV_SERVER; }