示例#1
0
文件: main.php 项目: lzhao18/nukeviet
/**
 * @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-9-2010 14:43
 */
if (!defined('NV_IS_FILE_ADMIN')) {
    die('Stop!!!');
}
$page_title = $lang_module['upload_manager'];
$contents = '';
$path = defined('NV_IS_SPADMIN') ? '' : NV_UPLOADS_DIR;
$path = nv_check_path_upload($nv_Request->get_string('path', 'get', $path));
$currentpath = nv_check_path_upload($nv_Request->get_string('currentpath', 'get', $path));
$type = $nv_Request->get_string('type', 'get');
$popup = $nv_Request->get_int('popup', 'get', 0);
$area = htmlspecialchars(trim($nv_Request->get_string('area', 'get')), ENT_QUOTES);
$alt = htmlspecialchars(trim($nv_Request->get_string('alt', 'get')), ENT_QUOTES);
if (empty($currentpath)) {
    $currentpath = NV_UPLOADS_DIR;
}
if ($type != 'image' and $type != 'flash') {
    $type = 'file';
}
$xtpl = new XTemplate('main.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file);
if ($popup) {
    $lang_module['browse_file'] = $lang_global['browse_file'];
    $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
    $xtpl->assign('ADMIN_THEME', $global_config['module_theme']);
示例#2
0
<?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)) {
示例#3
0
<?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'));
$check_allow_upload_dir = nv_check_allow_upload_dir($path);
if (!isset($check_allow_upload_dir['create_file'])) {
    die('ERROR_' . $lang_module['notlevel']);
}
$width = $nv_Request->get_int('width', 'post');
$height = $nv_Request->get_int('height', 'post');
$imagename = htmlspecialchars(trim($nv_Request->get_string('img', 'post')), ENT_QUOTES);
$imagename = basename($imagename);
$file = preg_replace('/^(.*)(\\.[a-zA-Z]+)$/', '\\1_' . $width . '_' . $height . '\\2', $imagename);
$i = 1;
while (file_exists(NV_ROOTDIR . '/' . $path . '/' . $file)) {
    $file = preg_replace('/^(.*)(\\.[a-zA-Z]+)$/', '\\1_' . $width . '_' . $height . '_' . $i . '\\2', $imagename);
    ++$i;
}
if (isset($array_thumb_config[$path])) {
    $thumb_config = $array_thumb_config[$path];
} else {
    $thumb_config = $array_thumb_config[''];
示例#4
0
<?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!!!');
}
$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);
示例#5
0
<?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>";
    }
示例#6
0
                $xtpl->assign('TREE_CONTENT', $content2);
                $xtpl->parse('tree.tree_content');
            }
            $xtpl->parse('tree');
            $content .= $xtpl->text('tree');
        }
    }
    return $content;
}
$path = nv_check_path_upload($nv_Request->get_string('path', 'get,post', NV_UPLOADS_DIR));
if (empty($path)) {
    if ($global_config['idsite'] or !defined('NV_IS_SPADMIN')) {
        $path = NV_UPLOADS_DIR;
    }
}
$currentpath = nv_check_path_upload($nv_Request->get_string('currentpath', 'request', NV_UPLOADS_DIR));
$check_allow_upload_dir = nv_check_allow_upload_dir($path);
$data = array();
$data['style'] = $path == $currentpath ? ' style="color:red"' : '';
$data['class'] = nv_set_dir_class($check_allow_upload_dir) . ' pos' . nv_string_to_filename($path);
$data['title'] = $path;
$data['titlepath'] = empty($path) ? NV_BASE_SITEURL : $path;
$content = viewdirtree($path, $currentpath);
$xtpl = new XTemplate('foldlist.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file);
$xtpl->assign('DATA', $data);
$xtpl->assign('PATH', $path);
$xtpl->assign('CURRENTPATH', $currentpath);
$check_allow_upload_dir = nv_check_allow_upload_dir($currentpath);
$xtpl->assign('VIEW_DIR', (isset($check_allow_upload_dir['view_dir']) and $check_allow_upload_dir['view_dir'] === true) ? 1 : 0);
$xtpl->assign('CREATE_DIR', (isset($check_allow_upload_dir['create_dir']) and $check_allow_upload_dir['create_dir'] === true) ? 1 : 0);
$xtpl->assign('RENAME_DIR', (isset($check_allow_upload_dir['rename_dir']) and $check_allow_upload_dir['rename_dir'] === true) ? 1 : 0);
示例#7
0
文件: moveimg.php 项目: nukeplus/nuke
/**
 * @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);
    }
}