c28f4dd1 by sayhoChun

final version

1 parent da0fac39
Showing 42 changed files with 172 additions and 94 deletions
var Map = function(){
this.map = new Object();
};
Map.prototype = {
put : function(key, value){
this.map[key] = value;
},
get : function(key){
return this.map[key];
},
containsKey : function(key){
return key in this.map;
}
};
......@@ -443,7 +443,7 @@ if(! class_exists("ApiBase") ) {
$Upload = new UploadUtil();
$uploadResult = $Upload->uploadOneFile($_FILES["file"], $this->fileSavePath, "", true);
$logData = "Api : fileUpload // file : {$_FILES["file"]["name"]} //uploadResult : {$uploadResult["returnMessage"]}";
$logData = "Api : fileUpload // file : {$_FILES["file"]["name"]} //uploadResult : {$uploadResult["returnMessage"]} // returnCode : {$uploadResult["returnCode"]} // savePath : {$uploadResult["fileInfo"]["savePath"]} // re_name : {$uploadResult["fileInfo"]["re_name"]}";
LogUtil::writeFileLog($this->logPath, $logData);
if( $uploadResult['returnCode'] == "1" ){
......@@ -453,6 +453,7 @@ if(! class_exists("ApiBase") ) {
$image = new SimpleImage();
$assoc = array($this->fileSavePath_720, $this->fileSavePath_640, $this->fileSavePath_480, $this->fileSavePath_320, $this->fileSavePath_100) ;
$image->check($assoc) ;
$image->processing($fileData["savePath"], $this->fileSavePath_720, 720, $fileData['re_name']) ;
$image->processing($fileData["savePath"], $this->fileSavePath_640, 640, $fileData['re_name']) ;
$image->processing($fileData["savePath"], $this->fileSavePath_480, 480, $fileData['re_name']) ;
......
......@@ -454,7 +454,7 @@ if (! class_exists("ApiBoard"))
SELECT COUNT(*) rn
FROM tblComment C
LEFT JOIN tblUser U ON C.userFk=U.userNo
WHERE targetFk='{$csNo}' AND commentType='CS' AND status=1
WHERE targetFk='{$csNo}' AND commentType='CS' AND C.status=1
";
$this->rownum=$this->getValue($sql, "rn");
$this->initPageForDevice();
......
......@@ -7,11 +7,11 @@ if(! class_exists("Constants") )
/* 개발서버 */
var $excelSavePath = "D:/workspace_php/KCSpecialVehicle/upload_excel" ;
var $fileSavePath = "C:/Users/p/workspace_php/KCSpecialVehicle/upload_img" ;
var $fileSavePath_720 = "C:/Users/p/workspace_php/KCSpecialVehicle/720" ;
var $fileSavePath_640 = "C:/Users/p/workspace_php/KCSpecialVehicle/640" ;
var $fileSavePath_480 = "C:/Users/p/workspace_php/KCSpecialVehicle/480" ;
var $fileSavePath_320 = "C:/Users/p/workspace_php/KCSpecialVehicle/320" ;
var $fileSavePath_100 = "C:/Users/p/workspace_php/KCSpecialVehicle/100" ;
var $fileSavePath_720 = "C:/Users/p/workspace_php/KCSpecialVehicle/720/" ;
var $fileSavePath_640 = "C:/Users/p/workspace_php/KCSpecialVehicle/640/" ;
var $fileSavePath_480 = "C:/Users/p/workspace_php/KCSpecialVehicle/480/" ;
var $fileSavePath_320 = "C:/Users/p/workspace_php/KCSpecialVehicle/320/" ;
var $fileSavePath_100 = "C:/Users/p/workspace_php/KCSpecialVehicle/100/" ;
var $agreeInfoPath = "C:/Users/p/workspace_php/KCSpecialVehicle/setting/agree.txt"; // 이용약관 파일 경로
var $privacyInfoPath = "C:/Users/p/workspace_php/KCSpecialVehicle/setting/privacy.txt"; // 개인정보취급방침 파일 경로
......@@ -19,8 +19,8 @@ if(! class_exists("Constants") )
// var $logPath = "C:/Users/p/workspace_php/groupby/log" ; // simple 로그기록
var $logPath = "C:/Users/p/workspace_php/KCSpecialVehicle/log" ; // simple 로그기록
var $documentRoot = "C:/Users/p/workspace_php/KCSpecialVehicle/" ; // simple 로그기록
var $webRoot = "http://localhost:8200" ;
var $con_domain = "http://localhost:8200" ; // 메일에서 사용되는 도메인
var $webRoot = "http://106.240.232.36:8200" ;
var $con_domain = "http://106.240.232.36:8200" ; // 메일에서 사용되는 도메인
var $fileSaveUrl = "/upload_img/" ;
......
......@@ -112,15 +112,13 @@ if(! class_exists("SimpleImage") ) {
$this->image = $new_image;
}
function processing($filePath, $savePath, $reSize, $fileName)
{
$this->load($filePath . "/" . $fileName) ;
function processing($filePath, $savePath, $reSize, $fileName) {
$this->load ( $filePath . "/" . $fileName );
if($this->getWidth() > $reSize)
$this->resizeToWidth($reSize) ;
$this->save($savePath . "/" . date("Ymd") . "/" . $fileName) ;
if ($this->getWidth () > $reSize)
$this->resizeToWidth ( $reSize );
$this->save ( $savePath . "/" . date ( "Ymd" ) . "/" . $fileName );
}
}
}
......
......@@ -164,88 +164,63 @@ if(! class_exists("UploadUtil") ) {
}
function uploadOneFile($File, $BasePath, $SubPath, $makeDayFolderFlag = FALSE, $overlapFlag = FALSE, $MakeNewNameFlag = TRUE)
{
$newFileName = $File["name"];
function uploadOneFile($File, $BasePath, $SubPath, $makeDayFolderFlag = FALSE, $overlapFlag = FALSE, $MakeNewNameFlag = TRUE) {
$newFileName = $File ["name"];
$SavePath = $BasePath;
$logData = "Api : uploadOneFile // file : {$newFileName} //uploadResult : {$uploadResult["returnMessage"]}";
LogUtil::writeFileLog($this->logPath, $logData);
LogUtil::writeFileLog ( $this->logPath, $logData );
if($SubPath != "")
if ($SubPath != "")
$SavePath .= "/" . $SubPath;
//새로운 파일 이름 생성
if($MakeNewNameFlag)
$newFileName = $this->File_Make_Unique_Name($newFileName);
// 우선 파일사이즈가 0인건 업로드 하지 않음
if($File["size"] == 0 || !isset($File["size"])){
return $this->makeResult("-2", "비정상 파일입니다.(사이즈 0)");
}
// 파일 확장자 체크
if(!$this->File_Check_Extension($File["name"])){
return $this->makeResult("-3", "허용되지 않은 확장자");
}
// 파일 사이즈 체크
if(!$this->File_Check_Size($File["size"])){
return $this->makeResult("-4", "업로드 용량을 초과하였습니다.");
}
// 에러 체크
if($File["error"] === "0"){
return $this->makeResult("-5", "파일이 비정상적으로 업로드 되었습니다 - {$File["error"]}");
}
// 파일 중복 체크
if($overlapFlag && !$this->File_Check_Overlap($SavePath, $newFileName)){
$this->removeFile($SavePath, $newFileName);
}
else if(!$overlapFlag && !$this->File_Check_Overlap($SavePath, $newFileName))
{
return $this->makeResult("-6", "이미 파일이 존재합니다.");
}
$SavePath = $this->Make_SavePath($SavePath, $makeDayFolderFlag);
$SubPath = str_replace($BasePath . "/", "", $SavePath);
if($SavePath === FALSE)
{
return $this->makeResult("-7", "업로드 경로 확인");
}
//실제 업로드
if(!@move_uploaded_file($File["tmp_name"], $SavePath."/".$newFileName)){
return $this->makeResult("-8", "업로드 도중 에러가 발생함");
}
chmod($SavePath."/".$newFileName, 0755);
$fileInfo = array(
"re_name" => $newFileName,
"name" => $File["name"],
"tmp_name" => $File["tmp_name"],
"error" => $File["error"],
"type" => $File["type"],
"size" => $File["size"],
"extension" => $this->File_Explode_Extension($newFileName),
"savePath" => $SavePath,
"SubPath" => $SubPath,
"saveURL" => $SubPath . "/" . $newFileName
);
return $this->makeResult("1", "", $fileInfo); // 모든 파일을 업로드 한후 파일 정보를 넘겨준당.
// 새로운 파일 이름 생성
if ($MakeNewNameFlag)
$newFileName = $this->File_Make_Unique_Name ( $newFileName );
// 우선 파일사이즈가 0인건 업로드 하지 않음
if ($File ["size"] == 0 || ! isset ( $File ["size"] )) {
return $this->makeResult ( "-2", "비정상 파일입니다.(사이즈 0)" );
}
// 파일 확장자 체크
if (! $this->File_Check_Extension ( $File ["name"] )) {
return $this->makeResult ( "-3", "허용되지 않은 확장자" );
}
// 파일 사이즈 체크
if (! $this->File_Check_Size ( $File ["size"] )) {
return $this->makeResult ( "-4", "업로드 용량을 초과하였습니다." );
}
// 에러 체크
if ($File ["error"] === "0") {
return $this->makeResult ( "-5", "파일이 비정상적으로 업로드 되었습니다 - {$File["error"]}" );
}
// 파일 중복 체크
if ($overlapFlag && ! $this->File_Check_Overlap ( $SavePath, $newFileName )) {
$this->removeFile ( $SavePath, $newFileName );
} else if (! $overlapFlag && ! $this->File_Check_Overlap ( $SavePath, $newFileName )) {
return $this->makeResult ( "-6", "이미 파일이 존재합니다." );
}
$SavePath = $this->Make_SavePath ( $SavePath, $makeDayFolderFlag );
$SubPath = str_replace ( $BasePath . "/", "", $SavePath );
if ($SavePath === FALSE) {
return $this->makeResult ( "-7", "업로드 경로 확인" );
}
// 실제 업로드
if (! @move_uploaded_file ( $File ["tmp_name"], $SavePath . "/" . $newFileName )) {
return $this->makeResult ( "-8", "업로드 도중 에러가 발생함" );
}
chmod ( $SavePath . "/" . $newFileName, 0755 );
$fileInfo = array (
"re_name" => $newFileName,
"name" => $File ["name"],
"tmp_name" => $File ["tmp_name"],
"error" => $File ["error"],
"type" => $File ["type"],
"size" => $File ["size"],
"extension" => $this->File_Explode_Extension ( $newFileName ),
"savePath" => $SavePath,
"SubPath" => $SubPath,
"saveURL" => $SubPath . "/" . $newFileName
);
return $this->makeResult ( "1", "", $fileInfo ); // 모든 파일을 업로드 한후 파일 정보를 넘겨준당.
}
......
log Date : 2017-05-22 11:04:02 // Api : saveComment // userFk : 111
============================================================================
log Date : 2017-05-22 11:19:32 // Api : saveComment // userFk : 111
============================================================================
log Date : 2017-05-22 11:24:48 // Api : saveComment // userFk : 111
============================================================================
log Date : 2017-05-22 11:36:41 // Api : saveComment // userFk : 111
============================================================================
log Date : 2017-05-22 11:36:51 // Api : saveComment // userFk : 111
============================================================================
log Date : 2017-05-22 11:37:07 // Api : saveComment // userFk : 111
============================================================================
log Date : 2017-05-22 12:56:20 // Api : fileUpload // file : Capture%2B_2017-05-08-11-39-40.png //uploadResult :
============================================================================
log Date : 2017-05-22 12:56:34 // Api : fileUpload // file : Capture%2B_2017-05-08-11-39-40.png //uploadResult :
============================================================================
log Date : 2017-05-22 13:00:46 // Api : fileUpload // file : 20170425_174352.jpg //uploadResult :
============================================================================
log Date : 2017-05-22 13:02:15 // Api : fileUpload // file : 20170425_174352.jpg //uploadResult :
============================================================================
log Date : 2017-05-22 13:03:30 // Api : fileUpload // file : 20170425_174352.jpg //uploadResult :
============================================================================
log Date : 2017-05-22 13:04:54 // Api : fileUpload // file : 20170425_174352.jpg //uploadResult :
============================================================================
log Date : 2017-05-22 13:06:47 // Api : fileUpload // file : 20170425_204734.jpg //uploadResult :
============================================================================
log Date : 2017-05-22 13:11:57 // Api : fileUpload // file : 20170425_204734.jpg //uploadResult :
============================================================================
log Date : 2017-05-22 13:13:29 // Api : fileUpload // file : 20170425_204734.jpg //uploadResult :
============================================================================
log Date : 2017-05-22 13:15:09 // Api : fileUpload // file : //uploadResult : 비정상 파일입니다.(사이즈 0)
============================================================================
log Date : 2017-05-22 13:15:10 // Api : fileUpload // file : //uploadResult : 비정상 파일입니다.(사이즈 0)
============================================================================
log Date : 2017-05-22 13:16:00 // Api : fileUpload // file : //uploadResult : 비정상 파일입니다.(사이즈 0)
============================================================================
log Date : 2017-05-22 13:17:11 // Api : fileUpload // file : //uploadResult : 비정상 파일입니다.(사이즈 0)
============================================================================
log Date : 2017-05-22 13:17:49 // Api : fileUpload // file : 20170425_204734.jpg //uploadResult :
============================================================================
log Date : 2017-05-22 13:18:16 // Api : fileUpload // file : 20170425_204734.jpg //uploadResult :
============================================================================
log Date : 2017-05-22 13:21:00 // Api : fileUpload // file : img.PNG //uploadResult :
============================================================================
log Date : 2017-05-22 13:36:42 // Api : fileUpload // file : //uploadResult : 비정상 파일입니다.(사이즈 0)
============================================================================
log Date : 2017-05-22 13:36:51 // Api : fileUpload // file : img.PNG //uploadResult :
============================================================================
log Date : 2017-05-22 13:37:22 // Api : fileUpload // file : 20170522_133116.jpg //uploadResult :
============================================================================
log Date : 2017-05-22 13:38:33 // Api : saveComment // userFk : 104
============================================================================
log Date : 2017-05-22 13:39:15 // Api : saveComment // userFk : 104
============================================================================
log Date : 2017-05-22 13:39:19 // Api : fileUpload // file : //uploadResult : 비정상 파일입니다.(사이즈 0)
============================================================================
log Date : 2017-05-22 13:43:18 // Api : fileUpload // file : //uploadResult : 비정상 파일입니다.(사이즈 0)
============================================================================
log Date : 2017-05-22 13:48:11 // Api : saveComment // userFk : 104
============================================================================
log Date : 2017-05-22 13:48:17 // Api : saveComment // userFk : 104
============================================================================
log Date : 2017-05-22 13:48:29 // Api : saveComment // userFk : 104
============================================================================
log Date : 2017-05-22 13:49:23 // Api : fileUpload // file : 20170522_133116.jpg //uploadResult :
============================================================================
log Date : 2017-05-22 13:52:24 // Api : fileUpload // file : 20170522_133116.jpg //uploadResult :
============================================================================
log Date : 2017-05-22 13:56:43 // Api : fileUpload // file : 20170522_133116.jpg //uploadResult :
============================================================================
log Date : 2017-05-22 13:57:55 // Api : fileUpload // file : 20170522_133116.jpg //uploadResult :
============================================================================
log Date : 2017-05-22 14:20:56 // Api : fileUpload // file : 1495429834422.jpg //uploadResult : // returnCode : 1
============================================================================
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
============================================================================
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
============================================================================
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
============================================================================
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
============================================================================
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
============================================================================
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
============================================================================