package cn.jsprun.struts.foreg.actions;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.lang.StringUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
import org.apache.struts.upload.FormFile;
import cn.jsprun.domain.Attachments;
import cn.jsprun.domain.Forumfields;
import cn.jsprun.domain.Forums;
import cn.jsprun.domain.Members;
import cn.jsprun.domain.Polloptions;
import cn.jsprun.domain.Polls;
import cn.jsprun.domain.Posts;
import cn.jsprun.domain.Threads;
import cn.jsprun.foreg.service.PolloptionsService;
import cn.jsprun.foreg.service.PollsService;
import cn.jsprun.foreg.utils.CookieUtil;
import cn.jsprun.foreg.utils.Jspruncode;
import cn.jsprun.page.LogPage;
import cn.jsprun.service.forumsedit.ForumService;
import cn.jsprun.service.forumsedit.ForumfieldService;
import cn.jsprun.service.posts.PostsService;
import cn.jsprun.service.posts.ThreadsService;
import cn.jsprun.service.system.DataBaseService;
import cn.jsprun.service.user.MemberService;
import cn.jsprun.struts.foreg.form.FileAttaUploadForm;
import cn.jsprun.utils.BeanFactory;
import cn.jsprun.utils.Common;
import cn.jsprun.utils.DataParse;
import cn.jsprun.utils.FormDataCheck;
import cn.jsprun.utils.ForumCommonsUtil;
import cn.jsprun.utils.FtpUtils;
import cn.jsprun.utils.ImageUtil;
import cn.jsprun.utils.Log;
import cn.jsprun.utils.Md5Token;
public class PostManageAction extends DispatchAction {
private ForumService forumService = (ForumService) BeanFactory.getBean("forumService");
private PollsService pollService = (PollsService) BeanFactory.getBean("pollsService");
private PolloptionsService optionService = (PolloptionsService) BeanFactory.getBean("polloptionsService");
private ThreadsService threadService = (ThreadsService) BeanFactory.getBean("threadsService");
private DataBaseService dataBaseService = (DataBaseService) BeanFactory.getBean("dataBaseService");
private PostsService postService = (PostsService) BeanFactory.getBean("postsService");
private MemberService memberService = (MemberService) BeanFactory.getBean("memberService");
private DataParse dataParse = (DataParse) BeanFactory.getBean("dataParse");
private FtpUtils ftputil = (FtpUtils) BeanFactory.getBean("ftputils");
private ForumfieldService forumfieldService = (ForumfieldService) BeanFactory.getBean("forumfieldService");
private final String[] coloroptions = { "Black", "Sienna", "DarkOliveGreen","DarkGreen", "DarkSlateBlue", "Navy", "Indigo","DarkSlateGray", "DarkRed", "DarkOrange", "Olive", "Green","Teal", "Blue", "SlateGray", "DimGray", "Red", "SandyBrown","YellowGreen", "SeaGreen", "MediumTurquoise", "RoyalBlue","Purple", "Gray", "Magenta", "Orange", "Yellow", "Lime","Cyan", "DeepSkyBlue", "DarkOrchid", "Silver", "Pink", "Wheat","LemonChiffon", "PaleGreen", "PaleTurquoise", "LightBlue","Plum", "White" };
private final String[] fontoptions={"仿宋_GB2312", "黑体", "楷体_GB2312", "宋体", "新宋体","微软雅黑", "Trebuchet MS", "Tahoma", "Arial", "Impact", "Verdana","Times New Roman" };
private final int[]sizeoptions={ 1, 2, 3, 4, 5, 6, 7 };
@SuppressWarnings("unchecked")
public ActionForward toNewthread(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response) {
short fid = Common.toDigit(request.getParameter("fid"), 10000000000L, 0L).shortValue();
Forums forum = forumService.findById(fid);
if (forum == null) {
request.setAttribute("errorInfo", "指定的版块不存在,请返回。");
return mapping.findForward("showMessage");
}
request.setAttribute("styleid", forum.getStyleid() > 0 ? forum.getStyleid() : null);
Forumfields forumfield = forumfieldService.findById(fid);
if((forum.getSimple()&1)>0||forumfield.getRedirect().length()>0){
request.setAttribute("resultInfo", "本版块禁止发帖。");
return mapping.findForward("showMessage");
}
HttpSession session = request.getSession();
short groupid=(Short)session.getAttribute("jsprun_groupid");
Members member = (Members) session.getAttribute("user");
Map<String, String> usergroups = (Map<String, String>) request.getAttribute("usergroups");
int allowpost =Integer.valueOf(usergroups.get("allowpost"));
String postperm = forumfield.getPostperm();
if (member == null&& !((postperm.equals("") && allowpost > 0) || (!postperm.equals("") && Common.forumperm(postperm, groupid, member!=null?member.getExtgroupids():"")))) {
request.setAttribute("show_message", "您所在的用户组("+ usergroups.get("grouptitle") + ")无法进行此操作。");
return mapping.findForward("nopermission");
} else if (postperm.equals("") && allowpost == 0) {
request.setAttribute("show_message", "您所在的用户组("+ usergroups.get("grouptitle") + ")无法进行此操作。");
return mapping.findForward("nopermission");
} else if (!postperm.equals("") && !Common.forumperm(postperm, groupid, member!=null?member.getExtgroupids():"")) {
request.setAttribute("errorInfo", "对不起,本版块只有特定用户组可以发新话题,请返回。");
return mapping.findForward("showMessage");
}
if ("yes".equals(request.getParameter("isblog"))&& (Integer.valueOf(usergroups.get("allowuseblog")) == 0 || forum.getAllowshare() == 0)) {
request.setAttribute("errorInfo", "对不起,您没有权限或管理员设置了禁止在本版发表文章,请返回。");
return mapping.findForward("showMessage");
}
int timestamp =(int)(Calendar.getInstance().getTimeInMillis()/1000);
int special = Common.toDigit(request.getParameter("special"), 6L, 0L).intValue();
Map<String, String> settings = (Map<String, String>) request.getAttribute("settings");
this.common(request, response, settings, usergroups, forumfield, forum,special);
usergroups=null;
String target =null;
if (special == 2) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Map<String, String> trade = new HashMap<String, String>();
String expiration_month = format.format(Common.addTime(Calendar.MONTH, 1));
request.setAttribute("expiration_7days", format.format(Common.addTime(Calendar.DATE, 7)));
request.setAttribute("expiration_14days", format.format(Common.addTime(Calendar.DATE, 14)));
request.setAttribute("expiration_month", expiration_month);
request.setAttribute("expiration_3months", format.format(Common.addTime(Calendar.MONTH, 3)));
request.setAttribute("expiration_halfyear", format.format(Common.addTime(Calendar.MONTH,6)));
request.setAttribute("expiration_year", format.format(Common.addTime(Calendar.YEAR, 1)));
format=null;
trade.put("amount", "1");
trade.put("transport", "2");
trade.put("expiration", expiration_month);
request.setAttribute("trade", trade);
trade=null;
String tradetypes=settings.get("tradetypes");
if(tradetypes!=null&&tradetypes.length()>0) {
Map<String,String> forumtradetypes=dataParse.characterParse(forumfield.getTradetypes(), true);
Map<String,String> tradetypesmap=dataParse.characterParse(tradetypes, true);
StringBuffer tradetypeselect = new StringBuffer("<select name=\"tradetypeid\" onchange=\"ajaxget(\'post.jsp?action=threadtypes&tradetype=yes&typeid=\'+this.options[this.selectedIndex].value+'&rand='+Math.random(), \'threadtypes\', \'threadtypeswait\')\"><option value=\"0\"> </option>");
Set<String> typeids=tradetypesmap.keySet();
for (String typeid : typeids) {
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论










收起资源包目录





































































































共 3012 条
- 1
- 2
- 3
- 4
- 5
- 6
- 31

renzhaoqiang
- 粉丝: 47
- 资源: 66
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


安全验证
文档复制为VIP权益,开通VIP直接复制

- 1
- 2
前往页