]> source.dussan.org Git - nextcloud-server.git/commitdiff
Merge branch 'audit'
authorBart Visscher <bartv@thisnet.nl>
Wed, 20 Jun 2012 15:20:39 +0000 (17:20 +0200)
committerBart Visscher <bartv@thisnet.nl>
Wed, 20 Jun 2012 15:20:39 +0000 (17:20 +0200)
1  2 
apps/files_sharing/get.php
apps/files_sharing/lib_share.php
lib/filesystem.php

index a051451d33a40e075e717939d8f95828275a716a,57ff6b6e2009cedab965bc73d6603b15a41b78c6..1ab8c6a257f55a3d44324b0838af7e378ec9daea
mode 100644,100755..100644
index 4abf80ae19c35260185fa1eddc9441115965e2a3,14c61c620a1be4e758d660d30c5d4033b5a38aea..6e092269250052efdd0b736677f2e688ebc03155
mode 100644,100755..100644
@@@ -41,12 -41,9 +41,13 @@@ class OC_Share 
        public function __construct($source, $uid_shared_with, $permissions) {
                $uid_owner = OCP\USER::getUser();
                $query = OCP\DB::prepare("INSERT INTO *PREFIX*sharing VALUES(?,?,?,?,?)");
 +              // Check if this is a reshare and use the original source
 +              if ($result = OC_Share::getSource($source)) {
 +                      $source = $result;
 +              }
                if ($uid_shared_with == self::PUBLICLINK) {
                        $token = sha1("$uid_shared_with-$source");
+                       OCP\Util::emitHook('OC_Share', 'public', array('source'=>$source, 'token'=>$token, 'permissions'=>$permissions));
                        $query->execute(array($uid_owner, self::PUBLICLINK, $source, $token, $permissions));
                        $this->token = $token;
                } else {
                                if (isset($gid)) {
                                        $uid = $uid."@".$gid;
                                }
+                               OCP\Util::emitHook('OC_Share', 'user', array('source'=>$source, 'target'=>$target, 'with'=>$uid, 'permissions'=>$permissions));
                                $query->execute(array($uid_owner, $uid, $source, $target, $permissions));
 -                              // Add file to filesystem cache
 -                              $userDirectory = "/".OCP\USER::getUser()."/files";
 -                              $data = OC_Filecache::get(substr($source, strlen($userDirectory)));
 -                              $parentQuery = OCP\DB::prepare('SELECT id FROM *PREFIX*fscache WHERE path=?');
 -                              $parentResult = $parentQuery->execute(array($sharedFolder))->fetchRow();
 -                              $parent = $parentResult['id'];
 -                              $is_writeable = $permissions & OC_Share::WRITE;
 -                              $cacheQuery = OCP\DB::prepare('INSERT INTO *PREFIX*fscache(parent, name, path, size, mtime, ctime, mimetype, mimepart, user, writable) VALUES(?,?,?,?,?,?,?,?,?,?)');
 -                              $cacheQuery->execute(array($parent, basename($target), $target, $data['size'], $data['mtime'], $data['ctime'], $data['mimetype'], dirname($data['mimetype']), $uid, $is_writeable));
                        }
                }
        }
Simple merge