diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-03-03 17:20:09 +0100 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-03-25 17:47:24 +0100 |
commit | 3a459db3585f02d02c492dc3ce836e2fea1c8cb2 (patch) | |
tree | 9577c1f52de714fcb20b3fab52c80f620e4e26ac /lib | |
parent | 6607f7cb5e170568129ddd3ea0a7839a7f6229b5 (diff) | |
download | nextcloud-server-3a459db3585f02d02c492dc3ce836e2fea1c8cb2.tar.gz nextcloud-server-3a459db3585f02d02c492dc3ce836e2fea1c8cb2.zip |
seperate transformDBResults
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/share/share.php | 57 |
1 files changed, 33 insertions, 24 deletions
diff --git a/lib/private/share/share.php b/lib/private/share/share.php index d743cfccb71..45ed4c70458 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -1046,30 +1046,7 @@ class Share extends \OC\Share\Constants { $switchedItems = array(); $mounts = array(); while ($row = $result->fetchRow()) { - if (isset($row['id'])) { - $row['id']=(int)$row['id']; - } - if (isset($row['share_type'])) { - $row['share_type']=(int)$row['share_type']; - } - if (isset($row['parent'])) { - $row['parent']=(int)$row['parent']; - } - if (isset($row['file_parent'])) { - $row['file_parent']=(int)$row['file_parent']; - } - if (isset($row['file_source'])) { - $row['file_source']=(int)$row['file_source']; - } - if (isset($row['permissions'])) { - $row['permissions']=(int)$row['permissions']; - } - if (isset($row['storage'])) { - $row['storage']=(int)$row['storage']; - } - if (isset($row['stime'])) { - $row['stime']=(int)$row['stime']; - } + self::transformDBResults($row); // Filter out duplicate group shares for users with unique targets if ($row['share_type'] == self::$shareTypeGroupUserUnique && isset($items[$row['parent']])) { $row['share_type'] = self::SHARE_TYPE_GROUP; @@ -1587,4 +1564,36 @@ class Share extends \OC\Share\Constants { } return $select; } + + + /** + * @brief transform db results + * @param array $row result + */ + private static function transformDBResults(&$row) { + if (isset($row['id'])) { + $row['id'] = (int) $row['id']; + } + if (isset($row['share_type'])) { + $row['share_type'] = (int) $row['share_type']; + } + if (isset($row['parent'])) { + $row['parent'] = (int) $row['parent']; + } + if (isset($row['file_parent'])) { + $row['file_parent'] = (int) $row['file_parent']; + } + if (isset($row['file_source'])) { + $row['file_source'] = (int) $row['file_source']; + } + if (isset($row['permissions'])) { + $row['permissions'] = (int) $row['permissions']; + } + if (isset($row['storage'])) { + $row['storage'] = (int) $row['storage']; + } + if (isset($row['stime'])) { + $row['stime'] = (int) $row['stime']; + } + } } |