Committer: amyshkin
LJSUP-8857: Updating commenting formU trunk/htdocs/talkpost_do.bml
Modified: trunk/htdocs/talkpost_do.bml =================================================================== --- trunk/htdocs/talkpost_do.bml 2011-08-25 07:04:56 UTC (rev 19830) +++ trunk/htdocs/talkpost_do.bml 2011-08-25 07:12:51 UTC (rev 19831) @@ -4,7 +4,7 @@ use strict; our ( %ML, %GET, %POST, $title, $body ); - my ( $status, $result, $message, $answer, $redirected, $user_url ); + my ( $status, $result, $answer, $redirected, $user_url ); my $restore_old = sub { my $remote = LJ::get_remote(); @@ -39,17 +39,14 @@ my $external_site_case = $POST{'is_form_embedded'}; my $site_scheme_wrap = ! $external_site_case; - my $ajax = $POST{json} || 0; + # stupid hack to allow hotmail people to post, since hotmail changes + # POST forms to GET. this isn't a security problem (GET -> POST escalation) + # since talklib.pl's LJ::Talk::Post::init checks for $POST{'ecphash'} + # and requires it to be correct. if it's not, the page fails. + %POST = %GET if $GET{'ecphash'}; + my $ajax = $POST{'json'} || 0; my $render_body = sub { - # stupid hack to allow hotmail people to post, since hotmail changes - # POST forms to GET. this isn't a security problem (GET -> POST escalation) - # since talklib.pl's LJ::Talk::Post::init checks for $POST{'ecphash'} - # and requires it to be correct. if it's not, the page fails. - if ($GET{'ecphash'}) { - %POST = %GET; - } - if ($LJ::TALK_ABORT_REGEXP) { my $tempbody = $POST{'body'}; LJ::CleanHTML::clean_comment(\$tempbody); @@ -361,7 +358,8 @@ # is screened itself, or they logged in if (!($wasscreened and $parent->{state} ne 'S') && !$init->{didlogin}) { LJ::set_lastcomment($journalu->{'userid'}, $remote, $dtalkid); - return BML::redirect($redirect->($commentlink)); + return $redirect->($commentlink) if $ajax; + return BML::redirect($commentlink); } $mlcode = '.success.message2'; @@ -408,21 +406,13 @@ : ''; if ( $ajax ) { - my $res = { - status => $status, - ( - $result - ? ( result => $result ) - : ( message => $message ) - ) - }; - - return qq~ + $result => LJ::eurl($result); + return qq~ <!DOCTYPE html> <html> <head></head> <body> -<iframe src="$user_url/xdreceiver.html?status=$status&result=$result&message=$message" /> +<iframe src="$user_url/xdreceiver.html?status=$status&result=$result" /> </body> </html> ~;