*/ if (!defined('NV_IS_FILE_ADMIN')) { die('Stop!!!'); } $pathimg = nv_check_path_upload($nv_Request->get_string('path', 'get', NV_UPLOADS_DIR)); $check_allow_upload_dir = nv_check_allow_upload_dir($pathimg); if (isset($check_allow_upload_dir['view_dir'])) { $type = $nv_Request->get_string('type', 'get', 'file'); if ($type != "image" and $type != "flash") { $type = "file"; } $selectfile = htmlspecialchars(trim($nv_Request->get_string('imgfile', 'get', '')), ENT_QUOTES); $selectfile = basename($selectfile); $author = $nv_Request->isset_request('author', 'get') ? true : false; $refresh = $nv_Request->isset_request('refresh', 'get') ? true : false; $results = nv_filesList($pathimg, $refresh); if (!empty($results)) { $xtpl = new XTemplate("listimg.tpl", NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/modules/" . $module_file); $xtpl->assign("NV_BASE_SITEURL", NV_BASE_SITEURL); $author = $author === true ? $admin_info['userid'] : 0; foreach ($results as $title => $file) { if ($type == "file" or $type != "file" and $file[2] == $type) { if (!$author or $author == $file[8]) { $file = array_combine(array('name0', 'ext', 'type', 'filesize', 'src', 'srcWidth', 'srcHeight', 'name', 'author', 'mtime'), $file); $file['title'] = $title; if ($file['type'] == "image" or $file['ext'] == "swf") { $file['size'] = str_replace("|", " x ", $file['name']) . " pixels"; } else { $file['size'] = nv_convertfromBytes($file['filesize']); } $file['name'] .= "|" . $file['ext'] . "|" . $file['type'] . "|" . nv_convertfromBytes($file['filesize']) . "|" . $file['author'] . "|" . nv_date("l, d F Y, H:i:s P", $file['mtime']);
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>"; } exit; } if (!isset($check_allow_upload_dir['upload_file'])) { SendUploadResults(1, "", "", $lang_module['notlevel']); } if (!isset($_FILES, $_FILES['upload'], $_FILES['upload']['tmp_name'])) { SendUploadResults(1, "", "", $lang_module['errorNotSelectFile']); } $type = $nv_Request->get_string('type', 'post,get'); $allow_files_type = array(); if ($type == "image" and in_array('images', $admin_info['allow_files_type'])) { $allow_files_type = array('images'); } elseif ($type == "flash" and in_array('flash', $admin_info['allow_files_type'])) { $allow_files_type = array('flash'); } elseif (empty($type)) { $allow_files_type = $admin_info['allow_files_type']; } if (empty($allow_files_type)) { SendUploadResults(1, "", "", $lang_module['notlevel']); } require_once NV_ROOTDIR . "/includes/class/upload.class.php"; $upload = new upload($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['upload'], NV_ROOTDIR . '/' . $imgfolder, false); if (!empty($upload_info['error'])) { SendUploadResults(1, "", "", $upload_info['error']); } nv_filesList($imgfolder, false, $upload_info['basename']); nv_insert_logs(NV_LANG_DATA, $module_name, $lang_module['upload_file'], $imgfolder . "/" . $upload_info['basename'], $admin_info['userid']); SendUploadResults(0, NV_BASE_SITEURL . $imgfolder . "/" . $upload_info['basename'], $upload_info['basename'], "");
<?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')); $check_allow_upload_dir = nv_check_allow_upload_dir($path); if (!isset($check_allow_upload_dir['delete_file'])) { die("ERROR_" . $lang_module['notlevel']); } $file = htmlspecialchars(trim($nv_Request->get_string('file', 'post')), ENT_QUOTES); $file = basename($file); if (empty($file) or !is_file(NV_ROOTDIR . '/' . $path . '/' . $file)) { die("ERROR_" . $lang_module['errorNotSelectFile']); } @nv_deletefile(NV_ROOTDIR . '/' . $path . '/' . $file); $md5_view_image = NV_ROOTDIR . "/" . NV_FILES_DIR . "/images/" . md5($path . '/' . $file) . "." . nv_getextension($file); if (file_exists($md5_view_image)) { @nv_deletefile($md5_view_image); } nv_filesList($path, false, '', $file); nv_insert_logs(NV_LANG_DATA, $module_name, $lang_module['upload_delfile'], $path . '/' . $file, $admin_info['userid']); echo "OK";
} $file = htmlspecialchars(trim($nv_Request->get_string('file', 'post')), ENT_QUOTES); $file = basename($file); if (empty($file) or !is_file(NV_ROOTDIR . '/' . $path . '/' . $file)) { die("ERROR_" . $lang_module['errorNotSelectFile']); } $newname = htmlspecialchars(trim($nv_Request->get_string('newname', 'post')), ENT_QUOTES); $newname = nv_string_to_filename(basename($newname)); if (empty($newname)) { die("ERROR_" . $lang_module['rename_noname']); } $ext = nv_getextension($file); $newname = $newname . "." . $ext; $newname2 = $newname; $i = 1; while (file_exists(NV_ROOTDIR . '/' . $path . '/' . $newname2)) { $newname2 = preg_replace('/(.*)(\\.[a-zA-Z0-9]+)$/', '\\1_' . $i . '\\2', $newname); ++$i; } $newname = $newname2; if (!@rename(NV_ROOTDIR . '/' . $path . '/' . $file, NV_ROOTDIR . '/' . $path . '/' . $newname)) { die("ERROR_" . $lang_module['errorNotRenameFile']); } nv_filesList($path, false, $newname, $file); nv_insert_logs(NV_LANG_DATA, $module_name, $lang_module['rename'], $path . '/' . $file . " -> " . $path . '/' . $newname, $admin_info['userid']); $md5_view_image = NV_ROOTDIR . '/' . NV_FILES_DIR . '/images/' . md5($path . '/' . $file) . "." . $ext; if (file_exists($md5_view_image)) { @nv_deletefile($md5_view_image); } echo $newname; exit;
$file_size = $upload_info['img_info']; if ($file_size[0] <= 150) { $w = ceil($logo_size[0] * $global_config['autologosize1'] / 100); } elseif ($file_size[0] < 350) { $w = ceil($logo_size[0] * $global_config['autologosize2'] / 100); } else { if (ceil($file_size[0] * $global_config['autologosize3'] / 100) > $logo_size[0]) { $w = $logo_size[0]; } else { $w = ceil($file_size[0] * $global_config['autologosize3'] / 100); } } $h = ceil($w * $logo_size[1] / $logo_size[0]); $x = $file_size[0] - $w - 5; $y = $file_size[1] - $h - 5; $config_logo = array(); $config_logo['x'] = $file_size[0] - $w - 5; $config_logo['y'] = $file_size[1] - $h - 5; $config_logo['w'] = $w; $config_logo['h'] = $h; require_once NV_ROOTDIR . "/includes/class/image.class.php"; $createImage = new image(NV_ROOTDIR . '/' . $path . '/' . $upload_info['basename'], NV_MAX_WIDTH, NV_MAX_HEIGHT); $createImage->addlogo(NV_ROOTDIR . '/' . $upload_logo, '', '', $config_logo); $createImage->save(NV_ROOTDIR . '/' . $path, $upload_info['basename']); } } } nv_filesList($path, false, $upload_info['basename']); nv_insert_logs(NV_LANG_DATA, $module_name, $lang_module['upload_file'], $path . "/" . $upload_info['basename'], $admin_info['userid']); echo $upload_info['basename']; exit;
$check_allow_upload_dir = nv_check_allow_upload_dir($newfolder); if (!isset($check_allow_upload_dir['create_file'])) { die("ERROR_" . $lang_module['notlevel']); } $image = htmlspecialchars(trim($nv_Request->get_string('file', 'post')), ENT_QUOTES); $image = basename($image); if (empty($image) or !is_file(NV_ROOTDIR . '/' . $path . '/' . $image)) { die("ERROR_" . $lang_module['errorNotSelectFile']); } $mirror = $nv_Request->get_int('mirror', 'post', 0); $file = $image; $i = 1; while (file_exists(NV_ROOTDIR . '/' . $newfolder . '/' . $file)) { $file = preg_replace('/(.*)(\\.[a-zA-Z0-9]+)$/', '\\1_' . $i . '\\2', $image); ++$i; } if (!nv_copyfile(NV_ROOTDIR . '/' . $path . '/' . $image, NV_ROOTDIR . '/' . $newfolder . '/' . $file)) { die("ERROR_" . $lang_module['errorNotCopyFile']); } nv_filesList($newfolder, false, $file); if (!$mirror) { @nv_deletefile(NV_ROOTDIR . '/' . $path . '/' . $image); $md5_view_image = NV_ROOTDIR . '/' . NV_FILES_DIR . '/images/' . md5($path . '/' . $image) . "." . nv_getextension($image); if (file_exists($md5_view_image)) { @nv_deletefile($md5_view_image); } nv_filesList($path, false, '', $image); } nv_insert_logs(NV_LANG_DATA, $module_name, $lang_module['move'], $path . '/' . $image . " -> " . $newfolder . '/' . $file, $admin_info['userid']); echo $file; exit;