当前位置: 首页>>代码示例>>PHP>>正文


PHP Files_Sharing\Helper类代码示例

本文整理汇总了PHP中OCA\Files_Sharing\Helper的典型用法代码示例。如果您正苦于以下问题:PHP Helper类的具体用法?PHP Helper怎么用?PHP Helper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Helper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generateTarget

 /**
  * create unique target
  * @param string $filePath
  * @param string $shareWith
  * @param string $exclude
  * @return string
  */
 public function generateTarget($filePath, $shareWith, $exclude = null)
 {
     $shareFolder = \OCA\Files_Sharing\Helper::getShareFolder();
     $target = \OC\Files\Filesystem::normalizePath($shareFolder . '/' . basename($filePath));
     // for group shares we return the target right away
     if ($shareWith === false) {
         return $target;
     }
     \OC\Files\Filesystem::initMountPoints($shareWith);
     $view = new \OC\Files\View('/' . $shareWith . '/files');
     if (!$view->is_dir($shareFolder)) {
         $dir = '';
         $subdirs = explode('/', $shareFolder);
         foreach ($subdirs as $subdir) {
             $dir = $dir . '/' . $subdir;
             if (!$view->is_dir($dir)) {
                 $view->mkdir($dir);
             }
         }
     }
     $excludeList = \OCP\Share::getItemsSharedWithUser('file', $shareWith, self::FORMAT_TARGET_NAMES);
     if (is_array($exclude)) {
         $excludeList = array_merge($excludeList, $exclude);
     }
     return \OCA\Files_Sharing\Helper::generateUniqueTarget($target, $excludeList, $view);
 }
开发者ID:Combustible,项目名称:core,代码行数:33,代码来源:file.php

示例2: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     // reset backend
     \OC_User::clearBackends();
     \OC_User::useBackend('database');
     \OC_Hook::clear('OC_Filesystem');
     \OC_Hook::clear('OC_User');
     \OC_Hook::clear('OCP\\Share');
     // trashbin hooks
     \OCA\Files_Trashbin\Trashbin::registerHooks();
     // Filesystem related hooks
     \OCA\Encryption\Helper::registerFilesystemHooks();
     // register share hooks
     \OC::registerShareHooks();
     \OCA\Files_Sharing\Helper::registerHooks();
     // Sharing related hooks
     \OCA\Encryption\Helper::registerShareHooks();
     // Filesystem related hooks
     \OCA\Encryption\Helper::registerFilesystemHooks();
     // clear and register hooks
     \OC_FileProxy::clearProxies();
     \OC_FileProxy::register(new OCA\Files\Share\Proxy());
     \OC_FileProxy::register(new OCA\Encryption\Proxy());
     // create test user
     self::loginHelper(self::TEST_ENCRYPTION_TRASHBIN_USER2, true);
     self::loginHelper(self::TEST_ENCRYPTION_TRASHBIN_USER1, true);
 }
开发者ID:droiter,项目名称:openwrt-on-android,代码行数:28,代码来源:trashbin.php

示例3: __construct

 public function __construct(array $urlParams = array())
 {
     parent::__construct('files_sharing', $urlParams);
     $container = $this->getContainer();
     $server = $container->getServer();
     /**
      * Controllers
      */
     $container->registerService('ShareController', function (SimpleContainer $c) use($server) {
         return new ShareController($c->query('AppName'), $c->query('Request'), $c->query('UserSession'), $server->getAppConfig(), $server->getConfig(), $c->query('URLGenerator'), $c->query('UserManager'), $server->getLogger(), $server->getActivityManager());
     });
     $container->registerService('ExternalSharesController', function (SimpleContainer $c) {
         return new ExternalSharesController($c->query('AppName'), $c->query('Request'), $c->query('IsIncomingShareEnabled'), $c->query('ExternalManager'), $c->query('HttpClientService'));
     });
     /**
      * Core class wrappers
      */
     $container->registerService('UserSession', function (SimpleContainer $c) use($server) {
         return $server->getUserSession();
     });
     $container->registerService('URLGenerator', function (SimpleContainer $c) use($server) {
         return $server->getUrlGenerator();
     });
     $container->registerService('UserManager', function (SimpleContainer $c) use($server) {
         return $server->getUserManager();
     });
     $container->registerService('HttpClientService', function (SimpleContainer $c) use($server) {
         return $server->getHTTPClientService();
     });
     $container->registerService('IsIncomingShareEnabled', function (SimpleContainer $c) {
         return Helper::isIncomingServer2serverShareEnabled();
     });
     $container->registerService('ExternalManager', function (SimpleContainer $c) use($server) {
         $user = $server->getUserSession()->getUser();
         $uid = $user ? $user->getUID() : null;
         return new \OCA\Files_Sharing\External\Manager($server->getDatabaseConnection(), \OC\Files\Filesystem::getMountManager(), \OC\Files\Filesystem::getLoader(), $server->getHTTPHelper(), $server->getNotificationManager(), $uid);
     });
     /**
      * Middleware
      */
     $container->registerService('SharingCheckMiddleware', function (SimpleContainer $c) use($server) {
         return new SharingCheckMiddleware($c->query('AppName'), $server->getConfig(), $server->getAppManager());
     });
     // Execute middlewares
     $container->registerMiddleware('SharingCheckMiddleware');
     $container->registerService('MountProvider', function (IContainer $c) {
         /** @var \OCP\IServerContainer $server */
         $server = $c->query('ServerContainer');
         return new MountProvider($server->getConfig(), $c->query('PropagationManager'));
     });
     $container->registerService('PropagationManager', function (IContainer $c) {
         /** @var \OCP\IServerContainer $server */
         $server = $c->query('ServerContainer');
         return new PropagationManager($server->getUserSession(), $server->getConfig());
     });
     /*
      * Register capabilities
      */
     $container->registerCapability('OCA\\Files_Sharing\\Capabilities');
 }
开发者ID:hyb148,项目名称:core,代码行数:60,代码来源:application.php

示例4: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     // reset backend
     \OC_User::clearBackends();
     \OC_User::useBackend('database');
     // enable resharing
     \OC::$server->getAppConfig()->setValue('core', 'shareapi_allow_resharing', 'yes');
     // clear share hooks
     \OC_Hook::clear('OCP\\Share');
     // register share hooks
     \OC::registerShareHooks();
     \OCA\Files_Sharing\Helper::registerHooks();
     // Sharing related hooks
     \OCA\Encryption\Helper::registerShareHooks();
     // Filesystem related hooks
     \OCA\Encryption\Helper::registerFilesystemHooks();
     // clear and register hooks
     \OC_FileProxy::clearProxies();
     \OC_FileProxy::register(new OCA\Files\Share\Proxy());
     \OC_FileProxy::register(new OCA\Encryption\Proxy());
     // create users
     \Test_Encryption_Util::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1, true);
     \Test_Encryption_Util::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2, true);
     \Test_Encryption_Util::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER3, true);
     \Test_Encryption_Util::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER4, true);
     // create group and assign users
     \OC_Group::createGroup(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_GROUP1);
     \OC_Group::addToGroup(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER3, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_GROUP1);
     \OC_Group::addToGroup(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER4, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_GROUP1);
 }
开发者ID:Romua1d,项目名称:core,代码行数:30,代码来源:share.php

示例5: testSetGetShareFolder

 /**
  * test set and get share folder
  */
 function testSetGetShareFolder()
 {
     $this->assertSame('/', \OCA\Files_Sharing\Helper::getShareFolder());
     \OCA\Files_Sharing\Helper::setShareFolder('/Shared');
     $this->assertSame('/Shared', \OCA\Files_Sharing\Helper::getShareFolder());
     // cleanup
     \OCP\Config::deleteSystemValue('share_folder');
 }
开发者ID:Romua1d,项目名称:core,代码行数:11,代码来源:helper.php

示例6: testSetGetShareFolder

 /**
  * test set and get share folder
  */
 function testSetGetShareFolder()
 {
     $this->assertSame('/', \OCA\Files_Sharing\Helper::getShareFolder());
     \OCA\Files_Sharing\Helper::setShareFolder('/Shared/Folder');
     $sharedFolder = \OCA\Files_Sharing\Helper::getShareFolder();
     $this->assertSame('/Shared/Folder', \OCA\Files_Sharing\Helper::getShareFolder());
     $this->assertTrue(\OC\Files\Filesystem::is_dir($sharedFolder));
     // cleanup
     \OCP\Config::deleteSystemValue('share_folder');
 }
开发者ID:droiter,项目名称:openwrt-on-android,代码行数:13,代码来源:helper.php

示例7: getCloudId

 private function getCloudId()
 {
     $this->requireLogin();
     if (!method_exists($this->user, 'getCloudId')) {
         $uid = \OC::$server->getUserSession()->getUser()->getUID();
         $server = \OC::$server->getURLGenerator()->getAbsoluteURL('/');
         return $uid . '@' . rtrim(\OCA\Files_Sharing\Helper::removeProtocolFromUrl($server), '/');
     }
     // Nextcloud 9
     return $this->user->getCloudId();
 }
开发者ID:strukturag,项目名称:nextcloud-spreedme,代码行数:11,代码来源:user.php

示例8: verifyMountPoint

 /**
  * check if the parent folder exists otherwise move the mount point up
  *
  * @param \OCP\Share\IShare $share
  * @param SharedMount[] $mountpoints
  * @return string
  */
 private function verifyMountPoint(\OCP\Share\IShare $share, array $mountpoints)
 {
     $mountPoint = basename($share->getTarget());
     $parent = dirname($share->getTarget());
     if (!$this->recipientView->is_dir($parent)) {
         $parent = Helper::getShareFolder();
     }
     $newMountPoint = $this->generateUniqueTarget(\OC\Files\Filesystem::normalizePath($parent . '/' . $mountPoint), $this->recipientView, $mountpoints);
     if ($newMountPoint !== $share->getTarget()) {
         $this->updateFileTarget($newMountPoint, $share);
     }
     return $newMountPoint;
 }
开发者ID:stweil,项目名称:owncloud-core,代码行数:20,代码来源:sharedmount.php

示例9: generateTarget

 /**
  * create unique target
  * @param string $filePath
  * @param string $shareWith
  * @param string $exclude
  * @return string
  */
 public function generateTarget($filePath, $shareWith, $exclude = null)
 {
     $target = '/' . basename($filePath);
     // for group shares we return the target right away
     if ($shareWith === false) {
         return $target;
     }
     \OC\Files\Filesystem::initMountPoints($shareWith);
     $view = new \OC\Files\View('/' . $shareWith . '/files');
     $excludeList = \OCP\Share::getItemsSharedWithUser('file', $shareWith, self::FORMAT_TARGET_NAMES);
     if (is_array($exclude)) {
         $excludeList = array_merge($excludeList, $exclude);
     }
     return \OCA\Files_Sharing\Helper::generateUniqueTarget($target, $excludeList, $view);
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:22,代码来源:file.php

示例10: verifyMountPoint

 /**
  * check if the parent folder exists otherwise move the mount point up
  */
 private function verifyMountPoint(&$share, $user)
 {
     $mountPoint = basename($share['file_target']);
     $parent = dirname($share['file_target']);
     if (!\OC\Files\Filesystem::is_dir($parent)) {
         $parent = Helper::getShareFolder();
     }
     $newMountPoint = \OCA\Files_Sharing\Helper::generateUniqueTarget(\OC\Files\Filesystem::normalizePath($parent . '/' . $mountPoint), array(), new \OC\Files\View('/' . $user . '/files'));
     if ($newMountPoint !== $share['file_target']) {
         self::updateFileTarget($newMountPoint, $share);
         $share['file_target'] = $newMountPoint;
         $share['unique_name'] = true;
     }
     return $newMountPoint;
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:18,代码来源:sharedmount.php

示例11: verifyMountPoint

 /**
  * check if the parent folder exists otherwise move the mount point up
  *
  * @param array $share
  * @return string
  */
 private function verifyMountPoint(&$share)
 {
     $mountPoint = basename($share['file_target']);
     $parent = dirname($share['file_target']);
     if (!$this->recipientView->is_dir($parent)) {
         $parent = Helper::getShareFolder();
     }
     $newMountPoint = \OCA\Files_Sharing\Helper::generateUniqueTarget(\OC\Files\Filesystem::normalizePath($parent . '/' . $mountPoint), [], $this->recipientView);
     if ($newMountPoint !== $share['file_target']) {
         $this->updateFileTarget($newMountPoint, $share);
         $share['file_target'] = $newMountPoint;
         $share['unique_name'] = true;
     }
     return $newMountPoint;
 }
开发者ID:DanielTosello,项目名称:owncloud,代码行数:21,代码来源:sharedmount.php

示例12: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     // enable resharing
     \OC::$server->getAppConfig()->setValue('core', 'shareapi_allow_resharing', 'yes');
     // register share hooks
     \OC::registerShareHooks();
     \OCA\Files_Sharing\Helper::registerHooks();
     // clear and register hooks
     \OC_FileProxy::register(new \OCA\Files\Share\Proxy());
     // create users
     self::loginHelper(self::TEST_ENCRYPTION_SHARE_USER1, true);
     self::loginHelper(self::TEST_ENCRYPTION_SHARE_USER2, true);
     self::loginHelper(self::TEST_ENCRYPTION_SHARE_USER3, true);
     self::loginHelper(self::TEST_ENCRYPTION_SHARE_USER4, true);
     // create group and assign users
     \OC_Group::createGroup(self::TEST_ENCRYPTION_SHARE_GROUP1);
     \OC_Group::addToGroup(self::TEST_ENCRYPTION_SHARE_USER3, self::TEST_ENCRYPTION_SHARE_GROUP1);
     \OC_Group::addToGroup(self::TEST_ENCRYPTION_SHARE_USER4, self::TEST_ENCRYPTION_SHARE_GROUP1);
 }
开发者ID:yheric455042,项目名称:owncloud82,代码行数:20,代码来源:share.php

示例13: setupMounts

    private function setupMounts()
    {
        // don't setup server-to-server shares if the admin disabled it
        if (\OCA\Files_Sharing\Helper::isIncomingServer2serverShareEnabled() === false) {
            return false;
        }
        if ($this->uid) {
            $query = $this->connection->prepare('
				SELECT `remote`, `share_token`, `password`, `mountpoint`, `owner`
				FROM `*PREFIX*share_external`
				WHERE `user` = ?
			');
            $query->execute(array($this->uid));
            while ($row = $query->fetch()) {
                $row['manager'] = $this;
                $row['token'] = $row['share_token'];
                $this->mountShare($row);
            }
        }
    }
开发者ID:droiter,项目名称:openwrt-on-android,代码行数:20,代码来源:manager.php

示例14: correctFolders

 /**
  * Correct the parent folders' ETags for all users shared the file at $target
  *
  * @param string $target
  */
 public static function correctFolders($target)
 {
     // ignore part files
     if (pathinfo($target, PATHINFO_EXTENSION) === 'part') {
         return false;
     }
     // Correct Shared folders of other users shared with
     $shares = \OCA\Files_Sharing\Helper::getSharesFromItem($target);
     foreach ($shares as $share) {
         if ((int) $share['share_type'] === \OCP\Share::SHARE_TYPE_USER) {
             self::correctUsersFolder($share['share_with'], $share['file_target']);
         } elseif ((int) $share['share_type'] === \OCP\Share::SHARE_TYPE_GROUP) {
             $users = \OC_Group::usersInGroup($share['share_with']);
             foreach ($users as $user) {
                 self::correctUsersFolder($user, $share['file_target']);
             }
         } else {
             //unique name for group share
             self::correctUsersFolder($share['share_with'], $share['file_target']);
         }
     }
 }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:27,代码来源:updater.php

示例15: __construct

 /**
  * @param array $urlParams
  */
 public function __construct(array $urlParams = array())
 {
     parent::__construct('files_sharing', $urlParams);
     $container = $this->getContainer();
     /**
      * Controllers
      */
     $container->registerService('ShareController', function (SimpleContainer $c) {
         return new ShareController($c->query('AppName'), $c->query('Request'), $c->query('UserSession'), $c->query('ServerContainer')->getAppConfig(), $c->query('ServerContainer')->getConfig(), $c->query('URLGenerator'), $c->query('ServerContainer')->getUserManager(), $c->query('ServerContainer')->getLogger(), $c->query('ServerContainer')->getActivityManager());
     });
     $container->registerService('ExternalSharesController', function (SimpleContainer $c) {
         return new ExternalSharesController($c->query('AppName'), $c->query('Request'), $c->query('IsIncomingShareEnabled'), $c->query('ExternalManager'));
     });
     /**
      * Core class wrappers
      */
     $container->registerService('UserSession', function (SimpleContainer $c) {
         return $c->query('ServerContainer')->getUserSession();
     });
     $container->registerService('URLGenerator', function (SimpleContainer $c) {
         return $c->query('ServerContainer')->getUrlGenerator();
     });
     $container->registerService('IsIncomingShareEnabled', function (SimpleContainer $c) {
         return Helper::isIncomingServer2serverShareEnabled();
     });
     $container->registerService('ExternalManager', function (SimpleContainer $c) {
         return new \OCA\Files_Sharing\External\Manager(\OC::$server->getDatabaseConnection(), \OC\Files\Filesystem::getMountManager(), \OC\Files\Filesystem::getLoader(), \OC::$server->getUserSession(), \OC::$server->getHTTPHelper());
     });
     /**
      * Middleware
      */
     $container->registerService('SharingCheckMiddleware', function (SimpleContainer $c) {
         return new SharingCheckMiddleware($c->query('AppName'), $c->query('ServerContainer')->getAppConfig(), $c->getCoreApi());
     });
     // Execute middlewares
     $container->registerMiddleware('SharingCheckMiddleware');
 }
开发者ID:riso,项目名称:owncloud-core,代码行数:40,代码来源:application.php


注:本文中的OCA\Files_Sharing\Helper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。