diff options
Diffstat (limited to 'src/main/java/com/juick/server/MessagesQueries.java')
-rw-r--r-- | src/main/java/com/juick/server/MessagesQueries.java | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/main/java/com/juick/server/MessagesQueries.java b/src/main/java/com/juick/server/MessagesQueries.java index b6e722f3..82fef672 100644 --- a/src/main/java/com/juick/server/MessagesQueries.java +++ b/src/main/java/com/juick/server/MessagesQueries.java @@ -719,14 +719,12 @@ public class MessagesQueries { ResultSet rs = null; try { if (before > 0) { - stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE message_id<? AND (privacy>0 OR user_id=?) AND attach IS NOT NULL AND user_id NOT IN (SELECT bl_user_id FROM bl_users WHERE user_id=?) ORDER BY message_id DESC LIMIT 20"); + stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE message_id<? AND (privacy>0 OR user_id=?) AND attach IS NOT NULL AND user_id NOT IN (SELECT id from users WHERE banned=1) ORDER BY message_id DESC LIMIT 20"); stmt.setInt(1, before); stmt.setInt(2, visitor_uid); - stmt.setInt(3, visitor_uid); } else { - stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE (privacy>0 OR user_id=?) AND attach IS NOT NULL AND user_id NOT IN (SELECT bl_user_id FROM bl_users WHERE user_id=?) ORDER BY message_id DESC LIMIT 20"); + stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE (privacy>0 OR user_id=?) AND attach IS NOT NULL AND user_id NOT IN (SELECT id from users WHERE banned=1) ORDER BY message_id DESC LIMIT 20"); stmt.setInt(1, visitor_uid); - stmt.setInt(2, visitor_uid); } rs = stmt.executeQuery(); rs.beforeFirst(); @@ -749,11 +747,11 @@ public class MessagesQueries { try { if (before > 0) { - stmt = sqlSearch.prepareStatement("SELECT id AS message_id FROM messages WHERE MATCH(?) AND id<? AND user_id NOT IN (SELECT id from users WHERE banned=1) ORDER BY id DESC LIMIT 25"); + stmt = sqlSearch.prepareStatement("SELECT id AS message_id FROM messages WHERE MATCH(?) AND id<? ORDER BY id DESC LIMIT 25"); stmt.setString(1, search); stmt.setInt(2, before); } else { - stmt = sqlSearch.prepareStatement("SELECT id AS message_id FROM messages WHERE MATCH(?) AND user_id NOT IN (SELECT id from users WHERE banned=1) ORDER BY id DESC LIMIT 25"); + stmt = sqlSearch.prepareStatement("SELECT id AS message_id FROM messages WHERE MATCH(?) ORDER BY id DESC LIMIT 25"); stmt.setString(1, search); } rs = stmt.executeQuery(); @@ -770,7 +768,7 @@ public class MessagesQueries { ArrayList<Integer> mids = new ArrayList<Integer>(20); if (mids0.size() > 0) { try { - stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE message_id IN (" + Utils.convertArrayInt2String(mids0) + ") AND privacy>0 AND user_id NOT IN (SELECT id from users WHERE banned=1) ORDER BY message_id DESC LIMIT 20"); + stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE message_id IN (" + Utils.convertArrayInt2String(mids0) + ") AND privacy>0 ORDER BY message_id DESC LIMIT 20"); rs = stmt.executeQuery(); rs.beforeFirst(); while (rs.next()) { |