/** * viewdirtree() * * @param mixed $dir * @param mixed $currentpath * @return */ function viewdirtree($dir, $currentpath) { global $dirlist, $global_config, $module_file; $pattern = !empty($dir) ? "/^(" . nv_preg_quote($dir) . ")\\/([^\\/]+)\$/" : "/^([^\\/]+)\$/"; $_dirlist = preg_grep($pattern, $dirlist); $content = ""; foreach ($_dirlist as $_dir) { $check_allow_upload_dir = nv_check_allow_upload_dir($_dir); if (!empty($check_allow_upload_dir)) { $class_li = ($_dir == $currentpath or strpos($currentpath, $_dir . '/') !== false) ? "open collapsable" : "expandable"; $style_color = $_dir == $currentpath ? ' style="color:red"' : ''; $tree = array(); $tree['class1'] = $class_li; $tree['class2'] = nv_set_dir_class($check_allow_upload_dir) . " pos" . nv_string_to_filename($dir); $tree['style'] = $style_color; $tree['title'] = $_dir; $tree['titlepath'] = basename($_dir); $content2 = viewdirtree($_dir, $currentpath); $xtpl = new XTemplate("foldlist.tpl", NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/modules/" . $module_file); $xtpl->assign("DIRTREE", $tree); if (!empty($content2)) { $xtpl->assign("TREE_CONTENT", $content2); $xtpl->parse('tree.tree_content'); } $xtpl->parse('tree'); $content .= $xtpl->text('tree'); } } return $content; }
/** * viewdirtree() * * @param mixed $dir * @param mixed $currentpath * @return */ function viewdirtree($dir, $currentpath) { global $array_dirname, $global_config, $module_file; $pattern = !empty($dir) ? '/^(' . nv_preg_quote($dir) . ')\\/([^\\/]+)$/' : '/^([^\\/]+)$/'; $_dirlist = preg_grep($pattern, array_keys($array_dirname)); $content = ''; foreach ($_dirlist as $_dir) { $check_allow_upload_dir = nv_check_allow_upload_dir($_dir); if (!empty($check_allow_upload_dir)) { $class_li = ($_dir == $currentpath or strpos($currentpath, $_dir . '/') !== false) ? 'open collapsable' : 'expandable'; $style_color = $_dir == $currentpath ? ' style="color:red"' : ''; $tree = array(); $tree['class1'] = $class_li; $tree['class2'] = nv_set_dir_class($check_allow_upload_dir) . ' pos' . nv_string_to_filename($dir); $tree['style'] = $style_color; $tree['title'] = $_dir; $tree['titlepath'] = basename($_dir); $content2 = viewdirtree($_dir, $currentpath); $xtpl = new XTemplate('foldlist.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file); $xtpl->assign('DIRTREE', $tree); if (empty($content2)) { $content2 = '<li class="hide"> </li>'; } if (!empty($content2)) { $xtpl->assign('TREE_CONTENT', $content2); $xtpl->parse('tree.tree_content'); } $xtpl->parse('tree'); $content .= $xtpl->text('tree'); } } return $content; }
<?php /** * @Project NUKEVIET 4.x * @Author Mr.Thang (kid.apt@gmail.com) * @License GNU/GPL version 2 or any later version * @Createdate 16-03-2015 12:55 */ $path = nv_check_path_upload(NV_UPLOADS_DIR . '/' . $mod_name); $check_allow_upload_dir = nv_check_allow_upload_dir($path); $data = $nv_Request->get_string('data', 'post', ''); if (isset($check_allow_upload_dir['upload_file']) and in_array('images', $admin_info['allow_files_type']) and preg_match_all('/<\\s*img [^\\>]*src\\s*=\\s*[\\""\']?([^\\""\'\\s>]*)/i', $data, $matches)) { $imageMatch = array_unique($matches[1]); $mod_name = $nv_Request->get_title('module_name', 'post', ''); $pathsave = $nv_Request->get_title('pathsave', 'post', ''); $upload_real_dir_page = NV_ROOTDIR . '/' . NV_UPLOADS_DIR . '/' . $mod_name; if (!empty($pathsave)) { if (!preg_match('/^[a-z0-9\\-\\_]+$/i', $module_name)) { $pathsave = change_alias($pathsave); } $pathsave = $mod_name . '/' . $pathsave; $e = explode('/', $pathsave); if (!empty($e)) { $cp = ''; foreach ($e as $p) { if (!empty($p) and !is_dir(NV_ROOTDIR . '/' . NV_UPLOADS_DIR . '/' . $cp . $p)) { $mk = nv_mkdir(NV_ROOTDIR . '/' . NV_UPLOADS_DIR . '/' . $cp, $p); if ($mk[0] > 0) { $upload_real_dir_page = $mk[2]; } } elseif (!empty($p)) {
<?php /** * @Project NUKEVIET 3.0 * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2010 VINADES.,JSC. All rights reserved * @Createdate 2-2-2010 12:55 */ if (!defined('NV_IS_FILE_ADMIN')) { die('Stop!!!'); } $path = htmlspecialchars(trim($nv_Request->get_string('path', 'get')), ENT_QUOTES); $image = htmlspecialchars(trim($nv_Request->get_string('img', 'get')), ENT_QUOTES); $path_filename = NV_ROOTDIR . '/' . $path . "/" . $image; if (file_exists($path_filename) && is_file($path_filename) && nv_check_allow_upload_dir($path)) { //Download file require_once NV_ROOTDIR . '/includes/class/download.class.php'; $download = new download($path_filename, NV_ROOTDIR . '/' . $path, basename($path_filename)); $download->download_file(); exit; } else { echo 'file not exist !'; }
<?php /** * @Project NUKEVIET 3.x * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2012 VINADES.,JSC. All rights reserved * @Createdate 2-2-2010 12:55 */ if (!defined('NV_IS_FILE_ADMIN')) { die('Stop!!!'); } $path = nv_check_path_upload($nv_Request->get_string('path', 'post,get')); $image = htmlspecialchars(trim($nv_Request->get_string('img', 'post,get')), ENT_QUOTES); $image = basename($image); $path_filename = NV_ROOTDIR . '/' . $path . "/" . $image; if (!empty($image) && is_file($path_filename) && nv_check_allow_upload_dir($path)) { //Download file require_once NV_ROOTDIR . '/includes/class/download.class.php'; $download = new download($path_filename, NV_ROOTDIR . '/' . $path, $image); $download->download_file(); exit; } else { echo 'file not exist !'; }
*/ if (!defined('NV_IS_FILE_ADMIN')) { die('Stop!!!'); } $page_title = $lang_module['upload_manager']; # config $path = htmlspecialchars(trim($nv_Request->get_string('path', 'get', NV_UPLOADS_DIR)), ENT_QUOTES); $currentPath = htmlspecialchars(trim($nv_Request->get_string('currentpath', 'post,get')), ENT_QUOTES); $area = ""; $popup = $nv_Request->get_int('popup', 'get', 0); $selectedfile = ''; $uploadflag = $nv_Request->isset_request('confirm', 'post'); if ($uploadflag) { $imgurl = htmlspecialchars(trim($nv_Request->get_string('imgurl', 'post')), ENT_QUOTES); $imgfolder = htmlspecialchars(trim($nv_Request->get_string('path', 'post')), ENT_QUOTES); if (is_uploaded_file($_FILES['fileupload']['tmp_name']) && nv_check_allow_upload_dir($imgfolder)) { require_once NV_ROOTDIR . "/includes/class/upload.class.php"; $upload = new upload($admin_info['allow_files_type'], $global_config['forbid_extensions'], $global_config['forbid_mimes'], NV_UPLOAD_MAX_FILESIZE, NV_MAX_WIDTH, NV_MAX_HEIGHT); $upload_info = $upload->save_file($_FILES['fileupload'], NV_ROOTDIR . '/' . $imgfolder, false); if (!empty($upload_info['error'])) { $errors[] = $upload_info['error']; } else { $selectedfile = $upload_info['basename']; } } elseif (!empty($imgurl)) { $prover = @getimagesize($imgurl); if ($prover) { $imgname = end(explode("/", $imgurl)); $imgname = str_replace('%', '_', $imgname); $file_type = strtolower($types[$prover[2]]); if (in_array($file_type, $allowed_extensions)) {
<?php /** * @Project NUKEVIET 3.x * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2012 VINADES.,JSC. All rights reserved * @Createdate 2-9-2010 14:43 */ if (!defined('NV_IS_FILE_ADMIN')) { die('Stop!!!'); } $CKEditorFuncNum = $nv_Request->get_string('CKEditorFuncNum', 'post,get', 0); $imgfolder = nv_check_path_upload($nv_Request->get_string('currentpath', 'post,get')); $check_allow_upload_dir = nv_check_allow_upload_dir($imgfolder); /** * SendUploadResults() * * @param mixed $errorNumber * @param string $fileUrl * @param string $fileName * @param string $customMsg * @return void */ function SendUploadResults($errorNumber, $fileUrl = "", $fileName = "", $customMsg = "") { global $CKEditorFuncNum; if ($CKEditorFuncNum) { echo "<script type=\"text/javascript\">window.parent.CKEDITOR.tools.callFunction(" . $CKEditorFuncNum . ", '" . $fileUrl . "', '" . $customMsg . "');</script>"; } else { echo "<script type=\"text/javascript\">(function(){var d=document.domain;while (true){try{var A=window.parent.document.domain;break;}catch(e) {};d=d.replace(/.*?(?:\\.|\$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})();window.parent.OnUploadCompleted({$errorNumber},\"" . $fileUrl . "\",\"" . $fileName . "\", \"" . $customMsg . "\");</script>"; }
<?php /** * @Project NUKEVIET 3.0 * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2010 VINADES.,JSC. All rights reserved * @Createdate 2-2-2010 12:55 */ if (!defined('NV_IS_FILE_ADMIN')) { die('Stop!!!'); } $path = htmlspecialchars(trim($nv_Request->get_string('path', 'post')), ENT_QUOTES); if ($admin_info['allow_modify_files'] && nv_check_allow_upload_dir($path)) { $image = htmlspecialchars(trim($nv_Request->get_string('img', 'post')), ENT_QUOTES); $newfolder = htmlspecialchars(trim($nv_Request->get_string('folder', 'post')), ENT_QUOTES); if (!empty($newfolder) && $path != $newfolder) { @rename(NV_ROOTDIR . '/' . $path . '/' . $image, NV_ROOTDIR . '/' . $newfolder . '/' . $image); } }
<?php /** * @Project NUKEVIET 4.x * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2014 VINADES.,JSC. All rights reserved * @License GNU/GPL version 2 or any later version * @Createdate 2-2-2010 12:55 */ if (!defined('NV_IS_FILE_ADMIN')) { die('Stop!!!'); } $path = nv_check_path_upload($nv_Request->get_string('path', 'post,get')); $image = htmlspecialchars(trim($nv_Request->get_string('img', 'post,get')), ENT_QUOTES); $image = basename($image); $path_filename = NV_BASE_SITEURL . $path . '/' . $image; if (!empty($image) and nv_is_file($path_filename, $path) and nv_check_allow_upload_dir($path)) { //Download file $download = new NukeViet\Files\Download(NV_DOCUMENT_ROOT . $path_filename, NV_ROOTDIR . '/' . $path, $image); $download->download_file(); exit; } else { echo 'file not exist !'; }
* @Project NUKEVIET 4.x * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2014 VINADES.,JSC. All rights reserved * @License GNU/GPL version 2 or any later version * @Createdate 2-2-2010 12:55 */ if (!defined('NV_IS_FILE_ADMIN')) { die('Stop!!!'); } $path = nv_check_path_upload($nv_Request->get_string('path', 'post')); $check_allow_upload_dir = nv_check_allow_upload_dir($path); if (!isset($check_allow_upload_dir['move_file'])) { die("ERROR#" . $lang_module['notlevel']); } $newfolder = nv_check_path_upload($nv_Request->get_string('newpath', 'post')); $check_allow_upload_dir = nv_check_allow_upload_dir($newfolder); if (!isset($check_allow_upload_dir['create_file'])) { die("ERROR#" . $lang_module['notlevel']); } $images = array_map("basename", explode("|", htmlspecialchars(trim($nv_Request->get_string('file', 'post')), ENT_QUOTES))); // Check choose file if (empty($images)) { die('ERROR#' . $lang_module['errorNotSelectFile']); } // Check file exists foreach ($images as $file) { if (!nv_is_file(NV_BASE_SITEURL . $path . '/' . $file, $path)) { die('ERROR#' . $lang_module['file_no_exists'] . ': ' . $file); } } $mirror = $nv_Request->get_int('mirror', 'post', 0);
<?php /** * @Project NUKEVIET 3.0 * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2010 VINADES.,JSC. All rights reserved * @Createdate 2-2-2010 12:55 */ if (!defined('NV_IS_FILE_ADMIN')) { die('Stop!!!'); } $path = htmlspecialchars(trim($nv_Request->get_string('path', 'post')), ENT_QUOTES); $newname = htmlspecialchars(trim($nv_Request->get_string('newname', 'post')), ENT_QUOTES); if (!empty($newname) && !file_exists(NV_ROOTDIR . '/' . $path . '/' . change_alias($newname)) && $admin_info['allow_create_subdirectories'] && nv_check_allow_upload_dir($path)) { $n_dir = nv_mkdir(NV_ROOTDIR . '/' . $path, change_alias($newname)); if (!empty($n_dir[0])) { echo $path . '/' . change_alias($newname); } }
*/ if (!defined('NV_IS_FILE_ADMIN')) { die('Stop!!!'); } $path = htmlspecialchars(trim($nv_Request->get_string('path', 'request', NV_UPLOADS_DIR)), ENT_QUOTES); if (!nv_check_allow_upload_dir($path)) { $path = NV_UPLOADS_DIR; } $currentpath = htmlspecialchars(trim($nv_Request->get_string('currentpath', 'request', NV_UPLOADS_DIR)), ENT_QUOTES); echo '<ul id="foldertree" class="filetree">'; echo '<li class="open collapsable"><span ' . ($path == $currentpath ? ' style="color:red"' : '') . ' class="folder" title="' . $path . '"> ' . $path . '</span>'; echo '<ul>'; $arr_files = @scandir(NV_ROOTDIR . '/' . $path); foreach ($arr_files as $file) { $full_d = NV_ROOTDIR . '/' . $path . '/' . $file; if (is_dir($full_d) && !in_array($file, $array_hidefolders) && nv_check_allow_upload_dir($path . '/' . $file)) { if ($path . '/' . $file == $currentpath) { echo '<li class="open collapsable"><span style="color:red" class="folder" title="' . ($path . '/' . $file) . '"> ' . $file . '</span>'; } else { echo '<li class="expandable"><span class="folder" title="' . ($path . '/' . $file) . '"> ' . $file . '</span>'; } echo '<ul>'; viewdirtree($path . '/' . $file, $currentpath); echo '</ul>'; echo '</li>'; } } echo '</ul>'; echo '</li>'; echo '</ul>'; echo '
<?php /** * @Project NUKEVIET 3.0 * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2010 VINADES.,JSC. All rights reserved * @Createdate 2-2-2010 12:55 */ if (!defined('NV_IS_FILE_ADMIN')) { die('Stop!!!'); } $path = htmlspecialchars(trim($nv_Request->get_string('path', 'post')), ENT_QUOTES); $realfolder = end(explode('/', $path)); $remainpath = substr($path, 0, -strlen($realfolder)); $newname = htmlspecialchars(trim($nv_Request->get_string('newname', 'post')), ENT_QUOTES); if (!empty($newname) && $newname != $path && $newname != NV_UPLOADS_DIR && $admin_info['allow_modify_subdirectories'] && nv_check_allow_upload_dir($path)) { @rename(NV_ROOTDIR . '/' . $path, NV_ROOTDIR . '/' . $remainpath . change_alias($newname)); } echo $remainpath . change_alias($newname);
<?php /** * @Project NUKEVIET 3.0 * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2010 VINADES.,JSC. All rights reserved * @Createdate 2-2-2010 12:55 */ if (!defined('NV_IS_FILE_ADMIN')) { die('Stop!!!'); } $path = htmlspecialchars(trim($nv_Request->get_string('path', 'post')), ENT_QUOTES); if (trim($path) != NV_UPLOADS_DIR && !empty($path) && $admin_info['allow_modify_subdirectories'] && nv_check_allow_upload_dir($path)) { nv_deletefile(NV_ROOTDIR . '/' . trim($path), true); }
<?php /** * @Project NUKEVIET 3.0 * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2010 VINADES.,JSC. All rights reserved * @Createdate 2-2-2010 12:55 */ if (!defined('NV_IS_FILE_ADMIN')) { die('Stop!!!'); } $pathimg = htmlspecialchars(trim($nv_Request->get_string('path', 'get', NV_UPLOADS_DIR)), ENT_QUOTES); $type = htmlspecialchars(trim($nv_Request->get_string('type', 'get', 'file')), ENT_QUOTES); $selectfile = htmlspecialchars(trim($nv_Request->get_string('imgfile', 'get')), ENT_QUOTES); $imglist = array(); if (!nv_check_allow_upload_dir($pathimg)) { $pathimg = NV_UPLOADS_DIR; } $files = @scandir(NV_ROOTDIR . "/" . $pathimg); if (!empty($files)) { if ($type == 'image') { $filter = "\\.(gif|jpg|jpeg|pjpeg|png)"; } if ($type == 'flash') { $filter = "\\.(flv|swf|swc)"; } foreach ($files as $file) { $full_d = NV_ROOTDIR . '/' . $pathimg . '/' . $file; if (!in_array($file, $array_hidefolders) and !is_dir($full_d)) { if ($type != 'file') { if (preg_match('/^[a-zA-Z0-9\\-\\_](.*)' . $filter . '$/', strtolower($file))) {