Committer: vsukhanov
LJSUP-6482: SMS Notification RUU trunk/bin/upgrading/update-db-local.pl U trunk/cgi-bin/LJ/GeoLocation.pm U trunk/htdocs/manage/profile/index.bml.text.local
Modified: trunk/bin/upgrading/update-db-local.pl =================================================================== --- trunk/bin/upgrading/update-db-local.pl 2010-08-16 10:06:27 UTC (rev 9342) +++ trunk/bin/upgrading/update-db-local.pl 2010-08-17 05:54:26 UTC (rev 9343) @@ -1527,6 +1527,45 @@ ) EOC +register_tablecreate("smsru_phones", <<'EOC'); +create table `smsru_phones` ( + userid INT(10) UNSIGNED, + phone INT(10), + status varchar(50), + + UNIQUE INDEX(userid) + +) Type=InnoDB +EOC + +register_tablecreate("smsru_vercodes", <<'EOC'); +create table `smsru_vercodes` ( + userid INT(10) UNSIGNED, + phone varchar(50), + longcode CHAR(16), + shortcode CHAR(5), + added TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + + PRIMARY KEY(userid), + UNIQUE INDEX(longcode), + UNIQUE INDEX(userid, shortcode) + +) Type=InnoDB +EOC + +register_tablecreate("smsru", <<'EOC'); +create table `smsru` ( + smsid INT(10) UNSIGNED PRIMARY KEY UNIQUE AUTO_INCREMENT, + userid INT(10) UNSIGNED, + to_number INT(10), + msg VARCHAR(255), + added TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + + INDEX(userid) +) Type=InnoDB +EOC + + # ************************************************************* register_alter(sub { Modified: trunk/cgi-bin/LJ/GeoLocation.pm =================================================================== --- trunk/cgi-bin/LJ/GeoLocation.pm 2010-08-16 10:06:27 UTC (rev 9342) +++ trunk/cgi-bin/LJ/GeoLocation.pm 2010-08-17 05:54:26 UTC (rev 9343) @@ -124,6 +124,19 @@ return; } +sub ip_country { + my $class = shift; + my $ip = shift || LJ::get_remote_ip(); + return undef unless $LJ::USE_IPMAP; + + my ($ip_class, $country) = $class->_get_fake_ip_class(); + return $country if defined $country; + + return undef unless $ip; + $country = $class->get_ipmap()->Resolve($ip); + return $country; +} + sub _get_fake_ip_class { my $class = shift; Modified: trunk/htdocs/manage/profile/index.bml.text.local =================================================================== --- trunk/htdocs/manage/profile/index.bml.text.local 2010-08-16 10:06:27 UTC (rev 9342) +++ trunk/htdocs/manage/profile/index.bml.text.local 2010-08-17 05:54:26 UTC (rev 9343) @@ -25,3 +25,4 @@ .showljtalk=Do not show field +.section.phone=Phone