📄 topicadminaction.java
字号:
String reasonpm = ((Map<String,String>)request.getAttribute("usergroups")).get("reasonpm");
Forums currentforum = forumService.findById(Short.valueOf(fid));
String modreasons = settingService.findBySettingvariable("modreasons").getValue();
Map transfersMap = new HashMap();
transfersMap.put("currentThread", currentThread);
transfersMap.put("currentforum", currentforum);
transfersMap.put("postsList", postsList_validateBeing);
transfersMap.put("operation", "split");
transfersMap.put("reasonpm", reasonpm);
transfersMap.put("modreasons", modreasons);
transfersMap.put("timeoffset", session.getAttribute("timeoffset"));
TopicSplitVO topicSplitVO = topicAdminActionService.geTopicSplitVO(transfersMap);
request.setAttribute("valueObject", topicSplitVO);
return mapping.findForward("goTopicadmin_split");
}
public ActionForward splitOperating(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response){
String fid = request.getParameter("fid");
HttpSession session = request.getSession();
Members member = (Members)session.getAttribute("user");
if(!Common.ismoderator(Short.valueOf(fid), member)){
request.setAttribute("errorInfo", "错误的操作.");
return mapping.findForward("showMessage");
}
String tid = request.getParameter("tid");
String[] pidArray = request.getParameterValues("split_pid");
String subject = request.getParameter("subject");
String sendreasonpm = request.getParameter("sendreasonpm");
String reason = request.getParameter("reason");
if(tid==null||fid==null){
request.setAttribute("errorInfo", "请确保正常操作");
return mapping.findForward("showMessage");
}
if(subject==null||subject.trim().equals("")){
request.setAttribute("errorInfo", "请正确填写主题名称。");
return mapping.findForward("showMessage");
}
Threads passiveThread = threadsService.findByTid(Integer.valueOf(tid));
if(passiveThread==null||passiveThread.getDisplayorder()<0){
request.setAttribute("errorInfo", "对不起,该主题已经被删除。");
return mapping.findForward("showMessage");
}
if(pidArray==null||pidArray.length==0){
request.setAttribute("errorInfo", "您没有选择要分割入新主题的帖子,请返回修改。");
return mapping.findForward("showMessage");
}
List<Integer> pidList = new ArrayList<Integer>();
for(int i = 0;i<pidArray.length;i++){
pidList.add(Integer.valueOf(pidArray[i]));
}
List<Posts> postsList = postsService.getPostsListByPidList(pidList);
for(int i = 0;i<postsList.size();i++){
if(postsList.get(i)==null){
request.setAttribute("errorInfo", "存在被删除的准备被分割进新主题的回帖。请返回刷新后再试!");
return mapping.findForward("showMessage");
}
}
String realPath = servlet.getServletContext().getRealPath("/");
String url = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath();
String IP = request.getRemoteAddr();
Members currentMember = (Members)request.getSession().getAttribute("user");
Map<String,Object> transfersMap = new HashMap<String, Object>();
transfersMap.put("fid", fid);
transfersMap.put("passiveThread",passiveThread );
transfersMap.put("postsList", postsList);
transfersMap.put("subject", subject);
transfersMap.put("timeoffset", session.getAttribute("timeoffset"));
transfersMap.put("sendreasonpm", sendreasonpm);
transfersMap.put("reason", reason);
transfersMap.put("realPath",realPath);
transfersMap.put("IP", IP);
transfersMap.put("url", url);
transfersMap.put("currentMember", currentMember);
transfersMap.put("settingMap", (Map<String,String>)request.getAttribute("settings"));
String result = topicAdminActionService.operatingSplit(transfersMap);
if(result!=null){
request.setAttribute("errorInfo", result);
return mapping.findForward("showMessage");
}
if(Common.isshowsuccess(request.getSession(), "admin_succeed")){
Common.requestforward(response, "forumdisplay.jsp?fid="+fid);
return null;
}else{
request.setAttribute("successInfo", "管理操作成功,现在将返回论坛。");
request.setAttribute("requestPath", "forumdisplay.jsp?fid="+fid);
return mapping.findForward("showMessage");
}
}
public ActionForward deletePost(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
boolean allowDeletePosts = allowDeletePosts(request);
if(!allowDeletePosts){
request.setAttribute("errorInfo", "对不起,您没有该权限");
return mapping.findForward("showMessage");
}
String fid = request.getParameter("fid");
String currentPage = request.getParameter("page");
String threadPage = request.getParameter("threadpage");
String[] topiclist = request.getParameterValues("topiclist[]");
String moderates = request.getParameter("moderates");
if(moderates==null){
request.setAttribute("errorInfo", "请确保正常操作");
return mapping.findForward("showMessage");
}
if(topiclist==null){
request.setAttribute("errorInfo", "对不起,您没有选择要进行操作的回帖,请返回修改。");
return mapping.findForward("showMessage");
}
Threads threads = threadsService.findByTid(Integer.valueOf(moderates));
if(threads==null||threads.getDisplayorder()<0){
request.setAttribute("errorInfo", "对不起,该主题已经被删除。");
return mapping.findForward("showMessage");
}
List<Integer> pidList = new ArrayList<Integer>();
for(int i = 0;i<topiclist.length;i++){
pidList.add(Integer.valueOf(topiclist[i]));
}
List<Posts> postsList = postsService.getPostsListByPidList(pidList);
for(int i = 0;i<postsList.size();i++){
if(postsList.get(i)==null){
request.setAttribute("errorInfo", "对不起,您所操作的帖子中存在被删除的选项,请返回刷新后重试!");
return mapping.findForward("showMessage");
}
}
String pid = postsService.findPostByThreadId(Integer.valueOf(moderates)).getPid().toString();
for(int i = 0;i<topiclist.length;i++){
if(topiclist[i].equals(pid)){
return moderate(mapping, form, request, response);
}
}
String reasonpm = ((Map<String,String>)request.getAttribute("usergroups")).get("reasonpm");
Forums currentForums = forumService.findById(Short.valueOf(fid));
String modreasons = settingService.findBySettingvariable("modreasons").getValue();
Map transfersMap = new HashMap();
transfersMap.put("currentPage", currentPage);
transfersMap.put("threadPage", threadPage);
transfersMap.put("currentThread", threads);
transfersMap.put("currentForum", currentForums);
transfersMap.put("pidArray", topiclist);
transfersMap.put("operation", "delpost");
transfersMap.put("reasonpm", reasonpm);
transfersMap.put("modreasons", modreasons);
transfersMap.put("timeoffset", request.getSession().getAttribute("timeoffset"));
OtherBaseVO otherBaseVO = topicAdminActionService.getValueObject(transfersMap);
request.setAttribute("valueObject", otherBaseVO);
return mapping.findForward("goTopicadmin_delpost");
}
public ActionForward deletePostOperating(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response){
boolean allowDeletePosts = allowDeletePosts(request);
if(!allowDeletePosts){
request.setAttribute("errorInfo", "对不起,您没有该权限");
return mapping.findForward("showMessage");
}
String tid = request.getParameter("tid");
String currentPage = request.getParameter("currentPage");
String threadPage = request.getParameter("threadPage");
threadPage = Common.encode("page="+threadPage);
String[] postIdArray = request.getParameterValues("postIdArray");
String sendreasonpm = request.getParameter("sendreasonpm");
String reason = request.getParameter("reason");
if(tid==null){
request.setAttribute("errorInfo", "请确保正常操作");
return mapping.findForward("showMessage");
}
if(postIdArray==null){
request.setAttribute("errorInfo", "对不起,您没有选择要进行操作的回帖,请返回修改。");
return mapping.findForward("showMessage");
}
Threads threads = threadsService.findByTid(Integer.valueOf(tid));
if(threads==null||threads.getDisplayorder()<0){
request.setAttribute("errorInfo", "对不起,该主题已经被删除。");
return mapping.findForward("showMessage");
}
List<Integer> pidList = new ArrayList<Integer>();
for(int i = 0;i<postIdArray.length;i++){
pidList.add(Integer.valueOf(postIdArray[i]));
}
List<Posts> postsList = postsService.getPostsListByPidList(pidList);
for(int i = 0;i<postsList.size();i++){
if(postsList.get(i)==null){
request.setAttribute("errorInfo", "对不起,您所操作的帖子中存在被删除的选项,请返回刷新后重试!");
return mapping.findForward("showMessage");
}
}
String pid = postsService.findPostByThreadId(Integer.valueOf(tid)).getPid().toString();
for(int i = 0;i<postIdArray.length;i++){
if(postIdArray[i].equals(pid)){
return moderate(mapping, form, request, response);
}
}
HttpSession session = request.getSession();
Members members = (Members)session.getAttribute("user");
if(members==null){
try{
throw new Exception();
}catch(Exception exception){
exception.printStackTrace();
request.setAttribute("errorInfo", "错误01,请稍后在试。");
return mapping.findForward("showMessage");
}
}
String realPath = servlet.getServletContext().getRealPath("/");
String IP = request.getRemoteAddr();
String url = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath();
Map<String,String> settingMap = ((Map<String,String>)request.getAttribute("settings"));
String losslessdel = settingMap.get("losslessdel");
String creditsformula = settingMap.get("creditsformula");
String creditspolicy = settingMap.get("creditspolicy");
String attachurl = settingMap.get("attachurl");
String attachurl_realy = getAttachmentRealyPath(attachurl, url);
Map<String,Object> parameterMap = new HashMap<String, Object>();
parameterMap.put("losslessdel", losslessdel);
parameterMap.put("threads", threads);
parameterMap.put("postIdArray", postIdArray);
parameterMap.put("members", members);
parameterMap.put("fid", threads.getFid());
parameterMap.put("sendreasonpm", sendreasonpm);
parameterMap.put("reason", reason);
parameterMap.put("adminId", members.getAdminid());
parameterMap.put("uid", members.getUid());
parameterMap.put("username", members.getUsername());
parameterMap.put("groupId", members.getGroupid());
parameterMap.put("url", url);
parameterMap.put("timeoffset", session.getAttribute("timeoffset"));
parameterMap.put("realPath",realPath);
parameterMap.put("IP", IP);
parameterMap.put("creditsformula", creditsformula);
parameterMap.put("creditspolicy", creditspolicy);
parameterMap.put("attachurl_realy", attachurl_realy);
parameterMap.put("settingMap", (Map<String,String>)request.getAttribute("settings"));
String result = topicAdminActionService.operatingDelPost(parameterMap);
if(result!=null){
request.setAttribute("errorInfo", result);
return mapping.findForward("showMessage");
}
if(Common.isshowsuccess(request.getSession(), "admin_succeed")){
Common.requestforward(response, "viewthread.jsp?tid="+tid+"&page="+currentPage+"&extra="+threadPage);
return null;
}else{
request.setAttribute("successInfo", "管理操作成功,现在将返回论坛。");
request.setAttribute("requestPath", "viewthread.jsp?tid="+tid+"&page="+currentPage+"&extra="+threadPage);
return mapping.findForward("showMessage");
}
}
public ActionForward banPost(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response){
boolean allowBanpost = allowBanpost(request);
if(!allowBanpost){
request.setAttribute("errorInfo", "对不起,您没有该权限");
return mapping.findForward("showMessage");
}
String fid = request.getParameter("fid");
String currentPage = request.getParameter("page");
String threadPage = request.getParameter("threadpage");
String[] topiclist = request.getParameterValues("topiclist[]");
String moderates = request.getParameter("moderates");
if(moderates==null){
request.setAttribute("errorInfo", "请确保正常操作");
return mapping.findForward("showMessage");
}
if(topiclist==null){
request.setAttribute("errorInfo", "对不起,您没有选择要进行操作的回帖,请返回修改。");
return mapping.findForward("showMessage");
}
Threads threads = threadsService.findByTid(Integer.valueOf(moderates));
if(threads==null||threads.getDisplayorder()<0){
request.setAttribute("errorInfo", "对不起,该主题已经被删除。");
return mapping.findForward("showMessage");
}
List<Integer> pidList = new ArrayList<Integer>();
for(int i = 0;i<topiclist.length;i++){
pidList.add(Integer.valueOf(topiclist[i]));
}
List<Posts> postsList = postsService.getPostsListByPidList(pidList);
for(int i = 0;i<postsList.size();i++){
if(postsList.get(i)==null){
request.setAttribute("errorInfo", "对不起,您所操作的帖子中存在被删除的选项,请返回刷新后重试!");
return mapping.findForward("showMessage");
}
}
String reasonpm = ((Map<String,String>)request.getAttribute("usergroups")).get("reasonpm");
Forums currentForum = forumService.findById(Short.valueOf(fid));
String modreasons = settingService.findBySettingvariable("modreasons").getValue();
Map transfersMap = new HashMap();
transfersMap.put("currentThread", threads);
transfersMap.put("currentForum", currentForum);
transfersMap.put("currentPage", currentPage);
transfersMap.put("threadPage", threadPage);
transfersMap.put("pidArray", topiclist);
transfersMap.put("operation", "banpost");
transfersMap.put("reasonpm", reasonpm);
transfersMap.put("modreasons", modreasons);
transfersMap.put("timeoffset", request.getSession().getAttribute("timeoffset"));
OtherBaseVO otherBaseVO = topicAdminActionService.getValueObject(transfersMap);
request.setAttribute("valueObject", otherBaseVO);
return mapping.findForward("goTopicadmin_banpost");
}
public ActionForward banPostOperating(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response){
boolean allowBanpost = allowBanpost(request);
if(!allowBanpost){
request.setAttribute("errorInfo", "对不起,您没有该权限");
return mapping.findForward("showMessage");
}
String tid = request.getParameter("tid");
String currentPage = request.getParameter("currentPage");
String threadPage = request.getParameter("threadPage");
threadPage = Common.encode("page="+threadPage);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -