String page = st.nextToken();
html = HtmCache.getInstance().getNotNull("scripts/services/community/bbs_memo_edit.htm", player);
html = html.replace("%page%", page);
html = html.replace("%memo_id%", "0");
html = html.replace("%TREE%", " > Create a record?");
player.sendPacket(new ShowBoard(html, "1001", player));
List<String> args = new ArrayList<>();
args.add("0");
args.add("0");
args.add("0");
args.add("0");
args.add("0");
args.add("0");
args.add("");
args.add("0");
args.add("");
args.add("0");
args.add("");
args.add("");
args.add("");
args.add("1970-01-01 00:00:00 ");
args.add("1970-01-01 00:00:00 ");
args.add("0");
args.add("0");
args.add("");
player.sendPacket(new ShowBoard(args));
return;
}
else if ("mmread".equals(cmd))
{
int memoId = Integer.parseInt(st.nextToken());
String page = st.nextToken();
Connection con = null;
PreparedStatement statement = null;
ResultSet rset = null;
try
{
con = DatabaseFactory.getInstance().getConnection();
statement = con.prepareStatement("SELECT * FROM `bbs_memo` WHERE `account_name` = ? and memo_id = ?");
statement.setString(1, player.getAccountName());
statement.setInt(2, memoId);
rset = statement.executeQuery();
if (rset.next())
{
String post = HtmCache.getInstance().getNotNull("scripts/services/community/bbs_memo_read.htm", player);
post = post.replace("%title%", rset.getString("title"));
post = post.replace("%char_name%", rset.getString("char_name"));
post = post.replace("%post_date%", String.format("%1$tY-%1$tm-%1$te %1$tH:%1tM:%1$tS", new Date(rset.getInt("post_date") * 1000L)));
post = post.replace("%memo%", rset.getString("memo").replace("\n", "<br1>"));
post = post.replace("%page%", page);
post = post.replace("%memo_id%", String.valueOf(memoId));
ShowBoard.separateAndSend(post, player);
return;
}
}
catch (Exception e)
{
}
finally
{
DbUtils.closeQuietly(con, statement, rset);
}
onBypassCommand(player, "_bbsmemo");
return;
}
else if ("mmdele".equals(cmd))
{
int memoId = Integer.parseInt(st.nextToken());
Connection con = null;
PreparedStatement statement = null;
try
{
con = DatabaseFactory.getInstance().getConnection();
statement = con.prepareStatement("DELETE FROM `bbs_memo` WHERE `account_name` = ? and memo_id = ?");
statement.setString(1, player.getAccountName());
statement.setInt(2, memoId);
statement.execute();
}
catch (Exception e)
{
}
finally
{
DbUtils.closeQuietly(con, statement);
}
onBypassCommand(player, "_mmlist_1");
return;
}
else if ("mmmodi".equals(cmd))
{
int memoId = Integer.parseInt(st.nextToken());
String page = st.nextToken();
Connection con = null;
PreparedStatement statement = null;
ResultSet rset = null;
try
{
con = DatabaseFactory.getInstance().getConnection();
statement = con.prepareStatement("SELECT * FROM `bbs_memo` WHERE `account_name` = ? and memo_id = ?");
statement.setString(1, player.getAccountName());
statement.setInt(2, memoId);
rset = statement.executeQuery();
if (rset.next())
{
html = HtmCache.getInstance().getNotNull("scripts/services/community/bbs_memo_edit.htm", player);
html = html.replace("%page%", page);
html = html.replace("%memo_id%", String.valueOf(memoId));
html = html.replace("%TREE%", " > <a action=\"bypass _mmread_" + memoId + "_" + page + "\">Note: " + rset.getString("title") + "</a> > Editing");
player.sendPacket(new ShowBoard(html, "1001", player));
List<String> args = new ArrayList<>();
args.add("0");
args.add("0");
args.add(String.valueOf(memoId));
args.add("0");
args.add("0");
args.add("0");
args.add(player.getName());
args.add("0");
args.add(player.getAccountName());
args.add("0");
args.add(rset.getString("title"));
args.add(rset.getString("title"));
args.add(rset.getString("memo"));
args.add(String.format("%1$tY-%1$tm-%1$te %1$tH:%1tM:%1$tS", new Date(rset.getInt("post_date") * 1000L)));
args.add(String.format("%1$tY-%1$tm-%1$te %1$tH:%1tM:%1$tS", new Date(rset.getInt("post_date") * 1000L)));
args.add("0");
args.add("0");
args.add("");
player.sendPacket(new ShowBoard(args));
return;
}
}
catch (Exception e)
{