forked from khoidang1704/banquanao
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreatefolder.php
47 lines (38 loc) · 1.45 KB
/
createfolder.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
* @Project NUKEVIET 4.x
* @Author VINADES.,JSC ([email protected])
* @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'));
$newname = nv_string_to_filename(htmlspecialchars(trim($nv_Request->get_string('newname', 'post')), ENT_QUOTES));
$check_allow_upload_dir = nv_check_allow_upload_dir($path);
if (! isset($check_allow_upload_dir['create_dir']) or $check_allow_upload_dir['create_dir'] !== true) {
die('ERROR_' . $lang_module['notlevel']);
}
if (empty($path)) {
die('ERROR_' . $lang_module['notlevel']);
}
if (empty($newname)) {
die('ERROR_' . $lang_module['name_nonamefolder']);
}
$newpath = $path . '/' . $newname;
if (is_dir(NV_ROOTDIR . '/' . $newpath)) {
die('ERROR_' . $lang_module['folder_exists']);
}
$n_dir = nv_mkdir(NV_ROOTDIR . '/' . $path, $newname);
if (! empty($n_dir[0])) {
$sth = $db->prepare('INSERT INTO ' . NV_UPLOAD_GLOBALTABLE . '_dir (dirname, time, thumb_type, thumb_width, thumb_height, thumb_quality) VALUES (:newpath, 0, 0, 0, 0, 0)');
$sth->bindParam(':newpath', $newpath, PDO::PARAM_STR);
$sth->execute();
nv_insert_logs(NV_LANG_DATA, $module_name, $lang_module['createfolder'], $newpath, $admin_info['userid']);
echo $newpath;
exit();
} else {
die('ERROR_' . $n_dir[1]);
}