diff --git a/tinyfilemanager.php b/tinyfilemanager.php index f9c5363..6b5c3aa 100644 --- a/tinyfilemanager.php +++ b/tinyfilemanager.php @@ -212,8 +212,9 @@ if (isset($_GET['del']) && !FM_READONLY) { } // Create folder -if (isset($_GET['new']) && !FM_READONLY) { +if (isset($_GET['new']) && isset($_GET['type']) && !FM_READONLY) { $new = $_GET['new']; + $type = $_GET['type']; $new = fm_clean_path($new); $new = str_replace('/', '', $new); if ($new != '' && $new != '..' && $new != '.') { @@ -221,12 +222,21 @@ if (isset($_GET['new']) && !FM_READONLY) { if (FM_PATH != '') { $path .= '/' . FM_PATH; } - if (fm_mkdir($path . '/' . $new, false) === true) { - fm_set_msg(sprintf(fm_t('Folder %s created'), $new)); - } elseif (fm_mkdir($path . '/' . $new, false) === $path . '/' . $new) { - fm_set_msg(sprintf(fm_t('Folder %s already exists'), $new), 'alert'); + if($_GET['type']=="file") { + if(!file_exists($path . '/' . $new)) { + @fopen($path . '/' . $new, 'w') or die('Cannot open file: '.$new); + fm_set_msg(sprintf(fm_t('File %s created'), $new)); + } else { + fm_set_msg(sprintf(fm_t('File %s already exists'), $new), 'alert'); + } } else { - fm_set_msg(sprintf(fm_t('Folder %s not created'), $new), 'error'); + if (fm_mkdir($path . '/' . $new, false) === true) { + fm_set_msg(sprintf(fm_t('Folder %s created'), $new)); + } elseif (fm_mkdir($path . '/' . $new, false) === $path . '/' . $new) { + fm_set_msg(sprintf(fm_t('Folder %s already exists'), $new), 'alert'); + } else { + fm_set_msg(sprintf(fm_t('Folder %s not created'), $new), 'error'); + } } } else { fm_set_msg(fm_t('Wrong folder name'), 'error'); @@ -1178,7 +1188,7 @@ if (empty($folders) && empty($files)) { -H3K | File Manager
+H3K | Tiny File Manager @@ -1819,7 +1829,7 @@ function fm_show_nav_path($path) @@ -1911,9 +1921,9 @@ body {margin:0 30px;margin-top: 45px;}.logo{color:#0df70d;float:left;font-size:2