• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP OCP\Util类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getTasks

 /**
  * @NoAdminRequired
  */
 public function getTasks()
 {
     $calendars = \OC_Calendar_Calendar::allCalendars($this->userId, true);
     $user_timezone = \OC_Calendar_App::getTimezone();
     $tasks = array();
     foreach ($calendars as $calendar) {
         $calendar_tasks = \OC_Calendar_Object::all($calendar['id']);
         foreach ($calendar_tasks as $task) {
             if ($task['objecttype'] != 'VTODO') {
                 continue;
             }
             if (is_null($task['summary'])) {
                 continue;
             }
             $vtodo = Helper::parseVTODO($task['calendardata']);
             try {
                 $task_data = Helper::arrayForJSON($task['id'], $vtodo, $user_timezone);
                 $task_data['calendarid'] = $calendar['id'];
                 $task_data['calendarcolor'] = $calendar['calendarcolor'];
                 $tasks[] = $task_data;
             } catch (\Exception $e) {
                 \OCP\Util::writeLog('tasks', $e->getMessage(), \OCP\Util::ERROR);
             }
         }
     }
     $result = array('data' => array('tasks' => $tasks));
     $response = new JSONResponse();
     $response->setData($result);
     return $response;
 }
开发者ID:msbt,项目名称:tasks,代码行数:33,代码来源:taskscontroller.php


示例2: getCalenderSources

 public static function getCalenderSources($parameters)
 {
     $base_url = \OCP\Util::linkTo('calendar', 'ajax/events.php') . '?calendar_id=';
     foreach (Addressbook::all(\OCP\USER::getUser()) as $addressbook) {
         $parameters['sources'][] = array('url' => $base_url . 'birthday_' . $addressbook['id'], 'backgroundColor' => '#cccccc', 'borderColor' => '#888', 'textColor' => 'black', 'cache' => true, 'editable' => false);
     }
 }
开发者ID:netcon-source,项目名称:apps,代码行数:7,代码来源:hooks.php


示例3: setup

 public function setup()
 {
     Util::connectHook('OC_User', 'post_createUser', $this, 'postCreateUser');
     Util::connectHook('OC_User', 'pre_deleteUser', $this, 'preDeleteUser');
     Util::connectHook('OC_User', 'post_deleteUser', $this, 'postDeleteUser');
     Util::connectHook('OC_User', 'changeUser', $this, 'changeUser');
 }
开发者ID:farukuzun,项目名称:core-1,代码行数:7,代码来源:hookmanager.php


示例4: __construct

 public function __construct(IL10N $l, ISession $session, ICrypto $crypto)
 {
     $this->session = $session;
     $this->crypto = $crypto;
     $this->setIdentifier('password::sessioncredentials')->setScheme(self::SCHEME_PASSWORD)->setText($l->t('Session credentials'))->addParameters([]);
     \OCP\Util::connectHook('OC_User', 'post_login', $this, 'authenticate');
 }
开发者ID:kenwi,项目名称:core,代码行数:7,代码来源:sessioncredentials.php


示例5: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     // reset backend
     \OC_User::clearBackends();
     \OC_User::useBackend('database');
     // enable resharing
     \OC_Appconfig::setValue('core', 'shareapi_allow_resharing', 'yes');
     // clear share hooks
     \OC_Hook::clear('OCP\\Share');
     \OC::registerShareHooks();
     \OCP\Util::connectHook('OC_Filesystem', 'setup', '\\OC\\Files\\Storage\\Shared', 'setup');
     // Sharing related hooks
     \OCA\Encryption\Helper::registerShareHooks();
     // Filesystem related hooks
     \OCA\Encryption\Helper::registerFilesystemHooks();
     // clear and register hooks
     \OC_FileProxy::clearProxies();
     \OC_FileProxy::register(new OCA\Encryption\Proxy());
     // create users
     \Test_Encryption_Util::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1, true);
     \Test_Encryption_Util::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2, true);
     \Test_Encryption_Util::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER3, true);
     \Test_Encryption_Util::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER4, true);
     // create group and assign users
     \OC_Group::createGroup(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_GROUP1);
     \OC_Group::addToGroup(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER3, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_GROUP1);
     \OC_Group::addToGroup(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER4, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_GROUP1);
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:28,代码来源:share.php


