diff --git a/apps/files_sharing/lib_share.php b/apps/files_sharing/lib_share.php index b87775dd8c581120a4a3f24f359a9c5fa1d4cab2..a42fed3e763a9ecc50aa04741f0d1c408c004537 100644 --- a/apps/files_sharing/lib_share.php +++ b/apps/files_sharing/lib_share.php @@ -59,7 +59,7 @@ class OC_Share { throw new Exception("This item is already shared with ".$uid); } // Check if the target already exists for the user, if it does append a number to the name - $target = "/".$uid."/files/Share/".basename($source); + $target = "/".$uid."/files/Shared/".basename($source); if (self::getSource($target)) { if ($pos = strrpos($target, ".")) { $name = substr($target, 0, $pos); diff --git a/apps/files_sharing/sharedstorage.php b/apps/files_sharing/sharedstorage.php index 11b141373c4cbca140159cd5e7756af0e715bc70..55254ccd662284326b5005a4154fcb19bddfdfe8 100644 --- a/apps/files_sharing/sharedstorage.php +++ b/apps/files_sharing/sharedstorage.php @@ -32,6 +32,9 @@ class OC_Filestorage_Shared extends OC_Filestorage { public function __construct($arguments) { $this->datadir = $arguments['datadir']; + if (!OC_Filesystem::is_dir($this->datadir)) { + OC_Filesystem::mkdir($this->datadir); + } } public function getInternalPath($path) { @@ -309,14 +312,15 @@ class OC_Filestorage_Shared extends OC_Filestorage { public function filectime($path) { if ($path == "" || $path == "/") { $ctime = 0; - $dir = $this->opendir($path); - while (($filename = readdir($dir)) != false) { - $tempctime = $this->filectime($filename); - if ($tempctime < $ctime) { - $ctime = $tempctime; + if ($dh = $this->opendir($path)) { + while (($filename = readdir($dh)) !== false) { + $tempctime = $this->filectime($filename); + if ($tempctime < $ctime) { + $ctime = $tempctime; + } } + return $ctime; } - return $ctime; } else { $source = $this->getSource($path); if ($source) { @@ -329,14 +333,15 @@ class OC_Filestorage_Shared extends OC_Filestorage { public function filemtime($path) { if ($path == "" || $path == "/") { $mtime = 0; - $dir = $this->opendir($path); - while (($filename = readdir($dir)) != false) { - $tempmtime = $this->filemtime($filename); - if ($tempmtime > $mtime) { - $mtime = $tempmtime; + if ($dh = $this->opendir($path)) { + while (($filename = readdir($dh)) !== false) { + $tempmtime = $this->filemtime($filename); + if ($tempmtime > $mtime) { + $mtime = $tempmtime; + } } + return $mtime; } - return $mtime; } else { $source = $this->getSource($path); if ($source) { @@ -349,14 +354,15 @@ class OC_Filestorage_Shared extends OC_Filestorage { public function fileatime($path) { if ($path == "" || $path == "/") { $atime = 0; - $dir = $this->opendir($path); - while (($filename = readdir($dir)) != false) { - $tempatime = $this->fileatime($filename); - if ($tempatime > $atime) { - $atime = $tempatime; + if ($dh = $this->opendir($path)) { + while (($filename = readdir($dh)) !== false) { + $tempatime = $this->fileatime($filename); + if ($tempatime > $atime) { + $atime = $tempatime; + } } + return $atime; } - return $atime; } else { $source = $this->getSource($path); if ($source) { diff --git a/lib/util.php b/lib/util.php index 53c4283be11b7a9715f58c2e103659bfa7e39b66..4b49d1319b95c0047b0786529496a773348a16e8 100644 --- a/lib/util.php +++ b/lib/util.php @@ -54,8 +54,8 @@ class OC_Util { OC_Filesystem::mount($rootStorage,'/'); // TODO add this storage provider in a proper way - $sharedStorage = OC_Filesystem::createStorage('shared',array('datadir'=>'/'.OC_User::getUser().'/files/Share/')); - OC_Filesystem::mount($sharedStorage,'/'.OC_User::getUser().'/files/Share/'); + $sharedStorage = OC_Filesystem::createStorage('shared',array('datadir'=>'/'.OC_User::getUser().'/files/Shared/')); + OC_Filesystem::mount($sharedStorage,'/'.OC_User::getUser().'/files/Shared/'); $CONFIG_DATADIRECTORY = "$CONFIG_DATADIRECTORY_ROOT/$user/$root"; if( !is_dir( $CONFIG_DATADIRECTORY )){