diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/appinfo/app.php | 1 | ||||
-rw-r--r-- | apps/files_sharing/js/share.js | 1 | ||||
-rw-r--r-- | apps/files_sharing/lib_share.php | 4 | ||||
-rw-r--r-- | apps/files_sharing/sharedstorage.php | 89 | ||||
-rw-r--r-- | apps/files_texteditor/ajax/loadfile.php | 2 | ||||
-rw-r--r-- | apps/files_texteditor/ajax/savefile.php | 3 |
6 files changed, 22 insertions, 78 deletions
diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php index 8d589ea5e2e..8049e9b0ae3 100644 --- a/apps/files_sharing/appinfo/app.php +++ b/apps/files_sharing/appinfo/app.php @@ -6,7 +6,6 @@ OC::$CLASSPATH['OC_Share'] = "apps/files_sharing/lib_share.php"; OC_Hook::connect("OC_Filesystem", "post_delete", "OC_Share", "deleteItem"); OC_Hook::connect("OC_Filesystem", "post_rename", "OC_Share", "renameItem"); OC_Hook::connect("OC_Filesystem", "post_write", "OC_Share", "updateItem"); -OC_Filesystem::registerStorageType("shared", "OC_Filestorage_Shared", array("datadir" => "string")); OC_Util::addScript("files_sharing", "share"); OC_Util::addScript("3rdparty", "chosen/chosen.jquery.min"); OC_Util::addStyle( 'files_sharing', 'sharing' ); diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index 4457dddbe15..d01a07447a6 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -2,6 +2,7 @@ $(document).ready(function() { var shared_status = {}; if (typeof FileActions !== 'undefined') { FileActions.register('all', 'Share', function(filename) { + if (scanFiles.scanning){return;}//workaround to prevent aditional http request block scanning feedback var icon; var file = $('#dir').val()+'/'+filename; if(shared_status[file]) diff --git a/apps/files_sharing/lib_share.php b/apps/files_sharing/lib_share.php index 0eb0e5bf85d..049a74278b3 100644 --- a/apps/files_sharing/lib_share.php +++ b/apps/files_sharing/lib_share.php @@ -89,8 +89,8 @@ class OC_Share { } $query->execute(array($uid_owner, $uid, $source, $target, $permissions)); // Clear the folder size cache for the 'Shared' folder - $clearFolderSize = OC_DB::prepare("DELETE FROM *PREFIX*foldersize WHERE path = ?"); - $clearFolderSize->execute(array($sharedFolder)); +// $clearFolderSize = OC_DB::prepare("DELETE FROM *PREFIX*foldersize WHERE path = ?"); +// $clearFolderSize->execute(array($sharedFolder)); // Emit post_create and post_write hooks to notify of a new file in the user's filesystem OC_Hook::emit("OC_Filesystem", "post_create", array('path' => $target)); OC_Hook::emit("OC_Filesystem", "post_write", array('path' => $target)); diff --git a/apps/files_sharing/sharedstorage.php b/apps/files_sharing/sharedstorage.php index b0eaeecf723..4840cce4c9d 100644 --- a/apps/files_sharing/sharedstorage.php +++ b/apps/files_sharing/sharedstorage.php @@ -22,10 +22,10 @@ require_once( 'lib_share.php' ); -if (!OC_Filesystem::is_dir('/Shared')) { +if (OC_Filesystem::$loaded and !OC_Filesystem::is_dir('/Shared')) { OC_Filesystem::mkdir('/Shared'); } -OC_Filesystem::mount('shared',array('datadir'=>'/'.OC_User::getUser().'/files/Shared'),'/'.OC_User::getUser().'/files/Shared/'); +OC_Filesystem::mount('OC_Filestorage_Shared',array('datadir'=>'/'.OC_User::getUser().'/files/Shared'),'/'.OC_User::getUser().'/files/Shared/'); /** * Convert target path to source path and pass the function call to the correct storage provider @@ -168,19 +168,9 @@ class OC_Filestorage_Shared extends OC_Filestorage { // TODO fill in other components of array public function stat($path) { if ($path == "" || $path == "/") { - $stat["dev"] = ""; - $stat["ino"] = ""; - $stat["mode"] = ""; - $stat["nlink"] = ""; - $stat["uid"] = ""; - $stat["gid"] = ""; - $stat["rdev"] = ""; $stat["size"] = $this->filesize($path); - $stat["atime"] = $this->fileatime($path); $stat["mtime"] = $this->filemtime($path); $stat["ctime"] = $this->filectime($path); - $stat["blksize"] = ""; - $stat["blocks"] = ""; return $stat; } else { $source = $this->getSource($path); @@ -217,18 +207,7 @@ class OC_Filestorage_Shared extends OC_Filestorage { } public function getFolderSize($path) { - // Shared folder sizes are cached separately from the source folder sizes because folders can have different names - $path = rtrim($path, "/"); - $path = ltrim($path, "/"); - $path = preg_replace('{(/)\1+}', "/", $path); - $dbpath = rtrim($this->datadir.$path, "/"); - $query = OC_DB::prepare("SELECT size FROM *PREFIX*foldersize WHERE path = ?"); - $size = $query->execute(array($dbpath))->fetchAll(); - if (count($size) > 0) { - return $size[0]['size']; - } else { - return $this->calculateFolderSize($path); - } + return 0; //depricated } private function calculateFolderSize($path) { @@ -249,8 +228,8 @@ class OC_Filestorage_Shared extends OC_Filestorage { } if ($size > 0) { $dbpath = rtrim($this->datadir.$path, "/"); - $query = OC_DB::prepare("INSERT INTO *PREFIX*foldersize VALUES(?,?)"); - $result = $query->execute(array($dbpath, $size)); +// $query = OC_DB::prepare("INSERT INTO *PREFIX*foldersize VALUES(?,?)"); +// $result = $query->execute(array($dbpath, $size)); } } return $size; @@ -263,8 +242,8 @@ class OC_Filestorage_Shared extends OC_Filestorage { $path = dirname($path); } $dbpath = rtrim($this->datadir.$path, "/"); - $query = OC_DB::prepare("DELETE FROM *PREFIX*foldersize WHERE path = ?"); - $result = $query->execute(array($dbpath)); +// $query = OC_DB::prepare("DELETE FROM *PREFIX*/*foldersize*/ WHERE path = ?"); +// $result = $query->execute(array($dbpath)); if ($path != "/" && $path != "") { $parts = explode("/", $path); $part = array_pop($parts); @@ -280,7 +259,7 @@ class OC_Filestorage_Shared extends OC_Filestorage { return true; } - public function is_writeable($path) { + public function is_writable($path) { if($path == "" || $path == "/"){ return false; }elseif (OC_Share::getPermissions($this->datadir.$path) & OC_Share::WRITE) { @@ -320,8 +299,8 @@ class OC_Filestorage_Shared extends OC_Filestorage { $ctime = $tempctime; } } - return $ctime; } + return $ctime; } else { $source = $this->getSource($path); if ($source) { @@ -341,8 +320,8 @@ class OC_Filestorage_Shared extends OC_Filestorage { $mtime = $tempmtime; } } - return $mtime; } + return $mtime; } else { $source = $this->getSource($path); if ($source) { @@ -352,27 +331,6 @@ class OC_Filestorage_Shared extends OC_Filestorage { } } - public function fileatime($path) { - if ($path == "" || $path == "/") { - $atime = 0; - if ($dh = $this->opendir($path)) { - while (($filename = readdir($dh)) !== false) { - $tempatime = $this->fileatime($filename); - if ($tempatime > $atime) { - $atime = $tempatime; - } - } - return $atime; - } - } else { - $source = $this->getSource($path); - if ($source) { - $storage = OC_Filesystem::getStorage($source); - return $storage->fileatime($this->getInternalPath($source)); - } - } - } - public function file_get_contents($path) { $source = $this->getSource($path); if ($source) { @@ -382,7 +340,7 @@ class OC_Filestorage_Shared extends OC_Filestorage { } public function file_put_contents($path, $data) { - if ($this->is_writeable($path)) { + if ($this->is_writable($path)) { $source = $this->getSource($path); if ($source) { $storage = OC_Filesystem::getStorage($source); @@ -426,7 +384,7 @@ class OC_Filestorage_Shared extends OC_Filestorage { if ($root1 !== $root2) { return false; // Check if both paths have write permission - } else if ($this->is_writeable($path1) && $this->is_writeable($path2)) { + } else if ($this->is_writable($path1) && $this->is_writable($path2)) { $oldSource = $this->getSource($path1); $newSource = $folders['source'].substr($newTarget, strlen($folders['target'])); if ($oldSource) { @@ -456,7 +414,7 @@ class OC_Filestorage_Shared extends OC_Filestorage { if ($path2 == "" || $path2 == "/") { // TODO Construct new shared item or should this not be allowed? } else { - if ($this->is_writeable($path2)) { + if ($this->is_writable($path2)) { $tmpFile = $this->toTmpFile($path1); $result = $this->fromTmpFile($tmpFile, $path2); if ($result) { @@ -486,7 +444,7 @@ class OC_Filestorage_Shared extends OC_Filestorage { } public function fromTmpFile($tmpFile, $path) { - if ($this->is_writeable($path)) { + if ($this->is_writable($path)) { $source = $this->getSource($path); if ($source) { $storage = OC_Filesystem::getStorage($source); @@ -501,23 +459,10 @@ class OC_Filestorage_Shared extends OC_Filestorage { } } - public function fromUploadedFile($tmpFile, $path) { - if ($this->is_writeable($path)) { - $source = $this->getSource($path); - if ($source) { - $storage = OC_Filesystem::getStorage($source); - $result = $storage->fromUploadedFile($tmpFile, $this->getInternalPath($source)); - if ($result) { - $this->clearFolderSizeCache($path); - } - return $result; - } - } else { - return false; - } - } - public function getMimeType($path) { + if ($path2 == "" || $path2 == "/") { + return 'httpd/unix-directory'; + } $source = $this->getSource($path); if ($source) { $storage = OC_Filesystem::getStorage($source); diff --git a/apps/files_texteditor/ajax/loadfile.php b/apps/files_texteditor/ajax/loadfile.php index 64e016be8c2..8ece844aa29 100644 --- a/apps/files_texteditor/ajax/loadfile.php +++ b/apps/files_texteditor/ajax/loadfile.php @@ -33,7 +33,7 @@ $filename = isset($_GET['file']) ? $_GET['file'] : ''; if(!empty($filename)) { $path = $dir.'/'.$filename; - if(OC_Filesystem::is_writeable($path)) + if(OC_Filesystem::is_writable($path)) { $mtime = OC_Filesystem::filemtime($path); $filecontents = OC_Filesystem::file_get_contents($path); diff --git a/apps/files_texteditor/ajax/savefile.php b/apps/files_texteditor/ajax/savefile.php index 3d0771ea983..589428d1862 100644 --- a/apps/files_texteditor/ajax/savefile.php +++ b/apps/files_texteditor/ajax/savefile.php @@ -32,7 +32,6 @@ $filecontents = htmlspecialchars_decode($_POST['filecontents']); $path = isset($_POST['path']) ? $_POST['path'] : ''; $mtime = isset($_POST['mtime']) ? $_POST['mtime'] : ''; - if($path != '' && $mtime != '') { // Get file mtime @@ -47,7 +46,7 @@ if($path != '' && $mtime != '') { // File same as when opened // Save file - if(OC_Filesystem::is_writeable($path)) + if(OC_Filesystem::is_writable($path)) { OC_Filesystem::file_put_contents($path, $filecontents); // Clear statcache |