diff options
Diffstat (limited to 'lib/util.php')
-rwxr-xr-x | lib/util.php | 56 |
1 files changed, 48 insertions, 8 deletions
diff --git a/lib/util.php b/lib/util.php index 71921f0aedd..97e0fdba75b 100755 --- a/lib/util.php +++ b/lib/util.php @@ -77,7 +77,7 @@ class OC_Util { public static function getVersion() { // hint: We only can count up. Reset minor/patchlevel when // updating major/minor version number. - return array(5, 00, 21); + return array(5, 00, 25); } /** @@ -85,7 +85,7 @@ class OC_Util { * @return string */ public static function getVersionString() { - return '5.0.12 RC1'; + return '5.0.13'; } /** @@ -312,9 +312,27 @@ class OC_Util { } /** - * Check for correct file permissions of data directory - * @return array arrays with error messages and hints - */ + * @brief check if there are still some encrypted files stored + * @return boolean + */ + public static function encryptedFiles() { + //check if encryption was enabled in the past + $encryptedFiles = false; + if (OC_App::isEnabled('files_encryption') === false) { + $view = new OC\Files\View('/' . OCP\User::getUser()); + if ($view->file_exists('/files_encryption/keyfiles')) { + $encryptedFiles = true; + } + } + + return $encryptedFiles; + } + + /** + * @brief Check for correct file permissions of data directory + * @paran string $dataDirectory + * @return array arrays with error messages and hints + */ public static function checkDataDirectoryPermissions($dataDirectory) { $errors = array(); if (stristr(PHP_OS, 'WIN')) { @@ -354,6 +372,7 @@ class OC_Util { } $parameters['alt_login'] = OC_App::getAlternativeLogIns(); + $parameters['rememberLoginAllowed'] = self::rememberLoginAllowed(); OC_Template::printGuestPage("", "login", $parameters); } @@ -385,6 +404,7 @@ class OC_Util { * Check if the user is a admin, redirects to home if not */ public static function checkAdminUser() { + \OC_Util::checkLoggedIn(); if( !OC_User::isAdminUser(OC_User::getUser())) { header( 'Location: '.OC_Helper::linkToAbsolute( '', 'index.php' )); exit(); @@ -392,10 +412,32 @@ class OC_Util { } /** - * Check if the user is a subadmin, redirects to home if not + * Check if it is allowed to remember login. + * + * @note Every app can set 'rememberlogin' to 'false' to disable the remember login feature + * + * @return bool + */ + public static function rememberLoginAllowed() { + + $apps = OC_App::getEnabledApps(); + + foreach ($apps as $app) { + $appInfo = OC_App::getAppInfo($app); + if (isset($appInfo['rememberlogin']) && $appInfo['rememberlogin'] === 'false') { + return false; + } + + } + return true; + } + + /** + * @brief Check if the user is a subadmin, redirects to home if not * @return array $groups where the current user is subadmin */ public static function checkSubAdminUser() { + \OC_Util::checkLoggedIn(); if(!OC_SubAdmin::isSubAdmin(OC_User::getUser())) { header( 'Location: '.OC_Helper::linkToAbsolute( '', 'index.php' )); exit(); @@ -536,7 +578,6 @@ class OC_Util { return $value; } - /** * Check if the htaccess file is working by creating a test file in the data directory and trying to access via http */ @@ -677,7 +718,6 @@ class OC_Util { } } - } /** |