示例6: get_realm

 public static function get_realm()
 {
     $appConfig = \OC::$server->getAppConfig();
     $result = $appConfig->getValue('privacyIDEA', 'realm', '');
     \OCP\Util::writeLog('user_privacyidea', "Getting result for realm: {$result}", \OCP\Util::DEBUG);
     return $result;
 }
开发者ID:vDorst,项目名称:privacyidea,代码行数:7,代码来源:helper.php


示例7: __construct

 function __construct()
 {
     $this->l = \OC::$server->getL10N('lib');
     $version = \OCP\Util::getVersion();
     $this->defaultEntity = 'ownCloud';
     /* e.g. company name, used for footers and copyright notices */
     $this->defaultName = 'ownCloud';
     /* short name, used when referring to the software */
     $this->defaultTitle = 'ownCloud';
     /* can be a longer name, for titles */
     $this->defaultBaseUrl = 'https://owncloud.org';
     $this->defaultSyncClientUrl = 'https://owncloud.org/sync-clients/';
     $this->defaultiOSClientUrl = 'https://itunes.apple.com/us/app/owncloud/id543672169?mt=8';
     $this->defaultiTunesAppId = '543672169';
     $this->defaultAndroidClientUrl = 'https://play.google.com/store/apps/details?id=com.owncloud.android';
     $this->defaultDocBaseUrl = 'https://doc.owncloud.org';
     $this->defaultDocVersion = $version[0] . '.' . $version[1];
     // used to generate doc links
     $this->defaultSlogan = $this->l->t('web services under your control');
     $this->defaultLogoClaim = '';
     $this->defaultMailHeaderColor = '#1d2d44';
     /* header color of mail notifications */
     $themePath = OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php';
     if (file_exists($themePath)) {
         // prevent defaults.php from printing output
         ob_start();
         require_once $themePath;
         ob_end_clean();
         if (class_exists('OC_Theme')) {
             $this->theme = new OC_Theme();
         }
     }
 }
开发者ID:kenwi,项目名称:core,代码行数:33,代码来源:defaults.php


示例8: __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


示例9: 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


示例10: index

	/**
	 * @NoAdminRequired
	 * @NoCSRFRequired
	 */
	public function index() {
		\OC::$server->getNavigationManager()->setActiveEntry($this->appName);

		$importManager = new ImportManager();
		$imppTypes = Properties::getTypesForProperty('IMPP');
		$adrTypes = Properties::getTypesForProperty('ADR');
		$phoneTypes = Properties::getTypesForProperty('TEL');
		$emailTypes = Properties::getTypesForProperty('EMAIL');
		$ims = Properties::getIMOptions();
		$imProtocols = array();
		foreach($ims as $name => $values) {
			$imProtocols[$name] = $values['displayname'];
		}

		$maxUploadFilesize = \OCP\Util::maxUploadFilesize('/');

		$response = new TemplateResponse($this->appName, 'contacts');
		$response->setParams(array(
			'uploadMaxFilesize' => $maxUploadFilesize,
			'uploadMaxHumanFilesize' => \OCP\Util::humanFileSize($maxUploadFilesize),
			'phoneTypes' => $phoneTypes,
			'emailTypes' => $emailTypes,
			'adrTypes' => $adrTypes,
			'imppTypes' => $imppTypes,
			'imProtocols' => $imProtocols,
			'importManager' => $importManager,
		));

		return $response;
	}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:34,代码来源:pagecontroller.php


示例11: logException

 /**
  * Log exception
  *
  * @internal param Exception $e exception
  */
 public function logException($e)
 {
     $exceptionClass = get_class($e);
     if ($exceptionClass !== 'Sabre_DAV_Exception_NotAuthenticated') {
         \OCP\Util::logException($this->appName, $e);
     }
 }
开发者ID:hjimmy,项目名称:owncloud,代码行数:12,代码来源:exceptionloggerplugin.php


示例12: testGetTypeIcon

 /**
  * @dataProvider getTypeIconData
  */
 public function testGetTypeIcon($type, $expected)
 {
     $manager = $this->getMock('\\OCP\\Activity\\IManager');
     $manager->expects($this->any())->method('getTypeIcon')->willReturn('');
     $dataHelper = new DataHelper($manager, new ParameterHelper($manager, new View(''), $this->getMockBuilder('OCP\\IConfig')->disableOriginalConstructor()->getMock(), Util::getL10N('activity')), Util::getL10N('activity'));
     $this->assertEquals($expected, $dataHelper->getTypeIcon($type));
 }
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:10,代码来源:datahelpertest.php


示例13: register

 public function register()
 {
     $loginRecord = function ($user) {
         $UserRole = \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), "settings", "role", "undefined");
         Util::writeLog('core', "user:" . User::getDisplayName() . " role:" . $UserRole . " action:login success", Util::INFO);
     };
     $logoutRecord = function () {
         $UserRole = \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), "settings", "role", "undefined");
         Util::writeLog('core', "user:" . User::getDisplayName() . " role:" . $this->UserRole . " action:logout success", Util::INFO);
     };
     $createRecord = function ($node) {
         $UserRole = \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), "settings", "role", "undefined");
         Util::writeLog('activity', "user:" . User::getDisplayName() . " role:" . $UserRole . " action:creates " . $node->getName() . " success", Util::INFO);
     };
     $deleteRecord = function ($node) {
         $UserRole = \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), "settings", "role", "undefined");
         Util::writeLog('activity', "user:" . User::getDisplayName() . " role:" . $UserRole . " action:deletes " . $node->getName() . " success", Util::INFO);
     };
     $renameRecord = function ($node) {
         $UserRole = \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), "settings", "role", "undefined");
         Util::writeLog('activity', "user:" . User::getDisplayName() . " role:" . $UserRole . " action:renames " . $node->getName() . " success", Util::INFO);
     };
     $touchRecord = function ($node) {
         $UserRole = \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), "settings", "role", "undefined");
         Util::writeLog('activity', "user:" . User::getDisplayName() . " role:" . $UserRole . " action:touches " . $node->getName() . " success", Util::INFO);
     };
     Util::connectHook('OCP\\Share', 'post_shared', 'OCA\\Activity_Logging\\UserHooks', 'share');
     $this->userManager->listen('\\OC\\User', 'postLogin', $loginRecord);
     $this->userManager->listen('\\OC\\User', 'logout', $logoutRecord);
     $this->UserFolder->listen('\\OC\\Files', 'postCreate', $createRecord);
     $this->UserFolder->listen('\\OC\\Files', 'postDelete', $deleteRecord);
     $this->UserFolder->listen('\\OC\\Files', 'postRename', $renameRecord);
 }
开发者ID:inwinstack,项目名称:owncloud-activity_logging,代码行数:33,代码来源:userhooks.php


示例14: format

 /**
  * @param IEvent $event
  * @param string $parameter The parameter to be formatted
  * @return string The formatted parameter
  */
 public function format(IEvent $event, $parameter)
 {
     $param = $this->fixLegacyFilename($parameter);
     // If the activity is about the very same file, we use the current path
     // for the link generation instead of the one that was saved.
     $fileId = '';
     if (is_array($param)) {
         $fileId = key($param);
         $param = $param[$fileId];
         $info = $this->infoCache->getInfoById($this->user, $fileId, $param);
     } elseif ($event->getObjectType() === 'files' && $event->getObjectName() === $param) {
         $fileId = $event->getObjectId();
         $info = $this->infoCache->getInfoById($this->user, $fileId, $param);
     } else {
         $info = $this->infoCache->getInfoByPath($this->user, $param);
     }
     if ($info['is_dir']) {
         $linkData = ['dir' => $info['path']];
     } else {
         $parentDir = substr_count($info['path'], '/') === 1 ? '/' : dirname($info['path']);
         $fileName = basename($info['path']);
         $linkData = ['dir' => $parentDir, 'scrollto' => $fileName];
     }
     if ($info['view'] !== '') {
         $linkData['view'] = $info['view'];
     }
     $param = trim($param, '/');
     $fileLink = $this->urlGenerator->linkToRouteAbsolute('files.view.index', $linkData);
     return '<file link="' . $fileLink . '" id="' . Util::sanitizeHTML($fileId) . '">' . Util::sanitizeHTML($param) . '</file>';
 }
