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

📄 othermanageaction.java

📁 论坛软件系统亦称电子公告板(BBS)系统
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
				}
				if(!FormDataCheck.isValueString(textLink)){
					request.setAttribute("errorInfo", "文字链接必须为有效字符串。");
					return mapping.findForward("error");
				}
				parametersMap.put("title", textTitle);
				parametersMap.put("link", textLink);
				parametersMap.put("size", textSize);
				html = "<a href=\""+textLink+"\" target=\"_blank\" style=\"font-size: "+textSize+"\">"+textTitle+"</a>";
			}else 
				if(style.equals("image")){
				String imageUrl = request.getParameter("imageurl"); 
				String imageLink = request.getParameter("imagelink"); 
				String imageWidth = request.getParameter("imagewidth"); 
				String imageHeight = request.getParameter("imageheight"); 
				String imageAlt = request.getParameter("imagealt"); 
				
				if(imageUrl==null||imageLink==null||imageWidth==null||imageHeight==null||imageAlt==null){
					request.setAttribute("errorInfo", "非正常的访问方式");
					return mapping.findForward("error");
				}
				if(!FormDataCheck.isValueString(imageUrl)){
					request.setAttribute("errorInfo", "图片地址必须为有效字符串。");
					return mapping.findForward("error");
				}
				if(!FormDataCheck.isValueString(imageLink)){
					request.setAttribute("errorInfo", "图片链接必须为有效字符串。");
					return mapping.findForward("error");
				}
				if(!FormDataCheck.isNum(imageWidth)){
					imageWidth = "";
				}
				if(!FormDataCheck.isNum(imageHeight)){
					imageHeight = "";
				}
				parametersMap.put("url", imageUrl);
				parametersMap.put("link", imageLink);
				if(!imageWidth.equals("")){
					parametersMap.put("width", imageWidth);
				}
				if(!imageHeight.equals("")){
					parametersMap.put("height", imageHeight);
				}
				if(FormDataCheck.isValueString(imageAlt)){
					parametersMap.put("alt", imageAlt);
				}
				StringBuffer buffer = new StringBuffer("<a href=\""+imageLink+"\" target=\"_blank\"><img src=\""+imageUrl+"\"");
				if(!imageHeight.equals("")){
					buffer.append(" height=\""+imageHeight+"\"");
				}
				if(!imageWidth.equals("")){
					buffer.append(" width=\""+imageWidth+"\"");
				}
				buffer.append(" alt=\""+imageAlt+"\" border=\"0\"></a>");
				html = buffer.toString();
			}else
				if(style.equals("flash")){
				String flashUrl = request.getParameter("flashurl"); 
				String flashLink = request.getParameter("flashlink");  
				String flashWidth = request.getParameter("flashwidth"); 
				String flashHeight = request.getParameter("flashheight"); 
				if(flashUrl==null||flashLink==null||flashWidth==null||flashHeight==null){
					request.setAttribute("errorInfo", "非正常的访问方式");
					return mapping.findForward("error");
				}
				
				if(!FormDataCheck.isValueString(flashUrl)){
					request.setAttribute("errorInfo", "Flash地址必须为有效字符串。");
					return mapping.findForward("error");
				}
				if(!FormDataCheck.isValueString(flashWidth)){
					request.setAttribute("errorInfo", "Flash宽度必须填写。");
					return mapping.findForward("error");
				}
				if(!FormDataCheck.isValueString(flashHeight)){
					request.setAttribute("errorInfo", "Flash高度必须填写。");
					return mapping.findForward("error");
				}
				parametersMap.put("url", flashUrl);
				parametersMap.put("link", flashLink);
				parametersMap.put("width", flashWidth);
				parametersMap.put("height", flashHeight);
				
				StringBuffer htmlBuffer = new StringBuffer();
				
				boolean flashLinkBool = false;
				if(flashLink!=null){
					String flashLinkTrim = flashLink.trim();
					if(!flashLinkTrim.equals("")){
						htmlBuffer.append("<button onclick=\"window.open('"+flashLinkTrim+"')\" style=\"border:0px;width:"+flashWidth+"px;height:"+flashHeight+"px;background:background-color\" >");
						flashLinkBool = true;
					}
				}
				htmlBuffer.append("<embed width=\""+flashWidth+"\" height=\""+flashHeight+"\" src=\""+flashUrl+"\" type=\"application/x-shockwave-flash\"");
				if(flashLinkBool){
					htmlBuffer.append(" wmode=\"transparent\"");
				}
				htmlBuffer.append("></embed>");
				if(flashLinkBool){
					htmlBuffer.append("</button>");
				}
				html = htmlBuffer.toString();
			}
			parametersMap.put("type", type);
			parametersMap.put("style", style);
			parametersMap.put("position", position);
			parametersMap.put("html", html);
			parametersMap.put("displayorder", displayOrder);
			String targetsResult = "";
			if(targets!=null){
				int len = targets.length;
				StringBuffer targetSb = new StringBuffer();
				for(int i=0;i<len;i++){
					if(targets[i].equals("all")){
						targetSb.delete(0, targetSb.length());
						targetSb.append("all");
						break;
					}
					if(targets[i].equals("")){
						continue;
					}
					if(i==len-1){
						targetSb.append(targets[i]);
					}else{
						targetSb.append(targets[i] + "\t");
					}
				}
				targetsResult = targetSb.toString();
			}
			String parameters = dataParse.combinationChar(parametersMap);
			int startTimeInt = 0;
			int endTimeInt = 0;
			try {
				startTimeInt = ((int)(dateFormat.parse(startTime).getTime()/1000)) - (int)(timeoffset * 3600);
				endTimeInt = endTime.equals("0")?0:((int)(dateFormat.parse(endTime).getTime()/1000)) - (int)(timeoffset * 3600);
			} catch (ParseException e) {
				e.printStackTrace();
			}
			dataBaseService.execute("UPDATE jrun_advertisements SET title='"+title.replace("\\", "\\\\").replace("'", "\\'")+"',targets='"+targetsResult.replace("\\", "\\\\").replace("'", "\\'")+"', parameters='"+parameters.replace("\\", "\\\\").replace("'", "\\'")+"', code='"+html.replace("\\", "\\\\").replace("'", "\\'")+"',starttime="+startTimeInt+",endtime="+endTimeInt+" WHERE advid="+advId);
			String realPath = servlet.getServletContext().getRealPath("/");
			String[] updateKeyArray = {"archiver","register","index","forumdisplay","viewthread","settings"};
			UpdateCache.excude(realPath, updateKeyArray);
			request.setAttribute("successInfo", "编辑广告成功。");
			request.setAttribute("requestPath","admincp.jsp?action=adv");
			return mapping.findForward("success");
		}
	}
	public ActionForward forumlinks(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
		
		String forumlinksubmit = request.getParameter("forumlinksubmit");
		if(forumlinksubmit == null){

			List<Forumlinks> forumlinksList = otherSetService.queryAllForumLinkInfo();
			for(Forumlinks fm : forumlinksList){
				String fName = fm.getName();
				String fUrl = fm.getUrl();
				String fLogo = fm.getLogo();
				String fdsp = fm.getDescription();
				if (fName != null) {
					fm.setName(fName.replace("\"", "&quot;"));
				}
				if (fUrl != null) {
					fm.setUrl(fUrl.replace("\"", "&quot;"));
				}
				if (fLogo != null) {
					fm.setLogo(fLogo.replace("\"", "&quot;"));
				}
				if (fdsp != null) {
					fm.setDescription(fdsp.replace("\"", "&quot;"));
				}
			}
			request.setAttribute("flList", forumlinksList);
			return mapping.findForward("other_forumlinks");
		}else{
			List<Forumlinks> updateOrSaveForumLinks = new ArrayList<Forumlinks>();
			Forumlinks flBean = null;
			Forumlinks addFlBean = null;
			String deletes[] = request.getParameterValues("delete");
			String fIds[] = request.getParameterValues("fid");
			String displayorder[] = request.getParameterValues("displayorder");
			String displayorder_h[] = request.getParameterValues("displayorder_h");
			String name[] = request.getParameterValues("name");
			String name_h[] = request.getParameterValues("name_h");
			String url[] = request.getParameterValues("url");
			String url_h[] = request.getParameterValues("url_h");
			String description[] = request.getParameterValues("description");
			String description_h[] = request.getParameterValues("description_h");
			String logo[] = request.getParameterValues("logo");
			String logo_h[] = request.getParameterValues("logo_h");
			String newName = request.getParameter("newname");
			String newUrl = request.getParameter("newurl");
			String newDescription = request.getParameter("newdescription");
			String newLogo = request.getParameter("newlogo");
			String newDisplayOrder = request.getParameter("newdisplayorder");
			List<String> deleteList = new ArrayList<String>();
			if(!FormDataCheck.isZeroOption(deletes)){
				for(String delete : deletes){
					deleteList.add(delete);
				}
			}
			if (!FormDataCheck.isZeroOption(fIds)) {
				int len = fIds.length;
				for (int i = 0; i < len; i++) {
					if(!deleteList.contains(fIds[i])&&(!name[i].equals(name_h[i])
							||!url[i].equals(url_h[i])
							||!displayorder[i].equals(displayorder_h[i])
							||!description[i].equals(description_h[i])
							||!logo[i].equals(logo_h[i]))){
						flBean = new Forumlinks();
						flBean.setId(Short.valueOf(fIds[i]));
						flBean.setName(name[i]);
						flBean.setUrl(url[i]);
						flBean.setDescription(description[i]);
						try{ 
							flBean.setDisplayorder((short)(Double.parseDouble(displayorder[i])));
						}catch(Exception exception){
							flBean.setDisplayorder((short)0);
						}
						flBean.setLogo(logo[i]);
						updateOrSaveForumLinks.add(flBean);
					}
				}
			}
			if (FormDataCheck.isValueString(newName)){
				addFlBean = new Forumlinks();
				
				try{
					newDisplayOrder = Short.valueOf((short)(Double.parseDouble(newDisplayOrder))).toString();
				}catch(Exception exception){
					newDisplayOrder="0";
				}
				addFlBean.setDisplayorder(Short.valueOf(newDisplayOrder));
				addFlBean.setName(newName);
				addFlBean.setUrl(newUrl);
				addFlBean.setDescription(newDescription);
				addFlBean.setLogo(newLogo);
				updateOrSaveForumLinks.add(addFlBean);
			}
			otherSetService.updateForumLinks(deleteList, updateOrSaveForumLinks);
			String realPath = servlet.getServletContext().getRealPath("/");
			String[] updateKeyArray = {"index"};
			UpdateCache.excude(realPath, updateKeyArray);
			request.setAttribute("successInfo", "友情链接信息更新成功。");
			request.setAttribute("requestPath", "admincp.jsp?action=forumlinks");
			return mapping.findForward("success");
		}
	}
	public ActionForward crons(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
		String cronssubmit = request.getParameter("cronssubmit");
		if(cronssubmit == null){
			String run=request.getParameter("run");
			if(run!=null){
				Members members = (Members)request.getSession().getAttribute("members");
				if(members==null){
					request.setAttribute("errorInfo", "无权限操作。");
					return mapping.findForward("error");
				}else{
					byte adminid = members.getAdminid();
					if(adminid!=1){
						request.setAttribute("errorInfo", "无权限操作。");
						return mapping.findForward("error");
					}
				}
				cronsService.cronRunning(request, response, run);
				
				request.setAttribute("successInfo", "计划任务成功更新。");
				request.setAttribute("requestPath", "admincp.jsp?action=crons");
				return mapping.findForward("success");
			}else{
				float timeoffset = Float.parseFloat(ForumInit.settings.get("timeoffset"));
				List<Crons> cronsList = cronsService.queryAllCrons();
				SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd // HH:mm");
				List<CronInfo> cronInfoList = new ArrayList<CronInfo>();
				CronInfo cronInfo = null;
				for(Crons crons : cronsList){
					cronInfo = new CronInfo();
					cronInfo.setAvailable(crons.getAvailable().toString());
					cronInfo.setCronid(crons.getCronid().toString());
					Short day = crons.getDay();
					cronInfo.setDay(day==-1?"*":day.toString());
					cronInfo.setFilename(crons.getFilename());
					Short hour = crons.getHour();
					cronInfo.setHour(hour==-1?"*":hour.toString());
					cronInfo.setLastrun(Common.gmdate(simpleDateFormat, crons.getLastrun(), timeoffset));
					cronInfo.setMinute(crons.getMinute().replace("\t", ","));
					String cronsName = crons.getName();
					cronInfo.setName(cronsName!=null?cronsName.replace("\"", "&quot;"):null);
					cronInfo.setNextrun(Common.gmdate(simpleDateFormat, crons.getNextrun(), timeoffset));
					cronInfo.setType(crons.getType());
					byte weekday = crons.getWeekday();
					switch(weekday){
						case -1:cronInfo.setWeekday("*");break;
						case 0:cronInfo.setWeekday("星期日");break;
						case 1:cronInfo.setW

⌨️ 快捷键说明

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