'; $html.=$_tagk; $html.=''; } else { $html.=''; $html.=$_tagk; $html.=''; } endfor; return $html; } // 첨부파일 리스트 갯수 추출 함수 function _getAttachNum($upload,$mod){ global $table; $attach = getArrayString($upload); $attach_file_num=0;// 첨부파일 수량 $hidden_file_num=0; // 숨김파일(다운로드 방지) 수량 foreach($attach['data'] as $val) { $U = getUidData($table['s_upload'],$val); if($U['fileonly']==1) $attach_file_num++; // 전체 첨부파일 수량 증가 if($U['hidden']==1) $hidden_file_num++; // 숨김파일 수량 증가 } $down_file_num=$attach_file_num-$hidden_file_num; // 다운로드 가능한 첨부파일 $result=array(); $result['modify']=$attach_file_num; $result['view']=$down_file_num; return $result[$mod]; } // 첨부파일 리스트 추출 함수 (전체) /* $parent_data : 해당 포스트의 row 배열 $mod : upload or modal ==> 실제 업로드 모드 와 모달을 띄워서 본문에 삽입용도로 쓰거나 */ function _getAttachFileList($parent_data,$mod,$type,$device){ global $table; $upload=$parent_data['upload']; $featured_img_uid=$parent_data['featured_img'];// 대표이미지 uid $featured_video_uid=$parent_data['featured_video'];// 대표비디오 uid $featured_audio_uid=$parent_data['featured_audio'];// 대표오디오 uid if($type=='file') $sql='type=1 and hidden=0'; else if($type=='photo') $sql='type=2 and hidden=0'; else if($type=='audio') $sql='type=4 and hidden=0'; else if($type=='video') $sql='type=5 and hidden=0'; else if($type=='doc') $sql='type=6 and hidden=0'; else if($type=='zip') $sql='type=7 and hidden=0'; else $sql='type=1'; $attach = getArrayString($upload); $uid_q='('; foreach($attach['data'] as $uid) { $uid_q.='uid='.$uid.' or '; } $uid_q=substr($uid_q,0,-4).')'; $sql=$sql.' and '.$uid_q; $RCD=getDbArray($table['s_upload'],$sql,'*','gid','asc','',1); $html=''; while($R=db_fetch_array($RCD)){ $U=getUidData($table['s_upload'],$R['uid']); if ($device =='mobile') { if($type=='file') $html.=_getAttachFile_m($U,$mod,$featured_img_uid); else if($type=='photo') $html.=_getAttachPhoto_m($U,$mod,$featured_img_uid); else if($type=='audio') $html.=_getAttachAudio_m($U,$mod,$featured_audio_uid); else if($type=='video') $html.=_getAttachVideo_m($U,$mod,$featured_video_uid); else $html.=_getAttachFile_m($U,$mod,$featured_img_uid);; } else { if($type=='file') $html.=_getAttachFile($U,$mod,$featured_img_uid); else if($type=='photo') $html.=_getAttachPhoto($U,$mod,$featured_img_uid); else if($type=='audio') $html.=_getAttachAudio($U,$mod,$featured_audio_uid); else if($type=='video') $html.=_getAttachVideo($U,$mod,$featured_video_uid); else $html.=_getAttachFile($U,$mod,$featured_img_uid);; } } return $html; } function _getAttachObjectArray($parent_data,$type){ global $table; $upload=$parent_data['upload']; $featured_img_uid=$parent_data['featured_img'];// 대표이미지 uid $featured_video_uid=$parent_data['featured_video'];// 대표비디오 uid $featured_audio_uid=$parent_data['featured_audio'];// 대표오디오 uid if($type=='file') $sql='type=1 and hidden=0'; else if($type=='photo') $sql='type=2 and hidden=0'; else if($type=='audio') $sql='type=4 and hidden=0'; else if($type=='video') $sql='type=5 and hidden=0'; else if($type=='doc') $sql='type=6 and hidden=0'; else if($type=='zip') $sql='type=7 and hidden=0'; else $sql='type=1'; $attachArray = []; $attach = getArrayString($upload); $uid_q='('; foreach($attach['data'] as $uid) { $uid_q.='uid='.$uid.' or '; } $uid_q=substr($uid_q,0,-4).')'; $sql=$sql.' and '.$uid_q; $RCD=getDbArray($table['s_upload'],$sql,'*','gid','asc','',1); // Loop through query and push results into $someArray; // while ($R = mysqli_fetch_assoc($query)) { while($R=db_fetch_array($RCD)){ $U=getUidData($table['s_upload'],$R['uid']); $src = $U['src']; array_push($attachArray, [ 'src' => $src, 'w' => $U['width'], 'h' => $U['height'], 'title' => $U['caption'] ]); } return $attachArray; } // 첨부파일 리스트 추출 함수 (데스크탑,사진) function _getAttachPhoto($R,$mod,$featured_img_uid) { global $g,$r; $fileName=explode('.',$R['name']); $file_name=$fileName[0]; // 파일명만 분리 $caption=$R['caption']?$R['caption']:$file_name; $img_origin=$R['src']; $img_origin_size=$R['width'].'x'.$R['height']; $thumb_list=getPreviewResize($R['src'],'c'); // 미리보기 사이즈 조정 (이미지 업로드시 썸네일을 만들 필요 없다.) $thumb_modal=getPreviewResize($R['src'],'q'); // 정보수정 모달용 사이즈 조정 (이미지 업로드시 썸네일을 만들 필요 없다.) $insert_text='!['.$caption.']('.$g['url_root'].$img_origin.')'; $html=''; $html.='
'; $html.=' '.$caption.' '; $html.='
'; return $html; } // 첨부파일 리스트 추출 함수 (데스크탑,파일) function _getAttachFile($R,$mod,$featured_img_uid) { global $g,$r; $fileName=explode('.',$R['name']); $file_name=$fileName[0]; // 파일명만 분리 if ($R['type']==2) { $type='photo'; } elseif($R['type']==4) { $type='audio'; } elseif($R['type']==5) { $type='video'; } else { $type='file'; } if($type=='photo'){ $caption=$R['caption']?$R['caption']:$file_name; $img_origin=$R['src']; $thumb_list=getPreviewResize($img_origin,'c'); // 미리보기 사이즈 조정 (이미지 업로드시 썸네일을 만들 필요 없다.) $thumb_modal=getPreviewResize($img_origin,'q'); // 정보수정 모달용 사이즈 조정 (이미지 업로드시 썸네일을 만들 필요 없다.) }else if($type=='file'){ $src=$R['host'].'/'.$R['folder'].'/'.$R['name']; $download_link=$g['url_root'].'/?r='.$r.'&m=mediaset&a=download&uid='.$R['uid']; } $ext_to_fa=array('xls'=>'excel','xlsx'=>'-excel','ppt'=>'powerpoint','pptx'=>'powerpoint','txt'=>'text','pdf'=>'pdf','zip'=>'archive','doc'=>'word'); $ext_icon=in_array($R['ext'],array_keys($ext_to_fa))?'-'.$ext_to_fa[$R['ext']]:''; $html=''; if($R['type']==2){ $html.='
'; $html.='
'.$caption.'
'; $html.='대표 '; $html.='숨김'; $html.=''.$R['name'].' '.getSizeFormat($R['size'],2).'
'; } else { $html.=''; $html.=' '.$R['name'].''; $html.=''.getSizeFormat($R['size'],2).' '.$R['down'].''; } return $html; } // 오디오파일 리스트 추출 함수 (데스크탑,오디오) function _getAttachAudio($R,$mod,$featured_audio_uid) { global $g,$r; $fileName=explode('.',$R['name']); $file_name=$fileName[0]; // 파일명만 분리 $caption=$R['caption']?$R['caption']:$file_name; $html=''; $html.='
  • '; $html.='대표 '; $html.='숨김'; $html.=' '; $html.='
  • '; return $html; } // 비디오파일 리스트 추출 함수 (데스크탑,비디오) function _getAttachVideo($R,$mod,$featured_video_uid) { global $g,$r; $fileName=explode('.',$R['name']); $file_name=$fileName[0]; // 파일명만 분리 $caption=$R['caption']?$R['caption']:$file_name; $html=''; $html.='
    '; $html.=' '; $html.='
    '.$R['name'].'
    '; $html.='

    '.getSizeFormat($R['size'],2).'

    '; return $html; } // 첨부파일 리스트 추출 함수 (모바일,사진) function _getAttachPhoto_m($R,$mod,$featured_img_uid) { global $g,$r; $fileName=explode('.',$R['name']); $file_name=$fileName[0]; // 파일명만 분리 $caption=$R['caption']?$R['caption']:$file_name; $img_origin=$R['src']; $img_origin_size=$R['width'].'x'.$R['height']; $thumb_list=getPreviewResize($R['src'],'c'); // 미리보기 사이즈 조정 (이미지 업로드시 썸네일을 만들 필요 없다.) $thumb_modal=getPreviewResize($R['src'],'q'); // 정보수정 모달용 사이즈 조정 (이미지 업로드시 썸네일을 만들 필요 없다.) $insert_text='!['.$caption.']('.$g['url_root'].$img_origin.')'; $html=''; $html.='
    '; $html.=' '.$caption.' '; $html.='
    '; return $html; } // 첨부파일 리스트 추출 함수 (모바일,파일) function _getAttachFile_m($R,$mod,$featured_img_uid) { global $g,$r; $fileName=explode('.',$R['name']); $file_name=$fileName[0]; // 파일명만 분리 if ($R['type']==2) { $type='photo'; } elseif($R['type']==4) { $type='audio'; } elseif($R['type']==5) { $type='video'; } else { $type='file'; } if($type=='photo'){ $caption=$R['caption']?$R['caption']:$file_name; $img_origin=$R['host'].'/'.$R['folder'].'/'.$R['tmpname']; $thumb_list=getPreviewResize($img_origin,'c'); // 미리보기 사이즈 조정 (이미지 업로드시 썸네일을 만들 필요 없다.) $thumb_modal=getPreviewResize($img_origin,'q'); // 정보수정 모달용 사이즈 조정 (이미지 업로드시 썸네일을 만들 필요 없다.) }else if($type=='file'){ $src=$R['host'].'/'.$R['folder'].'/'.$R['name']; $download_link=$g['url_root'].'/?r='.$r.'&m=mediaset&a=download&uid='.$R['uid']; } $ext_to_fa=array('xls'=>'excel','xlsx'=>'-excel','ppt'=>'powerpoint','pptx'=>'powerpoint','txt'=>'text','pdf'=>'pdf','zip'=>'archive','doc'=>'word'); $ext_icon=in_array($R['ext'],array_keys($ext_to_fa))?'-'.$ext_to_fa[$R['ext']]:''; $html=''; $html.='
  • '; $html.=' '.$R['down'].''; if($R['type']==2){ $html.=' '.$caption.'
    '; $html.=''.$R['name'].' '.getSizeFormat($R['size'],2).'
    '; } else { $html.=' '; $html.='
    '; $html.=$R['name'].' '.getSizeFormat($R['size'],2).'
    '; } $html.='
  • '; return $html; } // 오디오파일 리스트 추출 함수 (모바일,오디오) function _getAttachAudio_m($R,$mod,$featured_audio_uid) { global $g,$r; $fileName=explode('.',$R['name']); $file_name=$fileName[0]; // 파일명만 분리 $caption=$R['caption']?$R['caption']:$file_name; $html=''; $html.='
  • '; $html.='대표 '; $html.='숨김'; $html.=' '; $html.='
  • '; return $html; } // 비디오파일 리스트 추출 함수 (모바일,비디오) function _getAttachVideo_m($R,$mod,$featured_video_uid) { global $g,$r; $fileName=explode('.',$R['name']); $file_name=$fileName[0]; // 파일명만 분리 $caption=$R['caption']?$R['caption']:$file_name; $html=''; $html.='
    '; $html.=' '; $html.='
    '.$R['name'].'
    '; $html.='

    '.getSizeFormat($R['size'],2).'

    '; return $html; } // 본문삽입 이미지 uid 얻기 함수 function _getInsertImgUid($upload) { global $table; $u_arr = getArrayString($upload); $Insert_arr=array(); $i=0; foreach ($u_arr['data'] as $val) { $U=getUidData($table['s_upload'],$val); if(!$U['fileonly']) $Insert_arr[$i]=$val; $i++; } $upfiles=''; // 중괄로로 재조립 foreach ($Insert_arr as $uid) { $upfiles.='['.$uid.']'; } return $upfiles; } ?>