wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[livejournal] r17234: LJSUP-6680. Disable "custom userheads" f...

Committer: gprochaev
LJSUP-6680. Disable "custom userheads" feature for nonSUP users

U   trunk/htdocs/manage/profile/index.bml
U   trunk/htdocs/tools/endpoints/ctxpopup.bml
Modified: trunk/htdocs/manage/profile/index.bml
===================================================================
--- trunk/htdocs/manage/profile/index.bml	2010-08-31 03:36:28 UTC (rev 17233)
+++ trunk/htdocs/manage/profile/index.bml	2010-08-31 06:37:24 UTC (rev 17234)
@@ -230,55 +230,58 @@
         }
 
         ## USERHEADS
-        if ($u->is_personal) {
-            $ret .= "<a name='userheads'></a><div class='section_head'>$ML{'.section.userheads'}</div>\n";
+        my $is_remote_sup = LJ::SUP->is_remote_sup();
+        unless (!$is_remote_sup && $LJ::DISABLED{'userhead_nonsup'}) {
+            if ($u->is_personal) {
+                $ret .= "<a name='userheads'></a><div class='section_head'>$ML{'.section.userheads'}</div>\n";
 
-            $ret .= "<table class='field_block' style='width:100%'>\n";
+                $ret .= "<table class='field_block' style='width:100%'>\n";
 
-            $ret .= "<tr><td class='field_name'>$ML{'.fn.active.userhead'}</td><td>";
-            my $uh_prop = $u->custom_usericon;
-            my $class = LJ::Pay::Payment::PayItem->get_class_for_item('userhead');
-            my $uhs = $class->get_expire_times ($u);
-            if ($uh_prop) {
-                ## Try to fetch expire date by userhead user's prop
-                ## At first we try to find uh in a shop
-                my $uhs_all = LJ::UserHead->get_all_userheads ();
-                my ($uh) = grep { $_->get_uh_img eq $uh_prop } @$uhs_all;
-                if ($uh) {
-                    ## we found a uh. get id and look at paid exp for expire date
-                    $ret .= "<img src='".$uh->get_uh_img."' class='i-manage-userhead' />";
-                    ## whether the user bought userhead?
-                    if (my ($found_uh) = grep { $_->{item} == "uh_".$uh->get_uh_id } @$uhs) {
-                        $ret .= '&nbsp;'. LJ::Lang::ml('.section.userheads.expire_date', { date => $date_format->($found_uh->{expdate}) });
+                $ret .= "<tr><td class='field_name'>$ML{'.fn.active.userhead'}</td><td>";
+                my $uh_prop = $u->custom_usericon;
+                my $class = LJ::Pay::Payment::PayItem->get_class_for_item('userhead');
+                my $uhs = $class->get_expire_times ($u);
+                if ($uh_prop) {
+                    ## Try to fetch expire date by userhead user's prop
+                    ## At first we try to find uh in a shop
+                    my $uhs_all = LJ::UserHead->get_all_userheads ();
+                    my ($uh) = grep { $_->get_uh_img eq $uh_prop } @$uhs_all;
+                    if ($uh) {
+                        ## we found a uh. get id and look at paid exp for expire date
+                        $ret .= "<img src='".$uh->get_uh_img."' class='i-manage-userhead' />";
+                        ## whether the user bought userhead?
+                        if (my ($found_uh) = grep { $_->{item} == "uh_".$uh->get_uh_id } @$uhs) {
+                            $ret .= '&nbsp;'. LJ::Lang::ml('.section.userheads.expire_date', { date => $date_format->($found_uh->{expdate}) });
+                        }
+                    } else {
+                        if ($uh_prop =~ /^http/) {
+                            $ret .= "<img src='$uh_prop' class='i-manage-userhead' />";
+                        } else {
+                            $ret .= "<img src='$LJ::FILEPREFIX/$uh_prop' class='i-manage-userhead' />";
+                        }
                     }
                 } else {
-                    if ($uh_prop =~ /^http/) {
-                        $ret .= "<img src='$uh_prop' class='i-manage-userhead' />";
-                    } else {
-                        $ret .= "<img src='$LJ::IMGPREFIX/$uh_prop' class='i-manage-userhead' />";
+                    $ret .= "<img src='$LJ::DEFAULT_USERHEAD' class='i-manage-userhead' />&nbsp;$ML{'.fn.userheads.default_userhead'}";
+                }
+                $ret .= "</td></tr>";
+                $ret .= "<tr><td class='field_name'>$ML{'.fn.userheads.collection'}</td><td>";
+                if (scalar @$uhs) {
+                    $ret .= '<p class="b-manage-userheads-desc">' . LJ::Lang::ml('.section.userhead.apply.href', { aopts => "href='$LJ::SITEROOT/shop/userheads.bml'" } ) . '</p>';
+                    $ret .= '<ul class="b-manage-userheads">';
+                    $ret .= "<li><label for='userhead0'><input type='radio' name='uh_id' value='default' id='userhead0' /><img src='$LJ::DEFAULT_USERHEAD' class='i-manage-userhead' />&nbsp;$ML{'.fn.userheads.default_userhead'}</label></li>";
+                    foreach my $uh (@$uhs) {
+                        my ($uh_id) = $uh->{item} =~ /uh-(\d+)/;
+                        my $uh_obj = LJ::UserHead->get_userhead ($uh_id);
+                        $ret .= "<li><label for='userhead$uh_id'><input type='radio' name='uh_id' value='$uh_id' id='userhead$uh_id' /><img src='".$uh_obj->get_uh_img . "' class='i-manage-userhead' /> " . LJ::Lang::ml('.section.userheads.expire_date', { date => $date_format->($uh->{expdate}) })."</label></li>" if $uh_obj;
                     }
+                    $ret .= '</ul>';
+                } else {
+                    $ret .= LJ::Lang::ml('.section.userhead.no_userheads', { url => $LJ::SITEROOT."/shop/userheads.bml" });
                 }
-            } else {
-                $ret .= "<img src='$LJ::DEFAULT_USERHEAD' class='i-manage-userhead' />&nbsp;$ML{'.fn.userheads.default_userhead'}";
+                $ret .= "</td></tr>\n\n";
+
+                $ret .= "</table>\n";
             }
-            $ret .= "</td></tr>";
-            $ret .= "<tr><td class='field_name'>$ML{'.fn.userheads.collection'}</td><td>";
-            if (scalar @$uhs) {
-                $ret .= '<p class="b-manage-userheads-desc">' . LJ::Lang::ml('.section.userhead.apply.href', { aopts => "href='$LJ::SITEROOT/shop/userheads.bml'" } ) . '</p>';
-                $ret .= '<ul class="b-manage-userheads">';
-                $ret .= "<li><label for='userhead0'><input type='radio' name='uh_id' value='default' id='userhead0' /><img src='$LJ::DEFAULT_USERHEAD' class='i-manage-userhead' />&nbsp;$ML{'.fn.userheads.default_userhead'}</label></li>";
-                foreach my $uh (@$uhs) {
-                    my ($uh_id) = $uh->{item} =~ /uh-(\d+)/;
-                    my $uh_obj = LJ::UserHead->get_userhead ($uh_id);
-                    $ret .= "<li><label for='userhead$uh_id'><input type='radio' name='uh_id' value='$uh_id' id='userhead$uh_id' /><img src='".$uh_obj->get_uh_img . "' class='i-manage-userhead' /> " . LJ::Lang::ml('.section.userheads.expire_date', { date => $date_format->($uh->{expdate}) })."</label></li>" if $uh_obj;
-                }
-                $ret .= '</ul>';
-            } else {
-                $ret .= LJ::Lang::ml('.section.userhead.no_userheads', { url => $LJ::SITEROOT."/shop/userheads.bml" });
-            }
-            $ret .= "</td></tr>\n\n";
-
-            $ret .= "</table>\n";
         }
 
         ## INTERESTS

Modified: trunk/htdocs/tools/endpoints/ctxpopup.bml
===================================================================
--- trunk/htdocs/tools/endpoints/ctxpopup.bml	2010-08-31 03:36:28 UTC (rev 17233)
+++ trunk/htdocs/tools/endpoints/ctxpopup.bml	2010-08-31 06:37:24 UTC (rev 17234)
@@ -19,6 +19,7 @@
 
     # get user
     my $remote = LJ::get_remote();
+    my $is_remote_sup = LJ::SUP->is_remote_sup();
 
     my $get_user = sub {
         # three ways to load a user:
@@ -78,6 +79,7 @@
     } else {
         $ret{is_custom_userhead} = 1;
     }
+    $ret{is_custom_userhead} = 0 if !$is_remote_sup && $LJ::DISABLED{'userhead_nonsup'};
 
     my $up = $u->userpic;
     if ($up) {

Tags: bml, livejournal, wisest-owl
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