diff options
-rwxr-xr-x | apps/files_external/lib/config.php | 37 | ||||
-rw-r--r-- | apps/files_sharing/lib/cache.php | 6 | ||||
-rw-r--r-- | apps/files_sharing/lib/helper.php | 4 | ||||
-rw-r--r-- | apps/files_sharing/lib/share/file.php | 7 | ||||
-rw-r--r-- | apps/files_sharing/lib/sharedstorage.php | 26 | ||||
-rw-r--r-- | apps/files_sharing/lib/updater.php | 5 | ||||
-rw-r--r-- | apps/user_ldap/l10n/ast.php | 2 | ||||
-rw-r--r-- | l10n/ast/user_ldap.po | 11 | ||||
-rw-r--r-- | l10n/templates/core.pot | 2 | ||||
-rw-r--r-- | l10n/templates/files.pot | 2 | ||||
-rw-r--r-- | l10n/templates/files_encryption.pot | 2 | ||||
-rw-r--r-- | l10n/templates/files_external.pot | 2 | ||||
-rw-r--r-- | l10n/templates/files_sharing.pot | 2 | ||||
-rw-r--r-- | l10n/templates/files_trashbin.pot | 2 | ||||
-rw-r--r-- | l10n/templates/files_versions.pot | 2 | ||||
-rw-r--r-- | l10n/templates/lib.pot | 2 | ||||
-rw-r--r-- | l10n/templates/private.pot | 2 | ||||
-rw-r--r-- | l10n/templates/settings.pot | 2 | ||||
-rw-r--r-- | l10n/templates/user_ldap.pot | 2 | ||||
-rw-r--r-- | l10n/templates/user_webdavauth.pot | 2 | ||||
-rw-r--r-- | lib/private/share/share.php | 189 | ||||
-rw-r--r-- | lib/private/user/database.php | 4 | ||||
-rw-r--r-- | lib/public/share.php | 143 |
23 files changed, 228 insertions, 230 deletions
diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php index 99eca2f38cf..15fbda927e0 100755 --- a/apps/files_external/lib/config.php +++ b/apps/files_external/lib/config.php @@ -132,7 +132,7 @@ class OC_Mount_Config { } // Load system mount points - $mountConfig = self::readData(false); + $mountConfig = self::readData(); if (isset($mountConfig[self::MOUNT_TYPE_GLOBAL])) { foreach ($mountConfig[self::MOUNT_TYPE_GLOBAL] as $mountPoint => $options) { $options['options'] = self::decryptPasswords($options['options']); @@ -169,7 +169,7 @@ class OC_Mount_Config { } // Load personal mount points - $mountConfig = self::readData(true); + $mountConfig = self::readData($user); if (isset($mountConfig[self::MOUNT_TYPE_USER][$user])) { foreach ($mountConfig[self::MOUNT_TYPE_USER][$user] as $mountPoint => $options) { $options['options'] = self::decryptPasswords($options['options']); @@ -233,7 +233,7 @@ class OC_Mount_Config { * @return array */ public static function getSystemMountPoints() { - $mountPoints = self::readData(false); + $mountPoints = self::readData(); $backends = self::getBackends(); $system = array(); if (isset($mountPoints[self::MOUNT_TYPE_GROUP])) { @@ -306,7 +306,7 @@ class OC_Mount_Config { * @return array */ public static function getPersonalMountPoints() { - $mountPoints = self::readData(true); + $mountPoints = self::readData(OCP\User::getUser()); $backEnds = self::getBackends(); $uid = OCP\User::getUser(); $personal = array(); @@ -400,7 +400,7 @@ class OC_Mount_Config { 'options' => self::encryptPasswords($classOptions)) ) ); - $mountPoints = self::readData($isPersonal); + $mountPoints = self::readData($isPersonal ? OCP\User::getUser() : NULL); // Merge the new mount point into the current mount points if (isset($mountPoints[$mountType])) { if (isset($mountPoints[$mountType][$applicable])) { @@ -412,7 +412,7 @@ class OC_Mount_Config { } else { $mountPoints[$mountType] = $mount; } - self::writeData($isPersonal, $mountPoints); + self::writeData($isPersonal ? OCP\User::getUser() : NULL, $mountPoints); return self::getBackendStatus($class, $classOptions, $isPersonal); } @@ -434,7 +434,7 @@ class OC_Mount_Config { } else { $mountPoint = '/$user/files/'.ltrim($mountPoint, '/'); } - $mountPoints = self::readData($isPersonal); + $mountPoints = self::readData($isPersonal ? OCP\User::getUser() : NULL); // Remove mount point unset($mountPoints[$mountType][$applicable][$mountPoint]); // Unset parent arrays if empty @@ -444,20 +444,20 @@ class OC_Mount_Config { unset($mountPoints[$mountType]); } } - self::writeData($isPersonal, $mountPoints); + self::writeData($isPersonal ? OCP\User::getUser() : NULL, $mountPoints); return true; } /** * Read the mount points in the config file into an array - * @param boolean $isPersonal Personal or system config file + * @param string|null $user If not null, personal for $user, otherwise system * @return array */ - private static function readData($isPersonal) { + private static function readData($user = NULL) { $parser = new \OC\ArrayParser(); - if ($isPersonal) { - $phpFile = OC_User::getHome(OCP\User::getUser()).'/mount.php'; - $jsonFile = OC_User::getHome(OCP\User::getUser()).'/mount.json'; + if (isset($user)) { + $phpFile = OC_User::getHome($user).'/mount.php'; + $jsonFile = OC_User::getHome($user).'/mount.json'; } else { $phpFile = OC::$SERVERROOT.'/config/mount.php'; $datadir = \OC_Config::getValue('datadirectory', \OC::$SERVERROOT . '/data/'); @@ -479,13 +479,12 @@ class OC_Mount_Config { /** * Write the mount points to the config file - * @param bool Personal or system config file - * @param array Mount points - * @param boolean $isPersonal + * @param string|null $user If not null, personal for $user, otherwise system + * @param array $data Mount points */ - private static function writeData($isPersonal, $data) { - if ($isPersonal) { - $file = OC_User::getHome(OCP\User::getUser()).'/mount.json'; + private static function writeData($user, $data) { + if (isset($user)) { + $file = OC_User::getHome($user).'/mount.json'; } else { $datadir = \OC_Config::getValue('datadirectory', \OC::$SERVERROOT . '/data/'); $file = \OC_Config::getValue('mount_file', $datadir . '/mount.json'); diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php index 1f316301c47..f74315c85f9 100644 --- a/apps/files_sharing/lib/cache.php +++ b/apps/files_sharing/lib/cache.php @@ -442,6 +442,9 @@ class Shared_Cache extends Cache { } } + /** + * @param integer $id + */ private function getShareById($id) { $item = \OCP\Share::getItemSharedWithBySource('file', $id); if ($item) { @@ -454,6 +457,9 @@ class Shared_Cache extends Cache { return null; } + /** + * @param integer $id + */ private function getParentInfo($id) { $sql = 'SELECT `parent`, `name` FROM `*PREFIX*filecache` WHERE `fileid` = ?'; $query = \OC_DB::prepare($sql); diff --git a/apps/files_sharing/lib/helper.php b/apps/files_sharing/lib/helper.php index c7347539fcc..dd4056b48f1 100644 --- a/apps/files_sharing/lib/helper.php +++ b/apps/files_sharing/lib/helper.php @@ -79,7 +79,7 @@ class Helper { * @param array $linkItem link item array * @param string $password optional password * - * @return true if authorized, false otherwise + * @return boolean true if authorized, false otherwise */ public static function authenticate($linkItem, $password) { if ($password !== null) { @@ -125,7 +125,7 @@ class Helper { $ids = array(); - while ($path !== '' && $path !== '.' && $path !== '/') { + while ($path !== dirname($path)) { $info = $ownerView->getFileInfo($path); if ($info instanceof \OC\Files\FileInfo) { $ids[] = $info['fileid']; diff --git a/apps/files_sharing/lib/share/file.php b/apps/files_sharing/lib/share/file.php index a18137e65ba..9950b4d61fd 100644 --- a/apps/files_sharing/lib/share/file.php +++ b/apps/files_sharing/lib/share/file.php @@ -183,8 +183,13 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent { return $source; } + /** + * @param string $target + * @param string $mountPoint + * @param string $itemType + * @return array|false source item + */ public static function getSource($target, $mountPoint, $itemType) { - if ($itemType === 'folder') { $source = \OCP\Share::getItemSharedWith('folder', $mountPoint, \OC_Share_Backend_File::FORMAT_SHARED_STORAGE); if ($source && $target !== '') { diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index 4733dff3d14..d4a817fca34 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -102,14 +102,15 @@ class Shared extends \OC\Files\Storage\Common { /** * @brief Get the permissions granted for a shared file * @param string Shared target file path - * @return int CRUDS permissions granted or false if not found + * @return int CRUDS permissions granted */ public function getPermissions($target) { - $source = $this->getFile($target); - if ($source) { - return $source['permissions']; + $permissions = $this->share['permissions']; + // part file are always have delete permissions + if (pathinfo($target, PATHINFO_EXTENSION) === 'part') { + $permissions |= \OCP\PERMISSION_DELETE; } - return false; + return $permissions; } public function mkdir($path) { @@ -183,9 +184,6 @@ class Shared extends \OC\Files\Storage\Common { } public function isCreatable($path) { - if ($path == '') { - $path = $this->getMountPoint(); - } return ($this->getPermissions($path) & \OCP\PERMISSION_CREATE); } @@ -194,23 +192,14 @@ class Shared extends \OC\Files\Storage\Common { } public function isUpdatable($path) { - if ($path == '') { - $path = $this->getMountPoint(); - } return ($this->getPermissions($path) & \OCP\PERMISSION_UPDATE); } public function isDeletable($path) { - if ($path == '') { - $path = $this->getMountPoint(); - } return ($this->getPermissions($path) & \OCP\PERMISSION_DELETE); } public function isSharable($path) { - if ($path == '') { - $path = $this->getMountPoint(); - } return ($this->getPermissions($path) & \OCP\PERMISSION_SHARE); } @@ -454,9 +443,6 @@ class Shared extends \OC\Files\Storage\Common { } public function free_space($path) { - if ($path == '') { - $path = $this->getMountPoint(); - } $source = $this->getSourcePath($path); if ($source) { list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source); diff --git a/apps/files_sharing/lib/updater.php b/apps/files_sharing/lib/updater.php index 249211c306d..49044383df5 100644 --- a/apps/files_sharing/lib/updater.php +++ b/apps/files_sharing/lib/updater.php @@ -38,14 +38,13 @@ class Shared_Updater { \OC\Files\Filesystem::initMountPoints($user); $view = new \OC\Files\View('/' . $user); if ($view->file_exists($path)) { - while ($path !== '/') { + while ($path !== dirname($path)) { $etag = $view->getETag($path); $view->putFileInfo($path, array('etag' => $etag)); $path = dirname($path); } } else { - error_log("error!" . 'can not update etags on ' . $path . ' for user ' . $user); - \OCP\Util::writeLog('files_sharing', 'can not update etags on ' . $path . ' for user ' . $user, \OCP\Util::ERROR); + \OCP\Util::writeLog('files_sharing', 'can not update etags on ' . $path . ' for user ' . $user . '. Path does not exists', \OCP\Util::DEBUG); } } diff --git a/apps/user_ldap/l10n/ast.php b/apps/user_ldap/l10n/ast.php index ceda5a9326d..ad37405ca70 100644 --- a/apps/user_ldap/l10n/ast.php +++ b/apps/user_ldap/l10n/ast.php @@ -17,6 +17,8 @@ $TRANSLATIONS = array( "Configuration incomplete" => "Configuración incompleta", "Select groups" => "Esbillar grupos", "Select attributes" => "Esbillar atributos", +"Connection test succeeded" => "Test de conexón esitosu", +"Connection test failed" => "Falló'l test de conexón", "_%s group found_::_%s groups found_" => array("%s grupu alcontráu","%s grupos alcontraos"), "_%s user found_::_%s users found_" => array("%s usuariu alcontráu","%s usuarios alcontraos"), "Could not find the desired feature" => "Nun pudo alcontrase la carauterística deseyada", diff --git a/l10n/ast/user_ldap.po b/l10n/ast/user_ldap.po index 5483e9078eb..a4964110eef 100644 --- a/l10n/ast/user_ldap.po +++ b/l10n/ast/user_ldap.po @@ -3,15 +3,16 @@ # This file is distributed under the same license as the PACKAGE package. # # Translators: +# dixebra <davidlopezcastanon@gmail.com>, 2014 # Tornes Llume <l.lumex03.tornes@gmail.com>, 2014 # tebanpb <peruyero@gmail.com>, 2014 msgid "" msgstr "" "Project-Id-Version: ownCloud\n" "Report-Msgid-Bugs-To: translations@owncloud.org\n" -"POT-Creation-Date: 2014-05-07 01:55-0400\n" -"PO-Revision-Date: 2014-05-05 15:09+0000\n" -"Last-Translator: tebanpb <peruyero@gmail.com>\n" +"POT-Creation-Date: 2014-05-08 01:55-0400\n" +"PO-Revision-Date: 2014-05-07 11:10+0000\n" +"Last-Translator: dixebra <davidlopezcastanon@gmail.com>\n" "Language-Team: Asturian (http://www.transifex.com/projects/p/owncloud/language/ast/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -114,11 +115,11 @@ msgstr "Esbillar atributos" #: js/settings.js:848 msgid "Connection test succeeded" -msgstr "" +msgstr "Test de conexón esitosu" #: js/settings.js:855 msgid "Connection test failed" -msgstr "" +msgstr "Falló'l test de conexón" #: js/settings.js:864 msgid "Do you really want to delete the current Server Configuration?" diff --git a/l10n/templates/core.pot b/l10n/templates/core.pot index 77a6ebbfdf3..6b5a34691c1 100644 --- a/l10n/templates/core.pot +++ b/l10n/templates/core.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud Core 6.0.0\n" "Report-Msgid-Bugs-To: translations@owncloud.org\n" -"POT-Creation-Date: 2014-05-07 01:55-0400\n" +"POT-Creation-Date: 2014-05-08 01:55-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/l10n/templates/files.pot b/l10n/templates/files.pot index 160fb27dc97..3ec45e506c7 100644 --- a/l10n/templates/files.pot +++ b/l10n/templates/files.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud Core 6.0.0\n" "Report-Msgid-Bugs-To: translations@owncloud.org\n" -"POT-Creation-Date: 2014-05-07 01:55-0400\n" +"POT-Creation-Date: 2014-05-08 01:55-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/l10n/templates/files_encryption.pot b/l10n/templates/files_encryption.pot index ce3c307eedb..b5f486a23b8 100644 --- a/l10n/templates/files_encryption.pot +++ b/l10n/templates/files_encryption.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud Core 6.0.0\n" "Report-Msgid-Bugs-To: translations@owncloud.org\n" -"POT-Creation-Date: 2014-05-07 01:55-0400\n" +"POT-Creation-Date: 2014-05-08 01:55-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/l10n/templates/files_external.pot b/l10n/templates/files_external.pot index 418130a220f..120ab271f07 100644 --- a/l10n/templates/files_external.pot +++ b/l10n/templates/files_external.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud Core 6.0.0\n" "Report-Msgid-Bugs-To: translations@owncloud.org\n" -"POT-Creation-Date: 2014-05-07 01:55-0400\n" +"POT-Creation-Date: 2014-05-08 01:55-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/l10n/templates/files_sharing.pot b/l10n/templates/files_sharing.pot index ecee20825d2..2f9501015eb 100644 --- a/l10n/templates/files_sharing.pot +++ b/l10n/templates/files_sharing.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud Core 6.0.0\n" "Report-Msgid-Bugs-To: translations@owncloud.org\n" -"POT-Creation-Date: 2014-05-07 01:55-0400\n" +"POT-Creation-Date: 2014-05-08 01:55-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/l10n/templates/files_trashbin.pot b/l10n/templates/files_trashbin.pot index b93929a6246..978a7a8ca52 100644 --- a/l10n/templates/files_trashbin.pot +++ b/l10n/templates/files_trashbin.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud Core 6.0.0\n" "Report-Msgid-Bugs-To: translations@owncloud.org\n" -"POT-Creation-Date: 2014-05-07 01:55-0400\n" +"POT-Creation-Date: 2014-05-08 01:55-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/l10n/templates/files_versions.pot b/l10n/templates/files_versions.pot index 3ce8cba1a44..9de8c61c3e5 100644 --- a/l10n/templates/files_versions.pot +++ b/l10n/templates/files_versions.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud Core 6.0.0\n" "Report-Msgid-Bugs-To: translations@owncloud.org\n" -"POT-Creation-Date: 2014-05-07 01:55-0400\n" +"POT-Creation-Date: 2014-05-08 01:55-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/l10n/templates/lib.pot b/l10n/templates/lib.pot index 126fcf62019..cb9695551a6 100644 --- a/l10n/templates/lib.pot +++ b/l10n/templates/lib.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud Core 6.0.0\n" "Report-Msgid-Bugs-To: translations@owncloud.org\n" -"POT-Creation-Date: 2014-05-07 01:55-0400\n" +"POT-Creation-Date: 2014-05-08 01:55-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/l10n/templates/private.pot b/l10n/templates/private.pot index 6d7def224cc..5ae1738af08 100644 --- a/l10n/templates/private.pot +++ b/l10n/templates/private.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud Core 6.0.0\n" "Report-Msgid-Bugs-To: translations@owncloud.org\n" -"POT-Creation-Date: 2014-05-07 01:55-0400\n" +"POT-Creation-Date: 2014-05-08 01:55-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/l10n/templates/settings.pot b/l10n/templates/settings.pot index d9c8e69a82e..61fde924069 100644 --- a/l10n/templates/settings.pot +++ b/l10n/templates/settings.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud Core 6.0.0\n" "Report-Msgid-Bugs-To: translations@owncloud.org\n" -"POT-Creation-Date: 2014-05-07 01:55-0400\n" +"POT-Creation-Date: 2014-05-08 01:55-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/l10n/templates/user_ldap.pot b/l10n/templates/user_ldap.pot index c7285bf575b..a0ccf684b36 100644 --- a/l10n/templates/user_ldap.pot +++ b/l10n/templates/user_ldap.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud Core 6.0.0\n" "Report-Msgid-Bugs-To: translations@owncloud.org\n" -"POT-Creation-Date: 2014-05-07 01:55-0400\n" +"POT-Creation-Date: 2014-05-08 01:55-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/l10n/templates/user_webdavauth.pot b/l10n/templates/user_webdavauth.pot index efcc3907578..dfa6255842f 100644 --- a/l10n/templates/user_webdavauth.pot +++ b/l10n/templates/user_webdavauth.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ownCloud Core 6.0.0\n" "Report-Msgid-Bugs-To: translations@owncloud.org\n" -"POT-Creation-Date: 2014-05-07 01:55-0400\n" +"POT-Creation-Date: 2014-05-08 01:55-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/lib/private/share/share.php b/lib/private/share/share.php index b12d62e8439..6f8830e73f2 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -48,11 +48,11 @@ class Share extends \OC\Share\Constants { /** * Register a sharing backend class that implements OCP\Share_Backend for an item type - * @param string Item type - * @param string Backend class - * @param string (optional) Depends on item type - * @param array (optional) List of supported file extensions if this item type depends on files - * @return Returns true if backend is registered or false if error + * @param string $itemType Item type + * @param string $class Backend class + * @param string $collectionOf (optional) Depends on item type + * @param array $supportedFileExtensions (optional) List of supported file extensions if this item type depends on files + * @return boolean true if backend is registered or false if error */ public static function registerBackend($itemType, $class, $collectionOf = null, $supportedFileExtensions = null) { if (self::isEnabled()) { @@ -78,7 +78,7 @@ class Share extends \OC\Share\Constants { /** * Check if the Share API is enabled - * @return Returns true if enabled or false + * @return boolean true if enabled or false * * The Share API is enabled by default if not configured */ @@ -93,8 +93,8 @@ class Share extends \OC\Share\Constants { * Find which users can access a shared item * @param string $path to the file * @param string $ownerUser owner of the file - * @param bool $includeOwner include owner to the list of users with access to the file - * @param bool $returnUserPaths Return an array with the user => path map + * @param boolean $includeOwner include owner to the list of users with access to the file + * @param boolean $returnUserPaths Return an array with the user => path map * @return array * @note $path needs to be relative to user data dir, e.g. 'file.txt' * not '/admin/data/file.txt' @@ -239,12 +239,12 @@ class Share extends \OC\Share\Constants { /** * Get the items of item type shared with the current user - * @param string Item type - * @param int Format (optional) Format type must be defined by the backend - * @param mixed Parameters (optional) - * @param int Number of items to return (optional) Returns all by default - * @param bool include collections (optional) - * @return Return depends on format + * @param string $itemType + * @param int $format (optional) Format type must be defined by the backend + * @param mixed $parameters (optional) + * @param int $limit Number of items to return (optional) Returns all by default + * @param boolean $includeCollections (optional) + * @return mixed Return depends on format */ public static function getItemsSharedWith($itemType, $format = self::FORMAT_NONE, $parameters = null, $limit = -1, $includeCollections = false) { @@ -259,7 +259,7 @@ class Share extends \OC\Share\Constants { * @param int Format (optional) Format type must be defined by the backend * @param mixed Parameters (optional) * @param int Number of items to return (optional) Returns all by default - * @param bool include collections (optional) + * @param boolean include collections (optional) * @return Return depends on format */ public static function getItemsSharedWithUser($itemType, $user, $format = self::FORMAT_NONE, @@ -273,9 +273,9 @@ class Share extends \OC\Share\Constants { * @param string $itemType * @param string $itemTarget * @param int $format (optional) Format type must be defined by the backend - * @param mixed Parameters (optional) - * @param bool include collections (optional) - * @return Return depends on format + * @param mixed $parameters (optional) + * @param boolean $includeCollections (optional) + * @return mixed Return depends on format */ public static function getItemSharedWith($itemType, $itemTarget, $format = self::FORMAT_NONE, $parameters = null, $includeCollections = false) { @@ -334,12 +334,12 @@ class Share extends \OC\Share\Constants { /** * Get the item of item type shared with the current user by source - * @param string Item type - * @param string Item source - * @param int Format (optional) Format type must be defined by the backend - * @param mixed Parameters - * @param bool include collections - * @return Return depends on format + * @param string $itemType + * @param string $itemSource + * @param int $format (optional) Format type must be defined by the backend + * @param mixed $parameters + * @param boolean $includeCollections + * @return mixed Return depends on format */ public static function getItemSharedWithBySource($itemType, $itemSource, $format = self::FORMAT_NONE, $parameters = null, $includeCollections = false) { @@ -349,9 +349,9 @@ class Share extends \OC\Share\Constants { /** * Get the item of item type shared by a link - * @param string Item type - * @param string Item source - * @param string Owner of link + * @param string $itemType + * @param string $itemSource + * @param string $uidOwner Owner of link * @return Item */ public static function getItemSharedWithByLink($itemType, $itemSource, $uidOwner) { @@ -362,7 +362,7 @@ class Share extends \OC\Share\Constants { /** * Based on the given token the share information will be returned - password protected shares will be verified * @param string $token - * @return array | bool false will be returned in case the token is unknown or unauthorized + * @return array | boolean false will be returned in case the token is unknown or unauthorized */ public static function getShareByToken($token, $checkPasswordProtection = true) { $query = \OC_DB::prepare('SELECT * FROM `*PREFIX*share` WHERE `token` = ?', 1); @@ -411,12 +411,12 @@ class Share extends \OC\Share\Constants { /** * Get the shared items of item type owned by the current user - * @param string Item type - * @param int Format (optional) Format type must be defined by the backend - * @param mixed Parameters - * @param int Number of items to return (optional) Returns all by default - * @param bool include collections - * @return Return depends on format + * @param string $itemType + * @param int $format (optional) Format type must be defined by the backend + * @param mixed $parameters + * @param int $limit Number of items to return (optional) Returns all by default + * @param boolean $includeCollections + * @return mixed Return depends on format */ public static function getItemsShared($itemType, $format = self::FORMAT_NONE, $parameters = null, $limit = -1, $includeCollections = false) { @@ -426,12 +426,12 @@ class Share extends \OC\Share\Constants { /** * Get the shared item of item type owned by the current user - * @param string Item type - * @param string Item source - * @param int Format (optional) Format type must be defined by the backend - * @param mixed Parameters - * @param bool include collections - * @return Return depends on format + * @param string $itemType + * @param string $itemSource + * @param int $format (optional) Format type must be defined by the backend + * @param mixed $parameters + * @param boolean $includeCollections + * @return mixed Return depends on format */ public static function getItemShared($itemType, $itemSource, $format = self::FORMAT_NONE, $parameters = null, $includeCollections = false) { @@ -441,11 +441,11 @@ class Share extends \OC\Share\Constants { /** * Get all users an item is shared with - * @param string Item type - * @param string Item source - * @param string Owner - * @param bool Include collections - * @praram bool check expire date + * @param string $itemType + * @param string $itemSource + * @param string $uidOwner + * @param boolean $includeCollections + * @param boolean $checkExpireDate * @return Return array of users */ public static function getUsersItemShared($itemType, $itemSource, $uidOwner, $includeCollections = false, $checkExpireDate = true) { @@ -478,7 +478,7 @@ class Share extends \OC\Share\Constants { * @internal param \OCP\SHARE_TYPE_USER $int , SHARE_TYPE_GROUP, or SHARE_TYPE_LINK * @internal param \OCP\User $string or group the item is being shared with * @internal param \OCP\CRUDS $int permissions - * @return bool|string Returns true on success or false on failure, Returns token on success for links + * @return boolean|string Returns true on success or false on failure, Returns token on success for links */ public static function shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions, $itemSourceName = null) { $uidOwner = \OC_User::getUser(); @@ -643,11 +643,11 @@ class Share extends \OC\Share\Constants { /** * Unshare an item from a user, group, or delete a private link - * @param string Item type - * @param string Item source - * @param int SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK - * @param string User or group the item is being shared with - * @return Returns true on success or false on failure + * @param string $itemType + * @param string $itemSource + * @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK + * @param string $shareWith User or group the item is being shared with + * @return boolean true on success or false on failure */ public static function unshare($itemType, $itemSource, $shareType, $shareWith) { $item = self::getItems($itemType, $itemSource, $shareType, $shareWith, \OC_User::getUser(),self::FORMAT_NONE, null, 1); @@ -660,9 +660,9 @@ class Share extends \OC\Share\Constants { /** * Unshare an item from all users, groups, and remove all links - * @param string Item type - * @param string Item source - * @return Returns true on success or false on failure + * @param string $itemType + * @param string $itemSource + * @return boolean true on success or false on failure */ public static function unshareAll($itemType, $itemSource) { // Get all of the owners of shares of this item. @@ -692,9 +692,9 @@ class Share extends \OC\Share\Constants { /** * Unshare an item shared with the current user - * @param string Item type - * @param string Item target - * @return Returns true on success or false on failure + * @param string $itemType + * @param string $itemTarget + * @return boolean true on success or false on failure * * Unsharing from self is not allowed for items inside collections */ @@ -727,12 +727,13 @@ class Share extends \OC\Share\Constants { } return false; } + /** * sent status if users got informed by mail about share * @param string $itemType * @param string $itemSource * @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK - * @param bool $status + * @param boolean $status */ public static function setSendMailStatus($itemType, $itemSource, $shareType, $status) { $status = $status ? 1 : 0; @@ -751,12 +752,12 @@ class Share extends \OC\Share\Constants { /** * Set the permissions of an item for a specific user or group - * @param string Item type - * @param string Item source - * @param int SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK - * @param string User or group the item is being shared with - * @param int CRUDS permissions - * @return Returns true on success or false on failure + * @param string $itemType + * @param string $itemSource + * @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK + * @param string $shareWith User or group the item is being shared with + * @param int $permissions CRUDS permissions + * @return boolean true on success or false on failure */ public static function setPermissions($itemType, $itemSource, $shareType, $shareWith, $permissions) { $l = \OC_L10N::get('lib'); @@ -842,7 +843,7 @@ class Share extends \OC\Share\Constants { * @param string $itemType * @param string $itemSource * @param string $date expiration date - * @return \OCP\Share_Backend + * @return boolean */ public static function setExpirationDate($itemType, $itemSource, $date) { $user = \OC_User::getUser(); @@ -873,7 +874,7 @@ class Share extends \OC\Share\Constants { /** * Checks whether a share has expired, calls unshareItem() if yes. * @param array $item Share data (usually database row) - * @return bool True if item was expired, false otherwise. + * @return boolean True if item was expired, false otherwise. */ protected static function expireItem(array $item) { @@ -957,7 +958,7 @@ class Share extends \OC\Share\Constants { /** * Check if resharing is allowed - * @return Returns true if allowed or false + * @return boolean true if allowed or false * * Resharing is allowed by default if not configured */ @@ -974,7 +975,7 @@ class Share extends \OC\Share\Constants { /** * Get a list of collection item types for the specified item type - * @param string Item type + * @param string $itemType * @return array */ private static function getCollectionItemTypes($itemType) { @@ -998,17 +999,17 @@ class Share extends \OC\Share\Constants { /** * Get shared items from the database - * @param string Item type + * @param string $itemType * @param string Item source or target (optional) - * @param int SHARE_TYPE_USER, SHARE_TYPE_GROUP, SHARE_TYPE_LINK, $shareTypeUserAndGroups, or $shareTypeGroupUserUnique - * @param string User or group the item is being shared with - * @param string User that is the owner of shared items (optional) - * @param int Format to convert items to with formatItems() - * @param mixed Parameters to pass to formatItems() - * @param int Number of items to return, -1 to return all matches (optional) - * @param bool Include collection item types (optional) - * @param bool TODO (optional) - * @prams bool check expire date + * @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, SHARE_TYPE_LINK, $shareTypeUserAndGroups, or $shareTypeGroupUserUnique + * @param string $shareWith User or group the item is being shared with + * @param string uidOwner User that is the owner of shared items (optional) + * @param int $format Format to convert items to with formatItems() (optional) + * @param mixed $parameters to pass to formatItems() (optional) + * @param int $limit Number of items to return, -1 to return all matches (optional) + * @param boolean $includeCollections Include collection item types (optional) + * @param boolean $itemShareWithBySource (optional) + * @param boolean $checkExpireDate * @return array * * See public functions getItem(s)... for parameter usage @@ -1343,16 +1344,16 @@ class Share extends \OC\Share\Constants { /** * Put shared item into the database - * @param string Item type - * @param string Item source - * @param int SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK - * @param string User or group the item is being shared with - * @param string User that is the owner of shared item - * @param int CRUDS permissions - * @param bool|array Parent folder target (optional) - * @param string token (optional) - * @param string name of the source item (optional) - * @return bool Returns true on success or false on failure + * @param string $itemType Item type + * @param string $itemSource Item source + * @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK + * @param string $shareWith User or group the item is being shared with + * @param string $uidOwner User that is the owner of shared item + * @param int $permissions CRUDS permissions + * @param boolean|array $parentFolder Parent folder target (optional) + * @param string $token (optional) + * @param string $itemSourceName name of the source item (optional) + * @return boolean Returns true on success or false on failure */ private static function put($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions, $parentFolder = null, $token = null, $itemSourceName = null) { @@ -1614,7 +1615,7 @@ class Share extends \OC\Share\Constants { * In case a password protected link is not yet authenticated this function will return false * * @param array $linkItem - * @return bool + * @return boolean */ public static function checkPasswordProtectedShare(array $linkItem) { if (!isset($linkItem['share_with'])) { @@ -1642,7 +1643,7 @@ class Share extends \OC\Share\Constants { /** * @breif construct select statement * @param int $format - * @param bool $fileDependent ist it a file/folder share or a generla share + * @param boolean $fileDependent ist it a file/folder share or a generla share * @param string $uidOwner * @return string select statement */ @@ -1717,11 +1718,11 @@ class Share extends \OC\Share\Constants { /** * @brief format result * @param array $items result - * @prams string $column is it a file share or a general share ('file_target' or 'item_target') - * @params \OCP\Share_Backend $backend sharing backend + * @param string $column is it a file share or a general share ('file_target' or 'item_target') + * @param \OCP\Share_Backend $backend sharing backend * @param int $format - * @param array additional format parameters - * @return array formate result + * @param array $parameters additional format parameters + * @return array format result */ private static function formatResult($items, $column, $backend, $format = self::FORMAT_NONE , $parameters = null) { if ($format === self::FORMAT_NONE) { diff --git a/lib/private/user/database.php b/lib/private/user/database.php index 681f03981f5..dec38464f98 100644 --- a/lib/private/user/database.php +++ b/lib/private/user/database.php @@ -183,14 +183,14 @@ class OC_User_Database extends OC_User_Backend { $row = $result->fetchRow(); if ($row) { $storedHash = $row['password']; - if ($storedHash[0] == '$') { //the new phpass based hashing + if ($storedHash[0] === '$') { //the new phpass based hashing $hasher = $this->getHasher(); if ($hasher->CheckPassword($password . OC_Config::getValue('passwordsalt', ''), $storedHash)) { return $row['uid']; } //old sha1 based hashing - } elseif (sha1($password) == $storedHash) { + } elseif (sha1($password) === $storedHash) { //upgrade to new hashing $this->setPassword($row['uid'], $password); return $row['uid']; diff --git a/lib/public/share.php b/lib/public/share.php index 230a517b5ee..b21b3a7b963 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -41,11 +41,11 @@ class Share extends \OC\Share\Constants { /** * Register a sharing backend class that implements OCP\Share_Backend for an item type - * @param string Item type - * @param string Backend class - * @param string (optional) Depends on item type - * @param array (optional) List of supported file extensions if this item type depends on files - * @return Returns true if backend is registered or false if error + * @param string $itemType Item type + * @param string $class Backend class + * @param string $collectionOf (optional) Depends on item type + * @param array $supportedFileExtensions (optional) List of supported file extensions if this item type depends on files + * @return boolean true if backend is registered or false if error */ public static function registerBackend($itemType, $class, $collectionOf = null, $supportedFileExtensions = null) { return \OC\Share\Share::registerBackend($itemType, $class, $collectionOf, $supportedFileExtensions); @@ -53,7 +53,7 @@ class Share extends \OC\Share\Constants { /** * Check if the Share API is enabled - * @return Returns true if enabled or false + * @return boolean true if enabled or false * * The Share API is enabled by default if not configured */ @@ -77,12 +77,12 @@ class Share extends \OC\Share\Constants { /** * Get the items of item type shared with the current user - * @param string Item type - * @param int Format (optional) Format type must be defined by the backend - * @param mixed Parameters (optional) - * @param int Number of items to return (optional) Returns all by default - * @param bool include collections (optional) - * @return Return depends on format + * @param string $itemType + * @param int $format (optional) Format type must be defined by the backend + * @param mixed $parameters (optional) + * @param int $limit Number of items to return (optional) Returns all by default + * @param bool $includeCollections (optional) + * @return mixed Return depends on format */ public static function getItemsSharedWith($itemType, $format = self::FORMAT_NONE, $parameters = null, $limit = -1, $includeCollections = false) { @@ -113,7 +113,7 @@ class Share extends \OC\Share\Constants { * @param int $format (optional) Format type must be defined by the backend * @param mixed Parameters (optional) * @param bool include collections (optional) - * @return Return depends on format + * @return mixed Return depends on format */ public static function getItemSharedWith($itemType, $itemTarget, $format = self::FORMAT_NONE, $parameters = null, $includeCollections = false) { @@ -134,12 +134,12 @@ class Share extends \OC\Share\Constants { /** * Get the item of item type shared with the current user by source - * @param string Item type - * @param string Item source - * @param int Format (optional) Format type must be defined by the backend - * @param mixed Parameters - * @param bool include collections - * @return Return depends on format + * @param string $itemType + * @param string $itemSource + * @param int $format (optional) Format type must be defined by the backend + * @param mixed $parameters + * @param bool $includeCollections + * @return mixed Return depends on format */ public static function getItemSharedWithBySource($itemType, $itemSource, $format = self::FORMAT_NONE, $parameters = null, $includeCollections = false) { @@ -148,9 +148,9 @@ class Share extends \OC\Share\Constants { /** * Get the item of item type shared by a link - * @param string Item type - * @param string Item source - * @param string Owner of link + * @param string $itemType + * @param string $itemSource + * @param string $uidOwner Owner of link * @return Item */ public static function getItemSharedWithByLink($itemType, $itemSource, $uidOwner) { @@ -178,12 +178,12 @@ class Share extends \OC\Share\Constants { /** * Get the shared items of item type owned by the current user - * @param string Item type - * @param int Format (optional) Format type must be defined by the backend - * @param mixed Parameters - * @param int Number of items to return (optional) Returns all by default - * @param bool include collections - * @return Return depends on format + * @param string $itemType + * @param int $format (optional) Format type must be defined by the backend + * @param mixed $parameters + * @param int $limit Number of items to return (optional) Returns all by default + * @param bool $includeCollections + * @return mixed Return depends on format */ public static function getItemsShared($itemType, $format = self::FORMAT_NONE, $parameters = null, $limit = -1, $includeCollections = false) { @@ -193,12 +193,12 @@ class Share extends \OC\Share\Constants { /** * Get the shared item of item type owned by the current user - * @param string Item type - * @param string Item source - * @param int Format (optional) Format type must be defined by the backend - * @param mixed Parameters - * @param bool include collections - * @return Return depends on format + * @param string $itemType + * @param string $itemSource + * @param int $format (optional) Format type must be defined by the backend + * @param mixed $parameters + * @param bool $includeCollections + * @return mixed Return depends on format */ public static function getItemShared($itemType, $itemSource, $format = self::FORMAT_NONE, $parameters = null, $includeCollections = false) { @@ -208,11 +208,11 @@ class Share extends \OC\Share\Constants { /** * Get all users an item is shared with - * @param string Item type - * @param string Item source - * @param string Owner - * @param bool Include collections - * @praram bool check expire date + * @param string $itemType + * @param string $itemSource + * @param string $uidOwner + * @param bool $includeCollections + * @param bool $checkExpireDate * @return Return array of users */ public static function getUsersItemShared($itemType, $itemSource, $uidOwner, $includeCollections = false, $checkExpireDate = true) { @@ -241,11 +241,11 @@ class Share extends \OC\Share\Constants { /** * Unshare an item from a user, group, or delete a private link - * @param string Item type - * @param string Item source - * @param int SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK - * @param string User or group the item is being shared with - * @return Returns true on success or false on failure + * @param string $itemType + * @param string $itemSource + * @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK + * @param string $shareWith User or group the item is being shared with + * @return boolean true on success or false on failure */ public static function unshare($itemType, $itemSource, $shareType, $shareWith) { return \OC\Share\Share::unshare($itemType, $itemSource, $shareType, $shareWith); @@ -253,9 +253,9 @@ class Share extends \OC\Share\Constants { /** * Unshare an item from all users, groups, and remove all links - * @param string Item type - * @param string Item source - * @return Returns true on success or false on failure + * @param string $itemType + * @param string $itemSource + * @return boolean true on success or false on failure */ public static function unshareAll($itemType, $itemSource) { return \OC\Share\Share::unshareAll($itemType, $itemSource); @@ -263,15 +263,16 @@ class Share extends \OC\Share\Constants { /** * Unshare an item shared with the current user - * @param string Item type - * @param string Item target - * @return Returns true on success or false on failure + * @param string $itemType + * @param string $itemTarget + * @return boolean true on success or false on failure * * Unsharing from self is not allowed for items inside collections */ public static function unshareFromSelf($itemType, $itemTarget) { return \OC\Share\Share::unshareFromSelf($itemType, $itemTarget); } + /** * sent status if users got informed by mail about share * @param string $itemType @@ -285,12 +286,12 @@ class Share extends \OC\Share\Constants { /** * Set the permissions of an item for a specific user or group - * @param string Item type - * @param string Item source - * @param int SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK - * @param string User or group the item is being shared with - * @param int CRUDS permissions - * @return Returns true on success or false on failure + * @param string $itemType + * @param string $itemSource + * @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK + * @param string $shareWith User or group the item is being shared with + * @param int $permissions CRUDS permissions + * @return boolean true on success or false on failure */ public static function setPermissions($itemType, $itemSource, $shareType, $shareWith, $permissions) { return \OC\Share\Share::setPermissions($itemType, $itemSource, $shareType, $shareWith, $permissions); @@ -301,7 +302,7 @@ class Share extends \OC\Share\Constants { * @param string $itemType * @param string $itemSource * @param string $date expiration date - * @return Share_Backend + * @return boolean */ public static function setExpirationDate($itemType, $itemSource, $date) { return \OC\Share\Share::setExpirationDate($itemType, $itemSource, $date); @@ -340,23 +341,20 @@ class Share extends \OC\Share\Constants { interface Share_Backend { /** - * Get the source of the item to be stored in the database - * @param string Item source - * @param string Owner of the item - * @return mixed|array|false Source + * Check if this $itemSource exist for the user + * @param string $itemSource + * @param string $uidOwner Owner of the item + * @return boolean|null Source * - * Return an array if the item is file dependent, the array needs two keys: 'item' and 'file' * Return false if the item does not exist for the user - * - * The formatItems() function will translate the source returned back into the item */ public function isValidSource($itemSource, $uidOwner); /** * Get a unique name of the item for the specified user - * @param string Item source - * @param string|false User the item is being shared with - * @param array|null List of similar item names already existing as shared items + * @param string $itemSource + * @param string|false $shareWith User the item is being shared with + * @param array|null $exclude List of similar item names already existing as shared items * @return string Target name * * This function needs to verify that the user does not already have an item with this name. @@ -366,8 +364,8 @@ interface Share_Backend { /** * Converts the shared item sources back into the item in the specified format - * @param array Shared items - * @param int Format + * @param array $items Shared items + * @param int $format * @return TODO * * The items array is a 3-dimensional array with the item_source as the @@ -397,8 +395,9 @@ interface Share_Backend_File_Dependent extends Share_Backend { /** * Get the file path of the item - * @param string Item source - * @param string User that is the owner of shared item + * @param string $itemSource + * @param string $uidOwner User that is the owner of shared item + * @return string|false */ public function getFilePath($itemSource, $uidOwner); @@ -412,7 +411,7 @@ interface Share_Backend_Collection extends Share_Backend { /** * Get the sources of the children of the item - * @param string Item source + * @param string $itemSource * @return array Returns an array of children each inside an array with the keys: source, target, and file_path if applicable */ public function getChildren($itemSource); |