function mkdir() { $ftp = $this->container->get('ftp'); $dir = $this->getParameter('dir', '/'); $parent = $this->getParameter('path', '/'); $newname = $this->getParameter('newname', 'New Folder'); $current = rtrim($parent, '/') . '/' . ltrim($dir, '/'); $this->debug(array('dir' => $dir, 'parent' => $parent, 'current' => $current, 'newname' => $newname)); $model = new \App\Models\Ftp($ftp); $model->mkdir($current, $newname); }
function trash() { $ftp = $this->container->get('ftp'); // 휴지통 경로(환경변수로 설정할까?) $trash = '/.trash'; $trash = $this->container->get('config')->get('trash.path'); $model = new \App\Models\Ftp($ftp); $model->deleteRecursive($trash); $model->mkdir('/', $trash); echo json_encode(array('code' => 1, 'message' => '휴지통에 있는 항목을 모두 삭제했습니다.!!!')); }
function rename() { $ftp = $this->container->get('ftp'); $dir = $this->getParameter('dir', '/'); $parent = $this->getParameter('path', '/'); $folder = $this->getParameter('folder'); $file = $this->getParameter('file'); $rename = $this->getParameter('rename'); $current = rtrim($parent, '/') . '/' . ltrim($dir, '/'); $this->debug(array('dir' => $dir, 'parent' => $parent, 'current' => $current, 'folder' => $folder, 'file' => $file, 'rename' => $rename)); $model = new \App\Models\Ftp($ftp); $model->rename($current, $folder, $file, $rename); }
function move() { $ftp = $this->container->get('ftp'); $dir = $this->getParameter('dir', '/'); $parent = $this->getParameter('path', '/'); $folder = $this->getParameter('folder'); $file = $this->getParameter('file'); $targetDir = $this->getParameter('targetDir'); $current = rtrim($parent, '/') . '/' . ltrim($dir, '/'); $target = '/' . rtrim($targetDir, '/'); $this->debug(array('dir' => $dir, 'parent' => $parent, 'current' => $current, 'folder' => $folder, 'file' => $file, 'target' => $target)); $model = new \App\Models\Ftp($ftp); $model->move($current, $folder, $file, $target); }
function execute() { $request = $this->container->get('request'); $settings = $this->container->get('settings'); $tpl = $this->container->get('template'); $ftp = $this->container->get('ftp'); $dir = $this->getParameter('dir', '/'); $parent = $this->getParameter('path', '/'); $search = $this->getParameter('search', ''); $trash = '/.trash'; $trash = $this->container->get('config')->get('trash.path'); // TODO::좋은 방법이 있을 텐데.. if ($dir == '..') { $current = str_replace('\\', '/', dirname($parent)); $parent = str_replace('\\', '/', dirname($current)); } else { if ($dir == $trash) { $current = $trash; $parent = ''; } else { $current = rtrim($parent, '/') . '/' . ltrim($dir, '/'); } } $this->debug(array('dir' => $dir, 'parent' => $parent, 'current' => $current, 'search' => $search)); $sortby = $request->cookie('sortby', 'name'); $sortorder = $request->cookie('sortorder', 'ASC'); /** * $this->debug ( array ( * 'sortby' => $sortby, * 'sortorder' => $sortorder * ) ); */ $model = new \App\Models\Ftp($ftp); $p_folder = $model->getFolder($parent, $sortby, $sortorder); if ($search == '') { $folder = $model->getFolder($current, $sortby, $sortorder); $files = $model->getFiles($current, $sortby, $sortorder); } else { $folder = $files = array(); $model->findRecursive($files, $current, $search); } $tpl->assign(array('jquery' => $settings['jquery'], 'type-interior' => true, 'bootstrap' => $settings['bootstrap'], 'custom' => array('css' => '_template/bootstrap/dashboard.css'), 'breadcrumb' => $this->breadcrumb($current), 'current' => $current, 'domain' => $this->router()->getBaseUrl(), 'ExtPath' => 'images/exts', 'path' => $parent, 'directory' => $dir, 'full_path' => $current, 'p_folder' => $p_folder, 'folder' => $folder, 'files' => $files)); $tpl->define(array("index" => "layout.tpl.html", "header" => "header.tpl.html", "footer" => "footer.tpl.html", "content" => "files.tpl.html")); $tpl->print_('index'); }
/** * 여러 파일 압축해서 다운로드 기능(2009.12.07) */ function zip() { $ftp = $this->container->get('ftp'); $dir = $this->getParameter('dir', '/'); $parent = $this->getParameter('path', '/'); $folder = $this->getParameter('folder', ''); $file = $this->getParameter('file', ''); $current = rtrim($parent, '/') . '/' . ltrim($dir, '/'); $this->debug(array('dir' => $dir, 'parent' => $parent, 'current' => $current, 'folder' => $folder, 'file' => $file)); // TODO::임시파일이름 지정 $temp_file = tempnam(sys_get_temp_dir(), 'Zip'); $model = new \App\Models\Ftp($ftp); $zip = $model->zip($current, $folder, $file, $temp_file); $this->debug($temp_file); $zipfile = $_SESSION['data']['username'] . '-' . time() . '.zip'; $fileDownload = FileDownload::createFromFilePath($temp_file); $fileDownload->sendDownload($zipfile); }
function zip() { $ftp = $this->container->get('ftp'); $dir = $this->getParameter('dir', '/'); $parent = $this->getParameter('path', '/'); $folder = $this->getParameter('folder', ''); $file = $this->getParameter('file', ''); $save_filename = $this->getParameter('save_filename', ''); $current = rtrim($parent, '/') . '/' . ltrim($dir, '/'); $this->debug(array('dir' => $dir, 'parent' => $parent, 'current' => $current, 'folder' => $folder, 'file' => $file, 'save_filename' => $save_filename)); // TODO::임시파일이름 지정 $temp_file = tempnam(sys_get_temp_dir(), 'Zip'); $model = new \App\Models\Ftp($ftp); $zip = $model->zip($current, $folder, $file, $temp_file); $this->debug($temp_file); $upfile['tmp_name'] = $temp_file; $upfile['name'] = rtrim($save_filename, '.zip') . '.zip'; $model->upload($current, $upfile); $this->debug($upfile); }
function execute() { $ftp = $this->container->get('ftp'); $dir = $this->getParameter('dir', '/'); $parent = $this->getParameter('path', '/'); $folder = $this->getParameter('folder'); $file = $this->getParameter('file'); $current = rtrim($parent, '/') . '/' . ltrim($dir, '/'); $this->debug(array('dir' => $dir, 'parent' => $parent, 'current' => $current, 'folder' => $folder, 'file' => $file)); // 휴지통 경로(환경변수로 설정할까?) $trash = '/.trash'; $trash = $this->container->get('config')->get('trash.path'); $model = new \App\Models\Ftp($ftp); // 휴지통 생성하기 $model->mkdir('/', $trash); // 만일 휴지통에서 삭제하면.. if ($current == $trash) { $model->delete($current, $folder, $file); } else { $model->move($current, $folder, $file, $trash); } }
function upload() { $this->debug($_GET); $this->debug($_POST); $this->debug($_FILES); $config = $this->container->get('config'); $ftp = $this->container->get('ftp'); $dir = $this->getParameter('dir', '/'); $parent = $this->getParameter('path', '/'); $current = rtrim($parent, '/') . '/' . ltrim($dir, '/'); $this->debug(array('dir' => $dir, 'parent' => $parent, 'current' => $current)); // $this->debug ( $_FILES ['file'] ); $upload = new \Kaiser\Plupload($config->get('plupload')); $upload->no_cache_headers(); $upload->cors_headers(); if (($file = $upload->getFiles()) !== false) { $model = new \App\Models\Ftp($ftp); $model->upload($current, $file); } else { $this->err($upload->get_error_message()); } }