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


PHP Share\Share类代码示例

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


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

示例1: post_addToGroup

 /**
  * Function that is called after a user is added to a group.
  * TODO what does it do?
  * @param array $arguments
  */
 public static function post_addToGroup($arguments)
 {
     // Find the group shares and check if the user needs a unique target
     $query = \OC_DB::prepare('SELECT * FROM `*PREFIX*share` WHERE `share_type` = ? AND `share_with` = ?');
     $result = $query->execute(array(self::SHARE_TYPE_GROUP, $arguments['gid']));
     $query = \OC_DB::prepare('INSERT INTO `*PREFIX*share` (`item_type`, `item_source`,' . ' `item_target`, `parent`, `share_type`, `share_with`, `uid_owner`, `permissions`,' . ' `stime`, `file_source`, `file_target`) VALUES (?,?,?,?,?,?,?,?,?,?,?)');
     while ($item = $result->fetchRow()) {
         $sourceExists = \OC\Share\Share::getItemSharedWithBySource($item['item_type'], $item['item_source'], self::FORMAT_NONE, null, true, $arguments['uid']);
         if ($sourceExists) {
             $fileTarget = $sourceExists['file_target'];
             $itemTarget = $sourceExists['item_target'];
         } else {
             $itemTarget = Helper::generateTarget($item['item_type'], $item['item_source'], self::SHARE_TYPE_USER, $arguments['uid'], $item['owner'], null, $item['parent']);
             // do we also need a file target
             if ($item['item_type'] === 'file' || $item['item_type'] === 'folder') {
                 $fileTarget = Helper::generateTarget('file', $item['file_target'], self::SHARE_TYPE_USER, $arguments['uid'], $item['owner'], null, $item['parent']);
             } else {
                 $fileTarget = null;
             }
         }
         // Insert an extra row for the group share if the item or file target is unique for this user
         if ($itemTarget != $item['item_target'] || $fileTarget != $item['file_target']) {
             $query->execute(array($item['item_type'], $item['item_source'], $itemTarget, $item['id'], self::$shareTypeGroupUserUnique, $arguments['uid'], $item['uid_owner'], $item['permissions'], $item['stime'], $item['file_source'], $fileTarget));
             \OC_DB::insertid('*PREFIX*share');
         }
     }
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:32,代码来源:hooks.php

示例2: content

 /**
  * get file content from file_id
  * @NoCSRFRequired
  */
 public function content($id)
 {
     $cacheInfo = FileCacheDao::getCacheInfo($id);
     //Get file information (storage urn and user)
     $fileInfo = FileCacheDao::getFileInfo($cacheInfo['storage'], $cacheInfo['path']);
     //Get content
     $content = FileCacheDao::getContentByUrn($fileInfo['urn']);
     // Get shares
     $shares = Share::getAllSharesForFileId($id);
     // Return json data
     return new JSONResponse(array('user' => $fileInfo['user'], 'content' => $content, 'path' => $cacheInfo['path'], 'shares' => $shares));
 }
开发者ID:ifremer,项目名称:snanny-owncloudapi,代码行数:16,代码来源:apicontroller.php

示例3: strpos

        $encModulues[$module['id']]['default'] = true;
    }
}
$template->assign('encryptionModules', $encModulues);
// If the current web root is non-empty but the web root from the config is,
// and system cron is used, the URL generator fails to build valid URLs.
$shouldSuggestOverwriteCliUrl = $config->getAppValue('core', 'backgroundjobs_mode', 'ajax') === 'cron' && \OC::$WEBROOT && \OC::$WEBROOT !== '/' && !$config->getSystemValue('overwrite.cli.url', '');
$suggestedOverwriteCliUrl = $shouldSuggestOverwriteCliUrl ? \OC::$WEBROOT : '';
$template->assign('suggestedOverwriteCliUrl', $suggestedOverwriteCliUrl);
$template->assign('allowLinks', $appConfig->getValue('core', 'shareapi_allow_links', 'yes'));
$template->assign('enforceLinkPassword', \OCP\Util::isPublicLinkPasswordRequired());
$template->assign('allowPublicUpload', $appConfig->getValue('core', 'shareapi_allow_public_upload', 'yes'));
$template->assign('allowResharing', $appConfig->getValue('core', 'shareapi_allow_resharing', 'yes'));
$template->assign('allowPublicMailNotification', $appConfig->getValue('core', 'shareapi_allow_public_notification', 'no'));
$template->assign('allowMailNotification', $appConfig->getValue('core', 'shareapi_allow_mail_notification', 'no'));
$template->assign('onlyShareWithGroupMembers', \OC\Share\Share::shareWithGroupMembersOnly());
$databaseOverload = strpos(\OCP\Config::getSystemValue('dbtype'), 'sqlite') !== false;
$template->assign('databaseOverload', $databaseOverload);
$template->assign('cronErrors', $appConfig->getValue('core', 'cronErrors'));
// warn if php is not setup properly to get system variables with getenv
$path = getenv('PATH');
$template->assign('getenvServerNotWorking', empty($path));
// warn if Windows is used
$template->assign('WindowsWarning', OC_Util::runningOnWindows());
// warn if outdated version of a memcache module is used
$caches = ['apcu' => ['name' => $l->t('APCu'), 'version' => '4.0.6'], 'redis' => ['name' => $l->t('Redis'), 'version' => '2.2.5']];
$outdatedCaches = [];
foreach ($caches as $php_module => $data) {
    $isOutdated = extension_loaded($php_module) && version_compare(phpversion($php_module), $data['version'], '<');
    if ($isOutdated) {
        $outdatedCaches[$php_module] = $data;
开发者ID:WeatherellTechnology,项目名称:weatherstorm7,代码行数:31,代码来源:admin.php

示例4: isResharingAllowed

 /**
  * Check if resharing is allowed
  *
  * @return boolean true if allowed or false
  */
 public static function isResharingAllowed()
 {
     return \OC\Share\Share::isResharingAllowed();
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:9,代码来源:share.php

示例5: propagateById

 public function propagateById($id)
 {
     if (isset($this->propagatingIds[$id])) {
         return;
     }
     $this->propagatingIds[$id] = true;
     $shares = Share::getAllSharesForFileId($id);
     foreach ($shares as $share) {
         // propagate down the share tree
         $this->markDirty($share, microtime(true));
         // propagate up the share tree
         if ($this->isRecipientOfShare($share)) {
             $user = $share['uid_owner'];
             $view = new View('/' . $user . '/files');
             $path = $view->getPath($share['file_source']);
             $watcher = new ChangeWatcher($view, $this->manager->getSharePropagator($user));
             $watcher->writeHook(['path' => $path]);
         }
     }
     unset($this->propagatingIds[$id]);
 }
开发者ID:lchen01,项目名称:STEdwards,代码行数:21,代码来源:recipientpropagator.php

示例6: getPermissions

 /**
  * @return int
  */
 public function getPermissions()
 {
     $perms = $this->data['permissions'];
     if (\OCP\Util::isSharingDisabledForUser() || $this->isShared() && !\OC\Share\Share::isResharingAllowed()) {
         $perms = $perms & ~\OCP\Constants::PERMISSION_SHARE;
     }
     return $perms;
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:11,代码来源:FileInfo.php

示例7: __construct

 /**
  * Constructor.
  *
  * @param TagMapper $mapper Instance of the TagMapper abstraction layer.
  * @param string $user The user whose data the object will operate on.
  * @param string $type The type of items for which tags will be loaded.
  * @param array $defaultTags Tags that should be created at construction.
  * @param boolean $includeShared Whether to include tags for items shared with this user by others.
  */
 public function __construct(TagMapper $mapper, $user, $type, $defaultTags = array(), $includeShared = false)
 {
     $this->mapper = $mapper;
     $this->user = $user;
     $this->type = $type;
     $this->includeShared = $includeShared;
     $this->owners = array($this->user);
     if ($this->includeShared) {
         $this->owners = array_merge($this->owners, \OC\Share\Share::getSharedItemsOwners($this->user, $this->type, true));
         $this->backend = \OC\Share\Share::getBackend($this->type);
     }
     $this->tags = $this->mapper->loadTags($this->owners, $this->type);
     if (count($defaultTags) > 0 && count($this->tags) === 0) {
         $this->addMultiple($defaultTags, true);
     }
     \OCP\Util::writeLog('core', __METHOD__ . ', tags: ' . print_r($this->tags, true), \OCP\Util::DEBUG);
 }
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:26,代码来源:tags.php

示例8: checkPasswordProtectedShare

 /**
  * In case a password protected link is not yet authenticated this function will return false
  *
  * @param array $linkItem
  * @return bool
  */
 public static function checkPasswordProtectedShare(array $linkItem)
 {
     return \OC\Share\Share::checkPasswordProtectedShare($linkItem);
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:10,代码来源:share.php

示例9: getItemSharedWithUser

 /**
  * @param $itemSource
  * @param $itemType
  * @param IUser $recipient
  * @return array
  */
 protected function getItemSharedWithUser($itemSource, $itemType, $recipient)
 {
     return Share::getItemSharedWithUser($itemType, $itemSource, $recipient->getUID());
 }
开发者ID:Commenter123,项目名称:core,代码行数:10,代码来源:mailnotifications.php

示例10: isSameUserOnSameServer

 /**
  * check if two federated cloud IDs refer to the same user
  *
  * @param string $user1
  * @param string $server1
  * @param string $user2
  * @param string $server2
  * @return bool true if both users and servers are the same
  */
 public static function isSameUserOnSameServer($user1, $server1, $user2, $server2)
 {
     $normalizedServer1 = strtolower(\OC\Share\Share::removeProtocolFromUrl($server1));
     $normalizedServer2 = strtolower(\OC\Share\Share::removeProtocolFromUrl($server2));
     if (rtrim($normalizedServer1, '/') === rtrim($normalizedServer2, '/')) {
         // FIXME this should be a method in the user management instead
         \OCP\Util::emitHook('\\OCA\\Files_Sharing\\API\\Server2Server', 'preLoginNameUsedAsUserName', array('uid' => &$user1));
         \OCP\Util::emitHook('\\OCA\\Files_Sharing\\API\\Server2Server', 'preLoginNameUsedAsUserName', array('uid' => &$user2));
         if ($user1 === $user2) {
             return true;
         }
     }
     return false;
 }
开发者ID:loulancn,项目名称:core,代码行数:23,代码来源:helper.php

示例11: calcExpireDate

 public static function calcExpireDate()
 {
     $expireAfter = \OC\Share\Share::getExpireInterval() * 24 * 60 * 60;
     $expireAt = time() + $expireAfter;
     $date = new \DateTime();
     $date->setTimestamp($expireAt);
     $date->setTime(0, 0, 0);
     //$dateString = $date->format('Y-m-d') . ' 00:00:00';
     return $date;
 }
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:10,代码来源:helper.php

示例12: shareFile

 /**
  * @param $fid
  * @param $uid
  * @param $wUid
  * @return bool|string
  * @throws \Exception
  * @throws \OC\HintException
  */
 public function shareFile($uid, $wUid, $fid, $permission = 1)
 {
     $isEnabled = \OCP\Share::isEnabled();
     $isAllowed = \OCP\Share::isResharingAllowed();
     $sharedWith = \OCP\Share::getUsersItemShared('file', $fid, $uid, false, true);
     //$file = $this->connect->files()->getInfoById($fid);
     if ($isEnabled && $isAllowed && !in_array($wUid, $sharedWith)) {
         // \OCP\Constants::PERMISSION_READ
         // \OCP\Constants::PERMISSION_ALL
         // \OCP\Share::SHARE_TYPE_LINK
         // \OCP\Share::SHARE_TYPE_USER,
         $shareIsSuccess = \OC\Share\Share::shareItem('file', $fid, \OCP\Share::SHARE_TYPE_USER, $wUid, $permission);
         if ($shareIsSuccess) {
             $this->connect->update('*PREFIX*share', ['uid_initiator' => $uid], 'share_with = :share_with AND uid_owner = :uid_owner AND file_source = :file_source', [':share_with' => $wUid, ':uid_owner' => $uid, ':file_source' => $fid]);
             $token = \OC\Share\Share::shareItem('file', $fid, \OCP\Share::SHARE_TYPE_LINK, $wUid, $permission);
             $this->connect->update('*PREFIX*share', ['uid_initiator' => $uid, 'share_with' => null], 'uid_owner = :uid_owner AND file_source = :file_source AND token = :token', [':uid_owner' => $uid, ':file_source' => $fid, ':token' => $token]);
             return $token;
         }
     }
 }
开发者ID:Werdffelynir,项目名称:owncollab_talks,代码行数:28,代码来源:files.php

示例13: __construct

 /**
  * Constructor.
  *
  * @param TagMapper $mapper Instance of the TagMapper abstraction layer.
  * @param string $user The user whose data the object will operate on.
  * @param string $type The type of items for which tags will be loaded.
  * @param array $defaultTags Tags that should be created at construction.
  * @param boolean $includeShared Whether to include tags for items shared with this user by others.
  */
 public function __construct(TagMapper $mapper, $user, $type, $defaultTags = array(), $includeShared = false)
 {
     $this->mapper = $mapper;
     $this->user = $user;
     $this->type = $type;
     $this->includeShared = $includeShared;
     $this->owners = array($this->user);
     if ($this->includeShared) {
         $this->owners = array_merge($this->owners, \OC\Share\Share::getSharedItemsOwners($this->user, $this->type, true));
         $this->backend = \OC\Share\Share::getBackend($this->type);
     }
     $this->tags = $this->mapper->loadTags($this->owners, $this->type);
     if (count($defaultTags) > 0 && count($this->tags) === 0) {
         $this->addMultiple($defaultTags, true);
     }
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:25,代码来源:tags.php

示例14: isSharable

 public function isSharable($path)
 {
     if (\OCP\Util::isSharingDisabledForUser() || !\OC\Share\Share::isResharingAllowed()) {
         return false;
     }
     return $this->getPermissions($path) & \OCP\Constants::PERMISSION_SHARE;
 }
开发者ID:lchen01,项目名称:STEdwards,代码行数:7,代码来源:storage.php

示例15: propagateById

 public function propagateById($id)
 {
     $shares = Share::getAllSharesForFileId($id);
     foreach ($shares as $share) {
         // propagate down the share tree
         $this->markDirty($share, microtime(true));
         // propagate up the share tree
         if ($share['share_with'] === $this->userId) {
             $user = $share['uid_owner'];
             $view = new View('/' . $user . '/files');
             $path = $view->getPath($share['file_source']);
             $watcher = new ChangeWatcher($view, $this->manager->getSharePropagator($user));
             $watcher->writeHook(['path' => $path]);
         }
     }
 }
开发者ID:GrumpyCrouton,项目名称:core,代码行数:16,代码来源:recipientpropagator.php


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