public function unpack() { Database::update('misc', array('data1' => 'unpacking'), 'type = ? and data2 = ?', array('pack_status', $this->id)); require ENGINE . SL . 'extract' . SL . 'ArchiveExtractor.class.php'; $archExtractor = new ArchiveExtractor(); if (!file_exists($this->archive)) { Database::update('misc', array('data1' => 'error'), 'type = ? and data2 = ?', array('pack_status', $this->id)); return; } mkdir($this->unpacked); $archExtractor->extractArchive($this->archive, $this->unpacked); Database::update('misc', array('data1' => 'unpacked'), 'type = ? and data2 = ?', array('pack_status', $this->id)); }
$realname = $_FILES['upfile']['name']; $fileExt = strtolower(getExt($realname)); $extPath = $g['path_tmp'] . 'app'; $extPath1 = $extPath . '/'; $saveFile = $extPath1 . $date['totime'] . '.zip'; if (is_uploaded_file($tmpname)) { if (substr($realname, 0, 7) != 'rb_etc_') { getLink('', '', '기타자료 패키지가 아닙니다.', ''); } if ($fileExt != 'zip') { getLink('', '', '패키지는 반드시 zip압축 포맷이어야 합니다.', ''); } move_uploaded_file($tmpname, $saveFile); require $g['path_core'] . 'opensrc/unzip/ArchiveExtractor.class.php'; require $g['path_core'] . 'function/dir.func.php'; $extractor = new ArchiveExtractor(); $extractor->extractArchive($saveFile, $extPath1); unlink($saveFile); $opendir = opendir($extPath1); while (false !== ($file = readdir($opendir))) { if ($file != '.' && $file != '..') { if (is_file($extPath1 . $file)) { if (is_file($folder . $file)) { unlink($folder . $file); } copy($extPath1 . $file, $folder . $file); @chmod($folder . $file, 0707); } else { if (!is_dir($folder . $file)) { mkdir($folder . $file, 0707); @chmod($folder . $file, 0707);
DirChmod($g['path_root'], 0707); unlink($saveFile); } } else { $rbPackage = getUrlData('http://www.kimsq.co.kr/__update/core/' . $version . '.zip', 10); if (!trim($rbPackage)) { echo '<script>'; echo "parent.errDownload('');"; echo '</script>'; exit; } $rbPackageFile = $g['path_root'] . $version . '.zip'; $fp = fopen($rbPackageFile, 'w'); fwrite($fp, $rbPackage); fclose($fp); $extractor = new ArchiveExtractor(); $extractor->extractArchive($rbPackageFile, $g['path_root']); DirChmod($g['path_root'], 0707); unlink($rbPackageFile); } } ?> <script> window.onload = function() { parent.location.href = './index.php?sitelang=<?php echo $sitelang; ?> '; }