c28f4dd1 by sayhoChun

final version

1 parent da0fac39
Showing 42 changed files with 172 additions and 94 deletions
1
2
3
4 var Map = function(){
5 this.map = new Object();
6 };
7
8 Map.prototype = {
9 put : function(key, value){
10 this.map[key] = value;
11 },
12 get : function(key){
13 return this.map[key];
14 },
15 containsKey : function(key){
16 return key in this.map;
17 }
18 };
...@@ -443,7 +443,7 @@ if(! class_exists("ApiBase") ) { ...@@ -443,7 +443,7 @@ if(! class_exists("ApiBase") ) {
443 $Upload = new UploadUtil(); 443 $Upload = new UploadUtil();
444 $uploadResult = $Upload->uploadOneFile($_FILES["file"], $this->fileSavePath, "", true); 444 $uploadResult = $Upload->uploadOneFile($_FILES["file"], $this->fileSavePath, "", true);
445 445
446 $logData = "Api : fileUpload // file : {$_FILES["file"]["name"]} //uploadResult : {$uploadResult["returnMessage"]}"; 446 $logData = "Api : fileUpload // file : {$_FILES["file"]["name"]} //uploadResult : {$uploadResult["returnMessage"]} // returnCode : {$uploadResult["returnCode"]} // savePath : {$uploadResult["fileInfo"]["savePath"]} // re_name : {$uploadResult["fileInfo"]["re_name"]}";
447 LogUtil::writeFileLog($this->logPath, $logData); 447 LogUtil::writeFileLog($this->logPath, $logData);
448 448
449 if( $uploadResult['returnCode'] == "1" ){ 449 if( $uploadResult['returnCode'] == "1" ){
...@@ -453,6 +453,7 @@ if(! class_exists("ApiBase") ) { ...@@ -453,6 +453,7 @@ if(! class_exists("ApiBase") ) {
453 $image = new SimpleImage(); 453 $image = new SimpleImage();
454 $assoc = array($this->fileSavePath_720, $this->fileSavePath_640, $this->fileSavePath_480, $this->fileSavePath_320, $this->fileSavePath_100) ; 454 $assoc = array($this->fileSavePath_720, $this->fileSavePath_640, $this->fileSavePath_480, $this->fileSavePath_320, $this->fileSavePath_100) ;
455 $image->check($assoc) ; 455 $image->check($assoc) ;
456
456 $image->processing($fileData["savePath"], $this->fileSavePath_720, 720, $fileData['re_name']) ; 457 $image->processing($fileData["savePath"], $this->fileSavePath_720, 720, $fileData['re_name']) ;
457 $image->processing($fileData["savePath"], $this->fileSavePath_640, 640, $fileData['re_name']) ; 458 $image->processing($fileData["savePath"], $this->fileSavePath_640, 640, $fileData['re_name']) ;
458 $image->processing($fileData["savePath"], $this->fileSavePath_480, 480, $fileData['re_name']) ; 459 $image->processing($fileData["savePath"], $this->fileSavePath_480, 480, $fileData['re_name']) ;
......
...@@ -454,7 +454,7 @@ if (! class_exists("ApiBoard")) ...@@ -454,7 +454,7 @@ if (! class_exists("ApiBoard"))
454 SELECT COUNT(*) rn 454 SELECT COUNT(*) rn
455 FROM tblComment C 455 FROM tblComment C
456 LEFT JOIN tblUser U ON C.userFk=U.userNo 456 LEFT JOIN tblUser U ON C.userFk=U.userNo
457 WHERE targetFk='{$csNo}' AND commentType='CS' AND status=1 457 WHERE targetFk='{$csNo}' AND commentType='CS' AND C.status=1
458 "; 458 ";
459 $this->rownum=$this->getValue($sql, "rn"); 459 $this->rownum=$this->getValue($sql, "rn");
460 $this->initPageForDevice(); 460 $this->initPageForDevice();
......
...@@ -7,11 +7,11 @@ if(! class_exists("Constants") ) ...@@ -7,11 +7,11 @@ if(! class_exists("Constants") )
7 /* 개발서버 */ 7 /* 개발서버 */
8 var $excelSavePath = "D:/workspace_php/KCSpecialVehicle/upload_excel" ; 8 var $excelSavePath = "D:/workspace_php/KCSpecialVehicle/upload_excel" ;
9 var $fileSavePath = "C:/Users/p/workspace_php/KCSpecialVehicle/upload_img" ; 9 var $fileSavePath = "C:/Users/p/workspace_php/KCSpecialVehicle/upload_img" ;
10 var $fileSavePath_720 = "C:/Users/p/workspace_php/KCSpecialVehicle/720" ; 10 var $fileSavePath_720 = "C:/Users/p/workspace_php/KCSpecialVehicle/720/" ;
11 var $fileSavePath_640 = "C:/Users/p/workspace_php/KCSpecialVehicle/640" ; 11 var $fileSavePath_640 = "C:/Users/p/workspace_php/KCSpecialVehicle/640/" ;
12 var $fileSavePath_480 = "C:/Users/p/workspace_php/KCSpecialVehicle/480" ; 12 var $fileSavePath_480 = "C:/Users/p/workspace_php/KCSpecialVehicle/480/" ;
13 var $fileSavePath_320 = "C:/Users/p/workspace_php/KCSpecialVehicle/320" ; 13 var $fileSavePath_320 = "C:/Users/p/workspace_php/KCSpecialVehicle/320/" ;
14 var $fileSavePath_100 = "C:/Users/p/workspace_php/KCSpecialVehicle/100" ; 14 var $fileSavePath_100 = "C:/Users/p/workspace_php/KCSpecialVehicle/100/" ;
15 var $agreeInfoPath = "C:/Users/p/workspace_php/KCSpecialVehicle/setting/agree.txt"; // 이용약관 파일 경로 15 var $agreeInfoPath = "C:/Users/p/workspace_php/KCSpecialVehicle/setting/agree.txt"; // 이용약관 파일 경로
16 var $privacyInfoPath = "C:/Users/p/workspace_php/KCSpecialVehicle/setting/privacy.txt"; // 개인정보취급방침 파일 경로 16 var $privacyInfoPath = "C:/Users/p/workspace_php/KCSpecialVehicle/setting/privacy.txt"; // 개인정보취급방침 파일 경로
17 17
...@@ -19,8 +19,8 @@ if(! class_exists("Constants") ) ...@@ -19,8 +19,8 @@ if(! class_exists("Constants") )
19 // var $logPath = "C:/Users/p/workspace_php/groupby/log" ; // simple 로그기록 19 // var $logPath = "C:/Users/p/workspace_php/groupby/log" ; // simple 로그기록
20 var $logPath = "C:/Users/p/workspace_php/KCSpecialVehicle/log" ; // simple 로그기록 20 var $logPath = "C:/Users/p/workspace_php/KCSpecialVehicle/log" ; // simple 로그기록
21 var $documentRoot = "C:/Users/p/workspace_php/KCSpecialVehicle/" ; // simple 로그기록 21 var $documentRoot = "C:/Users/p/workspace_php/KCSpecialVehicle/" ; // simple 로그기록
22 var $webRoot = "http://localhost:8200" ; 22 var $webRoot = "http://106.240.232.36:8200" ;
23 var $con_domain = "http://localhost:8200" ; // 메일에서 사용되는 도메인 23 var $con_domain = "http://106.240.232.36:8200" ; // 메일에서 사용되는 도메인
24 24
25 25
26 var $fileSaveUrl = "/upload_img/" ; 26 var $fileSaveUrl = "/upload_img/" ;
......
...@@ -112,15 +112,13 @@ if(! class_exists("SimpleImage") ) { ...@@ -112,15 +112,13 @@ if(! class_exists("SimpleImage") ) {
112 $this->image = $new_image; 112 $this->image = $new_image;
113 } 113 }
114 114
115 function processing($filePath, $savePath, $reSize, $fileName) 115 function processing($filePath, $savePath, $reSize, $fileName) {
116 { 116 $this->load ( $filePath . "/" . $fileName );
117
118 $this->load($filePath . "/" . $fileName) ;
119 117
120 if($this->getWidth() > $reSize) 118 if ($this->getWidth () > $reSize)
121 $this->resizeToWidth($reSize) ; 119 $this->resizeToWidth ( $reSize );
122 120
123 $this->save($savePath . "/" . date("Ymd") . "/" . $fileName) ; 121 $this->save ( $savePath . "/" . date ( "Ymd" ) . "/" . $fileName );
124 } 122 }
125 } 123 }
126 } 124 }
......
...@@ -164,88 +164,63 @@ if(! class_exists("UploadUtil") ) { ...@@ -164,88 +164,63 @@ if(! class_exists("UploadUtil") ) {
164 } 164 }
165 165
166 166
167 function uploadOneFile($File, $BasePath, $SubPath, $makeDayFolderFlag = FALSE, $overlapFlag = FALSE, $MakeNewNameFlag = TRUE) 167 function uploadOneFile($File, $BasePath, $SubPath, $makeDayFolderFlag = FALSE, $overlapFlag = FALSE, $MakeNewNameFlag = TRUE) {
168 { 168 $newFileName = $File ["name"];
169
170 $newFileName = $File["name"];
171 $SavePath = $BasePath; 169 $SavePath = $BasePath;
172 170
173 $logData = "Api : uploadOneFile // file : {$newFileName} //uploadResult : {$uploadResult["returnMessage"]}"; 171 $logData = "Api : uploadOneFile // file : {$newFileName} //uploadResult : {$uploadResult["returnMessage"]}";
174 LogUtil::writeFileLog($this->logPath, $logData); 172 LogUtil::writeFileLog ( $this->logPath, $logData );
175 173
176 174 if ($SubPath != "")
177 if($SubPath != "")
178 $SavePath .= "/" . $SubPath; 175 $SavePath .= "/" . $SubPath;
179 176 // 새로운 파일 이름 생성
180 //새로운 파일 이름 생성 177 if ($MakeNewNameFlag)
181 if($MakeNewNameFlag) 178 $newFileName = $this->File_Make_Unique_Name ( $newFileName );
182 $newFileName = $this->File_Make_Unique_Name($newFileName); 179 // 우선 파일사이즈가 0인건 업로드 하지 않음
183 180 if ($File ["size"] == 0 || ! isset ( $File ["size"] )) {
184 181 return $this->makeResult ( "-2", "비정상 파일입니다.(사이즈 0)" );
185 182 }
186 // 우선 파일사이즈가 0인건 업로드 하지 않음 183 // 파일 확장자 체크
187 if($File["size"] == 0 || !isset($File["size"])){ 184 if (! $this->File_Check_Extension ( $File ["name"] )) {
188 return $this->makeResult("-2", "비정상 파일입니다.(사이즈 0)"); 185 return $this->makeResult ( "-3", "허용되지 않은 확장자" );
189 } 186 }
190 187 // 파일 사이즈 체크
191 188 if (! $this->File_Check_Size ( $File ["size"] )) {
192 // 파일 확장자 체크 189 return $this->makeResult ( "-4", "업로드 용량을 초과하였습니다." );
193 if(!$this->File_Check_Extension($File["name"])){ 190 }
194 return $this->makeResult("-3", "허용되지 않은 확장자"); 191 // 에러 체크
195 } 192 if ($File ["error"] === "0") {
196 193 return $this->makeResult ( "-5", "파일이 비정상적으로 업로드 되었습니다 - {$File["error"]}" );
197 194 }
198 // 파일 사이즈 체크 195 // 파일 중복 체크
199 if(!$this->File_Check_Size($File["size"])){ 196 if ($overlapFlag && ! $this->File_Check_Overlap ( $SavePath, $newFileName )) {
200 return $this->makeResult("-4", "업로드 용량을 초과하였습니다."); 197 $this->removeFile ( $SavePath, $newFileName );
201 } 198 } else if (! $overlapFlag && ! $this->File_Check_Overlap ( $SavePath, $newFileName )) {
202 199 return $this->makeResult ( "-6", "이미 파일이 존재합니다." );
203 // 에러 체크 200 }
204 if($File["error"] === "0"){ 201 $SavePath = $this->Make_SavePath ( $SavePath, $makeDayFolderFlag );
205 return $this->makeResult("-5", "파일이 비정상적으로 업로드 되었습니다 - {$File["error"]}"); 202 $SubPath = str_replace ( $BasePath . "/", "", $SavePath );
206 } 203 if ($SavePath === FALSE) {
207 204 return $this->makeResult ( "-7", "업로드 경로 확인" );
208 // 파일 중복 체크 205 }
209 if($overlapFlag && !$this->File_Check_Overlap($SavePath, $newFileName)){ 206 // 실제 업로드
210 $this->removeFile($SavePath, $newFileName); 207 if (! @move_uploaded_file ( $File ["tmp_name"], $SavePath . "/" . $newFileName )) {
211 } 208 return $this->makeResult ( "-8", "업로드 도중 에러가 발생함" );
212 else if(!$overlapFlag && !$this->File_Check_Overlap($SavePath, $newFileName)) 209 }
213 { 210 chmod ( $SavePath . "/" . $newFileName, 0755 );
214 return $this->makeResult("-6", "이미 파일이 존재합니다."); 211 $fileInfo = array (
215 } 212 "re_name" => $newFileName,
216 213 "name" => $File ["name"],
217 214 "tmp_name" => $File ["tmp_name"],
218 $SavePath = $this->Make_SavePath($SavePath, $makeDayFolderFlag); 215 "error" => $File ["error"],
219 $SubPath = str_replace($BasePath . "/", "", $SavePath); 216 "type" => $File ["type"],
220 217 "size" => $File ["size"],
221 if($SavePath === FALSE) 218 "extension" => $this->File_Explode_Extension ( $newFileName ),
222 { 219 "savePath" => $SavePath,
223 return $this->makeResult("-7", "업로드 경로 확인"); 220 "SubPath" => $SubPath,
224 } 221 "saveURL" => $SubPath . "/" . $newFileName
225 222 );
226 223 return $this->makeResult ( "1", "", $fileInfo ); // 모든 파일을 업로드 한후 파일 정보를 넘겨준당.
227 //실제 업로드
228 if(!@move_uploaded_file($File["tmp_name"], $SavePath."/".$newFileName)){
229 return $this->makeResult("-8", "업로드 도중 에러가 발생함");
230 }
231
232 chmod($SavePath."/".$newFileName, 0755);
233
234 $fileInfo = array(
235 "re_name" => $newFileName,
236 "name" => $File["name"],
237 "tmp_name" => $File["tmp_name"],
238 "error" => $File["error"],
239 "type" => $File["type"],
240 "size" => $File["size"],
241 "extension" => $this->File_Explode_Extension($newFileName),
242 "savePath" => $SavePath,
243 "SubPath" => $SubPath,
244 "saveURL" => $SubPath . "/" . $newFileName
245 );
246
247 return $this->makeResult("1", "", $fileInfo); // 모든 파일을 업로드 한후 파일 정보를 넘겨준당.
248
249 } 224 }
250 225
251 226
......
1 log Date : 2017-05-22 11:04:02 // Api : saveComment // userFk : 111
2 ============================================================================
3 log Date : 2017-05-22 11:19:32 // Api : saveComment // userFk : 111
4 ============================================================================
5 log Date : 2017-05-22 11:24:48 // Api : saveComment // userFk : 111
6 ============================================================================
7 log Date : 2017-05-22 11:36:41 // Api : saveComment // userFk : 111
8 ============================================================================
9 log Date : 2017-05-22 11:36:51 // Api : saveComment // userFk : 111
10 ============================================================================
11 log Date : 2017-05-22 11:37:07 // Api : saveComment // userFk : 111
12 ============================================================================
13 log Date : 2017-05-22 12:56:20 // Api : fileUpload // file : Capture%2B_2017-05-08-11-39-40.png //uploadResult :
14 ============================================================================
15 log Date : 2017-05-22 12:56:34 // Api : fileUpload // file : Capture%2B_2017-05-08-11-39-40.png //uploadResult :
16 ============================================================================
17 log Date : 2017-05-22 13:00:46 // Api : fileUpload // file : 20170425_174352.jpg //uploadResult :
18 ============================================================================
19 log Date : 2017-05-22 13:02:15 // Api : fileUpload // file : 20170425_174352.jpg //uploadResult :
20 ============================================================================
21 log Date : 2017-05-22 13:03:30 // Api : fileUpload // file : 20170425_174352.jpg //uploadResult :
22 ============================================================================
23 log Date : 2017-05-22 13:04:54 // Api : fileUpload // file : 20170425_174352.jpg //uploadResult :
24 ============================================================================
25 log Date : 2017-05-22 13:06:47 // Api : fileUpload // file : 20170425_204734.jpg //uploadResult :
26 ============================================================================
27 log Date : 2017-05-22 13:11:57 // Api : fileUpload // file : 20170425_204734.jpg //uploadResult :
28 ============================================================================
29 log Date : 2017-05-22 13:13:29 // Api : fileUpload // file : 20170425_204734.jpg //uploadResult :
30 ============================================================================
31 log Date : 2017-05-22 13:15:09 // Api : fileUpload // file : //uploadResult : 비정상 파일입니다.(사이즈 0)
32 ============================================================================
33 log Date : 2017-05-22 13:15:10 // Api : fileUpload // file : //uploadResult : 비정상 파일입니다.(사이즈 0)
34 ============================================================================
35 log Date : 2017-05-22 13:16:00 // Api : fileUpload // file : //uploadResult : 비정상 파일입니다.(사이즈 0)
36 ============================================================================
37 log Date : 2017-05-22 13:17:11 // Api : fileUpload // file : //uploadResult : 비정상 파일입니다.(사이즈 0)
38 ============================================================================
39 log Date : 2017-05-22 13:17:49 // Api : fileUpload // file : 20170425_204734.jpg //uploadResult :
40 ============================================================================
41 log Date : 2017-05-22 13:18:16 // Api : fileUpload // file : 20170425_204734.jpg //uploadResult :
42 ============================================================================
43 log Date : 2017-05-22 13:21:00 // Api : fileUpload // file : img.PNG //uploadResult :
44 ============================================================================
45 log Date : 2017-05-22 13:36:42 // Api : fileUpload // file : //uploadResult : 비정상 파일입니다.(사이즈 0)
46 ============================================================================
47 log Date : 2017-05-22 13:36:51 // Api : fileUpload // file : img.PNG //uploadResult :
48 ============================================================================
49 log Date : 2017-05-22 13:37:22 // Api : fileUpload // file : 20170522_133116.jpg //uploadResult :
50 ============================================================================
51 log Date : 2017-05-22 13:38:33 // Api : saveComment // userFk : 104
52 ============================================================================
53 log Date : 2017-05-22 13:39:15 // Api : saveComment // userFk : 104
54 ============================================================================
55 log Date : 2017-05-22 13:39:19 // Api : fileUpload // file : //uploadResult : 비정상 파일입니다.(사이즈 0)
56 ============================================================================
57 log Date : 2017-05-22 13:43:18 // Api : fileUpload // file : //uploadResult : 비정상 파일입니다.(사이즈 0)
58 ============================================================================
59 log Date : 2017-05-22 13:48:11 // Api : saveComment // userFk : 104
60 ============================================================================
61 log Date : 2017-05-22 13:48:17 // Api : saveComment // userFk : 104
62 ============================================================================
63 log Date : 2017-05-22 13:48:29 // Api : saveComment // userFk : 104
64 ============================================================================
65 log Date : 2017-05-22 13:49:23 // Api : fileUpload // file : 20170522_133116.jpg //uploadResult :
66 ============================================================================
67 log Date : 2017-05-22 13:52:24 // Api : fileUpload // file : 20170522_133116.jpg //uploadResult :
68 ============================================================================
69 log Date : 2017-05-22 13:56:43 // Api : fileUpload // file : 20170522_133116.jpg //uploadResult :
70 ============================================================================
71 log Date : 2017-05-22 13:57:55 // Api : fileUpload // file : 20170522_133116.jpg //uploadResult :
72 ============================================================================
73 log Date : 2017-05-22 14:20:56 // Api : fileUpload // file : 1495429834422.jpg //uploadResult : // returnCode : 1
74 ============================================================================
75 log Date : 2017-05-22 14:24:34 // Api : fileUpload // file : 1495429834422.jpg //uploadResult : // returnCode : 1 // savePath : C:/Users/p/workspace_php/KCSpecialVehicle/upload_img/20170522
76 ============================================================================
77 log Date : 2017-05-22 14:25:42 // Api : fileUpload // file : 1495429834422.jpg //uploadResult : // returnCode : 1 // savePath : C:/Users/p/workspace_php/KCSpecialVehicle/upload_img/20170522
78 ============================================================================
79 log Date : 2017-05-22 14:27:12 // Api : fileUpload // file : 1490791259195.jpg //uploadResult : // returnCode : 1 // savePath : C:/Users/p/workspace_php/KCSpecialVehicle/upload_img/20170522
80 ============================================================================
81 log Date : 2017-05-22 14:29:38 // Api : fileUpload // file : 1490791259195.jpg //uploadResult : // returnCode : 1 // savePath : C:/Users/p/workspace_php/KCSpecialVehicle/upload_img/20170522 // re_name : 201705220229381753907.jpg
82 ============================================================================
83 log Date : 2017-05-22 14:31:03 // Api : fileUpload // file : 1490791259195.jpg //uploadResult : // returnCode : 1 // savePath : C:/Users/p/workspace_php/KCSpecialVehicle/upload_img/20170522 // re_name : 201705220231031780060.jpg
84 ============================================================================
85 log Date : 2017-05-22 14:33:08 // Api : fileUpload // file : 1495431179396.jpg //uploadResult : // returnCode : 1 // savePath : C:/Users/p/workspace_php/KCSpecialVehicle/upload_img/20170522 // re_name : 201705220233081289215.jpg
86 ============================================================================