Esempio n. 1
0
	/**
	 * @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;
	}
 public function testChainability()
 {
     $params = array('hi' => 'yo');
     $this->tpl->setParams($params)->setStatus(Http::STATUS_NOT_FOUND);
     $this->assertEquals(Http::STATUS_NOT_FOUND, $this->tpl->getStatus());
     $this->assertEquals(array('hi' => 'yo'), $this->tpl->getParams());
 }
Esempio n. 3
0
 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  */
 public function index()
 {
     \OCP\Util::addscript('core', 'tags');
     \OCP\Util::addStyle($this->appName, 'style');
     \OCP\Util::addStyle($this->appName, 'jquery.Jcrop');
     \OCP\Util::addStyle($this->appName, '3rdparty/fontello/css/animation');
     \OCP\Util::addStyle($this->appName, '3rdparty/fontello/css/fontello');
     \OCP\Util::addStyle($this->appName, '3rdparty/jquery.webui-popover');
     \OCP\Util::addscript($this->appName, 'app');
     \OCP\Util::addscript($this->appName, '3rdparty/jquery.webui-popover');
     \OCP\Util::addscript($this->appName, 'settings');
     \OCP\Util::addscript($this->appName, 'loader');
     \OCP\Util::addscript($this->appName, 'jquery.scrollTo.min');
     \OCP\Util::addscript($this->appName, 'jquery.nicescroll.min');
     \OCP\Util::addscript('files', 'jquery.fileupload');
     \OCP\Util::addscript($this->appName, 'jquery.Jcrop');
     $iosSupport = $this->configInfo->getUserValue($this->userId, $this->appName, 'iossupport');
     $maxUploadFilesize = \OCP\Util::maxUploadFilesize('/');
     $addressbooks = Addressbook::all($this->userId);
     if (count($addressbooks) == 0) {
         Addressbook::addDefault($this->userId);
         $addressbooks = Addressbook::all($this->userId);
     }
     //ContactsApp::addingDummyContacts(50);
     $params = ['uploadMaxFilesize' => $maxUploadFilesize, 'uploadMaxHumanFilesize' => \OCP\Util::humanFileSize($maxUploadFilesize), 'iossupport' => $iosSupport, 'addressbooks' => $addressbooks];
     $csp = new \OCP\AppFramework\Http\ContentSecurityPolicy();
     $csp->addAllowedImageDomain('*');
     $csp->addAllowedFrameDomain('*');
     $response = new TemplateResponse($this->appName, 'index');
     $response->setContentSecurityPolicy($csp);
     $response->setParams($params);
     return $response;
 }
Esempio n. 4
0
 /**
  * @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');
 }
Esempio n. 5
0
 /**
  * @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;
 }
Esempio n. 6
0
 /**
  * @PublicPage
  * @NoCSRFRequired
  *
  * @return TemplateResponse
  */
 public function show()
 {
     try {
         $user = $this->activityManager->getCurrentUserId();
         $userLang = $this->config->getUserValue($user, 'core', 'lang');
         // Overwrite user and language in the helper
         $l = Util::getL10N('activity', $userLang);
         $l->forceLanguage($userLang);
         $this->helper->setL10n($l);
         $this->helper->setUser($user);
         $description = (string) $l->t('Personal activity feed for %s', $user);
         $activities = $this->data->read($this->helper, $this->settings, 0, self::DEFAULT_PAGE_SIZE, 'all', $user);
     } catch (\UnexpectedValueException $e) {
         $l = Util::getL10N('activity');
         $description = (string) $l->t('Your feed URL is invalid');
         $activities = [['activity_id' => -1, 'timestamp' => time(), 'subject' => true, 'subjectformatted' => ['full' => $description]]];
     }
     $response = new TemplateResponse('activity', 'rss', ['rssLang' => $l->getLanguageCode(), 'rssLink' => $this->urlGenerator->linkToRouteAbsolute('activity.Feed.show'), 'rssPubDate' => date('r'), 'description' => $description, 'activities' => $activities], '');
     if ($this->request->getHeader('accept') !== null && stristr($this->request->getHeader('accept'), 'application/rss+xml')) {
         $response->addHeader('Content-Type', 'application/rss+xml');
     } else {
         $response->addHeader('Content-Type', 'text/xml; charset=UTF-8');
     }
     return $response;
 }
Esempio n. 7
0
 /**
  * CAUTION: the @Stuff turns off security checks; for this page no admin is
  *          required and no CSRF check. If you don't know what CSRF is, read
  *          it up in the docs or you might create a security hole. This is
  *          basically the only required method to add this exemption, don't
  *          add it to any other method if you don't exactly know what it does
  *
  * @NoAdminRequired
  * @NoCSRFRequired
  */
 public function index()
 {
     $params = ['user' => $this->userId];
     $response = new TemplateResponse('user_permission', 'main', $params);
     // templates/main.php
     $response->setStatus(Http::STATUS_UNAUTHORIZED);
     return $response;
 }
Esempio n. 8
0
 /**
  * CAUTION: the @Stuff turn off security checks, for this page no admin is
  *          required and no CSRF check. If you don't know what CSRF is, read
  *          it up in the docs or you might create a security hole. This is
  *          basically the only required method to add this exemption, don't
  *          add it to any other method if you don't exactly know what it does
  *
  * @NoAdminRequired
  * @NoCSRFRequired
  */
 public function index()
 {
     $params = array('user' => $this->userId);
     $csp = new \OCP\AppFramework\Http\ContentSecurityPolicy();
     $csp->addAllowedImageDomain('data:');
     $response = new TemplateResponse('ownnote', 'main', $params);
     $response->setContentSecurityPolicy($csp);
     return $response;
 }
 /**
  * Return 403 page in case of an exception
  * @param \OCP\AppFramework\Controller $controller
  * @param string $methodName
  * @param \Exception $exception
  * @return TemplateResponse
  * @throws \Exception
  */
 public function afterException($controller, $methodName, \Exception $exception)
 {
     if ($exception instanceof NotAdminException) {
         $response = new TemplateResponse('core', '403', array(), 'guest');
         $response->setStatus(Http::STATUS_FORBIDDEN);
         return $response;
     }
     throw $exception;
 }
Esempio n. 10
0
 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  */
 public function index()
 {
     $status = $this->statusService->getStatus();
     $response = new TemplateResponse($this->appName, 'index', ['cronWarning' => $status['warnings']['improperlyConfiguredCron']]);
     $csp = new ContentSecurityPolicy();
     $csp->addAllowedImageDomain('*')->addAllowedMediaDomain('*')->addAllowedConnectDomain('*')->addAllowedFrameDomain('https://youtube.com')->addAllowedFrameDomain('https://www.youtube.com')->addAllowedFrameDomain('https://player.vimeo.com')->addAllowedFrameDomain('https://www.player.vimeo.com');
     $response->setContentSecurityPolicy($csp);
     return $response;
 }
Esempio n. 11
0
 /**
  * @PublicPage
  * @NoCSRFRequired
  *
  * @return TemplateResponse
  */
 public function showPdfViewer()
 {
     $params = ['urlGenerator' => $this->urlGenerator];
     $response = new TemplateResponse($this->appName, 'viewer', $params, 'blank');
     $policy = new ContentSecurityPolicy();
     $policy->addAllowedChildSrcDomain('\'self\'');
     $policy->addAllowedFontDomain('data:');
     $response->setContentSecurityPolicy($policy);
     return $response;
 }
Esempio n. 12
0
 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  */
 public function index()
 {
     $bookmarkleturl = $this->urlgenerator->getAbsoluteURL('index.php/apps/bookmarks/bookmarklet');
     $params = array('user' => $this->userId, 'bookmarkleturl' => $bookmarkleturl);
     $policy = new ContentSecurityPolicy();
     $policy->addAllowedFrameDomain("'self'");
     $response = new TemplateResponse('bookmarks', 'main', $params);
     $response->setContentSecurityPolicy($policy);
     return $response;
 }
Esempio n. 13
0
 public function testShowPdfViewer()
 {
     $params = ['urlGenerator' => $this->urlGenerator];
     $expectedResponse = new TemplateResponse($this->appName, 'viewer', $params, 'blank');
     $policy = new ContentSecurityPolicy();
     $policy->addAllowedChildSrcDomain('\'self\'');
     $policy->addAllowedFontDomain('data:');
     $expectedResponse->setContentSecurityPolicy($policy);
     $this->assertEquals($expectedResponse, $this->controller->showPdfViewer());
 }
 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  * @PublicPage
  */
 public function webRTC()
 {
     $params = ['is_guest' => $this->userid === null];
     $response = new TemplateResponse(Settings::APP_ID, 'webrtc', $params, $this->userid === null ? 'empty' : 'user');
     // Allow to embed iframes
     $csp = new ContentSecurityPolicy();
     //$csp->addAllowedFrameDomain('*');
     $csp->addAllowedFrameDomain(implode(' ', Security::getAllowedIframeDomains()));
     $response->setContentSecurityPolicy($csp);
     return $response;
 }
Esempio n. 15
0
 /**
  * @NoCSRFRequired
  * @return TemplateResponse
  */
 public function viewApps()
 {
     $params = [];
     $params['experimentalEnabled'] = $this->config->getSystemValue('appstore.experimental.enabled', false);
     $this->navigationManager->setActiveEntry('core_apps');
     $templateResponse = new TemplateResponse($this->appName, 'apps', $params, 'user');
     $policy = new ContentSecurityPolicy();
     $policy->addAllowedImageDomain('https://apps.owncloud.com');
     $templateResponse->setContentSecurityPolicy($policy);
     return $templateResponse;
 }
 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  */
 public function webRTC()
 {
     $params = [];
     $response = new TemplateResponse(Settings::APP_ID, 'webrtc', $params);
     // Allow to embed iframes
     $csp = new ContentSecurityPolicy();
     //$csp->addAllowedFrameDomain('*');
     $csp->addAllowedFrameDomain(implode(' ', Security::getAllowedIframeDomains()));
     $response->setContentSecurityPolicy($csp);
     return $response;
 }
Esempio n. 17
0
 /**
  * @NoAdminRequired
  */
 public function cropPhoto()
 {
     $id = $this->params('id');
     $tmpkey = $this->params('tmpkey');
     $params = array('tmpkey' => $tmpkey, 'id' => $id);
     $csp = new \OCP\AppFramework\Http\ContentSecurityPolicy();
     $csp->addAllowedImageDomain('data:');
     $response = new TemplateResponse($this->appName, 'part.cropphoto', $params, '');
     $response->setContentSecurityPolicy($csp);
     return $response;
 }
Esempio n. 18
0
 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  *
  * @return TemplateResponse renders the index page
  */
 public function index()
 {
     $response = new TemplateResponse($this->appName, 'index', []);
     // set csp rules for ownCloud 8.1
     if (class_exists('OCP\\AppFramework\\Http\\ContentSecurityPolicy')) {
         $csp = new \OCP\AppFramework\Http\ContentSecurityPolicy();
         $csp->addAllowedFrameDomain('\'self\'');
         $response->setContentSecurityPolicy($csp);
     }
     return $response;
 }
Esempio n. 19
0
 public function testIndex()
 {
     $expected = new TemplateResponse($this->appName, 'index', []);
     // set csp rules for ownCloud 8.1
     if (class_exists('OCP\\AppFramework\\Http\\ContentSecurityPolicy')) {
         $csp = new \OCP\AppFramework\Http\ContentSecurityPolicy();
         $csp->addAllowedFrameDomain('\'self\'');
         $expected->setContentSecurityPolicy($csp);
     }
     $response = $this->controller->index();
     $this->assertEquals($expected, $response);
 }
Esempio n. 20
0
 /**
  * @PublicPage
  * @NoCSRFRequired
  *
  * @return TemplateResponse
  */
 public function showReader()
 {
     $params = ['urlGenerator' => $this->urlGenerator];
     $response = new TemplateResponse($this->appName, 'reader', $params, 'blank');
     $csp = new ContentSecurityPolicy();
     $csp->addAllowedChildSrcDomain('\'self\'');
     $csp->addAllowedFrameDomain('\'self\'');
     $csp->addAllowedStyleDomain('blob:');
     $csp->addAllowedImageDomain('blob:');
     $response->setContentSecurityPolicy($csp);
     return $response;
 }
Esempio n. 21
0
 /**
  * CAUTION: the @Stuff turn off security checks, for this page no admin is
  *          required and no CSRF check. If you don't know what CSRF is, read
  *          it up in the docs or you might create a security hole. This is
  *          basically the only required method to add this exemption, don't
  *          add it to any other method if you don't exactly know what it does
  *
  * @NoAdminRequired
  * @NoCSRFRequired
  */
 public function index()
 {
     $params = array('user' => $this->userId);
     $response = new TemplateResponse('ownmnote', 'main', $params);
     $ocVersion = \OCP\Util::getVersion();
     if ($ocVersion[0] > 8 || $ocVersion[0] == 8 && $ocVersion[1] >= 1) {
         $csp = new \OCP\AppFramework\Http\ContentSecurityPolicy();
         $csp->addAllowedImageDomain('data:');
         $response->setContentSecurityPolicy($csp);
     }
     return $response;
 }
Esempio n. 22
0
 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  */
 public function index()
 {
     if (\OC::$server->getAppManager()->isEnabledForUser('calendarplus')) {
         $csp = new \OCP\AppFramework\Http\ContentSecurityPolicy();
         $csp->addAllowedImageDomain(':data');
         $config = \OC::$server->getConfig();
         $response = new TemplateResponse($this->appName, 'index');
         $response->setParams(array('allowShareWithLink' => $config->getAppValue('core', 'shareapi_allow_links', 'yes'), 'mailNotificationEnabled' => $config->getAppValue('core', 'shareapi_allow_mail_notification', 'no'), 'mailPublicNotificationEnabled' => $config->getAppValue('core', 'shareapi_allow_public_notification', 'no'), 'appname' => TasksApp::$appname, 'calappname' => CalendarApp::$appname));
         $response->setContentSecurityPolicy($csp);
     } else {
         \OCP\Util::addStyle($this->appName, 'style');
         $response = new TemplateResponse($this->appName, 'no-calendar-app');
     }
     return $response;
 }
 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  */
 public function index()
 {
     if (substr(\OC_Util::getHumanVersion(), 0, 3) != '8.0') {
         // OC >= 8.1
         $response = new TemplateResponse('passwords', 'main');
         $csp = new ContentSecurityPolicy();
         $csp->addAllowedImageDomain('https://icons.duckduckgo.com');
         $csp->addAllowedImageDomain('https://www.google.com');
         $response->setContentSecurityPolicy($csp);
         return $response;
     } else {
         // OC =< 8.0.4
         return new TemplateResponse('passwords', 'main');
     }
 }
Esempio n. 24
0
 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  *
  * @return TemplateResponse
  */
 public function index()
 {
     $lastViewedNote = (int) $this->settings->getUserValue($this->userId, $this->appName, 'notesLastViewedNote');
     // check if note exists
     try {
         $this->notesService->get($lastViewedNote, $this->userId);
     } catch (NoteDoesNotExistException $ex) {
         $lastViewedNote = 0;
     }
     $response = new TemplateResponse($this->appName, 'main', ['lastViewedNote' => $lastViewedNote]);
     $csp = new ContentSecurityPolicy();
     $csp->addAllowedImageDomain('*');
     $response->setContentSecurityPolicy($csp);
     return $response;
 }
Esempio n. 25
0
 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  */
 public function index()
 {
     \OC::$server->getNavigationManager()->setActiveEntry('documents_index');
     $maxUploadFilesize = \OCP\Util::maxUploadFilesize("/");
     $response = new TemplateResponse('documents', 'documents', ['enable_previews' => $this->settings->getSystemValue('enable_previews', true), 'useUnstable' => $this->settings->getAppValue('documents', 'unstable', 'false'), 'savePath' => $this->settings->getUserValue($this->uid, 'documents', 'save_path', '/'), 'uploadMaxFilesize' => $maxUploadFilesize, 'uploadMaxHumanFilesize' => \OCP\Util::humanFileSize($maxUploadFilesize), 'allowShareWithLink' => $this->settings->getAppValue('core', 'shareapi_allow_links', 'yes')]);
     $policy = new ContentSecurityPolicy();
     //$policy->addAllowedChildSrcDomain('\'self\' http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js http://cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.12/jquery.mousewheel.min.js \'unsafe-eval\'');
     $policy->addAllowedScriptDomain('\'self\' http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js http://cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.12/jquery.mousewheel.min.js \'unsafe-eval\'');
     $policy->addAllowedFrameDomain('\'self\' http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js http://cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.12/jquery.mousewheel.min.js \'unsafe-eval\'');
     $policy->addAllowedConnectDomain('ws://' . $_SERVER['SERVER_NAME'] . ':9980');
     $policy->addAllowedImageDomain('*');
     $policy->allowInlineScript(true);
     $policy->addAllowedFontDomain('data:');
     $response->setContentSecurityPolicy($policy);
     return $response;
 }
Esempio n. 26
0
 /**
  * CAUTION: the @Stuff turn off security checks, for this page no admin is
  *          required and no CSRF check. If you don't know what CSRF is, read
  *          it up in the docs or you might create a security hole. This is
  *          basically the only required method to add this exemption, don't
  *          add it to any other method if you don't exactly know what it does
  *
  * @NoAdminRequired
  * @NoCSRFRequired
  */
 public function index()
 {
     $params = array('user' => $this->userId, 'devices' => $this->deviceMapper->findAll($this->userId));
     $response = new TemplateResponse('maps', 'main', $params);
     if (class_exists('OCP\\AppFramework\\Http\\ContentSecurityPolicy')) {
         $csp = new \OCP\AppFramework\Http\ContentSecurityPolicy();
         // map tiles
         $csp->addAllowedImageDomain('http://*.mqcdn.com');
         // marker icons
         $csp->addAllowedImageDomain('https://api.tiles.mapbox.com');
         // inline images
         $csp->addAllowedScriptDomain('data:');
         $response->setContentSecurityPolicy($csp);
     }
     return $response;
     // templates/main.php
 }
 /**
  * @PublicPage
  * @NoCSRFRequired
  *
  * @return TemplateResponse
  */
 public function showLibreOnline()
 {
     $params = ['urlGenerator' => $this->urlGenerator];
     $response = new TemplateResponse($this->appName, 'online', $params, 'blank');
     $policy = new ContentSecurityPolicy();
     $policy->addAllowedChildSrcDomain('*');
     $policy->addAllowedScriptDomain("*");
     $policy->addAllowedConnectDomain("*");
     $policy->addAllowedStyleDomain("*");
     $policy->addAllowedMediaDomain("*");
     $policy->addAllowedFontDomain('*');
     $policy->addAllowedImageDomain('*');
     $policy->addAllowedFrameDomain('*');
     $policy->addAllowedObjectDomain('*');
     $policy->allowInlineScript(True);
     $policy->allowInlineStyle(True);
     $policy->allowEvalScript(True);
     $response->setContentSecurityPolicy($policy);
     return $response;
 }
Esempio n. 28
0
    /**
     * @NoAdminRequired
     * @NoCSRFRequired
     */
    public function index() {
        $status = $this->statusService->getStatus();
        $response = new TemplateResponse($this->appName, 'index', [
            'cronWarning' => $status['warnings']['improperlyConfiguredCron']
        ]);

        // set csp rules for ownCloud 8.1
        if (class_exists('OCP\AppFramework\Http\ContentSecurityPolicy')) {
            $csp = new \OCP\AppFramework\Http\ContentSecurityPolicy();
            $csp->addAllowedImageDomain('*');
            $csp->addAllowedMediaDomain('*');
            $csp->addAllowedFrameDomain('https://youtube.com');
            $csp->addAllowedFrameDomain('https://www.youtube.com');
            $csp->addAllowedFrameDomain('https://player.vimeo.com');
            $csp->addAllowedFrameDomain('https://www.player.vimeo.com');
            $response->setContentSecurityPolicy($csp);
        }

        return $response;
    }
 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  */
 public function index()
 {
     $imppTypes = Properties::getTypesForProperty('IMPP');
     $adrTypes = Properties::getTypesForProperty('ADR');
     $phoneTypes = Properties::getTypesForProperty('TEL');
     $emailTypes = Properties::getTypesForProperty('EMAIL');
     $cloudTypes = Properties::getTypesForProperty('CLOUD');
     $ims = Properties::getIMOptions();
     $imProtocols = array();
     foreach ($ims as $name => $values) {
         $imProtocols[$name] = $values['displayname'];
     }
     $maxUploadFilesize = $this->utilFactory->maxUploadFilesize('/');
     \OCP\Util::addScript('placeholder', null);
     \OCP\Util::addScript('../vendor/blueimp-md5/js/md5', null);
     \OCP\Util::addScript('jquery.avatar', null);
     \OCP\Util::addScript('avatar', null);
     $response = new TemplateResponse($this->appName, 'contacts');
     $response->setParams(['uploadMaxFilesize' => $maxUploadFilesize, 'uploadMaxHumanFilesize' => $this->utilFactory->humanFileSize($maxUploadFilesize), 'phoneTypes' => $phoneTypes, 'emailTypes' => $emailTypes, 'cloudTypes' => $cloudTypes, 'adrTypes' => $adrTypes, 'imppTypes' => $imppTypes, 'imProtocols' => $imProtocols, 'importManager' => $this->importManager]);
     return $response;
 }
Esempio n. 30
0
 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  */
 public function index()
 {
     $iosSupport = $this->configInfo->getUserValue($this->userId, $this->appName, 'iossupport');
     $activeView = $this->configInfo->getUserValue($this->userId, $this->appName, 'view', 'listview');
     $lastSelectedBook = $this->configInfo->getUserValue($this->userId, $this->appName, 'currentbook', 0);
     $maxUploadFilesize = \OCP\Util::maxUploadFilesize('/');
     $addressbooks = Addressbook::all($this->userId);
     if (count($addressbooks) == 0) {
         Addressbook::addDefault($this->userId);
         $addressbooks = Addressbook::all($this->userId);
     }
     //ContactsApp::addingDummyContacts(1000);
     $params = ['uploadMaxFilesize' => $maxUploadFilesize, 'uploadMaxHumanFilesize' => \OCP\Util::humanFileSize($maxUploadFilesize), 'iossupport' => $iosSupport, 'addressbooks' => $addressbooks, 'activeView' => $activeView, 'lastSelectedBook' => $lastSelectedBook];
     $csp = new \OCP\AppFramework\Http\ContentSecurityPolicy();
     $csp->addAllowedImageDomain('*');
     $csp->addAllowedFrameDomain('*');
     $response = new TemplateResponse($this->appName, 'index');
     $response->setContentSecurityPolicy($csp);
     $response->setParams($params);
     return $response;
 }