diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index b2008b286ca25..1505399e1311c 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -2267,7 +2267,6 @@ 'OC_Defaults' => $baseDir . '/lib/private/legacy/OC_Defaults.php', 'OC_Helper' => $baseDir . '/lib/private/legacy/OC_Helper.php', 'OC_Hook' => $baseDir . '/lib/private/legacy/OC_Hook.php', - 'OC_JSON' => $baseDir . '/lib/private/legacy/OC_JSON.php', 'OC_Template' => $baseDir . '/lib/private/legacy/OC_Template.php', 'OC_User' => $baseDir . '/lib/private/legacy/OC_User.php', 'OC_Util' => $baseDir . '/lib/private/legacy/OC_Util.php', diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index fb4a73103f5b3..444173f5ca9a8 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -2308,7 +2308,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2 'OC_Defaults' => __DIR__ . '/../../..' . '/lib/private/legacy/OC_Defaults.php', 'OC_Helper' => __DIR__ . '/../../..' . '/lib/private/legacy/OC_Helper.php', 'OC_Hook' => __DIR__ . '/../../..' . '/lib/private/legacy/OC_Hook.php', - 'OC_JSON' => __DIR__ . '/../../..' . '/lib/private/legacy/OC_JSON.php', 'OC_Template' => __DIR__ . '/../../..' . '/lib/private/legacy/OC_Template.php', 'OC_User' => __DIR__ . '/../../..' . '/lib/private/legacy/OC_User.php', 'OC_Util' => __DIR__ . '/../../..' . '/lib/private/legacy/OC_Util.php', diff --git a/lib/private/legacy/OC_JSON.php b/lib/private/legacy/OC_JSON.php deleted file mode 100644 index 03ac83a058141..0000000000000 --- a/lib/private/legacy/OC_JSON.php +++ /dev/null @@ -1,109 +0,0 @@ -isEnabledForUser($app)) { - $l = \OC::$server->getL10N('lib'); - self::error([ 'data' => [ 'message' => $l->t('Application is not enabled'), 'error' => 'application_not_enabled' ]]); - exit(); - } - } - - /** - * Check if the user is logged in, send json error msg if not - * @deprecated 12.0.0 Use annotation based ACLs from the AppFramework instead - * @suppress PhanDeprecatedFunction - */ - public static function checkLoggedIn() { - $twoFactorAuthManger = Server::get(TwoFactorAuthManager::class); - if (!Server::get(IUserSession::class)->isLoggedIn() - || $twoFactorAuthManger->needsSecondFactor(Server::get(IUserSession::class)->getUser())) { - $l = \OC::$server->getL10N('lib'); - http_response_code(Http::STATUS_UNAUTHORIZED); - self::error([ 'data' => [ 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' ]]); - exit(); - } - } - - /** - * Check an ajax get/post call if the request token is valid, send json error msg if not. - * @deprecated 12.0.0 Use annotation based CSRF checks from the AppFramework instead - * @suppress PhanDeprecatedFunction - */ - public static function callCheck() { - if (!Server::get(IRequest::class)->passesStrictCookieCheck()) { - header('Location: ' . \OC::$WEBROOT); - exit(); - } - - if (!Server::get(IRequest::class)->passesCSRFCheck()) { - $l = \OC::$server->getL10N('lib'); - self::error([ 'data' => [ 'message' => $l->t('Token expired. Please reload page.'), 'error' => 'token_expired' ]]); - exit(); - } - } - - /** - * Check if the user is a admin, send json error msg if not. - * @deprecated 12.0.0 Use annotation based ACLs from the AppFramework instead - * @suppress PhanDeprecatedFunction - */ - public static function checkAdminUser() { - if (!OC_User::isAdminUser(OC_User::getUser())) { - $l = \OC::$server->getL10N('lib'); - self::error([ 'data' => [ 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' ]]); - exit(); - } - } - - /** - * Send json error msg - * @deprecated 12.0.0 Use a AppFramework JSONResponse instead - * @suppress PhanDeprecatedFunction - */ - public static function error($data = []) { - $data['status'] = 'error'; - header('Content-Type: application/json; charset=utf-8'); - echo self::encode($data); - } - - /** - * Send json success msg - * @deprecated 12.0.0 Use a AppFramework JSONResponse instead - * @suppress PhanDeprecatedFunction - */ - public static function success($data = []) { - $data['status'] = 'success'; - header('Content-Type: application/json; charset=utf-8'); - echo self::encode($data); - } - - /** - * Encode JSON - * @deprecated 12.0.0 Use a AppFramework JSONResponse instead - * - * @psalm-taint-escape has_quotes - * @psalm-taint-escape html - */ - private static function encode($data) { - return json_encode($data, JSON_HEX_TAG); - } -}