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

[livejournal] r17500: LJSUP-6482. Use function to determine a ...

Committer: gprochaev
LJSUP-6482. Use function to determine a country, not ip class.

U   trunk/cgi-bin/LJ/Widget/SubscribeInterface.pm
U   trunk/htdocs/manage/profile/index.bml
Modified: trunk/cgi-bin/LJ/Widget/SubscribeInterface.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/SubscribeInterface.pm	2010-10-04 10:21:16 UTC (rev 17499)
+++ trunk/cgi-bin/LJ/Widget/SubscribeInterface.pm	2010-10-05 01:55:09 UTC (rev 17500)
@@ -21,7 +21,7 @@
     my $u = $opts->{'u'} || LJ::get_remote();
 
     my @ntypes = @LJ::NOTIFY_TYPES;
-    my (undef, $country) = LJ::GeoLocation->ip_class;
+    my $country = LJ::country_of_remote_ip();
     my $phone = LJ::SMS::API::RU::Phone->get_phone($u->userid);
     if ($LJ::DISABLED{smsru} or
         ($country ne 'RU'

Modified: trunk/htdocs/manage/profile/index.bml
===================================================================
--- trunk/htdocs/manage/profile/index.bml	2010-10-04 10:21:16 UTC (rev 17499)
+++ trunk/htdocs/manage/profile/index.bml	2010-10-05 01:55:09 UTC (rev 17500)
@@ -487,8 +487,9 @@
         $ret .= "</table>\n";
 
         ## TEXT MESSAGING
+        my $country = LJ::country_of_remote_ip();
         $ret .= "<a name='txtmsg'></a><div class='section_head'>" . 
-            (LJ::GeoLocation->ip_country() eq 'RU' ? $ML{'.section.phone'} : $ML{'.section.textmsg'}) . "\n";
+            ($country eq 'RU' ? $ML{'.section.phone'} : $ML{'.section.textmsg'}) . "\n";
         unless (LJ::get_cap($u, "textmessaging")) {
             my $inline;
             if ($inline .= LJ::run_hook("cprod_inline", $u, 'TextMessaging')) {
@@ -502,7 +503,7 @@
             foreach (values %$tminfo) { LJ::text_out(\$_); }
             $tminfo->{'security'} = "N" if ($u->{'txtmsg_status'} eq 'off' || $u->{'txtmsg_status'} eq 'none');
 
-            if ($LJ::DISABLED{smsru} || LJ::GeoLocation->ip_country() ne 'RU') {
+            if ($LJ::DISABLED{smsru} || $country ne 'RU') {
                 $ret .= "<span id='phone_view_options' class='view_options'>$ML{'.fn.txtmsg'}&nbsp;";
                 $ret .= LJ::html_select({ 'name' => 'txtmsg_security', 'selected' => $tminfo->{'security'} },
                                           "all" => BML::ml(".security.visibility.everybody"),
@@ -515,9 +516,9 @@
             }
 
             my $block_id = 'phone_verification';
-               $block_id = '' if $LJ::DISABLED{smsru} || LJ::GeoLocation->ip_country() ne 'RU'; ## empty block_id disables JS script
+               $block_id = '' if $LJ::DISABLED{smsru} || $country ne 'RU'; ## empty block_id disables JS script
             $ret .= "<table class='field_block' id='$block_id'>\n";
-            if ($LJ::DISABLED{smsru} || LJ::GeoLocation->ip_country() ne 'RU') {
+            if ($LJ::DISABLED{smsru} || $country ne 'RU') {
                 foreach (values %$tminfo) { LJ::text_out(\$_); }
                 ##
                 $ret .= "<tr><td class='field_name'>$ML{'.fn.servprov'}</td><td>";
@@ -537,7 +538,6 @@
             $ret .= "<tr><td class='field_name'>$ML{'.fn.txtnum'}</td><td>";
             $ret .= '<ul class="b-manage-smsn b-manage-smsn-hide">';
             $ret .= '<li class="b-manage-smsn-sms">' . LJ::html_text({ 'name' => 'txtmsg_number', 'value' => $tminfo->{'number'}, 'size' => '15', 'maxlength' => '15' });
-            my (undef, $country) = LJ::GeoLocation->ip_class;
             $ret .= '<br /><span class="helper">' . $ML{'.section.textmsg.example_us'} . '</span></li>' if $country eq 'US';
             $ret .= '<br /><span class="helper">' . $ML{'.section.textmsg.example_ru'} . '</span></li>' if $country eq 'RU';
             $ret .= '<li class="b-manage-smsn-status"><i class="i-manage-smsn-icon"></i><i class="help-icon">' . LJ::help_icon('sms_notification') . '</i><span class="i-bubble b-bubble-lite"><i class="i-bubble-arrow-border"></i><i class="i-bubble-arrow"></i><span>' . $ML{'.section.textmsg.info'} . ' </span></span></li>';
@@ -838,7 +838,7 @@
         my $tminfo = LJ::TextMessage->tm_info($u);
         # Check that text messaging is turned off and either
         # the provider or number have been set to null
-        if ($LJ::DISABLED{'smsru'} || LJ::GeoLocation->ip_country() ne 'RU') {
+        if ($LJ::DISABLED{'smsru'} || LJ::country_of_remote_ip() ne 'RU') {
             if ($txtmsg_status eq "off" &&
                 (($tminfo->{'provider'} && ! $POST{'txtmsg_provider'})
                 || ($tminfo->{'number'} && ! $POST{'txtmsg_number'}))

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