You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

application.php 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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\AppSettingsController;
  13. use OC\Settings\Controller\MailSettingsController;
  14. use \OCP\AppFramework\App;
  15. use \OCP\Util;
  16. /**
  17. * @package OC\Settings
  18. */
  19. class Application extends App {
  20. /**
  21. * @param array $urlParams
  22. */
  23. public function __construct(array $urlParams=array()){
  24. parent::__construct('settings', $urlParams);
  25. $container = $this->getContainer();
  26. /**
  27. * Controllers
  28. */
  29. $container->registerService('MailSettingsController', function(SimpleContainer $c) {
  30. return new MailSettingsController(
  31. $c->query('AppName'),
  32. $c->query('Request'),
  33. $c->query('L10N'),
  34. $c->query('Config'),
  35. $c->query('UserSession'),
  36. $c->query('Defaults'),
  37. $c->query('Mail'),
  38. $c->query('DefaultMailAddress')
  39. );
  40. });
  41. $container->registerService('AppSettingsController', function(SimpleContainer $c) {
  42. return new AppSettingsController(
  43. $c->query('AppName'),
  44. $c->query('Request'),
  45. $c->query('L10N'),
  46. $c->query('Config')
  47. );
  48. });
  49. /**
  50. * Core class wrappers
  51. */
  52. $container->registerService('Config', function(SimpleContainer $c) {
  53. return $c->query('ServerContainer')->getConfig();
  54. });
  55. $container->registerService('L10N', function(SimpleContainer $c) {
  56. return $c->query('ServerContainer')->getL10N('settings');
  57. });
  58. $container->registerService('UserSession', function(SimpleContainer $c) {
  59. return $c->query('ServerContainer')->getUserSession();
  60. });
  61. $container->registerService('Mail', function(SimpleContainer $c) {
  62. return new \OC_Mail;
  63. });
  64. $container->registerService('Defaults', function(SimpleContainer $c) {
  65. return new \OC_Defaults;
  66. });
  67. $container->registerService('DefaultMailAddress', function(SimpleContainer $c) {
  68. return Util::getDefaultEmailAddress('no-reply');
  69. });
  70. }
  71. }