本文整理汇总了PHP中OCA\Files_Sharing\Helper类的典型用法代码示例。如果您正苦于以下问题:PHP Helper类的具体用法?PHP Helper怎么用?PHP Helper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Helper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: function
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
$l = \OC::$server->getL10N('files_sharing');
\OC::$CLASSPATH['OC_Share_Backend_File'] = 'files_sharing/lib/share/file.php';
\OC::$CLASSPATH['OC_Share_Backend_Folder'] = 'files_sharing/lib/share/folder.php';
\OC::$CLASSPATH['OC\\Files\\Storage\\Shared'] = 'files_sharing/lib/sharedstorage.php';
$application = new \OCA\Files_Sharing\AppInfo\Application();
$application->registerMountProviders();
\OCA\Files_Sharing\Helper::registerHooks();
\OCP\Share::registerBackend('file', 'OC_Share_Backend_File');
\OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file');
$eventDispatcher = \OC::$server->getEventDispatcher();
$eventDispatcher->addListener('OCA\\Files::loadAdditionalScripts', function () {
\OCP\Util::addScript('files_sharing', 'share');
\OCP\Util::addScript('files_sharing', 'sharetabview');
if (\OC::$server->getConfig()->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'yes') {
\OCP\Util::addScript('files_sharing', 'external');
}
\OCP\Util::addStyle('files_sharing', 'sharetabview');
});
// \OCP\Util::addStyle('files_sharing', 'sharetabview');
\OC::$server->getActivityManager()->registerExtension(function () {
return new \OCA\Files_Sharing\Activity(\OC::$server->query('L10NFactory'), \OC::$server->getURLGenerator(), \OC::$server->getActivityManager());
});
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:31,代码来源:app.php
示例17: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
\OCA\Files_Sharing\Helper::registerHooks();
}
开发者ID:GitHubUser4234,项目名称:core,代码行数:5,代码来源:PropagationTestCase.php
示例18: isShareTypeAllowed
/**
* check if server2server share is enabled
*
* @param int $shareType
* @return boolean
*/
public function isShareTypeAllowed($shareType)
{
if ($shareType === \OCP\Share::SHARE_TYPE_REMOTE) {
return \OCA\Files_Sharing\Helper::isOutgoingServer2serverShareEnabled();
}
return true;
}
开发者ID:Ebimedia,项目名称:owncloud,代码行数:13,代码来源:file.php
示例19: rename
public function rename($path1, $path2)
{
// we need the paths relative to data/user/files
$relPath1 = $this->getMountPoint() . '/' . $path1;
$relPath2 = $this->getMountPoint() . '/' . $path2;
// check for update permissions on the share
if ($this->isUpdatable('')) {
$pathinfo = pathinfo($relPath1);
// for part files we need to ask for the owner and path from the parent directory because
// the file cache doesn't return any results for part files
if ($pathinfo['extension'] === 'part') {
list($user1, $path1) = \OCA\Files_Sharing\Helper::getUidAndFilename($pathinfo['dirname']);
$path1 = $path1 . '/' . $pathinfo['basename'];
} else {
list($user1, $path1) = \OCA\Files_Sharing\Helper::getUidAndFilename($relPath1);
}
$targetFilename = basename($relPath2);
list($user2, $path2) = \OCA\Files_Sharing\Helper::getUidAndFilename(dirname($relPath2));
$rootView = new \OC\Files\View('');
return $rootView->rename('/' . $user1 . '/files/' . $path1, '/' . $user2 . '/files/' . $path2 . '/' . $targetFilename);
}
return false;
}
开发者ID:ArcherSys,项目名称:ArcherSysOSCloud7,代码行数:23,代码来源:sharedstorage.php
示例20: testShareWithDifferentShareFolder
public function testShareWithDifferentShareFolder()
{
$fileinfo = $this->view->getFileInfo($this->filename);
$folderinfo = $this->view->getFileInfo($this->folder);
$fileShare = \OCP\Share::shareItem('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, 31);
$this->assertTrue($fileShare);
\OCA\Files_Sharing\Helper::setShareFolder('/Shared/subfolder');
$folderShare = \OCP\Share::shareItem('folder', $folderinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, 31);
$this->assertTrue($folderShare);
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
$this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename));
$this->assertTrue(\OC\Files\Filesystem::file_exists('/Shared/subfolder/' . $this->folder));
//cleanup
\OC::$server->getConfig()->deleteSystemValue('share_folder');
}
开发者ID:evanjt,项目名称:core,代码行数:15,代码来源:share.php
注:本文中的OCA\Files_Sharing\Helper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论