开发者ID:drognisep,项目名称:Portfolio-Site,代码行数:35,代码来源:FileFormatter.php


示例15: testTranslation

 /**
  * @dataProvider translationData
  */
 public function testTranslation($text, $params, $stripPath, $highlightParams, $expected)
 {
     $config = $this->getMockBuilder('OCP\\IConfig')->disableOriginalConstructor()->getMock();
     $config->expects($this->any())->method('getSystemValue')->with('enable_avatars', true)->willReturn(true);
     $dataHelper = new \OCA\Activity\DataHelper($this->getMock('\\OCP\\Activity\\IManager'), new \OCA\Activity\ParameterHelper(new \OC\Files\View(''), $config, \OCP\Util::getL10N('activity')), \OCP\Util::getL10N('activity'));
     $this->assertEquals($expected, (string) $dataHelper->translation('files', $text, $params, $stripPath, $highlightParams));
 }
开发者ID:droiter,项目名称:openwrt-on-android,代码行数:10,代码来源:datahelpertest.php


示例16: testHooksDeleteUser

 /**
  * @dataProvider getTemplateData
  */
 public function testHooksDeleteUser($constructorActive, $forceActive)
 {
     $l = \OCP\Util::getL10N('activity');
     $navigation = new Navigation($l, \OC::$server->getActivityManager(), \OC::$server->getURLGenerator(), $constructorActive);
     $output = $navigation->getTemplate($forceActive)->fetchPage();
     // Get only the template part with the navigation links
     $navigationLinks = substr($output, strpos($output, '<li>') + 4);
     $navigationLinks = substr($navigationLinks, 0, strrpos($navigationLinks, '</li>'));
     // Remove tabs and new lines
     $navigationLinks = str_replace(array("\t", "\n"), '', $navigationLinks);
     // Turn the list of links into an array
     $navigationEntries = explode('</li><li>', $navigationLinks);
     $links = $navigation->getLinkList();
     // Check whether all top links are available
     foreach ($links['top'] as $link) {
         $found = false;
         foreach ($navigationEntries as $navigationEntry) {
             if (strpos($navigationEntry, 'data-navigation="' . $link['id'] . '"') !== false) {
                 $found = true;
                 $this->assertContains('href="' . $link['url'] . '">' . $link['name'] . '</a>', $navigationEntry);
                 if ($forceActive == $link['id']) {
                     $this->assertContains('class="active"', $navigationEntry);
                 } else {
                     if ($forceActive == null && $constructorActive == $link['id']) {
                         $this->assertContains('class="active"', $navigationEntry);
                     }
                 }
             }
         }
         $this->assertTrue($found, 'Could not find navigation entry "' . $link['name'] . '"');
     }
     // Check size of app links
     $this->assertSame(1, sizeof($links['apps']));
     $this->assertNotContains('data-navigation="files"', $navigationLinks, 'Files app should not be included when there are no other apps.');
 }
开发者ID:droiter,项目名称:openwrt-on-android,代码行数:38,代码来源:navigationtest.php


