From f613b983869b92a9474b89a5d86736e2c976c576 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Wed, 22 Sep 2021 01:59:50 +0000 Subject: [PATCH] Fixed probable community board post bypass exploit. --- .../gameserver/communitybbs/BB/Post.java | 156 +++++++++---- .../communitybbs/Manager/PostBBSManager.java | 10 +- .../communitybbs/Manager/TopicBBSManager.java | 4 +- .../gameserver/communitybbs/BB/Post.java | 156 +++++++++---- .../communitybbs/Manager/PostBBSManager.java | 10 +- .../communitybbs/Manager/TopicBBSManager.java | 4 +- .../gameserver/communitybbs/BB/Post.java | 156 +++++++++---- .../communitybbs/Manager/PostBBSManager.java | 10 +- .../communitybbs/Manager/TopicBBSManager.java | 4 +- .../gameserver/communitybbs/BB/Post.java | 156 +++++++++---- .../communitybbs/Manager/PostBBSManager.java | 10 +- .../communitybbs/Manager/TopicBBSManager.java | 4 +- .../gameserver/communitybbs/BB/Post.java | 156 +++++++++---- .../communitybbs/Manager/PostBBSManager.java | 10 +- .../communitybbs/Manager/TopicBBSManager.java | 4 +- .../gameserver/communitybbs/BB/Post.java | 156 +++++++++---- .../communitybbs/Manager/PostBBSManager.java | 10 +- .../communitybbs/Manager/TopicBBSManager.java | 4 +- .../gameserver/communitybbs/BB/Post.java | 156 +++++++++---- .../communitybbs/Manager/PostBBSManager.java | 10 +- .../communitybbs/Manager/TopicBBSManager.java | 4 +- .../gameserver/communitybbs/BB/Post.java | 156 +++++++++---- .../communitybbs/Manager/PostBBSManager.java | 10 +- .../communitybbs/Manager/TopicBBSManager.java | 4 +- .../gameserver/communitybbs/BB/Post.java | 156 +++++++++---- .../communitybbs/Manager/PostBBSManager.java | 10 +- .../communitybbs/Manager/TopicBBSManager.java | 4 +- .../gameserver/communitybbs/BB/Post.java | 156 +++++++++---- .../communitybbs/Manager/PostBBSManager.java | 10 +- .../communitybbs/Manager/TopicBBSManager.java | 4 +- .../gameserver/communitybbs/BB/Post.java | 214 ++++++++++++------ .../communitybbs/Manager/PostBBSManager.java | 8 +- .../gameserver/communitybbs/BB/Post.java | 214 ++++++++++++------ .../communitybbs/Manager/PostBBSManager.java | 8 +- .../gameserver/communitybbs/BB/Post.java | 156 +++++++++---- .../communitybbs/Manager/PostBBSManager.java | 10 +- .../communitybbs/Manager/TopicBBSManager.java | 4 +- .../gameserver/communitybbs/BB/Post.java | 156 +++++++++---- .../communitybbs/Manager/PostBBSManager.java | 10 +- .../communitybbs/Manager/TopicBBSManager.java | 4 +- .../gameserver/communitybbs/BB/Post.java | 156 +++++++++---- .../communitybbs/Manager/PostBBSManager.java | 10 +- .../communitybbs/Manager/TopicBBSManager.java | 4 +- .../gameserver/communitybbs/BB/Post.java | 156 +++++++++---- .../communitybbs/Manager/PostBBSManager.java | 10 +- .../communitybbs/Manager/TopicBBSManager.java | 4 +- .../gameserver/communitybbs/BB/Post.java | 156 +++++++++---- .../communitybbs/Manager/PostBBSManager.java | 10 +- .../communitybbs/Manager/TopicBBSManager.java | 4 +- .../gameserver/communitybbs/BB/Post.java | 156 +++++++++---- .../communitybbs/Manager/PostBBSManager.java | 10 +- .../communitybbs/Manager/TopicBBSManager.java | 4 +- .../gameserver/communitybbs/BB/Post.java | 156 +++++++++---- .../communitybbs/Manager/PostBBSManager.java | 10 +- .../communitybbs/Manager/TopicBBSManager.java | 4 +- .../gameserver/communitybbs/BB/Post.java | 156 +++++++++---- .../communitybbs/Manager/PostBBSManager.java | 10 +- .../communitybbs/Manager/TopicBBSManager.java | 4 +- .../gameserver/communitybbs/BB/Post.java | 156 +++++++++---- .../communitybbs/Manager/PostBBSManager.java | 10 +- .../communitybbs/Manager/TopicBBSManager.java | 4 +- .../gameserver/communitybbs/BB/Post.java | 156 +++++++++---- .../communitybbs/Manager/PostBBSManager.java | 10 +- .../communitybbs/Manager/TopicBBSManager.java | 4 +- .../gameserver/communitybbs/BB/Post.java | 156 +++++++++---- .../communitybbs/Manager/PostBBSManager.java | 10 +- .../communitybbs/Manager/TopicBBSManager.java | 4 +- 67 files changed, 2885 insertions(+), 1129 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java index 5288eac3b4..4cd006629d 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java @@ -36,13 +36,95 @@ public class Post public static class CPost { - public int postId; - public String postOwner; - public int postOwnerId; - public long postDate; - public int postTopicId; - public int postForumId; - public String postTxt; + private int _postId; + private String _postOwner; + private int _postOwnerId; + private long _postDate; + private int _postTopicId; + private int _postForumId; + private String _postText; + + public void setPostId(int postId) + { + _postId = postId; + } + + public int getPostId() + { + return _postId; + } + + public void setPostOwner(String postOwner) + { + _postOwner = postOwner; + } + + public String getPostOwner() + { + return _postOwner; + } + + public void setPostOwnerId(int postOwnerId) + { + _postOwnerId = postOwnerId; + } + + public int getPostOwnerId() + { + return _postOwnerId; + } + + public void setPostDate(long postDate) + { + _postDate = postDate; + } + + public long getPostDate() + { + return _postDate; + } + + public void setPostTopicId(int postTopicId) + { + _postTopicId = postTopicId; + } + + public int getPostTopicId() + { + return _postTopicId; + } + + public void setPostForumId(int postForumId) + { + _postForumId = postForumId; + } + + public int getPostForumId() + { + return _postForumId; + } + + public void setPostText(String postText) + { + _postText = postText; + } + + public String getPostText() + { + if (_postText == null) + { + return ""; + } + + // Bypass exploit check. + final String text = _postText.toLowerCase(); + if (text.contains("action") && text.contains("bypass")) + { + return ""; + } + + return _postText; + } } private final Collection _post; @@ -59,13 +141,13 @@ public class Post { _post = ConcurrentHashMap.newKeySet(); final CPost cp = new CPost(); - cp.postId = 0; - cp.postOwner = postOwner; - cp.postOwnerId = postOwnerId; - cp.postDate = date; - cp.postTopicId = tid; - cp.postForumId = postForumId; - cp.postTxt = txt; + cp.setPostId(0); + cp.setPostOwner(postOwner); + cp.setPostOwnerId(postOwnerId); + cp.setPostDate(date); + cp.setPostTopicId(tid); + cp.setPostForumId(postForumId); + cp.setPostText(txt); _post.add(cp); insertindb(cp); } @@ -75,13 +157,13 @@ public class Post try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)")) { - ps.setInt(1, cp.postId); - ps.setString(2, cp.postOwner); - ps.setInt(3, cp.postOwnerId); - ps.setLong(4, cp.postDate); - ps.setInt(5, cp.postTopicId); - ps.setInt(6, cp.postForumId); - ps.setString(7, cp.postTxt); + ps.setInt(1, cp.getPostId()); + ps.setString(2, cp.getPostOwner()); + ps.setInt(3, cp.getPostOwnerId()); + ps.setLong(4, cp.getPostDate()); + ps.setInt(5, cp.getPostTopicId()); + ps.setInt(6, cp.getPostForumId()); + ps.setString(7, cp.getPostText()); ps.execute(); } catch (Exception e) @@ -109,7 +191,7 @@ public class Post return null; } - public void deleteme(Topic t) + public void deleteMe(Topic t) { PostBBSManager.getInstance().delPostByTopic(t); try (Connection con = DatabaseFactory.getConnection(); @@ -125,9 +207,6 @@ public class Post } } - /** - * @param t - */ private void load(Topic t) { try (Connection con = DatabaseFactory.getConnection(); @@ -140,13 +219,13 @@ public class Post while (rs.next()) { final CPost cp = new CPost(); - cp.postId = rs.getInt("post_id"); - cp.postOwner = rs.getString("post_owner_name"); - cp.postOwnerId = rs.getInt("post_ownerid"); - cp.postDate = rs.getLong("post_date"); - cp.postTopicId = rs.getInt("post_topic_id"); - cp.postForumId = rs.getInt("post_forum_id"); - cp.postTxt = rs.getString("post_txt"); + cp.setPostId(rs.getInt("post_id")); + cp.setPostOwner(rs.getString("post_owner_name")); + cp.setPostOwnerId(rs.getInt("post_ownerid")); + cp.setPostDate(rs.getLong("post_date")); + cp.setPostTopicId(rs.getInt("post_topic_id")); + cp.setPostForumId(rs.getInt("post_forum_id")); + cp.setPostText(rs.getString("post_txt")); _post.add(cp); } } @@ -157,19 +236,16 @@ public class Post } } - /** - * @param i - */ - public void updatetxt(int i) + public void updateText(int i) { try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?")) { final CPost cp = getCPost(i); - ps.setString(1, cp.postTxt); - ps.setInt(2, cp.postId); - ps.setInt(3, cp.postTopicId); - ps.setInt(4, cp.postForumId); + ps.setString(1, cp.getPostText()); + ps.setInt(2, cp.getPostId()); + ps.setInt(3, cp.getPostTopicId()); + ps.setInt(4, cp.getPostForumId()); ps.execute(); } catch (Exception e) diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index d4e5528d28..4f38524224 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -120,7 +120,7 @@ public class PostBBSManager extends BaseBBSManager { final String html = "

HOME > " + forum.getName() + " Form
&$413;" + topic.getName() + "
&$427;
  
"; send1001(html, player); - send1002(player, p.getCPost(0).postTxt, topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); + send1002(player, p.getCPost(0).getPostText(), topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); } private void showMemoPost(Topic topic, PlayerInstance player, Forum forum) @@ -128,10 +128,10 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); - String mes = p.getCPost(0).postTxt.replace(">", ">"); + String mes = p.getCPost(0).getPostText().replace(">", ">"); mes = mes.replace("<", "<"); - final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).postDate) + "

" + mes + "

   



"; + final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).getPostDate()) + "

" + mes + "

   



"; CommunityBoardHandler.separateAndSend(html, player); } @@ -165,8 +165,8 @@ public class PostBBSManager extends BaseBBSManager } else { - p.getCPost(idp).postTxt = ar4; - p.updatetxt(idp); + p.getCPost(idp).setPostText(ar4); + p.updateText(idp); parsecmd("_bbsposts;read;" + f.getID() + ";" + t.getID(), player); } } diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java index e213662279..3db3f0de91 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java @@ -115,7 +115,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); @@ -178,7 +178,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java index 5288eac3b4..4cd006629d 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java @@ -36,13 +36,95 @@ public class Post public static class CPost { - public int postId; - public String postOwner; - public int postOwnerId; - public long postDate; - public int postTopicId; - public int postForumId; - public String postTxt; + private int _postId; + private String _postOwner; + private int _postOwnerId; + private long _postDate; + private int _postTopicId; + private int _postForumId; + private String _postText; + + public void setPostId(int postId) + { + _postId = postId; + } + + public int getPostId() + { + return _postId; + } + + public void setPostOwner(String postOwner) + { + _postOwner = postOwner; + } + + public String getPostOwner() + { + return _postOwner; + } + + public void setPostOwnerId(int postOwnerId) + { + _postOwnerId = postOwnerId; + } + + public int getPostOwnerId() + { + return _postOwnerId; + } + + public void setPostDate(long postDate) + { + _postDate = postDate; + } + + public long getPostDate() + { + return _postDate; + } + + public void setPostTopicId(int postTopicId) + { + _postTopicId = postTopicId; + } + + public int getPostTopicId() + { + return _postTopicId; + } + + public void setPostForumId(int postForumId) + { + _postForumId = postForumId; + } + + public int getPostForumId() + { + return _postForumId; + } + + public void setPostText(String postText) + { + _postText = postText; + } + + public String getPostText() + { + if (_postText == null) + { + return ""; + } + + // Bypass exploit check. + final String text = _postText.toLowerCase(); + if (text.contains("action") && text.contains("bypass")) + { + return ""; + } + + return _postText; + } } private final Collection _post; @@ -59,13 +141,13 @@ public class Post { _post = ConcurrentHashMap.newKeySet(); final CPost cp = new CPost(); - cp.postId = 0; - cp.postOwner = postOwner; - cp.postOwnerId = postOwnerId; - cp.postDate = date; - cp.postTopicId = tid; - cp.postForumId = postForumId; - cp.postTxt = txt; + cp.setPostId(0); + cp.setPostOwner(postOwner); + cp.setPostOwnerId(postOwnerId); + cp.setPostDate(date); + cp.setPostTopicId(tid); + cp.setPostForumId(postForumId); + cp.setPostText(txt); _post.add(cp); insertindb(cp); } @@ -75,13 +157,13 @@ public class Post try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)")) { - ps.setInt(1, cp.postId); - ps.setString(2, cp.postOwner); - ps.setInt(3, cp.postOwnerId); - ps.setLong(4, cp.postDate); - ps.setInt(5, cp.postTopicId); - ps.setInt(6, cp.postForumId); - ps.setString(7, cp.postTxt); + ps.setInt(1, cp.getPostId()); + ps.setString(2, cp.getPostOwner()); + ps.setInt(3, cp.getPostOwnerId()); + ps.setLong(4, cp.getPostDate()); + ps.setInt(5, cp.getPostTopicId()); + ps.setInt(6, cp.getPostForumId()); + ps.setString(7, cp.getPostText()); ps.execute(); } catch (Exception e) @@ -109,7 +191,7 @@ public class Post return null; } - public void deleteme(Topic t) + public void deleteMe(Topic t) { PostBBSManager.getInstance().delPostByTopic(t); try (Connection con = DatabaseFactory.getConnection(); @@ -125,9 +207,6 @@ public class Post } } - /** - * @param t - */ private void load(Topic t) { try (Connection con = DatabaseFactory.getConnection(); @@ -140,13 +219,13 @@ public class Post while (rs.next()) { final CPost cp = new CPost(); - cp.postId = rs.getInt("post_id"); - cp.postOwner = rs.getString("post_owner_name"); - cp.postOwnerId = rs.getInt("post_ownerid"); - cp.postDate = rs.getLong("post_date"); - cp.postTopicId = rs.getInt("post_topic_id"); - cp.postForumId = rs.getInt("post_forum_id"); - cp.postTxt = rs.getString("post_txt"); + cp.setPostId(rs.getInt("post_id")); + cp.setPostOwner(rs.getString("post_owner_name")); + cp.setPostOwnerId(rs.getInt("post_ownerid")); + cp.setPostDate(rs.getLong("post_date")); + cp.setPostTopicId(rs.getInt("post_topic_id")); + cp.setPostForumId(rs.getInt("post_forum_id")); + cp.setPostText(rs.getString("post_txt")); _post.add(cp); } } @@ -157,19 +236,16 @@ public class Post } } - /** - * @param i - */ - public void updatetxt(int i) + public void updateText(int i) { try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?")) { final CPost cp = getCPost(i); - ps.setString(1, cp.postTxt); - ps.setInt(2, cp.postId); - ps.setInt(3, cp.postTopicId); - ps.setInt(4, cp.postForumId); + ps.setString(1, cp.getPostText()); + ps.setInt(2, cp.getPostId()); + ps.setInt(3, cp.getPostTopicId()); + ps.setInt(4, cp.getPostForumId()); ps.execute(); } catch (Exception e) diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index d4e5528d28..4f38524224 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -120,7 +120,7 @@ public class PostBBSManager extends BaseBBSManager { final String html = "

HOME > " + forum.getName() + " Form
&$413;" + topic.getName() + "
&$427;
  
"; send1001(html, player); - send1002(player, p.getCPost(0).postTxt, topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); + send1002(player, p.getCPost(0).getPostText(), topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); } private void showMemoPost(Topic topic, PlayerInstance player, Forum forum) @@ -128,10 +128,10 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); - String mes = p.getCPost(0).postTxt.replace(">", ">"); + String mes = p.getCPost(0).getPostText().replace(">", ">"); mes = mes.replace("<", "<"); - final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).postDate) + "

" + mes + "

   



"; + final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).getPostDate()) + "

" + mes + "

   



"; CommunityBoardHandler.separateAndSend(html, player); } @@ -165,8 +165,8 @@ public class PostBBSManager extends BaseBBSManager } else { - p.getCPost(idp).postTxt = ar4; - p.updatetxt(idp); + p.getCPost(idp).setPostText(ar4); + p.updateText(idp); parsecmd("_bbsposts;read;" + f.getID() + ";" + t.getID(), player); } } diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java index e213662279..3db3f0de91 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java @@ -115,7 +115,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); @@ -178,7 +178,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java index 5288eac3b4..4cd006629d 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java @@ -36,13 +36,95 @@ public class Post public static class CPost { - public int postId; - public String postOwner; - public int postOwnerId; - public long postDate; - public int postTopicId; - public int postForumId; - public String postTxt; + private int _postId; + private String _postOwner; + private int _postOwnerId; + private long _postDate; + private int _postTopicId; + private int _postForumId; + private String _postText; + + public void setPostId(int postId) + { + _postId = postId; + } + + public int getPostId() + { + return _postId; + } + + public void setPostOwner(String postOwner) + { + _postOwner = postOwner; + } + + public String getPostOwner() + { + return _postOwner; + } + + public void setPostOwnerId(int postOwnerId) + { + _postOwnerId = postOwnerId; + } + + public int getPostOwnerId() + { + return _postOwnerId; + } + + public void setPostDate(long postDate) + { + _postDate = postDate; + } + + public long getPostDate() + { + return _postDate; + } + + public void setPostTopicId(int postTopicId) + { + _postTopicId = postTopicId; + } + + public int getPostTopicId() + { + return _postTopicId; + } + + public void setPostForumId(int postForumId) + { + _postForumId = postForumId; + } + + public int getPostForumId() + { + return _postForumId; + } + + public void setPostText(String postText) + { + _postText = postText; + } + + public String getPostText() + { + if (_postText == null) + { + return ""; + } + + // Bypass exploit check. + final String text = _postText.toLowerCase(); + if (text.contains("action") && text.contains("bypass")) + { + return ""; + } + + return _postText; + } } private final Collection _post; @@ -59,13 +141,13 @@ public class Post { _post = ConcurrentHashMap.newKeySet(); final CPost cp = new CPost(); - cp.postId = 0; - cp.postOwner = postOwner; - cp.postOwnerId = postOwnerId; - cp.postDate = date; - cp.postTopicId = tid; - cp.postForumId = postForumId; - cp.postTxt = txt; + cp.setPostId(0); + cp.setPostOwner(postOwner); + cp.setPostOwnerId(postOwnerId); + cp.setPostDate(date); + cp.setPostTopicId(tid); + cp.setPostForumId(postForumId); + cp.setPostText(txt); _post.add(cp); insertindb(cp); } @@ -75,13 +157,13 @@ public class Post try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)")) { - ps.setInt(1, cp.postId); - ps.setString(2, cp.postOwner); - ps.setInt(3, cp.postOwnerId); - ps.setLong(4, cp.postDate); - ps.setInt(5, cp.postTopicId); - ps.setInt(6, cp.postForumId); - ps.setString(7, cp.postTxt); + ps.setInt(1, cp.getPostId()); + ps.setString(2, cp.getPostOwner()); + ps.setInt(3, cp.getPostOwnerId()); + ps.setLong(4, cp.getPostDate()); + ps.setInt(5, cp.getPostTopicId()); + ps.setInt(6, cp.getPostForumId()); + ps.setString(7, cp.getPostText()); ps.execute(); } catch (Exception e) @@ -109,7 +191,7 @@ public class Post return null; } - public void deleteme(Topic t) + public void deleteMe(Topic t) { PostBBSManager.getInstance().delPostByTopic(t); try (Connection con = DatabaseFactory.getConnection(); @@ -125,9 +207,6 @@ public class Post } } - /** - * @param t - */ private void load(Topic t) { try (Connection con = DatabaseFactory.getConnection(); @@ -140,13 +219,13 @@ public class Post while (rs.next()) { final CPost cp = new CPost(); - cp.postId = rs.getInt("post_id"); - cp.postOwner = rs.getString("post_owner_name"); - cp.postOwnerId = rs.getInt("post_ownerid"); - cp.postDate = rs.getLong("post_date"); - cp.postTopicId = rs.getInt("post_topic_id"); - cp.postForumId = rs.getInt("post_forum_id"); - cp.postTxt = rs.getString("post_txt"); + cp.setPostId(rs.getInt("post_id")); + cp.setPostOwner(rs.getString("post_owner_name")); + cp.setPostOwnerId(rs.getInt("post_ownerid")); + cp.setPostDate(rs.getLong("post_date")); + cp.setPostTopicId(rs.getInt("post_topic_id")); + cp.setPostForumId(rs.getInt("post_forum_id")); + cp.setPostText(rs.getString("post_txt")); _post.add(cp); } } @@ -157,19 +236,16 @@ public class Post } } - /** - * @param i - */ - public void updatetxt(int i) + public void updateText(int i) { try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?")) { final CPost cp = getCPost(i); - ps.setString(1, cp.postTxt); - ps.setInt(2, cp.postId); - ps.setInt(3, cp.postTopicId); - ps.setInt(4, cp.postForumId); + ps.setString(1, cp.getPostText()); + ps.setInt(2, cp.getPostId()); + ps.setInt(3, cp.getPostTopicId()); + ps.setInt(4, cp.getPostForumId()); ps.execute(); } catch (Exception e) diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index d4e5528d28..4f38524224 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -120,7 +120,7 @@ public class PostBBSManager extends BaseBBSManager { final String html = "

HOME > " + forum.getName() + " Form
&$413;" + topic.getName() + "
&$427;
  
"; send1001(html, player); - send1002(player, p.getCPost(0).postTxt, topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); + send1002(player, p.getCPost(0).getPostText(), topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); } private void showMemoPost(Topic topic, PlayerInstance player, Forum forum) @@ -128,10 +128,10 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); - String mes = p.getCPost(0).postTxt.replace(">", ">"); + String mes = p.getCPost(0).getPostText().replace(">", ">"); mes = mes.replace("<", "<"); - final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).postDate) + "

" + mes + "

   



"; + final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).getPostDate()) + "

" + mes + "

   



"; CommunityBoardHandler.separateAndSend(html, player); } @@ -165,8 +165,8 @@ public class PostBBSManager extends BaseBBSManager } else { - p.getCPost(idp).postTxt = ar4; - p.updatetxt(idp); + p.getCPost(idp).setPostText(ar4); + p.updateText(idp); parsecmd("_bbsposts;read;" + f.getID() + ";" + t.getID(), player); } } diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java index e213662279..3db3f0de91 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java @@ -115,7 +115,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); @@ -178,7 +178,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java index 5288eac3b4..4cd006629d 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java @@ -36,13 +36,95 @@ public class Post public static class CPost { - public int postId; - public String postOwner; - public int postOwnerId; - public long postDate; - public int postTopicId; - public int postForumId; - public String postTxt; + private int _postId; + private String _postOwner; + private int _postOwnerId; + private long _postDate; + private int _postTopicId; + private int _postForumId; + private String _postText; + + public void setPostId(int postId) + { + _postId = postId; + } + + public int getPostId() + { + return _postId; + } + + public void setPostOwner(String postOwner) + { + _postOwner = postOwner; + } + + public String getPostOwner() + { + return _postOwner; + } + + public void setPostOwnerId(int postOwnerId) + { + _postOwnerId = postOwnerId; + } + + public int getPostOwnerId() + { + return _postOwnerId; + } + + public void setPostDate(long postDate) + { + _postDate = postDate; + } + + public long getPostDate() + { + return _postDate; + } + + public void setPostTopicId(int postTopicId) + { + _postTopicId = postTopicId; + } + + public int getPostTopicId() + { + return _postTopicId; + } + + public void setPostForumId(int postForumId) + { + _postForumId = postForumId; + } + + public int getPostForumId() + { + return _postForumId; + } + + public void setPostText(String postText) + { + _postText = postText; + } + + public String getPostText() + { + if (_postText == null) + { + return ""; + } + + // Bypass exploit check. + final String text = _postText.toLowerCase(); + if (text.contains("action") && text.contains("bypass")) + { + return ""; + } + + return _postText; + } } private final Collection _post; @@ -59,13 +141,13 @@ public class Post { _post = ConcurrentHashMap.newKeySet(); final CPost cp = new CPost(); - cp.postId = 0; - cp.postOwner = postOwner; - cp.postOwnerId = postOwnerId; - cp.postDate = date; - cp.postTopicId = tid; - cp.postForumId = postForumId; - cp.postTxt = txt; + cp.setPostId(0); + cp.setPostOwner(postOwner); + cp.setPostOwnerId(postOwnerId); + cp.setPostDate(date); + cp.setPostTopicId(tid); + cp.setPostForumId(postForumId); + cp.setPostText(txt); _post.add(cp); insertindb(cp); } @@ -75,13 +157,13 @@ public class Post try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)")) { - ps.setInt(1, cp.postId); - ps.setString(2, cp.postOwner); - ps.setInt(3, cp.postOwnerId); - ps.setLong(4, cp.postDate); - ps.setInt(5, cp.postTopicId); - ps.setInt(6, cp.postForumId); - ps.setString(7, cp.postTxt); + ps.setInt(1, cp.getPostId()); + ps.setString(2, cp.getPostOwner()); + ps.setInt(3, cp.getPostOwnerId()); + ps.setLong(4, cp.getPostDate()); + ps.setInt(5, cp.getPostTopicId()); + ps.setInt(6, cp.getPostForumId()); + ps.setString(7, cp.getPostText()); ps.execute(); } catch (Exception e) @@ -109,7 +191,7 @@ public class Post return null; } - public void deleteme(Topic t) + public void deleteMe(Topic t) { PostBBSManager.getInstance().delPostByTopic(t); try (Connection con = DatabaseFactory.getConnection(); @@ -125,9 +207,6 @@ public class Post } } - /** - * @param t - */ private void load(Topic t) { try (Connection con = DatabaseFactory.getConnection(); @@ -140,13 +219,13 @@ public class Post while (rs.next()) { final CPost cp = new CPost(); - cp.postId = rs.getInt("post_id"); - cp.postOwner = rs.getString("post_owner_name"); - cp.postOwnerId = rs.getInt("post_ownerid"); - cp.postDate = rs.getLong("post_date"); - cp.postTopicId = rs.getInt("post_topic_id"); - cp.postForumId = rs.getInt("post_forum_id"); - cp.postTxt = rs.getString("post_txt"); + cp.setPostId(rs.getInt("post_id")); + cp.setPostOwner(rs.getString("post_owner_name")); + cp.setPostOwnerId(rs.getInt("post_ownerid")); + cp.setPostDate(rs.getLong("post_date")); + cp.setPostTopicId(rs.getInt("post_topic_id")); + cp.setPostForumId(rs.getInt("post_forum_id")); + cp.setPostText(rs.getString("post_txt")); _post.add(cp); } } @@ -157,19 +236,16 @@ public class Post } } - /** - * @param i - */ - public void updatetxt(int i) + public void updateText(int i) { try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?")) { final CPost cp = getCPost(i); - ps.setString(1, cp.postTxt); - ps.setInt(2, cp.postId); - ps.setInt(3, cp.postTopicId); - ps.setInt(4, cp.postForumId); + ps.setString(1, cp.getPostText()); + ps.setInt(2, cp.getPostId()); + ps.setInt(3, cp.getPostTopicId()); + ps.setInt(4, cp.getPostForumId()); ps.execute(); } catch (Exception e) diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index d4e5528d28..4f38524224 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -120,7 +120,7 @@ public class PostBBSManager extends BaseBBSManager { final String html = "

HOME > " + forum.getName() + " Form
&$413;" + topic.getName() + "
&$427;
  
"; send1001(html, player); - send1002(player, p.getCPost(0).postTxt, topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); + send1002(player, p.getCPost(0).getPostText(), topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); } private void showMemoPost(Topic topic, PlayerInstance player, Forum forum) @@ -128,10 +128,10 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); - String mes = p.getCPost(0).postTxt.replace(">", ">"); + String mes = p.getCPost(0).getPostText().replace(">", ">"); mes = mes.replace("<", "<"); - final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).postDate) + "

" + mes + "

   



"; + final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).getPostDate()) + "

" + mes + "

   



"; CommunityBoardHandler.separateAndSend(html, player); } @@ -165,8 +165,8 @@ public class PostBBSManager extends BaseBBSManager } else { - p.getCPost(idp).postTxt = ar4; - p.updatetxt(idp); + p.getCPost(idp).setPostText(ar4); + p.updateText(idp); parsecmd("_bbsposts;read;" + f.getID() + ";" + t.getID(), player); } } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java index e213662279..3db3f0de91 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java @@ -115,7 +115,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); @@ -178,7 +178,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java index 5288eac3b4..4cd006629d 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java @@ -36,13 +36,95 @@ public class Post public static class CPost { - public int postId; - public String postOwner; - public int postOwnerId; - public long postDate; - public int postTopicId; - public int postForumId; - public String postTxt; + private int _postId; + private String _postOwner; + private int _postOwnerId; + private long _postDate; + private int _postTopicId; + private int _postForumId; + private String _postText; + + public void setPostId(int postId) + { + _postId = postId; + } + + public int getPostId() + { + return _postId; + } + + public void setPostOwner(String postOwner) + { + _postOwner = postOwner; + } + + public String getPostOwner() + { + return _postOwner; + } + + public void setPostOwnerId(int postOwnerId) + { + _postOwnerId = postOwnerId; + } + + public int getPostOwnerId() + { + return _postOwnerId; + } + + public void setPostDate(long postDate) + { + _postDate = postDate; + } + + public long getPostDate() + { + return _postDate; + } + + public void setPostTopicId(int postTopicId) + { + _postTopicId = postTopicId; + } + + public int getPostTopicId() + { + return _postTopicId; + } + + public void setPostForumId(int postForumId) + { + _postForumId = postForumId; + } + + public int getPostForumId() + { + return _postForumId; + } + + public void setPostText(String postText) + { + _postText = postText; + } + + public String getPostText() + { + if (_postText == null) + { + return ""; + } + + // Bypass exploit check. + final String text = _postText.toLowerCase(); + if (text.contains("action") && text.contains("bypass")) + { + return ""; + } + + return _postText; + } } private final Collection _post; @@ -59,13 +141,13 @@ public class Post { _post = ConcurrentHashMap.newKeySet(); final CPost cp = new CPost(); - cp.postId = 0; - cp.postOwner = postOwner; - cp.postOwnerId = postOwnerId; - cp.postDate = date; - cp.postTopicId = tid; - cp.postForumId = postForumId; - cp.postTxt = txt; + cp.setPostId(0); + cp.setPostOwner(postOwner); + cp.setPostOwnerId(postOwnerId); + cp.setPostDate(date); + cp.setPostTopicId(tid); + cp.setPostForumId(postForumId); + cp.setPostText(txt); _post.add(cp); insertindb(cp); } @@ -75,13 +157,13 @@ public class Post try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)")) { - ps.setInt(1, cp.postId); - ps.setString(2, cp.postOwner); - ps.setInt(3, cp.postOwnerId); - ps.setLong(4, cp.postDate); - ps.setInt(5, cp.postTopicId); - ps.setInt(6, cp.postForumId); - ps.setString(7, cp.postTxt); + ps.setInt(1, cp.getPostId()); + ps.setString(2, cp.getPostOwner()); + ps.setInt(3, cp.getPostOwnerId()); + ps.setLong(4, cp.getPostDate()); + ps.setInt(5, cp.getPostTopicId()); + ps.setInt(6, cp.getPostForumId()); + ps.setString(7, cp.getPostText()); ps.execute(); } catch (Exception e) @@ -109,7 +191,7 @@ public class Post return null; } - public void deleteme(Topic t) + public void deleteMe(Topic t) { PostBBSManager.getInstance().delPostByTopic(t); try (Connection con = DatabaseFactory.getConnection(); @@ -125,9 +207,6 @@ public class Post } } - /** - * @param t - */ private void load(Topic t) { try (Connection con = DatabaseFactory.getConnection(); @@ -140,13 +219,13 @@ public class Post while (rs.next()) { final CPost cp = new CPost(); - cp.postId = rs.getInt("post_id"); - cp.postOwner = rs.getString("post_owner_name"); - cp.postOwnerId = rs.getInt("post_ownerid"); - cp.postDate = rs.getLong("post_date"); - cp.postTopicId = rs.getInt("post_topic_id"); - cp.postForumId = rs.getInt("post_forum_id"); - cp.postTxt = rs.getString("post_txt"); + cp.setPostId(rs.getInt("post_id")); + cp.setPostOwner(rs.getString("post_owner_name")); + cp.setPostOwnerId(rs.getInt("post_ownerid")); + cp.setPostDate(rs.getLong("post_date")); + cp.setPostTopicId(rs.getInt("post_topic_id")); + cp.setPostForumId(rs.getInt("post_forum_id")); + cp.setPostText(rs.getString("post_txt")); _post.add(cp); } } @@ -157,19 +236,16 @@ public class Post } } - /** - * @param i - */ - public void updatetxt(int i) + public void updateText(int i) { try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?")) { final CPost cp = getCPost(i); - ps.setString(1, cp.postTxt); - ps.setInt(2, cp.postId); - ps.setInt(3, cp.postTopicId); - ps.setInt(4, cp.postForumId); + ps.setString(1, cp.getPostText()); + ps.setInt(2, cp.getPostId()); + ps.setInt(3, cp.getPostTopicId()); + ps.setInt(4, cp.getPostForumId()); ps.execute(); } catch (Exception e) diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index d4e5528d28..4f38524224 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -120,7 +120,7 @@ public class PostBBSManager extends BaseBBSManager { final String html = "

HOME > " + forum.getName() + " Form
&$413;" + topic.getName() + "
&$427;
  
"; send1001(html, player); - send1002(player, p.getCPost(0).postTxt, topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); + send1002(player, p.getCPost(0).getPostText(), topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); } private void showMemoPost(Topic topic, PlayerInstance player, Forum forum) @@ -128,10 +128,10 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); - String mes = p.getCPost(0).postTxt.replace(">", ">"); + String mes = p.getCPost(0).getPostText().replace(">", ">"); mes = mes.replace("<", "<"); - final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).postDate) + "

" + mes + "

   



"; + final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).getPostDate()) + "

" + mes + "

   



"; CommunityBoardHandler.separateAndSend(html, player); } @@ -165,8 +165,8 @@ public class PostBBSManager extends BaseBBSManager } else { - p.getCPost(idp).postTxt = ar4; - p.updatetxt(idp); + p.getCPost(idp).setPostText(ar4); + p.updateText(idp); parsecmd("_bbsposts;read;" + f.getID() + ";" + t.getID(), player); } } diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java index e213662279..3db3f0de91 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java @@ -115,7 +115,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); @@ -178,7 +178,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java index 5288eac3b4..4cd006629d 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java @@ -36,13 +36,95 @@ public class Post public static class CPost { - public int postId; - public String postOwner; - public int postOwnerId; - public long postDate; - public int postTopicId; - public int postForumId; - public String postTxt; + private int _postId; + private String _postOwner; + private int _postOwnerId; + private long _postDate; + private int _postTopicId; + private int _postForumId; + private String _postText; + + public void setPostId(int postId) + { + _postId = postId; + } + + public int getPostId() + { + return _postId; + } + + public void setPostOwner(String postOwner) + { + _postOwner = postOwner; + } + + public String getPostOwner() + { + return _postOwner; + } + + public void setPostOwnerId(int postOwnerId) + { + _postOwnerId = postOwnerId; + } + + public int getPostOwnerId() + { + return _postOwnerId; + } + + public void setPostDate(long postDate) + { + _postDate = postDate; + } + + public long getPostDate() + { + return _postDate; + } + + public void setPostTopicId(int postTopicId) + { + _postTopicId = postTopicId; + } + + public int getPostTopicId() + { + return _postTopicId; + } + + public void setPostForumId(int postForumId) + { + _postForumId = postForumId; + } + + public int getPostForumId() + { + return _postForumId; + } + + public void setPostText(String postText) + { + _postText = postText; + } + + public String getPostText() + { + if (_postText == null) + { + return ""; + } + + // Bypass exploit check. + final String text = _postText.toLowerCase(); + if (text.contains("action") && text.contains("bypass")) + { + return ""; + } + + return _postText; + } } private final Collection _post; @@ -59,13 +141,13 @@ public class Post { _post = ConcurrentHashMap.newKeySet(); final CPost cp = new CPost(); - cp.postId = 0; - cp.postOwner = postOwner; - cp.postOwnerId = postOwnerId; - cp.postDate = date; - cp.postTopicId = tid; - cp.postForumId = postForumId; - cp.postTxt = txt; + cp.setPostId(0); + cp.setPostOwner(postOwner); + cp.setPostOwnerId(postOwnerId); + cp.setPostDate(date); + cp.setPostTopicId(tid); + cp.setPostForumId(postForumId); + cp.setPostText(txt); _post.add(cp); insertindb(cp); } @@ -75,13 +157,13 @@ public class Post try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)")) { - ps.setInt(1, cp.postId); - ps.setString(2, cp.postOwner); - ps.setInt(3, cp.postOwnerId); - ps.setLong(4, cp.postDate); - ps.setInt(5, cp.postTopicId); - ps.setInt(6, cp.postForumId); - ps.setString(7, cp.postTxt); + ps.setInt(1, cp.getPostId()); + ps.setString(2, cp.getPostOwner()); + ps.setInt(3, cp.getPostOwnerId()); + ps.setLong(4, cp.getPostDate()); + ps.setInt(5, cp.getPostTopicId()); + ps.setInt(6, cp.getPostForumId()); + ps.setString(7, cp.getPostText()); ps.execute(); } catch (Exception e) @@ -109,7 +191,7 @@ public class Post return null; } - public void deleteme(Topic t) + public void deleteMe(Topic t) { PostBBSManager.getInstance().delPostByTopic(t); try (Connection con = DatabaseFactory.getConnection(); @@ -125,9 +207,6 @@ public class Post } } - /** - * @param t - */ private void load(Topic t) { try (Connection con = DatabaseFactory.getConnection(); @@ -140,13 +219,13 @@ public class Post while (rs.next()) { final CPost cp = new CPost(); - cp.postId = rs.getInt("post_id"); - cp.postOwner = rs.getString("post_owner_name"); - cp.postOwnerId = rs.getInt("post_ownerid"); - cp.postDate = rs.getLong("post_date"); - cp.postTopicId = rs.getInt("post_topic_id"); - cp.postForumId = rs.getInt("post_forum_id"); - cp.postTxt = rs.getString("post_txt"); + cp.setPostId(rs.getInt("post_id")); + cp.setPostOwner(rs.getString("post_owner_name")); + cp.setPostOwnerId(rs.getInt("post_ownerid")); + cp.setPostDate(rs.getLong("post_date")); + cp.setPostTopicId(rs.getInt("post_topic_id")); + cp.setPostForumId(rs.getInt("post_forum_id")); + cp.setPostText(rs.getString("post_txt")); _post.add(cp); } } @@ -157,19 +236,16 @@ public class Post } } - /** - * @param i - */ - public void updatetxt(int i) + public void updateText(int i) { try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?")) { final CPost cp = getCPost(i); - ps.setString(1, cp.postTxt); - ps.setInt(2, cp.postId); - ps.setInt(3, cp.postTopicId); - ps.setInt(4, cp.postForumId); + ps.setString(1, cp.getPostText()); + ps.setInt(2, cp.getPostId()); + ps.setInt(3, cp.getPostTopicId()); + ps.setInt(4, cp.getPostForumId()); ps.execute(); } catch (Exception e) diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index d4e5528d28..4f38524224 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -120,7 +120,7 @@ public class PostBBSManager extends BaseBBSManager { final String html = "

HOME > " + forum.getName() + " Form
&$413;" + topic.getName() + "
&$427;
  
"; send1001(html, player); - send1002(player, p.getCPost(0).postTxt, topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); + send1002(player, p.getCPost(0).getPostText(), topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); } private void showMemoPost(Topic topic, PlayerInstance player, Forum forum) @@ -128,10 +128,10 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); - String mes = p.getCPost(0).postTxt.replace(">", ">"); + String mes = p.getCPost(0).getPostText().replace(">", ">"); mes = mes.replace("<", "<"); - final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).postDate) + "

" + mes + "

   



"; + final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).getPostDate()) + "

" + mes + "

   



"; CommunityBoardHandler.separateAndSend(html, player); } @@ -165,8 +165,8 @@ public class PostBBSManager extends BaseBBSManager } else { - p.getCPost(idp).postTxt = ar4; - p.updatetxt(idp); + p.getCPost(idp).setPostText(ar4); + p.updateText(idp); parsecmd("_bbsposts;read;" + f.getID() + ";" + t.getID(), player); } } diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java index e213662279..3db3f0de91 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java @@ -115,7 +115,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); @@ -178,7 +178,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java index 5288eac3b4..4cd006629d 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java @@ -36,13 +36,95 @@ public class Post public static class CPost { - public int postId; - public String postOwner; - public int postOwnerId; - public long postDate; - public int postTopicId; - public int postForumId; - public String postTxt; + private int _postId; + private String _postOwner; + private int _postOwnerId; + private long _postDate; + private int _postTopicId; + private int _postForumId; + private String _postText; + + public void setPostId(int postId) + { + _postId = postId; + } + + public int getPostId() + { + return _postId; + } + + public void setPostOwner(String postOwner) + { + _postOwner = postOwner; + } + + public String getPostOwner() + { + return _postOwner; + } + + public void setPostOwnerId(int postOwnerId) + { + _postOwnerId = postOwnerId; + } + + public int getPostOwnerId() + { + return _postOwnerId; + } + + public void setPostDate(long postDate) + { + _postDate = postDate; + } + + public long getPostDate() + { + return _postDate; + } + + public void setPostTopicId(int postTopicId) + { + _postTopicId = postTopicId; + } + + public int getPostTopicId() + { + return _postTopicId; + } + + public void setPostForumId(int postForumId) + { + _postForumId = postForumId; + } + + public int getPostForumId() + { + return _postForumId; + } + + public void setPostText(String postText) + { + _postText = postText; + } + + public String getPostText() + { + if (_postText == null) + { + return ""; + } + + // Bypass exploit check. + final String text = _postText.toLowerCase(); + if (text.contains("action") && text.contains("bypass")) + { + return ""; + } + + return _postText; + } } private final Collection _post; @@ -59,13 +141,13 @@ public class Post { _post = ConcurrentHashMap.newKeySet(); final CPost cp = new CPost(); - cp.postId = 0; - cp.postOwner = postOwner; - cp.postOwnerId = postOwnerId; - cp.postDate = date; - cp.postTopicId = tid; - cp.postForumId = postForumId; - cp.postTxt = txt; + cp.setPostId(0); + cp.setPostOwner(postOwner); + cp.setPostOwnerId(postOwnerId); + cp.setPostDate(date); + cp.setPostTopicId(tid); + cp.setPostForumId(postForumId); + cp.setPostText(txt); _post.add(cp); insertindb(cp); } @@ -75,13 +157,13 @@ public class Post try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)")) { - ps.setInt(1, cp.postId); - ps.setString(2, cp.postOwner); - ps.setInt(3, cp.postOwnerId); - ps.setLong(4, cp.postDate); - ps.setInt(5, cp.postTopicId); - ps.setInt(6, cp.postForumId); - ps.setString(7, cp.postTxt); + ps.setInt(1, cp.getPostId()); + ps.setString(2, cp.getPostOwner()); + ps.setInt(3, cp.getPostOwnerId()); + ps.setLong(4, cp.getPostDate()); + ps.setInt(5, cp.getPostTopicId()); + ps.setInt(6, cp.getPostForumId()); + ps.setString(7, cp.getPostText()); ps.execute(); } catch (Exception e) @@ -109,7 +191,7 @@ public class Post return null; } - public void deleteme(Topic t) + public void deleteMe(Topic t) { PostBBSManager.getInstance().delPostByTopic(t); try (Connection con = DatabaseFactory.getConnection(); @@ -125,9 +207,6 @@ public class Post } } - /** - * @param t - */ private void load(Topic t) { try (Connection con = DatabaseFactory.getConnection(); @@ -140,13 +219,13 @@ public class Post while (rs.next()) { final CPost cp = new CPost(); - cp.postId = rs.getInt("post_id"); - cp.postOwner = rs.getString("post_owner_name"); - cp.postOwnerId = rs.getInt("post_ownerid"); - cp.postDate = rs.getLong("post_date"); - cp.postTopicId = rs.getInt("post_topic_id"); - cp.postForumId = rs.getInt("post_forum_id"); - cp.postTxt = rs.getString("post_txt"); + cp.setPostId(rs.getInt("post_id")); + cp.setPostOwner(rs.getString("post_owner_name")); + cp.setPostOwnerId(rs.getInt("post_ownerid")); + cp.setPostDate(rs.getLong("post_date")); + cp.setPostTopicId(rs.getInt("post_topic_id")); + cp.setPostForumId(rs.getInt("post_forum_id")); + cp.setPostText(rs.getString("post_txt")); _post.add(cp); } } @@ -157,19 +236,16 @@ public class Post } } - /** - * @param i - */ - public void updatetxt(int i) + public void updateText(int i) { try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?")) { final CPost cp = getCPost(i); - ps.setString(1, cp.postTxt); - ps.setInt(2, cp.postId); - ps.setInt(3, cp.postTopicId); - ps.setInt(4, cp.postForumId); + ps.setString(1, cp.getPostText()); + ps.setInt(2, cp.getPostId()); + ps.setInt(3, cp.getPostTopicId()); + ps.setInt(4, cp.getPostForumId()); ps.execute(); } catch (Exception e) diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index d4e5528d28..4f38524224 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -120,7 +120,7 @@ public class PostBBSManager extends BaseBBSManager { final String html = "

HOME > " + forum.getName() + " Form
&$413;" + topic.getName() + "
&$427;
  
"; send1001(html, player); - send1002(player, p.getCPost(0).postTxt, topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); + send1002(player, p.getCPost(0).getPostText(), topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); } private void showMemoPost(Topic topic, PlayerInstance player, Forum forum) @@ -128,10 +128,10 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); - String mes = p.getCPost(0).postTxt.replace(">", ">"); + String mes = p.getCPost(0).getPostText().replace(">", ">"); mes = mes.replace("<", "<"); - final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).postDate) + "

" + mes + "

   



"; + final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).getPostDate()) + "

" + mes + "

   



"; CommunityBoardHandler.separateAndSend(html, player); } @@ -165,8 +165,8 @@ public class PostBBSManager extends BaseBBSManager } else { - p.getCPost(idp).postTxt = ar4; - p.updatetxt(idp); + p.getCPost(idp).setPostText(ar4); + p.updateText(idp); parsecmd("_bbsposts;read;" + f.getID() + ";" + t.getID(), player); } } diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java index e213662279..3db3f0de91 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java @@ -115,7 +115,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); @@ -178,7 +178,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java index 5288eac3b4..4cd006629d 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java @@ -36,13 +36,95 @@ public class Post public static class CPost { - public int postId; - public String postOwner; - public int postOwnerId; - public long postDate; - public int postTopicId; - public int postForumId; - public String postTxt; + private int _postId; + private String _postOwner; + private int _postOwnerId; + private long _postDate; + private int _postTopicId; + private int _postForumId; + private String _postText; + + public void setPostId(int postId) + { + _postId = postId; + } + + public int getPostId() + { + return _postId; + } + + public void setPostOwner(String postOwner) + { + _postOwner = postOwner; + } + + public String getPostOwner() + { + return _postOwner; + } + + public void setPostOwnerId(int postOwnerId) + { + _postOwnerId = postOwnerId; + } + + public int getPostOwnerId() + { + return _postOwnerId; + } + + public void setPostDate(long postDate) + { + _postDate = postDate; + } + + public long getPostDate() + { + return _postDate; + } + + public void setPostTopicId(int postTopicId) + { + _postTopicId = postTopicId; + } + + public int getPostTopicId() + { + return _postTopicId; + } + + public void setPostForumId(int postForumId) + { + _postForumId = postForumId; + } + + public int getPostForumId() + { + return _postForumId; + } + + public void setPostText(String postText) + { + _postText = postText; + } + + public String getPostText() + { + if (_postText == null) + { + return ""; + } + + // Bypass exploit check. + final String text = _postText.toLowerCase(); + if (text.contains("action") && text.contains("bypass")) + { + return ""; + } + + return _postText; + } } private final Collection _post; @@ -59,13 +141,13 @@ public class Post { _post = ConcurrentHashMap.newKeySet(); final CPost cp = new CPost(); - cp.postId = 0; - cp.postOwner = postOwner; - cp.postOwnerId = postOwnerId; - cp.postDate = date; - cp.postTopicId = tid; - cp.postForumId = postForumId; - cp.postTxt = txt; + cp.setPostId(0); + cp.setPostOwner(postOwner); + cp.setPostOwnerId(postOwnerId); + cp.setPostDate(date); + cp.setPostTopicId(tid); + cp.setPostForumId(postForumId); + cp.setPostText(txt); _post.add(cp); insertindb(cp); } @@ -75,13 +157,13 @@ public class Post try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)")) { - ps.setInt(1, cp.postId); - ps.setString(2, cp.postOwner); - ps.setInt(3, cp.postOwnerId); - ps.setLong(4, cp.postDate); - ps.setInt(5, cp.postTopicId); - ps.setInt(6, cp.postForumId); - ps.setString(7, cp.postTxt); + ps.setInt(1, cp.getPostId()); + ps.setString(2, cp.getPostOwner()); + ps.setInt(3, cp.getPostOwnerId()); + ps.setLong(4, cp.getPostDate()); + ps.setInt(5, cp.getPostTopicId()); + ps.setInt(6, cp.getPostForumId()); + ps.setString(7, cp.getPostText()); ps.execute(); } catch (Exception e) @@ -109,7 +191,7 @@ public class Post return null; } - public void deleteme(Topic t) + public void deleteMe(Topic t) { PostBBSManager.getInstance().delPostByTopic(t); try (Connection con = DatabaseFactory.getConnection(); @@ -125,9 +207,6 @@ public class Post } } - /** - * @param t - */ private void load(Topic t) { try (Connection con = DatabaseFactory.getConnection(); @@ -140,13 +219,13 @@ public class Post while (rs.next()) { final CPost cp = new CPost(); - cp.postId = rs.getInt("post_id"); - cp.postOwner = rs.getString("post_owner_name"); - cp.postOwnerId = rs.getInt("post_ownerid"); - cp.postDate = rs.getLong("post_date"); - cp.postTopicId = rs.getInt("post_topic_id"); - cp.postForumId = rs.getInt("post_forum_id"); - cp.postTxt = rs.getString("post_txt"); + cp.setPostId(rs.getInt("post_id")); + cp.setPostOwner(rs.getString("post_owner_name")); + cp.setPostOwnerId(rs.getInt("post_ownerid")); + cp.setPostDate(rs.getLong("post_date")); + cp.setPostTopicId(rs.getInt("post_topic_id")); + cp.setPostForumId(rs.getInt("post_forum_id")); + cp.setPostText(rs.getString("post_txt")); _post.add(cp); } } @@ -157,19 +236,16 @@ public class Post } } - /** - * @param i - */ - public void updatetxt(int i) + public void updateText(int i) { try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?")) { final CPost cp = getCPost(i); - ps.setString(1, cp.postTxt); - ps.setInt(2, cp.postId); - ps.setInt(3, cp.postTopicId); - ps.setInt(4, cp.postForumId); + ps.setString(1, cp.getPostText()); + ps.setInt(2, cp.getPostId()); + ps.setInt(3, cp.getPostTopicId()); + ps.setInt(4, cp.getPostForumId()); ps.execute(); } catch (Exception e) diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index d4e5528d28..4f38524224 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -120,7 +120,7 @@ public class PostBBSManager extends BaseBBSManager { final String html = "

HOME > " + forum.getName() + " Form
&$413;" + topic.getName() + "
&$427;
  
"; send1001(html, player); - send1002(player, p.getCPost(0).postTxt, topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); + send1002(player, p.getCPost(0).getPostText(), topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); } private void showMemoPost(Topic topic, PlayerInstance player, Forum forum) @@ -128,10 +128,10 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); - String mes = p.getCPost(0).postTxt.replace(">", ">"); + String mes = p.getCPost(0).getPostText().replace(">", ">"); mes = mes.replace("<", "<"); - final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).postDate) + "

" + mes + "

   



"; + final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).getPostDate()) + "

" + mes + "

   



"; CommunityBoardHandler.separateAndSend(html, player); } @@ -165,8 +165,8 @@ public class PostBBSManager extends BaseBBSManager } else { - p.getCPost(idp).postTxt = ar4; - p.updatetxt(idp); + p.getCPost(idp).setPostText(ar4); + p.updateText(idp); parsecmd("_bbsposts;read;" + f.getID() + ";" + t.getID(), player); } } diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java index e213662279..3db3f0de91 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java @@ -115,7 +115,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); @@ -178,7 +178,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); diff --git a/L2J_Mobius_8.2_Homunculus/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_8.2_Homunculus/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java index 5288eac3b4..4cd006629d 100644 --- a/L2J_Mobius_8.2_Homunculus/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java +++ b/L2J_Mobius_8.2_Homunculus/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java @@ -36,13 +36,95 @@ public class Post public static class CPost { - public int postId; - public String postOwner; - public int postOwnerId; - public long postDate; - public int postTopicId; - public int postForumId; - public String postTxt; + private int _postId; + private String _postOwner; + private int _postOwnerId; + private long _postDate; + private int _postTopicId; + private int _postForumId; + private String _postText; + + public void setPostId(int postId) + { + _postId = postId; + } + + public int getPostId() + { + return _postId; + } + + public void setPostOwner(String postOwner) + { + _postOwner = postOwner; + } + + public String getPostOwner() + { + return _postOwner; + } + + public void setPostOwnerId(int postOwnerId) + { + _postOwnerId = postOwnerId; + } + + public int getPostOwnerId() + { + return _postOwnerId; + } + + public void setPostDate(long postDate) + { + _postDate = postDate; + } + + public long getPostDate() + { + return _postDate; + } + + public void setPostTopicId(int postTopicId) + { + _postTopicId = postTopicId; + } + + public int getPostTopicId() + { + return _postTopicId; + } + + public void setPostForumId(int postForumId) + { + _postForumId = postForumId; + } + + public int getPostForumId() + { + return _postForumId; + } + + public void setPostText(String postText) + { + _postText = postText; + } + + public String getPostText() + { + if (_postText == null) + { + return ""; + } + + // Bypass exploit check. + final String text = _postText.toLowerCase(); + if (text.contains("action") && text.contains("bypass")) + { + return ""; + } + + return _postText; + } } private final Collection _post; @@ -59,13 +141,13 @@ public class Post { _post = ConcurrentHashMap.newKeySet(); final CPost cp = new CPost(); - cp.postId = 0; - cp.postOwner = postOwner; - cp.postOwnerId = postOwnerId; - cp.postDate = date; - cp.postTopicId = tid; - cp.postForumId = postForumId; - cp.postTxt = txt; + cp.setPostId(0); + cp.setPostOwner(postOwner); + cp.setPostOwnerId(postOwnerId); + cp.setPostDate(date); + cp.setPostTopicId(tid); + cp.setPostForumId(postForumId); + cp.setPostText(txt); _post.add(cp); insertindb(cp); } @@ -75,13 +157,13 @@ public class Post try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)")) { - ps.setInt(1, cp.postId); - ps.setString(2, cp.postOwner); - ps.setInt(3, cp.postOwnerId); - ps.setLong(4, cp.postDate); - ps.setInt(5, cp.postTopicId); - ps.setInt(6, cp.postForumId); - ps.setString(7, cp.postTxt); + ps.setInt(1, cp.getPostId()); + ps.setString(2, cp.getPostOwner()); + ps.setInt(3, cp.getPostOwnerId()); + ps.setLong(4, cp.getPostDate()); + ps.setInt(5, cp.getPostTopicId()); + ps.setInt(6, cp.getPostForumId()); + ps.setString(7, cp.getPostText()); ps.execute(); } catch (Exception e) @@ -109,7 +191,7 @@ public class Post return null; } - public void deleteme(Topic t) + public void deleteMe(Topic t) { PostBBSManager.getInstance().delPostByTopic(t); try (Connection con = DatabaseFactory.getConnection(); @@ -125,9 +207,6 @@ public class Post } } - /** - * @param t - */ private void load(Topic t) { try (Connection con = DatabaseFactory.getConnection(); @@ -140,13 +219,13 @@ public class Post while (rs.next()) { final CPost cp = new CPost(); - cp.postId = rs.getInt("post_id"); - cp.postOwner = rs.getString("post_owner_name"); - cp.postOwnerId = rs.getInt("post_ownerid"); - cp.postDate = rs.getLong("post_date"); - cp.postTopicId = rs.getInt("post_topic_id"); - cp.postForumId = rs.getInt("post_forum_id"); - cp.postTxt = rs.getString("post_txt"); + cp.setPostId(rs.getInt("post_id")); + cp.setPostOwner(rs.getString("post_owner_name")); + cp.setPostOwnerId(rs.getInt("post_ownerid")); + cp.setPostDate(rs.getLong("post_date")); + cp.setPostTopicId(rs.getInt("post_topic_id")); + cp.setPostForumId(rs.getInt("post_forum_id")); + cp.setPostText(rs.getString("post_txt")); _post.add(cp); } } @@ -157,19 +236,16 @@ public class Post } } - /** - * @param i - */ - public void updatetxt(int i) + public void updateText(int i) { try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?")) { final CPost cp = getCPost(i); - ps.setString(1, cp.postTxt); - ps.setInt(2, cp.postId); - ps.setInt(3, cp.postTopicId); - ps.setInt(4, cp.postForumId); + ps.setString(1, cp.getPostText()); + ps.setInt(2, cp.getPostId()); + ps.setInt(3, cp.getPostTopicId()); + ps.setInt(4, cp.getPostForumId()); ps.execute(); } catch (Exception e) diff --git a/L2J_Mobius_8.2_Homunculus/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_8.2_Homunculus/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index d4e5528d28..4f38524224 100644 --- a/L2J_Mobius_8.2_Homunculus/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_8.2_Homunculus/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -120,7 +120,7 @@ public class PostBBSManager extends BaseBBSManager { final String html = "

HOME > " + forum.getName() + " Form
&$413;" + topic.getName() + "
&$427;
  
"; send1001(html, player); - send1002(player, p.getCPost(0).postTxt, topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); + send1002(player, p.getCPost(0).getPostText(), topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); } private void showMemoPost(Topic topic, PlayerInstance player, Forum forum) @@ -128,10 +128,10 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); - String mes = p.getCPost(0).postTxt.replace(">", ">"); + String mes = p.getCPost(0).getPostText().replace(">", ">"); mes = mes.replace("<", "<"); - final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).postDate) + "

" + mes + "

   



"; + final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).getPostDate()) + "

" + mes + "

   



"; CommunityBoardHandler.separateAndSend(html, player); } @@ -165,8 +165,8 @@ public class PostBBSManager extends BaseBBSManager } else { - p.getCPost(idp).postTxt = ar4; - p.updatetxt(idp); + p.getCPost(idp).setPostText(ar4); + p.updateText(idp); parsecmd("_bbsposts;read;" + f.getID() + ";" + t.getID(), player); } } diff --git a/L2J_Mobius_8.2_Homunculus/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java b/L2J_Mobius_8.2_Homunculus/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java index e213662279..3db3f0de91 100644 --- a/L2J_Mobius_8.2_Homunculus/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java +++ b/L2J_Mobius_8.2_Homunculus/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java @@ -115,7 +115,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); @@ -178,7 +178,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); diff --git a/L2J_Mobius_9.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_9.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java index 5288eac3b4..4cd006629d 100644 --- a/L2J_Mobius_9.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java +++ b/L2J_Mobius_9.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java @@ -36,13 +36,95 @@ public class Post public static class CPost { - public int postId; - public String postOwner; - public int postOwnerId; - public long postDate; - public int postTopicId; - public int postForumId; - public String postTxt; + private int _postId; + private String _postOwner; + private int _postOwnerId; + private long _postDate; + private int _postTopicId; + private int _postForumId; + private String _postText; + + public void setPostId(int postId) + { + _postId = postId; + } + + public int getPostId() + { + return _postId; + } + + public void setPostOwner(String postOwner) + { + _postOwner = postOwner; + } + + public String getPostOwner() + { + return _postOwner; + } + + public void setPostOwnerId(int postOwnerId) + { + _postOwnerId = postOwnerId; + } + + public int getPostOwnerId() + { + return _postOwnerId; + } + + public void setPostDate(long postDate) + { + _postDate = postDate; + } + + public long getPostDate() + { + return _postDate; + } + + public void setPostTopicId(int postTopicId) + { + _postTopicId = postTopicId; + } + + public int getPostTopicId() + { + return _postTopicId; + } + + public void setPostForumId(int postForumId) + { + _postForumId = postForumId; + } + + public int getPostForumId() + { + return _postForumId; + } + + public void setPostText(String postText) + { + _postText = postText; + } + + public String getPostText() + { + if (_postText == null) + { + return ""; + } + + // Bypass exploit check. + final String text = _postText.toLowerCase(); + if (text.contains("action") && text.contains("bypass")) + { + return ""; + } + + return _postText; + } } private final Collection _post; @@ -59,13 +141,13 @@ public class Post { _post = ConcurrentHashMap.newKeySet(); final CPost cp = new CPost(); - cp.postId = 0; - cp.postOwner = postOwner; - cp.postOwnerId = postOwnerId; - cp.postDate = date; - cp.postTopicId = tid; - cp.postForumId = postForumId; - cp.postTxt = txt; + cp.setPostId(0); + cp.setPostOwner(postOwner); + cp.setPostOwnerId(postOwnerId); + cp.setPostDate(date); + cp.setPostTopicId(tid); + cp.setPostForumId(postForumId); + cp.setPostText(txt); _post.add(cp); insertindb(cp); } @@ -75,13 +157,13 @@ public class Post try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)")) { - ps.setInt(1, cp.postId); - ps.setString(2, cp.postOwner); - ps.setInt(3, cp.postOwnerId); - ps.setLong(4, cp.postDate); - ps.setInt(5, cp.postTopicId); - ps.setInt(6, cp.postForumId); - ps.setString(7, cp.postTxt); + ps.setInt(1, cp.getPostId()); + ps.setString(2, cp.getPostOwner()); + ps.setInt(3, cp.getPostOwnerId()); + ps.setLong(4, cp.getPostDate()); + ps.setInt(5, cp.getPostTopicId()); + ps.setInt(6, cp.getPostForumId()); + ps.setString(7, cp.getPostText()); ps.execute(); } catch (Exception e) @@ -109,7 +191,7 @@ public class Post return null; } - public void deleteme(Topic t) + public void deleteMe(Topic t) { PostBBSManager.getInstance().delPostByTopic(t); try (Connection con = DatabaseFactory.getConnection(); @@ -125,9 +207,6 @@ public class Post } } - /** - * @param t - */ private void load(Topic t) { try (Connection con = DatabaseFactory.getConnection(); @@ -140,13 +219,13 @@ public class Post while (rs.next()) { final CPost cp = new CPost(); - cp.postId = rs.getInt("post_id"); - cp.postOwner = rs.getString("post_owner_name"); - cp.postOwnerId = rs.getInt("post_ownerid"); - cp.postDate = rs.getLong("post_date"); - cp.postTopicId = rs.getInt("post_topic_id"); - cp.postForumId = rs.getInt("post_forum_id"); - cp.postTxt = rs.getString("post_txt"); + cp.setPostId(rs.getInt("post_id")); + cp.setPostOwner(rs.getString("post_owner_name")); + cp.setPostOwnerId(rs.getInt("post_ownerid")); + cp.setPostDate(rs.getLong("post_date")); + cp.setPostTopicId(rs.getInt("post_topic_id")); + cp.setPostForumId(rs.getInt("post_forum_id")); + cp.setPostText(rs.getString("post_txt")); _post.add(cp); } } @@ -157,19 +236,16 @@ public class Post } } - /** - * @param i - */ - public void updatetxt(int i) + public void updateText(int i) { try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?")) { final CPost cp = getCPost(i); - ps.setString(1, cp.postTxt); - ps.setInt(2, cp.postId); - ps.setInt(3, cp.postTopicId); - ps.setInt(4, cp.postForumId); + ps.setString(1, cp.getPostText()); + ps.setInt(2, cp.getPostId()); + ps.setInt(3, cp.getPostTopicId()); + ps.setInt(4, cp.getPostForumId()); ps.execute(); } catch (Exception e) diff --git a/L2J_Mobius_9.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_9.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index d4e5528d28..4f38524224 100644 --- a/L2J_Mobius_9.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_9.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -120,7 +120,7 @@ public class PostBBSManager extends BaseBBSManager { final String html = "

HOME > " + forum.getName() + " Form
&$413;" + topic.getName() + "
&$427;
  
"; send1001(html, player); - send1002(player, p.getCPost(0).postTxt, topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); + send1002(player, p.getCPost(0).getPostText(), topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); } private void showMemoPost(Topic topic, PlayerInstance player, Forum forum) @@ -128,10 +128,10 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); - String mes = p.getCPost(0).postTxt.replace(">", ">"); + String mes = p.getCPost(0).getPostText().replace(">", ">"); mes = mes.replace("<", "<"); - final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).postDate) + "

" + mes + "

   



"; + final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).getPostDate()) + "

" + mes + "

   



"; CommunityBoardHandler.separateAndSend(html, player); } @@ -165,8 +165,8 @@ public class PostBBSManager extends BaseBBSManager } else { - p.getCPost(idp).postTxt = ar4; - p.updatetxt(idp); + p.getCPost(idp).setPostText(ar4); + p.updateText(idp); parsecmd("_bbsposts;read;" + f.getID() + ";" + t.getID(), player); } } diff --git a/L2J_Mobius_9.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java b/L2J_Mobius_9.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java index e213662279..3db3f0de91 100644 --- a/L2J_Mobius_9.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java +++ b/L2J_Mobius_9.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java @@ -115,7 +115,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); @@ -178,7 +178,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java index 200d834614..0425c1db2f 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java @@ -19,8 +19,9 @@ package org.l2jmobius.gameserver.communitybbs.BB; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; -import java.util.ArrayList; -import java.util.List; +import java.util.Collection; +import java.util.concurrent.ConcurrentHashMap; +import java.util.logging.Level; import java.util.logging.Logger; import org.l2jmobius.commons.database.DatabaseFactory; @@ -33,18 +34,100 @@ public class Post { private static final Logger LOGGER = Logger.getLogger(Post.class.getName()); - public class CPost + public static class CPost { - public int postId; - public String postOwner; - public int postOwnerId; - public long postDate; - public int postTopicId; - public int postForumId; - public String postTxt; + private int _postId; + private String _postOwner; + private int _postOwnerId; + private long _postDate; + private int _postTopicId; + private int _postForumId; + private String _postText; + + public void setPostId(int postId) + { + _postId = postId; + } + + public int getPostId() + { + return _postId; + } + + public void setPostOwner(String postOwner) + { + _postOwner = postOwner; + } + + public String getPostOwner() + { + return _postOwner; + } + + public void setPostOwnerId(int postOwnerId) + { + _postOwnerId = postOwnerId; + } + + public int getPostOwnerId() + { + return _postOwnerId; + } + + public void setPostDate(long postDate) + { + _postDate = postDate; + } + + public long getPostDate() + { + return _postDate; + } + + public void setPostTopicId(int postTopicId) + { + _postTopicId = postTopicId; + } + + public int getPostTopicId() + { + return _postTopicId; + } + + public void setPostForumId(int postForumId) + { + _postForumId = postForumId; + } + + public int getPostForumId() + { + return _postForumId; + } + + public void setPostText(String postText) + { + _postText = postText; + } + + public String getPostText() + { + if (_postText == null) + { + return ""; + } + + // Bypass exploit check. + final String text = _postText.toLowerCase(); + if (text.contains("action") && text.contains("bypass")) + { + return ""; + } + + return _postText; + } } - private final List _post; + private final Collection _post; /** * @param postOwner @@ -56,43 +139,42 @@ public class Post */ public Post(String postOwner, int postOwnerId, long date, int tid, int postForumId, String txt) { - _post = new ArrayList<>(); + _post = ConcurrentHashMap.newKeySet(); final CPost cp = new CPost(); - cp.postId = 0; - cp.postOwner = postOwner; - cp.postOwnerId = postOwnerId; - cp.postDate = date; - cp.postTopicId = tid; - cp.postForumId = postForumId; - cp.postTxt = txt; + cp.setPostId(0); + cp.setPostOwner(postOwner); + cp.setPostOwnerId(postOwnerId); + cp.setPostDate(date); + cp.setPostTopicId(tid); + cp.setPostForumId(postForumId); + cp.setPostText(txt); _post.add(cp); insertindb(cp); } - public void insertindb(CPost cp) + private void insertindb(CPost cp) { - try (Connection con = DatabaseFactory.getConnection()) + try (Connection con = DatabaseFactory.getConnection(); + PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)")) { - final PreparedStatement statement = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)"); - statement.setInt(1, cp.postId); - statement.setString(2, cp.postOwner); - statement.setInt(3, cp.postOwnerId); - statement.setLong(4, cp.postDate); - statement.setInt(5, cp.postTopicId); - statement.setInt(6, cp.postForumId); - statement.setString(7, cp.postTxt); - statement.execute(); - statement.close(); + ps.setInt(1, cp.getPostId()); + ps.setString(2, cp.getPostOwner()); + ps.setInt(3, cp.getPostOwnerId()); + ps.setLong(4, cp.getPostDate()); + ps.setInt(5, cp.getPostTopicId()); + ps.setInt(6, cp.getPostForumId()); + ps.setString(7, cp.getPostText()); + ps.execute(); } catch (Exception e) { - LOGGER.warning("Error while saving new Post to db " + e); + LOGGER.log(Level.WARNING, "Error while saving new Post to db " + e.getMessage(), e); } } public Post(Topic t) { - _post = new ArrayList<>(); + _post = ConcurrentHashMap.newKeySet(); load(t); } @@ -112,65 +194,63 @@ public class Post public void deleteMe(Topic t) { PostBBSManager.getInstance().delPostByTopic(t); - try (Connection con = DatabaseFactory.getConnection()) + try (Connection con = DatabaseFactory.getConnection(); + PreparedStatement ps = con.prepareStatement("DELETE FROM posts WHERE post_forum_id=? AND post_topic_id=?")) { - final PreparedStatement statement = con.prepareStatement("DELETE FROM posts WHERE post_forum_id=? AND post_topic_id=?"); - statement.setInt(1, t.getForumID()); - statement.setInt(2, t.getID()); - statement.execute(); - statement.close(); + ps.setInt(1, t.getForumID()); + ps.setInt(2, t.getID()); + ps.execute(); } catch (Exception e) { - LOGGER.warning("Error while deleting post: " + e.getMessage()); + LOGGER.log(Level.WARNING, "Error while deleting post: " + e.getMessage(), e); } } private void load(Topic t) { - try (Connection con = DatabaseFactory.getConnection()) + try (Connection con = DatabaseFactory.getConnection(); + PreparedStatement ps = con.prepareStatement("SELECT * FROM posts WHERE post_forum_id=? AND post_topic_id=? ORDER BY post_id ASC")) { - final PreparedStatement statement = con.prepareStatement("SELECT * FROM posts WHERE post_forum_id=? AND post_topic_id=? ORDER BY post_id ASC"); - statement.setInt(1, t.getForumID()); - statement.setInt(2, t.getID()); - final ResultSet result = statement.executeQuery(); - while (result.next()) + ps.setInt(1, t.getForumID()); + ps.setInt(2, t.getID()); + try (ResultSet rs = ps.executeQuery()) { - final CPost cp = new CPost(); - cp.postId = result.getInt("post_id"); - cp.postOwner = result.getString("post_owner_name"); - cp.postOwnerId = result.getInt("post_ownerid"); - cp.postDate = result.getLong("post_date"); - cp.postTopicId = result.getInt("post_topic_id"); - cp.postForumId = result.getInt("post_forum_id"); - cp.postTxt = result.getString("post_txt"); - _post.add(cp); + while (rs.next()) + { + final CPost cp = new CPost(); + cp.setPostId(rs.getInt("post_id")); + cp.setPostOwner(rs.getString("post_owner_name")); + cp.setPostOwnerId(rs.getInt("post_ownerid")); + cp.setPostDate(rs.getLong("post_date")); + cp.setPostTopicId(rs.getInt("post_topic_id")); + cp.setPostForumId(rs.getInt("post_forum_id")); + cp.setPostText(rs.getString("post_txt")); + _post.add(cp); + } } - result.close(); - statement.close(); } catch (Exception e) { - LOGGER.warning("Data error on Post " + t.getForumID() + "/" + t.getID() + " : " + e); + LOGGER.log(Level.WARNING, "Data error on Post " + t.getForumID() + "/" + t.getID() + " : " + e.getMessage(), e); } } public void updateText(int i) { - try (Connection con = DatabaseFactory.getConnection()) + try (Connection con = DatabaseFactory.getConnection(); + PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?")) { final CPost cp = getCPost(i); - final PreparedStatement statement = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?"); - statement.setString(1, cp.postTxt); - statement.setInt(2, cp.postId); - statement.setInt(3, cp.postTopicId); - statement.setInt(4, cp.postForumId); - statement.execute(); - statement.close(); + ps.setString(1, cp.getPostText()); + ps.setInt(2, cp.getPostId()); + ps.setInt(3, cp.getPostTopicId()); + ps.setInt(4, cp.getPostForumId()); + ps.execute(); } catch (Exception e) { - LOGGER.warning("Error while saving new Post to db " + e); + LOGGER.log(Level.WARNING, "Error while saving new Post to db " + e.getMessage(), e); } } } \ No newline at end of file diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index 0048a7faca..9a5093627e 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -119,7 +119,7 @@ public class PostBBSManager extends BaseBBSManager return; } - post.getCPost(idp).postTxt = ar4; + post.getCPost(idp).setPostText(ar4); post.updateText(idp); parseCmd("_bbsposts;read;" + forum.getID() + ";" + topic.getID(), player); } @@ -191,7 +191,7 @@ public class PostBBSManager extends BaseBBSManager { final String html = "

HOME > " + forum.getName() + " Form
&$413;" + topic.getName() + "
&$427;
  
"; send1001(html, player); - send1002(player, p.getCPost(0).postTxt, topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); + send1002(player, p.getCPost(0).getPostText(), topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); } private void showMemoPost(Topic topic, PlayerInstance player, Forum forum) @@ -199,11 +199,11 @@ public class PostBBSManager extends BaseBBSManager final Post p = getPostByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); - String mes = p.getCPost(0).postTxt.replace(">", ">"); + String mes = p.getCPost(0).getPostText().replace(">", ">"); mes = mes.replace("<", "<"); mes = mes.replace("\n", ""); - final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).postDate) + "

" + mes + "

   



"; + final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).getPostDate()) + "

" + mes + "

   



"; separateAndSend(html, player); } diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java index 200d834614..0425c1db2f 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java @@ -19,8 +19,9 @@ package org.l2jmobius.gameserver.communitybbs.BB; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; -import java.util.ArrayList; -import java.util.List; +import java.util.Collection; +import java.util.concurrent.ConcurrentHashMap; +import java.util.logging.Level; import java.util.logging.Logger; import org.l2jmobius.commons.database.DatabaseFactory; @@ -33,18 +34,100 @@ public class Post { private static final Logger LOGGER = Logger.getLogger(Post.class.getName()); - public class CPost + public static class CPost { - public int postId; - public String postOwner; - public int postOwnerId; - public long postDate; - public int postTopicId; - public int postForumId; - public String postTxt; + private int _postId; + private String _postOwner; + private int _postOwnerId; + private long _postDate; + private int _postTopicId; + private int _postForumId; + private String _postText; + + public void setPostId(int postId) + { + _postId = postId; + } + + public int getPostId() + { + return _postId; + } + + public void setPostOwner(String postOwner) + { + _postOwner = postOwner; + } + + public String getPostOwner() + { + return _postOwner; + } + + public void setPostOwnerId(int postOwnerId) + { + _postOwnerId = postOwnerId; + } + + public int getPostOwnerId() + { + return _postOwnerId; + } + + public void setPostDate(long postDate) + { + _postDate = postDate; + } + + public long getPostDate() + { + return _postDate; + } + + public void setPostTopicId(int postTopicId) + { + _postTopicId = postTopicId; + } + + public int getPostTopicId() + { + return _postTopicId; + } + + public void setPostForumId(int postForumId) + { + _postForumId = postForumId; + } + + public int getPostForumId() + { + return _postForumId; + } + + public void setPostText(String postText) + { + _postText = postText; + } + + public String getPostText() + { + if (_postText == null) + { + return ""; + } + + // Bypass exploit check. + final String text = _postText.toLowerCase(); + if (text.contains("action") && text.contains("bypass")) + { + return ""; + } + + return _postText; + } } - private final List _post; + private final Collection _post; /** * @param postOwner @@ -56,43 +139,42 @@ public class Post */ public Post(String postOwner, int postOwnerId, long date, int tid, int postForumId, String txt) { - _post = new ArrayList<>(); + _post = ConcurrentHashMap.newKeySet(); final CPost cp = new CPost(); - cp.postId = 0; - cp.postOwner = postOwner; - cp.postOwnerId = postOwnerId; - cp.postDate = date; - cp.postTopicId = tid; - cp.postForumId = postForumId; - cp.postTxt = txt; + cp.setPostId(0); + cp.setPostOwner(postOwner); + cp.setPostOwnerId(postOwnerId); + cp.setPostDate(date); + cp.setPostTopicId(tid); + cp.setPostForumId(postForumId); + cp.setPostText(txt); _post.add(cp); insertindb(cp); } - public void insertindb(CPost cp) + private void insertindb(CPost cp) { - try (Connection con = DatabaseFactory.getConnection()) + try (Connection con = DatabaseFactory.getConnection(); + PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)")) { - final PreparedStatement statement = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)"); - statement.setInt(1, cp.postId); - statement.setString(2, cp.postOwner); - statement.setInt(3, cp.postOwnerId); - statement.setLong(4, cp.postDate); - statement.setInt(5, cp.postTopicId); - statement.setInt(6, cp.postForumId); - statement.setString(7, cp.postTxt); - statement.execute(); - statement.close(); + ps.setInt(1, cp.getPostId()); + ps.setString(2, cp.getPostOwner()); + ps.setInt(3, cp.getPostOwnerId()); + ps.setLong(4, cp.getPostDate()); + ps.setInt(5, cp.getPostTopicId()); + ps.setInt(6, cp.getPostForumId()); + ps.setString(7, cp.getPostText()); + ps.execute(); } catch (Exception e) { - LOGGER.warning("Error while saving new Post to db " + e); + LOGGER.log(Level.WARNING, "Error while saving new Post to db " + e.getMessage(), e); } } public Post(Topic t) { - _post = new ArrayList<>(); + _post = ConcurrentHashMap.newKeySet(); load(t); } @@ -112,65 +194,63 @@ public class Post public void deleteMe(Topic t) { PostBBSManager.getInstance().delPostByTopic(t); - try (Connection con = DatabaseFactory.getConnection()) + try (Connection con = DatabaseFactory.getConnection(); + PreparedStatement ps = con.prepareStatement("DELETE FROM posts WHERE post_forum_id=? AND post_topic_id=?")) { - final PreparedStatement statement = con.prepareStatement("DELETE FROM posts WHERE post_forum_id=? AND post_topic_id=?"); - statement.setInt(1, t.getForumID()); - statement.setInt(2, t.getID()); - statement.execute(); - statement.close(); + ps.setInt(1, t.getForumID()); + ps.setInt(2, t.getID()); + ps.execute(); } catch (Exception e) { - LOGGER.warning("Error while deleting post: " + e.getMessage()); + LOGGER.log(Level.WARNING, "Error while deleting post: " + e.getMessage(), e); } } private void load(Topic t) { - try (Connection con = DatabaseFactory.getConnection()) + try (Connection con = DatabaseFactory.getConnection(); + PreparedStatement ps = con.prepareStatement("SELECT * FROM posts WHERE post_forum_id=? AND post_topic_id=? ORDER BY post_id ASC")) { - final PreparedStatement statement = con.prepareStatement("SELECT * FROM posts WHERE post_forum_id=? AND post_topic_id=? ORDER BY post_id ASC"); - statement.setInt(1, t.getForumID()); - statement.setInt(2, t.getID()); - final ResultSet result = statement.executeQuery(); - while (result.next()) + ps.setInt(1, t.getForumID()); + ps.setInt(2, t.getID()); + try (ResultSet rs = ps.executeQuery()) { - final CPost cp = new CPost(); - cp.postId = result.getInt("post_id"); - cp.postOwner = result.getString("post_owner_name"); - cp.postOwnerId = result.getInt("post_ownerid"); - cp.postDate = result.getLong("post_date"); - cp.postTopicId = result.getInt("post_topic_id"); - cp.postForumId = result.getInt("post_forum_id"); - cp.postTxt = result.getString("post_txt"); - _post.add(cp); + while (rs.next()) + { + final CPost cp = new CPost(); + cp.setPostId(rs.getInt("post_id")); + cp.setPostOwner(rs.getString("post_owner_name")); + cp.setPostOwnerId(rs.getInt("post_ownerid")); + cp.setPostDate(rs.getLong("post_date")); + cp.setPostTopicId(rs.getInt("post_topic_id")); + cp.setPostForumId(rs.getInt("post_forum_id")); + cp.setPostText(rs.getString("post_txt")); + _post.add(cp); + } } - result.close(); - statement.close(); } catch (Exception e) { - LOGGER.warning("Data error on Post " + t.getForumID() + "/" + t.getID() + " : " + e); + LOGGER.log(Level.WARNING, "Data error on Post " + t.getForumID() + "/" + t.getID() + " : " + e.getMessage(), e); } } public void updateText(int i) { - try (Connection con = DatabaseFactory.getConnection()) + try (Connection con = DatabaseFactory.getConnection(); + PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?")) { final CPost cp = getCPost(i); - final PreparedStatement statement = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?"); - statement.setString(1, cp.postTxt); - statement.setInt(2, cp.postId); - statement.setInt(3, cp.postTopicId); - statement.setInt(4, cp.postForumId); - statement.execute(); - statement.close(); + ps.setString(1, cp.getPostText()); + ps.setInt(2, cp.getPostId()); + ps.setInt(3, cp.getPostTopicId()); + ps.setInt(4, cp.getPostForumId()); + ps.execute(); } catch (Exception e) { - LOGGER.warning("Error while saving new Post to db " + e); + LOGGER.log(Level.WARNING, "Error while saving new Post to db " + e.getMessage(), e); } } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index 0048a7faca..9a5093627e 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -119,7 +119,7 @@ public class PostBBSManager extends BaseBBSManager return; } - post.getCPost(idp).postTxt = ar4; + post.getCPost(idp).setPostText(ar4); post.updateText(idp); parseCmd("_bbsposts;read;" + forum.getID() + ";" + topic.getID(), player); } @@ -191,7 +191,7 @@ public class PostBBSManager extends BaseBBSManager { final String html = "

HOME > " + forum.getName() + " Form
&$413;" + topic.getName() + "
&$427;
  
"; send1001(html, player); - send1002(player, p.getCPost(0).postTxt, topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); + send1002(player, p.getCPost(0).getPostText(), topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); } private void showMemoPost(Topic topic, PlayerInstance player, Forum forum) @@ -199,11 +199,11 @@ public class PostBBSManager extends BaseBBSManager final Post p = getPostByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); - String mes = p.getCPost(0).postTxt.replace(">", ">"); + String mes = p.getCPost(0).getPostText().replace(">", ">"); mes = mes.replace("<", "<"); mes = mes.replace("\n", ""); - final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).postDate) + "

" + mes + "

   



"; + final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).getPostDate()) + "

" + mes + "

   



"; separateAndSend(html, player); } diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java index 5288eac3b4..4cd006629d 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java @@ -36,13 +36,95 @@ public class Post public static class CPost { - public int postId; - public String postOwner; - public int postOwnerId; - public long postDate; - public int postTopicId; - public int postForumId; - public String postTxt; + private int _postId; + private String _postOwner; + private int _postOwnerId; + private long _postDate; + private int _postTopicId; + private int _postForumId; + private String _postText; + + public void setPostId(int postId) + { + _postId = postId; + } + + public int getPostId() + { + return _postId; + } + + public void setPostOwner(String postOwner) + { + _postOwner = postOwner; + } + + public String getPostOwner() + { + return _postOwner; + } + + public void setPostOwnerId(int postOwnerId) + { + _postOwnerId = postOwnerId; + } + + public int getPostOwnerId() + { + return _postOwnerId; + } + + public void setPostDate(long postDate) + { + _postDate = postDate; + } + + public long getPostDate() + { + return _postDate; + } + + public void setPostTopicId(int postTopicId) + { + _postTopicId = postTopicId; + } + + public int getPostTopicId() + { + return _postTopicId; + } + + public void setPostForumId(int postForumId) + { + _postForumId = postForumId; + } + + public int getPostForumId() + { + return _postForumId; + } + + public void setPostText(String postText) + { + _postText = postText; + } + + public String getPostText() + { + if (_postText == null) + { + return ""; + } + + // Bypass exploit check. + final String text = _postText.toLowerCase(); + if (text.contains("action") && text.contains("bypass")) + { + return ""; + } + + return _postText; + } } private final Collection _post; @@ -59,13 +141,13 @@ public class Post { _post = ConcurrentHashMap.newKeySet(); final CPost cp = new CPost(); - cp.postId = 0; - cp.postOwner = postOwner; - cp.postOwnerId = postOwnerId; - cp.postDate = date; - cp.postTopicId = tid; - cp.postForumId = postForumId; - cp.postTxt = txt; + cp.setPostId(0); + cp.setPostOwner(postOwner); + cp.setPostOwnerId(postOwnerId); + cp.setPostDate(date); + cp.setPostTopicId(tid); + cp.setPostForumId(postForumId); + cp.setPostText(txt); _post.add(cp); insertindb(cp); } @@ -75,13 +157,13 @@ public class Post try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)")) { - ps.setInt(1, cp.postId); - ps.setString(2, cp.postOwner); - ps.setInt(3, cp.postOwnerId); - ps.setLong(4, cp.postDate); - ps.setInt(5, cp.postTopicId); - ps.setInt(6, cp.postForumId); - ps.setString(7, cp.postTxt); + ps.setInt(1, cp.getPostId()); + ps.setString(2, cp.getPostOwner()); + ps.setInt(3, cp.getPostOwnerId()); + ps.setLong(4, cp.getPostDate()); + ps.setInt(5, cp.getPostTopicId()); + ps.setInt(6, cp.getPostForumId()); + ps.setString(7, cp.getPostText()); ps.execute(); } catch (Exception e) @@ -109,7 +191,7 @@ public class Post return null; } - public void deleteme(Topic t) + public void deleteMe(Topic t) { PostBBSManager.getInstance().delPostByTopic(t); try (Connection con = DatabaseFactory.getConnection(); @@ -125,9 +207,6 @@ public class Post } } - /** - * @param t - */ private void load(Topic t) { try (Connection con = DatabaseFactory.getConnection(); @@ -140,13 +219,13 @@ public class Post while (rs.next()) { final CPost cp = new CPost(); - cp.postId = rs.getInt("post_id"); - cp.postOwner = rs.getString("post_owner_name"); - cp.postOwnerId = rs.getInt("post_ownerid"); - cp.postDate = rs.getLong("post_date"); - cp.postTopicId = rs.getInt("post_topic_id"); - cp.postForumId = rs.getInt("post_forum_id"); - cp.postTxt = rs.getString("post_txt"); + cp.setPostId(rs.getInt("post_id")); + cp.setPostOwner(rs.getString("post_owner_name")); + cp.setPostOwnerId(rs.getInt("post_ownerid")); + cp.setPostDate(rs.getLong("post_date")); + cp.setPostTopicId(rs.getInt("post_topic_id")); + cp.setPostForumId(rs.getInt("post_forum_id")); + cp.setPostText(rs.getString("post_txt")); _post.add(cp); } } @@ -157,19 +236,16 @@ public class Post } } - /** - * @param i - */ - public void updatetxt(int i) + public void updateText(int i) { try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?")) { final CPost cp = getCPost(i); - ps.setString(1, cp.postTxt); - ps.setInt(2, cp.postId); - ps.setInt(3, cp.postTopicId); - ps.setInt(4, cp.postForumId); + ps.setString(1, cp.getPostText()); + ps.setInt(2, cp.getPostId()); + ps.setInt(3, cp.getPostTopicId()); + ps.setInt(4, cp.getPostForumId()); ps.execute(); } catch (Exception e) diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index d4e5528d28..4f38524224 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -120,7 +120,7 @@ public class PostBBSManager extends BaseBBSManager { final String html = "

HOME > " + forum.getName() + " Form
&$413;" + topic.getName() + "
&$427;
  
"; send1001(html, player); - send1002(player, p.getCPost(0).postTxt, topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); + send1002(player, p.getCPost(0).getPostText(), topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); } private void showMemoPost(Topic topic, PlayerInstance player, Forum forum) @@ -128,10 +128,10 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); - String mes = p.getCPost(0).postTxt.replace(">", ">"); + String mes = p.getCPost(0).getPostText().replace(">", ">"); mes = mes.replace("<", "<"); - final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).postDate) + "

" + mes + "

   



"; + final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).getPostDate()) + "

" + mes + "

   



"; CommunityBoardHandler.separateAndSend(html, player); } @@ -165,8 +165,8 @@ public class PostBBSManager extends BaseBBSManager } else { - p.getCPost(idp).postTxt = ar4; - p.updatetxt(idp); + p.getCPost(idp).setPostText(ar4); + p.updateText(idp); parsecmd("_bbsposts;read;" + f.getID() + ";" + t.getID(), player); } } diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java index e213662279..3db3f0de91 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java @@ -115,7 +115,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); @@ -178,7 +178,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java index 5288eac3b4..4cd006629d 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java @@ -36,13 +36,95 @@ public class Post public static class CPost { - public int postId; - public String postOwner; - public int postOwnerId; - public long postDate; - public int postTopicId; - public int postForumId; - public String postTxt; + private int _postId; + private String _postOwner; + private int _postOwnerId; + private long _postDate; + private int _postTopicId; + private int _postForumId; + private String _postText; + + public void setPostId(int postId) + { + _postId = postId; + } + + public int getPostId() + { + return _postId; + } + + public void setPostOwner(String postOwner) + { + _postOwner = postOwner; + } + + public String getPostOwner() + { + return _postOwner; + } + + public void setPostOwnerId(int postOwnerId) + { + _postOwnerId = postOwnerId; + } + + public int getPostOwnerId() + { + return _postOwnerId; + } + + public void setPostDate(long postDate) + { + _postDate = postDate; + } + + public long getPostDate() + { + return _postDate; + } + + public void setPostTopicId(int postTopicId) + { + _postTopicId = postTopicId; + } + + public int getPostTopicId() + { + return _postTopicId; + } + + public void setPostForumId(int postForumId) + { + _postForumId = postForumId; + } + + public int getPostForumId() + { + return _postForumId; + } + + public void setPostText(String postText) + { + _postText = postText; + } + + public String getPostText() + { + if (_postText == null) + { + return ""; + } + + // Bypass exploit check. + final String text = _postText.toLowerCase(); + if (text.contains("action") && text.contains("bypass")) + { + return ""; + } + + return _postText; + } } private final Collection _post; @@ -59,13 +141,13 @@ public class Post { _post = ConcurrentHashMap.newKeySet(); final CPost cp = new CPost(); - cp.postId = 0; - cp.postOwner = postOwner; - cp.postOwnerId = postOwnerId; - cp.postDate = date; - cp.postTopicId = tid; - cp.postForumId = postForumId; - cp.postTxt = txt; + cp.setPostId(0); + cp.setPostOwner(postOwner); + cp.setPostOwnerId(postOwnerId); + cp.setPostDate(date); + cp.setPostTopicId(tid); + cp.setPostForumId(postForumId); + cp.setPostText(txt); _post.add(cp); insertindb(cp); } @@ -75,13 +157,13 @@ public class Post try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)")) { - ps.setInt(1, cp.postId); - ps.setString(2, cp.postOwner); - ps.setInt(3, cp.postOwnerId); - ps.setLong(4, cp.postDate); - ps.setInt(5, cp.postTopicId); - ps.setInt(6, cp.postForumId); - ps.setString(7, cp.postTxt); + ps.setInt(1, cp.getPostId()); + ps.setString(2, cp.getPostOwner()); + ps.setInt(3, cp.getPostOwnerId()); + ps.setLong(4, cp.getPostDate()); + ps.setInt(5, cp.getPostTopicId()); + ps.setInt(6, cp.getPostForumId()); + ps.setString(7, cp.getPostText()); ps.execute(); } catch (Exception e) @@ -109,7 +191,7 @@ public class Post return null; } - public void deleteme(Topic t) + public void deleteMe(Topic t) { PostBBSManager.getInstance().delPostByTopic(t); try (Connection con = DatabaseFactory.getConnection(); @@ -125,9 +207,6 @@ public class Post } } - /** - * @param t - */ private void load(Topic t) { try (Connection con = DatabaseFactory.getConnection(); @@ -140,13 +219,13 @@ public class Post while (rs.next()) { final CPost cp = new CPost(); - cp.postId = rs.getInt("post_id"); - cp.postOwner = rs.getString("post_owner_name"); - cp.postOwnerId = rs.getInt("post_ownerid"); - cp.postDate = rs.getLong("post_date"); - cp.postTopicId = rs.getInt("post_topic_id"); - cp.postForumId = rs.getInt("post_forum_id"); - cp.postTxt = rs.getString("post_txt"); + cp.setPostId(rs.getInt("post_id")); + cp.setPostOwner(rs.getString("post_owner_name")); + cp.setPostOwnerId(rs.getInt("post_ownerid")); + cp.setPostDate(rs.getLong("post_date")); + cp.setPostTopicId(rs.getInt("post_topic_id")); + cp.setPostForumId(rs.getInt("post_forum_id")); + cp.setPostText(rs.getString("post_txt")); _post.add(cp); } } @@ -157,19 +236,16 @@ public class Post } } - /** - * @param i - */ - public void updatetxt(int i) + public void updateText(int i) { try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?")) { final CPost cp = getCPost(i); - ps.setString(1, cp.postTxt); - ps.setInt(2, cp.postId); - ps.setInt(3, cp.postTopicId); - ps.setInt(4, cp.postForumId); + ps.setString(1, cp.getPostText()); + ps.setInt(2, cp.getPostId()); + ps.setInt(3, cp.getPostTopicId()); + ps.setInt(4, cp.getPostForumId()); ps.execute(); } catch (Exception e) diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index d4e5528d28..4f38524224 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -120,7 +120,7 @@ public class PostBBSManager extends BaseBBSManager { final String html = "

HOME > " + forum.getName() + " Form
&$413;" + topic.getName() + "
&$427;
  
"; send1001(html, player); - send1002(player, p.getCPost(0).postTxt, topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); + send1002(player, p.getCPost(0).getPostText(), topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); } private void showMemoPost(Topic topic, PlayerInstance player, Forum forum) @@ -128,10 +128,10 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); - String mes = p.getCPost(0).postTxt.replace(">", ">"); + String mes = p.getCPost(0).getPostText().replace(">", ">"); mes = mes.replace("<", "<"); - final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).postDate) + "

" + mes + "

   



"; + final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).getPostDate()) + "

" + mes + "

   



"; CommunityBoardHandler.separateAndSend(html, player); } @@ -165,8 +165,8 @@ public class PostBBSManager extends BaseBBSManager } else { - p.getCPost(idp).postTxt = ar4; - p.updatetxt(idp); + p.getCPost(idp).setPostText(ar4); + p.updateText(idp); parsecmd("_bbsposts;read;" + f.getID() + ";" + t.getID(), player); } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java index e213662279..3db3f0de91 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java @@ -115,7 +115,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); @@ -178,7 +178,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java index 5288eac3b4..4cd006629d 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java @@ -36,13 +36,95 @@ public class Post public static class CPost { - public int postId; - public String postOwner; - public int postOwnerId; - public long postDate; - public int postTopicId; - public int postForumId; - public String postTxt; + private int _postId; + private String _postOwner; + private int _postOwnerId; + private long _postDate; + private int _postTopicId; + private int _postForumId; + private String _postText; + + public void setPostId(int postId) + { + _postId = postId; + } + + public int getPostId() + { + return _postId; + } + + public void setPostOwner(String postOwner) + { + _postOwner = postOwner; + } + + public String getPostOwner() + { + return _postOwner; + } + + public void setPostOwnerId(int postOwnerId) + { + _postOwnerId = postOwnerId; + } + + public int getPostOwnerId() + { + return _postOwnerId; + } + + public void setPostDate(long postDate) + { + _postDate = postDate; + } + + public long getPostDate() + { + return _postDate; + } + + public void setPostTopicId(int postTopicId) + { + _postTopicId = postTopicId; + } + + public int getPostTopicId() + { + return _postTopicId; + } + + public void setPostForumId(int postForumId) + { + _postForumId = postForumId; + } + + public int getPostForumId() + { + return _postForumId; + } + + public void setPostText(String postText) + { + _postText = postText; + } + + public String getPostText() + { + if (_postText == null) + { + return ""; + } + + // Bypass exploit check. + final String text = _postText.toLowerCase(); + if (text.contains("action") && text.contains("bypass")) + { + return ""; + } + + return _postText; + } } private final Collection _post; @@ -59,13 +141,13 @@ public class Post { _post = ConcurrentHashMap.newKeySet(); final CPost cp = new CPost(); - cp.postId = 0; - cp.postOwner = postOwner; - cp.postOwnerId = postOwnerId; - cp.postDate = date; - cp.postTopicId = tid; - cp.postForumId = postForumId; - cp.postTxt = txt; + cp.setPostId(0); + cp.setPostOwner(postOwner); + cp.setPostOwnerId(postOwnerId); + cp.setPostDate(date); + cp.setPostTopicId(tid); + cp.setPostForumId(postForumId); + cp.setPostText(txt); _post.add(cp); insertindb(cp); } @@ -75,13 +157,13 @@ public class Post try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)")) { - ps.setInt(1, cp.postId); - ps.setString(2, cp.postOwner); - ps.setInt(3, cp.postOwnerId); - ps.setLong(4, cp.postDate); - ps.setInt(5, cp.postTopicId); - ps.setInt(6, cp.postForumId); - ps.setString(7, cp.postTxt); + ps.setInt(1, cp.getPostId()); + ps.setString(2, cp.getPostOwner()); + ps.setInt(3, cp.getPostOwnerId()); + ps.setLong(4, cp.getPostDate()); + ps.setInt(5, cp.getPostTopicId()); + ps.setInt(6, cp.getPostForumId()); + ps.setString(7, cp.getPostText()); ps.execute(); } catch (Exception e) @@ -109,7 +191,7 @@ public class Post return null; } - public void deleteme(Topic t) + public void deleteMe(Topic t) { PostBBSManager.getInstance().delPostByTopic(t); try (Connection con = DatabaseFactory.getConnection(); @@ -125,9 +207,6 @@ public class Post } } - /** - * @param t - */ private void load(Topic t) { try (Connection con = DatabaseFactory.getConnection(); @@ -140,13 +219,13 @@ public class Post while (rs.next()) { final CPost cp = new CPost(); - cp.postId = rs.getInt("post_id"); - cp.postOwner = rs.getString("post_owner_name"); - cp.postOwnerId = rs.getInt("post_ownerid"); - cp.postDate = rs.getLong("post_date"); - cp.postTopicId = rs.getInt("post_topic_id"); - cp.postForumId = rs.getInt("post_forum_id"); - cp.postTxt = rs.getString("post_txt"); + cp.setPostId(rs.getInt("post_id")); + cp.setPostOwner(rs.getString("post_owner_name")); + cp.setPostOwnerId(rs.getInt("post_ownerid")); + cp.setPostDate(rs.getLong("post_date")); + cp.setPostTopicId(rs.getInt("post_topic_id")); + cp.setPostForumId(rs.getInt("post_forum_id")); + cp.setPostText(rs.getString("post_txt")); _post.add(cp); } } @@ -157,19 +236,16 @@ public class Post } } - /** - * @param i - */ - public void updatetxt(int i) + public void updateText(int i) { try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?")) { final CPost cp = getCPost(i); - ps.setString(1, cp.postTxt); - ps.setInt(2, cp.postId); - ps.setInt(3, cp.postTopicId); - ps.setInt(4, cp.postForumId); + ps.setString(1, cp.getPostText()); + ps.setInt(2, cp.getPostId()); + ps.setInt(3, cp.getPostTopicId()); + ps.setInt(4, cp.getPostForumId()); ps.execute(); } catch (Exception e) diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index d4e5528d28..4f38524224 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -120,7 +120,7 @@ public class PostBBSManager extends BaseBBSManager { final String html = "

HOME > " + forum.getName() + " Form
&$413;" + topic.getName() + "
&$427;
  
"; send1001(html, player); - send1002(player, p.getCPost(0).postTxt, topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); + send1002(player, p.getCPost(0).getPostText(), topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); } private void showMemoPost(Topic topic, PlayerInstance player, Forum forum) @@ -128,10 +128,10 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); - String mes = p.getCPost(0).postTxt.replace(">", ">"); + String mes = p.getCPost(0).getPostText().replace(">", ">"); mes = mes.replace("<", "<"); - final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).postDate) + "

" + mes + "

   



"; + final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).getPostDate()) + "

" + mes + "

   



"; CommunityBoardHandler.separateAndSend(html, player); } @@ -165,8 +165,8 @@ public class PostBBSManager extends BaseBBSManager } else { - p.getCPost(idp).postTxt = ar4; - p.updatetxt(idp); + p.getCPost(idp).setPostText(ar4); + p.updateText(idp); parsecmd("_bbsposts;read;" + f.getID() + ";" + t.getID(), player); } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java index e213662279..3db3f0de91 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java @@ -115,7 +115,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); @@ -178,7 +178,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java index 5288eac3b4..4cd006629d 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java @@ -36,13 +36,95 @@ public class Post public static class CPost { - public int postId; - public String postOwner; - public int postOwnerId; - public long postDate; - public int postTopicId; - public int postForumId; - public String postTxt; + private int _postId; + private String _postOwner; + private int _postOwnerId; + private long _postDate; + private int _postTopicId; + private int _postForumId; + private String _postText; + + public void setPostId(int postId) + { + _postId = postId; + } + + public int getPostId() + { + return _postId; + } + + public void setPostOwner(String postOwner) + { + _postOwner = postOwner; + } + + public String getPostOwner() + { + return _postOwner; + } + + public void setPostOwnerId(int postOwnerId) + { + _postOwnerId = postOwnerId; + } + + public int getPostOwnerId() + { + return _postOwnerId; + } + + public void setPostDate(long postDate) + { + _postDate = postDate; + } + + public long getPostDate() + { + return _postDate; + } + + public void setPostTopicId(int postTopicId) + { + _postTopicId = postTopicId; + } + + public int getPostTopicId() + { + return _postTopicId; + } + + public void setPostForumId(int postForumId) + { + _postForumId = postForumId; + } + + public int getPostForumId() + { + return _postForumId; + } + + public void setPostText(String postText) + { + _postText = postText; + } + + public String getPostText() + { + if (_postText == null) + { + return ""; + } + + // Bypass exploit check. + final String text = _postText.toLowerCase(); + if (text.contains("action") && text.contains("bypass")) + { + return ""; + } + + return _postText; + } } private final Collection _post; @@ -59,13 +141,13 @@ public class Post { _post = ConcurrentHashMap.newKeySet(); final CPost cp = new CPost(); - cp.postId = 0; - cp.postOwner = postOwner; - cp.postOwnerId = postOwnerId; - cp.postDate = date; - cp.postTopicId = tid; - cp.postForumId = postForumId; - cp.postTxt = txt; + cp.setPostId(0); + cp.setPostOwner(postOwner); + cp.setPostOwnerId(postOwnerId); + cp.setPostDate(date); + cp.setPostTopicId(tid); + cp.setPostForumId(postForumId); + cp.setPostText(txt); _post.add(cp); insertindb(cp); } @@ -75,13 +157,13 @@ public class Post try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)")) { - ps.setInt(1, cp.postId); - ps.setString(2, cp.postOwner); - ps.setInt(3, cp.postOwnerId); - ps.setLong(4, cp.postDate); - ps.setInt(5, cp.postTopicId); - ps.setInt(6, cp.postForumId); - ps.setString(7, cp.postTxt); + ps.setInt(1, cp.getPostId()); + ps.setString(2, cp.getPostOwner()); + ps.setInt(3, cp.getPostOwnerId()); + ps.setLong(4, cp.getPostDate()); + ps.setInt(5, cp.getPostTopicId()); + ps.setInt(6, cp.getPostForumId()); + ps.setString(7, cp.getPostText()); ps.execute(); } catch (Exception e) @@ -109,7 +191,7 @@ public class Post return null; } - public void deleteme(Topic t) + public void deleteMe(Topic t) { PostBBSManager.getInstance().delPostByTopic(t); try (Connection con = DatabaseFactory.getConnection(); @@ -125,9 +207,6 @@ public class Post } } - /** - * @param t - */ private void load(Topic t) { try (Connection con = DatabaseFactory.getConnection(); @@ -140,13 +219,13 @@ public class Post while (rs.next()) { final CPost cp = new CPost(); - cp.postId = rs.getInt("post_id"); - cp.postOwner = rs.getString("post_owner_name"); - cp.postOwnerId = rs.getInt("post_ownerid"); - cp.postDate = rs.getLong("post_date"); - cp.postTopicId = rs.getInt("post_topic_id"); - cp.postForumId = rs.getInt("post_forum_id"); - cp.postTxt = rs.getString("post_txt"); + cp.setPostId(rs.getInt("post_id")); + cp.setPostOwner(rs.getString("post_owner_name")); + cp.setPostOwnerId(rs.getInt("post_ownerid")); + cp.setPostDate(rs.getLong("post_date")); + cp.setPostTopicId(rs.getInt("post_topic_id")); + cp.setPostForumId(rs.getInt("post_forum_id")); + cp.setPostText(rs.getString("post_txt")); _post.add(cp); } } @@ -157,19 +236,16 @@ public class Post } } - /** - * @param i - */ - public void updatetxt(int i) + public void updateText(int i) { try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?")) { final CPost cp = getCPost(i); - ps.setString(1, cp.postTxt); - ps.setInt(2, cp.postId); - ps.setInt(3, cp.postTopicId); - ps.setInt(4, cp.postForumId); + ps.setString(1, cp.getPostText()); + ps.setInt(2, cp.getPostId()); + ps.setInt(3, cp.getPostTopicId()); + ps.setInt(4, cp.getPostForumId()); ps.execute(); } catch (Exception e) diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index d4e5528d28..4f38524224 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -120,7 +120,7 @@ public class PostBBSManager extends BaseBBSManager { final String html = "

HOME > " + forum.getName() + " Form
&$413;" + topic.getName() + "
&$427;
  
"; send1001(html, player); - send1002(player, p.getCPost(0).postTxt, topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); + send1002(player, p.getCPost(0).getPostText(), topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); } private void showMemoPost(Topic topic, PlayerInstance player, Forum forum) @@ -128,10 +128,10 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); - String mes = p.getCPost(0).postTxt.replace(">", ">"); + String mes = p.getCPost(0).getPostText().replace(">", ">"); mes = mes.replace("<", "<"); - final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).postDate) + "

" + mes + "

   



"; + final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).getPostDate()) + "

" + mes + "

   



"; CommunityBoardHandler.separateAndSend(html, player); } @@ -165,8 +165,8 @@ public class PostBBSManager extends BaseBBSManager } else { - p.getCPost(idp).postTxt = ar4; - p.updatetxt(idp); + p.getCPost(idp).setPostText(ar4); + p.updateText(idp); parsecmd("_bbsposts;read;" + f.getID() + ";" + t.getID(), player); } } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java index e213662279..3db3f0de91 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java @@ -115,7 +115,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); @@ -178,7 +178,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java index 5288eac3b4..4cd006629d 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java @@ -36,13 +36,95 @@ public class Post public static class CPost { - public int postId; - public String postOwner; - public int postOwnerId; - public long postDate; - public int postTopicId; - public int postForumId; - public String postTxt; + private int _postId; + private String _postOwner; + private int _postOwnerId; + private long _postDate; + private int _postTopicId; + private int _postForumId; + private String _postText; + + public void setPostId(int postId) + { + _postId = postId; + } + + public int getPostId() + { + return _postId; + } + + public void setPostOwner(String postOwner) + { + _postOwner = postOwner; + } + + public String getPostOwner() + { + return _postOwner; + } + + public void setPostOwnerId(int postOwnerId) + { + _postOwnerId = postOwnerId; + } + + public int getPostOwnerId() + { + return _postOwnerId; + } + + public void setPostDate(long postDate) + { + _postDate = postDate; + } + + public long getPostDate() + { + return _postDate; + } + + public void setPostTopicId(int postTopicId) + { + _postTopicId = postTopicId; + } + + public int getPostTopicId() + { + return _postTopicId; + } + + public void setPostForumId(int postForumId) + { + _postForumId = postForumId; + } + + public int getPostForumId() + { + return _postForumId; + } + + public void setPostText(String postText) + { + _postText = postText; + } + + public String getPostText() + { + if (_postText == null) + { + return ""; + } + + // Bypass exploit check. + final String text = _postText.toLowerCase(); + if (text.contains("action") && text.contains("bypass")) + { + return ""; + } + + return _postText; + } } private final Collection _post; @@ -59,13 +141,13 @@ public class Post { _post = ConcurrentHashMap.newKeySet(); final CPost cp = new CPost(); - cp.postId = 0; - cp.postOwner = postOwner; - cp.postOwnerId = postOwnerId; - cp.postDate = date; - cp.postTopicId = tid; - cp.postForumId = postForumId; - cp.postTxt = txt; + cp.setPostId(0); + cp.setPostOwner(postOwner); + cp.setPostOwnerId(postOwnerId); + cp.setPostDate(date); + cp.setPostTopicId(tid); + cp.setPostForumId(postForumId); + cp.setPostText(txt); _post.add(cp); insertindb(cp); } @@ -75,13 +157,13 @@ public class Post try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)")) { - ps.setInt(1, cp.postId); - ps.setString(2, cp.postOwner); - ps.setInt(3, cp.postOwnerId); - ps.setLong(4, cp.postDate); - ps.setInt(5, cp.postTopicId); - ps.setInt(6, cp.postForumId); - ps.setString(7, cp.postTxt); + ps.setInt(1, cp.getPostId()); + ps.setString(2, cp.getPostOwner()); + ps.setInt(3, cp.getPostOwnerId()); + ps.setLong(4, cp.getPostDate()); + ps.setInt(5, cp.getPostTopicId()); + ps.setInt(6, cp.getPostForumId()); + ps.setString(7, cp.getPostText()); ps.execute(); } catch (Exception e) @@ -109,7 +191,7 @@ public class Post return null; } - public void deleteme(Topic t) + public void deleteMe(Topic t) { PostBBSManager.getInstance().delPostByTopic(t); try (Connection con = DatabaseFactory.getConnection(); @@ -125,9 +207,6 @@ public class Post } } - /** - * @param t - */ private void load(Topic t) { try (Connection con = DatabaseFactory.getConnection(); @@ -140,13 +219,13 @@ public class Post while (rs.next()) { final CPost cp = new CPost(); - cp.postId = rs.getInt("post_id"); - cp.postOwner = rs.getString("post_owner_name"); - cp.postOwnerId = rs.getInt("post_ownerid"); - cp.postDate = rs.getLong("post_date"); - cp.postTopicId = rs.getInt("post_topic_id"); - cp.postForumId = rs.getInt("post_forum_id"); - cp.postTxt = rs.getString("post_txt"); + cp.setPostId(rs.getInt("post_id")); + cp.setPostOwner(rs.getString("post_owner_name")); + cp.setPostOwnerId(rs.getInt("post_ownerid")); + cp.setPostDate(rs.getLong("post_date")); + cp.setPostTopicId(rs.getInt("post_topic_id")); + cp.setPostForumId(rs.getInt("post_forum_id")); + cp.setPostText(rs.getString("post_txt")); _post.add(cp); } } @@ -157,19 +236,16 @@ public class Post } } - /** - * @param i - */ - public void updatetxt(int i) + public void updateText(int i) { try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?")) { final CPost cp = getCPost(i); - ps.setString(1, cp.postTxt); - ps.setInt(2, cp.postId); - ps.setInt(3, cp.postTopicId); - ps.setInt(4, cp.postForumId); + ps.setString(1, cp.getPostText()); + ps.setInt(2, cp.getPostId()); + ps.setInt(3, cp.getPostTopicId()); + ps.setInt(4, cp.getPostForumId()); ps.execute(); } catch (Exception e) diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index d4e5528d28..4f38524224 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -120,7 +120,7 @@ public class PostBBSManager extends BaseBBSManager { final String html = "

HOME > " + forum.getName() + " Form
&$413;" + topic.getName() + "
&$427;
  
"; send1001(html, player); - send1002(player, p.getCPost(0).postTxt, topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); + send1002(player, p.getCPost(0).getPostText(), topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); } private void showMemoPost(Topic topic, PlayerInstance player, Forum forum) @@ -128,10 +128,10 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); - String mes = p.getCPost(0).postTxt.replace(">", ">"); + String mes = p.getCPost(0).getPostText().replace(">", ">"); mes = mes.replace("<", "<"); - final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).postDate) + "

" + mes + "

   



"; + final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).getPostDate()) + "

" + mes + "

   



"; CommunityBoardHandler.separateAndSend(html, player); } @@ -165,8 +165,8 @@ public class PostBBSManager extends BaseBBSManager } else { - p.getCPost(idp).postTxt = ar4; - p.updatetxt(idp); + p.getCPost(idp).setPostText(ar4); + p.updateText(idp); parsecmd("_bbsposts;read;" + f.getID() + ";" + t.getID(), player); } } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java index e213662279..3db3f0de91 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java @@ -115,7 +115,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); @@ -178,7 +178,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java index 5288eac3b4..4cd006629d 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java @@ -36,13 +36,95 @@ public class Post public static class CPost { - public int postId; - public String postOwner; - public int postOwnerId; - public long postDate; - public int postTopicId; - public int postForumId; - public String postTxt; + private int _postId; + private String _postOwner; + private int _postOwnerId; + private long _postDate; + private int _postTopicId; + private int _postForumId; + private String _postText; + + public void setPostId(int postId) + { + _postId = postId; + } + + public int getPostId() + { + return _postId; + } + + public void setPostOwner(String postOwner) + { + _postOwner = postOwner; + } + + public String getPostOwner() + { + return _postOwner; + } + + public void setPostOwnerId(int postOwnerId) + { + _postOwnerId = postOwnerId; + } + + public int getPostOwnerId() + { + return _postOwnerId; + } + + public void setPostDate(long postDate) + { + _postDate = postDate; + } + + public long getPostDate() + { + return _postDate; + } + + public void setPostTopicId(int postTopicId) + { + _postTopicId = postTopicId; + } + + public int getPostTopicId() + { + return _postTopicId; + } + + public void setPostForumId(int postForumId) + { + _postForumId = postForumId; + } + + public int getPostForumId() + { + return _postForumId; + } + + public void setPostText(String postText) + { + _postText = postText; + } + + public String getPostText() + { + if (_postText == null) + { + return ""; + } + + // Bypass exploit check. + final String text = _postText.toLowerCase(); + if (text.contains("action") && text.contains("bypass")) + { + return ""; + } + + return _postText; + } } private final Collection _post; @@ -59,13 +141,13 @@ public class Post { _post = ConcurrentHashMap.newKeySet(); final CPost cp = new CPost(); - cp.postId = 0; - cp.postOwner = postOwner; - cp.postOwnerId = postOwnerId; - cp.postDate = date; - cp.postTopicId = tid; - cp.postForumId = postForumId; - cp.postTxt = txt; + cp.setPostId(0); + cp.setPostOwner(postOwner); + cp.setPostOwnerId(postOwnerId); + cp.setPostDate(date); + cp.setPostTopicId(tid); + cp.setPostForumId(postForumId); + cp.setPostText(txt); _post.add(cp); insertindb(cp); } @@ -75,13 +157,13 @@ public class Post try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)")) { - ps.setInt(1, cp.postId); - ps.setString(2, cp.postOwner); - ps.setInt(3, cp.postOwnerId); - ps.setLong(4, cp.postDate); - ps.setInt(5, cp.postTopicId); - ps.setInt(6, cp.postForumId); - ps.setString(7, cp.postTxt); + ps.setInt(1, cp.getPostId()); + ps.setString(2, cp.getPostOwner()); + ps.setInt(3, cp.getPostOwnerId()); + ps.setLong(4, cp.getPostDate()); + ps.setInt(5, cp.getPostTopicId()); + ps.setInt(6, cp.getPostForumId()); + ps.setString(7, cp.getPostText()); ps.execute(); } catch (Exception e) @@ -109,7 +191,7 @@ public class Post return null; } - public void deleteme(Topic t) + public void deleteMe(Topic t) { PostBBSManager.getInstance().delPostByTopic(t); try (Connection con = DatabaseFactory.getConnection(); @@ -125,9 +207,6 @@ public class Post } } - /** - * @param t - */ private void load(Topic t) { try (Connection con = DatabaseFactory.getConnection(); @@ -140,13 +219,13 @@ public class Post while (rs.next()) { final CPost cp = new CPost(); - cp.postId = rs.getInt("post_id"); - cp.postOwner = rs.getString("post_owner_name"); - cp.postOwnerId = rs.getInt("post_ownerid"); - cp.postDate = rs.getLong("post_date"); - cp.postTopicId = rs.getInt("post_topic_id"); - cp.postForumId = rs.getInt("post_forum_id"); - cp.postTxt = rs.getString("post_txt"); + cp.setPostId(rs.getInt("post_id")); + cp.setPostOwner(rs.getString("post_owner_name")); + cp.setPostOwnerId(rs.getInt("post_ownerid")); + cp.setPostDate(rs.getLong("post_date")); + cp.setPostTopicId(rs.getInt("post_topic_id")); + cp.setPostForumId(rs.getInt("post_forum_id")); + cp.setPostText(rs.getString("post_txt")); _post.add(cp); } } @@ -157,19 +236,16 @@ public class Post } } - /** - * @param i - */ - public void updatetxt(int i) + public void updateText(int i) { try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?")) { final CPost cp = getCPost(i); - ps.setString(1, cp.postTxt); - ps.setInt(2, cp.postId); - ps.setInt(3, cp.postTopicId); - ps.setInt(4, cp.postForumId); + ps.setString(1, cp.getPostText()); + ps.setInt(2, cp.getPostId()); + ps.setInt(3, cp.getPostTopicId()); + ps.setInt(4, cp.getPostForumId()); ps.execute(); } catch (Exception e) diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index d4e5528d28..4f38524224 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -120,7 +120,7 @@ public class PostBBSManager extends BaseBBSManager { final String html = "

HOME > " + forum.getName() + " Form
&$413;" + topic.getName() + "
&$427;
  
"; send1001(html, player); - send1002(player, p.getCPost(0).postTxt, topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); + send1002(player, p.getCPost(0).getPostText(), topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); } private void showMemoPost(Topic topic, PlayerInstance player, Forum forum) @@ -128,10 +128,10 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); - String mes = p.getCPost(0).postTxt.replace(">", ">"); + String mes = p.getCPost(0).getPostText().replace(">", ">"); mes = mes.replace("<", "<"); - final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).postDate) + "

" + mes + "

   



"; + final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).getPostDate()) + "

" + mes + "

   



"; CommunityBoardHandler.separateAndSend(html, player); } @@ -165,8 +165,8 @@ public class PostBBSManager extends BaseBBSManager } else { - p.getCPost(idp).postTxt = ar4; - p.updatetxt(idp); + p.getCPost(idp).setPostText(ar4); + p.updateText(idp); parsecmd("_bbsposts;read;" + f.getID() + ";" + t.getID(), player); } } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java index e213662279..3db3f0de91 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java @@ -115,7 +115,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); @@ -178,7 +178,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java index 5288eac3b4..4cd006629d 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java @@ -36,13 +36,95 @@ public class Post public static class CPost { - public int postId; - public String postOwner; - public int postOwnerId; - public long postDate; - public int postTopicId; - public int postForumId; - public String postTxt; + private int _postId; + private String _postOwner; + private int _postOwnerId; + private long _postDate; + private int _postTopicId; + private int _postForumId; + private String _postText; + + public void setPostId(int postId) + { + _postId = postId; + } + + public int getPostId() + { + return _postId; + } + + public void setPostOwner(String postOwner) + { + _postOwner = postOwner; + } + + public String getPostOwner() + { + return _postOwner; + } + + public void setPostOwnerId(int postOwnerId) + { + _postOwnerId = postOwnerId; + } + + public int getPostOwnerId() + { + return _postOwnerId; + } + + public void setPostDate(long postDate) + { + _postDate = postDate; + } + + public long getPostDate() + { + return _postDate; + } + + public void setPostTopicId(int postTopicId) + { + _postTopicId = postTopicId; + } + + public int getPostTopicId() + { + return _postTopicId; + } + + public void setPostForumId(int postForumId) + { + _postForumId = postForumId; + } + + public int getPostForumId() + { + return _postForumId; + } + + public void setPostText(String postText) + { + _postText = postText; + } + + public String getPostText() + { + if (_postText == null) + { + return ""; + } + + // Bypass exploit check. + final String text = _postText.toLowerCase(); + if (text.contains("action") && text.contains("bypass")) + { + return ""; + } + + return _postText; + } } private final Collection _post; @@ -59,13 +141,13 @@ public class Post { _post = ConcurrentHashMap.newKeySet(); final CPost cp = new CPost(); - cp.postId = 0; - cp.postOwner = postOwner; - cp.postOwnerId = postOwnerId; - cp.postDate = date; - cp.postTopicId = tid; - cp.postForumId = postForumId; - cp.postTxt = txt; + cp.setPostId(0); + cp.setPostOwner(postOwner); + cp.setPostOwnerId(postOwnerId); + cp.setPostDate(date); + cp.setPostTopicId(tid); + cp.setPostForumId(postForumId); + cp.setPostText(txt); _post.add(cp); insertindb(cp); } @@ -75,13 +157,13 @@ public class Post try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)")) { - ps.setInt(1, cp.postId); - ps.setString(2, cp.postOwner); - ps.setInt(3, cp.postOwnerId); - ps.setLong(4, cp.postDate); - ps.setInt(5, cp.postTopicId); - ps.setInt(6, cp.postForumId); - ps.setString(7, cp.postTxt); + ps.setInt(1, cp.getPostId()); + ps.setString(2, cp.getPostOwner()); + ps.setInt(3, cp.getPostOwnerId()); + ps.setLong(4, cp.getPostDate()); + ps.setInt(5, cp.getPostTopicId()); + ps.setInt(6, cp.getPostForumId()); + ps.setString(7, cp.getPostText()); ps.execute(); } catch (Exception e) @@ -109,7 +191,7 @@ public class Post return null; } - public void deleteme(Topic t) + public void deleteMe(Topic t) { PostBBSManager.getInstance().delPostByTopic(t); try (Connection con = DatabaseFactory.getConnection(); @@ -125,9 +207,6 @@ public class Post } } - /** - * @param t - */ private void load(Topic t) { try (Connection con = DatabaseFactory.getConnection(); @@ -140,13 +219,13 @@ public class Post while (rs.next()) { final CPost cp = new CPost(); - cp.postId = rs.getInt("post_id"); - cp.postOwner = rs.getString("post_owner_name"); - cp.postOwnerId = rs.getInt("post_ownerid"); - cp.postDate = rs.getLong("post_date"); - cp.postTopicId = rs.getInt("post_topic_id"); - cp.postForumId = rs.getInt("post_forum_id"); - cp.postTxt = rs.getString("post_txt"); + cp.setPostId(rs.getInt("post_id")); + cp.setPostOwner(rs.getString("post_owner_name")); + cp.setPostOwnerId(rs.getInt("post_ownerid")); + cp.setPostDate(rs.getLong("post_date")); + cp.setPostTopicId(rs.getInt("post_topic_id")); + cp.setPostForumId(rs.getInt("post_forum_id")); + cp.setPostText(rs.getString("post_txt")); _post.add(cp); } } @@ -157,19 +236,16 @@ public class Post } } - /** - * @param i - */ - public void updatetxt(int i) + public void updateText(int i) { try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?")) { final CPost cp = getCPost(i); - ps.setString(1, cp.postTxt); - ps.setInt(2, cp.postId); - ps.setInt(3, cp.postTopicId); - ps.setInt(4, cp.postForumId); + ps.setString(1, cp.getPostText()); + ps.setInt(2, cp.getPostId()); + ps.setInt(3, cp.getPostTopicId()); + ps.setInt(4, cp.getPostForumId()); ps.execute(); } catch (Exception e) diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index d4e5528d28..4f38524224 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -120,7 +120,7 @@ public class PostBBSManager extends BaseBBSManager { final String html = "

HOME > " + forum.getName() + " Form
&$413;" + topic.getName() + "
&$427;
  
"; send1001(html, player); - send1002(player, p.getCPost(0).postTxt, topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); + send1002(player, p.getCPost(0).getPostText(), topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); } private void showMemoPost(Topic topic, PlayerInstance player, Forum forum) @@ -128,10 +128,10 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); - String mes = p.getCPost(0).postTxt.replace(">", ">"); + String mes = p.getCPost(0).getPostText().replace(">", ">"); mes = mes.replace("<", "<"); - final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).postDate) + "

" + mes + "

   



"; + final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).getPostDate()) + "

" + mes + "

   



"; CommunityBoardHandler.separateAndSend(html, player); } @@ -165,8 +165,8 @@ public class PostBBSManager extends BaseBBSManager } else { - p.getCPost(idp).postTxt = ar4; - p.updatetxt(idp); + p.getCPost(idp).setPostText(ar4); + p.updateText(idp); parsecmd("_bbsposts;read;" + f.getID() + ";" + t.getID(), player); } } diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java index e213662279..3db3f0de91 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java @@ -115,7 +115,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); @@ -178,7 +178,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java index 5288eac3b4..4cd006629d 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java @@ -36,13 +36,95 @@ public class Post public static class CPost { - public int postId; - public String postOwner; - public int postOwnerId; - public long postDate; - public int postTopicId; - public int postForumId; - public String postTxt; + private int _postId; + private String _postOwner; + private int _postOwnerId; + private long _postDate; + private int _postTopicId; + private int _postForumId; + private String _postText; + + public void setPostId(int postId) + { + _postId = postId; + } + + public int getPostId() + { + return _postId; + } + + public void setPostOwner(String postOwner) + { + _postOwner = postOwner; + } + + public String getPostOwner() + { + return _postOwner; + } + + public void setPostOwnerId(int postOwnerId) + { + _postOwnerId = postOwnerId; + } + + public int getPostOwnerId() + { + return _postOwnerId; + } + + public void setPostDate(long postDate) + { + _postDate = postDate; + } + + public long getPostDate() + { + return _postDate; + } + + public void setPostTopicId(int postTopicId) + { + _postTopicId = postTopicId; + } + + public int getPostTopicId() + { + return _postTopicId; + } + + public void setPostForumId(int postForumId) + { + _postForumId = postForumId; + } + + public int getPostForumId() + { + return _postForumId; + } + + public void setPostText(String postText) + { + _postText = postText; + } + + public String getPostText() + { + if (_postText == null) + { + return ""; + } + + // Bypass exploit check. + final String text = _postText.toLowerCase(); + if (text.contains("action") && text.contains("bypass")) + { + return ""; + } + + return _postText; + } } private final Collection _post; @@ -59,13 +141,13 @@ public class Post { _post = ConcurrentHashMap.newKeySet(); final CPost cp = new CPost(); - cp.postId = 0; - cp.postOwner = postOwner; - cp.postOwnerId = postOwnerId; - cp.postDate = date; - cp.postTopicId = tid; - cp.postForumId = postForumId; - cp.postTxt = txt; + cp.setPostId(0); + cp.setPostOwner(postOwner); + cp.setPostOwnerId(postOwnerId); + cp.setPostDate(date); + cp.setPostTopicId(tid); + cp.setPostForumId(postForumId); + cp.setPostText(txt); _post.add(cp); insertindb(cp); } @@ -75,13 +157,13 @@ public class Post try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)")) { - ps.setInt(1, cp.postId); - ps.setString(2, cp.postOwner); - ps.setInt(3, cp.postOwnerId); - ps.setLong(4, cp.postDate); - ps.setInt(5, cp.postTopicId); - ps.setInt(6, cp.postForumId); - ps.setString(7, cp.postTxt); + ps.setInt(1, cp.getPostId()); + ps.setString(2, cp.getPostOwner()); + ps.setInt(3, cp.getPostOwnerId()); + ps.setLong(4, cp.getPostDate()); + ps.setInt(5, cp.getPostTopicId()); + ps.setInt(6, cp.getPostForumId()); + ps.setString(7, cp.getPostText()); ps.execute(); } catch (Exception e) @@ -109,7 +191,7 @@ public class Post return null; } - public void deleteme(Topic t) + public void deleteMe(Topic t) { PostBBSManager.getInstance().delPostByTopic(t); try (Connection con = DatabaseFactory.getConnection(); @@ -125,9 +207,6 @@ public class Post } } - /** - * @param t - */ private void load(Topic t) { try (Connection con = DatabaseFactory.getConnection(); @@ -140,13 +219,13 @@ public class Post while (rs.next()) { final CPost cp = new CPost(); - cp.postId = rs.getInt("post_id"); - cp.postOwner = rs.getString("post_owner_name"); - cp.postOwnerId = rs.getInt("post_ownerid"); - cp.postDate = rs.getLong("post_date"); - cp.postTopicId = rs.getInt("post_topic_id"); - cp.postForumId = rs.getInt("post_forum_id"); - cp.postTxt = rs.getString("post_txt"); + cp.setPostId(rs.getInt("post_id")); + cp.setPostOwner(rs.getString("post_owner_name")); + cp.setPostOwnerId(rs.getInt("post_ownerid")); + cp.setPostDate(rs.getLong("post_date")); + cp.setPostTopicId(rs.getInt("post_topic_id")); + cp.setPostForumId(rs.getInt("post_forum_id")); + cp.setPostText(rs.getString("post_txt")); _post.add(cp); } } @@ -157,19 +236,16 @@ public class Post } } - /** - * @param i - */ - public void updatetxt(int i) + public void updateText(int i) { try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?")) { final CPost cp = getCPost(i); - ps.setString(1, cp.postTxt); - ps.setInt(2, cp.postId); - ps.setInt(3, cp.postTopicId); - ps.setInt(4, cp.postForumId); + ps.setString(1, cp.getPostText()); + ps.setInt(2, cp.getPostId()); + ps.setInt(3, cp.getPostTopicId()); + ps.setInt(4, cp.getPostForumId()); ps.execute(); } catch (Exception e) diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index d4e5528d28..4f38524224 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -120,7 +120,7 @@ public class PostBBSManager extends BaseBBSManager { final String html = "

HOME > " + forum.getName() + " Form
&$413;" + topic.getName() + "
&$427;
  
"; send1001(html, player); - send1002(player, p.getCPost(0).postTxt, topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); + send1002(player, p.getCPost(0).getPostText(), topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); } private void showMemoPost(Topic topic, PlayerInstance player, Forum forum) @@ -128,10 +128,10 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); - String mes = p.getCPost(0).postTxt.replace(">", ">"); + String mes = p.getCPost(0).getPostText().replace(">", ">"); mes = mes.replace("<", "<"); - final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).postDate) + "

" + mes + "

   



"; + final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).getPostDate()) + "

" + mes + "

   



"; CommunityBoardHandler.separateAndSend(html, player); } @@ -165,8 +165,8 @@ public class PostBBSManager extends BaseBBSManager } else { - p.getCPost(idp).postTxt = ar4; - p.updatetxt(idp); + p.getCPost(idp).setPostText(ar4); + p.updateText(idp); parsecmd("_bbsposts;read;" + f.getID() + ";" + t.getID(), player); } } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java index e213662279..3db3f0de91 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java @@ -115,7 +115,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); @@ -178,7 +178,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java index 5288eac3b4..4cd006629d 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java @@ -36,13 +36,95 @@ public class Post public static class CPost { - public int postId; - public String postOwner; - public int postOwnerId; - public long postDate; - public int postTopicId; - public int postForumId; - public String postTxt; + private int _postId; + private String _postOwner; + private int _postOwnerId; + private long _postDate; + private int _postTopicId; + private int _postForumId; + private String _postText; + + public void setPostId(int postId) + { + _postId = postId; + } + + public int getPostId() + { + return _postId; + } + + public void setPostOwner(String postOwner) + { + _postOwner = postOwner; + } + + public String getPostOwner() + { + return _postOwner; + } + + public void setPostOwnerId(int postOwnerId) + { + _postOwnerId = postOwnerId; + } + + public int getPostOwnerId() + { + return _postOwnerId; + } + + public void setPostDate(long postDate) + { + _postDate = postDate; + } + + public long getPostDate() + { + return _postDate; + } + + public void setPostTopicId(int postTopicId) + { + _postTopicId = postTopicId; + } + + public int getPostTopicId() + { + return _postTopicId; + } + + public void setPostForumId(int postForumId) + { + _postForumId = postForumId; + } + + public int getPostForumId() + { + return _postForumId; + } + + public void setPostText(String postText) + { + _postText = postText; + } + + public String getPostText() + { + if (_postText == null) + { + return ""; + } + + // Bypass exploit check. + final String text = _postText.toLowerCase(); + if (text.contains("action") && text.contains("bypass")) + { + return ""; + } + + return _postText; + } } private final Collection _post; @@ -59,13 +141,13 @@ public class Post { _post = ConcurrentHashMap.newKeySet(); final CPost cp = new CPost(); - cp.postId = 0; - cp.postOwner = postOwner; - cp.postOwnerId = postOwnerId; - cp.postDate = date; - cp.postTopicId = tid; - cp.postForumId = postForumId; - cp.postTxt = txt; + cp.setPostId(0); + cp.setPostOwner(postOwner); + cp.setPostOwnerId(postOwnerId); + cp.setPostDate(date); + cp.setPostTopicId(tid); + cp.setPostForumId(postForumId); + cp.setPostText(txt); _post.add(cp); insertindb(cp); } @@ -75,13 +157,13 @@ public class Post try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)")) { - ps.setInt(1, cp.postId); - ps.setString(2, cp.postOwner); - ps.setInt(3, cp.postOwnerId); - ps.setLong(4, cp.postDate); - ps.setInt(5, cp.postTopicId); - ps.setInt(6, cp.postForumId); - ps.setString(7, cp.postTxt); + ps.setInt(1, cp.getPostId()); + ps.setString(2, cp.getPostOwner()); + ps.setInt(3, cp.getPostOwnerId()); + ps.setLong(4, cp.getPostDate()); + ps.setInt(5, cp.getPostTopicId()); + ps.setInt(6, cp.getPostForumId()); + ps.setString(7, cp.getPostText()); ps.execute(); } catch (Exception e) @@ -109,7 +191,7 @@ public class Post return null; } - public void deleteme(Topic t) + public void deleteMe(Topic t) { PostBBSManager.getInstance().delPostByTopic(t); try (Connection con = DatabaseFactory.getConnection(); @@ -125,9 +207,6 @@ public class Post } } - /** - * @param t - */ private void load(Topic t) { try (Connection con = DatabaseFactory.getConnection(); @@ -140,13 +219,13 @@ public class Post while (rs.next()) { final CPost cp = new CPost(); - cp.postId = rs.getInt("post_id"); - cp.postOwner = rs.getString("post_owner_name"); - cp.postOwnerId = rs.getInt("post_ownerid"); - cp.postDate = rs.getLong("post_date"); - cp.postTopicId = rs.getInt("post_topic_id"); - cp.postForumId = rs.getInt("post_forum_id"); - cp.postTxt = rs.getString("post_txt"); + cp.setPostId(rs.getInt("post_id")); + cp.setPostOwner(rs.getString("post_owner_name")); + cp.setPostOwnerId(rs.getInt("post_ownerid")); + cp.setPostDate(rs.getLong("post_date")); + cp.setPostTopicId(rs.getInt("post_topic_id")); + cp.setPostForumId(rs.getInt("post_forum_id")); + cp.setPostText(rs.getString("post_txt")); _post.add(cp); } } @@ -157,19 +236,16 @@ public class Post } } - /** - * @param i - */ - public void updatetxt(int i) + public void updateText(int i) { try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?")) { final CPost cp = getCPost(i); - ps.setString(1, cp.postTxt); - ps.setInt(2, cp.postId); - ps.setInt(3, cp.postTopicId); - ps.setInt(4, cp.postForumId); + ps.setString(1, cp.getPostText()); + ps.setInt(2, cp.getPostId()); + ps.setInt(3, cp.getPostTopicId()); + ps.setInt(4, cp.getPostForumId()); ps.execute(); } catch (Exception e) diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index d4e5528d28..4f38524224 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -120,7 +120,7 @@ public class PostBBSManager extends BaseBBSManager { final String html = "

HOME > " + forum.getName() + " Form
&$413;" + topic.getName() + "
&$427;
  
"; send1001(html, player); - send1002(player, p.getCPost(0).postTxt, topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); + send1002(player, p.getCPost(0).getPostText(), topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); } private void showMemoPost(Topic topic, PlayerInstance player, Forum forum) @@ -128,10 +128,10 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); - String mes = p.getCPost(0).postTxt.replace(">", ">"); + String mes = p.getCPost(0).getPostText().replace(">", ">"); mes = mes.replace("<", "<"); - final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).postDate) + "

" + mes + "

   



"; + final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).getPostDate()) + "

" + mes + "

   



"; CommunityBoardHandler.separateAndSend(html, player); } @@ -165,8 +165,8 @@ public class PostBBSManager extends BaseBBSManager } else { - p.getCPost(idp).postTxt = ar4; - p.updatetxt(idp); + p.getCPost(idp).setPostText(ar4); + p.updateText(idp); parsecmd("_bbsposts;read;" + f.getID() + ";" + t.getID(), player); } } diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java index e213662279..3db3f0de91 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java @@ -115,7 +115,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); @@ -178,7 +178,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java index 5288eac3b4..4cd006629d 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java @@ -36,13 +36,95 @@ public class Post public static class CPost { - public int postId; - public String postOwner; - public int postOwnerId; - public long postDate; - public int postTopicId; - public int postForumId; - public String postTxt; + private int _postId; + private String _postOwner; + private int _postOwnerId; + private long _postDate; + private int _postTopicId; + private int _postForumId; + private String _postText; + + public void setPostId(int postId) + { + _postId = postId; + } + + public int getPostId() + { + return _postId; + } + + public void setPostOwner(String postOwner) + { + _postOwner = postOwner; + } + + public String getPostOwner() + { + return _postOwner; + } + + public void setPostOwnerId(int postOwnerId) + { + _postOwnerId = postOwnerId; + } + + public int getPostOwnerId() + { + return _postOwnerId; + } + + public void setPostDate(long postDate) + { + _postDate = postDate; + } + + public long getPostDate() + { + return _postDate; + } + + public void setPostTopicId(int postTopicId) + { + _postTopicId = postTopicId; + } + + public int getPostTopicId() + { + return _postTopicId; + } + + public void setPostForumId(int postForumId) + { + _postForumId = postForumId; + } + + public int getPostForumId() + { + return _postForumId; + } + + public void setPostText(String postText) + { + _postText = postText; + } + + public String getPostText() + { + if (_postText == null) + { + return ""; + } + + // Bypass exploit check. + final String text = _postText.toLowerCase(); + if (text.contains("action") && text.contains("bypass")) + { + return ""; + } + + return _postText; + } } private final Collection _post; @@ -59,13 +141,13 @@ public class Post { _post = ConcurrentHashMap.newKeySet(); final CPost cp = new CPost(); - cp.postId = 0; - cp.postOwner = postOwner; - cp.postOwnerId = postOwnerId; - cp.postDate = date; - cp.postTopicId = tid; - cp.postForumId = postForumId; - cp.postTxt = txt; + cp.setPostId(0); + cp.setPostOwner(postOwner); + cp.setPostOwnerId(postOwnerId); + cp.setPostDate(date); + cp.setPostTopicId(tid); + cp.setPostForumId(postForumId); + cp.setPostText(txt); _post.add(cp); insertindb(cp); } @@ -75,13 +157,13 @@ public class Post try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)")) { - ps.setInt(1, cp.postId); - ps.setString(2, cp.postOwner); - ps.setInt(3, cp.postOwnerId); - ps.setLong(4, cp.postDate); - ps.setInt(5, cp.postTopicId); - ps.setInt(6, cp.postForumId); - ps.setString(7, cp.postTxt); + ps.setInt(1, cp.getPostId()); + ps.setString(2, cp.getPostOwner()); + ps.setInt(3, cp.getPostOwnerId()); + ps.setLong(4, cp.getPostDate()); + ps.setInt(5, cp.getPostTopicId()); + ps.setInt(6, cp.getPostForumId()); + ps.setString(7, cp.getPostText()); ps.execute(); } catch (Exception e) @@ -109,7 +191,7 @@ public class Post return null; } - public void deleteme(Topic t) + public void deleteMe(Topic t) { PostBBSManager.getInstance().delPostByTopic(t); try (Connection con = DatabaseFactory.getConnection(); @@ -125,9 +207,6 @@ public class Post } } - /** - * @param t - */ private void load(Topic t) { try (Connection con = DatabaseFactory.getConnection(); @@ -140,13 +219,13 @@ public class Post while (rs.next()) { final CPost cp = new CPost(); - cp.postId = rs.getInt("post_id"); - cp.postOwner = rs.getString("post_owner_name"); - cp.postOwnerId = rs.getInt("post_ownerid"); - cp.postDate = rs.getLong("post_date"); - cp.postTopicId = rs.getInt("post_topic_id"); - cp.postForumId = rs.getInt("post_forum_id"); - cp.postTxt = rs.getString("post_txt"); + cp.setPostId(rs.getInt("post_id")); + cp.setPostOwner(rs.getString("post_owner_name")); + cp.setPostOwnerId(rs.getInt("post_ownerid")); + cp.setPostDate(rs.getLong("post_date")); + cp.setPostTopicId(rs.getInt("post_topic_id")); + cp.setPostForumId(rs.getInt("post_forum_id")); + cp.setPostText(rs.getString("post_txt")); _post.add(cp); } } @@ -157,19 +236,16 @@ public class Post } } - /** - * @param i - */ - public void updatetxt(int i) + public void updateText(int i) { try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?")) { final CPost cp = getCPost(i); - ps.setString(1, cp.postTxt); - ps.setInt(2, cp.postId); - ps.setInt(3, cp.postTopicId); - ps.setInt(4, cp.postForumId); + ps.setString(1, cp.getPostText()); + ps.setInt(2, cp.getPostId()); + ps.setInt(3, cp.getPostTopicId()); + ps.setInt(4, cp.getPostForumId()); ps.execute(); } catch (Exception e) diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index d4e5528d28..4f38524224 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -120,7 +120,7 @@ public class PostBBSManager extends BaseBBSManager { final String html = "

HOME > " + forum.getName() + " Form
&$413;" + topic.getName() + "
&$427;
  
"; send1001(html, player); - send1002(player, p.getCPost(0).postTxt, topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); + send1002(player, p.getCPost(0).getPostText(), topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); } private void showMemoPost(Topic topic, PlayerInstance player, Forum forum) @@ -128,10 +128,10 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); - String mes = p.getCPost(0).postTxt.replace(">", ">"); + String mes = p.getCPost(0).getPostText().replace(">", ">"); mes = mes.replace("<", "<"); - final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).postDate) + "

" + mes + "

   



"; + final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).getPostDate()) + "

" + mes + "

   



"; CommunityBoardHandler.separateAndSend(html, player); } @@ -165,8 +165,8 @@ public class PostBBSManager extends BaseBBSManager } else { - p.getCPost(idp).postTxt = ar4; - p.updatetxt(idp); + p.getCPost(idp).setPostText(ar4); + p.updateText(idp); parsecmd("_bbsposts;read;" + f.getID() + ";" + t.getID(), player); } } diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java index e213662279..3db3f0de91 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java @@ -115,7 +115,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); @@ -178,7 +178,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java index 5288eac3b4..4cd006629d 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/communitybbs/BB/Post.java @@ -36,13 +36,95 @@ public class Post public static class CPost { - public int postId; - public String postOwner; - public int postOwnerId; - public long postDate; - public int postTopicId; - public int postForumId; - public String postTxt; + private int _postId; + private String _postOwner; + private int _postOwnerId; + private long _postDate; + private int _postTopicId; + private int _postForumId; + private String _postText; + + public void setPostId(int postId) + { + _postId = postId; + } + + public int getPostId() + { + return _postId; + } + + public void setPostOwner(String postOwner) + { + _postOwner = postOwner; + } + + public String getPostOwner() + { + return _postOwner; + } + + public void setPostOwnerId(int postOwnerId) + { + _postOwnerId = postOwnerId; + } + + public int getPostOwnerId() + { + return _postOwnerId; + } + + public void setPostDate(long postDate) + { + _postDate = postDate; + } + + public long getPostDate() + { + return _postDate; + } + + public void setPostTopicId(int postTopicId) + { + _postTopicId = postTopicId; + } + + public int getPostTopicId() + { + return _postTopicId; + } + + public void setPostForumId(int postForumId) + { + _postForumId = postForumId; + } + + public int getPostForumId() + { + return _postForumId; + } + + public void setPostText(String postText) + { + _postText = postText; + } + + public String getPostText() + { + if (_postText == null) + { + return ""; + } + + // Bypass exploit check. + final String text = _postText.toLowerCase(); + if (text.contains("action") && text.contains("bypass")) + { + return ""; + } + + return _postText; + } } private final Collection _post; @@ -59,13 +141,13 @@ public class Post { _post = ConcurrentHashMap.newKeySet(); final CPost cp = new CPost(); - cp.postId = 0; - cp.postOwner = postOwner; - cp.postOwnerId = postOwnerId; - cp.postDate = date; - cp.postTopicId = tid; - cp.postForumId = postForumId; - cp.postTxt = txt; + cp.setPostId(0); + cp.setPostOwner(postOwner); + cp.setPostOwnerId(postOwnerId); + cp.setPostDate(date); + cp.setPostTopicId(tid); + cp.setPostForumId(postForumId); + cp.setPostText(txt); _post.add(cp); insertindb(cp); } @@ -75,13 +157,13 @@ public class Post try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)")) { - ps.setInt(1, cp.postId); - ps.setString(2, cp.postOwner); - ps.setInt(3, cp.postOwnerId); - ps.setLong(4, cp.postDate); - ps.setInt(5, cp.postTopicId); - ps.setInt(6, cp.postForumId); - ps.setString(7, cp.postTxt); + ps.setInt(1, cp.getPostId()); + ps.setString(2, cp.getPostOwner()); + ps.setInt(3, cp.getPostOwnerId()); + ps.setLong(4, cp.getPostDate()); + ps.setInt(5, cp.getPostTopicId()); + ps.setInt(6, cp.getPostForumId()); + ps.setString(7, cp.getPostText()); ps.execute(); } catch (Exception e) @@ -109,7 +191,7 @@ public class Post return null; } - public void deleteme(Topic t) + public void deleteMe(Topic t) { PostBBSManager.getInstance().delPostByTopic(t); try (Connection con = DatabaseFactory.getConnection(); @@ -125,9 +207,6 @@ public class Post } } - /** - * @param t - */ private void load(Topic t) { try (Connection con = DatabaseFactory.getConnection(); @@ -140,13 +219,13 @@ public class Post while (rs.next()) { final CPost cp = new CPost(); - cp.postId = rs.getInt("post_id"); - cp.postOwner = rs.getString("post_owner_name"); - cp.postOwnerId = rs.getInt("post_ownerid"); - cp.postDate = rs.getLong("post_date"); - cp.postTopicId = rs.getInt("post_topic_id"); - cp.postForumId = rs.getInt("post_forum_id"); - cp.postTxt = rs.getString("post_txt"); + cp.setPostId(rs.getInt("post_id")); + cp.setPostOwner(rs.getString("post_owner_name")); + cp.setPostOwnerId(rs.getInt("post_ownerid")); + cp.setPostDate(rs.getLong("post_date")); + cp.setPostTopicId(rs.getInt("post_topic_id")); + cp.setPostForumId(rs.getInt("post_forum_id")); + cp.setPostText(rs.getString("post_txt")); _post.add(cp); } } @@ -157,19 +236,16 @@ public class Post } } - /** - * @param i - */ - public void updatetxt(int i) + public void updateText(int i) { try (Connection con = DatabaseFactory.getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?")) { final CPost cp = getCPost(i); - ps.setString(1, cp.postTxt); - ps.setInt(2, cp.postId); - ps.setInt(3, cp.postTopicId); - ps.setInt(4, cp.postForumId); + ps.setString(1, cp.getPostText()); + ps.setInt(2, cp.getPostId()); + ps.setInt(3, cp.getPostTopicId()); + ps.setInt(4, cp.getPostForumId()); ps.execute(); } catch (Exception e) diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index d4e5528d28..4f38524224 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -120,7 +120,7 @@ public class PostBBSManager extends BaseBBSManager { final String html = "

HOME > " + forum.getName() + " Form
&$413;" + topic.getName() + "
&$427;
  
"; send1001(html, player); - send1002(player, p.getCPost(0).postTxt, topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); + send1002(player, p.getCPost(0).getPostText(), topic.getName(), DateFormat.getInstance().format(new Date(topic.getDate()))); } private void showMemoPost(Topic topic, PlayerInstance player, Forum forum) @@ -128,10 +128,10 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); - String mes = p.getCPost(0).postTxt.replace(">", ">"); + String mes = p.getCPost(0).getPostText().replace(">", ">"); mes = mes.replace("<", "<"); - final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).postDate) + "

" + mes + "

   



"; + final String html = "

HOME > Memo Form
&$413; :  " + topic.getName() + "
&$417; :  " + topic.getOwnerName() + "&$418; :" + dateFormat.format(p.getCPost(0).getPostDate()) + "

" + mes + "

   



"; CommunityBoardHandler.separateAndSend(html, player); } @@ -165,8 +165,8 @@ public class PostBBSManager extends BaseBBSManager } else { - p.getCPost(idp).postTxt = ar4; - p.updatetxt(idp); + p.getCPost(idp).setPostText(ar4); + p.updateText(idp); parsecmd("_bbsposts;read;" + f.getID() + ";" + t.getID(), player); } } diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java index e213662279..3db3f0de91 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java @@ -115,7 +115,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player); @@ -178,7 +178,7 @@ public class TopicBBSManager extends BaseBBSManager final Post p = PostBBSManager.getInstance().getGPosttByTopic(t); if (p != null) { - p.deleteme(t); + p.deleteMe(t); } t.deleteme(f); parsecmd("_bbsmemo", player);