|
@@ -1,8 +1,6 @@
|
|
|
package com.lemon.lifecenter.controller;
|
|
|
|
|
|
import java.io.File;
|
|
|
-import java.io.FileNotFoundException;
|
|
|
-import java.io.FileOutputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
@@ -112,6 +110,17 @@ public class BoardController extends LifeCenterController {
|
|
|
// return "/common/blank";
|
|
|
// }
|
|
|
|
|
|
+ String noticeInsertTime = LifeCenterSessionController.getSession(request, "noticeInsertTime");
|
|
|
+ long time = LifeCenterFunction.getNowUnixTimeStamp();
|
|
|
+ if( noticeInsertTime != null && !noticeInsertTime.equals( "" ) ) {
|
|
|
+ long i = Long.parseLong( noticeInsertTime );
|
|
|
+
|
|
|
+ if( ( time - i ) < 61 ) {
|
|
|
+ LifeCenterFunction.scriptMessage( response, "alertBox({ txt : '<font style=\"color:red\">자동화공격방지</font><br/>게시글 작성 후 60초 동안 작성이 불가능 합니다<br/>"+( 61 - ( time - i ) )+"초 이후 작성 가능', callBack : function(){ history.back(); } });" );
|
|
|
+ return "/common/blank";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (file.isEmpty() == false) {
|
|
|
UUID uuid = UUID.randomUUID();
|
|
|
String fileName = file.getOriginalFilename();
|
|
@@ -119,6 +128,19 @@ public class BoardController extends LifeCenterController {
|
|
|
String ext = FilenameUtils.getExtension(fileName);
|
|
|
String saveFileName = uuid + "." + ext;
|
|
|
|
|
|
+ final String[] PERMISSION_FILE_EXT_ARR = {"gif","png","jpg","jpeg","doc","docx","xls","xlsx","hwp","pdf", "txt"};
|
|
|
+ boolean extFlag = false;
|
|
|
+ for( int i = 0; i < PERMISSION_FILE_EXT_ARR.length; i++ ) {
|
|
|
+ if( PERMISSION_FILE_EXT_ARR[i].equals( ext.toLowerCase() ) ) {
|
|
|
+ extFlag = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if( extFlag == false ) {
|
|
|
+ LifeCenterFunction.scriptMessage( response, "alertBox({ txt : \"등록할수 없는 확장자입니다.<br/>.gif, .jpg, .png, .jpeg, .doc, .docx, .xls, .xlsx, .hwp, .pdf, .txt 확장자만 등록가능\", callBack : function(){ history.back(); } });" );
|
|
|
+ return "/common/blank";
|
|
|
+ }
|
|
|
+
|
|
|
try {
|
|
|
String tempPath = config.filePath;
|
|
|
File saveFile = new File(tempPath, saveFileName);
|
|
@@ -160,6 +182,8 @@ public class BoardController extends LifeCenterController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ LifeCenterSessionController.setSession( request, "noticeInsertTime", String.valueOf( time ) );
|
|
|
+
|
|
|
return "redirect:/notice/content?postSeq=" + dto.getPostSeq();
|
|
|
}
|
|
|
|
|
@@ -398,6 +422,17 @@ public class BoardController extends LifeCenterController {
|
|
|
MultipartFile file) {
|
|
|
String sesId = LifeCenterSessionController.getSession(request, "sesId");
|
|
|
|
|
|
+ String qnaInsertTime = LifeCenterSessionController.getSession(request, "qnaInsertTime");
|
|
|
+ long time = LifeCenterFunction.getNowUnixTimeStamp();
|
|
|
+ if( qnaInsertTime != null && !qnaInsertTime.equals( "" ) ) {
|
|
|
+ long i = Long.parseLong( qnaInsertTime );
|
|
|
+
|
|
|
+ if( ( time - i ) < 61 ) {
|
|
|
+ LifeCenterFunction.scriptMessage( response, "alertBox({ txt : '<font style=\"color:red\">자동화공격방지</font><br/>게시글 작성 후 60초 동안 작성이 불가능 합니다<br/>"+( 61 - ( time - i ) )+"초 이후 작성 가능', callBack : function(){ history.back(); } });" );
|
|
|
+ return "/common/blank";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (file.isEmpty() == false) {
|
|
|
UUID uuid = UUID.randomUUID();
|
|
|
String fileName = file.getOriginalFilename();
|
|
@@ -446,6 +481,8 @@ public class BoardController extends LifeCenterController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ LifeCenterSessionController.setSession( request, "qnaInsertTime", String.valueOf( time ) );
|
|
|
+
|
|
|
return "redirect:/qna/content?postSeq=" + dto.getPostSeq();
|
|
|
}
|
|
|
|