aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Server.php32
-rw-r--r--lib/private/Share20/Manager.php3
-rw-r--r--lib/private/legacy/OC_API.php2
-rw-r--r--lib/private/legacy/OC_EventSource.php4
-rw-r--r--lib/private/legacy/OC_JSON.php14
5 files changed, 10 insertions, 45 deletions
diff --git a/lib/private/Server.php b/lib/private/Server.php
index 40c226bdf81..385d654b951 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -152,7 +152,6 @@ use OC\Security\VerificationToken\VerificationToken;
use OC\Session\CryptoWrapper;
use OC\SetupCheck\SetupCheckManager;
use OC\Share20\ProviderFactory;
-use OC\Share20\ShareDisableChecker;
use OC\Share20\ShareHelper;
use OC\SpeechToText\SpeechToTextManager;
use OC\SystemTag\ManagerFactory as SystemTagManagerFactory;
@@ -261,6 +260,7 @@ use OCP\Security\ITrustedDomainHelper;
use OCP\Security\RateLimiting\ILimiter;
use OCP\Security\VerificationToken\IVerificationToken;
use OCP\SetupCheck\ISetupCheckManager;
+use OCP\Share\IProviderFactory;
use OCP\Share\IShareHelper;
use OCP\SpeechToText\ISpeechToTextManager;
use OCP\SystemTag\ISystemTagManager;
@@ -1247,36 +1247,14 @@ class Server extends ServerContainer implements IServerContainer {
/** @deprecated 19.0.0 */
$this->registerDeprecatedAlias('ContentSecurityPolicyManager', ContentSecurityPolicyManager::class);
- $this->registerService(\OCP\Share\IManager::class, function (IServerContainer $c) {
+ $this->registerService(IProviderFactory::class, function (ContainerInterface $c) {
$config = $c->get(\OCP\IConfig::class);
$factoryClass = $config->getSystemValue('sharing.managerFactory', ProviderFactory::class);
/** @var \OCP\Share\IProviderFactory $factory */
- $factory = new $factoryClass($this);
-
- $manager = new \OC\Share20\Manager(
- $c->get(LoggerInterface::class),
- $c->get(\OCP\IConfig::class),
- $c->get(ISecureRandom::class),
- $c->get(IHasher::class),
- $c->get(IMountManager::class),
- $c->get(IGroupManager::class),
- $c->getL10N('lib'),
- $c->get(IFactory::class),
- $factory,
- $c->get(IUserManager::class),
- $c->get(IRootFolder::class),
- $c->get(IMailer::class),
- $c->get(IURLGenerator::class),
- $c->get('ThemingDefaults'),
- $c->get(IEventDispatcher::class),
- $c->get(IUserSession::class),
- $c->get(KnownUserService::class),
- $c->get(ShareDisableChecker::class),
- $c->get(IDateTimeZone::class),
- );
-
- return $manager;
+ return new $factoryClass($this);
});
+
+ $this->registerAlias(\OCP\Share\IManager::class, \OC\Share20\Manager::class);
/** @deprecated 19.0.0 */
$this->registerDeprecatedAlias('ShareManager', \OCP\Share\IManager::class);
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php
index c1abaff2ec0..9b54592dd1e 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -130,7 +130,6 @@ class Manager implements IManager {
IHasher $hasher,
IMountManager $mountManager,
IGroupManager $groupManager,
- IL10N $l,
IFactory $l10nFactory,
IProviderFactory $factory,
IUserManager $userManager,
@@ -150,7 +149,7 @@ class Manager implements IManager {
$this->hasher = $hasher;
$this->mountManager = $mountManager;
$this->groupManager = $groupManager;
- $this->l = $l;
+ $this->l = $l10nFactory->get('lib');
$this->l10nFactory = $l10nFactory;
$this->factory = $factory;
$this->userManager = $userManager;
diff --git a/lib/private/legacy/OC_API.php b/lib/private/legacy/OC_API.php
index 862e73e6edd..facd08c1d2f 100644
--- a/lib/private/legacy/OC_API.php
+++ b/lib/private/legacy/OC_API.php
@@ -171,7 +171,7 @@ class OC_API {
],
];
if ($format == 'json') {
- return OC_JSON::encode($response);
+ return json_encode($response, JSON_HEX_TAG);
}
$writer = new XMLWriter();
diff --git a/lib/private/legacy/OC_EventSource.php b/lib/private/legacy/OC_EventSource.php
index cd72ba1f2d5..49fde4a214f 100644
--- a/lib/private/legacy/OC_EventSource.php
+++ b/lib/private/legacy/OC_EventSource.php
@@ -113,13 +113,13 @@ class OC_EventSource implements \OCP\IEventSource {
}
if ($this->fallback) {
$response = '<script type="text/javascript">window.parent.OC.EventSource.fallBackCallBack('
- . $this->fallBackId . ',"' . $type . '",' . OC_JSON::encode($data) . ')</script>' . PHP_EOL;
+ . $this->fallBackId . ',"' . ($type ?? '') . '",' . json_encode($data, JSON_HEX_TAG) . ')</script>' . PHP_EOL;
echo $response;
} else {
if ($type) {
echo 'event: ' . $type . PHP_EOL;
}
- echo 'data: ' . OC_JSON::encode($data) . PHP_EOL;
+ echo 'data: ' . json_encode($data, JSON_HEX_TAG) . PHP_EOL;
}
echo PHP_EOL;
flush();
diff --git a/lib/private/legacy/OC_JSON.php b/lib/private/legacy/OC_JSON.php
index b9cfb8210e0..b6791fe4b85 100644
--- a/lib/private/legacy/OC_JSON.php
+++ b/lib/private/legacy/OC_JSON.php
@@ -114,22 +114,10 @@ class OC_JSON {
}
/**
- * Convert OC_L10N_String to string, for use in json encodings
- */
- protected static function to_string(&$value) {
- if ($value instanceof \OC\L10N\L10NString) {
- $value = (string)$value;
- }
- }
-
- /**
* Encode JSON
* @deprecated Use a AppFramework JSONResponse instead
*/
- public static function encode($data) {
- if (is_array($data)) {
- array_walk_recursive($data, ['OC_JSON', 'to_string']);
- }
+ private static function encode($data) {
return json_encode($data, JSON_HEX_TAG);
}
}