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


PHP IRequest::getParam方法代码示例

本文整理汇总了PHP中OCP\IRequest::getParam方法的典型用法代码示例。如果您正苦于以下问题:PHP IRequest::getParam方法的具体用法?PHP IRequest::getParam怎么用?PHP IRequest::getParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OCP\IRequest的用法示例。


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

示例1: setAppValue

 /**
  * @param array $parameters
  * @return \OC_OCS_Result
  */
 public function setAppValue($parameters)
 {
     $app = $parameters['appid'];
     $configKey = $parameters['configkey'];
     $value = $this->request->getParam('value');
     $this->config->setAppValue($app, $configKey, $value);
     return new \OC_OCS_Result();
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:12,代码来源:Config.php

示例2: receiveSurveyResults

 /**
  * request received to ask remote server for a shared secret
  *
  * @return \OC_OCS_Result
  */
 public function receiveSurveyResults()
 {
     $data = $this->request->getParam('data');
     $array = json_decode($data, true);
     if ($array === null) {
         return new \OC_OCS_Result(null, Http::STATUS_BAD_REQUEST, 'Invalid data supplied.');
     }
     try {
         $this->service->add($array);
     } catch (\Exception $e) {
         return new \OC_OCS_Result(null, Http::STATUS_BAD_REQUEST, 'Invalid data supplied.');
     }
     return new \OC_OCS_Result(null, Http::STATUS_OK);
 }
开发者ID:schiessle,项目名称:popularitycontestserver,代码行数:19,代码来源:externalapi.php

示例3: generateHeaders

 /**
  * @param array $headers
  * @param bool $hasMoreActivities
  * @return array
  */
 protected function generateHeaders(array $headers, $hasMoreActivities)
 {
     if ($hasMoreActivities && isset($headers['X-Activity-Last-Given'])) {
         // Set the "Link" header for the next page
         $nextPageParameters = ['since' => $headers['X-Activity-Last-Given'], 'limit' => $this->limit, 'sort' => $this->sort];
         if ($this->objectType && $this->objectId) {
             $nextPageParameters['object_type'] = $this->objectType;
             $nextPageParameters['object_id'] = $this->objectId;
         }
         if ($this->request->getParam('format') !== null) {
             $nextPageParameters['format'] = $this->request->getParam('format');
         }
         $nextPage = $this->request->getServerProtocol();
         # http
         $nextPage .= '://' . $this->request->getServerHost();
         # localhost
         $nextPage .= $this->request->getScriptName();
         # /ocs/v2.php
         $nextPage .= $this->request->getPathInfo();
         # /apps/activity/api/v2/activity
         $nextPage .= '?' . http_build_query($nextPageParameters);
         $headers['Link'] = '<' . $nextPage . '>; rel="next"';
     }
     return $headers;
 }
开发者ID:ynott,项目名称:activity,代码行数:30,代码来源:ocsendpoint.php

示例4: updateShare

 /**
  * @param int $id
  * @return \OC_OCS_Result
  */
 public function updateShare($id)
 {
     // Try both our default and our federated provider
     $share = null;
     try {
         $share = $this->shareManager->getShareById('ocinternal:' . $id);
     } catch (\OC\Share20\Exception\ShareNotFound $e) {
         //Ignore for now
         //return new \OC_OCS_Result(null, 404, 'wrong share ID, share doesn\'t exist.');
     }
     // Could not find the share as internal share... maybe it is a federated share
     if ($share === null) {
         return \OCA\Files_Sharing\API\Local::updateShare(['id' => $id]);
     }
     if (!$this->canAccessShare($share)) {
         return new \OC_OCS_Result(null, 404, "wrong share Id, share doesn't exist.");
     }
     $permissions = $this->request->getParam('permissions', null);
     $password = $this->request->getParam('password', null);
     $publicUpload = $this->request->getParam('publicUpload', null);
     $expireDate = $this->request->getParam('expireDate', null);
     if ($permissions === null && $password === null && $publicUpload === null && $expireDate === null) {
         return new \OC_OCS_Result(null, 400, 'Wrong or no update parameter given');
     }
     if ($expireDate !== null) {
         try {
             $expireDate = $this->parseDate($expireDate);
         } catch (\Exception $e) {
             return new \OC_OCS_Result(null, 400, $e->getMessage());
         }
         $share->setExpirationDate($expireDate);
     }
     if ($permissions !== null) {
         $permissions = (int) $permissions;
         $share->setPermissions($permissions);
     }
     if ($password !== null) {
         $share->setPassword($password);
     }
     if ($publicUpload === 'true') {
         $share->setPermissions(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE);
     } else {
         if ($publicUpload === 'false') {
             $share->setPermissions(\OCP\Constants::PERMISSION_READ);
         }
     }
     try {
         $share = $this->shareManager->updateShare($share);
     } catch (\Exception $e) {
         return new \OC_OCS_Result(null, 400, $e->getMessage());
     }
     return new \OC_OCS_Result($this->formatShare($share));
 }
开发者ID:matt407,项目名称:core,代码行数:57,代码来源:share20ocs.php

示例5: getSharedSecret

 /**
  * create shared secret and return it
  *
  * @return \OC_OCS_Result
  */
 public function getSharedSecret()
 {
     $url = $this->request->getParam('url');
     $token = $this->request->getParam('token');
     if ($this->trustedServers->isTrustedServer($url) === false || $this->isValidToken($url, $token) === false) {
         return new \OC_OCS_Result(null, HTTP::STATUS_FORBIDDEN);
     }
     $sharedSecret = $this->secureRandom->getMediumStrengthGenerator()->generate(32);
     $this->trustedServers->addSharedSecret($url, $sharedSecret);
     // reset token after the exchange of the shared secret was successful
     $this->dbHandler->addToken($url, '');
     return new \OC_OCS_Result(['sharedSecret' => $sharedSecret], Http::STATUS_OK);
 }
开发者ID:mrjoshuap,项目名称:core,代码行数:18,代码来源:ocsauthapi.php

示例6: getUserFromToken

 /**
  * Get the user for the token
  *
  * @return string
  * @throws \UnexpectedValueException If the token is invalid, does not exist or is not unique
  */
 protected function getUserFromToken()
 {
     $token = (string) $this->request->getParam('token', '');
     if (strlen($token) !== 30) {
         throw new \UnexpectedValueException('The token is invalid');
     }
     $users = $this->config->getUsersForUserValue('activity', 'rsstoken', $token);
     if (sizeof($users) !== 1) {
         // No unique user found
         throw new \UnexpectedValueException('The token is invalid');
     }
     // Token found login as that user
     return array_shift($users);
 }
开发者ID:kenwi,项目名称:core,代码行数:20,代码来源:activitymanager.php

示例7: addGroup

 /**
  * creates a new group
  *
  * @param array $parameters
  * @return OC_OCS_Result
  */
 public function addGroup($parameters)
 {
     // Validate name
     $groupId = $this->request->getParam('groupid', '');
     if (empty($groupId)) {
         \OCP\Util::writeLog('provisioning_api', 'Group name not supplied', \OCP\Util::ERROR);
         return new OC_OCS_Result(null, 101, 'Invalid group name');
     }
     // Check if it exists
     if ($this->groupManager->groupExists($groupId)) {
         return new OC_OCS_Result(null, 102);
     }
     $this->groupManager->createGroup($groupId);
     return new OC_OCS_Result(null, 100);
 }
开发者ID:kenwi,项目名称:core,代码行数:21,代码来源:groups.php

示例8: addGroup

 /**
  * creates a new group
  *
  * @param array $parameters
  * @return OC_OCS_Result
  */
 public function addGroup($parameters)
 {
     // Validate name
     $groupId = $this->request->getParam('groupid', '');
     if (preg_match('/[^a-zA-Z0-9 _\\.@\\-]/', $groupId) || empty($groupId)) {
         \OCP\Util::writeLog('provisioning_api', 'Attempt made to create group using invalid characters.', \OCP\Util::ERROR);
         return new OC_OCS_Result(null, 101, 'Invalid group name');
     }
     // Check if it exists
     if ($this->groupManager->groupExists($groupId)) {
         return new OC_OCS_Result(null, 102);
     }
     $this->groupManager->createGroup($groupId);
     return new OC_OCS_Result(null, 100);
 }
开发者ID:evanjt,项目名称:core,代码行数:21,代码来源:groups.php

示例9: getSharedSecret

 /**
  * create shared secret and return it
  *
  * @return \OC_OCS_Result
  */
 public function getSharedSecret()
 {
     $url = $this->request->getParam('url');
     $token = $this->request->getParam('token');
     if ($this->trustedServers->isTrustedServer($url) === false) {
         $this->logger->log(\OCP\Util::ERROR, 'remote server not trusted (' . $url . ') while getting shared secret');
         return new \OC_OCS_Result(null, HTTP::STATUS_FORBIDDEN);
     }
     if ($this->isValidToken($url, $token) === false) {
         $this->logger->log(\OCP\Util::ERROR, 'remote server (' . $url . ') didn\'t send a valid token (got ' . $token . ') while getting shared secret');
         return new \OC_OCS_Result(null, HTTP::STATUS_FORBIDDEN);
     }
     $sharedSecret = $this->secureRandom->generate(32);
     $this->trustedServers->addSharedSecret($url, $sharedSecret);
     // reset token after the exchange of the shared secret was successful
     $this->dbHandler->addToken($url, '');
     return new \OC_OCS_Result(['sharedSecret' => $sharedSecret], Http::STATUS_OK);
 }
开发者ID:kenwi,项目名称:core,代码行数:23,代码来源:ocsauthapi.php

示例10: updatePermissions

 /**
  * update share information to keep federated re-shares in sync
  *
  * @param array $params
  * @return \OC_OCS_Result
  */
 public function updatePermissions($params)
 {
     $id = (int) $params['id'];
     $token = $this->request->getParam('token', null);
     $permissions = $this->request->getParam('permissions', null);
     try {
         $share = $this->federatedShareProvider->getShareById($id);
     } catch (Share\Exceptions\ShareNotFound $e) {
         return new \OC_OCS_Result(null, Http::STATUS_BAD_REQUEST);
     }
     $validPermission = ctype_digit($permissions);
     $validToken = $this->verifyShare($share, $token);
     if ($validPermission && $validToken) {
         $this->updatePermissionsInDatabase($share, (int) $permissions);
     } else {
         return new \OC_OCS_Result(null, Http::STATUS_BAD_REQUEST);
     }
     return new \OC_OCS_Result();
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:25,代码来源:RequestHandler.php

示例11: getShares

 /**
  * The getShares function.
  *
  * - Get shares by the current user
  * - Get shares by the current user and reshares (?reshares=true)
  * - Get shares with the current user (?shared_with_me=true)
  * - Get shares for a specific path (?path=...)
  * - Get all shares in a folder (?subfiles=true&path=..)
  *
  * @return \OC_OCS_Result
  */
 public function getShares()
 {
     $sharedWithMe = $this->request->getParam('shared_with_me', null);
     $reshares = $this->request->getParam('reshares', null);
     $subfiles = $this->request->getParam('subfiles');
     $path = $this->request->getParam('path', null);
     if ($sharedWithMe === 'true') {
         return $this->getSharedWithMe();
     }
     if ($path !== null) {
         $userFolder = $this->rootFolder->getUserFolder($this->currentUser->getUID());
         try {
             $path = $userFolder->get($path);
         } catch (\OCP\Files\NotFoundException $e) {
             return new \OC_OCS_Result(null, 404, 'wrong path, file/folder doesn\'t exist');
         }
     }
     if ($subfiles === 'true') {
         return $this->getSharesInDir($path);
     }
     if ($reshares === 'true') {
         $reshares = true;
     } else {
         $reshares = false;
     }
     // Get all shares
     $userShares = $this->shareManager->getSharesBy($this->currentUser, \OCP\Share::SHARE_TYPE_USER, $path, $reshares, -1, 0);
     $groupShares = $this->shareManager->getSharesBy($this->currentUser, \OCP\Share::SHARE_TYPE_GROUP, $path, $reshares, -1, 0);
     $linkShares = $this->shareManager->getSharesBy($this->currentUser, \OCP\Share::SHARE_TYPE_LINK, $path, $reshares, -1, 0);
     //TODO: Add federated shares
     $shares = array_merge($userShares, $groupShares, $linkShares);
     $formatted = [];
     foreach ($shares as $share) {
         $formatted[] = $this->formatShare($share);
     }
     return new \OC_OCS_Result($formatted);
 }
开发者ID:Juraganet,项目名称:core,代码行数:48,代码来源:share20ocs.php

示例12: params

 /**
  * Lets you access post and get parameters by the index
  * @deprecated 7.0.0 write your parameters as method arguments instead
  * @param string $key the key which you want to access in the URL Parameter
  *                     placeholder, $_POST or $_GET array.
  *                     The priority how they're returned is the following:
  *                     1. URL parameters
  *                     2. POST parameters
  *                     3. GET parameters
  * @param string $default If the key is not found, this value will be returned
  * @return mixed the content of the array
  * @since 6.0.0
  */
 public function params($key, $default = null)
 {
     return $this->request->getParam($key, $default);
 }
开发者ID:samj1912,项目名称:repo,代码行数:17,代码来源:controller.php

示例13: getPath

 /**
  * @param array $parameters
  * @return int
  */
 protected function getPath($parameters)
 {
     $node = \OC::$server->getRootFolder()->getUserFolder($parameters['user'])->get($this->request->getParam('path'));
     return 'files/' . md5($node->getStorage()->getId() . '::' . trim($node->getInternalPath(), '/'));
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:9,代码来源:provisioning.php

示例14: updateShare

 /**
  * @param int $id
  * @return \OC_OCS_Result
  */
 public function updateShare($id)
 {
     try {
         $share = $this->getShareById($id);
     } catch (ShareNotFound $e) {
         return new \OC_OCS_Result(null, 404, 'wrong share ID, share doesn\'t exist.');
     }
     if (!$this->canAccessShare($share)) {
         return new \OC_OCS_Result(null, 404, 'wrong share Id, share doesn\'t exist.');
     }
     $permissions = $this->request->getParam('permissions', null);
     $password = $this->request->getParam('password', null);
     $publicUpload = $this->request->getParam('publicUpload', null);
     $expireDate = $this->request->getParam('expireDate', null);
     /*
      * expirationdate, password and publicUpload only make sense for link shares
      */
     if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) {
         if ($permissions === null && $password === null && $publicUpload === null && $expireDate === null) {
             return new \OC_OCS_Result(null, 400, 'Wrong or no update parameter given');
         }
         $newPermissions = null;
         if ($publicUpload === 'true') {
             $newPermissions = \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE;
         } else {
             if ($publicUpload === 'false') {
                 $newPermissions = \OCP\Constants::PERMISSION_READ;
             }
         }
         if ($permissions !== null) {
             $newPermissions = (int) $permissions;
         }
         if ($newPermissions !== null && $newPermissions !== \OCP\Constants::PERMISSION_READ && $newPermissions !== (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE)) {
             return new \OC_OCS_Result(null, 400, 'can\'t change permission for public link share');
         }
         if ($newPermissions === (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE)) {
             if (!$this->shareManager->shareApiLinkAllowPublicUpload()) {
                 return new \OC_OCS_Result(null, 403, 'public upload disabled by the administrator');
             }
             if (!$share->getNode() instanceof \OCP\Files\Folder) {
                 return new \OC_OCS_Result(null, 400, "public upload is only possible for public shared folders");
             }
         }
         if ($newPermissions !== null) {
             $share->setPermissions($newPermissions);
         }
         if ($expireDate === '') {
             $share->setExpirationDate(null);
         } else {
             if ($expireDate !== null) {
                 try {
                     $expireDate = $this->parseDate($expireDate);
                 } catch (\Exception $e) {
                     return new \OC_OCS_Result(null, 400, $e->getMessage());
                 }
                 $share->setExpirationDate($expireDate);
             }
         }
         if ($password === '') {
             $share->setPassword(null);
         } else {
             if ($password !== null) {
                 $share->setPassword($password);
             }
         }
     } else {
         // For other shares only permissions is valid.
         if ($permissions === null) {
             return new \OC_OCS_Result(null, 400, 'Wrong or no update parameter given');
         } else {
             $permissions = (int) $permissions;
             $share->setPermissions($permissions);
         }
     }
     if ($permissions !== null) {
         /* Check if this is an incomming share */
         $incomingShares = $this->shareManager->getSharedWith($this->currentUser->getUID(), \OCP\Share::SHARE_TYPE_USER, $share->getNode(), -1, 0);
         $incomingShares = array_merge($incomingShares, $this->shareManager->getSharedWith($this->currentUser->getUID(), \OCP\Share::SHARE_TYPE_GROUP, $share->getNode(), -1, 0));
         if (!empty($incomingShares)) {
             $maxPermissions = 0;
             foreach ($incomingShares as $incomingShare) {
                 $maxPermissions |= $incomingShare->getPermissions();
             }
             if ($share->getPermissions() & ~$maxPermissions) {
                 return new \OC_OCS_Result(null, 404, 'Cannot increase permissions');
             }
         }
     }
     try {
         $share = $this->shareManager->updateShare($share);
     } catch (\Exception $e) {
         return new \OC_OCS_Result(null, 400, $e->getMessage());
     }
     return new \OC_OCS_Result($this->formatShare($share));
 }
开发者ID:gvde,项目名称:core,代码行数:99,代码来源:share20ocs.php

示例15: updateShare

 /**
  * @param int $id
  * @return \OC_OCS_Result
  */
 public function updateShare($id)
 {
     // Try both our default and our federated provider
     $share = null;
     try {
         $share = $this->shareManager->getShareById('ocinternal:' . $id);
     } catch (ShareNotFound $e) {
         //Ignore for now
         //return new \OC_OCS_Result(null, 404, 'wrong share ID, share doesn\'t exist.');
     }
     // Could not find the share as internal share... maybe it is a federated share
     if ($share === null) {
         return \OCA\Files_Sharing\API\Local::updateShare(['id' => $id]);
     }
     if (!$this->canAccessShare($share)) {
         return new \OC_OCS_Result(null, 404, 'wrong share Id, share doesn\'t exist.');
     }
     $permissions = $this->request->getParam('permissions', null);
     $password = $this->request->getParam('password', null);
     $publicUpload = $this->request->getParam('publicUpload', null);
     $expireDate = $this->request->getParam('expireDate', null);
     /*
      * expirationdate, password and publicUpload only make sense for link shares
      */
     if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) {
         if ($permissions === null && $password === null && $publicUpload === null && $expireDate === null) {
             return new \OC_OCS_Result(null, 400, 'Wrong or no update parameter given');
         }
         $newPermissions = null;
         if ($publicUpload === 'true') {
             $newPermissions = \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE;
         } else {
             if ($publicUpload === 'false') {
                 $newPermissions = \OCP\Constants::PERMISSION_READ;
             }
         }
         if ($permissions !== null) {
             $newPermissions = (int) $permissions;
         }
         if ($newPermissions !== null && $newPermissions !== \OCP\Constants::PERMISSION_READ && $newPermissions !== (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE)) {
             return new \OC_OCS_Result(null, 400, 'can\'t change permission for public link share');
         }
         if ($newPermissions === (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE)) {
             if (!$this->shareManager->shareApiLinkAllowPublicUpload()) {
                 return new \OC_OCS_Result(null, 403, 'public upload disabled by the administrator');
             }
             if (!$share->getNode() instanceof \OCP\Files\Folder) {
                 return new \OC_OCS_Result(null, 400, "public upload is only possible for public shared folders");
             }
         }
         if ($newPermissions !== null) {
             $share->setPermissions($newPermissions);
         }
         if ($expireDate === '') {
             $share->setExpirationDate(null);
         } else {
             if ($expireDate !== null) {
                 try {
                     $expireDate = $this->parseDate($expireDate);
                 } catch (\Exception $e) {
                     return new \OC_OCS_Result(null, 400, $e->getMessage());
                 }
                 $share->setExpirationDate($expireDate);
             }
         }
         if ($password === '') {
             $share->setPassword(null);
         } else {
             if ($password !== null) {
                 $share->setPassword($password);
             }
         }
     } else {
         // For other shares only permissions is valid.
         if ($permissions === null) {
             return new \OC_OCS_Result(null, 400, 'Wrong or no update parameter given');
         } else {
             $permissions = (int) $permissions;
             $share->setPermissions($permissions);
         }
     }
     try {
         $share = $this->shareManager->updateShare($share);
     } catch (\Exception $e) {
         return new \OC_OCS_Result(null, 400, $e->getMessage());
     }
     return new \OC_OCS_Result($this->formatShare($share));
 }
开发者ID:vincchan,项目名称:core,代码行数:92,代码来源:share20ocs.php


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