Found by Psalm 3.14.1 Signed-off-by: Morris Jobke <hey@morrisjobke.de>tags/v20.0.0beta1
* used/fetched to determine these numbers. If both are specified the | * used/fetched to determine these numbers. If both are specified the | ||||
* amount of times this is needed is reduced by a great degree. | * amount of times this is needed is reduced by a great degree. | ||||
* | * | ||||
* @param mixed $id | |||||
* @param mixed $calendarId | |||||
* @param int $calendarType | * @param int $calendarType | ||||
* @return array | * @return array | ||||
*/ | */ | ||||
public function getCalendarObjects($id, $calendarType=self::CALENDAR_TYPE_CALENDAR):array { | |||||
public function getCalendarObjects($calendarId, $calendarType=self::CALENDAR_TYPE_CALENDAR):array { | |||||
$query = $this->db->getQueryBuilder(); | $query = $this->db->getQueryBuilder(); | ||||
$query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'componenttype', 'classification']) | $query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'componenttype', 'classification']) | ||||
->from('calendarobjects') | ->from('calendarobjects') | ||||
->where($query->expr()->eq('calendarid', $query->createNamedParameter($id))) | |||||
->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) | |||||
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))); | ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))); | ||||
$stmt = $query->execute(); | $stmt = $query->execute(); | ||||
* | * | ||||
* This method must return null if the object did not exist. | * This method must return null if the object did not exist. | ||||
* | * | ||||
* @param mixed $id | |||||
* @param mixed $calendarId | |||||
* @param string $objectUri | * @param string $objectUri | ||||
* @param int $calendarType | * @param int $calendarType | ||||
* @return array|null | * @return array|null | ||||
*/ | */ | ||||
public function getCalendarObject($id, $objectUri, $calendarType=self::CALENDAR_TYPE_CALENDAR) { | |||||
public function getCalendarObject($calendarId, $objectUri, $calendarType=self::CALENDAR_TYPE_CALENDAR) { | |||||
$query = $this->db->getQueryBuilder(); | $query = $this->db->getQueryBuilder(); | ||||
$query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification']) | $query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification']) | ||||
->from('calendarobjects') | ->from('calendarobjects') | ||||
->where($query->expr()->eq('calendarid', $query->createNamedParameter($id))) | |||||
->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) | |||||
->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) | ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) | ||||
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))); | ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))); | ||||
$stmt = $query->execute(); | $stmt = $query->execute(); | ||||
* @param int $calendarType | * @param int $calendarType | ||||
* @return array | * @return array | ||||
*/ | */ | ||||
public function getMultipleCalendarObjects($id, array $uris, $calendarType=self::CALENDAR_TYPE_CALENDAR):array { | |||||
public function getMultipleCalendarObjects($calendarId, array $uris, $calendarType=self::CALENDAR_TYPE_CALENDAR):array { | |||||
if (empty($uris)) { | if (empty($uris)) { | ||||
return []; | return []; | ||||
} | } | ||||
$query = $this->db->getQueryBuilder(); | $query = $this->db->getQueryBuilder(); | ||||
$query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification']) | $query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification']) | ||||
->from('calendarobjects') | ->from('calendarobjects') | ||||
->where($query->expr()->eq('calendarid', $query->createNamedParameter($id))) | |||||
->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) | |||||
->andWhere($query->expr()->in('uri', $query->createParameter('uri'))) | ->andWhere($query->expr()->in('uri', $query->createParameter('uri'))) | ||||
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))); | ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))); | ||||
* as possible, so it gives you a good idea on what type of stuff you need | * as possible, so it gives you a good idea on what type of stuff you need | ||||
* to think of. | * to think of. | ||||
* | * | ||||
* @param mixed $id | |||||
* @param mixed $calendarId | |||||
* @param array $filters | * @param array $filters | ||||
* @param int $calendarType | * @param int $calendarType | ||||
* @return array | * @return array | ||||
*/ | */ | ||||
public function calendarQuery($id, array $filters, $calendarType=self::CALENDAR_TYPE_CALENDAR):array { | |||||
public function calendarQuery($calendarId, array $filters, $calendarType=self::CALENDAR_TYPE_CALENDAR):array { | |||||
$componentType = null; | $componentType = null; | ||||
$requirePostFilter = true; | $requirePostFilter = true; | ||||
$timeRange = null; | $timeRange = null; | ||||
$query = $this->db->getQueryBuilder(); | $query = $this->db->getQueryBuilder(); | ||||
$query->select($columns) | $query->select($columns) | ||||
->from('calendarobjects') | ->from('calendarobjects') | ||||
->where($query->expr()->eq('calendarid', $query->createNamedParameter($id))) | |||||
->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) | |||||
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))); | ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))); | ||||
if ($componentType) { | if ($componentType) { | ||||
} catch (ParseException $ex) { | } catch (ParseException $ex) { | ||||
$this->logger->logException($ex, [ | $this->logger->logException($ex, [ | ||||
'app' => 'dav', | 'app' => 'dav', | ||||
'message' => 'Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$id.' uri:'.$row['uri'] | |||||
'message' => 'Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri'] | |||||
]); | ]); | ||||
continue; | continue; | ||||
} catch (InvalidDataException $ex) { | } catch (InvalidDataException $ex) { | ||||
$this->logger->logException($ex, [ | $this->logger->logException($ex, [ | ||||
'app' => 'dav', | 'app' => 'dav', | ||||
'message' => 'Caught invalid data exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$id.' uri:'.$row['uri'] | |||||
'message' => 'Caught invalid data exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri'] | |||||
]); | ]); | ||||
continue; | continue; | ||||
} | } |
* This method must work recursively and delete the destination | * This method must work recursively and delete the destination | ||||
* if it exists | * if it exists | ||||
* | * | ||||
* @param string $source | |||||
* @param string $destination | |||||
* @param string $sourcePath | |||||
* @param string $destinationPath | |||||
* @throws FileLocked | * @throws FileLocked | ||||
* @throws Forbidden | * @throws Forbidden | ||||
* @throws InvalidPath | * @throws InvalidPath | ||||
* @throws \Sabre\DAV\Exception\ServiceUnavailable | * @throws \Sabre\DAV\Exception\ServiceUnavailable | ||||
* @return void | * @return void | ||||
*/ | */ | ||||
public function copy($source, $destination) { | |||||
public function copy($sourcePath, $destinationPath) { | |||||
if (!$this->fileView) { | if (!$this->fileView) { | ||||
throw new \Sabre\DAV\Exception\ServiceUnavailable('filesystem not setup'); | throw new \Sabre\DAV\Exception\ServiceUnavailable('filesystem not setup'); | ||||
} | } | ||||
$info = $this->fileView->getFileInfo(dirname($destination)); | |||||
if ($this->fileView->file_exists($destination)) { | |||||
$info = $this->fileView->getFileInfo(dirname($destinationPath)); | |||||
if ($this->fileView->file_exists($destinationPath)) { | |||||
$destinationPermission = $info && $info->isUpdateable(); | $destinationPermission = $info && $info->isUpdateable(); | ||||
} else { | } else { | ||||
$destinationPermission = $info && $info->isCreatable(); | $destinationPermission = $info && $info->isCreatable(); | ||||
} | } | ||||
// this will trigger existence check | // this will trigger existence check | ||||
$this->getNodeForPath($source); | |||||
$this->getNodeForPath($sourcePath); | |||||
list($destinationDir, $destinationName) = \Sabre\Uri\split($destination); | |||||
list($destinationDir, $destinationName) = \Sabre\Uri\split($destinationPath); | |||||
try { | try { | ||||
$this->fileView->verifyPath($destinationDir, $destinationName); | $this->fileView->verifyPath($destinationDir, $destinationName); | ||||
} catch (\OCP\Files\InvalidPathException $ex) { | } catch (\OCP\Files\InvalidPathException $ex) { | ||||
} | } | ||||
try { | try { | ||||
$this->fileView->copy($source, $destination); | |||||
$this->fileView->copy($sourcePath, $destinationPath); | |||||
} catch (StorageNotAvailableException $e) { | } catch (StorageNotAvailableException $e) { | ||||
throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage()); | throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage()); | ||||
} catch (ForbiddenException $ex) { | } catch (ForbiddenException $ex) { | ||||
throw new FileLocked($e->getMessage(), $e->getCode(), $e); | throw new FileLocked($e->getMessage(), $e->getCode(), $e); | ||||
} | } | ||||
list($destinationDir,) = \Sabre\Uri\split($destination); | |||||
list($destinationDir,) = \Sabre\Uri\split($destinationPath); | |||||
$this->markDirty($destinationDir); | $this->markDirty($destinationDir); | ||||
} | } | ||||
} | } |
$this->user = $user; | $this->user = $user; | ||||
} | } | ||||
public function createFile($tagId, $data = null) { | |||||
public function createFile($name, $data = null) { | |||||
$tagId = $name; | |||||
try { | try { | ||||
$tags = $this->tagManager->getTagsByIds([$tagId]); | $tags = $this->tagManager->getTagsByIds([$tagId]); | ||||
$tag = current($tags); | $tag = current($tags); |
return self::CREDENTIALS_IDENTIFIER_PREFIX . $storageId; | return self::CREDENTIALS_IDENTIFIER_PREFIX . $storageId; | ||||
} | } | ||||
public function saveBackendOptions(IUser $user, $id, array $options) { | |||||
$this->credentialsManager->store($user->getUID(), $this->getCredentialsIdentifier($id), [ | |||||
public function saveBackendOptions(IUser $user, $mountId, array $options) { | |||||
$this->credentialsManager->store($user->getUID(), $this->getCredentialsIdentifier($mountId), [ | |||||
'user' => $options['user'], // explicitly copy the fields we want instead of just passing the entire $options array | 'user' => $options['user'], // explicitly copy the fields we want instead of just passing the entire $options array | ||||
'password' => $options['password'] // this way we prevent users from being able to modify any other field | 'password' => $options['password'] // this way we prevent users from being able to modify any other field | ||||
]); | ]); |
} | } | ||||
} | } | ||||
public function touch($path, $time = null) { | |||||
public function touch($path, $mtime = null) { | |||||
try { | try { | ||||
if (!$this->file_exists($path)) { | if (!$this->file_exists($path)) { | ||||
$fh = $this->share->write($this->buildPath($path)); | $fh = $this->share->write($this->buildPath($path)); |
*/ | */ | ||||
private $user; | private $user; | ||||
public function login($user, $password) { | |||||
public function login($uid, $password) { | |||||
} | } | ||||
public function logout() { | public function logout() { |
* Get all mountpoints applicable for the user and check for shares where we need to update the etags | * Get all mountpoints applicable for the user and check for shares where we need to update the etags | ||||
* | * | ||||
* @param \OCP\IUser $user | * @param \OCP\IUser $user | ||||
* @param \OCP\Files\Storage\IStorageFactory $storageFactory | |||||
* @param \OCP\Files\Storage\IStorageFactory $loader | |||||
* @return \OCP\Files\Mount\IMountPoint[] | * @return \OCP\Files\Mount\IMountPoint[] | ||||
*/ | */ | ||||
public function getMountsForUser(IUser $user, IStorageFactory $storageFactory) { | |||||
public function getMountsForUser(IUser $user, IStorageFactory $loader) { | |||||
$shares = $this->shareManager->getSharedWith($user->getUID(), IShare::TYPE_USER, null, -1); | $shares = $this->shareManager->getSharedWith($user->getUID(), IShare::TYPE_USER, null, -1); | ||||
$shares = array_merge($shares, $this->shareManager->getSharedWith($user->getUID(), IShare::TYPE_GROUP, null, -1)); | $shares = array_merge($shares, $this->shareManager->getSharedWith($user->getUID(), IShare::TYPE_GROUP, null, -1)); | ||||
$shares = array_merge($shares, $this->shareManager->getSharedWith($user->getUID(), IShare::TYPE_CIRCLE, null, -1)); | $shares = array_merge($shares, $this->shareManager->getSharedWith($user->getUID(), IShare::TYPE_CIRCLE, null, -1)); | ||||
'ownerView' => $ownerViews[$owner], | 'ownerView' => $ownerViews[$owner], | ||||
'sharingDisabledForUser' => $sharingDisabledForUser | 'sharingDisabledForUser' => $sharingDisabledForUser | ||||
], | ], | ||||
$storageFactory, | |||||
$loader, | |||||
$view, | $view, | ||||
$foldersExistCache | $foldersExistCache | ||||
); | ); |
/** | /** | ||||
* create unique target | * create unique target | ||||
* @param string $filePath | |||||
* | |||||
* @param string $itemSource | |||||
* @param string $shareWith | * @param string $shareWith | ||||
* @param array $exclude (optional) | * @param array $exclude (optional) | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
public function generateTarget($filePath, $shareWith, $exclude = null) { | |||||
public function generateTarget($itemSource, $shareWith, $exclude = null) { | |||||
$shareFolder = \OCA\Files_Sharing\Helper::getShareFolder(); | $shareFolder = \OCA\Files_Sharing\Helper::getShareFolder(); | ||||
$target = \OC\Files\Filesystem::normalizePath($shareFolder . '/' . basename($filePath)); | |||||
$target = \OC\Files\Filesystem::normalizePath($shareFolder . '/' . basename($itemSource)); | |||||
// for group shares we return the target right away | // for group shares we return the target right away | ||||
if ($shareWith === false) { | if ($shareWith === false) { |
/** | /** | ||||
* Tries the backends one after the other until a positive result is returned from the specified method | * Tries the backends one after the other until a positive result is returned from the specified method | ||||
* | * | ||||
* @param string $gid the gid connected to the request | |||||
* @param string $id the gid connected to the request | |||||
* @param string $method the method of the group backend that shall be called | * @param string $method the method of the group backend that shall be called | ||||
* @param array $parameters an array of parameters to be passed | * @param array $parameters an array of parameters to be passed | ||||
* @return mixed, the result of the method or false | |||||
* @return mixed the result of the method or false | |||||
*/ | */ | ||||
protected function walkBackends($gid, $method, $parameters) { | |||||
protected function walkBackends($id, $method, $parameters) { | |||||
$gid = $id; | |||||
$cacheKey = $this->getGroupCacheKey($gid); | $cacheKey = $this->getGroupCacheKey($gid); | ||||
foreach ($this->backends as $configPrefix => $backend) { | foreach ($this->backends as $configPrefix => $backend) { | ||||
if ($result = call_user_func_array([$backend, $method], $parameters)) { | if ($result = call_user_func_array([$backend, $method], $parameters)) { | ||||
/** | /** | ||||
* Asks the backend connected to the server that supposely takes care of the gid from the request. | * Asks the backend connected to the server that supposely takes care of the gid from the request. | ||||
* | * | ||||
* @param string $gid the gid connected to the request | |||||
* @param string $id the gid connected to the request | |||||
* @param string $method the method of the group backend that shall be called | * @param string $method the method of the group backend that shall be called | ||||
* @param array $parameters an array of parameters to be passed | * @param array $parameters an array of parameters to be passed | ||||
* @param mixed $passOnWhen the result matches this variable | * @param mixed $passOnWhen the result matches this variable | ||||
* @return mixed, the result of the method or false | |||||
* @return mixed the result of the method or false | |||||
*/ | */ | ||||
protected function callOnLastSeenOn($gid, $method, $parameters, $passOnWhen) { | |||||
protected function callOnLastSeenOn($id, $method, $parameters, $passOnWhen) { | |||||
$gid = $id; | |||||
$cacheKey = $this->getGroupCacheKey($gid); | $cacheKey = $this->getGroupCacheKey($gid); | ||||
$prefix = $this->getFromCache($cacheKey); | $prefix = $this->getFromCache($cacheKey); | ||||
//in case the uid has been found in the past, try this stored connection first | //in case the uid has been found in the past, try this stored connection first |
/** | /** | ||||
* Tries the backends one after the other until a positive result is returned from the specified method | * Tries the backends one after the other until a positive result is returned from the specified method | ||||
* | * | ||||
* @param string $uid the uid connected to the request | |||||
* @param string $id the uid connected to the request | |||||
* @param string $method the method of the user backend that shall be called | * @param string $method the method of the user backend that shall be called | ||||
* @param array $parameters an array of parameters to be passed | * @param array $parameters an array of parameters to be passed | ||||
* @return mixed the result of the method or false | * @return mixed the result of the method or false | ||||
*/ | */ | ||||
protected function walkBackends($uid, $method, $parameters) { | |||||
protected function walkBackends($id, $method, $parameters) { | |||||
$uid = $id; | |||||
$cacheKey = $this->getUserCacheKey($uid); | $cacheKey = $this->getUserCacheKey($uid); | ||||
foreach ($this->backends as $configPrefix => $backend) { | foreach ($this->backends as $configPrefix => $backend) { | ||||
$instance = $backend; | $instance = $backend; | ||||
/** | /** | ||||
* Asks the backend connected to the server that supposely takes care of the uid from the request. | * Asks the backend connected to the server that supposely takes care of the uid from the request. | ||||
* | * | ||||
* @param string $uid the uid connected to the request | |||||
* @param string $id the uid connected to the request | |||||
* @param string $method the method of the user backend that shall be called | * @param string $method the method of the user backend that shall be called | ||||
* @param array $parameters an array of parameters to be passed | * @param array $parameters an array of parameters to be passed | ||||
* @param mixed $passOnWhen the result matches this variable | * @param mixed $passOnWhen the result matches this variable | ||||
* @return mixed the result of the method or false | * @return mixed the result of the method or false | ||||
*/ | */ | ||||
protected function callOnLastSeenOn($uid, $method, $parameters, $passOnWhen) { | |||||
protected function callOnLastSeenOn($id, $method, $parameters, $passOnWhen) { | |||||
$uid = $id; | |||||
$cacheKey = $this->getUserCacheKey($uid); | $cacheKey = $this->getUserCacheKey($uid); | ||||
$prefix = $this->getFromCache($cacheKey); | $prefix = $this->getFromCache($cacheKey); | ||||
//in case the uid has been found in the past, try this stored connection first | //in case the uid has been found in the past, try this stored connection first |
<?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||||
<files psalm-version="3.13.1@afd8874a9e4562eac42a02de90e42e430c3a1db1"> | |||||
<files psalm-version="3.14.1@9822043ca46d6682b76097bfa97d7c450eef9e90"> | |||||
<file src="3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php"> | <file src="3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php"> | ||||
<ImplementedReturnTypeMismatch occurrences="1"> | <ImplementedReturnTypeMismatch occurrences="1"> | ||||
<code>string|null</code> | <code>string|null</code> | ||||
<MoreSpecificImplementedParamType occurrences="1"> | <MoreSpecificImplementedParamType occurrences="1"> | ||||
<code>$calendarData</code> | <code>$calendarData</code> | ||||
</MoreSpecificImplementedParamType> | </MoreSpecificImplementedParamType> | ||||
<ParamNameMismatch occurrences="1"> | |||||
<code>$calendarData</code> | |||||
</ParamNameMismatch> | |||||
</file> | </file> | ||||
<file src="apps/dav/lib/CalDAV/CachedSubscriptionObject.php"> | <file src="apps/dav/lib/CalDAV/CachedSubscriptionObject.php"> | ||||
<ImplementedReturnTypeMismatch occurrences="1"> | <ImplementedReturnTypeMismatch occurrences="1"> | ||||
<code>null</code> | <code>null</code> | ||||
<code>null</code> | <code>null</code> | ||||
</NullArgument> | </NullArgument> | ||||
<ParamNameMismatch occurrences="1"> | |||||
<code>$fullSourcePath</code> | |||||
</ParamNameMismatch> | |||||
<UndefinedFunction occurrences="1"> | <UndefinedFunction occurrences="1"> | ||||
<code>\Sabre\Uri\split($sourceNode->getPath())</code> | <code>\Sabre\Uri\split($sourceNode->getPath())</code> | ||||
</UndefinedFunction> | </UndefinedFunction> | ||||
<file src="apps/dav/lib/Connector/Sabre/ObjectTree.php"> | <file src="apps/dav/lib/Connector/Sabre/ObjectTree.php"> | ||||
<UndefinedFunction occurrences="3"> | <UndefinedFunction occurrences="3"> | ||||
<code>\Sabre\Uri\split($path)</code> | <code>\Sabre\Uri\split($path)</code> | ||||
<code>\Sabre\Uri\split($destination)</code> | |||||
<code>\Sabre\Uri\split($destination)</code> | |||||
<code>\Sabre\Uri\split($destinationPath)</code> | |||||
<code>\Sabre\Uri\split($destinationPath)</code> | |||||
</UndefinedFunction> | </UndefinedFunction> | ||||
</file> | </file> | ||||
<file src="apps/dav/lib/Connector/Sabre/Principal.php"> | <file src="apps/dav/lib/Connector/Sabre/Principal.php"> | ||||
<InternalMethod occurrences="1"> | <InternalMethod occurrences="1"> | ||||
<code>put</code> | <code>put</code> | ||||
</InternalMethod> | </InternalMethod> | ||||
<ParamNameMismatch occurrences="2"> | |||||
<code>$source</code> | |||||
<code>$target</code> | |||||
</ParamNameMismatch> | |||||
</file> | </file> | ||||
<file src="apps/files_external/lib/Lib/Storage/SFTPReadStream.php"> | <file src="apps/files_external/lib/Lib/Storage/SFTPReadStream.php"> | ||||
<FalsableReturnStatement occurrences="2"> | <FalsableReturnStatement occurrences="2"> | ||||
<NullableReturnStatement occurrences="1"> | <NullableReturnStatement occurrences="1"> | ||||
<code>null</code> | <code>null</code> | ||||
</NullableReturnStatement> | </NullableReturnStatement> | ||||
<ParamNameMismatch occurrences="2"> | |||||
<code>$source</code> | |||||
<code>$target</code> | |||||
</ParamNameMismatch> | |||||
<TooManyArguments occurrences="2"> | <TooManyArguments occurrences="2"> | ||||
<code>rename</code> | <code>rename</code> | ||||
<code>rename</code> | <code>rename</code> | ||||
<InvalidReturnType occurrences="1"> | <InvalidReturnType occurrences="1"> | ||||
<code>isSharable</code> | <code>isSharable</code> | ||||
</InvalidReturnType> | </InvalidReturnType> | ||||
<NullArgument occurrences="1"> | |||||
<code>$response['{http://open-collaboration-services.org/ns}share-permissions']</code> | |||||
</NullArgument> | |||||
</file> | </file> | ||||
<file src="apps/files_sharing/lib/Listener/LegacyBeforeTemplateRenderedListener.php"> | <file src="apps/files_sharing/lib/Listener/LegacyBeforeTemplateRenderedListener.php"> | ||||
<InvalidArgument occurrences="1"> | <InvalidArgument occurrences="1"> | ||||
<code>is_array($members)</code> | <code>is_array($members)</code> | ||||
</TypeDoesNotContainType> | </TypeDoesNotContainType> | ||||
</file> | </file> | ||||
<file src="apps/user_ldap/lib/Group_Proxy.php"> | |||||
<InvalidDocblock occurrences="2"> | |||||
<code>protected function walkBackends($gid, $method, $parameters) {</code> | |||||
<code>protected function callOnLastSeenOn($gid, $method, $parameters, $passOnWhen) {</code> | |||||
</InvalidDocblock> | |||||
</file> | |||||
<file src="apps/user_ldap/lib/Helper.php"> | <file src="apps/user_ldap/lib/Helper.php"> | ||||
<InvalidScalarArgument occurrences="1"> | <InvalidScalarArgument occurrences="1"> | ||||
<code>$lastNumber + 1</code> | <code>$lastNumber + 1</code> | ||||
<InvalidScalarArgument occurrences="1"> | <InvalidScalarArgument occurrences="1"> | ||||
<code>$e->getCode()</code> | <code>$e->getCode()</code> | ||||
</InvalidScalarArgument> | </InvalidScalarArgument> | ||||
<ParamNameMismatch occurrences="1"> | |||||
<code>$statement</code> | |||||
</ParamNameMismatch> | |||||
</file> | </file> | ||||
<file src="lib/private/DB/ConnectionFactory.php"> | <file src="lib/private/DB/ConnectionFactory.php"> | ||||
<InternalClass occurrences="1"> | <InternalClass occurrences="1"> | ||||
<InvalidArgument occurrences="1"> | <InvalidArgument occurrences="1"> | ||||
<code>$eventName</code> | <code>$eventName</code> | ||||
</InvalidArgument> | </InvalidArgument> | ||||
<ParamNameMismatch occurrences="1"> | |||||
<code>$eventName</code> | |||||
</ParamNameMismatch> | |||||
<TooManyArguments occurrences="1"> | <TooManyArguments occurrences="1"> | ||||
<code>dispatch</code> | <code>dispatch</code> | ||||
</TooManyArguments> | </TooManyArguments> | ||||
</ImplementedReturnTypeMismatch> | </ImplementedReturnTypeMismatch> | ||||
</file> | </file> | ||||
<file src="lib/private/Files/ObjectStore/NoopScanner.php"> | <file src="lib/private/Files/ObjectStore/NoopScanner.php"> | ||||
<ImplementedParamTypeMismatch occurrences="1"> | |||||
<code>$folderData</code> | |||||
</ImplementedParamTypeMismatch> | |||||
<MoreSpecificImplementedParamType occurrences="1"> | <MoreSpecificImplementedParamType occurrences="1"> | ||||
<code>$cacheData</code> | <code>$cacheData</code> | ||||
</MoreSpecificImplementedParamType> | </MoreSpecificImplementedParamType> | ||||
</file> | </file> | ||||
<file src="lib/private/Files/ObjectStore/ObjectStoreStorage.php"> | <file src="lib/private/Files/ObjectStore/ObjectStoreStorage.php"> | ||||
<ParamNameMismatch occurrences="2"> | |||||
<code>$source</code> | |||||
<code>$target</code> | |||||
</ParamNameMismatch> | |||||
<UndefinedInterfaceMethod occurrences="4"> | <UndefinedInterfaceMethod occurrences="4"> | ||||
<code>$child</code> | <code>$child</code> | ||||
<code>$child</code> | <code>$child</code> | ||||
<InvalidReturnType occurrences="1"> | <InvalidReturnType occurrences="1"> | ||||
<code>filemtime</code> | <code>filemtime</code> | ||||
</InvalidReturnType> | </InvalidReturnType> | ||||
<ParamNameMismatch occurrences="4"> | |||||
<code>$source</code> | |||||
<code>$target</code> | |||||
<code>$source</code> | |||||
<code>$target</code> | |||||
</ParamNameMismatch> | |||||
</file> | </file> | ||||
<file src="lib/private/Files/Storage/Local.php"> | <file src="lib/private/Files/Storage/Local.php"> | ||||
<ImplicitToStringCast occurrences="1"> | <ImplicitToStringCast occurrences="1"> | ||||
<InvalidScalarArgument occurrences="1"> | <InvalidScalarArgument occurrences="1"> | ||||
<code>'ext'</code> | <code>'ext'</code> | ||||
</InvalidScalarArgument> | </InvalidScalarArgument> | ||||
<ParamNameMismatch occurrences="2"> | |||||
<code>$source</code> | |||||
<code>$target</code> | |||||
</ParamNameMismatch> | |||||
<UndefinedInterfaceMethod occurrences="1"> | <UndefinedInterfaceMethod occurrences="1"> | ||||
<code>$data</code> | <code>$data</code> | ||||
</UndefinedInterfaceMethod> | </UndefinedInterfaceMethod> | ||||
</UndefinedDocblockClass> | </UndefinedDocblockClass> | ||||
</file> | </file> | ||||
<file src="lib/private/legacy/OC_Files.php"> | <file src="lib/private/legacy/OC_Files.php"> | ||||
<EmptyArrayAccess occurrences="2"/> | |||||
<InvalidArgument occurrences="3"> | <InvalidArgument occurrences="3"> | ||||
<code>$fileInfos</code> | <code>$fileInfos</code> | ||||
<code>[$fileInfo]</code> | <code>[$fileInfo]</code> |
/** | /** | ||||
* @param string $optionName | * @param string $optionName | ||||
* @param CompletionContext $completionContext | |||||
* @param CompletionContext $context | |||||
* @return array | * @return array | ||||
*/ | */ | ||||
public function completeOptionValues($optionName, CompletionContext $completionContext) { | |||||
public function completeOptionValues($optionName, CompletionContext $context) { | |||||
if ($optionName === 'shipped') { | if ($optionName === 'shipped') { | ||||
return ['true', 'false']; | return ['true', 'false']; | ||||
} | } |
/** | /** | ||||
* Get the (unencrypted) password of the given token | * Get the (unencrypted) password of the given token | ||||
* | * | ||||
* @param IToken $token | |||||
* @param IToken $savedToken | |||||
* @param string $tokenId | * @param string $tokenId | ||||
* @throws InvalidTokenException | * @throws InvalidTokenException | ||||
* @throws PasswordlessTokenException | * @throws PasswordlessTokenException | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
public function getPassword(IToken $token, string $tokenId): string; | |||||
public function getPassword(IToken $savedToken, string $tokenId): string; | |||||
/** | /** | ||||
* Encrypt and set the password of the given token | * Encrypt and set the password of the given token |
return $this->mapper->getTokenByUser($uid); | return $this->mapper->getTokenByUser($uid); | ||||
} | } | ||||
public function getPassword(IToken $token, string $tokenId): string { | |||||
if (!($token instanceof PublicKeyToken)) { | |||||
public function getPassword(IToken $savedToken, string $tokenId): string { | |||||
if (!($savedToken instanceof PublicKeyToken)) { | |||||
throw new InvalidTokenException("Invalid token type"); | throw new InvalidTokenException("Invalid token type"); | ||||
} | } | ||||
if ($token->getPassword() === null) { | |||||
if ($savedToken->getPassword() === null) { | |||||
throw new PasswordlessTokenException(); | throw new PasswordlessTokenException(); | ||||
} | } | ||||
// Decrypt private key with tokenId | // Decrypt private key with tokenId | ||||
$privateKey = $this->decrypt($token->getPrivateKey(), $tokenId); | |||||
$privateKey = $this->decrypt($savedToken->getPrivateKey(), $tokenId); | |||||
// Decrypt password with private key | // Decrypt password with private key | ||||
return $this->decryptPassword($token->getPassword(), $privateKey); | |||||
return $this->decryptPassword($savedToken->getPassword(), $privateKey); | |||||
} | } | ||||
public function setPassword(IToken $token, string $tokenId, string $password) { | public function setPassword(IToken $token, string $tokenId, string $password) { |
* This function can be used to delete the contact identified by the given id | * This function can be used to delete the contact identified by the given id | ||||
* | * | ||||
* @param object $id the unique identifier to a contact | * @param object $id the unique identifier to a contact | ||||
* @param string $addressBookKey identifier of the address book in which the contact shall be deleted | |||||
* @param string $address_book_key identifier of the address book in which the contact shall be deleted | |||||
* @return bool successful or not | * @return bool successful or not | ||||
*/ | */ | ||||
public function delete($id, $addressBookKey) { | |||||
$addressBook = $this->getAddressBook($addressBookKey); | |||||
public function delete($id, $address_book_key) { | |||||
$addressBook = $this->getAddressBook($address_book_key); | |||||
if (!$addressBook) { | if (!$addressBook) { | ||||
return null; | return null; | ||||
} | } | ||||
* Otherwise the contact will be updated by replacing the entire data set. | * Otherwise the contact will be updated by replacing the entire data set. | ||||
* | * | ||||
* @param array $properties this array if key-value-pairs defines a contact | * @param array $properties this array if key-value-pairs defines a contact | ||||
* @param string $addressBookKey identifier of the address book in which the contact shall be created or updated | |||||
* @param string $address_book_key identifier of the address book in which the contact shall be created or updated | |||||
* @return array representing the contact just created or updated | * @return array representing the contact just created or updated | ||||
*/ | */ | ||||
public function createOrUpdate($properties, $addressBookKey) { | |||||
$addressBook = $this->getAddressBook($addressBookKey); | |||||
public function createOrUpdate($properties, $address_book_key) { | |||||
$addressBook = $this->getAddressBook($address_book_key); | |||||
if (!$addressBook) { | if (!$addressBook) { | ||||
return null; | return null; | ||||
} | } |
/** | /** | ||||
* {@inheritDoc} | * {@inheritDoc} | ||||
*/ | */ | ||||
public function insert($tableName, array $data, array $types = []) { | |||||
if ($tableName[0] !== $this->getDatabasePlatform()->getIdentifierQuoteCharacter()) { | |||||
$tableName = $this->quoteIdentifier($tableName); | |||||
public function insert($tableExpression, array $data, array $types = []) { | |||||
if ($tableExpression[0] !== $this->getDatabasePlatform()->getIdentifierQuoteCharacter()) { | |||||
$tableExpression = $this->quoteIdentifier($tableExpression); | |||||
} | } | ||||
$data = $this->quoteKeys($data); | $data = $this->quoteKeys($data); | ||||
return parent::insert($tableName, $data, $types); | |||||
return parent::insert($tableExpression, $data, $types); | |||||
} | } | ||||
/** | /** | ||||
* {@inheritDoc} | * {@inheritDoc} | ||||
*/ | */ | ||||
public function update($tableName, array $data, array $identifier, array $types = []) { | |||||
if ($tableName[0] !== $this->getDatabasePlatform()->getIdentifierQuoteCharacter()) { | |||||
$tableName = $this->quoteIdentifier($tableName); | |||||
public function update($tableExpression, array $data, array $identifier, array $types = []) { | |||||
if ($tableExpression[0] !== $this->getDatabasePlatform()->getIdentifierQuoteCharacter()) { | |||||
$tableExpression = $this->quoteIdentifier($tableExpression); | |||||
} | } | ||||
$data = $this->quoteKeys($data); | $data = $this->quoteKeys($data); | ||||
$identifier = $this->quoteKeys($identifier); | $identifier = $this->quoteKeys($identifier); | ||||
return parent::update($tableName, $data, $identifier, $types); | |||||
return parent::update($tableExpression, $data, $identifier, $types); | |||||
} | } | ||||
/** | /** |
* @param string|boolean $path | * @param string|boolean $path | ||||
* @param array $data (optional) meta data of the folder | * @param array $data (optional) meta data of the folder | ||||
*/ | */ | ||||
public function correctFolderSize($path, $data = null, $isBackgroundSize = false) { | |||||
public function correctFolderSize($path, $data = null, $isBackgroundScan = false) { | |||||
if ($this->getCache() instanceof Cache) { | if ($this->getCache() instanceof Cache) { | ||||
$this->getCache()->correctFolderSize($this->getSourcePath($path), $data, $isBackgroundSize); | |||||
$this->getCache()->correctFolderSize($this->getSourcePath($path), $data, $isBackgroundScan); | |||||
} | } | ||||
} | } | ||||
* @param array $folderData existing cache data for the folder to be scanned | * @param array $folderData existing cache data for the folder to be scanned | ||||
* @return int the size of the scanned folder or -1 if the size is unknown at this stage | * @return int the size of the scanned folder or -1 if the size is unknown at this stage | ||||
*/ | */ | ||||
protected function scanChildren($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $folderData = null, $lock = true) { | |||||
protected function scanChildren($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $folderId = null, $lock = true) { | |||||
return 0; | return 0; | ||||
} | } | ||||
/** | /** | ||||
* {@inheritdoc} | * {@inheritdoc} | ||||
*/ | */ | ||||
public function updateTag(string $tagId, string $tagName, bool $userVisible, bool $userAssignable) { | |||||
public function updateTag(string $tagId, string $newName, bool $userVisible, bool $userAssignable) { | |||||
try { | try { | ||||
$tags = $this->getTagsByIds($tagId); | $tags = $this->getTagsByIds($tagId); | ||||
} catch (TagNotFoundException $e) { | } catch (TagNotFoundException $e) { | ||||
$beforeUpdate = array_shift($tags); | $beforeUpdate = array_shift($tags); | ||||
$afterUpdate = new SystemTag( | $afterUpdate = new SystemTag( | ||||
$tagId, | $tagId, | ||||
$tagName, | |||||
$newName, | |||||
$userVisible, | $userVisible, | ||||
$userAssignable | $userAssignable | ||||
); | ); | ||||
->set('visibility', $query->createParameter('visibility')) | ->set('visibility', $query->createParameter('visibility')) | ||||
->set('editable', $query->createParameter('editable')) | ->set('editable', $query->createParameter('editable')) | ||||
->where($query->expr()->eq('id', $query->createParameter('tagid'))) | ->where($query->expr()->eq('id', $query->createParameter('tagid'))) | ||||
->setParameter('name', $tagName) | |||||
->setParameter('name', $newName) | |||||
->setParameter('visibility', $userVisible ? 1 : 0) | ->setParameter('visibility', $userVisible ? 1 : 0) | ||||
->setParameter('editable', $userAssignable ? 1 : 0) | ->setParameter('editable', $userAssignable ? 1 : 0) | ||||
->setParameter('tagid', $tagId); | ->setParameter('tagid', $tagId); | ||||
} | } | ||||
} catch (UniqueConstraintViolationException $e) { | } catch (UniqueConstraintViolationException $e) { | ||||
throw new TagAlreadyExistsException( | throw new TagAlreadyExistsException( | ||||
'Tag ("' . $tagName . '", '. $userVisible . ', ' . $userAssignable . ') already exists', | |||||
'Tag ("' . $newName . '", '. $userVisible . ', ' . $userAssignable . ') already exists', | |||||
0, | 0, | ||||
$e | $e | ||||
); | ); |
/** | /** | ||||
* Creates an url using a defined route | * Creates an url using a defined route | ||||
* @param string $route | |||||
* @param array $parameters args with param=>value, will be appended to the returned url | |||||
* | |||||
* @param string $routeName | |||||
* @param array $arguments args with param=>value, will be appended to the returned url | |||||
* @return string the url | * @return string the url | ||||
* | * | ||||
* Returns a url to the given route. | * Returns a url to the given route. | ||||
*/ | */ | ||||
public function linkToRoute(string $route, array $parameters = []): string { | |||||
public function linkToRoute(string $routeName, array $arguments = []): string { | |||||
// TODO: mock router | // TODO: mock router | ||||
return \OC::$server->getRouter()->generate($route, $parameters); | |||||
return \OC::$server->getRouter()->generate($routeName, $arguments); | |||||
} | } | ||||
/** | /** | ||||
/** | /** | ||||
* Creates an url | * Creates an url | ||||
* @param string $app app | |||||
* | |||||
* @param string $appName app | |||||
* @param string $file file | * @param string $file file | ||||
* @param array $args array with param=>value, will be appended to the returned url | * @param array $args array with param=>value, will be appended to the returned url | ||||
* The value of $args will be urlencoded | * The value of $args will be urlencoded | ||||
* | * | ||||
* Returns a url to the given app and file. | * Returns a url to the given app and file. | ||||
*/ | */ | ||||
public function linkTo(string $app, string $file, array $args = []): string { | |||||
public function linkTo(string $appName, string $file, array $args = []): string { | |||||
$frontControllerActive = ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'); | $frontControllerActive = ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'); | ||||
if ($app !== '') { | |||||
$app_path = \OC_App::getAppPath($app); | |||||
if ($appName !== '') { | |||||
$app_path = \OC_App::getAppPath($appName); | |||||
// Check if the app is in the app folder | // Check if the app is in the app folder | ||||
if ($app_path && file_exists($app_path . '/' . $file)) { | if ($app_path && file_exists($app_path . '/' . $file)) { | ||||
if (substr($file, -3) === 'php') { | if (substr($file, -3) === 'php') { | ||||
$urlLinkTo = \OC::$WEBROOT . '/index.php/apps/' . $app; | |||||
$urlLinkTo = \OC::$WEBROOT . '/index.php/apps/' . $appName; | |||||
if ($frontControllerActive) { | if ($frontControllerActive) { | ||||
$urlLinkTo = \OC::$WEBROOT . '/apps/' . $app; | |||||
$urlLinkTo = \OC::$WEBROOT . '/apps/' . $appName; | |||||
} | } | ||||
$urlLinkTo .= ($file !== 'index.php') ? '/' . $file : ''; | $urlLinkTo .= ($file !== 'index.php') ? '/' . $file : ''; | ||||
} else { | } else { | ||||
$urlLinkTo = \OC_App::getAppWebPath($app) . '/' . $file; | |||||
$urlLinkTo = \OC_App::getAppWebPath($appName) . '/' . $file; | |||||
} | } | ||||
} else { | } else { | ||||
$urlLinkTo = \OC::$WEBROOT . '/' . $app . '/' . $file; | |||||
$urlLinkTo = \OC::$WEBROOT . '/' . $appName . '/' . $file; | |||||
} | } | ||||
} else { | } else { | ||||
if (file_exists(\OC::$SERVERROOT . '/core/' . $file)) { | if (file_exists(\OC::$SERVERROOT . '/core/' . $file)) { | ||||
/** | /** | ||||
* Creates path to an image | * Creates path to an image | ||||
* @param string $app app | |||||
* @param string $image image name | |||||
* | |||||
* @param string $appName app | |||||
* @param string $file image name | |||||
* @throws \RuntimeException If the image does not exist | * @throws \RuntimeException If the image does not exist | ||||
* @return string the url | * @return string the url | ||||
* | * | ||||
* Returns the path to the image. | * Returns the path to the image. | ||||
*/ | */ | ||||
public function imagePath(string $app, string $image): string { | |||||
public function imagePath(string $appName, string $file): string { | |||||
$cache = $this->cacheFactory->createDistributed('imagePath-'.md5($this->getBaseUrl()).'-'); | $cache = $this->cacheFactory->createDistributed('imagePath-'.md5($this->getBaseUrl()).'-'); | ||||
$cacheKey = $app.'-'.$image; | |||||
$cacheKey = $appName.'-'.$file; | |||||
if ($key = $cache->get($cacheKey)) { | if ($key = $cache->get($cacheKey)) { | ||||
return $key; | return $key; | ||||
} | } | ||||
$theme = \OC_Util::getTheme(); | $theme = \OC_Util::getTheme(); | ||||
//if a theme has a png but not an svg always use the png | //if a theme has a png but not an svg always use the png | ||||
$basename = substr(basename($image),0,-4); | |||||
$basename = substr(basename($file),0,-4); | |||||
$appPath = \OC_App::getAppPath($app); | |||||
$appPath = \OC_App::getAppPath($appName); | |||||
// Check if the app is in the app folder | // Check if the app is in the app folder | ||||
$path = ''; | $path = ''; | ||||
if ($themingEnabled) { | if ($themingEnabled) { | ||||
$themingDefaults = \OC::$server->getThemingDefaults(); | $themingDefaults = \OC::$server->getThemingDefaults(); | ||||
if ($themingDefaults instanceof ThemingDefaults) { | if ($themingDefaults instanceof ThemingDefaults) { | ||||
$themingImagePath = $themingDefaults->replaceImagePath($app, $image); | |||||
$themingImagePath = $themingDefaults->replaceImagePath($appName, $file); | |||||
} | } | ||||
} | } | ||||
if (file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$image")) { | |||||
$path = \OC::$WEBROOT . "/themes/$theme/apps/$app/img/$image"; | |||||
} elseif (!file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$basename.svg") | |||||
&& file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$basename.png")) { | |||||
$path = \OC::$WEBROOT . "/themes/$theme/apps/$app/img/$basename.png"; | |||||
} elseif (!empty($app) and file_exists(\OC::$SERVERROOT . "/themes/$theme/$app/img/$image")) { | |||||
$path = \OC::$WEBROOT . "/themes/$theme/$app/img/$image"; | |||||
} elseif (!empty($app) and (!file_exists(\OC::$SERVERROOT . "/themes/$theme/$app/img/$basename.svg") | |||||
&& file_exists(\OC::$SERVERROOT . "/themes/$theme/$app/img/$basename.png"))) { | |||||
$path = \OC::$WEBROOT . "/themes/$theme/$app/img/$basename.png"; | |||||
} elseif (file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$image")) { | |||||
$path = \OC::$WEBROOT . "/themes/$theme/core/img/$image"; | |||||
if (file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$appName/img/$file")) { | |||||
$path = \OC::$WEBROOT . "/themes/$theme/apps/$appName/img/$file"; | |||||
} elseif (!file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$appName/img/$basename.svg") | |||||
&& file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$appName/img/$basename.png")) { | |||||
$path = \OC::$WEBROOT . "/themes/$theme/apps/$appName/img/$basename.png"; | |||||
} elseif (!empty($appName) and file_exists(\OC::$SERVERROOT . "/themes/$theme/$appName/img/$file")) { | |||||
$path = \OC::$WEBROOT . "/themes/$theme/$appName/img/$file"; | |||||
} elseif (!empty($appName) and (!file_exists(\OC::$SERVERROOT . "/themes/$theme/$appName/img/$basename.svg") | |||||
&& file_exists(\OC::$SERVERROOT . "/themes/$theme/$appName/img/$basename.png"))) { | |||||
$path = \OC::$WEBROOT . "/themes/$theme/$appName/img/$basename.png"; | |||||
} elseif (file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$file")) { | |||||
$path = \OC::$WEBROOT . "/themes/$theme/core/img/$file"; | |||||
} elseif (!file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$basename.svg") | } elseif (!file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$basename.svg") | ||||
&& file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$basename.png")) { | && file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$basename.png")) { | ||||
$path = \OC::$WEBROOT . "/themes/$theme/core/img/$basename.png"; | $path = \OC::$WEBROOT . "/themes/$theme/core/img/$basename.png"; | ||||
} elseif ($themingEnabled && $themingImagePath) { | } elseif ($themingEnabled && $themingImagePath) { | ||||
$path = $themingImagePath; | $path = $themingImagePath; | ||||
} elseif ($appPath && file_exists($appPath . "/img/$image")) { | |||||
$path = \OC_App::getAppWebPath($app) . "/img/$image"; | |||||
} elseif ($appPath && file_exists($appPath . "/img/$file")) { | |||||
$path = \OC_App::getAppWebPath($appName) . "/img/$file"; | |||||
} elseif ($appPath && !file_exists($appPath . "/img/$basename.svg") | } elseif ($appPath && !file_exists($appPath . "/img/$basename.svg") | ||||
&& file_exists($appPath . "/img/$basename.png")) { | && file_exists($appPath . "/img/$basename.png")) { | ||||
$path = \OC_App::getAppWebPath($app) . "/img/$basename.png"; | |||||
} elseif (!empty($app) and file_exists(\OC::$SERVERROOT . "/$app/img/$image")) { | |||||
$path = \OC::$WEBROOT . "/$app/img/$image"; | |||||
} elseif (!empty($app) and (!file_exists(\OC::$SERVERROOT . "/$app/img/$basename.svg") | |||||
&& file_exists(\OC::$SERVERROOT . "/$app/img/$basename.png"))) { | |||||
$path = \OC::$WEBROOT . "/$app/img/$basename.png"; | |||||
} elseif (file_exists(\OC::$SERVERROOT . "/core/img/$image")) { | |||||
$path = \OC::$WEBROOT . "/core/img/$image"; | |||||
$path = \OC_App::getAppWebPath($appName) . "/img/$basename.png"; | |||||
} elseif (!empty($appName) and file_exists(\OC::$SERVERROOT . "/$appName/img/$file")) { | |||||
$path = \OC::$WEBROOT . "/$appName/img/$file"; | |||||
} elseif (!empty($appName) and (!file_exists(\OC::$SERVERROOT . "/$appName/img/$basename.svg") | |||||
&& file_exists(\OC::$SERVERROOT . "/$appName/img/$basename.png"))) { | |||||
$path = \OC::$WEBROOT . "/$appName/img/$basename.png"; | |||||
} elseif (file_exists(\OC::$SERVERROOT . "/core/img/$file")) { | |||||
$path = \OC::$WEBROOT . "/core/img/$file"; | |||||
} elseif (!file_exists(\OC::$SERVERROOT . "/core/img/$basename.svg") | } elseif (!file_exists(\OC::$SERVERROOT . "/core/img/$basename.svg") | ||||
&& file_exists(\OC::$SERVERROOT . "/core/img/$basename.png")) { | && file_exists(\OC::$SERVERROOT . "/core/img/$basename.png")) { | ||||
$path = \OC::$WEBROOT . "/themes/$theme/core/img/$basename.png"; | $path = \OC::$WEBROOT . "/themes/$theme/core/img/$basename.png"; | ||||
return $path; | return $path; | ||||
} | } | ||||
throw new RuntimeException('image not found: image:' . $image . ' webroot:' . \OC::$WEBROOT . ' serverroot:' . \OC::$SERVERROOT); | |||||
throw new RuntimeException('image not found: image:' . $file . ' webroot:' . \OC::$WEBROOT . ' serverroot:' . \OC::$SERVERROOT); | |||||
} | } | ||||
/** | /** | ||||
* Check if the password is correct | * Check if the password is correct | ||||
* | * | ||||
* @param string $uid The username | |||||
* @param string $loginName The loginname | |||||
* @param string $password The password | * @param string $password The password | ||||
* @return string | * @return string | ||||
* | * | ||||
* Check if the password is correct without logging in the user | * Check if the password is correct without logging in the user | ||||
* returns the user id or false | * returns the user id or false | ||||
*/ | */ | ||||
public function checkPassword(string $uid, string $password) { | |||||
public function checkPassword(string $loginName, string $password) { | |||||
$this->fixDI(); | $this->fixDI(); | ||||
$qb = $this->dbConn->getQueryBuilder(); | $qb = $this->dbConn->getQueryBuilder(); | ||||
->from($this->table) | ->from($this->table) | ||||
->where( | ->where( | ||||
$qb->expr()->eq( | $qb->expr()->eq( | ||||
'uid_lower', $qb->createNamedParameter(mb_strtolower($uid)) | |||||
'uid_lower', $qb->createNamedParameter(mb_strtolower($loginName)) | |||||
) | ) | ||||
); | ); | ||||
$result = $qb->execute(); | $result = $qb->execute(); | ||||
$newHash = ''; | $newHash = ''; | ||||
if (\OC::$server->getHasher()->verify($password, $storedHash, $newHash)) { | if (\OC::$server->getHasher()->verify($password, $storedHash, $newHash)) { | ||||
if (!empty($newHash)) { | if (!empty($newHash)) { | ||||
$this->updatePassword($uid, $newHash); | |||||
$this->updatePassword($loginName, $newHash); | |||||
} | } | ||||
return (string)$row['uid']; | return (string)$row['uid']; | ||||
} | } |
/** | /** | ||||
* Do a user login | * Do a user login | ||||
* | * | ||||
* @param string $user the username | |||||
* @param string $uid the username | |||||
* @param string $password the password | * @param string $password the password | ||||
* @return bool true if successful | * @return bool true if successful | ||||
* @since 6.0.0 | * @since 6.0.0 | ||||
*/ | */ | ||||
public function login($user, $password); | |||||
public function login($uid, $password); | |||||
/** | /** | ||||
* Logs the user out including all the session data | * Logs the user out including all the session data |
/** | /** | ||||
* @since 14.0.0 | * @since 14.0.0 | ||||
* | * | ||||
* @param string $uid The username | |||||
* @param string $loginName The loginname | |||||
* @param string $password The password | * @param string $password The password | ||||
* @return string|bool The uid on success false on failure | * @return string|bool The uid on success false on failure | ||||
*/ | */ |