Committer: ailyin
LJINT-362 (Comments for side projects)U trunk/cgi-bin/LJ/Talk.pm U trunk/htdocs/gadgets/logcom.bml U trunk/htdocs/talkpost_do.bml U trunk/templates/CommentForm/FormEmbedable.tmpl
Modified: trunk/cgi-bin/LJ/Talk.pm =================================================================== --- trunk/cgi-bin/LJ/Talk.pm 2011-01-27 11:32:30 UTC (rev 18130) +++ trunk/cgi-bin/LJ/Talk.pm 2011-01-27 12:07:20 UTC (rev 18131) @@ -1876,6 +1876,7 @@ 'logout_url' => $opts->{'logout_url'}, 'js_check_domain' => $opts->{'js_check_domain'}, + 'partner_domain' => $opts->{'partner_domain'}, ); return $template->output; Modified: trunk/htdocs/gadgets/logcom.bml =================================================================== --- trunk/htdocs/gadgets/logcom.bml 2011-01-27 11:32:30 UTC (rev 18130) +++ trunk/htdocs/gadgets/logcom.bml 2011-01-27 12:07:20 UTC (rev 18131) @@ -13,12 +13,17 @@ my $docid = LJ::Request->get_param('docid'); my $api_key = LJ::Request->get_param('rsk'); + my $domain = LJ::Request->get_param('domain'); ## convert remote-site key to lj.com's community my $partner = LJ::PartnerSite->find_by_api_key($api_key); return 'unknown key' unless $partner; + unless ( $partner->is_domain_trusted($domain) ) { + return 'this domain doesn\'t belong to this partner'; + } + $partner->request_logcom_resources; my $journal = $partner->journal; @@ -26,7 +31,12 @@ return 'rate limit exceeded' unless LJ::RateLimit->check( $journal, $partner->rate_limits ); - my $js_check_domain = $partner->domain_check_js( { 'mode' => 'logcom' } ); + my $js_check_domain = $partner->domain_check_js( + { + 'mode' => 'logcom', + 'partner_domain' => $domain, + } + ); my $entry = $partner->find_entry_by_docid($docid); my $jitemid = $entry->jitemid; @@ -57,6 +67,7 @@ 'embedable_form' => 1, 'logout_url' => $logout_url, 'js_check_domain' => $js_check_domain, + 'partner_domain' => $domain, 'remote' => $remote, 'journalu' => $journal, Modified: trunk/htdocs/talkpost_do.bml =================================================================== --- trunk/htdocs/talkpost_do.bml 2011-01-27 11:32:30 UTC (rev 18130) +++ trunk/htdocs/talkpost_do.bml 2011-01-27 12:07:20 UTC (rev 18131) @@ -183,6 +183,8 @@ = $partner->domain_check_js( { 'mode' => 'logcom' } ); $partner->request_logcom_resources; + + $talkform_opts->{'partner_domain'} = $POST{'partner_domain'}; } return LJ::Talk::talkform($talkform_opts); @@ -248,13 +250,15 @@ my $partner = LJ::PartnerSite->find_by_journal_username($journalu->username); - my $uri = URI->new( $partner->xdreceiver_url ); + my $uri + = URI->new( $partner->xdreceiver_url( $POST{'partner_domain'} ) ); my $parentid = $parent->{'talkid'} ? $parent->{'talkid'} * 256 + $entry->anum : 0; $uri->query_form( $uri->query_form, + 'mode' => 'addcomment', 'comment_id' => $dtalkid, 'replyto' => $parentid, ); Modified: trunk/templates/CommentForm/FormEmbedable.tmpl =================================================================== --- trunk/templates/CommentForm/FormEmbedable.tmpl 2011-01-27 11:32:30 UTC (rev 18130) +++ trunk/templates/CommentForm/FormEmbedable.tmpl 2011-01-27 12:07:20 UTC (rev 18131) @@ -7,6 +7,7 @@ <TMPL_VAR lj_res_includes> </head> <body> + <TMPL_VAR js_check_domain> <div class="lj3-form-wrapper"> <form class="lj3-form lj3-post-comment lj3-active" id="postform" method="post" action="/talkpost_do.bml" target=""> <TMPL_IF errors> @@ -18,6 +19,7 @@ <input type="hidden" name="usertype" value="<TMPL_VAR usertype_default>"> <input type="hidden" name="is_form_embedded" value="1"> <input type="hidden" name="cookieuser" value="<TMPL_VAR remote_username>"> + <input type="hidden" name="partner_domain" value="<TMPL_VAR expr="ehtml(partner_domain)">" > <fieldset> <p class="lj3-identity"> От <strong><a href="javascript:void(0);"><TMPL_VAR remote_display_name></a></strong>