⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 postmanageaction.java

📁 论坛软件系统亦称电子公告板(BBS)系统
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
				request.setAttribute("errorInfo", "对不起,积分余额不足,请返回修改。");
				return mapping.findForward("showMessage");
			}
			price = rewardprice;
			member = (Members) Common.setValues(member, extcreditField, String.valueOf(extcredit - realprice));
			memberService.modifyMember(member);
		} else if (special == 4) {
			int activitytime = Common.toDigit(request.getParameter("activitytime"), 1L, 0L).intValue();
			String starttimefrom = request.getParameter("starttimefrom["+ activitytime + "]");
			String starttimeto = request.getParameter("starttimeto");
			String activityclass = request.getParameter("activityclass").trim();
			String activityplace = request.getParameter("activityplace").trim();
			String activityexpiration = request.getParameter("activityexpiration").trim();
			String activitycity = request.getParameter("activitycity").trim();
			if (activitytime == 0&&starttimefrom.equals("")) {
				request.setAttribute("errorInfo", "对不起,活动开始时间不能为空,请返回修改。");
				return mapping.findForward("showMessage");
			} else if (checkDateFormatAndValite(starttimefrom) < 0) {
				request.setAttribute("errorInfo", "对不起,活动开始时间格式不正确,请返回修改。");
				return mapping.findForward("showMessage");
			}
			int starttime=Common.dataToInteger(starttimefrom)-timeoffset;
			int timeto=Common.dataToInteger(starttimeto);
			timeto=timeto>0?timeto-timeoffset:0;
			if (starttime < timestamp) {
				request.setAttribute("resultInfo", "对不起,活动开始时间不能小于当前时间");
				return mapping.findForward("showMessage");
			} else if (activitytime > 0&& (timeto <= 0 || starttime >timeto)) {
				request.setAttribute("errorInfo", "对不起,活动开始时间格式不正确,请返回修改。");
				return mapping.findForward("showMessage");
			} else if ("".equals(activityclass)) {
				request.setAttribute("errorInfo", "对不起,活动所属类别不能为空,请返回修改。");
				return mapping.findForward("showMessage");
			} else if ("".equals(activityplace)) {
				request.setAttribute("errorInfo", "对不起,活动地点不能为空,请返回修改。");
				return mapping.findForward("showMessage");
			} else if (!activityexpiration.equals("")&& checkDateFormatAndValite(activityexpiration) < 0) {
				request.setAttribute("errorInfo", "对不起,活动征集截止日期格式不正确,请返回修改。");
				return mapping.findForward("showMessage");
			}
			activity = new HashMap<String, String>();
			activity.put("class", activityclass);
			activity.put("starttimefrom", String.valueOf(starttime));
			activity.put("starttimeto", String.valueOf(timeto));
			activity.put("place", activityplace);
			activity.put("cost", Common.toDigit(request.getParameter("cost"),	1000000000L, 0L).toString());
			activity.put("gender", Common.toDigit(request.getParameter("gender"), 2L,	0L).toString());
			activity.put("number", Common.toDigit(request.getParameter("number"),1000000000L, 0L).toString());
			if (!activityexpiration.equals("")) {
				activity.put("expiration", String.valueOf(Common.dataToInteger(activityexpiration)-timeoffset));
			} else {
				activity.put("expiration", "0");
			}
			if (!activitycity.equals("")) {
				subject += "["+activitycity+"]";
			}
		} else if (special == 5) {
			affirmpoint = request.getParameter("affirmpoint");
			negapoint = request.getParameter("negapoint");
			endtime = Common.dataToInteger(request.getParameter("endtime"))-timeoffset;
			umpire = request.getParameter("umpire");
			if (affirmpoint == null || negapoint == null) {
				request.setAttribute("errorInfo","对不起,发表辩论主题需要输入正方和反方观点,请返回修改。");
				return mapping.findForward("showMessage");
			} else if (endtime > 0 && endtime < timestamp) {
				request.setAttribute("errorInfo","对不起,您设置辩论的结束时间小于当前时间,请返回修改。");
				return mapping.findForward("showMessage");
			} else if (umpire != null) {
				Members me = memberService.findByName(umpire);
				if (me == null) {
					request.setAttribute("errorInfo", "对不起,你指定的裁判 (<b>"+ umpire + "</b>) 不存在或者被删除,请返回修改。");
					return mapping.findForward("showMessage");
				}
				me=null;
			}
		}
		Map<Integer, String> expiration = threadtypes != null ? (Map<Integer, String>) threadtypes.get("expiration"): null;
		int typeexpiration = Common.toDigit(request.getParameter("typeexpiration"),1000000000L, 0L).intValue();
		if ("1".equals(expiration != null ? expiration.get(typeid) : "0")&& typeexpiration <= 0) {
			expiration=null;
			request.setAttribute("errorInfo", "此主题必须指定有效期,请返回修改。");
			return mapping.findForward("showMessage");
		}
		expiration=null;
		Map<Integer, String> specials = threadtypes != null ? (Map<Integer, String>) threadtypes.get("special"): null;
		typeid = special > 0&& "1".equals(specials != null ? specials.get(typeid) : "0") ? 0: typeid;
		specials=null;
		Map<Integer, String> optiondata = new TreeMap<Integer, String>();
		if(threadtypes!=null&&typeid>0){
			Common.include(request, response, servlet, "/forumdata/cache/threadtype_"+typeid+".jsp", null);
			Map<String, String> threadtype = (Map<String, String>) request.getAttribute("threadtype");
			if (threadtype != null) {
				Map<Integer, Map<String, String>> dtype = dataParse.characterParse(threadtype.get("dtype"),true);
				threadtype=null;
				if (dtype != null&& dtype.size() > 0&& "1".equals(((Map<Integer, String>) threadtypes.get("special")).get((int)typeid))&& !(forum.getAllowspecialonly() > 0)) {
					Set<Integer> keys = dtype.keySet();
					for (Integer optionid : keys) {
						Map<String, String> option = dtype.get(optionid);
						String title = option.get("title");
						String identifier = option.get("identifier");
						String type = option.get("type");
						int maxlength = Common.toDigit(option.get("maxlength"),1000000000L, 0L).intValue();
						int maxnum = Common.toDigit(option.get("maxnum"), 1000000000L,0L).intValue();
						int minnum = Common.toDigit(option.get("minnum"), 1000000000L,0L).intValue();
						byte required = Common.toDigit(option.get("required"), 1L, 0L).byteValue();
						String value = request.getParameter("typeoption["+ identifier + "]");
						if (required > 0 && (value==null||value.equals(""))) {
							request.setAttribute("errorInfo", "资料填写不全,请返回检查"+ title + "选项。");
							return mapping.findForward("showMessage");
						} else if (value!=null&&!value.equals("")&& (type.equals("number") && !Common.isNum(value) || type.equals("email")&& !Common.isEmail(value))) {
							request.setAttribute("errorInfo", "资料格式不正确,请返回检查"+ title + "选项。");
							return mapping.findForward("showMessage");
						} else if (value!=null&&!value.equals("") && maxlength > 0&& value.length() > maxlength) {
							request.setAttribute("errorInfo", "资料长度过长,请返回检查"+ title + "选项。");
							return mapping.findForward("showMessage");
						} else if (value!=null&&!value.equals("")&& ((option.get("maxnum") != null && Integer.valueOf(value) > Integer.valueOf(maxnum)) || (option.get("minnum") != null && Integer.valueOf(value) < Integer.valueOf(minnum)))) {
							request.setAttribute("errorInfo", "'资料数值不正确,请返回检查"+ title + "选项。");
							return mapping.findForward("showMessage");
						} else if (type.equals("checkbox")) {
							String[] values = request.getParameterValues("typeoption["+ identifier + "]");
							if(values!=null){
								StringBuffer temp = new StringBuffer();
								for(String obj:values){
									temp.append("\t"+obj);
								}
								value = temp.substring(1);
							}
						}
						optiondata.put(optionid, value);
					}
				}
				dtype=null;
			}
		}
		String author = isanonymous == 0 ? (member!=null?member.getUsername():"匿名") : "";
		byte moderated = (byte)(digest != 0 || displayorder > 0 ? 1 : 0);
		List filelist = getAttach(form);
		String attachmentMessage = this.checkAttachment(request,filelist,forumfield);
		if (attachmentMessage != null) {
			request.setAttribute("errorInfo", attachmentMessage);
			return mapping.findForward("showMessage");
		}
		
		byte subscribed = (byte)(request.getParameter("emailnotify") != null&& member != null ? 1 : 0);
		Map supe_pushsetting = dataParse.characterParse(forumfield.getSupe_pushsetting(),false);
		byte supe_pushstatus = (byte)("1".equals(settings.get("super_status"))&& supe_pushsetting != null&& "1".equals(supe_pushsetting.get("status")) && modnewthreads ? 1: 0);
		supe_pushsetting=null;
		String newsubject=Common.dhtmlspecialchars(subject);
		Threads thread = new Threads();
		thread.setFid(fid);
		thread.setReadperm(readperm);
		thread.setPrice(price);
		thread.setIconid(iconid);
		thread.setTypeid(typeid);
		thread.setAuthor(author);
		thread.setAuthorid(member!=null?member.getUid():0);
		thread.setSubject(newsubject);
		thread.setDateline(timestamp);
		thread.setLastpost(timestamp);
		thread.setLastposter(author);
		thread.setDisplayorder(displayorder);
		thread.setDigest(digest);
		thread.setBlog(blog);
		thread.setSpecial((byte)special);
		thread.setAttachment(Byte.valueOf("0"));
		thread.setSubscribed(subscribed);
		thread.setModerated(moderated);
		thread.setSupePushstatus(supe_pushstatus);
		threadService.addThread(thread);
		int tid = thread.getTid();
		Map<String, String> searcharray = dataParse.characterParse(((Map<String, String>) request.getAttribute("smilies")).get("searcharray"), false);
		byte bbcodeoff =checkbbcodes(message, Common.toDigit(request.getParameter("bbcodeoff"), 1L, 0L));
		byte smileyoff = checksmilies(message, Common.toDigit(request.getParameter("smileyoff"), 1L, 0L), searcharray);
		searcharray=null;
		byte parseurloff = Common.toDigit(request.getParameter("parseurloff"), 1L, 0L).byteValue();
		byte tagstatus = Common.toDigit(settings.get("tagstatus"), 255L, 0L).byteValue();
		byte htmlon = (byte)((tagstatus > 0&& request.getParameter("tagoff") != null ? 1 : 0)+ ("1".equals(usergroups.get("allowhtml"))&& request.getParameter("htmlon") != null ? 1 : 0));
		message=message.replace("\\", "\\\\");
		byte invisible = (byte)(modnewthreads ? -2 : 0);
		Posts post = new Posts();
		post.setFid(fid);
		post.setTid(tid);
		post.setFirst(Byte.valueOf("1"));
		post.setAuthor(member!=null?member.getUsername():"匿名");
		post.setAuthorid(member!=null?member.getUid():0);
		post.setSubject(newsubject);
		post.setDateline(timestamp);
		post.setMessage(message);
		post.setUseip(request.getRemoteAddr());
		post.setInvisible(invisible);
		post.setAnonymous(isanonymous);
		post.setUsesig(usesig);
		post.setHtmlon(htmlon);
		post.setBbcodeoff(bbcodeoff);
		post.setSmileyoff(smileyoff);
		post.setParseurloff(parseurloff);
		post.setAttachment((byte)0);
		postService.saveOrupdatePosts(post);
		int pid = post.getPid();
		if (allowpostattach) {
			String attamessage = uploadAttachment(request, pid, tid, fid,message,filelist,forum.getDisablewatermark());
			if(!attamessage.equals("")){
				dataBaseService.runQuery("delete from jrun_posts where pid="+pid,true);
				dataBaseService.runQuery("delete from jrun_threads where tid="+tid,true);
				request.setAttribute("resultInfo", attamessage);
				return mapping.findForward("showMessage");
			}
		}
		filelist = null;
		if (subscribed > 0) {
			dataBaseService.runQuery("REPLACE INTO jrun_subscriptions (uid, tid, lastpost, lastnotify) VALUES ('"+ member.getUid() + "', '" + tid + "', '" + timestamp+ "', '" + timestamp + "')",true);
		}
		dataBaseService.runQuery("REPLACE INTO jrun_mythreads (uid, tid, dateline, special) VALUES ('" + uid+ "', '" + tid + "', '" + timestamp + "', '" + special + "')",true);
		if (special == 1) {
			dataBaseService.runQuery("INSERT INTO jrun_polls (tid, multiple, visible, maxchoices, expiration) VALUES ('"+ tid + "', '" + pollarray.get("multiple") + "', '"	+ pollarray.get("visible") + "', '"	+ pollarray.get("maxchoices") + "', '"	+ pollarray.get("expiration") + "')",true);
			StringBuffer sql=new StringBuffer();
			sql.append("INSERT INTO jrun_polloptions (tid,votes,displayorder, polloption,voterids) VALUES ");
			boolean flag=false;
			for (String polloptvalue : (List<String>) pollarray.get("options")) {
				if(flag){
					sql.append(",('" + tid+ "','0','0','" + polloptvalue + "','')");
				}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -