From b619821f4a7048c56d198095c5c3b3c9fca02ae1 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Tue, 15 May 2012 12:03:20 -0400 Subject: [PATCH] Create a new OC_Share object instead of manually inserting rows when adding a user to a group share, prevents a couple of potential bugs --- apps/files_sharing/lib_share.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/files_sharing/lib_share.php b/apps/files_sharing/lib_share.php index 73ddaf0b9ea..9e43fef7696 100644 --- a/apps/files_sharing/lib_share.php +++ b/apps/files_sharing/lib_share.php @@ -472,12 +472,10 @@ class OC_Share { $gid = '@'.$arguments['gid']; $result = $query->execute(array($gid))->fetchAll(); if (count($result) > 0) { - $query = OCP\DB::prepare('INSERT INTO *PREFIX*sharing VALUES(?,?,?,?,?)'); - $sharedFolder = '/'.$arguments['uid'].'/files/Shared/'; $lastSource = ''; for ($i = 0; $i < count($result) - 1; $i++) { if ($result[$i]['source'] != $lastSource) { - $query->execute(array($result[$i]['uid_owner'], $arguments['uid'].'@'.$arguments['gid'], $result[$i]['source'], $sharedFolder.basename($result[$i]['source']), $result[$i]['permissions'])); + new OC_Share($result[$i]['source'], $arguments['gid'], $result[$i]['permissions']); $lastSource = $result[$i]['source']; } } -- 2.39.5