diff options
author | Joas Schilling <coding@schilljs.com> | 2016-10-17 13:21:44 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2016-10-17 13:22:12 +0300 |
commit | 4531545c6102a06fee7ea9a31f65375a866c257c (patch) | |
tree | 607948d33f01d70960fe591900da6200d5119578 /lib/AppInfo | |
parent | 4d6f7675470ccc2657cca7f17578c0e207fcd0ec (diff) |
Use PSR-4 loading for normal files
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/AppInfo')
-rw-r--r-- | lib/AppInfo/Application.php | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php new file mode 100644 index 000000000..e2d68e175 --- /dev/null +++ b/lib/AppInfo/Application.php @@ -0,0 +1,52 @@ +<?php + +/** + * @author Christoph Wurst <christoph@winzerhof-wurst.at> + * @author Thomas Müller <thomas.mueller@tmit.eu> + * + * Mail + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ + +namespace OCA\Mail\AppInfo; + +use OCP\AppFramework\App; +use OCP\Util; + +class Application extends App { + + public function __construct(array $urlParams = []) { + parent::__construct('mail', $urlParams); + + $container = $this->getContainer(); + + $transport = $container->getServer()->getConfig()->getSystemValue('app.mail.transport', 'smtp'); + $testSmtp = $transport === 'smtp'; + + $container->registerService('OCP\ISession', function ($c) { + return $c->getServer()->getSession(); + }); + + $container->registerParameter("appName", "mail"); + $container->registerService("userFolder", function ($c) use ($container) { + $user = $container->query("UserId"); + return $container->getServer()->getUserFolder($user); + }); + $container->registerParameter("testSmtp", $testSmtp); + $container->registerParameter("referrer", isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null); + $container->registerParameter("hostname", Util::getServerHostName()); + } + +} |