/** * @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(); }
<?php /** * ownCloud - Files_Opds App * * @author Frank de Lange * @copyright 2014 Frank de Lange * * This file is licensed under the Affero General Public License version 3 or * later. */ namespace OCA\Files_Opds; $l = new \OC_L10N('files_opds'); \OCP\JSON::checkLoggedIn(); \OCP\JSON::callCheck(); Bookshelf::clear(); \OCP\JSON::success(array("data" => array("message" => $l->t("Bookshelf cleared"))));
<?php /** * ownCloud - Files_Opds app * * Copyright (c) 2014 Frank de Lange * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ namespace OCA\Files_Opds; $l = new \OC_L10N('files_opds'); \OCP\Util::addScript('files_opds', 'personal'); $tmpl = new \OCP\Template('files_opds', 'personal'); $opdsEnable = Config::get('enable', false); $tmpl->assign('opdsEnable-checked', $opdsEnable === 'true' ? 'checked="checked"' : ''); $tmpl->assign('opdsEnable-value', $opdsEnable === 'true' ? '1' : '0'); $tmpl->assign('rootPath', Config::get('root_path', '/Library')); $tmpl->assign('fileTypes', Config::get('file_types', '')); $tmpl->assign('skipList', Config::get('skip_list', 'metadata.opf,cover.jpg')); $tmpl->assign('feedTitle', Config::get('feed_title', $l->t("%s's Library", \OCP\User::getDisplayName()))); $tmpl->assign('bookshelf-count', Bookshelf::count()); $tmpl->assign('feedUrl', \OC_Helper::linkToAbsolute('', 'index.php') . '/apps/files_opds/'); return $tmpl->fetchPage();
<?php require_once 'layout.php'; $myBooks = new Bookshelf(); $booklist = $myBooks->parseBookData(); usort($booklist, 'Bookshelf::bookcmp'); $smarty->assign('site_title', 'Toews Web Site Development'); $smarty->assign('page_title', 'Bookshelf'); $smarty->assign('books', $booklist); $smarty->display('smarty/bookshelf.tpl');
$book2Publisher = new Publisher("Manning"); $book2Borrower = new Borrower("Michael", "Neuhaus"); $book2 = new Book(2, "Secrets Of The JavaScript Ninja", $book2Author, $book2Publisher, $book2Borrower); $book3Author = new Author("Mark Ethan", "Trostler"); $book3Publisher = new Publisher("O'Reilly"); $book3Borrower = new Borrower(); $book3 = new Book(3, "Testable JavaScript", $book3Author, $book3Publisher, $book3Borrower); $book4Author = new Author("Stoyan", "Stefanov"); $book4Publisher = new Publisher("O'Reilly"); $book4Borrower = new Borrower("Daniel", "Schulz"); $book4 = new Book(4, "JavaScript Patterns", $book4Author, $book4Publisher, $book4Borrower); $book5Author = new Author("Marijn", "Haverbeke"); $book5Publisher = new Publisher("no starch press"); $book5Borrower = new Borrower(); $book5 = new Book(5, "Eloquent JavaScript", $book5Author, $book5Publisher, $book5Borrower); $newBookshelf = new Bookshelf(); $newBookshelf->addOneBookToArray($book1); $newBookshelf->addOneBookToArray($book2); $newBookshelf->addOneBookToArray($book3); $newBookshelf->addOneBookToArray($book4); $newBookshelf->addOneBookToArray($book5); $type = (int) $_GET['type']; if (isset($_GET['type'])) { if ($type === 1) { $pinkBrowserPrinter = new BrowserPrinter($newBookshelf); } else { if ($type === 2) { $pinkDataPrinter = new DataPrinter($newBookshelf); } else { echo "Nothing to print."; }