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']); } } }
function print_collection_list($list) { foreach ($list as $collection) { if ($collection instanceof OCA\News\Folder) { $tmpl_folder = new OCP\Template("news", "part.listfolder"); $tmpl_folder->assign('folder', $collection); $tmpl_folder->printpage(); print_collection_list($collection->getChildren()); echo '</ul></li>'; } elseif ($collection instanceof OCA\News\Feed) { //onhover $(element).attr('id', 'newID'); $itemmapper = new OCA\News\ItemMapper(); $items = $itemmapper->findByFeedId($collection->getId()); $counter = 0; foreach ($items as $item) { if (!$item->isRead()) { ++$counter; } } $tmpl_feed = new OCP\Template("news", "part.listfeed"); $tmpl_feed->assign('feed', $collection); $tmpl_feed->assign('unreadItemsCount', $counter); $tmpl_feed->printpage(); } else { //TODO:handle error in this case } } }
/** * Get the template for a specific activity-event in the activities * * @param array $activity An array with all the activity data in it * @param return string */ public static function show($activity) { $tmpl = new \OCP\Template('activity', 'activity.box'); $tmpl->assign('formattedDate', \OCP\Util::formatDate($activity['timestamp'])); $tmpl->assign('formattedTimestamp', \OCP\relative_modified_date($activity['timestamp'])); $tmpl->assign('user', $activity['user']); $tmpl->assign('displayName', \OCP\User::getDisplayName($activity['user'])); if ($activity['app'] === 'files') { // We do not link the subject as we create links for the parameters instead $activity['link'] = ''; } $tmpl->assign('event', $activity); if ($activity['file']) { $rootView = new \OC\Files\View(''); $exist = $rootView->file_exists('/' . $activity['user'] . '/files' . $activity['file']); $is_dir = $rootView->is_dir('/' . $activity['user'] . '/files' . $activity['file']); unset($rootView); // show a preview image if the file still exists if (!$is_dir && $exist) { $tmpl->assign('previewLink', \OCP\Util::linkTo('files', 'index.php', array('dir' => dirname($activity['file'])))); $tmpl->assign('previewImageLink', \OCP\Util::linkToRoute('core_ajax_preview', array('file' => $activity['file'], 'x' => 150, 'y' => 150))); } else { if ($exist) { $tmpl->assign('previewLink', \OCP\Util::linkTo('files', 'index.php', array('dir' => $activity['file']))); $tmpl->assign('previewImageLink', \OC_Helper::mimetypeIcon('dir')); $tmpl->assign('previewLinkIsDir', true); } } } return $tmpl->fetchPage(); }
/** * Binds variables to the template and prints it * The following values are always assigned: userId, trans * @param $arguments an array with arguments in $templateVar => $content * @param $template the name of the template * @param $safeParams template parameters which should not be escaped * @param $fullPage if true, it will render a full page, otherwise only a part * defaults to true */ protected function render($template, $arguments = array(), $safeParams = array(), $fullPage = true) { if ($fullPage) { $template = new \OCP\Template('news', $template, 'user'); } else { $template = new \OCP\Template('news', $template); } foreach ($arguments as $key => $value) { if (array_key_exists($key, $safeParams)) { $template->assign($key, $value, false); } else { $template->assign($key, $value); } } $template->assign('userId', $this->userId); $template->assign('trans', $this->trans); $template->printPage(); }
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); } }
/** * Get the users we want to send an email to * * @param null|string $forceActive Navigation entry that should be marked as active * @return \OCP\Template */ public function getTemplate($forceActive = null) { $active = $forceActive ?: $this->active; $template = new \OCP\Template('activity', 'navigation', ''); $entries = $this->getLinkList(); $additionalEntries = \OC::$server->getActivityManager()->getNavigation(); $entries['apps'] = array_merge($entries['apps'], $additionalEntries['apps']); $entries['top'] = array_merge($entries['top'], $additionalEntries['top']); if (sizeof($entries['apps']) === 1) { // If there is only the files app, we simply do not show it, // as it is the same as the 'all' filter. $entries['apps'] = array(); } $template->assign('activeNavigation', $active); $template->assign('navigations', $entries); $template->assign('rssLink', $this->rssLink); return $template; }
/** * Returns the rendered html * @return the rendered html */ public function render() { if ($this->renderAs === 'blank') { $template = new \OCP\Template($this->appName, $this->templateName); } else { $template = new \OCP\Template($this->appName, $this->templateName, $this->renderAs); } foreach ($this->params as $key => $value) { $template->assign($key, $value, false); } return $template->fetchPage(); }
/** * 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); } }
/** * @brief serve opds feed for given directory * * @param string $dir full path to directory * @param int $id requested id */ public static function serveFeed($dir, $id) { if (isset($_SERVER['HTTP_ACCEPT']) && stristr($_SERVER['HTTP_ACCEPT'], 'application/atom+xml')) { header('Content-Type: application/atom+xml'); } else { header('Content-Type: text/xml; charset=UTF-8'); } $sortAttribute = 'name'; $sortDirection = false; $defaults = new \OC_Defaults(); $tmpl = new \OCP\Template('files_opds', 'feed'); $tmpl->assign('files', Files::formatFileInfos(Files::getFiles($dir, $sortAttribute, $sortDirection))); $tmpl->assign('bookshelf', Files::formatFileInfos(Bookshelf::get())); $tmpl->assign('bookshelf-count', Bookshelf::count()); $tmpl->assign('feed_id', self::getFeedId()); $tmpl->assign('id', $id); $tmpl->assign('dir', $dir); $tmpl->assign('user', \OCP\User::getDisplayName()); $tmpl->assign('feed_title', Config::get('feed_title', \OCP\User::getDisplayName() . "'s Library")); $tmpl->assign('feed_subtitle', Config::getApp('feed_subtitle', $defaults->getName() . " OPDS catalog")); $tmpl->assign('feed_updated', time()); $tmpl->printPage(); }
* 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 along with this library. If not, see <http://www.gnu.org/licenses/>. */ OC_Util::checkAdminUser(); OCP\Util::addScript('files_external', 'settings'); OCP\Util::addscript('3rdparty', 'chosen/chosen.jquery.min'); OCP\Util::addStyle('files_external', 'settings'); OCP\Util::addStyle('3rdparty', 'chosen/chosen'); $backends = OC_Mount_Config::getBackends(); $personal_backends = array(); $enabled_backends = explode(',', OCP\Config::getAppValue('files_external', 'user_mounting_backends', '')); foreach ($backends as $class => $backend) { if ($class != '\\OC\\Files\\Storage\\Local') { $personal_backends[$class] = array('backend' => $backend['backend'], 'enabled' => in_array($class, $enabled_backends)); } } $tmpl = new OCP\Template('files_external', 'settings'); $tmpl->assign('isAdminPage', true); $tmpl->assign('mounts', OC_Mount_Config::getSystemMountPoints()); $tmpl->assign('backends', $backends); $tmpl->assign('personal_backends', $personal_backends); $tmpl->assign('groups', OC_Group::getGroups()); $tmpl->assign('users', OCP\User::getUsers()); $tmpl->assign('userDisplayNames', OC_User::getDisplayNames()); $tmpl->assign('dependencies', OC_Mount_Config::checkDependencies()); $tmpl->assign('allowUserMounting', OCP\Config::getAppValue('files_external', 'allow_user_mounting', 'yes')); return $tmpl->fetchPage();
<?php $tmpl = new OCP\Template('contacts', 'settings'); $tmpl->assign('addressbooks', OC_Contacts_Addressbook::all(OCP\USER::getUser())); $tmpl->printPage();
* */ OC_Util::checkAdminUser(); $params = array('cas_server_version', 'cas_server_hostname', 'cas_server_port', 'cas_server_path', 'cas_group_mapping', 'cas_group_root', 'cas_aliasName'); OCP\Util::addscript('user_cas', 'settings'); if ($_POST) { foreach ($params as $param) { if (isset($_POST[$param])) { OCP\Config::setAppValue('user_cas', $param, $_POST[$param]); } elseif ('cas_autocreate' == $param) { OCP\Config::setAppValue('user_cas', $param, 0); } elseif ('cas_update_user_data' == $param) { OCP\Config::setAppValue('user_cas', $param, 0); } } } // fill template $tmpl = new OCP\Template('user_cas', 'settings'); foreach ($params as $param) { $value = htmlentities(OCP\Config::getAppValue('user_cas', $param, '')); $tmpl->assign($param, $value); } // settings with default values $tmpl->assign('cas_server_version', OCP\Config::getAppValue('user_cas', 'cas_server_version', '2.0')); $tmpl->assign('cas_server_hostname', OCP\Config::getAppValue('user_cas', 'cas_server_hostname', 'ident.domain.fr')); $tmpl->assign('cas_server_port', OCP\Config::getAppValue('user_cas', 'cas_server_port', '443')); $tmpl->assign('cas_server_path', OCP\Config::getAppValue('user_cas', 'cas_server_path', '/cas')); $tmpl->assign('cas_group_mapping', OCP\Config::getAppValue('user_cas', 'cas_group_mapping', '')); $tmpl->assign('cas_group_root', OCP\Config::getAppValue('user_cas', 'cas_group_root', '')); $tmpl->assign('cas_aliasName', OCP\Config::getAppValue('user_cas', 'cas_aliasName', '')); return $tmpl->fetchPage();
<?php \OCP\User::checkLoggedIn(); \OCP\App::checkAppEnabled('fc_mail_attachments'); \OCP\Util::addscript('fc_mail_attachments', 'utils'); \OCP\Util::addscript('fc_mail_attachments', 'account'); //OCP\Util::addstyle('fc_mail_attachments', 'style'); $user = OCP\User::getUser(); $tmpl = new OCP\Template('fc_mail_attachments', 'settings'); $query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*fc_mail_attachments` WHERE user = ?'); $results = $query->execute(array($user))->fetchAll(); if (sizeof($results)) { $conf = $results[0]; $tmpl->assign('dir', $conf['dir']); $tmpl->assign('mail_host', $conf['mail_host']); $tmpl->assign('mail_port', $conf['mail_port']); $tmpl->assign('mail_security', $conf['mail_security']); $tmpl->assign('mail_user', $conf['mail_user']); } return $tmpl->fetchPage();
<?php /** * ownCloud - eBook reader application * * @author Priyanka Menghani * */ OCP\User::checkLoggedIn(); OCP\App::checkAppEnabled('reader'); OCP\App::setActiveNavigationEntry('reader_index'); OCP\Util::addscript('reader', 'integrate'); OCP\Util::addscript('reader', 'pdf'); OCP\Util::addStyle('reader', 'reader'); // Get the current directory from window url. $dir = empty($_GET['dir']) ? '/' : $_GET['dir']; $tmpl = new OCP\Template('reader', 'index', 'user'); $tmpl->assign('dir', $dir); $tmpl->printPage();
* You should have received a copy of the GNU Affero General Public * License along with this library. * If not, see <http://www.gnu.org/licenses/>. * */ /** * @file content.php * Content of the imprint as configured * @access public */ // Session checks // \OCP\User::checkLoggedIn(); \OCP\App::checkAppEnabled('imprint'); // prepare content if (FALSE === ($content = \OCP\Config::getAppValue('imprint', 'content', FALSE))) { $tmpl = new \OCP\Template('imprint', 'tmpl_dummy'); \OCP\Util::addStyle('imprint', 'reference'); } else { // detect type of stored content and process accordingly if (strlen($content) != strlen(strip_tags($content))) { $processed_content = $content; } else { $processed_content = sprintf("<pre>\n%s\n</pre>", $content); } // output processed content \OCP\Util::addStyle('imprint', 'content'); $tmpl = new \OCP\Template('imprint', 'tmpl_content'); $tmpl->assign('processed-content', $processed_content); } // render template $tmpl->printPage();
$upload_max_filesize = OCP\Util::computerFileSize(ini_get('upload_max_filesize')); $post_max_size = OCP\Util::computerFileSize(ini_get('post_max_size')); $maxUploadFilesize = OCP\Util::humanFileSize(min($upload_max_filesize, $post_max_size)); if ($_POST && OC_Util::isCallRegistered()) { if (isset($_POST['maxUploadSize'])) { if (($setMaxSize = OC_Files::setUploadLimit(OCP\Util::computerFileSize($_POST['maxUploadSize']))) !== false) { $maxUploadFilesize = OCP\Util::humanFileSize($setMaxSize); } } } OCP\App::setActiveNavigationEntry("files_administration"); $htaccessWritable = is_writable(OC::$SERVERROOT . '/.htaccess'); $tmpl = new OCP\Template('files', 'admin'); /* * extended version * + only users with permission can delete files(in the files app only) * + file type restriction */ $filetyprestriction = \OC_Appconfig::getValue('core', 'filetyperes_enabled', 'no'); $allowed_types = \OC_Appconfig::getValue('core', 'allowed_filetypes', ''); $deleteGroupsList = \OC_Appconfig::getValue('core', 'delete', ''); $deleteGroupsList = explode(',', $deleteGroupsList); $tmpl->assign('deleteGroupsList', implode('|', $deleteGroupsList)); $tmpl->assign('fileTypeRes', $filetyprestriction); $tmpl->assign('allowed_filetypes', $allowed_types); $tmpl->assign('uploadChangable', $htaccessWorking and $htaccessWritable); $tmpl->assign('uploadMaxFilesize', $maxUploadFilesize); // max possible makes only sense on a 32 bit system $tmpl->assign('displayMaxPossibleUploadSize', PHP_INT_SIZE === 4); $tmpl->assign('maxPossibleUploadSize', OCP\Util::humanFileSize(PHP_INT_MAX)); return $tmpl->fetchPage();
if (sizeof($users) !== 1) { // User not found header('HTTP/1.0 404 Not Found'); exit; } // Token found login as that user \OC_User::setUserId(array_shift($users)); $forceUserLogout = true; } // check if the user has the right permissions. \OCP\User::checkLoggedIn(); // rss is of content type text/xml if (isset($_SERVER['HTTP_ACCEPT']) && stristr($_SERVER['HTTP_ACCEPT'], 'application/rss+xml')) { header('Content-Type: application/rss+xml'); } else { header('Content-Type: text/xml; charset=UTF-8'); } // generate and show the rss feed $l = \OCP\Util::getL10N('activity'); $data = new \OCA\Activity\Data(\OC::$server->getActivityManager()); $groupHelper = new \OCA\Activity\GroupHelper(\OC::$server->getActivityManager(), new \OCA\Activity\DataHelper(\OC::$server->getActivityManager(), new \OCA\Activity\ParameterHelper(new \OC\Files\View(''), $l), $l), false); $tmpl = new \OCP\Template('activity', 'rss'); $tmpl->assign('rssLang', \OC_Preferences::getValue(\OCP\User::getUser(), 'core', 'lang')); $tmpl->assign('rssLink', \OCP\Util::linkToAbsolute('activity', 'rss.php')); $tmpl->assign('rssPubDate', date('r')); $tmpl->assign('user', \OCP\User::getUser()); $tmpl->assign('activities', $data->read($groupHelper, 0, 30, 'all')); $tmpl->printPage(); if ($forceUserLogout) { \OC_User::logout(); }
* ownCloud - sipgate * * This file is licensed under the Affero General Public License version 3 or * later. See the COPYING file. * * @author Raphael Pigulla <*****@*****.**> * @copyright Raphael Pigulla 2015 */ use OCP\AppFramework\App; use OCA\Sipgate\Service\UserSettings; $app = new App('sipgate'); $container = $app->getContainer(); /** @var OCP\IDateTimeZone $timeZone */ $timeZone = $container->query('OCP\\IDateTimeZone'); /** @var OCA\Sipgate\Service\UserSettings $userSettings */ $userSettings = $container->query('OCA\\Sipgate\\Service\\UserSettings'); $lastUpdated = $userSettings->getLastUpdated(); $lastUpdated->setTimezone($timeZone->getTimeZone()); $template = new \OCP\Template('sipgate', 'settings-personal'); $template->assign('username', $userSettings->getUsername()); $template->assign('password', $userSettings->getPassword()); $template->assign('retention', $userSettings->getRetention()); $template->assign('syncPeriod', $userSettings->getSyncPeriod()); $template->assign('localUris', implode(' ', $userSettings->getLocalURIs())); $template->assign('defaultCountryCode', $userSettings->getDefaultCountryCode()); $template->assign('lastUpdated', $lastUpdated->format('Y-m-d H:i:s')); $template->assign('SYNC_PERIOD_MIN', UserSettings::SYNC_PERIOD_MIN); $template->assign('SYNC_PERIOD_MAX', UserSettings::SYNC_PERIOD_MAX); $template->assign('RETENTION_MIN', UserSettings::RETENTION_MIN); $template->assign('RETENTION_MAX', UserSettings::RETENTION_MAX); return $template->fetchPage();
* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE * License as published by the Free Software Foundation; either * version 3 of the License, or any later version. * * This library 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 Lesser General Public * License along with this library. If not, see <http://www.gnu.org/licenses/>. * */ require_once 'lib/external.php'; OCP\User::checkLoggedIn(); if (isset($_GET['id'])) { $id = $_GET['id']; $id = (int) $id; $sites = OC_External::getSites(); if (sizeof($sites) >= $id) { $url = $sites[$id - 1][1]; OCP\App::setActiveNavigationEntry('external_index' . $id); $tmpl = new OCP\Template('external', 'frame', 'user'); //overwrite x-frame-options $tmpl->addHeader('X-Frame-Options', 'ALLOW-FROM *'); $tmpl->assign('url', $url); $tmpl->printPage(); } }
* 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 along with this library. If not, see <http://www.gnu.org/licenses/>. * */ namespace OCA\Documents; \OCP\User::checkLoggedIn(); \OCP\JSON::checkAppEnabled('documents'); \OCP\App::setActiveNavigationEntry('documents_index'); \OCP\Util::addStyle('documents', 'style'); \OCP\Util::addStyle('documents', '3rdparty/webodf/dojo-app'); \OCP\Util::addScript('documents', 'documents'); \OCP\Util::addScript('files', 'file-upload'); \OCP\Util::addScript('files', 'jquery.iframe-transport'); \OCP\Util::addScript('files', 'jquery.fileupload'); $tmpl = new \OCP\Template('documents', 'documents', 'user'); $previewsEnabled = \OC::$server->getConfig()->getSystemValue('enable_previews', true); $unstable = \OCP\Config::getAppValue('documents', 'unstable', 'false'); $maxUploadFilesize = \OCP\Util::maxUploadFilesize("/"); $savePath = \OCP\Config::getUserValue(\OCP\User::getUser(), 'documents', 'save_path', '/'); $tmpl->assign('enable_previews', $previewsEnabled); $tmpl->assign('useUnstable', $unstable); $tmpl->assign('uploadMaxFilesize', $maxUploadFilesize); $tmpl->assign('uploadMaxHumanFilesize', \OCP\Util::humanFileSize($maxUploadFilesize)); $tmpl->assign('savePath', $savePath); $tmpl->assign("allowShareWithLink", \OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes')); $tmpl->printPage();
<?php /** * Copyright (c) 2011 Thomas Tanghus <*****@*****.**> * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('contacts'); $books = OC_Contacts_Addressbook::all(OCP\USER::getUser()); $tmpl = new OCP\Template("contacts", "part.selectaddressbook"); $tmpl->assign('addressbooks', $books); $page = $tmpl->fetchPage(); OCP\JSON::success(array('data' => array('page' => $page)));
if (sizeof($users) !== 1) { // User not found header('HTTP/1.0 404 Not Found'); exit; } // Token found login as that user \OC_User::setUserId(array_shift($users)); $forceUserLogout = true; } // check if the user has the right permissions. \OCP\User::checkLoggedIn(); // rss is of content type text/xml if (isset($_SERVER['HTTP_ACCEPT']) && stristr($_SERVER['HTTP_ACCEPT'], 'application/rss+xml')) { header('Content-Type: application/rss+xml'); } else { header('Content-Type: text/xml; charset=UTF-8'); } // generate and show the rss feed $l = \OCP\Util::getL10N('activity'); $data = new \OCA\Activity\Data(\OC::$server->getActivityManager()); $groupHelper = new \OCA\Activity\GroupHelper(\OC::$server->getActivityManager(), new \OCA\Activity\DataHelper(\OC::$server->getActivityManager(), new \OCA\Activity\ParameterHelper(new \OC\Files\View(''), \OC::$server->getConfig(), $l), $l), false); $tmpl = new \OCP\Template('activity', 'rss'); $tmpl->assign('rssLang', \OC_Preferences::getValue(\OCP\User::getUser(), 'core', 'lang')); $tmpl->assign('rssLink', \OC::$server->getURLGenerator()->getAbsoluteURL(\OC::$server->getURLGenerator()->linkToRoute('activity.rss'))); $tmpl->assign('rssPubDate', date('r')); $tmpl->assign('user', \OCP\User::getUser()); $tmpl->assign('activities', $data->read($groupHelper, 0, 30, 'all')); $tmpl->printPage(); if ($forceUserLogout) { \OCP\User::logout(); }
/** * Returns the rendered html * @return string the rendered html * @since 6.0.0 */ public function render() { // \OCP\Template needs an empty string instead of 'blank' for an unwrapped response $renderAs = $this->renderAs === 'blank' ? '' : $this->renderAs; $template = new \OCP\Template($this->appName, $this->templateName, $renderAs); foreach ($this->params as $key => $value) { $template->assign($key, $value); } return $template->fetchPage(); }
<?php /** * ownCloud - Updater plugin * * @author Victor Dubiniuk * @copyright 2012-2013 Victor Dubiniuk victor.dubiniuk@gmail.com * * This file is licensed under the Affero General Public License version 3 or * later. */ namespace OCA\Updater; \OCP\User::checkAdminUser(); \OCP\Util::addScript(App::APP_ID, '3rdparty/angular'); \OCP\Util::addScript(App::APP_ID, 'app'); \OCP\Util::addScript(App::APP_ID, 'controllers'); \OCP\Util::addStyle(App::APP_ID, 'updater'); if (!@file_exists(App::getBackupBase())) { Helper::mkdir(App::getBackupBase()); } $data = App::getFeed(); $isNewVersionAvailable = isset($data['version']) && $data['version'] != '' && $data['version'] !== array(); $tmpl = new \OCP\Template(App::APP_ID, 'admin'); $lastCheck = \OC_Appconfig::getValue('core', 'lastupdatedat'); $tmpl->assign('checkedAt', \OCP\Util::formatDate($lastCheck)); $tmpl->assign('isNewVersionAvailable', $isNewVersionAvailable ? 'true' : 'false'); $tmpl->assign('channels', Channel::getChannels()); $tmpl->assign('currentChannel', Channel::getCurrentChannel()); $tmpl->assign('version', isset($data['versionstring']) ? $data['versionstring'] : ''); return $tmpl->fetchPage();
* ownCloud - Addressbook * * @author Thomas Tanghus * @copyright 2012 Thomas Tanghus <*****@*****.**> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE * License as published by the Free Software Foundation; either * version 3 of the License, or any later version. * * This library 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 along with this library. If not, see <http://www.gnu.org/licenses/>. * */ // Init owncloud // Check if we are a user OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('contacts'); $tmp_path = $_GET['tmp_path']; $id = $_GET['id']; OCP\Util::writeLog('contacts', 'ajax/cropphoto.php: tmp_path: ' . $tmp_path . ', exists: ' . file_exists($tmp_path), OCP\Util::DEBUG); $tmpl = new OCP\Template("contacts", "part.cropphoto"); $tmpl->assign('tmp_path', $tmp_path); $tmpl->assign('id', $id); $page = $tmpl->fetchPage(); OCP\JSON::success(array('data' => array('page' => $page)));
* 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/> * */ OCP\User::checkAdminUser(); $htaccessWorking = getenv('htaccessWorking') == 'true'; $upload_max_filesize = OCP\Util::computerFileSize(ini_get('upload_max_filesize')); $post_max_size = OCP\Util::computerFileSize(ini_get('post_max_size')); $maxUploadFilesize = OCP\Util::humanFileSize(min($upload_max_filesize, $post_max_size)); if ($_POST && OC_Util::isCallRegistered()) { if (isset($_POST['maxUploadSize'])) { if (($setMaxSize = OC_Files::setUploadLimit(OCP\Util::computerFileSize($_POST['maxUploadSize']))) !== false) { $maxUploadFilesize = OCP\Util::humanFileSize($setMaxSize); } } } $htaccessWritable = is_writable(OC::$SERVERROOT . '/.htaccess'); $tmpl = new OCP\Template('files', 'admin'); $tmpl->assign('uploadChangable', $htaccessWorking and $htaccessWritable); $tmpl->assign('uploadMaxFilesize', $maxUploadFilesize); // max possible makes only sense on a 32 bit system $tmpl->assign('displayMaxPossibleUploadSize', PHP_INT_SIZE === 4); $tmpl->assign('maxPossibleUploadSize', OCP\Util::humanFileSize(PHP_INT_MAX)); return $tmpl->fetchPage();
<?php /** * ownCloud - gsync plugin * * @author Victor Dubiniuk * @copyright 2012-2013 Victor Dubiniuk victor.dubiniuk@gmail.com * * This file is licensed under the Affero General Public License version 3 or * later. */ namespace OCA_Gsync; App::initController(); \OCP\Util::addScript(App::APP_ID, 'settings'); $info = \OCP\App::getAppInfo(App::APP_ID); $tmpl = new \OCP\Template(App::APP_ID, 'settings'); $tmpl->assign(App::GOOGLE_CLIENT_ID, App::getClientId()); $tmpl->assign(App::GOOGLE_SECRET, App::getSecret()); $tmpl->assign(App::GOOGLE_REFRESH_TOKEN, App::getRefreshToken()); $tmpl->assign('gsync_redirect', App::getRedirectUri()); $tmpl->assign('app_version', @$info['version']); return $tmpl->fetchPage();
<?php /** * Copyright (c) 2011 Bart Visscher <*****@*****.**> * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ $tmpl = new OCP\Template('calendar', 'settings'); $timezone = OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezone', ''); $tmpl->assign('timezone', $timezone); $tmpl->assign('timezones', DateTimeZone::listIdentifiers()); $tmpl->assign('calendars', OC_Calendar_Calendar::allCalendars(OCP\USER::getUser()), false); OCP\Util::addscript('calendar', 'settings'); $tmpl->printPage();
" id="datecontrol_today"/> </form> </li> <li> <a id="newCalendar"><?php p($l->t('New Calendar')); ?> </a> </li> <?php $option_calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser()); for ($i = 0; $i < count($option_calendars); $i++) { print_unescaped("<li data-id='" . OC_Util::sanitizeHTML($option_calendars[$i]['id']) . "'>"); $tmpl = new OCP\Template('calendar', 'part.choosecalendar.rowfields'); $tmpl->assign('calendar', $option_calendars[$i]); if ($option_calendars[$i]['userid'] != OCP\User::getUser()) { $sharedCalendar = OCP\Share::getItemSharedWithBySource('calendar', $option_calendars[$i]['id']); $shared = true; } else { $shared = false; } $tmpl->assign('shared', $shared); $tmpl->printpage(); print_unescaped("</li>"); } ?> <li id="caldav_url_entry"> <input style="display:none;width: 78%;float: left;" type="text" id="caldav_url" title="<?php p($l->t("CalDav Link")); ?>
* @copyright 2012 Jakob Sack <*****@*****.**> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE * License as published by the Free Software Foundation; either * version 3 of the License, or any later version. * * This library 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 along with this library. If not, see <http://www.gnu.org/licenses/>. * */ // Check if we are a user OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('mail'); $accounts = OCA_Mail\App::getFolders(OCP\User::getUser()); // // TODO: error is listed within the accounts // if ($accounts['error']) { OCP\JSON::error(array('data' => array('message' => $accounts['error']))); exit; } $tmpl = new OCP\Template('mail', 'part.folders'); $tmpl->assign('accounts', $accounts); $page = $tmpl->fetchPage(); OCP\JSON::success(array('data' => $page));