当前位置: 首页>>代码示例>>PHP>>正文


PHP Util::getDefaultEmailAddress方法代码示例

本文整理汇总了PHP中OCP\Util::getDefaultEmailAddress方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::getDefaultEmailAddress方法的具体用法?PHP Util::getDefaultEmailAddress怎么用?PHP Util::getDefaultEmailAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OCP\Util的用法示例。


在下文中一共展示了Util::getDefaultEmailAddress方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendEmail

 public static function sendEmail($args)
 {
     $isEncrypted = \OC_App::isEnabled('files_encryption');
     if (!$isEncrypted || isset($_POST['continue'])) {
         $continue = true;
     } else {
         $continue = false;
     }
     if (\OC_User::userExists($_POST['user']) && $continue) {
         $token = hash('sha256', \OC_Util::generateRandomBytes(30) . \OC_Config::getValue('passwordsalt', ''));
         \OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword', hash('sha256', $token));
         // Hash the token again to prevent timing attacks
         $email = \OC_Preferences::getValue($_POST['user'], 'settings', 'email', '');
         if (!empty($email)) {
             $link = \OC_Helper::linkToRoute('core_lostpassword_reset', array('user' => $_POST['user'], 'token' => $token));
             $link = \OC_Helper::makeURLAbsolute($link);
             $tmpl = new \OC_Template('core/lostpassword', 'email');
             $tmpl->assign('link', $link, false);
             $msg = $tmpl->fetchPage();
             $l = \OC_L10N::get('core');
             $from = \OCP\Util::getDefaultEmailAddress('lostpassword-noreply');
             try {
                 $defaults = new \OC_Defaults();
                 \OC_Mail::send($email, $_POST['user'], $l->t('%s password reset', array($defaults->getName())), $msg, $from, $defaults->getName());
             } catch (Exception $e) {
                 \OC_Template::printErrorPage('A problem occurs during sending the e-mail please contact your administrator.');
             }
             self::displayLostPasswordPage(false, true);
         } else {
             self::displayLostPasswordPage(true, false);
         }
     } else {
         self::displayLostPasswordPage(true, false);
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:35,代码来源:controller.php

示例2: validateEmail

 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  * @PublicPage
  */
 public function validateEmail()
 {
     $email = $this->request->getParam('email');
     if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
         return new TemplateResponse('', 'error', array(array('error' => $this->l10n->t('Email address you entered is not valid'))), 'error');
         return new TemplateResponse('', 'error', array('errors' => array(array('error' => $this->l10n->t('Email address you entered is not valid'), 'hint' => ''))), 'error');
     }
     if ($this->pendingreg->find($email)) {
         return new TemplateResponse('', 'error', array('errors' => array(array('error' => $this->l10n->t('There is already a pending registration with this email'), 'hint' => ''))), 'error');
     }
     if ($this->config->getUsersForUserValue('settings', 'email', $email)) {
         return new TemplateResponse('', 'error', array('errors' => array(array('error' => $this->l10n->t('There is an existing user with this email'), 'hint' => ''))), 'error');
     }
     // FEATURE: allow only from specific email domain
     $token = $this->pendingreg->save($email);
     //TODO: check for error
     $link = $this->urlgenerator->linkToRoute('registration.register.verifyToken', array('token' => $token));
     $link = $this->urlgenerator->getAbsoluteURL($link);
     $from = Util::getDefaultEmailAddress('register');
     $res = new TemplateResponse('registration', 'email', array('link' => $link), 'blank');
     $msg = $res->render();
     try {
         $this->mail->sendMail($email, 'ownCloud User', $this->l10n->t('Verify your ownCloud registration request'), $msg, $from, 'ownCloud');
     } catch (\Exception $e) {
         \OC_Template::printErrorPage('A problem occurs during sending the e-mail please contact your administrator.');
         return;
     }
     return new TemplateResponse('registration', 'message', array('msg' => $this->l10n->t('Verification email successfully sent.')), 'guest');
 }
开发者ID:j2L4e,项目名称:registration,代码行数:34,代码来源:registercontroller.php

示例3: __construct

 /**
  * @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');
     });
 }
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:35,代码来源:application.php

示例4: sendMail

 public static function sendMail($path)
 {
     if (!\OCP\User::isLoggedIn()) {
         return;
     }
     $config = \OC::$server->getConfig();
     $user = \OC::$server->getUserSession()->getUser();
     $email = $user->getEMailAddress();
     $displayName = $user->getDisplayName();
     if (strval($displayName) === '') {
         $displayName = $user->getUID();
     }
     \OCP\Util::writeLog('files_antivirus', 'Email: ' . $email, \OCP\Util::DEBUG);
     if (!empty($email)) {
         try {
             $tmpl = new \OCP\Template('files_antivirus', 'notification');
             $tmpl->assign('file', $path);
             $tmpl->assign('host', \OC::$server->getRequest()->getServerHost());
             $tmpl->assign('user', $displayName);
             $msg = $tmpl->fetchPage();
             $from = \OCP\Util::getDefaultEmailAddress('security-noreply');
             $mailer = \OC::$server->getMailer();
             $message = $mailer->createMessage();
             $message->setSubject(\OCP\Util::getL10N('files_antivirus')->t('Malware detected'));
             $message->setFrom([$from => 'ownCloud Notifier']);
             $message->setTo([$email => $displayName]);
             $message->setPlainBody($msg);
             $message->setHtmlBody($msg);
             $mailer->send($message);
         } catch (\Exception $e) {
             \OC::$server->getLogger()->error(__METHOD__ . ', exception: ' . $e->getMessage(), ['app' => 'files_antivirus']);
         }
     }
 }
开发者ID:drognisep,项目名称:Portfolio-Site,代码行数:34,代码来源:notification.php

示例5: __construct

 /**
  *
  * @param string $sender user id
  */
 public function __construct($sender)
 {
     $this->l = \OC::$server->getL10N('lib');
     $this->senderId = $sender;
     $this->from = \OCP\Util::getDefaultEmailAddress('sharing-noreply');
     $this->replyTo = \OCP\Config::getUserValue($this->senderId, 'settings', 'email', $this->from);
     $this->senderDisplayName = \OCP\User::getDisplayName($this->senderId);
 }
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:12,代码来源:mailnotifications.php

示例6: __construct

 /**
  * @param array $urlParams
  */
 public function __construct(array $urlParams = array())
 {
     parent::__construct('core', $urlParams);
     $container = $this->getContainer();
     /**
      * Controllers
      */
     $container->registerService('LostController', function (SimpleContainer $c) {
         return new LostController($c->query('AppName'), $c->query('Request'), $c->query('URLGenerator'), $c->query('UserManager'), $c->query('Defaults'), $c->query('L10N'), $c->query('Config'), $c->query('SecureRandom'), $c->query('DefaultEmailAddress'), $c->query('IsEncryptionEnabled'), $c->query('Mailer'));
     });
     $container->registerService('UserController', function (SimpleContainer $c) {
         return new UserController($c->query('AppName'), $c->query('Request'), $c->query('UserManager'), $c->query('Defaults'));
     });
     $container->registerService('AvatarController', function (SimpleContainer $c) {
         return new AvatarController($c->query('AppName'), $c->query('Request'), $c->query('AvatarManager'), $c->query('Cache'), $c->query('L10N'), $c->query('UserManager'), $c->query('UserSession'));
     });
     /**
      * Core class wrappers
      */
     $container->registerService('IsEncryptionEnabled', function (SimpleContainer $c) {
         return $c->query('ServerContainer')->getEncryptionManager()->isEnabled();
     });
     $container->registerService('URLGenerator', function (SimpleContainer $c) {
         return $c->query('ServerContainer')->getURLGenerator();
     });
     $container->registerService('UserManager', function (SimpleContainer $c) {
         return $c->query('ServerContainer')->getUserManager();
     });
     $container->registerService('Config', function (SimpleContainer $c) {
         return $c->query('ServerContainer')->getConfig();
     });
     $container->registerService('L10N', function (SimpleContainer $c) {
         return $c->query('ServerContainer')->getL10N('core');
     });
     $container->registerService('SecureRandom', function (SimpleContainer $c) {
         return $c->query('ServerContainer')->getSecureRandom();
     });
     $container->registerService('AvatarManager', function (SimpleContainer $c) {
         return $c->query('ServerContainer')->getAvatarManager();
     });
     $container->registerService('UserSession', function (SimpleContainer $c) {
         return $c->query('ServerContainer')->getUserSession();
     });
     $container->registerService('Cache', function (SimpleContainer $c) {
         return $c->query('ServerContainer')->getCache();
     });
     $container->registerService('Defaults', function () {
         return new \OC_Defaults();
     });
     $container->registerService('Mailer', function (SimpleContainer $c) {
         return $c->query('ServerContainer')->getMailer();
     });
     $container->registerService('DefaultEmailAddress', function () {
         return Util::getDefaultEmailAddress('lostpassword-noreply');
     });
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:59,代码来源:application.php

示例7: __construct

 public function __construct(array $urlParams = array())
 {
     parent::__construct('core', $urlParams);
     $container = $this->getContainer();
     /**
      * Controllers
      */
     $container->registerService('LostController', function ($c) {
         return new LostController($c->query('AppName'), $c->query('Request'), $c->query('ServerContainer')->getURLGenerator(), $c->query('ServerContainer')->getUserManager(), new \OC_Defaults(), $c->query('ServerContainer')->getL10N('core'), $c->query('ServerContainer')->getConfig(), $c->query('ServerContainer')->getUserSession(), \OCP\Util::getDefaultEmailAddress('lostpassword-noreply'), \OC_App::isEnabled('files_encryption'));
     });
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:11,代码来源:application.php

示例8: __construct

 /**
  *
  * @param string $sender user id (if nothing is set we use the currently logged-in user)
  */
 public function __construct($sender = null)
 {
     $this->l = \OC_L10N::get('core');
     $this->senderId = $sender;
     $this->from = \OCP\Util::getDefaultEmailAddress('sharing-noreply');
     if ($this->senderId) {
         $this->from = \OCP\Config::getUserValue($this->senderId, 'settings', 'email', $this->from);
         $this->senderDisplayName = \OCP\User::getDisplayName($this->senderId);
     } else {
         $this->senderDisplayName = \OCP\User::getDisplayName();
     }
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:16,代码来源:mailnotifications.php

示例9: __construct

 public function __construct(IRequest $request, $baseUri)
 {
     $this->request = $request;
     $this->baseUri = $baseUri;
     $logger = \OC::$server->getLogger();
     $dispatcher = \OC::$server->getEventDispatcher();
     $root = new RootCollection();
     $this->server = new \OCA\DAV\Connector\Sabre\Server($root);
     // Backends
     $authBackend = new Auth(\OC::$server->getSession(), \OC::$server->getUserSession());
     // Set URL explicitly due to reverse-proxy situations
     $this->server->httpRequest->setUrl($this->request->getRequestUri());
     $this->server->setBaseUri($this->baseUri);
     $this->server->addPlugin(new BlockLegacyClientPlugin(\OC::$server->getConfig()));
     $this->server->addPlugin(new Plugin($authBackend, 'ownCloud'));
     $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\DummyGetResponsePlugin());
     $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin('webdav', $logger));
     $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin());
     $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\ListenerPlugin($dispatcher));
     $this->server->addPlugin(new \Sabre\DAV\Sync\Plugin());
     // acl
     $acl = new \Sabre\DAVACL\Plugin();
     $acl->defaultUsernamePath = 'principals/users';
     $this->server->addPlugin($acl);
     // calendar plugins
     $this->server->addPlugin(new \Sabre\CalDAV\Plugin());
     $this->server->addPlugin(new \Sabre\CalDAV\ICSExportPlugin());
     $senderEmail = \OCP\Util::getDefaultEmailAddress('no-reply');
     $this->server->addPlugin(new \Sabre\CalDAV\Schedule\Plugin());
     $this->server->addPlugin(new \Sabre\CalDAV\Schedule\IMipPlugin($senderEmail));
     $this->server->addPlugin(new \Sabre\CalDAV\SharingPlugin());
     $this->server->addPlugin(new \Sabre\CalDAV\Subscriptions\Plugin());
     $this->server->addPlugin(new \Sabre\CalDAV\Notifications\Plugin());
     $this->server->addPlugin(new CardDAV\Sharing\Plugin($authBackend, \OC::$server->getRequest()));
     // addressbook plugins
     $this->server->addPlugin(new \OCA\DAV\CardDAV\Plugin());
     // system tags plugins
     $this->server->addPlugin(new \OCA\DAV\SystemTag\SystemTagPlugin(\OC::$server->getSystemTagManager()));
     // Finder on OS X requires Class 2 WebDAV support (locking), since we do
     // not provide locking we emulate it using a fake locking plugin.
     if ($request->isUserAgent(['/WebDAVFS/'])) {
         $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\FakeLockerPlugin());
     }
     // wait with registering these until auth is handled and the filesystem is setup
     $this->server->on('beforeMethod', function () {
         // custom properties plugin must be the last one
         $user = \OC::$server->getUserSession()->getUser();
         if (!is_null($user)) {
             $this->server->addPlugin(new \Sabre\DAV\PropertyStorage\Plugin(new CustomPropertiesBackend($this->server->tree, \OC::$server->getDatabaseConnection(), \OC::$server->getUserSession()->getUser())));
         }
     });
 }
