diff options
Diffstat (limited to 'src/com/juick/server/MessagesQueries.java')
-rw-r--r-- | src/com/juick/server/MessagesQueries.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/com/juick/server/MessagesQueries.java b/src/com/juick/server/MessagesQueries.java index dd284d3f..3dd8418b 100644 --- a/src/com/juick/server/MessagesQueries.java +++ b/src/com/juick/server/MessagesQueries.java @@ -130,7 +130,7 @@ public class MessagesQueries { PreparedStatement stmt = null; ResultSet rs = null; try { - stmt = sql.prepareStatement("SELECT messages.user_id,users.nick,TIMESTAMPDIFF(MINUTE,messages.ts,NOW()),DATE_FORMAT(messages.ts,'%Y-%m-%d %H:%i:%s'),messages.readonly,messages.privacy,messages.replies,messages.attach,messages.place_id,messages.lat,messages.lon,messages.votes FROM messages INNER JOIN users ON messages.user_id=users.id WHERE messages.message_id=?"); + stmt = sql.prepareStatement("SELECT messages.user_id,users.nick,TIMESTAMPDIFF(MINUTE,messages.ts,NOW()),DATE_FORMAT(messages.ts,'%Y-%m-%d %H:%i:%s'),messages.readonly,messages.privacy,messages.replies,messages.attach,messages.place_id,messages.lat,messages.lon,messages.likes FROM messages INNER JOIN users ON messages.user_id=users.id WHERE messages.message_id=?"); stmt.setInt(1, mid); rs = stmt.executeQuery(); if (rs.first()) { @@ -154,7 +154,7 @@ public class MessagesQueries { msg.Place.lat = rs.getDouble(10); msg.Place.lon = rs.getDouble(11); } - msg.Votes = rs.getInt(12); + msg.Likes = rs.getInt(12); } } catch (SQLException e) { System.err.println(e); @@ -291,21 +291,21 @@ public class MessagesQueries { try { if (visitor_uid > 1) { if (before > 0) { - stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE message_id<? AND (privacy>0 OR user_id=?) AND lang!='fa' 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 user_id NOT IN (SELECT bl_user_id FROM bl_users WHERE user_id=?) 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 lang!='fa' 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 user_id NOT IN (SELECT bl_user_id FROM bl_users WHERE user_id=?) ORDER BY message_id DESC LIMIT 20"); stmt.setInt(1, visitor_uid); stmt.setInt(2, visitor_uid); } } else { if (before > 0) { - stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE message_id<? AND privacy>0 AND lang!='fa' ORDER BY message_id DESC LIMIT 20"); + stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE message_id<? AND privacy>0 ORDER BY message_id DESC LIMIT 20"); stmt.setInt(1, before); } else { - stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE privacy>0 AND lang!='fa' ORDER BY message_id DESC LIMIT 20"); + stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE privacy>0 ORDER BY message_id DESC LIMIT 20"); } } @@ -811,7 +811,7 @@ public class MessagesQueries { PreparedStatement stmt = null; ResultSet rs = null; try { - stmt = sql.prepareStatement("SELECT STRAIGHT_JOIN messages.message_id,messages.user_id,users.nick,messages_txt.tags,messages.readonly,messages.privacy,messages_txt.txt,TIMESTAMPDIFF(MINUTE,messages.ts,NOW()),DATE_FORMAT(messages.ts,'%Y-%m-%d %H:%i:%s'),messages.replies,messages_txt.repliesby,messages.attach,messages.lat,messages.lon,messages.votes FROM (messages INNER JOIN messages_txt ON messages.message_id=messages_txt.message_id) INNER JOIN users ON messages.user_id=users.id WHERE messages.message_id IN (" + Utils.convertArrayInt2String(mids) + ") ORDER BY messages.message_id DESC"); + stmt = sql.prepareStatement("SELECT STRAIGHT_JOIN messages.message_id,messages.user_id,users.nick,messages_txt.tags,messages.readonly,messages.privacy,messages_txt.txt,TIMESTAMPDIFF(MINUTE,messages.ts,NOW()),DATE_FORMAT(messages.ts,'%Y-%m-%d %H:%i:%s'),messages.replies,messages_txt.repliesby,messages.attach,messages.lat,messages.lon,messages.likes FROM (messages INNER JOIN messages_txt ON messages.message_id=messages_txt.message_id) INNER JOIN users ON messages.user_id=users.id WHERE messages.message_id IN (" + Utils.convertArrayInt2String(mids) + ") ORDER BY messages.message_id DESC"); rs = stmt.executeQuery(); rs.beforeFirst(); while (rs.next()) { @@ -838,7 +838,7 @@ public class MessagesQueries { msg.Place.lat = rs.getDouble(13); msg.Place.lon = rs.getDouble(14); } - msg.Votes = rs.getInt(15); + msg.Likes = rs.getInt(15); msgs.add(msg); } |