Committer: afedorov
LJSUP-13431: Antispam for edited entries in the communitiesU trunk/cgi-bin/LJ/RelationService/MysqlAPI.pm
Modified: trunk/cgi-bin/LJ/RelationService/MysqlAPI.pm =================================================================== --- trunk/cgi-bin/LJ/RelationService/MysqlAPI.pm 2012-09-27 10:41:57 UTC (rev 22990) +++ trunk/cgi-bin/LJ/RelationService/MysqlAPI.pm 2012-09-27 10:50:24 UTC (rev 22991) @@ -775,15 +775,18 @@ my $types = shift; my %opts = @_; - return undef unless $types && $u && $friend; + return undef unless $u && $friend; + return undef unless ref $types eq 'ARRAY'; my $userid = LJ::want_userid($u); my $friendid = LJ::want_userid($friend); + $types = join ",", map {"'$_'"} @$types; + my $dbh = LJ::get_db_writer(); my $relcount = $dbh->selectrow_array("SELECT COUNT(*) FROM reluser ". "WHERE userid=$userid AND targetid=$friendid ". - "AND type IN (?)", undef, $types); + "AND type IN ($types)"); return $relcount; }