diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/files/filesystem.php | 13 | ||||
-rw-r--r-- | lib/files/storage/temporary.php | 4 | ||||
-rw-r--r-- | lib/public/share.php | 17 | ||||
-rw-r--r-- | lib/user.php | 18 |
4 files changed, 41 insertions, 11 deletions
diff --git a/lib/files/filesystem.php b/lib/files/filesystem.php index 65d9ffab485..71bf3d8708d 100644 --- a/lib/files/filesystem.php +++ b/lib/files/filesystem.php @@ -527,8 +527,7 @@ class Filesystem { } /** - * normalize a path - * + * @brief Fix common problems with a file path * @param string $path * @param bool $stripTrailingSlash * @return string @@ -537,21 +536,21 @@ class Filesystem { if ($path == '') { return '/'; } -//no windows style slashes + //no windows style slashes $path = str_replace('\\', '/', $path); -//add leading slash + //add leading slash if ($path[0] !== '/') { $path = '/' . $path; } -//remove duplicate slashes + //remove duplicate slashes while (strpos($path, '//') !== false) { $path = str_replace('//', '/', $path); } -//remove trailing slash + //remove trailing slash if ($stripTrailingSlash and strlen($path) > 1 and substr($path, -1, 1) === '/') { $path = substr($path, 0, -1); } -//normalize unicode if possible + //normalize unicode if possible if (class_exists('Normalizer')) { $path = \Normalizer::normalize($path); } diff --git a/lib/files/storage/temporary.php b/lib/files/storage/temporary.php index ffc55e27507..542d2cd9f48 100644 --- a/lib/files/storage/temporary.php +++ b/lib/files/storage/temporary.php @@ -9,11 +9,11 @@ namespace OC\Files\Storage; /** - * local storage backnd in temporary folder for testing purpores + * local storage backend in temporary folder for testing purpose */ class Temporary extends Local{ public function __construct($arguments) { - $this->datadir=\OC_Helper::tmpFolder(); + parent::__construct(array('datadir' => \OC_Helper::tmpFolder())); } public function cleanUp() { diff --git a/lib/public/share.php b/lib/public/share.php index 7d806fafd04..9aacf5e3449 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -342,6 +342,13 @@ class Share { */ public static function unshare($itemType, $itemSource, $shareType, $shareWith) { if ($item = self::getItems($itemType, $itemSource, $shareType, $shareWith, \OC_User::getUser(), self::FORMAT_NONE, null, 1)) { + // Pass all the vars we have for now, they may be useful + \OC_Hook::emit('OCP\Share', 'pre_unshare', array( + 'itemType' => $itemType, + 'itemSource' => $itemSource, + 'shareType' => $shareType, + 'shareWith' => $shareWith, + )); self::delete($item['id']); return true; } @@ -356,6 +363,12 @@ class Share { */ public static function unshareAll($itemType, $itemSource) { if ($shares = self::getItemShared($itemType, $itemSource)) { + // Pass all the vars we have for now, they may be useful + \OC_Hook::emit('OCP\Share', 'pre_unshareAll', array( + 'itemType' => $itemType, + 'itemSource' => $itemSource, + 'shares' => $shares + )); foreach ($shares as $share) { self::delete($share['id']); } @@ -764,8 +777,8 @@ class Share { if ( isset($row['share_with']) && $row['share_with'] != '') { $row['share_with_displayname'] = \OCP\User::getDisplayName($row['share_with']); } - if ( isset($row['uid_owner']) && $row['uid_owner'] != '') {
- $row['displayname_owner'] = \OCP\User::getDisplayName($row['uid_owner']);
+ if ( isset($row['uid_owner']) && $row['uid_owner'] != '') { + $row['displayname_owner'] = \OCP\User::getDisplayName($row['uid_owner']); } $items[$row['id']] = $row; diff --git a/lib/user.php b/lib/user.php index 38259bceea5..f953d221543 100644 --- a/lib/user.php +++ b/lib/user.php @@ -420,6 +420,24 @@ class OC_User { } /** + * @brief Check whether user can change his password + * @param $uid The username + * @returns true/false + * + * Check whether a specified user can change his password + */ + public static function canUserChangePassword($uid) { + foreach(self::$_usedBackends as $backend) { + if($backend->implementsActions(OC_USER_BACKEND_SET_PASSWORD)) { + if($backend->userExists($uid)) { + return true; + } + } + } + return false; + } + + /** * @brief Check if the password is correct * @param $uid The username * @param $password The password |