sunnyman's (sunnyman) wrote in changelog,
sunnyman's
sunnyman
changelog

[ljcom] r11429: LJSUP-10937: Error processing extended.

Committer: vtroitsky
LJSUP-10937: Error processing extended.
U   trunk/cgi-bin/LJ/Widget/Shop/View/SelfPromo.pm
U   trunk/htdocs/shop/selfpromo.bml.text.local
Modified: trunk/cgi-bin/LJ/Widget/Shop/View/SelfPromo.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/Shop/View/SelfPromo.pm	2012-02-08 10:26:41 UTC (rev 11428)
+++ trunk/cgi-bin/LJ/Widget/Shop/View/SelfPromo.pm	2012-02-08 11:52:11 UTC (rev 11429)
@@ -41,28 +41,26 @@
   
     # Get all data for all types ob promo objects!!!!
     foreach my $type qw( entry journal community ) {
-
         my $class = LJ::Pay::SelfPromo->get_class_by_type($type);
 
-        # TODO (refactoring): encapsulate logic into PromoObject 
-        my $buyout_cost = $class->buyout_cost;
-        ## 12345678 --> 12 345 678
-        my $buyout_split = join ' ', ($buyout_cost =~ /^(.?.?.?)(...)*$/);
-        my $ml_current_price = LJ::Lang::ml( '/shop/selfpromo.bml.current_price',
-            { 'price' => $buyout_split } );
-
-      
         my $ml_info_title_object = LJ::Lang::ml("/shop/selfpromo.bml.info.title.$type");
 
         my $hide_buyout = 0;
         my $owner_cancel = 0;
     # TODO (refactoring): Move that method into SelfPromo object 
         my $data_selfpromo = LJ::PersonalStats->get_selfpromo_data( { 'type' => $type } );
+
+    # TODO (refactoring): encapsulate logic into PromoObject 
+        my $buyout_cost = $class->buyout_cost;
+        ## 12345678 --> 12 345 678
+        my $buyout_split = join ' ', grep { $_ } ($buyout_cost =~ /^(.?.?.?)(...)*$/);
+        my $ml_current_price = LJ::Lang::ml( '/shop/selfpromo.bml.current_price', { 'price' => $buyout_split } );
         foreach my $row (@$data_selfpromo) {
 
             # TODO (refactoring): Incapsulate that logic into PromoObject + SelfPromo processor
             my $promo = $class->current_promo_info( $row->{'promoid'} );
 
+        
             # TODO (refactoring): Incapsulate that logic inside PromoObject functions  $promo->can_withdraw($remote);
             my $can_withdraw = LJ::u_equals($promo->promoter, $remote) || LJ::u_equals($promo->owner, $remote);
 
@@ -113,6 +111,13 @@
     unless ( LJ::check_form_auth() ) {
         $self->ml_error('error.invalidform');
     }
+
+    my $remote = LJ::get_remote();
+    unless ($remote) {
+        $self->ml_error('/shop/selfpromo.bml.error.not_logged_in');
+    }
+
+
     my $type = LJ::Request->post_param('type');
     $type = 'entry' unless $type =~ /(entry|journal|community)/;
     my $class = LJ::Pay::SelfPromo->get_class_by_type($type); 
@@ -152,6 +157,10 @@
 
         return LJ::JSON->to_json( { 'result' => $result, 'html' => $html } );
     };
+    my $remote = LJ::get_remote();
+    unless ($remote) {
+        return $format_result->( 'error', LJ::Lang::ml('/shop/selfpromo.bml.error.not_logged_in') );
+    }
 
     unless ( LJ::Request->post_param('confirm') ) {
         return $format_result->( 'error', LJ::Lang::ml('error.unconfirmed') );
@@ -169,8 +178,6 @@
         $object_url = 'http://' . $object_url;
     }
 
-    my $remote = LJ::get_remote();
-
 # TODO Refactoring: move logic inside PromoObject constructor  !!!
     # my $promo_object = LJ::SelfPromo::Promo->create_from_url(url => $object_url, type => $type);
 

Modified: trunk/htdocs/shop/selfpromo.bml.text.local
===================================================================
--- trunk/htdocs/shop/selfpromo.bml.text.local	2012-02-08 10:26:41 UTC (rev 11428)
+++ trunk/htdocs/shop/selfpromo.bml.text.local	2012-02-08 11:52:11 UTC (rev 11429)
@@ -28,46 +28,30 @@
 .journal_was_promoted=This journal was promoted in SelfPromo
 .community_was_promoted=This community was promoted in SelfPromo
 
-.error.entry_ineligible.cannot_manage=You cannot promote the entry at <a href="[[entry_url]]">[[entry_url]]</a> because you are not its author or community's owner/maintainer.
+.error.entry_ineligible.cannot_manage=You cannot promote the entry at <a href="[[object_url]]">[[object_url]]</a> because you are not its author or community's owner/maintainer.
 
-.error.entry_ineligible.entry_adult_content=The entry at <a href="[[entry_url]]">[[entry_url]]</a> cannot be promoted because it is marked as containing adult content.
+.error.entry_ineligible.entry_adult_content=The entry at <a href="[[object_url]]">[[object_url]]</a> cannot be promoted because it is marked as containing adult content.
 
-.error.entry_ineligible.entry_banned=The entry at <a href="[[entry_url]]">[[entry_url]]</a> cannot be promoted because it was banned from this service. If you believe this is in error, <a href="http://www.livejournal.com/support">contact our Support team</a>.
+.error.entry_ineligible.entry_banned=The entry at <a href="[[object_url]]">[[object_url]]</a> cannot be promoted because it was banned from this service. If you believe this is in error, <a href="http://www.livejournal.com/support">contact our Support team</a>.
 
-.error.entry_ineligible.entry_invisible=The entry at <a href="[[entry_url]]">[[entry_url]]</a> cannot be promoted because it is not a visible entry.
+.error.entry_ineligible.entry_invisible=The entry at <a href="[[object_url]]">[[object_url]]</a> cannot be promoted because it is not a visible entry.
 
-.error.entry_ineligible.entry_not_public=The entry at <a href="[[entry_url]]">[[entry_url]]</a> cannot be promoted because it is not publicly viewable.
+.error.entry_ineligible.entry_not_public=The entry at <a href="[[object_url]]">[[object_url]]</a> cannot be promoted because it is not publicly viewable.
 
-.error.entry_ineligible.journal_adult_content=The entry at <a href="[[entry_url]]">[[entry_url]]</a> cannot be promoted because [[journal_ljuser]] is marked as containing adult content.
+.error.entry_ineligible.journal_adult_content=The entry at <a href="[[object_url]]">[[object_url]]</a> cannot be promoted because [[journal_ljuser]] is marked as containing adult content.
 
-.error.entry_ineligible.journal_banned=The entry at <a href="[[entry_url]]">[[entry_url]]</a> cannot be promoted because the journal it is in was banned from this service. If you believe this is in error, <a href="http://www.livejournal.com/support">contact our Support team</a>.
+.error.entry_ineligible.journal_banned=The entry at <a href="[[object_url]]">[[object_url]]</a> cannot be promoted because the journal it is in was banned from this service. If you believe this is in error, <a href="http://www.livejournal.com/support">contact our Support team</a>.
 
-.error.entry_ineligible.journal_invisible=The entry at <a href="[[entry_url]]">[[entry_url]]</a> cannot be promoted because [[journal_ljuser]] is not a visible journal.
+.error.entry_ineligible.journal_invisible=The entry at <a href="[[object_url]]">[[object_url]]</a> cannot be promoted because [[journal_ljuser]] is not a visible journal.
 
-.error.entry_ineligible.not_found=We couldn't find any entry at <a href="[[entry_url]]">[[entry_url]]</a>.
+.error.entry_ineligible.not_found=We couldn't find any entry at <a href="[[object_url]]">[[object_url]]</a>.
 
-.error.entry_ineligible.poster_banned=You cannot promote the entry at <a href="[[entry_url]]">[[entry_url]]</a> cannot be promoted because you were banned from using this service. If you believe this is in error, <a href="http://www.livejournal.com/support">contact our Support team</a>.
+.error.entry_ineligible.poster_banned=You cannot promote the entry at <a href="[[object_url]]">[[object_url]]</a> cannot be promoted because you were banned from using this service. If you believe this is in error, <a href="http://www.livejournal.com/support">contact our Support team</a>.
 
-.error.entry_ineligible.poster_invisible=The entry at <a href="[[entry_url]]">[[entry_url]]</a> cannot be promoted because its author, [[poster_ljuser]], is not a visible user.
+.error.entry_ineligible.poster_invisible=The entry at <a href="[[object_url]]">[[object_url]]</a> cannot be promoted because its author, [[poster_ljuser]], is not a visible user.
 
-.error.entry_ineligible.promoter_poster_mismatch=You cannot promote the entry at <a href="[[entry_url]]">[[entry_url]]</a> because you are not its author.
+.error.entry_ineligible.promoter_poster_mismatch=You cannot promote the entry at <a href="[[object_url]]">[[object_url]]</a> because you are not its author.
 
-
-.error.journal_ineligible.no_public_entries=The journal <a href="[[object_url]]">[[object_url]]</a> cannot be promoted because it has no public entries.
-
-.error.journal_ineligible.journal_adult_content=The journal <a href="[[object_url]]">[[object_url]]</a> cannot be promoted because it is marked as containing adult content.
-
-.error.journal_ineligible.not_found=We couldn't find a journal specified <a href="[[object_url]]">[[object_url]]</a>.
-
-.error.journal_ineligible.not_journal=The specified journal is not personal one <a href="[[object_url]]">[[object_url]]</a>.
-
-.error.journal_ineligible.journal_banned=You cannot promote your journal because you were banned from using this service. If you believe this is in error, <a href="http://www.livejournal.com/support">contact our Support team</a>.
-
-.error.journal_ineligible.journal_invisible=The journal at <a href="[[object_url]]">[[object_url]]</a> cannot be promoted because it's invisible.
-
-.error.journal_ineligible.promoter_poster_mismatch=You cannot promote the other journal <a href="[[object_url]]">[[object_url]]</a> that yours.
-
-
 .error.community_ineligible.no_public_entries=The community <a href="[[object_url]]">[[object_url]]</a> cannot be promoted because it has no public entries.
 
 .error.community_ineligible.community_adult_content=The community <a href="[[object_url]]">[[object_url]]</a> cannot be promoted because it is marked as containing adult content.
@@ -84,7 +68,22 @@
 
 .error.community_ineligible.cannot_manage=You cannot promote the community <a href="[[object_url]]">[[object_url]]</a> that you can't manage.
 
+.error.journal_ineligible.no_public_entries=The journal <a href="[[object_url]]">[[object_url]]</a> cannot be promoted because it has no public entries.
 
+.error.journal_ineligible.journal_adult_content=The journal <a href="[[object_url]]">[[object_url]]</a> cannot be promoted because it is marked as containing adult content.
+
+.error.journal_ineligible.not_found=We couldn't find a journal specified <a href="[[object_url]]">[[object_url]]</a>.
+
+.error.journal_ineligible.not_journal=The specified journal is not personal one <a href="[[object_url]]">[[object_url]]</a>.
+
+.error.journal_ineligible.journal_banned=You cannot promote your journal because you were banned from using this service. If you believe this is in error, <a href="http://www.livejournal.com/support">contact our Support team</a>.
+
+.error.journal_ineligible.journal_invisible=The journal at <a href="[[object_url]]">[[object_url]]</a> cannot be promoted because it's invisible.
+
+.error.journal_ineligible.promoter_poster_mismatch=You cannot promote the other journal <a href="[[object_url]]">[[object_url]]</a> that yours.
+
+.error.not_logged_in=This action is not permitted for anonymous users. 
+
 .error.price_insufficient=[[price]] [[?price|LJ Token is|LJ Tokens are]] insufficient; you will need to pay at least [[need]] [[?need|LJ Token|LJ Tokens]].
 
 .error.price_invalid=[[price]] [[?price|LJ Token|LJ Tokens]] is an invalid price; the price must be a multiple of 100.
@@ -169,6 +168,8 @@
 .warning.log_in|staleness=1
 .warning.log_in=This service is available for logged in users only. Please <a href="http://www.livejournal.com/login.bml">sign in</a> or <a href="https://www.livejournal.com/create.bml">sign up</a>.
 
+
+
 .your.entry.could.be.here=Your entry could be here
 .your.journal.could.be.here=Your journal could be here
 .your.community.could.be.here=Your community could be here

Tags: ljcom, local, pm, sunnyman, vtroitsky
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments