/** * 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(); }
/** * Get the template for a specific activity-event in the activities * * @param array $activity An array with all the activity data in it * @return string */ public static function show($activity) { $tmpl = new Template('activity', 'activity.box'); $tmpl->assign('formattedDate', Util::formatDate($activity['timestamp'])); $tmpl->assign('formattedTimestamp', \OCP\relative_modified_date($activity['timestamp'])); $tmpl->assign('user', $activity['user']); $tmpl->assign('displayName', User::getDisplayName($activity['user'])); if (strpos($activity['subjectformatted']['markup']['trimmed'], '<a ') !== false) { // 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 View('/' . $activity['affecteduser'] . '/files'); $exist = $rootView->file_exists($activity['file']); $is_dir = $rootView->is_dir($activity['file']); unset($rootView); // show a preview image if the file still exists $mimetype = \OC_Helper::getFileNameMimeType($activity['file']); if (!$is_dir && \OC::$server->getPreviewManager()->isMimeSupported($mimetype) && $exist) { $tmpl->assign('previewLink', Util::linkTo('files', 'index.php', array('dir' => dirname($activity['file'])))); $tmpl->assign('previewImageLink', Util::linkToRoute('core_ajax_preview', array('file' => $activity['file'], 'x' => 150, 'y' => 150))); } else { $tmpl->assign('previewLink', Util::linkTo('files', 'index.php', array('dir' => $activity['file']))); $tmpl->assign('previewImageLink', \OC_Helper::mimetypeIcon($is_dir ? 'dir' : $mimetype)); $tmpl->assign('previewLinkIsDir', true); } } return $tmpl->fetchPage(); }
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); } }
/** * Create a new content search result * @param QueryHit $hit file data given by provider */ public function __construct(QueryHit $hit) { $this->id = (string) $hit->fileId; $this->path = $this->getRelativePath($hit->path); $this->name = basename($this->path); $this->size = (int) $hit->size; $this->score = $hit->score; $this->link = \OCP\Util::linkTo('files', 'index.php', array('dir' => dirname($this->path), 'scrollto' => $this->name)); $this->permissions = $this->getPermissions($this->path); $this->modified = (int) $hit->mtime; $this->mime_type = $hit->mimetype; }
/** * Create a new file search result * @param FileInfo $data file data given by provider */ public function __construct(FileInfo $data) { $path = $this->getRelativePath($data->getPath()); $info = pathinfo($path); $this->id = $data->getId(); $this->name = $info['basename']; $this->link = \OCP\Util::linkTo('files', 'index.php', array('dir' => $info['dirname'], 'file' => $info['basename'])); $this->permissions = $data->getPermissions(); $this->path = $path; $this->size = $data->getSize(); $this->modified = $data->getMtime(); $this->mime_type = $data->getMimetype(); }
function display_sub_dirs($current_dir, $sub_dirs) { $results = explore($current_dir, $sub_dirs, 1); foreach ($results as $r) { echo '<tr id = "row" data-file="' . $r[0] . '" data-type="dir"> <td id = "thumbnail_container" width = "14%"><div id = "thumbs">'; $is_dir = check_dir_exists($current_dir, $r[0]); $margin = 10; $img_id = 1; foreach ($r[1] as $thumbs) { $thumb_exists = false; $thumb_exists = check_thumb_exists($current_dir . $r[0] . '/' . $thumbs); $img_path = \OCP\Util::linkTo('reader', 'ajax/thumbnail.php') . '&filepath=' . urlencode($current_dir . $r[0] . '/' . rtrim($thumbs, 'pdf') . 'png'); $counter = 3; for ($i = 1; $i <= $counter; $i++) { echo '<img id = "' . $current_dir . $r[0] . '/' . $thumbs . '" src = "' . $img_path . '" value = "' . $thumb_exists . '" style = "position:absolute;top:-55px;left:10px;margin-left:' . $margin . 'px; z-index:' . (50 - $margin) . ';"/>'; $margin = $margin + 5; $img_id = $img_id + 1; } } echo '</div></td>'; echo '<td class = "filename svg" width = "86%"> <a class = "dirs" id = "' . $r[0] . '" href = "' . OCP\Util::linkTo('reader', 'index.php') . '&dir=' . $current_dir . $r[0] . '/' . '"> <span class = "nametext">' . htmlspecialchars($r[0]) . '</span> </a> <div id = "more_info" style = "color:#666;margin-left:15px;margin-top:35px; vertical-align:bottom">'; echo "Browse in for"; echo '<br>'; $dir_browse_results = explore($current_dir, array($r[0]), 5); foreach ($dir_browse_results as $browse_result) { foreach ($browse_result[1] as $each) { $each_sub_dir = explode("/", $each); if (count($each_sub_dir) > 1) { foreach ($each_sub_dir as $element) { echo '<span style = "color:#DDD;">>></span>' . $element; } } else { echo '<span style = "color:#DDD;"> >></span>' . $each; } echo '<br>'; } } echo '</div> </td> </tr>'; } }
/** * @NoAdminRequired * @NoCSRFRequired * @SSOCORS */ public function getFileList($dir = null, $sortby = 'name', $sort = false) { \OCP\JSON::checkLoggedIn(); \OC::$server->getSession()->close(); // Load the files $dir = $dir ? (string) $dir : ''; $dir = \OC\Files\Filesystem::normalizePath($dir); try { $dirInfo = \OC\Files\Filesystem::getFileInfo($dir); if (!$dirInfo || !$dirInfo->getType() === 'dir') { header('HTTP/1.0 404 Not Found'); exit; } $data = array(); $baseUrl = \OCP\Util::linkTo('files', 'index.php') . '?dir='; $permissions = $dirInfo->getPermissions(); $sortDirection = $sort === 'desc'; $mimetypeFilters = ''; $files = []; if (is_array($mimetypeFilters) && count($mimetypeFilters)) { $mimetypeFilters = array_unique($mimetypeFilters); if (!in_array('httpd/unix-directory', $mimetypeFilters)) { $mimetypeFilters[] = 'httpd/unix-directory'; } foreach ($mimetypeFilters as $mimetypeFilter) { $files = array_merge($files, \OCA\Files\Helper::getFiles($dir, $sortby, $sortDirection, $mimetypeFilter)); } $files = \OCA\Files\Helper::sortFiles($files, $sortby, $sortDirection); } else { $files = \OCA\Files\Helper::getFiles($dir, $sortby, $sortDirection); } $files = \OCA\Files\Helper::populateTags($files); $data['directory'] = $dir; $data['files'] = \OCA\Files\Helper::formatFileInfos($files); $data['permissions'] = $permissions; return new DataResponse(array('data' => $data, 'status' => 'success')); } catch (\OCP\Files\StorageNotAvailableException $e) { \OCP\Util::logException('files', $e); return new DataResponse(array('data' => array('exception' => '\\OCP\\Files\\StorageNotAvailableException', 'message' => 'Storage not available'), 'status' => 'error')); } catch (\OCP\Files\StorageInvalidException $e) { \OCP\Util::logException('files', $e); return new DataResponse(array('data' => array('exception' => '\\OCP\\Files\\StorageInvalidException', 'message' => 'Storage invalid'), 'status' => 'error')); } catch (\Exception $e) { \OCP\Util::logException('files', $e); return new DataResponse(array('data' => array('exception' => '\\Exception', 'message' => 'Unknown error'), 'status' => 'error')); } }
function search($query) { $unescape = function ($value) { return strtr($value, array('\\,' => ',', '\\;' => ';')); }; $app = new App(); $searchresults = array(); $results = \OCP\Contacts::search($query, array('N', 'FN', 'EMAIL', 'NICKNAME', 'ORG')); $l = new \OC_l10n('contacts'); foreach ($results as $result) { $link = \OCP\Util::linkTo('contacts', 'index.php') . '/#' . $result['id']; $props = array(); foreach (array('EMAIL', 'NICKNAME', 'ORG') as $searchvar) { if (isset($result[$searchvar]) && count($result[$searchvar]) > 0 && strlen($result[$searchvar][0]) > 3) { $props = array_merge($props, $result[$searchvar]); } } $props = array_map($unescape, $props); $searchresults[] = new \OC_Search_Result($result['FN'], implode(', ', $props), $link, (string) $l->t('Contact')); //$name,$text,$link,$type } return $searchresults; }
/** * Constructor * * @param array $data * @return \OCA\Calendar\Search\Event */ public function __construct(array $data = null) { // set default properties $this->id = $data['id']; $this->name = $data['summary']; $this->link = \OCP\Util::linkTo('calendar', 'index.php') . '?showevent=' . urlencode($data['id']); // do calendar-specific setup $l = new \OC_l10n('calendar'); $calendar_data = \Sabre\VObject\Reader::read($data['calendardata']); $vevent = $calendar_data->VEVENT; // get start time $dtstart = $vevent->DTSTART; $start_dt = $dtstart->getDateTime(); $start_dt->setTimezone($this->getUserTimezone()); $this->start_time = $start_dt->format('r'); // get end time $dtend = \OC_Calendar_Object::getDTEndFromVEvent($vevent); $end_dt = $dtend->getDateTime(); $end_dt->setTimezone($this->getUserTimezone()); $this->end_time = $end_dt->format('r'); // create text description if (!$dtstart->hasTime()) { $end_dt->modify('-1 sec'); if ($start_dt->format('d.m.Y') != $end_dt->format('d.m.Y')) { $this->text = $l->t('Date') . ': ' . $start_dt->format('d.m.Y') . ' - ' . $end_dt->format('d.m.Y'); } else { $this->text = $l->t('Date') . ': ' . $start_dt->format('d.m.Y'); } } else { $this->text = $l->t('Date') . ': ' . $start_dt->format('d.m.y H:i') . ' - ' . $end_dt->format('d.m.y H:i'); } // set last modified time $this->modified = date('r', $data['lastmodified']); // set repeating property $this->repeating = (bool) $data['repeating']; }
/** * 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(); //Check if we are redirected here with permanent sync request if (isset($_GET['code'])) { $code = preg_replace('/[^0-9a-zA-Z\\.\\-_\\/]*/i', '', $_GET['code']); $response = Request::getTokenByCode($code); $respData = json_decode($response, true); App::log('Goglesaid.' . $response, \OCP\Util::DEBUG); if (@$respData[App::GOOGLE_REFRESH_TOKEN]) { App::setRefreshToken($respData[App::GOOGLE_REFRESH_TOKEN]); } //Dirty hack. //It's not possible to redirect with server headers at this point echo '<script>window.location="' . \OCP\Util::linkTo('settings', 'personal.php') . '";</script>'; exit; } else { \OCP\Util::addScript(App::APP_ID, 'sync'); $tmpl = new \OCP\Template(App::APP_ID, 'index', 'user'); $tmpl->printPage(); }
/** * converts a zend lucene search object to a OC_SearchResult * * Example: * * Text | Some Document.txt * | /path/to/file, 148kb, Score: 0.55 * * @author Jörn Dreyer <*****@*****.**> * * @param Zend_Search_Lucene_Search_QueryHit $hit The Lucene Search Result * @return OC_Search_Result an OC_Search_Result */ private static function asOCSearchResult(\Zend_Search_Lucene_Search_QueryHit $hit) { $mimeBase = self::baseTypeOf($hit->mimetype); switch ($mimeBase) { case 'audio': $type = 'Music'; break; case 'text': $type = 'Text'; break; case 'image': $type = 'Images'; break; default: if ($hit->mimetype == 'application/xml') { $type = 'Text'; } else { $type = 'Files'; } } switch ($hit->mimetype) { case 'httpd/unix-directory': $url = Util::linkTo('files', 'index.php') . '?dir=' . $hit->path; break; default: $url = \OC::getRouter()->generate('download', array('file' => $hit->path)); } return new \OC_Search_Result(basename($hit->path), dirname($hit->path) . ', ' . \OC_Helper::humanFileSize($hit->size) . ', Score: ' . number_format($hit->score, 2), $url, $type); }
public function getMiniatureSrc() { return \OCP\Util::linkTo('gallery', 'ajax/thumbnail.php') . '?filepath=' . urlencode($this->getPath()); }
<?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. */ ?> <div class="section"> <h2><?php p($l->t('Updater')); ?> </h2> <a class="button" target="_blank" href="<?php p(\OCP\Util::linkTo('updater', 'update.php')); ?> "><?php p($l->t('Open Update Center')); ?> </a> </div>
function search($query) { $collection = new Collection(\OCP\User::getUser()); $l = \OC_L10N::get('media'); $app_name = (string) $l->t('Music'); $artists = $collection->getArtists($query); $albums = $collection->getAlbums(0, $query); $songs = $collection->getSongs(0, 0, $query); $results = array(); foreach ($artists as $artist) { $results[] = new \OC_Search_Result($artist['artist_name'], '', \OCP\Util::linkTo('media', 'index.php') . '#artist=' . urlencode($artist['artist_name']), $app_name); } foreach ($albums as $album) { $artist = $collection->getArtistName($album['album_artist']); $results[] = new \OC_Search_Result($album['album_name'], 'by ' . $artist, \OCP\Util::linkTo('media', 'index.php') . '#artist=' . urlencode($artist) . '&album=' . urlencode($album['album_name']), $app_name); } foreach ($songs as $song) { $minutes = floor($song['song_length'] / 60); $seconds = $song['song_length'] % 60; $artist = $collection->getArtistName($song['song_artist']); $album = $collection->getalbumName($song['song_album']); $results[] = new \OC_Search_Result($song['song_name'], "by {$artist}, in {$album} {$minutes}:{$seconds}", \OCP\Util::linkTo('media', 'index.php') . '#artist=' . urlencode($artist) . '&album=' . urlencode($album) . '&song=' . urlencode($song['song_name']), $app_name); } return $results; }
* License along with this library. * If not, see <http://www.gnu.org/licenses/>. * */ ?> <?php /** * @file templates/tmpl_content.php * Visualizes the configured imprint content. * @access public * @author Christian Reiner */ ?> <html> <head> <link rel="stylesheet" href="<?php p(\OCP\Util::linkTo('imprint', 'css/content.css')); ?> " type="text/css" media="screen" /> </head> <body id="imprint-body"> <div id="imprint-content"> <?php print_unescaped($_['content']); ?> </div> </body> </html>
/** * Returns an URL for an image or file * @param string $file the name of the file * @param string $appName the name of the app, defaults to the current one */ public function linkTo($file, $appName = null) { if ($appName === null) { $appName = $this->appName; } return \OCP\Util::linkTo($appName, $file); }
/** * @author Felix Moeller <*****@*****.**> * @author Frank Karlitschek <*****@*****.**> * @author j-ed <*****@*****.**> * @author Morris Jobke <*****@*****.**> * @author Roeland Jago Douma <*****@*****.**> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License, version 3, * 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/> * */ require_once OC_App::getAppPath('user_webdavauth') . '/user_webdavauth.php'; OC_APP::registerAdmin('user_webdavauth', 'settings'); OC_User::registerBackend("WEBDAVAUTH"); OC_User::useBackend("WEBDAVAUTH"); // add settings page to navigation $entry = array('id' => "user_webdavauth_settings", 'order' => 1, 'href' => \OCP\Util::linkTo("user_webdavauth", "settings.php"), 'name' => 'WEBDAVAUTH');
$("a[rel=images]").fancybox({ 'titlePosition': 'inside' }); }); </script> <div id="controls"><?php $sr = trim($_['root'], '/'); if (!empty($sr)) { $paths = explode('/', $sr); $path = '/'; for ($i = 0; $i < count($paths); $i++) { $path .= urlencode($paths[$i]) . '/'; $classess = 'crumb' . ($i == count($paths) - 1 ? ' last' : ''); echo '<div class="' . $classess . '" style="background-image:url(\'' . \OCP\image_path('core', 'breadcrumb.png') . '\')"><a href="' . \OCP\Util::linkTo('gallery', 'index.php') . '&root=' . $path . '">' . OCP\Util::sanitizeHTML($paths[$i]) . '</a></div>'; } } ?> <div id="slideshow"> <input type="button" class="start" value="<?php echo $l->t('Slideshow'); ?> " /> </div> </div> <div id="gallerycontent"> <?php session_write_close(); echo $_['tl']->get(); ?>
function display_sub_dirs($current_dir, $sub_dirs) { $results = explore($current_dir, $sub_dirs, 1); foreach ($results as $r) { echo '<tr id = "row" data-file="' . $r[0] . '" data-type="dir"> <td class = "filename svg" width = "14%"> <a class = "dirs" id = "' . $r[0] . '" href = "' . OCP\Util::linkTo('reader', 'index.php') . '&dir=' . $current_dir . $r[0] . '/' . '">'; // Check if sub-directory($r[0]) exists or not--> $is_dir = check_dir_exists($current_dir, $r[0]); if ($is_dir == false) { echo '<img src= "' . OCP\image_path('reader', 'download.jpg') . '" style = "width:100px; height:100px;">'; } else { $margin = 15; $img_id = 1; foreach ($r[1] as $thumbs) { $thumb_exists = false; $thumb_exists = check_thumb_exists($current_dir . $r[0] . '/' . $thumbs); if ($thumb_exists != 'true') { $img_path = "/owncloud/apps/reader/img/images.jpg"; echo '<div style ='; echo 'background-image:url("'; echo OCP\image_path('reader', 'images.jpg'); echo '");width:100px;height:100px;'; echo "></div>"; } else { if ($thumb_exists == 'true') { $img_path = \OCP\Util::linkTo('reader', 'ajax/thumbnail.php') . '&filepath=' . urlencode($current_dir . $r[0] . '/' . rtrim($thumbs, 'pdf') . 'png'); $counter = 3; } } if ($thumb_exists != 'false') { for ($i = 1; $i <= $counter; $i++) { echo '<img id = "img' . $img_id . '" src = "' . $img_path . '" style = "position:absolute; top:20px; left:10px; margin-left:' . $margin . 'px; z-index:' . (50 - $margin) . ';">'; $margin = $margin + 5; $img_id = $img_id + 1; } } } } echo '</a> </td> <td id = "info" width = "86%"> <span class = "nametext">'; echo htmlspecialchars($r[0]); echo '</span> <div id = "more_info" style = "color:#666;margin-left:5px;margin-top:15px;">'; echo "Browse in for"; echo '<br>'; $dir_browse_results = explore($current_dir, array($r[0]), 5); foreach ($dir_browse_results as $browse_result) { foreach ($browse_result[1] as $each) { $each_sub_dir = explode("/", $each); if (count($each_sub_dir) > 1) { foreach ($each_sub_dir as $element) { echo '<span style = "color:#DDD;">>></span>' . $element; } } else { echo '<span style = "color:#DDD;"> >></span>' . $each; } echo '<br>'; } } echo '</div> </td> </tr>'; } }
<a class="name" href="http://localhost<?php echo \OCP\Util::linkTo('files', 'download.php') . '?file=' . $directory . $name; ?> " title="<?php echo urldecode($name); ?> " dir ="<?php echo $directory . $name; ?> " value = "<?php echo $check_thumb; ?> "> <center> <span class = "nametext"> <?php echo htmlspecialchars($filename); ?> </span> </center> <img rel ="images" src = "<?php echo \OCP\Util::linkTo('reader', 'ajax/thumbnail.php') . '&filepath=' . urlencode($path . rtrim($filename, 'pdf') . 'png'); ?> "> </a> </td> </tr> </tbody> </table>
* 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/>. * */ /** * @file appinfo/app.php * @brief Basic registration of app inside ownCloud * @author Christian Reiner */ \OCP\App::registerAdmin('imprint', 'settings'); \OCP\Util::addStyle('imprint', 'reference'); \OCP\Util::addScript('imprint', 'reference'); // add imprint positioning options as meta tags to the html head to avoid additional ajax requests \OCP\Util::addHeader('meta', array('data-imprint-position-user' => \OCP\Config::getAppValue('imprint', 'position-user', ''))); \OCP\Util::addHeader('meta', array('data-imprint-position-guest' => \OCP\Config::getAppValue('imprint', 'position-guest', ''))); \OCP\Util::addHeader('meta', array('data-imprint-position-login' => \OCP\Config::getAppValue('imprint', 'position-login', ''))); // offer application as standalone entry in the menu? if ('true' === \OCP\Config::getAppValue('imprint', 'standalone', 'false')) { // no js required, we add the imprint as a normal app to the navigation \OCP\App::addNavigationEntry(array('id' => 'imprint', 'order' => 99999, 'href' => \OCP\Util::linkTo('imprint', 'index.php'), 'icon' => \OCP\Util::imagePath('imprint', 'imprint-light.svg'), 'name' => \OCP\Util::getL10N('imprint')->t("Legal notice"))); } // if
// config key to store Url of the hosted Etherpad service const CONFIG_ETHERPAD_URL = 'etherpad_url'; // Default value for Url of the hosted Etherpad service const CONFIG_ETHERPAD_URL_DEFAULT = 'http://beta.etherpad.org/p/'; // Url of the hosted Etherpad solution const CONFIG_USERNAME = '******'; const ERROR_URL_INVALID = 'invalid URL'; const ERROR_USERNAME_INVALID = 'invalid username'; public static function getServiceUrl() { return self::getValue(self::CONFIG_ETHERPAD_URL, self::CONFIG_ETHERPAD_URL_DEFAULT); } public static function setServiceUrl($url) { return \OCP\Config::setUserValue(\OCP\User::getUser(), self::APP_ID, self::CONFIG_ETHERPAD_URL, $url); } public static function getUsername() { return self::getValue(self::CONFIG_USERNAME, \OCP\User::getUser()); } public static function setUsername($username) { return \OCP\Config::setUserValue(\OCP\User::getUser(), self::APP_ID, self::CONFIG_USERNAME, $username); } protected static function getValue($key, $defaultValue) { return \OCP\Config::getUserValue(\OCP\User::getUser(), self::APP_ID, $key, $defaultValue); } } \OCP\App::addNavigationEntry(array('id' => 'ownpad_lite_index', 'order' => 90, 'href' => \OCP\Util::linkTo(App::APP_ID, 'index.php'), 'icon' => \OCP\Util::imagePath('settings', 'users.svg'), 'name' => \OC_L10N::get(App::APP_ID)->t('My pad')));
* 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/>. * */ ?> <?php /** * @file templates/tmpl_content.php * Visualizes the configured imprint content. * @access public * @author Christian Reiner */ ?> <iframe id="imprint-frame" src="<?php p(\OCP\Util::linkTo('imprint', 'content.php')); ?> " width="100%"></iframe>
/** * Prepares a file parameter for usage * * Removes the path from filenames and adds highlights * * @param string $param * @param bool $stripPath Shall we remove the path from the filename * @param bool $highlightParams * @return string */ protected function prepareFileParam($param, $stripPath, $highlightParams) { $param = $this->fixLegacyFilename($param); $is_dir = $this->rootView->is_dir('/' . User::getUser() . '/files' . $param); if ($is_dir) { $parent_dir = $param; } else { $parent_dir = substr_count($param, '/') == 1 ? '/' : dirname($param); } $fileLink = Util::linkTo('files', 'index.php', array('dir' => $parent_dir)); $param = trim($param, '/'); if (!$stripPath) { if (!$highlightParams) { return $param; } return '<a class="filename" href="' . $fileLink . '">' . Util::sanitizeHTML($param) . '</a>'; } if (!$highlightParams) { return $this->stripPathFromFilename($param); } $title = $param; $title = ' title="' . Util::sanitizeHTML($title) . '"'; $newParam = $this->stripPathFromFilename($param); return '<a class="filename tooltip" href="' . $fileLink . '"' . $title . '>' . Util::sanitizeHTML($newParam) . '</a>'; }
<?php \OCP\App::registerAdmin('files', 'admin'); \OC::$server->getNavigationManager()->add(function () { $l = \OC::$server->getL10N('files'); return ['id' => 'files_index', 'order' => 0, 'href' => \OCP\Util::linkTo('files', 'index.php'), 'icon' => \OCP\Util::imagePath('core', 'places/files.svg'), 'name' => $l->t('Files')]; }); \OC::$server->getSearch()->registerProvider('OC\\Search\\Provider\\File', array('apps' => array('files'))); $templateManager = \OC_Helper::getFileTemplateManager(); $templateManager->registerTemplate('text/html', 'core/templates/filetemplates/template.html'); $templateManager->registerTemplate('application/vnd.oasis.opendocument.presentation', 'core/templates/filetemplates/template.odp'); $templateManager->registerTemplate('application/vnd.oasis.opendocument.text', 'core/templates/filetemplates/template.odt'); $templateManager->registerTemplate('application/vnd.oasis.opendocument.spreadsheet', 'core/templates/filetemplates/template.ods'); \OCA\Files\App::getNavigationManager()->add(function () { $l = \OC::$server->getL10N('files'); return ['id' => 'files', 'appname' => 'files', 'script' => 'list.php', 'order' => 0, 'name' => $l->t('All files')]; }); \OC::$server->getActivityManager()->registerExtension(function () { return new \OCA\Files\Activity(\OC::$server->query('L10NFactory'), \OC::$server->getURLGenerator(), \OC::$server->getActivityManager(), new \OCA\Files\ActivityHelper(\OC::$server->getTagManager()), \OC::$server->getConfig()); });
public static function getCalenderSources($parameters) { //\OCP\Util::writeLog('contacts', __METHOD__.' parameters: '.print_r($parameters, true), \OCP\Util::DEBUG); $app = new App(); $addressBooks = $app->getAddressBooksForUser(); $baseUrl = \OCP\Util::linkTo('calendar', 'ajax/events.php') . '?calendar_id='; foreach ($addressBooks as $addressBook) { $info = $addressBook->getMetaData(); $parameters['sources'][] = array('url' => $baseUrl . 'birthday_' . $info['backend'] . '_' . $info['id'], 'backgroundColor' => '#cccccc', 'borderColor' => '#888', 'textColor' => 'black', 'cache' => true, 'editable' => false); } }
* 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/>. * */ namespace OCA\FirstRunWizard; use OCP\Defaults; use OCP\User; use OCP\Util as CoreUtil; use OCP\Template; // Check if we are a user User::checkLoggedIn(); $appManager = \OC::$server->getAppManager(); $config = \OC::$server->getConfig(); $defaults = new Defaults(); $util = new Util($appManager, $config, $defaults); $tmpl = new Template('firstrunwizard', 'wizard', ''); $tmpl->assign('logo', CoreUtil::linkTo('core', 'img/logo-inverted.svg')); $tmpl->assign('clients', $util->getSyncClientUrls()); $tmpl->assign('edition', $util->getEdition()); $tmpl->printPage();
* 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\AppInfo; use OCA\Documents\Filter\Office; use OCA\Documents\Config; $app = new Application(); $c = $app->getContainer(); \OCP\App::registerAdmin('documents', 'admin'); \OCP\App::registerPersonal('documents', 'personal'); $navigationEntry = function () use($c) { return ['id' => 'documents_index', 'order' => 2, 'href' => \OCP\Util::linkTo('documents/', 'index.php'), 'icon' => \OCP\Util::imagePath('documents', 'documents.svg'), 'name' => $c->query('L10N')->t('Documents')]; }; $c->getServer()->getNavigationManager()->add($navigationEntry); //Script for registering file actions $request = \OC::$server->getRequest(); if (isset($request->server['REQUEST_URI'])) { $url = $request->server['REQUEST_URI']; if (preg_match('%index.php/apps/files(/.*)?%', $url)) { \OCP\Util::addScript('documents', 'viewer/viewer'); } } if (Config::getConverter() !== 'off') { $docFilter = new Office(['read' => ['target' => 'application/vnd.oasis.opendocument.text', 'format' => 'odt:writer8', 'extension' => 'odt'], 'write' => ['target' => 'application/msword', 'format' => 'doc', 'extension' => 'doc']]); $docxFilter = new Office(['read' => ['target' => 'application/vnd.oasis.opendocument.text', 'format' => 'odt:writer8', 'extension' => 'odt'], 'write' => ['target' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'format' => 'docx', 'extension' => 'docx']]); } //Listen to delete file signal
/** * Prepares a file parameter for usage * * Removes the path from filenames and adds highlights * * @param string $param * @param bool $stripPath Shall we remove the path from the filename * @param bool $highlightParams * @return string */ protected function prepareFileParam($param, $stripPath, $highlightParams) { $param = $this->fixLegacyFilename($param); $is_dir = $this->rootView->is_dir('/' . User::getUser() . '/files' . $param); if ($is_dir) { $fileLink = Util::linkTo('files', 'index.php', array('dir' => $param)); } else { $parentDir = substr_count($param, '/') == 1 ? '/' : dirname($param); $fileName = basename($param); $fileLink = Util::linkTo('files', 'index.php', array('dir' => $parentDir, 'scrollto' => $fileName)); } $param = trim($param, '/'); list($path, $name) = $this->splitPathFromFilename($param); if (!$stripPath || $path === '') { if (!$highlightParams) { return $param; } return '<a class="filename" href="' . $fileLink . '">' . Util::sanitizeHTML($param) . '</a>'; } if (!$highlightParams) { return $name; } $title = ' title="' . $this->l->t('in %s', array(Util::sanitizeHTML($path))) . '"'; return '<a class="filename tooltip" href="' . $fileLink . '"' . $title . '>' . Util::sanitizeHTML($name) . '</a>'; }
*/ // ownCloud calls appinfo/app.php every time it runs. This is the place to // Register navigation entries, and connect signals and slots define(__NAMESPACE__.'\K_APP_NAME', 'oc_apps2_games'); \OCP\App::register(Array( 'id' => K_APP_NAME, 'order' => 60, 'name' => 'Games2 +' )); \OCP\App::addNavigationEntry(Array( 'id' => namespace\K_APP_NAME, 'order' => 60, 'href' => \OCP\Util::linkTo(K_APP_NAME, 'main.php'), 'icon' => \OCP\Util::imagePath(K_APP_NAME, 'games-card_game.png'), 'name' => 'Games2 +' )); //\OC_Hook::connect('OC_DB','install', 'installer'); //\OC_Hook::connect('OC_DB','update', 'updater'); /* $myFile = \OC_App::getAppPath('oc_apps2_games').'/appinfo/apps2_game_map.csv'; if ( @is_readable($myFile) ) { $myHandle = @fopen($myFile,'r'); if ( $myHandle ) { \OCP\DB::beginTransaction(); $mySQL = <<<EOR INSERT INTO *PREFIX*apps2_games_map(game_id,author,map_id,json,jsol) VALUES (?,?,?,?,?) EOR;