Application.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. * @copyright Copyright (c) 2016 Joas Schilling <coding@schilljs.com>
  5. *
  6. * @author Bernhard Posselt <dev@bernhard-posselt.com>
  7. * @author Christoph Wurst <christoph@owncloud.com>
  8. * @author Joas Schilling <coding@schilljs.com>
  9. * @author Lukas Reschke <lukas@statuscode.ch>
  10. * @author Morris Jobke <hey@morrisjobke.de>
  11. * @author Roeland Jago Douma <roeland@famdouma.nl>
  12. * @author Thomas Müller <thomas.mueller@tmit.eu>
  13. * @author Victor Dubiniuk <dubiniuk@owncloud.com>
  14. *
  15. * @license AGPL-3.0
  16. *
  17. * This code is free software: you can redistribute it and/or modify
  18. * it under the terms of the GNU Affero General Public License, version 3,
  19. * as published by the Free Software Foundation.
  20. *
  21. * This program is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. * GNU Affero General Public License for more details.
  25. *
  26. * You should have received a copy of the GNU Affero General Public License, version 3,
  27. * along with this program. If not, see <http://www.gnu.org/licenses/>
  28. *
  29. */
  30. namespace OC\Core;
  31. use OC\Core\Controller\OCJSController;
  32. use OC\Security\IdentityProof\Manager;
  33. use OC\Server;
  34. use OCP\AppFramework\App;
  35. use OC\Core\Controller\CssController;
  36. use OCP\AppFramework\Utility\ITimeFactory;
  37. use OCP\IRequest;
  38. use OCP\Util;
  39. /**
  40. * Class Application
  41. *
  42. * @package OC\Core
  43. */
  44. class Application extends App {
  45. public function __construct() {
  46. parent::__construct('core');
  47. $container = $this->getContainer();
  48. $container->registerService('defaultMailAddress', function () {
  49. return Util::getDefaultEmailAddress('lostpassword-noreply');
  50. });
  51. $container->registerService(Manager::class, function () {
  52. return new Manager(
  53. \OC::$server->getAppDataDir('identityproof'),
  54. \OC::$server->getCrypto()
  55. );
  56. });
  57. $container->registerService(CssController::class, function () use ($container) {
  58. return new CssController(
  59. $container->query('appName'),
  60. $container->query(IRequest::class),
  61. \OC::$server->getAppDataDir('css'),
  62. $container->query(ITimeFactory::class)
  63. );
  64. });
  65. $container->registerService(OCJSController::class, function () use ($container) {
  66. /** @var Server $server */
  67. $server = $container->getServer();
  68. return new OCJSController(
  69. $container->query('appName'),
  70. $server->getRequest(),
  71. $server->getL10N('core'),
  72. // This is required for the theming to overwrite the `OC_Defaults`, see
  73. // https://github.com/nextcloud/server/issues/3148
  74. $server->getThemingDefaults(),
  75. $server->getAppManager(),
  76. $server->getSession(),
  77. $server->getUserSession(),
  78. $server->getConfig(),
  79. $server->getGroupManager(),
  80. $server->getIniWrapper(),
  81. $server->getURLGenerator()
  82. );
  83. });
  84. }
  85. }