示例17: index

 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  */
 public function index()
 {
     if (defined('DEBUG') && DEBUG) {
         \OCP\Util::addScript('tasks', 'vendor/angularjs/angular');
         \OCP\Util::addScript('tasks', 'vendor/angularjs/angular-route');
         \OCP\Util::addScript('tasks', 'vendor/angularjs/angular-animate');
         \OCP\Util::addScript('tasks', 'vendor/momentjs/moment');
         \OCP\Util::addScript('tasks', 'vendor/bootstrap/ui-bootstrap-custom-tpls-0.10.0');
     } else {
         \OCP\Util::addScript('tasks', 'vendor/angularjs/angular.min');
         \OCP\Util::addScript('tasks', 'vendor/angularjs/angular-route.min');
         \OCP\Util::addScript('tasks', 'vendor/angularjs/angular-animate.min');
         \OCP\Util::addScript('tasks', 'vendor/momentjs/moment.min');
         \OCP\Util::addScript('tasks', 'vendor/bootstrap/ui-bootstrap-custom-tpls-0.10.0.min');
     }
     \OCP\Util::addScript('tasks', 'public/app');
     \OCP\Util::addScript('tasks', 'vendor/appframework/app');
     \OCP\Util::addScript('tasks', 'vendor/timepicker/jquery.ui.timepicker');
     \OCP\Util::addStyle('tasks', 'style');
     \OCP\Util::addStyle('tasks', 'vendor/bootstrap/bootstrap');
     $date = new \DateTimeZone(\OC_Calendar_App::getTimezone());
     $day = new \DateTime('today', $date);
     $day = $day->format('d');
     // TODO: Make a HTMLTemplateResponse class
     $response = new TemplateResponse('tasks', 'main');
     $response->setParams(array('DOM' => $day));
     return $response;
 }
开发者ID:msbt,项目名称:tasks,代码行数:32,代码来源:pagecontroller.php


示例18: sanitizeHtmlMailBody

 public function sanitizeHtmlMailBody($mailBody, array $messageParameters, Closure $mapCidToAttachmentId)
 {
     $config = HTMLPurifier_Config::createDefault();
     // Append target="_blank" to all link (a) elements
     $config->set('HTML.TargetBlank', true);
     // allow cid, http and ftp
     $config->set('URI.AllowedSchemes', ['cid' => true, 'http' => true, 'https' => true, 'ftp' => true, 'mailto' => true]);
     $config->set('URI.Host', Util::getServerHostName());
     // Disable the cache since ownCloud has no really appcache
     // TODO: Fix this - requires https://github.com/owncloud/core/issues/10767 to be fixed
     $config->set('Cache.DefinitionImpl', null);
     // Rewrite URL for redirection and proxying of content
     $html = $config->getDefinition('HTML');
     $html->info_attr_transform_post['imagesrc'] = new TransformImageSrc($this->urlGenerator);
     $html->info_attr_transform_post['cssbackground'] = new TransformCSSBackground($this->urlGenerator);
     $html->info_attr_transform_post['htmllinks'] = new TransformHTMLLinks();
     $uri = $config->getDefinition('URI');
     $uri->addFilter(new TransformURLScheme($messageParameters, $mapCidToAttachmentId, $this->urlGenerator), $config);
     HTMLPurifier_URISchemeRegistry::instance()->register('cid', new CidURIScheme());
     $purifier = new HTMLPurifier($config);
     $result = $purifier->purify($mailBody);
     // eat xml parse errors within HTMLPurifier
     libxml_clear_errors();
     return $result;
 }
开发者ID:Gomez,项目名称:mail,代码行数:25,代码来源:html.php


示例19: 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


示例20: getUrl

 /**
  * @param $requestToken
  * @return string
  */
 public function getUrl($requestToken)
 {
     if (!$requestToken) {
         throw new \RuntimeException('No request token given');
     }
     return \OCP\Util::linkToRoute('ocusagecharts.chart_api.load_chart', array('id' => $this->chart->getId(), 'requesttoken' => $requestToken));
 }
开发者ID:xn--nding-jua,项目名称:ocusagecharts,代码行数:11,代码来源:chartviewhelper.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Activity\IManager类代码示例发布时间:2022-05-23
下一篇:
PHP OCP\User类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap