TopBoard.java 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package com.l2jserver.communityserver.communityboard.boards;
  16. import java.util.StringTokenizer;
  17. import com.l2jserver.communityserver.cache.HtmCache;
  18. import com.l2jserver.communityserver.communityboard.CommunityBoard;
  19. import com.l2jserver.communityserver.communityboard.CommunityBoardManager;
  20. public class TopBoard extends CommunityBoard
  21. {
  22. public TopBoard(final CommunityBoardManager mgr)
  23. {
  24. super(mgr);
  25. }
  26. @Override
  27. public final void parseCmd(final int playerObjId, final String cmd)
  28. {
  29. String file = "";
  30. String content = "";
  31. if (cmd.equalsIgnoreCase("_bbshome"))
  32. file = "index.htm";
  33. else if (cmd.startsWith("_bbshome;"))
  34. {
  35. StringTokenizer st = new StringTokenizer(cmd, ";");
  36. st.nextToken();
  37. file = st.nextToken();
  38. }
  39. if (file.isEmpty())
  40. content = "<html><body><br><br><center>Error: no file name </center></body></html>";
  41. else
  42. content = HtmCache.getInstance().getHtm(this.getCommunityBoardManager().getSQLDPId(),"html/" + file);
  43. if (content == null)
  44. content = "<html><body><br><br><center>404 :File Not foud: '" + file + "' </center></body></html>";
  45. super.send(playerObjId, content);
  46. }
  47. @Override
  48. public final void parseWrite(final int playerObjId, final String ar1, final String ar2, final String ar3, final String ar4, final String ar5)
  49. {
  50. }
  51. }