diff options
Diffstat (limited to 'apps/files_encryption/lib/helper.php')
-rwxr-xr-x | apps/files_encryption/lib/helper.php | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/apps/files_encryption/lib/helper.php b/apps/files_encryption/lib/helper.php index bb06a57c714..ef3775875f0 100755 --- a/apps/files_encryption/lib/helper.php +++ b/apps/files_encryption/lib/helper.php @@ -103,7 +103,7 @@ class Helper { * @brief enable recovery * * @param $recoveryKeyId - * @param $recoveryPassword + * @param string $recoveryPassword * @internal param \OCA\Encryption\Util $util * @internal param string $password * @return bool @@ -111,10 +111,11 @@ class Helper { public static function adminEnableRecovery($recoveryKeyId, $recoveryPassword) { $view = new \OC\Files\View('/'); + $appConfig = \OC::$server->getAppConfig(); if ($recoveryKeyId === null) { $recoveryKeyId = 'recovery_' . substr(md5(time()), 0, 8); - \OC_Appconfig::setValue('files_encryption', 'recoveryKeyId', $recoveryKeyId); + $appConfig->setValue('files_encryption', 'recoveryKeyId', $recoveryKeyId); } if (!$view->is_dir('/owncloud_private_key')) { @@ -147,7 +148,7 @@ class Helper { \OC_FileProxy::$enabled = true; // Set recoveryAdmin as enabled - \OC_Appconfig::setValue('files_encryption', 'recoveryAdminEnabled', 1); + $appConfig->setValue('files_encryption', 'recoveryAdminEnabled', 1); $return = true; @@ -155,7 +156,7 @@ class Helper { $util = new \OCA\Encryption\Util(new \OC_FilesystemView('/'), \OCP\User::getUser()); $return = $util->checkRecoveryPassword($recoveryPassword); if ($return) { - \OC_Appconfig::setValue('files_encryption', 'recoveryAdminEnabled', 1); + $appConfig->setValue('files_encryption', 'recoveryAdminEnabled', 1); } } @@ -209,7 +210,7 @@ class Helper { /** * @brief disable recovery * - * @param $recoveryPassword + * @param string $recoveryPassword * @return bool */ public static function adminDisableRecovery($recoveryPassword) { @@ -218,7 +219,7 @@ class Helper { if ($return) { // Set recoveryAdmin as disabled - \OC_Appconfig::setValue('files_encryption', 'recoveryAdminEnabled', 0); + \OC::$server->getAppConfig()->setValue('files_encryption', 'recoveryAdminEnabled', 0); } return $return; @@ -344,6 +345,7 @@ class Helper { /** * @brief redirect to a error page + * @param Session $session */ public static function redirectToErrorPage($session, $errorCode = null) { @@ -422,8 +424,8 @@ class Helper { /** * @brief glob uses different pattern than regular expressions, escape glob pattern only - * @param unescaped path - * @return escaped path + * @param string $path unescaped path + * @return string path */ public static function escapeGlobPattern($path) { return preg_replace('/(\*|\?|\[)/', '[$1]', $path); @@ -441,7 +443,7 @@ class Helper { /** * @brief get the path of the original file * @param string $tmpFile path of the tmp file - * @return mixed path of the original file or false + * @return string|false path of the original file or false */ public static function getPathFromTmpFile($tmpFile) { if (isset(self::$tmpFileMapping[$tmpFile])) { |