public static function showFooter() { echo ' <script src="' . \OCP\Util::linkToAbsolute('revealjs', 'js/reveal.js') . '"></script> <script src="' . \OCP\Util::linkToAbsolute('revealjs', 'js/head.min.js') . '"></script> <script> Reveal.initialize({ // Display controls in the bottom right corner controls: true, // Display a presentation progress bar progress: true, // Push each slide change to the browser history history: false, // Enable keyboard shortcuts for navigation keyboard: true, // Enable the slide overview mode overview: true, // Loop the presentation loop: false, // Number of milliseconds between automatically proceeding to the // next slide, disabled when set to 0 autoSlide: 0, // Enable slide navigation via mouse wheel mouseWheel: true, // Apply a 3D roll to links on hover rollingLinks: true, // Transition style // default/cube/page/concave/linear(2d) transition: "default" }); </script> </body> </html> '; }
protected function addNotificationsForUser($user, $subject, $subjectParams, $path, $isFile, $streamSetting, $emailSetting, $type = Files_Sharing::TYPE_SHARED, $priority = IExtension::PRIORITY_MEDIUM) { if (!$streamSetting && !$emailSetting) { return; } $selfAction = $user === $this->currentUser; $app = $type === Files_Sharing::TYPE_SHARED ? 'sharing_group' : 'files'; $link = Util::linkToAbsolute('files', 'index.php', array('dir' => $isFile ? dirname($path) : $path)); // Add activity to stream if ($streamSetting && (!$selfAction || $this->userSettings->getUserSetting($this->currentUser, 'setting', 'self'))) { $this->activityData->send($app, $subject, $subjectParams, '', array(), $path, $link, $user, $type, $priority); } // Add activity to mail queue if ($emailSetting && (!$selfAction || $this->userSettings->getUserSetting($this->currentUser, 'setting', 'selfemail'))) { $latestSend = time() + $emailSetting; $this->activityData->storeMail($app, $subject, $subjectParams, $user, $type, $latestSend); } }
/** * @NoAdminRequired * @NoCSRFRequired */ public function index () { $mboxes = array( 'PNLConversations' => array( 'label' => 'Conversations', 'phoneNumbers' => $this->smsMapper->getAllPeersPhoneNumbers($this->userId), 'url' => \OCP\Util::linkToAbsolute('index.php', 'apps/ocsms/', array('feed' => 'conversations')) ), 'PNLDrafts' => array( 'label' => 'Drafts', 'phoneNumbers' => array(), 'url' => \OCP\Util::linkToAbsolute('index.php', 'apps/ocsms/', array('feed' => 'drafts')) ) ); $params = array('user' => $this->userId, 'mailboxes' => $mboxes ); return new TemplateResponse($this->appName, 'main', $params); }
public static function showFooter() { echo ' <div class="hint"> <p>Make full screen and use a space bar or arrow keys to navigate</p> </div> <script> if ("ontouchstart" in document.documentElement) { document.querySelector(".hint").innerHTML = "<p>Tap on the left or right to navigate</p>"; } </script> <script src="' . \OCP\Util::linkToAbsolute('impressionist', 'js/impress.js') . '"></script> <script>impress().init();</script> <script> </script> </body></html> '; }
*/ // check if the user has the right permissions to access the activities OCP\User::checkLoggedIn(); OCP\App::checkAppEnabled('activity'); // activate the right navigation entry OCP\App::setActiveNavigationEntry('activity'); // load the needed js scripts and css OCP\Util::addScript('activity', 'jquery.masonry.min'); OCP\Util::addScript('activity', 'jquery.infinitescroll.min'); OCP\Util::addScript('activity', 'script'); OCP\Util::addStyle('activity', 'style'); // get the page that is requested. Needed for endless scrolling if (isset($_GET['page'])) { $page = intval($_GET['page']) - 1; } else { $page = 0; } // get rss url $rsslink = \OCP\Util::linkToAbsolute('activity', 'rss.php'); $nextpage = \OCP\Util::linkToAbsolute('activity', 'index.php', array('page' => $page + 2)); // read activities data $count = 30; $activity = OCA\Activity\Data::read($page * $count, 30); // show activity template $tmpl = new \OCP\Template('activity', 'list', 'user'); $tmpl->assign('rsslink', $rsslink); $tmpl->assign('activity', $activity); if ($page == 0) { $tmpl->assign('nextpage', $nextpage); } $tmpl->printPage();
* License along with this library. If not, see <http://www.gnu.org/licenses/>. */ // This script we have to wrap in a class to pretend it to override t() // and possibly other functions or variables. See below. //\OCP\Util::addScript('secure_container', '3rdparty/sjcl/sjcl'); \OCP\Util::addScript('secure_container', 'container'); \OCP\Util::addScript('secure_container', 'navigation'); \OCP\Util::addScript('secure_container', 'app'); \OCP\Util::addStyle('secure_container', 'style'); $l = \OC_L10N::get('secure_container'); ?> <script type="text/javascript" src="<?php p(\OCP\Util::linkToAbsolute('secure_container', 'js/3rdparty/jswrapper.php', array('app'=> 'sjcl'))); ?>"></script> <div id="app-navigation"> <ul class="level-0 path-childs" id="path-childs-0"> <?php foreach ($_['navigation'] as $k => $path): ?> <?php print_unescaped($this->inc('pathentry', array('path' => $path, 'level'=> 1))); ?> <?php endforeach; ?> </ul> </div> <main id="app-content"> <div id="controls"> <nav class="breadcrumb"> <div class="crumb home svg last" data-dir="0"> <a><img class="svg" src="<?php print(\OCP\Util::imagePath('core', 'places/home.svg')); ?>"></a> </div> </nav>
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(); }
<?php // show toolbar echo '<div id="controls"> <a href="' . \OCP\Util::linkToAbsolute('impress', 'documentation.php') . '" class="button docu">' . $l->t('Documentation') . '</a> </div> '; if (empty($_['list'])) { echo '<div id="emptyfolder">' . $l->t('No Impress files are found in your ownCloud. Please upload a .impress file.') . '</div>'; } else { echo '<table class="impresslist" >'; foreach ($_['list'] as $entry) { echo '<tr><td width="1"><a target="_blank" href="' . \OCP\Util::linkToAbsolute('impress', 'player.php') . '&file=' . urlencode($entry['url']) . '&name=' . urlencode($entry['name']) . '"><img align="left" src="' . \OCP\Util::linkToAbsolute('impress', 'img/impressbig.png') . '"></a></td><td><a target="_blank" href="' . \OCP\Util::linkToAbsolute('impress', 'player.php') . '&file=' . urlencode($entry['url']) . '&name=' . urlencode($entry['name']) . '">' . $entry['name'] . '</a></td><td>' . \OCP\Util::formatDate($entry['mtime']) . '</td><td>' . \OCP\Util::humanFileSize($entry['size']) . '</td></tr>'; } echo '</table>'; }
/** * Adds the activity and email for a user when the settings require it * * @param string $user * @param string $subject * @param array $subjectParams * @param int $fileId * @param string $path * @param bool $isFile If the item is a file, we link to the parent directory * @param bool $streamSetting * @param int $emailSetting * @param string $type */ protected function addNotificationsForUser($user, $subject, $subjectParams, $fileId, $path, $isFile, $streamSetting, $emailSetting, $type = Files_Sharing::TYPE_SHARED) { if (!$streamSetting && !$emailSetting) { return; } $selfAction = $user === $this->currentUser; $app = $type === Files_Sharing::TYPE_SHARED ? 'files_sharing' : 'files'; $link = Util::linkToAbsolute('files', 'index.php', array('dir' => $isFile ? dirname($path) : $path)); $objectType = $fileId ? 'files' : ''; $event = $this->manager->generateEvent(); $event->setApp($app)->setType($type)->setAffectedUser($user)->setAuthor($this->currentUser)->setTimestamp(time())->setSubject($subject, $subjectParams)->setObject($objectType, $fileId, $path)->setLink($link); // Add activity to stream if ($streamSetting && (!$selfAction || $this->userSettings->getUserSetting($this->currentUser, 'setting', 'self'))) { $this->activityData->send($event); } // Add activity to mail queue if ($emailSetting && (!$selfAction || $this->userSettings->getUserSetting($this->currentUser, 'setting', 'selfemail'))) { $latestSend = time() + $emailSetting; $this->activityData->storeMail($event, $latestSend); } }
* 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/> * */ OC_Util::checkLoggedIn(); // Load the files we need OC_Util::addStyle("settings", "settings"); \OC::$server->getNavigationManager()->setActiveEntry('help'); if (isset($_GET['mode']) and $_GET['mode'] === 'admin') { $url = \OCP\Util::linkToAbsolute('core', 'doc/admin/index.html'); $style1 = ''; $style2 = ' active'; } else { $url = \OCP\Util::linkToAbsolute('core', 'doc/user/index.html'); $style1 = ' active'; $style2 = ''; } $url1 = \OC::$server->getURLGenerator()->linkToRoute('settings_help') . '?mode=user'; $url2 = \OC::$server->getURLGenerator()->linkToRoute('settings_help') . '?mode=admin'; $tmpl = new OC_Template("settings", "help", "user"); $tmpl->assign("admin", OC_User::isAdminUser(OC_User::getUser())); $tmpl->assign("url", $url); $tmpl->assign("url1", $url1); $tmpl->assign("url2", $url2); $tmpl->assign("style1", $style1); $tmpl->assign("style2", $style2); $tmpl->printPage();
public static function getRedirectUri() { return \OCP\Util::linkToAbsolute(self::APP_ID, 'index.php'); }
/** * Get all items for the users we want to send an email to * * @return array Notification data (user => array of rows from the table) */ protected function getLinkList() { $topEntries = array(array('id' => 'all', 'name' => (string) $this->l->t('All Activities'), 'url' => \OCP\Util::linkToAbsolute('activity', 'index.php')), array('id' => 'self', 'name' => (string) $this->l->t('Activities by you'), 'url' => \OCP\Util::linkToAbsolute('activity', 'index.php', array('filter' => 'self'))), array('id' => 'by', 'name' => (string) $this->l->t('Activities by others'), 'url' => \OCP\Util::linkToAbsolute('activity', 'index.php', array('filter' => 'by'))), array('id' => 'shares', 'name' => (string) $this->l->t('Shares'), 'url' => \OCP\Util::linkToAbsolute('activity', 'index.php', array('filter' => 'shares')))); $appFilterEntries = array(array('id' => 'files', 'name' => (string) $this->l->t('Files'), 'url' => \OCP\Util::linkToAbsolute('activity', 'index.php', array('filter' => 'files')))); return array('top' => $topEntries, 'apps' => $appFilterEntries); }
/** * links to a file * @param string $file the name of the file * @param string $appName the name of the app, defaults to the current one * @deprecated replaced with linkToRoute() * @return string the url */ public function linkToAbsolute($file, $appName = null) { if ($appName === null) { $appName = $this->appName; } return \OCP\Util::linkToAbsolute($appName, $file); }
<table cellspacing="0" cellpadding="0" border="0" width="100%"> <tr><td> <table cellspacing="0" cellpadding="0" border="0" width="600px"> <tr> <td bgcolor="<?php p($theme->getMailHeaderColor()); ?> " width="20px"> </td> <td bgcolor="<?php p($theme->getMailHeaderColor()); ?> "> <img src="<?php p(\OCP\Util::linkToAbsolute('', image_path('', 'logo-mail.gif'))); ?> " alt="<?php p($theme->getName()); ?> "/> </td> </tr> <tr><td colspan="2"> </td></tr> <tr> <td width="20px"> </td> <td style="font-weight:normal; font-size:0.8em; line-height:1.2em; font-family:verdana,'arial',sans;"> <?php print_unescaped($l->t('Hello,<br><br>we would like to inform you that your ownCloud password for the client apps has been changed.<br><br>If you did not change your password, please contact us on du-support@cesnet.cz.<br><br>', array())); // TRANSLATORS term at the end of a mail p($l->t('Your CESNET Storage Department Team')); ?> </td>
OCP\Util::addScript('conversations', 'jquery.timeago'); OCP\Util::addstyle('conversations', 'style'); // add timeago translations $lang = OC_L10N::findLanguage('conversations'); // TODO: may find a better solution than file_exists if (in_array($lang, OC_L10N::findAvailableLanguages('conversations')) && file_exists('./apps/conversations/js/jquery.timeago.' . $lang . '.js')) { OCP\Util::addScript('conversations', 'jquery.timeago.' . $lang); } // rooms $rooms = OC_Conversations::getRooms(); $updates = OC_Conversations::updateCheck(); $rooms = array_merge_recursive($rooms, $updates); // get the page that is requested. Needed for endless scrolling $count = 5; if (isset($_GET['page'])) { $page = intval($_GET['page']) - 1; } else { $page = 0; } $nextpage = \OCP\Util::linkToAbsolute('conversations', 'index.php', array('page' => $page + 2)); $tmpl = new OCP\Template('conversations', 'main', 'user'); if (!empty($rooms)) { $tmpl->assign('rooms', $rooms); } if ($page == 0) { $tmpl->assign('nextpage', $nextpage); } $room = OC_Conversations::getRoom(); $tmpl->assign('active_room', $room); $tmpl->assign('conversation', OC_Conversations::getConversation($room, $page * $count, $count)); $tmpl->printPage();
<meta charset="utf-8" /> <title>Impressionist for ownCloud</title> <link rel="stylesheet" type="text/css" src="<?php echo \OCP\Util::linkToAbsolute('impressionist', 'css/bootstrap.css'); ?> "></script> <link rel="stylesheet" type="text/css" href="<?php echo \OCP\Util::linkToAbsolute('impressionist', 'css/mainstyle.css'); ?> " /> <script type="text/javascript" src="<?php echo \OCP\Util::linkToAbsolute('', 'js/jquery-1.7.2.min.js'); ?> "></script> <script type="text/javascript" src="<?php echo \OCP\Util::linkToAbsolute('impressionist', 'js/bootstrap.js'); ?> "></script> <script> function closewindow() { close(); } </script> </head> <body> <div id="hero"> <div class="hero-unit" style="position:absolute; width:800px; text-align:center; left: 25%;top:30%; font-family:'Open Sans', serif; border: 1px dotted #0ca4eb;"> <h1>Congrats! You are all set.</h1> <p>Filename: <?php echo $filename . ".zip"; ?>
/** * @brief Store the share events * @param array $params The hook params */ public static function share($params) { if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') { $link = \OCP\Util::linkToAbsolute('files', 'index.php', array('dir' => dirname($params['fileTarget']))); $link2 = \OCP\Util::linkToAbsolute('files', 'index.php', array('dir' => dirname('/Shared/' . $params['fileTarget']))); $sharedFrom = \OCP\User::getUser(); $shareWith = $params['shareWith']; if (!empty($shareWith)) { $subject = 'You shared %s with %s'; Data::send('files', $subject, array(substr($params['fileTarget'], 1), $shareWith), '', array(), $params['fileTarget'], $link, \OCP\User::getUser(), 4, Data::PRIORITY_MEDIUM); $subject = '%s shared %s with you'; Data::send('files', $subject, array($sharedFrom, substr('/Shared' . $params['fileTarget'], 1)), '', array(), '/Shared/' . $params['fileTarget'], $link2, $shareWith, 5, Data::PRIORITY_MEDIUM); } else { $subject = 'You shared %s'; Data::send('files', $subject, array(substr($params['fileTarget'], 1)), '', array(), $params['fileTarget'], $link, \OCP\User::getUser(), 4, Data::PRIORITY_MEDIUM); } } }
* 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/>. * */ \OCP\JSON::checkLoggedIn(); \OCP\JSON::checkAppEnabled('activity'); \OCP\JSON::callCheck(); $l = \OCP\Util::getL10N('activity'); $token = $tokenUrl = ''; if ($_POST['enable'] === 'true') { // Check for collisions $token = \OCP\Util::generateRandomBytes(); $preferences = new \OC\Preferences(\OC_DB::getConnection()); $conflicts = $preferences->getUsersForValue('activity', 'rsstoken', $token); while (!empty($conflicts)) { $token = \OCP\Util::generateRandomBytes(); $conflicts = $preferences->getUsersForValue('activity', 'rsstoken', $token); } $tokenUrl = \OCP\Util::linkToAbsolute('activity', 'rss.php', array('token' => $token)); } \OCP\Config::setUserValue(\OCP\User::getUser(), 'activity', 'rsstoken', $token); \OCP\JSON::success(array('data' => array('message' => $l->t('Your settings have been updated.'), 'rsslink' => $tokenUrl)));
/** * inform users if a file was shared with them * * @param array $recipientList list of recipients * @param string $itemSource shared item source * @param string $itemType shared item type * @return array list of user to whom the mail send operation failed */ public function sendInternalShareMail($recipientList, $itemSource, $itemType) { $noMail = []; foreach ($recipientList as $recipient) { $recipientDisplayName = \OCP\User::getDisplayName($recipient); $to = $this->config->getUserValue($recipient, 'settings', 'email', ''); if ($to === '') { $noMail[] = $recipientDisplayName; continue; } $items = \OCP\Share::getItemSharedWithUser($itemType, $itemSource, $recipient); $filename = trim($items[0]['file_target'], '/'); $subject = (string) $this->l->t('%s shared »%s« with you', array($this->senderDisplayName, $filename)); $expiration = null; if (isset($items[0]['expiration'])) { try { $date = new DateTime($items[0]['expiration']); $expiration = $date->getTimestamp(); } catch (\Exception $e) { $this->logger->error("Couldn't read date: " . $e->getMessage(), ['app' => 'sharing']); } } // Link to folder, or root folder if a file if ($itemType === 'folder') { $args = array('dir' => $filename); } else { if (strpos($filename, '/')) { $args = array('dir' => '/' . dirname($filename), 'scrollto' => basename($filename)); } else { $args = array('dir' => '/', 'scrollto' => $filename); } } $link = \OCP\Util::linkToAbsolute('files', 'index.php', $args); list($htmlBody, $textBody) = $this->createMailBody($filename, $link, $expiration); // send it out now try { $message = $this->mailer->createMessage(); $message->setSubject($subject); $message->setTo([$to => $recipientDisplayName]); $message->setHtmlBody($htmlBody); $message->setPlainBody($textBody); $message->setFrom([\OCP\Util::getDefaultEmailAddress('sharing-noreply') => (string) $this->l->t('%s via %s', [$this->senderDisplayName, $this->defaults->getName()])]); if (!is_null($this->replyTo)) { $message->setReplyTo([$this->replyTo]); } $this->mailer->send($message); } catch (\Exception $e) { $this->logger->error("Can't send mail to inform the user about an internal share: " . $e->getMessage(), ['app' => 'sharing']); $noMail[] = $recipientDisplayName; } } return $noMail; }
private function getProperty(&$results, $row) { if (!$row['name'] || !$row['value']) { return false; } $value = null; switch ($row['name']) { case 'PHOTO': $value = 'VALUE=uri:' . \OCP\Util::linkToAbsolute('contacts', 'photo.php') . '?id=' . $row['contactid']; break; case 'N': case 'ORG': case 'ADR': case 'GEO': case 'CATEGORIES': $property = \Sabre\VObject\Property::create($row['name'], $row['value']); $value = $property->getParts(); break; default: $value = $value = strtr($row['value'], array('\\,' => ',', '\\;' => ';')); break; } if (in_array($row['name'], Properties::$multi_properties)) { if (!isset($results[$row['contactid']])) { $results[$row['contactid']] = array('id' => $row['contactid'], $row['name'] => array($value)); } elseif (!isset($results[$row['contactid']][$row['name']])) { $results[$row['contactid']][$row['name']] = array($value); } else { $results[$row['contactid']][$row['name']][] = $value; } } else { if (!isset($results[$row['contactid']])) { $results[$row['contactid']] = array('id' => $row['contactid'], $row['name'] => $value); } elseif (!isset($results[$row['contactid']][$row['name']])) { $results[$row['contactid']][$row['name']] = $value; } } }
/** * inform users if a file was shared with them * * @param array $recipientList list of recipients * @param string $itemSource shared item source * @param string $itemType shared item type * @return array list of user to whom the mail send operation failed */ public function sendInternalShareMail($recipientList, $itemSource, $itemType) { $noMail = array(); foreach ($recipientList as $recipient) { $recipientDisplayName = \OCP\User::getDisplayName($recipient); $to = \OC_Preferences::getValue($recipient, 'settings', 'email', ''); if ($to === '') { $noMail[] = $recipientDisplayName; continue; } $items = \OCP\Share::getItemSharedWithUser($itemType, $itemSource, $recipient); $filename = trim($items[0]['file_target'], '/'); $subject = (string) $this->l->t('%s shared »%s« with you', array($this->senderDisplayName, $filename)); $expiration = null; if (isset($items[0]['expiration'])) { try { $date = new DateTime($items[0]['expiration']); $expiration = $date->getTimestamp(); } catch (\Exception $e) { \OCP\Util::writeLog('sharing', "Couldn't read date: " . $e->getMessage(), \OCP\Util::ERROR); } } // Link to folder, or root folder if a file if ($itemType === 'folder') { $args = array( 'dir' => $filename, ); } else { $args = array( 'dir' => '/', 'scrollto' => $filename, ); } $link = \OCP\Util::linkToAbsolute('files', 'index.php', $args); list($htmlMail, $alttextMail) = $this->createMailBody($filename, $link, $expiration); // send it out now try { \OCP\Util::sendMail($to, $recipientDisplayName, $subject, $htmlMail, $this->from, $this->senderDisplayName, 1, $alttextMail); } catch (\Exception $e) { \OCP\Util::writeLog('sharing', "Can't send mail to inform the user about an internal share: " . $e->getMessage() , \OCP\Util::ERROR); $noMail[] = $recipientDisplayName; } } return $noMail; }
$items = \OCP\Share::getItemSharedWithUser($itemType, $itemSource, $recipient); $filename = trim($items[0]['file_target'], '/'); $subject = (string) $l->t('%s shared »%s« with you', array($ownerDisplayName, $filename)); $expiration = null; if (isset($items[0]['expiration'])) { $date = new DateTime($items[0]['expiration']); $expiration = $date->format('Y-m-d'); } if ($itemType === 'folder') { $foldername = "/Shared/" . $filename; } else { // if it is a file we can just link to the Shared folder, // that's the place where the user will find the file $foldername = "/Shared"; } $link = \OCP\Util::linkToAbsolute('files', 'index.php', array("dir" => $foldername)); $content = new OC_Template("core", "mail", ""); $content->assign('link', $link); $content->assign('user_displayname', $ownerDisplayName); $content->assign('filename', $filename); $content->assign('expiration', $expiration); $text = $content->fetchPage(); $content = new OC_Template("core", "altmail", ""); $content->assign('link', $link); $content->assign('user_displayname', $ownerDisplayName); $content->assign('filename', $filename); $content->assign('expiration', $expiration); $alttext = $content->fetchPage(); $default_from = OCP\Util::getDefaultEmailAddress('sharing-noreply'); $from = OCP\Config::getUserValue(\OCP\User::getUser(), 'settings', 'email', $default_from); // send it out now
/** * get file * * @param string $user * @param int $fileSource * @return array with internal path of the file and a absolute link to it */ private function getFile($user, $fileSource) { \OC_Util::setupFS($user); $file = \OC\Files\Filesystem::getPath($fileSource); $args = \OC\Files\Filesystem::is_dir($file) ? array('dir' => $file) : array('dir' => dirname($file), 'scrollto' => $file); $link = \OCP\Util::linkToAbsolute('files', 'index.php', $args); return array($file, $link); }
<?php /** * ownCloud - Activity app * * @author Frank Karlitschek * @copyright 2013 Frank Karlitschek frank@owncloud.org * * 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/>. * */ // check if the user has the right permissions. OCP\User::checkLoggedIn(); OCP\App::checkAppEnabled('activity'); // read the data $activities = OCA\Activity\Data::read(0, 30); // generate an absolute link to the rss feed. $rsslink = \OCP\Util::linkToAbsolute('activity', 'rss.php'); // generate and show the rss feed echo OCA\Activity\Data::generaterss($rsslink, $activities);
/** * @brief Sharing a file or folder via link/public * @param array $params The hook params */ public static function shareFileOrFolder($params) { if (UserSettings::getUserSetting(\OCP\User::getUser(), 'setting', 'self') && UserSettings::getUserSetting(\OCP\User::getUser(), 'stream', Data::TYPE_SHARED)) { $path = \OC\Files\Filesystem::getPath($params['fileSource']); $link = \OCP\Util::linkToAbsolute('files', 'index.php', array('dir' => $params['itemType'] === 'file' ? dirname($path) : $path)); Data::send('files', 'shared_link_self', array($path), '', array(), $path, $link, \OCP\User::getUser(), Data::TYPE_SHARED, Data::PRIORITY_MEDIUM); } }
/** * Check if the user is a subadmin, redirects to home if not * * @return null|boolean $groups where the current user is subadmin */ public static function checkSubAdminUser() { OC_Util::checkLoggedIn(); $userObject = \OC::$server->getUserSession()->getUser(); $isSubAdmin = false; if ($userObject !== null) { $isSubAdmin = \OC::$server->getGroupManager()->getSubAdmin()->isSubAdmin($userObject); } if (!$isSubAdmin) { header('Location: ' . \OCP\Util::linkToAbsolute('', 'index.php')); exit; } return true; }
/** * @PublicPage * @NoCSRFRequired * * @param string $token * @param string $files * @param string $path * @return void|RedirectResponse */ public function downloadShare($token, $files = null, $path = '') { \OC_User::setIncognitoMode(true); $linkItem = OCP\Share::getShareByToken($token, false); // Share is password protected - check whether the user is permitted to access the share if (isset($linkItem['share_with'])) { if (!Helper::authenticate($linkItem)) { return new RedirectResponse($this->urlGenerator->linkToRoute('files_sharing.sharecontroller.authenticate', array('token' => $token))); } } $originalSharePath = self::getPath($token); if (isset($originalSharePath) && Filesystem::isReadable($originalSharePath . $path)) { $originalSharePath = Filesystem::normalizePath($originalSharePath . $path); $type = \OC\Files\Filesystem::is_dir($originalSharePath) ? 'folder' : 'file'; $args = $type === 'folder' ? array('dir' => $originalSharePath) : array('dir' => dirname($originalSharePath), 'scrollto' => basename($originalSharePath)); $linkToFile = \OCP\Util::linkToAbsolute('files', 'index.php', $args); $subject = $type === 'folder' ? Activity::SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED : Activity::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED; $this->activityManager->publishActivity('files_sharing', $subject, array($originalSharePath), '', array(), $originalSharePath, $linkToFile, $linkItem['uid_owner'], Activity::TYPE_PUBLIC_LINKS, Activity::PRIORITY_MEDIUM); } if (!is_null($files)) { // download selected files $files_list = json_decode($files); // in case we get only a single file if ($files_list === NULL) { $files_list = array($files); } // FIXME: The exit is required here because otherwise the AppFramework is trying to add headers as well // after dispatching the request which results in a "Cannot modify header information" notice. OC_Files::get($originalSharePath, $files_list, $_SERVER['REQUEST_METHOD'] == 'HEAD'); exit; } else { // FIXME: The exit is required here because otherwise the AppFramework is trying to add headers as well // after dispatching the request which results in a "Cannot modify header information" notice. OC_Files::get(dirname($originalSharePath), basename($originalSharePath), $_SERVER['REQUEST_METHOD'] == 'HEAD'); exit; } }
/** * Prepare an image tile * @param array $fileData File data with this structure: array('id'=>'', 'path'=>'', 'name'=>'') * @return string */ public static function prepareTile($fileData) { $pathInfo = substr(pathinfo($fileData['path'], PATHINFO_DIRNAME), 6); $filePath = strpos($fileData['path'], 'files') === FALSE ? $fileData['path'] : substr($fileData['path'], 5); $result = '<div class="oclife_tile" data-fileid="' . $fileData['fileid'] . '" data-filePath="' . $pathInfo . '" data-fullPath="' . $filePath . '">'; $result .= '<div>' . $fileData['name'] . '</div>'; $thumbPath = \OCP\Util::linkToAbsolute('oclife', 'getThumbnail.php', array('filePath' => $filePath)); $result .= '<img src="' . $thumbPath . '" />'; $result .= '</div>'; return $result; }