application.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /**
  3. * @author Lukas Reschke
  4. * @copyright 2014 Lukas Reschke lukas@owncloud.com
  5. *
  6. * This file is licensed under the Affero General Public License version 3 or
  7. * later.
  8. * See the COPYING-README file.
  9. */
  10. namespace OC\Settings;
  11. use OC\AppFramework\Utility\SimpleContainer;
  12. use OC\Settings\Controller\MailSettingsController;
  13. use \OCP\AppFramework\App;
  14. use \OCP\Util;
  15. /**
  16. * @package OC\Settings
  17. */
  18. class Application extends App {
  19. /**
  20. * @param array $urlParams
  21. */
  22. public function __construct(array $urlParams=array()){
  23. parent::__construct('settings', $urlParams);
  24. $container = $this->getContainer();
  25. /**
  26. * Controllers
  27. */
  28. $container->registerService('MailSettingsController', function(SimpleContainer $c) {
  29. return new MailSettingsController(
  30. $c->query('AppName'),
  31. $c->query('Request'),
  32. $c->query('L10N'),
  33. $c->query('Config'),
  34. $c->query('UserSession'),
  35. $c->query('Defaults'),
  36. $c->query('Mail'),
  37. $c->query('DefaultMailAddress')
  38. );
  39. });
  40. /**
  41. * Core class wrappers
  42. */
  43. $container->registerService('Config', function(SimpleContainer $c) {
  44. return $c->query('ServerContainer')->getConfig();
  45. });
  46. $container->registerService('L10N', function(SimpleContainer $c) {
  47. return $c->query('ServerContainer')->getL10N('settings');
  48. });
  49. $container->registerService('UserSession', function(SimpleContainer $c) {
  50. return $c->query('ServerContainer')->getUserSession();
  51. });
  52. $container->registerService('Mail', function(SimpleContainer $c) {
  53. return new \OC_Mail;
  54. });
  55. $container->registerService('Defaults', function(SimpleContainer $c) {
  56. return new \OC_Defaults;
  57. });
  58. $container->registerService('DefaultMailAddress', function(SimpleContainer $c) {
  59. return Util::getDefaultEmailAddress('no-reply');
  60. });
  61. }
  62. }