function DirChmod($t_dir, $mode) { $dirh = opendir($t_dir); while (false !== ($filename = readdir($dirh))) { if ($filename != '.' && $filename != '..') { if (!is_file($t_dir . '/' . $filename)) { @chmod($t_dir . '/' . $filename, $mode); DirChmod($t_dir . '/' . $filename, $mode); } else { @chmod($t_dir . '/' . $filename, $mode); } } } closedir($dirh); @chmod($t_dir, $mode); }
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); } DirCopy($extPath1 . $file, $folder . $file); DirChmod($folder . $file, 0707); } } } closedir($opendir); DirDelete($extPath); mkdir($extPath, 0707); @chmod($extPath, 0707); } getLink('reload', 'parent.', '자료가 정상적으로 등록되었습니다.', '');
} } 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; ?> '; } </script>
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 != '..' && is_file($extPath1 . $file . '/main.php')) { if (is_file($g['path_module'] . $file . '/main.php')) { $isModule = $file; break; } mkdir($g['path_module'] . $file, 0707); @chmod($g['path_module'] . $file, 0707); DirCopy($extPath1 . $file, $g['path_module'] . $file); DirChmod($g['path_module'] . $file, 0707); $isUpload = true; break; } } closedir($opendir); DirDelete($extPath); mkdir($extPath, 0707); @chmod($extPath, 0707); if ($isModule) { getLink('', '', '이미 동일한 아이디(' . $isModule . ')의 모듈이 존재합니다.', ''); } if (!$isUpload) { getLink('', '', '패키지규격에 맞지 않는 파일입니다', ''); } }