summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHorus32014-09-22 20:09:36 +0200
committerHorus32014-09-22 20:09:36 +0200
commit9c814f9b2859ea41ee18230a32008bb757d10ef3 (patch)
treec314d4e38a654cf4da0f07a145454e179331535f
parent53a944ea8047dad64a4835c623df306a6d161b8e (diff)
downloadvfs-9c814f9b2859ea41ee18230a32008bb757d10ef3.tar.gz
fixed even more typos
-rw-r--r--public_html/class/vfsdata.php19
1 files changed, 10 insertions, 9 deletions
diff --git a/public_html/class/vfsdata.php b/public_html/class/vfsdata.php
index b92bbac..92d9745 100644
--- a/public_html/class/vfsdata.php
+++ b/public_html/class/vfsdata.php
@@ -21,10 +21,9 @@ class vfsdata {
$this->current_user = $user;
}
- protected function _getRoot($user, $folderpath, $visbility){
- $folder_array = explode('/', $this->folder_path);
+ protected function _getRoot($visbility){
- $sql = $vfsdb->prepare("SELECT id FROM files WHERE parent=0 AND type='DIRECTORY' and owner = %s " . $visibility . ";", $this->owner);
+ $sql = $vfsdb->prepare("SELECT id FROM files WHERE parent=0 AND type='DIRECTORY' and owner = %d " . $visibility . ";", $this->userid);
$root_db = $vfsdb->doQuery($sql);
$root_ar = $root_db->fetch_array(MYSQLI_ASSOC);
$root_id = $root_ar["id"];
@@ -32,15 +31,16 @@ class vfsdata {
return $root_id;
}
- public function getId($user = NULL, $folder = NULL){
+ public function getId($user = NULL, $folder_ = NULL){
global $vfsuser;
if ( is_null($user) )
$user = $this->current_user;
- if ( is_null($folder) )
+ if ( is_null($folder_) )
$folder = $this->folder_path;
+ $folder = explode('/', $folder_);
$this->userid = $vfsuser->getUserId();
# checks if the current user is the actual owner
@@ -49,6 +49,11 @@ class vfsdata {
else
$visibility = " AND visibility='PUBLIC'";
+ $parentdir = $this->_getRoot($visibility);
+
+ if ( empty($folder[0]) )
+ return $parentdir;
+
$tmp_length = count($folder);
if ( empty($folder[$tmp_length-1]) )
@@ -56,10 +61,6 @@ class vfsdata {
else
$length = $tmp_length;
- $parentdir = $this->_getRoot($user, $folder, $visibility);
-
- if ( empty($folder[0]) )
- return $parentdir;
for ( $i=0; $i<$length, $i++ ) {
$sql = $vfsdb->prepare("SELECT id, parent FROM files WHERE owner = %d AND parent = %d AND name = %s " . $visibility . ";", $this->userid, $parentdir, $folder[$i]);