Browse Source

agggiornato arav_up_inclu

cek 7 years ago
parent
commit
2d31ea6746
1 changed files with 17 additions and 12 deletions
  1. 17 12
      arav_up_inclu/fileops.php

+ 17 - 12
arav_up_inclu/fileops.php

@@ -1,18 +1,23 @@
 <?php
-require_once('report.php');
 
-function data_mkdir($path, $newdir){
-     // pulisci
-     $newdir = basename(trim($newdir));
-     $newdirpath = realpath($GLOBALS["conf"]["data_basedir"].DIRECTORY_SEPARATOR.$path).DIRECTORY_SEPARATOR.$newdir;
+function data_mkdir($path,$newdir){
+    $filteredpath = realpath($GLOBALS["conf"]["data_basedir"]."/".trim($path));
 
-    report(1, "BABABA ".$newdirpath);
+    if(strpos($filteredpath, $GLOBALS["conf"]["data_basedir"]) === FALSE){
+	return FALSE; // noooo
+    } else {
+	$absnewdirpath = $filteredpath."/".trim($newdir);
 
-     if (!file_exists($newdirpath)) {
-        return mkdir($newdirpath, 0755, false);
-     }
-
-     return false;
- }
+	if (!file_exists($absnewdirpath)) {
+	    if (!mkdir($absnewdirpath, 0755, true)) {
+		return FALSE;
+	    } else {
+		return TRUE;
+	    }
+	} else {
+	    return FALSE;
+	}
+    }
+}
 
 ?>