first
This commit is contained in:
32
modules/mediaset/action/a.config.php
Normal file
32
modules/mediaset/action/a.config.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
if(!defined('__KIMS__')) exit;
|
||||
|
||||
checkAdmin(0);
|
||||
$ftp_port = $ftp_port ? trim($ftp_port) : '21';
|
||||
$_tmpdfile = $g['path_var'].'site/'.$r.'/'.$m.'.var.php';
|
||||
|
||||
$fp = fopen($_tmpdfile,'w');
|
||||
fwrite($fp, "<?php\n");
|
||||
fwrite($fp, "\$d['mediaset']['maxnum_file'] = \"".$maxnum_file."\";\n");
|
||||
fwrite($fp, "\$d['mediaset']['maxsize_file'] = \"".$maxsize_file."\";\n");
|
||||
fwrite($fp, "\$d['mediaset']['thumbsize'] = \"".$thumbsize."\";\n");
|
||||
fwrite($fp, "\$d['mediaset']['use_fileserver'] = \"".$use_fileserver."\";\n");
|
||||
fwrite($fp, "\$d['mediaset']['ftp_type'] = \"".$ftp_type."\";\n");
|
||||
fwrite($fp, "\$d['mediaset']['ftp_host'] = \"".trim($ftp_host)."\";\n");
|
||||
fwrite($fp, "\$d['mediaset']['ftp_port'] = \"".$ftp_port."\";\n");
|
||||
fwrite($fp, "\$d['mediaset']['ftp_user'] = \"".trim($ftp_user)."\";\n");
|
||||
fwrite($fp, "\$d['mediaset']['ftp_pasv'] = \"".$ftp_pasv."\";\n");
|
||||
fwrite($fp, "\$d['mediaset']['ftp_pass'] = \"".trim($ftp_pass)."\";\n");
|
||||
fwrite($fp, "\$d['mediaset']['ftp_folder'] = \"".trim($ftp_folder)."\";\n");
|
||||
fwrite($fp, "\$d['mediaset']['ftp_urlpath'] = \"".trim($ftp_urlpath)."\";\n");
|
||||
fwrite($fp, "\$d['mediaset']['S3_KEY'] = \"".trim($s3_key)."\";\n");
|
||||
fwrite($fp, "\$d['mediaset']['S3_SEC'] = \"".trim($s3_sec)."\";\n");
|
||||
fwrite($fp, "\$d['mediaset']['S3_REGION'] = \"".trim($s3_region)."\";\n");
|
||||
fwrite($fp, "\$d['mediaset']['S3_BUCKET'] = \"".trim($s3_bucket)."\";\n");
|
||||
fwrite($fp, "?>");
|
||||
fclose($fp);
|
||||
@chmod($_tmpdfile,0707);
|
||||
|
||||
setrawcookie('mediaset_config_result', rawurlencode('<i class="fa fa-check" aria-hidden="true"></i> 설정이 변경 되었습니다.|success')); // 처리여부 cookie 저장
|
||||
getLink('reload','parent.','','');
|
||||
?>
|
||||
59
modules/mediaset/action/a.delete.php
Normal file
59
modules/mediaset/action/a.delete.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
if(!defined('__KIMS__')) exit;
|
||||
|
||||
$uid = $_POST['uid']; // 첨부물 UID
|
||||
|
||||
$g['mediasetVarForSite'] = $g['path_var'].'site/'.$r.'/'.$m.'.var.php';
|
||||
include_once file_exists($g['mediasetVarForSite']) ? $g['mediasetVarForSite'] : $g['dir_module'].'var/var.php';
|
||||
include_once $g['path_core'].'opensrc/aws-sdk-php/v3/aws-autoloader.php';
|
||||
|
||||
use Aws\S3\S3Client;
|
||||
|
||||
define('S3_KEY', $d['mediaset']['S3_KEY']); //발급받은 키.
|
||||
define('S3_SEC', $d['mediaset']['S3_SEC'] ); //발급받은 비밀번호.
|
||||
define('S3_REGION', $d['mediaset']['S3_REGION']); //S3 버킷의 리전.
|
||||
define('S3_BUCKET', $d['mediaset']['S3_BUCKET']); //버킷의 이름.
|
||||
|
||||
$U = getUidData($table['s_upload'],$uid);
|
||||
if ($U['uid'])
|
||||
{
|
||||
getDbUpdate($table['s_numinfo'],'upload=upload-1',"date='".substr($U['d_regis'],0,8)."' and site=".$U['site']);
|
||||
getDbDelete($table['s_upload'],'uid='.$U['uid']);
|
||||
|
||||
if ($U['host']==$d['mediaset']['ftp_urlpath'])
|
||||
{
|
||||
$FTP_CONNECT = ftp_connect($d['mediaset']['ftp_host'],$d['mediaset']['ftp_port']);
|
||||
$FTP_CRESULT = ftp_login($FTP_CONNECT,$d['mediaset']['ftp_user'],$d['mediaset']['ftp_pass']);
|
||||
if (!$FTP_CONNECT) getLink('','','FTP서버 연결에 문제가 발생했습니다.','');
|
||||
if (!$FTP_CRESULT) getLink('','','FTP서버 아이디나 패스워드가 일치하지 않습니다.','');
|
||||
|
||||
ftp_delete($FTP_CONNECT,$d['mediaset']['ftp_folder'].$U['folder'].'/'.$U['tmpname']);
|
||||
if($U['type']==2) ftp_delete($FTP_CONNECT,$d['mediaset']['ftp_folder'].$U['folder'].'/'.$U['thumbname']);
|
||||
ftp_close($FTP_CONNECT);
|
||||
|
||||
} elseif ($U['fserver']==2) {
|
||||
|
||||
$s3 = new S3Client([
|
||||
'version' => 'latest',
|
||||
'region' => S3_REGION,
|
||||
'credentials' => [
|
||||
'key' => S3_KEY,
|
||||
'secret' => S3_SEC,
|
||||
],
|
||||
]);
|
||||
|
||||
$s3->deleteObject([
|
||||
'Bucket' => S3_BUCKET,
|
||||
'Key' => $U['folder'].'/'.$U['tmpname']
|
||||
]);
|
||||
|
||||
|
||||
} else {
|
||||
unlink('.'.$U['host'].'/'.$U['folder'].'/'.$U['tmpname']);
|
||||
// if($U['type']==2) unlink('.'.$U['url'].$U['folder'].'/'.$U['tmpname'].'.'.$U['ext']);
|
||||
}
|
||||
}
|
||||
|
||||
echo 'ok';
|
||||
exit;
|
||||
?>
|
||||
63
modules/mediaset/action/a.download.php
Normal file
63
modules/mediaset/action/a.download.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
if(!defined('__KIMS__')) exit;
|
||||
$R=getUidData($table['s_upload'],$uid);
|
||||
if (!$R['uid']) getLink('','','정상적인 요청이 아닙니다.','');
|
||||
$filename = $R['name'];
|
||||
$filetmpname = $R['tmpname'];
|
||||
|
||||
if ($R['host']) $filepath = $R['src'];
|
||||
else $filepath = $R['folder'].'/'.$filetmpname;
|
||||
|
||||
$filesize = $R['size'];
|
||||
|
||||
if (!strstr($_SERVER['HTTP_REFERER'],'module='.$m) && !$my['admin']) {
|
||||
//동기화
|
||||
$syncArr = getArrayString($R['sync']);
|
||||
$fdexp = explode(',',$syncArr['data'][2]);
|
||||
if($fdexp[0]&&$fdexp[1]&&$syncArr['data'][3]) {
|
||||
$syncQue = $fdexp[1].'='.$fdexp[1].'+1';
|
||||
getDbUpdate($syncArr['data'][3],$syncQue,$fdexp[0].'='.$syncArr['data'][1]);
|
||||
}
|
||||
getDbUpdate($table['s_upload'],'down=down+1','uid='.$R['uid']);
|
||||
getDbUpdate($table['s_numinfo'],'download=download+1',"date='".$date['today']."' and site=".$s);
|
||||
}
|
||||
|
||||
header("Content-Type: application/octet-stream");
|
||||
header("Content-Length: " .$filesize);
|
||||
header('Content-Disposition: attachment; filename="'.$filename.'"');
|
||||
header("Cache-Control: private, must-revalidate");
|
||||
header("Pragma: no-cache");
|
||||
header("Expires: 0");
|
||||
|
||||
if ($R['fserver']) {
|
||||
|
||||
$_filepath = $g['path_tmp'].'session/'.$filetmpname;
|
||||
$fp = fopen($_filepath, "rb");
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $filepath);
|
||||
curl_setopt($ch, CURLOPT_FAILONERROR, true);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
||||
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
|
||||
curl_setopt($ch, CURLOPT_BINARYTRANSFER,true);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_setopt($ch, CURLOPT_FILE, $fp);
|
||||
$file = curl_exec($ch);
|
||||
if(!$file) {
|
||||
echo "에러 :- ".curl_error($ch);
|
||||
}
|
||||
|
||||
if (!fpassthru($fp)) fclose($fp);
|
||||
unlink($_filepath);
|
||||
|
||||
} else {
|
||||
|
||||
$fp = fopen($filepath, 'rb');
|
||||
if (!fpassthru($fp)) fclose($fp);
|
||||
}
|
||||
|
||||
exit;
|
||||
?>
|
||||
37
modules/mediaset/action/a.edit.php
Normal file
37
modules/mediaset/action/a.edit.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
if(!defined('__KIMS__')) exit;
|
||||
|
||||
$result=array();
|
||||
$result['error']=false;
|
||||
|
||||
// 보이기 숨기기
|
||||
if($act=='showhide'){
|
||||
if($showhide=='show') getDbUpdate($table['s_upload'],'hidden=0','uid='.$uid);
|
||||
else getDbUpdate($table['s_upload'],'hidden=1','uid='.$uid);
|
||||
|
||||
}else if($act=='insert'){
|
||||
getDbUpdate($table['s_upload'],'hidden=1','uid='.$uid);
|
||||
|
||||
}else if($act=='save-photo'||$act=='save-file'||$act=='save'){
|
||||
$name=$filename.'.'.$fileext;
|
||||
$name=trim($name);
|
||||
$filecaption=trim($filecaption);
|
||||
|
||||
$QVAL="name='$name',caption='$filecaption'";
|
||||
getDbUpdate($table['s_upload'],$QVAL,'uid='.$uid);
|
||||
|
||||
$result['filename']=$filename;
|
||||
$result['fileext']=$fileext;
|
||||
$result['filetype']=$filetype;
|
||||
$result['filecaption']=$filecaption;
|
||||
$result['filesrc']=$filesrc;
|
||||
}else if($act=='editTag'){
|
||||
|
||||
$QVAL="tag='$tag'";
|
||||
getDbUpdate($table['s_upload'],$QVAL,'uid='.$uid);
|
||||
|
||||
}
|
||||
echo json_encode($result,true);
|
||||
|
||||
exit;
|
||||
?>
|
||||
16
modules/mediaset/action/a.edit_link.php
Normal file
16
modules/mediaset/action/a.edit_link.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
if(!defined('__KIMS__')) exit;
|
||||
$result=array();
|
||||
$result['error']=false;
|
||||
|
||||
if($act=='delete') getDbDelete($table['s_link'],'uid='.$uid);
|
||||
else if($act=='showhide'){
|
||||
if($showhide=='show') getDbUpdate($table['s_link'],'hidden=0','uid='.$uid);
|
||||
else getDbUpdate($table['s_link'],'hidden=1','uid='.$uid);
|
||||
}
|
||||
|
||||
$result['msg']='ok';
|
||||
|
||||
echo json_encode($result,true);
|
||||
exit;
|
||||
?>
|
||||
49
modules/mediaset/action/a.ftp_check.php
Normal file
49
modules/mediaset/action/a.ftp_check.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
if(!defined('__KIMS__')) exit;
|
||||
|
||||
checkAdmin(0);
|
||||
|
||||
$FTP_CONNECT = ftp_connect($ftp_host,$ftp_port);
|
||||
$FTP_CRESULT = ftp_login($FTP_CONNECT,$ftp_user,$ftp_pass);
|
||||
|
||||
if ($FTP_CONNECT && $FTP_CRESULT):
|
||||
|
||||
$FTP_PASV = true;
|
||||
if($ftp_pasv)
|
||||
{
|
||||
$FTP_PASV = ftp_pasv($FTP_CONNECT, true);
|
||||
}
|
||||
$FTP_CHDIR = ftp_chdir($FTP_CONNECT,$ftp_folder);
|
||||
if (!$FTP_PASV) $_msg = 'Passive Mode 를 확인하세요.';
|
||||
if (!$FTP_CHDIR || substr($ftp_folder,-1)!='/' || substr($ftp_urlpath,-1)!='/') $_msg = '첨부할 폴더와 URL경로를 확인하세요.';
|
||||
if ($FTP_PASV && $FTP_CHDIR):
|
||||
?>
|
||||
<script>
|
||||
alert('정상적으로 FTP 연결이 확인되었습니다.');
|
||||
parent.getId('ftpbtn').innerHTML = '<i class="fa fa-info-circle fa-lg fa-fw"></i> 정상';
|
||||
parent.submitFlag = false;
|
||||
parent.document.procForm.a.value = 'config';
|
||||
parent.document.procForm.ftp_connect.value = '1';
|
||||
</script>
|
||||
<?php else:?>
|
||||
<script>
|
||||
alert('FTP 연결이 되지 않았습니다. <?php echo $_msg?>');
|
||||
parent.getId('ftpbtn').innerHTML = '<i class="fa fa-question fa-lg fa-fw"></i> 확인요망';
|
||||
parent.submitFlag = false;
|
||||
parent.document.procForm.a.value = 'config';
|
||||
parent.document.procForm.ftp_connect.value = '';
|
||||
</script>
|
||||
<?php endif?>
|
||||
<?php else:?>
|
||||
<script>
|
||||
alert('FTP 연결이 되지 않았습니다. FTP정보를 확인해 주세요.');
|
||||
parent.getId('ftpbtn').innerHTML = '<i class="fa fa-question fa-lg fa-fw"></i> 확인요망';
|
||||
parent.submitFlag = false;
|
||||
parent.document.procForm.a.value = 'config';
|
||||
parent.document.procForm.ftp_connect.value = '';
|
||||
</script>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
exit;
|
||||
?>
|
||||
27
modules/mediaset/action/a.getAttachFileList.php
Normal file
27
modules/mediaset/action/a.getAttachFileList.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
if(!defined('__KIMS__')) exit;
|
||||
|
||||
$p_module = $_POST['p_module'];
|
||||
$uid = $_POST['uid'];
|
||||
$mod = $_POST['mod'];
|
||||
$theme_file = $_POST['theme_file'];
|
||||
$theme = $theme_file;
|
||||
|
||||
$R = getUidData($table[$p_module.'data'],$uid);
|
||||
|
||||
$result=array();
|
||||
$result['error']=false;
|
||||
|
||||
include_once $g['path_module'].'mediaset/themes/'.$theme_file.'/main.func.php';
|
||||
|
||||
if($R['upload']) {
|
||||
$result['file'] = getAttachFileList($R,$mod,'file',$p_module);
|
||||
$result['photo'] = getAttachFileList($R,$mod,'photo',$p_module);
|
||||
$result['photo_full'] = getAttachPhotoSwipeFull($R);
|
||||
$result['video'] = getAttachFileList($R,$mod,'video',$p_module);
|
||||
$result['audio'] = getAttachFileList($R,$mod,'audio',$p_module);
|
||||
}
|
||||
|
||||
echo json_encode($result);
|
||||
exit;
|
||||
?>
|
||||
15
modules/mediaset/action/a.get_attachForm.php
Normal file
15
modules/mediaset/action/a.get_attachForm.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
$getWidget=$_GET['getWidget']; // 위젯
|
||||
$parent_module=$_GET['parent_module']; // 첨부파일 사용하는 모듈
|
||||
$parent_data=$_GET['parent_data']; // 해당 포스트 데이타 (수정시 필요)
|
||||
$attach_theme=$_GET['attach_theme']; // 첨부파일 테마
|
||||
$attach_mod=$_GET['attach_mod']; // main, list...
|
||||
$attach_handler_file=$_GET['attach_handler_file']; //파일첨부 실행 엘리먼트 button or 기타 엘리먼트 data-role="" 형태로 하는 것을 권고
|
||||
$attach_handler_photo=$_GET['attach_handler_photo']; // 사진첨부 실행 엘리먼트 button or 기타 엘리먼트 data-role="" 형태로 하는 것을 권고
|
||||
$attach_handler_getModalList=$_GET['attach_handler_getModalList']; // 첨부파일 리스트 호출 handler
|
||||
$attach_object_type=$_GET['attach_object_type'];//첨부 대상에 따른 분류 : photo, file, link, video....
|
||||
|
||||
|
||||
getWidget($getWidget,array('parent_module'=>$parent_module,'theme'=>$attach_theme,'attach_handler_file'=>$attach_handler_file,'attach_handler_photo'=>$attach_handler_photo,'attach_handler_getModalList'=>$attach_handler_getModalList,'parent_data'=>$R));
|
||||
exit;
|
||||
?>
|
||||
12
modules/mediaset/action/a.get_attachTag.php
Normal file
12
modules/mediaset/action/a.get_attachTag.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
if(!defined('__KIMS__')) exit;
|
||||
|
||||
$U=getDbData($table['s_upload'],"src='".$src."'",'tag');
|
||||
|
||||
$result=array();
|
||||
$result['error'] = false;
|
||||
$result['tag'] = stripslashes($U['tag']);
|
||||
|
||||
echo json_encode($result);
|
||||
exit;
|
||||
?>
|
||||
13
modules/mediaset/action/a.modifygid.php
Normal file
13
modules/mediaset/action/a.modifygid.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
if(!defined('__KIMS__')) exit;
|
||||
|
||||
$result=array();
|
||||
$attach = getArrayString($attachfiles);
|
||||
|
||||
$i = 0;
|
||||
foreach($attach['data'] as $val) getDbUpdate($table['s_upload'],'gid='.($i++),'uid='.$val);
|
||||
|
||||
$result['error'] = false;
|
||||
echo json_encode($result);
|
||||
exit;
|
||||
?>
|
||||
51
modules/mediaset/action/a.multi_delete.php
Normal file
51
modules/mediaset/action/a.multi_delete.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
if(!defined('__KIMS__')) exit;
|
||||
|
||||
checkAdmin(0);
|
||||
|
||||
$g['mediasetVarForSite'] = $g['path_var'].'site/'.$r.'/'.$m.'.var.php';
|
||||
include_once file_exists($g['mediasetVarForSite']) ? $g['mediasetVarForSite'] : $g['dir_module'].'var/var.php';
|
||||
include_once $g['path_core'].'opensrc/aws-sdk-php/v3/aws-autoloader.php';
|
||||
|
||||
use Aws\S3\S3Client;
|
||||
|
||||
define('S3_KEY', $d['mediaset']['S3_KEY']); //발급받은 키.
|
||||
define('S3_SEC', $d['mediaset']['S3_SEC'] ); //발급받은 비밀번호.
|
||||
define('S3_REGION', $d['mediaset']['S3_REGION']); //S3 버킷의 리전.
|
||||
define('S3_BUCKET', $d['mediaset']['S3_BUCKET']); //버킷의 이름.
|
||||
|
||||
foreach($upfile_members as $val)
|
||||
{
|
||||
|
||||
$R = getUidData($table['s_upload'],$val);
|
||||
if ($R['uid'])
|
||||
{
|
||||
getDbDelete($table['s_upload'],'uid='.$R['uid']);
|
||||
getDbUpdate($table['s_numinfo'],'upload=upload-1',"date='".substr($R['d_regis'],0,8)."' and site=".$R['site']);
|
||||
|
||||
if ($R['fserver']==2)
|
||||
{
|
||||
$s3 = new S3Client([
|
||||
'version' => 'latest',
|
||||
'region' => S3_REGION,
|
||||
'credentials' => [
|
||||
'key' => S3_KEY,
|
||||
'secret' => S3_SEC,
|
||||
],
|
||||
]);
|
||||
|
||||
$s3->deleteObject([
|
||||
'Bucket' => S3_BUCKET,
|
||||
'Key' => $R['folder'].'/'.$R['tmpname']
|
||||
]);
|
||||
|
||||
}
|
||||
else {
|
||||
unlink($R['src']);
|
||||
//if($R['type']==2) unlink($g['path_file'].$R['folder'].'/'.$R['thumbname']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getLink('reload','parent.','','');
|
||||
?>
|
||||
89
modules/mediaset/action/a.saveLink.php
Normal file
89
modules/mediaset/action/a.saveLink.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
if(!defined('__KIMS__')) exit;
|
||||
|
||||
include $g['path_module'].'mediaset/themes/'.$theme.'/main.func.php';
|
||||
|
||||
$result=array();
|
||||
$result['error']=false;
|
||||
|
||||
$d_regis=$date['totime'];
|
||||
$mbruid=$my['uid'];
|
||||
|
||||
$fserver = 3;
|
||||
$caption= $title;
|
||||
$description= $description;
|
||||
$thumbnail_url_arr=parse_url($thumbnail_url);
|
||||
$thumbnail_host = $thumbnail_url_arr['scheme'].'://'.$thumbnail_url_arr['host'];
|
||||
$thumbnail_query= $thumbnail_url_arr['query'];
|
||||
$path_arr = explode('/',$thumbnail_url_arr['path']);
|
||||
$_tmpname = array_pop($path_arr);
|
||||
|
||||
$folder = str_replace($_tmpname,'',$thumbnail_url_arr['path']);
|
||||
$folder = substr($folder ,0,-1);
|
||||
$folder = substr($folder,1);
|
||||
|
||||
$tmpname = $_tmpname.($thumbnail_query?'?'.$thumbnail_query:'');
|
||||
$src = $thumbnail_url;
|
||||
|
||||
if ($provider=='YouTube') {
|
||||
$url_arr = explode('=',$url);
|
||||
$name = $url_arr[1];
|
||||
} elseif ($provider=='Instagram' || $provider=='Google Maps') {
|
||||
$tmpname = md5($name).substr($date['totime'],8,14).'.jpg';
|
||||
$name = $tmpname;
|
||||
$savePath1 = $saveDir.substr($date['today'],0,4);
|
||||
$savePath2 = $savePath1.'/'.substr($date['today'],4,2);
|
||||
$savePath3 = $savePath2.'/'.substr($date['today'],6,2);
|
||||
$folder = substr($date['today'],0,4).'/'.substr($date['today'],4,2).'/'.substr($date['today'],6,2);
|
||||
$_photodata = getCURLData($thumbnail_url,'');
|
||||
|
||||
if ($_photodata) {
|
||||
$saveFile = $saveDir.$folder.'/'.$tmpname;
|
||||
$thumbnail_host = '';
|
||||
$size = filesize($saveFile);
|
||||
$src = str_replace('.','',$saveDir).$folder.'/'.$tmpname;
|
||||
$folder = str_replace('./','',$saveDir).$folder;
|
||||
$fserver = 0;
|
||||
for ($i = 1; $i < 4; $i++) {
|
||||
if (!is_dir(${'savePath'.$i})) {
|
||||
mkdir(${'savePath'.$i},0707);
|
||||
@chmod(${'savePath'.$i},0707);
|
||||
}
|
||||
}
|
||||
$fp = fopen($saveFile, "w");
|
||||
fwrite($fp,$_photodata);
|
||||
@chmod($saveFile,0707);
|
||||
fclose($fp);
|
||||
}
|
||||
} else {
|
||||
$name = $tmpname;
|
||||
}
|
||||
|
||||
$linkurl= $url;
|
||||
$fileExt = getExt($_tmpname);
|
||||
$fileExt = $fileExt == 'jpeg' ? 'jpg' : $fileExt;
|
||||
|
||||
if($uid){
|
||||
|
||||
$QVAL1 = "caption='$title',description='$description',time='$time',tag='$tag' ";
|
||||
getDbUpdate($table['s_upload'],$QVAL1,'uid='.$uid);
|
||||
|
||||
$NOWUID=$uid;
|
||||
}else{
|
||||
|
||||
$mingid = getDbCnt($table['s_upload'],'min(gid)','');
|
||||
$gid = $mingid ? $mingid - 1 : 100000000;
|
||||
|
||||
$QKEY = "gid,pid,parent,hidden,tmpcode,site,mbruid,fileonly,type,ext,fserver,host,folder,name,tmpname,size,width,height,caption,description,src,provider,author,down,d_regis,d_update,linkurl,time,duration,tag";
|
||||
$QVAL = "'$gid','$gid','$parent','$hidden','$tmpcode','$s','$mbruid','0','$type','$fileExt','$fserver','$thumbnail_host','$folder','$name','$tmpname','$size','$width','$height','$caption','$description','$src','$provider','$author','$down','$d_regis','$d_update','$linkurl','$time','$duration','$tag'";
|
||||
getDbInsert($table['s_upload'],$QKEY,$QVAL);
|
||||
$NOWUID= getDbCnt($table['s_upload'],'max(uid)','');
|
||||
}
|
||||
|
||||
$R=getUidData($table['s_upload'],$NOWUID);
|
||||
$result['last_uid']=$NOWUID;
|
||||
$result['list']=getAttachPlatform($R,'','',$wysiwyg);
|
||||
$result['table']=$table['s_upload'];
|
||||
echo json_encode($result,true);
|
||||
exit;
|
||||
?>
|
||||
227
modules/mediaset/action/a.upload.php
Normal file
227
modules/mediaset/action/a.upload.php
Normal file
@@ -0,0 +1,227 @@
|
||||
<?php
|
||||
if(!defined('__KIMS__')) exit;
|
||||
|
||||
if (!$_SESSION['upsescode']) $_SESSION['upsescode'] = str_replace('.','',$g['time_start']);
|
||||
$sescode = $_SESSION['upsescode'];
|
||||
$sess_Code =$sescode.'_'.$my['uid']; // 코드- 회원 uid
|
||||
|
||||
// 업로드 디렉토리 없는 경우 추가
|
||||
if(!is_dir($saveDir)){
|
||||
mkdir($saveDir,0707);
|
||||
@chmod($saveDir,0707);
|
||||
}
|
||||
|
||||
include $g['path_module'].'mediaset/themes/'.$theme.'/main.func.php';
|
||||
include $g['path_module'].'mediaset/themes/'.$theme.'/_var.php';
|
||||
$g['mediasetVarForSite'] = $g['path_var'].'site/'.$r.'/'.$m.'.var.php';
|
||||
include_once file_exists($g['mediasetVarForSite']) ? $g['mediasetVarForSite'] : $g['dir_module'].'var/var.php';
|
||||
include $g['path_core'].'function/thumb.func.php';
|
||||
|
||||
$sessArr = explode('_',$sess_Code);
|
||||
$tmpcode = $sessArr[0];
|
||||
$mbruid = $sessArr[1];
|
||||
$fserver = $d['mediaset']['use_fileserver'];
|
||||
$name = strtolower($_FILES['files']['name']);
|
||||
$size = $_FILES['files']['size'];
|
||||
$width = 0;
|
||||
$height = 0;
|
||||
$caption = trim($caption);
|
||||
$down = 0;
|
||||
$d_regis = $date['totime'];
|
||||
$d_update = '';
|
||||
$fileExt = getExt($name);
|
||||
$fileExt = $fileExt == 'jpeg' ? 'jpg' : $fileExt;
|
||||
$type = getFileType($fileExt);
|
||||
$tmpname = md5($name).substr($date['totime'],8,14);
|
||||
|
||||
include_once $g['path_core'].'opensrc/aws-sdk-php/v3/aws-autoloader.php';
|
||||
|
||||
use Aws\S3\S3Client;
|
||||
|
||||
define('S3_KEY', $d['mediaset']['S3_KEY']); //발급받은 키.
|
||||
define('S3_SEC', $d['mediaset']['S3_SEC'] ); //발급받은 비밀번호.
|
||||
define('S3_REGION', $d['mediaset']['S3_REGION']); //S3 버킷의 리전.
|
||||
define('S3_BUCKET', $d['mediaset']['S3_BUCKET']); //버킷의 이름.
|
||||
|
||||
if ($type == 2 || $type == 4 || $type == 5 ) {
|
||||
$tmpname = $tmpname.'.'.$fileExt;
|
||||
}
|
||||
|
||||
if ($d['theme']['hidden_photo'] == 1 && $type == 2) {
|
||||
$hidden = 1;
|
||||
}
|
||||
|
||||
if ($d['mediaset']['up_ext_cut'] && strstr($d['mediaset']['up_ext_cut'],$fileExt))
|
||||
{
|
||||
$code='200';
|
||||
$msg='정상적인 접근이 아닙니다.';
|
||||
$result=array($code,$msg);
|
||||
echo json_encode($result);
|
||||
exit;
|
||||
}
|
||||
|
||||
$savePath1 = $saveDir.substr($date['today'],0,4);
|
||||
$savePath2 = $savePath1.'/'.substr($date['today'],4,2);
|
||||
$savePath3 = $savePath2.'/'.substr($date['today'],6,2);
|
||||
$folder = substr($date['today'],0,4).'/'.substr($date['today'],4,2).'/'.substr($date['today'],6,2);
|
||||
|
||||
if(isset($_FILES["files"])) {
|
||||
|
||||
if ($fserver==1) {
|
||||
|
||||
$host = $d['mediaset']['ftp_urlpath'];
|
||||
|
||||
$FTP_CONNECT = ftp_connect($d['mediaset']['ftp_host'],$d['mediaset']['ftp_port']);
|
||||
$FTP_CRESULT = ftp_login($FTP_CONNECT,$d['mediaset']['ftp_user'],$d['mediaset']['ftp_pass']);
|
||||
if ($d['mediaset']['ftp_pasv']) ftp_pasv($FTP_CONNECT, true);
|
||||
if (!$FTP_CONNECT) exit;
|
||||
if (!$FTP_CRESULT) exit;
|
||||
|
||||
// getLink('','',$FTP_CONNECT.' 여기까지','');
|
||||
|
||||
ftp_chdir($FTP_CONNECT,$d['mediaset']['ftp_folder']);
|
||||
|
||||
for ($i = 1; $i < 4; $i++)
|
||||
{
|
||||
// getLink('','',$d['mediaset']['ftp_folder'].str_replace('./files/','',${'savePath'.$i}).'여기까지','');
|
||||
ftp_mkdir($FTP_CONNECT,$d['mediaset']['ftp_folder'].str_replace('./files/','',${'savePath'.$i}));
|
||||
}
|
||||
|
||||
if ($Overwrite == 'true' || !is_file($saveFile))
|
||||
{
|
||||
if ($type == 2)
|
||||
{
|
||||
ResizeWidth($_FILES['files']['tmp_name'],$_FILES['files']['tmp_name'],$d['mediaset']['thumbsize']);
|
||||
@chmod($_FILES['files']['tmp_name'],0707);
|
||||
$IM = getimagesize($_FILES['files']['tmp_name']);
|
||||
$width = $IM[0];
|
||||
$height= $IM[1];
|
||||
}
|
||||
}
|
||||
ftp_put($FTP_CONNECT,$d['mediaset']['ftp_folder'].$folder.'/'.$tmpname,$_FILES['files']['tmp_name'],FTP_BINARY);
|
||||
ftp_close($FTP_CONNECT);
|
||||
|
||||
} elseif ($fserver==2) {
|
||||
|
||||
$s3 = new S3Client([
|
||||
'version' => 'latest',
|
||||
'region' => S3_REGION,
|
||||
'credentials' => [
|
||||
'key' => S3_KEY,
|
||||
'secret' => S3_SEC,
|
||||
],
|
||||
]);
|
||||
|
||||
// 파일 업로드
|
||||
$host= 'https://'.S3_BUCKET.'.s3.'.S3_REGION.'.amazonaws.com';
|
||||
$folder = str_replace('./files/','',$saveDir).$folder;
|
||||
$src = $host.'/'.$folder.'/'.$tmpname;
|
||||
|
||||
if ($type == 2) {
|
||||
if ($fileExt == 'jpg') exifRotate($_FILES['files']['tmp_name']); //가로세로 교정
|
||||
ResizeWidth($_FILES['files']['tmp_name'],$_FILES['files']['tmp_name'],$d['mediaset']['thumbsize']);
|
||||
@chmod($_FILES['files']['tmp_name'],0707);
|
||||
$IM = getimagesize($_FILES['files']['tmp_name']);
|
||||
$width = $IM[0];
|
||||
$height= $IM[1];
|
||||
}
|
||||
|
||||
try {
|
||||
$s3->putObject(Array(
|
||||
'ACL'=>'public-read',
|
||||
'SourceFile'=>$_FILES['files']['tmp_name'],
|
||||
'Bucket'=>S3_BUCKET,
|
||||
'Key'=>$folder.'/'.$tmpname,
|
||||
'ContentType'=>$_FILES['files']['type']
|
||||
));
|
||||
unlink($_FILES['files']['tmp_name']);
|
||||
|
||||
} catch (Aws\S3\Exception\S3Exception $e) {
|
||||
$result['error'] = 'AwS S3에 파일을 업로드하는 중 오류가 발생했습니다.';
|
||||
}
|
||||
|
||||
} else {
|
||||
$host = '';
|
||||
$folder = str_replace('.','',$saveDir).$folder;
|
||||
$src = $folder.'/'.$tmpname;
|
||||
|
||||
for ($i = 1; $i < 4; $i++)
|
||||
{
|
||||
if (!is_dir(${'savePath'.$i}))
|
||||
{
|
||||
mkdir(${'savePath'.$i},0707);
|
||||
@chmod(${'savePath'.$i},0707);
|
||||
}
|
||||
}
|
||||
|
||||
$folder = substr($folder,1);
|
||||
$saveFile = $savePath3.'/'.$tmpname;
|
||||
|
||||
if ($Overwrite == 'true' || !is_file($saveFile))
|
||||
{
|
||||
move_uploaded_file($_FILES['files']['tmp_name'], $saveFile);
|
||||
if ($type == 2)
|
||||
{
|
||||
if ($fileExt == 'jpg') exifRotate($saveFile); //가로세로 교정
|
||||
$IM = getimagesize($saveFile);
|
||||
|
||||
if ($IM[0] >= $IM[1]) {
|
||||
ResizeWidth($saveFile,$saveFile,$d['mediaset']['thumbsize']);
|
||||
} else {
|
||||
ResizeHeight($saveFile,$saveFile,$d['mediaset']['thumbsize']);
|
||||
}
|
||||
|
||||
$_IM = getimagesize($saveFile); // 리사이징된 크기 다시 측정
|
||||
$width = $_IM[0];
|
||||
$height= $_IM[1];
|
||||
}
|
||||
@chmod($saveFile,0707);
|
||||
}
|
||||
|
||||
}
|
||||
// DB 저장
|
||||
$mingid = getDbCnt($table['s_upload'],'min(gid)','');
|
||||
$gid = $mingid ? $mingid - 1 : 100000000;
|
||||
|
||||
$QKEY = "gid,pid,parent,hidden,tmpcode,site,mbruid,fileonly,type,ext,fserver,host,folder,name,tmpname,size,width,height,caption,src,down,d_regis,d_update";
|
||||
$QVAL = "'$gid','$gid','$parent','$hidden','$tmpcode','$s','$mbruid','1','$type','$fileExt','$fserver','$host','$folder','$name','$tmpname','$size','$width','$height','$caption','$src','$down','$d_regis','$d_update'";
|
||||
getDbInsert($table['s_upload'],$QKEY,$QVAL);
|
||||
|
||||
if ($gid == 100000000) db_query("OPTIMIZE TABLE ".$table['s_upload'],$DB_CONNECT);
|
||||
|
||||
$lastuid= getDbCnt($table['s_upload'],'max(uid)','');
|
||||
$R=getUidData($table['s_upload'],$lastuid);
|
||||
|
||||
$result=array();
|
||||
// main.func.php 파일 getAttachFile 함수 참조
|
||||
|
||||
if ($type==4) {
|
||||
$preview_default=getAttachFile($R,'upload','',$wysiwyg); // 빈값은 대표이미지 uid 이다. (최초 등록시에는 없다.)
|
||||
$preview_modal=getAttachFile($R,'modal','');
|
||||
} elseif($type==5) {
|
||||
$preview_default=getAttachVideo($R,'upload','',$wysiwyg); // 빈값은 대표이미지 uid 이다. (최초 등록시에는 없다.)
|
||||
$preview_modal=getAttachVideo($R,'modal','');
|
||||
} else {
|
||||
$preview_default=getAttachFile($R,'upload','',$wysiwyg); // 빈값은 대표이미지 uid 이다. (최초 등록시에는 없다.)
|
||||
// $preview_modal=getAttachFile($R,'modal','');
|
||||
}
|
||||
|
||||
$result['preview_default']=$preview_default;
|
||||
$result['preview_modal']=$preview_modal; // 모달 리스트 출력용 (소스복사외 다른 메뉴는 없다.)
|
||||
|
||||
if ($type==2) {
|
||||
$result['type']='photo';
|
||||
} else if($type==4) {
|
||||
$result['type']='audio';
|
||||
} else if($type==5) {
|
||||
$result['type']='video';
|
||||
} else {
|
||||
$result['type']='file';
|
||||
}
|
||||
|
||||
$result['url']= $src; //ckeditor5 전달용
|
||||
|
||||
echo json_encode($result,true);
|
||||
}
|
||||
exit;
|
||||
?>
|
||||
136
modules/mediaset/action/a.upload_randomfield.php
Normal file
136
modules/mediaset/action/a.upload_randomfield.php
Normal file
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
if(!defined('__KIMS__')) exit;
|
||||
|
||||
if (!$_SESSION['upsescode']) $_SESSION['upsescode'] = str_replace('.','',$g['time_start']);
|
||||
$sescode = $_SESSION['upsescode'];
|
||||
$sess_Code =$sescode.'_'.$my['uid']; // 코드- 회원 uid
|
||||
|
||||
// 업로드 디렉토리 없는 경우 추가
|
||||
if(!is_dir($saveDir)){
|
||||
mkdir($saveDir,0707);
|
||||
@chmod($saveDir,0707);
|
||||
}
|
||||
|
||||
include $g['path_module'].'mediaset/themes/'.$theme.'/main.func.php';
|
||||
$g['mediasetVarForSite'] = $g['path_var'].'site/'.$r.'/'.$m.'.var.php';
|
||||
include_once file_exists($g['mediasetVarForSite']) ? $g['mediasetVarForSite'] : $g['dir_module'].'var/var.php';
|
||||
include $g['path_core'].'function/thumb.func.php';
|
||||
|
||||
$sessArr = explode('_',$sess_Code);
|
||||
$tmpcode = $sessArr[0];
|
||||
$mbruid = $sessArr[1];
|
||||
$fserver = $d['mediaset']['up_use_fileserver'];
|
||||
$url = $fserver ? $d['mediaset']['ftp_urlpath'] : str_replace('.','',$saveDir);
|
||||
$name = strtolower($_FILES['files']['name']);
|
||||
$size = $_FILES['files']['size'];
|
||||
$width = 0;
|
||||
$height = 0;
|
||||
$caption = trim($caption);
|
||||
$down = 0;
|
||||
$d_regis = $date['totime'];
|
||||
$d_update = '';
|
||||
$fileExt = getExt($name);
|
||||
$fileExt = $fileExt == 'jpeg' ? 'jpg' : $fileExt;
|
||||
$type = getFileType($fileExt);
|
||||
$tmpname = md5($name).substr($date['totime'],8,14);
|
||||
$tmpname = $type == 2 ? $tmpname.'.'.$fileExt : $tmpname;
|
||||
$hidden = $type == 2 ? 1 : 0;
|
||||
|
||||
if ($d['mediaset']['up_ext_cut'] && strstr($d['mediaset']['up_ext_cut'],$fileExt))
|
||||
{
|
||||
$code='200';
|
||||
$msg='정상적인 접근이 아닙니다.';
|
||||
$result=array($code,$msg);
|
||||
echo json_encode($result);
|
||||
exit;
|
||||
}
|
||||
|
||||
$savePath1 = $saveDir.substr($date['today'],0,4);
|
||||
$savePath2 = $savePath1.'/'.substr($date['today'],4,2);
|
||||
$savePath3 = $savePath2.'/'.substr($date['today'],6,2);
|
||||
$folder = substr($date['today'],0,4).'/'.substr($date['today'],4,2).'/'.substr($date['today'],6,2);
|
||||
if(isset($_FILES["files"]))
|
||||
{
|
||||
if ($fserver)
|
||||
{
|
||||
$FTP_CONNECT = ftp_connect($d['mediaset']['ftp_host'],$d['mediaset']['ftp_port']);
|
||||
$FTP_CRESULT = ftp_login($FTP_CONNECT,$d['mediaset']['ftp_user'],$d['mediaset']['ftp_pass']);
|
||||
if ($d['mediaset']['ftp_pasv']) ftp_pasv($FTP_CONNECT, true);
|
||||
if (!$FTP_CONNECT) exit;
|
||||
if (!$FTP_CRESULT) exit;
|
||||
|
||||
ftp_chdir($FTP_CONNECT,$d['mediaset']['ftp_folder']);
|
||||
|
||||
for ($i = 1; $i < 4; $i++)
|
||||
{
|
||||
ftp_mkdir($FTP_CONNECT,$d['mediaset']['ftp_folder'].str_replace('./files/','',${'savePath'.$i}));
|
||||
}
|
||||
|
||||
if ($Overwrite == 'true' || !is_file($saveFile))
|
||||
{
|
||||
if ($type == 2)
|
||||
{
|
||||
$IM = getimagesize($_FILES['files']['tmp_name']);
|
||||
$width = $IM[0];
|
||||
$height= $IM[1];
|
||||
}
|
||||
}
|
||||
ftp_put($FTP_CONNECT,$d['mediaset']['ftp_folder'].$folder.'/'.$tmpname,$_FILES['files']['tmp_name'],FTP_BINARY);
|
||||
ftp_close($FTP_CONNECT);
|
||||
}
|
||||
else{
|
||||
|
||||
for ($i = 1; $i < 4; $i++)
|
||||
{
|
||||
if (!is_dir(${'savePath'.$i}))
|
||||
{
|
||||
mkdir(${'savePath'.$i},0707);
|
||||
@chmod(${'savePath'.$i},0707);
|
||||
}
|
||||
}
|
||||
|
||||
$saveFile = $savePath3.'/'.$tmpname;
|
||||
|
||||
if ($Overwrite == 'true' || !is_file($saveFile))
|
||||
{
|
||||
move_uploaded_file($_FILES['files']['tmp_name'], $saveFile);
|
||||
if ($type == 2)
|
||||
{
|
||||
// $thumbname = md5($tmpname).'.'.$fileExt;
|
||||
// $thumbFile = $savePath3.'/'.$thumbname;
|
||||
// ResizeWidth($saveFile,$thumbFile,150);
|
||||
// @chmod($thumbFile,0707);
|
||||
$IM = getimagesize($saveFile);
|
||||
$width = $IM[0];
|
||||
$height= $IM[1];
|
||||
}
|
||||
@chmod($saveFile,0707);
|
||||
}
|
||||
|
||||
}
|
||||
// DB 저장
|
||||
$mingid = getDbCnt($table['s_upload'],'min(gid)','');
|
||||
$gid = $mingid ? $mingid - 1 : 100000000;
|
||||
|
||||
$QKEY = "gid,pid,parent,hidden,tmpcode,mbruid,fileonly,type,ext,fserver,url,folder,name,tmpname,thumbname,size,width,height,caption,down,d_regis,d_update";
|
||||
$QVAL = "'$gid','$gid','$parent','$hidden','$tmpcode','$mbruid','1','$type','$fileExt','$fserver','$url','$folder','$name','$tmpname','$thumbname','$size','$width','$height','$caption','$down','$d_regis','$d_update'";
|
||||
getDbInsert($table['s_upload'],$QKEY,$QVAL);
|
||||
|
||||
if ($gid == 100000000) db_query("OPTIMIZE TABLE ".$table['s_upload'],$DB_CONNECT);
|
||||
|
||||
$lastuid= getDbCnt($table['s_upload'],'max(uid)','');
|
||||
$R=getUidData($table['s_upload'],$lastuid);
|
||||
|
||||
$result=array();
|
||||
// main.func.php 파일 getAttachFile 함수 참조
|
||||
$preview_default=getAttachFile($R['uid'],$parent_table,$parent_uid,$parent_field); // 빈값은 대표이미지 uid 이다. (최초 등록시에는 없다.)
|
||||
$result['preview_default']=$preview_default;
|
||||
$result['parent_table']=$parent_table;
|
||||
$result['parent_uid']=$parent_uid;
|
||||
$result['parent_field']=$parent_field;
|
||||
$result['type']=$type==2?'photo':'file';
|
||||
|
||||
echo json_encode($result,true);
|
||||
}
|
||||
exit;
|
||||
?>
|
||||
22
modules/mediaset/action/mediaset/a.caption_regis.php
Normal file
22
modules/mediaset/action/mediaset/a.caption_regis.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
if(!defined('__KIMS__')) exit;
|
||||
|
||||
if (!$uid) getLink('','',_LANG('a0002','mediaset'),'');
|
||||
$R = getUidData($table['s_upload'],$uid);
|
||||
if (!$R['uid']) getLink('','',_LANG('a0003','mediaset'),'');
|
||||
if (!$my['admin'] && $my['uid'] != $R['mbruid']) getLink('','',_LANG('a0004','mediaset'),'');
|
||||
|
||||
$name = trim($name);
|
||||
$name = str_replace('.'.$R['ext'],'',$name).'.'.$R['ext'];
|
||||
$name = strip_tags($name);
|
||||
$alt = strip_tags(trim($alt));
|
||||
$linkurl = trim($linkurl);
|
||||
$caption = $my['admin'] ? trim($caption) : strip_tags(trim($caption));
|
||||
$description = $my['admin'] ? trim($description) : strip_tags(trim($description));
|
||||
if ($R['type']<0) $src = trim($src);
|
||||
else $src = $R['src'];
|
||||
|
||||
getDbUpdate($table['s_upload'],"hidden='".$hidden."',name='".$name."',alt='".$alt."',caption='".$caption."',description='".$description."',src='".$src."',linkto='".$linkto."',license='".$license."',d_update='".$date['totime']."',linkurl='".$linkurl."'",'uid='.$R['uid']);
|
||||
setrawcookie('mediaset_result', rawurlencode('저장 되었습니다.|success')); // 처리여부 cookie 저장
|
||||
getLink('reload','parent.','','');
|
||||
?>
|
||||
20
modules/mediaset/action/mediaset/a.caption_regis_vod.php
Normal file
20
modules/mediaset/action/mediaset/a.caption_regis_vod.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
if(!defined('__KIMS__')) exit;
|
||||
|
||||
if (!$uid) getLink('','',_LANG('a0002','mediaset'),'');
|
||||
$R = getUidData($table['s_upload'],$uid);
|
||||
if (!$R['uid']) getLink('','',_LANG('a0003','mediaset'),'');
|
||||
if (!$my['admin'] && $my['uid'] != $R['mbruid']) getLink('','',_LANG('a0004','mediaset'),'');
|
||||
|
||||
$name = strip_tags(trim($name));
|
||||
$alt = strip_tags(trim($alt));
|
||||
$linkurl = trim($linkurl);
|
||||
$caption = $my['admin'] ? trim($caption) : strip_tags(trim($caption));
|
||||
$description = $my['admin'] ? trim($description) : strip_tags(trim($description));
|
||||
if ($R['type']<0) $src = trim($src);
|
||||
else $src = $R['src'];
|
||||
|
||||
getDbUpdate($table['s_upload'],"name='".$name."',alt='".$alt."',caption='".$caption."',description='".$description."',src='".$src."',license='".$license."',d_update='".$date['totime']."',linkurl='".$linkurl."'",'uid='.$R['uid']);
|
||||
|
||||
getLink('reload','parent.',_LANG('a0005','mediaset'),'');
|
||||
?>
|
||||
30
modules/mediaset/action/mediaset/a.category_add.php
Normal file
30
modules/mediaset/action/mediaset/a.category_add.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
if(!defined('__KIMS__')) exit;
|
||||
|
||||
if (!$my['uid']) getLink('','','로그인이 필요합니다.','');
|
||||
|
||||
if (getDbRows($table['s_uploadcat'],'site='.$s.' and name="'.$name.'"')) {
|
||||
getLink('','','동일한 카테고리가 있습니다.','');
|
||||
}
|
||||
|
||||
if (!getDbRows($table['s_uploadcat'],'mbruid='.$my['uid'].' and type='.$ablum_type))
|
||||
{
|
||||
getDbInsert($table['s_uploadcat'],'gid,site,mbruid,type,hidden,users,name,r_num,d_regis,d_update',"'0','".$s."','".$my['uid']."','".$ablum_type."','0','','none','0','".$date['totime']."',''");
|
||||
getDbInsert($table['s_uploadcat'],'gid,site,mbruid,type,hidden,users,name,r_num,d_regis,d_update',"'1','".$s."','".$my['uid']."','".$ablum_type."','0','','trash','0','".$date['totime']."',''");
|
||||
}
|
||||
|
||||
$MAXC = getDbCnt($table['s_uploadcat'],'max(gid)','mbruid='.$my['uid'].' and type='.$ablum_type);
|
||||
$sarr = explode(',',trim($name));
|
||||
$slen = count($sarr);
|
||||
|
||||
for ($i = 0 ; $i < $slen; $i++)
|
||||
{
|
||||
$xname = trim($sarr[$i]);
|
||||
if (!$xname) continue;
|
||||
if ($xname == 'none' || $xname == 'trash') continue;
|
||||
$gid = $MAXC+1+$i;
|
||||
getDbInsert($table['s_uploadcat'],'gid,site,mbruid,type,hidden,users,name,r_num,d_regis,d_update',"'$gid','".$s."','".$my['uid']."','".$ablum_type."','0','','".$xname."','0','".$date['totime']."',''");
|
||||
}
|
||||
setrawcookie('mediaset_result', rawurlencode('카테고리가 추가 되었습니다..|success')); // 처리여부 cookie 저장
|
||||
getLink('reload','parent.','','');
|
||||
?>
|
||||
15
modules/mediaset/action/mediaset/a.category_delete.php
Normal file
15
modules/mediaset/action/mediaset/a.category_delete.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
if(!defined('__KIMS__')) exit;
|
||||
|
||||
if (!$my['uid'] || $category < 1) getLink('','',_LANG('a0001','mediaset'),'');
|
||||
|
||||
$_CT = getUidData($table['s_uploadcat'],$category);
|
||||
if (!$_CT['uid']) getLink('','',_LANG('a0001','mediaset'),'');
|
||||
if ($my['uid'] != $_CT['mbruid']) getLink('','',_LANG('a1001','mediaset'),'');
|
||||
|
||||
getDbDelete($table['s_uploadcat'],'uid='.$_CT['uid']);
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num+'.$_CT['r_num'],"mbruid=".$my['uid']." and type=".$ablum_type." and name='trash'");
|
||||
getDbUpdate($table['s_upload'],'category=-1','category='.$_CT['uid']);
|
||||
setrawcookie('mediaset_result', rawurlencode('카테고리가 삭제 되었습니다.|success')); // 처리여부 cookie 저장
|
||||
getLink('reload','parent.','','');
|
||||
?>
|
||||
52
modules/mediaset/action/mediaset/a.download.php
Normal file
52
modules/mediaset/action/mediaset/a.download.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
if(!defined('__KIMS__')) exit;
|
||||
|
||||
$g['mediasetVarForSite'] = $g['path_var'].'site/'.$r.'/'.$m.'.var.php';
|
||||
include_once file_exists($g['mediasetVarForSite']) ? $g['mediasetVarForSite'] : $g['dir_module'].'var/var.php';
|
||||
|
||||
$R=getUidData($table['s_upload'],$uid);
|
||||
if (!$R['uid']) getLink('','',_LANG('a2001','mediaset'),'');
|
||||
if ($R['type'] < 1) return getLink('','',_LANG('a2002','mediaset'),'');
|
||||
|
||||
|
||||
$filename = getUTFtoKR($R['name']);
|
||||
$filetmpname = getUTFtoKR($R['tmpname']);
|
||||
|
||||
if ($R['url']==$d['mediaset']['ftp_urlpath'])
|
||||
{
|
||||
$filepath = $d['mediaset']['ftp_urlpath'].$R['folder'].'/'.$filetmpname;
|
||||
$filesize = $R['size'];
|
||||
}
|
||||
else {
|
||||
$filepath = $g['path_file'].$R['folder'].'/'.$filetmpname;
|
||||
$filesize = filesize($filepath);
|
||||
}
|
||||
|
||||
header("Content-Type: application/octet-stream");
|
||||
header("Content-Length: " .$filesize);
|
||||
header('Content-Disposition: attachment; filename="'.$filename.'"');
|
||||
header("Cache-Control: private, must-revalidate");
|
||||
header("Pragma: no-cache");
|
||||
header("Expires: 0");
|
||||
|
||||
if ($R['fserver'] && $R['url'] == $d['mediaset']['ftp_urlpath'])
|
||||
{
|
||||
$FTP_CONNECT = ftp_connect($d['mediaset']['ftp_host'],$d['mediaset']['ftp_port']);
|
||||
$FTP_CRESULT = ftp_login($FTP_CONNECT,$d['mediaset']['ftp_user'],$d['mediaset']['ftp_pass']);
|
||||
if (!$FTP_CONNECT) getLink('','',_LANG('a2003','mediaset'),'');
|
||||
if (!$FTP_CRESULT) getLink('','',_LANG('a2004','mediaset'),'');
|
||||
if($d['mediaset']['ftp_pasv']) ftp_pasv($FTP_CONNECT, true);
|
||||
|
||||
$filepath = $g['path_tmp'].'session/'.$filetmpname;
|
||||
ftp_get($FTP_CONNECT,$filepath,$d['mediaset']['ftp_folder'].$R['folder'].'/'.$filetmpname,FTP_BINARY);
|
||||
ftp_close($FTP_CONNECT);
|
||||
$fp = fopen($filepath, 'rb');
|
||||
if (!fpassthru($fp)) fclose($fp);
|
||||
unlink($filepath);
|
||||
}
|
||||
else {
|
||||
$fp = fopen($filepath, 'rb');
|
||||
if (!fpassthru($fp)) fclose($fp);
|
||||
}
|
||||
exit;
|
||||
?>
|
||||
135
modules/mediaset/action/mediaset/a.files_delete.php
Normal file
135
modules/mediaset/action/mediaset/a.files_delete.php
Normal file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
if(!defined('__KIMS__')) exit;
|
||||
|
||||
$g['mediasetVarForSite'] = $g['path_var'].'site/'.$r.'/'.$m.'.var.php';
|
||||
include_once file_exists($g['mediasetVarForSite']) ? $g['mediasetVarForSite'] : $g['dir_module'].'var/var.php';
|
||||
include_once $g['path_core'].'opensrc/aws-sdk-php/v3/aws-autoloader.php';
|
||||
|
||||
use Aws\S3\S3Client;
|
||||
|
||||
define('S3_KEY', $d['mediaset']['S3_KEY']); //발급받은 키.
|
||||
define('S3_SEC', $d['mediaset']['S3_SEC'] ); //발급받은 비밀번호.
|
||||
define('S3_REGION', $d['mediaset']['S3_REGION']); //S3 버킷의 리전.
|
||||
define('S3_BUCKET', $d['mediaset']['S3_BUCKET']); //버킷의 이름.
|
||||
|
||||
foreach($photomembers as $file_uid)
|
||||
{
|
||||
$val = explode('|',$file_uid);
|
||||
$R = getUidData($table['s_upload'],$val[0]);
|
||||
if (!$my['admin'] && (!$R['mbruid'] || $my['uid'] != $R['mbruid']))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($dtype == 'move')
|
||||
{
|
||||
if ($R['category'] != $mcat)
|
||||
{
|
||||
getDbUpdate($table['s_upload'],'category='.$mcat,'uid='.$R['uid']);
|
||||
|
||||
if ($R['category'] == -1)
|
||||
{
|
||||
if ($mcat == 0)
|
||||
{
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num+1','mbruid='.$my['uid']." and type=1 and name='none'");
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num-1','mbruid='.$my['uid']." and type=1 and name='trash'");
|
||||
}
|
||||
if ($mcat > 0)
|
||||
{
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num+1','mbruid='.$my['uid'].' and uid='.$mcat);
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num-1','mbruid='.$my['uid']." and type=1 and name='trash'");
|
||||
}
|
||||
}
|
||||
if($R['category'] == 0)
|
||||
{
|
||||
if ($mcat == -1)
|
||||
{
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num-1','mbruid='.$my['uid']." and type=1 and name='none'");
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num+1','mbruid='.$my['uid']." and type=1 and name='trash'");
|
||||
}
|
||||
if ($mcat > 0)
|
||||
{
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num+1','mbruid='.$my['uid'].' and uid='.$mcat);
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num-1','mbruid='.$my['uid']." and type=1 and name='none'");
|
||||
}
|
||||
}
|
||||
if($R['category'] > 0)
|
||||
{
|
||||
if ($mcat == -1)
|
||||
{
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num-1','mbruid='.$my['uid'].' and uid='.$R['category']);
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num+1','mbruid='.$my['uid']." and type=1 and name='trash'");
|
||||
}
|
||||
if ($mcat == 0)
|
||||
{
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num-1','mbruid='.$my['uid'].' and uid='.$R['category']);
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num+1','mbruid='.$my['uid']." and type=1 and name='none'");
|
||||
}
|
||||
if ($mcat > 0)
|
||||
{
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num-1','mbruid='.$my['uid'].' and uid='.$R['category']);
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num+1','mbruid='.$my['uid'].' and uid='.$mcat);
|
||||
}
|
||||
}
|
||||
}
|
||||
setrawcookie('mediaset_result', rawurlencode('사진이 이동 되었습니다.|success')); // 처리여부 cookie 저장
|
||||
}
|
||||
else {
|
||||
|
||||
if ($R['uid'])
|
||||
{
|
||||
if ($mediaset != 'Y' || $dtype == 'delete')
|
||||
{
|
||||
getDbDelete($table['s_upload'],'uid='.$R['uid']);
|
||||
|
||||
if ($R['type']>0)
|
||||
{
|
||||
|
||||
if ($R['fserver']==2) {
|
||||
|
||||
$s3 = new S3Client([
|
||||
'version' => 'latest',
|
||||
'region' => S3_REGION,
|
||||
'credentials' => [
|
||||
'key' => S3_KEY,
|
||||
'secret' => S3_SEC,
|
||||
],
|
||||
]);
|
||||
|
||||
$s3->deleteObject([
|
||||
'Bucket' => S3_BUCKET,
|
||||
'Key' => $R['folder'].'/'.$R['tmpname']
|
||||
]);
|
||||
|
||||
}
|
||||
else {
|
||||
unlink('./'.$R['folder'].'/'.$R['tmpname']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($R['category'] > 0)
|
||||
{
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num-1','mbruid='.$my['uid'].' and type=1 and uid='.$R['category']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($R['category'] == -1)
|
||||
{
|
||||
if($dtype == 'delete') getDbUpdate($table['s_uploadcat'],'r_num=r_num-1','mbruid='.$my['uid']." and type=1 and name='trash'");
|
||||
}
|
||||
if ($R['category'] == 0)
|
||||
{
|
||||
getDbUpdate($table['s_upload'],'category=-1','uid='.$R['uid']);
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num-1','mbruid='.$my['uid']." and type=1 and name='none'");
|
||||
if ($mediaset == 'Y' && $dtype != 'delete') getDbUpdate($table['s_uploadcat'],'r_num=r_num+1','mbruid='.$my['uid']." and type=1 and name='trash'");
|
||||
}
|
||||
if($R['category'] > 0)
|
||||
{
|
||||
getDbUpdate($table['s_upload'],'category=-1','uid='.$R['uid']);
|
||||
if ($mediaset == 'Y' && $dtype != 'delete') getDbUpdate($table['s_uploadcat'],'r_num=r_num+1','mbruid='.$my['uid']." and type=1 and name='trash'");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
getLink('reload','parent.','','');
|
||||
?>
|
||||
121
modules/mediaset/action/mediaset/a.files_delete_vod.php
Normal file
121
modules/mediaset/action/mediaset/a.files_delete_vod.php
Normal file
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
if(!defined('__KIMS__')) exit;
|
||||
|
||||
$g['mediasetVarForSite'] = $g['path_var'].'site/'.$r.'/'.$m.'.var.php';
|
||||
include_once file_exists($g['mediasetVarForSite']) ? $g['mediasetVarForSite'] : $g['dir_module'].'var/var.php';
|
||||
|
||||
foreach($photomembers as $file_uid)
|
||||
{
|
||||
$val = explode('|',$file_uid);
|
||||
$R = getUidData($table['s_upload'],$val[0]);
|
||||
if (!$my['admin'] && (!$R['mbruid'] || $my['uid'] != $R['mbruid']))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($dtype == 'move')
|
||||
{
|
||||
if ($R['category'] != $mcat)
|
||||
{
|
||||
getDbUpdate($table['s_upload'],'category='.$mcat,'uid='.$R['uid']);
|
||||
|
||||
if ($R['category'] == -1)
|
||||
{
|
||||
if ($mcat == 0)
|
||||
{
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num+1','mbruid='.$my['uid']." and type=2 and name='none'");
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num-1','mbruid='.$my['uid']." and type=2 and name='trash'");
|
||||
}
|
||||
if ($mcat > 0)
|
||||
{
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num+1','mbruid='.$my['uid'].' and uid='.$mcat);
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num-1','mbruid='.$my['uid']." and type=2 and name='trash'");
|
||||
}
|
||||
}
|
||||
if($R['category'] == 0)
|
||||
{
|
||||
if ($mcat == -1)
|
||||
{
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num-1','mbruid='.$my['uid']." and type=2 and name='none'");
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num+1','mbruid='.$my['uid']." and type=2 and name='trash'");
|
||||
}
|
||||
if ($mcat > 0)
|
||||
{
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num+1','mbruid='.$my['uid'].' and uid='.$mcat);
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num-1','mbruid='.$my['uid']." and type=2 and name='none'");
|
||||
}
|
||||
}
|
||||
if($R['category'] > 0)
|
||||
{
|
||||
if ($mcat == -1)
|
||||
{
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num-1','mbruid='.$my['uid'].' and uid='.$R['category']);
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num+1','mbruid='.$my['uid']." and type=2 and name='trash'");
|
||||
}
|
||||
if ($mcat == 0)
|
||||
{
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num-1','mbruid='.$my['uid'].' and uid='.$R['category']);
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num+1','mbruid='.$my['uid']." and type=2 and name='none'");
|
||||
}
|
||||
if ($mcat > 0)
|
||||
{
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num-1','mbruid='.$my['uid'].' and uid='.$R['category']);
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num+1','mbruid='.$my['uid'].' and uid='.$mcat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
if ($R['uid'])
|
||||
{
|
||||
if ($mediaset != 'Y' || $dtype == 'delete')
|
||||
{
|
||||
getDbDelete($table['s_upload'],'uid='.$R['uid']);
|
||||
|
||||
if ($R['type'])
|
||||
{
|
||||
if ($R['fserver'] && $R['url'] == $d['mediaset']['ftp_urlpath'])
|
||||
{
|
||||
$FTP_CONNECT = ftp_connect($d['mediaset']['ftp_host'],$d['mediaset']['ftp_port']);
|
||||
$FTP_CRESULT = ftp_login($FTP_CONNECT,$d['mediaset']['ftp_user'],$d['mediaset']['ftp_pass']);
|
||||
if (!$FTP_CONNECT) continue;
|
||||
if (!$FTP_CRESULT) continue;
|
||||
if($d['mediaset']['ftp_pasv']) ftp_pasv($FTP_CONNECT, true);
|
||||
ftp_delete($FTP_CONNECT,$d['mediaset']['ftp_folder'].$R['folder'].'/'.$R['tmpname']);
|
||||
if($R['type']==2) ftp_delete($FTP_CONNECT,$d['mediaset']['ftp_folder'].$R['folder'].'/'.$R['thumbname']);
|
||||
ftp_close($FTP_CONNECT);
|
||||
}
|
||||
else {
|
||||
unlink($g['path_file'].$R['folder'].'/'.$R['tmpname']);
|
||||
if($R['type']==2) unlink($g['path_file'].$R['folder'].'/'.$R['thumbname']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($R['category'] > 0)
|
||||
{
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num-1','mbruid='.$my['uid'].' and type=2 and uid='.$R['category']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($R['category'] == -1)
|
||||
{
|
||||
if($dtype == 'delete') getDbUpdate($table['s_uploadcat'],'r_num=r_num-1','mbruid='.$my['uid']." and type=2 and name='trash'");
|
||||
}
|
||||
if ($R['category'] == 0)
|
||||
{
|
||||
getDbUpdate($table['s_upload'],'category=-1','uid='.$R['uid']);
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num-1','mbruid='.$my['uid']." and type=2 and name='none'");
|
||||
if ($mediaset == 'Y' && $dtype != 'delete') getDbUpdate($table['s_uploadcat'],'r_num=r_num+1','mbruid='.$my['uid']." and type=2 and name='trash'");
|
||||
}
|
||||
if($R['category'] > 0)
|
||||
{
|
||||
getDbUpdate($table['s_upload'],'category=-1','uid='.$R['uid']);
|
||||
if ($mediaset == 'Y' && $dtype != 'delete') getDbUpdate($table['s_uploadcat'],'r_num=r_num+1','mbruid='.$my['uid']." and type=2 and name='trash'");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getLink('reload','parent.','','');
|
||||
?>
|
||||
13
modules/mediaset/action/mediaset/a.files_order.php
Normal file
13
modules/mediaset/action/mediaset/a.files_order.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
if(!defined('__KIMS__')) exit;
|
||||
|
||||
$i = 0;
|
||||
foreach($photomembers as $file_uid)
|
||||
{
|
||||
$val = explode('|',$file_uid);
|
||||
getDbUpdate($table['s_upload'],'pid='.$i,'uid='.$val[0]);
|
||||
$i++;
|
||||
}
|
||||
setrawcookie('mediaset_result', rawurlencode('순서가 변경 되었습니다.|success')); // 처리여부 cookie 저장
|
||||
getLink('reload','parent.','','');
|
||||
?>
|
||||
76
modules/mediaset/action/mediaset/a.multi_delete.php
Normal file
76
modules/mediaset/action/mediaset/a.multi_delete.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
if(!defined('__KIMS__')) exit;
|
||||
|
||||
|
||||
|
||||
checkAdmin(0);
|
||||
|
||||
|
||||
function getuFileType($R)
|
||||
{
|
||||
if ($R['type'] == 2 || $R['type'] == -1) return 1;
|
||||
if ($R['type'] == 5 || $R['type'] == 0) return 2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
$g['mediasetVarForSite'] = $g['path_var'].'site/'.$r.'/'.$m.'.var.php';
|
||||
include_once file_exists($g['mediasetVarForSite']) ? $g['mediasetVarForSite'] : $g['dir_module'].'var/var.php';
|
||||
include_once $g['path_core'].'opensrc/aws-sdk-php/v3/aws-autoloader.php';
|
||||
|
||||
$_MEMBERS = array();
|
||||
|
||||
foreach($upfile_members as $val)
|
||||
|
||||
{
|
||||
|
||||
|
||||
$R = getUidData($table['s_upload'],$val);
|
||||
|
||||
if ($R['uid'])
|
||||
|
||||
{
|
||||
|
||||
getDbDelete($table['s_upload'],'uid='.$R['uid']);
|
||||
|
||||
|
||||
if ($R['type']>0)
|
||||
{
|
||||
|
||||
if ($R['fserver']==2) {
|
||||
|
||||
$s3 = new S3Client([
|
||||
'version' => 'latest',
|
||||
'region' => S3_REGION,
|
||||
'credentials' => [
|
||||
'key' => S3_KEY,
|
||||
'secret' => S3_SEC,
|
||||
],
|
||||
]);
|
||||
|
||||
$s3->deleteObject([
|
||||
'Bucket' => S3_BUCKET,
|
||||
'Key' => $R['folder'].'/'.$R['tmpname']
|
||||
]);
|
||||
|
||||
}
|
||||
else {
|
||||
unlink('./'.$R['folder'].'/'.$R['tmpname']);
|
||||
}
|
||||
}
|
||||
|
||||
$_type = getuFileType($R['type']);
|
||||
|
||||
if ($R['category'] == -1)
|
||||
{
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num-1','mbruid='.$R['mbruid']." and type=".$_type." and name='trash'");
|
||||
}
|
||||
if ($R['category'] == 0)
|
||||
{
|
||||
getDbUpdate($table['s_upload'],'category=-1','uid='.$R['uid']);
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num-1','mbruid='.$R['mbruid']." and type=".$_type." and name='none'");
|
||||
}
|
||||
if($R['category'] > 0)
|
||||
{
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num-1','mbruid='.$R['mbruid'].' and type='.$_type.' and uid='.$R['category']);
|
||||
getDbUpdate($table['s_upload'],'category=-1','uid='.$R['uid']);
|
||||
241
modules/mediaset/action/mediaset/a.upload.php
Normal file
241
modules/mediaset/action/mediaset/a.upload.php
Normal file
@@ -0,0 +1,241 @@
|
||||
<?php
|
||||
if(!defined('__KIMS__')) exit;
|
||||
|
||||
include $g['path_core'].'function/thumb.func.php';
|
||||
|
||||
$g['mediasetVarForSite'] = $g['path_var'].'site/'.$r.'/'.$m.'.var.php';
|
||||
include_once file_exists($g['mediasetVarForSite']) ? $g['mediasetVarForSite'] : $g['dir_module'].'var/var.php';
|
||||
|
||||
// 업로드 디렉토리 없는 경우 추가
|
||||
if(!is_dir($saveDir)){
|
||||
mkdir($saveDir,0707);
|
||||
@chmod($saveDir,0707);
|
||||
}
|
||||
|
||||
$savePath1 = $saveDir.substr($date['today'],0,4);
|
||||
$savePath2 = $savePath1.'/'.substr($date['today'],4,2);
|
||||
$savePath3 = $savePath2.'/'.substr($date['today'],6,2);
|
||||
$folder = substr($date['today'],0,4).'/'.substr($date['today'],4,2).'/'.substr($date['today'],6,2);
|
||||
|
||||
$upfileNum = count($_FILES['upfiles']['name']);
|
||||
$tmpcode = $mediaset == 'Y' ? '' : $_SESSION['upsescode'];
|
||||
$mbruid = $my['uid'];
|
||||
$fserver = $d['mediaset']['use_fileserver'];
|
||||
$d_regis = $date['totime'];
|
||||
$down = 0;
|
||||
$width = 0;
|
||||
$height = 0;
|
||||
$caption = '';
|
||||
$d_update = '';
|
||||
$alt = '';
|
||||
$description= '';
|
||||
$src = trim($src);
|
||||
$linkto = 0;
|
||||
$license = 0;
|
||||
$_fileonly = $fileonly == 'Y' ? 1 : 0;
|
||||
$linkurl = '';
|
||||
|
||||
include_once $g['path_core'].'opensrc/aws-sdk-php/v3/aws-autoloader.php';
|
||||
use Aws\S3\S3Client;
|
||||
|
||||
define('S3_KEY', $d['mediaset']['S3_KEY']); //발급받은 키.
|
||||
define('S3_SEC', $d['mediaset']['S3_SEC'] ); //발급받은 비밀번호.
|
||||
define('S3_REGION', $d['mediaset']['S3_REGION']); //S3 버킷의 리전.
|
||||
define('S3_BUCKET', $d['mediaset']['S3_BUCKET']); //버킷의 이름.
|
||||
|
||||
if ($type == 2 || $type == 4 || $type == 5 ) {
|
||||
$tmpname = $tmpname.'.'.$fileExt;
|
||||
}
|
||||
|
||||
if ($link != 'Y')
|
||||
{
|
||||
if ($fserver==1) {
|
||||
$host = $d['mediaset']['ftp_urlpath'];
|
||||
|
||||
$FTP_CONNECT = ftp_connect($d['mediaset']['ftp_host'],$d['mediaset']['ftp_port']);
|
||||
$FTP_CRESULT = ftp_login($FTP_CONNECT,$d['mediaset']['ftp_user'],$d['mediaset']['ftp_pass']);
|
||||
if (!$FTP_CONNECT) getLink('','',_LANG('a5001','mediaset'),'');
|
||||
if (!$FTP_CRESULT) getLink('','',_LANG('a5001','mediaset'),'');
|
||||
if($d['mediaset']['ftp_pasv']) ftp_pasv($FTP_CONNECT, true);
|
||||
ftp_chdir($FTP_CONNECT,$d['mediaset']['ftp_folder']);
|
||||
}
|
||||
|
||||
|
||||
for($i = 0; $i < $upfileNum; $i++) {
|
||||
|
||||
$name = strtolower($_FILES['upfiles']['name'][$i]);
|
||||
$size = $_FILES['upfiles']['size'][$i];
|
||||
$fileExt = getExt($name);
|
||||
$fileExt = $fileExt == 'jpeg' ? 'jpg' : $fileExt;
|
||||
$type = getFileType($fileExt);
|
||||
$tmpname = md5($name).substr($date['totime'],8,14);
|
||||
$tmpname = $type == 2 ? $tmpname.'.'.$fileExt : $tmpname;
|
||||
$hidden = $type == 2 ? 1 : 0;
|
||||
|
||||
if ($d['mediaset']['ext_cut'] && strstr($d['mediaset']['ext_cut'],$fileExt)) continue;
|
||||
|
||||
if ($fserver==1) {
|
||||
for ($j = 1; $j < 4; $j++)
|
||||
{
|
||||
@ftp_mkdir($FTP_CONNECT,$d['mediaset']['ftp_folder'].str_replace('./files/','',${'savePath'.$j}));
|
||||
}
|
||||
|
||||
if ($Overwrite == 'true' || !is_file($saveFile))
|
||||
{
|
||||
if ($type == 2)
|
||||
{
|
||||
$thumbname = md5($tmpname).'.'.$fileExt;
|
||||
$thumbFile = $g['path_tmp'].'backup/'.$thumbname;
|
||||
ResizeWidth($_FILES['upfiles']['tmp_name'][$i],$thumbFile,$d['mediaset']['thumbsize']);
|
||||
$IM = getimagesize($_FILES['upfiles']['tmp_name'][$i]);
|
||||
$width = $IM[0];
|
||||
$height= $IM[1];
|
||||
ftp_put($FTP_CONNECT,$d['mediaset']['ftp_folder'].$folder.'/'.$thumbname,$thumbFile,FTP_BINARY);
|
||||
unlink($thumbFile);
|
||||
}
|
||||
}
|
||||
ftp_put($FTP_CONNECT,$d['mediaset']['ftp_folder'].$folder.'/'.$tmpname,$_FILES['upfiles']['tmp_name'][$i],FTP_BINARY);
|
||||
ftp_close($FTP_CONNECT);
|
||||
|
||||
} elseif ($fserver==2) {
|
||||
|
||||
$name = strtolower($_FILES['upfiles']['name'][$i]);
|
||||
$size = $_FILES['upfiles']['size'][$i];
|
||||
$fileExt = getExt($name);
|
||||
$fileExt = $fileExt == 'jpeg' ? 'jpg' : $fileExt;
|
||||
$type = getFileType($fileExt);
|
||||
$tmpname = md5($name).substr($date['totime'],8,14);
|
||||
$tmpname = $type == 2 ? $tmpname.'.'.$fileExt : $tmpname;
|
||||
$hidden = $type == 2 ? 1 : 0;
|
||||
|
||||
// 파일 업로드
|
||||
$host= 'https://'.S3_BUCKET.'.s3.'.S3_REGION.'.amazonaws.com';
|
||||
$folder = str_replace('./files/','',$saveDir).$folder;
|
||||
$src = $host.'/'.$folder.'/'.$tmpname;
|
||||
|
||||
$s3 = new S3Client([
|
||||
'version' => 'latest',
|
||||
'region' => S3_REGION,
|
||||
'credentials' => [
|
||||
'key' => S3_KEY,
|
||||
'secret' => S3_SEC,
|
||||
],
|
||||
]);
|
||||
|
||||
if ($type == 2) {
|
||||
if ($fileExt == 'jpg') exifRotate($_FILES['upfiles']['tmp_name'][$i]); //가로세로 교정
|
||||
ResizeWidth($_FILES['upfiles']['tmp_name'][$i],$_FILES['upfiles']['tmp_name'][$i],$d['mediaset']['thumbsize']);
|
||||
@chmod($_FILES['upfiles']['tmp_name'][$i],0707);
|
||||
$IM = getimagesize($_FILES['upfiles']['tmp_name'][$i]);
|
||||
$width = $IM[0];
|
||||
$height= $IM[1];
|
||||
}
|
||||
|
||||
try {
|
||||
$s3->putObject(Array(
|
||||
'ACL'=>'public-read',
|
||||
'SourceFile'=>$_FILES['upfiles']['tmp_name'][$i],
|
||||
'Bucket'=>S3_BUCKET,
|
||||
'Key'=>$folder.'/'.$tmpname,
|
||||
'ContentType'=>$_FILES['upfiles']['type'][$i]
|
||||
));
|
||||
unlink($_FILES['upfiles']['tmp_name'][$i]);
|
||||
|
||||
// getLink('','',$_FILES['upfiles']['tmp_name'][$i].' 여기까지','');
|
||||
|
||||
} catch (Aws\S3\Exception\S3Exception $e) {
|
||||
$result['error'] = 'AwS S3에 파일을 업로드하는 중 오류가 발생했습니다.';
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$host = '';
|
||||
$folder = str_replace('.','',$saveDir).$folder;
|
||||
$src = $folder.'/'.$tmpname;
|
||||
|
||||
for ($j = 1; $j < 4; $j++)
|
||||
{
|
||||
if (!is_dir(${'savePath'.$j}))
|
||||
{
|
||||
mkdir(${'savePath'.$j},0707);
|
||||
@chmod(${'savePath'.$j},0707);
|
||||
}
|
||||
}
|
||||
|
||||
$saveFile = $savePath3.'/'.$tmpname;
|
||||
|
||||
if ($Overwrite == 'true' || !is_file($saveFile))
|
||||
{
|
||||
move_uploaded_file($_FILES['upfiles']['tmp_name'][$i], $saveFile);
|
||||
if ($type == 2)
|
||||
{
|
||||
if ($fileExt == 'jpg') exifRotate($_FILES['upfiles']['tmp_name']); //가로세로 교정
|
||||
ResizeWidth($_FILES['upfiles']['tmp_name'],$_FILES['upfiles']['tmp_name'],$d['mediaset']['thumbsize']);
|
||||
@chmod($_FILES['upfiles']['tmp_name'],0707);
|
||||
$IM = getimagesize($saveFile);
|
||||
$width = $IM[0];
|
||||
$height= $IM[1];
|
||||
}
|
||||
@chmod($saveFile,0707);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$mingid = getDbCnt($table['s_upload'],'min(gid)','');
|
||||
$gid = $mingid ? $mingid - 1 : 100000000;
|
||||
|
||||
$QKEY = "gid,pid,category,hidden,tmpcode,site,mbruid,fileonly,type,ext,fserver,host,folder,name,tmpname,size,width,height,alt,caption,description,src,linkto,license,down,d_regis,d_update,sync,linkurl";
|
||||
$QVAL = "'$gid','$gid','$category','$hidden','$tmpcode','$s','$mbruid','$_fileonly','$type','$fileExt','$fserver','$host','$folder','$name','$tmpname','$size','$width','$height','$alt','$caption','$description','$src','$linkto','$license','$down','$d_regis','$d_update','$sync','$linkurl'";
|
||||
getDbInsert($table['s_upload'],$QKEY,$QVAL);
|
||||
getDbUpdate($table['s_numinfo'],'upload=upload+1',"date='".$date['today']."' and site=".$s);
|
||||
|
||||
if ($gid == 100000000) db_query("OPTIMIZE TABLE ".$table['s_upload'],$DB_CONNECT);
|
||||
$_nowPer = (int)((($i+1)/$upfileNum)*100);
|
||||
?>
|
||||
<script>
|
||||
parent.getId('progressPer').style.width = '<?php echo $_nowPer?>%';
|
||||
parent.getId('progressPer').innerHTML = '<?php echo $_nowPer?>%(<?php echo ($i+1)?>/<?php echo $upfileNum?>)';
|
||||
<?php if($_nowPer > 99):?>
|
||||
parent.gridProgress();
|
||||
<?php endif?>
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
$upfileNum = 1;
|
||||
$name = basename($src);
|
||||
$fileExt = getExt($src);
|
||||
$fileExt = $fileExt == 'jpeg' ? 'jpg' : $fileExt;
|
||||
|
||||
$mingid = getDbCnt($table['s_upload'],'min(gid)','');
|
||||
$gid = $mingid ? $mingid - 1 : 100000000;
|
||||
|
||||
$QKEY = "gid,pid,category,hidden,tmpcode,site,mbruid,fileonly,type,ext,fserver,host,folder,name,tmpname,size,width,height,alt,caption,description,src,linkto,license,down,d_regis,d_update,sync,linkurl";
|
||||
$QVAL = "'$gid','$gid','$category','0','$tmpcode','$s','$mbruid','$_fileonly','-1','$fileExt','0','','','$name','','0','0','0','','','','$src','0','0','0','$d_regis','','',''";
|
||||
getDbInsert($table['s_upload'],$QKEY,$QVAL);
|
||||
|
||||
if ($gid == 100000000) db_query("OPTIMIZE TABLE ".$table['s_upload'],$DB_CONNECT);
|
||||
|
||||
}
|
||||
if ($fileonly != 'Y')
|
||||
{
|
||||
if (!getDbRows($table['s_uploadcat'],'mbruid='.$my['uid'].' and type=1'))
|
||||
{
|
||||
getDbInsert($table['s_uploadcat'],'gid,site,mbruid,type,hidden,users,name,r_num,d_regis,d_update',"'0','".$s."','".$my['uid']."','1','0','','none','0','".$date['totime']."',''");
|
||||
getDbInsert($table['s_uploadcat'],'gid,site,mbruid,type,hidden,users,name,r_num,d_regis,d_update',"'1','".$s."','".$my['uid']."','1','0','','trash','0','".$date['totime']."',''");
|
||||
}
|
||||
|
||||
$_tname = ' and uid='.(int)$category;
|
||||
if (!$category) $_tname = " and name='none'";
|
||||
if ($category == -1) $_tname = "and name='trash'";
|
||||
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num+'.$upfileNum,'mbruid='.$my['uid'].' and type=1'.$_tname);
|
||||
}
|
||||
if ($link == 'Y') {
|
||||
setrawcookie('mediaset_result', rawurlencode('사진이 추가 되었습니다.|success')); // 처리여부 cookie 저장
|
||||
getLink('reload','parent.','','');
|
||||
}
|
||||
exit;
|
||||
?>
|
||||
144
modules/mediaset/action/mediaset/a.upload_vod.php
Normal file
144
modules/mediaset/action/mediaset/a.upload_vod.php
Normal file
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
if(!defined('__KIMS__')) exit;
|
||||
|
||||
include $g['path_core'].'function/thumb.func.php';
|
||||
$g['mediasetVarForSite'] = $g['path_var'].'site/'.$r.'/'.$m.'.var.php';
|
||||
include_once file_exists($g['mediasetVarForSite']) ? $g['mediasetVarForSite'] : $g['dir_module'].'var/var.php';
|
||||
|
||||
$savePath1 = $saveDir.substr($date['today'],0,4);
|
||||
$savePath2 = $savePath1.'/'.substr($date['today'],4,2);
|
||||
$savePath3 = $savePath2.'/'.substr($date['today'],6,2);
|
||||
$folder = substr($date['today'],0,4).'/'.substr($date['today'],4,2).'/'.substr($date['today'],6,2);
|
||||
|
||||
$upfileNum = count($_FILES['upfiles']['name']);
|
||||
$tmpcode = $mediaset == 'Y' ? '' : $_SESSION['upsescode'];
|
||||
$mbruid = $my['uid'];
|
||||
$fserver = $d['mediaset']['use_fileserver'];
|
||||
$url = $fserver ? $d['mediaset']['ftp_urlpath'] : $g['url_root'].'/files/';
|
||||
$d_regis = $date['totime'];
|
||||
$down = 0;
|
||||
$width = 0;
|
||||
$height = 0;
|
||||
$caption = '';
|
||||
$d_update = '';
|
||||
|
||||
//$category = 0;
|
||||
$alt = '';
|
||||
$description= '';
|
||||
$src = trim($src);
|
||||
$linkto = 0;
|
||||
$license = 0;
|
||||
$_fileonly = 0;
|
||||
$linkurl = '';
|
||||
|
||||
|
||||
if ($link != 'Y')
|
||||
{
|
||||
if ($fserver)
|
||||
{
|
||||
$FTP_CONNECT = ftp_connect($d['mediaset']['ftp_host'],$d['mediaset']['ftp_port']);
|
||||
$FTP_CRESULT = ftp_login($FTP_CONNECT,$d['mediaset']['ftp_user'],$d['mediaset']['ftp_pass']);
|
||||
if (!$FTP_CONNECT) getLink('','',_LANG('a5001','mediaset'),'');
|
||||
if (!$FTP_CRESULT) getLink('','',_LANG('a5001','mediaset'),'');
|
||||
if($d['mediaset']['ftp_pasv']) ftp_pasv($FTP_CONNECT, true);
|
||||
ftp_chdir($FTP_CONNECT,$d['mediaset']['ftp_folder']);
|
||||
}
|
||||
|
||||
|
||||
for($i = 0; $i < $upfileNum; $i++)
|
||||
{
|
||||
$name = strtolower($_FILES['upfiles']['name'][$i]);
|
||||
$size = $_FILES['upfiles']['size'][$i];
|
||||
$fileExt = getExt($name);
|
||||
$fileExt = $fileExt == 'jpeg' ? 'jpg' : $fileExt;
|
||||
$type = getFileType($fileExt);
|
||||
$tmpname = md5($name).substr($date['totime'],8,14);
|
||||
$tmpname = $type == 5 ? $tmpname.'.'.$fileExt : $tmpname;
|
||||
$hidden = $type == 5 ? 1 : 0;
|
||||
|
||||
if ($fileExt != 'mp4') continue;
|
||||
|
||||
if ($fserver)
|
||||
{
|
||||
for ($j = 1; $j < 4; $j++)
|
||||
{
|
||||
ftp_mkdir($FTP_CONNECT,$d['mediaset']['ftp_folder'].str_replace('./files/','',${'savePath'.$j}));
|
||||
}
|
||||
ftp_put($FTP_CONNECT,$d['mediaset']['ftp_folder'].$folder.'/'.$tmpname,$_FILES['upfiles']['tmp_name'][$i],FTP_BINARY);
|
||||
}
|
||||
else {
|
||||
|
||||
for ($j = 1; $j < 4; $j++)
|
||||
{
|
||||
if (!is_dir(${'savePath'.$j}))
|
||||
{
|
||||
mkdir(${'savePath'.$j},0707);
|
||||
@chmod(${'savePath'.$j},0707);
|
||||
}
|
||||
}
|
||||
|
||||
$saveFile = $savePath3.'/'.$tmpname;
|
||||
|
||||
if ($Overwrite == 'true' || !is_file($saveFile))
|
||||
{
|
||||
move_uploaded_file($_FILES['upfiles']['tmp_name'][$i], $saveFile);
|
||||
@chmod($saveFile,0707);
|
||||
}
|
||||
}
|
||||
|
||||
$mingid = getDbCnt($table['s_upload'],'min(gid)','');
|
||||
$gid = $mingid ? $mingid - 1 : 100000000;
|
||||
|
||||
$QKEY = "gid,pid,category,hidden,tmpcode,site,mbruid,fileonly,type,ext,fserver,url,folder,name,tmpname,thumbname,size,width,height,alt,caption,description,src,linkto,license,down,d_regis,d_update,sync,linkurl";
|
||||
$QVAL = "'$gid','$gid','$category','$hidden','$tmpcode','$s','$mbruid','$_fileonly','$type','$fileExt','$fserver','$url','$folder','$name','$tmpname','$thumbname','$size','$width','$height','$alt','$caption','$description','$src','$linkto','$license','$down','$d_regis','$d_update','$sync','$linkurl'";
|
||||
getDbInsert($table['s_upload'],$QKEY,$QVAL);
|
||||
getDbUpdate($table['s_numinfo'],'upload=upload+1',"date='".$date['today']."' and site=".$s);
|
||||
|
||||
if ($gid == 100000000) db_query("OPTIMIZE TABLE ".$table['s_upload'],$DB_CONNECT);
|
||||
|
||||
$_nowPer = (int)((($i+1)/$upfileNum)*100);
|
||||
?>
|
||||
<script>
|
||||
parent.getId('progressPer').style.width = '<?php echo $_nowPer?>%';
|
||||
parent.getId('progressPer').innerHTML = '<?php echo $_nowPer?>%(<?php echo ($i+1)?>/<?php echo $upfileNum?>)';
|
||||
<?php if($_nowPer > 99):?>
|
||||
parent.gridProgress();
|
||||
<?php endif?>
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
$upfileNum = 1;
|
||||
$name = _LANG('a5002','mediaset');
|
||||
$fileExt = 'mp4';
|
||||
|
||||
$mingid = getDbCnt($table['s_upload'],'min(gid)','');
|
||||
$gid = $mingid ? $mingid - 1 : 100000000;
|
||||
|
||||
$QKEY = "gid,pid,category,hidden,tmpcode,site,mbruid,fileonly,type,ext,fserver,url,folder,name,tmpname,thumbname,size,width,height,alt,caption,description,src,linkto,license,down,d_regis,d_update,sync,linkurl";
|
||||
$QVAL = "'$gid','$gid','$category','0','$tmpcode','$s','$mbruid','$_fileonly','0','$fileExt','0','','','$name','','','0','0','0','','','','$src','0','0','0','$d_regis','','',''";
|
||||
getDbInsert($table['s_upload'],$QKEY,$QVAL);
|
||||
|
||||
if ($gid == 100000000) db_query("OPTIMIZE TABLE ".$table['s_upload'],$DB_CONNECT);
|
||||
|
||||
}
|
||||
if ($fileonly != 'Y')
|
||||
{
|
||||
if (!getDbRows($table['s_uploadcat'],'mbruid='.$my['uid'].' and type=2'))
|
||||
{
|
||||
getDbInsert($table['s_uploadcat'],'gid,site,mbruid,type,hidden,users,name,r_num,d_regis,d_update',"'0','".$s."','".$my['uid']."','2','0','','none','0','".$date['totime']."',''");
|
||||
getDbInsert($table['s_uploadcat'],'gid,site,mbruid,type,hidden,users,name,r_num,d_regis,d_update',"'1','".$s."','".$my['uid']."','2','0','','trash','0','".$date['totime']."',''");
|
||||
}
|
||||
|
||||
$_tname = 'uid='.(int)$category;
|
||||
if (!$category) $_tname = "name='none'";
|
||||
if ($category == -1) $_tname = "name='trash'";
|
||||
|
||||
|
||||
getDbUpdate($table['s_uploadcat'],'r_num=r_num+'.$upfileNum,'mbruid='.$my['uid'].' and type=2 and '.$_tname);
|
||||
}
|
||||
if ($link == 'Y') getLink('reload','parent.','','');
|
||||
exit;
|
||||
?>
|
||||
Reference in New Issue
Block a user