1
0
Fork 0
mirror of https://github.com/Yetangitu/owncloud-apps.git synced 2025-10-02 14:49:17 +02:00

Adjust files_opds for Nextcloud 16

This commit is contained in:
Nico Baggus 2019-07-16 00:09:30 +02:00
parent 457c1603fa
commit e3c6d117ed
14 changed files with 165 additions and 71 deletions

View file

@ -12,8 +12,8 @@
namespace OCA\Files_Opds; namespace OCA\Files_Opds;
\OCP\JSON::callCheck(); \OC_JSON::callCheck();
\OCP\JSON::checkLoggedIn(); \OC_JSON::checkLoggedIn();
$defaults = new \OC_Defaults(); $defaults = new \OC_Defaults();
$l = \OC::$server->getL10N('files_opds'); $l = \OC::$server->getL10N('files_opds');
@ -53,7 +53,7 @@ if (isset($_POST['opdsCoverX'])) {
Config::setPreview('OC\Preview\MSOffice2007',$opdsPreviewMsOffice); Config::setPreview('OC\Preview\MSOffice2007',$opdsPreviewMsOffice);
} }
\OCP\JSON::success( \OC_JSON::success(
array( array(
'data' => array('message'=> $l->t('Settings updated successfully.')) 'data' => array('message'=> $l->t('Settings updated successfully.'))
) )

View file

@ -14,8 +14,8 @@ namespace OCA\Files_Opds;
$l = \OC::$server->getL10N('files_opds'); $l = \OC::$server->getL10N('files_opds');
\OCP\JSON::checkLoggedIn(); \OC_JSON::checkLoggedIn();
\OCP\JSON::callCheck(); \OC_JSON::callCheck();
Bookshelf::clear(); Bookshelf::clear();
\OCP\JSON::success(array( "data" => array( "message" => $l->t("Bookshelf cleared")))); \OC_JSON::success(array( "data" => array( "message" => $l->t("Bookshelf cleared"))));

View file

@ -12,8 +12,8 @@
namespace OCA\Files_Opds; namespace OCA\Files_Opds;
\OCP\JSON::callCheck(); \OC_JSON::callCheck();
\OCP\JSON::checkLoggedIn(); \OC_JSON::checkLoggedIn();
$l = \OC::$server->getL10N('files_opds'); $l = \OC::$server->getL10N('files_opds');
@ -21,12 +21,12 @@ $opdsEnable = isset($_POST['opdsEnable']) ? $_POST['opdsEnable'] : 'false';
$rootPath = isset($_POST['rootPath']) ? $_POST['rootPath'] : '/Library'; $rootPath = isset($_POST['rootPath']) ? $_POST['rootPath'] : '/Library';
$fileTypes = isset($_POST['fileTypes']) ? $_POST['fileTypes'] : ''; $fileTypes = isset($_POST['fileTypes']) ? $_POST['fileTypes'] : '';
$skipList = isset($_POST['skipList']) ? $_POST['skipList'] : 'metadata.opf,cover.jpg'; $skipList = isset($_POST['skipList']) ? $_POST['skipList'] : 'metadata.opf,cover.jpg';
$feedTitle = isset($_POST['feedTitle']) ? $_POST['feedTitle'] : $l->t("%s's Library", \OCP\User::getDisplayName()); $feedTitle = isset($_POST['feedTitle']) ? $_POST['feedTitle'] : $l->t("%s's Library", \OC_User::getDisplayName());
if (!strlen($rootPath) || if (!strlen($rootPath) ||
\OC\Files\Filesystem::isValidPath($rootPath) === false || \OC\Files\Filesystem::isValidPath($rootPath) === false ||
\OC\Files\Filesystem::file_exists($rootPath) === false ) { \OC\Files\Filesystem::file_exists($rootPath) === false ) {
\OCP\JSON::error( \OC_JSON::error(
array( array(
'data' => array('message'=> $l->t('Directory does not exist!')) 'data' => array('message'=> $l->t('Directory does not exist!'))
) )
@ -39,7 +39,7 @@ if (!strlen($rootPath) ||
Config::set('feed_title', $feedTitle); Config::set('feed_title', $feedTitle);
Config::set('id', Util::genUuid()); Config::set('id', Util::genUuid());
\OCP\JSON::success( \OC_JSON::success(
array( array(
'data' => array('message'=> $l->t('Settings updated successfully.')) 'data' => array('message'=> $l->t('Settings updated successfully.'))
) )

View file

@ -14,8 +14,8 @@ namespace OCA\Files_Opds;
$l = \OC::$server->getL10N('files_opds'); $l = \OC::$server->getL10N('files_opds');
\OCP\JSON::checkLoggedIn(); \OC_JSON::checkLoggedIn();
\OCP\JSON::callCheck(); \OC_JSON::callCheck();
Meta::rescan(); Meta::rescan();
\OCP\JSON::success(array( "data" => array( "message" => $l->t("Rescan scheduled")))); \OC_JSON::success(array( "data" => array( "message" => $l->t("Rescan scheduled"))));

View file

@ -37,10 +37,13 @@ See [README] for more information on (mis)features of this app.
<database>sqlite</database> <database>sqlite</database>
<database>mysql</database> <database>mysql</database>
<owncloud min-version="8.2" max-version="10.0" /> <owncloud min-version="8.2" max-version="10.0" />
<nextcloud min-version="8.1" max-version="13.0" /> <nextcloud min-version="8.1" max-version="16.0" />
</dependencies> </dependencies>
<settings> <settings>
<admin>OCA\Files_Opds\Settings\Admin</admin> <admin>OCA\Files_Opds\Settings\Admin</admin>
<admin-section>OCA\Files_Opds\Settings\AdminSection</admin-section>
<personal>OCA\Files_Opds\Settings\Personal</personal>
<personal-section>OCA\Files_Opds\Settings\PersonalSection</personal-section>
</settings> </settings>
<ocsid>168132</ocsid> <ocsid>168132</ocsid>
</info> </info>

View file

@ -0,0 +1,89 @@
<?php
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* 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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\File_Opds\Settings;
use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\Settings\IIconSection;
class PersonalSection implements IIconSection {
/** @var IL10N */
private $l;
/** @var IURLGenerator */
private $url;
/**
* @param IURLGenerator $url
* @param IL10N $l
*/
public function __construct(IURLGenerator $url, IL10N $l) {
$this->url = $url;
$this->l = $l;
}
/**
* returns the relative path to an 16*16 icon describing the section.
* e.g. '/core/img/places/files.svg'
*
* @returns string
* @since 16.0
*/
public function getIcon() {
return $this->url->imagePath('files_opds', 'files_opds-dark.svg');
}
/**
* returns the ID of the section. It is supposed to be a lower case string,
* e.g. 'ldap'
*
* @returns string
* @since 16.0
*/
public function getID() {
return 'files_opds';
}
/**
* returns the translated name as it should be displayed, e.g. 'LDAP / AD
* integration'. Use the L10N service to translate it.
*
* @return string
* @since 16.0
*/
public function getName() {
return $this->l->t('OPDS Library');
}
/**
* @return int whether the form should be rather on the top or bottom of
* the settings navigation. The sections are arranged in ascending order of
* the priority values. It is required to return a value between 0 and 99.
*
* E.g.: 70
* @since 16.0
*/
public function getPriority() {
return 10;
}
}

View file

@ -25,7 +25,7 @@ class Config
* @return string retrieved value or default * @return string retrieved value or default
*/ */
public static function get($key, $default) { public static function get($key, $default) {
return \OCP\Config::getUserValue(\OCP\User::getUser(), 'files_opds', $key, $default); return \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), 'files_opds', $key, $default);
} }
/** /**
@ -36,7 +36,7 @@ class Config
* @return bool success * @return bool success
*/ */
public static function set($key, $value) { public static function set($key, $value) {
return \OCP\Config::setUserValue(\OCP\User::getUser(), 'files_opds', $key, $value); return \OC::$server->getConfig()->setUserValue(\OC_User::getUser(), 'files_opds', $key, $value);
} }
/** /**
@ -47,7 +47,7 @@ class Config
* @return string retrieved value or default * @return string retrieved value or default
*/ */
public static function getApp($key, $default) { public static function getApp($key, $default) {
return \OCP\Config::getAppValue('files_opds', $key, $default); return \OC::$server->getConfig()->getAppValue('files_opds', $key, $default);
} }
/** /**
@ -58,7 +58,7 @@ class Config
* @return bool success * @return bool success
*/ */
public static function setApp($key, $value) { public static function setApp($key, $value) {
return \OCP\Config::setAppValue('files_opds', $key, $value); return \OC::$server->getConfig()->setAppValue('files_opds', $key, $value);
} }
/** /**
@ -68,7 +68,7 @@ class Config
* @return bool (true = enabled, false = disabled) * @return bool (true = enabled, false = disabled)
*/ */
public static function getPreview($format) { public static function getPreview($format) {
$enablePreviewProviders = \OCP\Config::getSystemValue('enabledPreviewProviders', null); $enablePreviewProviders = \OC::$server->getConfig()->getSystemValue('enabledPreviewProviders', null);
if (!($enablePreviewProviders === null)) { if (!($enablePreviewProviders === null)) {
return in_array($format, $enablePreviewProviders); return in_array($format, $enablePreviewProviders);
} }
@ -83,7 +83,7 @@ class Config
* @return bool * @return bool
*/ */
public static function setPreview($format, $enable = 'false') { public static function setPreview($format, $enable = 'false') {
$enablePreviewProviders = \OCP\Config::getSystemValue('enabledPreviewProviders', null); $enablePreviewProviders = \OC::$server->getConfig()->getSystemValue('enabledPreviewProviders', null);
if ($enable == 'true') { if ($enable == 'true') {
if ($enablePreviewProviders === null) { if ($enablePreviewProviders === null) {
// set up default providers // set up default providers
@ -103,8 +103,8 @@ class Config
} }
} }
if (!(\OCP\Config::setSystemValue('enabledPreviewProviders', $enablePreviewProviders))) { if (!(\OC::$server->getConfig()->setSystemValue('enabledPreviewProviders', $enablePreviewProviders))) {
logWarn("Failed to enable " . $format . " preview provider (config.php readonly?)"); Util::logWarn("Failed to enable " . $format . " preview provider (config.php readonly?)");
return true; return true;
} }
} }

View file

@ -34,7 +34,7 @@ class Feed
* @param int $id file id * @param int $id file id
*/ */
public static function serveFile($path, $id) { public static function serveFile($path, $id) {
\OCP\User::checkLoggedIn(); \OC_JSON::checkLoggedIn();
\OC::$server->getSession()->close(); \OC::$server->getSession()->close();
Bookshelf::add($id); Bookshelf::add($id);
$dirName = dirname($path); $dirName = dirname($path);
@ -66,8 +66,8 @@ class Feed
$tmpl->assign('id', $id); $tmpl->assign('id', $id);
$tmpl->assign('type', $type); $tmpl->assign('type', $type);
$tmpl->assign('dir', $dir); $tmpl->assign('dir', $dir);
$tmpl->assign('user', \OCP\User::getDisplayName()); $tmpl->assign('user', \OC_User::getDisplayName());
$tmpl->assign('feed_title', Config::get('feed_title',\OCP\User::getDisplayName() . "'s Library")); $tmpl->assign('feed_title', Config::get('feed_title',\OC_User::getDisplayName() . "'s Library"));
$tmpl->assign('feed_subtitle', Config::getApp('feed_subtitle', $defaults->getName() . " OPDS catalog")); $tmpl->assign('feed_subtitle', Config::getApp('feed_subtitle', $defaults->getName() . " OPDS catalog"));
$tmpl->assign('feed_updated', time()); $tmpl->assign('feed_updated', time());
$tmpl->printPage(); $tmpl->printPage();
@ -82,7 +82,7 @@ class Feed
* @param string type type of preview requested * @param string type type of preview requested
*/ */
public static function servePreview($path, $type) { public static function servePreview($path, $type) {
\OCP\User::checkLoggedIn(); \OC_Join::checkLoggedIn();
\OC::$server->getSession()->close(); \OC::$server->getSession()->close();
$i = \OC\Files\Filesystem::getFileInfo($path,false); $i = \OC\Files\Filesystem::getFileInfo($path,false);

View file

@ -11,6 +11,7 @@
*/ */
namespace OCA\Files_Opds; namespace OCA\Files_Opds;
use OCP\ILogger;
/** /**
* Meta (data) class for OPDS * Meta (data) class for OPDS
@ -61,13 +62,13 @@ class Meta
* *
* @return array or false * @return array or false
*/ */
protected static function load($id) { protected static function xload($id) {
$sql = 'SELECT * FROM `*PREFIX*opds_metadata` WHERE id = ?'; $sql = 'SELECT * FROM `*PREFIX*opds_metadata` WHERE id = ?';
$args = array($id); $args = array($id);
$query = \OCP\DB::prepare($sql); $query = \OC_DB::prepare($sql);
$result = $query->execute($args); $result = $query->execute($args);
return ($row = $result->fetchRow()) ? $row : false; return ($row = $result->fetch()) ? $row : false;
} }
/** /**
@ -79,9 +80,9 @@ class Meta
protected static function save($meta) { protected static function save($meta) {
$sql = "SELECT `id` FROM *PREFIX*opds_metadata WHERE `id`=?"; $sql = "SELECT `id` FROM *PREFIX*opds_metadata WHERE `id`=?";
$args = array($meta['id']); $args = array($meta['id']);
$query = \OCP\DB::prepare($sql); $query = \OC_DB::prepare($sql);
$result = $query->execute($args); $result = $query->execute($args);
$data = $result->fetchRow(); $data = $result->fetch();
if (isset($data['id'])) { if (isset($data['id'])) {
$sql = "UPDATE *PREFIX*opds_metadata SET `updated`=?, `date`=?, `author`=?, `title`=?, `language`=?, `publisher`=?, `isbn`=?, `copyright`=?, `description`=?, `subjects`=?, `cover`=?, `rescan`=? WHERE id=?"; $sql = "UPDATE *PREFIX*opds_metadata SET `updated`=?, `date`=?, `author`=?, `title`=?, `language`=?, `publisher`=?, `isbn`=?, `copyright`=?, `description`=?, `subjects`=?, `cover`=?, `rescan`=? WHERE id=?";
$args = array( $args = array(
@ -99,7 +100,6 @@ class Meta
$meta['rescan'], $meta['rescan'],
$meta['id'] $meta['id']
); );
} else { } else {
$sql = "INSERT INTO *PREFIX*opds_metadata (`id`, `updated`, `date`, `author`, `title`, `language`, `publisher`, `isbn`, `copyright`, `description`, `subjects`, `cover`, `rescan`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)"; $sql = "INSERT INTO *PREFIX*opds_metadata (`id`, `updated`, `date`, `author`, `title`, `language`, `publisher`, `isbn`, `copyright`, `description`, `subjects`, `cover`, `rescan`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)";
$args = array( $args = array(
@ -117,8 +117,9 @@ class Meta
$meta['cover'], $meta['cover'],
$meta['rescan'] $meta['rescan']
); );
} }
$query = \OCP\DB::prepare($sql); $query = \OC_DB::prepare($sql);
return $query->execute($args); return $query->execute($args);
} }
@ -132,7 +133,7 @@ class Meta
* @return array of metadata * @return array of metadata
*/ */
public static function get($id) { public static function get($id) {
if (!($meta = self::load($id)) || (isset($meta['rescan']) && time() > strtotime($meta['rescan']))) { if (!($meta = self::xload($id)) || (isset($meta['rescan']) && time() > strtotime($meta['rescan']))) {
if(isset($meta['rescan'])) { if(isset($meta['rescan'])) {
$meta['rescan'] = null; $meta['rescan'] = null;
} }
@ -150,7 +151,7 @@ class Meta
public static function remove($id) { public static function remove($id) {
$sql = "DELETE FROM *PREFIX*opds_metadata WHERE `id`=?"; $sql = "DELETE FROM *PREFIX*opds_metadata WHERE `id`=?";
$args = array($id); $args = array($id);
$query = \OCP\DB::prepare($sql); $query = \OC_DB::prepare($sql);
return $query->execute($args); return $query->execute($args);
} }
@ -162,7 +163,7 @@ class Meta
public static function rescan() { public static function rescan() {
$sql = "UPDATE *PREFIX*opds_metadata SET `rescan`=?"; $sql = "UPDATE *PREFIX*opds_metadata SET `rescan`=?";
$args = array(date("Y-m-d H:i:s")); $args = array(date("Y-m-d H:i:s"));
$query = \OCP\DB::prepare($sql); $query = \OC_DB::prepare($sql);
$result = $query->execute($args); $result = $query->execute($args);
} }
@ -229,7 +230,7 @@ class Meta
$meta['subjects'] = json_encode($epub->Subjects()); $meta['subjects'] = json_encode($epub->Subjects());
} }
} catch (\Exception $e) { } catch (\Exception $e) {
\OCP\Util::writeLog(get_class(), $e->getMessage(), \OCP\Util::ERROR); \OCP\Util::writeLog(get_class(), $e->getMessage(), ILogger::ERROR);
} }
} }
@ -257,7 +258,7 @@ class Meta
$meta['subjects'] = json_encode($fb2->Subjects()); $meta['subjects'] = json_encode($fb2->Subjects());
} }
} catch (\Exception $e) { } catch (\Exception $e) {
\OCP\Util::writeLog(get_class(), $e->getMessage(), \OCP\Util::ERROR); \OCP\Util::writeLog(get_class(), $e->getMessage(), ILogger::ERROR);
} }
} }

View file

@ -14,6 +14,7 @@ namespace OCA\Files_Opds;
use OC\Authentication\Exceptions\PasswordLoginForbiddenException; use OC\Authentication\Exceptions\PasswordLoginForbiddenException;
use OC\User\LoginException; use OC\User\LoginException;
use OCP\ILogger;
/** /**
* Utility class for OPDS * Utility class for OPDS
@ -113,7 +114,7 @@ class Util
*/ */
public static function genUuid() { public static function genUuid() {
$defaults = new \OC_Defaults(); $defaults = new \OC_Defaults();
$hash = md5(\OCP\User::getDisplayName() . $defaults->getBaseUrl()); $hash = md5(\OC_User::getDisplayName() . $defaults->getBaseUrl());
$hash = substr($hash, 0, 8 ) .'-'. $hash = substr($hash, 0, 8 ) .'-'.
substr($hash, 8, 4) .'-3'. substr($hash, 8, 4) .'-3'.
substr($hash, 13, 3) .'-9'. substr($hash, 13, 3) .'-9'.
@ -127,6 +128,6 @@ class Util
* @param string message to write to log * @param string message to write to log
*/ */
public static function logWarn($msg) { public static function logWarn($msg) {
\OCP\Util::writeLog('files_opds', $msg, \OCP\Util::WARN); \OCP\Util::writeLog('files_opds', $msg, ILogger::WARN);
} }
} }

View file

@ -14,7 +14,7 @@ use OCP\Util;
$l = \OC::$server->getL10N('files_opds'); $l = \OC::$server->getL10N('files_opds');
#\OCP\Util::addScript('files_opds', 'personal'); \OCP\Util::addScript('files_opds', 'personal');
$tmpl = new \OCP\Template('files_opds', 'personal'); $tmpl = new \OCP\Template('files_opds', 'personal');
$opdsEnable = Config::get('enable', false); $opdsEnable = Config::get('enable', false);
@ -23,7 +23,7 @@ $tmpl->assign('opdsEnable-value', ($opdsEnable === 'true') ? '1' : '0');
$tmpl->assign('rootPath', Config::get('root_path', '/Library')); $tmpl->assign('rootPath', Config::get('root_path', '/Library'));
$tmpl->assign('fileTypes', Config::get('file_types', '')); $tmpl->assign('fileTypes', Config::get('file_types', ''));
$tmpl->assign('skipList', Config::get('skip_list', 'metadata.opf,cover.jpg')); $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('feedTitle', Config::get('feed_title', $l->t("%s's Library", \OC_User::getDisplayName())));
$tmpl->assign('bookshelf-count', Bookshelf::count()); $tmpl->assign('bookshelf-count', Bookshelf::count());
$tmpl->assign('feedUrl', Util::linkToAbsolute('','index.php') . '/apps/files_opds/'); $tmpl->assign('feedUrl', Util::linkToAbsolute('','index.php') . '/apps/files_opds/');

View file

@ -48,7 +48,7 @@ switch ($_['type']) {
case 'bookshelf': case 'bookshelf':
foreach ($_['bookshelf'] as $file) { foreach ($_['bookshelf'] as $file) {
print_unescaped($this->inc('part.feed.acquisition', [ 'file' => $file ])); print_unescaped($this->inc('part.feed.acquisition', [ 'xfile' => $file ]));
} }
break; break;
@ -61,9 +61,9 @@ switch ($_['type']) {
default: default:
foreach ($_['files'] as $file) { foreach ($_['files'] as $file) {
if ($file['type'] == 'dir') { if ($file['type'] == 'dir') {
print_unescaped($this->inc('part.feed.navigation', [ 'file' => $file ])); print_unescaped($this->inc('part.feed.navigation', [ 'xfile' => $file ]));
} else { } else {
print_unescaped($this->inc('part.feed.acquisition', [ 'file' => $file ])); print_unescaped($this->inc('part.feed.acquisition', [ 'xfile' => $file ]));
} }
} }
break; break;

View file

@ -1,38 +1,38 @@
<entry> <entry>
<title><?php p($_['file']['meta']['title']); ?></title> <title><?php p($_['xfile']['meta']['title']); ?></title>
<updated><?php p(date("Y-m-d\TH:i:sP",strtotime($_['file']['meta']['updated']))); ?></updated> <updated><?php p(date("Y-m-d\TH:i:sP",strtotime($_['file']['meta']['updated']))); ?></updated>
<id>id:<?php p($_['file']['id']); ?></id> <id>id:<?php p($_['xfile']['id']); ?></id>
<dcterms:extent><?php p($_['file']['humansize']); ?></dcterms:extent> <dcterms:extent><?php p($_['xfile']['humansize']); ?></dcterms:extent>
<?php $authors = json_decode($_['file']['meta']['author'],true); if(is_array($authors)): foreach ($authors as $author): ?> <?php $authors = json_decode($_['xfile']['meta']['author'],true); if(is_array($authors)): foreach ($authors as $author): ?>
<author> <author>
<name><?php p($author); ?></name> <name><?php p($author); ?></name>
</author> </author>
<?php endforeach; endif; ?> <?php endforeach; endif; ?>
<?php if($_['file']['meta']['isbn']): ?> <?php if($_['xfile']['meta']['isbn']): ?>
<dc:identifier>urn:isbn:<?php p($_['file']['meta']['isbn']); ?></dc:identifier> <dc:identifier>urn:isbn:<?php p($_['xfile']['meta']['isbn']); ?></dc:identifier>
<?php endif; ?> <?php endif; ?>
<?php if($_['file']['meta']['publisher']): ?> <?php if($_['xfile']['meta']['publisher']): ?>
<dc:publisher><?php p($_['file']['meta']['publisher']); ?></dc:publisher> <dc:publisher><?php p($_['xfile']['meta']['publisher']); ?></dc:publisher>
<?php endif; ?> <?php endif; ?>
<?php if($_['file']['meta']['language']): ?> <?php if($_['xfile']['meta']['language']): ?>
<dc:language><?php p($_['file']['meta']['language']); ?></dc:language> <dc:language><?php p($_['xfile']['meta']['language']); ?></dc:language>
<?php endif; ?> <?php endif; ?>
<dc:issued><?php p(date("Y-m-d\TH:i:sP",strtotime($_['file']['meta']['date']))); ?></dc:issued> <dc:issued><?php p(date("Y-m-d\TH:i:sP",strtotime($_['xfile']['meta']['date']))); ?></dc:issued>
<link type="<?php p($_['file']['mimetype']); ?>" <link type="<?php p($_['xfile']['mimetype']); ?>"
rel="alternate" rel="alternate"
href="?id=<?php p($_['file']['id']); ?>"/> href="?id=<?php p($_['xfile']['id']); ?>"/>
<link type="<?php p($_['file']['mimetype']); ?>" <link type="<?php p($_['xfile']['mimetype']); ?>"
rel="http://opds-spec.org/acquisition/open-access" rel="http://opds-spec.org/acquisition/open-access"
href="?id=<?php p($_['file']['id']); ?>"/> href="?id=<?php p($_['xfile']['id']); ?>"/>
<link href="?pid=<?php p($_['file']['id']); ?>" <link href="?pid=<?php p($_['xfile']['id']); ?>"
rel="http://opds-spec.org/image" rel="http://opds-spec.org/image"
type="image/jpeg" /> type="image/jpeg" />
<link href="?tid=<?php p($_['file']['id']); ?>" <link href="?tid=<?php p($_['xfile']['id']); ?>"
rel="http://opds-spec.org/image/thumbnail" rel="http://opds-spec.org/image/thumbnail"
type="image/jpeg" /> type="image/jpeg" />
<?php if ($_['file']['meta']['description']): ?> <?php if ($_['xfile']['meta']['description']): ?>
<content type="text"><?php p($_['file']['meta']['description']); p("\n\n"); ?><?php p(formatMetadata($_['file']['humansize'],$_['file']['mimetype'],$_['file']['name'])); ?></content> <content type="text"><?php p($_['xfile']['meta']['description']); p("\n\n"); ?><?php p(formatMetadata($_['xfile']['humansize'],$_['xfile']['mimetype'],$_['xfile']['name'])); ?></content>
<?php else: ?> <?php else: ?>
<summary type="text"><?php p(formatMetadata($_['file']['humansize'],$_['file']['mimetype'],$_['file']['name'])); ?></summary> <summary type="text"><?php p(formatMetadata($_['xfile']['humansize'],$_['xfile']['mimetype'],$_['xfile']['name'])); ?></summary>
<?php endif; ?> <?php endif; ?>
</entry> </entry>

View file

@ -1,12 +1,12 @@
<entry> <entry>
<title><?php p($_['file']['name']); ?></title> <title><?php p($_['xfile']['name']); ?></title>
<updated><?php p(date("Y-m-d\TH:i:sP", $_['file']['mtime'])); ?></updated> <updated><?php p(date("Y-m-d\TH:i:sP", $_['file']['mtime'])); ?></updated>
<id>id:<?php p($_['file']['id']); ?></id> <id>id:<?php p($_['xfile']['id']); ?></id>
<link type="application/atom+xml;profile=opds-catalog;kind=navigation" <link type="application/atom+xml;profile=opds-catalog;kind=navigation"
rel="alternate" rel="alternate"
href="?id=<?php p($_['file']['id']); ?>"/> href="?id=<?php p($_['xfile']['id']); ?>"/>
<link type="application/atom+xml;profile=opds-catalog;kind=navigation" <link type="application/atom+xml;profile=opds-catalog;kind=navigation"
rel="subsection" rel="subsection"
href="?id=<?php p($_['file']['id']); ?>"/> href="?id=<?php p($_['xfile']['id']); ?>"/>
<content type="text"></content> <content type="text"></content>
</entry> </entry>