summaryrefslogtreecommitdiffstats
path: root/settings/application.php
blob: b17ca01c2f3cf023e6ba7673caf23148aa0a15da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
 * @author Lukas Reschke
 * @copyright 2014 Lukas Reschke lukas@owncloud.com
 *
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */

namespace OC\Settings;

use OC\AppFramework\Utility\SimpleContainer;
use OC\Settings\Controller\MailSettingsController;
use \OCP\AppFramework\App;
use \OCP\Util;

/**
 * @package OC\Settings
 */
class Application extends App {


	/**
	 * @param array $urlParams
	 */
	public function __construct(array $urlParams=array()){
		parent::__construct('settings', $urlParams);

		$container = $this->getContainer();

		/**
		 * Controllers
		 */
		$container->registerService('MailSettingsController', function(SimpleContainer $c) {
			return new MailSettingsController(
				$c->query('AppName'),
				$c->query('Request'),
				$c->query('L10N'),
				$c->query('Config'),
				$c->query('UserSession'),
				$c->query('Defaults'),
				$c->query('Mail'),
				$c->query('DefaultMailAddress')
			);
		});

		/**
		 * Core class wrappers
		 */
		$container->registerService('Config', function(SimpleContainer $c) {
			return $c->query('ServerContainer')->getConfig();
		});
		$container->registerService('L10N', function(SimpleContainer $c) {
			return $c->query('ServerContainer')->getL10N('settings');
		});
		$container->registerService('UserSession', function(SimpleContainer $c) {
			return $c->query('ServerContainer')->getUserSession();
		});
		$container->registerService('Mail', function(SimpleContainer $c) {
			return new \OC_Mail;
		});
		$container->registerService('Defaults', function(SimpleContainer $c) {
			return new \OC_Defaults;
		});
		$container->registerService('DefaultMailAddress', function(SimpleContainer $c) {
			return Util::getDefaultEmailAddress('no-reply');
		});
	}
}