diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-03-07 15:38:14 +0100 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-03-25 17:47:24 +0100 |
commit | 2d8607fae92e083a431d476f670acdbc1cfdc947 (patch) | |
tree | 08a152a316a837990319a265a04772043a4680c8 /lib | |
parent | 5db3b049fd459e3a8e6e36a3a9e12f53e97c4b0b (diff) | |
download | nextcloud-server-2d8607fae92e083a431d476f670acdbc1cfdc947.tar.gz nextcloud-server-2d8607fae92e083a431d476f670acdbc1cfdc947.zip |
don't assign variables in if condition
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/share/share.php | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/lib/private/share/share.php b/lib/private/share/share.php index 3471514c487..ae7b6f5fbc7 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -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,22 +747,20 @@ 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)) { - if (!empty($items)) { - if ($date == '') { - $date = null; - } else { - $date = new \DateTime($date); - } - $query = \OC_DB::prepare('UPDATE `*PREFIX*share` SET `expiration` = ? WHERE `id` = ?'); - $query->bindValue(1, $date, 'datetime'); - foreach ($items as $item) { - $query->bindValue(2, (int) $item['id']); - $query->execute(); - } - return true; + $items = self::getItems($itemType, $itemSource, null, null, \OC_User::getUser(), self::FORMAT_NONE, null, -1, false); + if (!empty($items)) { + if ($date == '') { + $date = null; + } else { + $date = new \DateTime($date); + } + $query = \OC_DB::prepare('UPDATE `*PREFIX*share` SET `expiration` = ? WHERE `id` = ?'); + $query->bindValue(1, $date, 'datetime'); + foreach ($items as $item) { + $query->bindValue(2, (int) $item['id']); + $query->execute(); } + return true; } return false; } |