function DirCopy($dir1, $dir2) { $dirh = opendir($dir1); while (false !== ($filename = readdir($dirh))) { if ($filename != '.' && $filename != '..') { if (!is_file($dir1 . '/' . $filename)) { @mkdir($dir2 . '/' . $filename, 0707); @chmod($dir2 . '/' . $filename, 0707); DirCopy($dir1 . '/' . $filename, $dir2 . '/' . $filename); } else { @copy($dir1 . '/' . $filename, $dir2 . '/' . $filename); @chmod($dir2 . '/' . $filename, 0707); } } } closedir($dirh); }
function CopiarDirectorio($srcdir, $dstdir, $basesrc, $basedst, $verbose = true) { global $msgstr; $num = 0; echo $srcdir; if (!file_exists($srcdir)) { return $num; } if ($curdir = opendir($srcdir)) { while ($file = readdir($curdir)) { if ($file != '.' && $file != '..') { $srcfile = $srcdir . $file; $dstfile = $dstdir . str_replace($basesrc, $basedst, $file); if (is_file($srcfile)) { if (is_file($dstfile)) { $ow = filemtime($srcfile) - filemtime($dstfile); } else { $ow = 1; } if ($ow > 0) { if ($verbose) { echo " ({$srcfile}) --> ({$dstfile}) ...<br>"; } if (copy($srcfile, $dstfile)) { touch($dstfile, filemtime($srcfile)); $num++; if ($verbose) { echo "OK<br>\n"; } } else { echo $msgstr["warning"] . "! " . $msgstr["nocopyfile"] . " " . $srcfile . "\n"; } } } else { if (is_dir($srcfile)) { $num += DirCopy($srcfile, $dstfile, $verbose); } } } } closedir($curdir); } return $num; }
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.', '자료가 정상적으로 등록되었습니다.', '');
$extPath = $g['path_tmp'] . 'app'; $extPath1 = $extPath . '/'; $saveFile = $extPath1 . 'rb_update_app.zip'; $fp = fopen($saveFile, 'w'); fwrite($fp, $_updatefile); fclose($fp); @chmod($saveFile, 0707); $extractor = new ArchiveExtractor(); $extractor->extractArchive($saveFile, $extPath1); unlink($saveFile); $_updateFile = $extPath1 . '/_update.php'; if (is_file($_updateFile)) { include $_updateFile; unlink($_updateFile); } DirCopy($extPath1, $folder); DirDelete($extPath); mkdir($extPath, 0707); @chmod($extPath, 0707); $fp = fopen($_ufile, 'w'); fwrite($fp, $date['today'] . ',0'); fclose($fp); @chmod($_ufile, 0707); if ($_updateversion != $d['admin']['version']) { $d['admin']['version'] = $_updateversion; $_tmpdfile = $g['dir_module'] . 'var/var.system.php'; $fp = fopen($_tmpdfile, 'w'); fwrite($fp, "<?php\n"); foreach ($d['admin'] as $key => $val) { fwrite($fp, "\$d['admin']['" . $key . "'] = \"" . $val . "\";\n"); }
$saveFile = $extPath1 . $date['totime'] . '.zip'; $plfldPath = $g['path_module'] . 'dashboard/widgets/' . $plFolder; $tgFolder = $plfldPath . '/'; if (is_uploaded_file($tmpname)) { if ($fileExt != 'zip' || substr($realname, 0, 13) != 'rb_dashboard_') { getLink('reload', 'parent.', _LANG('a7001', 'market'), ''); } 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); mkdir($plfldPath, 0707); @chmod($plfldPath, 0707); DirCopy($extPath1, $tgFolder); DirDelete($extPath); mkdir($extPath, 0707); @chmod($extPath, 0707); } else { getLink('', '', _LANG('a7002', 'market'), ''); } ?> <script> var pt = parent.parent.parent ? parent.parent.parent : parent.parent; var ex = pt.location.href.split('&_admpnl_'); var gx = ex[0] + '&_admpnl_=' + escape(pt.frames._ADMPNL_.location.href); pt.location.href = gx; </script> <?php exit;
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 != '..' && 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); $isUpload = true; break; } } closedir($opendir); DirDelete($extPath); mkdir($extPath, 0707); @chmod($extPath, 0707); if ($isModule) { getLink('', '', '이미 동일한 아이디(' . $isModule . ')의 모듈이 존재합니다.', ''); } if (!$isUpload) { getLink('', '', '패키지규격에 맞지 않는 파일입니다', ''); } }
if (is_file($g['path_layout'] . $layout . '/' . $cssfile)) { unlink($g['path_layout'] . $layout . '/' . $cssfile); } if (is_file($g['path_layout'] . $layout . '/' . $jsfile)) { unlink($g['path_layout'] . $layout . '/' . $jsfile); } getLink($g['s'] . '/?r=' . $r . '&m=admin&module=' . $m . '&layout=' . $layout, 'parent.', '', ''); } } if ($numCopy == 1) { $cssfile = str_replace('.php', '.css', $sublayout); $jsfile = str_replace('.php', '.js', $sublayout); copy($g['path_layout'] . $layout . '/' . $sublayout, $g['path_layout'] . $layout . '/copy-' . $sublayout); if (is_file($g['path_layout'] . $layout . '/' . $cssfile)) { copy($g['path_layout'] . $layout . '/' . $cssfile, $g['path_layout'] . $layout . '/copy-' . $cssfile); @chmod($g['path_layout'] . $layout . '/copy-' . $cssfile, 0707); } if (is_file($g['path_layout'] . $layout . '/' . $jsfile)) { copy($g['path_layout'] . $layout . '/' . $jsfile, $g['path_layout'] . $layout . '/copy-' . $jsfile); @chmod($g['path_layout'] . $layout . '/copy-' . $jsfile, 0707); } getLink($g['s'] . '/?r=' . $r . '&m=admin&module=' . $m . '&layout=' . $layout . '&sublayout=copy-' . $sublayout, 'parent.', '', ''); } if ($numCopy == 2) { include $g['path_core'] . 'function/dir.func.php'; @mkdir($g['path_layout'] . 'copy-' . $layout, 0707); @chmod($g['path_layout'] . 'copy-' . $layout, 0707); DirCopy($g['path_layout'] . $layout, $g['path_layout'] . 'copy-' . $layout); getLink($g['s'] . '/?r=' . $r . '&m=admin&module=' . $m . '&layout=copy-' . $layout, 'parent.', '', ''); } exit;
<?php if (!defined('__KIMS__')) { exit; } checkAdmin(0); if ($cplayout) { if (!is_file($g['path_layout'] . $cplayout . '/main.php')) { mkdir($g['path_layout'] . $cplayout, 0707); @chmod($g['path_layout'] . $cplayout, 0707); include_once $g['path_core'] . 'function/dir.func.php'; DirCopy($g['path_layout'] . $layout, $g['path_layout'] . $cplayout); $layout = $cplayout; } } if ($type == 'layout') { $nameFile = $g['path_layout'] . $layout . '/name.txt'; $fp = fopen($nameFile, 'w'); fwrite($fp, trim(stripslashes($name))); fclose($fp); @chmod($nameFile, 0707); } if ($type != 'image') { if ($type == 'layout') { $codeName = basename($sublayout, '.php') == $subname ? $sublayout : basename($subname, '.php') . '.php'; } else { $codeName = '_main.' . $type; } $codeFile = $g['path_layout'] . $layout . '/' . $codeName; $fp = fopen($codeFile, 'w'); fwrite($fp, trim(stripslashes($code)));
<?php if (!defined('__KIMS__')) { exit; } checkAdmin(0); require $g['path_core'] . 'function/dir.func.php'; DirCopy('./_package/modules/' . $module, './modules/' . $module); getLink($g['s'] . '/?r=' . $r . '&m=' . $m . '&a=module_setting&module=' . $module, '', '', '');
continue; } $_r = explode("\t", $_val); $_p = getDbData($table['s_page'], "id='" . $_r[3] . "'", 'uid'); if ($_p['uid']) { getDbUpdate($table['s_page'], "pagetype='" . $_r[0] . "',ismain='" . $_r[1] . "',mobile='" . $_r[2] . "',id='" . $_r[3] . "',category='" . $_r[4] . "',name='" . $_r[5] . "',layout='" . $_r[6] . "',joint='" . $_r[7] . "',sosokmenu='" . $_r[8] . "'", 'uid=' . $_p['uid']); } else { getDbInsert($table['s_page'], 'pagetype,ismain,mobile,id,category,name,layout,joint,sosokmenu', "'" . $_r[0] . "','" . $_r[1] . "','" . $_r[2] . "','" . $_r[3] . "','" . $_r[4] . "','" . $_r[5] . "','" . $_r[6] . "','" . $_r[7] . "','" . $_r[8] . "'"); } } } if ($aply_bbs == '1') { $maxgid = getDbCnt($table['bbslist'], 'max(gid)', ''); $_bbs = file('./_package/dump_bbs.dat'); foreach ($_bbs as $_val) { if (!trim($_val)) { continue; } $_r = explode("\t", $_val); $_p = getDbData($table['bbslist'], "id='" . $_r[0] . "'", 'uid'); if ($_p['uid']) { continue; } $maxgid++; getDbInsert($table['bbslist'], 'gid,id,name,category,imghead,imgfoot,puthead,putfoot', "'" . $maxgid . "','" . $_r[0] . "','" . $_r[1] . "','" . $_r[2] . "','" . $_r[3] . "','" . $_r[4] . "','" . $_r[5] . "','" . $_r[6] . "'"); } } DirCopy('./_package/rb', './'); DirDelete('./_package'); getLink('reload', 'parent.', '패키지가 적용되었습니다.', ''); }