diff options
author | 2012-12-31 16:34:51 +0700 | |
---|---|---|
committer | 2012-12-31 16:34:51 +0700 | |
commit | b74e6c267498e6fda56a5167346623bf55a8f01e (patch) | |
tree | 51f7b3fb3ffdd57fd8ed5481b28c7d712c8371c8 | |
parent | 10f1681919c312597a71be2597626daa4d3739be (diff) |
MessagesQueries privacy
-rw-r--r-- | src/com/juick/server/MessagesQueries.java | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/com/juick/server/MessagesQueries.java b/src/com/juick/server/MessagesQueries.java index b2251048..227b3fea 100644 --- a/src/com/juick/server/MessagesQueries.java +++ b/src/com/juick/server/MessagesQueries.java @@ -544,18 +544,18 @@ public class MessagesQueries { return mids; } - public static ArrayList<Integer> getUserBlog(Connection sql, int UID, int before) { + public static ArrayList<Integer> getUserBlog(Connection sql, int UID, int privacy, int before) { ArrayList<Integer> mids = new ArrayList<Integer>(20); PreparedStatement stmt = null; ResultSet rs = null; try { if (before > 0) { - stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE user_id=? AND message_id<? AND privacy>=0 ORDER BY message_id DESC LIMIT 20"); + stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE user_id=? AND message_id<? AND privacy>=" + privacy + " ORDER BY message_id DESC LIMIT 20"); stmt.setInt(1, UID); stmt.setInt(2, before); } else { - stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE user_id=? AND privacy>=0 ORDER BY message_id DESC LIMIT 20"); + stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE user_id=? AND privacy>=" + privacy + " ORDER BY message_id DESC LIMIT 20"); stmt.setInt(1, UID); } rs = stmt.executeQuery(); @@ -571,19 +571,19 @@ public class MessagesQueries { return mids; } - public static ArrayList<Integer> getUserTag(Connection sql, int UID, int TID, int before) { + public static ArrayList<Integer> getUserTag(Connection sql, int UID, int TID, int privacy, int before) { ArrayList<Integer> mids = new ArrayList<Integer>(20); PreparedStatement stmt = null; ResultSet rs = null; try { if (before > 0) { - stmt = sql.prepareStatement("SELECT messages.message_id FROM messages_tags INNER JOIN messages USING(message_id) WHERE messages.user_id=? AND messages_tags.tag_id=? AND messages.message_id<? AND messages.privacy>0 ORDER BY messages.message_id DESC LIMIT 20"); + stmt = sql.prepareStatement("SELECT messages.message_id FROM messages_tags INNER JOIN messages USING(message_id) WHERE messages.user_id=? AND messages_tags.tag_id=? AND messages.message_id<? AND messages.privacy>" + privacy + " ORDER BY messages.message_id DESC LIMIT 20"); stmt.setInt(1, UID); stmt.setInt(2, TID); stmt.setInt(3, before); } else { - stmt = sql.prepareStatement("SELECT messages.message_id FROM messages_tags INNER JOIN messages USING(message_id) WHERE messages.user_id=? AND messages_tags.tag_id=? AND messages.privacy>0 ORDER BY messages.message_id DESC LIMIT 20"); + stmt = sql.prepareStatement("SELECT messages.message_id FROM messages_tags INNER JOIN messages USING(message_id) WHERE messages.user_id=? AND messages_tags.tag_id=? AND messages.privacy>" + privacy + " ORDER BY messages.message_id DESC LIMIT 20"); stmt.setInt(1, UID); stmt.setInt(2, TID); } @@ -627,18 +627,18 @@ public class MessagesQueries { return mids; } - public static ArrayList<Integer> getUserPhotos(Connection sql, int UID, int before) { + public static ArrayList<Integer> getUserPhotos(Connection sql, int UID, int privacy, int before) { ArrayList<Integer> mids = new ArrayList<Integer>(20); PreparedStatement stmt = null; ResultSet rs = null; try { if (before > 0) { - stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE user_id=? AND message_id<? AND privacy>=0 AND attach IS NOT NULL ORDER BY message_id DESC LIMIT 20"); + stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE user_id=? AND message_id<? AND privacy>=" + privacy + " AND attach IS NOT NULL ORDER BY message_id DESC LIMIT 20"); stmt.setInt(1, UID); stmt.setInt(2, before); } else { - stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE user_id=? AND privacy>=0 AND attach IS NOT NULL ORDER BY message_id DESC LIMIT 20"); + stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE user_id=? AND privacy>=" + privacy + " AND attach IS NOT NULL ORDER BY message_id DESC LIMIT 20"); stmt.setInt(1, UID); } rs = stmt.executeQuery(); @@ -654,7 +654,7 @@ public class MessagesQueries { return mids; } - public static ArrayList<Integer> getUserSearch(Connection sql, Connection sqlSearch, int UID, String search, int before) { + public static ArrayList<Integer> getUserSearch(Connection sql, Connection sqlSearch, int UID, String search, int privacy, int before) { ArrayList<Integer> mids0 = new ArrayList<Integer>(20); PreparedStatement stmt = null; @@ -684,7 +684,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.convertArray2String(mids0) + ") AND privacy>=0 ORDER BY message_id DESC"); + stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE message_id IN (" + Utils.convertArray2String(mids0) + ") AND privacy>=" + privacy + " ORDER BY message_id DESC"); rs = stmt.executeQuery(); rs.beforeFirst(); while (rs.next()) { |