function getStandardImage() { //OCP\Response::setExpiresHeader('P10D'); OCP\Response::enableCaching(); OCP\Response::redirect(OCP\Util::imagePath('contacts', 'person_large.png')); exit; }
function handleGetThumbnails($albumname) { OCP\Response::enableCaching(3600 * 24); // 24 hour $thumbnail = OC::$CONFIG_DATADIRECTORY . '/../gallery/' . urldecode($albumname) . '.png'; header('Content-Type: ' . OC_Image::getMimeTypeForFile($thumbnail)); OCP\Response::sendFile($thumbnail); }
function handleGetThumbnails($albumname) { OCP\Response::enableCaching(3600 * 24); // 24 hour $view = OCP\Files::getStorage('gallery'); $thumbnail = $view->fopen(urldecode($albumname) . '.png', 'r'); header('Content-Type: ' . OC_Image::getMimeTypeForFile($thumbnail)); OCP\Response::sendFile($thumbnail); }
function handleGetAlbumThumbnail($token, $albumname) { $owner = OC_Gallery_Sharing::getTokenOwner($token); $file = OCP\Config::getSystemValue("datadirectory") . '/' . $owner . '/gallery/' . $albumname . '.png'; $image = new OC_Image($file); if ($image->valid()) { $image->centerCrop(); $image->resize(200); $image->fixOrientation(); OCP\Response::enableCaching(3600 * 24); // 24 hour $image->show(); } }
function handleGetAlbumThumbnail($token, $albumname) { $owner = OC_Gallery_Sharing::getTokenOwner($token); $view = OCP\Files::getStorage('gallery'); $file = $view->fopen($albumname . '.png', 'r'); $image = new OC_Image($file); if ($image->valid()) { $image->centerCrop(); $image->resize(200); $image->fixOrientation(); OCP\Response::enableCaching(3600 * 24); // 24 hour $image->show(); } }
/** * @brief analyses the parameter for calendar parameter and returns the objects * @param (string) $calendarid - calendarid * @param (int) $start - unixtimestamp of start * @param (int) $end - unixtimestamp of end * @return (array) $events */ public static function getrequestedEvents($calendarid, $start, $end) { $events = array(); if ($calendarid == 'shared_events') { $singleevents = OCP\Share::getItemsSharedWith('event', OC_Share_Backend_Event::FORMAT_EVENT); $calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser()); foreach ($singleevents as $singleevent) { // Skip this single event if the whole calendar is already shared with the user. $calendarShared = false; foreach ($calendars as $calendar) { if ($singleevent['calendarid'] === $calendar['id']) { $calendarShared = true; break; } } if ($calendarShared === true) { continue; } $singleevent['summary'] .= ' (' . self::$l10n->t('by') . ' ' . OC_Calendar_Object::getowner($singleevent['id']) . ')'; $events[] = $singleevent; } } else { if (is_numeric($calendarid)) { $calendar = self::getCalendar($calendarid); OCP\Response::enableCaching(0); OCP\Response::setETagHeader($calendar['ctag']); $events = OC_Calendar_Object::allInPeriod($calendarid, $start, $end, $calendar['userid'] !== OCP\User::getUser()); } else { OCP\Util::emitHook('OC_Calendar', 'getEvents', array('calendar_id' => $calendarid, 'events' => &$events)); } } return $events; }
/** * ownCloud - gallery application * * @author Bartek Przybylski * @copyright 2012 Bartek Przybylski bart.p.pl@gmail.com * * 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/>. * */ OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('gallery'); require_once 'apps/gallery/lib/managers.php'; $img = $_GET['filepath']; $image = \OC\Pictures\ThumbnailsManager::getInstance()->getThumbnail($img); if ($image) { OCP\Response::enableCaching(3600 * 24); // 24 hour $image->show(); }
} OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('contacts'); $offset = isset($_GET['offset']) ? $_GET['offset'] : 0; $aid = isset($_GET['aid']) ? $_GET['aid'] : null; $active_addressbooks = array(); if (is_null($aid)) { // Called initially to get the active addressbooks. $active_addressbooks = OCA\Contacts\Addressbook::active(OCP\USER::getUser()); } else { // called each time more contacts has to be shown. $active_addressbooks = array(OCA\Contacts\Addressbook::find($aid)); } $lastModified = OCA\Contacts\App::lastModified(); if (!is_null($lastModified)) { OCP\Response::enableCaching(); OCP\Response::setLastModifiedHeader($lastModified); OCP\Response::setETagHeader(md5($lastModified->format('U'))); } session_write_close(); // create the addressbook associate array $contacts_addressbook = array(); $ids = array(); foreach ($active_addressbooks as $addressbook) { $ids[] = $addressbook['id']; /*if(!isset($contacts_addressbook[$addressbook['id']])) { $contacts_addressbook[$addressbook['id']] = array('contacts' => array('type' => 'book',)); $contacts_addressbook[$addressbook['id']]['displayname'] = $addressbook['displayname']; $contacts_addressbook[$addressbook['id']]['description']
public static function getrequestedEvents($calendarid, $start, $end) { $events = array(); if ($calendarid == 'shared_rw' || $calendarid == 'shared_r') { $calendars = OC_Calendar_Share::allSharedwithuser(OCP\USER::getUser(), OC_Calendar_Share::CALENDAR, 1, $_GET['calendar_id'] == 'shared_rw' ? 'rw' : 'r'); foreach ($calendars as $calendar) { $calendarevents = OC_Calendar_Object::allInPeriod($calendar['calendarid'], $start, $end); foreach ($calendarevents as $event) { $event['summary'] .= ' (' . self::$l10n->t('by') . ' ' . OC_Calendar_Object::getowner($event['id']) . ')'; } $events = array_merge($events, $calendarevents); } $singleevents = OC_Calendar_Share::allSharedwithuser(OCP\USER::getUser(), OC_Calendar_Share::EVENT, 1, $_GET['calendar_id'] == 'shared_rw' ? 'rw' : 'r'); foreach ($singleevents as $singleevent) { $event = OC_Calendar_Object::find($singleevent['eventid']); if (!array_key_exists('summary', $event)) { $event['summary'] = self::$l10n->t('unnamed'); } $event['summary'] .= ' (' . self::$l10n->t('by') . ' ' . OC_Calendar_Object::getowner($event['id']) . ')'; $events[] = $event; } } else { if (is_numeric($calendarid)) { $calendar = self::getCalendar($calendarid); OCP\Response::enableCaching(0); OCP\Response::setETagHeader($calendar['ctag']); $events = OC_Calendar_Object::allInPeriod($calendarid, $start, $end); } else { OCP\Util::emitHook('OC_Calendar', 'getEvents', array('calendar_id' => $calendarid, 'events' => &$events)); } } return $events; }
/** * @brief analyses the parameter for calendar parameter and returns the objects * @param (string) $calendarid - calendarid * @param (int) $start - unixtimestamp of start * @param (int) $end - unixtimestamp of end * @return (array) $events */ public static function getrequestedEvents($calendarid, $start, $end) { $events = array(); if ($calendarid == 'shared_events') { $singleevents = OCP\Share::getItemsSharedWith('event', OC_Share_Backend_Event::FORMAT_EVENT); foreach ($singleevents as $singleevent) { $singleevent['summary'] .= ' (' . self::$l10n->t('by') . ' ' . OC_Calendar_Object::getowner($singleevent['id']) . ')'; $events[] = $singleevent; } } else { if (is_numeric($calendarid)) { $calendar = self::getCalendar($calendarid); OCP\Response::enableCaching(0); OCP\Response::setETagHeader($calendar['ctag']); $events = OC_Calendar_Object::allInPeriod($calendarid, $start, $end); } else { OCP\Util::emitHook('OC_Calendar', 'getEvents', array('calendar_id' => $calendarid, 'events' => &$events)); } } return $events; }
function getStandardImage() { OCP\Response::enableCaching(); OCP\Response::redirect(OCP\Util::imagePath('contacts', 'person.png')); }