don't assign variables in if condition

This commit is contained in:
Bjoern Schiessle 2014-03-07 15:38:14 +01:00
parent 5db3b049fd
commit 2d8607fae9

View file

@ -556,8 +556,8 @@ class Share extends \OC\Share\Constants {
* @return Returns true on success or false on failure
*/
public static function unshare($itemType, $itemSource, $shareType, $shareWith) {
if ($item = self::getItems($itemType, $itemSource, $shareType, $shareWith, \OC_User::getUser(),
self::FORMAT_NONE, null, 1)) {
$item = self::getItems($itemType, $itemSource, $shareType, $shareWith, \OC_User::getUser(),self::FORMAT_NONE, null, 1);
if (!empty($item)) {
self::unshareItem($item);
return true;
}
@ -605,7 +605,8 @@ class Share extends \OC\Share\Constants {
* Unsharing from self is not allowed for items inside collections
*/
public static function unshareFromSelf($itemType, $itemTarget) {
if ($item = self::getItemSharedWith($itemType, $itemTarget)) {
$item = self::getItemSharedWith($itemType, $itemTarget);
if (!empty($item)) {
if ((int)$item['share_type'] === self::SHARE_TYPE_GROUP) {
// Insert an extra row for the group share and set permission
// to 0 to prevent it from showing up for the user
@ -746,8 +747,7 @@ class Share extends \OC\Share\Constants {
* @return \OCP\Share_Backend
*/
public static function setExpirationDate($itemType, $itemSource, $date) {
if ($items = self::getItems($itemType, $itemSource, null, null, \OC_User::getUser(),
self::FORMAT_NONE, null, -1, false)) {
$items = self::getItems($itemType, $itemSource, null, null, \OC_User::getUser(), self::FORMAT_NONE, null, -1, false);
if (!empty($items)) {
if ($date == '') {
$date = null;
@ -762,7 +762,6 @@ class Share extends \OC\Share\Constants {
}
return true;
}
}
return false;
}