Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

10 роки тому
9 роки тому
9 роки тому
8 роки тому
9 роки тому
8 роки тому
9 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <?php
  2. /**
  3. * @author Bernhard Posselt <dev@bernhard-posselt.com>
  4. * @author Christoph Wurst <christoph@owncloud.com>
  5. * @author Lukas Reschke <lukas@owncloud.com>
  6. * @author Morris Jobke <hey@morrisjobke.de>
  7. * @author Roeland Jago Douma <rullzer@owncloud.com>
  8. * @author Thomas Müller <thomas.mueller@tmit.eu>
  9. * @author Victor Dubiniuk <dubiniuk@owncloud.com>
  10. *
  11. * @copyright Copyright (c) 2016, ownCloud, Inc.
  12. * @license AGPL-3.0
  13. *
  14. * This code is free software: you can redistribute it and/or modify
  15. * it under the terms of the GNU Affero General Public License, version 3,
  16. * as published by the Free Software Foundation.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU Affero General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU Affero General Public License, version 3,
  24. * along with this program. If not, see <http://www.gnu.org/licenses/>
  25. *
  26. */
  27. namespace OC\Core;
  28. use OC\AppFramework\Utility\SimpleContainer;
  29. use OC\AppFramework\Utility\TimeFactory;
  30. use OC\Core\Controller\AvatarController;
  31. use OC\Core\Controller\LoginController;
  32. use OC\Core\Controller\LostController;
  33. use OC\Core\Controller\TokenController;
  34. use OC\Core\Controller\UserController;
  35. use OC_Defaults;
  36. use OCP\AppFramework\App;
  37. use OCP\Util;
  38. /**
  39. * Class Application
  40. *
  41. * @package OC\Core
  42. */
  43. class Application extends App {
  44. /**
  45. * @param array $urlParams
  46. */
  47. public function __construct(array $urlParams=array()){
  48. parent::__construct('core', $urlParams);
  49. $container = $this->getContainer();
  50. /**
  51. * Controllers
  52. */
  53. $container->registerService('LostController', function(SimpleContainer $c) {
  54. return new LostController(
  55. $c->query('AppName'),
  56. $c->query('Request'),
  57. $c->query('URLGenerator'),
  58. $c->query('UserManager'),
  59. $c->query('Defaults'),
  60. $c->query('L10N'),
  61. $c->query('Config'),
  62. $c->query('SecureRandom'),
  63. $c->query('DefaultEmailAddress'),
  64. $c->query('IsEncryptionEnabled'),
  65. $c->query('Mailer'),
  66. $c->query('TimeFactory')
  67. );
  68. });
  69. $container->registerService('UserController', function(SimpleContainer $c) {
  70. return new UserController(
  71. $c->query('AppName'),
  72. $c->query('Request'),
  73. $c->query('UserManager'),
  74. $c->query('Defaults')
  75. );
  76. });
  77. $container->registerService('AvatarController', function(SimpleContainer $c) {
  78. return new AvatarController(
  79. $c->query('AppName'),
  80. $c->query('Request'),
  81. $c->query('AvatarManager'),
  82. $c->query('Cache'),
  83. $c->query('L10N'),
  84. $c->query('UserManager'),
  85. $c->query('UserSession'),
  86. $c->query('UserFolder'),
  87. $c->query('Logger')
  88. );
  89. });
  90. $container->registerService('LoginController', function(SimpleContainer $c) {
  91. return new LoginController(
  92. $c->query('AppName'),
  93. $c->query('Request'),
  94. $c->query('UserManager'),
  95. $c->query('Config'),
  96. $c->query('Session'),
  97. $c->query('UserSession'),
  98. $c->query('URLGenerator')
  99. );
  100. });
  101. $container->registerService('TokenController', function(SimpleContainer $c) {
  102. return new TokenController(
  103. $c->query('AppName'),
  104. $c->query('Request'),
  105. $c->query('UserManager'),
  106. $c->query('OC\Authentication\Token\DefaultTokenProvider'),
  107. $c->query('SecureRandom')
  108. );
  109. });
  110. /**
  111. * Core class wrappers
  112. */
  113. $container->registerService('IsEncryptionEnabled', function(SimpleContainer $c) {
  114. return $c->query('ServerContainer')->getEncryptionManager()->isEnabled();
  115. });
  116. $container->registerService('URLGenerator', function(SimpleContainer $c) {
  117. return $c->query('ServerContainer')->getURLGenerator();
  118. });
  119. $container->registerService('UserManager', function(SimpleContainer $c) {
  120. return $c->query('ServerContainer')->getUserManager();
  121. });
  122. $container->registerService('Config', function(SimpleContainer $c) {
  123. return $c->query('ServerContainer')->getConfig();
  124. });
  125. $container->registerService('L10N', function(SimpleContainer $c) {
  126. return $c->query('ServerContainer')->getL10N('core');
  127. });
  128. $container->registerService('SecureRandom', function(SimpleContainer $c) {
  129. return $c->query('ServerContainer')->getSecureRandom();
  130. });
  131. $container->registerService('AvatarManager', function(SimpleContainer $c) {
  132. return $c->query('ServerContainer')->getAvatarManager();
  133. });
  134. $container->registerService('Session', function(SimpleContainer $c) {
  135. return $c->query('ServerContainer')->getSession();
  136. });
  137. $container->registerService('UserSession', function(SimpleContainer $c) {
  138. return $c->query('ServerContainer')->getUserSession();
  139. });
  140. $container->registerService('Session', function(SimpleContainer $c) {
  141. return $c->query('ServerContainer')->getSession();
  142. });
  143. $container->registerService('Cache', function(SimpleContainer $c) {
  144. return $c->query('ServerContainer')->getCache();
  145. });
  146. $container->registerService('UserFolder', function(SimpleContainer $c) {
  147. return $c->query('ServerContainer')->getUserFolder();
  148. });
  149. $container->registerService('Defaults', function() {
  150. return new OC_Defaults;
  151. });
  152. $container->registerService('Mailer', function(SimpleContainer $c) {
  153. return $c->query('ServerContainer')->getMailer();
  154. });
  155. $container->registerService('Logger', function(SimpleContainer $c) {
  156. return $c->query('ServerContainer')->getLogger();
  157. });
  158. $container->registerService('TimeFactory', function(SimpleContainer $c) {
  159. return new TimeFactory();
  160. });
  161. $container->registerService('DefaultEmailAddress', function() {
  162. return Util::getDefaultEmailAddress('lostpassword-noreply');
  163. });
  164. }
  165. }