开发者ID:loulancn,项目名称:core,代码行数:52,代码来源:server.php

示例10: sendMail

 public static function sendMail($path)
 {
     if (!\OCP\User::isLoggedIn()) {
         return;
     }
     $email = \OCP\Config::getUserValue(\OCP\User::getUser(), 'settings', 'email', '');
     \OCP\Util::writeLog('files_antivirus', 'Email: ' . $email, \OCP\Util::DEBUG);
     if (!empty($email)) {
         $defaults = new \OCP\Defaults();
         $tmpl = new \OCP\Template('files_antivirus', 'notification');
         $tmpl->assign('file', $path);
         $tmpl->assign('host', \OCP\Util::getServerHost());
         $tmpl->assign('user', \OCP\User::getDisplayName());
         $msg = $tmpl->fetchPage();
         $from = \OCP\Util::getDefaultEmailAddress('security-noreply');
         \OCP\Util::sendMail($email, \OCP\User::getUser(), \OCP\Util::getL10N('files_antivirus')->t('Malware detected'), $msg, $from, $defaults->getName(), true);
     }
 }
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:18,代码来源:notification.php

示例11: sendTestMail

 /**
  * Send a mail to test the settings
  */
 public static function sendTestMail()
 {
     \OC_Util::checkAdminUser();
     \OCP\JSON::callCheck();
     $l = \OC::$server->getL10N('settings');
     $email = \OC_Preferences::getValue(\OC_User::getUser(), 'settings', 'email', '');
     if (!empty($email)) {
         $defaults = new \OC_Defaults();
         try {
             \OC_Mail::send($email, \OC_User::getDisplayName(), $l->t('test email settings'), $l->t('If you received this email, the settings seem to be correct.'), \OCP\Util::getDefaultEmailAddress('no-reply'), $defaults->getName());
         } catch (\Exception $e) {
             $message = $l->t('A problem occurred while sending the e-mail. Please revisit your settings.');
             \OC_JSON::error(array("data" => array("message" => $message)));
             exit;
         }
         \OC_JSON::success(array("data" => array("message" => $l->t("Email sent"))));
     } else {
         $message = $l->t('You need to set your user email before being able to send test emails.');
         \OC_JSON::error(array("data" => array("message" => $message)));
     }
 }
开发者ID:Combustible,项目名称:core,代码行数:24,代码来源:controller.php

示例12: mailUserDeletion

 /**
  * Send a mail signaling a user deletion
  * @param \OC\User\User $user
  */
 public function mailUserDeletion(\OC\User\User $user)
 {
     $toAddress = $toName = $this->config->getSystemValue('monitoring_admin_email');
     $theme = new \OC_Defaults();
     $now = new \DateTime();
     $niceNow = date_format($now, 'd/m/Y H:i:s');
     $subject = (string) $this->l->t('%s - User %s just has been deleted (%s)', array($theme->getTitle(), $user->getUID(), $niceNow));
     $html = new \OCP\Template($this->appName, "mail_userdeletion_html", "");
     $html->assign('userUID', $user->getUID());
     $html->assign('datetime', $niceNow);
     $htmlMail = $html->fetchPage();
     $alttext = new \OCP\Template($this->appName, "mail_userdeletion_text", "");
     $alttext->assign('userUID', $user->getUID());
     $alttext->assign('datetime', $niceNow);
     $altMail = $alttext->fetchPage();
     $fromAddress = $fromName = \OCP\Util::getDefaultEmailAddress('owncloud');
     try {
         \OCP\Util::sendMail($toAddress, $toName, $subject, $htmlMail, $fromAddress, $fromName, 1, $altMail);
     } catch (\Exception $e) {
         \OCP\Util::writeLog('user_account_actions', "Can't send mail for user deletion: " . $e->getMessage(), \OCP\Util::ERROR);
     }
 }
开发者ID:Victor-Bordage-Gorry,项目名称:user_account_actions,代码行数:26,代码来源:mailaction.php

示例13: send

 /**
  * Send the specified message. Also sets the from address to the value defined in config.php
  * if no-one has been passed.
  *
  * @param Message $message Message to send
  * @return string[] Array with failed recipients. Be aware that this depends on the used mail backend and
  * therefore should be considered
  * @throws \Exception In case it was not possible to send the message. (for example if an invalid mail address
  * has been supplied.)
  */
 public function send(Message $message)
 {
     $debugMode = $this->config->getSystemValue('mail_smtpdebug', false);
     if (sizeof($message->getFrom()) === 0) {
         $message->setFrom([\OCP\Util::getDefaultEmailAddress($this->defaults->getName())]);
     }
     $failedRecipients = [];
     $mailer = $this->getInstance();
     // Enable logger if debug mode is enabled
     if ($debugMode) {
         $mailLogger = new \Swift_Plugins_Loggers_ArrayLogger();
         $mailer->registerPlugin(new \Swift_Plugins_LoggerPlugin($mailLogger));
     }
     $mailer->send($message->getSwiftMessage(), $failedRecipients);
     // Debugging logging
     $logMessage = sprintf('Sent mail to "%s" with subject "%s"', print_r($message->getTo(), true), $message->getSubject());
     $this->logger->debug($logMessage, ['app' => 'core']);
     if ($debugMode && isset($mailLogger)) {
         $this->logger->debug($mailLogger->dump(), ['app' => 'core']);
     }
     return $failedRecipients;
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:32,代码来源:mailer.php

示例14: __construct

 /**
  * @param array $urlParams
  */
 public function __construct(array $urlParams = [])
 {
     parent::__construct('settings', $urlParams);
     $container = $this->getContainer();
     /**
      * Controllers
      */
     $container->registerService('MailSettingsController', function (IContainer $c) {
         return new MailSettingsController($c->query('AppName'), $c->query('Request'), $c->query('L10N'), $c->query('Config'), $c->query('UserSession'), $c->query('Defaults'), $c->query('Mailer'), $c->query('DefaultMailAddress'));
     });
     $container->registerService('EncryptionController', function (IContainer $c) {
         return new EncryptionController($c->query('AppName'), $c->query('Request'), $c->query('L10N'), $c->query('Config'), $c->query('DatabaseConnection'), $c->query('UserManager'), new View(), $c->query('Logger'));
     });
     $container->registerService('AppSettingsController', function (IContainer $c) {
         return new AppSettingsController($c->query('AppName'), $c->query('Request'), $c->query('L10N'), $c->query('Config'), $c->query('ICacheFactory'), $c->query('INavigationManager'), $c->query('IAppManager'), $c->query('OcsClient'));
     });
     $container->registerService('AuthSettingsController', function (IContainer $c) {
         return new AuthSettingsController($c->query('AppName'), $c->query('Request'), $c->query('ServerContainer')->query('OC\\Authentication\\Token\\IProvider'), $c->query('UserManager'), $c->query('ServerContainer')->getSession(), $c->query('ServerContainer')->getSecureRandom(), $c->query('UserId'));
     });
     $container->registerService('SecuritySettingsController', function (IContainer $c) {
         return new SecuritySettingsController($c->query('AppName'), $c->query('Request'), $c->query('Config'));
     });
     $container->registerService('CertificateController', function (IContainer $c) {
         return new CertificateController($c->query('AppName'), $c->query('Request'), $c->query('CertificateManager'), $c->query('SystemCertificateManager'), $c->query('L10N'), $c->query('IAppManager'));
     });
     $container->registerService('GroupsController', function (IContainer $c) {
         return new GroupsController($c->query('AppName'), $c->query('Request'), $c->query('GroupManager'), $c->query('UserSession'), $c->query('IsAdmin'), $c->query('L10N'));
     });
     $container->registerService('UsersController', function (IContainer $c) {
         return new UsersController($c->query('AppName'), $c->query('Request'), $c->query('UserManager'), $c->query('GroupManager'), $c->query('UserSession'), $c->query('Config'), $c->query('IsAdmin'), $c->query('L10N'), $c->query('Logger'), $c->query('Defaults'), $c->query('Mailer'), $c->query('DefaultMailAddress'), $c->query('URLGenerator'), $c->query('OCP\\App\\IAppManager'), $c->query('OCP\\IAvatarManager'));
     });
     $container->registerService('LogSettingsController', function (IContainer $c) {
         return new LogSettingsController($c->query('AppName'), $c->query('Request'), $c->query('Config'), $c->query('L10N'));
     });
     $container->registerService('CheckSetupController', function (IContainer $c) {
         return new CheckSetupController($c->query('AppName'), $c->query('Request'), $c->query('Config'), $c->query('ClientService'), $c->query('URLGenerator'), $c->query('Util'), $c->query('L10N'), $c->query('Checker'));
     });
     /**
      * Middleware
      */
     $container->registerService('SubadminMiddleware', function (IContainer $c) {
         return new SubadminMiddleware($c->query('ControllerMethodReflector'), $c->query('IsSubAdmin'));
     });
     // Execute middlewares
     $container->registerMiddleware('SubadminMiddleware');
     /**
      * Core class wrappers
      */
     $container->registerService('Config', function (IContainer $c) {
         return $c->query('ServerContainer')->getConfig();
     });
     $container->registerService('ICacheFactory', function (IContainer $c) {
         return $c->query('ServerContainer')->getMemCacheFactory();
     });
     $container->registerService('L10N', function (IContainer $c) {
         return $c->query('ServerContainer')->getL10N('settings');
     });
     $container->registerService('GroupManager', function (IContainer $c) {
         return $c->query('ServerContainer')->getGroupManager();
     });
     $container->registerService('UserManager', function (IContainer $c) {
         return $c->query('ServerContainer')->getUserManager();
     });
     $container->registerService('UserSession', function (IContainer $c) {
         return $c->query('ServerContainer')->getUserSession();
     });
     /** FIXME: Remove once OC_User is non-static and mockable */
     $container->registerService('IsAdmin', function (IContainer $c) {
         return \OC_User::isAdminUser(\OC_User::getUser());
     });
     /** FIXME: Remove once OC_SubAdmin is non-static and mockable */
     $container->registerService('IsSubAdmin', function (IContainer $c) {
         $userObject = \OC::$server->getUserSession()->getUser();
         $isSubAdmin = false;
         if ($userObject !== null) {
             $isSubAdmin = \OC::$server->getGroupManager()->getSubAdmin()->isSubAdmin($userObject);
         }
         return $isSubAdmin;
     });
     $container->registerService('Mailer', function (IContainer $c) {
         return $c->query('ServerContainer')->getMailer();
     });
     $container->registerService('Defaults', function (IContainer $c) {
         return new \OC_Defaults();
     });
     $container->registerService('DefaultMailAddress', function (IContainer $c) {
         return Util::getDefaultEmailAddress('no-reply');
     });
     $container->registerService('Logger', function (IContainer $c) {
         return $c->query('ServerContainer')->getLogger();
     });
     $container->registerService('URLGenerator', function (IContainer $c) {
         return $c->query('ServerContainer')->getURLGenerator();
     });
     $container->registerService('ClientService', function (IContainer $c) {
         return $c->query('ServerContainer')->getHTTPClientService();
     });
//.........这里部分代码省略.........
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:101,代码来源:Application.php

示例15: testGetConfiguredEmailAddressFromConfig

 function testGetConfiguredEmailAddressFromConfig()
 {
     OC_Config::setValue('mail_domain', 'example.com');
     OC_Config::setValue('mail_from_address', 'owncloud');
     $email = \OCP\Util::getDefaultEmailAddress("no-reply");
     $this->assertEquals('owncloud@example.com', $email);
     OC_Config::deleteKey('mail_domain');
     OC_Config::deleteKey('mail_from_address');
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:9,代码来源:util.php


注:本文中的OCP\Util::getDefaultEmailAddress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。